Auto merge of #85560 - GuillaumeGomez:rollup-8k90rc7, r=GuillaumeGomez
Rollup of 4 pull requests Successful merges: - #85506 (Reset "focusedByTab" field when doing another search) - #85548 (Remove dead toggle JS code) - #85550 (facepalm: operator precedence fail on my part.) - #85555 (Check for more things in THIR unsafeck) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
5dc8789e30
70 changed files with 684 additions and 262 deletions
19
src/test/ui/cast/cast-ptr-to-int-const.mir.stderr
Normal file
19
src/test/ui/cast/cast-ptr-to-int-const.mir.stderr
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
error[E0133]: cast of pointer to int is unsafe and requires unsafe function or block
|
||||
--> $DIR/cast-ptr-to-int-const.rs:10:9
|
||||
|
|
||||
LL | &Y as *const u32 as usize
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ cast of pointer to int
|
||||
|
|
||||
= note: casting pointers to integers in constants
|
||||
|
||||
error[E0133]: cast of pointer to int is unsafe and requires unsafe function or block
|
||||
--> $DIR/cast-ptr-to-int-const.rs:17:5
|
||||
|
|
||||
LL | &0 as *const i32 as usize
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ cast of pointer to int
|
||||
|
|
||||
= note: casting pointers to integers in constants
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0133`.
|
||||
|
|
@ -1,25 +1,19 @@
|
|||
// gate-test-const_raw_ptr_to_usize_cast
|
||||
// revisions: with_feature without_feature
|
||||
// revisions: mir thir
|
||||
// [thir]compile-flags: -Z thir-unsafeck
|
||||
|
||||
#![cfg_attr(with_feature, feature(const_raw_ptr_to_usize_cast))]
|
||||
#![feature(const_raw_ptr_to_usize_cast)]
|
||||
|
||||
fn main() {
|
||||
const X: usize = unsafe {
|
||||
main as usize //[without_feature]~ ERROR casting pointers to integers in constants is unstable
|
||||
};
|
||||
const Y: u32 = 0;
|
||||
const Z: usize = unsafe {
|
||||
&Y as *const u32 as usize //[without_feature]~ ERROR is unstable
|
||||
};
|
||||
// Cast in `const` without `unsafe` block
|
||||
const SAFE: usize = {
|
||||
&Y as *const u32 as usize //[without_feature]~ ERROR is unstable
|
||||
//[with_feature]~^ ERROR cast of pointer to int is unsafe and requires unsafe
|
||||
&Y as *const u32 as usize
|
||||
//~^ ERROR cast of pointer to int is unsafe and requires unsafe
|
||||
};
|
||||
}
|
||||
|
||||
// Cast in `const fn` without `unsafe` block
|
||||
const fn test() -> usize {
|
||||
&0 as *const i32 as usize //[without_feature]~ ERROR is unstable
|
||||
//[with_feature]~^ ERROR cast of pointer to int is unsafe and requires unsafe
|
||||
&0 as *const i32 as usize
|
||||
//~^ ERROR cast of pointer to int is unsafe and requires unsafe
|
||||
}
|
||||
|
|
|
|||
19
src/test/ui/cast/cast-ptr-to-int-const.thir.stderr
Normal file
19
src/test/ui/cast/cast-ptr-to-int-const.thir.stderr
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
error[E0133]: cast of pointer to int is unsafe and requires unsafe function or block
|
||||
--> $DIR/cast-ptr-to-int-const.rs:10:9
|
||||
|
|
||||
LL | &Y as *const u32 as usize
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ cast of pointer to int
|
||||
|
|
||||
= note: casting pointers to integers in constants
|
||||
|
||||
error[E0133]: cast of pointer to int is unsafe and requires unsafe function or block
|
||||
--> $DIR/cast-ptr-to-int-const.rs:17:5
|
||||
|
|
||||
LL | &0 as *const i32 as usize
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ cast of pointer to int
|
||||
|
|
||||
= note: casting pointers to integers in constants
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0133`.
|
||||
13
src/test/ui/cast/feature-gate-const_raw_ptr_to_usize_cast.rs
Normal file
13
src/test/ui/cast/feature-gate-const_raw_ptr_to_usize_cast.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
fn main() {
|
||||
const X: usize = unsafe {
|
||||
main as usize //~ ERROR casting pointers to integers in constants is unstable
|
||||
};
|
||||
const Y: u32 = 0;
|
||||
const Z: usize = unsafe {
|
||||
&Y as *const u32 as usize //~ ERROR is unstable
|
||||
};
|
||||
}
|
||||
|
||||
const fn test() -> usize {
|
||||
&0 as *const i32 as usize //~ ERROR is unstable
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
error[E0658]: casting pointers to integers in constants is unstable
|
||||
--> $DIR/feature-gate-const_raw_ptr_to_usize_cast.rs:3:9
|
||||
|
|
||||
LL | main as usize
|
||||
| ^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #51910 <https://github.com/rust-lang/rust/issues/51910> for more information
|
||||
= help: add `#![feature(const_raw_ptr_to_usize_cast)]` to the crate attributes to enable
|
||||
|
||||
error[E0658]: casting pointers to integers in constants is unstable
|
||||
--> $DIR/feature-gate-const_raw_ptr_to_usize_cast.rs:7:9
|
||||
|
|
||||
LL | &Y as *const u32 as usize
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #51910 <https://github.com/rust-lang/rust/issues/51910> for more information
|
||||
= help: add `#![feature(const_raw_ptr_to_usize_cast)]` to the crate attributes to enable
|
||||
|
||||
error[E0658]: casting pointers to integers in constant functions is unstable
|
||||
--> $DIR/feature-gate-const_raw_ptr_to_usize_cast.rs:12:5
|
||||
|
|
||||
LL | &0 as *const i32 as usize
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #51910 <https://github.com/rust-lang/rust/issues/51910> for more information
|
||||
= help: add `#![feature(const_raw_ptr_to_usize_cast)]` to the crate attributes to enable
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block
|
||||
--> $DIR/issue-45729-unsafe-in-generator.rs:5:9
|
||||
--> $DIR/issue-45729-unsafe-in-generator.rs:8:9
|
||||
|
|
||||
LL | *(1 as *mut u32) = 42;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ dereference of raw pointer
|
||||
|
|
@ -1,3 +1,6 @@
|
|||
// revisions: mir thir
|
||||
// [thir]compile-flags: -Z thir-unsafeck
|
||||
|
||||
#![feature(generators)]
|
||||
|
||||
fn main() {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,11 @@
|
|||
error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block
|
||||
--> $DIR/issue-45729-unsafe-in-generator.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 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0133`.
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0133]: use of extern static is unsafe and requires unsafe function or block
|
||||
--> $DIR/issue-28575.rs:8:5
|
||||
--> $DIR/issue-28575.rs:11:5
|
||||
|
|
||||
LL | FOO()
|
||||
| ^^^ use of extern static
|
||||
|
|
@ -1,3 +1,6 @@
|
|||
// revisions: mir thir
|
||||
// [thir]compile-flags: -Z thir-unsafeck
|
||||
|
||||
#![feature(intrinsics)]
|
||||
|
||||
extern "C" {
|
||||
|
|
|
|||
11
src/test/ui/intrinsics/issue-28575.thir.stderr
Normal file
11
src/test/ui/intrinsics/issue-28575.thir.stderr
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
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 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0133`.
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0133]: use of extern static is unsafe and requires unsafe function or block
|
||||
--> $DIR/issue-14227.rs:4:21
|
||||
--> $DIR/issue-14227.rs:7:21
|
||||
|
|
||||
LL | static CRASH: u32 = symbol;
|
||||
| ^^^^^^ use of extern static
|
||||
|
|
@ -1,3 +1,6 @@
|
|||
// revisions: mir thir
|
||||
// [thir]compile-flags: -Z thir-unsafeck
|
||||
|
||||
extern "C" {
|
||||
pub static symbol: u32;
|
||||
}
|
||||
|
|
|
|||
11
src/test/ui/issues/issue-14227.thir.stderr
Normal file
11
src/test/ui/issues/issue-14227.thir.stderr
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
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 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0133`.
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
error[E0015]: calls in statics are limited to constant functions, tuple structs and tuple variants
|
||||
--> $DIR/issue-16538.rs:11:27
|
||||
--> $DIR/issue-16538.rs:14:27
|
||||
|
|
||||
LL | static foo: *const Y::X = Y::foo(Y::x as *const Y::X);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0277]: `*const usize` cannot be shared between threads safely
|
||||
--> $DIR/issue-16538.rs:11:1
|
||||
--> $DIR/issue-16538.rs:14:1
|
||||
|
|
||||
LL | static foo: *const Y::X = Y::foo(Y::x as *const Y::X);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `*const usize` cannot be shared between threads safely
|
||||
|
|
@ -14,7 +14,7 @@ LL | static foo: *const Y::X = Y::foo(Y::x as *const Y::X);
|
|||
= note: shared static variables must have a type that implements `Sync`
|
||||
|
||||
error[E0133]: use of extern static is unsafe and requires unsafe function or block
|
||||
--> $DIR/issue-16538.rs:11:34
|
||||
--> $DIR/issue-16538.rs:14:34
|
||||
|
|
||||
LL | static foo: *const Y::X = Y::foo(Y::x as *const Y::X);
|
||||
| ^^^^ use of extern static
|
||||
|
|
@ -1,3 +1,6 @@
|
|||
// revisions: mir thir
|
||||
// [thir]compile-flags: -Z thir-unsafeck
|
||||
|
||||
mod Y {
|
||||
pub type X = usize;
|
||||
extern "C" {
|
||||
|
|
|
|||
27
src/test/ui/issues/issue-16538.thir.stderr
Normal file
27
src/test/ui/issues/issue-16538.thir.stderr
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
error[E0015]: calls in statics are limited to constant functions, tuple structs and tuple variants
|
||||
--> $DIR/issue-16538.rs:14:27
|
||||
|
|
||||
LL | static foo: *const Y::X = Y::foo(Y::x as *const Y::X);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0277]: `*const usize` cannot be shared between threads safely
|
||||
--> $DIR/issue-16538.rs:14:1
|
||||
|
|
||||
LL | static foo: *const Y::X = Y::foo(Y::x as *const Y::X);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `*const usize` cannot be shared between threads safely
|
||||
|
|
||||
= help: the trait `Sync` is not implemented for `*const usize`
|
||||
= note: shared static variables must have a type that implements `Sync`
|
||||
|
||||
error[E0133]: use of extern static is unsafe and requires unsafe function or block
|
||||
--> $DIR/issue-16538.rs:14:34
|
||||
|
|
||||
LL | static foo: *const 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: aborting due to 3 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0015, E0133, E0277.
|
||||
For more information about an error, try `rustc --explain E0015`.
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0133]: use of extern static is unsafe and requires unsafe function or block
|
||||
--> $DIR/issue-28324.rs:5:24
|
||||
--> $DIR/issue-28324.rs:8:24
|
||||
|
|
||||
LL | pub static BAZ: u32 = *&error_message_count;
|
||||
| ^^^^^^^^^^^^^^^^^^^^ use of extern static
|
||||
|
|
@ -1,3 +1,6 @@
|
|||
// revisions: mir thir
|
||||
// [thir]compile-flags: -Z thir-unsafeck
|
||||
|
||||
extern "C" {
|
||||
static error_message_count: u32;
|
||||
}
|
||||
|
|
|
|||
11
src/test/ui/issues/issue-28324.thir.stderr
Normal file
11
src/test/ui/issues/issue-28324.thir.stderr
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
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 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0133`.
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0133]: access to union field is unsafe and requires unsafe function or block
|
||||
--> $DIR/issue-47412.rs:11:11
|
||||
--> $DIR/issue-47412.rs:14:11
|
||||
|
|
||||
LL | match u.void {}
|
||||
| ^^^^^^ access to union field
|
||||
|
|
@ -7,7 +7,7 @@ LL | match u.void {}
|
|||
= note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
|
||||
|
||||
error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block
|
||||
--> $DIR/issue-47412.rs:17:11
|
||||
--> $DIR/issue-47412.rs:21:11
|
||||
|
|
||||
LL | match *ptr {}
|
||||
| ^^^^ dereference of raw pointer
|
||||
|
|
@ -1,3 +1,6 @@
|
|||
// revisions: mir thir
|
||||
// [thir]compile-flags: -Z thir-unsafeck
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
enum Void {}
|
||||
|
||||
|
|
@ -9,7 +12,8 @@ fn union_field() {
|
|||
union Union { unit: (), void: Void }
|
||||
let u = Union { unit: () };
|
||||
match u.void {}
|
||||
//~^ ERROR access to union field is unsafe
|
||||
//[mir]~^ ERROR access to union field is unsafe
|
||||
// FIXME(thir-unsafeck): AccessToUnionField unimplemented
|
||||
}
|
||||
|
||||
fn raw_ptr_deref() {
|
||||
|
|
|
|||
11
src/test/ui/issues/issue-47412.thir.stderr
Normal file
11
src/test/ui/issues/issue-47412.thir.stderr
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block
|
||||
--> $DIR/issue-47412.rs:21:11
|
||||
|
|
||||
LL | match *ptr {}
|
||||
| ^^^^ 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 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0133`.
|
||||
|
|
@ -8,6 +8,8 @@
|
|||
|
||||
// check-pass
|
||||
// only-x86_64
|
||||
// revisions: mir thir
|
||||
// [thir]compile-flags: -Z thir-unsafeck
|
||||
|
||||
#![feature(target_feature_11)]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
// Tests #73631: closures inherit `#[target_feature]` annotations
|
||||
|
||||
// check-pass
|
||||
// revisions: mir thir
|
||||
// [thir]compile-flags: -Z thir-unsafeck
|
||||
// only-x86_64
|
||||
|
||||
#![feature(target_feature_11)]
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/fn-ptr.rs:9:21
|
||||
--> $DIR/fn-ptr.rs:11:21
|
||||
|
|
||||
LL | #[target_feature(enable = "sse2")]
|
||||
| ---------------------------------- `#[target_feature]` added here
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
// revisions: mir thir
|
||||
// [thir]compile-flags: -Z thir-unsafeck
|
||||
// only-x86_64
|
||||
|
||||
#![feature(target_feature_11)]
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/fn-ptr.rs:11: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: functions with `#[target_feature]` can only be coerced to `unsafe` function pointers
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
||||
|
|
@ -1,69 +1,69 @@
|
|||
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
|
||||
--> $DIR/safe-calls.rs:21:5
|
||||
|
|
||||
LL | sse2();
|
||||
| ^^^^^^ call to function with `#[target_feature]`
|
||||
|
|
||||
= note: can only be called if the required target features are available
|
||||
|
||||
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
|
||||
--> $DIR/safe-calls.rs:22:5
|
||||
|
|
||||
LL | avx_bmi2();
|
||||
| ^^^^^^^^^^ call to function with `#[target_feature]`
|
||||
|
|
||||
= note: can only be called if the required target features are available
|
||||
|
||||
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
|
||||
--> $DIR/safe-calls.rs:23:5
|
||||
|
|
||||
LL | Quux.avx_bmi2();
|
||||
| ^^^^^^^^^^^^^^^ call to function with `#[target_feature]`
|
||||
|
|
||||
= note: can only be called if the required target features are available
|
||||
|
||||
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
|
||||
--> $DIR/safe-calls.rs:28:5
|
||||
|
|
||||
LL | avx_bmi2();
|
||||
| ^^^^^^^^^^ call to function with `#[target_feature]`
|
||||
|
|
||||
= note: can only be called if the required target features are available
|
||||
|
||||
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]`
|
||||
|
|
||||
= note: can only be called if the required target features are available
|
||||
|
||||
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
|
||||
--> $DIR/safe-calls.rs:34:5
|
||||
|
|
||||
LL | sse2();
|
||||
| ^^^^^^ call to function with `#[target_feature]`
|
||||
|
|
||||
= note: can only be called if the required target features are available
|
||||
|
||||
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
|
||||
--> $DIR/safe-calls.rs:35:5
|
||||
--> $DIR/safe-calls.rs:24:5
|
||||
|
|
||||
LL | avx_bmi2();
|
||||
| ^^^^^^^^^^ call to function with `#[target_feature]`
|
||||
|
|
||||
= note: can only be called if the required target features are available
|
||||
|
||||
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
|
||||
--> $DIR/safe-calls.rs:25:5
|
||||
|
|
||||
LL | Quux.avx_bmi2();
|
||||
| ^^^^^^^^^^^^^^^ call to function with `#[target_feature]`
|
||||
|
|
||||
= note: can only be called if the required target features are available
|
||||
|
||||
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
|
||||
--> $DIR/safe-calls.rs:30:5
|
||||
|
|
||||
LL | avx_bmi2();
|
||||
| ^^^^^^^^^^ call to function with `#[target_feature]`
|
||||
|
|
||||
= note: can only be called if the required target features are available
|
||||
|
||||
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
|
||||
--> $DIR/safe-calls.rs:31:5
|
||||
|
|
||||
LL | Quux.avx_bmi2();
|
||||
| ^^^^^^^^^^^^^^^ call to function with `#[target_feature]`
|
||||
|
|
||||
= note: can only be called if the required target features are available
|
||||
|
||||
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
|
||||
--> $DIR/safe-calls.rs:36:5
|
||||
|
|
||||
LL | sse2();
|
||||
| ^^^^^^ call to function with `#[target_feature]`
|
||||
|
|
||||
= note: can only be called if the required target features are available
|
||||
|
||||
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
|
||||
--> $DIR/safe-calls.rs:37:5
|
||||
|
|
||||
LL | avx_bmi2();
|
||||
| ^^^^^^^^^^ call to function with `#[target_feature]`
|
||||
|
|
||||
= note: can only be called if the required target features are available
|
||||
|
||||
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
|
||||
--> $DIR/safe-calls.rs:38:5
|
||||
|
|
||||
LL | Quux.avx_bmi2();
|
||||
| ^^^^^^^^^^^^^^^ call to function with `#[target_feature]`
|
||||
|
|
||||
= note: can only be called if the required target features are available
|
||||
|
||||
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
|
||||
--> $DIR/safe-calls.rs:42:5
|
||||
--> $DIR/safe-calls.rs:44:5
|
||||
|
|
||||
LL | sse2();
|
||||
| ^^^^^^ call to function with `#[target_feature]`
|
||||
|
|
@ -71,7 +71,7 @@ LL | sse2();
|
|||
= note: can only be called if the required target features are available
|
||||
|
||||
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
|
||||
--> $DIR/safe-calls.rs:45:18
|
||||
--> $DIR/safe-calls.rs:47:18
|
||||
|
|
||||
LL | const name: () = sse2();
|
||||
| ^^^^^^ call to function with `#[target_feature]`
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
// revisions: mir thir
|
||||
// [thir]compile-flags: -Z thir-unsafeck
|
||||
// only-x86_64
|
||||
|
||||
#![feature(target_feature_11)]
|
||||
|
|
|
|||
|
|
@ -0,0 +1,83 @@
|
|||
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
|
||||
--> $DIR/safe-calls.rs:23:5
|
||||
|
|
||||
LL | sse2();
|
||||
| ^^^^^^ call to function with `#[target_feature]`
|
||||
|
|
||||
= note: can only be called if the required target features are available
|
||||
|
||||
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
|
||||
--> $DIR/safe-calls.rs:24:5
|
||||
|
|
||||
LL | avx_bmi2();
|
||||
| ^^^^^^^^^^ call to function with `#[target_feature]`
|
||||
|
|
||||
= note: can only be called if the required target features are available
|
||||
|
||||
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
|
||||
--> $DIR/safe-calls.rs:25:5
|
||||
|
|
||||
LL | Quux.avx_bmi2();
|
||||
| ^^^^^^^^^^^^^^^ call to function with `#[target_feature]`
|
||||
|
|
||||
= note: can only be called if the required target features are available
|
||||
|
||||
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
|
||||
--> $DIR/safe-calls.rs:30:5
|
||||
|
|
||||
LL | avx_bmi2();
|
||||
| ^^^^^^^^^^ call to function with `#[target_feature]`
|
||||
|
|
||||
= note: can only be called if the required target features are available
|
||||
|
||||
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
|
||||
--> $DIR/safe-calls.rs:31:5
|
||||
|
|
||||
LL | Quux.avx_bmi2();
|
||||
| ^^^^^^^^^^^^^^^ call to function with `#[target_feature]`
|
||||
|
|
||||
= note: can only be called if the required target features are available
|
||||
|
||||
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
|
||||
--> $DIR/safe-calls.rs:36:5
|
||||
|
|
||||
LL | sse2();
|
||||
| ^^^^^^ call to function with `#[target_feature]`
|
||||
|
|
||||
= note: can only be called if the required target features are available
|
||||
|
||||
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
|
||||
--> $DIR/safe-calls.rs:37:5
|
||||
|
|
||||
LL | avx_bmi2();
|
||||
| ^^^^^^^^^^ call to function with `#[target_feature]`
|
||||
|
|
||||
= note: can only be called if the required target features are available
|
||||
|
||||
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
|
||||
--> $DIR/safe-calls.rs:38:5
|
||||
|
|
||||
LL | Quux.avx_bmi2();
|
||||
| ^^^^^^^^^^^^^^^ call to function with `#[target_feature]`
|
||||
|
|
||||
= note: can only be called if the required target features are available
|
||||
|
||||
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
|
||||
--> $DIR/safe-calls.rs:44:5
|
||||
|
|
||||
LL | sse2();
|
||||
| ^^^^^^ call to function with `#[target_feature]`
|
||||
|
|
||||
= note: can only be called if the required target features are available
|
||||
|
||||
error[E0133]: call to function with `#[target_feature]` is unsafe and requires unsafe function or block
|
||||
--> $DIR/safe-calls.rs:47:18
|
||||
|
|
||||
LL | const name: () = sse2();
|
||||
| ^^^^^^ call to function with `#[target_feature]`
|
||||
|
|
||||
= note: can only be called if the required target features are available
|
||||
|
||||
error: aborting due to 10 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0133`.
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0133]: use of mutable static is unsafe and requires unsafe function or block
|
||||
--> $DIR/safe-extern-statics-mut.rs:11:13
|
||||
--> $DIR/safe-extern-statics-mut.rs:13:13
|
||||
|
|
||||
LL | let b = B;
|
||||
| ^ 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
|
||||
|
||||
error[E0133]: use of mutable static is unsafe and requires unsafe function or block
|
||||
--> $DIR/safe-extern-statics-mut.rs:12:14
|
||||
--> $DIR/safe-extern-statics-mut.rs:14:14
|
||||
|
|
||||
LL | let rb = &B;
|
||||
| ^^ 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
|
||||
|
||||
error[E0133]: use of mutable static is unsafe and requires unsafe function or block
|
||||
--> $DIR/safe-extern-statics-mut.rs:13:14
|
||||
--> $DIR/safe-extern-statics-mut.rs:15:14
|
||||
|
|
||||
LL | let xb = XB;
|
||||
| ^^ 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
|
||||
|
||||
error[E0133]: use of mutable static is unsafe and requires unsafe function or block
|
||||
--> $DIR/safe-extern-statics-mut.rs:14:15
|
||||
--> $DIR/safe-extern-statics-mut.rs:16:15
|
||||
|
|
||||
LL | let xrb = &XB;
|
||||
| ^^^ use of mutable static
|
||||
|
|
@ -1,4 +1,6 @@
|
|||
// aux-build:extern-statics.rs
|
||||
// revisions: mir thir
|
||||
// [thir]compile-flags: -Z thir-unsafeck
|
||||
|
||||
extern crate extern_statics;
|
||||
use extern_statics::*;
|
||||
|
|
|
|||
35
src/test/ui/safe-extern-statics-mut.thir.stderr
Normal file
35
src/test/ui/safe-extern-statics-mut.thir.stderr
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
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`.
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0133]: use of extern static is unsafe and requires unsafe function or block
|
||||
--> $DIR/safe-extern-statics.rs:11:13
|
||||
--> $DIR/safe-extern-statics.rs:13:13
|
||||
|
|
||||
LL | let a = A;
|
||||
| ^ 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
|
||||
|
||||
error[E0133]: use of extern static is unsafe and requires unsafe function or block
|
||||
--> $DIR/safe-extern-statics.rs:12:14
|
||||
--> $DIR/safe-extern-statics.rs:14:14
|
||||
|
|
||||
LL | let ra = &A;
|
||||
| ^^ 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
|
||||
|
||||
error[E0133]: use of extern static is unsafe and requires unsafe function or block
|
||||
--> $DIR/safe-extern-statics.rs:13:14
|
||||
--> $DIR/safe-extern-statics.rs:15:14
|
||||
|
|
||||
LL | let xa = XA;
|
||||
| ^^ 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
|
||||
|
||||
error[E0133]: use of extern static is unsafe and requires unsafe function or block
|
||||
--> $DIR/safe-extern-statics.rs:14:15
|
||||
--> $DIR/safe-extern-statics.rs:16:15
|
||||
|
|
||||
LL | let xra = &XA;
|
||||
| ^^^ use of extern static
|
||||
|
|
@ -1,4 +1,6 @@
|
|||
// aux-build:extern-statics.rs
|
||||
// revisions: mir thir
|
||||
// [thir]compile-flags: -Z thir-unsafeck
|
||||
|
||||
extern crate extern_statics;
|
||||
use extern_statics::*;
|
||||
|
|
|
|||
35
src/test/ui/safe-extern-statics.thir.stderr
Normal file
35
src/test/ui/safe-extern-statics.thir.stderr
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
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`.
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0133]: use of mutable static is unsafe and requires unsafe function or block
|
||||
--> $DIR/static-mut-foreign-requires-unsafe.rs:6:5
|
||||
--> $DIR/static-mut-foreign-requires-unsafe.rs:9:5
|
||||
|
|
||||
LL | a += 3;
|
||||
| ^^^^^^ 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
|
||||
|
||||
error[E0133]: use of mutable static is unsafe and requires unsafe function or block
|
||||
--> $DIR/static-mut-foreign-requires-unsafe.rs:7:5
|
||||
--> $DIR/static-mut-foreign-requires-unsafe.rs:10:5
|
||||
|
|
||||
LL | a = 4;
|
||||
| ^^^^^ 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
|
||||
|
||||
error[E0133]: use of mutable static is unsafe and requires unsafe function or block
|
||||
--> $DIR/static-mut-foreign-requires-unsafe.rs:8:14
|
||||
--> $DIR/static-mut-foreign-requires-unsafe.rs:11:14
|
||||
|
|
||||
LL | let _b = a;
|
||||
| ^ use of mutable static
|
||||
|
|
@ -1,3 +1,6 @@
|
|||
// revisions: mir thir
|
||||
// [thir]compile-flags: -Z thir-unsafeck
|
||||
|
||||
extern "C" {
|
||||
static mut a: i32;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,27 @@
|
|||
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`.
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0133]: use of mutable static is unsafe and requires unsafe function or block
|
||||
--> $DIR/static-mut-requires-unsafe.rs:4:5
|
||||
--> $DIR/static-mut-requires-unsafe.rs:7:5
|
||||
|
|
||||
LL | a += 3;
|
||||
| ^^^^^^ 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
|
||||
|
||||
error[E0133]: use of mutable static is unsafe and requires unsafe function or block
|
||||
--> $DIR/static-mut-requires-unsafe.rs:5:5
|
||||
--> $DIR/static-mut-requires-unsafe.rs:8:5
|
||||
|
|
||||
LL | a = 4;
|
||||
| ^^^^^ 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
|
||||
|
||||
error[E0133]: use of mutable static is unsafe and requires unsafe function or block
|
||||
--> $DIR/static-mut-requires-unsafe.rs:6:14
|
||||
--> $DIR/static-mut-requires-unsafe.rs:9:14
|
||||
|
|
||||
LL | let _b = a;
|
||||
| ^ use of mutable static
|
||||
|
|
@ -1,3 +1,6 @@
|
|||
// revisions: mir thir
|
||||
// [thir]compile-flags: -Z thir-unsafeck
|
||||
|
||||
static mut a: isize = 3;
|
||||
|
||||
fn main() {
|
||||
|
|
|
|||
27
src/test/ui/static/static-mut-requires-unsafe.thir.stderr
Normal file
27
src/test/ui/static/static-mut-requires-unsafe.thir.stderr
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
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`.
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block
|
||||
--> $DIR/safety-fn-body.rs:11:9
|
||||
--> $DIR/safety-fn-body.rs:14:9
|
||||
|
|
||||
LL | *self += 1;
|
||||
| ^^^^^^^^^^ dereference of raw pointer
|
||||
|
|
@ -1,6 +1,9 @@
|
|||
// Check that an unsafe impl does not imply that unsafe actions are
|
||||
// legal in the methods.
|
||||
|
||||
// revisions: mir thir
|
||||
// [thir]compile-flags: -Z thir-unsafeck
|
||||
|
||||
unsafe trait UnsafeTrait : Sized {
|
||||
fn foo(self) { }
|
||||
}
|
||||
|
|
|
|||
11
src/test/ui/traits/safety-fn-body.thir.stderr
Normal file
11
src/test/ui/traits/safety-fn-body.thir.stderr
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block
|
||||
--> $DIR/safety-fn-body.rs:14:9
|
||||
|
|
||||
LL | *self += 1;
|
||||
| ^^^^^ 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 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0133`.
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block
|
||||
--> $DIR/issue-45087-unreachable-unsafe.rs:3:5
|
||||
--> $DIR/issue-45087-unreachable-unsafe.rs:6:5
|
||||
|
|
||||
LL | *(1 as *mut u32) = 42;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ dereference of raw pointer
|
||||
|
|
@ -1,3 +1,6 @@
|
|||
// revisions: mir thir
|
||||
// [thir]compile-flags: -Z thir-unsafeck
|
||||
|
||||
fn main() {
|
||||
return;
|
||||
*(1 as *mut u32) = 42;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,11 @@
|
|||
error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block
|
||||
--> $DIR/issue-45087-unreachable-unsafe.rs:6:5
|
||||
|
|
||||
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 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0133`.
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0133]: initializing type with `rustc_layout_scalar_valid_range` attr is unsafe and requires unsafe function or block
|
||||
--> $DIR/ranged_ints.rs:7:14
|
||||
--> $DIR/ranged_ints.rs:10:14
|
||||
|
|
||||
LL | let _x = NonZero(0);
|
||||
| ^^^^^^^^^^ initializing type with `rustc_layout_scalar_valid_range` attr
|
||||
|
|
@ -1,3 +1,6 @@
|
|||
// revisions: mir thir
|
||||
// [thir]compile-flags: -Z thir-unsafeck
|
||||
|
||||
#![feature(rustc_attrs)]
|
||||
|
||||
#[rustc_layout_scalar_valid_range_start(1)]
|
||||
|
|
|
|||
11
src/test/ui/unsafe/ranged_ints.thir.stderr
Normal file
11
src/test/ui/unsafe/ranged_ints.thir.stderr
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
error[E0133]: initializing type with `rustc_layout_scalar_valid_range` attr is unsafe and requires unsafe function or block
|
||||
--> $DIR/ranged_ints.rs:10:14
|
||||
|
|
||||
LL | let _x = NonZero(0);
|
||||
| ^^^^^^^^^^ initializing type with `rustc_layout_scalar_valid_range` attr
|
||||
|
|
||||
= note: initializing a layout restricted type's field with a value outside the valid range is undefined behavior
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0133`.
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0133]: initializing type with `rustc_layout_scalar_valid_range` attr is unsafe and requires unsafe function or block
|
||||
--> $DIR/ranged_ints_const.rs:8:34
|
||||
--> $DIR/ranged_ints_const.rs:11:34
|
||||
|
|
||||
LL | const fn foo() -> NonZero<u32> { NonZero(0) }
|
||||
| ^^^^^^^^^^ initializing type with `rustc_layout_scalar_valid_range` attr
|
||||
|
|
@ -1,3 +1,6 @@
|
|||
// revisions: mir thir
|
||||
// [thir]compile-flags: -Z thir-unsafeck
|
||||
|
||||
#![feature(rustc_attrs)]
|
||||
|
||||
#[rustc_layout_scalar_valid_range_start(1)]
|
||||
|
|
|
|||
11
src/test/ui/unsafe/ranged_ints_const.thir.stderr
Normal file
11
src/test/ui/unsafe/ranged_ints_const.thir.stderr
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
error[E0133]: initializing type with `rustc_layout_scalar_valid_range` attr is unsafe and requires unsafe function or block
|
||||
--> $DIR/ranged_ints_const.rs:11:34
|
||||
|
|
||||
LL | const fn foo() -> NonZero<u32> { NonZero(0) }
|
||||
| ^^^^^^^^^^ initializing type with `rustc_layout_scalar_valid_range` attr
|
||||
|
|
||||
= note: initializing a layout restricted type's field with a value outside the valid range is undefined behavior
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0133`.
|
||||
|
|
@ -1,4 +1,7 @@
|
|||
// build-pass
|
||||
// revisions: mir thir
|
||||
// [thir]compile-flags: -Z thir-unsafeck
|
||||
|
||||
#![feature(rustc_attrs)]
|
||||
|
||||
macro_rules! apply {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block
|
||||
--> $DIR/unsafe-fn-assign-deref-ptr.rs:2:5
|
||||
--> $DIR/unsafe-fn-assign-deref-ptr.rs:5:5
|
||||
|
|
||||
LL | *p = 0;
|
||||
| ^^^^^^ dereference of raw pointer
|
||||
|
|
@ -1,3 +1,6 @@
|
|||
// revisions: mir thir
|
||||
// [thir]compile-flags: -Z thir-unsafeck
|
||||
|
||||
fn f(p: *mut u8) {
|
||||
*p = 0; //~ ERROR dereference of raw pointer is unsafe
|
||||
return;
|
||||
|
|
|
|||
11
src/test/ui/unsafe/unsafe-fn-assign-deref-ptr.thir.stderr
Normal file
11
src/test/ui/unsafe/unsafe-fn-assign-deref-ptr.thir.stderr
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block
|
||||
--> $DIR/unsafe-fn-assign-deref-ptr.rs:5:5
|
||||
|
|
||||
LL | *p = 0;
|
||||
| ^^ 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 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0133`.
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block
|
||||
--> $DIR/unsafe-fn-deref-ptr.rs:2:12
|
||||
--> $DIR/unsafe-fn-deref-ptr.rs:5:12
|
||||
|
|
||||
LL | return *p;
|
||||
| ^^ dereference of raw pointer
|
||||
|
|
@ -1,3 +1,6 @@
|
|||
// revisions: mir thir
|
||||
// [thir]compile-flags: -Z thir-unsafeck
|
||||
|
||||
fn f(p: *const u8) -> u8 {
|
||||
return *p; //~ ERROR dereference of raw pointer is unsafe
|
||||
}
|
||||
|
|
|
|||
11
src/test/ui/unsafe/unsafe-fn-deref-ptr.thir.stderr
Normal file
11
src/test/ui/unsafe/unsafe-fn-deref-ptr.thir.stderr
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block
|
||||
--> $DIR/unsafe-fn-deref-ptr.rs:5:12
|
||||
|
|
||||
LL | return *p;
|
||||
| ^^ 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 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0133`.
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block
|
||||
--> $DIR/unsafe-unstable-const-fn.rs:8:5
|
||||
--> $DIR/unsafe-unstable-const-fn.rs:11:5
|
||||
|
|
||||
LL | *a == b
|
||||
| ^^ dereference of raw pointer
|
||||
|
|
@ -1,3 +1,6 @@
|
|||
// revisions: mir thir
|
||||
// [thir]compile-flags: -Z thir-unsafeck
|
||||
|
||||
#![stable(feature = "foo", since = "1.33.0")]
|
||||
#![feature(staged_api)]
|
||||
#![feature(const_raw_ptr_deref)]
|
||||
|
|
|
|||
11
src/test/ui/unsafe/unsafe-unstable-const-fn.thir.stderr
Normal file
11
src/test/ui/unsafe/unsafe-unstable-const-fn.thir.stderr
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block
|
||||
--> $DIR/unsafe-unstable-const-fn.rs:11:5
|
||||
|
|
||||
LL | *a == b
|
||||
| ^^ 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 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0133`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue