Skip to content

Rollup of 10 pull requests #142795

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

Merged
merged 54 commits into from
Jun 20, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
9aa572d
use consistent title capitalization
tshepang May 22, 2025
a4c8ef9
Adjust some doc for Query System
xizheyin Jun 13, 2025
94d56d1
Merge pull request #2441 from rust-lang/tshepang-remove-title-case
tshepang Jun 14, 2025
9265493
Merge pull request #2465 from xizheyin/rustc-query
tshepang Jun 14, 2025
a70deb6
content has moved to another chapter
tshepang Jun 14, 2025
9926215
Merge pull request #2466 from rust-lang/tshepang-moved
tshepang Jun 14, 2025
0834e48
use sentence case
tshepang Jun 14, 2025
a3f261c
Merge pull request #2467 from rust-lang/tshepang-patch-1
tshepang Jun 14, 2025
820e88a
title case
tshepang Jun 14, 2025
21a1e51
do not inline links
tshepang Jun 14, 2025
d16e1a1
Merge pull request #2468 from rust-lang/query-cleaning
tshepang Jun 14, 2025
808d16c
Use stage 1 for building docs
Darksonn Jun 16, 2025
3edb332
Merge pull request #2471 from Darksonn/patch-1
Noratrieb Jun 16, 2025
1dbf86a
Remove hanging parenthesis from example signature.
cbloodsworth Jun 16, 2025
02334e1
Merge pull request #2472 from cbloodsworth/fix/tytable_parens
BoxyUwU Jun 16, 2025
8bc55da
Profiling with perf: specify the section of bootstrap settings.
lolbinarycat Jun 17, 2025
671817f
Merge pull request #2475 from lolbinarycat/patch-3
Noratrieb Jun 17, 2025
d96b2d4
Stub chapter and consolidate under `/hir/`
BoxyUwU Jun 6, 2025
42888bb
Write chapter on Unambig vs Ambig Types/Consts
BoxyUwU Jun 17, 2025
c1506c0
Add links
BoxyUwU Jun 17, 2025
39e9800
Reviews
BoxyUwU Jun 18, 2025
6c7830e
Merge pull request #2474 from BoxyUwU/ambig_unambig_ty_consts
BoxyUwU Jun 18, 2025
4145596
fix markup
tshepang Jun 18, 2025
79652d9
Merge pull request #2476 from rust-lang/tshepang-patch-1
tshepang Jun 18, 2025
0a185e4
initial instructions for gpu offload
ZuseZ4 Jun 2, 2025
f25cfe8
Merge pull request #2447 from rust-lang/offload-docs
ZuseZ4 Jun 19, 2025
48b36ee
Preparing for merge from rustc
invalid-email-address Jun 19, 2025
d854d56
Merge from rustc
invalid-email-address Jun 19, 2025
8c28161
Add `get_host_target` function
Kobzol Jun 17, 2025
21d21d5
Normalize host target in snapshot tests
Kobzol Jun 17, 2025
718e475
Clarify arrow in snapshot tests
Kobzol Jun 18, 2025
eefd598
correct template for `#[align]`
folkertdev Jun 19, 2025
aca0688
De-dup common code from `ExternalCrate` methods
yotamofek Jun 19, 2025
6ad42bf
Merge pull request #2477 from rust-lang/rustc-pull
tshepang Jun 19, 2025
dfaa622
add issue template for rustdoc
lolbinarycat Jun 19, 2025
240dc05
Add a mailmap entry for y21
tgross35 Jun 19, 2025
fca6e81
Make sure to rebuild rustdoc if `src/rustdoc-json-types` is changed
jieyouxu Jun 19, 2025
42b0201
Fix `tests/ui/asm/naked-invalid-attr.stderr`.
nnethercote May 27, 2025
4a1f445
Use a symbol for `ExpansionConfig::crate_name`.
nnethercote May 29, 2025
1edf201
Avoid some unnecessary symbol interning.
nnethercote May 29, 2025
b95d39d
Remove an unnecessary check in rustfmt.
nnethercote May 27, 2025
75bcc9c
remove equivalent new method on context
jdonszelmann Jun 19, 2025
d475e10
Add temporary directory for executing snapshot tests
Kobzol Jun 20, 2025
88f1ed4
Convert `ilog(10)` to `ilog10()`
ChaiTRex Jun 20, 2025
7f9c3a3
Rollup merge of #142629 - Kobzol:bootstrap-tests-builder, r=jieyouxu
Kobzol Jun 20, 2025
065a5fb
Rollup merge of #142715 - folkertdev:fn-align-corrections, r=jdonszel…
Kobzol Jun 20, 2025
6c58f69
Rollup merge of #142720 - yotamofek:pr/rustdoc/ext-crate-cleanup, r=G…
Kobzol Jun 20, 2025
abe7991
Rollup merge of #142736 - lolbinarycat:rustdoc-issue-template, r=Guil…
Kobzol Jun 20, 2025
829aaf8
Rollup merge of #142743 - tshepang:rdg-push, r=jieyouxu
Kobzol Jun 20, 2025
f2c4854
Rollup merge of #142744 - tgross35:y21-mailmap, r=y21
Kobzol Jun 20, 2025
64a7fcf
Rollup merge of #142758 - jieyouxu:rustdoc-json-types, r=Kobzol
Kobzol Jun 20, 2025
74cea63
Rollup merge of #142764 - ChaiTRex:ilog_10_to_ilog10, r=workingjubilee
Kobzol Jun 20, 2025
31663db
Rollup merge of #142767 - nnethercote:symbol-cleanups, r=petrochenkov
Kobzol Jun 20, 2025
e7cc4ec
Rollup merge of #142769 - jdonszelmann:remove-useless-new-method, r=t…
Kobzol Jun 20, 2025
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
Prev Previous commit
Next Next commit
Normalize host target in snapshot tests
  • Loading branch information
