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 8 pull requests #106318

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
2c89a51
rustc_target: Add alignment to indirectly-passed by-value types, corr…
pcwalton Nov 1, 2022
02397c8
Add regression test for #86106
JohnTitor Dec 22, 2022
3b16aea
Apply review suggestions
JohnTitor Dec 22, 2022
cbede85
Support `x clean --stage 1 rustc_query_impl`
jyn514 Dec 29, 2022
e15272d
Add tidy check to deny merge commits
Noratrieb Dec 14, 2022
ad9806b
Checkout `master` branch in CI
Noratrieb Dec 23, 2022
f9cc011
Tidy up tidy error codes check
Noratrieb Dec 30, 2022
87bc29d
Extend scraped examples layout GUI test for position of buttons
GuillaumeGomez Dec 30, 2022
878af66
Add `build_helper` crate to share code between tidy and bootstrap
Noratrieb Dec 30, 2022
c8c849e
Use more consistent progress messages in bootstrap
jyn514 Dec 30, 2022
9dfe504
bootstrap: Get rid of `tail_args` in `stream_cargo`
jyn514 Dec 30, 2022
75b3ee2
Make tidy errors red
Noratrieb Dec 30, 2022
e2c5999
Dont use `--merge-base` during bootstrap formatting subcommand
compiler-errors Dec 30, 2022
6d2fe52
Fix panic on `x build --help`
jyn514 Dec 31, 2022
5c5309d
Rollup merge of #103830 - pcwalton:pointee-align, r=oli-obk
jyn514 Dec 31, 2022
c9f4f03
Rollup merge of #105058 - Nilstrieb:no-merge-commits-for-you-only-bor…
jyn514 Dec 31, 2022
900a2cc
Rollup merge of #106036 - JohnTitor:issue-86106, r=nikic
jyn514 Dec 31, 2022
ec92680
Rollup merge of #106286 - Nilstrieb:tidy-cowows, r=jyn514
jyn514 Dec 31, 2022
0770295
Rollup merge of #106295 - GuillaumeGomez:extend-scraped-examples-layo…
jyn514 Dec 31, 2022
f34c6e3
Rollup merge of #106305 - jyn514:tail-args, r=Mark-Simulacrum
jyn514 Dec 31, 2022
2a74e58
Rollup merge of #106310 - compiler-errors:old-git, r=jyn514
jyn514 Dec 31, 2022
71909ef
Rollup merge of #106314 - jyn514:fix-panic, r=jyn514
jyn514 Dec 31, 2022
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
15 changes: 15 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ jobs:
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: "checkout the `master` branch for tidy"
uses: actions/checkout@v3
with:
ref: master
fetch-depth: 1
- name: configure the PR in which the error message will be posted
run: "echo \"[CI_PR_NUMBER=$num]\""
env:
Expand Down Expand Up @@ -485,6 +490,11 @@ jobs:
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: "checkout the `master` branch for tidy"
uses: actions/checkout@v3
with:
ref: master
fetch-depth: 1
- name: configure the PR in which the error message will be posted
run: "echo \"[CI_PR_NUMBER=$num]\""
env:
Expand Down Expand Up @@ -600,6 +610,11 @@ jobs:
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: "checkout the `master` branch for tidy"
uses: actions/checkout@v3
with:
ref: master
fetch-depth: 1
- name: configure the PR in which the error message will be posted
run: "echo \"[CI_PR_NUMBER=$num]\""
env:
Expand Down
14 changes: 10 additions & 4 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,10 @@ dependencies = [
"toml",
]

[[package]]
name = "build_helper"
version = "0.1.0"

