diff options
| author | Emil Gardström <emil.gardstrom@gmail.com> | 2022-04-24 14:08:23 +0200 |
|---|---|---|
| committer | Emil Gardström <emil.gardstrom@gmail.com> | 2022-04-24 18:33:06 +0200 |
| commit | 8b8f6653cfd54525714f02efe7af0a0f830e185c (patch) | |
| tree | 08350f3a61cde865ec0fa0ca084b874e88a389f3 /src/test/ui/consts | |
| parent | d8e59edbfa47ff38e23e6dedab6bedd3b41895e0 (diff) | |
| download | rust-8b8f6653cfd54525714f02efe7af0a0f830e185c.tar.gz rust-8b8f6653cfd54525714f02efe7af0a0f830e185c.zip | |
add `DefId` to unsafety violations and display function path in E0133
this enables consumers to access the function definition that was reported to be unsafe
Diffstat (limited to 'src/test/ui/consts')
3 files changed, 8 insertions, 8 deletions
diff --git a/src/test/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.mir.stderr b/src/test/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.mir.stderr index 33014a1500c..bedb934ab1c 100644 --- a/src/test/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.mir.stderr +++ b/src/test/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.mir.stderr @@ -1,16 +1,16 @@ -error[E0133]: call to unsafe function is unsafe and requires unsafe function or block +error[E0133]: call to unsafe function `foo` is unsafe and requires unsafe function or block --> $DIR/const-extern-fn-requires-unsafe.rs:9:17 | LL | let a: [u8; foo()]; - | ^^^^^ call to unsafe function + | ^^^^^ call to unsafe function `foo` | = 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 `foo` is unsafe and requires unsafe function or block --> $DIR/const-extern-fn-requires-unsafe.rs:11:5 | LL | foo(); - | ^^^^^ call to unsafe function + | ^^^^^ call to unsafe function `foo` | = note: consult the function's documentation for information on how to avoid undefined behavior diff --git a/src/test/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.rs b/src/test/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.rs index 031e67a1e3c..b4cf729703a 100644 --- a/src/test/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.rs +++ b/src/test/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.rs @@ -7,7 +7,7 @@ const unsafe extern "C" fn foo() -> usize { 5 } fn main() { let a: [u8; foo()]; - //~^ ERROR call to unsafe function is unsafe and requires unsafe function or block + //~^ ERROR call to unsafe function `foo` is unsafe and requires unsafe function or block foo(); - //[mir]~^ ERROR call to unsafe function is unsafe and requires unsafe function or block + //[mir]~^ ERROR call to unsafe function `foo` is unsafe and requires unsafe function or block } diff --git a/src/test/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.thir.stderr b/src/test/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.thir.stderr index c6077da768b..f5361f355e1 100644 --- a/src/test/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.thir.stderr +++ b/src/test/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.thir.stderr @@ -1,8 +1,8 @@ -error[E0133]: call to unsafe function is unsafe and requires unsafe function or block +error[E0133]: call to unsafe function `foo` is unsafe and requires unsafe function or block --> $DIR/const-extern-fn-requires-unsafe.rs:9:17 | LL | let a: [u8; foo()]; - | ^^^^^ call to unsafe function + | ^^^^^ call to unsafe function `foo` | = note: consult the function's documentation for information on how to avoid undefined behavior |
