Remove revisions for THIR unsafeck

This is to make the diff when stabilizing it easier to review.
This commit is contained in:
Matthew Jasper 2023-10-26 16:13:20 +00:00
parent 5113ed28ea
commit 982b49494e
266 changed files with 694 additions and 4667 deletions

View file

@ -1,8 +1,6 @@
// only-aarch64 // only-aarch64
// run-pass // run-pass
// needs-asm-support // needs-asm-support
// revisions: mirunsafeck thirunsafeck
// [thirunsafeck]compile-flags: -Z thir-unsafeck
#![feature(asm_const)] #![feature(asm_const)]

View file

@ -1,7 +1,5 @@
// compile-flags: --target sparc-unknown-linux-gnu // compile-flags: --target sparc-unknown-linux-gnu
// needs-llvm-components: sparc // needs-llvm-components: sparc
// revisions: mirunsafeck thirunsafeck
// [thirunsafeck]compile-flags: -Z thir-unsafeck
#![feature(no_core, lang_items, rustc_attrs)] #![feature(no_core, lang_items, rustc_attrs)]
#![no_core] #![no_core]

View file

@ -1,11 +1,11 @@
error[E0472]: inline assembly is unsupported on this target error[E0472]: inline assembly is unsupported on this target
--> $DIR/bad-arch.rs:22:9 --> $DIR/bad-arch.rs:20:9
| |
LL | asm!(""); LL | asm!("");
| ^^^^^^^^ | ^^^^^^^^
error[E0472]: inline assembly is unsupported on this target error[E0472]: inline assembly is unsupported on this target
--> $DIR/bad-arch.rs:27:1 --> $DIR/bad-arch.rs:25:1
| |
LL | global_asm!(""); LL | global_asm!("");
| ^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^

View file

@ -1,17 +0,0 @@
error[E0472]: inline assembly is unsupported on this target
--> $DIR/bad-arch.rs:22:9
|
LL | asm!("");
| ^^^^^^^^
error[E0472]: inline assembly is unsupported on this target
--> $DIR/bad-arch.rs:27:1
|
LL | global_asm!("");
| ^^^^^^^^^^^^^^^
|
= note: this error originates in the macro `global_asm` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0472`.

View file

@ -1,5 +1,5 @@
error: invalid reference to argument at index 0 error: invalid reference to argument at index 0
--> $DIR/bad-template.rs:31:15 --> $DIR/bad-template.rs:27:15
| |
LL | asm!("{}"); LL | asm!("{}");
| ^^ from here | ^^ from here
@ -7,7 +7,7 @@ LL | asm!("{}");
= note: no arguments were given = note: no arguments were given
error: invalid reference to argument at index 1 error: invalid reference to argument at index 1
--> $DIR/bad-template.rs:33:15 --> $DIR/bad-template.rs:29:15
| |
LL | asm!("{1}", in(reg) foo); LL | asm!("{1}", in(reg) foo);
| ^^^ from here | ^^^ from here
@ -15,7 +15,7 @@ LL | asm!("{1}", in(reg) foo);
= note: there is 1 argument = note: there is 1 argument
error: argument never used error: argument never used
--> $DIR/bad-template.rs:33:21 --> $DIR/bad-template.rs:29:21
| |
LL | asm!("{1}", in(reg) foo); LL | asm!("{1}", in(reg) foo);
| ^^^^^^^^^^^ argument never used | ^^^^^^^^^^^ argument never used
@ -23,13 +23,13 @@ LL | asm!("{1}", in(reg) foo);
= help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {0} */"` = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {0} */"`
error: there is no argument named `a` error: there is no argument named `a`
--> $DIR/bad-template.rs:36:16 --> $DIR/bad-template.rs:32:16
| |
LL | asm!("{a}"); LL | asm!("{a}");
| ^ | ^
error: invalid reference to argument at index 0 error: invalid reference to argument at index 0
--> $DIR/bad-template.rs:38:15 --> $DIR/bad-template.rs:34:15
| |
LL | asm!("{}", a = in(reg) foo); LL | asm!("{}", a = in(reg) foo);
| ^^ --------------- named argument | ^^ --------------- named argument
@ -38,13 +38,13 @@ LL | asm!("{}", a = in(reg) foo);
| |
= note: no positional arguments were given = note: no positional arguments were given
note: named arguments cannot be referenced by position note: named arguments cannot be referenced by position
--> $DIR/bad-template.rs:38:20 --> $DIR/bad-template.rs:34:20
| |
LL | asm!("{}", a = in(reg) foo); LL | asm!("{}", a = in(reg) foo);
| ^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^
error: named argument never used error: named argument never used
--> $DIR/bad-template.rs:38:20 --> $DIR/bad-template.rs:34:20
| |
LL | asm!("{}", a = in(reg) foo); LL | asm!("{}", a = in(reg) foo);
| ^^^^^^^^^^^^^^^ named argument never used | ^^^^^^^^^^^^^^^ named argument never used
@ -52,7 +52,7 @@ LL | asm!("{}", a = in(reg) foo);
= help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"` = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"`
error: invalid reference to argument at index 1 error: invalid reference to argument at index 1
--> $DIR/bad-template.rs:41:15 --> $DIR/bad-template.rs:37:15
| |
LL | asm!("{1}", a = in(reg) foo); LL | asm!("{1}", a = in(reg) foo);
| ^^^ from here | ^^^ from here
@ -60,7 +60,7 @@ LL | asm!("{1}", a = in(reg) foo);
= note: no positional arguments were given = note: no positional arguments were given
error: named argument never used error: named argument never used
--> $DIR/bad-template.rs:41:21 --> $DIR/bad-template.rs:37:21
| |
LL | asm!("{1}", a = in(reg) foo); LL | asm!("{1}", a = in(reg) foo);
| ^^^^^^^^^^^^^^^ named argument never used | ^^^^^^^^^^^^^^^ named argument never used
@ -68,7 +68,7 @@ LL | asm!("{1}", a = in(reg) foo);
= help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"` = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"`
error: invalid reference to argument at index 0 error: invalid reference to argument at index 0
--> $DIR/bad-template.rs:48:15 --> $DIR/bad-template.rs:44:15
| |
LL | asm!("{}", in("x0") foo); LL | asm!("{}", in("x0") foo);
| ^^ ------------ explicit register argument | ^^ ------------ explicit register argument
@ -77,24 +77,24 @@ LL | asm!("{}", in("x0") foo);
| |
= note: no positional arguments were given = note: no positional arguments were given
note: explicit register arguments cannot be used in the asm template note: explicit register arguments cannot be used in the asm template
--> $DIR/bad-template.rs:48:20 --> $DIR/bad-template.rs:44:20
| |
LL | asm!("{}", in("x0") foo); LL | asm!("{}", in("x0") foo);
| ^^^^^^^^^^^^ | ^^^^^^^^^^^^
help: use the register name directly in the assembly code help: use the register name directly in the assembly code
--> $DIR/bad-template.rs:48:20 --> $DIR/bad-template.rs:44:20
| |
LL | asm!("{}", in("x0") foo); LL | asm!("{}", in("x0") foo);
| ^^^^^^^^^^^^ | ^^^^^^^^^^^^
error: asm template modifier must be a single character error: asm template modifier must be a single character
--> $DIR/bad-template.rs:50:17 --> $DIR/bad-template.rs:46:17
| |
LL | asm!("{:foo}", in(reg) foo); LL | asm!("{:foo}", in(reg) foo);
| ^^^ | ^^^
error: multiple unused asm arguments error: multiple unused asm arguments
--> $DIR/bad-template.rs:53:18 --> $DIR/bad-template.rs:49:18
| |
LL | asm!("", in(reg) 0, in(reg) 1); LL | asm!("", in(reg) 0, in(reg) 1);
| ^^^^^^^^^ ^^^^^^^^^ argument never used | ^^^^^^^^^ ^^^^^^^^^ argument never used
@ -104,7 +104,7 @@ LL | asm!("", in(reg) 0, in(reg) 1);
= help: if these arguments are intentionally unused, consider using them in an asm comment: `"/* {0} {1} */"` = help: if these arguments are intentionally unused, consider using them in an asm comment: `"/* {0} {1} */"`
error: invalid reference to argument at index 0 error: invalid reference to argument at index 0
--> $DIR/bad-template.rs:59:14 --> $DIR/bad-template.rs:55:14
| |
LL | global_asm!("{}"); LL | global_asm!("{}");
| ^^ from here | ^^ from here
@ -112,7 +112,7 @@ LL | global_asm!("{}");
= note: no arguments were given = note: no arguments were given
error: invalid reference to argument at index 1 error: invalid reference to argument at index 1
--> $DIR/bad-template.rs:61:14 --> $DIR/bad-template.rs:57:14
| |
LL | global_asm!("{1}", const FOO); LL | global_asm!("{1}", const FOO);
| ^^^ from here | ^^^ from here
@ -120,7 +120,7 @@ LL | global_asm!("{1}", const FOO);
= note: there is 1 argument = note: there is 1 argument
error: argument never used error: argument never used
--> $DIR/bad-template.rs:61:20 --> $DIR/bad-template.rs:57:20
| |
LL | global_asm!("{1}", const FOO); LL | global_asm!("{1}", const FOO);
| ^^^^^^^^^ argument never used | ^^^^^^^^^ argument never used
@ -128,13 +128,13 @@ LL | global_asm!("{1}", const FOO);
= help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {0} */"` = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {0} */"`
error: there is no argument named `a` error: there is no argument named `a`
--> $DIR/bad-template.rs:64:15 --> $DIR/bad-template.rs:60:15
| |
LL | global_asm!("{a}"); LL | global_asm!("{a}");
| ^ | ^
error: invalid reference to argument at index 0 error: invalid reference to argument at index 0
--> $DIR/bad-template.rs:66:14 --> $DIR/bad-template.rs:62:14
| |
LL | global_asm!("{}", a = const FOO); LL | global_asm!("{}", a = const FOO);
| ^^ ------------- named argument | ^^ ------------- named argument
@ -143,13 +143,13 @@ LL | global_asm!("{}", a = const FOO);
| |
= note: no positional arguments were given = note: no positional arguments were given
note: named arguments cannot be referenced by position note: named arguments cannot be referenced by position
--> $DIR/bad-template.rs:66:19 --> $DIR/bad-template.rs:62:19
| |
LL | global_asm!("{}", a = const FOO); LL | global_asm!("{}", a = const FOO);
| ^^^^^^^^^^^^^ | ^^^^^^^^^^^^^
error: named argument never used error: named argument never used
--> $DIR/bad-template.rs:66:19 --> $DIR/bad-template.rs:62:19
| |
LL | global_asm!("{}", a = const FOO); LL | global_asm!("{}", a = const FOO);
| ^^^^^^^^^^^^^ named argument never used | ^^^^^^^^^^^^^ named argument never used
@ -157,7 +157,7 @@ LL | global_asm!("{}", a = const FOO);
= help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"` = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"`
error: invalid reference to argument at index 1 error: invalid reference to argument at index 1
--> $DIR/bad-template.rs:69:14 --> $DIR/bad-template.rs:65:14
| |
LL | global_asm!("{1}", a = const FOO); LL | global_asm!("{1}", a = const FOO);
| ^^^ from here | ^^^ from here
@ -165,7 +165,7 @@ LL | global_asm!("{1}", a = const FOO);
= note: no positional arguments were given = note: no positional arguments were given
error: named argument never used error: named argument never used
--> $DIR/bad-template.rs:69:20 --> $DIR/bad-template.rs:65:20
| |
LL | global_asm!("{1}", a = const FOO); LL | global_asm!("{1}", a = const FOO);
| ^^^^^^^^^^^^^ named argument never used | ^^^^^^^^^^^^^ named argument never used
@ -173,13 +173,13 @@ LL | global_asm!("{1}", a = const FOO);
= help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"` = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"`
error: asm template modifier must be a single character error: asm template modifier must be a single character
--> $DIR/bad-template.rs:72:16 --> $DIR/bad-template.rs:68:16
| |
LL | global_asm!("{:foo}", const FOO); LL | global_asm!("{:foo}", const FOO);
| ^^^ | ^^^
error: multiple unused asm arguments error: multiple unused asm arguments
--> $DIR/bad-template.rs:74:17 --> $DIR/bad-template.rs:70:17
| |
LL | global_asm!("", const FOO, const FOO); LL | global_asm!("", const FOO, const FOO);
| ^^^^^^^^^ ^^^^^^^^^ argument never used | ^^^^^^^^^ ^^^^^^^^^ argument never used
@ -189,7 +189,7 @@ LL | global_asm!("", const FOO, const FOO);
= help: if these arguments are intentionally unused, consider using them in an asm comment: `"/* {0} {1} */"` = help: if these arguments are intentionally unused, consider using them in an asm comment: `"/* {0} {1} */"`
warning: formatting may not be suitable for sub-register argument warning: formatting may not be suitable for sub-register argument
--> $DIR/bad-template.rs:50:15 --> $DIR/bad-template.rs:46:15
| |
LL | asm!("{:foo}", in(reg) foo); LL | asm!("{:foo}", in(reg) foo);
| ^^^^^^ --- for this argument | ^^^^^^ --- for this argument

View file

@ -1,202 +0,0 @@
error: invalid reference to argument at index 0
--> $DIR/bad-template.rs:31:15
|
LL | asm!("{}");
| ^^ from here
|
= note: no arguments were given
error: invalid reference to argument at index 1
--> $DIR/bad-template.rs:33:15
|
LL | asm!("{1}", in(reg) foo);
| ^^^ from here
|
= note: there is 1 argument
error: argument never used
--> $DIR/bad-template.rs:33:21
|
LL | asm!("{1}", in(reg) foo);
| ^^^^^^^^^^^ argument never used
|
= help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {0} */"`
error: there is no argument named `a`
--> $DIR/bad-template.rs:36:16
|
LL | asm!("{a}");
| ^
error: invalid reference to argument at index 0
--> $DIR/bad-template.rs:38:15
|
LL | asm!("{}", a = in(reg) foo);
| ^^ --------------- named argument
| |
| from here
|
= note: no positional arguments were given
note: named arguments cannot be referenced by position
--> $DIR/bad-template.rs:38:20
|
LL | asm!("{}", a = in(reg) foo);
| ^^^^^^^^^^^^^^^
error: named argument never used
--> $DIR/bad-template.rs:38:20
|
LL | asm!("{}", a = in(reg) foo);
| ^^^^^^^^^^^^^^^ named argument never used
|
= help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"`
error: invalid reference to argument at index 1
--> $DIR/bad-template.rs:41:15
|
LL | asm!("{1}", a = in(reg) foo);
| ^^^ from here
|
= note: no positional arguments were given
error: named argument never used
--> $DIR/bad-template.rs:41:21
|
LL | asm!("{1}", a = in(reg) foo);
| ^^^^^^^^^^^^^^^ named argument never used
|
= help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"`
error: invalid reference to argument at index 0
--> $DIR/bad-template.rs:48:15
|
LL | asm!("{}", in("x0") foo);
| ^^ ------------ explicit register argument
| |
| from here
|
= note: no positional arguments were given
note: explicit register arguments cannot be used in the asm template
--> $DIR/bad-template.rs:48:20
|
LL | asm!("{}", in("x0") foo);
| ^^^^^^^^^^^^
help: use the register name directly in the assembly code
--> $DIR/bad-template.rs:48:20
|
LL | asm!("{}", in("x0") foo);
| ^^^^^^^^^^^^
error: asm template modifier must be a single character
--> $DIR/bad-template.rs:50:17
|
LL | asm!("{:foo}", in(reg) foo);
| ^^^
error: multiple unused asm arguments
--> $DIR/bad-template.rs:53:18
|
LL | asm!("", in(reg) 0, in(reg) 1);
| ^^^^^^^^^ ^^^^^^^^^ argument never used
| |
| argument never used
|
= help: if these arguments are intentionally unused, consider using them in an asm comment: `"/* {0} {1} */"`
error: invalid reference to argument at index 0
--> $DIR/bad-template.rs:59:14
|
LL | global_asm!("{}");
| ^^ from here
|
= note: no arguments were given
error: invalid reference to argument at index 1
--> $DIR/bad-template.rs:61:14
|
LL | global_asm!("{1}", const FOO);
| ^^^ from here
|
= note: there is 1 argument
error: argument never used
--> $DIR/bad-template.rs:61:20
|
LL | global_asm!("{1}", const FOO);
| ^^^^^^^^^ argument never used
|
= help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {0} */"`
error: there is no argument named `a`
--> $DIR/bad-template.rs:64:15
|
LL | global_asm!("{a}");
| ^
error: invalid reference to argument at index 0
--> $DIR/bad-template.rs:66:14
|
LL | global_asm!("{}", a = const FOO);
| ^^ ------------- named argument
| |
| from here
|
= note: no positional arguments were given
note: named arguments cannot be referenced by position
--> $DIR/bad-template.rs:66:19
|
LL | global_asm!("{}", a = const FOO);
| ^^^^^^^^^^^^^
error: named argument never used
--> $DIR/bad-template.rs:66:19
|
LL | global_asm!("{}", a = const FOO);
| ^^^^^^^^^^^^^ named argument never used
|
= help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"`
error: invalid reference to argument at index 1
--> $DIR/bad-template.rs:69:14
|
LL | global_asm!("{1}", a = const FOO);
| ^^^ from here
|
= note: no positional arguments were given
error: named argument never used
--> $DIR/bad-template.rs:69:20
|
LL | global_asm!("{1}", a = const FOO);
| ^^^^^^^^^^^^^ named argument never used
|
= help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"`
error: asm template modifier must be a single character
--> $DIR/bad-template.rs:72:16
|
LL | global_asm!("{:foo}", const FOO);
| ^^^
error: multiple unused asm arguments
--> $DIR/bad-template.rs:74:17
|
LL | global_asm!("", const FOO, const FOO);
| ^^^^^^^^^ ^^^^^^^^^ argument never used
| |
| argument never used
|
= help: if these arguments are intentionally unused, consider using them in an asm comment: `"/* {0} {1} */"`
warning: formatting may not be suitable for sub-register argument
--> $DIR/bad-template.rs:50:15
|
LL | asm!("{:foo}", in(reg) foo);
| ^^^^^^ --- for this argument
|
= help: use `{0:w}` to have the register formatted as `w0`
= help: or use `{0:x}` to keep the default formatting of `x0`
= note: `#[warn(asm_sub_register)]` on by default
error: aborting due to 21 previous errors; 1 warning emitted

