authorbors <bors@rust-lang.org> 2026-01-26 05:42:45 UTC
committerbors <bors@rust-lang.org> 2026-01-26 05:42:45 UTC
log0462e8f7e51f20692b02d68efee68bb28a6f4457
tree9627d8d59486e73b1520436e6bfa75c689a51adc
parentfb292b75fb6c410344f7216ec51b2eaa7cc2bb0c
parentec48041b2002b999458a9ea4e86bfa0253b4d044

Auto merge of #151667 - Zalathar:rollup-OzG0S5m, r=Zalathar

Rollup of 6 pull requests Successful merges: - rust-lang/rust#151611 (Improve is_ascii performance on x86_64 with explicit SSE2 intrinsics) - rust-lang/rust#150705 (Add missing mut to pin.rs docs) - rust-lang/rust#151294 (compiletest: add implied `needs-target-std` for `codegen` mode tests unless annotated with `#![no_std]`/`#![no_core]`) - rust-lang/rust#151589 (Add a `documentation` remapping path scope for rustdoc usage) - rust-lang/rust#151639 (Fix broken WASIp1 reference link) - rust-lang/rust#151645 (Update `sysinfo` version to `0.38.0`)

36 files changed, 532 insertions(+), 119 deletions(-)

Cargo.lock+66-15
......@@ -857,7 +857,7 @@ dependencies = [
857857 "tracing-subscriber",
858858 "unified-diff",
859859 "walkdir",
860 "windows",
860 "windows 0.61.3",
861861]
862862
863863[[package]]
......@@ -2038,7 +2038,7 @@ dependencies = [
20382038 "serde",
20392039 "tempfile",
20402040 "uuid",
2041 "windows",
2041 "windows 0.61.3",
20422042]
20432043
20442044[[package]]
......@@ -3698,7 +3698,7 @@ dependencies = [
36983698 "thorin-dwp",
36993699 "tracing",
37003700 "wasm-encoder 0.219.2",
3701 "windows",
3701 "windows 0.61.3",
37023702]
37033703
37043704[[package]]
......@@ -3756,7 +3756,7 @@ dependencies = [
37563756 "tempfile",
37573757 "thin-vec",
37583758 "tracing",
3759 "windows",
3759 "windows 0.61.3",
37603760]
37613761
37623762[[package]]
......@@ -3822,7 +3822,7 @@ dependencies = [
38223822 "serde_json",
38233823 "shlex",
38243824 "tracing",
3825 "windows",
3825 "windows 0.61.3",
38263826]
38273827
38283828[[package]]
......@@ -3873,7 +3873,7 @@ dependencies = [
38733873 "serde_json",
38743874 "termize",
38753875 "tracing",
3876 "windows",
3876 "windows 0.61.3",
38773877]
38783878
38793879[[package]]
......@@ -4664,7 +4664,7 @@ dependencies = [
46644664 "rustc_target",
46654665 "termize",
46664666 "tracing",
4667 "windows",
4667 "windows 0.61.3",
46684668]
46694669
46704670[[package]]
......@@ -5438,14 +5438,14 @@ dependencies = [
54385438
54395439[[package]]
54405440name = "sysinfo"
5441version = "0.37.2"
5441version = "0.38.0"
54425442source = "registry+https://github.com/rust-lang/crates.io-index"
5443checksum = "16607d5caffd1c07ce073528f9ed972d88db15dd44023fa57142963be3feb11f"
5443checksum = "fe840c5b1afe259a5657392a4dbb74473a14c8db999c3ec2f4ae812e028a94da"
54445444dependencies = [
54455445 "libc",
54465446 "objc2-core-foundation",
54475447 "objc2-io-kit",
5448 "windows",
5448 "windows 0.62.2",
54495449]
54505450
54515451[[package]]
......@@ -6398,11 +6398,23 @@ version = "0.61.3"
63986398source = "registry+https://github.com/rust-lang/crates.io-index"
63996399checksum = "9babd3a767a4c1aef6900409f85f5d53ce2544ccdfaa86dad48c91782c6d6893"
64006400dependencies = [
6401 "windows-collections",
6401 "windows-collections 0.2.0",
64026402 "windows-core 0.61.2",
6403 "windows-future",
6403 "windows-future 0.2.1",
64046404 "windows-link 0.1.3",
6405 "windows-numerics",
6405 "windows-numerics 0.2.0",
6406]
6407
6408[[package]]
6409name = "windows"
6410version = "0.62.2"
6411source = "registry+https://github.com/rust-lang/crates.io-index"
6412checksum = "527fadee13e0c05939a6a05d5bd6eec6cd2e3dbd648b9f8e447c6518133d8580"
6413dependencies = [
6414 "windows-collections 0.3.2",
6415 "windows-core 0.62.2",
6416 "windows-future 0.3.2",
6417 "windows-numerics 0.3.1",
64066418]
64076419
64086420[[package]]
......@@ -6413,7 +6425,7 @@ checksum = "9b4e97b01190d32f268a2dfbd3f006f77840633746707fbe40bcee588108a231"
64136425dependencies = [
64146426 "serde",
64156427 "serde_json",
6416 "windows-threading",
6428 "windows-threading 0.1.0",
64176429]
64186430
64196431[[package]]
......@@ -6425,6 +6437,15 @@ dependencies = [
64256437 "windows-core 0.61.2",
64266438]
64276439
6440[[package]]
6441name = "windows-collections"
6442version = "0.3.2"
6443source = "registry+https://github.com/rust-lang/crates.io-index"
6444checksum = "23b2d95af1a8a14a3c7367e1ed4fc9c20e0a26e79551b1454d72583c97cc6610"
6445dependencies = [
6446 "windows-core 0.62.2",
6447]
6448
64286449[[package]]
64296450name = "windows-core"
64306451version = "0.61.2"
......@@ -6459,7 +6480,18 @@ checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e"
64596480dependencies = [
64606481 "windows-core 0.61.2",
64616482 "windows-link 0.1.3",
6462 "windows-threading",
6483 "windows-threading 0.1.0",
6484]
6485
6486[[package]]
6487name = "windows-future"
6488version = "0.3.2"
6489source = "registry+https://github.com/rust-lang/crates.io-index"
6490checksum = "e1d6f90251fe18a279739e78025bd6ddc52a7e22f921070ccdc67dde84c605cb"
6491dependencies = [
6492 "windows-core 0.62.2",
6493 "windows-link 0.2.1",
6494 "windows-threading 0.2.1",
64636495]
64646496
64656497[[package]]
......@@ -6506,6 +6538,16 @@ dependencies = [
65066538 "windows-link 0.1.3",
65076539]
65086540
6541[[package]]
6542name = "windows-numerics"
6543version = "0.3.1"
6544source = "registry+https://github.com/rust-lang/crates.io-index"
6545checksum = "6e2e40844ac143cdb44aead537bbf727de9b044e107a0f1220392177d15b0f26"
6546dependencies = [
6547 "windows-core 0.62.2",
6548 "windows-link 0.2.1",
6549]
6550
65096551[[package]]
65106552name = "windows-result"
65116553version = "0.3.4"
......@@ -6611,6 +6653,15 @@ dependencies = [
66116653 "windows-link 0.1.3",
66126654]
66136655
6656[[package]]
6657name = "windows-threading"
6658version = "0.2.1"
6659source = "registry+https://github.com/rust-lang/crates.io-index"
6660checksum = "3949bd5b99cafdf1c7ca86b43ca564028dfe27d66958f2470940f73d86d75b37"
6661dependencies = [
6662 "windows-link 0.2.1",
6663]
6664
66146665[[package]]
66156666name = "windows_aarch64_gnullvm"
66166667version = "0.52.6"
compiler/rustc_session/src/config.rs+10-2
......@@ -1322,6 +1322,7 @@ impl OutputFilenames {
13221322pub(crate) fn parse_remap_path_scope(
13231323 early_dcx: &EarlyDiagCtxt,
13241324 matches: &getopts::Matches,
1325 unstable_opts: &UnstableOptions,
13251326) -> RemapPathScopeComponents {
13261327 if let Some(v) = matches.opt_str("remap-path-scope") {
13271328 let mut slot = RemapPathScopeComponents::empty();
......@@ -1329,11 +1330,18 @@ pub(crate) fn parse_remap_path_scope(
13291330 slot |= match s {
13301331 "macro" => RemapPathScopeComponents::MACRO,
13311332 "diagnostics" => RemapPathScopeComponents::DIAGNOSTICS,
1333 "documentation" => {
1334 if !unstable_opts.unstable_options {
1335 early_dcx.early_fatal("remapping `documentation` path scope requested but `-Zunstable-options` not specified");
1336 }
1337
1338 RemapPathScopeComponents::DOCUMENTATION
1339 },
13321340 "debuginfo" => RemapPathScopeComponents::DEBUGINFO,
13331341 "coverage" => RemapPathScopeComponents::COVERAGE,
13341342 "object" => RemapPathScopeComponents::OBJECT,
13351343 "all" => RemapPathScopeComponents::all(),
1336 _ => early_dcx.early_fatal("argument for `--remap-path-scope` must be a comma separated list of scopes: `macro`, `diagnostics`, `debuginfo`, `coverage`, `object`, `all`"),
1344 _ => early_dcx.early_fatal("argument for `--remap-path-scope` must be a comma separated list of scopes: `macro`, `diagnostics`, `documentation`, `debuginfo`, `coverage`, `object`, `all`"),
13371345 }
13381346 }
13391347 slot
......@@ -2677,7 +2685,7 @@ pub fn build_session_options(early_dcx: &mut EarlyDiagCtxt, matches: &getopts::M
26772685 let externs = parse_externs(early_dcx, matches, &unstable_opts);
26782686
26792687 let remap_path_prefix = parse_remap_path_prefix(early_dcx, matches, &unstable_opts);
2680 let remap_path_scope = parse_remap_path_scope(early_dcx, matches);
2688 let remap_path_scope = parse_remap_path_scope(early_dcx, matches, &unstable_opts);
26812689
26822690 let pretty = parse_pretty(early_dcx, &unstable_opts);
26832691
compiler/rustc_span/src/lib.rs+2
......@@ -233,6 +233,8 @@ bitflags::bitflags! {
233233 const DEBUGINFO = 1 << 3;
234234 /// Apply remappings to coverage information
235235 const COVERAGE = 1 << 4;
236 /// Apply remappings to documentation information
237 const DOCUMENTATION = 1 << 5;
236238
237239 /// An alias for `macro`, `debuginfo` and `coverage`. This ensures all paths in compiled
238240 /// executables, libraries and objects are remapped but not elsewhere.
library/core/src/pin.rs+2-4
......@@ -831,15 +831,13 @@
831831//! <code>fn get_pin_mut(self: [Pin]<[`&mut Self`]>) -> [Pin]<[`&mut T`]></code>.
832832//! Then we could do the following:
833833//! ```compile_fail
834//! # use std::cell::RefCell;
835//! # use std::pin::Pin;
836//! fn exploit_ref_cell<T>(rc: Pin<&mut RefCell<T>>) {
834//! fn exploit_ref_cell<T>(mut rc: Pin<&mut RefCell<T>>) {
837835//! // Here we get pinned access to the `T`.
838836//! let _: Pin<&mut T> = rc.as_mut().get_pin_mut();
839837//!
840838//! // And here we have `&mut T` to the same data.
841839//! let shared: &RefCell<T> = rc.into_ref().get_ref();
842//! let borrow = shared.borrow_mut();
840//! let mut borrow = shared.borrow_mut();
843841//! let content = &mut *borrow;
844842//! }
845843//! ```
library/core/src/slice/ascii.rs+22-40
......@@ -460,56 +460,38 @@ const fn is_ascii(s: &[u8]) -> bool {
460460 )
461461}
462462
463/// Chunk size for vectorized ASCII checking (two 16-byte SSE registers).
463/// Chunk size for SSE2 vectorized ASCII checking (4x 16-byte loads).
464464#[cfg(all(target_arch = "x86_64", target_feature = "sse2"))]
465const CHUNK_SIZE: usize = 32;
465const SSE2_CHUNK_SIZE: usize = 64;
466466
467/// SSE2 implementation using `_mm_movemask_epi8` (compiles to `pmovmskb`) to
468/// avoid LLVM's broken AVX-512 auto-vectorization of counting loops.
469///
470/// FIXME(llvm#176906): Remove this workaround once LLVM generates efficient code.
471467#[cfg(all(target_arch = "x86_64", target_feature = "sse2"))]
468#[inline]
472469fn is_ascii_sse2(bytes: &[u8]) -> bool {
473470 use crate::arch::x86_64::{__m128i, _mm_loadu_si128, _mm_movemask_epi8, _mm_or_si128};
474471
475 let mut i = 0;
476
477 while i + CHUNK_SIZE <= bytes.len() {
478 // SAFETY: We have verified that `i + CHUNK_SIZE <= bytes.len()`.
479 let ptr = unsafe { bytes.as_ptr().add(i) };
480
481 // Load two 16-byte chunks and combine them.
482 // SAFETY: We verified `i + 32 <= len`, so ptr is valid for 32 bytes.
483 // `_mm_loadu_si128` allows unaligned loads.
484 let chunk1 = unsafe { _mm_loadu_si128(ptr as *const __m128i) };
485 // SAFETY: Same as above - ptr.add(16) is within the valid 32-byte range.
486 let chunk2 = unsafe { _mm_loadu_si128(ptr.add(16) as *const __m128i) };
487
488 // OR them together - if any byte has the high bit set, the result will too.
489 // SAFETY: SSE2 is guaranteed by the cfg predicate.
490 let combined = unsafe { _mm_or_si128(chunk1, chunk2) };
491
492 // Create a mask from the MSBs of each byte.
493 // If any byte is >= 128, its MSB is 1, so the mask will be non-zero.
494 // SAFETY: SSE2 is guaranteed by the cfg predicate.
495 let mask = unsafe { _mm_movemask_epi8(combined) };
496
472 let (chunks, rest) = bytes.as_chunks::<SSE2_CHUNK_SIZE>();
473
474 for chunk in chunks {
475 let ptr = chunk.as_ptr();
476 // SAFETY: chunk is 64 bytes. SSE2 is baseline on x86_64.
477 let mask = unsafe {
478 let a1 = _mm_loadu_si128(ptr as *const __m128i);
479 let a2 = _mm_loadu_si128(ptr.add(16) as *const __m128i);
480 let b1 = _mm_loadu_si128(ptr.add(32) as *const __m128i);
481 let b2 = _mm_loadu_si128(ptr.add(48) as *const __m128i);
482 // OR all chunks - if any byte has high bit set, combined will too.
483 let combined = _mm_or_si128(_mm_or_si128(a1, a2), _mm_or_si128(b1, b2));
484 // Create a mask from the MSBs of each byte.
485 // If any byte is >= 128, its MSB is 1, so the mask will be non-zero.
486 _mm_movemask_epi8(combined)
487 };
497488 if mask != 0 {
498489 return false;
499490 }
500
501 i += CHUNK_SIZE;
502 }
503
504 // Handle remaining bytes with simple loop
505 while i < bytes.len() {
506 if !bytes[i].is_ascii() {
507 return false;
508 }
509 i += 1;
510491 }
511492
512 true
493 // Handle remaining bytes
494 rest.iter().all(|b| b.is_ascii())
513495}
514496
515497/// ASCII test optimized to use the `pmovmskb` instruction on `x86-64`.
......@@ -529,7 +511,7 @@ const fn is_ascii(bytes: &[u8]) -> bool {
529511 is_ascii_simple(bytes)
530512 } else {
531513 // For small inputs, use usize-at-a-time processing to avoid SSE2 call overhead.
532 if bytes.len() < CHUNK_SIZE {
514 if bytes.len() < SSE2_CHUNK_SIZE {
533515 let chunks = bytes.chunks_exact(USIZE_SIZE);
534516 let remainder = chunks.remainder();
535517 for chunk in chunks {
src/bootstrap/Cargo.lock+115-27
......@@ -70,7 +70,7 @@ dependencies = [
7070 "tracing-chrome",
7171 "tracing-subscriber",
7272 "walkdir",
73 "windows",
73 "windows 0.61.1",
7474 "xz2",
7575]
7676
......@@ -472,18 +472,18 @@ dependencies = [
472472
473473[[package]]
474474name = "objc2-core-foundation"
475version = "0.3.1"
475version = "0.3.2"
476476source = "registry+https://github.com/rust-lang/crates.io-index"
477checksum = "1c10c2894a6fed806ade6027bcd50662746363a9589d3ec9d9bef30a4e4bc166"
477checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536"
478478dependencies = [
479479 "bitflags",
480480]
481481
482482[[package]]
483483name = "objc2-io-kit"
484version = "0.3.1"
484version = "0.3.2"
485485source = "registry+https://github.com/rust-lang/crates.io-index"
486checksum = "71c1c64d6120e51cd86033f67176b1cb66780c2efe34dec55176f77befd93c0a"
486checksum = "33fafba39597d6dc1fb709123dfa8289d39406734be322956a69f0931c73bb15"
487487dependencies = [
488488 "libc",
489489 "objc2-core-foundation",
......@@ -743,16 +743,16 @@ dependencies = [
743743
744744[[package]]
745745name = "sysinfo"
746version = "0.37.0"
746version = "0.38.0"
747747source = "registry+https://github.com/rust-lang/crates.io-index"
748checksum = "07cec4dc2d2e357ca1e610cfb07de2fa7a10fc3e9fe89f72545f3d244ea87753"
748checksum = "fe840c5b1afe259a5657392a4dbb74473a14c8db999c3ec2f4ae812e028a94da"
749749dependencies = [
750750 "libc",
751751 "memchr",
752752 "ntapi",
753753 "objc2-core-foundation",
754754 "objc2-io-kit",
755 "windows",
755 "windows 0.62.2",
756756]
757757
758758[[package]]
......@@ -958,11 +958,23 @@ version = "0.61.1"
958958source = "registry+https://github.com/rust-lang/crates.io-index"
959959checksum = "c5ee8f3d025738cb02bad7868bbb5f8a6327501e870bf51f1b455b0a2454a419"
960960dependencies = [
961 "windows-collections",
962 "windows-core",
963 "windows-future",
964 "windows-link",
965 "windows-numerics",
961 "windows-collections 0.2.0",
962 "windows-core 0.61.0",
963 "windows-future 0.2.0",
964 "windows-link 0.1.1",
965 "windows-numerics 0.2.0",
966]
967
968[[package]]
969name = "windows"
970version = "0.62.2"
971source = "registry+https://github.com/rust-lang/crates.io-index"
972checksum = "527fadee13e0c05939a6a05d5bd6eec6cd2e3dbd648b9f8e447c6518133d8580"
973dependencies = [
974 "windows-collections 0.3.2",
975 "windows-core 0.62.2",
976 "windows-future 0.3.2",
977 "windows-numerics 0.3.1",
966978]
967979
968980[[package]]
......@@ -971,7 +983,16 @@ version = "0.2.0"
971983source = "registry+https://github.com/rust-lang/crates.io-index"
972984checksum = "3beeceb5e5cfd9eb1d76b381630e82c4241ccd0d27f1a39ed41b2760b255c5e8"
973985dependencies = [
974 "windows-core",
986 "windows-core 0.61.0",
987]
988
989[[package]]
990name = "windows-collections"
991version = "0.3.2"
992source = "registry+https://github.com/rust-lang/crates.io-index"
993checksum = "23b2d95af1a8a14a3c7367e1ed4fc9c20e0a26e79551b1454d72583c97cc6610"
994dependencies = [
995 "windows-core 0.62.2",
975996]
976997
977998[[package]]
......@@ -982,9 +1003,22 @@ checksum = "4763c1de310c86d75a878046489e2e5ba02c649d185f21c67d4cf8a56d098980"
9821003dependencies = [
9831004 "windows-implement",
9841005 "windows-interface",
985 "windows-link",
986 "windows-result",
987 "windows-strings",
1006 "windows-link 0.1.1",
1007 "windows-result 0.3.2",
1008 "windows-strings 0.4.0",
1009]
1010
1011[[package]]
1012name = "windows-core"
1013version = "0.62.2"
1014source = "registry+https://github.com/rust-lang/crates.io-index"
1015checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb"
1016dependencies = [
1017 "windows-implement",
1018 "windows-interface",
1019 "windows-link 0.2.1",
1020 "windows-result 0.4.1",
1021 "windows-strings 0.5.1",
9881022]
9891023
9901024[[package]]
......@@ -993,15 +1027,26 @@ version = "0.2.0"
9931027source = "registry+https://github.com/rust-lang/crates.io-index"
9941028checksum = "7a1d6bbefcb7b60acd19828e1bc965da6fcf18a7e39490c5f8be71e54a19ba32"
9951029dependencies = [
996 "windows-core",
997 "windows-link",
1030 "windows-core 0.61.0",
1031 "windows-link 0.1.1",
1032]
1033
1034[[package]]
1035name = "windows-future"
1036version = "0.3.2"
1037source = "registry+https://github.com/rust-lang/crates.io-index"
1038checksum = "e1d6f90251fe18a279739e78025bd6ddc52a7e22f921070ccdc67dde84c605cb"
1039dependencies = [
1040 "windows-core 0.62.2",
1041 "windows-link 0.2.1",
1042 "windows-threading",
9981043]
9991044
10001045[[package]]
10011046name = "windows-implement"
1002version = "0.60.0"
1047version = "0.60.2"
10031048source = "registry+https://github.com/rust-lang/crates.io-index"
1004checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836"
1049checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf"
10051050dependencies = [
10061051 "proc-macro2",
10071052 "quote",
......@@ -1010,9 +1055,9 @@ dependencies = [
10101055
10111056[[package]]
10121057name = "windows-interface"
1013version = "0.59.1"
1058version = "0.59.3"
10141059source = "registry+https://github.com/rust-lang/crates.io-index"
1015checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8"
1060checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358"
10161061dependencies = [
10171062 "proc-macro2",
10181063 "quote",
......@@ -1025,14 +1070,30 @@ version = "0.1.1"
10251070source = "registry+https://github.com/rust-lang/crates.io-index"
10261071checksum = "76840935b766e1b0a05c0066835fb9ec80071d4c09a16f6bd5f7e655e3c14c38"
10271072
1073[[package]]
1074name = "windows-link"
1075version = "0.2.1"
1076source = "registry+https://github.com/rust-lang/crates.io-index"
1077checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
1078
10281079[[package]]
10291080name = "windows-numerics"
10301081version = "0.2.0"
10311082source = "registry+https://github.com/rust-lang/crates.io-index"
10321083checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1"
10331084dependencies = [
1034 "windows-core",
1035 "windows-link",
1085 "windows-core 0.61.0",
1086 "windows-link 0.1.1",
1087]
1088
1089[[package]]
1090name = "windows-numerics"
1091version = "0.3.1"
1092source = "registry+https://github.com/rust-lang/crates.io-index"
1093checksum = "6e2e40844ac143cdb44aead537bbf727de9b044e107a0f1220392177d15b0f26"
1094dependencies = [
1095 "windows-core 0.62.2",
1096 "windows-link 0.2.1",
10361097]
10371098
10381099[[package]]
......@@ -1041,7 +1102,16 @@ version = "0.3.2"
10411102source = "registry+https://github.com/rust-lang/crates.io-index"
10421103checksum = "c64fd11a4fd95df68efcfee5f44a294fe71b8bc6a91993e2791938abcc712252"
10431104dependencies = [
1044 "windows-link",
1105 "windows-link 0.1.1",
1106]
1107
1108[[package]]
1109name = "windows-result"
1110version = "0.4.1"
1111source = "registry+https://github.com/rust-lang/crates.io-index"
1112checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5"
1113dependencies = [
1114 "windows-link 0.2.1",
10451115]
10461116
10471117[[package]]
......@@ -1050,7 +1120,16 @@ version = "0.4.0"
10501120source = "registry+https://github.com/rust-lang/crates.io-index"
10511121checksum = "7a2ba9642430ee452d5a7aa78d72907ebe8cfda358e8cb7918a2050581322f97"
10521122dependencies = [
1053 "windows-link",
1123 "windows-link 0.1.1",
1124]
1125
1126[[package]]
1127name = "windows-strings"
1128version = "0.5.1"
1129source = "registry+https://github.com/rust-lang/crates.io-index"
1130checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091"
1131dependencies = [
1132 "windows-link 0.2.1",
10541133]
10551134
10561135[[package]]
......@@ -1103,6 +1182,15 @@ dependencies = [
11031182 "windows_x86_64_msvc 0.53.0",
11041183]
11051184
1185[[package]]
1186name = "windows-threading"
1187version = "0.2.1"
1188source = "registry+https://github.com/rust-lang/crates.io-index"
1189checksum = "3949bd5b99cafdf1c7ca86b43ca564028dfe27d66958f2470940f73d86d75b37"
1190dependencies = [
1191 "windows-link 0.2.1",
1192]
1193
11061194[[package]]
11071195name = "windows_aarch64_gnullvm"
11081196version = "0.52.6"
src/bootstrap/Cargo.toml+1-1
......@@ -57,7 +57,7 @@ walkdir = "2.4"
5757xz2 = "0.1"
5858
5959# Dependencies needed by the build-metrics feature
60sysinfo = { version = "0.37.0", default-features = false, optional = true, features = ["system"] }
60sysinfo = { version = "0.38.0", default-features = false, optional = true, features = ["system"] }
6161
6262# Dependencies needed by the `tracing` feature
6363chrono = { version = "0.4", default-features = false, optional = true, features = ["now", "std"] }
src/doc/rustc-dev-guide/src/tests/compiletest.md+8-2
......@@ -311,14 +311,20 @@ For example, `./x test tests/debuginfo -- --debugger gdb` will only test GDB com
311311
312312### Codegen tests
313313
314The tests in [`tests/codegen-llvm`] test LLVM code generation. They compile the test
315with the `--emit=llvm-ir` flag to emit LLVM IR. They then run the LLVM
314The tests in [`tests/codegen-llvm`] test LLVM code generation. They compile the
315test with the `--emit=llvm-ir` flag to emit LLVM IR. They then run the LLVM
316316[FileCheck] tool. The test is annotated with various `// CHECK` comments to
317317check the generated code. See the [FileCheck] documentation for a tutorial and
318318more information.
319319
320320See also the [assembly tests](#assembly-tests) for a similar set of tests.
321321
322By default, codegen tests will have `//@ needs-target-std` *implied* (that the
323target needs to support std), *unless* the `#![no_std]`/`#![no_core]` attribute
324was specified in the test source. You can override this behavior and explicitly
325write `//@ needs-target-std` to only run the test when target supports std, even
326if the test is `#![no_std]`/`#![no_core]`.
327
322328If you need to work with `#![no_std]` cross-compiling tests, consult the
323329[`minicore` test auxiliary](./minicore.md) chapter.
324330
src/doc/rustc-dev-guide/src/tests/directives.md+2
......@@ -200,6 +200,8 @@ The following directives will check rustc build settings and target settings:
200200 on `wasm32-unknown-unknown` target because the target does not support the
201201 `proc-macro` crate type.
202202- `needs-target-std` — ignores if target platform does not have std support.
203 - See also [`#![no_std]`/`#![no_core]` and implied `needs-target-std` for
204 codegen tests](./compiletest.md#codegen-tests).
203205- `ignore-backends` — ignores the listed backends, separated by whitespace characters.
204206 Please note
205207 that this directive can be overriden with the `--bypass-ignore-backends=[BACKEND]` command line
src/doc/rustc/src/platform-support/wasm32-wasip1.md+1-1
......@@ -20,7 +20,7 @@ focused on the Component Model-based definition of WASI. At this point the
2020`wasm32-wasip1` Rust target is intended for historical compatibility with
2121[WASIp1] set of syscalls.
2222
23[WASIp1]: https://github.com/WebAssembly/WASI/tree/main/legacy/preview1
23[WASIp1]: https://github.com/WebAssembly/WASI/tree/wasi-0.1/preview1
2424[Component Model]: https://github.com/webassembly/component-model
2525
2626Today the `wasm32-wasip1` target will generate core WebAssembly modules
src/doc/rustc/src/remap-source-paths.md+1-1
......@@ -52,7 +52,7 @@ The valid scopes are:
5252- `debuginfo` - apply remappings to debug information
5353- `coverage` - apply remappings to coverage information
5454- `object` - apply remappings to all paths in compiled executables or libraries, but not elsewhere. Currently an alias for `macro,coverage,debuginfo`.
55- `all` (default) - an alias for all of the above, also equivalent to supplying only `--remap-path-prefix` without `--remap-path-scope`.
55- `all` (default) - an alias for all of the above (and unstable scopes), also equivalent to supplying only `--remap-path-prefix` without `--remap-path-scope`.
5656
5757The scopes accepted by `--remap-path-scope` are not exhaustive - new scopes may be added in future releases for eventual stabilisation.
5858This implies that the `all` scope can correspond to different scopes between releases.
src/doc/rustdoc/src/unstable-features.md+16
......@@ -751,6 +751,22 @@ pass `--doctest-build-arg ARG` for each argument `ARG`.
751751
752752This flag enables the generation of toggles to expand macros in the HTML source code pages.
753753
754## `--remap-path-prefix`: Remap source code paths in output
755
756This flag is the equivalent flag from `rustc` `--remap-path-prefix`.
757
758it permits remapping source path prefixes in all output, including compiler diagnostics,
759debug information, macro expansions, etc. It takes a value of the form `FROM=TO`
760where a path prefix equal to `FROM` is rewritten to the value `TO`.
761
762### `documentation` scope
763
764`rustdoc` (and by extension `rustc`) have a special `documentation` remapping scope, it
765permits remapping source paths that ends up in the generated documentation.
766
767Currently the scope can only be specified from `rustc`, due to the lack of an equivalent
768`--remap-path-scope` flag in `rustc`.
769
754770## `#[doc(cfg)]` and `#[doc(auto_cfg)]`
755771
756772This feature aims at providing rustdoc users the possibility to add visual markers to the rendered documentation to know under which conditions an item is available (currently possible through the following unstable feature: `doc_cfg`).
src/librustdoc/clean/types.rs+1-1
......@@ -152,7 +152,7 @@ impl ExternalCrate {
152152 FileName::Real(ref p) => {
153153 match p
154154 .local_path()
155 .or(Some(p.path(RemapPathScopeComponents::MACRO)))
155 .or(Some(p.path(RemapPathScopeComponents::DOCUMENTATION)))
156156 .unwrap()
157157 .parent()
158158 {
src/librustdoc/doctest.rs+12-4
......@@ -957,8 +957,10 @@ impl ScrapedDocTest {
957957 if !item_path.is_empty() {
958958 item_path.push(' ');
959959 }
960 let name =
961 format!("{} - {item_path}(line {line})", filename.prefer_remapped_unconditionally());
960 let name = format!(
961 "{} - {item_path}(line {line})",
962 filename.display(RemapPathScopeComponents::DOCUMENTATION)
963 );
962964
963965 Self { filename, line, langstr, text, name, span, global_crate_attrs }
964966 }
......@@ -969,9 +971,12 @@ impl ScrapedDocTest {
969971 fn no_run(&self, opts: &RustdocOptions) -> bool {
970972 self.langstr.no_run || opts.no_run
971973 }
974
972975 fn path(&self) -> PathBuf {
973976 match &self.filename {
974 FileName::Real(name) => name.path(RemapPathScopeComponents::DIAGNOSTICS).to_path_buf(),
977 FileName::Real(name) => {
978 name.path(RemapPathScopeComponents::DOCUMENTATION).to_path_buf()
979 }
975980 _ => PathBuf::from(r"doctest.rs"),
976981 }
977982 }
......@@ -1016,9 +1021,12 @@ impl CreateRunnableDocTests {
10161021
10171022 fn add_test(&mut self, scraped_test: ScrapedDocTest, dcx: Option<DiagCtxtHandle<'_>>) {
10181023 // For example `module/file.rs` would become `module_file_rs`
1024 //
1025 // Note that we are kind-of extending the definition of the MACRO scope here, but
1026 // after all `#[doc]` is kind-of a macro.
10191027 let file = scraped_test
10201028 .filename
1021 .prefer_local_unconditionally()
1029 .display(RemapPathScopeComponents::MACRO)
10221030 .to_string_lossy()
10231031 .chars()
10241032 .map(|c| if c.is_ascii_alphanumeric() { c } else { '_' })
src/librustdoc/doctest/extracted.rs+2-1
......@@ -3,6 +3,7 @@
33//! This module contains the logic to extract doctests and output a JSON containing this
44//! information.
55
6use rustc_span::RemapPathScopeComponents;
67use rustc_span::edition::Edition;
78use serde::Serialize;
89
......@@ -62,7 +63,7 @@ impl ExtractedDocTests {
6263 Some(&opts.crate_name),
6364 );
6465 self.doctests.push(ExtractedDocTest {
65 file: filename.prefer_remapped_unconditionally().to_string(),
66 file: filename.display(RemapPathScopeComponents::DOCUMENTATION).to_string(),
6667 line,
6768 doctest_attributes: langstr.into(),
6869 doctest_code: match wrapped {
src/librustdoc/html/render/context.rs+6-2
......@@ -367,7 +367,7 @@ impl<'tcx> Context<'tcx> {
367367 let file = match span.filename(self.sess()) {
368368 FileName::Real(ref path) => path
369369 .local_path()
370 .unwrap_or(path.path(RemapPathScopeComponents::MACRO))
370 .unwrap_or(path.path(RemapPathScopeComponents::DOCUMENTATION))
371371 .to_path_buf(),
372372 _ => return None,
373373 };
......@@ -503,7 +503,11 @@ impl<'tcx> Context<'tcx> {
503503
504504 let src_root = match krate.src(tcx) {
505505 FileName::Real(ref p) => {
506 match p.local_path().unwrap_or(p.path(RemapPathScopeComponents::MACRO)).parent() {
506 match p
507 .local_path()
508 .unwrap_or(p.path(RemapPathScopeComponents::DOCUMENTATION))
509 .parent()
510 {
507511 Some(p) => p.to_path_buf(),
508512 None => PathBuf::new(),
509513 }
src/librustdoc/passes/calculate_doc_coverage.rs+2-4
......@@ -124,7 +124,7 @@ impl CoverageCalculator<'_, '_> {
124124 &self
125125 .items
126126 .iter()
127 .map(|(k, v)| (k.prefer_local_unconditionally().to_string(), v))
127 .map(|(k, v)| (k.display(RemapPathScopeComponents::COVERAGE).to_string(), v))
128128 .collect::<BTreeMap<String, &ItemCount>>(),
129129 )
130130 .expect("failed to convert JSON data to string")
......@@ -168,9 +168,7 @@ impl CoverageCalculator<'_, '_> {
168168 if let Some(percentage) = count.percentage() {
169169 print_table_record(
170170 &limit_filename_len(
171 file.display(RemapPathScopeComponents::DIAGNOSTICS)
172 .to_string_lossy()
173 .into(),
171 file.display(RemapPathScopeComponents::COVERAGE).to_string(),
174172 ),
175173 count,
176174 percentage,
src/tools/compiletest/src/directives.rs+14-1
......@@ -206,7 +206,7 @@ pub(crate) struct TestProps {
206206 pub add_minicore: bool,
207207 /// Add these flags to the build of `minicore`.
208208 pub minicore_compile_flags: Vec<String>,
209 /// Whether line annotatins are required for the given error kind.
209 /// Whether line annotations are required for the given error kind.
210210 pub dont_require_annotations: HashSet<ErrorKind>,
211211 /// Whether pretty printers should be disabled in gdb.
212212 pub disable_gdb_pretty_printers: bool,
......@@ -600,6 +600,19 @@ fn iter_directives(
600600 }
601601 }
602602
603 // Note: affects all codegen test suites under test mode `codegen`, e.g. `codegen-llvm`.
604 //
605 // Codegen tests automatically receive implied `//@ needs-target-std`, unless
606 // `#![no_std]`/`#![no_core]` attribute was explicitly seen. The rationale is basically to avoid
607 // having to manually maintain a bunch of `//@ needs-target-std` directives esp. for targets
608 // tested/built out-of-tree.
609 if mode == TestMode::Codegen && !file_directives.has_explicit_no_std_core_attribute {
610 let implied_needs_target_std_line =
611 line_directive(testfile, LineNumber::ZERO, "//@ needs-target-std")
612 .expect("valid `needs-target-std` directive line");
613 it(&implied_needs_target_std_line);
614 }
615
603616 for directive_line in &file_directives.lines {
604617 it(directive_line);
605618 }
src/tools/compiletest/src/directives/file.rs+18-1
......@@ -6,20 +6,37 @@ use crate::directives::line::{DirectiveLine, line_directive};
66pub(crate) struct FileDirectives<'a> {
77 pub(crate) path: &'a Utf8Path,
88 pub(crate) lines: Vec<DirectiveLine<'a>>,
9
10 /// Whether the test source file contains an explicit `#![no_std]`/`#![no_core]` attribute.
11 pub(crate) has_explicit_no_std_core_attribute: bool,
912}
1013
1114impl<'a> FileDirectives<'a> {
1215 pub(crate) fn from_file_contents(path: &'a Utf8Path, file_contents: &'a str) -> Self {
1316 let mut lines = vec![];
17 let mut has_explicit_no_std_core_attribute = false;
1418
1519 for (line_number, ln) in LineNumber::enumerate().zip(file_contents.lines()) {
1620 let ln = ln.trim();
1721
22 // Perform a naive check for lines starting with `#![no_std]`/`#![no_core]`, which
23 // suppresses the implied `//@ needs-target-std` in codegen tests. This ignores
24 // occurrences in ordinary comments.
25 //
26 // This check is imperfect in some edge cases, but we can generally trust our own test
27 // suite to not hit those edge cases (e.g. `#![no_std]`/`#![no_core]` in multi-line
28 // comments or string literals). Tests can write `//@ needs-target-std` manually if
29 // needed.
30 if ln.starts_with("#![no_std]") || ln.starts_with("#![no_core]") {
31 has_explicit_no_std_core_attribute = true;
32 continue;
33 }
34
1835 if let Some(directive_line) = line_directive(path, line_number, ln) {
1936 lines.push(directive_line);
2037 }
2138 }
2239
23 Self { path, lines }
40 Self { path, lines, has_explicit_no_std_core_attribute }
2441 }
2542}
src/tools/compiletest/src/directives/tests.rs+95-1
......@@ -105,6 +105,7 @@ fn test_parse_normalize_rule() {
105105#[derive(Default)]
106106struct ConfigBuilder {
107107 mode: Option<String>,
108 suite: Option<String>,
108109 channel: Option<String>,
109110 edition: Option<Edition>,
110111 host: Option<String>,
......@@ -126,6 +127,11 @@ impl ConfigBuilder {
126127 self
127128 }
128129
130 fn suite(&mut self, s: &str) -> &mut Self {
131 self.suite = Some(s.to_owned());
132 self
133 }
134
129135 fn channel(&mut self, s: &str) -> &mut Self {
130136 self.channel = Some(s.to_owned());
131137 self
......@@ -196,7 +202,8 @@ impl ConfigBuilder {
196202 "compiletest",
197203 "--mode",
198204 self.mode.as_deref().unwrap_or("ui"),
199 "--suite=ui",
205 "--suite",
206 self.suite.as_deref().unwrap_or("ui"),
200207 "--compile-lib-path=",
201208 "--run-lib-path=",
202209 "--python=",
......@@ -1019,6 +1026,93 @@ fn test_needs_target_std() {
10191026 assert!(!check_ignore(&config, "//@ needs-target-std"));
10201027}
10211028
1029#[test]
1030fn implied_needs_target_std() {
1031 let config = cfg().mode("codegen").suite("codegen-llvm").target("x86_64-unknown-none").build();
1032 // Implied `needs-target-std` due to no `#![no_std]`/`#![no_core]`.
1033 assert!(check_ignore(&config, ""));
1034 assert!(check_ignore(&config, "//@ needs-target-std"));
1035 assert!(!check_ignore(&config, "#![no_std]"));
1036 assert!(!check_ignore(&config, "#![no_core]"));
1037 // Make sure that `//@ needs-target-std` takes precedence.
1038 assert!(check_ignore(
1039 &config,
1040 r#"
1041 //@ needs-target-std
1042 #![no_std]
1043 "#
1044 ));
1045 assert!(check_ignore(
1046 &config,
1047 r#"
1048 //@ needs-target-std
1049 #![no_core]
1050 "#
1051 ));
1052
1053 let config =
1054 cfg().mode("codegen").suite("codegen-llvm").target("x86_64-unknown-linux-gnu").build();
1055 assert!(!check_ignore(&config, ""));
1056 assert!(!check_ignore(&config, "//@ needs-target-std"));
1057 assert!(!check_ignore(&config, "#![no_std]"));
1058 assert!(!check_ignore(&config, "#![no_core]"));
1059 assert!(!check_ignore(
1060 &config,
1061 r#"
1062 //@ needs-target-std
1063 #![no_std]
1064 "#
1065 ));
1066 assert!(!check_ignore(
1067 &config,
1068 r#"
1069 //@ needs-target-std
1070 #![no_core]
1071 "#
1072 ));
1073
1074 let config = cfg().mode("ui").suite("ui").target("x86_64-unknown-none").build();
1075 // The implied `//@ needs-target-std` is only applicable for mode=codegen tests.
1076 assert!(!check_ignore(&config, ""));
1077 assert!(check_ignore(&config, "//@ needs-target-std"));
1078 assert!(!check_ignore(&config, "#![no_std]"));
1079 assert!(!check_ignore(&config, "#![no_core]"));
1080 assert!(check_ignore(
1081 &config,
1082 r#"
1083 //@ needs-target-std
1084 #![no_std]
1085 "#
1086 ));
1087 assert!(check_ignore(
1088 &config,
1089 r#"
1090 //@ needs-target-std
1091 #![no_core]
1092 "#
1093 ));
1094
1095 let config = cfg().mode("ui").suite("ui").target("x86_64-unknown-linux-gnu").build();
1096 assert!(!check_ignore(&config, ""));
1097 assert!(!check_ignore(&config, "//@ needs-target-std"));
1098 assert!(!check_ignore(&config, "#![no_std]"));
1099 assert!(!check_ignore(&config, "#![no_core]"));
1100 assert!(!check_ignore(
1101 &config,
1102 r#"
1103 //@ needs-target-std
1104 #![no_std]
1105 "#
1106 ));
1107 assert!(!check_ignore(
1108 &config,
1109 r#"
1110 //@ needs-target-std
1111 #![no_core]
1112 "#
1113 ));
1114}
1115
10221116fn parse_edition_range(line: &str) -> Option<EditionRange> {
10231117 let config = cfg().build();
10241118
src/tools/opt-dist/Cargo.toml+1-1
......@@ -10,7 +10,7 @@ log = "0.4"
1010anyhow = "1"
1111humantime = "2"
1212humansize = "2"
13sysinfo = { version = "0.37.0", default-features = false, features = ["disk"] }
13sysinfo = { version = "0.38.0", default-features = false, features = ["disk"] }
1414fs_extra = "1"
1515camino = "1"
1616tar = "0.4"
tests/assembly-llvm/slice-is-ascii.rs+3-3
......@@ -13,15 +13,15 @@
1313/// Verify `is_ascii` generates efficient code on different architectures:
1414///
1515/// - x86_64: Must NOT use `kshiftrd`/`kshiftrq` (broken AVX-512 auto-vectorization).
16/// The fix uses explicit SSE2 intrinsics (`pmovmskb`/`vpmovmskb`).
17/// See: https://github.com/llvm/llvm-project/issues/176906
16/// Good version uses explicit SSE2 intrinsics (`pmovmskb`/`vpmovmskb`).
1817///
1918/// - loongarch64: Should use `vmskltz.b` instruction for the fast-path.
20/// This architecture still relies on LLVM auto-vectorization.
2119
2220// X86_64-LABEL: test_is_ascii
2321// X86_64-NOT: kshiftrd
2422// X86_64-NOT: kshiftrq
23// X86_64: {{vpor|por}}
24// X86_64: {{vpmovmskb|pmovmskb}}
2525
2626// LA64-LABEL: test_is_ascii
2727// LA64: vmskltz.b
tests/run-make/remap-path-prefix/rmake.rs+24
......@@ -12,7 +12,9 @@ fn main() {
1212 let mut out_simple = rustc();
1313 let mut out_object = rustc();
1414 let mut out_macro = rustc();
15 let mut out_doc = rustc();
1516 let mut out_diagobj = rustc();
17 let mut out_diagdocobj = rustc();
1618 out_simple
1719 .remap_path_prefix("auxiliary", "/the/aux")
1820 .crate_type("lib")
......@@ -28,11 +30,21 @@ fn main() {
2830 .crate_type("lib")
2931 .emit("metadata")
3032 .input("auxiliary/lib.rs");
33 out_doc
34 .remap_path_prefix("auxiliary", "/the/aux")
35 .crate_type("lib")
36 .emit("metadata")
37 .input("auxiliary/lib.rs");
3138 out_diagobj
3239 .remap_path_prefix("auxiliary", "/the/aux")
3340 .crate_type("lib")
3441 .emit("metadata")
3542 .input("auxiliary/lib.rs");
43 out_diagdocobj
44 .remap_path_prefix("auxiliary", "/the/aux")
45 .crate_type("lib")
46 .emit("metadata")
47 .input("auxiliary/lib.rs");
3648
3749 out_simple.run();
3850 rmeta_contains("/the/aux/lib.rs");
......@@ -40,11 +52,17 @@ fn main() {
4052
4153 out_object.arg("--remap-path-scope=object");
4254 out_macro.arg("--remap-path-scope=macro");
55 out_doc.arg("--remap-path-scope=documentation").arg("-Zunstable-options");
4356 out_diagobj.arg("--remap-path-scope=diagnostics,object");
57 out_diagdocobj
58 .arg("--remap-path-scope=diagnostics,documentation,object")
59 .arg("-Zunstable-options");
4460 if is_darwin() {
4561 out_object.arg("-Csplit-debuginfo=off");
4662 out_macro.arg("-Csplit-debuginfo=off");
63 out_doc.arg("-Csplit-debuginfo=off");
4764 out_diagobj.arg("-Csplit-debuginfo=off");
65 out_diagdocobj.arg("-Csplit-debuginfo=off");
4866 }
4967
5068 out_object.run();
......@@ -53,8 +71,14 @@ fn main() {
5371 out_macro.run();
5472 rmeta_contains("/the/aux/lib.rs");
5573 rmeta_contains("auxiliary");
74 out_doc.run();
75 rmeta_contains("/the/aux/lib.rs");
76 rmeta_contains("auxiliary");
5677 out_diagobj.run();
5778 rmeta_contains("/the/aux/lib.rs");
79 rmeta_contains("auxiliary");
80 out_diagdocobj.run();
81 rmeta_contains("/the/aux/lib.rs");
5882 rmeta_not_contains("auxiliary");
5983}
6084
tests/ui/compile-flags/invalid/remap-path-scope.foo.stderr created+2
......@@ -0,0 +1,2 @@
1error: argument for `--remap-path-scope` must be a comma separated list of scopes: `macro`, `diagnostics`, `documentation`, `debuginfo`, `coverage`, `object`, `all`
2
tests/ui/compile-flags/invalid/remap-path-scope.rs created+9
......@@ -0,0 +1,9 @@
1// Error on invalid --remap-path-scope arguments
2
3//@ revisions: foo underscore
4//@ [foo]compile-flags: --remap-path-scope=foo
5//@ [underscore]compile-flags: --remap-path-scope=macro_object
6
7//~? ERROR argument for `--remap-path-scope
8
9fn main() {}
tests/ui/compile-flags/invalid/remap-path-scope.underscore.stderr created+2
......@@ -0,0 +1,2 @@
1error: argument for `--remap-path-scope` must be a comma separated list of scopes: `macro`, `diagnostics`, `documentation`, `debuginfo`, `coverage`, `object`, `all`
2
tests/ui/errors/auxiliary/file-doc.rs created+13
......@@ -0,0 +1,13 @@
1//@ compile-flags: --remap-path-prefix={{src-base}}=remapped
2//@ compile-flags: --remap-path-scope=documentation -Zunstable-options
3
4#[macro_export]
5macro_rules! my_file {
6 () => {
7 file!()
8 };
9}
10
11pub fn file() -> &'static str {
12 file!()
13}
tests/ui/errors/auxiliary/trait-doc.rs created+4
......@@ -0,0 +1,4 @@
1//@ compile-flags: --remap-path-prefix={{src-base}}=remapped
2//@ compile-flags: --remap-path-scope=documentation -Zunstable-options
3
4pub trait Trait: std::fmt::Display {}
tests/ui/errors/remap-path-prefix-diagnostics.only-doc-in-deps.stderr created+20
......@@ -0,0 +1,20 @@
1error[E0277]: `A` doesn't implement `std::fmt::Display`
2 --> $DIR/remap-path-prefix-diagnostics.rs:LL:COL
3 |
4LL | impl r#trait::Trait for A {}
5 | ^ unsatisfied trait bound
6 |
7help: the trait `std::fmt::Display` is not implemented for `A`
8 --> $DIR/remap-path-prefix-diagnostics.rs:LL:COL
9 |
10LL | struct A;
11 | ^^^^^^^^
12note: required by a bound in `Trait`
13 --> $DIR/auxiliary/trait-doc.rs:LL:COL
14 |
15LL | pub trait Trait: std::fmt::Display {}
16 | ^^^^^^^^^^^^^^^^^ required by this bound in `Trait`
17
18error: aborting due to 1 previous error
19
20For more information about this error, try `rustc --explain E0277`.
tests/ui/errors/remap-path-prefix-diagnostics.rs+14-5
......@@ -3,26 +3,30 @@
33// We test different combinations with/without remap in deps, with/without remap in this
44// crate but always in deps and always here but never in deps.
55
6//@ revisions: with-diag-in-deps with-macro-in-deps with-debuginfo-in-deps
7//@ revisions: only-diag-in-deps only-macro-in-deps only-debuginfo-in-deps
6//@ revisions: with-diag-in-deps with-macro-in-deps with-debuginfo-in-deps with-doc-in-deps
7//@ revisions: only-diag-in-deps only-macro-in-deps only-debuginfo-in-deps only-doc-in-deps
88//@ revisions: not-diag-in-deps
99
1010//@[with-diag-in-deps] compile-flags: --remap-path-prefix={{src-base}}=remapped
1111//@[with-macro-in-deps] compile-flags: --remap-path-prefix={{src-base}}=remapped
1212//@[with-debuginfo-in-deps] compile-flags: --remap-path-prefix={{src-base}}=remapped
13//@[with-doc-in-deps] compile-flags: --remap-path-prefix={{src-base}}=remapped
1314//@[not-diag-in-deps] compile-flags: --remap-path-prefix={{src-base}}=remapped
1415
1516//@[with-diag-in-deps] compile-flags: --remap-path-scope=diagnostics
1617//@[with-macro-in-deps] compile-flags: --remap-path-scope=macro
1718//@[with-debuginfo-in-deps] compile-flags: --remap-path-scope=debuginfo
19//@[with-doc-in-deps] compile-flags: --remap-path-scope=documentation -Zunstable-options
1820//@[not-diag-in-deps] compile-flags: --remap-path-scope=diagnostics
1921
2022//@[with-diag-in-deps] aux-build:trait-diag.rs
2123//@[with-macro-in-deps] aux-build:trait-macro.rs
2224//@[with-debuginfo-in-deps] aux-build:trait-debuginfo.rs
25//@[with-doc-in-deps] aux-build:trait-doc.rs
2326//@[only-diag-in-deps] aux-build:trait-diag.rs
2427//@[only-macro-in-deps] aux-build:trait-macro.rs
2528//@[only-debuginfo-in-deps] aux-build:trait-debuginfo.rs
29//@[only-doc-in-deps] aux-build:trait-doc.rs
2630//@[not-diag-in-deps] aux-build:trait.rs
2731
2832// The $SRC_DIR*.rs:LL:COL normalisation doesn't kick in automatically
......@@ -39,6 +43,9 @@ extern crate trait_macro as r#trait;
3943#[cfg(any(with_debuginfo_in_deps, only_debuginfo_in_deps))]
4044extern crate trait_debuginfo as r#trait;
4145
46#[cfg(any(with_doc_in_deps, only_doc_in_deps))]
47extern crate trait_doc as r#trait;
48
4249#[cfg(not_diag_in_deps)]
4350extern crate r#trait as r#trait;
4451
......@@ -47,9 +54,11 @@ struct A;
4754impl r#trait::Trait for A {}
4855//[with-macro-in-deps]~^ ERROR `A` doesn't implement `std::fmt::Display`
4956//[with-debuginfo-in-deps]~^^ ERROR `A` doesn't implement `std::fmt::Display`
50//[only-diag-in-deps]~^^^ ERROR `A` doesn't implement `std::fmt::Display`
51//[only-macro-in-deps]~^^^^ ERROR `A` doesn't implement `std::fmt::Display`
52//[only-debuginfo-in-deps]~^^^^^ ERROR `A` doesn't implement `std::fmt::Display`
57//[with-doc-in-deps]~^^^ ERROR `A` doesn't implement `std::fmt::Display`
58//[only-diag-in-deps]~^^^^ ERROR `A` doesn't implement `std::fmt::Display`
59//[only-macro-in-deps]~^^^^^ ERROR `A` doesn't implement `std::fmt::Display`
60//[only-debuginfo-in-deps]~^^^^^^ ERROR `A` doesn't implement `std::fmt::Display`
61//[only-doc-in-deps]~^^^^^^^ ERROR `A` doesn't implement `std::fmt::Display`
5362
5463//[with-diag-in-deps]~? ERROR `A` doesn't implement `std::fmt::Display`
5564//[not-diag-in-deps]~? ERROR `A` doesn't implement `std::fmt::Display`
tests/ui/errors/remap-path-prefix-diagnostics.with-doc-in-deps.stderr created+20
......@@ -0,0 +1,20 @@
1error[E0277]: `A` doesn't implement `std::fmt::Display`
2 --> $DIR/remap-path-prefix-diagnostics.rs:LL:COL
3 |
4LL | impl r#trait::Trait for A {}
5 | ^ unsatisfied trait bound
6 |
7help: the trait `std::fmt::Display` is not implemented for `A`
8 --> $DIR/remap-path-prefix-diagnostics.rs:LL:COL
9 |
10LL | struct A;
11 | ^^^^^^^^
12note: required by a bound in `Trait`
13 --> $DIR/auxiliary/trait-doc.rs:LL:COL
14 |
15LL | pub trait Trait: std::fmt::Display {}
16 | ^^^^^^^^^^^^^^^^^ required by this bound in `Trait`
17
18error: aborting due to 1 previous error
19
20For more information about this error, try `rustc --explain E0277`.
tests/ui/errors/remap-path-prefix-macro.only-doc-in-deps.run.stdout created+3
......@@ -0,0 +1,3 @@
1file::my_file!() = $DIR/remap-path-prefix-macro.rs
2file::file() = $DIR/auxiliary/file-doc.rs
3file!() = $DIR/remap-path-prefix-macro.rs
tests/ui/errors/remap-path-prefix-macro.rs+9-2
......@@ -6,26 +6,30 @@
66//@ run-pass
77//@ check-run-results
88
9//@ revisions: with-diag-in-deps with-macro-in-deps with-debuginfo-in-deps
10//@ revisions: only-diag-in-deps only-macro-in-deps only-debuginfo-in-deps
9//@ revisions: with-diag-in-deps with-macro-in-deps with-debuginfo-in-deps with-doc-in-deps
10//@ revisions: only-diag-in-deps only-macro-in-deps only-debuginfo-in-deps only-doc-in-deps
1111//@ revisions: not-macro-in-deps
1212
1313//@[with-diag-in-deps] compile-flags: --remap-path-prefix={{src-base}}=remapped
1414//@[with-macro-in-deps] compile-flags: --remap-path-prefix={{src-base}}=remapped
1515//@[with-debuginfo-in-deps] compile-flags: --remap-path-prefix={{src-base}}=remapped
16//@[with-doc-in-deps] compile-flags: --remap-path-prefix={{src-base}}=remapped
1617//@[not-macro-in-deps] compile-flags: --remap-path-prefix={{src-base}}=remapped
1718
1819//@[with-diag-in-deps] compile-flags: --remap-path-scope=diagnostics
1920//@[with-macro-in-deps] compile-flags: --remap-path-scope=macro
2021//@[with-debuginfo-in-deps] compile-flags: --remap-path-scope=debuginfo
22//@[with-doc-in-deps] compile-flags: --remap-path-scope=documentation -Zunstable-options
2123//@[not-macro-in-deps] compile-flags: --remap-path-scope=macro
2224
2325//@[with-diag-in-deps] aux-build:file-diag.rs
2426//@[with-macro-in-deps] aux-build:file-macro.rs
2527//@[with-debuginfo-in-deps] aux-build:file-debuginfo.rs
28//@[with-doc-in-deps] aux-build:file-doc.rs
2629//@[only-diag-in-deps] aux-build:file-diag.rs
2730//@[only-macro-in-deps] aux-build:file-macro.rs
2831//@[only-debuginfo-in-deps] aux-build:file-debuginfo.rs
32//@[only-doc-in-deps] aux-build:file-doc.rs
2933//@[not-macro-in-deps] aux-build:file.rs
3034
3135#[cfg(any(with_diag_in_deps, only_diag_in_deps))]
......@@ -37,6 +41,9 @@ extern crate file_macro as file;
3741#[cfg(any(with_debuginfo_in_deps, only_debuginfo_in_deps))]
3842extern crate file_debuginfo as file;
3943
44#[cfg(any(with_doc_in_deps, only_doc_in_deps))]
45extern crate file_doc as file;
46
4047#[cfg(not_macro_in_deps)]
4148extern crate file;
4249
tests/ui/errors/remap-path-prefix-macro.with-doc-in-deps.run.stdout created+3
......@@ -0,0 +1,3 @@
1file::my_file!() = $DIR/remap-path-prefix-macro.rs
2file::file() = $DIR/auxiliary/file-doc.rs
3file!() = $DIR/remap-path-prefix-macro.rs
tests/ui/feature-gates/remap-path-scope-documentation.rs created+7
......@@ -0,0 +1,7 @@
1// Test that documentation scope is unstable
2
3//@ compile-flags: --remap-path-scope=documentation
4
5//~? ERROR remapping `documentation` path scope requested but `-Zunstable-options` not specified
6
7fn main() {}
tests/ui/feature-gates/remap-path-scope-documentation.stderr created+2
......@@ -0,0 +1,2 @@
1error: remapping `documentation` path scope requested but `-Zunstable-options` not specified
2