From 3938541d29f646e8a8757fc4a2bd70d1e60cc328 Mon Sep 17 00:00:00 2001 From: Miguel Ojeda Date: Fri, 21 Apr 2023 19:39:44 +0200 Subject: [PATCH 01/13] tests: add test for warning-free builds of `core` under `no_global_oom_handling` `tests/run-make/alloc-no-oom-handling` tests that `alloc` under `no_global_oom_handling` builds and is warning-free. Do the same for `core` to prevent issues such as [1]. Link: https://github.com/rust-lang/rust/pull/110649 [1] Signed-off-by: Miguel Ojeda --- tests/run-make/core-no-oom-handling/Makefile | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 tests/run-make/core-no-oom-handling/Makefile diff --git a/tests/run-make/core-no-oom-handling/Makefile b/tests/run-make/core-no-oom-handling/Makefile new file mode 100644 index 0000000000000..28c5261ff854d --- /dev/null +++ b/tests/run-make/core-no-oom-handling/Makefile @@ -0,0 +1,6 @@ +include ../tools.mk + +FAKEROOT=$(TMPDIR)/fakeroot + +all: + $(RUSTC) --edition=2021 -Dwarnings --crate-type=rlib ../../../library/core/src/lib.rs --sysroot=$(FAKEROOT) --cfg no_global_oom_handling From 73b65746e81a31c03cbd3751966eb399073f2d9a Mon Sep 17 00:00:00 2001 From: Chris Denton Date: Thu, 20 Apr 2023 08:58:14 +0100 Subject: [PATCH 02/13] Fix Unreadable non-UTF-8 output on localized MSVC MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #35785 by converting non UTF-8 linker output to Unicode using the OEM code page. Before: ```text = note: Non-UTF-8 output: LINK : fatal error LNK1181: cannot open input file \'m\x84rchenhaft.obj\'\r\n ``` After: ```text = note: LINK : fatal error LNK1181: cannot open input file 'märchenhaft.obj' ``` The difference is more dramatic if using a non-ascii language pack for Visual Studio. --- Cargo.lock | 1 + compiler/rustc_codegen_ssa/Cargo.toml | 4 ++ compiler/rustc_codegen_ssa/src/back/link.rs | 55 ++++++++++++++++++- .../msvc-non-utf8-output.rs | 6 ++ .../msvc-non-utf8-output.stderr | 7 +++ 5 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 tests/ui/native-library-link-flags/msvc-non-utf8-output.rs create mode 100644 tests/ui/native-library-link-flags/msvc-non-utf8-output.stderr diff --git a/Cargo.lock b/Cargo.lock index 06a2a36f4552b..cd319574f7977 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3250,6 +3250,7 @@ dependencies = [ "tempfile", "thorin-dwp", "tracing", + "windows 0.46.0", ] [[package]] diff --git a/compiler/rustc_codegen_ssa/Cargo.toml b/compiler/rustc_codegen_ssa/Cargo.toml index a421535c9b46f..4f73b731f5a2a 100644 --- a/compiler/rustc_codegen_ssa/Cargo.toml +++ b/compiler/rustc_codegen_ssa/Cargo.toml @@ -49,3 +49,7 @@ libc = "0.2.50" version = "0.30.1" default-features = false features = ["read_core", "elf", "macho", "pe", "unaligned", "archive", "write"] + +[target.'cfg(windows)'.dependencies.windows] +version = "0.46.0" +features = ["Win32_Globalization"] diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs index 02e21e74fadc8..feab57e98208f 100644 --- a/compiler/rustc_codegen_ssa/src/back/link.rs +++ b/compiler/rustc_codegen_ssa/src/back/link.rs @@ -857,7 +857,7 @@ fn link_natively<'a>( if !prog.status.success() { let mut output = prog.stderr.clone(); output.extend_from_slice(&prog.stdout); - let escaped_output = escape_string(&output); + let escaped_output = escape_linker_output(&output, flavor); // FIXME: Add UI tests for this error. let err = errors::LinkingFailed { linker_path: &linker_path, @@ -1049,6 +1049,59 @@ fn escape_string(s: &[u8]) -> String { } } +#[cfg(not(windows))] +fn escape_linker_output(s: &[u8], _flavour: LinkerFlavor) -> String { + escape_string(s) +} + +/// If the output of the msvc linker is not UTF-8 and the host is Windows, +/// then try to convert the string from the OEM encoding. +#[cfg(windows)] +fn escape_linker_output(s: &[u8], flavour: LinkerFlavor) -> String { + // This only applies to the actual MSVC linker. + if flavour != LinkerFlavor::Msvc(Lld::No) { + return escape_string(s); + } + match str::from_utf8(s) { + Ok(s) => return s.to_owned(), + Err(_) if s.len() <= i32::MAX as usize => { + use windows::Win32::Globalization::{ + GetLocaleInfoEx, MultiByteToWideChar, CP_OEMCP, LOCALE_IUSEUTF8LEGACYOEMCP, + LOCALE_NAME_SYSTEM_DEFAULT, LOCALE_RETURN_NUMBER, MB_ERR_INVALID_CHARS, + }; + // Get the legacy system OEM code page. + let code_page = unsafe { + let mut cp: u32 = 0; + // We're using the `LOCALE_RETURN_NUMBER` flag to return a u32. + // But the API requires us to pass the data as though it's a [u16] string. + let len = std::mem::size_of::() / std::mem::size_of::(); + let data = std::slice::from_raw_parts_mut(&mut cp as *mut u32 as *mut u16, len); + let len_written = GetLocaleInfoEx( + LOCALE_NAME_SYSTEM_DEFAULT, + LOCALE_IUSEUTF8LEGACYOEMCP | LOCALE_RETURN_NUMBER, + Some(data), + ); + if len_written as usize == len { cp } else { CP_OEMCP } + }; + // Error if the string is not valid for the expected code page. + let flags = MB_ERR_INVALID_CHARS; + // Call MultiByteToWideChar twice. + // First to calculate the length then to convert the string. + let mut len = unsafe { MultiByteToWideChar(code_page, flags, s, None) }; + if len > 0 { + let mut utf16 = vec![0; len as usize]; + len = unsafe { MultiByteToWideChar(code_page, flags, s, Some(&mut utf16)) }; + if len > 0 { + return String::from_utf16_lossy(&utf16[..len as usize]); + } + } + } + _ => {} + }; + // The string is not UTF-8 and isn't valid for the OEM code page + format!("Non-UTF-8 output: {}", s.escape_ascii()) +} + fn add_sanitizer_libraries(sess: &Session, crate_type: CrateType, linker: &mut dyn Linker) { // On macOS the runtimes are distributed as dylibs which should be linked to // both executables and dynamic shared objects. Everywhere else the runtimes diff --git a/tests/ui/native-library-link-flags/msvc-non-utf8-output.rs b/tests/ui/native-library-link-flags/msvc-non-utf8-output.rs new file mode 100644 index 0000000000000..3fb2842d694cc --- /dev/null +++ b/tests/ui/native-library-link-flags/msvc-non-utf8-output.rs @@ -0,0 +1,6 @@ +// build-fail +// compile-flags:-C link-arg=märchenhaft +// only-msvc +// error-pattern:= note: LINK : fatal error LNK1181: +// normalize-stderr-test "(\s*\|\n)\s*= note: .*\n" -> "$1" +pub fn main() {} diff --git a/tests/ui/native-library-link-flags/msvc-non-utf8-output.stderr b/tests/ui/native-library-link-flags/msvc-non-utf8-output.stderr new file mode 100644 index 0000000000000..f843aad782c30 --- /dev/null +++ b/tests/ui/native-library-link-flags/msvc-non-utf8-output.stderr @@ -0,0 +1,7 @@ +error: linking with `link.exe` failed: exit code: 1181 + | + = note: LINK : fatal error LNK1181: cannot open input file 'märchenhaft.obj' + + +error: aborting due to previous error + From 9b9d39e43f3d8723b36f7e4b9ecafa36203fde45 Mon Sep 17 00:00:00 2001 From: Chris Denton Date: Thu, 27 Apr 2023 09:27:23 +0100 Subject: [PATCH 03/13] Abstract `MultiByteToWideChar` --- compiler/rustc_codegen_ssa/src/back/link.rs | 90 +++++++++++++-------- 1 file changed, 57 insertions(+), 33 deletions(-) diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs index feab57e98208f..fe21986884f06 100644 --- a/compiler/rustc_codegen_ssa/src/back/link.rs +++ b/compiler/rustc_codegen_ssa/src/back/link.rs @@ -1064,42 +1064,66 @@ fn escape_linker_output(s: &[u8], flavour: LinkerFlavor) -> String { } match str::from_utf8(s) { Ok(s) => return s.to_owned(), - Err(_) if s.len() <= i32::MAX as usize => { - use windows::Win32::Globalization::{ - GetLocaleInfoEx, MultiByteToWideChar, CP_OEMCP, LOCALE_IUSEUTF8LEGACYOEMCP, - LOCALE_NAME_SYSTEM_DEFAULT, LOCALE_RETURN_NUMBER, MB_ERR_INVALID_CHARS, - }; - // Get the legacy system OEM code page. - let code_page = unsafe { - let mut cp: u32 = 0; - // We're using the `LOCALE_RETURN_NUMBER` flag to return a u32. - // But the API requires us to pass the data as though it's a [u16] string. - let len = std::mem::size_of::() / std::mem::size_of::(); - let data = std::slice::from_raw_parts_mut(&mut cp as *mut u32 as *mut u16, len); - let len_written = GetLocaleInfoEx( - LOCALE_NAME_SYSTEM_DEFAULT, - LOCALE_IUSEUTF8LEGACYOEMCP | LOCALE_RETURN_NUMBER, - Some(data), - ); - if len_written as usize == len { cp } else { CP_OEMCP } - }; - // Error if the string is not valid for the expected code page. - let flags = MB_ERR_INVALID_CHARS; - // Call MultiByteToWideChar twice. - // First to calculate the length then to convert the string. - let mut len = unsafe { MultiByteToWideChar(code_page, flags, s, None) }; + Err(_) => match win::locale_byte_str_to_string(s, win::oem_code_page()) { + Some(s) => s, + // The string is not UTF-8 and isn't valid for the OEM code page + None => format!("Non-UTF-8 output: {}", s.escape_ascii()), + }, + } +} + +/// Wrappers around the Windows API. +#[cfg(windows)] +mod win { + use windows::Win32::Globalization::{ + GetLocaleInfoEx, MultiByteToWideChar, CP_OEMCP, LOCALE_IUSEUTF8LEGACYOEMCP, + LOCALE_NAME_SYSTEM_DEFAULT, LOCALE_RETURN_NUMBER, MB_ERR_INVALID_CHARS, + }; + + /// Get the Windows system OEM code page. This is most notably the code page + /// used for link.exe's output. + pub fn oem_code_page() -> u32 { + unsafe { + let mut cp: u32 = 0; + // We're using the `LOCALE_RETURN_NUMBER` flag to return a u32. + // But the API requires us to pass the data as though it's a [u16] string. + let len = std::mem::size_of::() / std::mem::size_of::(); + let data = std::slice::from_raw_parts_mut(&mut cp as *mut u32 as *mut u16, len); + let len_written = GetLocaleInfoEx( + LOCALE_NAME_SYSTEM_DEFAULT, + LOCALE_IUSEUTF8LEGACYOEMCP | LOCALE_RETURN_NUMBER, + Some(data), + ); + if len_written as usize == len { cp } else { CP_OEMCP } + } + } + /// Try to convert a multi-byte string to a UTF-8 string using the given code page + /// The string does not need to be null terminated. + /// + /// This is implemented as a wrapper around `MultiByteToWideChar`. + /// See + /// + /// It will fail if the multi-byte string is longer than `i32::MAX` or if it contains + /// any invalid bytes for the expected encoding. + pub fn locale_byte_str_to_string(s: &[u8], code_page: u32) -> Option { + // `MultiByteToWideChar` requires a length to be a "positive integer". + if s.len() > isize::MAX as usize { + return None; + } + // Error if the string is not valid for the expected code page. + let flags = MB_ERR_INVALID_CHARS; + // Call MultiByteToWideChar twice. + // First to calculate the length then to convert the string. + let mut len = unsafe { MultiByteToWideChar(code_page, flags, s, None) }; + if len > 0 { + let mut utf16 = vec![0; len as usize]; + len = unsafe { MultiByteToWideChar(code_page, flags, s, Some(&mut utf16)) }; if len > 0 { - let mut utf16 = vec![0; len as usize]; - len = unsafe { MultiByteToWideChar(code_page, flags, s, Some(&mut utf16)) }; - if len > 0 { - return String::from_utf16_lossy(&utf16[..len as usize]); - } + return utf16.get(..len as usize).map(String::from_utf16_lossy); } } - _ => {} - }; - // The string is not UTF-8 and isn't valid for the OEM code page - format!("Non-UTF-8 output: {}", s.escape_ascii()) + None + } } fn add_sanitizer_libraries(sess: &Session, crate_type: CrateType, linker: &mut dyn Linker) { From 107d480892aeedf2b02b70788a3668498fa72084 Mon Sep 17 00:00:00 2001 From: bindsdev Date: Fri, 28 Apr 2023 20:28:56 -0500 Subject: [PATCH 04/13] improve error notes for packed struct reference diagnostic --- .../src/check_packed_ref.rs | 7 +++-- .../binding/issue-53114-safety-checks.stderr | 18 +++++++---- .../diagnostics/repr_packed.stderr | 3 +- tests/ui/lint/unaligned_references.stderr | 30 ++++++++++++------- ...unaligned_references_external_macro.stderr | 3 +- tests/ui/packed/issue-27060.stderr | 12 +++++--- .../packed-struct-borrow-element-64bit.stderr | 3 +- .../packed-struct-borrow-element.stderr | 6 ++-- 8 files changed, 55 insertions(+), 27 deletions(-) diff --git a/compiler/rustc_mir_transform/src/check_packed_ref.rs b/compiler/rustc_mir_transform/src/check_packed_ref.rs index f5f1c1010e155..b9bc89fcf8fa4 100644 --- a/compiler/rustc_mir_transform/src/check_packed_ref.rs +++ b/compiler/rustc_mir_transform/src/check_packed_ref.rs @@ -56,8 +56,11 @@ impl<'tcx> Visitor<'tcx> for PackedRefChecker<'_, 'tcx> { "reference to packed field is unaligned" ) .note( - "fields of packed structs are not properly aligned, and creating \ - a misaligned reference is undefined behavior (even if that \ + "packed structs are only aligned by one byte, and many modern architectures \ + penalize unaligned field accesses" + ) + .note( + "creating a misaligned reference is undefined behavior (even if that \ reference is never dereferenced)", ).help( "copy the field contents to a local variable, or replace the \ diff --git a/tests/ui/binding/issue-53114-safety-checks.stderr b/tests/ui/binding/issue-53114-safety-checks.stderr index 41318d0a38a17..349c4639a9e2d 100644 --- a/tests/ui/binding/issue-53114-safety-checks.stderr +++ b/tests/ui/binding/issue-53114-safety-checks.stderr @@ -4,7 +4,8 @@ error[E0793]: reference to packed field is unaligned LL | let _ = &p.b; | ^^^^ | - = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) + = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses + = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) error[E0793]: reference to packed field is unaligned @@ -13,7 +14,8 @@ error[E0793]: reference to packed field is unaligned LL | let (_,) = (&p.b,); | ^^^^ | - = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) + = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses + = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) error[E0793]: reference to packed field is unaligned @@ -22,7 +24,8 @@ error[E0793]: reference to packed field is unaligned LL | let _: _ = &p.b; | ^^^^ | - = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) + = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses + = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) error[E0793]: reference to packed field is unaligned @@ -31,7 +34,8 @@ error[E0793]: reference to packed field is unaligned LL | let (_,): _ = (&p.b,); | ^^^^ | - = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) + = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses + = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) error[E0793]: reference to packed field is unaligned @@ -40,7 +44,8 @@ error[E0793]: reference to packed field is unaligned LL | match &p.b { _ => { } } | ^^^^ | - = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) + = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses + = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) error[E0793]: reference to packed field is unaligned @@ -49,7 +54,8 @@ error[E0793]: reference to packed field is unaligned LL | match (&p.b,) { (_,) => { } } | ^^^^ | - = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) + = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses + = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) error[E0133]: access to union field is unsafe and requires unsafe function or block diff --git a/tests/ui/closures/2229_closure_analysis/diagnostics/repr_packed.stderr b/tests/ui/closures/2229_closure_analysis/diagnostics/repr_packed.stderr index 9c2c434572ae5..8c44229bcebe1 100644 --- a/tests/ui/closures/2229_closure_analysis/diagnostics/repr_packed.stderr +++ b/tests/ui/closures/2229_closure_analysis/diagnostics/repr_packed.stderr @@ -4,7 +4,8 @@ error[E0793]: reference to packed field is unaligned LL | println!("{}", foo.x); | ^^^^^ | - = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) + = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses + = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/lint/unaligned_references.stderr b/tests/ui/lint/unaligned_references.stderr index 775dcac678e76..5f9cecadbffa6 100644 --- a/tests/ui/lint/unaligned_references.stderr +++ b/tests/ui/lint/unaligned_references.stderr @@ -4,7 +4,8 @@ error[E0793]: reference to packed field is unaligned LL | &self.x; | ^^^^^^^ | - = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) + = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses + = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) error[E0793]: reference to packed field is unaligned @@ -13,7 +14,8 @@ error[E0793]: reference to packed field is unaligned LL | let _ = &good.ptr; | ^^^^^^^^^ | - = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) + = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses + = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) error[E0793]: reference to packed field is unaligned @@ -22,7 +24,8 @@ error[E0793]: reference to packed field is unaligned LL | let _ = &good.data; | ^^^^^^^^^^ | - = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) + = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses + = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) error[E0793]: reference to packed field is unaligned @@ -31,7 +34,8 @@ error[E0793]: reference to packed field is unaligned LL | let _ = &good.data as *const _; | ^^^^^^^^^^ | - = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) + = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses + = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) error[E0793]: reference to packed field is unaligned @@ -40,7 +44,8 @@ error[E0793]: reference to packed field is unaligned LL | let _: *const _ = &good.data; | ^^^^^^^^^^ | - = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) + = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses + = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) error[E0793]: reference to packed field is unaligned @@ -49,7 +54,8 @@ error[E0793]: reference to packed field is unaligned LL | let _ = good.data.clone(); | ^^^^^^^^^^^^^^^^^ | - = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) + = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses + = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) error[E0793]: reference to packed field is unaligned @@ -58,7 +64,8 @@ error[E0793]: reference to packed field is unaligned LL | let _ = &good.data2[0]; | ^^^^^^^^^^^^^^ | - = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) + = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses + = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) error[E0793]: reference to packed field is unaligned @@ -67,7 +74,8 @@ error[E0793]: reference to packed field is unaligned LL | let _ = &packed2.x; | ^^^^^^^^^^ | - = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) + = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses + = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) error[E0793]: reference to packed field is unaligned @@ -76,7 +84,8 @@ error[E0793]: reference to packed field is unaligned LL | let _ref = &m1.1.a; | ^^^^^^^ | - = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) + = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses + = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) error[E0793]: reference to packed field is unaligned @@ -85,7 +94,8 @@ error[E0793]: reference to packed field is unaligned LL | let _ref = &m2.1.a; | ^^^^^^^ | - = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) + = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses + = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) error: aborting due to 10 previous errors diff --git a/tests/ui/lint/unaligned_references_external_macro.stderr b/tests/ui/lint/unaligned_references_external_macro.stderr index 5b08f433e3280..94a95c1d8fda7 100644 --- a/tests/ui/lint/unaligned_references_external_macro.stderr +++ b/tests/ui/lint/unaligned_references_external_macro.stderr @@ -9,7 +9,8 @@ LL | | } LL | | } | |_^ | - = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) + = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses + = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) = note: this error originates in the macro `unaligned_references_external_crate::mac` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/tests/ui/packed/issue-27060.stderr b/tests/ui/packed/issue-27060.stderr index b4753284f725d..4dc31a283865c 100644 --- a/tests/ui/packed/issue-27060.stderr +++ b/tests/ui/packed/issue-27060.stderr @@ -4,7 +4,8 @@ error[E0793]: reference to packed field is unaligned LL | let _ = &good.data; | ^^^^^^^^^^ | - = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) + = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses + = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) error[E0793]: reference to packed field is unaligned @@ -13,7 +14,8 @@ error[E0793]: reference to packed field is unaligned LL | let _ = &good.data2[0]; | ^^^^^^^^^^^^^^ | - = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) + = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses + = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) error[E0793]: reference to packed field is unaligned @@ -22,7 +24,8 @@ error[E0793]: reference to packed field is unaligned LL | let _ = &good.data; | ^^^^^^^^^^ | - = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) + = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses + = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) error[E0793]: reference to packed field is unaligned @@ -31,7 +34,8 @@ error[E0793]: reference to packed field is unaligned LL | let _ = &good.data2[0]; | ^^^^^^^^^^^^^^ | - = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) + = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses + = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) error: aborting due to 4 previous errors diff --git a/tests/ui/packed/packed-struct-borrow-element-64bit.stderr b/tests/ui/packed/packed-struct-borrow-element-64bit.stderr index 32943b0f07b8c..57630a4b47018 100644 --- a/tests/ui/packed/packed-struct-borrow-element-64bit.stderr +++ b/tests/ui/packed/packed-struct-borrow-element-64bit.stderr @@ -4,7 +4,8 @@ error[E0793]: reference to packed field is unaligned LL | let brw = &foo.baz; | ^^^^^^^^ | - = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) + = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses + = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) error: aborting due to previous error diff --git a/tests/ui/packed/packed-struct-borrow-element.stderr b/tests/ui/packed/packed-struct-borrow-element.stderr index 29d867fc5b9ad..c1f749d6fbbbd 100644 --- a/tests/ui/packed/packed-struct-borrow-element.stderr +++ b/tests/ui/packed/packed-struct-borrow-element.stderr @@ -4,7 +4,8 @@ error[E0793]: reference to packed field is unaligned LL | let brw = &foo.baz; | ^^^^^^^^ | - = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) + = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses + = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) error[E0793]: reference to packed field is unaligned @@ -13,7 +14,8 @@ error[E0793]: reference to packed field is unaligned LL | let brw = &foo.baz; | ^^^^^^^^ | - = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) + = note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses + = note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) error: aborting due to 2 previous errors From 344dd0e82805ce18d0569e9da8e14a7f0a9fdefe Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Fri, 28 Apr 2023 21:54:23 +0200 Subject: [PATCH 05/13] Make `repr` attribute local_only --- compiler/rustc_feature/src/builtin_attrs.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/rustc_feature/src/builtin_attrs.rs b/compiler/rustc_feature/src/builtin_attrs.rs index 103e0f344070d..c77292fdd1647 100644 --- a/compiler/rustc_feature/src/builtin_attrs.rs +++ b/compiler/rustc_feature/src/builtin_attrs.rs @@ -344,7 +344,7 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[ ), ungated!(link_name, Normal, template!(NameValueStr: "name"), FutureWarnPreceding), ungated!(no_link, Normal, template!(Word), WarnFollowing), - ungated!(repr, Normal, template!(List: "C"), DuplicatesOk), + ungated!(repr, Normal, template!(List: "C"), DuplicatesOk, @only_local: true), ungated!(export_name, Normal, template!(NameValueStr: "name"), FutureWarnPreceding), ungated!(link_section, Normal, template!(NameValueStr: "name"), FutureWarnPreceding), ungated!(no_mangle, Normal, template!(Word), WarnFollowing, @only_local: true), From 63028ac3a1cdad56e4a61b8fcb260456efc2b71e Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Sat, 29 Apr 2023 10:32:31 +0000 Subject: [PATCH 06/13] Do not force anonymous lifetimes in consts to be static. --- compiler/rustc_resolve/src/late.rs | 4 ++-- .../elided-lifetime-in-anon-const.rs | 20 +++++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 tests/ui/lifetimes/elided-lifetime-in-anon-const.rs diff --git a/compiler/rustc_resolve/src/late.rs b/compiler/rustc_resolve/src/late.rs index a97857e05e2e9..5da67dbc2aa17 100644 --- a/compiler/rustc_resolve/src/late.rs +++ b/compiler/rustc_resolve/src/late.rs @@ -656,7 +656,7 @@ impl<'a: 'ast, 'ast, 'tcx> Visitor<'ast> for LateResolutionVisitor<'a, '_, 'ast, fn visit_anon_const(&mut self, constant: &'ast AnonConst) { // We deal with repeat expressions explicitly in `resolve_expr`. self.with_lifetime_rib(LifetimeRibKind::AnonConst, |this| { - this.with_lifetime_rib(LifetimeRibKind::Elided(LifetimeRes::Static), |this| { + this.with_lifetime_rib(LifetimeRibKind::Elided(LifetimeRes::Infer), |this| { this.resolve_anon_const(constant, IsRepeatExpr::No); }) }) @@ -4130,7 +4130,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> { ExprKind::Repeat(ref elem, ref ct) => { self.visit_expr(elem); self.with_lifetime_rib(LifetimeRibKind::AnonConst, |this| { - this.with_lifetime_rib(LifetimeRibKind::Elided(LifetimeRes::Static), |this| { + this.with_lifetime_rib(LifetimeRibKind::Elided(LifetimeRes::Infer), |this| { this.resolve_anon_const(ct, IsRepeatExpr::Yes) }) }); diff --git a/tests/ui/lifetimes/elided-lifetime-in-anon-const.rs b/tests/ui/lifetimes/elided-lifetime-in-anon-const.rs new file mode 100644 index 0000000000000..69a7b61bab418 --- /dev/null +++ b/tests/ui/lifetimes/elided-lifetime-in-anon-const.rs @@ -0,0 +1,20 @@ +// Verify that elided lifetimes inside anonymous constants are not forced to be `'static`. +// check-pass + +fn foo() -> [(); { + let a = 10_usize; + let b: &'_ usize = &a; + *b + }] { + [(); 10] +} + +fn bar() -> [(); 10] { + [(); { + let a = 10_usize; + let b: &'_ usize = &a; + *b + }] +} + +fn main() {} From 5fa975142f98939222e12e8ca1338185cc7feb1c Mon Sep 17 00:00:00 2001 From: jyn Date: Sat, 29 Apr 2023 04:08:33 -0500 Subject: [PATCH 07/13] Move some rustdoc-ui tests to subdirectories --- .../rustdoc-ui/{ => check-cfg}/check-cfg-test.stderr | 0 .../rustdoc-ui/{ => check-cfg}/check-cfg-unstable.rs | 0 .../{ => check-cfg}/check-cfg-unstable.stderr | 0 tests/rustdoc-ui/{ => check-cfg}/check-cfg.rs | 0 tests/rustdoc-ui/{ => check-cfg}/check-cfg.stderr | 0 .../{ => doctest}/auxiliary/extern_macros.rs | 0 tests/rustdoc-ui/{ => doctest}/block-doc-comment.rs | 0 .../rustdoc-ui/{ => doctest}/block-doc-comment.stdout | 0 tests/rustdoc-ui/{ => doctest}/cfg-test.rs | 2 +- tests/rustdoc-ui/{ => doctest}/cfg-test.stdout | 0 tests/rustdoc-ui/{ => doctest}/check-attr-test.rs | 0 tests/rustdoc-ui/{ => doctest}/check-attr-test.stderr | 0 tests/rustdoc-ui/{ => doctest}/check-cfg-test.rs | 4 ++-- tests/rustdoc-ui/doctest/check-cfg-test.stderr | 11 +++++++++++ tests/rustdoc-ui/{ => doctest}/check-cfg-test.stdout | 0 tests/rustdoc-ui/{ => doctest}/display-output.rs | 2 +- tests/rustdoc-ui/{ => doctest}/display-output.stdout | 0 .../{ => doctest}/doc-comment-multi-line-attr.rs | 2 +- .../{ => doctest}/doc-comment-multi-line-attr.stdout | 0 .../{ => doctest}/doc-comment-multi-line-cfg-attr.rs | 2 +- .../doc-comment-multi-line-cfg-attr.stdout | 0 tests/rustdoc-ui/{ => doctest}/doc-test-attr-pass.rs | 0 tests/rustdoc-ui/{ => doctest}/doc-test-attr.rs | 0 tests/rustdoc-ui/{ => doctest}/doc-test-attr.stderr | 0 .../{ => doctest}/doc-test-doctest-feature.rs | 2 +- .../{ => doctest}/doc-test-doctest-feature.stdout | 0 .../{ => doctest}/doc-test-rustdoc-feature.rs | 2 +- .../{ => doctest}/doc-test-rustdoc-feature.stdout | 0 tests/rustdoc-ui/{ => doctest}/doctest-edition.rs | 0 tests/rustdoc-ui/{ => doctest}/doctest-edition.stderr | 0 .../doctest-multiline-crate-attribute.rs | 2 +- .../doctest-multiline-crate-attribute.stdout | 0 tests/rustdoc-ui/{ => doctest}/doctest-output.rs | 2 +- tests/rustdoc-ui/{ => doctest}/doctest-output.stdout | 0 .../{ => doctest}/failed-doctest-compile-fail.rs | 2 +- .../{ => doctest}/failed-doctest-compile-fail.stdout | 0 .../failed-doctest-extra-semicolon-on-item.rs | 2 +- .../failed-doctest-extra-semicolon-on-item.stdout | 0 .../{ => doctest}/failed-doctest-missing-codes.rs | 2 +- .../{ => doctest}/failed-doctest-missing-codes.stdout | 0 .../{ => doctest}/failed-doctest-output-windows.rs | 2 +- .../failed-doctest-output-windows.stdout | 0 .../rustdoc-ui/{ => doctest}/failed-doctest-output.rs | 2 +- .../{ => doctest}/failed-doctest-output.stdout | 0 .../{ => doctest}/failed-doctest-should-panic.rs | 2 +- .../{ => doctest}/failed-doctest-should-panic.stdout | 0 tests/rustdoc-ui/{ => doctest}/no-run-flag-error.rs | 0 .../rustdoc-ui/{ => doctest}/no-run-flag-error.stderr | 0 tests/rustdoc-ui/{ => doctest}/no-run-flag.rs | 2 +- tests/rustdoc-ui/{ => doctest}/no-run-flag.stdout | 0 tests/rustdoc-ui/{ => doctest}/nocapture-fail.rs | 4 ++-- tests/rustdoc-ui/{ => doctest}/nocapture-fail.stderr | 0 tests/rustdoc-ui/{ => doctest}/nocapture-fail.stdout | 0 tests/rustdoc-ui/{ => doctest}/nocapture.rs | 2 +- tests/rustdoc-ui/{ => doctest}/nocapture.stderr | 0 tests/rustdoc-ui/{ => doctest}/nocapture.stdout | 0 tests/rustdoc-ui/{ => doctest}/private-doc-test.rs | 0 .../rustdoc-ui/{ => doctest}/private-item-doc-test.rs | 0 .../{ => doctest}/private-item-doc-test.stderr | 0 .../{ => doctest}/private-public-item-doc-test.rs | 0 .../{ => doctest}/private-public-item-doc-test.stderr | 0 .../{ => doctest}/public-reexported-item-doc-test.rs | 0 .../{ => doctest}/run-directory.correct.stdout | 0 .../{ => doctest}/run-directory.incorrect.stdout | 0 tests/rustdoc-ui/{ => doctest}/run-directory.rs | 6 +++--- tests/rustdoc-ui/{ => doctest}/test-compile-fail1.rs | 0 .../{ => doctest}/test-compile-fail1.stderr | 0 tests/rustdoc-ui/{ => doctest}/test-compile-fail2.rs | 0 .../{ => doctest}/test-compile-fail2.stderr | 0 tests/rustdoc-ui/{ => doctest}/test-compile-fail3.rs | 0 .../{ => doctest}/test-compile-fail3.stderr | 0 tests/rustdoc-ui/{ => doctest}/test-no_std.rs | 2 +- tests/rustdoc-ui/{ => doctest}/test-no_std.stdout | 0 tests/rustdoc-ui/{ => doctest}/test-type.rs | 2 +- tests/rustdoc-ui/{ => doctest}/test-type.stdout | 0 .../rustdoc-ui/{ => doctest}/unparseable-doc-test.rs | 2 +- .../{ => doctest}/unparseable-doc-test.stdout | 0 .../generate-link-to-definition-opt-unstable.rs | 0 .../generate-link-to-definition-opt-unstable.stderr | 0 .../generate-link-to-definition-opt.rs | 0 .../generate-link-to-definition-opt.stderr | 0 .../generate-link-to-definition-opt2.rs | 0 .../generate-link-to-definition-opt2.stderr | 0 .../deny-intra-link-resolution-failure.rs | 0 .../deny-intra-link-resolution-failure.stderr | 0 tests/rustdoc-ui/{ => issues}/auxiliary/empty-fn.rs | 0 .../rustdoc-ui/{ => issues}/auxiliary/issue-61592.rs | 0 .../{ => issues}/auxiliary/panic-handler.rs | 0 tests/rustdoc-ui/{ => issues}/issue-101076.rs | 0 tests/rustdoc-ui/{ => issues}/issue-102986.rs | 0 tests/rustdoc-ui/{ => issues}/issue-102986.stderr | 0 tests/rustdoc-ui/{ => issues}/issue-103997.rs | 0 tests/rustdoc-ui/{ => issues}/issue-103997.stderr | 0 tests/rustdoc-ui/{ => issues}/issue-105334.rs | 0 tests/rustdoc-ui/{ => issues}/issue-105334.stderr | 0 tests/rustdoc-ui/{ => issues}/issue-105737.rs | 0 tests/rustdoc-ui/{ => issues}/issue-105737.stderr | 0 tests/rustdoc-ui/{ => issues}/issue-105742.rs | 0 tests/rustdoc-ui/{ => issues}/issue-105742.stderr | 0 tests/rustdoc-ui/{ => issues}/issue-106213.rs | 0 tests/rustdoc-ui/{ => issues}/issue-106213.stderr | 0 tests/rustdoc-ui/{ => issues}/issue-106226.rs | 0 tests/rustdoc-ui/{ => issues}/issue-106226.stderr | 0 tests/rustdoc-ui/{ => issues}/issue-107918.rs | 0 .../{ => issues}/issue-109282-import-inline-merge.rs | 0 tests/rustdoc-ui/{ => issues}/issue-110900.rs | 0 tests/rustdoc-ui/{ => issues}/issue-58473-2.rs | 0 tests/rustdoc-ui/{ => issues}/issue-58473.rs | 0 tests/rustdoc-ui/{ => issues}/issue-61592-2.rs | 0 tests/rustdoc-ui/{ => issues}/issue-61592-2.stderr | 0 tests/rustdoc-ui/{ => issues}/issue-61592.rs | 0 tests/rustdoc-ui/{ => issues}/issue-61592.stderr | 0 tests/rustdoc-ui/{ => issues}/issue-61732.rs | 0 tests/rustdoc-ui/{ => issues}/issue-61732.stderr | 0 .../{ => issues}/issue-74134.private.stderr | 0 .../rustdoc-ui/{ => issues}/issue-74134.public.stderr | 0 tests/rustdoc-ui/{ => issues}/issue-74134.rs | 0 tests/rustdoc-ui/{ => issues}/issue-79465.rs | 0 tests/rustdoc-ui/{ => issues}/issue-79465.stderr | 0 tests/rustdoc-ui/{ => issues}/issue-79467.rs | 0 tests/rustdoc-ui/{ => issues}/issue-79467.stderr | 0 tests/rustdoc-ui/{ => issues}/issue-79494.rs | 0 tests/rustdoc-ui/{ => issues}/issue-79494.stderr | 0 tests/rustdoc-ui/{ => issues}/issue-80992.rs | 2 +- tests/rustdoc-ui/{ => issues}/issue-80992.stdout | 0 .../rustdoc-ui/{ => issues}/issue-81662-shortness.rs | 2 +- .../{ => issues}/issue-81662-shortness.stdout | 0 .../{ => issues}/issue-83883-describe-lints.rs | 0 .../{ => issues}/issue-83883-describe-lints.stdout | 0 tests/rustdoc-ui/{ => issues}/issue-91134.rs | 2 +- tests/rustdoc-ui/{ => issues}/issue-91134.stdout | 0 tests/rustdoc-ui/{ => issues}/issue-91713.rs | 0 tests/rustdoc-ui/{ => issues}/issue-91713.stderr | 0 tests/rustdoc-ui/{ => issues}/issue-91713.stdout | 0 tests/rustdoc-ui/{ => issues}/issue-96287.rs | 0 tests/rustdoc-ui/{ => issues}/issue-96287.stderr | 0 tests/rustdoc-ui/{ => issues}/issue-98690.rs | 0 tests/rustdoc-ui/{ => issues}/issue-98690.stderr | 0 .../scrape-examples-fail-if-type-error.rs | 0 .../scrape-examples-fail-if-type-error.stderr | 0 .../{ => scrape-examples}/scrape-examples-ice.rs | 0 .../scrape-examples-wrong-options-1.rs | 0 .../scrape-examples-wrong-options-1.stderr | 0 .../scrape-examples-wrong-options-2.rs | 0 .../scrape-examples-wrong-options-2.stderr | 0 145 files changed, 40 insertions(+), 29 deletions(-) rename tests/rustdoc-ui/{ => check-cfg}/check-cfg-test.stderr (100%) rename tests/rustdoc-ui/{ => check-cfg}/check-cfg-unstable.rs (100%) rename tests/rustdoc-ui/{ => check-cfg}/check-cfg-unstable.stderr (100%) rename tests/rustdoc-ui/{ => check-cfg}/check-cfg.rs (100%) rename tests/rustdoc-ui/{ => check-cfg}/check-cfg.stderr (100%) rename tests/rustdoc-ui/{ => doctest}/auxiliary/extern_macros.rs (100%) rename tests/rustdoc-ui/{ => doctest}/block-doc-comment.rs (100%) rename tests/rustdoc-ui/{ => doctest}/block-doc-comment.stdout (100%) rename tests/rustdoc-ui/{ => doctest}/cfg-test.rs (90%) rename tests/rustdoc-ui/{ => doctest}/cfg-test.stdout (100%) rename tests/rustdoc-ui/{ => doctest}/check-attr-test.rs (100%) rename tests/rustdoc-ui/{ => doctest}/check-attr-test.stderr (100%) rename tests/rustdoc-ui/{ => doctest}/check-cfg-test.rs (72%) create mode 100644 tests/rustdoc-ui/doctest/check-cfg-test.stderr rename tests/rustdoc-ui/{ => doctest}/check-cfg-test.stdout (100%) rename tests/rustdoc-ui/{ => doctest}/display-output.rs (84%) rename tests/rustdoc-ui/{ => doctest}/display-output.stdout (100%) rename tests/rustdoc-ui/{ => doctest}/doc-comment-multi-line-attr.rs (80%) rename tests/rustdoc-ui/{ => doctest}/doc-comment-multi-line-attr.stdout (100%) rename tests/rustdoc-ui/{ => doctest}/doc-comment-multi-line-cfg-attr.rs (78%) rename tests/rustdoc-ui/{ => doctest}/doc-comment-multi-line-cfg-attr.stdout (100%) rename tests/rustdoc-ui/{ => doctest}/doc-test-attr-pass.rs (100%) rename tests/rustdoc-ui/{ => doctest}/doc-test-attr.rs (100%) rename tests/rustdoc-ui/{ => doctest}/doc-test-attr.stderr (100%) rename tests/rustdoc-ui/{ => doctest}/doc-test-doctest-feature.rs (81%) rename tests/rustdoc-ui/{ => doctest}/doc-test-doctest-feature.stdout (100%) rename tests/rustdoc-ui/{ => doctest}/doc-test-rustdoc-feature.rs (82%) rename tests/rustdoc-ui/{ => doctest}/doc-test-rustdoc-feature.stdout (100%) rename tests/rustdoc-ui/{ => doctest}/doctest-edition.rs (100%) rename tests/rustdoc-ui/{ => doctest}/doctest-edition.stderr (100%) rename tests/rustdoc-ui/{ => doctest}/doctest-multiline-crate-attribute.rs (81%) rename tests/rustdoc-ui/{ => doctest}/doctest-multiline-crate-attribute.stdout (100%) rename tests/rustdoc-ui/{ => doctest}/doctest-output.rs (87%) rename tests/rustdoc-ui/{ => doctest}/doctest-output.stdout (100%) rename tests/rustdoc-ui/{ => doctest}/failed-doctest-compile-fail.rs (84%) rename tests/rustdoc-ui/{ => doctest}/failed-doctest-compile-fail.stdout (100%) rename tests/rustdoc-ui/{ => doctest}/failed-doctest-extra-semicolon-on-item.rs (88%) rename tests/rustdoc-ui/{ => doctest}/failed-doctest-extra-semicolon-on-item.stdout (100%) rename tests/rustdoc-ui/{ => doctest}/failed-doctest-missing-codes.rs (84%) rename tests/rustdoc-ui/{ => doctest}/failed-doctest-missing-codes.stdout (100%) rename tests/rustdoc-ui/{ => doctest}/failed-doctest-output-windows.rs (92%) rename tests/rustdoc-ui/{ => doctest}/failed-doctest-output-windows.stdout (100%) rename tests/rustdoc-ui/{ => doctest}/failed-doctest-output.rs (92%) rename tests/rustdoc-ui/{ => doctest}/failed-doctest-output.stdout (100%) rename tests/rustdoc-ui/{ => doctest}/failed-doctest-should-panic.rs (84%) rename tests/rustdoc-ui/{ => doctest}/failed-doctest-should-panic.stdout (100%) rename tests/rustdoc-ui/{ => doctest}/no-run-flag-error.rs (100%) rename tests/rustdoc-ui/{ => doctest}/no-run-flag-error.stderr (100%) rename tests/rustdoc-ui/{ => doctest}/no-run-flag.rs (91%) rename tests/rustdoc-ui/{ => doctest}/no-run-flag.stdout (100%) rename tests/rustdoc-ui/{ => doctest}/nocapture-fail.rs (63%) rename tests/rustdoc-ui/{ => doctest}/nocapture-fail.stderr (100%) rename tests/rustdoc-ui/{ => doctest}/nocapture-fail.stdout (100%) rename tests/rustdoc-ui/{ => doctest}/nocapture.rs (77%) rename tests/rustdoc-ui/{ => doctest}/nocapture.stderr (100%) rename tests/rustdoc-ui/{ => doctest}/nocapture.stdout (100%) rename tests/rustdoc-ui/{ => doctest}/private-doc-test.rs (100%) rename tests/rustdoc-ui/{ => doctest}/private-item-doc-test.rs (100%) rename tests/rustdoc-ui/{ => doctest}/private-item-doc-test.stderr (100%) rename tests/rustdoc-ui/{ => doctest}/private-public-item-doc-test.rs (100%) rename tests/rustdoc-ui/{ => doctest}/private-public-item-doc-test.stderr (100%) rename tests/rustdoc-ui/{ => doctest}/public-reexported-item-doc-test.rs (100%) rename tests/rustdoc-ui/{ => doctest}/run-directory.correct.stdout (100%) rename tests/rustdoc-ui/{ => doctest}/run-directory.incorrect.stdout (100%) rename tests/rustdoc-ui/{ => doctest}/run-directory.rs (70%) rename tests/rustdoc-ui/{ => doctest}/test-compile-fail1.rs (100%) rename tests/rustdoc-ui/{ => doctest}/test-compile-fail1.stderr (100%) rename tests/rustdoc-ui/{ => doctest}/test-compile-fail2.rs (100%) rename tests/rustdoc-ui/{ => doctest}/test-compile-fail2.stderr (100%) rename tests/rustdoc-ui/{ => doctest}/test-compile-fail3.rs (100%) rename tests/rustdoc-ui/{ => doctest}/test-compile-fail3.stderr (100%) rename tests/rustdoc-ui/{ => doctest}/test-no_std.rs (75%) rename tests/rustdoc-ui/{ => doctest}/test-no_std.stdout (100%) rename tests/rustdoc-ui/{ => doctest}/test-type.rs (87%) rename tests/rustdoc-ui/{ => doctest}/test-type.stdout (100%) rename tests/rustdoc-ui/{ => doctest}/unparseable-doc-test.rs (77%) rename tests/rustdoc-ui/{ => doctest}/unparseable-doc-test.stdout (100%) rename tests/rustdoc-ui/{ => generate-link-to-definition}/generate-link-to-definition-opt-unstable.rs (100%) rename tests/rustdoc-ui/{ => generate-link-to-definition}/generate-link-to-definition-opt-unstable.stderr (100%) rename tests/rustdoc-ui/{ => generate-link-to-definition}/generate-link-to-definition-opt.rs (100%) rename tests/rustdoc-ui/{ => generate-link-to-definition}/generate-link-to-definition-opt.stderr (100%) rename tests/rustdoc-ui/{ => generate-link-to-definition}/generate-link-to-definition-opt2.rs (100%) rename tests/rustdoc-ui/{ => generate-link-to-definition}/generate-link-to-definition-opt2.stderr (100%) rename tests/rustdoc-ui/{ => intra-doc}/deny-intra-link-resolution-failure.rs (100%) rename tests/rustdoc-ui/{ => intra-doc}/deny-intra-link-resolution-failure.stderr (100%) rename tests/rustdoc-ui/{ => issues}/auxiliary/empty-fn.rs (100%) rename tests/rustdoc-ui/{ => issues}/auxiliary/issue-61592.rs (100%) rename tests/rustdoc-ui/{ => issues}/auxiliary/panic-handler.rs (100%) rename tests/rustdoc-ui/{ => issues}/issue-101076.rs (100%) rename tests/rustdoc-ui/{ => issues}/issue-102986.rs (100%) rename tests/rustdoc-ui/{ => issues}/issue-102986.stderr (100%) rename tests/rustdoc-ui/{ => issues}/issue-103997.rs (100%) rename tests/rustdoc-ui/{ => issues}/issue-103997.stderr (100%) rename tests/rustdoc-ui/{ => issues}/issue-105334.rs (100%) rename tests/rustdoc-ui/{ => issues}/issue-105334.stderr (100%) rename tests/rustdoc-ui/{ => issues}/issue-105737.rs (100%) rename tests/rustdoc-ui/{ => issues}/issue-105737.stderr (100%) rename tests/rustdoc-ui/{ => issues}/issue-105742.rs (100%) rename tests/rustdoc-ui/{ => issues}/issue-105742.stderr (100%) rename tests/rustdoc-ui/{ => issues}/issue-106213.rs (100%) rename tests/rustdoc-ui/{ => issues}/issue-106213.stderr (100%) rename tests/rustdoc-ui/{ => issues}/issue-106226.rs (100%) rename tests/rustdoc-ui/{ => issues}/issue-106226.stderr (100%) rename tests/rustdoc-ui/{ => issues}/issue-107918.rs (100%) rename tests/rustdoc-ui/{ => issues}/issue-109282-import-inline-merge.rs (100%) rename tests/rustdoc-ui/{ => issues}/issue-110900.rs (100%) rename tests/rustdoc-ui/{ => issues}/issue-58473-2.rs (100%) rename tests/rustdoc-ui/{ => issues}/issue-58473.rs (100%) rename tests/rustdoc-ui/{ => issues}/issue-61592-2.rs (100%) rename tests/rustdoc-ui/{ => issues}/issue-61592-2.stderr (100%) rename tests/rustdoc-ui/{ => issues}/issue-61592.rs (100%) rename tests/rustdoc-ui/{ => issues}/issue-61592.stderr (100%) rename tests/rustdoc-ui/{ => issues}/issue-61732.rs (100%) rename tests/rustdoc-ui/{ => issues}/issue-61732.stderr (100%) rename tests/rustdoc-ui/{ => issues}/issue-74134.private.stderr (100%) rename tests/rustdoc-ui/{ => issues}/issue-74134.public.stderr (100%) rename tests/rustdoc-ui/{ => issues}/issue-74134.rs (100%) rename tests/rustdoc-ui/{ => issues}/issue-79465.rs (100%) rename tests/rustdoc-ui/{ => issues}/issue-79465.stderr (100%) rename tests/rustdoc-ui/{ => issues}/issue-79467.rs (100%) rename tests/rustdoc-ui/{ => issues}/issue-79467.stderr (100%) rename tests/rustdoc-ui/{ => issues}/issue-79494.rs (100%) rename tests/rustdoc-ui/{ => issues}/issue-79494.stderr (100%) rename tests/rustdoc-ui/{ => issues}/issue-80992.rs (78%) rename tests/rustdoc-ui/{ => issues}/issue-80992.stdout (100%) rename tests/rustdoc-ui/{ => issues}/issue-81662-shortness.rs (81%) rename tests/rustdoc-ui/{ => issues}/issue-81662-shortness.stdout (100%) rename tests/rustdoc-ui/{ => issues}/issue-83883-describe-lints.rs (100%) rename tests/rustdoc-ui/{ => issues}/issue-83883-describe-lints.stdout (100%) rename tests/rustdoc-ui/{ => issues}/issue-91134.rs (85%) rename tests/rustdoc-ui/{ => issues}/issue-91134.stdout (100%) rename tests/rustdoc-ui/{ => issues}/issue-91713.rs (100%) rename tests/rustdoc-ui/{ => issues}/issue-91713.stderr (100%) rename tests/rustdoc-ui/{ => issues}/issue-91713.stdout (100%) rename tests/rustdoc-ui/{ => issues}/issue-96287.rs (100%) rename tests/rustdoc-ui/{ => issues}/issue-96287.stderr (100%) rename tests/rustdoc-ui/{ => issues}/issue-98690.rs (100%) rename tests/rustdoc-ui/{ => issues}/issue-98690.stderr (100%) rename tests/rustdoc-ui/{ => scrape-examples}/scrape-examples-fail-if-type-error.rs (100%) rename tests/rustdoc-ui/{ => scrape-examples}/scrape-examples-fail-if-type-error.stderr (100%) rename tests/rustdoc-ui/{ => scrape-examples}/scrape-examples-ice.rs (100%) rename tests/rustdoc-ui/{ => scrape-examples}/scrape-examples-wrong-options-1.rs (100%) rename tests/rustdoc-ui/{ => scrape-examples}/scrape-examples-wrong-options-1.stderr (100%) rename tests/rustdoc-ui/{ => scrape-examples}/scrape-examples-wrong-options-2.rs (100%) rename tests/rustdoc-ui/{ => scrape-examples}/scrape-examples-wrong-options-2.stderr (100%) diff --git a/tests/rustdoc-ui/check-cfg-test.stderr b/tests/rustdoc-ui/check-cfg/check-cfg-test.stderr similarity index 100% rename from tests/rustdoc-ui/check-cfg-test.stderr rename to tests/rustdoc-ui/check-cfg/check-cfg-test.stderr diff --git a/tests/rustdoc-ui/check-cfg-unstable.rs b/tests/rustdoc-ui/check-cfg/check-cfg-unstable.rs similarity index 100% rename from tests/rustdoc-ui/check-cfg-unstable.rs rename to tests/rustdoc-ui/check-cfg/check-cfg-unstable.rs diff --git a/tests/rustdoc-ui/check-cfg-unstable.stderr b/tests/rustdoc-ui/check-cfg/check-cfg-unstable.stderr similarity index 100% rename from tests/rustdoc-ui/check-cfg-unstable.stderr rename to tests/rustdoc-ui/check-cfg/check-cfg-unstable.stderr diff --git a/tests/rustdoc-ui/check-cfg.rs b/tests/rustdoc-ui/check-cfg/check-cfg.rs similarity index 100% rename from tests/rustdoc-ui/check-cfg.rs rename to tests/rustdoc-ui/check-cfg/check-cfg.rs diff --git a/tests/rustdoc-ui/check-cfg.stderr b/tests/rustdoc-ui/check-cfg/check-cfg.stderr similarity index 100% rename from tests/rustdoc-ui/check-cfg.stderr rename to tests/rustdoc-ui/check-cfg/check-cfg.stderr diff --git a/tests/rustdoc-ui/auxiliary/extern_macros.rs b/tests/rustdoc-ui/doctest/auxiliary/extern_macros.rs similarity index 100% rename from tests/rustdoc-ui/auxiliary/extern_macros.rs rename to tests/rustdoc-ui/doctest/auxiliary/extern_macros.rs diff --git a/tests/rustdoc-ui/block-doc-comment.rs b/tests/rustdoc-ui/doctest/block-doc-comment.rs similarity index 100% rename from tests/rustdoc-ui/block-doc-comment.rs rename to tests/rustdoc-ui/doctest/block-doc-comment.rs diff --git a/tests/rustdoc-ui/block-doc-comment.stdout b/tests/rustdoc-ui/doctest/block-doc-comment.stdout similarity index 100% rename from tests/rustdoc-ui/block-doc-comment.stdout rename to tests/rustdoc-ui/doctest/block-doc-comment.stdout diff --git a/tests/rustdoc-ui/cfg-test.rs b/tests/rustdoc-ui/doctest/cfg-test.rs similarity index 90% rename from tests/rustdoc-ui/cfg-test.rs rename to tests/rustdoc-ui/doctest/cfg-test.rs index d40b928373555..a263baa9738c5 100644 --- a/tests/rustdoc-ui/cfg-test.rs +++ b/tests/rustdoc-ui/doctest/cfg-test.rs @@ -1,6 +1,6 @@ // check-pass // compile-flags:--test --test-args --test-threads=1 -// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR" +// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" // normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" // Crates like core have doctests gated on `cfg(not(test))` so we need to make diff --git a/tests/rustdoc-ui/cfg-test.stdout b/tests/rustdoc-ui/doctest/cfg-test.stdout similarity index 100% rename from tests/rustdoc-ui/cfg-test.stdout rename to tests/rustdoc-ui/doctest/cfg-test.stdout diff --git a/tests/rustdoc-ui/check-attr-test.rs b/tests/rustdoc-ui/doctest/check-attr-test.rs similarity index 100% rename from tests/rustdoc-ui/check-attr-test.rs rename to tests/rustdoc-ui/doctest/check-attr-test.rs diff --git a/tests/rustdoc-ui/check-attr-test.stderr b/tests/rustdoc-ui/doctest/check-attr-test.stderr similarity index 100% rename from tests/rustdoc-ui/check-attr-test.stderr rename to tests/rustdoc-ui/doctest/check-attr-test.stderr diff --git a/tests/rustdoc-ui/check-cfg-test.rs b/tests/rustdoc-ui/doctest/check-cfg-test.rs similarity index 72% rename from tests/rustdoc-ui/check-cfg-test.rs rename to tests/rustdoc-ui/doctest/check-cfg-test.rs index 920432276cba0..49a801c3fb352 100644 --- a/tests/rustdoc-ui/check-cfg-test.rs +++ b/tests/rustdoc-ui/doctest/check-cfg-test.rs @@ -1,7 +1,7 @@ // check-pass // compile-flags: --test --nocapture --check-cfg=values(feature,"test") -Z unstable-options -// normalize-stderr-test: "tests/rustdoc-ui" -> "$$DIR" -// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR" +// normalize-stderr-test: "tests/rustdoc-ui/doctest" -> "$$DIR" +// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" // normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" /// The doctest will produce a warning because feature invalid is unexpected diff --git a/tests/rustdoc-ui/doctest/check-cfg-test.stderr b/tests/rustdoc-ui/doctest/check-cfg-test.stderr new file mode 100644 index 0000000000000..9770be2f191f0 --- /dev/null +++ b/tests/rustdoc-ui/doctest/check-cfg-test.stderr @@ -0,0 +1,11 @@ +warning: unexpected `cfg` condition value + --> $DIR/check-cfg-test.rs:9:7 + | +LL | #[cfg(feature = "invalid")] + | ^^^^^^^^^^^^^^^^^^^ + | + = note: expected values for `feature` are: test + = note: `#[warn(unexpected_cfgs)]` on by default + +warning: 1 warning emitted + diff --git a/tests/rustdoc-ui/check-cfg-test.stdout b/tests/rustdoc-ui/doctest/check-cfg-test.stdout similarity index 100% rename from tests/rustdoc-ui/check-cfg-test.stdout rename to tests/rustdoc-ui/doctest/check-cfg-test.stdout diff --git a/tests/rustdoc-ui/display-output.rs b/tests/rustdoc-ui/doctest/display-output.rs similarity index 84% rename from tests/rustdoc-ui/display-output.rs rename to tests/rustdoc-ui/doctest/display-output.rs index 23bc54e3cde1a..7a26dbff98613 100644 --- a/tests/rustdoc-ui/display-output.rs +++ b/tests/rustdoc-ui/doctest/display-output.rs @@ -3,7 +3,7 @@ // check-pass // edition:2018 // compile-flags:--test --test-args=--show-output -// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR" +// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" // normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" /// ``` diff --git a/tests/rustdoc-ui/display-output.stdout b/tests/rustdoc-ui/doctest/display-output.stdout similarity index 100% rename from tests/rustdoc-ui/display-output.stdout rename to tests/rustdoc-ui/doctest/display-output.stdout diff --git a/tests/rustdoc-ui/doc-comment-multi-line-attr.rs b/tests/rustdoc-ui/doctest/doc-comment-multi-line-attr.rs similarity index 80% rename from tests/rustdoc-ui/doc-comment-multi-line-attr.rs rename to tests/rustdoc-ui/doctest/doc-comment-multi-line-attr.rs index db674e229fc0d..75508f435b3ca 100644 --- a/tests/rustdoc-ui/doc-comment-multi-line-attr.rs +++ b/tests/rustdoc-ui/doctest/doc-comment-multi-line-attr.rs @@ -1,6 +1,6 @@ // Regression test for #97440: Multiline inner attribute triggers ICE during doctest // compile-flags:--test -// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR" +// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" // normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" // check-pass diff --git a/tests/rustdoc-ui/doc-comment-multi-line-attr.stdout b/tests/rustdoc-ui/doctest/doc-comment-multi-line-attr.stdout similarity index 100% rename from tests/rustdoc-ui/doc-comment-multi-line-attr.stdout rename to tests/rustdoc-ui/doctest/doc-comment-multi-line-attr.stdout diff --git a/tests/rustdoc-ui/doc-comment-multi-line-cfg-attr.rs b/tests/rustdoc-ui/doctest/doc-comment-multi-line-cfg-attr.rs similarity index 78% rename from tests/rustdoc-ui/doc-comment-multi-line-cfg-attr.rs rename to tests/rustdoc-ui/doctest/doc-comment-multi-line-cfg-attr.rs index 6ce3cb9fc0707..3b0b27edb7d08 100644 --- a/tests/rustdoc-ui/doc-comment-multi-line-cfg-attr.rs +++ b/tests/rustdoc-ui/doctest/doc-comment-multi-line-cfg-attr.rs @@ -1,5 +1,5 @@ // compile-flags:--test -// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR" +// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" // normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" // check-pass diff --git a/tests/rustdoc-ui/doc-comment-multi-line-cfg-attr.stdout b/tests/rustdoc-ui/doctest/doc-comment-multi-line-cfg-attr.stdout similarity index 100% rename from tests/rustdoc-ui/doc-comment-multi-line-cfg-attr.stdout rename to tests/rustdoc-ui/doctest/doc-comment-multi-line-cfg-attr.stdout diff --git a/tests/rustdoc-ui/doc-test-attr-pass.rs b/tests/rustdoc-ui/doctest/doc-test-attr-pass.rs similarity index 100% rename from tests/rustdoc-ui/doc-test-attr-pass.rs rename to tests/rustdoc-ui/doctest/doc-test-attr-pass.rs diff --git a/tests/rustdoc-ui/doc-test-attr.rs b/tests/rustdoc-ui/doctest/doc-test-attr.rs similarity index 100% rename from tests/rustdoc-ui/doc-test-attr.rs rename to tests/rustdoc-ui/doctest/doc-test-attr.rs diff --git a/tests/rustdoc-ui/doc-test-attr.stderr b/tests/rustdoc-ui/doctest/doc-test-attr.stderr similarity index 100% rename from tests/rustdoc-ui/doc-test-attr.stderr rename to tests/rustdoc-ui/doctest/doc-test-attr.stderr diff --git a/tests/rustdoc-ui/doc-test-doctest-feature.rs b/tests/rustdoc-ui/doctest/doc-test-doctest-feature.rs similarity index 81% rename from tests/rustdoc-ui/doc-test-doctest-feature.rs rename to tests/rustdoc-ui/doctest/doc-test-doctest-feature.rs index 88cf44e643be0..9c1f4936eab31 100644 --- a/tests/rustdoc-ui/doc-test-doctest-feature.rs +++ b/tests/rustdoc-ui/doctest/doc-test-doctest-feature.rs @@ -1,6 +1,6 @@ // check-pass // compile-flags:--test -// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR" +// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" // normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" // Make sure `cfg(doctest)` is set when finding doctests but not inside diff --git a/tests/rustdoc-ui/doc-test-doctest-feature.stdout b/tests/rustdoc-ui/doctest/doc-test-doctest-feature.stdout similarity index 100% rename from tests/rustdoc-ui/doc-test-doctest-feature.stdout rename to tests/rustdoc-ui/doctest/doc-test-doctest-feature.stdout diff --git a/tests/rustdoc-ui/doc-test-rustdoc-feature.rs b/tests/rustdoc-ui/doctest/doc-test-rustdoc-feature.rs similarity index 82% rename from tests/rustdoc-ui/doc-test-rustdoc-feature.rs rename to tests/rustdoc-ui/doctest/doc-test-rustdoc-feature.rs index dc72a4857645e..1f90d13af84fc 100644 --- a/tests/rustdoc-ui/doc-test-rustdoc-feature.rs +++ b/tests/rustdoc-ui/doctest/doc-test-rustdoc-feature.rs @@ -1,6 +1,6 @@ // check-pass // compile-flags:--test -// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR" +// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" // normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" #![feature(doc_cfg)] diff --git a/tests/rustdoc-ui/doc-test-rustdoc-feature.stdout b/tests/rustdoc-ui/doctest/doc-test-rustdoc-feature.stdout similarity index 100% rename from tests/rustdoc-ui/doc-test-rustdoc-feature.stdout rename to tests/rustdoc-ui/doctest/doc-test-rustdoc-feature.stdout diff --git a/tests/rustdoc-ui/doctest-edition.rs b/tests/rustdoc-ui/doctest/doctest-edition.rs similarity index 100% rename from tests/rustdoc-ui/doctest-edition.rs rename to tests/rustdoc-ui/doctest/doctest-edition.rs diff --git a/tests/rustdoc-ui/doctest-edition.stderr b/tests/rustdoc-ui/doctest/doctest-edition.stderr similarity index 100% rename from tests/rustdoc-ui/doctest-edition.stderr rename to tests/rustdoc-ui/doctest/doctest-edition.stderr diff --git a/tests/rustdoc-ui/doctest-multiline-crate-attribute.rs b/tests/rustdoc-ui/doctest/doctest-multiline-crate-attribute.rs similarity index 81% rename from tests/rustdoc-ui/doctest-multiline-crate-attribute.rs rename to tests/rustdoc-ui/doctest/doctest-multiline-crate-attribute.rs index 260f5a7a64f50..a3bde6cb94103 100644 --- a/tests/rustdoc-ui/doctest-multiline-crate-attribute.rs +++ b/tests/rustdoc-ui/doctest/doctest-multiline-crate-attribute.rs @@ -1,5 +1,5 @@ // compile-flags:--test --test-args=--test-threads=1 -// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR" +// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" // normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" // check-pass diff --git a/tests/rustdoc-ui/doctest-multiline-crate-attribute.stdout b/tests/rustdoc-ui/doctest/doctest-multiline-crate-attribute.stdout similarity index 100% rename from tests/rustdoc-ui/doctest-multiline-crate-attribute.stdout rename to tests/rustdoc-ui/doctest/doctest-multiline-crate-attribute.stdout diff --git a/tests/rustdoc-ui/doctest-output.rs b/tests/rustdoc-ui/doctest/doctest-output.rs similarity index 87% rename from tests/rustdoc-ui/doctest-output.rs rename to tests/rustdoc-ui/doctest/doctest-output.rs index 303f768969817..26754b73f0bc0 100644 --- a/tests/rustdoc-ui/doctest-output.rs +++ b/tests/rustdoc-ui/doctest/doctest-output.rs @@ -1,7 +1,7 @@ // edition:2018 // aux-build:extern_macros.rs // compile-flags:--test --test-args=--test-threads=1 -// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR" +// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" // normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" // check-pass diff --git a/tests/rustdoc-ui/doctest-output.stdout b/tests/rustdoc-ui/doctest/doctest-output.stdout similarity index 100% rename from tests/rustdoc-ui/doctest-output.stdout rename to tests/rustdoc-ui/doctest/doctest-output.stdout diff --git a/tests/rustdoc-ui/failed-doctest-compile-fail.rs b/tests/rustdoc-ui/doctest/failed-doctest-compile-fail.rs similarity index 84% rename from tests/rustdoc-ui/failed-doctest-compile-fail.rs rename to tests/rustdoc-ui/doctest/failed-doctest-compile-fail.rs index 4dfca600f1627..53b3857dfde69 100644 --- a/tests/rustdoc-ui/failed-doctest-compile-fail.rs +++ b/tests/rustdoc-ui/doctest/failed-doctest-compile-fail.rs @@ -2,7 +2,7 @@ // adapted to use that, and that normalize line can go away // compile-flags:--test -// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR" +// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" // normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" // failure-status: 101 diff --git a/tests/rustdoc-ui/failed-doctest-compile-fail.stdout b/tests/rustdoc-ui/doctest/failed-doctest-compile-fail.stdout similarity index 100% rename from tests/rustdoc-ui/failed-doctest-compile-fail.stdout rename to tests/rustdoc-ui/doctest/failed-doctest-compile-fail.stdout diff --git a/tests/rustdoc-ui/failed-doctest-extra-semicolon-on-item.rs b/tests/rustdoc-ui/doctest/failed-doctest-extra-semicolon-on-item.rs similarity index 88% rename from tests/rustdoc-ui/failed-doctest-extra-semicolon-on-item.rs rename to tests/rustdoc-ui/doctest/failed-doctest-extra-semicolon-on-item.rs index 03a5b9d5d842f..84e4d61603aef 100644 --- a/tests/rustdoc-ui/failed-doctest-extra-semicolon-on-item.rs +++ b/tests/rustdoc-ui/doctest/failed-doctest-extra-semicolon-on-item.rs @@ -2,7 +2,7 @@ // adapted to use that, and that normalize line can go away // compile-flags:--test -// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR" +// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" // normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" // failure-status: 101 diff --git a/tests/rustdoc-ui/failed-doctest-extra-semicolon-on-item.stdout b/tests/rustdoc-ui/doctest/failed-doctest-extra-semicolon-on-item.stdout similarity index 100% rename from tests/rustdoc-ui/failed-doctest-extra-semicolon-on-item.stdout rename to tests/rustdoc-ui/doctest/failed-doctest-extra-semicolon-on-item.stdout diff --git a/tests/rustdoc-ui/failed-doctest-missing-codes.rs b/tests/rustdoc-ui/doctest/failed-doctest-missing-codes.rs similarity index 84% rename from tests/rustdoc-ui/failed-doctest-missing-codes.rs rename to tests/rustdoc-ui/doctest/failed-doctest-missing-codes.rs index 66a229a0c7576..4e3b848fc02bc 100644 --- a/tests/rustdoc-ui/failed-doctest-missing-codes.rs +++ b/tests/rustdoc-ui/doctest/failed-doctest-missing-codes.rs @@ -2,7 +2,7 @@ // adapted to use that, and that normalize line can go away // compile-flags:--test -// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR" +// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" // normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" // failure-status: 101 diff --git a/tests/rustdoc-ui/failed-doctest-missing-codes.stdout b/tests/rustdoc-ui/doctest/failed-doctest-missing-codes.stdout similarity index 100% rename from tests/rustdoc-ui/failed-doctest-missing-codes.stdout rename to tests/rustdoc-ui/doctest/failed-doctest-missing-codes.stdout diff --git a/tests/rustdoc-ui/failed-doctest-output-windows.rs b/tests/rustdoc-ui/doctest/failed-doctest-output-windows.rs similarity index 92% rename from tests/rustdoc-ui/failed-doctest-output-windows.rs rename to tests/rustdoc-ui/doctest/failed-doctest-output-windows.rs index 456a9e68f20c1..6bc6c33c76ecc 100644 --- a/tests/rustdoc-ui/failed-doctest-output-windows.rs +++ b/tests/rustdoc-ui/doctest/failed-doctest-output-windows.rs @@ -7,7 +7,7 @@ // compile-flags:--test --test-args --test-threads=1 // rustc-env:RUST_BACKTRACE=0 -// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR" +// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" // normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" // failure-status: 101 diff --git a/tests/rustdoc-ui/failed-doctest-output-windows.stdout b/tests/rustdoc-ui/doctest/failed-doctest-output-windows.stdout similarity index 100% rename from tests/rustdoc-ui/failed-doctest-output-windows.stdout rename to tests/rustdoc-ui/doctest/failed-doctest-output-windows.stdout diff --git a/tests/rustdoc-ui/failed-doctest-output.rs b/tests/rustdoc-ui/doctest/failed-doctest-output.rs similarity index 92% rename from tests/rustdoc-ui/failed-doctest-output.rs rename to tests/rustdoc-ui/doctest/failed-doctest-output.rs index 77647f8eca954..3e1312382ee87 100644 --- a/tests/rustdoc-ui/failed-doctest-output.rs +++ b/tests/rustdoc-ui/doctest/failed-doctest-output.rs @@ -7,7 +7,7 @@ // compile-flags:--test --test-args --test-threads=1 // rustc-env:RUST_BACKTRACE=0 -// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR" +// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" // normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" // failure-status: 101 diff --git a/tests/rustdoc-ui/failed-doctest-output.stdout b/tests/rustdoc-ui/doctest/failed-doctest-output.stdout similarity index 100% rename from tests/rustdoc-ui/failed-doctest-output.stdout rename to tests/rustdoc-ui/doctest/failed-doctest-output.stdout diff --git a/tests/rustdoc-ui/failed-doctest-should-panic.rs b/tests/rustdoc-ui/doctest/failed-doctest-should-panic.rs similarity index 84% rename from tests/rustdoc-ui/failed-doctest-should-panic.rs rename to tests/rustdoc-ui/doctest/failed-doctest-should-panic.rs index c134f80064d55..36284e814f3c4 100644 --- a/tests/rustdoc-ui/failed-doctest-should-panic.rs +++ b/tests/rustdoc-ui/doctest/failed-doctest-should-panic.rs @@ -2,7 +2,7 @@ // adapted to use that, and that normalize line can go away // compile-flags:--test -// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR" +// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" // normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" // failure-status: 101 diff --git a/tests/rustdoc-ui/failed-doctest-should-panic.stdout b/tests/rustdoc-ui/doctest/failed-doctest-should-panic.stdout similarity index 100% rename from tests/rustdoc-ui/failed-doctest-should-panic.stdout rename to tests/rustdoc-ui/doctest/failed-doctest-should-panic.stdout diff --git a/tests/rustdoc-ui/no-run-flag-error.rs b/tests/rustdoc-ui/doctest/no-run-flag-error.rs similarity index 100% rename from tests/rustdoc-ui/no-run-flag-error.rs rename to tests/rustdoc-ui/doctest/no-run-flag-error.rs diff --git a/tests/rustdoc-ui/no-run-flag-error.stderr b/tests/rustdoc-ui/doctest/no-run-flag-error.stderr similarity index 100% rename from tests/rustdoc-ui/no-run-flag-error.stderr rename to tests/rustdoc-ui/doctest/no-run-flag-error.stderr diff --git a/tests/rustdoc-ui/no-run-flag.rs b/tests/rustdoc-ui/doctest/no-run-flag.rs similarity index 91% rename from tests/rustdoc-ui/no-run-flag.rs rename to tests/rustdoc-ui/doctest/no-run-flag.rs index 181730eb41618..1cf3b7c4bb3d0 100644 --- a/tests/rustdoc-ui/no-run-flag.rs +++ b/tests/rustdoc-ui/doctest/no-run-flag.rs @@ -2,7 +2,7 @@ // check-pass // compile-flags:-Z unstable-options --test --no-run --test-args=--test-threads=1 -// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR" +// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" // normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" /// ``` diff --git a/tests/rustdoc-ui/no-run-flag.stdout b/tests/rustdoc-ui/doctest/no-run-flag.stdout similarity index 100% rename from tests/rustdoc-ui/no-run-flag.stdout rename to tests/rustdoc-ui/doctest/no-run-flag.stdout diff --git a/tests/rustdoc-ui/nocapture-fail.rs b/tests/rustdoc-ui/doctest/nocapture-fail.rs similarity index 63% rename from tests/rustdoc-ui/nocapture-fail.rs rename to tests/rustdoc-ui/doctest/nocapture-fail.rs index 9a3fb592c6304..ce487a43db418 100644 --- a/tests/rustdoc-ui/nocapture-fail.rs +++ b/tests/rustdoc-ui/doctest/nocapture-fail.rs @@ -1,7 +1,7 @@ // check-pass // compile-flags:--test -Zunstable-options --nocapture -// normalize-stderr-test: "tests/rustdoc-ui" -> "$$DIR" -// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR" +// normalize-stderr-test: "tests/rustdoc-ui/doctest" -> "$$DIR" +// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" // normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" /// ```compile_fail diff --git a/tests/rustdoc-ui/nocapture-fail.stderr b/tests/rustdoc-ui/doctest/nocapture-fail.stderr similarity index 100% rename from tests/rustdoc-ui/nocapture-fail.stderr rename to tests/rustdoc-ui/doctest/nocapture-fail.stderr diff --git a/tests/rustdoc-ui/nocapture-fail.stdout b/tests/rustdoc-ui/doctest/nocapture-fail.stdout similarity index 100% rename from tests/rustdoc-ui/nocapture-fail.stdout rename to tests/rustdoc-ui/doctest/nocapture-fail.stdout diff --git a/tests/rustdoc-ui/nocapture.rs b/tests/rustdoc-ui/doctest/nocapture.rs similarity index 77% rename from tests/rustdoc-ui/nocapture.rs rename to tests/rustdoc-ui/doctest/nocapture.rs index 3eb38f2fb3b8b..25fbcf857e256 100644 --- a/tests/rustdoc-ui/nocapture.rs +++ b/tests/rustdoc-ui/doctest/nocapture.rs @@ -1,6 +1,6 @@ // check-pass // compile-flags:--test -Zunstable-options --nocapture -// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR" +// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" // normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" /// ``` diff --git a/tests/rustdoc-ui/nocapture.stderr b/tests/rustdoc-ui/doctest/nocapture.stderr similarity index 100% rename from tests/rustdoc-ui/nocapture.stderr rename to tests/rustdoc-ui/doctest/nocapture.stderr diff --git a/tests/rustdoc-ui/nocapture.stdout b/tests/rustdoc-ui/doctest/nocapture.stdout similarity index 100% rename from tests/rustdoc-ui/nocapture.stdout rename to tests/rustdoc-ui/doctest/nocapture.stdout diff --git a/tests/rustdoc-ui/private-doc-test.rs b/tests/rustdoc-ui/doctest/private-doc-test.rs similarity index 100% rename from tests/rustdoc-ui/private-doc-test.rs rename to tests/rustdoc-ui/doctest/private-doc-test.rs diff --git a/tests/rustdoc-ui/private-item-doc-test.rs b/tests/rustdoc-ui/doctest/private-item-doc-test.rs similarity index 100% rename from tests/rustdoc-ui/private-item-doc-test.rs rename to tests/rustdoc-ui/doctest/private-item-doc-test.rs diff --git a/tests/rustdoc-ui/private-item-doc-test.stderr b/tests/rustdoc-ui/doctest/private-item-doc-test.stderr similarity index 100% rename from tests/rustdoc-ui/private-item-doc-test.stderr rename to tests/rustdoc-ui/doctest/private-item-doc-test.stderr diff --git a/tests/rustdoc-ui/private-public-item-doc-test.rs b/tests/rustdoc-ui/doctest/private-public-item-doc-test.rs similarity index 100% rename from tests/rustdoc-ui/private-public-item-doc-test.rs rename to tests/rustdoc-ui/doctest/private-public-item-doc-test.rs diff --git a/tests/rustdoc-ui/private-public-item-doc-test.stderr b/tests/rustdoc-ui/doctest/private-public-item-doc-test.stderr similarity index 100% rename from tests/rustdoc-ui/private-public-item-doc-test.stderr rename to tests/rustdoc-ui/doctest/private-public-item-doc-test.stderr diff --git a/tests/rustdoc-ui/public-reexported-item-doc-test.rs b/tests/rustdoc-ui/doctest/public-reexported-item-doc-test.rs similarity index 100% rename from tests/rustdoc-ui/public-reexported-item-doc-test.rs rename to tests/rustdoc-ui/doctest/public-reexported-item-doc-test.rs diff --git a/tests/rustdoc-ui/run-directory.correct.stdout b/tests/rustdoc-ui/doctest/run-directory.correct.stdout similarity index 100% rename from tests/rustdoc-ui/run-directory.correct.stdout rename to tests/rustdoc-ui/doctest/run-directory.correct.stdout diff --git a/tests/rustdoc-ui/run-directory.incorrect.stdout b/tests/rustdoc-ui/doctest/run-directory.incorrect.stdout similarity index 100% rename from tests/rustdoc-ui/run-directory.incorrect.stdout rename to tests/rustdoc-ui/doctest/run-directory.incorrect.stdout diff --git a/tests/rustdoc-ui/run-directory.rs b/tests/rustdoc-ui/doctest/run-directory.rs similarity index 70% rename from tests/rustdoc-ui/run-directory.rs rename to tests/rustdoc-ui/doctest/run-directory.rs index b8d0647f08d8e..1ff0af2d17cb3 100644 --- a/tests/rustdoc-ui/run-directory.rs +++ b/tests/rustdoc-ui/doctest/run-directory.rs @@ -4,12 +4,12 @@ // check-pass // [correct]compile-flags:--test --test-run-directory={{src-base}} // [incorrect]compile-flags:--test --test-run-directory={{src-base}}/coverage -// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR" +// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" // normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" /// ``` /// assert_eq!( -/// std::fs::read_to_string("run-directory.rs").unwrap(), +/// std::fs::read_to_string("doctest/run-directory.rs").unwrap(), /// include_str!("run-directory.rs"), /// ); /// ``` @@ -17,7 +17,7 @@ pub fn foo() {} /// ``` -/// assert!(std::fs::read_to_string("run-directory.rs").is_err()); +/// assert!(std::fs::read_to_string("doctest/run-directory.rs").is_err()); /// ``` #[cfg(incorrect)] pub fn foo() {} diff --git a/tests/rustdoc-ui/test-compile-fail1.rs b/tests/rustdoc-ui/doctest/test-compile-fail1.rs similarity index 100% rename from tests/rustdoc-ui/test-compile-fail1.rs rename to tests/rustdoc-ui/doctest/test-compile-fail1.rs diff --git a/tests/rustdoc-ui/test-compile-fail1.stderr b/tests/rustdoc-ui/doctest/test-compile-fail1.stderr similarity index 100% rename from tests/rustdoc-ui/test-compile-fail1.stderr rename to tests/rustdoc-ui/doctest/test-compile-fail1.stderr diff --git a/tests/rustdoc-ui/test-compile-fail2.rs b/tests/rustdoc-ui/doctest/test-compile-fail2.rs similarity index 100% rename from tests/rustdoc-ui/test-compile-fail2.rs rename to tests/rustdoc-ui/doctest/test-compile-fail2.rs diff --git a/tests/rustdoc-ui/test-compile-fail2.stderr b/tests/rustdoc-ui/doctest/test-compile-fail2.stderr similarity index 100% rename from tests/rustdoc-ui/test-compile-fail2.stderr rename to tests/rustdoc-ui/doctest/test-compile-fail2.stderr diff --git a/tests/rustdoc-ui/test-compile-fail3.rs b/tests/rustdoc-ui/doctest/test-compile-fail3.rs similarity index 100% rename from tests/rustdoc-ui/test-compile-fail3.rs rename to tests/rustdoc-ui/doctest/test-compile-fail3.rs diff --git a/tests/rustdoc-ui/test-compile-fail3.stderr b/tests/rustdoc-ui/doctest/test-compile-fail3.stderr similarity index 100% rename from tests/rustdoc-ui/test-compile-fail3.stderr rename to tests/rustdoc-ui/doctest/test-compile-fail3.stderr diff --git a/tests/rustdoc-ui/test-no_std.rs b/tests/rustdoc-ui/doctest/test-no_std.rs similarity index 75% rename from tests/rustdoc-ui/test-no_std.rs rename to tests/rustdoc-ui/doctest/test-no_std.rs index 51abf1c721768..fd651d1a34421 100644 --- a/tests/rustdoc-ui/test-no_std.rs +++ b/tests/rustdoc-ui/doctest/test-no_std.rs @@ -1,5 +1,5 @@ // compile-flags:--test -// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR" +// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" // normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" // check-pass diff --git a/tests/rustdoc-ui/test-no_std.stdout b/tests/rustdoc-ui/doctest/test-no_std.stdout similarity index 100% rename from tests/rustdoc-ui/test-no_std.stdout rename to tests/rustdoc-ui/doctest/test-no_std.stdout diff --git a/tests/rustdoc-ui/test-type.rs b/tests/rustdoc-ui/doctest/test-type.rs similarity index 87% rename from tests/rustdoc-ui/test-type.rs rename to tests/rustdoc-ui/doctest/test-type.rs index 7f5a8f3fc415a..036d37f9db2b2 100644 --- a/tests/rustdoc-ui/test-type.rs +++ b/tests/rustdoc-ui/doctest/test-type.rs @@ -1,6 +1,6 @@ // compile-flags: --test --test-args=--test-threads=1 // check-pass -// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR" +// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" // normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" /// ``` diff --git a/tests/rustdoc-ui/test-type.stdout b/tests/rustdoc-ui/doctest/test-type.stdout similarity index 100% rename from tests/rustdoc-ui/test-type.stdout rename to tests/rustdoc-ui/doctest/test-type.stdout diff --git a/tests/rustdoc-ui/unparseable-doc-test.rs b/tests/rustdoc-ui/doctest/unparseable-doc-test.rs similarity index 77% rename from tests/rustdoc-ui/unparseable-doc-test.rs rename to tests/rustdoc-ui/doctest/unparseable-doc-test.rs index f0a56a91bf549..fd8b2094d0201 100644 --- a/tests/rustdoc-ui/unparseable-doc-test.rs +++ b/tests/rustdoc-ui/doctest/unparseable-doc-test.rs @@ -1,5 +1,5 @@ // compile-flags: --test -// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR" +// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" // normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" // failure-status: 101 // rustc-env: RUST_BACKTRACE=0 diff --git a/tests/rustdoc-ui/unparseable-doc-test.stdout b/tests/rustdoc-ui/doctest/unparseable-doc-test.stdout similarity index 100% rename from tests/rustdoc-ui/unparseable-doc-test.stdout rename to tests/rustdoc-ui/doctest/unparseable-doc-test.stdout diff --git a/tests/rustdoc-ui/generate-link-to-definition-opt-unstable.rs b/tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt-unstable.rs similarity index 100% rename from tests/rustdoc-ui/generate-link-to-definition-opt-unstable.rs rename to tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt-unstable.rs diff --git a/tests/rustdoc-ui/generate-link-to-definition-opt-unstable.stderr b/tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt-unstable.stderr similarity index 100% rename from tests/rustdoc-ui/generate-link-to-definition-opt-unstable.stderr rename to tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt-unstable.stderr diff --git a/tests/rustdoc-ui/generate-link-to-definition-opt.rs b/tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt.rs similarity index 100% rename from tests/rustdoc-ui/generate-link-to-definition-opt.rs rename to tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt.rs diff --git a/tests/rustdoc-ui/generate-link-to-definition-opt.stderr b/tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt.stderr similarity index 100% rename from tests/rustdoc-ui/generate-link-to-definition-opt.stderr rename to tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt.stderr diff --git a/tests/rustdoc-ui/generate-link-to-definition-opt2.rs b/tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt2.rs similarity index 100% rename from tests/rustdoc-ui/generate-link-to-definition-opt2.rs rename to tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt2.rs diff --git a/tests/rustdoc-ui/generate-link-to-definition-opt2.stderr b/tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt2.stderr similarity index 100% rename from tests/rustdoc-ui/generate-link-to-definition-opt2.stderr rename to tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt2.stderr diff --git a/tests/rustdoc-ui/deny-intra-link-resolution-failure.rs b/tests/rustdoc-ui/intra-doc/deny-intra-link-resolution-failure.rs similarity index 100% rename from tests/rustdoc-ui/deny-intra-link-resolution-failure.rs rename to tests/rustdoc-ui/intra-doc/deny-intra-link-resolution-failure.rs diff --git a/tests/rustdoc-ui/deny-intra-link-resolution-failure.stderr b/tests/rustdoc-ui/intra-doc/deny-intra-link-resolution-failure.stderr similarity index 100% rename from tests/rustdoc-ui/deny-intra-link-resolution-failure.stderr rename to tests/rustdoc-ui/intra-doc/deny-intra-link-resolution-failure.stderr diff --git a/tests/rustdoc-ui/auxiliary/empty-fn.rs b/tests/rustdoc-ui/issues/auxiliary/empty-fn.rs similarity index 100% rename from tests/rustdoc-ui/auxiliary/empty-fn.rs rename to tests/rustdoc-ui/issues/auxiliary/empty-fn.rs diff --git a/tests/rustdoc-ui/auxiliary/issue-61592.rs b/tests/rustdoc-ui/issues/auxiliary/issue-61592.rs similarity index 100% rename from tests/rustdoc-ui/auxiliary/issue-61592.rs rename to tests/rustdoc-ui/issues/auxiliary/issue-61592.rs diff --git a/tests/rustdoc-ui/auxiliary/panic-handler.rs b/tests/rustdoc-ui/issues/auxiliary/panic-handler.rs similarity index 100% rename from tests/rustdoc-ui/auxiliary/panic-handler.rs rename to tests/rustdoc-ui/issues/auxiliary/panic-handler.rs diff --git a/tests/rustdoc-ui/issue-101076.rs b/tests/rustdoc-ui/issues/issue-101076.rs similarity index 100% rename from tests/rustdoc-ui/issue-101076.rs rename to tests/rustdoc-ui/issues/issue-101076.rs diff --git a/tests/rustdoc-ui/issue-102986.rs b/tests/rustdoc-ui/issues/issue-102986.rs similarity index 100% rename from tests/rustdoc-ui/issue-102986.rs rename to tests/rustdoc-ui/issues/issue-102986.rs diff --git a/tests/rustdoc-ui/issue-102986.stderr b/tests/rustdoc-ui/issues/issue-102986.stderr similarity index 100% rename from tests/rustdoc-ui/issue-102986.stderr rename to tests/rustdoc-ui/issues/issue-102986.stderr diff --git a/tests/rustdoc-ui/issue-103997.rs b/tests/rustdoc-ui/issues/issue-103997.rs similarity index 100% rename from tests/rustdoc-ui/issue-103997.rs rename to tests/rustdoc-ui/issues/issue-103997.rs diff --git a/tests/rustdoc-ui/issue-103997.stderr b/tests/rustdoc-ui/issues/issue-103997.stderr similarity index 100% rename from tests/rustdoc-ui/issue-103997.stderr rename to tests/rustdoc-ui/issues/issue-103997.stderr diff --git a/tests/rustdoc-ui/issue-105334.rs b/tests/rustdoc-ui/issues/issue-105334.rs similarity index 100% rename from tests/rustdoc-ui/issue-105334.rs rename to tests/rustdoc-ui/issues/issue-105334.rs diff --git a/tests/rustdoc-ui/issue-105334.stderr b/tests/rustdoc-ui/issues/issue-105334.stderr similarity index 100% rename from tests/rustdoc-ui/issue-105334.stderr rename to tests/rustdoc-ui/issues/issue-105334.stderr diff --git a/tests/rustdoc-ui/issue-105737.rs b/tests/rustdoc-ui/issues/issue-105737.rs similarity index 100% rename from tests/rustdoc-ui/issue-105737.rs rename to tests/rustdoc-ui/issues/issue-105737.rs diff --git a/tests/rustdoc-ui/issue-105737.stderr b/tests/rustdoc-ui/issues/issue-105737.stderr similarity index 100% rename from tests/rustdoc-ui/issue-105737.stderr rename to tests/rustdoc-ui/issues/issue-105737.stderr diff --git a/tests/rustdoc-ui/issue-105742.rs b/tests/rustdoc-ui/issues/issue-105742.rs similarity index 100% rename from tests/rustdoc-ui/issue-105742.rs rename to tests/rustdoc-ui/issues/issue-105742.rs diff --git a/tests/rustdoc-ui/issue-105742.stderr b/tests/rustdoc-ui/issues/issue-105742.stderr similarity index 100% rename from tests/rustdoc-ui/issue-105742.stderr rename to tests/rustdoc-ui/issues/issue-105742.stderr diff --git a/tests/rustdoc-ui/issue-106213.rs b/tests/rustdoc-ui/issues/issue-106213.rs similarity index 100% rename from tests/rustdoc-ui/issue-106213.rs rename to tests/rustdoc-ui/issues/issue-106213.rs diff --git a/tests/rustdoc-ui/issue-106213.stderr b/tests/rustdoc-ui/issues/issue-106213.stderr similarity index 100% rename from tests/rustdoc-ui/issue-106213.stderr rename to tests/rustdoc-ui/issues/issue-106213.stderr diff --git a/tests/rustdoc-ui/issue-106226.rs b/tests/rustdoc-ui/issues/issue-106226.rs similarity index 100% rename from tests/rustdoc-ui/issue-106226.rs rename to tests/rustdoc-ui/issues/issue-106226.rs diff --git a/tests/rustdoc-ui/issue-106226.stderr b/tests/rustdoc-ui/issues/issue-106226.stderr similarity index 100% rename from tests/rustdoc-ui/issue-106226.stderr rename to tests/rustdoc-ui/issues/issue-106226.stderr diff --git a/tests/rustdoc-ui/issue-107918.rs b/tests/rustdoc-ui/issues/issue-107918.rs similarity index 100% rename from tests/rustdoc-ui/issue-107918.rs rename to tests/rustdoc-ui/issues/issue-107918.rs diff --git a/tests/rustdoc-ui/issue-109282-import-inline-merge.rs b/tests/rustdoc-ui/issues/issue-109282-import-inline-merge.rs similarity index 100% rename from tests/rustdoc-ui/issue-109282-import-inline-merge.rs rename to tests/rustdoc-ui/issues/issue-109282-import-inline-merge.rs diff --git a/tests/rustdoc-ui/issue-110900.rs b/tests/rustdoc-ui/issues/issue-110900.rs similarity index 100% rename from tests/rustdoc-ui/issue-110900.rs rename to tests/rustdoc-ui/issues/issue-110900.rs diff --git a/tests/rustdoc-ui/issue-58473-2.rs b/tests/rustdoc-ui/issues/issue-58473-2.rs similarity index 100% rename from tests/rustdoc-ui/issue-58473-2.rs rename to tests/rustdoc-ui/issues/issue-58473-2.rs diff --git a/tests/rustdoc-ui/issue-58473.rs b/tests/rustdoc-ui/issues/issue-58473.rs similarity index 100% rename from tests/rustdoc-ui/issue-58473.rs rename to tests/rustdoc-ui/issues/issue-58473.rs diff --git a/tests/rustdoc-ui/issue-61592-2.rs b/tests/rustdoc-ui/issues/issue-61592-2.rs similarity index 100% rename from tests/rustdoc-ui/issue-61592-2.rs rename to tests/rustdoc-ui/issues/issue-61592-2.rs diff --git a/tests/rustdoc-ui/issue-61592-2.stderr b/tests/rustdoc-ui/issues/issue-61592-2.stderr similarity index 100% rename from tests/rustdoc-ui/issue-61592-2.stderr rename to tests/rustdoc-ui/issues/issue-61592-2.stderr diff --git a/tests/rustdoc-ui/issue-61592.rs b/tests/rustdoc-ui/issues/issue-61592.rs similarity index 100% rename from tests/rustdoc-ui/issue-61592.rs rename to tests/rustdoc-ui/issues/issue-61592.rs diff --git a/tests/rustdoc-ui/issue-61592.stderr b/tests/rustdoc-ui/issues/issue-61592.stderr similarity index 100% rename from tests/rustdoc-ui/issue-61592.stderr rename to tests/rustdoc-ui/issues/issue-61592.stderr diff --git a/tests/rustdoc-ui/issue-61732.rs b/tests/rustdoc-ui/issues/issue-61732.rs similarity index 100% rename from tests/rustdoc-ui/issue-61732.rs rename to tests/rustdoc-ui/issues/issue-61732.rs diff --git a/tests/rustdoc-ui/issue-61732.stderr b/tests/rustdoc-ui/issues/issue-61732.stderr similarity index 100% rename from tests/rustdoc-ui/issue-61732.stderr rename to tests/rustdoc-ui/issues/issue-61732.stderr diff --git a/tests/rustdoc-ui/issue-74134.private.stderr b/tests/rustdoc-ui/issues/issue-74134.private.stderr similarity index 100% rename from tests/rustdoc-ui/issue-74134.private.stderr rename to tests/rustdoc-ui/issues/issue-74134.private.stderr diff --git a/tests/rustdoc-ui/issue-74134.public.stderr b/tests/rustdoc-ui/issues/issue-74134.public.stderr similarity index 100% rename from tests/rustdoc-ui/issue-74134.public.stderr rename to tests/rustdoc-ui/issues/issue-74134.public.stderr diff --git a/tests/rustdoc-ui/issue-74134.rs b/tests/rustdoc-ui/issues/issue-74134.rs similarity index 100% rename from tests/rustdoc-ui/issue-74134.rs rename to tests/rustdoc-ui/issues/issue-74134.rs diff --git a/tests/rustdoc-ui/issue-79465.rs b/tests/rustdoc-ui/issues/issue-79465.rs similarity index 100% rename from tests/rustdoc-ui/issue-79465.rs rename to tests/rustdoc-ui/issues/issue-79465.rs diff --git a/tests/rustdoc-ui/issue-79465.stderr b/tests/rustdoc-ui/issues/issue-79465.stderr similarity index 100% rename from tests/rustdoc-ui/issue-79465.stderr rename to tests/rustdoc-ui/issues/issue-79465.stderr diff --git a/tests/rustdoc-ui/issue-79467.rs b/tests/rustdoc-ui/issues/issue-79467.rs similarity index 100% rename from tests/rustdoc-ui/issue-79467.rs rename to tests/rustdoc-ui/issues/issue-79467.rs diff --git a/tests/rustdoc-ui/issue-79467.stderr b/tests/rustdoc-ui/issues/issue-79467.stderr similarity index 100% rename from tests/rustdoc-ui/issue-79467.stderr rename to tests/rustdoc-ui/issues/issue-79467.stderr diff --git a/tests/rustdoc-ui/issue-79494.rs b/tests/rustdoc-ui/issues/issue-79494.rs similarity index 100% rename from tests/rustdoc-ui/issue-79494.rs rename to tests/rustdoc-ui/issues/issue-79494.rs diff --git a/tests/rustdoc-ui/issue-79494.stderr b/tests/rustdoc-ui/issues/issue-79494.stderr similarity index 100% rename from tests/rustdoc-ui/issue-79494.stderr rename to tests/rustdoc-ui/issues/issue-79494.stderr diff --git a/tests/rustdoc-ui/issue-80992.rs b/tests/rustdoc-ui/issues/issue-80992.rs similarity index 78% rename from tests/rustdoc-ui/issue-80992.rs rename to tests/rustdoc-ui/issues/issue-80992.rs index 80ff225b8791f..f5ae16981ca11 100644 --- a/tests/rustdoc-ui/issue-80992.rs +++ b/tests/rustdoc-ui/issues/issue-80992.rs @@ -1,6 +1,6 @@ // check-pass // compile-flags:--test -// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR" +// normalize-stdout-test: "tests/rustdoc-ui/issues" -> "$$DIR" // normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" pub fn test() -> Result<(), ()> { diff --git a/tests/rustdoc-ui/issue-80992.stdout b/tests/rustdoc-ui/issues/issue-80992.stdout similarity index 100% rename from tests/rustdoc-ui/issue-80992.stdout rename to tests/rustdoc-ui/issues/issue-80992.stdout diff --git a/tests/rustdoc-ui/issue-81662-shortness.rs b/tests/rustdoc-ui/issues/issue-81662-shortness.rs similarity index 81% rename from tests/rustdoc-ui/issue-81662-shortness.rs rename to tests/rustdoc-ui/issues/issue-81662-shortness.rs index 8a90813b31d52..0240d217bee52 100644 --- a/tests/rustdoc-ui/issue-81662-shortness.rs +++ b/tests/rustdoc-ui/issues/issue-81662-shortness.rs @@ -1,5 +1,5 @@ // compile-flags:--test --error-format=short -// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR" +// normalize-stdout-test: "tests/rustdoc-ui/issues" -> "$$DIR" // normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" // failure-status: 101 diff --git a/tests/rustdoc-ui/issue-81662-shortness.stdout b/tests/rustdoc-ui/issues/issue-81662-shortness.stdout similarity index 100% rename from tests/rustdoc-ui/issue-81662-shortness.stdout rename to tests/rustdoc-ui/issues/issue-81662-shortness.stdout diff --git a/tests/rustdoc-ui/issue-83883-describe-lints.rs b/tests/rustdoc-ui/issues/issue-83883-describe-lints.rs similarity index 100% rename from tests/rustdoc-ui/issue-83883-describe-lints.rs rename to tests/rustdoc-ui/issues/issue-83883-describe-lints.rs diff --git a/tests/rustdoc-ui/issue-83883-describe-lints.stdout b/tests/rustdoc-ui/issues/issue-83883-describe-lints.stdout similarity index 100% rename from tests/rustdoc-ui/issue-83883-describe-lints.stdout rename to tests/rustdoc-ui/issues/issue-83883-describe-lints.stdout diff --git a/tests/rustdoc-ui/issue-91134.rs b/tests/rustdoc-ui/issues/issue-91134.rs similarity index 85% rename from tests/rustdoc-ui/issue-91134.rs rename to tests/rustdoc-ui/issues/issue-91134.rs index 42703ee4d7998..85362f186cc7f 100644 --- a/tests/rustdoc-ui/issue-91134.rs +++ b/tests/rustdoc-ui/issues/issue-91134.rs @@ -1,7 +1,7 @@ // compile-flags: --test --crate-name=empty_fn --extern=empty_fn --test-args=--test-threads=1 // aux-build:empty-fn.rs // check-pass -// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR" +// normalize-stdout-test: "tests/rustdoc-ui/issues" -> "$$DIR" // normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME" // edition:2021 diff --git a/tests/rustdoc-ui/issue-91134.stdout b/tests/rustdoc-ui/issues/issue-91134.stdout similarity index 100% rename from tests/rustdoc-ui/issue-91134.stdout rename to tests/rustdoc-ui/issues/issue-91134.stdout diff --git a/tests/rustdoc-ui/issue-91713.rs b/tests/rustdoc-ui/issues/issue-91713.rs similarity index 100% rename from tests/rustdoc-ui/issue-91713.rs rename to tests/rustdoc-ui/issues/issue-91713.rs diff --git a/tests/rustdoc-ui/issue-91713.stderr b/tests/rustdoc-ui/issues/issue-91713.stderr similarity index 100% rename from tests/rustdoc-ui/issue-91713.stderr rename to tests/rustdoc-ui/issues/issue-91713.stderr diff --git a/tests/rustdoc-ui/issue-91713.stdout b/tests/rustdoc-ui/issues/issue-91713.stdout similarity index 100% rename from tests/rustdoc-ui/issue-91713.stdout rename to tests/rustdoc-ui/issues/issue-91713.stdout diff --git a/tests/rustdoc-ui/issue-96287.rs b/tests/rustdoc-ui/issues/issue-96287.rs similarity index 100% rename from tests/rustdoc-ui/issue-96287.rs rename to tests/rustdoc-ui/issues/issue-96287.rs diff --git a/tests/rustdoc-ui/issue-96287.stderr b/tests/rustdoc-ui/issues/issue-96287.stderr similarity index 100% rename from tests/rustdoc-ui/issue-96287.stderr rename to tests/rustdoc-ui/issues/issue-96287.stderr diff --git a/tests/rustdoc-ui/issue-98690.rs b/tests/rustdoc-ui/issues/issue-98690.rs similarity index 100% rename from tests/rustdoc-ui/issue-98690.rs rename to tests/rustdoc-ui/issues/issue-98690.rs diff --git a/tests/rustdoc-ui/issue-98690.stderr b/tests/rustdoc-ui/issues/issue-98690.stderr similarity index 100% rename from tests/rustdoc-ui/issue-98690.stderr rename to tests/rustdoc-ui/issues/issue-98690.stderr diff --git a/tests/rustdoc-ui/scrape-examples-fail-if-type-error.rs b/tests/rustdoc-ui/scrape-examples/scrape-examples-fail-if-type-error.rs similarity index 100% rename from tests/rustdoc-ui/scrape-examples-fail-if-type-error.rs rename to tests/rustdoc-ui/scrape-examples/scrape-examples-fail-if-type-error.rs diff --git a/tests/rustdoc-ui/scrape-examples-fail-if-type-error.stderr b/tests/rustdoc-ui/scrape-examples/scrape-examples-fail-if-type-error.stderr similarity index 100% rename from tests/rustdoc-ui/scrape-examples-fail-if-type-error.stderr rename to tests/rustdoc-ui/scrape-examples/scrape-examples-fail-if-type-error.stderr diff --git a/tests/rustdoc-ui/scrape-examples-ice.rs b/tests/rustdoc-ui/scrape-examples/scrape-examples-ice.rs similarity index 100% rename from tests/rustdoc-ui/scrape-examples-ice.rs rename to tests/rustdoc-ui/scrape-examples/scrape-examples-ice.rs diff --git a/tests/rustdoc-ui/scrape-examples-wrong-options-1.rs b/tests/rustdoc-ui/scrape-examples/scrape-examples-wrong-options-1.rs similarity index 100% rename from tests/rustdoc-ui/scrape-examples-wrong-options-1.rs rename to tests/rustdoc-ui/scrape-examples/scrape-examples-wrong-options-1.rs diff --git a/tests/rustdoc-ui/scrape-examples-wrong-options-1.stderr b/tests/rustdoc-ui/scrape-examples/scrape-examples-wrong-options-1.stderr similarity index 100% rename from tests/rustdoc-ui/scrape-examples-wrong-options-1.stderr rename to tests/rustdoc-ui/scrape-examples/scrape-examples-wrong-options-1.stderr diff --git a/tests/rustdoc-ui/scrape-examples-wrong-options-2.rs b/tests/rustdoc-ui/scrape-examples/scrape-examples-wrong-options-2.rs similarity index 100% rename from tests/rustdoc-ui/scrape-examples-wrong-options-2.rs rename to tests/rustdoc-ui/scrape-examples/scrape-examples-wrong-options-2.rs diff --git a/tests/rustdoc-ui/scrape-examples-wrong-options-2.stderr b/tests/rustdoc-ui/scrape-examples/scrape-examples-wrong-options-2.stderr similarity index 100% rename from tests/rustdoc-ui/scrape-examples-wrong-options-2.stderr rename to tests/rustdoc-ui/scrape-examples/scrape-examples-wrong-options-2.stderr From 5da288f842f5616d58dc98338a833addf8a3cb2b Mon Sep 17 00:00:00 2001 From: jyn Date: Sat, 29 Apr 2023 04:25:04 -0500 Subject: [PATCH 08/13] move lint tests into subdirectories --- tests/rustdoc-ui/{ => intra-doc}/assoc-item-not-in-scope.rs | 0 tests/rustdoc-ui/{ => intra-doc}/assoc-item-not-in-scope.stderr | 0 tests/rustdoc-ui/{ => intra-doc}/pub-export-lint.rs | 0 tests/rustdoc-ui/{ => intra-doc}/pub-export-lint.stderr | 0 .../{ => intra-doc}/reference-link-reports-error-once.rs | 0 .../{ => intra-doc}/reference-link-reports-error-once.stderr | 0 tests/rustdoc-ui/{ => intra-doc}/reference-links.rs | 0 tests/rustdoc-ui/{ => intra-doc}/reference-links.stderr | 0 tests/rustdoc-ui/{ => lints}/bare-urls.fixed | 0 tests/rustdoc-ui/{ => lints}/bare-urls.rs | 0 tests/rustdoc-ui/{ => lints}/bare-urls.stderr | 0 tests/rustdoc-ui/{ => lints}/check-attr.rs | 0 tests/rustdoc-ui/{ => lints}/check-attr.stderr | 0 tests/rustdoc-ui/{ => lints}/check-fail.rs | 0 tests/rustdoc-ui/{ => lints}/check-fail.stderr | 0 tests/rustdoc-ui/{ => lints}/check.rs | 0 tests/rustdoc-ui/{ => lints}/check.stderr | 0 tests/rustdoc-ui/{ => lints}/deny-missing-docs-crate.rs | 0 tests/rustdoc-ui/{ => lints}/deny-missing-docs-crate.stderr | 0 tests/rustdoc-ui/{ => lints}/deny-missing-docs-macro.rs | 0 tests/rustdoc-ui/{ => lints}/deny-missing-docs-macro.stderr | 0 tests/rustdoc-ui/{ => lints}/doc-attr.rs | 0 tests/rustdoc-ui/{ => lints}/doc-attr.stderr | 0 tests/rustdoc-ui/{ => lints}/doc-spotlight.fixed | 0 tests/rustdoc-ui/{ => lints}/doc-spotlight.rs | 0 tests/rustdoc-ui/{ => lints}/doc-spotlight.stderr | 0 tests/rustdoc-ui/{ => lints}/doc-without-codeblock.rs | 0 tests/rustdoc-ui/{ => lints}/doc-without-codeblock.stderr | 0 tests/rustdoc-ui/{ => lints}/doc_cfg_hide.rs | 0 tests/rustdoc-ui/{ => lints}/doc_cfg_hide.stderr | 0 tests/rustdoc-ui/{ => lints}/expect-tool-lint-rfc-2383.rs | 0 tests/rustdoc-ui/{ => lints}/expect-tool-lint-rfc-2383.stderr | 0 .../{ => lints}/feature-gate-rustdoc_missing_doc_code_examples.rs | 0 .../feature-gate-rustdoc_missing_doc_code_examples.stderr | 0 tests/rustdoc-ui/{ => lints}/invalid-doc-attr.rs | 0 tests/rustdoc-ui/{ => lints}/invalid-doc-attr.stderr | 0 tests/rustdoc-ui/{ => lints}/invalid-html-self-closing-tag.rs | 0 tests/rustdoc-ui/{ => lints}/invalid-html-self-closing-tag.stderr | 0 tests/rustdoc-ui/{ => lints}/invalid-html-tags.rs | 0 tests/rustdoc-ui/{ => lints}/invalid-html-tags.stderr | 0 tests/rustdoc-ui/{ => lints}/lint-group.rs | 0 tests/rustdoc-ui/{ => lints}/lint-group.stderr | 0 tests/rustdoc-ui/{ => lints}/lint-missing-doc-code-example.rs | 0 tests/rustdoc-ui/{ => lints}/lint-missing-doc-code-example.stderr | 0 tests/rustdoc-ui/{ => lints}/no-crate-level-doc-lint.rs | 0 tests/rustdoc-ui/{ => lints}/no-crate-level-doc-lint.stderr | 0 tests/rustdoc-ui/{ => lints}/renamed-lint-still-applies.rs | 0 tests/rustdoc-ui/{ => lints}/renamed-lint-still-applies.stderr | 0 tests/rustdoc-ui/{ => lints}/rustdoc-all-only-stable-lints.rs | 0 tests/rustdoc-ui/{ => lints}/unknown-renamed-lints.rs | 0 tests/rustdoc-ui/{ => lints}/unknown-renamed-lints.stderr | 0 tests/rustdoc-ui/{ => lints}/unused-braces-lint.rs | 0 tests/rustdoc-ui/{ => lints}/unused.rs | 0 53 files changed, 0 insertions(+), 0 deletions(-) rename tests/rustdoc-ui/{ => intra-doc}/assoc-item-not-in-scope.rs (100%) rename tests/rustdoc-ui/{ => intra-doc}/assoc-item-not-in-scope.stderr (100%) rename tests/rustdoc-ui/{ => intra-doc}/pub-export-lint.rs (100%) rename tests/rustdoc-ui/{ => intra-doc}/pub-export-lint.stderr (100%) rename tests/rustdoc-ui/{ => intra-doc}/reference-link-reports-error-once.rs (100%) rename tests/rustdoc-ui/{ => intra-doc}/reference-link-reports-error-once.stderr (100%) rename tests/rustdoc-ui/{ => intra-doc}/reference-links.rs (100%) rename tests/rustdoc-ui/{ => intra-doc}/reference-links.stderr (100%) rename tests/rustdoc-ui/{ => lints}/bare-urls.fixed (100%) rename tests/rustdoc-ui/{ => lints}/bare-urls.rs (100%) rename tests/rustdoc-ui/{ => lints}/bare-urls.stderr (100%) rename tests/rustdoc-ui/{ => lints}/check-attr.rs (100%) rename tests/rustdoc-ui/{ => lints}/check-attr.stderr (100%) rename tests/rustdoc-ui/{ => lints}/check-fail.rs (100%) rename tests/rustdoc-ui/{ => lints}/check-fail.stderr (100%) rename tests/rustdoc-ui/{ => lints}/check.rs (100%) rename tests/rustdoc-ui/{ => lints}/check.stderr (100%) rename tests/rustdoc-ui/{ => lints}/deny-missing-docs-crate.rs (100%) rename tests/rustdoc-ui/{ => lints}/deny-missing-docs-crate.stderr (100%) rename tests/rustdoc-ui/{ => lints}/deny-missing-docs-macro.rs (100%) rename tests/rustdoc-ui/{ => lints}/deny-missing-docs-macro.stderr (100%) rename tests/rustdoc-ui/{ => lints}/doc-attr.rs (100%) rename tests/rustdoc-ui/{ => lints}/doc-attr.stderr (100%) rename tests/rustdoc-ui/{ => lints}/doc-spotlight.fixed (100%) rename tests/rustdoc-ui/{ => lints}/doc-spotlight.rs (100%) rename tests/rustdoc-ui/{ => lints}/doc-spotlight.stderr (100%) rename tests/rustdoc-ui/{ => lints}/doc-without-codeblock.rs (100%) rename tests/rustdoc-ui/{ => lints}/doc-without-codeblock.stderr (100%) rename tests/rustdoc-ui/{ => lints}/doc_cfg_hide.rs (100%) rename tests/rustdoc-ui/{ => lints}/doc_cfg_hide.stderr (100%) rename tests/rustdoc-ui/{ => lints}/expect-tool-lint-rfc-2383.rs (100%) rename tests/rustdoc-ui/{ => lints}/expect-tool-lint-rfc-2383.stderr (100%) rename tests/rustdoc-ui/{ => lints}/feature-gate-rustdoc_missing_doc_code_examples.rs (100%) rename tests/rustdoc-ui/{ => lints}/feature-gate-rustdoc_missing_doc_code_examples.stderr (100%) rename tests/rustdoc-ui/{ => lints}/invalid-doc-attr.rs (100%) rename tests/rustdoc-ui/{ => lints}/invalid-doc-attr.stderr (100%) rename tests/rustdoc-ui/{ => lints}/invalid-html-self-closing-tag.rs (100%) rename tests/rustdoc-ui/{ => lints}/invalid-html-self-closing-tag.stderr (100%) rename tests/rustdoc-ui/{ => lints}/invalid-html-tags.rs (100%) rename tests/rustdoc-ui/{ => lints}/invalid-html-tags.stderr (100%) rename tests/rustdoc-ui/{ => lints}/lint-group.rs (100%) rename tests/rustdoc-ui/{ => lints}/lint-group.stderr (100%) rename tests/rustdoc-ui/{ => lints}/lint-missing-doc-code-example.rs (100%) rename tests/rustdoc-ui/{ => lints}/lint-missing-doc-code-example.stderr (100%) rename tests/rustdoc-ui/{ => lints}/no-crate-level-doc-lint.rs (100%) rename tests/rustdoc-ui/{ => lints}/no-crate-level-doc-lint.stderr (100%) rename tests/rustdoc-ui/{ => lints}/renamed-lint-still-applies.rs (100%) rename tests/rustdoc-ui/{ => lints}/renamed-lint-still-applies.stderr (100%) rename tests/rustdoc-ui/{ => lints}/rustdoc-all-only-stable-lints.rs (100%) rename tests/rustdoc-ui/{ => lints}/unknown-renamed-lints.rs (100%) rename tests/rustdoc-ui/{ => lints}/unknown-renamed-lints.stderr (100%) rename tests/rustdoc-ui/{ => lints}/unused-braces-lint.rs (100%) rename tests/rustdoc-ui/{ => lints}/unused.rs (100%) diff --git a/tests/rustdoc-ui/assoc-item-not-in-scope.rs b/tests/rustdoc-ui/intra-doc/assoc-item-not-in-scope.rs similarity index 100% rename from tests/rustdoc-ui/assoc-item-not-in-scope.rs rename to tests/rustdoc-ui/intra-doc/assoc-item-not-in-scope.rs diff --git a/tests/rustdoc-ui/assoc-item-not-in-scope.stderr b/tests/rustdoc-ui/intra-doc/assoc-item-not-in-scope.stderr similarity index 100% rename from tests/rustdoc-ui/assoc-item-not-in-scope.stderr rename to tests/rustdoc-ui/intra-doc/assoc-item-not-in-scope.stderr diff --git a/tests/rustdoc-ui/pub-export-lint.rs b/tests/rustdoc-ui/intra-doc/pub-export-lint.rs similarity index 100% rename from tests/rustdoc-ui/pub-export-lint.rs rename to tests/rustdoc-ui/intra-doc/pub-export-lint.rs diff --git a/tests/rustdoc-ui/pub-export-lint.stderr b/tests/rustdoc-ui/intra-doc/pub-export-lint.stderr similarity index 100% rename from tests/rustdoc-ui/pub-export-lint.stderr rename to tests/rustdoc-ui/intra-doc/pub-export-lint.stderr diff --git a/tests/rustdoc-ui/reference-link-reports-error-once.rs b/tests/rustdoc-ui/intra-doc/reference-link-reports-error-once.rs similarity index 100% rename from tests/rustdoc-ui/reference-link-reports-error-once.rs rename to tests/rustdoc-ui/intra-doc/reference-link-reports-error-once.rs diff --git a/tests/rustdoc-ui/reference-link-reports-error-once.stderr b/tests/rustdoc-ui/intra-doc/reference-link-reports-error-once.stderr similarity index 100% rename from tests/rustdoc-ui/reference-link-reports-error-once.stderr rename to tests/rustdoc-ui/intra-doc/reference-link-reports-error-once.stderr diff --git a/tests/rustdoc-ui/reference-links.rs b/tests/rustdoc-ui/intra-doc/reference-links.rs similarity index 100% rename from tests/rustdoc-ui/reference-links.rs rename to tests/rustdoc-ui/intra-doc/reference-links.rs diff --git a/tests/rustdoc-ui/reference-links.stderr b/tests/rustdoc-ui/intra-doc/reference-links.stderr similarity index 100% rename from tests/rustdoc-ui/reference-links.stderr rename to tests/rustdoc-ui/intra-doc/reference-links.stderr diff --git a/tests/rustdoc-ui/bare-urls.fixed b/tests/rustdoc-ui/lints/bare-urls.fixed similarity index 100% rename from tests/rustdoc-ui/bare-urls.fixed rename to tests/rustdoc-ui/lints/bare-urls.fixed diff --git a/tests/rustdoc-ui/bare-urls.rs b/tests/rustdoc-ui/lints/bare-urls.rs similarity index 100% rename from tests/rustdoc-ui/bare-urls.rs rename to tests/rustdoc-ui/lints/bare-urls.rs diff --git a/tests/rustdoc-ui/bare-urls.stderr b/tests/rustdoc-ui/lints/bare-urls.stderr similarity index 100% rename from tests/rustdoc-ui/bare-urls.stderr rename to tests/rustdoc-ui/lints/bare-urls.stderr diff --git a/tests/rustdoc-ui/check-attr.rs b/tests/rustdoc-ui/lints/check-attr.rs similarity index 100% rename from tests/rustdoc-ui/check-attr.rs rename to tests/rustdoc-ui/lints/check-attr.rs diff --git a/tests/rustdoc-ui/check-attr.stderr b/tests/rustdoc-ui/lints/check-attr.stderr similarity index 100% rename from tests/rustdoc-ui/check-attr.stderr rename to tests/rustdoc-ui/lints/check-attr.stderr diff --git a/tests/rustdoc-ui/check-fail.rs b/tests/rustdoc-ui/lints/check-fail.rs similarity index 100% rename from tests/rustdoc-ui/check-fail.rs rename to tests/rustdoc-ui/lints/check-fail.rs diff --git a/tests/rustdoc-ui/check-fail.stderr b/tests/rustdoc-ui/lints/check-fail.stderr similarity index 100% rename from tests/rustdoc-ui/check-fail.stderr rename to tests/rustdoc-ui/lints/check-fail.stderr diff --git a/tests/rustdoc-ui/check.rs b/tests/rustdoc-ui/lints/check.rs similarity index 100% rename from tests/rustdoc-ui/check.rs rename to tests/rustdoc-ui/lints/check.rs diff --git a/tests/rustdoc-ui/check.stderr b/tests/rustdoc-ui/lints/check.stderr similarity index 100% rename from tests/rustdoc-ui/check.stderr rename to tests/rustdoc-ui/lints/check.stderr diff --git a/tests/rustdoc-ui/deny-missing-docs-crate.rs b/tests/rustdoc-ui/lints/deny-missing-docs-crate.rs similarity index 100% rename from tests/rustdoc-ui/deny-missing-docs-crate.rs rename to tests/rustdoc-ui/lints/deny-missing-docs-crate.rs diff --git a/tests/rustdoc-ui/deny-missing-docs-crate.stderr b/tests/rustdoc-ui/lints/deny-missing-docs-crate.stderr similarity index 100% rename from tests/rustdoc-ui/deny-missing-docs-crate.stderr rename to tests/rustdoc-ui/lints/deny-missing-docs-crate.stderr diff --git a/tests/rustdoc-ui/deny-missing-docs-macro.rs b/tests/rustdoc-ui/lints/deny-missing-docs-macro.rs similarity index 100% rename from tests/rustdoc-ui/deny-missing-docs-macro.rs rename to tests/rustdoc-ui/lints/deny-missing-docs-macro.rs diff --git a/tests/rustdoc-ui/deny-missing-docs-macro.stderr b/tests/rustdoc-ui/lints/deny-missing-docs-macro.stderr similarity index 100% rename from tests/rustdoc-ui/deny-missing-docs-macro.stderr rename to tests/rustdoc-ui/lints/deny-missing-docs-macro.stderr diff --git a/tests/rustdoc-ui/doc-attr.rs b/tests/rustdoc-ui/lints/doc-attr.rs similarity index 100% rename from tests/rustdoc-ui/doc-attr.rs rename to tests/rustdoc-ui/lints/doc-attr.rs diff --git a/tests/rustdoc-ui/doc-attr.stderr b/tests/rustdoc-ui/lints/doc-attr.stderr similarity index 100% rename from tests/rustdoc-ui/doc-attr.stderr rename to tests/rustdoc-ui/lints/doc-attr.stderr diff --git a/tests/rustdoc-ui/doc-spotlight.fixed b/tests/rustdoc-ui/lints/doc-spotlight.fixed similarity index 100% rename from tests/rustdoc-ui/doc-spotlight.fixed rename to tests/rustdoc-ui/lints/doc-spotlight.fixed diff --git a/tests/rustdoc-ui/doc-spotlight.rs b/tests/rustdoc-ui/lints/doc-spotlight.rs similarity index 100% rename from tests/rustdoc-ui/doc-spotlight.rs rename to tests/rustdoc-ui/lints/doc-spotlight.rs diff --git a/tests/rustdoc-ui/doc-spotlight.stderr b/tests/rustdoc-ui/lints/doc-spotlight.stderr similarity index 100% rename from tests/rustdoc-ui/doc-spotlight.stderr rename to tests/rustdoc-ui/lints/doc-spotlight.stderr diff --git a/tests/rustdoc-ui/doc-without-codeblock.rs b/tests/rustdoc-ui/lints/doc-without-codeblock.rs similarity index 100% rename from tests/rustdoc-ui/doc-without-codeblock.rs rename to tests/rustdoc-ui/lints/doc-without-codeblock.rs diff --git a/tests/rustdoc-ui/doc-without-codeblock.stderr b/tests/rustdoc-ui/lints/doc-without-codeblock.stderr similarity index 100% rename from tests/rustdoc-ui/doc-without-codeblock.stderr rename to tests/rustdoc-ui/lints/doc-without-codeblock.stderr diff --git a/tests/rustdoc-ui/doc_cfg_hide.rs b/tests/rustdoc-ui/lints/doc_cfg_hide.rs similarity index 100% rename from tests/rustdoc-ui/doc_cfg_hide.rs rename to tests/rustdoc-ui/lints/doc_cfg_hide.rs diff --git a/tests/rustdoc-ui/doc_cfg_hide.stderr b/tests/rustdoc-ui/lints/doc_cfg_hide.stderr similarity index 100% rename from tests/rustdoc-ui/doc_cfg_hide.stderr rename to tests/rustdoc-ui/lints/doc_cfg_hide.stderr diff --git a/tests/rustdoc-ui/expect-tool-lint-rfc-2383.rs b/tests/rustdoc-ui/lints/expect-tool-lint-rfc-2383.rs similarity index 100% rename from tests/rustdoc-ui/expect-tool-lint-rfc-2383.rs rename to tests/rustdoc-ui/lints/expect-tool-lint-rfc-2383.rs diff --git a/tests/rustdoc-ui/expect-tool-lint-rfc-2383.stderr b/tests/rustdoc-ui/lints/expect-tool-lint-rfc-2383.stderr similarity index 100% rename from tests/rustdoc-ui/expect-tool-lint-rfc-2383.stderr rename to tests/rustdoc-ui/lints/expect-tool-lint-rfc-2383.stderr diff --git a/tests/rustdoc-ui/feature-gate-rustdoc_missing_doc_code_examples.rs b/tests/rustdoc-ui/lints/feature-gate-rustdoc_missing_doc_code_examples.rs similarity index 100% rename from tests/rustdoc-ui/feature-gate-rustdoc_missing_doc_code_examples.rs rename to tests/rustdoc-ui/lints/feature-gate-rustdoc_missing_doc_code_examples.rs diff --git a/tests/rustdoc-ui/feature-gate-rustdoc_missing_doc_code_examples.stderr b/tests/rustdoc-ui/lints/feature-gate-rustdoc_missing_doc_code_examples.stderr similarity index 100% rename from tests/rustdoc-ui/feature-gate-rustdoc_missing_doc_code_examples.stderr rename to tests/rustdoc-ui/lints/feature-gate-rustdoc_missing_doc_code_examples.stderr diff --git a/tests/rustdoc-ui/invalid-doc-attr.rs b/tests/rustdoc-ui/lints/invalid-doc-attr.rs similarity index 100% rename from tests/rustdoc-ui/invalid-doc-attr.rs rename to tests/rustdoc-ui/lints/invalid-doc-attr.rs diff --git a/tests/rustdoc-ui/invalid-doc-attr.stderr b/tests/rustdoc-ui/lints/invalid-doc-attr.stderr similarity index 100% rename from tests/rustdoc-ui/invalid-doc-attr.stderr rename to tests/rustdoc-ui/lints/invalid-doc-attr.stderr diff --git a/tests/rustdoc-ui/invalid-html-self-closing-tag.rs b/tests/rustdoc-ui/lints/invalid-html-self-closing-tag.rs similarity index 100% rename from tests/rustdoc-ui/invalid-html-self-closing-tag.rs rename to tests/rustdoc-ui/lints/invalid-html-self-closing-tag.rs diff --git a/tests/rustdoc-ui/invalid-html-self-closing-tag.stderr b/tests/rustdoc-ui/lints/invalid-html-self-closing-tag.stderr similarity index 100% rename from tests/rustdoc-ui/invalid-html-self-closing-tag.stderr rename to tests/rustdoc-ui/lints/invalid-html-self-closing-tag.stderr diff --git a/tests/rustdoc-ui/invalid-html-tags.rs b/tests/rustdoc-ui/lints/invalid-html-tags.rs similarity index 100% rename from tests/rustdoc-ui/invalid-html-tags.rs rename to tests/rustdoc-ui/lints/invalid-html-tags.rs diff --git a/tests/rustdoc-ui/invalid-html-tags.stderr b/tests/rustdoc-ui/lints/invalid-html-tags.stderr similarity index 100% rename from tests/rustdoc-ui/invalid-html-tags.stderr rename to tests/rustdoc-ui/lints/invalid-html-tags.stderr diff --git a/tests/rustdoc-ui/lint-group.rs b/tests/rustdoc-ui/lints/lint-group.rs similarity index 100% rename from tests/rustdoc-ui/lint-group.rs rename to tests/rustdoc-ui/lints/lint-group.rs diff --git a/tests/rustdoc-ui/lint-group.stderr b/tests/rustdoc-ui/lints/lint-group.stderr similarity index 100% rename from tests/rustdoc-ui/lint-group.stderr rename to tests/rustdoc-ui/lints/lint-group.stderr diff --git a/tests/rustdoc-ui/lint-missing-doc-code-example.rs b/tests/rustdoc-ui/lints/lint-missing-doc-code-example.rs similarity index 100% rename from tests/rustdoc-ui/lint-missing-doc-code-example.rs rename to tests/rustdoc-ui/lints/lint-missing-doc-code-example.rs diff --git a/tests/rustdoc-ui/lint-missing-doc-code-example.stderr b/tests/rustdoc-ui/lints/lint-missing-doc-code-example.stderr similarity index 100% rename from tests/rustdoc-ui/lint-missing-doc-code-example.stderr rename to tests/rustdoc-ui/lints/lint-missing-doc-code-example.stderr diff --git a/tests/rustdoc-ui/no-crate-level-doc-lint.rs b/tests/rustdoc-ui/lints/no-crate-level-doc-lint.rs similarity index 100% rename from tests/rustdoc-ui/no-crate-level-doc-lint.rs rename to tests/rustdoc-ui/lints/no-crate-level-doc-lint.rs diff --git a/tests/rustdoc-ui/no-crate-level-doc-lint.stderr b/tests/rustdoc-ui/lints/no-crate-level-doc-lint.stderr similarity index 100% rename from tests/rustdoc-ui/no-crate-level-doc-lint.stderr rename to tests/rustdoc-ui/lints/no-crate-level-doc-lint.stderr diff --git a/tests/rustdoc-ui/renamed-lint-still-applies.rs b/tests/rustdoc-ui/lints/renamed-lint-still-applies.rs similarity index 100% rename from tests/rustdoc-ui/renamed-lint-still-applies.rs rename to tests/rustdoc-ui/lints/renamed-lint-still-applies.rs diff --git a/tests/rustdoc-ui/renamed-lint-still-applies.stderr b/tests/rustdoc-ui/lints/renamed-lint-still-applies.stderr similarity index 100% rename from tests/rustdoc-ui/renamed-lint-still-applies.stderr rename to tests/rustdoc-ui/lints/renamed-lint-still-applies.stderr diff --git a/tests/rustdoc-ui/rustdoc-all-only-stable-lints.rs b/tests/rustdoc-ui/lints/rustdoc-all-only-stable-lints.rs similarity index 100% rename from tests/rustdoc-ui/rustdoc-all-only-stable-lints.rs rename to tests/rustdoc-ui/lints/rustdoc-all-only-stable-lints.rs diff --git a/tests/rustdoc-ui/unknown-renamed-lints.rs b/tests/rustdoc-ui/lints/unknown-renamed-lints.rs similarity index 100% rename from tests/rustdoc-ui/unknown-renamed-lints.rs rename to tests/rustdoc-ui/lints/unknown-renamed-lints.rs diff --git a/tests/rustdoc-ui/unknown-renamed-lints.stderr b/tests/rustdoc-ui/lints/unknown-renamed-lints.stderr similarity index 100% rename from tests/rustdoc-ui/unknown-renamed-lints.stderr rename to tests/rustdoc-ui/lints/unknown-renamed-lints.stderr diff --git a/tests/rustdoc-ui/unused-braces-lint.rs b/tests/rustdoc-ui/lints/unused-braces-lint.rs similarity index 100% rename from tests/rustdoc-ui/unused-braces-lint.rs rename to tests/rustdoc-ui/lints/unused-braces-lint.rs diff --git a/tests/rustdoc-ui/unused.rs b/tests/rustdoc-ui/lints/unused.rs similarity index 100% rename from tests/rustdoc-ui/unused.rs rename to tests/rustdoc-ui/lints/unused.rs From 57aac3f671d32b2e2541c8907664f10af8c9db39 Mon Sep 17 00:00:00 2001 From: Scott McMurray Date: Sat, 29 Apr 2023 12:50:53 -0700 Subject: [PATCH 09/13] Improve internal field comments on `slice::Iter(Mut)` I wrote these in a previous PR that I ended up withdrawing, so might as well submit them separately. --- library/core/src/slice/iter.rs | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/library/core/src/slice/iter.rs b/library/core/src/slice/iter.rs index b2dd92a2379a8..8629aab007046 100644 --- a/library/core/src/slice/iter.rs +++ b/library/core/src/slice/iter.rs @@ -60,10 +60,17 @@ impl<'a, T> IntoIterator for &'a mut [T] { #[stable(feature = "rust1", since = "1.0.0")] #[must_use = "iterators are lazy and do nothing unless consumed"] pub struct Iter<'a, T: 'a> { + /// The pointer to the next element to return, or the past-the-end location + /// if the iterator is empty. + /// + /// This address will be used for all ZST elements, never changed. ptr: NonNull, - end: *const T, // If T is a ZST, this is actually ptr+len. This encoding is picked so that - // ptr == end is a quick test for the Iterator being empty, that works - // for both ZST and non-ZST. + /// For non-ZSTs, the non-null pointer to the past-the-end element. + /// + /// For ZSTs, this is `ptr.wrapping_byte_add(len)`. + /// + /// For all types, `ptr == end` tests whether the iterator is empty. + end: *const T, _marker: PhantomData<&'a T>, } @@ -179,10 +186,17 @@ impl AsRef<[T]> for Iter<'_, T> { #[stable(feature = "rust1", since = "1.0.0")] #[must_use = "iterators are lazy and do nothing unless consumed"] pub struct IterMut<'a, T: 'a> { + /// The pointer to the next element to return, or the past-the-end location + /// if the iterator is empty. + /// + /// This address will be used for all ZST elements, never changed. ptr: NonNull, - end: *mut T, // If T is a ZST, this is actually ptr+len. This encoding is picked so that - // ptr == end is a quick test for the Iterator being empty, that works - // for both ZST and non-ZST. + /// For non-ZSTs, the non-null pointer to the past-the-end element. + /// + /// For ZSTs, this is `ptr.wrapping_byte_add(len)`. + /// + /// For all types, `ptr == end` tests whether the iterator is empty. + end: *mut T, _marker: PhantomData<&'a mut T>, } From 61b6f6588402123ee20467f7df9863a9194d4fe2 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Fri, 28 Apr 2023 21:55:14 +0200 Subject: [PATCH 10/13] Get `repr` information through `AdtDef` for foreign items --- src/librustdoc/html/render/mod.rs | 69 ++++++++++++++++++++---- src/librustdoc/html/render/print_item.rs | 23 ++++---- src/librustdoc/lib.rs | 1 + 3 files changed, 72 insertions(+), 21 deletions(-) diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs index a5f08fdac11c9..55b249f8bbf83 100644 --- a/src/librustdoc/html/render/mod.rs +++ b/src/librustdoc/html/render/mod.rs @@ -849,10 +849,10 @@ fn assoc_method( let (indent, indent_str, end_newline) = if parent == ItemType::Trait { header_len += 4; let indent_str = " "; - write!(w, "{}", render_attributes_in_pre(meth, indent_str)); + write!(w, "{}", render_attributes_in_pre(meth, indent_str, tcx)); (4, indent_str, Ending::NoNewline) } else { - render_attributes_in_code(w, meth); + render_attributes_in_code(w, meth, tcx); (0, "", Ending::Newline) }; w.reserve(header_len + "{".len() + "".len()); @@ -1024,8 +1024,12 @@ fn render_assoc_item( const ALLOWED_ATTRIBUTES: &[Symbol] = &[sym::export_name, sym::link_section, sym::no_mangle, sym::repr, sym::non_exhaustive]; -fn attributes(it: &clean::Item) -> Vec { - it.attrs +fn attributes(it: &clean::Item, tcx: TyCtxt<'_>) -> Vec { + use rustc_abi::IntegerType; + use rustc_middle::ty::ReprFlags; + + let mut attrs: Vec = it + .attrs .other_attrs .iter() .filter_map(|attr| { @@ -1040,17 +1044,62 @@ fn attributes(it: &clean::Item) -> Vec { None } }) - .collect() + .collect(); + if let Some(def_id) = it.item_id.as_def_id() && + !def_id.is_local() && + // This check is needed because `adt_def` will panic if not a compatible type otherwise... + matches!(it.type_(), ItemType::Struct | ItemType::Enum | ItemType::Union) + { + let repr = tcx.adt_def(def_id).repr(); + let mut out = Vec::new(); + if repr.flags.contains(ReprFlags::IS_C) { + out.push("C"); + } + if repr.flags.contains(ReprFlags::IS_TRANSPARENT) { + out.push("transparent"); + } + if repr.flags.contains(ReprFlags::IS_SIMD) { + out.push("simd"); + } + let pack_s; + if let Some(pack) = repr.pack { + pack_s = format!("packed({})", pack.bytes()); + out.push(&pack_s); + } + let align_s; + if let Some(align) = repr.align { + align_s = format!("align({})", align.bytes()); + out.push(&align_s); + } + let int_s; + if let Some(int) = repr.int { + int_s = match int { + IntegerType::Pointer(is_signed) => { + format!("{}size", if is_signed { 'i' } else { 'u' }) + } + IntegerType::Fixed(size, is_signed) => { + format!("{}{}", if is_signed { 'i' } else { 'u' }, size.size().bytes() * 8) + } + }; + out.push(&int_s); + } + if out.is_empty() { + return Vec::new(); + } + attrs.push(format!("#[repr({})]", out.join(", "))); + } + attrs } // When an attribute is rendered inside a `
` tag, it is formatted using
 // a whitespace prefix and newline.
-fn render_attributes_in_pre<'a>(
+fn render_attributes_in_pre<'a, 'b: 'a>(
     it: &'a clean::Item,
     prefix: &'a str,
-) -> impl fmt::Display + Captures<'a> {
+    tcx: TyCtxt<'b>,
+) -> impl fmt::Display + Captures<'a> + Captures<'b> {
     crate::html::format::display_fn(move |f| {
-        for a in attributes(it) {
+        for a in attributes(it, tcx) {
             writeln!(f, "{}{}", prefix, a)?;
         }
         Ok(())
@@ -1059,8 +1108,8 @@ fn render_attributes_in_pre<'a>(
 
 // When an attribute is rendered inside a  tag, it is formatted using
 // a div to produce a newline after it.
-fn render_attributes_in_code(w: &mut Buffer, it: &clean::Item) {
-    for a in attributes(it) {
+fn render_attributes_in_code(w: &mut Buffer, it: &clean::Item, tcx: TyCtxt<'_>) {
+    for a in attributes(it, tcx) {
         write!(w, "
{}
", a); } } diff --git a/src/librustdoc/html/render/print_item.rs b/src/librustdoc/html/render/print_item.rs index 3e71d41ec96f1..40f69189a8eba 100644 --- a/src/librustdoc/html/render/print_item.rs +++ b/src/librustdoc/html/render/print_item.rs @@ -548,7 +548,7 @@ fn item_function(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, f: &cle w, "{attrs}{vis}{constness}{asyncness}{unsafety}{abi}fn \ {name}{generics}{decl}{notable_traits}{where_clause}", - attrs = render_attributes_in_pre(it, ""), + attrs = render_attributes_in_pre(it, "", tcx), vis = visibility, constness = constness, asyncness = asyncness, @@ -589,7 +589,7 @@ fn item_trait(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, t: &clean: it.name.unwrap(), t.generics.print(cx), bounds, - attrs = render_attributes_in_pre(it, ""), + attrs = render_attributes_in_pre(it, "", tcx), ); if !t.generics.where_predicates.is_empty() { @@ -1063,7 +1063,7 @@ fn item_trait_alias(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, t: & t.generics.print(cx), print_where_clause(&t.generics, cx, 0, Ending::Newline), bounds(&t.bounds, true, cx), - attrs = render_attributes_in_pre(it, ""), + attrs = render_attributes_in_pre(it, "", cx.tcx()), ); }); @@ -1085,7 +1085,7 @@ fn item_opaque_ty(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, t: &cl t.generics.print(cx), where_clause = print_where_clause(&t.generics, cx, 0, Ending::Newline), bounds = bounds(&t.bounds, false, cx), - attrs = render_attributes_in_pre(it, ""), + attrs = render_attributes_in_pre(it, "", cx.tcx()), ); }); @@ -1109,7 +1109,7 @@ fn item_typedef(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, t: &clea t.generics.print(cx), where_clause = print_where_clause(&t.generics, cx, 0, Ending::Newline), type_ = t.type_.print(cx), - attrs = render_attributes_in_pre(it, ""), + attrs = render_attributes_in_pre(it, "", cx.tcx()), ); }); } @@ -1168,7 +1168,8 @@ fn item_union(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, s: &clean: &'b self, ) -> impl fmt::Display + Captures<'a> + 'b + Captures<'cx> { display_fn(move |f| { - let v = render_attributes_in_pre(self.it, ""); + let tcx = self.cx.borrow().tcx(); + let v = render_attributes_in_pre(self.it, "", tcx); write!(f, "{v}") }) } @@ -1250,7 +1251,7 @@ fn item_enum(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, e: &clean:: visibility_print_with_space(it.visibility(tcx), it.item_id, cx), it.name.unwrap(), e.generics.print(cx), - attrs = render_attributes_in_pre(it, ""), + attrs = render_attributes_in_pre(it, "", tcx), ); if !print_where_clause_and_check(w, &e.generics, cx) { // If there wasn't a `where` clause, we add a whitespace. @@ -1445,7 +1446,7 @@ fn item_primitive(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item) { fn item_constant(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, c: &clean::Constant) { wrap_item(w, |w| { let tcx = cx.tcx(); - render_attributes_in_code(w, it); + render_attributes_in_code(w, it, tcx); write!( w, @@ -1492,7 +1493,7 @@ fn item_constant(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, c: &cle fn item_struct(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, s: &clean::Struct) { wrap_item(w, |w| { - render_attributes_in_code(w, it); + render_attributes_in_code(w, it, cx.tcx()); render_struct(w, it, Some(&s.generics), s.ctor_kind, &s.fields, "", true, cx); }); @@ -1542,7 +1543,7 @@ fn item_struct(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, s: &clean fn item_static(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, s: &clean::Static) { wrap_item(w, |w| { - render_attributes_in_code(w, it); + render_attributes_in_code(w, it, cx.tcx()); write!( w, "{vis}static {mutability}{name}: {typ}", @@ -1558,7 +1559,7 @@ fn item_static(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, s: &clean fn item_foreign_type(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item) { wrap_item(w, |w| { w.write_str("extern {\n"); - render_attributes_in_code(w, it); + render_attributes_in_code(w, it, cx.tcx()); write!( w, " {}type {};\n}}", diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index c15afca22611b..eb589bb2414f4 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -33,6 +33,7 @@ extern crate tracing; // Dependencies listed in Cargo.toml do not need `extern crate`. extern crate pulldown_cmark; +extern crate rustc_abi; extern crate rustc_ast; extern crate rustc_ast_pretty; extern crate rustc_attr; From 89b0956a9a60f1c1b49e7b1df2c48f49f4af7314 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sat, 29 Apr 2023 12:17:08 +0200 Subject: [PATCH 11/13] Fix display of attributes for enums --- src/librustdoc/html/render/print_item.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/librustdoc/html/render/print_item.rs b/src/librustdoc/html/render/print_item.rs index 40f69189a8eba..4cc81e860f09a 100644 --- a/src/librustdoc/html/render/print_item.rs +++ b/src/librustdoc/html/render/print_item.rs @@ -1245,13 +1245,13 @@ fn item_enum(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, e: &clean:: let tcx = cx.tcx(); let count_variants = e.variants().count(); wrap_item(w, |mut w| { + render_attributes_in_code(w, it, tcx); write!( w, - "{attrs}{}enum {}{}", + "{}enum {}{}", visibility_print_with_space(it.visibility(tcx), it.item_id, cx), it.name.unwrap(), e.generics.print(cx), - attrs = render_attributes_in_pre(it, "", tcx), ); if !print_where_clause_and_check(w, &e.generics, cx) { // If there wasn't a `where` clause, we add a whitespace. From 2693e20aa3a4d1a430fcacf48d85e984323e122f Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sat, 29 Apr 2023 12:17:12 +0200 Subject: [PATCH 12/13] Extend foreign inlined item with `#[repr()]` test --- tests/rustdoc/inline_cross/auxiliary/repr.rs | 22 ++++++++++++++++++-- tests/rustdoc/inline_cross/repr.rs | 22 +++++++++++++++++--- 2 files changed, 39 insertions(+), 5 deletions(-) diff --git a/tests/rustdoc/inline_cross/auxiliary/repr.rs b/tests/rustdoc/inline_cross/auxiliary/repr.rs index 64a98f1814626..4a6648a643980 100644 --- a/tests/rustdoc/inline_cross/auxiliary/repr.rs +++ b/tests/rustdoc/inline_cross/auxiliary/repr.rs @@ -1,4 +1,22 @@ -#[repr(C)] -pub struct Foo { +#![feature(repr_simd)] + +#[repr(C, align(8))] +pub struct ReprC { field: u8, } +#[repr(simd, packed(2))] +pub struct ReprSimd { + field: u8, +} +#[repr(transparent)] +pub struct ReprTransparent { + field: u8, +} +#[repr(isize)] +pub enum ReprIsize { + Bla, +} +#[repr(u8)] +pub enum ReprU8 { + Bla, +} diff --git a/tests/rustdoc/inline_cross/repr.rs b/tests/rustdoc/inline_cross/repr.rs index 7e1f2799af1cd..9e107cee9e91b 100644 --- a/tests/rustdoc/inline_cross/repr.rs +++ b/tests/rustdoc/inline_cross/repr.rs @@ -7,7 +7,23 @@ extern crate repr; -// @has 'foo/struct.Foo.html' -// @has - '//*[@class="rust item-decl"]//*[@class="code-attribute"]' '#[repr(C)]' +// @has 'foo/struct.ReprC.html' +// @has - '//*[@class="rust item-decl"]//*[@class="code-attribute"]' '#[repr(C, align(8))]' #[doc(inline)] -pub use repr::Foo; +pub use repr::ReprC; +// @has 'foo/struct.ReprSimd.html' +// @has - '//*[@class="rust item-decl"]//*[@class="code-attribute"]' '#[repr(simd, packed(2))]' +#[doc(inline)] +pub use repr::ReprSimd; +// @has 'foo/struct.ReprTransparent.html' +// @has - '//*[@class="rust item-decl"]//*[@class="code-attribute"]' '#[repr(transparent)]' +#[doc(inline)] +pub use repr::ReprTransparent; +// @has 'foo/enum.ReprIsize.html' +// @has - '//*[@class="rust item-decl"]//*[@class="code-attribute"]' '#[repr(isize)]' +#[doc(inline)] +pub use repr::ReprIsize; +// @has 'foo/enum.ReprU8.html' +// @has - '//*[@class="rust item-decl"]//*[@class="code-attribute"]' '#[repr(u8)]' +#[doc(inline)] +pub use repr::ReprU8; From b778688f913bf6d3735b0b603b41c6989f513399 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sat, 29 Apr 2023 23:36:48 +0200 Subject: [PATCH 13/13] Unify attributes retrieval for JSON and HTML rendering --- src/librustdoc/clean/types.rs | 73 +++++++++++++++++++++++++++++ src/librustdoc/html/render/mod.rs | 75 +----------------------------- src/librustdoc/json/conversions.rs | 7 +-- 3 files changed, 76 insertions(+), 79 deletions(-) diff --git a/src/librustdoc/clean/types.rs b/src/librustdoc/clean/types.rs index 74f330b76217b..7371b44465bab 100644 --- a/src/librustdoc/clean/types.rs +++ b/src/librustdoc/clean/types.rs @@ -11,6 +11,7 @@ use arrayvec::ArrayVec; use thin_vec::ThinVec; use rustc_ast as ast; +use rustc_ast_pretty::pprust; use rustc_attr::{ConstStability, Deprecation, Stability, StabilityLevel}; use rustc_const_eval::const_eval::is_unstable_const_fn; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; @@ -711,6 +712,78 @@ impl Item { }; Some(tcx.visibility(def_id)) } + + pub(crate) fn attributes(&self, tcx: TyCtxt<'_>, keep_as_is: bool) -> Vec { + const ALLOWED_ATTRIBUTES: &[Symbol] = + &[sym::export_name, sym::link_section, sym::no_mangle, sym::repr, sym::non_exhaustive]; + + use rustc_abi::IntegerType; + use rustc_middle::ty::ReprFlags; + + let mut attrs: Vec = self + .attrs + .other_attrs + .iter() + .filter_map(|attr| { + if keep_as_is { + Some(pprust::attribute_to_string(attr)) + } else if ALLOWED_ATTRIBUTES.contains(&attr.name_or_empty()) { + Some( + pprust::attribute_to_string(attr) + .replace("\\\n", "") + .replace('\n', "") + .replace(" ", " "), + ) + } else { + None + } + }) + .collect(); + if let Some(def_id) = self.item_id.as_def_id() && + !def_id.is_local() && + // This check is needed because `adt_def` will panic if not a compatible type otherwise... + matches!(self.type_(), ItemType::Struct | ItemType::Enum | ItemType::Union) + { + let repr = tcx.adt_def(def_id).repr(); + let mut out = Vec::new(); + if repr.flags.contains(ReprFlags::IS_C) { + out.push("C"); + } + if repr.flags.contains(ReprFlags::IS_TRANSPARENT) { + out.push("transparent"); + } + if repr.flags.contains(ReprFlags::IS_SIMD) { + out.push("simd"); + } + let pack_s; + if let Some(pack) = repr.pack { + pack_s = format!("packed({})", pack.bytes()); + out.push(&pack_s); + } + let align_s; + if let Some(align) = repr.align { + align_s = format!("align({})", align.bytes()); + out.push(&align_s); + } + let int_s; + if let Some(int) = repr.int { + int_s = match int { + IntegerType::Pointer(is_signed) => { + format!("{}size", if is_signed { 'i' } else { 'u' }) + } + IntegerType::Fixed(size, is_signed) => { + format!("{}{}", if is_signed { 'i' } else { 'u' }, size.size().bytes() * 8) + } + }; + out.push(&int_s); + } + if out.is_empty() { + return Vec::new(); + } + attrs.push(format!("#[repr({})]", out.join(", "))); + } + attrs + } } #[derive(Clone, Debug)] diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs index 55b249f8bbf83..91ca048050efe 100644 --- a/src/librustdoc/html/render/mod.rs +++ b/src/librustdoc/html/render/mod.rs @@ -48,7 +48,6 @@ use std::str; use std::string::ToString; use askama::Template; -use rustc_ast_pretty::pprust; use rustc_attr::{ConstStability, Deprecation, StabilityLevel}; use rustc_data_structures::captures::Captures; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; @@ -1021,76 +1020,6 @@ fn render_assoc_item( } } -const ALLOWED_ATTRIBUTES: &[Symbol] = - &[sym::export_name, sym::link_section, sym::no_mangle, sym::repr, sym::non_exhaustive]; - -fn attributes(it: &clean::Item, tcx: TyCtxt<'_>) -> Vec { - use rustc_abi::IntegerType; - use rustc_middle::ty::ReprFlags; - - let mut attrs: Vec = it - .attrs - .other_attrs - .iter() - .filter_map(|attr| { - if ALLOWED_ATTRIBUTES.contains(&attr.name_or_empty()) { - Some( - pprust::attribute_to_string(attr) - .replace("\\\n", "") - .replace('\n', "") - .replace(" ", " "), - ) - } else { - None - } - }) - .collect(); - if let Some(def_id) = it.item_id.as_def_id() && - !def_id.is_local() && - // This check is needed because `adt_def` will panic if not a compatible type otherwise... - matches!(it.type_(), ItemType::Struct | ItemType::Enum | ItemType::Union) - { - let repr = tcx.adt_def(def_id).repr(); - let mut out = Vec::new(); - if repr.flags.contains(ReprFlags::IS_C) { - out.push("C"); - } - if repr.flags.contains(ReprFlags::IS_TRANSPARENT) { - out.push("transparent"); - } - if repr.flags.contains(ReprFlags::IS_SIMD) { - out.push("simd"); - } - let pack_s; - if let Some(pack) = repr.pack { - pack_s = format!("packed({})", pack.bytes()); - out.push(&pack_s); - } - let align_s; - if let Some(align) = repr.align { - align_s = format!("align({})", align.bytes()); - out.push(&align_s); - } - let int_s; - if let Some(int) = repr.int { - int_s = match int { - IntegerType::Pointer(is_signed) => { - format!("{}size", if is_signed { 'i' } else { 'u' }) - } - IntegerType::Fixed(size, is_signed) => { - format!("{}{}", if is_signed { 'i' } else { 'u' }, size.size().bytes() * 8) - } - }; - out.push(&int_s); - } - if out.is_empty() { - return Vec::new(); - } - attrs.push(format!("#[repr({})]", out.join(", "))); - } - attrs -} - // When an attribute is rendered inside a `
` tag, it is formatted using
 // a whitespace prefix and newline.
 fn render_attributes_in_pre<'a, 'b: 'a>(
@@ -1099,7 +1028,7 @@ fn render_attributes_in_pre<'a, 'b: 'a>(
     tcx: TyCtxt<'b>,
 ) -> impl fmt::Display + Captures<'a> + Captures<'b> {
     crate::html::format::display_fn(move |f| {
-        for a in attributes(it, tcx) {
+        for a in it.attributes(tcx, false) {
             writeln!(f, "{}{}", prefix, a)?;
         }
         Ok(())
@@ -1109,7 +1038,7 @@ fn render_attributes_in_pre<'a, 'b: 'a>(
 // When an attribute is rendered inside a  tag, it is formatted using
 // a div to produce a newline after it.
 fn render_attributes_in_code(w: &mut Buffer, it: &clean::Item, tcx: TyCtxt<'_>) {
-    for a in attributes(it, tcx) {
+    for a in it.attributes(tcx, false) {
         write!(w, "
{}
", a); } } diff --git a/src/librustdoc/json/conversions.rs b/src/librustdoc/json/conversions.rs index edd046ab77233..62aab46fa7e8b 100644 --- a/src/librustdoc/json/conversions.rs +++ b/src/librustdoc/json/conversions.rs @@ -41,12 +41,7 @@ impl JsonRenderer<'_> { }) .collect(); let docs = item.attrs.collapsed_doc_value(); - let attrs = item - .attrs - .other_attrs - .iter() - .map(rustc_ast_pretty::pprust::attribute_to_string) - .collect(); + let attrs = item.attributes(self.tcx, true); let span = item.span(self.tcx); let visibility = item.visibility(self.tcx); let clean::Item { name, item_id, .. } = item;