summaryrefslogtreecommitdiffstats
path: root/debian/patches/u-fix-get-toml-when-test.patch
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:47 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:47 +0000
commit9a1b5b5113f0fe12f83b7cedc2353ad41cc837b1 (patch)
tree3f4102a262698a69127c4c527a3efe30a13ac7df /debian/patches/u-fix-get-toml-when-test.patch
parentMerging upstream version 1.71.1+dfsg1. (diff)
downloadrustc-9a1b5b5113f0fe12f83b7cedc2353ad41cc837b1.tar.xz
rustc-9a1b5b5113f0fe12f83b7cedc2353ad41cc837b1.zip
Adding debian version 1.71.1+dfsg1-1.debian/1.71.1+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.patch55
1 files changed, 27 insertions, 28 deletions
diff --git a/debian/patches/u-fix-get-toml-when-test.patch b/debian/patches/u-fix-get-toml-when-test.patch
index 34789ecae..4b5bcb6d5 100644
--- a/debian/patches/u-fix-get-toml-when-test.patch
+++ b/debian/patches/u-fix-get-toml-when-test.patch
@@ -10,32 +10,27 @@ Index: rust/src/bootstrap/config.rs
===================================================================
--- rust.orig/src/bootstrap/config.rs
+++ rust/src/bootstrap/config.rs
-@@ -848,9 +848,9 @@ impl Config {
- }
+@@ -931,9 +931,32 @@ impl Config {
pub fn parse(args: &[String]) -> Config {
-- #[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()));
-@@ -859,7 +859,23 @@ impl Config {
- 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 {
+ #[cfg(test)]
+- fn get_toml(_: &Path) -> TomlConfig {
+- TomlConfig::default()
+- }
++ fn get_toml(file: &Path) -> TomlConfig {
++ // 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.
++ let contents =
++ t!(fs::read_to_string(file), format!("config file {} not found", file.display()));
++ // Deserialize to Value and then TomlConfig to prevent the Deserialize impl of
++ // TomlConfig and sub types to be monomorphized 5x by toml.
++ toml::from_str(&contents)
++ .and_then(|table: toml::Value| TomlConfig::deserialize(table))
++ .map(|table| {
+ let mut config = TomlConfig::default();
+ let mut build = Build::default();
+ let cbuild = table.build.unwrap();
@@ -43,7 +38,11 @@ Index: rust/src/bootstrap/config.rs
+ build.cargo = cbuild.cargo;
+ config.build = Some(build);
+ config
-+ },
- Err(err) => {
- eprintln!("failed to parse TOML configuration '{}': {}", file.display(), err);
- crate::detail_exit(2);
++ })
++ .unwrap_or_else(|err| {
++ eprintln!("failed to parse TOML configuration '{}': {err}", file.display());
++ crate::detail_exit(2);
++ }) }
+
+ #[cfg(not(test))]
+ fn get_toml(file: &Path) -> TomlConfig {