diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:13:01 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:13:01 +0000 |
commit | 8eaa44899cb2f756d21ac152935a9cfa65ca2e7b (patch) | |
tree | 4561b181d6ffa6c8a16cf2740e43440e86d0bb22 /debian/patches/u-fix-get-toml-when-test.patch | |
parent | Merging upstream version 1.66.0+dfsg1. (diff) | |
download | rustc-8eaa44899cb2f756d21ac152935a9cfa65ca2e7b.tar.xz rustc-8eaa44899cb2f756d21ac152935a9cfa65ca2e7b.zip |
Adding debian version 1.66.0+dfsg1-1.debian/1.66.0+dfsg1-1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/patches/u-fix-get-toml-when-test.patch')
-rw-r--r-- | debian/patches/u-fix-get-toml-when-test.patch | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/debian/patches/u-fix-get-toml-when-test.patch b/debian/patches/u-fix-get-toml-when-test.patch new file mode 100644 index 000000000..229bd1432 --- /dev/null +++ b/debian/patches/u-fix-get-toml-when-test.patch @@ -0,0 +1,46 @@ +Description: Fix get_toml() when cfg(test) + When cfg(test), Config::parse doesn't parse a config.toml but uses default + values, failing when the initial rustc is needed. This is a workaround before + upstream issue gets solved. +Bug: https://github.com/rust-lang/rust/issues/105766 +Last-Update: 2023-03-29 +--- +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ +--- a/src/bootstrap/config.rs ++++ b/src/bootstrap/config.rs +@@ -896,9 +896,9 @@ + + config.stage0_metadata = t!(serde_json::from_slice::<Stage0Metadata>(&stage0_json)); + +- #[cfg(test)] ++ /*#[cfg(test)] + let get_toml = |_| TomlConfig::default(); +- #[cfg(not(test))] ++ #[cfg(not(test))]*/ + let get_toml = |file: &Path| { + let contents = + t!(fs::read_to_string(file), format!("config file {} not found", file.display())); +@@ -907,7 +907,22 @@ + match toml::from_str(&contents) + .and_then(|table: toml::Value| TomlConfig::deserialize(table)) + { +- Ok(table) => table, ++ /// Debian: We use previous version as a custom rustc, which unfortunately won't be ++ /// picked up because config.toml isn't read when cfg!(test). Making tests use the ++ /// entirety of our config.toml isn't feasible either as it panicks on GitRepo::Llvm ++ /// (d-bootstrap-custom-debuginfo-path.patch), so only give paths of initial rustc ++ /// and cargo. ++ Ok(table) => if !cfg!(test) || table.build.is_none() { ++ table ++ } else { ++ let mut config = TomlConfig::default(); ++ let mut build = Build::default(); ++ let cbuild = table.build.unwrap(); ++ build.rustc = cbuild.rustc; ++ build.cargo = cbuild.cargo; ++ config.build = Some(build); ++ config ++ }, + Err(err) => { + eprintln!("failed to parse TOML configuration '{}': {}", file.display(), err); + crate::detail_exit(2); |