View file

@ -1,14 +1,10 @@
// revisions: x86_64_mirunsafeck aarch64_mirunsafeck x86_64_thirunsafeck aarch64_thirunsafeck // revisions: x86_64 aarch64
// [x86_64_thirunsafeck] compile-flags: -Z thir-unsafeck --target x86_64-unknown-linux-gnu // [x86_64] compile-flags: --target x86_64-unknown-linux-gnu
// [aarch64_thirunsafeck] compile-flags: -Z thir-unsafeck --target aarch64-unknown-linux-gnu // [aarch64] compile-flags: --target aarch64-unknown-linux-gnu
// [x86_64_mirunsafeck] compile-flags: --target x86_64-unknown-linux-gnu
// [aarch64_mirunsafeck] compile-flags: --target aarch64-unknown-linux-gnu
// [x86_64_thirunsafeck] needs-llvm-components: x86 // [x86_64] needs-llvm-components: x86
// [x86_64_mirunsafeck] needs-llvm-components: x86 // [aarch64] needs-llvm-components: aarch64
// [aarch64_thirunsafeck] needs-llvm-components: aarch64
// [aarch64_mirunsafeck] needs-llvm-components: aarch64
#![feature(no_core, lang_items, rustc_attrs, asm_const)] #![feature(no_core, lang_items, rustc_attrs, asm_const)]
#![no_core] #![no_core]
@ -41,12 +37,12 @@ fn main() {
asm!("{1}", a = in(reg) foo); asm!("{1}", a = in(reg) foo);
//~^ ERROR invalid reference to argument at index 1 //~^ ERROR invalid reference to argument at index 1
//~^^ ERROR named argument never used //~^^ ERROR named argument never used
#[cfg(any(x86_64_thirunsafeck, x86_64_mirunsafeck))] #[cfg(any(x86_64))]
asm!("{}", in("eax") foo); asm!("{}", in("eax") foo);
//[x86_64_thirunsafeck,x86_64_mirunsafeck]~^ ERROR invalid reference to argument at index 0 //[x86_64]~^ ERROR invalid reference to argument at index 0
#[cfg(any(aarch64_thirunsafeck, aarch64_mirunsafeck))] #[cfg(any(aarch64))]
asm!("{}", in("x0") foo); asm!("{}", in("x0") foo);
//[aarch64_thirunsafeck,aarch64_mirunsafeck]~^ ERROR invalid reference to argument at index 0 //[aarch64]~^ ERROR invalid reference to argument at index 0
asm!("{:foo}", in(reg) foo); asm!("{:foo}", in(reg) foo);
//~^ ERROR asm template modifier must be a single character //~^ ERROR asm template modifier must be a single character
//~| WARN formatting may not be suitable for sub-register argument [asm_sub_register] //~| WARN formatting may not be suitable for sub-register argument [asm_sub_register]

View file

@ -1,5 +1,5 @@
error: invalid reference to argument at index 0 error: invalid reference to argument at index 0
--> $DIR/bad-template.rs:31:15 --> $DIR/bad-template.rs:27:15
| |
LL | asm!("{}"); LL | asm!("{}");
| ^^ from here | ^^ from here
@ -7,7 +7,7 @@ LL | asm!("{}");
= note: no arguments were given = note: no arguments were given
error: invalid reference to argument at index 1 error: invalid reference to argument at index 1
--> $DIR/bad-template.rs:33:15 --> $DIR/bad-template.rs:29:15
| |
LL | asm!("{1}", in(reg) foo); LL | asm!("{1}", in(reg) foo);
| ^^^ from here | ^^^ from here
@ -15,7 +15,7 @@ LL | asm!("{1}", in(reg) foo);
= note: there is 1 argument = note: there is 1 argument
error: argument never used error: argument never used
--> $DIR/bad-template.rs:33:21 --> $DIR/bad-template.rs:29:21
| |
LL | asm!("{1}", in(reg) foo); LL | asm!("{1}", in(reg) foo);
| ^^^^^^^^^^^ argument never used | ^^^^^^^^^^^ argument never used
@ -23,13 +23,13 @@ LL | asm!("{1}", in(reg) foo);
= help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {0} */"` = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {0} */"`
error: there is no argument named `a` error: there is no argument named `a`
--> $DIR/bad-template.rs:36:16 --> $DIR/bad-template.rs:32:16
| |
LL | asm!("{a}"); LL | asm!("{a}");
| ^ | ^
error: invalid reference to argument at index 0 error: invalid reference to argument at index 0
--> $DIR/bad-template.rs:38:15 --> $DIR/bad-template.rs:34:15
| |
LL | asm!("{}", a = in(reg) foo); LL | asm!("{}", a = in(reg) foo);
| ^^ --------------- named argument | ^^ --------------- named argument
@ -38,13 +38,13 @@ LL | asm!("{}", a = in(reg) foo);
| |
= note: no positional arguments were given = note: no positional arguments were given
note: named arguments cannot be referenced by position note: named arguments cannot be referenced by position
--> $DIR/bad-template.rs:38:20 --> $DIR/bad-template.rs:34:20
| |
LL | asm!("{}", a = in(reg) foo); LL | asm!("{}", a = in(reg) foo);
| ^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^
error: named argument never used error: named argument never used
--> $DIR/bad-template.rs:38:20 --> $DIR/bad-template.rs:34:20
| |
LL | asm!("{}", a = in(reg) foo); LL | asm!("{}", a = in(reg) foo);
| ^^^^^^^^^^^^^^^ named argument never used | ^^^^^^^^^^^^^^^ named argument never used
@ -52,7 +52,7 @@ LL | asm!("{}", a = in(reg) foo);
= help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"` = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"`
error: invalid reference to argument at index 1 error: invalid reference to argument at index 1
--> $DIR/bad-template.rs:41:15 --> $DIR/bad-template.rs:37:15
| |
LL | asm!("{1}", a = in(reg) foo); LL | asm!("{1}", a = in(reg) foo);
| ^^^ from here | ^^^ from here
@ -60,7 +60,7 @@ LL | asm!("{1}", a = in(reg) foo);
= note: no positional arguments were given = note: no positional arguments were given
error: named argument never used error: named argument never used
--> $DIR/bad-template.rs:41:21 --> $DIR/bad-template.rs:37:21
| |
LL | asm!("{1}", a = in(reg) foo); LL | asm!("{1}", a = in(reg) foo);
| ^^^^^^^^^^^^^^^ named argument never used | ^^^^^^^^^^^^^^^ named argument never used
@ -68,7 +68,7 @@ LL | asm!("{1}", a = in(reg) foo);
= help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"` = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"`
error: invalid reference to argument at index 0 error: invalid reference to argument at index 0
--> $DIR/bad-template.rs:45:15 --> $DIR/bad-template.rs:41:15
| |
LL | asm!("{}", in("eax") foo); LL | asm!("{}", in("eax") foo);
| ^^ ------------- explicit register argument | ^^ ------------- explicit register argument
@ -77,24 +77,24 @@ LL | asm!("{}", in("eax") foo);
| |
= note: no positional arguments were given = note: no positional arguments were given
note: explicit register arguments cannot be used in the asm template note: explicit register arguments cannot be used in the asm template
--> $DIR/bad-template.rs:45:20 --> $DIR/bad-template.rs:41:20
| |
LL | asm!("{}", in("eax") foo); LL | asm!("{}", in("eax") foo);
| ^^^^^^^^^^^^^ | ^^^^^^^^^^^^^
help: use the register name directly in the assembly code help: use the register name directly in the assembly code
--> $DIR/bad-template.rs:45:20 --> $DIR/bad-template.rs:41:20
| |
LL | asm!("{}", in("eax") foo); LL | asm!("{}", in("eax") foo);
| ^^^^^^^^^^^^^ | ^^^^^^^^^^^^^
error: asm template modifier must be a single character error: asm template modifier must be a single character
--> $DIR/bad-template.rs:50:17 --> $DIR/bad-template.rs:46:17
| |
LL | asm!("{:foo}", in(reg) foo); LL | asm!("{:foo}", in(reg) foo);
| ^^^ | ^^^
error: multiple unused asm arguments error: multiple unused asm arguments
--> $DIR/bad-template.rs:53:18 --> $DIR/bad-template.rs:49:18
| |
LL | asm!("", in(reg) 0, in(reg) 1); LL | asm!("", in(reg) 0, in(reg) 1);
| ^^^^^^^^^ ^^^^^^^^^ argument never used | ^^^^^^^^^ ^^^^^^^^^ argument never used
@ -104,7 +104,7 @@ LL | asm!("", in(reg) 0, in(reg) 1);
= help: if these arguments are intentionally unused, consider using them in an asm comment: `"/* {0} {1} */"` = help: if these arguments are intentionally unused, consider using them in an asm comment: `"/* {0} {1} */"`
error: invalid reference to argument at index 0 error: invalid reference to argument at index 0
--> $DIR/bad-template.rs:59:14 --> $DIR/bad-template.rs:55:14
| |
LL | global_asm!("{}"); LL | global_asm!("{}");
| ^^ from here | ^^ from here
@ -112,7 +112,7 @@ LL | global_asm!("{}");
= note: no arguments were given = note: no arguments were given
error: invalid reference to argument at index 1 error: invalid reference to argument at index 1
--> $DIR/bad-template.rs:61:14 --> $DIR/bad-template.rs:57:14
| |
LL | global_asm!("{1}", const FOO); LL | global_asm!("{1}", const FOO);
| ^^^ from here | ^^^ from here
@ -120,7 +120,7 @@ LL | global_asm!("{1}", const FOO);
= note: there is 1 argument = note: there is 1 argument
error: argument never used error: argument never used
--> $DIR/bad-template.rs:61:20 --> $DIR/bad-template.rs:57:20
| |
LL | global_asm!("{1}", const FOO); LL | global_asm!("{1}", const FOO);
| ^^^^^^^^^ argument never used | ^^^^^^^^^ argument never used
@ -128,13 +128,13 @@ LL | global_asm!("{1}", const FOO);
= help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {0} */"` = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {0} */"`
error: there is no argument named `a` error: there is no argument named `a`
--> $DIR/bad-template.rs:64:15 --> $DIR/bad-template.rs:60:15
| |
LL | global_asm!("{a}"); LL | global_asm!("{a}");
| ^ | ^
error: invalid reference to argument at index 0 error: invalid reference to argument at index 0
--> $DIR/bad-template.rs:66:14 --> $DIR/bad-template.rs:62:14
| |
LL | global_asm!("{}", a = const FOO); LL | global_asm!("{}", a = const FOO);
| ^^ ------------- named argument | ^^ ------------- named argument
@ -143,13 +143,13 @@ LL | global_asm!("{}", a = const FOO);
| |
= note: no positional arguments were given = note: no positional arguments were given
note: named arguments cannot be referenced by position note: named arguments cannot be referenced by position
--> $DIR/bad-template.rs:66:19 --> $DIR/bad-template.rs:62:19
| |
LL | global_asm!("{}", a = const FOO); LL | global_asm!("{}", a = const FOO);
| ^^^^^^^^^^^^^ | ^^^^^^^^^^^^^
error: named argument never used error: named argument never used
--> $DIR/bad-template.rs:66:19 --> $DIR/bad-template.rs:62:19
| |
LL | global_asm!("{}", a = const FOO); LL | global_asm!("{}", a = const FOO);
| ^^^^^^^^^^^^^ named argument never used | ^^^^^^^^^^^^^ named argument never used
@ -157,7 +157,7 @@ LL | global_asm!("{}", a = const FOO);
= help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"` = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"`
error: invalid reference to argument at index 1 error: invalid reference to argument at index 1
--> $DIR/bad-template.rs:69:14 --> $DIR/bad-template.rs:65:14
| |
LL | global_asm!("{1}", a = const FOO); LL | global_asm!("{1}", a = const FOO);
| ^^^ from here | ^^^ from here
@ -165,7 +165,7 @@ LL | global_asm!("{1}", a = const FOO);
= note: no positional arguments were given = note: no positional arguments were given
error: named argument never used error: named argument never used
--> $DIR/bad-template.rs:69:20 --> $DIR/bad-template.rs:65:20
| |
LL | global_asm!("{1}", a = const FOO); LL | global_asm!("{1}", a = const FOO);
| ^^^^^^^^^^^^^ named argument never used | ^^^^^^^^^^^^^ named argument never used
@ -173,13 +173,13 @@ LL | global_asm!("{1}", a = const FOO);
= help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"` = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"`
error: asm template modifier must be a single character error: asm template modifier must be a single character
--> $DIR/bad-template.rs:72:16 --> $DIR/bad-template.rs:68:16
| |
LL | global_asm!("{:foo}", const FOO); LL | global_asm!("{:foo}", const FOO);
| ^^^ | ^^^
error: multiple unused asm arguments error: multiple unused asm arguments
--> $DIR/bad-template.rs:74:17 --> $DIR/bad-template.rs:70:17
| |
LL | global_asm!("", const FOO, const FOO); LL | global_asm!("", const FOO, const FOO);
| ^^^^^^^^^ ^^^^^^^^^ argument never used | ^^^^^^^^^ ^^^^^^^^^ argument never used
@ -189,7 +189,7 @@ LL | global_asm!("", const FOO, const FOO);
= help: if these arguments are intentionally unused, consider using them in an asm comment: `"/* {0} {1} */"` = help: if these arguments are intentionally unused, consider using them in an asm comment: `"/* {0} {1} */"`
warning: formatting may not be suitable for sub-register argument warning: formatting may not be suitable for sub-register argument
--> $DIR/bad-template.rs:50:15 --> $DIR/bad-template.rs:46:15
| |
LL | asm!("{:foo}", in(reg) foo); LL | asm!("{:foo}", in(reg) foo);
| ^^^^^^ --- for this argument | ^^^^^^ --- for this argument

View file

@ -1,202 +0,0 @@
error: invalid reference to argument at index 0
--> $DIR/bad-template.rs:31:15
|
LL | asm!("{}");
| ^^ from here
|
= note: no arguments were given
error: invalid reference to argument at index 1
--> $DIR/bad-template.rs:33:15
|
LL | asm!("{1}", in(reg) foo);
| ^^^ from here
|
= note: there is 1 argument
error: argument never used
--> $DIR/bad-template.rs:33:21
|
LL | asm!("{1}", in(reg) foo);
| ^^^^^^^^^^^ argument never used
|
= help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {0} */"`
error: there is no argument named `a`
--> $DIR/bad-template.rs:36:16
|
LL | asm!("{a}");
| ^
error: invalid reference to argument at index 0
--> $DIR/bad-template.rs:38:15
|
LL | asm!("{}", a = in(reg) foo);
| ^^ --------------- named argument
| |
| from here
|
= note: no positional arguments were given
note: named arguments cannot be referenced by position
--> $DIR/bad-template.rs:38:20
|
LL | asm!("{}", a = in(reg) foo);
| ^^^^^^^^^^^^^^^
error: named argument never used
--> $DIR/bad-template.rs:38:20
|
LL | asm!("{}", a = in(reg) foo);
| ^^^^^^^^^^^^^^^ named argument never used
|
= help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"`
error: invalid reference to argument at index 1
--> $DIR/bad-template.rs:41:15
|
LL | asm!("{1}", a = in(reg) foo);
| ^^^ from here
|
= note: no positional arguments were given
error: named argument never used
--> $DIR/bad-template.rs:41:21
|
LL | asm!("{1}", a = in(reg) foo);
| ^^^^^^^^^^^^^^^ named argument never used
|
= help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"`
error: invalid reference to argument at index 0
--> $DIR/bad-template.rs:45:15
|
LL | asm!("{}", in("eax") foo);
| ^^ ------------- explicit register argument
| |
| from here
|
= note: no positional arguments were given
note: explicit register arguments cannot be used in the asm template
--> $DIR/bad-template.rs:45:20
|
LL | asm!("{}", in("eax") foo);
| ^^^^^^^^^^^^^
help: use the register name directly in the assembly code
--> $DIR/bad-template.rs:45:20
|
LL | asm!("{}", in("eax") foo);
| ^^^^^^^^^^^^^
error: asm template modifier must be a single character
--> $DIR/bad-template.rs:50:17
|
LL | asm!("{:foo}", in(reg) foo);
| ^^^
error: multiple unused asm arguments
--> $DIR/bad-template.rs:53:18
|
LL | asm!("", in(reg) 0, in(reg) 1);
| ^^^^^^^^^ ^^^^^^^^^ argument never used
| |
| argument never used
|
= help: if these arguments are intentionally unused, consider using them in an asm comment: `"/* {0} {1} */"`
error: invalid reference to argument at index 0
--> $DIR/bad-template.rs:59:14
|
LL | global_asm!("{}");
| ^^ from here
|
= note: no arguments were given
error: invalid reference to argument at index 1
--> $DIR/bad-template.rs:61:14
|
LL | global_asm!("{1}", const FOO);
| ^^^ from here
|
= note: there is 1 argument
error: argument never used
--> $DIR/bad-template.rs:61:20
|
LL | global_asm!("{1}", const FOO);
| ^^^^^^^^^ argument never used
|
= help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {0} */"`
error: there is no argument named `a`
--> $DIR/bad-template.rs:64:15
|
LL | global_asm!("{a}");
| ^
error: invalid reference to argument at index 0
--> $DIR/bad-template.rs:66:14
|
LL | global_asm!("{}", a = const FOO);
| ^^ ------------- named argument
| |
| from here
|
= note: no positional arguments were given
note: named arguments cannot be referenced by position
--> $DIR/bad-template.rs:66:19
|
LL | global_asm!("{}", a = const FOO);
| ^^^^^^^^^^^^^
error: named argument never used
--> $DIR/bad-template.rs:66:19
|
LL | global_asm!("{}", a = const FOO);
| ^^^^^^^^^^^^^ named argument never used
|
= help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"`
error: invalid reference to argument at index 1
--> $DIR/bad-template.rs:69:14
|
LL | global_asm!("{1}", a = const FOO);
| ^^^ from here
|
= note: no positional arguments were given
error: named argument never used
--> $DIR/bad-template.rs:69:20
|
LL | global_asm!("{1}", a = const FOO);
| ^^^^^^^^^^^^^ named argument never used
|
= help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"`
error: asm template modifier must be a single character
--> $DIR/bad-template.rs:72:16
|
LL | global_asm!("{:foo}", const FOO);
| ^^^
error: multiple unused asm arguments
--> $DIR/bad-template.rs:74:17
|
LL | global_asm!("", const FOO, const FOO);
| ^^^^^^^^^ ^^^^^^^^^ argument never used
| |
| argument never used
|
= help: if these arguments are intentionally unused, consider using them in an asm comment: `"/* {0} {1} */"`
warning: formatting may not be suitable for sub-register argument
--> $DIR/bad-template.rs:50:15
|
LL | asm!("{:foo}", in(reg) foo);
| ^^^^^^ --- for this argument
|
= help: use `{0:e}` to have the register formatted as `eax`
= help: or use `{0:r}` to keep the default formatting of `rax`
= note: `#[warn(asm_sub_register)]` on by default
error: aborting due to 21 previous errors; 1 warning emitted

View file

@ -1,8 +1,6 @@
// only-x86_64 // only-x86_64
// run-pass // run-pass
// needs-asm-support // needs-asm-support
// revisions: mirunsafeck thirunsafeck
// [thirunsafeck]compile-flags: -Z thir-unsafeck
#![feature(asm_const)] #![feature(asm_const)]

View file

@ -1,8 +1,7 @@
// run-pass // run-pass
// revisions: default nomiropt thirunsafeck // revisions: default nomiropt
//[nomiropt]compile-flags: -Z mir-opt-level=0 //[nomiropt]compile-flags: -Z mir-opt-level=0
//[thirunsafeck]compile-flags: -Zthir-unsafeck
#![allow(unused)] #![allow(unused)]

View file

@ -1,6 +1,4 @@
// edition:2018 // edition:2018
// revisions: mir thir
// [thir]compile-flags: -Z thir-unsafeck
struct S; struct S;
@ -12,18 +10,14 @@ async unsafe fn f() {}
async fn g() { async fn g() {
S::f(); S::f();
//[mir]~^ ERROR call to unsafe function is unsafe //~^ ERROR call to unsafe function is unsafe
//[thir]~^^ ERROR call to unsafe function `S::f` is unsafe
f(); f();
//[mir]~^ ERROR call to unsafe function is unsafe //~^ ERROR call to unsafe function is unsafe
//[thir]~^^ ERROR call to unsafe function `f` is unsafe
} }
fn main() { fn main() {
S::f(); S::f();
//[mir]~^ ERROR call to unsafe function is unsafe //~^ ERROR call to unsafe function is unsafe
//[thir]~^^ ERROR call to unsafe function `S::f` is unsafe
f(); f();
//[mir]~^ ERROR call to unsafe function is unsafe //~^ ERROR call to unsafe function is unsafe
//[thir]~^^ ERROR call to unsafe function `f` is unsafe
} }

View file

@ -1,5 +1,5 @@
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
--> $DIR/async-unsafe-fn-call-in-safe.rs:14:5 --> $DIR/async-unsafe-fn-call-in-safe.rs:12:5
| |
LL | S::f(); LL | S::f();
| ^^^^^^ call to unsafe function | ^^^^^^ call to unsafe function
@ -7,7 +7,7 @@ LL | S::f();
= note: consult the function's documentation for information on how to avoid undefined behavior = note: consult the function's documentation for information on how to avoid undefined behavior
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
--> $DIR/async-unsafe-fn-call-in-safe.rs:17:5 --> $DIR/async-unsafe-fn-call-in-safe.rs:14:5
| |
LL | f(); LL | f();
| ^^^ call to unsafe function | ^^^ call to unsafe function
@ -15,7 +15,7 @@ LL | f();
= note: consult the function's documentation for information on how to avoid undefined behavior = note: consult the function's documentation for information on how to avoid undefined behavior
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
--> $DIR/async-unsafe-fn-call-in-safe.rs:23:5 --> $DIR/async-unsafe-fn-call-in-safe.rs:19:5
| |
LL | S::f(); LL | S::f();
| ^^^^^^ call to unsafe function | ^^^^^^ call to unsafe function
@ -23,7 +23,7 @@ LL | S::f();
= note: consult the function's documentation for information on how to avoid undefined behavior = note: consult the function's documentation for information on how to avoid undefined behavior
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
--> $DIR/async-unsafe-fn-call-in-safe.rs:26:5 --> $DIR/async-unsafe-fn-call-in-safe.rs:21:5
| |
LL | f(); LL | f();
| ^^^ call to unsafe function | ^^^ call to unsafe function

View file

@ -1,35 +0,0 @@
error[E0133]: call to unsafe function `S::f` is unsafe and requires unsafe function or block
--> $DIR/async-unsafe-fn-call-in-safe.rs:14:5
|
LL | S::f();
| ^^^^^^ call to unsafe function
|
= note: consult the function's documentation for information on how to avoid undefined behavior
error[E0133]: call to unsafe function `f` is unsafe and requires unsafe function or block
--> $DIR/async-unsafe-fn-call-in-safe.rs:17:5
|
LL | f();
| ^^^ call to unsafe function
|
= note: consult the function's documentation for information on how to avoid undefined behavior
error[E0133]: call to unsafe function `S::f` is unsafe and requires unsafe function or block
--> $DIR/async-unsafe-fn-call-in-safe.rs:23:5
|
LL | S::f();
| ^^^^^^ call to unsafe function
|
= note: consult the function's documentation for information on how to avoid undefined behavior
error[E0133]: call to unsafe function `f` is unsafe and requires unsafe function or block
--> $DIR/async-unsafe-fn-call-in-safe.rs:26:5
|
LL | f();
| ^^^ call to unsafe function
|
= note: consult the function's documentation for information on how to avoid undefined behavior
error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0133`.

View file

@ -1,6 +1,3 @@
// revisions: mir thir
// [thir]compile-flags: -Z thir-unsafeck
// Ensure we get unsafe function after coercion // Ensure we get unsafe function after coercion
unsafe fn add(a: i32, b: i32) -> i32 { unsafe fn add(a: i32, b: i32) -> i32 {
a + b a + b

View file

@ -1,5 +1,5 @@
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
--> $DIR/closure_no_cap_coerce_many_unsafe_0.rs:15:23 --> $DIR/closure_no_cap_coerce_many_unsafe_0.rs:12:23
| |
LL | let result: i32 = foo(5, 5); LL | let result: i32 = foo(5, 5);
| ^^^^^^^^^ call to unsafe function | ^^^^^^^^^ call to unsafe function
@ -7,7 +7,7 @@ LL | let result: i32 = foo(5, 5);
= note: consult the function's documentation for information on how to avoid undefined behavior = note: consult the function's documentation for information on how to avoid undefined behavior
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
--> $DIR/closure_no_cap_coerce_many_unsafe_0.rs:24:23 --> $DIR/closure_no_cap_coerce_many_unsafe_0.rs:21:23
| |
LL | let result: i32 = foo(5, 5); LL | let result: i32 = foo(5, 5);
| ^^^^^^^^^ call to unsafe function | ^^^^^^^^^ call to unsafe function

View file

@ -1,6 +1,3 @@
// revisions: mir thir
// [thir]compile-flags: -Z thir-unsafeck
fn main() { fn main() {
let _: unsafe fn() = || { ::std::pin::Pin::new_unchecked(&0_u8); }; let _: unsafe fn() = || { ::std::pin::Pin::new_unchecked(&0_u8); };
//~^ ERROR E0133 //~^ ERROR E0133

View file

@ -1,5 +1,5 @@
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
--> $DIR/coerce-unsafe-closure-to-unsafe-fn-ptr.rs:5:31 --> $DIR/coerce-unsafe-closure-to-unsafe-fn-ptr.rs:2:31
| |
LL | let _: unsafe fn() = || { ::std::pin::Pin::new_unchecked(&0_u8); }; LL | let _: unsafe fn() = || { ::std::pin::Pin::new_unchecked(&0_u8); };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function

View file

@ -1,11 +0,0 @@
error[E0133]: call to unsafe function `Pin::<P>::new_unchecked` is unsafe and requires unsafe function or block
--> $DIR/coerce-unsafe-closure-to-unsafe-fn-ptr.rs:5:31
|
LL | let _: unsafe fn() = || { ::std::pin::Pin::new_unchecked(&0_u8); };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
|
= note: consult the function's documentation for information on how to avoid undefined behavior
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0133`.

View file

@ -1,6 +1,5 @@
// Tests that no ICE occurs when a closure appears inside a node // Tests that no ICE occurs when a closure appears inside a node
// that does not have a body when compiling with // that does not have a body when compiling with
// compile-flags: -Zthir-unsafeck=yes
// check-pass // check-pass
#![allow(dead_code)] #![allow(dead_code)]

View file

@ -1,6 +1,4 @@
// run-pass // run-pass
// revisions: mir thir
// [thir]compile-flags: -Zthir-unsafeck
#![allow(stable_features)] #![allow(stable_features)]
// ignore-windows - this is a unix-specific test // ignore-windows - this is a unix-specific test

View file

@ -1,15 +1,10 @@
// revisions: mir thir
// [thir]compile-flags: -Z thir-unsafeck
#![feature(const_extern_fn)] #![feature(const_extern_fn)]
const unsafe extern "C" fn foo() -> usize { 5 } const unsafe extern "C" fn foo() -> usize { 5 }
fn main() { fn main() {
let a: [u8; foo()]; let a: [u8; foo()];
//[mir]~^ call to unsafe function is unsafe and requires unsafe function or block //~^ call to unsafe function is unsafe and requires unsafe function or block
//[thir]~^^ call to unsafe function `foo` is unsafe and requires unsafe function or block
foo(); foo();
//[mir]~^ ERROR call to unsafe function is unsafe and requires unsafe function or block //~^ ERROR call to unsafe function is unsafe and requires unsafe function or block
//[thir]~^^ ERROR call to unsafe function `foo` is unsafe and requires unsafe function or block
} }

View file

@ -1,16 +1,16 @@
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
--> $DIR/closure_no_cap_coerce_many_unsafe_0.rs:15:23 --> $DIR/const-extern-fn-requires-unsafe.rs:8:5
| |
LL | let result: i32 = foo(5, 5); LL | foo();
| ^^^^^^^^^ call to unsafe function | ^^^^^ call to unsafe function
| |
= note: consult the function's documentation for information on how to avoid undefined behavior = note: consult the function's documentation for information on how to avoid undefined behavior
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
--> $DIR/closure_no_cap_coerce_many_unsafe_0.rs:24:23 --> $DIR/const-extern-fn-requires-unsafe.rs:6:17
| |
LL | let result: i32 = foo(5, 5); LL | let a: [u8; foo()];
| ^^^^^^^^^ call to unsafe function | ^^^^^ call to unsafe function
| |
= note: consult the function's documentation for information on how to avoid undefined behavior = note: consult the function's documentation for information on how to avoid undefined behavior

View file

@ -1,6 +1,3 @@
// revisions: mir thir
// [thir]compile-flags: -Z thir-unsafeck
mod Y { mod Y {
pub type X = usize; pub type X = usize;
extern "C" { extern "C" {

View file

@ -1,5 +1,5 @@
error[E0015]: cannot call non-const fn `Y::foo` in statics error[E0015]: cannot call non-const fn `Y::foo` in statics
--> $DIR/issue-16538.rs:14:23 --> $DIR/issue-16538.rs:11:23
| |
LL | static foo: &Y::X = &*Y::foo(Y::x as *const Y::X); LL | static foo: &Y::X = &*Y::foo(Y::x as *const Y::X);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -8,7 +8,7 @@ LL | static foo: &Y::X = &*Y::foo(Y::x as *const Y::X);
= note: consider wrapping this expression in `Lazy::new(|| ...)` from the `once_cell` crate: https://crates.io/crates/once_cell = note: consider wrapping this expression in `Lazy::new(|| ...)` from the `once_cell` crate: https://crates.io/crates/once_cell
error[E0133]: use of extern static is unsafe and requires unsafe function or block error[E0133]: use of extern static is unsafe and requires unsafe function or block
--> $DIR/issue-16538.rs:14:30 --> $DIR/issue-16538.rs:11:30
| |
LL | static foo: &Y::X = &*Y::foo(Y::x as *const Y::X); LL | static foo: &Y::X = &*Y::foo(Y::x as *const Y::X);
| ^^^^ use of extern static | ^^^^ use of extern static
@ -16,7 +16,7 @@ LL | static foo: &Y::X = &*Y::foo(Y::x as *const Y::X);
= note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior
error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block
--> $DIR/issue-16538.rs:14:21 --> $DIR/issue-16538.rs:11:21
| |
LL | static foo: &Y::X = &*Y::foo(Y::x as *const Y::X); LL | static foo: &Y::X = &*Y::foo(Y::x as *const Y::X);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ dereference of raw pointer | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ dereference of raw pointer

View file

@ -1,29 +0,0 @@
error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block
--> $DIR/issue-16538.rs:14:22
|
LL | static foo: &Y::X = &*Y::foo(Y::x as *const Y::X);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ dereference of raw pointer
|
= note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
error[E0133]: use of extern static is unsafe and requires unsafe function or block
--> $DIR/issue-16538.rs:14:30
|
LL | static foo: &Y::X = &*Y::foo(Y::x as *const Y::X);
| ^^^^ use of extern static
|
= note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior
error[E0015]: cannot call non-const fn `Y::foo` in statics
--> $DIR/issue-16538.rs:14:23
|
LL | static foo: &Y::X = &*Y::foo(Y::x as *const Y::X);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: calls in statics are limited to constant functions, tuple structs and tuple variants
= note: consider wrapping this expression in `Lazy::new(|| ...)` from the `once_cell` crate: https://crates.io/crates/once_cell
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0015, E0133.
For more information about an error, try `rustc --explain E0015`.

View file

@ -1,6 +1,3 @@
// revisions: mir thir
// [thir]compile-flags: -Z thir-unsafeck
#![feature(coroutines)] #![feature(coroutines)]
fn main() { fn main() {

View file

@ -1,5 +1,5 @@
error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block
--> $DIR/issue-45729-unsafe-in-coroutine.rs:8:9 --> $DIR/issue-45729-unsafe-in-coroutine.rs:5:9
| |
LL | *(1 as *mut u32) = 42; LL | *(1 as *mut u32) = 42;
| ^^^^^^^^^^^^^^^^^^^^^ dereference of raw pointer | ^^^^^^^^^^^^^^^^^^^^^ dereference of raw pointer

View file

@ -1,11 +0,0 @@
error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block
--> $DIR/issue-45729-unsafe-in-coroutine.rs:8:9
|
LL | *(1 as *mut u32) = 42;
| ^^^^^^^^^^^^^^^^ dereference of raw pointer
|
= note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0133`.

View file

@ -1,6 +1,4 @@
// build-pass // build-pass
// revisions: mir thir
// [thir]compile-flags: -Zthir-unsafeck
#![feature(coroutines)] #![feature(coroutines)]

View file

@ -1,6 +1,3 @@
// revisions: mir thir
// [thir]compile-flags: -Z thir-unsafeck
unsafe fn f() { return; } unsafe fn f() { return; }
fn main() { fn main() {

View file

@ -1,5 +1,5 @@
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
--> $DIR/E0133.rs:7:5 --> $DIR/E0133.rs:4:5
| |
LL | f(); LL | f();
| ^^^ call to unsafe function | ^^^ call to unsafe function

View file

@ -1,11 +0,0 @@
error[E0133]: call to unsafe function `f` is unsafe and requires unsafe function or block
--> $DIR/E0133.rs:7:5
|
LL | f();
| ^^^ call to unsafe function
|
= note: consult the function's documentation for information on how to avoid undefined behavior
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0133`.

View file

@ -1,6 +1,3 @@
// revisions: mir thir
// [thir]compile-flags: -Z thir-unsafeck
extern "C" { extern "C" {
static error_message_count: u32; static error_message_count: u32;
} }

View file

@ -1,5 +1,5 @@
error[E0133]: use of extern static is unsafe and requires unsafe function or block error[E0133]: use of extern static is unsafe and requires unsafe function or block
--> $DIR/issue-28324.rs:8:24 --> $DIR/issue-28324.rs:5:24
| |
LL | pub static BAZ: u32 = *&error_message_count; LL | pub static BAZ: u32 = *&error_message_count;
| ^^^^^^^^^^^^^^^^^^^^ use of extern static | ^^^^^^^^^^^^^^^^^^^^ use of extern static

View file

@ -1,11 +0,0 @@
error[E0133]: use of extern static is unsafe and requires unsafe function or block
--> $DIR/issue-28324.rs:8:25
|
LL | pub static BAZ: u32 = *&error_message_count;
| ^^^^^^^^^^^^^^^^^^^ use of extern static
|
= note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0133`.

View file

@ -1,7 +1,7 @@
// revisions: mir thir
// [thir]compile-flags: -Z thir-unsafeck
#![feature(inline_const)] #![feature(inline_const)]
const unsafe fn require_unsafe() -> usize { 1 } const unsafe fn require_unsafe() -> usize {
1
}
fn main() { fn main() {
const { const {

View file

@ -1,11 +0,0 @@
error[E0133]: call to unsafe function `require_unsafe` is unsafe and requires unsafe function or block
--> $DIR/expr-unsafe-err.rs:8:9
|
LL | require_unsafe();
| ^^^^^^^^^^^^^^^^ call to unsafe function
|
= note: consult the function's documentation for information on how to avoid undefined behavior
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0133`.

View file

@ -1,6 +1,5 @@
// check-pass // check-pass
// revisions: mir thir
// [thir]compile-flags: -Z thir-unsafeck
#![warn(unused_unsafe)] #![warn(unused_unsafe)]
#![feature(inline_const)] #![feature(inline_const)]
const unsafe fn require_unsafe() -> usize { 1 } const unsafe fn require_unsafe() -> usize { 1 }

View file

@ -1,11 +1,11 @@
warning: unnecessary `unsafe` block warning: unnecessary `unsafe` block
--> $DIR/expr-unsafe.rs:12:13 --> $DIR/expr-unsafe.rs:11:13
| |
LL | unsafe {} LL | unsafe {}
| ^^^^^^ unnecessary `unsafe` block | ^^^^^^ unnecessary `unsafe` block
| |
note: the lint level is defined here note: the lint level is defined here
--> $DIR/expr-unsafe.rs:4:9 --> $DIR/expr-unsafe.rs:3:9
| |
LL | #![warn(unused_unsafe)] LL | #![warn(unused_unsafe)]
| ^^^^^^^^^^^^^ | ^^^^^^^^^^^^^

View file

@ -1,14 +0,0 @@
warning: unnecessary `unsafe` block
--> $DIR/expr-unsafe.rs:12:13
|
LL | unsafe {}
| ^^^^^^ unnecessary `unsafe` block
|
note: the lint level is defined here
--> $DIR/expr-unsafe.rs:4:9
|
LL | #![warn(unused_unsafe)]
| ^^^^^^^^^^^^^
warning: 1 warning emitted

View file

@ -1,6 +1,4 @@
// revisions: mir thir // ignore-test This is currently broken
// [mir]ignore-test This is currently broken
// [thir]compile-flags: -Z thir-unsafeck
#![allow(incomplete_features)] #![allow(incomplete_features)]
#![feature(inline_const_pat)] #![feature(inline_const_pat)]

View file

@ -1,19 +0,0 @@
error[E0133]: call to unsafe function `require_unsafe` is unsafe and requires unsafe function or block
--> $DIR/pat-unsafe-err.rs:15:13
|
LL | require_unsafe();
| ^^^^^^^^^^^^^^^^ call to unsafe function
|
= note: consult the function's documentation for information on how to avoid undefined behavior
error[E0133]: call to unsafe function `require_unsafe` is unsafe and requires unsafe function or block
--> $DIR/pat-unsafe-err.rs:22:13
|
LL | require_unsafe()
| ^^^^^^^^^^^^^^^^ call to unsafe function
|
= note: consult the function's documentation for information on how to avoid undefined behavior
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0133`.

View file

@ -1,7 +1,5 @@
// check-pass // check-pass
// revisions: mir thir // ignore-test This is currently broken
// [mir]ignore-test This is currently broken
// [thir]compile-flags: -Z thir-unsafeck
#![allow(incomplete_features)] #![allow(incomplete_features)]
#![warn(unused_unsafe)] #![warn(unused_unsafe)]

View file

@ -1,20 +0,0 @@
warning: unnecessary `unsafe` block
--> $DIR/pat-unsafe.rs:19:17
|
LL | unsafe {}
| ^^^^^^ unnecessary `unsafe` block
|
note: the lint level is defined here
--> $DIR/pat-unsafe.rs:7:9
|
LL | #![warn(unused_unsafe)]
| ^^^^^^^^^^^^^
warning: unnecessary `unsafe` block
--> $DIR/pat-unsafe.rs:26:17
|
LL | unsafe {}
| ^^^^^^ unnecessary `unsafe` block
warning: 2 warnings emitted

View file

@ -1,6 +1,3 @@
// revisions: mir thir
// [thir]compile-flags: -Z thir-unsafeck
#![feature(intrinsics)] #![feature(intrinsics)]
extern "C" { extern "C" {

View file

@ -1,5 +1,5 @@
error[E0133]: use of extern static is unsafe and requires unsafe function or block error[E0133]: use of extern static is unsafe and requires unsafe function or block
--> $DIR/issue-28575.rs:11:5 --> $DIR/issue-28575.rs:8:5
| |
LL | FOO() LL | FOO()
| ^^^ use of extern static | ^^^ use of extern static

View file

@ -1,11 +0,0 @@
error[E0133]: use of extern static is unsafe and requires unsafe function or block
--> $DIR/issue-28575.rs:11:5
|
LL | FOO()
| ^^^ use of extern static
|
= note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0133`.

View file

@ -1,6 +1,3 @@
// revisions: mir thir
// [thir]compile-flags: -Z thir-unsafeck
#![feature(core_intrinsics)] #![feature(core_intrinsics)]
fn main() { fn main() {

View file

@ -1,5 +1,5 @@
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
--> $DIR/unchecked_math_unsafe.rs:8:15 --> $DIR/unchecked_math_unsafe.rs:5:15
| |
LL | let add = std::intrinsics::unchecked_add(x, y); LL | let add = std::intrinsics::unchecked_add(x, y);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
@ -7,7 +7,7 @@ LL | let add = std::intrinsics::unchecked_add(x, y);
= note: consult the function's documentation for information on how to avoid undefined behavior = note: consult the function's documentation for information on how to avoid undefined behavior
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
--> $DIR/unchecked_math_unsafe.rs:9:15 --> $DIR/unchecked_math_unsafe.rs:6:15
| |
LL | let sub = std::intrinsics::unchecked_sub(x, y); LL | let sub = std::intrinsics::unchecked_sub(x, y);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
@ -15,7 +15,7 @@ LL | let sub = std::intrinsics::unchecked_sub(x, y);
= note: consult the function's documentation for information on how to avoid undefined behavior = note: consult the function's documentation for information on how to avoid undefined behavior
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
--> $DIR/unchecked_math_unsafe.rs:10:15 --> $DIR/unchecked_math_unsafe.rs:7:15
| |
LL | let mul = std::intrinsics::unchecked_mul(x, y); LL | let mul = std::intrinsics::unchecked_mul(x, y);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function

View file

@ -1,27 +0,0 @@
error[E0133]: call to unsafe function `unchecked_add` is unsafe and requires unsafe function or block
--> $DIR/unchecked_math_unsafe.rs:8:15
|
LL | let add = std::intrinsics::unchecked_add(x, y);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
|
= note: consult the function's documentation for information on how to avoid undefined behavior
error[E0133]: call to unsafe function `unchecked_sub` is unsafe and requires unsafe function or block
--> $DIR/unchecked_math_unsafe.rs:9:15
|
LL | let sub = std::intrinsics::unchecked_sub(x, y);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
|
= note: consult the function's documentation for information on how to avoid undefined behavior
error[E0133]: call to unsafe function `unchecked_mul` is unsafe and requires unsafe function or block
--> $DIR/unchecked_math_unsafe.rs:10:15
|
LL | let mul = std::intrinsics::unchecked_mul(x, y);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
|
= note: consult the function's documentation for information on how to avoid undefined behavior
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0133`.

View file

@ -1,6 +1,4 @@
// check-pass // check-pass
// revisions: mir thir
// [thir]compile-flags: -Zthir-unsafeck
struct Attr { struct Attr {
name: String, name: String,

View file

@ -1,6 +1,3 @@
// revisions: mir thir
// [thir]compile-flags: -Z thir-unsafeck
use std::ptr; use std::ptr;
fn main() { fn main() {

View file

@ -1,5 +1,5 @@
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
--> $DIR/issue-28776.rs:7:5 --> $DIR/issue-28776.rs:4:5
| |
LL | (&ptr::write)(1 as *mut _, 42); LL | (&ptr::write)(1 as *mut _, 42);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function

View file

@ -1,11 +0,0 @@
error[E0133]: call to unsafe function `std::ptr::write` is unsafe and requires unsafe function or block
--> $DIR/issue-28776.rs:7:5
|
LL | (&ptr::write)(1 as *mut _, 42);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
|
= note: consult the function's documentation for information on how to avoid undefined behavior
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0133`.

View file

@ -1,6 +1,4 @@
// run-pass // run-pass
// revisions: mir thir
// [thir]compile-flags: -Zthir-unsafeck
use std::ops::Deref; use std::ops::Deref;

View file

@ -1,20 +0,0 @@
error: unnecessary `unsafe` block
--> $DIR/issue-48131.rs:12:9
|
LL | unsafe { /* unnecessary */ }
| ^^^^^^ unnecessary `unsafe` block
|
note: the lint level is defined here
--> $DIR/issue-48131.rs:6:9
|
LL | #![deny(unused_unsafe)]
| ^^^^^^^^^^^^^
error: unnecessary `unsafe` block
--> $DIR/issue-48131.rs:23:13
|
LL | unsafe { /* unnecessary */ }
| ^^^^^^ unnecessary `unsafe` block
error: aborting due to 2 previous errors

View file

@ -1,6 +1,3 @@
// revisions: mir thir
// [thir]compile-flags: -Z thir-unsafeck
// This note is annotated because the purpose of the test // This note is annotated because the purpose of the test
// is to ensure that certain other notes are not generated. // is to ensure that certain other notes are not generated.
#![deny(unused_unsafe)] //~ NOTE #![deny(unused_unsafe)] //~ NOTE

View file

@ -1,17 +1,17 @@
error: unnecessary `unsafe` block error: unnecessary `unsafe` block
--> $DIR/issue-48131.rs:12:9 --> $DIR/issue-48131.rs:9:9
| |
LL | unsafe { /* unnecessary */ } LL | unsafe { /* unnecessary */ }
| ^^^^^^ unnecessary `unsafe` block | ^^^^^^ unnecessary `unsafe` block
| |
note: the lint level is defined here note: the lint level is defined here
--> $DIR/issue-48131.rs:6:9 --> $DIR/issue-48131.rs:3:9
| |
LL | #![deny(unused_unsafe)] LL | #![deny(unused_unsafe)]
| ^^^^^^^^^^^^^ | ^^^^^^^^^^^^^
error: unnecessary `unsafe` block error: unnecessary `unsafe` block
--> $DIR/issue-48131.rs:23:13 --> $DIR/issue-48131.rs:20:13
| |
LL | unsafe { /* unnecessary */ } LL | unsafe { /* unnecessary */ }
| ^^^^^^ unnecessary `unsafe` block | ^^^^^^ unnecessary `unsafe` block

View file

@ -1,9 +1,7 @@
//aux-build:issue-5844-aux.rs //aux-build:issue-5844-aux.rs
// revisions: mir thir
// [thir]compile-flags: -Z thir-unsafeck
extern crate issue_5844_aux; extern crate issue_5844_aux;
fn main () { fn main() {
issue_5844_aux::rand(); //~ ERROR: requires unsafe issue_5844_aux::rand(); //~ ERROR: requires unsafe
} }

View file

@ -1,5 +1,5 @@
error[E0133]: call to unsafe function is unsafe and requires unsafe function or block error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
--> $DIR/issue-5844.rs:8:5 --> $DIR/issue-5844.rs:6:5
| |
LL | issue_5844_aux::rand(); LL | issue_5844_aux::rand();
| ^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function | ^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function

View file

@ -1,11 +0,0 @@
error[E0133]: call to unsafe function `rand` is unsafe and requires unsafe function or block
--> $DIR/issue-5844.rs:8:5
|
LL | issue_5844_aux::rand();
| ^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
|
= note: consult the function's documentation for information on how to avoid undefined behavior
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0133`.

View file

@ -2,8 +2,6 @@
// compile-flags: -C lto // compile-flags: -C lto
// no-prefer-dynamic // no-prefer-dynamic
// ignore-emscripten no threads support // ignore-emscripten no threads support
// revisions: mir thir
// [thir]compile-flags: -Zthir-unsafeck
use std::thread; use std::thread;

View file

@ -1,14 +0,0 @@
error: `{closure@$DIR/non-structural-match-types.rs:12:17: 12:19}` cannot be used in patterns
--> $DIR/non-structural-match-types.rs:12:9
|
LL | const { || {} } => {}
| ^^^^^^^^^^^^^^^
error: `{async block@$DIR/non-structural-match-types.rs:15:17: 15:25}` cannot be used in patterns
--> $DIR/non-structural-match-types.rs:15:9
|
LL | const { async {} } => {}
| ^^^^^^^^^^^^^^^^^^
error: aborting due to 2 previous errors

View file

@ -1,6 +1,4 @@
// edition:2021 // edition:2021
// revisions: mir thir
// [thir]compile-flags: -Z thir-unsafeck
#![allow(incomplete_features)] #![allow(incomplete_features)]
#![allow(unreachable_code)] #![allow(unreachable_code)]

View file

@ -0,0 +1,14 @@
error: `{closure@$DIR/non-structural-match-types.rs:10:17: 10:19}` cannot be used in patterns
--> $DIR/non-structural-match-types.rs:10:9
|
LL | const { || {} } => {}
| ^^^^^^^^^^^^^^^
error: `{async block@$DIR/non-structural-match-types.rs:13:17: 13:25}` cannot be used in patterns
--> $DIR/non-structural-match-types.rs:13:9
|
LL | const { async {} } => {}
| ^^^^^^^^^^^^^^^^^^
error: aborting due to 2 previous errors

View file

@ -1,14 +0,0 @@
error: `{closure@$DIR/non-structural-match-types.rs:12:17: 12:19}` cannot be used in patterns
--> $DIR/non-structural-match-types.rs:12:9
|
LL | const { || {} } => {}
| ^^^^^^^^^^^^^^^
error: `{async block@$DIR/non-structural-match-types.rs:15:17: 15:25}` cannot be used in patterns
--> $DIR/non-structural-match-types.rs:15:9
|
LL | const { async {} } => {}
| ^^^^^^^^^^^^^^^^^^
error: aborting due to 2 previous errors

View file

@ -2,8 +2,6 @@
// ignore-android // ignore-android
// ignore-emscripten no processes // ignore-emscripten no processes
// ignore-sgx no processes // ignore-sgx no processes
// revisions: mir thir
// [thir]compile-flags: -Zthir-unsafeck
#![feature(rustc_private)] #![feature(rustc_private)]

View file

@ -8,8 +8,6 @@
// check-pass // check-pass
// only-x86_64 // only-x86_64
// revisions: mir thir
// [thir]compile-flags: -Z thir-unsafeck
#![feature(target_feature_11)] #![feature(target_feature_11)]

View file

@ -1,18 +1,16 @@
// Tests #73631: closures inherit `#[target_feature]` annotations // Tests #73631: closures inherit `#[target_feature]` annotations
// check-pass // check-pass
// revisions: mir thir
// [thir]compile-flags: -Z thir-unsafeck
// only-x86_64 // only-x86_64
#![feature(target_feature_11)] #![feature(target_feature_11)]
#[target_feature(enable="avx")] #[target_feature(enable = "avx")]
fn also_use_avx() { fn also_use_avx() {
println!("Hello from AVX") println!("Hello from AVX")
} }
#[target_feature(enable="avx")] #[target_feature(enable = "avx")]
fn use_avx() -> Box<dyn Fn()> { fn use_avx() -> Box<dyn Fn()> {
Box::new(|| also_use_avx()) Box::new(|| also_use_avx())
} }

View file

@ -1,5 +1,3 @@
// revisions: mir thir
// [thir]compile-flags: -Z thir-unsafeck
// only-x86_64 // only-x86_64
#![feature(target_feature_11)] #![feature(target_feature_11)]

View file

@ -0,0 +1,23 @@
error[E0308]: mismatched types
--> $DIR/fn-ptr.rs:9:21
|
LL | #[target_feature(enable = "sse2")]
| ---------------------------------- `#[target_feature]` added here
...
LL | let foo: fn() = foo;
| ---- ^^^ cannot coerce functions with `#[target_feature]` to safe function pointers
| |
| expected due to this
|
= note: expected fn pointer `fn()`
found fn item `fn() {foo}`
= note: fn items are distinct from fn pointers
= note: functions with `#[target_feature]` can only be coerced to `unsafe` function pointers
help: consider casting to a fn pointer
|
LL | let foo: fn() = foo as fn();
| ~~~~~~~~~~~
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0308`.

View file

@ -1,8 +1,6 @@
// Tests #108655: closures in `#[target_feature]` functions can still be marked #[inline(always)] // Tests #108655: closures in `#[target_feature]` functions can still be marked #[inline(always)]
// check-pass // check-pass
// revisions: mir thir
// [thir]compile-flags: -Z thir-unsafeck
// only-x86_64 // only-x86_64
#![feature(target_feature_11)] #![feature(target_feature_11)]

View file

@ -1,5 +1,3 @@
// revisions: mir thir
// [thir]compile-flags: -Z thir-unsafeck
// only-x86_64 // only-x86_64
#![feature(target_feature_11)] #![feature(target_feature_11)]
@ -11,7 +9,6 @@ const fn sse2() {}
#[target_feature(enable = "fxsr")] #[target_feature(enable = "fxsr")]
const fn sse2_and_fxsr() {} const fn sse2_and_fxsr() {}
#[target_feature(enable = "avx")] #[target_feature(enable = "avx")]
#[target_feature(enable = "bmi2")] #[target_feature(enable = "bmi2")]
fn avx_bmi2() {} fn avx_bmi2() {}
@ -26,62 +23,50 @@ impl Quux {
fn foo() { fn foo() {
sse2(); sse2();
//[mir]~^ ERROR call to function with `#[target_feature]` is unsafe //~^ ERROR call to function with `#[target_feature]` is unsafe
//[thir]~^^ ERROR call to function `sse2` with `#[target_feature]` is unsafe
avx_bmi2(); avx_bmi2();
//[mir]~^ ERROR call to function with `#[target_feature]` is unsafe //~^ ERROR call to function with `#[target_feature]` is unsafe
//[thir]~^^ ERROR call to function `avx_bmi2` with `#[target_feature]` is unsafe
Quux.avx_bmi2(); Quux.avx_bmi2();
//[mir]~^ ERROR call to function with `#[target_feature]` is unsafe //~^ ERROR call to function with `#[target_feature]` is unsafe
//[thir]~^^ ERROR call to function `Quux::avx_bmi2` with `#[target_feature]` is unsafe
} }
#[target_feature(enable = "sse2")] #[target_feature(enable = "sse2")]
fn bar() { fn bar() {
avx_bmi2(); avx_bmi2();
//[mir]~^ ERROR call to function with `#[target_feature]` is unsafe //~^ ERROR call to function with `#[target_feature]` is unsafe
//[thir]~^^ ERROR call to function `avx_bmi2` with `#[target_feature]` is unsafe
Quux.avx_bmi2(); Quux.avx_bmi2();
//[mir]~^ ERROR call to function with `#[target_feature]` is unsafe //~^ ERROR call to function with `#[target_feature]` is unsafe
//[thir]~^^ ERROR call to function `Quux::avx_bmi2` with `#[target_feature]` is unsafe
} }
#[target_feature(enable = "avx")] #[target_feature(enable = "avx")]
fn baz() { fn baz() {
sse2(); sse2();
//[mir]~^ ERROR call to function with `#[target_feature]` is unsafe //~^ ERROR call to function with `#[target_feature]` is unsafe
//[thir]~^^ ERROR call to function `sse2` with `#[target_feature]` is unsafe
avx_bmi2(); avx_bmi2();
//[mir]~^ ERROR call to function with `#[target_feature]` is unsafe //~^ ERROR call to function with `#[target_feature]` is unsafe
//[thir]~^^ ERROR call to function `avx_bmi2` with `#[target_feature]` is unsafe
Quux.avx_bmi2(); Quux.avx_bmi2();
//[mir]~^ ERROR call to function with `#[target_feature]` is unsafe //~^ ERROR call to function with `#[target_feature]` is unsafe
//[thir]~^^ ERROR call to function `Quux::avx_bmi2` with `#[target_feature]` is unsafe
} }
#[target_feature(enable = "avx")] #[target_feature(enable = "avx")]
#[target_feature(enable = "bmi2")] #[target_feature(enable = "bmi2")]
fn qux() { fn qux() {
sse2(); sse2();
//[mir]~^ ERROR call to function with `#[target_feature]` is unsafe //~^ ERROR call to function with `#[target_feature]` is unsafe
//[thir]~^^ ERROR call to function `sse2` with `#[target_feature]` is unsafe
} }
const _: () = sse2(); const _: () = sse2();
//[mir]~^ ERROR call to function with `#[target_feature]` is unsafe //~^ ERROR call to function with `#[target_feature]` is unsafe
//[thir]~^^ ERROR call to function `sse2` with `#[target_feature]` is unsafe
const _: () = sse2_and_fxsr(); const _: () = sse2_and_fxsr();
//[mir]~^ ERROR call to function with `#[target_feature]` is unsafe //~^ ERROR call to function with `#[target_feature]` is unsafe
//[thir]~^^ ERROR call to function `sse2_and_fxsr` with `#[target_feature]` is unsafe
#[deny(unsafe_op_in_unsafe_fn)] #[deny(unsafe_op_in_unsafe_fn)]
#[target_feature(enable = "avx")] #[target_feature(enable = "avx")]
#[target_feature(enable = "bmi2")] #[target_feature(enable = "bmi2")]
unsafe fn needs_unsafe_block() { unsafe fn needs_unsafe_block() {
sse2(); sse2();
//[mir]~^ ERROR call to function with `#[target_feature]` is unsafe //~^ ERROR call to function with `#[target_feature]` is unsafe
//[thir]~^^ ERROR call to function `sse2` with `#[target_feature]` is unsafe
} }
fn main() {} fn main() {}

View file

@ -0,0 +1,115 @@
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
--> $DIR/safe-calls.rs:25:5
|
LL | sse2();
| ^^^^^^ call to function with `#[target_feature]`
|
= help: in order for the call to be safe, the context requires the following additional target feature: sse2
= note: the sse2 target feature being enabled in the build configuration does not remove the requirement to list it in `#[target_feature]`
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
--> $DIR/safe-calls.rs:27:5
|
LL | avx_bmi2();
| ^^^^^^^^^^ call to function with `#[target_feature]`
|
= help: in order for the call to be safe, the context requires the following additional target features: avx and bmi2
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
--> $DIR/safe-calls.rs:29:5
|
LL | Quux.avx_bmi2();
| ^^^^^^^^^^^^^^^ call to function with `#[target_feature]`
|
= help: in order for the call to be safe, the context requires the following additional target features: avx and bmi2
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
--> $DIR/safe-calls.rs:35:5
|
LL | avx_bmi2();
| ^^^^^^^^^^ call to function with `#[target_feature]`
|
= help: in order for the call to be safe, the context requires the following additional target features: avx and bmi2
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
--> $DIR/safe-calls.rs:37:5
|
LL | Quux.avx_bmi2();
| ^^^^^^^^^^^^^^^ call to function with `#[target_feature]`
|
= help: in order for the call to be safe, the context requires the following additional target features: avx and bmi2
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
--> $DIR/safe-calls.rs:43:5
|
LL | sse2();
| ^^^^^^ call to function with `#[target_feature]`
|
= help: in order for the call to be safe, the context requires the following additional target feature: sse2
= note: the sse2 target feature being enabled in the build configuration does not remove the requirement to list it in `#[target_feature]`
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
--> $DIR/safe-calls.rs:45:5
|
LL | avx_bmi2();
| ^^^^^^^^^^ call to function with `#[target_feature]`
|
= help: in order for the call to be safe, the context requires the following additional target feature: bmi2
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
--> $DIR/safe-calls.rs:47:5
|
LL | Quux.avx_bmi2();
| ^^^^^^^^^^^^^^^ call to function with `#[target_feature]`
|
= help: in order for the call to be safe, the context requires the following additional target feature: bmi2
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
--> $DIR/safe-calls.rs:54:5
|
LL | sse2();
| ^^^^^^ call to function with `#[target_feature]`
|
= help: in order for the call to be safe, the context requires the following additional target feature: sse2
= note: the sse2 target feature being enabled in the build configuration does not remove the requirement to list it in `#[target_feature]`
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
--> $DIR/safe-calls.rs:58:15
|
LL | const _: () = sse2();
| ^^^^^^ call to function with `#[target_feature]`
|
= help: in order for the call to be safe, the context requires the following additional target feature: sse2
= note: the sse2 target feature being enabled in the build configuration does not remove the requirement to list it in `#[target_feature]`
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
--> $DIR/safe-calls.rs:61:15
|
LL | const _: () = sse2_and_fxsr();
| ^^^^^^^^^^^^^^^ call to function with `#[target_feature]`
|
= help: in order for the call to be safe, the context requires the following additional target features: sse2 and fxsr
= note: the fxsr and sse2 target features being enabled in the build configuration does not remove the requirement to list them in `#[target_feature]`
error: call to function with `#[target_feature]` is unsafe and requires unsafe block (error E0133)
--> $DIR/safe-calls.rs:68:5
|
LL | sse2();
| ^^^^^^ call to function with `#[target_feature]`
|
= help: in order for the call to be safe, the context requires the following additional target feature: sse2
= note: the sse2 target feature being enabled in the build configuration does not remove the requirement to list it in `#[target_feature]`
note: an unsafe function restricts its caller, but its body is safe by default
--> $DIR/safe-calls.rs:67:1
|
LL | unsafe fn needs_unsafe_block() {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: the lint level is defined here
--> $DIR/safe-calls.rs:64:8
|
LL | #[deny(unsafe_op_in_unsafe_fn)]
| ^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 12 previous errors
For more information about this error, try `rustc --explain E0133`.

View file

@ -1,8 +1,6 @@
// run-pass // run-pass
// ignore-emscripten spawning processes is not supported // ignore-emscripten spawning processes is not supported
// ignore-sgx no processes // ignore-sgx no processes
// revisions: mir thir
// [thir]compile-flags: -Zthir-unsafeck
#![feature(start)] #![feature(start)]

View file

@ -1,7 +1,5 @@
// run-pass // run-pass
// ignore-emscripten FIXME(#45351) hits an LLVM assert // ignore-emscripten FIXME(#45351) hits an LLVM assert
// revisions: mir thir
// [thir]compile-flags: -Zthir-unsafeck
#![feature(repr_simd, platform_intrinsics, concat_idents)] #![feature(repr_simd, platform_intrinsics, concat_idents)]
#![allow(non_camel_case_types)] #![allow(non_camel_case_types)]

View file

@ -3,9 +3,6 @@
// edition:2018 // edition:2018
// revisions: mir thir
// [thir]compile-flags: -Zthir-unsafeck
#![allow(dead_code)] #![allow(dead_code)]
#![deny(unused_unsafe)] #![deny(unused_unsafe)]

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,4 @@
// aux-build:extern-statics.rs // aux-build:extern-statics.rs
// revisions: mir thir
// [thir]compile-flags: -Z thir-unsafeck
extern crate extern_statics; extern crate extern_statics;
use extern_statics::*; use extern_statics::*;

View file

@ -1,5 +1,5 @@
error[E0133]: use of mutable static is unsafe and requires unsafe function or block error[E0133]: use of mutable static is unsafe and requires unsafe function or block
--> $DIR/safe-extern-statics-mut.rs:13:13 --> $DIR/safe-extern-statics-mut.rs:11:13
| |
LL | let b = B; LL | let b = B;
| ^ use of mutable static | ^ use of mutable static
@ -7,7 +7,7 @@ LL | let b = B;
= note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
error[E0133]: use of mutable static is unsafe and requires unsafe function or block error[E0133]: use of mutable static is unsafe and requires unsafe function or block
--> $DIR/safe-extern-statics-mut.rs:14:14 --> $DIR/safe-extern-statics-mut.rs:12:14
| |
LL | let rb = &B; LL | let rb = &B;
| ^^ use of mutable static | ^^ use of mutable static
@ -15,7 +15,7 @@ LL | let rb = &B;
= note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
error[E0133]: use of mutable static is unsafe and requires unsafe function or block error[E0133]: use of mutable static is unsafe and requires unsafe function or block
--> $DIR/safe-extern-statics-mut.rs:15:14 --> $DIR/safe-extern-statics-mut.rs:13:14
| |
LL | let xb = XB; LL | let xb = XB;
| ^^ use of mutable static | ^^ use of mutable static
@ -23,7 +23,7 @@ LL | let xb = XB;
= note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
error[E0133]: use of mutable static is unsafe and requires unsafe function or block error[E0133]: use of mutable static is unsafe and requires unsafe function or block
--> $DIR/safe-extern-statics-mut.rs:16:15 --> $DIR/safe-extern-statics-mut.rs:14:15
| |
LL | let xrb = &XB; LL | let xrb = &XB;
| ^^^ use of mutable static | ^^^ use of mutable static

View file

@ -1,35 +0,0 @@
error[E0133]: use of mutable static is unsafe and requires unsafe function or block
--> $DIR/safe-extern-statics-mut.rs:13:13
|
LL | let b = B;
| ^ use of mutable static
|
= note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
error[E0133]: use of mutable static is unsafe and requires unsafe function or block
--> $DIR/safe-extern-statics-mut.rs:14:15
|
LL | let rb = &B;
| ^ use of mutable static
|
= note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
error[E0133]: use of mutable static is unsafe and requires unsafe function or block
--> $DIR/safe-extern-statics-mut.rs:15:14
|
LL | let xb = XB;
| ^^ use of mutable static
|
= note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
error[E0133]: use of mutable static is unsafe and requires unsafe function or block
--> $DIR/safe-extern-statics-mut.rs:16:16
|
LL | let xrb = &XB;
| ^^ use of mutable static
|
= note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0133`.

View file

@ -1,6 +1,4 @@
// aux-build:extern-statics.rs // aux-build:extern-statics.rs
// revisions: mir thir
// [thir]compile-flags: -Z thir-unsafeck
extern crate extern_statics; extern crate extern_statics;
use extern_statics::*; use extern_statics::*;

View file

@ -1,5 +1,5 @@
error[E0133]: use of extern static is unsafe and requires unsafe function or block error[E0133]: use of extern static is unsafe and requires unsafe function or block
--> $DIR/safe-extern-statics.rs:13:13 --> $DIR/safe-extern-statics.rs:11:13
| |
LL | let a = A; LL | let a = A;
| ^ use of extern static | ^ use of extern static
@ -7,7 +7,7 @@ LL | let a = A;
= note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior
error[E0133]: use of extern static is unsafe and requires unsafe function or block error[E0133]: use of extern static is unsafe and requires unsafe function or block
--> $DIR/safe-extern-statics.rs:14:14 --> $DIR/safe-extern-statics.rs:12:14
| |
LL | let ra = &A; LL | let ra = &A;
| ^^ use of extern static | ^^ use of extern static
@ -15,7 +15,7 @@ LL | let ra = &A;
= note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior
error[E0133]: use of extern static is unsafe and requires unsafe function or block error[E0133]: use of extern static is unsafe and requires unsafe function or block
--> $DIR/safe-extern-statics.rs:15:14 --> $DIR/safe-extern-statics.rs:13:14
| |
LL | let xa = XA; LL | let xa = XA;
| ^^ use of extern static | ^^ use of extern static
@ -23,7 +23,7 @@ LL | let xa = XA;
= note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior
error[E0133]: use of extern static is unsafe and requires unsafe function or block error[E0133]: use of extern static is unsafe and requires unsafe function or block
--> $DIR/safe-extern-statics.rs:16:15 --> $DIR/safe-extern-statics.rs:14:15
| |
LL | let xra = &XA; LL | let xra = &XA;
| ^^^ use of extern static | ^^^ use of extern static

View file

@ -1,35 +0,0 @@
error[E0133]: use of extern static is unsafe and requires unsafe function or block
--> $DIR/safe-extern-statics.rs:13:13
|
LL | let a = A;
| ^ use of extern static
|
= note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior
error[E0133]: use of extern static is unsafe and requires unsafe function or block
--> $DIR/safe-extern-statics.rs:14:15
|
LL | let ra = &A;
| ^ use of extern static
|
= note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior
error[E0133]: use of extern static is unsafe and requires unsafe function or block
--> $DIR/safe-extern-statics.rs:15:14
|
LL | let xa = XA;
| ^^ use of extern static
|
= note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior
error[E0133]: use of extern static is unsafe and requires unsafe function or block
--> $DIR/safe-extern-statics.rs:16:16
|
LL | let xra = &XA;
| ^^ use of extern static
|
= note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior
error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0133`.

View file

@ -1,6 +1,3 @@
// revisions: mir thir
// [thir]compile-flags: -Z thir-unsafeck
extern "C" { extern "C" {
static mut a: i32; static mut a: i32;
} }

View file

@ -1,5 +1,5 @@
error[E0133]: use of mutable static is unsafe and requires unsafe function or block error[E0133]: use of mutable static is unsafe and requires unsafe function or block
--> $DIR/static-mut-foreign-requires-unsafe.rs:9:5 --> $DIR/static-mut-foreign-requires-unsafe.rs:6:5
| |
LL | a += 3; LL | a += 3;
| ^^^^^^ use of mutable static | ^^^^^^ use of mutable static
@ -7,7 +7,7 @@ LL | a += 3;
= note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
error[E0133]: use of mutable static is unsafe and requires unsafe function or block error[E0133]: use of mutable static is unsafe and requires unsafe function or block
--> $DIR/static-mut-foreign-requires-unsafe.rs:10:5 --> $DIR/static-mut-foreign-requires-unsafe.rs:7:5
| |
LL | a = 4; LL | a = 4;
| ^^^^^ use of mutable static | ^^^^^ use of mutable static
@ -15,7 +15,7 @@ LL | a = 4;
= note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
error[E0133]: use of mutable static is unsafe and requires unsafe function or block error[E0133]: use of mutable static is unsafe and requires unsafe function or block
--> $DIR/static-mut-foreign-requires-unsafe.rs:11:14 --> $DIR/static-mut-foreign-requires-unsafe.rs:8:14
| |
LL | let _b = a; LL | let _b = a;
| ^ use of mutable static | ^ use of mutable static

View file

@ -1,27 +0,0 @@
error[E0133]: use of mutable static is unsafe and requires unsafe function or block
--> $DIR/static-mut-foreign-requires-unsafe.rs:9:5
|
LL | a += 3;
| ^ use of mutable static
|
= note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
error[E0133]: use of mutable static is unsafe and requires unsafe function or block
--> $DIR/static-mut-foreign-requires-unsafe.rs:10:5
|
LL | a = 4;
| ^ use of mutable static
|
= note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
error[E0133]: use of mutable static is unsafe and requires unsafe function or block
--> $DIR/static-mut-foreign-requires-unsafe.rs:11:14
|
LL | let _b = a;
| ^ use of mutable static
|
= note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0133`.

View file

@ -1,6 +1,3 @@
// revisions: mir thir
// [thir]compile-flags: -Z thir-unsafeck
static mut a: isize = 3; static mut a: isize = 3;
fn main() { fn main() {

View file

@ -1,5 +1,5 @@
error[E0133]: use of mutable static is unsafe and requires unsafe function or block error[E0133]: use of mutable static is unsafe and requires unsafe function or block
--> $DIR/static-mut-requires-unsafe.rs:7:5 --> $DIR/static-mut-requires-unsafe.rs:4:5
| |
LL | a += 3; LL | a += 3;
| ^^^^^^ use of mutable static | ^^^^^^ use of mutable static
@ -7,7 +7,7 @@ LL | a += 3;
= note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
error[E0133]: use of mutable static is unsafe and requires unsafe function or block error[E0133]: use of mutable static is unsafe and requires unsafe function or block
--> $DIR/static-mut-requires-unsafe.rs:8:5 --> $DIR/static-mut-requires-unsafe.rs:5:5
| |
LL | a = 4; LL | a = 4;
| ^^^^^ use of mutable static | ^^^^^ use of mutable static
@ -15,7 +15,7 @@ LL | a = 4;
= note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
error[E0133]: use of mutable static is unsafe and requires unsafe function or block error[E0133]: use of mutable static is unsafe and requires unsafe function or block
--> $DIR/static-mut-requires-unsafe.rs:9:14 --> $DIR/static-mut-requires-unsafe.rs:6:14
| |
LL | let _b = a; LL | let _b = a;
| ^ use of mutable static | ^ use of mutable static

View file

@ -1,27 +0,0 @@
error[E0133]: use of mutable static is unsafe and requires unsafe function or block
--> $DIR/static-mut-requires-unsafe.rs:7:5
|
LL | a += 3;
| ^ use of mutable static
|
= note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
error[E0133]: use of mutable static is unsafe and requires unsafe function or block
--> $DIR/static-mut-requires-unsafe.rs:8:5
|
LL | a = 4;
| ^ use of mutable static
|
= note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
error[E0133]: use of mutable static is unsafe and requires unsafe function or block
--> $DIR/static-mut-requires-unsafe.rs:9:14
|
LL | let _b = a;
| ^ use of mutable static
|
= note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0133`.

View file

@ -1,6 +1,3 @@
// revisions: mir thir
// [thir]compile-flags: -Z thir-unsafeck
extern "C" { extern "C" {
pub static symbol: u32; pub static symbol: u32;
} }

View file

@ -1,5 +1,5 @@
error[E0133]: use of extern static is unsafe and requires unsafe function or block error[E0133]: use of extern static is unsafe and requires unsafe function or block
--> $DIR/issue-14227.rs:7:21 --> $DIR/issue-14227.rs:4:21
| |
LL | static CRASH: u32 = symbol; LL | static CRASH: u32 = symbol;
| ^^^^^^ use of extern static | ^^^^^^ use of extern static

View file

@ -1,11 +0,0 @@
error[E0133]: use of extern static is unsafe and requires unsafe function or block
--> $DIR/issue-14227.rs:7:21
|
LL | static CRASH: u32 = symbol;
| ^^^^^^ use of extern static
|
= note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0133`.

View file

@ -1,6 +1,4 @@
// edition:2018 // edition:2018
// revisions: mir thir
//thir: -Zthir-unsafeck
#![feature(thread_local)] #![feature(thread_local)]
#![feature(const_swap)] #![feature(const_swap)]

View file

@ -1,5 +1,5 @@
error[E0658]: mutable references are not allowed in constant functions error[E0658]: mutable references are not allowed in constant functions
--> $DIR/thread-local-static.rs:10:12 --> $DIR/thread-local-static.rs:8:12
| |
LL | const fn g(x: &mut [u32; 8]) { LL | const fn g(x: &mut [u32; 8]) {
| ^ | ^
@ -8,13 +8,13 @@ LL | const fn g(x: &mut [u32; 8]) {
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
error[E0625]: thread-local statics cannot be accessed at compile-time error[E0625]: thread-local statics cannot be accessed at compile-time
--> $DIR/thread-local-static.rs:12:28 --> $DIR/thread-local-static.rs:10:28
| |
LL | std::mem::swap(x, &mut STATIC_VAR_2) LL | std::mem::swap(x, &mut STATIC_VAR_2)
| ^^^^^^^^^^^^ | ^^^^^^^^^^^^
error[E0013]: constant functions cannot refer to statics error[E0013]: constant functions cannot refer to statics
--> $DIR/thread-local-static.rs:12:28 --> $DIR/thread-local-static.rs:10:28
| |
LL | std::mem::swap(x, &mut STATIC_VAR_2) LL | std::mem::swap(x, &mut STATIC_VAR_2)
| ^^^^^^^^^^^^ | ^^^^^^^^^^^^
@ -22,7 +22,7 @@ LL | std::mem::swap(x, &mut STATIC_VAR_2)
= help: consider extracting the value of the `static` to a `const`, and referring to that = help: consider extracting the value of the `static` to a `const`, and referring to that
error[E0658]: mutable references are not allowed in constant functions error[E0658]: mutable references are not allowed in constant functions
--> $DIR/thread-local-static.rs:12:23 --> $DIR/thread-local-static.rs:10:23
| |
LL | std::mem::swap(x, &mut STATIC_VAR_2) LL | std::mem::swap(x, &mut STATIC_VAR_2)
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^
@ -31,7 +31,7 @@ LL | std::mem::swap(x, &mut STATIC_VAR_2)
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
error[E0133]: use of mutable static is unsafe and requires unsafe function or block error[E0133]: use of mutable static is unsafe and requires unsafe function or block
--> $DIR/thread-local-static.rs:12:23 --> $DIR/thread-local-static.rs:10:23
| |
LL | std::mem::swap(x, &mut STATIC_VAR_2) LL | std::mem::swap(x, &mut STATIC_VAR_2)
| ^^^^^^^^^^^^^^^^^ use of mutable static | ^^^^^^^^^^^^^^^^^ use of mutable static

View file

@ -1,44 +0,0 @@
error[E0658]: mutable references are not allowed in constant functions
--> $DIR/thread-local-static.rs:10:12
|
LL | const fn g(x: &mut [u32; 8]) {
| ^
|
= note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
error[E0625]: thread-local statics cannot be accessed at compile-time
--> $DIR/thread-local-static.rs:12:28
|
LL | std::mem::swap(x, &mut STATIC_VAR_2)
| ^^^^^^^^^^^^
error[E0013]: constant functions cannot refer to statics
--> $DIR/thread-local-static.rs:12:28
|
LL | std::mem::swap(x, &mut STATIC_VAR_2)
| ^^^^^^^^^^^^
|
= help: consider extracting the value of the `static` to a `const`, and referring to that
error[E0658]: mutable references are not allowed in constant functions
--> $DIR/thread-local-static.rs:12:23
|
LL | std::mem::swap(x, &mut STATIC_VAR_2)
| ^^^^^^^^^^^^^^^^^
|
= note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
error[E0133]: use of mutable static is unsafe and requires unsafe function or block
--> $DIR/thread-local-static.rs:12:23
|
LL | std::mem::swap(x, &mut STATIC_VAR_2)
| ^^^^^^^^^^^^^^^^^ use of mutable static
|
= note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
error: aborting due to 5 previous errors
Some errors have detailed explanations: E0013, E0133, E0625, E0658.
For more information about an error, try `rustc --explain E0013`.

View file

@ -1,6 +1,4 @@
// ignore-wasm32 // ignore-wasm32
// revisions: mir thir
// [thir]compile-flags: -Z thir-unsafeck
#![feature(thread_local)] #![feature(thread_local)]
#![feature(cfg_target_thread_local, thread_local_internals)] #![feature(cfg_target_thread_local, thread_local_internals)]
@ -17,13 +15,11 @@ static __KEY: std::thread::local_impl::Key<Foo> = std::thread::local_impl::Key::
fn __getit(_: Option<&mut Option<RefCell<String>>>) -> std::option::Option<&'static Foo> { fn __getit(_: Option<&mut Option<RefCell<String>>>) -> std::option::Option<&'static Foo> {
__KEY.get(Default::default) __KEY.get(Default::default)
//[mir]~^ ERROR call to unsafe function is unsafe //~^ ERROR call to unsafe function is unsafe
//[thir]~^^ ERROR call to unsafe function `Key::<T>::get`
} }
static FOO: std::thread::LocalKey<Foo> = std::thread::LocalKey::new(__getit); static FOO: std::thread::LocalKey<Foo> = std::thread::LocalKey::new(__getit);
//[mir]~^ ERROR call to unsafe function is unsafe //~^ ERROR call to unsafe function is unsafe
//[thir]~^^ ERROR call to unsafe function `LocalKey::<T>::new`
fn main() { fn main() {
FOO.with(|foo| println!("{}", foo.borrow())); FOO.with(|foo| println!("{}", foo.borrow()));

Some files were not shown because too many files have changed in this diff Show more