Kobzol committed Jun 19, 2025
commit 21d21d5f81d6d0ac7e58275e40e982550951ec86
48 changes: 31 additions & 17 deletions src/bootstrap/src/core/builder/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use crate::Flags;
use crate::core::build_steps::doc::DocumentationFormat;
use crate::core::config::Config;
use crate::utils::cache::ExecutedStep;
use crate::utils::helpers::get_host_target;
use crate::utils::tests::git::{GitCtx, git_test};

static TEST_TRIPLE_1: &str = "i686-unknown-haiku";
Expand Down Expand Up @@ -1236,24 +1237,38 @@ fn any_debug() {
/// The staging tests use insta for snapshot testing.
/// See bootstrap's README on how to bless the snapshots.
mod staging {
use crate::Build;
use crate::core::builder::Builder;
use crate::core::builder::tests::{
TEST_TRIPLE_1, configure, configure_with_args, render_steps, run_build,
};
use crate::utils::tests::ConfigBuilder;

#[test]
fn build_compiler_stage_1() {
let mut cache = run_build(
&["compiler".into()],
configure_with_args(&["build", "--stage", "1"], &[TEST_TRIPLE_1], &[TEST_TRIPLE_1]),
);
let steps = cache.into_executed_steps();
insta::assert_snapshot!(render_steps(&steps), @r"
[build] rustc 0 <target1> -> std 0 <target1>
[build] llvm <target1>
[build] rustc 0 <target1> -> rustc 1 <target1>
[build] rustc 0 <target1> -> rustc 1 <target1>
insta::assert_snapshot!(
ConfigBuilder::build()
.path("compiler")
.stage(1)
.get_steps(), @r"
[build] rustc 0 <host> -> std 0 <host>
[build] llvm <host>
[build] rustc 0 <host> -> rustc 1 <host>
[build] rustc 0 <host> -> rustc 1 <host>
");
}

impl ConfigBuilder {
fn get_steps(self) -> String {
let config = self.create_config();

let kind = config.cmd.kind();
let build = Build::new(config);
let builder = Builder::new(&build);
builder.run_step_descriptions(&Builder::get_step_descriptions(kind), &builder.paths);
render_steps(&builder.cache.into_executed_steps())
}
}
}

/// Renders the executed bootstrap steps for usage in snapshot tests with insta.
Expand All @@ -1275,18 +1290,17 @@ fn render_steps(steps: &[ExecutedStep]) -> String {
}
let stage =
if let Some(stage) = metadata.stage { format!("{stage} ") } else { "".to_string() };
write!(record, "{} {stage}<{}>", metadata.name, metadata.target);
write!(record, "{} {stage}<{}>", metadata.name, normalize_target(metadata.target));
Some(record)
})
.map(|line| {
line.replace(TEST_TRIPLE_1, "target1")
.replace(TEST_TRIPLE_2, "target2")
.replace(TEST_TRIPLE_3, "target3")
})
.collect::<Vec<_>>()
.join("\n")
}

fn normalize_target(target: TargetSelection) -> String {
target.to_string().replace(&get_host_target().to_string(), "host")
}

fn render_compiler(compiler: Compiler) -> String {
format!("rustc {} <{}>", compiler.stage, compiler.host)
format!("rustc {} <{}>", compiler.stage, normalize_target(compiler.host))
}
43 changes: 43 additions & 0 deletions src/bootstrap/src/utils/tests/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,46 @@
//! This module contains shared utilities for bootstrap tests.

use crate::core::builder::Builder;
use crate::core::config::DryRun;
use crate::{Build, Config, Flags};

pub mod git;

/// Used to configure an invocation of bootstrap.
/// Currently runs in the rustc checkout, long-term it should be switched
/// to run in a (cache-primed) temporary directory instead.
pub struct ConfigBuilder {
args: Vec<String>,
}

impl ConfigBuilder {
pub fn from_args(args: &[&str]) -> Self {
Self::new(args)
}

pub fn build() -> Self {
Self::new(&["build"])
}

pub fn path(mut self, path: &str) -> Self {
self.args.push(path.to_string());
self
}

pub fn stage(mut self, stage: u32) -> Self {
self.args.push("--stage".to_string());
self.args.push(stage.to_string());
self
}

fn new(args: &[&str]) -> Self {
Self { args: args.iter().copied().map(String::from).collect() }
}

pub fn create_config(mut self) -> Config {
let mut config = Config::parse(Flags::parse(&self.args));
// Run in dry-check, otherwise the test would be too slow
config.set_dry_run(DryRun::SelfCheck);
config
}
}