@@ -708,6 +708,7 @@ impl<'a, 'b:'a, 'c: 'b> ImportResolver<'a, 'b, 'c> {
708
708
}
709
709
}
710
710
711
+ let uniform_paths_feature = self . session . features_untracked ( ) . uniform_paths ;
711
712
for ( ( span, _) , ( name, results) ) in uniform_paths_canaries {
712
713
self . per_ns ( |this, ns| {
713
714
let results = & results[ ns] ;
@@ -739,15 +740,24 @@ impl<'a, 'b:'a, 'c: 'b> ImportResolver<'a, 'b, 'c> {
739
740
suggestion_choices. push_str ( " or " ) ;
740
741
}
741
742
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
+ }
744
750
}
745
751
for & span in & results. block_scopes {
746
752
err. span_label ( span,
747
753
format ! ( "shadowed by block-scoped `{}`" , name) ) ;
748
754
}
749
755
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
+ }
751
761
err. emit ( ) ;
752
762
} ) ;
753
763
}
@@ -933,11 +943,15 @@ impl<'a, 'b:'a, 'c: 'b> ImportResolver<'a, 'b, 'c> {
933
943
_ => unreachable ! ( ) ,
934
944
} ;
935
945
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
+
936
950
let mut all_ns_err = true ;
937
951
self . per_ns ( |this, ns| if !type_ns_only || ns == TypeNS {
938
952
if let Ok ( binding) = result[ ns] . get ( ) {
939
953
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 ) {
941
955
if let ModuleOrUniformRoot :: Module ( module) = module {
942
956
this. resolution ( module, ident, ns) . borrow_mut ( ) . binding =
943
957
Some ( this. dummy_binding ) ;
@@ -949,7 +963,7 @@ impl<'a, 'b:'a, 'c: 'b> ImportResolver<'a, 'b, 'c> {
949
963
if all_ns_err {
950
964
let mut all_ns_failed = true ;
951
965
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) {
953
967
Ok ( _) => all_ns_failed = false ,
954
968
_ => { }
955
969
}
0 commit comments