From 07f1e6152c5aab4490975d53e2da442a4e827fc5 Mon Sep 17 00:00:00 2001 From: Wesley Wiser Date: Mon, 28 Jun 2021 17:42:55 -0400 Subject: [PATCH 01/20] Add natvis for NonZero and Wrapping types --- src/etc/natvis/libcore.natvis | 41 ++++++++ src/test/debuginfo/numeric-types.rs | 142 ++++++++++++++++++++++++++++ 2 files changed, 183 insertions(+) create mode 100644 src/test/debuginfo/numeric-types.rs diff --git a/src/etc/natvis/libcore.natvis b/src/etc/natvis/libcore.natvis index c8196d5c713b2..7eaba42e2f77d 100644 --- a/src/etc/natvis/libcore.natvis +++ b/src/etc/natvis/libcore.natvis @@ -1,5 +1,46 @@ + + {__0} + + + {__0} + + + {__0} + + + {__0} + + + {__0} + + + {__0} + + + {__0} + + + {__0} + + + {__0} + + + {__0} + + + {__0} + + + {__0} + + + + {__0} + + {{ Unique {pointer} }} diff --git a/src/test/debuginfo/numeric-types.rs b/src/test/debuginfo/numeric-types.rs new file mode 100644 index 0000000000000..8e03a2947ea45 --- /dev/null +++ b/src/test/debuginfo/numeric-types.rs @@ -0,0 +1,142 @@ +// only-cdb +// compile-flags:-g + +// Tests the visualizations for `NonZero{I,U}{8,16,32,64,128,size}` and `Wrapping` in +// `libcore.natvis`. + +// === CDB TESTS ================================================================================== +// cdb-command: g + +// cdb-command: dx nz_i8 +// cdb-check:nz_i8 : 11 [Type: core::num::nonzero::NonZeroI8] +// cdb-check: [] [Type: core::num::nonzero::NonZeroI8] + +// cdb-command: dx nz_i16 +// cdb-check:nz_i16 : 22 [Type: core::num::nonzero::NonZeroI16] +// cdb-check: [] [Type: core::num::nonzero::NonZeroI16] + +// cdb-command: dx nz_i32 +// cdb-check:nz_i32 : 33 [Type: core::num::nonzero::NonZeroI32] +// cdb-check: [] [Type: core::num::nonzero::NonZeroI32] + +// cdb-command: dx nz_i64 +// cdb-check:nz_i64 : 44 [Type: core::num::nonzero::NonZeroI64] +// cdb-check: [] [Type: core::num::nonzero::NonZeroI64] + +// 128-bit integers don't seem to work in CDB +// cdb-command: dx nz_i128 +// cdb-check: [] [Type: core::num::nonzero::NonZeroI128] + +// cdb-command: dx nz_isize +// cdb-check:nz_isize : 66 [Type: core::num::nonzero::NonZeroIsize] +// cdb-check: [] [Type: core::num::nonzero::NonZeroIsize] + +// cdb-command: dx nz_u8 +// cdb-check:nz_u8 : 0x4d [Type: core::num::nonzero::NonZeroU8] +// cdb-check: [] [Type: core::num::nonzero::NonZeroU8] + +// cdb-command: dx nz_u16 +// cdb-check:nz_u16 : 0x58 [Type: core::num::nonzero::NonZeroU16] +// cdb-check: [] [Type: core::num::nonzero::NonZeroU16] + +// cdb-command: dx nz_u32 +// cdb-check:nz_u32 : 0x63 [Type: core::num::nonzero::NonZeroU32] +// cdb-check: [] [Type: core::num::nonzero::NonZeroU32] + +// cdb-command: dx nz_u64 +// cdb-check:nz_u64 : 0x64 [Type: core::num::nonzero::NonZeroU64] +// cdb-check: [] [Type: core::num::nonzero::NonZeroU64] + +// 128-bit integers don't seem to work in CDB +// cdb-command: dx nz_u128 +// cdb-check: [] [Type: core::num::nonzero::NonZeroU128] + +// cdb-command: dx nz_usize +// cdb-check:nz_usize : 0x7a [Type: core::num::nonzero::NonZeroUsize] +// cdb-check: [] [Type: core::num::nonzero::NonZeroUsize] + +// cdb-command: dx w_i8 +// cdb-check:w_i8 : 10 [Type: core::num::wrapping::Wrapping] +// cdb-check: [] [Type: core::num::wrapping::Wrapping] + +// cdb-command: dx w_i16 +// cdb-check:w_i16 : 20 [Type: core::num::wrapping::Wrapping] +// cdb-check: [] [Type: core::num::wrapping::Wrapping] + +// cdb-command: dx w_i32 +// cdb-check:w_i32 : 30 [Type: core::num::wrapping::Wrapping] +// cdb-check: [] [Type: core::num::wrapping::Wrapping] + +// cdb-command: dx w_i64 +// cdb-check:w_i64 : 40 [Type: core::num::wrapping::Wrapping] +// cdb-check: [] [Type: core::num::wrapping::Wrapping] + +// 128-bit integers don't seem to work in CDB +// cdb-command: dx w_i128 +// cdb-check:w_i128 [Type: core::num::wrapping::Wrapping] +// cdb-check: [] [Type: core::num::wrapping::Wrapping] + +// cdb-command: dx w_isize +// cdb-check:w_isize : 60 [Type: core::num::wrapping::Wrapping] +// cdb-check: [] [Type: core::num::wrapping::Wrapping] + +// cdb-command: dx w_u8 +// cdb-check:w_u8 : 0x46 [Type: core::num::wrapping::Wrapping] +// cdb-check: [] [Type: core::num::wrapping::Wrapping] + +// cdb-command: dx w_u16 +// cdb-check:w_u16 : 0x50 [Type: core::num::wrapping::Wrapping] +// cdb-check: [] [Type: core::num::wrapping::Wrapping] + +// cdb-command: dx w_u32 +// cdb-check:w_u32 : 0x5a [Type: core::num::wrapping::Wrapping] +// cdb-check: [] [Type: core::num::wrapping::Wrapping] + +// cdb-command: dx w_u64 +// cdb-check:w_u64 : 0x64 [Type: core::num::wrapping::Wrapping] +// cdb-check: [] [Type: core::num::wrapping::Wrapping] + +// 128-bit integers don't seem to work in CDB +// cdb-command: dx w_u128 +// cdb-check:w_u128 [Type: core::num::wrapping::Wrapping] +// cdb-check: [] [Type: core::num::wrapping::Wrapping] + +// cdb-command: dx w_usize +// cdb-check:w_usize : 0x78 [Type: core::num::wrapping::Wrapping] +// cdb-check: [] [Type: core::num::wrapping::Wrapping] + +use std::num::*; + +fn main() { + let nz_i8 = NonZeroI8::new(11).unwrap(); + let nz_i16 = NonZeroI16::new(22).unwrap(); + let nz_i32 = NonZeroI32::new(33).unwrap(); + let nz_i64 = NonZeroI64::new(44).unwrap(); + let nz_i128 = NonZeroI128::new(55).unwrap(); + let nz_isize = NonZeroIsize::new(66).unwrap(); + + let nz_u8 = NonZeroU8::new(77).unwrap(); + let nz_u16 = NonZeroU16::new(88).unwrap(); + let nz_u32 = NonZeroU32::new(99).unwrap(); + let nz_u64 = NonZeroU64::new(100).unwrap(); + let nz_u128 = NonZeroU128::new(111).unwrap(); + let nz_usize = NonZeroUsize::new(122).unwrap(); + + let w_i8 = Wrapping(10i8); + let w_i16 = Wrapping(20i16); + let w_i32 = Wrapping(30i32); + let w_i64 = Wrapping(40i64); + let w_i128 = Wrapping(50i128); + let w_isize = Wrapping(60isize); + + let w_u8 = Wrapping(70u8); + let w_u16 = Wrapping(80u16); + let w_u32 = Wrapping(90u32); + let w_u64 = Wrapping(100u64); + let w_u128 = Wrapping(110u128); + let w_usize = Wrapping(120usize); + + zzz(); // #break +} + +fn zzz() { } From 9740dcc82f39c2a7f1700ebbb2f0edb53388a44b Mon Sep 17 00:00:00 2001 From: Wesley Wiser Date: Tue, 29 Jun 2021 10:45:41 -0400 Subject: [PATCH 02/20] Add natvis for Atomic types --- src/etc/natvis/libcore.natvis | 36 ++++++++++++++- src/test/debuginfo/numeric-types.rs | 68 ++++++++++++++++++++++++++++- 2 files changed, 101 insertions(+), 3 deletions(-) diff --git a/src/etc/natvis/libcore.natvis b/src/etc/natvis/libcore.natvis index 7eaba42e2f77d..b5899cf9319d8 100644 --- a/src/etc/natvis/libcore.natvis +++ b/src/etc/natvis/libcore.natvis @@ -61,4 +61,38 @@ *pointer - \ No newline at end of file + + + {(bool)v.value} + + + {v.value} + + + {v.value} + + + {v.value} + + + {v.value} + + + {v.value} + + + {v.value} + + + {v.value} + + + {v.value} + + + {v.value} + + + {v.value} + + diff --git a/src/test/debuginfo/numeric-types.rs b/src/test/debuginfo/numeric-types.rs index 8e03a2947ea45..2eae9239b6118 100644 --- a/src/test/debuginfo/numeric-types.rs +++ b/src/test/debuginfo/numeric-types.rs @@ -1,8 +1,8 @@ // only-cdb // compile-flags:-g -// Tests the visualizations for `NonZero{I,U}{8,16,32,64,128,size}` and `Wrapping` in -// `libcore.natvis`. +// Tests the visualizations for `NonZero{I,U}{8,16,32,64,128,size}`, `Wrapping` and +// `Atomic{Bool,I8,I16,I32,I64,Isize,U8,U16,U32,U64,Usize}` located in `libcore.natvis`. // === CDB TESTS ================================================================================== // cdb-command: g @@ -105,7 +105,56 @@ // cdb-check:w_usize : 0x78 [Type: core::num::wrapping::Wrapping] // cdb-check: [] [Type: core::num::wrapping::Wrapping] +// cdb-command: dx a_bool_t +// cdb-check:a_bool_t : true [Type: core::sync::atomic::AtomicBool] +// cdb-check: [] [Type: core::sync::atomic::AtomicBool] + +// cdb-command: dx a_bool_f +// cdb-check:a_bool_f : false [Type: core::sync::atomic::AtomicBool] +// cdb-check: [] [Type: core::sync::atomic::AtomicBool] + +// cdb-command: dx a_i8 +// cdb-check:a_i8 : 2 [Type: core::sync::atomic::AtomicI8] +// cdb-check: [] [Type: core::sync::atomic::AtomicI8] + +// cdb-command: dx a_i16 +// cdb-check:a_i16 : 4 [Type: core::sync::atomic::AtomicI16] +// cdb-check: [] [Type: core::sync::atomic::AtomicI16] + +// cdb-command: dx a_i32 +// cdb-check:a_i32 : 8 [Type: core::sync::atomic::AtomicI32] +// cdb-check: [] [Type: core::sync::atomic::AtomicI32] + +// cdb-command: dx a_i64 +// cdb-check:a_i64 : 16 [Type: core::sync::atomic::AtomicI64] +// cdb-check: [] [Type: core::sync::atomic::AtomicI64] + +// cdb-command: dx a_isize +// cdb-check:a_isize : 32 [Type: core::sync::atomic::AtomicIsize] +// cdb-check: [] [Type: core::sync::atomic::AtomicIsize] + +// cdb-command: dx a_u8 +// cdb-check:a_u8 : 0x40 [Type: core::sync::atomic::AtomicU8] +// cdb-check: [] [Type: core::sync::atomic::AtomicU8] + +// cdb-command: dx a_u16 +// cdb-check:a_u16 : 0x80 [Type: core::sync::atomic::AtomicU16] +// cdb-check: [] [Type: core::sync::atomic::AtomicU16] + +// cdb-command: dx a_u32 +// cdb-check:a_u32 : 0x100 [Type: core::sync::atomic::AtomicU32] +// cdb-check: [] [Type: core::sync::atomic::AtomicU32] + +// cdb-command: dx a_u64 +// cdb-check:a_u64 : 0x200 [Type: core::sync::atomic::AtomicU64] +// cdb-check: [] [Type: core::sync::atomic::AtomicU64] + +// cdb-command: dx a_usize +// cdb-check:a_usize : 0x400 [Type: core::sync::atomic::AtomicUsize] +// cdb-check: [] [Type: core::sync::atomic::AtomicUsize] + use std::num::*; +use std::sync::atomic::*; fn main() { let nz_i8 = NonZeroI8::new(11).unwrap(); @@ -136,6 +185,21 @@ fn main() { let w_u128 = Wrapping(110u128); let w_usize = Wrapping(120usize); + let a_bool_t = AtomicBool::new(true); + let a_bool_f = AtomicBool::new(false); + + let a_i8 = AtomicI8::new(2); + let a_i16 = AtomicI16::new(4); + let a_i32 = AtomicI32::new(8); + let a_i64 = AtomicI64::new(16); + let a_isize = AtomicIsize::new(32); + + let a_u8 = AtomicU8::new(64); + let a_u16 = AtomicU16::new(128); + let a_u32 = AtomicU32::new(256); + let a_u64 = AtomicU64::new(512); + let a_usize = AtomicUsize::new(1024); + zzz(); // #break } From cad42e0d330d8d3476f2217fe4f14f2f5e34e691 Mon Sep 17 00:00:00 2001 From: Wesley Wiser Date: Tue, 29 Jun 2021 15:32:03 -0400 Subject: [PATCH 03/20] Add natvis for cell types --- src/etc/natvis/libcore.natvis | 34 +++++++++++++ src/test/debuginfo/mutable-locs.rs | 77 +++++++++++++++++++++++++----- src/test/debuginfo/rwlock-read.rs | 6 +-- 3 files changed, 102 insertions(+), 15 deletions(-) diff --git a/src/etc/natvis/libcore.natvis b/src/etc/natvis/libcore.natvis index b5899cf9319d8..96459adb6b8ac 100644 --- a/src/etc/natvis/libcore.natvis +++ b/src/etc/natvis/libcore.natvis @@ -1,5 +1,39 @@ + + {value.value} + + value.value + + + + {value} + + value + + + + {value} + + value + + + + {value.value} + + "Unborrowed",sb + "Immutably borrowed",sb + "Mutably borrowed",sb + value.value + + + + {value} + + value + + + {__0} diff --git a/src/test/debuginfo/mutable-locs.rs b/src/test/debuginfo/mutable-locs.rs index 428a7e8d9c09b..688483e43e4db 100644 --- a/src/test/debuginfo/mutable-locs.rs +++ b/src/test/debuginfo/mutable-locs.rs @@ -9,26 +9,64 @@ // cdb-command: g // cdb-command:dx static_c,d -// cdb-check:static_c,d [Type: core::cell::Cell] -// cdb-check: [...] value [Type: core::cell::UnsafeCell] +// cdb-check:static_c,d : 10 [Type: core::cell::Cell] +// cdb-check: [] [Type: core::cell::Cell] // cdb-command: dx static_c.value,d -// cdb-check:static_c.value,d [Type: core::cell::UnsafeCell] -// cdb-check: [...] value : 10 [Type: int] +// cdb-check:static_c.value,d : 10 [Type: core::cell::UnsafeCell] +// cdb-check: [] [Type: core::cell::UnsafeCell] // cdb-command: dx dynamic_c,d -// cdb-check:dynamic_c,d [Type: core::cell::RefCell] -// cdb-check: [...] borrow [Type: core::cell::Cell] -// cdb-check: [...] value [Type: core::cell::UnsafeCell] +// cdb-check:dynamic_c,d : 15 [Type: core::cell::RefCell] +// cdb-check: [] [Type: core::cell::RefCell] +// cdb-check: [Borrow state] : Unborrowed // cdb-command: dx dynamic_c.value,d -// cdb-check:dynamic_c.value,d [Type: core::cell::UnsafeCell] -// cdb-check: [...] value : 15 [Type: int] +// cdb-check:dynamic_c.value,d : 15 [Type: core::cell::UnsafeCell] +// cdb-check: [] [Type: core::cell::UnsafeCell] // cdb-command: dx b,d -// cdb-check:b,d [Type: core::cell::RefMut] -// cdb-check: [...] value : [...] : 42 [Type: int *] -// cdb-check: [...] borrow [Type: core::cell::BorrowRefMut] +// cdb-check:b,d : 42 [Type: core::cell::RefMut] +// cdb-check: [] [Type: core::cell::RefMut] +// cdb-check: 42 [Type: int] + +// cdb-command: g + +// cdb-command: dx dynamic_c,d +// cdb-check:dynamic_c,d : 15 [Type: core::cell::RefCell] +// cdb-check: [] [Type: core::cell::RefCell] +// cdb-check: [Borrow state] : Immutably borrowed + +// cdb-command: dx r_borrow,d +// cdb-check:r_borrow,d : 15 [Type: core::cell::Ref] +// cdb-check: [] [Type: core::cell::Ref] +// cdb-check: 15 [Type: int] + +// cdb-command: g + +// cdb-command: dx dynamic_c,d +// cdb-check:dynamic_c,d : 15 [Type: core::cell::RefCell] +// cdb-check: [] [Type: core::cell::RefCell] +// cdb-check: [Borrow state] : Unborrowed + +// cdb-command: g + +// cdb-command: dx dynamic_c,d +// cdb-check:dynamic_c,d : 15 [Type: core::cell::RefCell] +// cdb-check: [] [Type: core::cell::RefCell] +// cdb-check: [Borrow state] : Mutably borrowed + +// cdb-command: dx r_borrow_mut,d +// cdb-check:r_borrow_mut,d : 15 [Type: core::cell::RefMut] +// cdb-check: [] [Type: core::cell::RefMut] +// cdb-check: 15 [Type: int] + +// cdb-command: g + +// cdb-command: dx dynamic_c,d +// cdb-check:dynamic_c,d : 15 [Type: core::cell::RefCell] +// cdb-check: [] [Type: core::cell::RefCell] +// cdb-check: [Borrow state] : Unborrowed #![allow(unused_variables)] @@ -46,6 +84,21 @@ fn main() { *b = 42; zzz(); // #break + + // Check that `RefCell`'s borrow state visualizes correctly + { + let r_borrow = dynamic_c.borrow(); + zzz(); // #break + } + + zzz(); // #break + + { + let r_borrow_mut = dynamic_c.borrow_mut(); + zzz(); // #break + } + + zzz(); // #break } fn zzz() {()} diff --git a/src/test/debuginfo/rwlock-read.rs b/src/test/debuginfo/rwlock-read.rs index ac652c8ccf4cc..e1c10a4d37fc3 100644 --- a/src/test/debuginfo/rwlock-read.rs +++ b/src/test/debuginfo/rwlock-read.rs @@ -11,15 +11,15 @@ // cdb-command:dx l // cdb-check:l [Type: std::sync::rwlock::RwLock] // cdb-check: [...] poison [Type: std::sync::poison::Flag] -// cdb-check: [...] data [Type: core::cell::UnsafeCell] +// cdb-check: [...] data : 0 [Type: core::cell::UnsafeCell] // // cdb-command:dx r // cdb-check:r [Type: std::sync::rwlock::RwLockReadGuard] // cdb-check: [...] lock : [...] [Type: std::sync::rwlock::RwLock *] // // cdb-command:dx r.lock->data,d -// cdb-check:r.lock->data,d [Type: core::cell::UnsafeCell] -// cdb-check: [...] value : 0 [Type: int] +// cdb-check:r.lock->data,d : 0 [Type: core::cell::UnsafeCell] +// cdb-check: [] [Type: core::cell::UnsafeCell] #[allow(unused_variables)] From 8f1eec37545c276b0cfaa60d38b4778e1bba7214 Mon Sep 17 00:00:00 2001 From: Wesley Wiser Date: Tue, 29 Jun 2021 16:41:44 -0400 Subject: [PATCH 04/20] Fixup natvis for NonNull and Unique types Remove the Shared type natvis since it no longer exists --- src/etc/natvis/libcore.natvis | 19 ++++++------------- src/test/debuginfo/marker-types.rs | 21 +++++++++++++++++++++ 2 files changed, 27 insertions(+), 13 deletions(-) create mode 100644 src/test/debuginfo/marker-types.rs diff --git a/src/etc/natvis/libcore.natvis b/src/etc/natvis/libcore.natvis index 96459adb6b8ac..04e72c706b4b7 100644 --- a/src/etc/natvis/libcore.natvis +++ b/src/etc/natvis/libcore.natvis @@ -75,24 +75,17 @@ {__0} - - {{ Unique {pointer} }} - - pointer - - - - - {{ Shared {pointer} }} + + NonNull({(void*) pointer}: {pointer}) - pointer + pointer - - {(void*) pointer} + + Unique({(void*)pointer}: {pointer}) - *pointer + pointer diff --git a/src/test/debuginfo/marker-types.rs b/src/test/debuginfo/marker-types.rs new file mode 100644 index 0000000000000..43e45d8f282e8 --- /dev/null +++ b/src/test/debuginfo/marker-types.rs @@ -0,0 +1,21 @@ +// only-cdb +// compile-flags:-g + +// === CDB TESTS ================================================================================== + +// cdb-command: g + +// cdb-command: dx nonnull +// cdb-check:nonnull : NonNull(0x[...]: 0xc) [Type: core::ptr::non_null::NonNull] +// cdb-check: [] [Type: core::ptr::non_null::NonNull] +// cdb-checK: 0xc [Type: unsigned int] + +use std::ptr::NonNull; + +fn main() { + let nonnull: NonNull<_> = (&12u32).into(); + + zzz(); // #break +} + +fn zzz() { } From f2aba34eea86a1e3c1ebdd0b8f7adfc730169518 Mon Sep 17 00:00:00 2001 From: Wesley Wiser Date: Tue, 29 Jun 2021 17:04:23 -0400 Subject: [PATCH 05/20] Add natvis for Range types --- src/etc/natvis/libcore.natvis | 16 ++++++++++++++ src/test/debuginfo/range-types.rs | 36 ++++++++++++++++--------------- 2 files changed, 35 insertions(+), 17 deletions(-) diff --git a/src/etc/natvis/libcore.natvis b/src/etc/natvis/libcore.natvis index 04e72c706b4b7..624495fb5acbc 100644 --- a/src/etc/natvis/libcore.natvis +++ b/src/etc/natvis/libcore.natvis @@ -75,6 +75,22 @@ {__0} + + ({start}..{end}) + + + ({start}..) + + + ({start}..={end}) + + + (..{end}) + + + (..={end}) + + NonNull({(void*) pointer}: {pointer}) diff --git a/src/test/debuginfo/range-types.rs b/src/test/debuginfo/range-types.rs index c0288b6ba80e0..7362a50a03015 100644 --- a/src/test/debuginfo/range-types.rs +++ b/src/test/debuginfo/range-types.rs @@ -9,26 +9,27 @@ // cdb-command: g // cdb-command: dx r1,d -// cdb-check:r1,d [Type: core::ops::range::Range] -// cdb-check: [...] start : 3 [Type: int] -// cdb-check: [...] end : 5 [Type: int] +// cdb-check:r1,d : (3..5) [Type: core::ops::range::Range] +// cdb-check: [] [Type: core::ops::range::Range] // cdb-command: dx r2,d -// cdb-check:r2,d [Type: core::ops::range::RangeFrom] -// cdb-check: [...] start : 2 [Type: int] +// cdb-check:r2,d : (2..) [Type: core::ops::range::RangeFrom] +// cdb-check: [] [Type: core::ops::range::RangeFrom] // cdb-command: dx r3,d -// cdb-check:r3,d [Type: core::ops::range::RangeInclusive] -// cdb-check: [...] start : 1 [Type: int] -// cdb-check: [...] end : 4 [Type: int] -// cdb-check: [...] exhausted : false [Type: bool] +// cdb-check:r3,d : (1..=4) [Type: core::ops::range::RangeInclusive] +// cdb-check: [] [Type: core::ops::range::RangeInclusive] // cdb-command: dx r4,d -// cdb-check:r4,d [Type: core::ops::range::RangeToInclusive] -// cdb-check: [...] end : 3 [Type: int] +// cdb-check:r4,d : (..10) [Type: core::ops::range::RangeTo] +// cdb-check: [] [Type: core::ops::range::RangeTo] // cdb-command: dx r5,d -// cdb-check:r5,d [Type: core::ops::range::RangeFull] +// cdb-check:r5,d : (..=3) [Type: core::ops::range::RangeToInclusive] +// cdb-check: [] [Type: core::ops::range::RangeToInclusive] + +// cdb-command: dx r6,d +// cdb-check:r6,d [Type: core::ops::range::RangeFull] #[allow(unused_variables)] @@ -36,11 +37,12 @@ use std::ops::{Range, RangeFrom, RangeFull, RangeInclusive, RangeToInclusive}; fn main() { - let r1 = Range{start: 3, end: 5}; - let r2 = RangeFrom{start: 2}; - let r3 = RangeInclusive::new(1, 4); - let r4 = RangeToInclusive{end: 3}; - let r5 = RangeFull{}; + let r1 = (3..5); + let r2 = (2..); + let r3 = (1..=4); + let r4 = (..10); + let r5 = (..=3); + let r6 = (..); zzz(); // #break } From 691ee054d5bb8e0a95fd0486a7167bd8889ebba7 Mon Sep 17 00:00:00 2001 From: Wesley Wiser Date: Wed, 30 Jun 2021 12:08:58 -0400 Subject: [PATCH 06/20] Add natvis for Duration, ManuallyDrop and Pin types --- src/etc/natvis/libcore.natvis | 22 ++++++++++++++++++++++ src/test/debuginfo/duration-type.rs | 22 ++++++++++++++++++++++ src/test/debuginfo/marker-types.rs | 18 ++++++++++++++++++ 3 files changed, 62 insertions(+) create mode 100644 src/test/debuginfo/duration-type.rs diff --git a/src/etc/natvis/libcore.natvis b/src/etc/natvis/libcore.natvis index 624495fb5acbc..abac2cefa3886 100644 --- a/src/etc/natvis/libcore.natvis +++ b/src/etc/natvis/libcore.natvis @@ -34,6 +34,13 @@ + + {value} + + value + + + {__0} @@ -91,6 +98,13 @@ (..={end}) + + Pin({(void*)pointer}: {pointer}) + + pointer + + + NonNull({(void*) pointer}: {pointer}) @@ -138,4 +152,12 @@ {v.value} + + + {secs,d}s {nanos,d}ns + + secs + nanos + + diff --git a/src/test/debuginfo/duration-type.rs b/src/test/debuginfo/duration-type.rs new file mode 100644 index 0000000000000..3a7f9f78b5fed --- /dev/null +++ b/src/test/debuginfo/duration-type.rs @@ -0,0 +1,22 @@ +// only-cdb +// compile-flags:-g + +// === CDB TESTS ================================================================================== + +// cdb-command: g + +// cdb-command: dx duration +// cdb-check:duration : 5s 12ns [Type: core::time::Duration] +// cdb-check: [] [Type: core::time::Duration] +// cdb-check: seconds : 0x5 [Type: unsigned __int64] +// cdb-check: nanoseconds : 0xc [Type: unsigned int] + +use std::time::Duration; + +fn main() { + let duration = Duration::new(5, 12); + + zzz(); // #break +} + +fn zzz() { } diff --git a/src/test/debuginfo/marker-types.rs b/src/test/debuginfo/marker-types.rs index 43e45d8f282e8..de4e8311a4fc3 100644 --- a/src/test/debuginfo/marker-types.rs +++ b/src/test/debuginfo/marker-types.rs @@ -10,11 +10,29 @@ // cdb-check: [] [Type: core::ptr::non_null::NonNull] // cdb-checK: 0xc [Type: unsigned int] +// cdb-command: dx manuallydrop +// cdb-check:manuallydrop : 12345 [Type: core::mem::manually_drop::ManuallyDrop] +// cdb-check: [] [Type: core::mem::manually_drop::ManuallyDrop] + +// cdb-command: dx pin +// cdb-check:pin : Pin(0x[...]: "this") [Type: core::pin::Pin >] +// cdb-check: [] [Type: core::pin::Pin >] +// cdb-check: [len] : 0x4 [Type: unsigned __int64] +// cdb-check: [capacity] : 0x4 [Type: unsigned __int64] +// cdb-check: [chars] + +use std::mem::ManuallyDrop; +use std::pin::Pin; use std::ptr::NonNull; fn main() { let nonnull: NonNull<_> = (&12u32).into(); + let manuallydrop = ManuallyDrop::new(12345i32); + + let mut s = "this".to_string(); + let pin = Pin::new(&mut s); + zzz(); // #break } From a6a82c66d4fc3be10861ad6885ff0ab239c203ad Mon Sep 17 00:00:00 2001 From: Wesley Wiser Date: Wed, 30 Jun 2021 17:23:44 -0400 Subject: [PATCH 07/20] Add/improve visualizations for liballoc types --- src/etc/natvis/liballoc.natvis | 10 ++++++++++ src/test/debuginfo/pretty-std.rs | 26 +++++++++++++++++++++++++- src/test/debuginfo/rc_arc.rs | 13 +++++++++++-- 3 files changed, 46 insertions(+), 3 deletions(-) diff --git a/src/etc/natvis/liballoc.natvis b/src/etc/natvis/liballoc.natvis index 9cc60fc7b47e5..707643152c946 100644 --- a/src/etc/natvis/liballoc.natvis +++ b/src/etc/natvis/liballoc.natvis @@ -57,16 +57,26 @@ + {ptr.pointer->value} ptr.pointer->value + ptr.pointer->strong + + {ptr.pointer->value} + + ptr.pointer->value + + + {ptr.pointer->data} ptr.pointer->data + ptr.pointer->strong diff --git a/src/test/debuginfo/pretty-std.rs b/src/test/debuginfo/pretty-std.rs index 7ed76beb8c6d9..a2074c43dfaca 100644 --- a/src/test/debuginfo/pretty-std.rs +++ b/src/test/debuginfo/pretty-std.rs @@ -129,10 +129,24 @@ // NOTE: cdb fails to interpret debug info of Option enums on i686. // cdb-check:some_string [Type: enum$, 1, [...], Some>] +// cdb-command: dx linkedlist +// cdb-check:linkedlist : { len=0x2 } [Type: alloc::collections::linked_list::LinkedList] +// cdb-check: [] [Type: alloc::collections::linked_list::LinkedList] +// cdb-check: [0x0] : 128 [Type: int] +// cdb-check: [0x1] : 42 [Type: int] + +// cdb-command: dx vecdeque +// cdb-check:vecdeque : { len=0x2 } [Type: alloc::collections::vec_deque::VecDeque] +// cdb-check: [] [Type: alloc::collections::vec_deque::VecDeque] +// cdb-check: [len] : 0x2 +// cdb-check: [capacity] : 0x8 [Type: unsigned __int64] +// cdb-check: [0x0] : 90 [Type: int] +// cdb-check: [0x1] : 20 [Type: int] + #![allow(unused_variables)] +use std::collections::{LinkedList, VecDeque}; use std::ffi::OsString; - fn main() { // &[] @@ -156,6 +170,16 @@ fn main() { let some_string = Some("IAMA optional string!".to_owned()); + // LinkedList + let mut linkedlist = LinkedList::new(); + linkedlist.push_back(42); + linkedlist.push_front(128); + + // VecDeque + let mut vecdeque = VecDeque::new(); + vecdeque.push_back(20); + vecdeque.push_front(90); + zzz(); // #break } diff --git a/src/test/debuginfo/rc_arc.rs b/src/test/debuginfo/rc_arc.rs index 6e558bd3c13aa..24623bc972e9f 100644 --- a/src/test/debuginfo/rc_arc.rs +++ b/src/test/debuginfo/rc_arc.rs @@ -29,22 +29,31 @@ // cdb-command:dx r,d // cdb-check:r,d : 42 [Type: alloc::rc::Rc] +// cdb-check: [] [Type: alloc::rc::Rc] +// cdb-check: [Reference count] : 2 [Type: core::cell::Cell] // cdb-command:dx r1,d // cdb-check:r1,d : 42 [Type: alloc::rc::Rc] +// cdb-check: [] [Type: alloc::rc::Rc] +// cdb-check: [Reference count] : 2 [Type: core::cell::Cell] // cdb-command:dx w1,d -// cdb-check:w1,d [Type: alloc::rc::Weak] -// cdb-check: [...] ptr : [...] [Type: core::ptr::non_null::NonNull >] +// cdb-check:w1,d : 42 [Type: alloc::rc::Weak] +// cdb-check: [] [Type: alloc::rc::Weak] // cdb-command:dx a,d // cdb-check:a,d : 42 [Type: alloc::sync::Arc] +// cdb-check: [] [Type: alloc::sync::Arc] +// cdb-check: [Reference count] : 2 [Type: core::sync::atomic::AtomicUsize] // cdb-command:dx a1,d // cdb-check:a1,d : 42 [Type: alloc::sync::Arc] +// cdb-check: [] [Type: alloc::sync::Arc] +// cdb-check: [Reference count] : 2 [Type: core::sync::atomic::AtomicUsize] // cdb-command:dx w2,d // cdb-check:w2,d : 42 [Type: alloc::sync::Weak] +// cdb-check: [] [Type: alloc::sync::Weak] use std::rc::Rc; use std::sync::Arc; From 85002741a26d6fdf6578e33aaaeace7c04c6254a Mon Sep 17 00:00:00 2001 From: Wesley Wiser Date: Thu, 1 Jul 2021 15:57:12 -0400 Subject: [PATCH 08/20] Add visualizer for OsString and fixup other string visualizers --- src/etc/natvis/intrinsic.natvis | 4 ++-- src/etc/natvis/libstd.natvis | 16 +++++++++++++++- src/test/debuginfo/pretty-std.rs | 5 +++-- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/etc/natvis/intrinsic.natvis b/src/etc/natvis/intrinsic.natvis index 52e5d37c83fbd..558536fa613a5 100644 --- a/src/etc/natvis/intrinsic.natvis +++ b/src/etc/natvis/intrinsic.natvis @@ -1,8 +1,8 @@ - {data_ptr,[length]s8} - data_ptr,[length]s8 + {(char*)data_ptr,[length]s8} + (char*)data_ptr,[length]s8 length diff --git a/src/etc/natvis/libstd.natvis b/src/etc/natvis/libstd.natvis index 3ccd2e9c30ed5..25094fc8409e1 100644 --- a/src/etc/natvis/libstd.natvis +++ b/src/etc/natvis/libstd.natvis @@ -74,7 +74,7 @@ - {inner.data_ptr,s} + {(char*)inner.data_ptr} @@ -101,4 +101,18 @@ + + + {(char*)inner.inner.bytes.buf.ptr.pointer,[inner.inner.bytes.len]} + + + + + inner.inner.bytes.len + (char*)inner.inner.bytes.buf.ptr.pointer + + + + + diff --git a/src/test/debuginfo/pretty-std.rs b/src/test/debuginfo/pretty-std.rs index a2074c43dfaca..51325cd4249ad 100644 --- a/src/test/debuginfo/pretty-std.rs +++ b/src/test/debuginfo/pretty-std.rs @@ -111,8 +111,9 @@ // cdb-check: [11] : 33 '!' [Type: char] // cdb-command: dx os_string -// cdb-check:os_string [Type: [...]::OsString] -// NOTE: OsString doesn't have a .natvis entry yet. +// cdb-check:os_string : "IAMA OS string 😃" [Type: std::ffi::os_str::OsString] +// cdb-check: [] [Type: std::ffi::os_str::OsString] +// cdb-check: [chars] // cdb-command: dx some // cdb-check:some : Some [Type: enum$ >] From d1852e10545c65cec73ea296436840e67309d82c Mon Sep 17 00:00:00 2001 From: Wesley Wiser Date: Fri, 9 Jul 2021 12:52:28 -0400 Subject: [PATCH 09/20] Respond to review feedback --- src/etc/natvis/liballoc.natvis | 1 + src/etc/natvis/libcore.natvis | 4 ++-- src/etc/natvis/libstd.natvis | 2 ++ src/test/debuginfo/duration-type.rs | 4 ++-- src/test/debuginfo/marker-types.rs | 4 ++-- src/test/debuginfo/pretty-std.rs | 2 +- 6 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/etc/natvis/liballoc.natvis b/src/etc/natvis/liballoc.natvis index 707643152c946..b9454573de8ea 100644 --- a/src/etc/natvis/liballoc.natvis +++ b/src/etc/natvis/liballoc.natvis @@ -48,6 +48,7 @@ vec.len vec.buf.cap + {(char*)vec.buf.ptr.pointer,[vec.len]s8} vec.len diff --git a/src/etc/natvis/libcore.natvis b/src/etc/natvis/libcore.natvis index abac2cefa3886..fa8ee2d70bbab 100644 --- a/src/etc/natvis/libcore.natvis +++ b/src/etc/natvis/libcore.natvis @@ -156,8 +156,8 @@ {secs,d}s {nanos,d}ns - secs - nanos + secs,d + nanos,d diff --git a/src/etc/natvis/libstd.natvis b/src/etc/natvis/libstd.natvis index 25094fc8409e1..c7be0167de9fd 100644 --- a/src/etc/natvis/libstd.natvis +++ b/src/etc/natvis/libstd.natvis @@ -77,6 +77,7 @@ {(char*)inner.data_ptr} + {(char*)inner.data_ptr} inner.length @@ -106,6 +107,7 @@ {(char*)inner.inner.bytes.buf.ptr.pointer,[inner.inner.bytes.len]} + {(char*)inner.inner.bytes.buf.ptr.pointer,[inner.inner.bytes.len]} inner.inner.bytes.len diff --git a/src/test/debuginfo/duration-type.rs b/src/test/debuginfo/duration-type.rs index 3a7f9f78b5fed..bc0266d644ec1 100644 --- a/src/test/debuginfo/duration-type.rs +++ b/src/test/debuginfo/duration-type.rs @@ -8,8 +8,8 @@ // cdb-command: dx duration // cdb-check:duration : 5s 12ns [Type: core::time::Duration] // cdb-check: [] [Type: core::time::Duration] -// cdb-check: seconds : 0x5 [Type: unsigned __int64] -// cdb-check: nanoseconds : 0xc [Type: unsigned int] +// cdb-check: seconds : 5 [Type: unsigned __int64] +// cdb-check: nanoseconds : 12 [Type: unsigned int] use std::time::Duration; diff --git a/src/test/debuginfo/marker-types.rs b/src/test/debuginfo/marker-types.rs index de4e8311a4fc3..52d70bda908d5 100644 --- a/src/test/debuginfo/marker-types.rs +++ b/src/test/debuginfo/marker-types.rs @@ -8,7 +8,7 @@ // cdb-command: dx nonnull // cdb-check:nonnull : NonNull(0x[...]: 0xc) [Type: core::ptr::non_null::NonNull] // cdb-check: [] [Type: core::ptr::non_null::NonNull] -// cdb-checK: 0xc [Type: unsigned int] +// cdb-check: 0xc [Type: unsigned int] // cdb-command: dx manuallydrop // cdb-check:manuallydrop : 12345 [Type: core::mem::manually_drop::ManuallyDrop] @@ -19,7 +19,7 @@ // cdb-check: [] [Type: core::pin::Pin >] // cdb-check: [len] : 0x4 [Type: unsigned __int64] // cdb-check: [capacity] : 0x4 [Type: unsigned __int64] -// cdb-check: [chars] +// cdb-check: [chars] : "this" use std::mem::ManuallyDrop; use std::pin::Pin; diff --git a/src/test/debuginfo/pretty-std.rs b/src/test/debuginfo/pretty-std.rs index 51325cd4249ad..303f0114b1734 100644 --- a/src/test/debuginfo/pretty-std.rs +++ b/src/test/debuginfo/pretty-std.rs @@ -113,7 +113,7 @@ // cdb-command: dx os_string // cdb-check:os_string : "IAMA OS string 😃" [Type: std::ffi::os_str::OsString] // cdb-check: [] [Type: std::ffi::os_str::OsString] -// cdb-check: [chars] +// cdb-check: [chars] : "IAMA OS string 😃" // cdb-command: dx some // cdb-check:some : Some [Type: enum$ >] From 14fdf8a115da7e88721dcbef6b35d8c6eab074f2 Mon Sep 17 00:00:00 2001 From: Wesley Wiser Date: Mon, 12 Jul 2021 13:26:01 -0400 Subject: [PATCH 10/20] Add test for `Unique`, weak ref counts and ref counts for `Weak` --- src/etc/natvis/liballoc.natvis | 6 ++++++ src/test/debuginfo/marker-types.rs | 12 +++++++++++- src/test/debuginfo/rc_arc.rs | 8 ++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/etc/natvis/liballoc.natvis b/src/etc/natvis/liballoc.natvis index b9454573de8ea..d001f40fccbc7 100644 --- a/src/etc/natvis/liballoc.natvis +++ b/src/etc/natvis/liballoc.natvis @@ -64,12 +64,15 @@ ptr.pointer->value ptr.pointer->strong + ptr.pointer->weak {ptr.pointer->value} ptr.pointer->value + ptr.pointer->strong + ptr.pointer->weak @@ -78,12 +81,15 @@ ptr.pointer->data ptr.pointer->strong + ptr.pointer->weak {ptr.pointer->data} ptr.pointer->data + ptr.pointer->strong + ptr.pointer->weak diff --git a/src/test/debuginfo/marker-types.rs b/src/test/debuginfo/marker-types.rs index 52d70bda908d5..f27a5d20c70db 100644 --- a/src/test/debuginfo/marker-types.rs +++ b/src/test/debuginfo/marker-types.rs @@ -21,9 +21,17 @@ // cdb-check: [capacity] : 0x4 [Type: unsigned __int64] // cdb-check: [chars] : "this" +// cdb-command: dx unique +// cdb-check:unique : Unique(0x[...]: (0x2a, 4321)) [Type: core::ptr::unique::Unique >] +// cdb-check: [] [Type: core::ptr::unique::Unique >] +// cdb-check: [0] : 0x2a [Type: unsigned __int64] +// cdb-check: [1] : 4321 [Type: int] + +#![feature(ptr_internals)] + use std::mem::ManuallyDrop; use std::pin::Pin; -use std::ptr::NonNull; +use std::ptr::{NonNull, Unique}; fn main() { let nonnull: NonNull<_> = (&12u32).into(); @@ -33,6 +41,8 @@ fn main() { let mut s = "this".to_string(); let pin = Pin::new(&mut s); + let unique: Unique<_> = (&mut (42u64, 4321i32)).into(); + zzz(); // #break } diff --git a/src/test/debuginfo/rc_arc.rs b/src/test/debuginfo/rc_arc.rs index 24623bc972e9f..55cddf7c6c6b4 100644 --- a/src/test/debuginfo/rc_arc.rs +++ b/src/test/debuginfo/rc_arc.rs @@ -31,29 +31,37 @@ // cdb-check:r,d : 42 [Type: alloc::rc::Rc] // cdb-check: [] [Type: alloc::rc::Rc] // cdb-check: [Reference count] : 2 [Type: core::cell::Cell] +// cdb-check: [Weak reference count] : 2 [Type: core::cell::Cell] // cdb-command:dx r1,d // cdb-check:r1,d : 42 [Type: alloc::rc::Rc] // cdb-check: [] [Type: alloc::rc::Rc] // cdb-check: [Reference count] : 2 [Type: core::cell::Cell] +// cdb-check: [Weak reference count] : 2 [Type: core::cell::Cell] // cdb-command:dx w1,d // cdb-check:w1,d : 42 [Type: alloc::rc::Weak] // cdb-check: [] [Type: alloc::rc::Weak] +// cdb-check: [Reference count] : 2 [Type: core::cell::Cell] +// cdb-check: [Weak reference count] : 2 [Type: core::cell::Cell] // cdb-command:dx a,d // cdb-check:a,d : 42 [Type: alloc::sync::Arc] // cdb-check: [] [Type: alloc::sync::Arc] // cdb-check: [Reference count] : 2 [Type: core::sync::atomic::AtomicUsize] +// cdb-check: [Weak reference count] : 2 [Type: core::sync::atomic::AtomicUsize] // cdb-command:dx a1,d // cdb-check:a1,d : 42 [Type: alloc::sync::Arc] // cdb-check: [] [Type: alloc::sync::Arc] // cdb-check: [Reference count] : 2 [Type: core::sync::atomic::AtomicUsize] +// cdb-check: [Weak reference count] : 2 [Type: core::sync::atomic::AtomicUsize] // cdb-command:dx w2,d // cdb-check:w2,d : 42 [Type: alloc::sync::Weak] // cdb-check: [] [Type: alloc::sync::Weak] +// cdb-check: [Reference count] : 2 [Type: core::sync::atomic::AtomicUsize] +// cdb-check: [Weak reference count] : 2 [Type: core::sync::atomic::AtomicUsize] use std::rc::Rc; use std::sync::Arc; From 10b65c821fec2a37aa30e4ac7e2190981a8a49ef Mon Sep 17 00:00:00 2001 From: Stein Somers Date: Wed, 18 Nov 2020 18:19:38 +0100 Subject: [PATCH 11/20] Make BTreeSet::split_off name elements like other set methods do --- library/alloc/src/collections/btree/set.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/library/alloc/src/collections/btree/set.rs b/library/alloc/src/collections/btree/set.rs index 45ea30b538691..be740b05fb8ee 100644 --- a/library/alloc/src/collections/btree/set.rs +++ b/library/alloc/src/collections/btree/set.rs @@ -903,8 +903,8 @@ impl BTreeSet { self.map.append(&mut other.map); } - /// Splits the collection into two at the given key. Returns everything after the given key, - /// including the key. + /// Splits the collection into two at the given value. Returns everything after the given value, + /// including the value. /// /// # Examples /// @@ -933,11 +933,11 @@ impl BTreeSet { /// assert!(b.contains(&41)); /// ``` #[stable(feature = "btree_split_off", since = "1.11.0")] - pub fn split_off(&mut self, key: &Q) -> Self + pub fn split_off(&mut self, value: &Q) -> Self where T: Borrow + Ord, { - BTreeSet { map: self.map.split_off(key) } + BTreeSet { map: self.map.split_off(value) } } /// Creates an iterator that visits all values in ascending order and uses a closure From 28a50b376a2117c0ed23a70b64ee2b7505dcaf10 Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Tue, 13 Jul 2021 16:55:40 +0900 Subject: [PATCH 12/20] Unignore some pretty printing tests --- src/test/ui/issues/issue-20427.rs | 1 - src/test/ui/issues/issue-22992.rs | 1 - src/test/ui/issues/issue-23338-ensure-param-drop-order.rs | 2 -- src/test/ui/issues/issue-27401-dropflag-reinit.rs | 1 - 4 files changed, 5 deletions(-) diff --git a/src/test/ui/issues/issue-20427.rs b/src/test/ui/issues/issue-20427.rs index 41922c6229351..cfd8b2191ac38 100644 --- a/src/test/ui/issues/issue-20427.rs +++ b/src/test/ui/issues/issue-20427.rs @@ -7,7 +7,6 @@ #![allow(deprecated, deprecated_in_future)] // aux-build:i8.rs -// ignore-pretty issue #37201 extern crate i8; use std::string as i16; diff --git a/src/test/ui/issues/issue-22992.rs b/src/test/ui/issues/issue-22992.rs index e2ae1f96ee533..292a0ae298dcf 100644 --- a/src/test/ui/issues/issue-22992.rs +++ b/src/test/ui/issues/issue-22992.rs @@ -1,5 +1,4 @@ // run-pass -// ignore-pretty issue #37201 struct X { val: i32 } impl std::ops::Deref for X { diff --git a/src/test/ui/issues/issue-23338-ensure-param-drop-order.rs b/src/test/ui/issues/issue-23338-ensure-param-drop-order.rs index 823be8c832d09..a99f260dde3b2 100644 --- a/src/test/ui/issues/issue-23338-ensure-param-drop-order.rs +++ b/src/test/ui/issues/issue-23338-ensure-param-drop-order.rs @@ -1,8 +1,6 @@ // run-pass #![allow(non_upper_case_globals)] -// ignore-pretty issue #37201 - // This test is ensuring that parameters are indeed dropped after // temporaries in a fn body. diff --git a/src/test/ui/issues/issue-27401-dropflag-reinit.rs b/src/test/ui/issues/issue-27401-dropflag-reinit.rs index e137575c2f825..ab54af29bd6b9 100644 --- a/src/test/ui/issues/issue-27401-dropflag-reinit.rs +++ b/src/test/ui/issues/issue-27401-dropflag-reinit.rs @@ -1,5 +1,4 @@ // run-pass -// ignore-pretty issue #37201 // Check that when a `let`-binding occurs in a loop, its associated // drop-flag is reinitialized (to indicate "needs-drop" at the end of From b09084cbb6f391c2efe7da26c70983d810c23c33 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Mon, 12 Jul 2021 16:32:26 +0200 Subject: [PATCH 13/20] Fix search result description text color for ayu theme --- src/librustdoc/html/static/css/themes/ayu.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/librustdoc/html/static/css/themes/ayu.css b/src/librustdoc/html/static/css/themes/ayu.css index 171d06c0a3667..1ef9ae3321f9f 100644 --- a/src/librustdoc/html/static/css/themes/ayu.css +++ b/src/librustdoc/html/static/css/themes/ayu.css @@ -161,7 +161,7 @@ pre, .rustdoc.source .example-wrap { .search-results a { color: #0096cf; } -.search-results a span.desc { +.search-results a div.desc { color: #c5c5c5; } From f0169e923b4c47b6fdf263d8e060a9c4e84c94e4 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Mon, 12 Jul 2021 16:48:25 +0200 Subject: [PATCH 14/20] Add test for search results colors --- src/test/rustdoc-gui/search-result-color.goml | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/test/rustdoc-gui/search-result-color.goml diff --git a/src/test/rustdoc-gui/search-result-color.goml b/src/test/rustdoc-gui/search-result-color.goml new file mode 100644 index 0000000000000..c138cc8d9c61a --- /dev/null +++ b/src/test/rustdoc-gui/search-result-color.goml @@ -0,0 +1,32 @@ +// The goal of this test is to ensure the color of the text is the one expected. +goto: file://|DOC_PATH|/test_docs/index.html?search=coo + +// This is needed so that the text color is computed. +show-text: true + +// Ayu theme +local-storage: {"rustdoc-theme": "ayu", "rustdoc-preferred-dark-theme": "ayu", "rustdoc-use-system-theme": "false"} +reload: + +// Waiting for the search results to appear... +wait-for: "#titles" +assert-css: ("//*[@class='desc']//*[text()='Just a normal struct.']", {"color": "rgb(197, 197, 197)"}) +assert-css: ("//*[@class='result-name']/*[text()='test_docs::']", {"color": "rgb(0, 150, 207)"}) + +// Dark theme +local-storage: {"rustdoc-theme": "dark", "rustdoc-preferred-dark-theme": "dark", "rustdoc-use-system-theme": "false"} +reload: + +// Waiting for the search results to appear... +wait-for: "#titles" +assert-css: ("//*[@class='desc']//*[text()='Just a normal struct.']", {"color": "rgb(221, 221, 221)"}) +assert-css: ("//*[@class='result-name']/*[text()='test_docs::']", {"color": "rgb(221, 221, 221)"}) + +// Light theme +local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"} +reload: + +// Waiting for the search results to appear... +wait-for: "#titles" +assert-css: ("//*[@class='desc']//*[text()='Just a normal struct.']", {"color": "rgb(0, 0, 0)"}) +assert-css: ("//*[@class='result-name']/*[text()='test_docs::']", {"color": "rgb(0, 0, 0)"}) From 168b4d490bd15c5eb0055cd748e7fbb4a5851456 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Mon, 12 Jul 2021 17:42:53 +0200 Subject: [PATCH 15/20] Fix color for keyword/primitive search result --- src/librustdoc/html/static/css/themes/ayu.css | 2 +- src/librustdoc/html/static/css/themes/dark.css | 2 +- src/librustdoc/html/static/css/themes/light.css | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/librustdoc/html/static/css/themes/ayu.css b/src/librustdoc/html/static/css/themes/ayu.css index 1ef9ae3321f9f..9da3fe07adea0 100644 --- a/src/librustdoc/html/static/css/themes/ayu.css +++ b/src/librustdoc/html/static/css/themes/ayu.css @@ -286,7 +286,7 @@ details.undocumented > summary::before { color: grey; } -tr.result span.primitive::after, tr.result span.keyword::after { +.result-name .primitive > i, .result-name .keyword > i { color: #788797; } diff --git a/src/librustdoc/html/static/css/themes/dark.css b/src/librustdoc/html/static/css/themes/dark.css index d9ea28058ad99..599fb942dbe2a 100644 --- a/src/librustdoc/html/static/css/themes/dark.css +++ b/src/librustdoc/html/static/css/themes/dark.css @@ -247,7 +247,7 @@ details.undocumented > summary::before { color: grey; } -tr.result span.primitive::after, tr.result span.keyword::after { +.result-name .primitive > i, .result-name .keyword > i { color: #ddd; } diff --git a/src/librustdoc/html/static/css/themes/light.css b/src/librustdoc/html/static/css/themes/light.css index 6785b79ffda96..0c2799727f3e3 100644 --- a/src/librustdoc/html/static/css/themes/light.css +++ b/src/librustdoc/html/static/css/themes/light.css @@ -237,7 +237,7 @@ details.undocumented > summary::before { color: grey; } -tr.result span.primitive::after, tr.result span.keyword::after { +.result-name .primitive > i, .result-name .keyword > i { color: black; } From b8264a862f045de899d79e149d7ba4bd15adb6a3 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Mon, 12 Jul 2021 17:42:59 +0200 Subject: [PATCH 16/20] Add test for keyword/primitive text color --- src/test/rustdoc-gui/search-result-color.goml | 9 +++++++++ src/test/rustdoc-gui/src/test_docs/lib.rs | 1 + 2 files changed, 10 insertions(+) diff --git a/src/test/rustdoc-gui/search-result-color.goml b/src/test/rustdoc-gui/search-result-color.goml index c138cc8d9c61a..bb8ecb98fa387 100644 --- a/src/test/rustdoc-gui/search-result-color.goml +++ b/src/test/rustdoc-gui/search-result-color.goml @@ -13,6 +13,9 @@ wait-for: "#titles" assert-css: ("//*[@class='desc']//*[text()='Just a normal struct.']", {"color": "rgb(197, 197, 197)"}) assert-css: ("//*[@class='result-name']/*[text()='test_docs::']", {"color": "rgb(0, 150, 207)"}) +// Checking the color for "keyword". +assert-css: ("//*[@class='result-name']//*[text()='(keyword)']", {"color": "rgb(120, 135, 151)"}) + // Dark theme local-storage: {"rustdoc-theme": "dark", "rustdoc-preferred-dark-theme": "dark", "rustdoc-use-system-theme": "false"} reload: @@ -22,6 +25,9 @@ wait-for: "#titles" assert-css: ("//*[@class='desc']//*[text()='Just a normal struct.']", {"color": "rgb(221, 221, 221)"}) assert-css: ("//*[@class='result-name']/*[text()='test_docs::']", {"color": "rgb(221, 221, 221)"}) +// Checking the color for "keyword". +assert-css: ("//*[@class='result-name']//*[text()='(keyword)']", {"color": "rgb(221, 221, 221)"}) + // Light theme local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"} reload: @@ -30,3 +36,6 @@ reload: wait-for: "#titles" assert-css: ("//*[@class='desc']//*[text()='Just a normal struct.']", {"color": "rgb(0, 0, 0)"}) assert-css: ("//*[@class='result-name']/*[text()='test_docs::']", {"color": "rgb(0, 0, 0)"}) + +// Checking the color for "keyword". +assert-css: ("//*[@class='result-name']//*[text()='(keyword)']", {"color": "rgb(0, 0, 0)"}) diff --git a/src/test/rustdoc-gui/src/test_docs/lib.rs b/src/test/rustdoc-gui/src/test_docs/lib.rs index 3e753cb4de8b1..1b9f652120e94 100644 --- a/src/test/rustdoc-gui/src/test_docs/lib.rs +++ b/src/test/rustdoc-gui/src/test_docs/lib.rs @@ -101,6 +101,7 @@ pub enum AnEnum { } #[doc(keyword = "CookieMonster")] +/// Some keyword. pub mod keyword {} /// Just some type alias. From 106d5a65bafd2bdacaf3d76d45b1e412fc78df5b Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sun, 11 Jul 2021 12:40:31 +0200 Subject: [PATCH 17/20] Fix display for non-rust code blocks --- src/librustdoc/html/markdown.rs | 50 ++++++++++++++-------- src/librustdoc/html/static/css/rustdoc.css | 2 +- 2 files changed, 33 insertions(+), 19 deletions(-) diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs index 9fff508165a10..e488a76f2806e 100644 --- a/src/librustdoc/html/markdown.rs +++ b/src/librustdoc/html/markdown.rs @@ -207,26 +207,11 @@ impl<'a, I: Iterator>> Iterator for CodeBlocks<'_, 'a, I> { let should_panic; let ignore; let edition; - if let Some(Event::Start(Tag::CodeBlock(kind))) = event { - let parse_result = match kind { - CodeBlockKind::Fenced(ref lang) => { - LangString::parse_without_check(&lang, self.check_error_codes, false) - } - CodeBlockKind::Indented => Default::default(), - }; - if !parse_result.rust { - return Some(Event::Start(Tag::CodeBlock(kind))); - } - compile_fail = parse_result.compile_fail; - should_panic = parse_result.should_panic; - ignore = parse_result.ignore; - edition = parse_result.edition; + let kind = if let Some(Event::Start(Tag::CodeBlock(kind))) = event { + kind } else { return event; - } - - let explicit_edition = edition.is_some(); - let edition = edition.unwrap_or(self.edition); + }; let mut origtext = String::new(); for event in &mut self.inner { @@ -241,6 +226,35 @@ impl<'a, I: Iterator>> Iterator for CodeBlocks<'_, 'a, I> { let lines = origtext.lines().filter_map(|l| map_line(l).for_html()); let text = lines.collect::>>().join("\n"); + let parse_result = match kind { + CodeBlockKind::Fenced(ref lang) => { + let parse_result = + LangString::parse_without_check(&lang, self.check_error_codes, false); + if !parse_result.rust { + return Some(Event::Html( + format!( + "
\ + {}\ +
", + format!(" class=\"language-{}\"", lang), + text, + ) + .into(), + )); + } + parse_result + } + CodeBlockKind::Indented => Default::default(), + }; + + compile_fail = parse_result.compile_fail; + should_panic = parse_result.should_panic; + ignore = parse_result.ignore; + edition = parse_result.edition; + + let explicit_edition = edition.is_some(); + let edition = edition.unwrap_or(self.edition); + let playground_button = self.playground.as_ref().and_then(|playground| { let krate = &playground.crate_name; let url = &playground.url; diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index 66dfd2fac84c6..208e8f723f407 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -435,7 +435,7 @@ nav.sub { border-bottom-left-radius: 5px; } -.rustdoc:not(.source) .example-wrap > pre.rust { +.rustdoc:not(.source) .example-wrap > pre:not(.line-number) { width: 100%; overflow-x: auto; } From 09270edd3430323c760cf2526b19c9813829284a Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sun, 11 Jul 2021 13:06:48 +0200 Subject: [PATCH 18/20] Add test for codeblocks overflow --- src/test/rustdoc-gui/code-blocks-overflow.goml | 8 ++++++++ src/test/rustdoc-gui/src/lib2/lib.rs | 14 ++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 src/test/rustdoc-gui/code-blocks-overflow.goml diff --git a/src/test/rustdoc-gui/code-blocks-overflow.goml b/src/test/rustdoc-gui/code-blocks-overflow.goml new file mode 100644 index 0000000000000..ee4dad444e932 --- /dev/null +++ b/src/test/rustdoc-gui/code-blocks-overflow.goml @@ -0,0 +1,8 @@ +// This test ensures that codeblocks content don't overflow. +goto: file://|DOC_PATH|/lib2/sub_mod/struct.Foo.html +size: (1080, 600) +// There should be two codeblocks: a rust one and a non-rust one. +assert-count: (".docblock > .example-wrap", 2) +assert: ".docblock > .example-wrap > .language-txt" +assert: ".docblock > .example-wrap > .rust-example-rendered" +assert-css: (".docblock > .example-wrap > pre", {"width": "796px", "overflow-x": "auto"}, ALL) diff --git a/src/test/rustdoc-gui/src/lib2/lib.rs b/src/test/rustdoc-gui/src/lib2/lib.rs index 72ef3cbd2026d..ec8ab339e2804 100644 --- a/src/test/rustdoc-gui/src/lib2/lib.rs +++ b/src/test/rustdoc-gui/src/lib2/lib.rs @@ -1,3 +1,5 @@ +// ignore-tidy-linelength + pub mod module { pub mod sub_module { pub mod sub_sub_module { @@ -32,4 +34,16 @@ impl Trait for Foo { const Y: u32 = 0; } + impl implementors::Whatever for Foo {} + +pub mod sub_mod { + /// ```txt + /// aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + /// ``` + /// + /// ``` + /// aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + /// ``` + pub struct Foo; +} From da56618ff9ea1295d108c58002b744223898cb2b Mon Sep 17 00:00:00 2001 From: Michael Woerister Date: Mon, 12 Jul 2021 15:12:49 +0200 Subject: [PATCH 19/20] Handle non-integer const generic parameters in debuginfo type names. --- .../src/debuginfo/type_names.rs | 81 ++++++++++++++----- src/test/debuginfo/function-names.rs | 28 ++++++- 2 files changed, 90 insertions(+), 19 deletions(-) diff --git a/compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs b/compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs index b3c14d9072cce..25268d9a5552f 100644 --- a/compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs +++ b/compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs @@ -12,12 +12,15 @@ // * `"` is treated as the start of a string. use rustc_data_structures::fx::FxHashSet; +use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_hir as hir; use rustc_hir::def_id::DefId; use rustc_hir::definitions::{DefPathData, DefPathDataName, DisambiguatedDefPathData}; +use rustc_middle::ich::NodeIdHashingMode; +use rustc_middle::ty::layout::IntegerExt; use rustc_middle::ty::subst::{GenericArgKind, SubstsRef}; use rustc_middle::ty::{self, AdtDef, Ty, TyCtxt}; -use rustc_target::abi::{TagEncoding, Variants}; +use rustc_target::abi::{Integer, TagEncoding, Variants}; use std::fmt::Write; @@ -47,7 +50,7 @@ pub fn push_debuginfo_type_name<'tcx>( ) { // When targeting MSVC, emit C++ style type names for compatibility with // .natvis visualizers (and perhaps other existing native debuggers?) - let cpp_like_names = tcx.sess.target.is_like_msvc; + let cpp_like_names = cpp_like_names(tcx); match *t.kind() { ty::Bool => output.push_str("bool"), @@ -424,8 +427,6 @@ fn push_unqualified_item_name( disambiguated_data: DisambiguatedDefPathData, output: &mut String, ) { - let cpp_like_names = tcx.sess.target.is_like_msvc; - match disambiguated_data.data { DefPathData::CrateRoot => { output.push_str(&tcx.crate_name(def_id.krate).as_str()); @@ -433,7 +434,7 @@ fn push_unqualified_item_name( DefPathData::ClosureExpr if tcx.generator_kind(def_id).is_some() => { // Generators look like closures, but we want to treat them differently // in the debug info. - if cpp_like_names { + if cpp_like_names(tcx) { write!(output, "generator${}", disambiguated_data.disambiguator).unwrap(); } else { write!(output, "{{generator#{}}}", disambiguated_data.disambiguator).unwrap(); @@ -444,7 +445,7 @@ fn push_unqualified_item_name( output.push_str(&name.as_str()); } DefPathDataName::Anon { namespace } => { - if cpp_like_names { + if cpp_like_names(tcx) { write!(output, "{}${}", namespace, disambiguated_data.disambiguator).unwrap(); } else { write!(output, "{{{}#{}}}", namespace, disambiguated_data.disambiguator) @@ -478,19 +479,14 @@ fn push_generic_params_internal<'tcx>( match type_parameter { GenericArgKind::Type(type_parameter) => { push_debuginfo_type_name(tcx, type_parameter, true, output, visited); - output.push_str(", "); - } - GenericArgKind::Const(const_parameter) => match const_parameter.val { - ty::ConstKind::Param(param) => write!(output, "{}, ", param.name).unwrap(), - _ => write!( - output, - "0x{:x}, ", - const_parameter.eval_bits(tcx, ty::ParamEnv::reveal_all(), const_parameter.ty) - ) - .unwrap(), - }, + } + GenericArgKind::Const(ct) => { + push_const_param(tcx, ct, output); + } other => bug!("Unexpected non-erasable generic: {:?}", other), } + + output.push_str(", "); } output.pop(); @@ -499,6 +495,51 @@ fn push_generic_params_internal<'tcx>( push_close_angle_bracket(tcx, output); } +fn push_const_param<'tcx>(tcx: TyCtxt<'tcx>, ct: &'tcx ty::Const<'tcx>, output: &mut String) { + match ct.val { + ty::ConstKind::Param(param) => { + write!(output, "{}", param.name) + } + _ => match ct.ty.kind() { + ty::Int(ity) => { + let bits = ct.eval_bits(tcx, ty::ParamEnv::reveal_all(), ct.ty); + let val = Integer::from_int_ty(&tcx, *ity).size().sign_extend(bits) as i128; + write!(output, "{}", val) + } + ty::Uint(_) => { + let val = ct.eval_bits(tcx, ty::ParamEnv::reveal_all(), ct.ty); + write!(output, "{}", val) + } + ty::Bool => { + let val = ct.try_eval_bool(tcx, ty::ParamEnv::reveal_all()).unwrap(); + write!(output, "{}", val) + } + _ => { + // If we cannot evaluate the constant to a known type, we fall back + // to emitting a stable hash value of the constant. This isn't very pretty + // but we get a deterministic, virtually unique value for the constant. + let hcx = &mut tcx.create_stable_hashing_context(); + let mut hasher = StableHasher::new(); + hcx.while_hashing_spans(false, |hcx| { + hcx.with_node_id_hashing_mode(NodeIdHashingMode::HashDefPath, |hcx| { + ct.val.hash_stable(hcx, &mut hasher); + }); + }); + // Let's only emit 64 bits of the hash value. That should be plenty for + // avoiding collisions and will make the emitted type names shorter. + let hash: u64 = hasher.finish(); + + if cpp_like_names(tcx) { + write!(output, "CONST${:x}", hash) + } else { + write!(output, "{{CONST#{:x}}}", hash) + } + } + }, + } + .unwrap(); +} + pub fn push_generic_params<'tcx>(tcx: TyCtxt<'tcx>, substs: SubstsRef<'tcx>, output: &mut String) { let mut visited = FxHashSet::default(); push_generic_params_internal(tcx, substs, output, &mut visited); @@ -507,9 +548,13 @@ pub fn push_generic_params<'tcx>(tcx: TyCtxt<'tcx>, substs: SubstsRef<'tcx>, out fn push_close_angle_bracket<'tcx>(tcx: TyCtxt<'tcx>, output: &mut String) { // MSVC debugger always treats `>>` as a shift, even when parsing templates, // so add a space to avoid confusion. - if tcx.sess.target.is_like_msvc && output.ends_with('>') { + if cpp_like_names(tcx) && output.ends_with('>') { output.push(' ') }; output.push('>'); } + +fn cpp_like_names(tcx: TyCtxt<'_>) -> bool { + tcx.sess.target.is_like_msvc +} diff --git a/src/test/debuginfo/function-names.rs b/src/test/debuginfo/function-names.rs index 26317f5c3ff32..54e270b24dc6a 100644 --- a/src/test/debuginfo/function-names.rs +++ b/src/test/debuginfo/function-names.rs @@ -33,6 +33,13 @@ // Generator // Generators don't seem to appear in GDB's symbol table. +// Const generic parameter +// gdb-command:info functions -q function_names::const_generic_fn.* +// gdb-check:[...]static fn function_names::const_generic_fn_bool(); +// gdb-check:[...]static fn function_names::const_generic_fn_non_int(); +// gdb-check:[...]static fn function_names::const_generic_fn_signed_int(); +// gdb-check:[...]static fn function_names::const_generic_fn_unsigned_int(); + // === CDB TESTS =================================================================================== // Top-level function @@ -65,10 +72,18 @@ // cdb-command:x a!function_names::*::generator* // cdb-check:[...] a!function_names::main::generator$1 (void) +// Const generic parameter +// cdb-command:x a!function_names::const_generic_fn* +// cdb-check:[...] a!function_names::const_generic_fn_bool (void) +// cdb-check:[...] a!function_names::const_generic_fn_non_int (void) +// cdb-check:[...] a!function_names::const_generic_fn_signed_int<-7> (void) +// cdb-check:[...] a!function_names::const_generic_fn_unsigned_int<14> (void) + #![allow(unused_variables)] #![feature(omit_gdb_pretty_printer_section)] #![omit_gdb_pretty_printer_section] -#![feature(generators, generator_trait)] +#![feature(const_generics, generators, generator_trait)] +#![allow(incomplete_features)] // for const_generics use Mod1::TestTrait2; use std::ops::Generator; @@ -97,6 +112,12 @@ fn main() { // Generator let mut generator = || { yield; return; }; Pin::new(&mut generator).resume(()); + + // Const generic functions + const_generic_fn_bool::(); + const_generic_fn_non_int::<{()}>(); + const_generic_fn_signed_int::<-7>(); + const_generic_fn_unsigned_int::<14>(); } struct TestStruct1; @@ -173,3 +194,8 @@ fn generic_func(value: T) -> T { value } + +fn const_generic_fn_bool() {} +fn const_generic_fn_non_int() {} +fn const_generic_fn_signed_int() {} +fn const_generic_fn_unsigned_int() {} From cac0d71b6aad63955789ad37ce87c4dc9d5b34f9 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Tue, 13 Jul 2021 14:41:19 +0200 Subject: [PATCH 20/20] Add test for "go to first" feature --- .../search-result-go-to-first.goml | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/test/rustdoc-gui/search-result-go-to-first.goml diff --git a/src/test/rustdoc-gui/search-result-go-to-first.goml b/src/test/rustdoc-gui/search-result-go-to-first.goml new file mode 100644 index 0000000000000..5d709f6588118 --- /dev/null +++ b/src/test/rustdoc-gui/search-result-go-to-first.goml @@ -0,0 +1,20 @@ +// This test ensures that the "go_to_first" feature is working as expected. + +// First, we check that the first page doesn't have the string we're looking for to ensure +// that the feature is changing page as expected. +goto: file://|DOC_PATH|/test_docs/index.html +assert-text-false: (".fqn .in-band", "Struct test_docs::Foo") + +// We now check that we land on the search result page if "go_to_first" isn't set. +goto: file://|DOC_PATH|/test_docs/index.html?search=struct%3AFoo +// Waiting for the search results to appear... +wait-for: "#titles" +assert-text-false: (".fqn .in-band", "Struct test_docs::Foo") +// Ensure that the search results are displayed, not the "normal" content. +assert-css: ("#main", {"display": "none"}) + +// Now we can check that the feature is working as expected! +goto: file://|DOC_PATH|/test_docs/index.html?search=struct%3AFoo&go_to_first=true +// Waiting for the page to load... +wait-for: 500 +assert-text: (".fqn .in-band", "Struct test_docs::Foo")