diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:03 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:03 +0000 |
commit | 64d98f8ee037282c35007b64c2649055c56af1db (patch) | |
tree | 5492bcf97fce41ee1c0b1cc2add283f3e66cdab0 /tests/ui/crate-loading | |
parent | Adding debian version 1.67.1+dfsg1-1. (diff) | |
download | rustc-64d98f8ee037282c35007b64c2649055c56af1db.tar.xz rustc-64d98f8ee037282c35007b64c2649055c56af1db.zip |
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/crate-loading')
-rw-r--r-- | tests/ui/crate-loading/auxiliary/crateresolve1-1.rs | 6 | ||||
-rw-r--r-- | tests/ui/crate-loading/auxiliary/crateresolve1-2.rs | 6 | ||||
-rw-r--r-- | tests/ui/crate-loading/auxiliary/crateresolve1-3.rs | 6 | ||||
-rw-r--r-- | tests/ui/crate-loading/auxiliary/crateresolve2-1.rs | 5 | ||||
-rw-r--r-- | tests/ui/crate-loading/auxiliary/crateresolve2-2.rs | 5 | ||||
-rw-r--r-- | tests/ui/crate-loading/auxiliary/crateresolve2-3.rs | 5 | ||||
-rw-r--r-- | tests/ui/crate-loading/auxiliary/libfoo.rlib | 0 | ||||
-rw-r--r-- | tests/ui/crate-loading/auxiliary/proc-macro.rs | 12 | ||||
-rw-r--r-- | tests/ui/crate-loading/crateresolve1.rs | 14 | ||||
-rw-r--r-- | tests/ui/crate-loading/crateresolve1.stderr | 13 | ||||
-rw-r--r-- | tests/ui/crate-loading/crateresolve2.rs | 13 | ||||
-rw-r--r-- | tests/ui/crate-loading/crateresolve2.stderr | 13 | ||||
-rw-r--r-- | tests/ui/crate-loading/cross-compiled-proc-macro.rs | 8 | ||||
-rw-r--r-- | tests/ui/crate-loading/invalid-rlib.rs | 10 | ||||
-rw-r--r-- | tests/ui/crate-loading/invalid-rlib.stderr | 19 | ||||
-rw-r--r-- | tests/ui/crate-loading/missing-std.rs | 12 | ||||
-rw-r--r-- | tests/ui/crate-loading/missing-std.stderr | 15 |
17 files changed, 162 insertions, 0 deletions
diff --git a/tests/ui/crate-loading/auxiliary/crateresolve1-1.rs b/tests/ui/crate-loading/auxiliary/crateresolve1-1.rs new file mode 100644 index 000000000..bd9c8483e --- /dev/null +++ b/tests/ui/crate-loading/auxiliary/crateresolve1-1.rs @@ -0,0 +1,6 @@ +// compile-flags:-C extra-filename=-1 +// no-prefer-dynamic +#![crate_name = "crateresolve1"] +#![crate_type = "lib"] + +pub fn f() -> isize { 10 } diff --git a/tests/ui/crate-loading/auxiliary/crateresolve1-2.rs b/tests/ui/crate-loading/auxiliary/crateresolve1-2.rs new file mode 100644 index 000000000..bd0f08f45 --- /dev/null +++ b/tests/ui/crate-loading/auxiliary/crateresolve1-2.rs @@ -0,0 +1,6 @@ +// compile-flags:-C extra-filename=-2 +// no-prefer-dynamic +#![crate_name = "crateresolve1"] +#![crate_type = "lib"] + +pub fn f() -> isize { 20 } diff --git a/tests/ui/crate-loading/auxiliary/crateresolve1-3.rs b/tests/ui/crate-loading/auxiliary/crateresolve1-3.rs new file mode 100644 index 000000000..1226c2fbb --- /dev/null +++ b/tests/ui/crate-loading/auxiliary/crateresolve1-3.rs @@ -0,0 +1,6 @@ +// compile-flags:-C extra-filename=-3 +// no-prefer-dynamic +#![crate_name = "crateresolve1"] +#![crate_type = "lib"] + +pub fn f() -> isize { 30 } diff --git a/tests/ui/crate-loading/auxiliary/crateresolve2-1.rs b/tests/ui/crate-loading/auxiliary/crateresolve2-1.rs new file mode 100644 index 000000000..e9459ed07 --- /dev/null +++ b/tests/ui/crate-loading/auxiliary/crateresolve2-1.rs @@ -0,0 +1,5 @@ +// compile-flags:-C extra-filename=-1 --emit=metadata +#![crate_name = "crateresolve2"] +#![crate_type = "lib"] + +pub fn f() -> isize { 10 } diff --git a/tests/ui/crate-loading/auxiliary/crateresolve2-2.rs b/tests/ui/crate-loading/auxiliary/crateresolve2-2.rs new file mode 100644 index 000000000..c45416827 --- /dev/null +++ b/tests/ui/crate-loading/auxiliary/crateresolve2-2.rs @@ -0,0 +1,5 @@ +// compile-flags:-C extra-filename=-2 --emit=metadata +#![crate_name = "crateresolve2"] +#![crate_type = "lib"] + +pub fn f() -> isize { 20 } diff --git a/tests/ui/crate-loading/auxiliary/crateresolve2-3.rs b/tests/ui/crate-loading/auxiliary/crateresolve2-3.rs new file mode 100644 index 000000000..b356db4b6 --- /dev/null +++ b/tests/ui/crate-loading/auxiliary/crateresolve2-3.rs @@ -0,0 +1,5 @@ +// compile-flags:-C extra-filename=-3 --emit=metadata +#![crate_name = "crateresolve2"] +#![crate_type = "lib"] + +pub fn f() -> isize { 30 } diff --git a/tests/ui/crate-loading/auxiliary/libfoo.rlib b/tests/ui/crate-loading/auxiliary/libfoo.rlib new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/tests/ui/crate-loading/auxiliary/libfoo.rlib diff --git a/tests/ui/crate-loading/auxiliary/proc-macro.rs b/tests/ui/crate-loading/auxiliary/proc-macro.rs new file mode 100644 index 000000000..52631de57 --- /dev/null +++ b/tests/ui/crate-loading/auxiliary/proc-macro.rs @@ -0,0 +1,12 @@ +// force-host +// no-prefer-dynamic +#![crate_name = "reproduction"] +#![crate_type = "proc-macro"] + +extern crate proc_macro; +use proc_macro::TokenStream; + +#[proc_macro] +pub fn mac(input: TokenStream) -> TokenStream { + input +} diff --git a/tests/ui/crate-loading/crateresolve1.rs b/tests/ui/crate-loading/crateresolve1.rs new file mode 100644 index 000000000..61a1ee263 --- /dev/null +++ b/tests/ui/crate-loading/crateresolve1.rs @@ -0,0 +1,14 @@ +// aux-build:crateresolve1-1.rs +// aux-build:crateresolve1-2.rs +// aux-build:crateresolve1-3.rs + +// normalize-stderr-test: "\.nll/" -> "/" +// normalize-stderr-test: "\\\?\\" -> "" +// normalize-stderr-test: "(lib)?crateresolve1-([123])\.[a-z]+" -> "libcrateresolve1-$2.somelib" + +// NOTE: This test is duplicated at `tests/ui/error-codes/E0464.rs`. + +extern crate crateresolve1; +//~^ ERROR multiple candidates for `rlib` dependency `crateresolve1` found + +fn main() {} diff --git a/tests/ui/crate-loading/crateresolve1.stderr b/tests/ui/crate-loading/crateresolve1.stderr new file mode 100644 index 000000000..7b840b526 --- /dev/null +++ b/tests/ui/crate-loading/crateresolve1.stderr @@ -0,0 +1,13 @@ +error[E0464]: multiple candidates for `rlib` dependency `crateresolve1` found + --> $DIR/crateresolve1.rs:11:1 + | +LL | extern crate crateresolve1; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: candidate #1: $TEST_BUILD_DIR/crate-loading/crateresolve1/auxiliary/libcrateresolve1-1.somelib + = note: candidate #2: $TEST_BUILD_DIR/crate-loading/crateresolve1/auxiliary/libcrateresolve1-2.somelib + = note: candidate #3: $TEST_BUILD_DIR/crate-loading/crateresolve1/auxiliary/libcrateresolve1-3.somelib + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0464`. diff --git a/tests/ui/crate-loading/crateresolve2.rs b/tests/ui/crate-loading/crateresolve2.rs new file mode 100644 index 000000000..0774c0dfd --- /dev/null +++ b/tests/ui/crate-loading/crateresolve2.rs @@ -0,0 +1,13 @@ +// check-fail + +// aux-build:crateresolve2-1.rs +// aux-build:crateresolve2-2.rs +// aux-build:crateresolve2-3.rs + +// normalize-stderr-test: "\.nll/" -> "/" +// normalize-stderr-test: "\\\?\\" -> "" + +extern crate crateresolve2; +//~^ ERROR multiple candidates for `rmeta` dependency `crateresolve2` found + +fn main() {} diff --git a/tests/ui/crate-loading/crateresolve2.stderr b/tests/ui/crate-loading/crateresolve2.stderr new file mode 100644 index 000000000..a36f4f022 --- /dev/null +++ b/tests/ui/crate-loading/crateresolve2.stderr @@ -0,0 +1,13 @@ +error[E0464]: multiple candidates for `rmeta` dependency `crateresolve2` found + --> $DIR/crateresolve2.rs:10:1 + | +LL | extern crate crateresolve2; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: candidate #1: $TEST_BUILD_DIR/crate-loading/crateresolve2/auxiliary/libcrateresolve2-1.rmeta + = note: candidate #2: $TEST_BUILD_DIR/crate-loading/crateresolve2/auxiliary/libcrateresolve2-2.rmeta + = note: candidate #3: $TEST_BUILD_DIR/crate-loading/crateresolve2/auxiliary/libcrateresolve2-3.rmeta + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0464`. diff --git a/tests/ui/crate-loading/cross-compiled-proc-macro.rs b/tests/ui/crate-loading/cross-compiled-proc-macro.rs new file mode 100644 index 000000000..c1f433143 --- /dev/null +++ b/tests/ui/crate-loading/cross-compiled-proc-macro.rs @@ -0,0 +1,8 @@ +// edition:2018 +// compile-flags:--extern reproduction +// aux-build:proc-macro.rs +// check-pass + +reproduction::mac!(); + +fn main() {} diff --git a/tests/ui/crate-loading/invalid-rlib.rs b/tests/ui/crate-loading/invalid-rlib.rs new file mode 100644 index 000000000..aea861e32 --- /dev/null +++ b/tests/ui/crate-loading/invalid-rlib.rs @@ -0,0 +1,10 @@ +// compile-flags: --crate-type lib --extern foo={{src-base}}/crate-loading/auxiliary/libfoo.rlib +// normalize-stderr-test: "failed to mmap file '.*auxiliary/libfoo.rlib':.*" -> "failed to mmap file 'auxiliary/libfoo.rlib'" +// don't emit warn logging, it's basically the same as the errors and it's annoying to normalize +// rustc-env:RUSTC_LOG=error +// edition:2018 +#![no_std] +use ::foo; //~ ERROR invalid metadata files for crate `foo` +//~| NOTE failed to mmap file +//~^^ ERROR invalid metadata files for crate `foo` +//~| NOTE failed to mmap file diff --git a/tests/ui/crate-loading/invalid-rlib.stderr b/tests/ui/crate-loading/invalid-rlib.stderr new file mode 100644 index 000000000..3c0d23bf7 --- /dev/null +++ b/tests/ui/crate-loading/invalid-rlib.stderr @@ -0,0 +1,19 @@ +error[E0786]: found invalid metadata files for crate `foo` + --> $DIR/invalid-rlib.rs:7:7 + | +LL | use ::foo; + | ^^^ + | + = note: failed to mmap file 'auxiliary/libfoo.rlib' + +error[E0786]: found invalid metadata files for crate `foo` + --> $DIR/invalid-rlib.rs:7:7 + | +LL | use ::foo; + | ^^^ + | + = note: failed to mmap file 'auxiliary/libfoo.rlib' + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0786`. diff --git a/tests/ui/crate-loading/missing-std.rs b/tests/ui/crate-loading/missing-std.rs new file mode 100644 index 000000000..400d9f6e0 --- /dev/null +++ b/tests/ui/crate-loading/missing-std.rs @@ -0,0 +1,12 @@ +// compile-flags: --target x86_64-unknown-uefi +// needs-llvm-components: x86 +// rustc-env:CARGO=/usr/bin/cargo +#![feature(no_core)] +#![no_core] +extern crate core; +//~^ ERROR can't find crate for `core` +//~| NOTE can't find crate +//~| NOTE target may not be installed +//~| HELP consider building the standard library from source with `cargo build -Zbuild-std` +//~| HELP consider downloading the target with `rustup target add x86_64-unknown-uefi` +fn main() {} diff --git a/tests/ui/crate-loading/missing-std.stderr b/tests/ui/crate-loading/missing-std.stderr new file mode 100644 index 000000000..70bcae1e0 --- /dev/null +++ b/tests/ui/crate-loading/missing-std.stderr @@ -0,0 +1,15 @@ +error[E0463]: can't find crate for `core` + --> $DIR/missing-std.rs:6:1 + | +LL | extern crate core; + | ^^^^^^^^^^^^^^^^^^ can't find crate + | + = note: the `x86_64-unknown-uefi` target may not be installed + = help: consider downloading the target with `rustup target add x86_64-unknown-uefi` + = help: consider building the standard library from source with `cargo build -Zbuild-std` + +error: requires `sized` lang_item + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0463`. |