@@ -708,6 +708,7 @@ impl<'a, 'b:'a, 'c: 'b> ImportResolver<'a, 'b, 'c> {
708708 }
709709 }
710710
711+ let uniform_paths_feature = self . session . features_untracked ( ) . uniform_paths ;
711712 for ( ( span, _) , ( name, results) ) in uniform_paths_canaries {
712713 self . per_ns ( |this, ns| {
713714 let results = & results[ ns] ;
@@ -739,15 +740,24 @@ impl<'a, 'b:'a, 'c: 'b> ImportResolver<'a, 'b, 'c> {
739740 suggestion_choices. push_str ( " or " ) ;
740741 }
741742 write ! ( suggestion_choices, "`self::{}`" , name) ;
742- err. span_label ( span,
743- format ! ( "can refer to `self::{}`" , name) ) ;
743+ if uniform_paths_feature {
744+ err. span_label ( span,
745+ format ! ( "can refer to `self::{}`" , name) ) ;
746+ } else {
747+ err. span_label ( span,
748+ format ! ( "may refer to `self::{}` in the future" , name) ) ;
749+ }
744750 }
745751 for & span in & results. block_scopes {
746752 err. span_label ( span,
747753 format ! ( "shadowed by block-scoped `{}`" , name) ) ;
748754 }
749755 err. help ( & format ! ( "write {} explicitly instead" , suggestion_choices) ) ;
750- err. note ( "relative `use` paths enabled by `#![feature(uniform_paths)]`" ) ;
756+ if uniform_paths_feature {
757+ err. note ( "relative `use` paths enabled by `#![feature(uniform_paths)]`" ) ;
758+ } else {
759+ err. note ( "in the future, `#![feature(uniform_paths)]` may become the default" ) ;
760+ }
751761 err. emit ( ) ;
752762 } ) ;
753763 }
@@ -933,11 +943,15 @@ impl<'a, 'b:'a, 'c: 'b> ImportResolver<'a, 'b, 'c> {
933943 _ => unreachable ! ( ) ,
934944 } ;
935945
946+ // Do not record uses from canaries, to avoid interfering with other
947+ // diagnostics or suggestions that rely on some items not being used.
948+ let record_used = !directive. is_uniform_paths_canary ;
949+
936950 let mut all_ns_err = true ;
937951 self . per_ns ( |this, ns| if !type_ns_only || ns == TypeNS {
938952 if let Ok ( binding) = result[ ns] . get ( ) {
939953 all_ns_err = false ;
940- if this. record_use ( ident, ns, binding, directive. span ) {
954+ if record_used && this. record_use ( ident, ns, binding, directive. span ) {
941955 if let ModuleOrUniformRoot :: Module ( module) = module {
942956 this. resolution ( module, ident, ns) . borrow_mut ( ) . binding =
943957 Some ( this. dummy_binding ) ;
@@ -949,7 +963,7 @@ impl<'a, 'b:'a, 'c: 'b> ImportResolver<'a, 'b, 'c> {
949963 if all_ns_err {
950964 let mut all_ns_failed = true ;
951965 self . per_ns ( |this, ns| if !type_ns_only || ns == TypeNS {
952- match this. resolve_ident_in_module ( module, ident, ns, true , span) {
966+ match this. resolve_ident_in_module ( module, ident, ns, record_used , span) {
953967 Ok ( _) => all_ns_failed = false ,
954968 _ => { }
955969 }
0 commit comments