Skip to content

Commit

Permalink
resolve: Scale back hard-coded extern prelude additions
Browse files Browse the repository at this point in the history
  • Loading branch information
petrochenkov committed Oct 13, 2018
1 parent 5229488 commit 894a8d5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
16 changes: 9 additions & 7 deletions src/librustc_resolve/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1680,13 +1680,15 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
let mut extern_prelude: FxHashSet<Name> =
session.opts.externs.iter().map(|kv| Symbol::intern(kv.0)).collect();

// HACK(eddyb) this ignore the `no_{core,std}` attributes.
// FIXME(eddyb) warn (elsewhere) if core/std is used with `no_{core,std}`.
// if !attr::contains_name(&krate.attrs, "no_core") {
// if !attr::contains_name(&krate.attrs, "no_std") {
extern_prelude.insert(Symbol::intern("core"));
extern_prelude.insert(Symbol::intern("std"));
extern_prelude.insert(Symbol::intern("meta"));
if !attr::contains_name(&krate.attrs, "no_core") {
extern_prelude.insert(Symbol::intern("core"));
if !attr::contains_name(&krate.attrs, "no_std") {
extern_prelude.insert(Symbol::intern("std"));
if session.rust_2018() {
extern_prelude.insert(Symbol::intern("meta"));
}
}
}

let mut invocations = FxHashMap();
invocations.insert(Mark::root(),
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/rust-2018/issue-54006.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error[E0432]: unresolved import `alloc`
--> $DIR/issue-54006.rs:16:5
|
LL | use alloc::vec;
| ^^^^^ Did you mean `std::alloc`?
| ^^^^^ Did you mean `core::alloc`?

error: cannot determine resolution for the macro `vec`
--> $DIR/issue-54006.rs:20:18
Expand Down

0 comments on commit 894a8d5

Please sign in to comment.