Don't assume paths work with fn_sig in multiple_unsafe_ops_pre_block.
This commit is contained in:
parent
3d193fa17a
commit
002e934189
3 changed files with 99 additions and 28 deletions
|
|
@ -116,4 +116,32 @@ fn issue10259() {
|
|||
unsafe_macro!();
|
||||
}
|
||||
|
||||
fn _fn_ptr(x: unsafe fn()) {
|
||||
unsafe {
|
||||
x();
|
||||
x();
|
||||
}
|
||||
}
|
||||
|
||||
fn _assoc_const() {
|
||||
trait X {
|
||||
const X: unsafe fn();
|
||||
}
|
||||
fn _f<T: X>() {
|
||||
unsafe {
|
||||
T::X();
|
||||
T::X();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn _field_fn_ptr(x: unsafe fn()) {
|
||||
struct X(unsafe fn());
|
||||
let x = X(x);
|
||||
unsafe {
|
||||
x.0();
|
||||
x.0();
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -125,5 +125,65 @@ note: raw pointer dereference occurs here
|
|||
LL | unsafe { char::from_u32_unchecked(*ptr.cast::<u32>()) }
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
error: this `unsafe` block contains 2 unsafe operations, expected only one
|
||||
--> $DIR/multiple_unsafe_ops_per_block.rs:120:5
|
||||
|
|
||||
LL | / unsafe {
|
||||
LL | | x();
|
||||
LL | | x();
|
||||
LL | | }
|
||||
| |_____^
|
||||
|
|
||||
note: unsafe function call occurs here
|
||||
--> $DIR/multiple_unsafe_ops_per_block.rs:121:9
|
||||
|
|
||||
LL | x();
|
||||
| ^^^
|
||||
note: unsafe function call occurs here
|
||||
--> $DIR/multiple_unsafe_ops_per_block.rs:122:9
|
||||
|
|
||||
LL | x();
|
||||
| ^^^
|
||||
|
||||
error: this `unsafe` block contains 2 unsafe operations, expected only one
|
||||
--> $DIR/multiple_unsafe_ops_per_block.rs:131:9
|
||||
|
|
||||
LL | / unsafe {
|
||||
LL | | T::X();
|
||||
LL | | T::X();
|
||||
LL | | }
|
||||
| |_________^
|
||||
|
|
||||
note: unsafe function call occurs here
|
||||
--> $DIR/multiple_unsafe_ops_per_block.rs:132:13
|
||||
|
|
||||
LL | T::X();
|
||||
| ^^^^^^
|
||||
note: unsafe function call occurs here
|
||||
--> $DIR/multiple_unsafe_ops_per_block.rs:133:13
|
||||
|
|
||||
LL | T::X();
|
||||
| ^^^^^^
|
||||
|
||||
error: this `unsafe` block contains 2 unsafe operations, expected only one
|
||||
--> $DIR/multiple_unsafe_ops_per_block.rs:141:5
|
||||
|
|
||||
LL | / unsafe {
|
||||
LL | | x.0();
|
||||
LL | | x.0();
|
||||
LL | | }
|
||||
| |_____^
|
||||
|
|
||||
note: unsafe function call occurs here
|
||||
--> $DIR/multiple_unsafe_ops_per_block.rs:142:9
|
||||
|
|
||||
LL | x.0();
|
||||
| ^^^^^
|
||||
note: unsafe function call occurs here
|
||||
--> $DIR/multiple_unsafe_ops_per_block.rs:143:9
|
||||
|
|
||||
LL | x.0();
|
||||
| ^^^^^
|
||||
|
||||
error: aborting due to 8 previous errors
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue