-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Add compiler-builtins
to bootstrap
#142106
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -2731,6 +2731,68 @@ impl Step for Crate { | |||||||
} | ||||||||
} | ||||||||
|
||||||||
/// Test compiler-builtins via its testcrate. | ||||||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||||||||
pub struct CompilerBuiltins { | ||||||||
compiler: Compiler, | ||||||||
target: TargetSelection, | ||||||||
mode: Mode, | ||||||||
} | ||||||||
|
||||||||
impl Step for CompilerBuiltins { | ||||||||
type Output = (); | ||||||||
const DEFAULT: bool = true; | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This actually makes it run on CI :) |
||||||||
|
||||||||
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { | ||||||||
run.paths(&["library/compiler-builtins", "library/compiler-builtins/compiler-builtins"]) | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Should be enough, I think. |
||||||||
} | ||||||||
|
||||||||
fn make_run(run: RunConfig<'_>) { | ||||||||
let builder = run.builder; | ||||||||
let host = run.build_triple(); | ||||||||
let compiler = builder.compiler_for(builder.top_stage, host, host); | ||||||||
|
||||||||
builder.ensure(CompilerBuiltins { compiler, target: run.target, mode: Mode::Std }); | ||||||||
} | ||||||||
|
||||||||
fn run(self, builder: &Builder<'_>) -> Self::Output { | ||||||||
let compiler = self.compiler; | ||||||||
let target = self.target; | ||||||||
let mode = self.mode; | ||||||||
|
||||||||
builder.ensure(compile::Std::new(compiler, compiler.host).force_recompile(true)); | ||||||||
let compiler = builder.compiler_for(compiler.stage, compiler.host, target); | ||||||||
|
||||||||
// Also prepare a sysroot for the target. | ||||||||
if !builder.config.is_host_target(target) { | ||||||||
builder.ensure(compile::Std::new(compiler, target).force_recompile(true)); | ||||||||
builder.ensure(RemoteCopyLibs { compiler, target }); | ||||||||
} | ||||||||
|
||||||||
let make_cargo = |f: fn(&mut builder::Cargo) -> &mut builder::Cargo| { | ||||||||
let mut c = builder::Cargo::new( | ||||||||
builder, | ||||||||
compiler, | ||||||||
mode, | ||||||||
SourceType::InTree, | ||||||||
target, | ||||||||
Kind::Test, | ||||||||
); | ||||||||
f(&mut c); | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
c | ||||||||
}; | ||||||||
|
||||||||
// Most tests are in the builtins-test crate. | ||||||||
let crates = ["compiler-builtins".to_string(), "builtins-test".to_string()]; | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
let cargo = make_cargo(|c| c); | ||||||||
run_cargo_test(cargo, &[], &crates, "compiler-buitlins", target, builder); | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
:) Also below. |
||||||||
let cargo = make_cargo(|c| c.arg("--release")); | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need another variation for |
||||||||
run_cargo_test(cargo, &[], &crates, "compiler-buitlins --release", target, builder); | ||||||||
let cargo = make_cargo(|c| c.arg("--features=c")); | ||||||||
run_cargo_test(cargo, &[], &crates, "compiler-buitlins --features c", target, builder); | ||||||||
} | ||||||||
} | ||||||||
|
||||||||
/// Rustdoc is special in various ways, which is why this step is different from `Crate`. | ||||||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||||||||
pub struct CrateRustdoc { | ||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The builtins only make sense for
Mode::Std
, I think? So we don't need to parametrize this and the step can just hardcode it.