diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 18:31:44 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 18:31:44 +0000 |
commit | c23a457e72abe608715ac76f076f47dc42af07a5 (patch) | |
tree | 2772049aaf84b5c9d0ed12ec8d86812f7a7904b6 /tests/ui/lang-items | |
parent | Releasing progress-linux version 1.73.0+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-c23a457e72abe608715ac76f076f47dc42af07a5.tar.xz rustc-c23a457e72abe608715ac76f076f47dc42af07a5.zip |
Merging upstream version 1.74.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/lang-items')
15 files changed, 111 insertions, 55 deletions
diff --git a/tests/ui/lang-items/start_lang_item_args.argc.stderr b/tests/ui/lang-items/start_lang_item_args.argc.stderr index 65c99a93c..66d4397a2 100644 --- a/tests/ui/lang-items/start_lang_item_args.argc.stderr +++ b/tests/ui/lang-items/start_lang_item_args.argc.stderr @@ -1,8 +1,12 @@ -error: parameter 2 of the `start` lang item is incorrect +error[E0308]: lang item `start` function has wrong type --> $DIR/start_lang_item_args.rs:75:38 | LL | fn start<T>(_main: fn() -> T, _argc: i8, _argv: *const *const u8, _sigpipe: u8) -> isize { - | ^^ help: change the type from `i8` to `isize` + | ^^ expected `isize`, found `i8` + | + = note: expected signature `fn(fn() -> _, isize, _, _) -> _` + found signature `fn(fn() -> _, i8, _, _) -> _` error: aborting due to previous error +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/lang-items/start_lang_item_args.argv.stderr b/tests/ui/lang-items/start_lang_item_args.argv.stderr index f0947a9b3..53d776cd8 100644 --- a/tests/ui/lang-items/start_lang_item_args.argv.stderr +++ b/tests/ui/lang-items/start_lang_item_args.argv.stderr @@ -1,8 +1,12 @@ -error: parameter 3 of the `start` lang item is incorrect +error[E0308]: lang item `start` function has wrong type --> $DIR/start_lang_item_args.rs:89:52 | LL | fn start<T>(_main: fn() -> T, _argc: isize, _argv: u8, _sigpipe: u8) -> isize { - | ^^ help: change the type from `u8` to `*const *const u8` + | ^^ expected `*const *const u8`, found `u8` + | + = note: expected signature `fn(fn() -> _, _, *const *const u8, _) -> _` + found signature `fn(fn() -> _, _, u8, _) -> _` error: aborting due to previous error +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/lang-items/start_lang_item_args.argv_inner_ptr.stderr b/tests/ui/lang-items/start_lang_item_args.argv_inner_ptr.stderr index 08efd5088..7d002e090 100644 --- a/tests/ui/lang-items/start_lang_item_args.argv_inner_ptr.stderr +++ b/tests/ui/lang-items/start_lang_item_args.argv_inner_ptr.stderr @@ -1,13 +1,12 @@ -error: parameter 3 of the `start` lang item is incorrect +error[E0308]: lang item `start` function has wrong type --> $DIR/start_lang_item_args.rs:82:52 | LL | fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const usize, _sigpipe: u8) -> isize { - | ^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^ expected `u8`, found `usize` | -help: change the type from `*const *const usize` to `*const *const u8` - | -LL | fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8, _sigpipe: u8) -> isize { - | ~~~~~~~~~~~~~~~~ + = note: expected signature `fn(fn() -> _, _, *const *const u8, _) -> _` + found signature `fn(fn() -> _, _, *const *const usize, _) -> _` error: aborting due to previous error +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/lang-items/start_lang_item_args.main_args.stderr b/tests/ui/lang-items/start_lang_item_args.main_args.stderr index c20a74466..91994b9d7 100644 --- a/tests/ui/lang-items/start_lang_item_args.main_args.stderr +++ b/tests/ui/lang-items/start_lang_item_args.main_args.stderr @@ -1,13 +1,12 @@ -error: parameter 1 of the `start` lang item is incorrect - --> $DIR/start_lang_item_args.rs:61:20 +error[E0308]: lang item `start` function has wrong type + --> $DIR/start_lang_item_args.rs:61:1 | LL | fn start<T>(_main: fn(i32) -> T, _argc: isize, _argv: *const *const u8, _sigpipe: u8) -> isize { - | ^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect number of function parameters | -help: change the type from `fn(i32) -> T` to `fn() -> T` - | -LL | fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8, _sigpipe: u8) -> isize { - | ~~~~~~~~~ + = note: expected signature `fn(fn() -> _, _, _, _) -> _` + found signature `fn(fn(i32) -> _, _, _, _) -> _` error: aborting due to previous error +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/lang-items/start_lang_item_args.main_ret.stderr b/tests/ui/lang-items/start_lang_item_args.main_ret.stderr index 8f967252f..4582b6985 100644 --- a/tests/ui/lang-items/start_lang_item_args.main_ret.stderr +++ b/tests/ui/lang-items/start_lang_item_args.main_ret.stderr @@ -1,13 +1,14 @@ -error: parameter 1 of the `start` lang item is incorrect +error[E0308]: lang item `start` function has wrong type --> $DIR/start_lang_item_args.rs:68:20 | LL | fn start<T>(_main: fn() -> u16, _argc: isize, _argv: *const *const u8, _sigpipe: u8) -> isize { - | ^^^^^^^^^^^ + | - ^^^^^^^^^^^ expected type parameter `T`, found `u16` + | | + | this type parameter | -help: change the type from `fn() -> u16` to `fn() -> T` - | -LL | fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8, _sigpipe: u8) -> isize { - | ~~~~~~~~~ + = note: expected signature `fn(fn() -> T, _, _, _) -> _` + found signature `fn(fn() -> u16, _, _, _) -> _` error: aborting due to previous error +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/lang-items/start_lang_item_args.main_ty.stderr b/tests/ui/lang-items/start_lang_item_args.main_ty.stderr index deb37b868..87940d05e 100644 --- a/tests/ui/lang-items/start_lang_item_args.main_ty.stderr +++ b/tests/ui/lang-items/start_lang_item_args.main_ty.stderr @@ -1,8 +1,12 @@ -error: parameter 1 of the `start` lang item is incorrect +error[E0308]: lang item `start` function has wrong type --> $DIR/start_lang_item_args.rs:54:20 | LL | fn start<T>(_main: u64, _argc: isize, _argv: *const *const u8, _sigpipe: u8) -> isize { - | ^^^ help: change the type from `u64` to `fn() -> T` + | ^^^ expected fn pointer, found `u64` + | + = note: expected signature `fn(fn() -> T, _, _, _) -> _` + found signature `fn(u64, _, _, _) -> _` error: aborting due to previous error +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/lang-items/start_lang_item_args.missing_all_args.stderr b/tests/ui/lang-items/start_lang_item_args.missing_all_args.stderr index 004c2a67f..5363871e2 100644 --- a/tests/ui/lang-items/start_lang_item_args.missing_all_args.stderr +++ b/tests/ui/lang-items/start_lang_item_args.missing_all_args.stderr @@ -1,11 +1,12 @@ -error: incorrect number of parameters for the `start` lang item +error[E0308]: lang item `start` function has wrong type --> $DIR/start_lang_item_args.rs:15:1 | LL | fn start<T>() -> isize { - | ^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^ incorrect number of function parameters | - = note: the `start` lang item should have four parameters, but found 0 - = note: the `start` lang item should have the signature `fn(fn() -> T, isize, *const *const u8, u8) -> isize` + = note: expected signature `fn(fn() -> T, isize, *const *const u8, u8) -> _` + found signature `fn() -> _` error: aborting due to previous error +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/lang-items/start_lang_item_args.missing_ret.stderr b/tests/ui/lang-items/start_lang_item_args.missing_ret.stderr index 1d8285b59..2bb29f911 100644 --- a/tests/ui/lang-items/start_lang_item_args.missing_ret.stderr +++ b/tests/ui/lang-items/start_lang_item_args.missing_ret.stderr @@ -1,8 +1,12 @@ -error: the return type of the `start` lang item is incorrect +error[E0308]: lang item `start` function has wrong type --> $DIR/start_lang_item_args.rs:29:84 | LL | fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8, _sigpipe: u8) {} - | ^ help: change the type from `()` to `isize` + | ^ expected `isize`, found `()` + | + = note: expected signature `fn(fn() -> _, _, _, _) -> isize` + found signature `fn(fn() -> _, _, _, _)` error: aborting due to previous error +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/lang-items/start_lang_item_args.missing_sigpipe_arg.stderr b/tests/ui/lang-items/start_lang_item_args.missing_sigpipe_arg.stderr index e545a750f..f873f7614 100644 --- a/tests/ui/lang-items/start_lang_item_args.missing_sigpipe_arg.stderr +++ b/tests/ui/lang-items/start_lang_item_args.missing_sigpipe_arg.stderr @@ -1,11 +1,12 @@ -error: incorrect number of parameters for the `start` lang item +error[E0308]: lang item `start` function has wrong type --> $DIR/start_lang_item_args.rs:22:1 | LL | fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8) -> isize { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect number of function parameters | - = note: the `start` lang item should have four parameters, but found 3 - = note: the `start` lang item should have the signature `fn(fn() -> T, isize, *const *const u8, u8) -> isize` + = note: expected signature `fn(fn() -> T, isize, *const *const u8, u8) -> _` + found signature `fn(fn() -> T, isize, *const *const u8) -> _` error: aborting due to previous error +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/lang-items/start_lang_item_args.rs b/tests/ui/lang-items/start_lang_item_args.rs index 0dbfba39c..4a0302bcb 100644 --- a/tests/ui/lang-items/start_lang_item_args.rs +++ b/tests/ui/lang-items/start_lang_item_args.rs @@ -13,33 +13,33 @@ pub trait Sized {} #[cfg(missing_all_args)] #[lang = "start"] fn start<T>() -> isize { - //[missing_all_args]~^ ERROR incorrect number of parameters + //[missing_all_args]~^ ERROR lang item `start` function has wrong type [E0308] 100 } #[cfg(missing_sigpipe_arg)] #[lang = "start"] fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8) -> isize { - //[missing_sigpipe_arg]~^ ERROR incorrect number of parameters + //[missing_sigpipe_arg]~^ ERROR lang item `start` function has wrong type [E0308] 100 } #[cfg(missing_ret)] #[lang = "start"] fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8, _sigpipe: u8) {} -//[missing_ret]~^ ERROR the return type of the `start` lang item is incorrect +//[missing_ret]~^ ERROR lang item `start` function has wrong type [E0308] #[cfg(start_ret)] #[lang = "start"] fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8, _sigpipe: u8) -> u8 { - //[start_ret]~^ ERROR the return type of the `start` lang item is incorrect + //[start_ret]~^ ERROR lang item `start` function has wrong type [E0308] 100 } #[cfg(too_many_args)] #[lang = "start"] fn start<T>( - //[too_many_args]~^ ERROR incorrect number of parameters + //[too_many_args]~^ ERROR lang item `start` function has wrong type [E0308] _main: fn() -> T, _argc: isize, _argv: *const *const u8, @@ -52,49 +52,49 @@ fn start<T>( #[cfg(main_ty)] #[lang = "start"] fn start<T>(_main: u64, _argc: isize, _argv: *const *const u8, _sigpipe: u8) -> isize { - //[main_ty]~^ ERROR parameter 1 of the `start` lang item is incorrect + //[main_ty]~^ ERROR lang item `start` function has wrong type [E0308] 100 } #[cfg(main_args)] #[lang = "start"] fn start<T>(_main: fn(i32) -> T, _argc: isize, _argv: *const *const u8, _sigpipe: u8) -> isize { - //[main_args]~^ ERROR parameter 1 of the `start` lang item is incorrect + //[main_args]~^ ERROR lang item `start` function has wrong type [E0308] 100 } #[cfg(main_ret)] #[lang = "start"] fn start<T>(_main: fn() -> u16, _argc: isize, _argv: *const *const u8, _sigpipe: u8) -> isize { - //[main_ret]~^ ERROR parameter 1 of the `start` lang item is incorrect + //[main_ret]~^ ERROR lang item `start` function has wrong type [E0308] 100 } #[cfg(argc)] #[lang = "start"] fn start<T>(_main: fn() -> T, _argc: i8, _argv: *const *const u8, _sigpipe: u8) -> isize { - //[argc]~^ ERROR parameter 2 of the `start` lang item is incorrect + //[argc]~^ ERROR lang item `start` function has wrong type [E0308] 100 } #[cfg(argv_inner_ptr)] #[lang = "start"] fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const usize, _sigpipe: u8) -> isize { - //[argv_inner_ptr]~^ ERROR parameter 3 of the `start` lang item is incorrect + //[argv_inner_ptr]~^ ERROR lang item `start` function has wrong type [E0308] 100 } #[cfg(argv)] #[lang = "start"] fn start<T>(_main: fn() -> T, _argc: isize, _argv: u8, _sigpipe: u8) -> isize { - //[argv]~^ ERROR parameter 3 of the `start` lang item is incorrect + //[argv]~^ ERROR lang item `start` function has wrong type [E0308] 100 } #[cfg(sigpipe)] #[lang = "start"] fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8, _sigpipe: i64) -> isize { - //[sigpipe]~^ ERROR parameter 4 of the `start` lang item is incorrect + //[sigpipe]~^ ERROR lang item `start` function has wrong type [E0308] 100 } diff --git a/tests/ui/lang-items/start_lang_item_args.sigpipe.stderr b/tests/ui/lang-items/start_lang_item_args.sigpipe.stderr index b20ae3128..280d423bd 100644 --- a/tests/ui/lang-items/start_lang_item_args.sigpipe.stderr +++ b/tests/ui/lang-items/start_lang_item_args.sigpipe.stderr @@ -1,8 +1,12 @@ -error: parameter 4 of the `start` lang item is incorrect +error[E0308]: lang item `start` function has wrong type --> $DIR/start_lang_item_args.rs:96:80 | LL | fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8, _sigpipe: i64) -> isize { - | ^^^ help: change the type from `i64` to `u8` + | ^^^ expected `u8`, found `i64` + | + = note: expected signature `fn(fn() -> _, _, _, u8) -> _` + found signature `fn(fn() -> _, _, _, i64) -> _` error: aborting due to previous error +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/lang-items/start_lang_item_args.start_ret.stderr b/tests/ui/lang-items/start_lang_item_args.start_ret.stderr index 935d5f3c8..4e4f8a5cd 100644 --- a/tests/ui/lang-items/start_lang_item_args.start_ret.stderr +++ b/tests/ui/lang-items/start_lang_item_args.start_ret.stderr @@ -1,8 +1,12 @@ -error: the return type of the `start` lang item is incorrect +error[E0308]: lang item `start` function has wrong type --> $DIR/start_lang_item_args.rs:34:87 | LL | fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8, _sigpipe: u8) -> u8 { - | ^^ help: change the type from `u8` to `isize` + | ^^ expected `isize`, found `u8` + | + = note: expected signature `fn(fn() -> _, _, _, _) -> isize` + found signature `fn(fn() -> _, _, _, _) -> u8` error: aborting due to previous error +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/lang-items/start_lang_item_args.too_many_args.stderr b/tests/ui/lang-items/start_lang_item_args.too_many_args.stderr index 30a7ed18a..085d4b1f2 100644 --- a/tests/ui/lang-items/start_lang_item_args.too_many_args.stderr +++ b/tests/ui/lang-items/start_lang_item_args.too_many_args.stderr @@ -1,4 +1,4 @@ -error: incorrect number of parameters for the `start` lang item +error[E0308]: lang item `start` function has wrong type --> $DIR/start_lang_item_args.rs:41:1 | LL | / fn start<T>( @@ -8,10 +8,11 @@ LL | | _argc: isize, ... | LL | | _extra_arg: (), LL | | ) -> isize { - | |__________^ + | |__________^ incorrect number of function parameters | - = note: the `start` lang item should have four parameters, but found 5 - = note: the `start` lang item should have the signature `fn(fn() -> T, isize, *const *const u8, u8) -> isize` + = note: expected signature `fn(fn() -> T, isize, *const *const u8, u8) -> _` + found signature `fn(fn() -> T, isize, *const *const u8, u8, ()) -> _` error: aborting due to previous error +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/lang-items/start_lang_item_with_target_feature.rs b/tests/ui/lang-items/start_lang_item_with_target_feature.rs new file mode 100644 index 000000000..3052b7bb5 --- /dev/null +++ b/tests/ui/lang-items/start_lang_item_with_target_feature.rs @@ -0,0 +1,19 @@ +// only-x86_64 +// check-fail + +#![feature(lang_items, no_core, target_feature_11)] +#![no_core] + +#[lang = "copy"] +pub trait Copy {} +#[lang = "sized"] +pub trait Sized {} + +#[lang = "start"] +#[target_feature(enable = "avx2")] +//~^ ERROR `start` language item function is not allowed to have `#[target_feature]` +fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8, _sigpipe: u8) -> isize { + 0 +} + +fn main() {} diff --git a/tests/ui/lang-items/start_lang_item_with_target_feature.stderr b/tests/ui/lang-items/start_lang_item_with_target_feature.stderr new file mode 100644 index 000000000..ff55a1365 --- /dev/null +++ b/tests/ui/lang-items/start_lang_item_with_target_feature.stderr @@ -0,0 +1,11 @@ +error: `start` language item function is not allowed to have `#[target_feature]` + --> $DIR/start_lang_item_with_target_feature.rs:13:1 + | +LL | #[target_feature(enable = "avx2")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | +LL | fn start<T>(_main: fn() -> T, _argc: isize, _argv: *const *const u8, _sigpipe: u8) -> isize { + | ------------------------------------------------------------------------------------------- `start` language item function is not allowed to have `#[target_feature]` + +error: aborting due to previous error + |