From bd4a5541e262cbf76cef5e3461f3e578f567dfb8 Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Thu, 17 Jan 2019 02:17:22 +0300 Subject: [PATCH] resolve: Fallback to extern crates in absolute paths on 2015 edition --- src/librustc_resolve/build_reduced_graph.rs | 3 +- src/librustc_resolve/lib.rs | 29 ++++++------- src/librustc_resolve/macros.rs | 41 +------------------ src/librustc_resolve/resolve_imports.rs | 8 ++++ .../run-make-fulldeps/extern-prelude/Makefile | 3 +- ...-38054-do-not-show-unresolved-names.stderr | 4 +- src/test/ui/editions/edition-imports-2018.rs | 3 +- .../ui/editions/edition-imports-2018.stderr | 10 ----- .../edition-imports-virtual-2015-ambiguity.rs | 4 +- ...tion-imports-virtual-2015-ambiguity.stderr | 40 ------------------ .../edition-imports-virtual-2015-gated.rs | 3 +- .../edition-imports-virtual-2015-gated.stderr | 19 +++------ src/test/ui/error-codes/E0432.stderr | 2 +- src/test/ui/extenv/issue-55897.stderr | 2 +- .../feature-gate-extern_absolute_paths.rs | 5 ++- .../feature-gate-extern_absolute_paths.stderr | 19 +++------ src/test/ui/hidden-rt-injection.stderr | 2 +- src/test/ui/hidden-rt-injection2.stderr | 2 +- src/test/ui/import.rs | 1 - src/test/ui/import.stderr | 4 +- src/test/ui/import3.stderr | 2 +- src/test/ui/imports/issue-53269.stderr | 2 +- src/test/ui/imports/issue-55457.stderr | 4 +- src/test/ui/inaccessible-test-modules.stderr | 4 +- src/test/ui/issues/issue-1697.rs | 1 - src/test/ui/issues/issue-1697.stderr | 2 +- src/test/ui/issues/issue-28388-1.stderr | 2 +- src/test/ui/issues/issue-33464.stderr | 6 +-- src/test/ui/issues/issue-36881.stderr | 2 +- src/test/ui/issues/issue-37887.stderr | 2 +- .../keyword-extern-as-identifier-use.rs | 1 + .../keyword-extern-as-identifier-use.stderr | 9 +++- .../ui/macros/meta-item-absolute-path.stderr | 4 +- src/test/ui/privacy/restricted/test.rs | 2 +- src/test/ui/privacy/restricted/test.stderr | 6 +-- src/test/ui/quote-with-interpolated.rs | 4 +- src/test/ui/quote-with-interpolated.stderr | 8 ++-- src/test/ui/resolve/issue-5035.rs | 1 - src/test/ui/resolve/issue-5035.stderr | 2 +- .../resolve/resolve-bad-import-prefix.stderr | 2 +- src/test/ui/resolve_self_super_hint.rs | 2 - src/test/ui/resolve_self_super_hint.stderr | 6 +-- .../local-path-suggestions-2015.stderr | 2 +- src/test/ui/span/visibility-ty-params.stderr | 4 +- .../unresolved-import-recovery.stderr | 2 +- src/test/ui/unresolved/unresolved-import.rs | 1 - .../ui/unresolved/unresolved-import.stderr | 12 +++--- src/test/ui/use/use-mod/use-mod-4.stderr | 2 +- 48 files changed, 102 insertions(+), 199 deletions(-) delete mode 100644 src/test/ui/editions/edition-imports-2018.stderr delete mode 100644 src/test/ui/editions/edition-imports-virtual-2015-ambiguity.stderr diff --git a/src/librustc_resolve/build_reduced_graph.rs b/src/librustc_resolve/build_reduced_graph.rs index a452bbf0c9d54..ab9b2f25de539 100644 --- a/src/librustc_resolve/build_reduced_graph.rs +++ b/src/librustc_resolve/build_reduced_graph.rs @@ -129,8 +129,7 @@ impl<'a> Resolver<'a> { // get crate root prepended, but get special treatment during in-scope resolution instead. let is_glob = if let ast::UseTreeKind::Glob = use_tree.kind { true } else { false }; let crate_root = match prefix_iter.peek() { - Some(seg) if !seg.ident.is_path_segment_keyword() && - seg.ident.span.rust_2015() && self.session.rust_2015() => { + Some(seg) if !seg.ident.is_path_segment_keyword() && seg.ident.span.rust_2015() => { Some(seg.ident.span.ctxt()) } None if is_glob && use_tree.span.rust_2015() => { diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index b41193723069c..120b524726c39 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -1243,7 +1243,7 @@ struct UseError<'a> { #[derive(Clone, Copy, PartialEq, Debug)] enum AmbiguityKind { Import, - AbsolutePath, + // AbsolutePath, BuiltinAttr, DeriveHelper, LegacyHelperVsPrelude, @@ -1259,8 +1259,8 @@ impl AmbiguityKind { match self { AmbiguityKind::Import => "name vs any other name during import resolution", - AmbiguityKind::AbsolutePath => - "name in the crate root vs extern crate during absolute path resolution", + // AmbiguityKind::AbsolutePath => + // "name in the crate root vs extern crate during absolute path resolution", AmbiguityKind::BuiltinAttr => "built-in attribute vs any other name", AmbiguityKind::DeriveHelper => @@ -1513,6 +1513,8 @@ pub struct Resolver<'a> { /// FIXME: Refactor things so that these fields are passed through arguments and not resolver. /// We are resolving a last import segment during import validation. last_import_segment: bool, + /// We are resolving a prefix for `use *` or `use ::*` on 2015 edition. + root_glob_import: bool, /// This binding should be ignored during in-module resolution, so that we don't get /// "self-confirming" import resolutions during import validation. blacklisted_binding: Option<&'a NameBinding<'a>>, @@ -1861,6 +1863,7 @@ impl<'a> Resolver<'a> { current_self_type: None, current_self_item: None, last_import_segment: false, + root_glob_import: false, blacklisted_binding: None, primitive_type_table: PrimitiveTypeTable::new(), @@ -3833,19 +3836,17 @@ impl<'a> Resolver<'a> { self.resolve_self(&mut ctxt, self.current_module))); continue; } - if name == keywords::PathRoot.name() && ident.span.rust_2018() { - module = Some(ModuleOrUniformRoot::ExternPrelude); - continue; - } - if name == keywords::PathRoot.name() && - ident.span.rust_2015() && self.session.rust_2018() { - // `::a::b` from 2015 macro on 2018 global edition - module = Some(ModuleOrUniformRoot::CrateRootAndExternPrelude); + if name == keywords::PathRoot.name() { + module = Some(if ident.span.rust_2018() { + ModuleOrUniformRoot::ExternPrelude + } else if !self.root_glob_import { + ModuleOrUniformRoot::CrateRootAndExternPrelude + } else { + ModuleOrUniformRoot::Module(self.resolve_crate_root(ident)) + }); continue; } - if name == keywords::PathRoot.name() || - name == keywords::Crate.name() || - name == keywords::DollarCrate.name() { + if name == keywords::Crate.name() || name == keywords::DollarCrate.name() { // `::a::b`, `crate::a::b` or `$crate::a::b` module = Some(ModuleOrUniformRoot::Module( self.resolve_crate_root(ident))); diff --git a/src/librustc_resolve/macros.rs b/src/librustc_resolve/macros.rs index 286f9a758830b..f358c4d2dd6b2 100644 --- a/src/librustc_resolve/macros.rs +++ b/src/librustc_resolve/macros.rs @@ -709,8 +709,6 @@ impl<'a> Resolver<'a> { let ambiguity_error_kind = if is_import { Some(AmbiguityKind::Import) - } else if is_absolute_path { - Some(AmbiguityKind::AbsolutePath) } else if innermost_def == builtin || def == builtin { Some(AmbiguityKind::BuiltinAttr) } else if innermost_def == derive_helper || def == derive_helper { @@ -824,44 +822,7 @@ impl<'a> Resolver<'a> { } // The first found solution was the only one, return it. - if let Some((binding, flags)) = innermost_result { - // We get to here only if there's no ambiguity, in ambiguous cases an error will - // be reported anyway, so there's no reason to report an additional feature error. - // The `binding` can actually be introduced by something other than `--extern`, - // but its `Def` should coincide with a crate passed with `--extern` - // (otherwise there would be ambiguity) and we can skip feature error in this case. - 'ok: { - if !is_import || !rust_2015 { - break 'ok; - } - if ns == TypeNS && use_prelude && self.extern_prelude_get(ident, true).is_some() { - break 'ok; - } - let root_ident = Ident::new(keywords::PathRoot.name(), orig_ident.span); - let root_module = self.resolve_crate_root(root_ident); - if self.resolve_ident_in_module_ext(ModuleOrUniformRoot::Module(root_module), - orig_ident, ns, None, false, path_span) - .is_ok() { - break 'ok; - } - - let msg = "imports can only refer to extern crate names passed with \ - `--extern` in macros originating from 2015 edition"; - let mut err = self.session.struct_span_err(ident.span, msg); - let what = self.binding_description(binding, ident, - flags.contains(Flags::MISC_FROM_PRELUDE)); - let note_msg = format!("this import refers to {what}", what = what); - let label_span = if binding.span.is_dummy() { - err.note(¬e_msg); - ident.span - } else { - err.span_note(binding.span, ¬e_msg); - binding.span - }; - err.span_label(label_span, "not an extern crate passed with `--extern`"); - err.emit(); - } - + if let Some((binding, _)) = innermost_result { return Ok(binding); } diff --git a/src/librustc_resolve/resolve_imports.rs b/src/librustc_resolve/resolve_imports.rs index fd55897522bf7..6957f13f7ee9b 100644 --- a/src/librustc_resolve/resolve_imports.rs +++ b/src/librustc_resolve/resolve_imports.rs @@ -765,6 +765,9 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> { } else { // For better failure detection, pretend that the import will // not define any names while resolving its module path. + let orig_root_glob_import = mem::replace( + &mut self.root_glob_import, directive.is_glob() && directive.module_path.len() == 1 + ); let orig_vis = directive.vis.replace(ty::Visibility::Invisible); let path_res = self.resolve_path( &directive.module_path, @@ -775,6 +778,7 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> { directive.crate_lint(), ); directive.vis.set(orig_vis); + self.root_glob_import = orig_root_glob_import; match path_res { PathResult::Module(module) => module, @@ -850,12 +854,16 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> { ) -> Option<(Span, String, Option)> { self.current_module = directive.parent_scope.module; + let orig_root_glob_import = mem::replace( + &mut self.root_glob_import, directive.is_glob() && directive.module_path.len() == 1 + ); let orig_vis = directive.vis.replace(ty::Visibility::Invisible); let prev_ambiguity_errors_len = self.ambiguity_errors.len(); let path_res = self.resolve_path(&directive.module_path, None, &directive.parent_scope, true, directive.span, directive.crate_lint()); let no_ambiguity = self.ambiguity_errors.len() == prev_ambiguity_errors_len; directive.vis.set(orig_vis); + self.root_glob_import = orig_root_glob_import; let module = match path_res { PathResult::Module(module) => { // Consistency checks, analogous to `finalize_current_module_macro_resolutions`. diff --git a/src/test/run-make-fulldeps/extern-prelude/Makefile b/src/test/run-make-fulldeps/extern-prelude/Makefile index 69af01ccf0369..920cf55818761 100644 --- a/src/test/run-make-fulldeps/extern-prelude/Makefile +++ b/src/test/run-make-fulldeps/extern-prelude/Makefile @@ -7,5 +7,4 @@ all: $(RUSTC) basic.rs --extern ep_lib=$(TMPDIR)/libep_lib.rlib $(RUSTC) shadow-mod.rs --extern ep_lib=$(TMPDIR)/libep_lib.rlib $(RUSTC) shadow-prelude.rs --extern Vec=$(TMPDIR)/libep_vec.rlib - $(RUSTC) relative-only.rs --extern ep_lib=$(TMPDIR)/libep_lib.rlib 2>&1 | $(CGREP) "unresolved import" - $(RUSTC) relative-only.rs --extern ep_lib=$(TMPDIR)/libep_lib.rlib 2>&1 | $(CGREP) "failed to resolve" + $(RUSTC) relative-only.rs --extern ep_lib=$(TMPDIR)/libep_lib.rlib diff --git a/src/test/ui/did_you_mean/issue-38054-do-not-show-unresolved-names.stderr b/src/test/ui/did_you_mean/issue-38054-do-not-show-unresolved-names.stderr index 1f3f7c475707a..e4b91c2e6788e 100644 --- a/src/test/ui/did_you_mean/issue-38054-do-not-show-unresolved-names.stderr +++ b/src/test/ui/did_you_mean/issue-38054-do-not-show-unresolved-names.stderr @@ -2,13 +2,13 @@ error[E0432]: unresolved import `Foo` --> $DIR/issue-38054-do-not-show-unresolved-names.rs:1:5 | LL | use Foo; //~ ERROR unresolved - | ^^^ no `Foo` in the root + | ^^^ no `Foo` external crate error[E0432]: unresolved import `Foo1` --> $DIR/issue-38054-do-not-show-unresolved-names.rs:3:5 | LL | use Foo1; //~ ERROR unresolved - | ^^^^ no `Foo1` in the root + | ^^^^ no `Foo1` external crate error: aborting due to 2 previous errors diff --git a/src/test/ui/editions/edition-imports-2018.rs b/src/test/ui/editions/edition-imports-2018.rs index dcdbf0d050be1..161341f7a021c 100644 --- a/src/test/ui/editions/edition-imports-2018.rs +++ b/src/test/ui/editions/edition-imports-2018.rs @@ -1,3 +1,4 @@ +// compile-pass // edition:2018 // aux-build:edition-imports-2015.rs @@ -21,7 +22,7 @@ mod check { } mod check_glob { - gen_glob!(); //~ ERROR cannot glob-import all possible crates + gen_glob!(); // OK } fn main() {} diff --git a/src/test/ui/editions/edition-imports-2018.stderr b/src/test/ui/editions/edition-imports-2018.stderr deleted file mode 100644 index 944f42ee0451b..0000000000000 --- a/src/test/ui/editions/edition-imports-2018.stderr +++ /dev/null @@ -1,10 +0,0 @@ -error: cannot glob-import all possible crates - --> $DIR/edition-imports-2018.rs:24:5 - | -LL | gen_glob!(); //~ ERROR cannot glob-import all possible crates - | ^^^^^^^^^^^^ - | - = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) - -error: aborting due to previous error - diff --git a/src/test/ui/editions/edition-imports-virtual-2015-ambiguity.rs b/src/test/ui/editions/edition-imports-virtual-2015-ambiguity.rs index 53ec3867f0110..0cf85f8609fd5 100644 --- a/src/test/ui/editions/edition-imports-virtual-2015-ambiguity.rs +++ b/src/test/ui/editions/edition-imports-virtual-2015-ambiguity.rs @@ -1,3 +1,4 @@ +// compile-pass // edition:2018 // compile-flags:--extern edition_imports_2015 // aux-build:edition-imports-2015.rs @@ -12,8 +13,7 @@ mod check { pub struct Ambiguous {} fn check() { - edition_imports_2015::gen_ambiguous!(); //~ ERROR `Ambiguous` is ambiguous - //~| ERROR `edition_imports_2015` is ambiguous + edition_imports_2015::gen_ambiguous!(); } } diff --git a/src/test/ui/editions/edition-imports-virtual-2015-ambiguity.stderr b/src/test/ui/editions/edition-imports-virtual-2015-ambiguity.stderr deleted file mode 100644 index ac2bf21c5c0ba..0000000000000 --- a/src/test/ui/editions/edition-imports-virtual-2015-ambiguity.stderr +++ /dev/null @@ -1,40 +0,0 @@ -error[E0659]: `Ambiguous` is ambiguous (name vs any other name during import resolution) - --> $DIR/edition-imports-virtual-2015-ambiguity.rs:15:9 - | -LL | edition_imports_2015::gen_ambiguous!(); //~ ERROR `Ambiguous` is ambiguous - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ambiguous name - | -note: `Ambiguous` could refer to the struct defined here - --> $DIR/edition-imports-virtual-2015-ambiguity.rs:9:1 - | -LL | pub struct Ambiguous {} - | ^^^^^^^^^^^^^^^^^^^^^^^ - = help: use `crate::Ambiguous` to refer to this struct unambiguously -note: `Ambiguous` could also refer to the struct defined here - --> $DIR/edition-imports-virtual-2015-ambiguity.rs:12:5 - | -LL | pub struct Ambiguous {} - | ^^^^^^^^^^^^^^^^^^^^^^^ - = help: use `self::Ambiguous` to refer to this struct unambiguously - = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) - -error[E0659]: `edition_imports_2015` is ambiguous (name in the crate root vs extern crate during absolute path resolution) - --> $DIR/edition-imports-virtual-2015-ambiguity.rs:15:9 - | -LL | edition_imports_2015::gen_ambiguous!(); //~ ERROR `Ambiguous` is ambiguous - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ambiguous name - | - = note: `edition_imports_2015` could refer to an extern crate passed with `--extern` -note: `edition_imports_2015` could also refer to the module defined here - --> $DIR/edition-imports-virtual-2015-ambiguity.rs:5:1 - | -LL | / mod edition_imports_2015 { -LL | | pub struct Path; -LL | | } - | |_^ - = help: use `crate::edition_imports_2015` to refer to this module unambiguously - = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0659`. diff --git a/src/test/ui/editions/edition-imports-virtual-2015-gated.rs b/src/test/ui/editions/edition-imports-virtual-2015-gated.rs index a1bf4f5eb51dc..634d3e9a443fa 100644 --- a/src/test/ui/editions/edition-imports-virtual-2015-gated.rs +++ b/src/test/ui/editions/edition-imports-virtual-2015-gated.rs @@ -1,12 +1,11 @@ // edition:2018 // aux-build:edition-imports-2015.rs -// error-pattern: imports can only refer to extern crate names passed with `--extern` #[macro_use] extern crate edition_imports_2015; mod check { - gen_gated!(); + gen_gated!(); //~ ERROR unresolved import `E` } fn main() {} diff --git a/src/test/ui/editions/edition-imports-virtual-2015-gated.stderr b/src/test/ui/editions/edition-imports-virtual-2015-gated.stderr index 7c78fbb26a1b8..8cd9f764b6d62 100644 --- a/src/test/ui/editions/edition-imports-virtual-2015-gated.stderr +++ b/src/test/ui/editions/edition-imports-virtual-2015-gated.stderr @@ -1,20 +1,11 @@ -error: imports can only refer to extern crate names passed with `--extern` in macros originating from 2015 edition - --> <::edition_imports_2015::gen_gated macros>:1:50 +error[E0432]: unresolved import `E` + --> $DIR/edition-imports-virtual-2015-gated.rs:8:5 | -LL | ( ) => { fn check_gated ( ) { enum E { A } use E :: * ; } } - | ^ - | - ::: $DIR/edition-imports-virtual-2015-gated.rs:9:5 +LL | gen_gated!(); //~ ERROR unresolved import `E` + | ^^^^^^^^^^^^^ could not find `E` in `{{root}}` | -LL | gen_gated!(); - | ------------- not an extern crate passed with `--extern` - | -note: this import refers to the enum defined here - --> $DIR/edition-imports-virtual-2015-gated.rs:9:5 - | -LL | gen_gated!(); - | ^^^^^^^^^^^^^ = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: aborting due to previous error +For more information about this error, try `rustc --explain E0432`. diff --git a/src/test/ui/error-codes/E0432.stderr b/src/test/ui/error-codes/E0432.stderr index bb6b31242cb54..c3a672d5c4f6f 100644 --- a/src/test/ui/error-codes/E0432.stderr +++ b/src/test/ui/error-codes/E0432.stderr @@ -2,7 +2,7 @@ error[E0432]: unresolved import `something` --> $DIR/E0432.rs:1:5 | LL | use something::Foo; //~ ERROR E0432 - | ^^^^^^^^^ maybe a missing `extern crate something;`? + | ^^^^^^^^^ could not find `something` in `{{root}}` error: aborting due to previous error diff --git a/src/test/ui/extenv/issue-55897.stderr b/src/test/ui/extenv/issue-55897.stderr index 4d2e35dff4629..41224c9482e61 100644 --- a/src/test/ui/extenv/issue-55897.stderr +++ b/src/test/ui/extenv/issue-55897.stderr @@ -8,7 +8,7 @@ error[E0432]: unresolved import `prelude` --> $DIR/issue-55897.rs:1:5 | LL | use prelude::*; //~ ERROR unresolved import `prelude` - | ^^^^^^^ did you mean `std::prelude`? + | ^^^^^^^ could not find `prelude` in `{{root}}` error: cannot determine resolution for the macro `env` --> $DIR/issue-55897.rs:6:22 diff --git a/src/test/ui/feature-gates/feature-gate-extern_absolute_paths.rs b/src/test/ui/feature-gates/feature-gate-extern_absolute_paths.rs index cff273ce2c55a..95564eeb19a61 100644 --- a/src/test/ui/feature-gates/feature-gate-extern_absolute_paths.rs +++ b/src/test/ui/feature-gates/feature-gate-extern_absolute_paths.rs @@ -1,5 +1,6 @@ -use core::default; //~ ERROR unresolved import `core` +use core::default; fn main() { - let _: u8 = ::core::default::Default(); //~ ERROR failed to resolve + let _: u8 = ::core::default::Default(); + //~^ ERROR expected function, found trait `core::default::Default` } diff --git a/src/test/ui/feature-gates/feature-gate-extern_absolute_paths.stderr b/src/test/ui/feature-gates/feature-gate-extern_absolute_paths.stderr index 1629547acb1c0..f0797249c465e 100644 --- a/src/test/ui/feature-gates/feature-gate-extern_absolute_paths.stderr +++ b/src/test/ui/feature-gates/feature-gate-extern_absolute_paths.stderr @@ -1,16 +1,9 @@ -error[E0432]: unresolved import `core` - --> $DIR/feature-gate-extern_absolute_paths.rs:1:5 +error[E0423]: expected function, found trait `core::default::Default` + --> $DIR/feature-gate-extern_absolute_paths.rs:4:17 | -LL | use core::default; //~ ERROR unresolved import `core` - | ^^^^ maybe a missing `extern crate core;`? +LL | let _: u8 = ::core::default::Default(); + | ^^^^^^^^^^^^^^^^^^^^^^^^ not a function -error[E0433]: failed to resolve: maybe a missing `extern crate core;`? - --> $DIR/feature-gate-extern_absolute_paths.rs:4:19 - | -LL | let _: u8 = ::core::default::Default(); //~ ERROR failed to resolve - | ^^^^ maybe a missing `extern crate core;`? - -error: aborting due to 2 previous errors +error: aborting due to previous error -Some errors occurred: E0432, E0433. -For more information about an error, try `rustc --explain E0432`. +For more information about this error, try `rustc --explain E0423`. diff --git a/src/test/ui/hidden-rt-injection.stderr b/src/test/ui/hidden-rt-injection.stderr index 6d63344882b22..75df9d1bcaab0 100644 --- a/src/test/ui/hidden-rt-injection.stderr +++ b/src/test/ui/hidden-rt-injection.stderr @@ -2,7 +2,7 @@ error[E0432]: unresolved import `native` --> $DIR/hidden-rt-injection.rs:5:9 | LL | use native; //~ ERROR unresolved import - | ^^^^^^ no `native` in the root + | ^^^^^^ no `native` external crate error: aborting due to previous error diff --git a/src/test/ui/hidden-rt-injection2.stderr b/src/test/ui/hidden-rt-injection2.stderr index bbb45552f2c14..cd04de69ebc5c 100644 --- a/src/test/ui/hidden-rt-injection2.stderr +++ b/src/test/ui/hidden-rt-injection2.stderr @@ -2,7 +2,7 @@ error[E0432]: unresolved import `rt` --> $DIR/hidden-rt-injection2.rs:5:9 | LL | use rt; //~ ERROR unresolved import - | ^^ no `rt` in the root + | ^^ no `rt` external crate error: aborting due to previous error diff --git a/src/test/ui/import.rs b/src/test/ui/import.rs index 540258daaec82..b148cdc2f80bc 100644 --- a/src/test/ui/import.rs +++ b/src/test/ui/import.rs @@ -6,7 +6,6 @@ use zed::baz; //~ ERROR unresolved import `zed::baz` [E0432] mod zed { pub fn bar() { println!("bar"); } use foo; //~ ERROR unresolved import `foo` [E0432] - //~^ no `foo` in the root } fn main() { diff --git a/src/test/ui/import.stderr b/src/test/ui/import.stderr index 737d10cdecb23..cd13fe59159a6 100644 --- a/src/test/ui/import.stderr +++ b/src/test/ui/import.stderr @@ -8,10 +8,10 @@ error[E0432]: unresolved import `foo` --> $DIR/import.rs:8:9 | LL | use foo; //~ ERROR unresolved import `foo` [E0432] - | ^^^ no `foo` in the root + | ^^^ no `foo` external crate error[E0603]: unresolved item `foo` is private - --> $DIR/import.rs:13:10 + --> $DIR/import.rs:12:10 | LL | zed::foo(); //~ ERROR `foo` is private | ^^^ diff --git a/src/test/ui/import3.stderr b/src/test/ui/import3.stderr index 73b9b27b57cb1..bda34ed4c4d8f 100644 --- a/src/test/ui/import3.stderr +++ b/src/test/ui/import3.stderr @@ -2,7 +2,7 @@ error[E0432]: unresolved import `main` --> $DIR/import3.rs:2:5 | LL | use main::bar; - | ^^^^ maybe a missing `extern crate main;`? + | ^^^^ could not find `main` in `{{root}}` error: aborting due to previous error diff --git a/src/test/ui/imports/issue-53269.stderr b/src/test/ui/imports/issue-53269.stderr index 0163ee8bceb42..df838ebb54573 100644 --- a/src/test/ui/imports/issue-53269.stderr +++ b/src/test/ui/imports/issue-53269.stderr @@ -2,7 +2,7 @@ error[E0432]: unresolved import `nonexistent_module` --> $DIR/issue-53269.rs:6:9 | LL | use nonexistent_module::mac; //~ ERROR unresolved import `nonexistent_module` - | ^^^^^^^^^^^^^^^^^^ maybe a missing `extern crate nonexistent_module;`? + | ^^^^^^^^^^^^^^^^^^ could not find `nonexistent_module` in `{{root}}` error[E0659]: `mac` is ambiguous (`macro_rules` vs non-`macro_rules` from other module) --> $DIR/issue-53269.rs:8:5 diff --git a/src/test/ui/imports/issue-55457.stderr b/src/test/ui/imports/issue-55457.stderr index 4ee0332d04bcd..2c542dccdbe8a 100644 --- a/src/test/ui/imports/issue-55457.stderr +++ b/src/test/ui/imports/issue-55457.stderr @@ -2,13 +2,13 @@ error[E0432]: unresolved import `NonExistent` --> $DIR/issue-55457.rs:1:5 | LL | use NonExistent; //~ ERROR unresolved import `NonExistent` - | ^^^^^^^^^^^ no `NonExistent` in the root. Did you mean to use `non_existent`? + | ^^^^^^^^^^^ no `NonExistent` external crate error[E0432]: unresolved import `non_existent` --> $DIR/issue-55457.rs:2:5 | LL | use non_existent::non_existent; //~ ERROR unresolved import `non_existent` - | ^^^^^^^^^^^^ maybe a missing `extern crate non_existent;`? + | ^^^^^^^^^^^^ could not find `non_existent` in `{{root}}` error: cannot determine resolution for the derive macro `NonExistent` --> $DIR/issue-55457.rs:5:10 diff --git a/src/test/ui/inaccessible-test-modules.stderr b/src/test/ui/inaccessible-test-modules.stderr index 636ef8187059b..8e4056d40936e 100644 --- a/src/test/ui/inaccessible-test-modules.stderr +++ b/src/test/ui/inaccessible-test-modules.stderr @@ -2,13 +2,13 @@ error[E0432]: unresolved import `__test` --> $DIR/inaccessible-test-modules.rs:5:5 | LL | use __test as x; //~ ERROR unresolved import `__test` - | ^^^^^^^^^^^ no `__test` in the root. Did you mean to use `test`? + | ^^^^^^^^^^^ no `__test` external crate error[E0432]: unresolved import `__test_reexports` --> $DIR/inaccessible-test-modules.rs:6:5 | LL | use __test_reexports as y; //~ ERROR unresolved import `__test_reexports` - | ^^^^^^^^^^^^^^^^^^^^^ no `__test_reexports` in the root. Did you mean to use `__test_reexports`? + | ^^^^^^^^^^^^^^^^^^^^^ no `__test_reexports` external crate error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-1697.rs b/src/test/ui/issues/issue-1697.rs index 30b2558dce9dd..99e03e82b81ff 100644 --- a/src/test/ui/issues/issue-1697.rs +++ b/src/test/ui/issues/issue-1697.rs @@ -1,6 +1,5 @@ // Testing that we don't fail abnormally after hitting the errors use unresolved::*; //~ ERROR unresolved import `unresolved` [E0432] - //~^ maybe a missing `extern crate unresolved;`? fn main() {} diff --git a/src/test/ui/issues/issue-1697.stderr b/src/test/ui/issues/issue-1697.stderr index 00e136cb1ce86..2c7dded3138c6 100644 --- a/src/test/ui/issues/issue-1697.stderr +++ b/src/test/ui/issues/issue-1697.stderr @@ -2,7 +2,7 @@ error[E0432]: unresolved import `unresolved` --> $DIR/issue-1697.rs:3:5 | LL | use unresolved::*; //~ ERROR unresolved import `unresolved` [E0432] - | ^^^^^^^^^^ maybe a missing `extern crate unresolved;`? + | ^^^^^^^^^^ could not find `unresolved` in `{{root}}` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-28388-1.stderr b/src/test/ui/issues/issue-28388-1.stderr index 6aabf65351200..32dc0c67f5fc5 100644 --- a/src/test/ui/issues/issue-28388-1.stderr +++ b/src/test/ui/issues/issue-28388-1.stderr @@ -2,7 +2,7 @@ error[E0432]: unresolved import `foo` --> $DIR/issue-28388-1.rs:3:5 | LL | use foo::{}; //~ ERROR unresolved import `foo` - | ^^^^^^^ no `foo` in the root + | ^^^^^^^ no `foo` external crate error: aborting due to previous error diff --git a/src/test/ui/issues/issue-33464.stderr b/src/test/ui/issues/issue-33464.stderr index bbf8d21cf65a4..c3ea6d7b9b1da 100644 --- a/src/test/ui/issues/issue-33464.stderr +++ b/src/test/ui/issues/issue-33464.stderr @@ -2,19 +2,19 @@ error[E0432]: unresolved import `abc` --> $DIR/issue-33464.rs:3:5 | LL | use abc::one_el; - | ^^^ maybe a missing `extern crate abc;`? + | ^^^ could not find `abc` in `{{root}}` error[E0432]: unresolved import `abc` --> $DIR/issue-33464.rs:5:5 | LL | use abc::{a, bbb, cccccc}; - | ^^^ maybe a missing `extern crate abc;`? + | ^^^ could not find `abc` in `{{root}}` error[E0432]: unresolved import `a_very_long_name` --> $DIR/issue-33464.rs:7:5 | LL | use a_very_long_name::{el, el2}; - | ^^^^^^^^^^^^^^^^ maybe a missing `extern crate a_very_long_name;`? + | ^^^^^^^^^^^^^^^^ could not find `a_very_long_name` in `{{root}}` error: aborting due to 3 previous errors diff --git a/src/test/ui/issues/issue-36881.stderr b/src/test/ui/issues/issue-36881.stderr index b08b229384d08..795b53da95085 100644 --- a/src/test/ui/issues/issue-36881.stderr +++ b/src/test/ui/issues/issue-36881.stderr @@ -2,7 +2,7 @@ error[E0432]: unresolved import `issue_36881_aux` --> $DIR/issue-36881.rs:6:9 | LL | use issue_36881_aux::Foo; //~ ERROR unresolved import - | ^^^^^^^^^^^^^^^ maybe a missing `extern crate issue_36881_aux;`? + | ^^^^^^^^^^^^^^^ could not find `issue_36881_aux` in `{{root}}` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-37887.stderr b/src/test/ui/issues/issue-37887.stderr index 3b3ce8b39bc94..a979469febe49 100644 --- a/src/test/ui/issues/issue-37887.stderr +++ b/src/test/ui/issues/issue-37887.stderr @@ -2,7 +2,7 @@ error[E0432]: unresolved import `libc` --> $DIR/issue-37887.rs:3:9 | LL | use libc::*; //~ ERROR unresolved import - | ^^^^ maybe a missing `extern crate libc;`? + | ^^^^ could not find `libc` in `{{root}}` error[E0658]: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812) --> $DIR/issue-37887.rs:2:5 diff --git a/src/test/ui/keyword/extern/keyword-extern-as-identifier-use.rs b/src/test/ui/keyword/extern/keyword-extern-as-identifier-use.rs index b07de3e341c41..f9b9ebea45251 100644 --- a/src/test/ui/keyword/extern/keyword-extern-as-identifier-use.rs +++ b/src/test/ui/keyword/extern/keyword-extern-as-identifier-use.rs @@ -1,3 +1,4 @@ use extern::foo; //~ ERROR expected identifier, found keyword `extern` + //~| ERROR unresolved import `extern` fn main() {} diff --git a/src/test/ui/keyword/extern/keyword-extern-as-identifier-use.stderr b/src/test/ui/keyword/extern/keyword-extern-as-identifier-use.stderr index 31b575a92e0c8..e36f0f16d1f36 100644 --- a/src/test/ui/keyword/extern/keyword-extern-as-identifier-use.stderr +++ b/src/test/ui/keyword/extern/keyword-extern-as-identifier-use.stderr @@ -8,5 +8,12 @@ help: you can escape reserved keywords to use them as identifiers LL | use r#extern::foo; //~ ERROR expected identifier, found keyword `extern` | ^^^^^^^^ -error: aborting due to previous error +error[E0432]: unresolved import `extern` + --> $DIR/keyword-extern-as-identifier-use.rs:1:5 + | +LL | use extern::foo; //~ ERROR expected identifier, found keyword `extern` + | ^^^^^^ could not find `extern` in `{{root}}` + +error: aborting due to 2 previous errors +For more information about this error, try `rustc --explain E0432`. diff --git a/src/test/ui/macros/meta-item-absolute-path.stderr b/src/test/ui/macros/meta-item-absolute-path.stderr index 31b0a27bbc8da..7d982da5723b2 100644 --- a/src/test/ui/macros/meta-item-absolute-path.stderr +++ b/src/test/ui/macros/meta-item-absolute-path.stderr @@ -1,8 +1,8 @@ -error[E0433]: failed to resolve: maybe a missing `extern crate Absolute;`? +error[E0433]: failed to resolve: could not find `Absolute` in `{{root}}` --> $DIR/meta-item-absolute-path.rs:1:12 | LL | #[derive(::Absolute)] //~ ERROR failed to resolve - | ^^^^^^^^ maybe a missing `extern crate Absolute;`? + | ^^^^^^^^ could not find `Absolute` in `{{root}}` error: aborting due to previous error diff --git a/src/test/ui/privacy/restricted/test.rs b/src/test/ui/privacy/restricted/test.rs index f208696c86fb7..10dc0fdc87308 100644 --- a/src/test/ui/privacy/restricted/test.rs +++ b/src/test/ui/privacy/restricted/test.rs @@ -47,6 +47,6 @@ fn main() { } mod pathological { - pub(in bad::path) mod m1 {} //~ ERROR failed to resolve: maybe a missing `extern crate bad;`? + pub(in bad::path) mod m1 {} //~ ERROR failed to resolve: could not find `bad` in `{{root}}` pub(in foo) mod m2 {} //~ ERROR visibilities can only be restricted to ancestor modules } diff --git a/src/test/ui/privacy/restricted/test.stderr b/src/test/ui/privacy/restricted/test.stderr index 7539b0e1af4c9..bffa6526a4e81 100644 --- a/src/test/ui/privacy/restricted/test.stderr +++ b/src/test/ui/privacy/restricted/test.stderr @@ -1,8 +1,8 @@ -error[E0433]: failed to resolve: maybe a missing `extern crate bad;`? +error[E0433]: failed to resolve: could not find `bad` in `{{root}}` --> $DIR/test.rs:50:12 | -LL | pub(in bad::path) mod m1 {} //~ ERROR failed to resolve: maybe a missing `extern crate bad;`? - | ^^^ maybe a missing `extern crate bad;`? +LL | pub(in bad::path) mod m1 {} //~ ERROR failed to resolve: could not find `bad` in `{{root}}` + | ^^^ could not find `bad` in `{{root}}` error: visibilities can only be restricted to ancestor modules --> $DIR/test.rs:51:12 diff --git a/src/test/ui/quote-with-interpolated.rs b/src/test/ui/quote-with-interpolated.rs index b948226652b45..1e759880c9039 100644 --- a/src/test/ui/quote-with-interpolated.rs +++ b/src/test/ui/quote-with-interpolated.rs @@ -4,8 +4,8 @@ fn main() { ($bar:expr) => { quote_expr!(cx, $bar) //~^ ERROR quote! with interpolated token - //~| ERROR failed to resolve: maybe a missing `extern crate syntax;`? - //~| ERROR failed to resolve: maybe a missing `extern crate syntax;`? + //~| ERROR failed to resolve: could not find `syntax` in `{{root}}` + //~| ERROR failed to resolve: could not find `syntax` in `{{root}}` //~| ERROR cannot find value `cx` in this scope //~| ERROR cannot find function `new_parser_from_tts` in this scope } diff --git a/src/test/ui/quote-with-interpolated.stderr b/src/test/ui/quote-with-interpolated.stderr index 96feff949bfc9..cbfd758f4ffbc 100644 --- a/src/test/ui/quote-with-interpolated.stderr +++ b/src/test/ui/quote-with-interpolated.stderr @@ -7,17 +7,17 @@ LL | quote_expr!(cx, $bar) LL | foo!(bar); | ---------- in this macro invocation -error[E0433]: failed to resolve: maybe a missing `extern crate syntax;`? +error[E0433]: failed to resolve: could not find `syntax` in `{{root}}` --> $DIR/quote-with-interpolated.rs:5:13 | LL | quote_expr!(cx, $bar) - | ^^^^^^^^^^^^^^^^^^^^^ maybe a missing `extern crate syntax;`? + | ^^^^^^^^^^^^^^^^^^^^^ could not find `syntax` in `{{root}}` -error[E0433]: failed to resolve: maybe a missing `extern crate syntax;`? +error[E0433]: failed to resolve: could not find `syntax` in `{{root}}` --> $DIR/quote-with-interpolated.rs:5:29 | LL | quote_expr!(cx, $bar) - | ^^^^ maybe a missing `extern crate syntax;`? + | ^^^^ could not find `syntax` in `{{root}}` error[E0425]: cannot find value `cx` in this scope --> $DIR/quote-with-interpolated.rs:5:25 diff --git a/src/test/ui/resolve/issue-5035.rs b/src/test/ui/resolve/issue-5035.rs index c00567a75b7a3..3ec53b0f78141 100644 --- a/src/test/ui/resolve/issue-5035.rs +++ b/src/test/ui/resolve/issue-5035.rs @@ -3,7 +3,6 @@ type K = I; impl K for isize {} //~ ERROR expected trait, found type alias `K` use ImportError; //~ ERROR unresolved import `ImportError` [E0432] - //~^ no `ImportError` in the root impl ImportError for () {} // check that this is not an additional error (cf. issue #35142) fn main() {} diff --git a/src/test/ui/resolve/issue-5035.stderr b/src/test/ui/resolve/issue-5035.stderr index 57ad5f22f4c24..1ac7a28ad31ad 100644 --- a/src/test/ui/resolve/issue-5035.stderr +++ b/src/test/ui/resolve/issue-5035.stderr @@ -2,7 +2,7 @@ error[E0432]: unresolved import `ImportError` --> $DIR/issue-5035.rs:5:5 | LL | use ImportError; //~ ERROR unresolved import `ImportError` [E0432] - | ^^^^^^^^^^^ no `ImportError` in the root + | ^^^^^^^^^^^ no `ImportError` external crate error[E0404]: expected trait, found type alias `K` --> $DIR/issue-5035.rs:3:6 diff --git a/src/test/ui/resolve/resolve-bad-import-prefix.stderr b/src/test/ui/resolve/resolve-bad-import-prefix.stderr index f39e1edb61347..cfdd7fb863eec 100644 --- a/src/test/ui/resolve/resolve-bad-import-prefix.stderr +++ b/src/test/ui/resolve/resolve-bad-import-prefix.stderr @@ -2,7 +2,7 @@ error[E0432]: unresolved import `Nonexistent` --> $DIR/resolve-bad-import-prefix.rs:12:5 | LL | use Nonexistent::{}; //~ ERROR unresolved import `Nonexistent` - | ^^^^^^^^^^^^^^^ no `Nonexistent` in the root + | ^^^^^^^^^^^^^^^ no `Nonexistent` external crate error: aborting due to previous error diff --git a/src/test/ui/resolve_self_super_hint.rs b/src/test/ui/resolve_self_super_hint.rs index 193a6ecf9d570..e41be14b6d0fb 100644 --- a/src/test/ui/resolve_self_super_hint.rs +++ b/src/test/ui/resolve_self_super_hint.rs @@ -13,11 +13,9 @@ mod a { mod c { use alloc::HashMap; //~^ ERROR unresolved import `alloc` [E0432] - //~| did you mean `a::alloc`? mod d { use alloc::HashMap; //~^ ERROR unresolved import `alloc` [E0432] - //~| did you mean `a::alloc`? } } } diff --git a/src/test/ui/resolve_self_super_hint.stderr b/src/test/ui/resolve_self_super_hint.stderr index ddae0e5f6aaba..32db44edd4531 100644 --- a/src/test/ui/resolve_self_super_hint.stderr +++ b/src/test/ui/resolve_self_super_hint.stderr @@ -14,13 +14,13 @@ error[E0432]: unresolved import `alloc` --> $DIR/resolve_self_super_hint.rs:14:17 | LL | use alloc::HashMap; - | ^^^^^ did you mean `a::alloc`? + | ^^^^^ could not find `alloc` in `{{root}}` error[E0432]: unresolved import `alloc` - --> $DIR/resolve_self_super_hint.rs:18:21 + --> $DIR/resolve_self_super_hint.rs:17:21 | LL | use alloc::HashMap; - | ^^^^^ did you mean `a::alloc`? + | ^^^^^ could not find `alloc` in `{{root}}` error: aborting due to 4 previous errors diff --git a/src/test/ui/rust-2018/local-path-suggestions-2015.stderr b/src/test/ui/rust-2018/local-path-suggestions-2015.stderr index be642c3bcdcbb..a5da682e82e0a 100644 --- a/src/test/ui/rust-2018/local-path-suggestions-2015.stderr +++ b/src/test/ui/rust-2018/local-path-suggestions-2015.stderr @@ -2,7 +2,7 @@ error[E0432]: unresolved import `foobar` --> $DIR/local-path-suggestions-2015.rs:24:5 | LL | use foobar::Baz; //~ ERROR unresolved import `foobar` - | ^^^^^^ did you mean `aux_baz::foobar`? + | ^^^^^^ could not find `foobar` in `{{root}}` error: aborting due to previous error diff --git a/src/test/ui/span/visibility-ty-params.stderr b/src/test/ui/span/visibility-ty-params.stderr index d7914528f4686..b28c61d577e96 100644 --- a/src/test/ui/span/visibility-ty-params.stderr +++ b/src/test/ui/span/visibility-ty-params.stderr @@ -14,9 +14,7 @@ error[E0577]: expected module, found struct `S` --> $DIR/visibility-ty-params.rs:6:5 | LL | m!{ S } //~ ERROR unexpected generic arguments in path - | -^^^^ - | | - | help: a module with a similar name exists: `m` + | ^^^^^ not a module error: aborting due to 3 previous errors diff --git a/src/test/ui/unresolved/unresolved-import-recovery.stderr b/src/test/ui/unresolved/unresolved-import-recovery.stderr index 0154d002efeec..45d3ff9903472 100644 --- a/src/test/ui/unresolved/unresolved-import-recovery.stderr +++ b/src/test/ui/unresolved/unresolved-import-recovery.stderr @@ -2,7 +2,7 @@ error[E0432]: unresolved import `unresolved` --> $DIR/unresolved-import-recovery.rs:4:13 | LL | pub use unresolved; //~ ERROR unresolved import `unresolved` - | ^^^^^^^^^^ no `unresolved` in the root + | ^^^^^^^^^^ no `unresolved` external crate error: aborting due to previous error diff --git a/src/test/ui/unresolved/unresolved-import.rs b/src/test/ui/unresolved/unresolved-import.rs index be2a2c75485f6..09152bffd6e12 100644 --- a/src/test/ui/unresolved/unresolved-import.rs +++ b/src/test/ui/unresolved/unresolved-import.rs @@ -1,7 +1,6 @@ // ignore-tidy-linelength use foo::bar; //~ ERROR unresolved import `foo` [E0432] - //~^ maybe a missing `extern crate foo;`? use bar::Baz as x; //~ ERROR unresolved import `bar::Baz` [E0432] //~^ no `Baz` in `bar`. Did you mean to use `Bar`? diff --git a/src/test/ui/unresolved/unresolved-import.stderr b/src/test/ui/unresolved/unresolved-import.stderr index 0dc4b72208ac1..dbfb190f14a27 100644 --- a/src/test/ui/unresolved/unresolved-import.stderr +++ b/src/test/ui/unresolved/unresolved-import.stderr @@ -2,34 +2,34 @@ error[E0432]: unresolved import `foo` --> $DIR/unresolved-import.rs:3:5 | LL | use foo::bar; //~ ERROR unresolved import `foo` [E0432] - | ^^^ maybe a missing `extern crate foo;`? + | ^^^ could not find `foo` in `{{root}}` error[E0432]: unresolved import `bar::Baz` - --> $DIR/unresolved-import.rs:6:5 + --> $DIR/unresolved-import.rs:5:5 | LL | use bar::Baz as x; //~ ERROR unresolved import `bar::Baz` [E0432] | ^^^^^^^^^^^^^ no `Baz` in `bar`. Did you mean to use `Bar`? error[E0432]: unresolved import `food::baz` - --> $DIR/unresolved-import.rs:9:5 + --> $DIR/unresolved-import.rs:8:5 | LL | use food::baz; //~ ERROR unresolved import `food::baz` | ^^^^^^^^^ no `baz` in `food`. Did you mean to use `bag`? error[E0432]: unresolved import `food::beens` - --> $DIR/unresolved-import.rs:12:12 + --> $DIR/unresolved-import.rs:11:12 | LL | use food::{beens as Foo}; //~ ERROR unresolved import `food::beens` [E0432] | ^^^^^^^^^^^^ no `beens` in `food`. Did you mean to use `beans`? error[E0432]: unresolved import `MyEnum` - --> $DIR/unresolved-import.rs:34:9 + --> $DIR/unresolved-import.rs:33:9 | LL | use MyEnum::*; //~ ERROR unresolved import `MyEnum` [E0432] | ^^^^^^ did you mean `self::MyEnum`? error[E0432]: unresolved import `Enum` - --> $DIR/unresolved-import.rs:43:9 + --> $DIR/unresolved-import.rs:42:9 | LL | use Enum::*; //~ ERROR unresolved import `Enum` [E0432] | ^^^^ did you mean `self::Enum`? diff --git a/src/test/ui/use/use-mod/use-mod-4.stderr b/src/test/ui/use/use-mod/use-mod-4.stderr index fc0f8952c4794..b8738d02fd161 100644 --- a/src/test/ui/use/use-mod/use-mod-4.stderr +++ b/src/test/ui/use/use-mod/use-mod-4.stderr @@ -14,7 +14,7 @@ error[E0432]: unresolved import `foo` --> $DIR/use-mod-4.rs:1:5 | LL | use foo::self; //~ ERROR unresolved import `foo` - | ^^^ maybe a missing `extern crate foo;`? + | ^^^ could not find `foo` in `{{root}}` error: aborting due to 3 previous errors