@@ -572,7 +572,7 @@ impl<'a> Resolver<'a> {
572
572
ScopeSet :: Module => ( TypeNS , None , false , false ) ,
573
573
} ;
574
574
let mut where_to_resolve = match ns {
575
- _ if is_absolute_path || is_import && rust_2015 => WhereToResolve :: CrateRoot ,
575
+ _ if is_absolute_path => WhereToResolve :: CrateRoot ,
576
576
TypeNS | ValueNS => WhereToResolve :: Module ( parent_scope. module ) ,
577
577
MacroNS => WhereToResolve :: DeriveHelpers ,
578
578
} ;
@@ -770,8 +770,6 @@ impl<'a> Resolver<'a> {
770
770
771
771
let ambiguity_error_kind = if is_import {
772
772
Some ( AmbiguityKind :: Import )
773
- } else if is_absolute_path {
774
- Some ( AmbiguityKind :: AbsolutePath )
775
773
} else if innermost_def == builtin || def == builtin {
776
774
Some ( AmbiguityKind :: BuiltinAttr )
777
775
} else if innermost_def == derive_helper || def == derive_helper {
@@ -841,18 +839,13 @@ impl<'a> Resolver<'a> {
841
839
LegacyScope :: Empty => WhereToResolve :: Module ( parent_scope. module ) ,
842
840
LegacyScope :: Uninitialized => unreachable ! ( ) ,
843
841
}
844
- WhereToResolve :: CrateRoot if is_import => match ns {
845
- TypeNS | ValueNS => WhereToResolve :: Module ( parent_scope. module ) ,
846
- MacroNS => WhereToResolve :: DeriveHelpers ,
847
- }
848
- WhereToResolve :: CrateRoot if is_absolute_path => match ns {
842
+ WhereToResolve :: CrateRoot => match ns {
849
843
TypeNS => {
850
844
ident. span . adjust ( Mark :: root ( ) ) ;
851
845
WhereToResolve :: ExternPrelude
852
846
}
853
847
ValueNS | MacroNS => break ,
854
848
}
855
- WhereToResolve :: CrateRoot => unreachable ! ( ) ,
856
849
WhereToResolve :: Module ( module) => {
857
850
match self . hygienic_lexical_parent ( module, & mut ident. span ) {
858
851
Some ( parent_module) => WhereToResolve :: Module ( parent_module) ,
@@ -885,44 +878,7 @@ impl<'a> Resolver<'a> {
885
878
}
886
879
887
880
// The first found solution was the only one, return it.
888
- if let Some ( ( binding, flags) ) = innermost_result {
889
- // We get to here only if there's no ambiguity, in ambiguous cases an error will
890
- // be reported anyway, so there's no reason to report an additional feature error.
891
- // The `binding` can actually be introduced by something other than `--extern`,
892
- // but its `Def` should coincide with a crate passed with `--extern`
893
- // (otherwise there would be ambiguity) and we can skip feature error in this case.
894
- ' ok: {
895
- if !is_import || !rust_2015 {
896
- break ' ok;
897
- }
898
- if ns == TypeNS && use_prelude && self . extern_prelude_get ( ident, true ) . is_some ( ) {
899
- break ' ok;
900
- }
901
- let root_ident = Ident :: new ( keywords:: PathRoot . name ( ) , orig_ident. span ) ;
902
- let root_module = self . resolve_crate_root ( root_ident) ;
903
- if self . resolve_ident_in_module_ext ( ModuleOrUniformRoot :: Module ( root_module) ,
904
- orig_ident, ns, None , false , path_span)
905
- . is_ok ( ) {
906
- break ' ok;
907
- }
908
-
909
- let msg = "imports can only refer to extern crate names passed with \
910
- `--extern` in macros originating from 2015 edition";
911
- let mut err = self . session . struct_span_err ( ident. span , msg) ;
912
- let what = self . binding_description ( binding, ident,
913
- flags. contains ( Flags :: MISC_FROM_PRELUDE ) ) ;
914
- let note_msg = format ! ( "this import refers to {what}" , what = what) ;
915
- let label_span = if binding. span . is_dummy ( ) {
916
- err. note ( & note_msg) ;
917
- ident. span
918
- } else {
919
- err. span_note ( binding. span , & note_msg) ;
920
- binding. span
921
- } ;
922
- err. span_label ( label_span, "not an extern crate passed with `--extern`" ) ;
923
- err. emit ( ) ;
924
- }
925
-
881
+ if let Some ( ( binding, _) ) = innermost_result {
926
882
return Ok ( binding) ;
927
883
}
928
884
0 commit comments