@@ -705,6 +705,7 @@ impl<'a, 'b:'a, 'c: 'b> ImportResolver<'a, 'b, 'c> {
705
705
}
706
706
}
707
707
708
+ let uniform_paths_feature = self . session . features_untracked ( ) . uniform_paths ;
708
709
for ( ( span, _) , ( name, results) ) in uniform_paths_canaries {
709
710
self . per_ns ( |this, ns| {
710
711
let results = & results[ ns] ;
@@ -736,15 +737,24 @@ impl<'a, 'b:'a, 'c: 'b> ImportResolver<'a, 'b, 'c> {
736
737
suggestion_choices. push_str ( " or " ) ;
737
738
}
738
739
write ! ( suggestion_choices, "`self::{}`" , name) ;
739
- err. span_label ( span,
740
- format ! ( "can refer to `self::{}`" , name) ) ;
740
+ if uniform_paths_feature {
741
+ err. span_label ( span,
742
+ format ! ( "can refer to `self::{}`" , name) ) ;
743
+ } else {
744
+ err. span_label ( span,
745
+ format ! ( "may refer to `self::{}` in the future" , name) ) ;
746
+ }
741
747
}
742
748
for & span in & results. block_scopes {
743
749
err. span_label ( span,
744
750
format ! ( "shadowed by block-scoped `{}`" , name) ) ;
745
751
}
746
752
err. help ( & format ! ( "write {} explicitly instead" , suggestion_choices) ) ;
747
- err. note ( "relative `use` paths enabled by `#![feature(uniform_paths)]`" ) ;
753
+ if uniform_paths_feature {
754
+ err. note ( "relative `use` paths enabled by `#![feature(uniform_paths)]`" ) ;
755
+ } else {
756
+ err. note ( "in the future, `#![feature(uniform_paths)]` may become the default" ) ;
757
+ }
748
758
err. emit ( ) ;
749
759
} ) ;
750
760
}
@@ -930,11 +940,15 @@ impl<'a, 'b:'a, 'c: 'b> ImportResolver<'a, 'b, 'c> {
930
940
_ => unreachable ! ( ) ,
931
941
} ;
932
942
943
+ // Do not record uses from canaries, to avoid interfering with other
944
+ // diagnostics or suggestions that rely on some items not being used.
945
+ let record_used = !directive. is_uniform_paths_canary ;
946
+
933
947
let mut all_ns_err = true ;
934
948
self . per_ns ( |this, ns| if !type_ns_only || ns == TypeNS {
935
949
if let Ok ( binding) = result[ ns] . get ( ) {
936
950
all_ns_err = false ;
937
- if this. record_use ( ident, ns, binding) {
951
+ if record_used && this. record_use ( ident, ns, binding) {
938
952
if let ModuleOrUniformRoot :: Module ( module) = module {
939
953
this. resolution ( module, ident, ns) . borrow_mut ( ) . binding =
940
954
Some ( this. dummy_binding ) ;
@@ -946,7 +960,7 @@ impl<'a, 'b:'a, 'c: 'b> ImportResolver<'a, 'b, 'c> {
946
960
if all_ns_err {
947
961
let mut all_ns_failed = true ;
948
962
self . per_ns ( |this, ns| if !type_ns_only || ns == TypeNS {
949
- match this. resolve_ident_in_module ( module, ident, ns, true , span) {
963
+ match this. resolve_ident_in_module ( module, ident, ns, record_used , span) {
950
964
Ok ( _) => all_ns_failed = false ,
951
965
_ => { }
952
966
}
0 commit comments