[[package]]
name = "bump-stage0"
version = "0.1.0"
Expand Down Expand Up @@ -2675,9 +2679,9 @@ dependencies = [

[[package]]
name = "owo-colors"
version = "3.4.0"
version = "3.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "decf7381921fea4dcb2549c5667eda59b3ec297ab7e2b5fc33eac69d2e7da87b"
checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f"

[[package]]
name = "packed_simd_2"
Expand Down Expand Up @@ -5203,9 +5207,9 @@ dependencies = [

[[package]]
name = "termcolor"
version = "1.1.2"
version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4"
checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755"
dependencies = [
"winapi-util",
]
Expand Down Expand Up @@ -5304,11 +5308,13 @@ dependencies = [
name = "tidy"
version = "0.1.0"
dependencies = [
"build_helper",
"cargo_metadata 0.14.0",
"ignore",
"lazy_static",
"miropt-test-tools",
"regex",
"termcolor",
"walkdir",
]

Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ members = [
"library/std",
"library/test",
"src/rustdoc-json-types",
"src/tools/build_helper",
"src/tools/cargotest",
"src/tools/clippy",
"src/tools/clippy/clippy_dev",
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_target/src/abi/call/m68k.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ fn classify_ret<Ty>(ret: &mut ArgAbi<'_, Ty>) {

fn classify_arg<Ty>(arg: &mut ArgAbi<'_, Ty>) {
if arg.layout.is_aggregate() {
arg.make_indirect_byval();
arg.make_indirect_byval(None);
} else {
arg.extend_integer_width_to(32);
}
Expand Down
19 changes: 13 additions & 6 deletions compiler/rustc_target/src/abi/call/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -500,9 +500,7 @@ impl<'a, Ty> ArgAbi<'a, Ty> {
.set(ArgAttribute::NonNull)
.set(ArgAttribute::NoUndef);
attrs.pointee_size = layout.size;
// FIXME(eddyb) We should be doing this, but at least on
// i686-pc-windows-msvc, it results in wrong stack offsets.
// attrs.pointee_align = Some(layout.align.abi);
attrs.pointee_align = Some(layout.align.abi);

let extra_attrs = layout.is_unsized().then_some(ArgAttributes::new());

Expand All @@ -519,11 +517,19 @@ impl<'a, Ty> ArgAbi<'a, Ty> {
self.mode = Self::indirect_pass_mode(&self.layout);
}

pub fn make_indirect_byval(&mut self) {
pub fn make_indirect_byval(&mut self, byval_align: Option<Align>) {
self.make_indirect();
match self.mode {
PassMode::Indirect { attrs: _, extra_attrs: _, ref mut on_stack } => {
PassMode::Indirect { ref mut attrs, extra_attrs: _, ref mut on_stack } => {
*on_stack = true;

// Some platforms, like 32-bit x86, change the alignment of the type when passing
// `byval`. Account for that.
if let Some(byval_align) = byval_align {
// On all targets with byval align this is currently true, so let's assert it.
debug_assert!(byval_align >= Align::from_bytes(4).unwrap());
attrs.pointee_align = Some(byval_align);
}
}
_ => unreachable!(),
}
Expand Down Expand Up @@ -660,7 +666,8 @@ impl<'a, Ty> FnAbi<'a, Ty> {
{
if abi == spec::abi::Abi::X86Interrupt {
if let Some(arg) = self.args.first_mut() {
arg.make_indirect_byval();
// FIXME(pcwalton): This probably should use the x86 `byval` ABI...
arg.make_indirect_byval(None);
}
return Ok(());
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_target/src/abi/call/wasm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ where
{
arg.extend_integer_width_to(32);
if arg.layout.is_aggregate() && !unwrap_trivial_aggregate(cx, arg) {
arg.make_indirect_byval();
arg.make_indirect_byval(None);
}
}

Expand Down
35 changes: 31 additions & 4 deletions compiler/rustc_target/src/abi/call/x86.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::abi::call::{ArgAttribute, FnAbi, PassMode, Reg, RegKind};
use crate::abi::{HasDataLayout, TyAbiInterface};
use crate::abi::{Align, HasDataLayout, TyAbiInterface};
use crate::spec::HasTargetSpec;

#[derive(PartialEq)]
Expand Down Expand Up @@ -53,11 +53,38 @@ where
if arg.is_ignore() {
continue;
}
if arg.layout.is_aggregate() {
arg.make_indirect_byval();
} else {
if !arg.layout.is_aggregate() {
arg.extend_integer_width_to(32);
continue;
}

// We need to compute the alignment of the `byval` argument. The rules can be found in
// `X86_32ABIInfo::getTypeStackAlignInBytes` in Clang's `TargetInfo.cpp`. Summarized here,
// they are:
//
// 1. If the natural alignment of the type is less than or equal to 4, the alignment is 4.
//
// 2. Otherwise, on Linux, the alignment of any vector type is the natural alignment.
// (This doesn't matter here because we ensure we have an aggregate with the check above.)
//
// 3. Otherwise, on Apple platforms, the alignment of anything that contains a vector type
// is 16.
//
// 4. If none of these conditions are true, the alignment is 4.
let t = cx.target_spec();
let align_4 = Align::from_bytes(4).unwrap();
let align_16 = Align::from_bytes(16).unwrap();
let byval_align = if arg.layout.align.abi < align_4 {
align_4
} else if t.is_like_osx && arg.layout.align.abi >= align_16 {
// FIXME(pcwalton): This is dubious--we should actually be looking inside the type to
// determine if it contains SIMD vector values--but I think it's fine?
align_16
} else {
align_4
};

arg.make_indirect_byval(Some(byval_align));
}

if flavor == Flavor::FastcallOrVectorcall {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_target/src/abi/call/x86_64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ where
match cls_or_mem {
Err(Memory) => {
if is_arg {
arg.make_indirect_byval();
arg.make_indirect_byval(None);
} else {
// `sret` parameter thus one less integer register available
arg.make_indirect();
Expand Down
5 changes: 5 additions & 0 deletions src/bootstrap/Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ dependencies = [
name = "bootstrap"
version = "0.0.0"
dependencies = [
"build_helper",
"cc",
"cmake",
"fd-lock",
Expand Down Expand Up @@ -70,6 +71,10 @@ dependencies = [
"regex-automata",
]

[[package]]
name = "build_helper"
version = "0.1.0"

[[package]]
name = "cc"
version = "1.0.73"
Expand Down
1 change: 1 addition & 0 deletions src/bootstrap/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ path = "bin/sccache-plus-cl.rs"
test = false

[dependencies]
build_helper = { path = "../tools/build_helper" }
cmake = "0.1.38"
fd-lock = "3.0.8"
filetime = "0.2"
Expand Down
22 changes: 20 additions & 2 deletions src/bootstrap/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,18 +97,36 @@ impl RunConfig<'_> {
self.builder.build.build
}

/// Return a `-p=x -p=y` string suitable for passing to a cargo invocation.
/// Return a list of crate names selected by `run.paths`.
pub fn cargo_crates_in_set(&self) -> Interned<Vec<String>> {
let mut crates = Vec::new();
for krate in &self.paths {
let path = krate.assert_single_path();
let crate_name = self.builder.crate_paths[&path.path];
crates.push(format!("-p={crate_name}"));
crates.push(crate_name.to_string());
}
INTERNER.intern_list(crates)
}
}

/// A description of the crates in this set, suitable for passing to `builder.info`.
///
/// `crates` should be generated by [`RunConfig::cargo_crates_in_set`].
pub fn crate_description(crates: &[impl AsRef<str>]) -> String {
if crates.is_empty() {
return "".into();
}

let mut descr = String::from(" {");
descr.push_str(crates[0].as_ref());
for krate in &crates[1..] {
descr.push_str(", ");
descr.push_str(krate.as_ref());
}
descr.push('}');
descr
}

struct StepDescription {
default: bool,
only_hosts: bool,
Expand Down
43 changes: 14 additions & 29 deletions src/bootstrap/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,19 +99,13 @@ impl Step for Std {
cargo_subcommand(builder.kind),
);
std_cargo(builder, target, compiler.stage, &mut cargo);
cargo.args(args(builder));

builder.info(&format!(
"Checking stage{} std artifacts ({} -> {})",
"Checking stage{} library artifacts ({} -> {})",
builder.top_stage, &compiler.host, target
));
run_cargo(
builder,
cargo,
args(builder),
&libstd_stamp(builder, compiler, target),
vec![],
true,
);
run_cargo(builder, cargo, &libstd_stamp(builder, compiler, target), vec![], true);

// We skip populating the sysroot in non-zero stage because that'll lead
// to rlib/rmeta conflicts if std gets built during this session.
Expand Down Expand Up @@ -155,19 +149,13 @@ impl Step for Std {
for krate in builder.in_tree_crates("test", Some(target)) {
cargo.arg("-p").arg(krate.name);
}
cargo.args(args(builder));

builder.info(&format!(
"Checking stage{} std test/bench/example targets ({} -> {})",
"Checking stage{} library test/bench/example targets ({} -> {})",
builder.top_stage, &compiler.host, target
));
run_cargo(
builder,
cargo,
args(builder),
&libstd_test_stamp(builder, compiler, target),
vec![],
true,
);
run_cargo(builder, cargo, &libstd_test_stamp(builder, compiler, target), vec![], true);
}
}

Expand Down Expand Up @@ -231,19 +219,13 @@ impl Step for Rustc {
for krate in builder.in_tree_crates("rustc-main", Some(target)) {
cargo.arg("-p").arg(krate.name);
}
cargo.args(args(builder));

builder.info(&format!(
"Checking stage{} compiler artifacts ({} -> {})",
builder.top_stage, &compiler.host, target
));
run_cargo(
builder,
cargo,
args(builder),
&librustc_stamp(builder, compiler, target),
vec![],
true,
);
run_cargo(builder, cargo, &librustc_stamp(builder, compiler, target), vec![], true);

let libdir = builder.sysroot_libdir(compiler, target);
let hostdir = builder.sysroot_libdir(compiler, compiler.host);
Expand Down Expand Up @@ -290,6 +272,7 @@ impl Step for CodegenBackend {
.arg("--manifest-path")
.arg(builder.src.join(format!("compiler/rustc_codegen_{}/Cargo.toml", backend)));
rustc_cargo_env(builder, &mut cargo, target);
cargo.args(args(builder));

builder.info(&format!(
"Checking stage{} {} artifacts ({} -> {})",
Expand All @@ -299,7 +282,6 @@ impl Step for CodegenBackend {
run_cargo(
builder,
cargo,
args(builder),
&codegen_backend_stamp(builder, compiler, target, backend),
vec![],
true,
Expand Down Expand Up @@ -355,11 +337,13 @@ impl Step for RustAnalyzer {
cargo.arg("--benches");
}

cargo.args(args(builder));

builder.info(&format!(
"Checking stage{} {} artifacts ({} -> {})",
compiler.stage, "rust-analyzer", &compiler.host.triple, target.triple
));
run_cargo(builder, cargo, args(builder), &stamp(builder, compiler, target), vec![], true);
run_cargo(builder, cargo, &stamp(builder, compiler, target), vec![], true);

/// Cargo's output path in a given stage, compiled by a particular
/// compiler for the specified target.
Expand Down Expand Up @@ -413,6 +397,8 @@ macro_rules! tool_check_step {
cargo.arg("--all-targets");
}

cargo.args(args(builder));

// Enable internal lints for clippy and rustdoc
// NOTE: this doesn't enable lints for any other tools unless they explicitly add `#![warn(rustc::internal)]`
// See https://github.com/rust-lang/rust/pull/80573#issuecomment-754010776
Expand All @@ -428,7 +414,6 @@ macro_rules! tool_check_step {
run_cargo(
builder,
cargo,
args(builder),
&stamp(builder, compiler, target),
vec![],
true,
Expand Down
Loading