]> git.lizzy.rs Git - rust.git/blob - tests/debuginfo/mutex.rs
Rollup merge of #107194 - xfix:remove-slice-internals-dependency-in-rustc-ast, r...
[rust.git] / tests / debuginfo / mutex.rs
1 // Testing the display of Mutex and MutexGuard in cdb.
2
3 // cdb-only
4 // min-cdb-version: 10.0.21287.1005
5 // compile-flags:-g
6
7 // === CDB TESTS ==================================================================================
8 //
9 // cdb-command:g
10 //
11 // cdb-command:dx m,d
12 // cdb-check:m,d              [Type: std::sync::mutex::Mutex<i32>]
13 // cdb-check:    [...] inner            [Type: std::sys::windows::locks::mutex::Mutex]
14 // cdb-check:    [...] poison           [Type: std::sync::poison::Flag]
15 // cdb-check:    [...] data             : 0 [Type: core::cell::UnsafeCell<i32>]
16
17 //
18 // cdb-command:dx m.data,d
19 // cdb-check:m.data,d         : 0 [Type: core::cell::UnsafeCell<i32>]
20 // cdb-check:    [<Raw View>]     [Type: core::cell::UnsafeCell<i32>]
21
22 //
23 // cdb-command:dx _lock,d
24 // cdb-check:_lock,d          : Ok [Type: enum2$<core::result::Result<std::sync::mutex::MutexGuard<i32>,enum2$<std::sync::poison::TryLockError<std::sync::mutex::MutexGuard<i32> > > > >]
25 // cdb-check:    [...] __0              [Type: std::sync::mutex::MutexGuard<i32>]
26
27 use std::sync::Mutex;
28
29 fn main() {
30     let m = Mutex::new(0);
31     let _lock = m.try_lock();
32
33     println!("this line avoids an `Ambiguous symbol error` while setting the breakpoint");
34
35     zzz(); // #break
36 }
37
38 #[inline(never)]
39 fn zzz() {}