Rollup merge of #59347 - petrochenkov:nomake, r=davidtwco
Move one test from run-make-fulldeps to ui The test was written when `--extern` without path didn't exist.
This commit is contained in:
commit
4be19e36d9
10 changed files with 57 additions and 50 deletions
|
@ -1,11 +0,0 @@
|
|||
-include ../tools.mk
|
||||
|
||||
all:
|
||||
$(RUSTC) ep-lib.rs
|
||||
$(RUSTC) ep-vec.rs
|
||||
|
||||
$(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"
|
|
@ -1,6 +0,0 @@
|
|||
#![feature(extern_prelude)]
|
||||
|
||||
fn main() {
|
||||
let s = ep_lib::S; // It works
|
||||
s.external();
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
// Extern prelude names are not available by absolute paths
|
||||
|
||||
#![feature(extern_prelude)]
|
||||
|
||||
use ep_lib::S;
|
||||
|
||||
fn main() {
|
||||
let s = ::ep_lib::S;
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
// Local module shadows `ep_lib` from extern prelude
|
||||
|
||||
mod ep_lib {
|
||||
pub struct S;
|
||||
|
||||
impl S {
|
||||
pub fn internal(&self) {}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let s = ep_lib::S;
|
||||
s.internal(); // OK
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
// Extern prelude shadows standard library prelude
|
||||
|
||||
#![feature(extern_prelude)]
|
||||
|
||||
fn main() {
|
||||
let x = Vec::new(0f32, ()); // OK
|
||||
}
|
|
@ -1,3 +1,3 @@
|
|||
#![crate_type = "rlib"]
|
||||
#![crate_name = "Vec"]
|
||||
|
||||
pub fn new(arg1: f32, arg2: ()) {}
|
|
@ -1,5 +1,3 @@
|
|||
#![crate_type = "rlib"]
|
||||
|
||||
pub struct S;
|
||||
|
||||
impl S {
|
9
src/test/ui/extern-prelude-fail.rs
Normal file
9
src/test/ui/extern-prelude-fail.rs
Normal file
|
@ -0,0 +1,9 @@
|
|||
// compile-flags:--extern extern_prelude
|
||||
// aux-build:extern-prelude.rs
|
||||
|
||||
// Extern prelude names are not available by absolute paths
|
||||
|
||||
fn main() {
|
||||
use extern_prelude::S; //~ ERROR unresolved import `extern_prelude`
|
||||
let s = ::extern_prelude::S; //~ ERROR failed to resolve
|
||||
}
|
16
src/test/ui/extern-prelude-fail.stderr
Normal file
16
src/test/ui/extern-prelude-fail.stderr
Normal file
|
@ -0,0 +1,16 @@
|
|||
error[E0432]: unresolved import `extern_prelude`
|
||||
--> $DIR/extern-prelude-fail.rs:7:9
|
||||
|
|
||||
LL | use extern_prelude::S;
|
||||
| ^^^^^^^^^^^^^^ maybe a missing `extern crate extern_prelude;`?
|
||||
|
||||
error[E0433]: failed to resolve: maybe a missing `extern crate extern_prelude;`?
|
||||
--> $DIR/extern-prelude-fail.rs:8:15
|
||||
|
|
||||
LL | let s = ::extern_prelude::S;
|
||||
| ^^^^^^^^^^^^^^ maybe a missing `extern crate extern_prelude;`?
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
Some errors occurred: E0432, E0433.
|
||||
For more information about an error, try `rustc --explain E0432`.
|
31
src/test/ui/extern-prelude.rs
Normal file
31
src/test/ui/extern-prelude.rs
Normal file
|
@ -0,0 +1,31 @@
|
|||
// compile-pass
|
||||
// compile-flags:--extern extern_prelude --extern Vec
|
||||
// aux-build:extern-prelude.rs
|
||||
// aux-build:extern-prelude-vec.rs
|
||||
|
||||
fn basic() {
|
||||
// It works
|
||||
let s = extern_prelude::S;
|
||||
s.external();
|
||||
}
|
||||
|
||||
fn shadow_mod() {
|
||||
// Local module shadows `extern_prelude` from extern prelude
|
||||
mod extern_prelude {
|
||||
pub struct S;
|
||||
|
||||
impl S {
|
||||
pub fn internal(&self) {}
|
||||
}
|
||||
}
|
||||
|
||||
let s = extern_prelude::S;
|
||||
s.internal(); // OK
|
||||
}
|
||||
|
||||
fn shadow_prelude() {
|
||||
// Extern prelude shadows standard library prelude
|
||||
let x = Vec::new(0f32, ()); // OK
|
||||
}
|
||||
|
||||
fn main() {}
|
Loading…
Add table
Reference in a new issue