Skip to content

Commit 6b1e5d9

Browse files
committed
Auto merge of #122389 - workingjubilee:rollup-vbdniap, r=workingjubilee
Rollup of 12 pull requests Successful merges: - #121754 ([bootstrap] Move the `split-debuginfo` setting to the per-target section) - #121953 (Add tests for the generated assembly of mask related simd instructions.) - #122081 (validate `builder::PATH_REMAP`) - #122245 (Detect truncated DepGraph files) - #122354 (bootstrap: Don't eagerly format verbose messages) - #122355 (rustdoc: fix up old test) - #122363 (tests: Add ui/attributes/unix_sigpipe/unix_sigpipe-str-list.rs) - #122366 (Fix stack overflow with recursive associated types) - #122377 (Fix discriminant_kind copy paste from the pointee trait case) - #122378 (Properly rebuild rustbooks) - #122380 (Fix typo in lib.rs of proc_macro) - #122381 (llvm-wrapper: adapt for LLVM API changes) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 7de1a1f + 3e9c1d7 commit 6b1e5d9

34 files changed

+831
-104
lines changed

compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp

+7-2
Original file line numberDiff line numberDiff line change
@@ -1112,11 +1112,16 @@ extern "C" LLVMValueRef LLVMRustDIBuilderInsertDeclareAtEnd(
11121112
LLVMRustDIBuilderRef Builder, LLVMValueRef V, LLVMMetadataRef VarInfo,
11131113
uint64_t *AddrOps, unsigned AddrOpsCount, LLVMMetadataRef DL,
11141114
LLVMBasicBlockRef InsertAtEnd) {
1115-
return wrap(Builder->insertDeclare(
1115+
auto Result = Builder->insertDeclare(
11161116
unwrap(V), unwrap<DILocalVariable>(VarInfo),
11171117
Builder->createExpression(llvm::ArrayRef<uint64_t>(AddrOps, AddrOpsCount)),
11181118
DebugLoc(cast<MDNode>(unwrap(DL))),
1119-
unwrap(InsertAtEnd)));
1119+
unwrap(InsertAtEnd));
1120+
#if LLVM_VERSION_GE(19, 0)
1121+
return wrap(Result.get<llvm::Instruction *>());
1122+
#else
1123+
return wrap(Result);
1124+
#endif
11201125
}
11211126

