Skip to content

Commit e2ce96b

Browse files
authored
Merge pull request #4384 from RalfJung/diag-no-repeat
diagnostics: do not repeat the entire message in the span label
2 parents 88e3e68 + 3281f02 commit e2ce96b

File tree

562 files changed

+727
-874
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

562 files changed

+727
-874
lines changed

src/tools/miri/src/diagnostics.rs

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ impl fmt::Display for TerminationInfo {
8585
DataRace { involves_non_atomic, ptr, op1, op2, .. } =>
8686
write!(
8787
f,
88-
"{} detected between (1) {} on {} and (2) {} on {} at {ptr:?}. (2) just happened here",
88+
"{} detected between (1) {} on {} and (2) {} on {} at {ptr:?}",
8989
if *involves_non_atomic { "Data race" } else { "Race condition" },
9090
op1.action,
9191
op1.thread_info,
@@ -224,7 +224,7 @@ pub fn report_error<'tcx>(
224224
use InterpErrorKind::*;
225225
use UndefinedBehaviorInfo::*;
226226

227-
let mut msg = vec![];
227+
let mut labels = vec![];
228228

229229
let (title, helps) = if let MachineStop(info) = e.kind() {
230230
let info = info.downcast_ref::<TerminationInfo>().expect("invalid MachineStop payload");
@@ -237,7 +237,10 @@ pub fn report_error<'tcx>(
237237
Some("unsupported operation"),
238238
StackedBorrowsUb { .. } | TreeBorrowsUb { .. } | DataRace { .. } =>
239239
Some("Undefined Behavior"),
240-
Deadlock => Some("deadlock"),
240+
Deadlock => {
241+
labels.push(format!("this thread got stuck here"));
242+
None
243+
}
241244
GenmcStuckExecution => {
242245
// This case should only happen in GenMC mode. We treat it like a normal program exit.
243246
assert!(ecx.machine.data_race.as_genmc_ref().is_some());
@@ -259,7 +262,7 @@ pub fn report_error<'tcx>(
259262
]
260263
}
261264
StackedBorrowsUb { help, history, .. } => {
262-
msg.extend(help.clone());
265+
labels.extend(help.clone());
263266
let mut helps = vec![
264267
note!("this indicates a potential bug in the program: it performed an invalid operation, but the Stacked Borrows rules it violated are still experimental"),
265268
note!("see https://github.com/rust-lang/unsafe-code-guidelines/blob/master/wip/stacked-borrows.md for further information"),
@@ -297,6 +300,7 @@ pub fn report_error<'tcx>(
297300
Int2PtrWithStrictProvenance =>
298301
vec![note!("use Strict Provenance APIs (https://doc.rust-lang.org/nightly/std/ptr/index.html#strict-provenance, https://crates.io/crates/sptr) instead")],
299302
DataRace { op1, extra, retag_explain, .. } => {
303+
labels.push(format!("(2) just happened here"));
300304
let mut helps = vec![note_span!(op1.span, "and (1) occurred earlier here")];
301305
if let Some(extra) = extra {
302306
helps.push(note!("{extra}"));
@@ -426,12 +430,20 @@ pub fn report_error<'tcx>(
426430
_ => {}
427431
}
428432

429-
msg.insert(0, format_interp_error(ecx.tcx.dcx(), e));
433+
let mut primary_msg = String::new();
434+
if let Some(title) = title {
435+
write!(primary_msg, "{title}: ").unwrap();
436+
}
437+
write!(primary_msg, "{}", format_interp_error(ecx.tcx.dcx(), e)).unwrap();
438+
439+
if labels.is_empty() {
440+
labels.push(format!("{} occurred here", title.unwrap_or("error")));
441+
}
430442

431443
report_msg(
432444
DiagLevel::Error,
433-
if let Some(title) = title { format!("{title}: {}", msg[0]) } else { msg[0].clone() },
434-
msg,
445+
primary_msg,
446+
labels,
435447
vec![],
436448
helps,
437449
&stacktrace,
@@ -449,8 +461,8 @@ pub fn report_error<'tcx>(
449461
any_pruned |= was_pruned;
450462
report_msg(
451463
DiagLevel::Error,
452-
format!("deadlock: the evaluated program deadlocked"),
453-
vec![format!("the evaluated program deadlocked")],
464+
format!("the evaluated program deadlocked"),
465+
vec![format!("this thread got stuck here")],
454466
vec![],
455467
vec![],
456468
&stacktrace,
@@ -611,7 +623,7 @@ impl<'tcx> MiriMachine<'tcx> {
611623
let stacktrace = Frame::generate_stacktrace_from_stack(self.threads.active_thread_stack());
612624
let (stacktrace, _was_pruned) = prune_stacktrace(stacktrace, self);
613625

614-
let (title, diag_level) = match &e {
626+
let (label, diag_level) = match &e {
615627
RejectedIsolatedOp(_) =>
616628
("operation rejected by isolation".to_string(), DiagLevel::Warning),
617629
Int2Ptr { .. } => ("integer-to-pointer cast".to_string(), DiagLevel::Warning),
@@ -626,10 +638,10 @@ impl<'tcx> MiriMachine<'tcx> {
626638
| FreedAlloc(..)
627639
| ProgressReport { .. }
628640
| WeakMemoryOutdatedLoad { .. } =>
629-
("tracking was triggered".to_string(), DiagLevel::Note),
641+
("tracking was triggered here".to_string(), DiagLevel::Note),
630642
};
631643

632-
let msg = match &e {
644+
let title = match &e {
633645
CreatedPointerTag(tag, None, _) => format!("created base tag {tag:?}"),
634646
CreatedPointerTag(tag, Some(perm), None) =>
635647
format!("created {tag:?} with {perm} derived from unknown tag"),
@@ -735,7 +747,7 @@ impl<'tcx> MiriMachine<'tcx> {
735747
report_msg(
736748
diag_level,
737749
title,
738-
vec![msg],
750+
vec![label],
739751
notes,
740752
helps,
741753
&stacktrace,

src/tools/miri/tests/fail-dep/concurrency/apple_os_unfair_lock_assert_not_owner.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error: abnormal termination: called os_unfair_lock_assert_not_owner on an os_unf
22
--> tests/fail-dep/concurrency/apple_os_unfair_lock_assert_not_owner.rs:LL:CC
33
|
44
LL | libc::os_unfair_lock_assert_not_owner(lock.get());
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ called os_unfair_lock_assert_not_owner on an os_unfair_lock owned by the current thread
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ abnormal termination occurred here
66
|
77
= note: BACKTRACE:
88
= note: inside `main` at tests/fail-dep/concurrency/apple_os_unfair_lock_assert_not_owner.rs:LL:CC

src/tools/miri/tests/fail-dep/concurrency/apple_os_unfair_lock_assert_owner.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error: abnormal termination: called os_unfair_lock_assert_owner on an os_unfair_
22
--> tests/fail-dep/concurrency/apple_os_unfair_lock_assert_owner.rs:LL:CC
33
|
44
LL | libc::os_unfair_lock_assert_owner(lock.get());
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ called os_unfair_lock_assert_owner on an os_unfair_lock not owned by the current thread
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ abnormal termination occurred here
66
|
77
= note: BACKTRACE:
88
= note: inside `main` at tests/fail-dep/concurrency/apple_os_unfair_lock_assert_owner.rs:LL:CC

src/tools/miri/tests/fail-dep/concurrency/apple_os_unfair_lock_move_deadlock.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error: deadlock: the evaluated program deadlocked
1+
error: the evaluated program deadlocked
22
--> tests/fail-dep/concurrency/apple_os_unfair_lock_move_deadlock.rs:LL:CC
33
|
44
LL | unsafe { libc::os_unfair_lock_lock(lock.get()) };
5-
| ^ the evaluated program deadlocked
5+
| ^ this thread got stuck here
66
|
77
= note: BACKTRACE:
88
= note: inside `main` at tests/fail-dep/concurrency/apple_os_unfair_lock_move_deadlock.rs:LL:CC

src/tools/miri/tests/fail-dep/concurrency/apple_os_unfair_lock_reentrant.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error: abnormal termination: attempted to lock an os_unfair_lock that is already
22
--> tests/fail-dep/concurrency/apple_os_unfair_lock_reentrant.rs:LL:CC
33
|
44
LL | libc::os_unfair_lock_lock(lock.get());
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempted to lock an os_unfair_lock that is already locked by the current thread
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ abnormal termination occurred here
66
|
77
= note: BACKTRACE:
88
= note: inside `main` at tests/fail-dep/concurrency/apple_os_unfair_lock_reentrant.rs:LL:CC

src/tools/miri/tests/fail-dep/concurrency/apple_os_unfair_lock_unowned.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error: abnormal termination: attempted to unlock an os_unfair_lock not owned by
22
--> tests/fail-dep/concurrency/apple_os_unfair_lock_unowned.rs:LL:CC
33
|
44
LL | libc::os_unfair_lock_unlock(lock.get());
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempted to unlock an os_unfair_lock not owned by the current thread
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ abnormal termination occurred here
66
|
77
= note: BACKTRACE:
88
= note: inside `main` at tests/fail-dep/concurrency/apple_os_unfair_lock_unowned.rs:LL:CC

src/tools/miri/tests/fail-dep/concurrency/libc_pthread_cond_double_destroy.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error: Undefined Behavior: using uninitialized data, but this operation requires
22
--> tests/fail-dep/concurrency/libc_pthread_cond_double_destroy.rs:LL:CC
33
|
44
LL | libc::pthread_cond_destroy(cond.as_mut_ptr());
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Undefined Behavior occurred here
66
|
77
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
88
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

src/tools/miri/tests/fail-dep/concurrency/libc_pthread_cond_move.init.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error: Undefined Behavior: `pthread_cond_t` can't be moved after first use
22
--> tests/fail-dep/concurrency/libc_pthread_cond_move.rs:LL:CC
33
|
44
LL | libc::pthread_cond_destroy(cond2.as_mut_ptr());
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `pthread_cond_t` can't be moved after first use
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Undefined Behavior occurred here
66
|
77
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
88
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

src/tools/miri/tests/fail-dep/concurrency/libc_pthread_cond_move.static_initializer.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error: Undefined Behavior: `pthread_cond_t` can't be moved after first use
22
--> tests/fail-dep/concurrency/libc_pthread_cond_move.rs:LL:CC
33
|
44
LL | libc::pthread_cond_destroy(&mut cond2 as *mut _);
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `pthread_cond_t` can't be moved after first use
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Undefined Behavior occurred here
66
|
77
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
88
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

src/tools/miri/tests/fail-dep/concurrency/libc_pthread_condattr_double_destroy.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error: Undefined Behavior: using uninitialized data, but this operation requires
22
--> tests/fail-dep/concurrency/libc_pthread_condattr_double_destroy.rs:LL:CC
33
|
44
LL | libc::pthread_condattr_destroy(attr.as_mut_ptr());
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Undefined Behavior occurred here
66
|
77
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
88
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

src/tools/miri/tests/fail-dep/concurrency/libc_pthread_create_too_few_args.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
error: Undefined Behavior: calling a function with more arguments than it expected
22
|
3-
= note: calling a function with more arguments than it expected
3+
= note: Undefined Behavior occurred here
44
= note: (no span available)
55
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
66
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

src/tools/miri/tests/fail-dep/concurrency/libc_pthread_create_too_many_args.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
error: Undefined Behavior: calling a function with fewer arguments than it requires
22
|
3-
= note: calling a function with fewer arguments than it requires
3+
= note: Undefined Behavior occurred here
44
= note: (no span available)
55
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
66
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

src/tools/miri/tests/fail-dep/concurrency/libc_pthread_join_detached.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error: Undefined Behavior: trying to join a detached thread
22
--> tests/fail-dep/concurrency/libc_pthread_join_detached.rs:LL:CC
33
|
44
LL | assert_eq!(libc::pthread_join(native, ptr::null_mut()), 0);
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trying to join a detached thread
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Undefined Behavior occurred here
66
|
77
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
88
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

src/tools/miri/tests/fail-dep/concurrency/libc_pthread_join_joined.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error: Undefined Behavior: trying to join an already joined thread
22
--> tests/fail-dep/concurrency/libc_pthread_join_joined.rs:LL:CC
33
|
44
LL | assert_eq!(libc::pthread_join(native, ptr::null_mut()), 0);
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trying to join an already joined thread
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Undefined Behavior occurred here
66
|
77
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
88
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

src/tools/miri/tests/fail-dep/concurrency/libc_pthread_join_main.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error: Undefined Behavior: trying to join a detached thread
22
--> tests/fail-dep/concurrency/libc_pthread_join_main.rs:LL:CC
33
|
44
LL | assert_eq!(libc::pthread_join(thread_id, ptr::null_mut()), 0);
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trying to join a detached thread
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Undefined Behavior occurred here
66
|
77
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
88
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

src/tools/miri/tests/fail-dep/concurrency/libc_pthread_join_multiple.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error: Undefined Behavior: trying to join an already joined thread
22
--> tests/fail-dep/concurrency/libc_pthread_join_multiple.rs:LL:CC
33
|
44
LL | ... assert_eq!(libc::pthread_join(native_copy, ptr::null_mut()), 0);
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trying to join an already joined thread
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Undefined Behavior occurred here
66
|
77
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
88
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

src/tools/miri/tests/fail-dep/concurrency/libc_pthread_join_self.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error: Undefined Behavior: trying to join itself
22
--> tests/fail-dep/concurrency/libc_pthread_join_self.rs:LL:CC
33
|
44
LL | assert_eq!(libc::pthread_join(native, ptr::null_mut()), 0);
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trying to join itself
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Undefined Behavior occurred here
66
|
77
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
88
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

src/tools/miri/tests/fail-dep/concurrency/libc_pthread_mutex_NULL_reentrant.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error: Undefined Behavior: trying to acquire default mutex already locked by the
22
--> tests/fail-dep/concurrency/libc_pthread_mutex_NULL_reentrant.rs:LL:CC
33
|
44
LL | libc::pthread_mutex_lock(&mut mutex as *mut _);
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trying to acquire default mutex already locked by the current thread
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Undefined Behavior occurred here
66
|
77
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
88
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

src/tools/miri/tests/fail-dep/concurrency/libc_pthread_mutex_deadlock.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
error: deadlock: the evaluated program deadlocked
1+
error: the evaluated program deadlocked
22
--> tests/fail-dep/concurrency/libc_pthread_mutex_deadlock.rs:LL:CC
33
|
44
LL | assert_eq!(libc::pthread_mutex_lock(lock_copy.0.get() as *mut _), 0);
5-
| ^ the evaluated program deadlocked
5+
| ^ this thread got stuck here
66
|
77
= note: BACKTRACE on thread `unnamed-ID`:
88
= note: inside closure at tests/fail-dep/concurrency/libc_pthread_mutex_deadlock.rs:LL:CC
99

10-
error: deadlock: the evaluated program deadlocked
10+
error: the evaluated program deadlocked
1111
--> RUSTLIB/std/src/sys/pal/PLATFORM/thread.rs:LL:CC
1212
|
1313
LL | let ret = unsafe { libc::pthread_join(id, ptr::null_mut()) };
14-
| ^ the evaluated program deadlocked
14+
| ^ this thread got stuck here
1515
|
1616
= note: BACKTRACE:
1717
= note: inside `std::sys::pal::PLATFORM::thread::Thread::join` at RUSTLIB/std/src/sys/pal/PLATFORM/thread.rs:LL:CC

src/tools/miri/tests/fail-dep/concurrency/libc_pthread_mutex_default_reentrant.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error: Undefined Behavior: trying to acquire default mutex already locked by the
22
--> tests/fail-dep/concurrency/libc_pthread_mutex_default_reentrant.rs:LL:CC
33
|
44
LL | libc::pthread_mutex_lock(&mut mutex as *mut _);
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trying to acquire default mutex already locked by the current thread
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Undefined Behavior occurred here
66
|
77
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
88
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

src/tools/miri/tests/fail-dep/concurrency/libc_pthread_mutex_destroy_locked.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error: Undefined Behavior: destroyed a locked mutex
22
--> tests/fail-dep/concurrency/libc_pthread_mutex_destroy_locked.rs:LL:CC
33
|
44
LL | libc::pthread_mutex_destroy(&mut mutex as *mut _);
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ destroyed a locked mutex
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Undefined Behavior occurred here
66
|
77
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
88
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

src/tools/miri/tests/fail-dep/concurrency/libc_pthread_mutex_double_destroy.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error: Undefined Behavior: using uninitialized data, but this operation requires
22
--> tests/fail-dep/concurrency/libc_pthread_mutex_double_destroy.rs:LL:CC
33
|
44
LL | libc::pthread_mutex_destroy(mutex.as_mut_ptr());
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Undefined Behavior occurred here
66
|
77
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
88
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

src/tools/miri/tests/fail-dep/concurrency/libc_pthread_mutex_move.init.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error: Undefined Behavior: `pthread_mutex_t` can't be moved after first use
22
--> tests/fail-dep/concurrency/libc_pthread_mutex_move.rs:LL:CC
33
|
44
LL | libc::pthread_mutex_lock(&mut m2 as *mut _);
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `pthread_mutex_t` can't be moved after first use
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Undefined Behavior occurred here
66
|
77
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
88
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

0 commit comments

Comments
 (0)