Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 12 pull requests #122389

Merged
merged 25 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
d413ad8
update remap path of `rust-analyzer-proc-macro-srv` alias
onur-ozkan Mar 6, 2024
ea22e78
validate `builder::PATH_REMAP` in bootstrap tests
onur-ozkan Mar 6, 2024
11f8866
Detect truncated incr comp files
saethlin Feb 12, 2024
0e354c9
[bootstrap] Move the split-debuginfo setting to the per-target section
TimNN Feb 28, 2024
7f1d08e
bootstrap: Don't eagerly format verbose messages
clubby789 Mar 11, 2024
f4b2a8a
rustdoc: fix up old test
fmease Mar 12, 2024
98553ce
tests: Add ui/attributes/unix_sigpipe/unix_sigpipe-str-list.rs
Enselic Mar 10, 2024
783490d
Fix stack overflow with recursive associated types
oli-obk Mar 12, 2024
e91f937
Add tests for the generated assembly of mask related simd instructions.
jhorstmann Mar 2, 2024
5336a02
Fix discriminant_kind copy paste from the pointee trait case
zetanumbers Mar 12, 2024
e8cef43
Properly rebuild rustbooks
clubby789 Mar 12, 2024
34e59f4
Fix typo in lib.rs of proc_macro
Isotope-235 Mar 12, 2024
0a2ddcd
llvm-wrapper: adapt for LLVM API changes
krasimirgg Mar 12, 2024
7a45c72
Rollup merge of #121754 - TimNN:split-target, r=Mark-Simulacrum,onur-…
workingjubilee Mar 12, 2024
947d960
Rollup merge of #121953 - jhorstmann:assembly-tests-for-masked-simd-i…
workingjubilee Mar 12, 2024
45cc461
Rollup merge of #122081 - onur-ozkan:validate-path-remaps, r=clubby789
workingjubilee Mar 12, 2024
f54350a
Rollup merge of #122245 - saethlin:check-dep-graph-size, r=petrochenkov
workingjubilee Mar 12, 2024
7b5c63b
Rollup merge of #122354 - clubby789:bootstrap-eager-verbose, r=albert…
workingjubilee Mar 12, 2024
1aef2fb
Rollup merge of #122355 - fmease:rustdoc-fix-up-old-test, r=notriddle
workingjubilee Mar 12, 2024
778c76c
Rollup merge of #122363 - Enselic:unix_sigpipe-str-list, r=oli-obk
workingjubilee Mar 12, 2024
0b31375
Rollup merge of #122366 - oli-obk:opaques_defined_by_overflow, r=lcnr
workingjubilee Mar 12, 2024
bca8c62
Rollup merge of #122377 - zetanumbers:discriminant_kind_copypaste_fix…
workingjubilee Mar 12, 2024
cf3d178
Rollup merge of #122378 - clubby789:rustbook-rebuild, r=onur-ozkan
workingjubilee Mar 12, 2024
8efdef6
Rollup merge of #122380 - Isotope-235:fork, r=petrochenkov
workingjubilee Mar 12, 2024
3e9c1d7
Rollup merge of #122381 - krasimirgg:llvm-19-mar, r=durin42
workingjubilee Mar 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1112,11 +1112,16 @@ extern "C" LLVMValueRef LLVMRustDIBuilderInsertDeclareAtEnd(
LLVMRustDIBuilderRef Builder, LLVMValueRef V, LLVMMetadataRef VarInfo,
uint64_t *AddrOps, unsigned AddrOpsCount, LLVMMetadataRef DL,
LLVMBasicBlockRef InsertAtEnd) {
return wrap(Builder->insertDeclare(
auto Result = Builder->insertDeclare(
unwrap(V), unwrap<DILocalVariable>(VarInfo),
Builder->createExpression(llvm::ArrayRef<uint64_t>(AddrOps, AddrOpsCount)),
DebugLoc(cast<MDNode>(unwrap(DL))),
unwrap(InsertAtEnd)));
unwrap(InsertAtEnd));
#if LLVM_VERSION_GE(19, 0)
return wrap(Result.get<llvm::Instruction *>());
#else
return wrap(Result);
#endif
}

extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateEnumerator(
Expand Down
10 changes: 7 additions & 3 deletions compiler/rustc_query_system/src/dep_graph/serialized.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,13 +179,15 @@ impl SerializedDepGraph {
pub fn decode<D: Deps>(d: &mut MemDecoder<'_>) -> SerializedDepGraph {
// The last 16 bytes are the node count and edge count.
debug!("position: {:?}", d.position());
let (node_count, edge_count) =
d.with_position(d.len() - 2 * IntEncodedWithFixedSize::ENCODED_SIZE, |d| {
let (node_count, edge_count, graph_size) =
d.with_position(d.len() - 3 * IntEncodedWithFixedSize::ENCODED_SIZE, |d| {
debug!("position: {:?}", d.position());
let node_count = IntEncodedWithFixedSize::decode(d).0 as usize;
let edge_count = IntEncodedWithFixedSize::decode(d).0 as usize;
(node_count, edge_count)
let graph_size = IntEncodedWithFixedSize::decode(d).0 as usize;
(node_count, edge_count, graph_size)
});
assert_eq!(d.len(), graph_size);
debug!("position: {:?}", d.position());

debug!(?node_count, ?edge_count);
Expand Down Expand Up @@ -491,6 +493,8 @@ impl<D: Deps> EncoderState<D> {
debug!("position: {:?}", encoder.position());
IntEncodedWithFixedSize(node_count).encode(&mut encoder);
IntEncodedWithFixedSize(edge_count).encode(&mut encoder);
let graph_size = encoder.position() + IntEncodedWithFixedSize::ENCODED_SIZE;
IntEncodedWithFixedSize(graph_size as u64).encode(&mut encoder);
debug!("position: {:?}", encoder.position());
// Drop the encoder so that nothing is written after the counts.
let result = encoder.finish();
Expand Down
5 changes: 3 additions & 2 deletions compiler/rustc_trait_selection/src/traits/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1061,8 +1061,9 @@ fn assemble_candidates_from_impls<'cx, 'tcx>(
// Integers and floats always have `u8` as their discriminant.
| ty::Infer(ty::InferTy::IntVar(_) | ty::InferTy::FloatVar(..)) => true,

// type parameters, opaques, and unnormalized projections have pointer
// metadata if they're known (e.g. by the param_env) to be sized
// type parameters, opaques, and unnormalized projections don't have
// a known discriminant and may need to be normalized further or rely
// on param env for discriminant projections
ty::Param(_)
| ty::Alias(..)
| ty::Bound(..)
Expand Down
4 changes: 4 additions & 0 deletions compiler/rustc_ty_utils/src/opaque_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,10 @@ impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for OpaqueTypeCollector<'tcx> {
continue;
}

if !self.seen.insert(assoc.def_id.expect_local()) {
return;
}

let impl_args = alias_ty.args.rebase_onto(
self.tcx,
impl_trait_ref.def_id,
Expand Down
40 changes: 26 additions & 14 deletions config.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -543,23 +543,15 @@
# FIXME(#61117): Some tests fail when this option is enabled.
#debuginfo-level-tests = 0

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

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

# Should rustc and the standard library be built with split debuginfo? Default
# is platform dependent.
#
# Valid values are the same as those accepted by `-C split-debuginfo`
# (`off`/`unpacked`/`packed`).
#
# On Linux, split debuginfo is disabled by default.
#
# On Apple platforms, unpacked split debuginfo is used by default. Unpacked
# debuginfo does not run `dsymutil`, which packages debuginfo from disparate
# object files into a single `.dSYM` file. `dsymutil` adds time to builds for
# no clear benefit, and also makes it more difficult for debuggers to find
# debug info. The compiler currently defaults to running `dsymutil` to preserve
# its historical default, but when compiling the compiler itself, we skip it by
# default since we know it's safe to do so in that case.
#
# On Windows platforms, packed debuginfo is the only supported option,
# producing a `.pdb` file.
#split-debuginfo = if linux { off } else if windows { packed } else if apple { unpacked }

# Path to the `llvm-config` binary of the installation of a custom LLVM to link
# against. Note that if this is specified we don't compile LLVM at all for this
# target.
Expand Down
2 changes: 1 addition & 1 deletion library/proc_macro/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ pub fn is_available() -> bool {

/// The main type provided by this crate, representing an abstract stream of
/// tokens, or, more specifically, a sequence of token trees.
/// The type provide interfaces for iterating over those token trees and, conversely,
/// The type provides interfaces for iterating over those token trees and, conversely,
/// collecting a number of token trees into one stream.
///
/// This is both the input and output of `#[proc_macro]`, `#[proc_macro_attribute]`
Expand Down
7 changes: 4 additions & 3 deletions src/bootstrap/src/core/build_steps/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1536,7 +1536,8 @@ impl Step for Sysroot {
};
let sysroot = sysroot_dir(compiler.stage);

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

Expand Down Expand Up @@ -1606,7 +1607,7 @@ impl Step for Sysroot {
return true;
}
if !filtered_files.iter().all(|f| f != path.file_name().unwrap()) {
builder.verbose_than(1, &format!("ignoring {}", path.display()));
builder.verbose_than(1, || println!("ignoring {}", path.display()));
false
} else {
true
Expand Down Expand Up @@ -2085,7 +2086,7 @@ pub fn stream_cargo(
cargo.arg(arg);
}

builder.verbose(&format!("running: {cargo:?}"));
builder.verbose(|| println!("running: {cargo:?}"));

if builder.config.dry_run() {
return true;
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/src/core/build_steps/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2107,7 +2107,7 @@ fn maybe_install_llvm(
{
let mut cmd = Command::new(llvm_config);
cmd.arg("--libfiles");
builder.verbose(&format!("running {cmd:?}"));
builder.verbose(|| println!("running {cmd:?}"));
let files = if builder.config.dry_run() { "".into() } else { output(&mut cmd) };
let build_llvm_out = &builder.llvm_out(builder.config.build);
let target_llvm_out = &builder.llvm_out(target);
Expand Down
3 changes: 2 additions & 1 deletion src/bootstrap/src/core/build_steps/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ impl<P: Step> Step for RustbookSrc<P> {
let rustbook = builder.tool_exe(Tool::Rustbook);
let mut rustbook_cmd = builder.tool_cmd(Tool::Rustbook);

if !builder.config.dry_run() && !(up_to_date(&src, &index) || up_to_date(&rustbook, &index))
if !builder.config.dry_run()
&& (!up_to_date(&src, &index) || !up_to_date(&rustbook, &index))
{
builder.info(&format!("Rustbook ({target}) - {name}"));
let _ = fs::remove_dir_all(&out);
Expand Down
6 changes: 3 additions & 3 deletions src/bootstrap/src/core/build_steps/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -551,15 +551,15 @@ impl Miri {
if builder.config.dry_run() {
String::new()
} else {
builder.verbose(&format!("running: {cargo:?}"));
builder.verbose(|| println!("running: {cargo:?}"));
let out =
cargo.output().expect("We already ran `cargo miri setup` before and that worked");
assert!(out.status.success(), "`cargo miri setup` returned with non-0 exit code");
// Output is "<sysroot>\n".
let stdout = String::from_utf8(out.stdout)
.expect("`cargo miri setup` stdout is not valid UTF-8");
let sysroot = stdout.trim_end();
builder.verbose(&format!("`cargo miri setup --print-sysroot` said: {sysroot:?}"));
builder.verbose(|| println!("`cargo miri setup --print-sysroot` said: {sysroot:?}"));
sysroot.to_owned()
}
}
Expand Down Expand Up @@ -2326,7 +2326,7 @@ fn markdown_test(builder: &Builder<'_>, compiler: Compiler, markdown: &Path) ->
}
}

builder.verbose(&format!("doc tests for: {}", markdown.display()));
builder.verbose(|| println!("doc tests for: {}", markdown.display()));
let mut cmd = builder.rustdoc_cmd(compiler);
builder.add_rust_test_threads(&mut cmd);
// allow for unstable options such as new editions
Expand Down
34 changes: 18 additions & 16 deletions src/bootstrap/src/core/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ impl PathSet {
const PATH_REMAP: &[(&str, &[&str])] = &[
// config.toml uses `rust-analyzer-proc-macro-srv`, but the
// actual path is `proc-macro-srv-cli`
("rust-analyzer-proc-macro-srv", &["proc-macro-srv-cli"]),
("rust-analyzer-proc-macro-srv", &["src/tools/rust-analyzer/crates/proc-macro-srv-cli"]),
// Make `x test tests` function the same as `x t tests/*`
(
"tests",
Expand Down Expand Up @@ -382,10 +382,12 @@ impl StepDescription {
}

if !builder.config.skip.is_empty() && !matches!(builder.config.dry_run, DryRun::SelfCheck) {
builder.verbose(&format!(
"{:?} not skipped for {:?} -- not in {:?}",
pathset, self.name, builder.config.skip
));
builder.verbose(|| {
println!(
"{:?} not skipped for {:?} -- not in {:?}",
pathset, self.name, builder.config.skip
)
});
}
false
}
Expand Down Expand Up @@ -1093,10 +1095,9 @@ impl<'a> Builder<'a> {
// Avoid deleting the rustlib/ directory we just copied
// (in `impl Step for Sysroot`).
if !builder.download_rustc() {
builder.verbose(&format!(
"Removing sysroot {} to avoid caching bugs",
sysroot.display()
));
builder.verbose(|| {
println!("Removing sysroot {} to avoid caching bugs", sysroot.display())
});
let _ = fs::remove_dir_all(&sysroot);
t!(fs::create_dir_all(&sysroot));
}
Expand Down Expand Up @@ -1436,7 +1437,7 @@ impl<'a> Builder<'a> {

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

let mut rustflags = Rustflags::new(target);
Expand Down Expand Up @@ -1731,15 +1732,16 @@ impl<'a> Builder<'a> {
},
);

let split_debuginfo = self.config.split_debuginfo(target);
let split_debuginfo_is_stable = target.contains("linux")
|| target.contains("apple")
|| (target.is_msvc() && self.config.rust_split_debuginfo == SplitDebuginfo::Packed)
|| (target.is_windows() && self.config.rust_split_debuginfo == SplitDebuginfo::Off);
|| (target.is_msvc() && split_debuginfo == SplitDebuginfo::Packed)
|| (target.is_windows() && split_debuginfo == SplitDebuginfo::Off);

if !split_debuginfo_is_stable {
rustflags.arg("-Zunstable-options");
}
match self.config.rust_split_debuginfo {
match split_debuginfo {
SplitDebuginfo::Packed => rustflags.arg("-Csplit-debuginfo=packed"),
SplitDebuginfo::Unpacked => rustflags.arg("-Csplit-debuginfo=unpacked"),
SplitDebuginfo::Off => rustflags.arg("-Csplit-debuginfo=off"),
Expand Down Expand Up @@ -2102,11 +2104,11 @@ impl<'a> Builder<'a> {
panic!("{}", out);
}
if let Some(out) = self.cache.get(&step) {
self.verbose_than(1, &format!("{}c {:?}", " ".repeat(stack.len()), step));
self.verbose_than(1, || println!("{}c {:?}", " ".repeat(stack.len()), step));

return out;
}
self.verbose_than(1, &format!("{}> {:?}", " ".repeat(stack.len()), step));
self.verbose_than(1, || println!("{}> {:?}", " ".repeat(stack.len()), step));
stack.push(Box::new(step.clone()));
}

Expand Down Expand Up @@ -2144,7 +2146,7 @@ impl<'a> Builder<'a> {
let cur_step = stack.pop().expect("step stack empty");
assert_eq!(cur_step.downcast_ref(), Some(&step));
}
self.verbose_than(1, &format!("{}< {:?}", " ".repeat(self.stack.borrow().len()), step));
self.verbose_than(1, || println!("{}< {:?}", " ".repeat(self.stack.borrow().len()), step));
self.cache.put(step, out.clone());
out
}
Expand Down
13 changes: 13 additions & 0 deletions src/bootstrap/src/core/builder/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,19 @@ fn test_intersection() {
assert_eq!(command_paths, vec![Path::new("library/stdarch")]);
}

#[test]
fn validate_path_remap() {
let build = Build::new(configure("test", &["A"], &["A"]));

PATH_REMAP
.iter()
.flat_map(|(_, paths)| paths.iter())
.map(|path| build.src.join(path))
.for_each(|path| {
assert!(path.exists(), "{} should exist.", path.display());
});
}

#[test]
fn test_exclude() {
let mut config = configure("test", &["A"], &["A"]);
Expand Down
Loading
Loading