11221127
extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateEnumerator(

compiler/rustc_query_system/src/dep_graph/serialized.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -179,13 +179,15 @@ impl SerializedDepGraph {
179179
pub fn decode<D: Deps>(d: &mut MemDecoder<'_>) -> SerializedDepGraph {
180180
// The last 16 bytes are the node count and edge count.
181181
debug!("position: {:?}", d.position());
182-
let (node_count, edge_count) =
183-
d.with_position(d.len() - 2 * IntEncodedWithFixedSize::ENCODED_SIZE, |d| {
182+
let (node_count, edge_count, graph_size) =
183+
d.with_position(d.len() - 3 * IntEncodedWithFixedSize::ENCODED_SIZE, |d| {
184184
debug!("position: {:?}", d.position());
185185
let node_count = IntEncodedWithFixedSize::decode(d).0 as usize;
186186
let edge_count = IntEncodedWithFixedSize::decode(d).0 as usize;
187-
(node_count, edge_count)
187+
let graph_size = IntEncodedWithFixedSize::decode(d).0 as usize;
188+
(node_count, edge_count, graph_size)
188189
});
190+
assert_eq!(d.len(), graph_size);
189191
debug!("position: {:?}", d.position());
190192

191193
debug!(?node_count, ?edge_count);
@@ -491,6 +493,8 @@ impl<D: Deps> EncoderState<D> {
491493
debug!("position: {:?}", encoder.position());
492494
IntEncodedWithFixedSize(node_count).encode(&mut encoder);
493495
IntEncodedWithFixedSize(edge_count).encode(&mut encoder);
496+
let graph_size = encoder.position() + IntEncodedWithFixedSize::ENCODED_SIZE;
497+
IntEncodedWithFixedSize(graph_size as u64).encode(&mut encoder);
494498
debug!("position: {:?}", encoder.position());
495499
// Drop the encoder so that nothing is written after the counts.
496500
let result = encoder.finish();

compiler/rustc_trait_selection/src/traits/project.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1061,8 +1061,9 @@ fn assemble_candidates_from_impls<'cx, 'tcx>(
10611061
// Integers and floats always have `u8` as their discriminant.
10621062
| ty::Infer(ty::InferTy::IntVar(_) | ty::InferTy::FloatVar(..)) => true,
10631063

1064-
// type parameters, opaques, and unnormalized projections have pointer
1065-
// metadata if they're known (e.g. by the param_env) to be sized
1064+
// type parameters, opaques, and unnormalized projections don't have
1065+
// a known discriminant and may need to be normalized further or rely
1066+
// on param env for discriminant projections
10661067
ty::Param(_)
10671068
| ty::Alias(..)
10681069
| ty::Bound(..)

compiler/rustc_ty_utils/src/opaque_types.rs

+4
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,10 @@ impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for OpaqueTypeCollector<'tcx> {
240240
continue;
241241
}
242242

243+
if !self.seen.insert(assoc.def_id.expect_local()) {
244+
return;
245+
}
246+
243247
let impl_args = alias_ty.args.rebase_onto(
244248
self.tcx,
245249
impl_trait_ref.def_id,

config.example.toml

+26-14
Original file line numberDiff line numberDiff line change
@@ -543,23 +543,15 @@
543543
# FIXME(#61117): Some tests fail when this option is enabled.
544544
#debuginfo-level-tests = 0
545545

546-
# Should rustc be build with split debuginfo? Default is platform dependent.
547-
# Valid values are the same as those accepted by `-C split-debuginfo`
548-
# (`off`/`unpacked`/`packed`).
546+
# Should rustc and the standard library be built with split debuginfo? Default
547+
# is platform dependent.
549548
#
550-
# On Linux, split debuginfo is disabled by default.
549+
# This field is deprecated, use `target.<triple>.split-debuginfo` instead.
551550
#
552-
# On Apple platforms, unpacked split debuginfo is used by default. Unpacked
553-
# debuginfo does not run `dsymutil`, which packages debuginfo from disparate
554-
# object files into a single `.dSYM` file. `dsymutil` adds time to builds for
555-
# no clear benefit, and also makes it more difficult for debuggers to find
556-
# debug info. The compiler currently defaults to running `dsymutil` to preserve
557-
# its historical default, but when compiling the compiler itself, we skip it by
558-
# default since we know it's safe to do so in that case.
551+
# The value specified here is only used when targeting the `build.build` triple,
552+
# and is overridden by `target.<triple>.split-debuginfo` if specified.
559553
#
560-
# On Windows platforms, packed debuginfo is the only supported option,
561-
# producing a `.pdb` file.
562-
#split-debuginfo = if linux { off } else if windows { packed } else if apple { unpacked }
554+
#split-debuginfo = see target.<triple>.split-debuginfo
563555

564556
# Whether or not `panic!`s generate backtraces (RUST_BACKTRACE)
565557
#backtrace = true
@@ -773,6 +765,26 @@
773765
# Setting this will override the `use-lld` option for Rust code when targeting MSVC.
774766
#linker = "cc" (path)
775767

768+
# Should rustc and the standard library be built with split debuginfo? Default
769+
# is platform dependent.
770+
#
771+
# Valid values are the same as those accepted by `-C split-debuginfo`
772+
# (`off`/`unpacked`/`packed`).
773+
#
774+
# On Linux, split debuginfo is disabled by default.
775+
#
776+
# On Apple platforms, unpacked split debuginfo is used by default. Unpacked
777+
# debuginfo does not run `dsymutil`, which packages debuginfo from disparate
778+
# object files into a single `.dSYM` file. `dsymutil` adds time to builds for
779+
# no clear benefit, and also makes it more difficult for debuggers to find
780+
# debug info. The compiler currently defaults to running `dsymutil` to preserve
781+
# its historical default, but when compiling the compiler itself, we skip it by
782+
# default since we know it's safe to do so in that case.
783+
#
784+
# On Windows platforms, packed debuginfo is the only supported option,
785+
# producing a `.pdb` file.
786+
#split-debuginfo = if linux { off } else if windows { packed } else if apple { unpacked }
787+
776788
# Path to the `llvm-config` binary of the installation of a custom LLVM to link
777789
# against. Note that if this is specified we don't compile LLVM at all for this
778790
# target.

library/proc_macro/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ pub fn is_available() -> bool {
7373

7474
/// The main type provided by this crate, representing an abstract stream of
7575
/// tokens, or, more specifically, a sequence of token trees.
76-
/// The type provide interfaces for iterating over those token trees and, conversely,
76+
/// The type provides interfaces for iterating over those token trees and, conversely,
7777
/// collecting a number of token trees into one stream.
7878
///
7979
/// This is both the input and output of `#[proc_macro]`, `#[proc_macro_attribute]`

src/bootstrap/src/core/build_steps/compile.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -1536,7 +1536,8 @@ impl Step for Sysroot {
15361536
};
15371537
let sysroot = sysroot_dir(compiler.stage);
15381538

1539-
builder.verbose(&format!("Removing sysroot {} to avoid caching bugs", sysroot.display()));
1539+
builder
1540+
.verbose(|| println!("Removing sysroot {} to avoid caching bugs", sysroot.display()));
15401541
let _ = fs::remove_dir_all(&sysroot);
15411542
t!(fs::create_dir_all(&sysroot));
15421543

@@ -1606,7 +1607,7 @@ impl Step for Sysroot {
16061607
return true;
16071608
}
16081609
if !filtered_files.iter().all(|f| f != path.file_name().unwrap()) {
1609-
builder.verbose_than(1, &format!("ignoring {}", path.display()));
1610+
builder.verbose_than(1, || println!("ignoring {}", path.display()));
16101611
false
16111612
} else {
16121613
true
@@ -2085,7 +2086,7 @@ pub fn stream_cargo(
20852086
cargo.arg(arg);
20862087
}
20872088

2088-
builder.verbose(&format!("running: {cargo:?}"));
2089+
builder.verbose(|| println!("running: {cargo:?}"));
20892090

20902091
if builder.config.dry_run() {
20912092
return true;

src/bootstrap/src/core/build_steps/dist.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2107,7 +2107,7 @@ fn maybe_install_llvm(
21072107
{
21082108
let mut cmd = Command::new(llvm_config);
21092109
cmd.arg("--libfiles");
2110-
builder.verbose(&format!("running {cmd:?}"));
2110+
builder.verbose(|| println!("running {cmd:?}"));
21112111
let files = if builder.config.dry_run() { "".into() } else { output(&mut cmd) };
21122112
let build_llvm_out = &builder.llvm_out(builder.config.build);
21132113
let target_llvm_out = &builder.llvm_out(target);

src/bootstrap/src/core/build_steps/doc.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,8 @@ impl<P: Step> Step for RustbookSrc<P> {
145145
let rustbook = builder.tool_exe(Tool::Rustbook);
146146
let mut rustbook_cmd = builder.tool_cmd(Tool::Rustbook);
147147

148-
if !builder.config.dry_run() && !(up_to_date(&src, &index) || up_to_date(&rustbook, &index))
148+
if !builder.config.dry_run()
149+
&& (!up_to_date(&src, &index) || !up_to_date(&rustbook, &index))
149150
{
150151
builder.info(&format!("Rustbook ({target}) - {name}"));
151152
let _ = fs::remove_dir_all(&out);

src/bootstrap/src/core/build_steps/test.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -551,15 +551,15 @@ impl Miri {
551551
if builder.config.dry_run() {
552552
String::new()
553553
} else {
554-
builder.verbose(&format!("running: {cargo:?}"));
554+
builder.verbose(|| println!("running: {cargo:?}"));
555555
let out =
556556
cargo.output().expect("We already ran `cargo miri setup` before and that worked");
557557
assert!(out.status.success(), "`cargo miri setup` returned with non-0 exit code");
558558
// Output is "<sysroot>\n".
559559
let stdout = String::from_utf8(out.stdout)
560560
.expect("`cargo miri setup` stdout is not valid UTF-8");
561561
let sysroot = stdout.trim_end();
562-
builder.verbose(&format!("`cargo miri setup --print-sysroot` said: {sysroot:?}"));
562+
builder.verbose(|| println!("`cargo miri setup --print-sysroot` said: {sysroot:?}"));
563563
sysroot.to_owned()
564564
}
565565
}
@@ -2326,7 +2326,7 @@ fn markdown_test(builder: &Builder<'_>, compiler: Compiler, markdown: &Path) ->
23262326
}
23272327
}
23282328

2329-
builder.verbose(&format!("doc tests for: {}", markdown.display()));
2329+
builder.verbose(|| println!("doc tests for: {}", markdown.display()));
23302330
let mut cmd = builder.rustdoc_cmd(compiler);
23312331
builder.add_rust_test_threads(&mut cmd);
23322332
// allow for unstable options such as new editions

src/bootstrap/src/core/builder.rs

+18-16
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ impl PathSet {
291291
const PATH_REMAP: &[(&str, &[&str])] = &[
292292
// config.toml uses `rust-analyzer-proc-macro-srv`, but the
293293
// actual path is `proc-macro-srv-cli`
294-
("rust-analyzer-proc-macro-srv", &["proc-macro-srv-cli"]),
294+
("rust-analyzer-proc-macro-srv", &["src/tools/rust-analyzer/crates/proc-macro-srv-cli"]),
295295
// Make `x test tests` function the same as `x t tests/*`
296296
(
297297
"tests",
@@ -382,10 +382,12 @@ impl StepDescription {
382382
}
383383

384384
if !builder.config.skip.is_empty() && !matches!(builder.config.dry_run, DryRun::SelfCheck) {
385-
builder.verbose(&format!(
386-
"{:?} not skipped for {:?} -- not in {:?}",
387-
pathset, self.name, builder.config.skip
388-
));
385+
builder.verbose(|| {
386+
println!(
387+
"{:?} not skipped for {:?} -- not in {:?}",
388+
pathset, self.name, builder.config.skip
389+
)
390+
});
389391
}
390392
false
391393
}
@@ -1093,10 +1095,9 @@ impl<'a> Builder<'a> {
10931095
// Avoid deleting the rustlib/ directory we just copied
10941096
// (in `impl Step for Sysroot`).
10951097
if !builder.download_rustc() {
1096-
builder.verbose(&format!(
1097-
"Removing sysroot {} to avoid caching bugs",
1098-
sysroot.display()
1099-
));
1098+
builder.verbose(|| {
1099+
println!("Removing sysroot {} to avoid caching bugs", sysroot.display())
1100+
});
11001101
let _ = fs::remove_dir_all(&sysroot);
11011102
t!(fs::create_dir_all(&sysroot));
11021103
}
@@ -1436,7 +1437,7 @@ impl<'a> Builder<'a> {
14361437

14371438
let sysroot_str = sysroot.as_os_str().to_str().expect("sysroot should be UTF-8");
14381439
if !matches!(self.config.dry_run, DryRun::SelfCheck) {
1439-
self.verbose_than(0, &format!("using sysroot {sysroot_str}"));
1440+
self.verbose_than(0, || println!("using sysroot {sysroot_str}"));
14401441
}
14411442

14421443
let mut rustflags = Rustflags::new(target);
@@ -1731,15 +1732,16 @@ impl<'a> Builder<'a> {
17311732
},
17321733
);
17331734

1735+
let split_debuginfo = self.config.split_debuginfo(target);
17341736
let split_debuginfo_is_stable = target.contains("linux")
17351737
|| target.contains("apple")
1736-
|| (target.is_msvc() && self.config.rust_split_debuginfo == SplitDebuginfo::Packed)
1737-
|| (target.is_windows() && self.config.rust_split_debuginfo == SplitDebuginfo::Off);
1738+
|| (target.is_msvc() && split_debuginfo == SplitDebuginfo::Packed)
1739+
|| (target.is_windows() && split_debuginfo == SplitDebuginfo::Off);
17381740

17391741
if !split_debuginfo_is_stable {
17401742
rustflags.arg("-Zunstable-options");
17411743
}
1742-
match self.config.rust_split_debuginfo {
1744+
match split_debuginfo {
17431745
SplitDebuginfo::Packed => rustflags.arg("-Csplit-debuginfo=packed"),
17441746
SplitDebuginfo::Unpacked => rustflags.arg("-Csplit-debuginfo=unpacked"),
17451747
SplitDebuginfo::Off => rustflags.arg("-Csplit-debuginfo=off"),
@@ -2102,11 +2104,11 @@ impl<'a> Builder<'a> {
21022104
panic!("{}", out);
21032105
}
21042106
if let Some(out) = self.cache.get(&step) {
2105-
self.verbose_than(1, &format!("{}c {:?}", " ".repeat(stack.len()), step));
2107+
self.verbose_than(1, || println!("{}c {:?}", " ".repeat(stack.len()), step));
21062108

21072109
return out;
21082110
}
2109-
self.verbose_than(1, &format!("{}> {:?}", " ".repeat(stack.len()), step));
2111+
self.verbose_than(1, || println!("{}> {:?}", " ".repeat(stack.len()), step));
21102112
stack.push(Box::new(step.clone()));
21112113
}
21122114

@@ -2144,7 +2146,7 @@ impl<'a> Builder<'a> {
21442146
let cur_step = stack.pop().expect("step stack empty");
21452147
assert_eq!(cur_step.downcast_ref(), Some(&step));
21462148
}
2147-
self.verbose_than(1, &format!("{}< {:?}", " ".repeat(self.stack.borrow().len()), step));
2149+
self.verbose_than(1, || println!("{}< {:?}", " ".repeat(self.stack.borrow().len()), step));
21482150
self.cache.put(step, out.clone());
21492151
out
21502152
}

src/bootstrap/src/core/builder/tests.rs

+13
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,19 @@ fn test_intersection() {
115115
assert_eq!(command_paths, vec![Path::new("library/stdarch")]);
116116
}
117117

118+
#[test]
119+
fn validate_path_remap() {
120+
let build = Build::new(configure("test", &["A"], &["A"]));
121+
122+
PATH_REMAP
123+
.iter()
124+
.flat_map(|(_, paths)| paths.iter())
125+
.map(|path| build.src.join(path))
126+
.for_each(|path| {
127+
assert!(path.exists(), "{} should exist.", path.display());
128+
});
129+
}
130+
118131
#[test]
119132
fn test_exclude() {
120133
let mut config = configure("test", &["A"], &["A"]);

0 commit comments

Comments
 (0)