diff --git a/compiler/rustc_middle/src/mir/query.rs b/compiler/rustc_middle/src/mir/query.rs index a37091ed3631..e1e63dd48ba2 100644 --- a/compiler/rustc_middle/src/mir/query.rs +++ b/compiler/rustc_middle/src/mir/query.rs @@ -44,6 +44,27 @@ pub enum UnsafetyViolationDetails { } impl UnsafetyViolationDetails { + pub fn simple_description(&self) -> &'static str { + use UnsafetyViolationDetails::*; + + match self { + CallToUnsafeFunction(..) => "call to unsafe function", + UseOfInlineAssembly => "use of inline assembly", + InitializingTypeWith => "initializing type with `rustc_layout_scalar_valid_range` attr", + CastOfPointerToInt => "cast of pointer to int", + UseOfMutableStatic => "use of mutable static", + UseOfExternStatic => "use of extern static", + DerefOfRawPointer => "dereference of raw pointer", + AssignToDroppingUnionField => "assignment to union field that might need dropping", + AccessToUnionField => "access to union field", + MutationOfLayoutConstrainedField => "mutation of layout constrained field", + BorrowOfLayoutConstrainedField => { + "borrow of layout constrained field with interior mutability" + } + CallToFunctionWith(..) => "call to function with `#[target_feature]`", + } + } + pub fn description_and_note(&self, tcx: TyCtxt<'_>) -> (Cow<'static, str>, &'static str) { use UnsafetyViolationDetails::*; match self { @@ -51,55 +72,55 @@ impl UnsafetyViolationDetails { if let Some(did) = did { Cow::from(format!("call to unsafe function `{}`", tcx.def_path_str(*did))) } else { - Cow::Borrowed("call to unsafe function") + Cow::Borrowed(self.simple_description()) }, "consult the function's documentation for information on how to avoid undefined \ behavior", ), UseOfInlineAssembly => ( - Cow::Borrowed("use of inline assembly"), + Cow::Borrowed(self.simple_description()), "inline assembly is entirely unchecked and can cause undefined behavior", ), InitializingTypeWith => ( - Cow::Borrowed("initializing type with `rustc_layout_scalar_valid_range` attr"), + Cow::Borrowed(self.simple_description()), "initializing a layout restricted type's field with a value outside the valid \ range is undefined behavior", ), CastOfPointerToInt => ( - Cow::Borrowed("cast of pointer to int"), + Cow::Borrowed(self.simple_description()), "casting pointers to integers in constants", ), UseOfMutableStatic => ( - Cow::Borrowed("use of mutable static"), + Cow::Borrowed(self.simple_description()), "mutable statics can be mutated by multiple threads: aliasing violations or data \ races will cause undefined behavior", ), UseOfExternStatic => ( - Cow::Borrowed("use of extern static"), + Cow::Borrowed(self.simple_description()), "extern statics are not controlled by the Rust type system: invalid data, \ aliasing violations or data races will cause undefined behavior", ), DerefOfRawPointer => ( - Cow::Borrowed("dereference of raw pointer"), + Cow::Borrowed(self.simple_description()), "raw pointers may be null, dangling or unaligned; they can violate aliasing rules \ and cause data races: all of these are undefined behavior", ), AssignToDroppingUnionField => ( - Cow::Borrowed("assignment to union field that might need dropping"), + Cow::Borrowed(self.simple_description()), "the previous content of the field will be dropped, which causes undefined \ behavior if the field was not properly initialized", ), AccessToUnionField => ( - Cow::Borrowed("access to union field"), + Cow::Borrowed(self.simple_description()), "the field may not be properly initialized: using uninitialized data will cause \ undefined behavior", ), MutationOfLayoutConstrainedField => ( - Cow::Borrowed("mutation of layout constrained field"), + Cow::Borrowed(self.simple_description()), "mutating layout constrained fields cannot statically be checked for valid values", ), BorrowOfLayoutConstrainedField => ( - Cow::Borrowed("borrow of layout constrained field with interior mutability"), + Cow::Borrowed(self.simple_description()), "references to fields of layout constrained fields lose the constraints. Coupled \ with interior mutability, the field can be changed to invalid values", ), diff --git a/compiler/rustc_mir_build/src/check_unsafety.rs b/compiler/rustc_mir_build/src/check_unsafety.rs index 5e5a728a04a0..a841cce23dee 100644 --- a/compiler/rustc_mir_build/src/check_unsafety.rs +++ b/compiler/rustc_mir_build/src/check_unsafety.rs @@ -93,7 +93,7 @@ impl<'tcx> UnsafetyVisitor<'_, 'tcx> { "{} is unsafe and requires unsafe block (error E0133)", description, )) - .span_label(span, description) + .span_label(span, kind.simple_description()) .note(note) .emit(); }, @@ -110,7 +110,7 @@ impl<'tcx> UnsafetyVisitor<'_, 'tcx> { description, fn_sugg, ) - .span_label(span, description) + .span_label(span, kind.simple_description()) .note(note) .emit(); } @@ -546,57 +546,75 @@ enum UnsafeOpKind { use UnsafeOpKind::*; impl UnsafeOpKind { + pub fn simple_description(&self) -> &'static str { + match self { + CallToUnsafeFunction(..) => "call to unsafe function", + UseOfInlineAssembly => "use of inline assembly", + InitializingTypeWith => "initializing type with `rustc_layout_scalar_valid_range` attr", + UseOfMutableStatic => "use of mutable static", + UseOfExternStatic => "use of extern static", + DerefOfRawPointer => "dereference of raw pointer", + AssignToDroppingUnionField => "assignment to union field that might need dropping", + AccessToUnionField => "access to union field", + MutationOfLayoutConstrainedField => "mutation of layout constrained field", + BorrowOfLayoutConstrainedField => { + "borrow of layout constrained field with interior mutability" + } + CallToFunctionWith(..) => "call to function with `#[target_feature]`", + } + } + pub fn description_and_note(&self, tcx: TyCtxt<'_>) -> (Cow<'static, str>, &'static str) { match self { CallToUnsafeFunction(did) => ( if let Some(did) = did { Cow::from(format!("call to unsafe function `{}`", tcx.def_path_str(*did))) } else { - Cow::Borrowed("call to unsafe function") + Cow::Borrowed(self.simple_description()) }, "consult the function's documentation for information on how to avoid undefined \ behavior", ), UseOfInlineAssembly => ( - Cow::Borrowed("use of inline assembly"), + Cow::Borrowed(self.simple_description()), "inline assembly is entirely unchecked and can cause undefined behavior", ), InitializingTypeWith => ( - Cow::Borrowed("initializing type with `rustc_layout_scalar_valid_range` attr"), + Cow::Borrowed(self.simple_description()), "initializing a layout restricted type's field with a value outside the valid \ range is undefined behavior", ), UseOfMutableStatic => ( - Cow::Borrowed("use of mutable static"), + Cow::Borrowed(self.simple_description()), "mutable statics can be mutated by multiple threads: aliasing violations or data \ races will cause undefined behavior", ), UseOfExternStatic => ( - Cow::Borrowed("use of extern static"), + Cow::Borrowed(self.simple_description()), "extern statics are not controlled by the Rust type system: invalid data, \ aliasing violations or data races will cause undefined behavior", ), DerefOfRawPointer => ( - Cow::Borrowed("dereference of raw pointer"), + Cow::Borrowed(self.simple_description()), "raw pointers may be null, dangling or unaligned; they can violate aliasing rules \ and cause data races: all of these are undefined behavior", ), AssignToDroppingUnionField => ( - Cow::Borrowed("assignment to union field that might need dropping"), + Cow::Borrowed(self.simple_description()), "the previous content of the field will be dropped, which causes undefined \ behavior if the field was not properly initialized", ), AccessToUnionField => ( - Cow::Borrowed("access to union field"), + Cow::Borrowed(self.simple_description()), "the field may not be properly initialized: using uninitialized data will cause \ undefined behavior", ), MutationOfLayoutConstrainedField => ( - Cow::Borrowed("mutation of layout constrained field"), + Cow::Borrowed(self.simple_description()), "mutating layout constrained fields cannot statically be checked for valid values", ), BorrowOfLayoutConstrainedField => ( - Cow::Borrowed("borrow of layout constrained field with interior mutability"), + Cow::Borrowed(self.simple_description()), "references to fields of layout constrained fields lose the constraints. Coupled \ with interior mutability, the field can be changed to invalid values", ), diff --git a/compiler/rustc_mir_transform/src/check_unsafety.rs b/compiler/rustc_mir_transform/src/check_unsafety.rs index 33b83d90e0f6..34093eb29eb5 100644 --- a/compiler/rustc_mir_transform/src/check_unsafety.rs +++ b/compiler/rustc_mir_transform/src/check_unsafety.rs @@ -598,7 +598,7 @@ pub fn check_unsafety(tcx: TyCtxt<'_>, def_id: LocalDefId) { description, unsafe_fn_msg, ) - .span_label(source_info.span, description) + .span_label(source_info.span, details.simple_description()) .note(note) .emit(); } diff --git a/src/test/ui/async-await/async-unsafe-fn-call-in-safe.mir.stderr b/src/test/ui/async-await/async-unsafe-fn-call-in-safe.mir.stderr index b094aa198e89..a12839539227 100644 --- a/src/test/ui/async-await/async-unsafe-fn-call-in-safe.mir.stderr +++ b/src/test/ui/async-await/async-unsafe-fn-call-in-safe.mir.stderr @@ -2,7 +2,7 @@ error[E0133]: call to unsafe function `S::f` is unsafe and requires unsafe funct --> $DIR/async-unsafe-fn-call-in-safe.rs:14:5 | LL | S::f(); - | ^^^^^^ call to unsafe function `S::f` + | ^^^^^^ call to unsafe function | = note: consult the function's documentation for information on how to avoid undefined behavior @@ -10,7 +10,7 @@ error[E0133]: call to unsafe function `f` is unsafe and requires unsafe function --> $DIR/async-unsafe-fn-call-in-safe.rs:15:5 | LL | f(); - | ^^^ call to unsafe function `f` + | ^^^ call to unsafe function | = note: consult the function's documentation for information on how to avoid undefined behavior @@ -18,7 +18,7 @@ error[E0133]: call to unsafe function `S::f` is unsafe and requires unsafe funct --> $DIR/async-unsafe-fn-call-in-safe.rs:19:5 | LL | S::f(); - | ^^^^^^ call to unsafe function `S::f` + | ^^^^^^ call to unsafe function | = note: consult the function's documentation for information on how to avoid undefined behavior @@ -26,7 +26,7 @@ error[E0133]: call to unsafe function `f` is unsafe and requires unsafe function --> $DIR/async-unsafe-fn-call-in-safe.rs:20:5 | LL | f(); - | ^^^ call to unsafe function `f` + | ^^^ call to unsafe function | = note: consult the function's documentation for information on how to avoid undefined behavior diff --git a/src/test/ui/async-await/async-unsafe-fn-call-in-safe.thir.stderr b/src/test/ui/async-await/async-unsafe-fn-call-in-safe.thir.stderr index 3d57ca5f55ef..9de23a8fada2 100644 --- a/src/test/ui/async-await/async-unsafe-fn-call-in-safe.thir.stderr +++ b/src/test/ui/async-await/async-unsafe-fn-call-in-safe.thir.stderr @@ -2,7 +2,7 @@ error[E0133]: call to unsafe function `S::f` is unsafe and requires unsafe funct --> $DIR/async-unsafe-fn-call-in-safe.rs:14:5 | LL | S::f(); - | ^^^^^^ call to unsafe function `S::f` + | ^^^^^^ call to unsafe function | = note: consult the function's documentation for information on how to avoid undefined behavior @@ -10,7 +10,7 @@ error[E0133]: call to unsafe function `f` is unsafe and requires unsafe function --> $DIR/async-unsafe-fn-call-in-safe.rs:15:5 | LL | f(); - | ^^^ call to unsafe function `f` + | ^^^ call to unsafe function | = note: consult the function's documentation for information on how to avoid undefined behavior diff --git a/src/test/ui/closures/coerce-unsafe-closure-to-unsafe-fn-ptr.mir.stderr b/src/test/ui/closures/coerce-unsafe-closure-to-unsafe-fn-ptr.mir.stderr index 9a43711a4f03..c6d2c2d466af 100644 --- a/src/test/ui/closures/coerce-unsafe-closure-to-unsafe-fn-ptr.mir.stderr +++ b/src/test/ui/closures/coerce-unsafe-closure-to-unsafe-fn-ptr.mir.stderr @@ -2,7 +2,7 @@ error[E0133]: call to unsafe function `std::pin::Pin::
::new_unchecked` is uns --> $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 `std::pin::Pin::
::new_unchecked` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function | = note: consult the function's documentation for information on how to avoid undefined behavior diff --git a/src/test/ui/closures/coerce-unsafe-closure-to-unsafe-fn-ptr.thir.stderr b/src/test/ui/closures/coerce-unsafe-closure-to-unsafe-fn-ptr.thir.stderr index 9405f6a8e9ec..8c516e8900c2 100644 --- a/src/test/ui/closures/coerce-unsafe-closure-to-unsafe-fn-ptr.thir.stderr +++ b/src/test/ui/closures/coerce-unsafe-closure-to-unsafe-fn-ptr.thir.stderr @@ -2,7 +2,7 @@ error[E0133]: call to unsafe function `Pin::
::new_unchecked` is unsafe and re --> $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 `Pin::
::new_unchecked`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
|
= 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.mir.stderr b/src/test/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.mir.stderr
index bedb934ab1cb..ad73058e1afa 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
@@ -2,7 +2,7 @@ error[E0133]: call to unsafe function `foo` is unsafe and requires unsafe functi
--> $DIR/const-extern-fn-requires-unsafe.rs:9:17
|
LL | let a: [u8; foo()];
- | ^^^^^ call to unsafe function `foo`
+ | ^^^^^ call to unsafe function
|
= note: consult the function's documentation for information on how to avoid undefined behavior
@@ -10,7 +10,7 @@ error[E0133]: call to unsafe function `foo` is unsafe and requires unsafe functi
--> $DIR/const-extern-fn-requires-unsafe.rs:11:5
|
LL | foo();
- | ^^^^^ call to unsafe function `foo`
+ | ^^^^^ call to unsafe function
|
= 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.thir.stderr b/src/test/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.thir.stderr
index f5361f355e10..b313f06539ff 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
@@ -2,7 +2,7 @@ error[E0133]: call to unsafe function `foo` is unsafe and requires unsafe functi
--> $DIR/const-extern-fn-requires-unsafe.rs:9:17
|
LL | let a: [u8; foo()];
- | ^^^^^ call to unsafe function `foo`
+ | ^^^^^ call to unsafe function
|
= note: consult the function's documentation for information on how to avoid undefined behavior
diff --git a/src/test/ui/error-codes/E0133.mir.stderr b/src/test/ui/error-codes/E0133.mir.stderr
index 7d6dc0c7f09e..f1d7aba2aa3b 100644
--- a/src/test/ui/error-codes/E0133.mir.stderr
+++ b/src/test/ui/error-codes/E0133.mir.stderr
@@ -2,7 +2,7 @@ error[E0133]: call to unsafe function `f` is unsafe and requires unsafe function
--> $DIR/E0133.rs:7:5
|
LL | f();
- | ^^^ call to unsafe function `f`
+ | ^^^ call to unsafe function
|
= note: consult the function's documentation for information on how to avoid undefined behavior
diff --git a/src/test/ui/error-codes/E0133.thir.stderr b/src/test/ui/error-codes/E0133.thir.stderr
index 7d6dc0c7f09e..f1d7aba2aa3b 100644
--- a/src/test/ui/error-codes/E0133.thir.stderr
+++ b/src/test/ui/error-codes/E0133.thir.stderr
@@ -2,7 +2,7 @@ error[E0133]: call to unsafe function `f` is unsafe and requires unsafe function
--> $DIR/E0133.rs:7:5
|
LL | f();
- | ^^^ call to unsafe function `f`
+ | ^^^ call to unsafe function
|
= note: consult the function's documentation for information on how to avoid undefined behavior
diff --git a/src/test/ui/foreign-unsafe-fn-called.mir.stderr b/src/test/ui/foreign-unsafe-fn-called.mir.stderr
index cb5252361d33..00ba0f7a6a3e 100644
--- a/src/test/ui/foreign-unsafe-fn-called.mir.stderr
+++ b/src/test/ui/foreign-unsafe-fn-called.mir.stderr
@@ -2,7 +2,7 @@ error[E0133]: call to unsafe function `test::free` is unsafe and requires unsafe
--> $DIR/foreign-unsafe-fn-called.rs:11:5
|
LL | test::free();
- | ^^^^^^^^^^^^ call to unsafe function `test::free`
+ | ^^^^^^^^^^^^ call to unsafe function
|
= note: consult the function's documentation for information on how to avoid undefined behavior
diff --git a/src/test/ui/foreign-unsafe-fn-called.thir.stderr b/src/test/ui/foreign-unsafe-fn-called.thir.stderr
index cb5252361d33..00ba0f7a6a3e 100644
--- a/src/test/ui/foreign-unsafe-fn-called.thir.stderr
+++ b/src/test/ui/foreign-unsafe-fn-called.thir.stderr
@@ -2,7 +2,7 @@ error[E0133]: call to unsafe function `test::free` is unsafe and requires unsafe
--> $DIR/foreign-unsafe-fn-called.rs:11:5
|
LL | test::free();
- | ^^^^^^^^^^^^ call to unsafe function `test::free`
+ | ^^^^^^^^^^^^ call to unsafe function
|
= note: consult the function's documentation for information on how to avoid undefined behavior
diff --git a/src/test/ui/intrinsics/unchecked_math_unsafe.mir.stderr b/src/test/ui/intrinsics/unchecked_math_unsafe.mir.stderr
index e67e81cdc4ea..47bc2e1a6e91 100644
--- a/src/test/ui/intrinsics/unchecked_math_unsafe.mir.stderr
+++ b/src/test/ui/intrinsics/unchecked_math_unsafe.mir.stderr
@@ -2,7 +2,7 @@ error[E0133]: call to unsafe function `std::intrinsics::unchecked_add` is unsafe
--> $DIR/unchecked_math_unsafe.rs:8:15
|
LL | let add = std::intrinsics::unchecked_add(x, y);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function `std::intrinsics::unchecked_add`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
|
= note: consult the function's documentation for information on how to avoid undefined behavior
@@ -10,7 +10,7 @@ error[E0133]: call to unsafe function `std::intrinsics::unchecked_sub` is unsafe
--> $DIR/unchecked_math_unsafe.rs:9:15
|
LL | let sub = std::intrinsics::unchecked_sub(x, y);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function `std::intrinsics::unchecked_sub`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
|
= note: consult the function's documentation for information on how to avoid undefined behavior
@@ -18,7 +18,7 @@ error[E0133]: call to unsafe function `std::intrinsics::unchecked_mul` is unsafe
--> $DIR/unchecked_math_unsafe.rs:10:15
|
LL | let mul = std::intrinsics::unchecked_mul(x, y);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function `std::intrinsics::unchecked_mul`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
|
= note: consult the function's documentation for information on how to avoid undefined behavior
diff --git a/src/test/ui/intrinsics/unchecked_math_unsafe.thir.stderr b/src/test/ui/intrinsics/unchecked_math_unsafe.thir.stderr
index 50aaef8694f0..5c3728ccdf84 100644
--- a/src/test/ui/intrinsics/unchecked_math_unsafe.thir.stderr
+++ b/src/test/ui/intrinsics/unchecked_math_unsafe.thir.stderr
@@ -2,7 +2,7 @@ error[E0133]: call to unsafe function `unchecked_add` is unsafe and requires uns
--> $DIR/unchecked_math_unsafe.rs:8:15
|
LL | let add = std::intrinsics::unchecked_add(x, y);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function `unchecked_add`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
|
= note: consult the function's documentation for information on how to avoid undefined behavior
@@ -10,7 +10,7 @@ error[E0133]: call to unsafe function `unchecked_sub` is unsafe and requires uns
--> $DIR/unchecked_math_unsafe.rs:9:15
|
LL | let sub = std::intrinsics::unchecked_sub(x, y);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function `unchecked_sub`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
|
= note: consult the function's documentation for information on how to avoid undefined behavior
@@ -18,7 +18,7 @@ error[E0133]: call to unsafe function `unchecked_mul` is unsafe and requires uns
--> $DIR/unchecked_math_unsafe.rs:10:15
|
LL | let mul = std::intrinsics::unchecked_mul(x, y);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function `unchecked_mul`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
|
= note: consult the function's documentation for information on how to avoid undefined behavior
diff --git a/src/test/ui/issues/issue-28776.mir.stderr b/src/test/ui/issues/issue-28776.mir.stderr
index bb82a0f4c605..e3562810b3aa 100644
--- a/src/test/ui/issues/issue-28776.mir.stderr
+++ b/src/test/ui/issues/issue-28776.mir.stderr
@@ -2,7 +2,7 @@ error[E0133]: call to unsafe function `std::ptr::write` is unsafe and requires u
--> $DIR/issue-28776.rs:7:5
|
LL | (&ptr::write)(1 as *mut _, 42);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function `std::ptr::write`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
|
= note: consult the function's documentation for information on how to avoid undefined behavior
diff --git a/src/test/ui/issues/issue-28776.thir.stderr b/src/test/ui/issues/issue-28776.thir.stderr
index bb82a0f4c605..e3562810b3aa 100644
--- a/src/test/ui/issues/issue-28776.thir.stderr
+++ b/src/test/ui/issues/issue-28776.thir.stderr
@@ -2,7 +2,7 @@ error[E0133]: call to unsafe function `std::ptr::write` is unsafe and requires u
--> $DIR/issue-28776.rs:7:5
|
LL | (&ptr::write)(1 as *mut _, 42);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function `std::ptr::write`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
|
= note: consult the function's documentation for information on how to avoid undefined behavior
diff --git a/src/test/ui/issues/issue-3080.mir.stderr b/src/test/ui/issues/issue-3080.mir.stderr
index b1401b9d3935..4d8acac61d9e 100644
--- a/src/test/ui/issues/issue-3080.mir.stderr
+++ b/src/test/ui/issues/issue-3080.mir.stderr
@@ -2,7 +2,7 @@ error[E0133]: call to unsafe function `X::with` is unsafe and requires unsafe fu
--> $DIR/issue-3080.rs:10:5
|
LL | X(()).with();
- | ^^^^^^^^^^^^ call to unsafe function `X::with`
+ | ^^^^^^^^^^^^ call to unsafe function
|
= note: consult the function's documentation for information on how to avoid undefined behavior
diff --git a/src/test/ui/issues/issue-3080.thir.stderr b/src/test/ui/issues/issue-3080.thir.stderr
index b1401b9d3935..4d8acac61d9e 100644
--- a/src/test/ui/issues/issue-3080.thir.stderr
+++ b/src/test/ui/issues/issue-3080.thir.stderr
@@ -2,7 +2,7 @@ error[E0133]: call to unsafe function `X::with` is unsafe and requires unsafe fu
--> $DIR/issue-3080.rs:10:5
|
LL | X(()).with();
- | ^^^^^^^^^^^^ call to unsafe function `X::with`
+ | ^^^^^^^^^^^^ call to unsafe function
|
= note: consult the function's documentation for information on how to avoid undefined behavior
diff --git a/src/test/ui/issues/issue-5844.mir.stderr b/src/test/ui/issues/issue-5844.mir.stderr
index a4141495fa0d..4ec993edc665 100644
--- a/src/test/ui/issues/issue-5844.mir.stderr
+++ b/src/test/ui/issues/issue-5844.mir.stderr
@@ -2,7 +2,7 @@ error[E0133]: call to unsafe function `issue_5844_aux::rand` is unsafe and requi
--> $DIR/issue-5844.rs:8:5
|
LL | issue_5844_aux::rand();
- | ^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function `issue_5844_aux::rand`
+ | ^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
|
= note: consult the function's documentation for information on how to avoid undefined behavior
diff --git a/src/test/ui/issues/issue-5844.thir.stderr b/src/test/ui/issues/issue-5844.thir.stderr
index 0e28e42b928d..310a2b593fe8 100644
--- a/src/test/ui/issues/issue-5844.thir.stderr
+++ b/src/test/ui/issues/issue-5844.thir.stderr
@@ -2,7 +2,7 @@ error[E0133]: call to unsafe function `rand` is unsafe and requires unsafe funct
--> $DIR/issue-5844.rs:8:5
|
LL | issue_5844_aux::rand();
- | ^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function `rand`
+ | ^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
|
= note: consult the function's documentation for information on how to avoid undefined behavior
diff --git a/src/test/ui/rfcs/rfc-2396-target_feature-11/safe-calls.mir.stderr b/src/test/ui/rfcs/rfc-2396-target_feature-11/safe-calls.mir.stderr
index 38d451056796..6743f0802a0f 100644
--- a/src/test/ui/rfcs/rfc-2396-target_feature-11/safe-calls.mir.stderr
+++ b/src/test/ui/rfcs/rfc-2396-target_feature-11/safe-calls.mir.stderr
@@ -2,7 +2,7 @@ error[E0133]: call to function `sse2` with `#[target_feature]` is unsafe and req
--> $DIR/safe-calls.rs:23:5
|
LL | sse2();
- | ^^^^^^ call to function `sse2` with `#[target_feature]`
+ | ^^^^^^ call to function with `#[target_feature]`
|
= note: can only be called if the required target features are available
@@ -10,7 +10,7 @@ error[E0133]: call to function `avx_bmi2` with `#[target_feature]` is unsafe and
--> $DIR/safe-calls.rs:24:5
|
LL | avx_bmi2();
- | ^^^^^^^^^^ call to function `avx_bmi2` with `#[target_feature]`
+ | ^^^^^^^^^^ call to function with `#[target_feature]`
|
= note: can only be called if the required target features are available
@@ -18,7 +18,7 @@ error[E0133]: call to function `Quux::avx_bmi2` with `#[target_feature]` is unsa
--> $DIR/safe-calls.rs:25:5
|
LL | Quux.avx_bmi2();
- | ^^^^^^^^^^^^^^^ call to function `Quux::avx_bmi2` with `#[target_feature]`
+ | ^^^^^^^^^^^^^^^ call to function with `#[target_feature]`
|
= note: can only be called if the required target features are available
@@ -26,7 +26,7 @@ error[E0133]: call to function `avx_bmi2` with `#[target_feature]` is unsafe and
--> $DIR/safe-calls.rs:30:5
|
LL | avx_bmi2();
- | ^^^^^^^^^^ call to function `avx_bmi2` with `#[target_feature]`
+ | ^^^^^^^^^^ call to function with `#[target_feature]`
|
= note: can only be called if the required target features are available
@@ -34,7 +34,7 @@ error[E0133]: call to function `Quux::avx_bmi2` with `#[target_feature]` is unsa
--> $DIR/safe-calls.rs:31:5
|
LL | Quux.avx_bmi2();
- | ^^^^^^^^^^^^^^^ call to function `Quux::avx_bmi2` with `#[target_feature]`
+ | ^^^^^^^^^^^^^^^ call to function with `#[target_feature]`
|
= note: can only be called if the required target features are available
@@ -42,7 +42,7 @@ error[E0133]: call to function `sse2` with `#[target_feature]` is unsafe and req
--> $DIR/safe-calls.rs:36:5
|
LL | sse2();
- | ^^^^^^ call to function `sse2` with `#[target_feature]`
+ | ^^^^^^ call to function with `#[target_feature]`
|
= note: can only be called if the required target features are available
@@ -50,7 +50,7 @@ error[E0133]: call to function `avx_bmi2` with `#[target_feature]` is unsafe and
--> $DIR/safe-calls.rs:37:5
|
LL | avx_bmi2();
- | ^^^^^^^^^^ call to function `avx_bmi2` with `#[target_feature]`
+ | ^^^^^^^^^^ call to function with `#[target_feature]`
|
= note: can only be called if the required target features are available
@@ -58,7 +58,7 @@ error[E0133]: call to function `Quux::avx_bmi2` with `#[target_feature]` is unsa
--> $DIR/safe-calls.rs:38:5
|
LL | Quux.avx_bmi2();
- | ^^^^^^^^^^^^^^^ call to function `Quux::avx_bmi2` with `#[target_feature]`
+ | ^^^^^^^^^^^^^^^ call to function with `#[target_feature]`
|
= note: can only be called if the required target features are available
@@ -66,7 +66,7 @@ error[E0133]: call to function `sse2` with `#[target_feature]` is unsafe and req
--> $DIR/safe-calls.rs:44:5
|
LL | sse2();
- | ^^^^^^ call to function `sse2` with `#[target_feature]`
+ | ^^^^^^ call to function with `#[target_feature]`
|
= note: can only be called if the required target features are available
@@ -74,7 +74,7 @@ error[E0133]: call to function `sse2` with `#[target_feature]` is unsafe and req
--> $DIR/safe-calls.rs:47:18
|
LL | const name: () = sse2();
- | ^^^^^^ call to function `sse2` with `#[target_feature]`
+ | ^^^^^^ call to function with `#[target_feature]`
|
= note: can only be called if the required target features are available
diff --git a/src/test/ui/rfcs/rfc-2396-target_feature-11/safe-calls.thir.stderr b/src/test/ui/rfcs/rfc-2396-target_feature-11/safe-calls.thir.stderr
index 38d451056796..6743f0802a0f 100644
--- a/src/test/ui/rfcs/rfc-2396-target_feature-11/safe-calls.thir.stderr
+++ b/src/test/ui/rfcs/rfc-2396-target_feature-11/safe-calls.thir.stderr
@@ -2,7 +2,7 @@ error[E0133]: call to function `sse2` with `#[target_feature]` is unsafe and req
--> $DIR/safe-calls.rs:23:5
|
LL | sse2();
- | ^^^^^^ call to function `sse2` with `#[target_feature]`
+ | ^^^^^^ call to function with `#[target_feature]`
|
= note: can only be called if the required target features are available
@@ -10,7 +10,7 @@ error[E0133]: call to function `avx_bmi2` with `#[target_feature]` is unsafe and
--> $DIR/safe-calls.rs:24:5
|
LL | avx_bmi2();
- | ^^^^^^^^^^ call to function `avx_bmi2` with `#[target_feature]`
+ | ^^^^^^^^^^ call to function with `#[target_feature]`
|
= note: can only be called if the required target features are available
@@ -18,7 +18,7 @@ error[E0133]: call to function `Quux::avx_bmi2` with `#[target_feature]` is unsa
--> $DIR/safe-calls.rs:25:5
|
LL | Quux.avx_bmi2();
- | ^^^^^^^^^^^^^^^ call to function `Quux::avx_bmi2` with `#[target_feature]`
+ | ^^^^^^^^^^^^^^^ call to function with `#[target_feature]`
|
= note: can only be called if the required target features are available
@@ -26,7 +26,7 @@ error[E0133]: call to function `avx_bmi2` with `#[target_feature]` is unsafe and
--> $DIR/safe-calls.rs:30:5
|
LL | avx_bmi2();
- | ^^^^^^^^^^ call to function `avx_bmi2` with `#[target_feature]`
+ | ^^^^^^^^^^ call to function with `#[target_feature]`
|
= note: can only be called if the required target features are available
@@ -34,7 +34,7 @@ error[E0133]: call to function `Quux::avx_bmi2` with `#[target_feature]` is unsa
--> $DIR/safe-calls.rs:31:5
|
LL | Quux.avx_bmi2();
- | ^^^^^^^^^^^^^^^ call to function `Quux::avx_bmi2` with `#[target_feature]`
+ | ^^^^^^^^^^^^^^^ call to function with `#[target_feature]`
|
= note: can only be called if the required target features are available
@@ -42,7 +42,7 @@ error[E0133]: call to function `sse2` with `#[target_feature]` is unsafe and req
--> $DIR/safe-calls.rs:36:5
|
LL | sse2();
- | ^^^^^^ call to function `sse2` with `#[target_feature]`
+ | ^^^^^^ call to function with `#[target_feature]`
|
= note: can only be called if the required target features are available
@@ -50,7 +50,7 @@ error[E0133]: call to function `avx_bmi2` with `#[target_feature]` is unsafe and
--> $DIR/safe-calls.rs:37:5
|
LL | avx_bmi2();
- | ^^^^^^^^^^ call to function `avx_bmi2` with `#[target_feature]`
+ | ^^^^^^^^^^ call to function with `#[target_feature]`
|
= note: can only be called if the required target features are available
@@ -58,7 +58,7 @@ error[E0133]: call to function `Quux::avx_bmi2` with `#[target_feature]` is unsa
--> $DIR/safe-calls.rs:38:5
|
LL | Quux.avx_bmi2();
- | ^^^^^^^^^^^^^^^ call to function `Quux::avx_bmi2` with `#[target_feature]`
+ | ^^^^^^^^^^^^^^^ call to function with `#[target_feature]`
|
= note: can only be called if the required target features are available
@@ -66,7 +66,7 @@ error[E0133]: call to function `sse2` with `#[target_feature]` is unsafe and req
--> $DIR/safe-calls.rs:44:5
|
LL | sse2();
- | ^^^^^^ call to function `sse2` with `#[target_feature]`
+ | ^^^^^^ call to function with `#[target_feature]`
|
= note: can only be called if the required target features are available
@@ -74,7 +74,7 @@ error[E0133]: call to function `sse2` with `#[target_feature]` is unsafe and req
--> $DIR/safe-calls.rs:47:18
|
LL | const name: () = sse2();
- | ^^^^^^ call to function `sse2` with `#[target_feature]`
+ | ^^^^^^ call to function with `#[target_feature]`
|
= note: can only be called if the required target features are available
diff --git a/src/test/ui/threads-sendsync/issue-43733.mir.stderr b/src/test/ui/threads-sendsync/issue-43733.mir.stderr
index 897a0e459119..699735977afc 100644
--- a/src/test/ui/threads-sendsync/issue-43733.mir.stderr
+++ b/src/test/ui/threads-sendsync/issue-43733.mir.stderr
@@ -2,7 +2,7 @@ error[E0133]: call to unsafe function `std::thread::__FastLocalKeyInner::