Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rustc_resolve: always include core, std and meta in the extern prelude.
- Loading branch information
Showing
9 changed files
with
181 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
// edition:2018 | ||
|
||
// Tests that `meta` is whitelisted, even if the crate doesn't exist | ||
// yet (i.e. it causes a different error than `not-whitelisted.rs`). | ||
use meta; //~ ERROR can't find crate for `meta` | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
error[E0463]: can't find crate for `meta` | ||
--> $DIR/meta.rs:15:5 | ||
| | ||
LL | use meta; //~ ERROR can't find crate for `meta` | ||
| ^^^^ can't find crate | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0463`. |
19 changes: 19 additions & 0 deletions
19
src/test/ui/rfc-2126-extern-absolute-paths/not-whitelisted.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
// edition:2018 | ||
|
||
// Tests that arbitrary crates (other than `core`, `std` and `meta`) | ||
// aren't allowed without `--extern`, even if they're in the sysroot. | ||
use alloc; //~ ERROR unresolved import `alloc` | ||
use test; //~ ERROR unresolved import `test` | ||
use proc_macro; //~ ERROR unresolved import `proc_macro` | ||
|
||
fn main() {} |
21 changes: 21 additions & 0 deletions
21
src/test/ui/rfc-2126-extern-absolute-paths/not-whitelisted.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
error[E0432]: unresolved import `alloc` | ||
--> $DIR/not-whitelisted.rs:15:5 | ||
| | ||
LL | use alloc; //~ ERROR unresolved import `alloc` | ||
| ^^^^^ no `alloc` external crate | ||
|
||
error[E0432]: unresolved import `test` | ||
--> $DIR/not-whitelisted.rs:16:5 | ||
| | ||
LL | use test; //~ ERROR unresolved import `test` | ||
| ^^^^ no `test` external crate | ||
|
||
error[E0432]: unresolved import `proc_macro` | ||
--> $DIR/not-whitelisted.rs:17:5 | ||
| | ||
LL | use proc_macro; //~ ERROR unresolved import `proc_macro` | ||
| ^^^^^^^^^^ no `proc_macro` external crate | ||
|
||
error: aborting due to 3 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0432`. |
24 changes: 24 additions & 0 deletions
24
src/test/ui/run-pass/rfcs/rfc-2126-extern-absolute-paths/whitelisted.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
// run-pass | ||
// edition:2018 | ||
|
||
// Tests that `core` and `std` are always available. | ||
use core::iter; | ||
use std::io; | ||
// FIXME(eddyb) Add a `meta` crate to the distribution. | ||
// use meta; | ||
|
||
fn main() { | ||
for _ in iter::once(()) { | ||
io::stdout(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters