@@ -327,26 +327,22 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
327327 ) ;
328328 }
329329 if let Some ( span) = tcx. resolutions ( ( ) ) . confused_type_with_std_module . get ( & span) {
330- if let Ok ( snippet) = tcx. sess . source_map ( ) . span_to_snippet ( * span) {
331- err. span_suggestion (
332- * span,
333- "you are looking for the module in `std`, \
334- not the primitive type",
335- format ! ( "std::{}" , snippet) ,
336- Applicability :: MachineApplicable ,
337- ) ;
338- }
330+ err. span_suggestion (
331+ span. shrink_to_lo ( ) ,
332+ "you are looking for the module in `std`, not the primitive type" ,
333+ "std::" . to_string ( ) ,
334+ Applicability :: MachineApplicable ,
335+ ) ;
339336 }
340337 if let ty:: RawPtr ( _) = & actual. kind ( ) {
341338 err. note (
342339 "try using `<*const T>::as_ref()` to get a reference to the \
343- type behind the pointer: https://doc.rust-lang.org/std/\
344- primitive.pointer.html#method.as_ref",
340+ type behind the pointer: https://doc.rust-lang.org/std/\
341+ primitive.pointer.html#method.as_ref",
345342 ) ;
346343 err. note (
347- "using `<*const T>::as_ref()` on a pointer \
348- which is unaligned or points to invalid \
349- or uninitialized memory is undefined behavior",
344+ "using `<*const T>::as_ref()` on a pointer which is unaligned or points \
345+ to invalid or uninitialized memory is undefined behavior",
350346 ) ;
351347 }
352348
0 commit comments