diff --git a/migrations/20250705120351_rename-miri-std.sql b/migrations/20250705120351_rename-miri-std.sql new file mode 100644 index 0000000..fd86c52 --- /dev/null +++ b/migrations/20250705120351_rename-miri-std.sql @@ -0,0 +1,3 @@ +UPDATE finished_nightly SET mode = 'std' WHERE mode = 'miri-std'; + +UPDATE build_info SET mode = 'std' WHERE mode = 'miri-std'; diff --git a/src/build.rs b/src/build.rs index fa626c7..8e81c91 100644 --- a/src/build.rs +++ b/src/build.rs @@ -61,7 +61,11 @@ pub async fn background_builder(db: Db) -> Result<()> { loop { if let Err(err) = background_builder_inner(&db).await { - error!("error in background builder: {err}"); + error!( + ?err, + "error in background builder, waiting for an hour before retrying: {err}" + ); + tokio::time::sleep(Duration::from_secs(3600)).await; } } } @@ -145,20 +149,7 @@ async fn install_toolchain(toolchain: &Toolchain, mode: BuildMode) -> Result<()> if !result.status.success() { bail!("rustup failed: {:?}", String::from_utf8(result.stderr)); } - if mode == BuildMode::MiriStd { - let result = Command::new("rustup") - .arg("component") - .arg("add") - .arg("miri") - .arg("--toolchain") - .arg(&toolchain.0) - .output() - .await - .wrap_err("failed to spawn rustup")?; - if !result.status.success() { - bail!("rustup failed: {:?}", String::from_utf8(result.stderr)); - } - } + Ok(()) } @@ -289,23 +280,24 @@ async fn build_target( ) -> Result { let mut rustflags = None; - let output = match mode { + let init = Command::new("cargo") + .args(["init", "--lib", "--name", "target-test"]) + .current_dir(tmpdir) + .output() + .await + .wrap_err("spawning cargo init")?; + if !init.status.success() { + bail!("init failed: {}", String::from_utf8(init.stderr)?); + } + + let librs = tmpdir.join("src").join("lib.rs"); + std::fs::write(&librs, "#![no_std]\n") + .wrap_err_with(|| format!("writing to {}", librs.display()))?; + + let mut cmd = Command::new("cargo"); + + match mode { BuildMode::Core => { - let init = Command::new("cargo") - .args(["init", "--lib", "--name", "target-test"]) - .current_dir(tmpdir) - .output() - .await - .wrap_err("spawning cargo init")?; - if !init.status.success() { - bail!("init failed: {}", String::from_utf8(init.stderr)?); - } - - let librs = tmpdir.join("src").join("lib.rs"); - std::fs::write(&librs, "#![no_std]\n") - .wrap_err_with(|| format!("writing to {}", librs.display()))?; - - let mut cmd = Command::new("cargo"); cmd.arg(format!("+{toolchain}")) .args(["build", "-Zbuild-std=core", "--release"]) .args(["--target", target]); @@ -319,23 +311,20 @@ async fn build_target( cmd.env("RUSTFLAGS", &flags); rustflags = Some(flags); } - - cmd.current_dir(tmpdir) - .output() - .await - .wrap_err("spawning cargo build")? } - BuildMode::MiriStd => Command::new("cargo") - .arg(format!("+{toolchain}")) - .args(["miri", "setup"]) - .args(["--target", target]) - .current_dir(tmpdir) - .env("MIRI_SYSROOT", tmpdir) - .output() - .await - .wrap_err("spawning cargo build")?, + BuildMode::Std => { + cmd.arg(format!("+{toolchain}")) + .args(["check", "-Zbuild-std"]) + .args(["--target", target]); + } }; + let output = cmd + .current_dir(tmpdir) + .output() + .await + .wrap_err("spawning cargo build")?; + let stderr = String::from_utf8(output.stderr).wrap_err("cargo stderr utf8")?; let status = if output.status.success() { diff --git a/src/db.rs b/src/db.rs index 4bc3b58..71f34fe 100644 --- a/src/db.rs +++ b/src/db.rs @@ -14,26 +14,25 @@ pub struct Db { pub static MIGRATOR: Migrator = sqlx::migrate!(); -#[derive(Debug, Clone, Copy, sqlx::Type, Serialize, Deserialize, PartialEq, Eq, Hash)] +#[derive(Debug, Clone, Copy, sqlx::Type, Serialize, PartialEq, Eq, Hash)] #[sqlx(rename_all = "kebab-case")] -#[serde(rename_all = "kebab-case")] pub enum BuildMode { - /// `-Zbuild-std=core` + /// `build -Zbuild-std=core` Core, - /// `cargo miri setup` - MiriStd, + /// `check -Zbuild-std` + Std, } impl Display for BuildMode { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { Self::Core => f.write_str("core"), - Self::MiriStd => f.write_str("miri-std"), + Self::Std => f.write_str("std"), } } } -#[derive(sqlx::FromRow, Serialize, Deserialize, Clone)] +#[derive(sqlx::FromRow, Serialize, Clone)] pub struct BuildInfo { pub nightly: String, pub target: String, @@ -41,7 +40,7 @@ pub struct BuildInfo { pub mode: BuildMode, } -#[derive(Clone, sqlx::FromRow, Serialize, Deserialize)] +#[derive(Clone, sqlx::FromRow, Serialize)] pub struct FullBuildInfo { pub nightly: String, pub target: String, diff --git a/src/nightlies.rs b/src/nightlies.rs index cf67977..dd925d5 100644 --- a/src/nightlies.rs +++ b/src/nightlies.rs @@ -44,7 +44,7 @@ impl Nightlies { self.all .iter() - .flat_map(|nightly| [(nightly, BuildMode::Core), (nightly, BuildMode::MiriStd)]) + .flat_map(|nightly| [(nightly, BuildMode::Core), (nightly, BuildMode::Std)]) .find(|(nightly, mode)| { !already_finished.contains(&FinishedNightly { nightly: (*nightly).to_owned(), diff --git a/src/web.rs b/src/web.rs index f52fdeb..9d2c2d2 100644 --- a/src/web.rs +++ b/src/web.rs @@ -34,11 +34,33 @@ pub async fn webserver(db: Db) -> Result<()> { axum::serve(listener, app).await.wrap_err("failed to serve") } +#[derive(Debug, Clone, Copy)] +pub struct LegacyBuildMode(BuildMode); + +impl<'de> serde::Deserialize<'de> for LegacyBuildMode { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + let s = String::deserialize(deserializer)?; + match s.as_str() { + "core" => Ok(LegacyBuildMode(BuildMode::Core)), + "std" => Ok(LegacyBuildMode(BuildMode::Std)), + // This mode used to be called "miri-std" but it has been renamed to "std" using build-std. + // Allow the old value to keep links working but map it to std. + "miri-std" => Ok(LegacyBuildMode(BuildMode::Std)), + _ => Err(serde::de::Error::custom(format!( + "invalid build mode, expected 'core', 'std', or 'miri-std'" + ))), + } + } +} + #[derive(Deserialize)] struct BuildQuery { nightly: String, target: String, - mode: Option, + mode: Option, } async fn web_build(State(state): State, Query(query): Query) -> Response { @@ -63,7 +85,7 @@ async fn web_build(State(state): State, Query(query): Query, Query(query): Query { - if core.status == Status::Error || miri.status == Status::Error { + (Some(core), Some(std)) => { + if core.status == Status::Error || std.status == Status::Error { Status::Error } else { Status::Pass @@ -150,7 +172,7 @@ async fn web_target(State(state): State, Query(query): Query v.0 = Some(build), - BuildMode::MiriStd => v.1 = Some(build), + BuildMode::Std => v.1 = Some(build), } } @@ -213,7 +235,7 @@ async fn web_nightly(State(state): State, Query(query): Query v.0 = Some(build.clone()), - BuildMode::MiriStd => v.1 = Some(build.clone()), + BuildMode::Std => v.1 = Some(build.clone()), } } @@ -223,7 +245,7 @@ async fn web_nightly(State(state): State, Query(query): Query core_failures += 1, - BuildMode::MiriStd => std_failures += 1, + BuildMode::Std => std_failures += 1, } } } @@ -244,7 +266,7 @@ async fn web_nightly(State(state): State, Query(query): Query

- std is being built with cargo miri setup. If a target does - not support std, the std column represents core/alloc. This checks that - std builds (on targets that have it) but does not check whether + std is being built with cargo check -Zbuild-std. If a target + does not support std, the std column represents core/alloc. This checks + that std checks (on targets that have it) but does not check whether codegen/linking works. + + For older builds, cargo miri setup was used instead.

{% if let Some(core_broken) = core_broken %}

diff --git a/templates/target.html b/templates/target.html index b01ccee..07b7a43 100644 --- a/templates/target.html +++ b/templates/target.html @@ -23,10 +23,12 @@ codegen/linking of core works, but does not check whether std builds.

- std is being built with cargo miri setup. If a target does - not support std, the std column represents core/alloc. This checks that - std builds (on targets that have it) but does not check whether + std is being built with cargo check -Zbuild-std. If a target + does not support std, the std column represents core/alloc. This checks + that std checks (on targets that have it) but does not check whether codegen/linking works. + + For older builds, cargo miri setup was used instead.

{% if showing_failures %}