diff --git a/library/core/src/num/uint_macros.rs b/library/core/src/num/uint_macros.rs index f186b468e64cb..93f65c5c7aaf3 100644 --- a/library/core/src/num/uint_macros.rs +++ b/library/core/src/num/uint_macros.rs @@ -1469,37 +1469,42 @@ macro_rules! uint_impl { (a as Self, b) } - /// Calculates `self + rhs + carry` without the ability to overflow. + /// Calculates `self` + `rhs` + `carry` and returns a tuple containing + /// the sum and the output carry. /// - /// Performs "ternary addition" which takes in an extra bit to add, and may return an - /// additional bit of overflow. This allows for chaining together multiple additions - /// to create "big integers" which represent larger values. + /// Performs "ternary addition" of two integer operands and a carry-in + /// bit, and returns an output integer and a carry-out bit. This allows + /// chaining together multiple additions to create a wider addition, and + /// can be useful for bignum addition. /// #[doc = concat!("This can be thought of as a ", stringify!($BITS), "-bit \"full adder\", in the electronics sense.")] /// - /// # Examples + /// If the input carry is false, this method is equivalent to + /// [`overflowing_add`](Self::overflowing_add), and the output carry is + /// equal to the overflow flag. Note that although carry and overflow + /// flags are similar for unsigned integers, they are different for + /// signed integers. /// - /// Basic usage + /// # Examples /// /// ``` /// #![feature(bigint_helper_methods)] - #[doc = concat!("assert_eq!(5", stringify!($SelfT), ".carrying_add(2, false), (7, false));")] - #[doc = concat!("assert_eq!(5", stringify!($SelfT), ".carrying_add(2, true), (8, false));")] - #[doc = concat!("assert_eq!(", stringify!($SelfT), "::MAX.carrying_add(1, false), (0, true));")] - #[doc = concat!("assert_eq!(", stringify!($SelfT), "::MAX.carrying_add(0, true), (0, true));")] - #[doc = concat!("assert_eq!(", stringify!($SelfT), "::MAX.carrying_add(1, true), (1, true));")] - #[doc = concat!("assert_eq!(", - stringify!($SelfT), "::MAX.carrying_add(", stringify!($SelfT), "::MAX, true), ", - "(", stringify!($SelfT), "::MAX, true));" - )] - /// ``` /// - /// If `carry` is false, this method is equivalent to [`overflowing_add`](Self::overflowing_add): + #[doc = concat!("// 3 MAX (a = 3 × 2^", stringify!($BITS), " + 2^", stringify!($BITS), " - 1)")] + #[doc = concat!("// + 5 7 (b = 5 × 2^", stringify!($BITS), " + 7)")] + /// // --------- + #[doc = concat!("// 9 6 (sum = 9 × 2^", stringify!($BITS), " + 6)")] /// - /// ``` - /// #![feature(bigint_helper_methods)] - #[doc = concat!("assert_eq!(5_", stringify!($SelfT), ".carrying_add(2, false), 5_", stringify!($SelfT), ".overflowing_add(2));")] - #[doc = concat!("assert_eq!(", stringify!($SelfT), "::MAX.carrying_add(1, false), ", stringify!($SelfT), "::MAX.overflowing_add(1));")] + #[doc = concat!("let (a1, a0): (", stringify!($SelfT), ", ", stringify!($SelfT), ") = (3, ", stringify!($SelfT), "::MAX);")] + #[doc = concat!("let (b1, b0): (", stringify!($SelfT), ", ", stringify!($SelfT), ") = (5, 7);")] + /// let carry0 = false; + /// + /// let (sum0, carry1) = a0.carrying_add(b0, carry0); + /// assert_eq!(carry1, true); + /// let (sum1, carry2) = a1.carrying_add(b1, carry1); + /// assert_eq!(carry2, false); + /// + /// assert_eq!((sum1, sum0), (9, 6)); /// ``` #[unstable(feature = "bigint_helper_methods", issue = "85532")] #[rustc_const_unstable(feature = "const_bigint_helper_methods", issue = "85532")] @@ -1563,22 +1568,35 @@ macro_rules! uint_impl { (a as Self, b) } - /// Calculates `self - rhs - borrow` without the ability to overflow. + /// Calculates `self` − `rhs` − `borrow` and returns a tuple + /// containing the difference and the output borrow. /// - /// Performs "ternary subtraction" which takes in an extra bit to subtract, and may return - /// an additional bit of overflow. This allows for chaining together multiple subtractions - /// to create "big integers" which represent larger values. + /// Performs "ternary subtraction" by subtracting both an integer + /// operand and a borrow-in bit from `self`, and returns an output + /// integer and a borrow-out bit. This allows chaining together multiple + /// subtractions to create a wider subtraction, and can be useful for + /// bignum subtraction. /// /// # Examples /// - /// Basic usage - /// /// ``` /// #![feature(bigint_helper_methods)] - #[doc = concat!("assert_eq!(5", stringify!($SelfT), ".borrowing_sub(2, false), (3, false));")] - #[doc = concat!("assert_eq!(5", stringify!($SelfT), ".borrowing_sub(2, true), (2, false));")] - #[doc = concat!("assert_eq!(0", stringify!($SelfT), ".borrowing_sub(1, false), (", stringify!($SelfT), "::MAX, true));")] - #[doc = concat!("assert_eq!(0", stringify!($SelfT), ".borrowing_sub(1, true), (", stringify!($SelfT), "::MAX - 1, true));")] + /// + #[doc = concat!("// 9 6 (a = 9 × 2^", stringify!($BITS), " + 6)")] + #[doc = concat!("// - 5 7 (b = 5 × 2^", stringify!($BITS), " + 7)")] + /// // --------- + #[doc = concat!("// 3 MAX (diff = 3 × 2^", stringify!($BITS), " + 2^", stringify!($BITS), " - 1)")] + /// + #[doc = concat!("let (a1, a0): (", stringify!($SelfT), ", ", stringify!($SelfT), ") = (9, 6);")] + #[doc = concat!("let (b1, b0): (", stringify!($SelfT), ", ", stringify!($SelfT), ") = (5, 7);")] + /// let borrow0 = false; + /// + /// let (diff0, borrow1) = a0.borrowing_sub(b0, borrow0); + /// assert_eq!(borrow1, true); + /// let (diff1, borrow2) = a1.borrowing_sub(b1, borrow1); + /// assert_eq!(borrow2, false); + /// + #[doc = concat!("assert_eq!((diff1, diff0), (3, ", stringify!($SelfT), "::MAX));")] /// ``` #[unstable(feature = "bigint_helper_methods", issue = "85532")] #[rustc_const_unstable(feature = "const_bigint_helper_methods", issue = "85532")] diff --git a/library/core/src/slice/mod.rs b/library/core/src/slice/mod.rs index 56133f346ae9e..5f1a05706f205 100644 --- a/library/core/src/slice/mod.rs +++ b/library/core/src/slice/mod.rs @@ -2359,6 +2359,28 @@ impl [T] { /// assert!(match r { Ok(1..=4) => true, _ => false, }); /// ``` /// + /// If you want to find that whole *range* of matching items, rather than + /// an arbitrary matching one, that can be done using [`partition_point`]: + /// ``` + /// let s = [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55]; + /// + /// let low = s.partition_point(|x| x < &1); + /// assert_eq!(low, 1); + /// let high = s.partition_point(|x| x <= &1); + /// assert_eq!(high, 5); + /// let r = s.binary_search(&1); + /// assert!((low..high).contains(&r.unwrap())); + /// + /// assert!(s[..low].iter().all(|&x| x < 1)); + /// assert!(s[low..high].iter().all(|&x| x == 1)); + /// assert!(s[high..].iter().all(|&x| x > 1)); + /// + /// // For something not found, the "range" of equal items is empty + /// assert_eq!(s.partition_point(|x| x < &11), 9); + /// assert_eq!(s.partition_point(|x| x <= &11), 9); + /// assert_eq!(s.binary_search(&11), Err(9)); + /// ``` + /// /// If you want to insert an item to a sorted vector, while maintaining /// sort order, consider using [`partition_point`]: /// @@ -3787,6 +3809,16 @@ impl [T] { /// assert!(v[i..].iter().all(|&x| !(x < 5))); /// ``` /// + /// If all elements of the slice match the predicate, including if the slice + /// is empty, then the length of the slice will be returned: + /// + /// ``` + /// let a = [2, 4, 8]; + /// assert_eq!(a.partition_point(|x| x < &100), a.len()); + /// let a: [i32; 0] = []; + /// assert_eq!(a.partition_point(|x| x < &100), 0); + /// ``` + /// /// If you want to insert an item to a sorted vector, while maintaining /// sort order: /// diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index 5788363036acd..7b6f52b0acf69 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -437,6 +437,7 @@ img { .source-sidebar-expanded .source .sidebar { overflow-y: auto; + width: 300px; } .source-sidebar-expanded .source .sidebar > *:not(#sidebar-toggle) { @@ -1692,31 +1693,20 @@ details.rustdoc-toggle[open] > summary.hideme::after { display: inline-block; } -/* Media Queries */ - -/* -WARNING: RUSTDOC_MOBILE_BREAKPOINT MEDIA QUERY; -If you update this line, then you also need to update the line with the same warning -in storage.js plus the media query with (max-width: 700px) -*/ -@media (min-width: 701px) { - /* In case there is no documentation before a code block, we need to add some margin at the top - to prevent an overlay between the "collapse toggle" and the information tooltip. - However, it's not needed with smaller screen width because the doc/code block is always put - "one line" below. */ - .docblock > .example-wrap:first-child .tooltip { - margin-top: 16px; - } - - .source-sidebar-expanded .source .sidebar { - width: 300px; - } +/* In case there is no documentation before a code block, we need to add some margin at the top +to prevent an overlay between the "collapse toggle" and the information tooltip. +However, it's not needed with smaller screen width because the doc/code block is always put +"one line" below. */ +.docblock > .example-wrap:first-child .tooltip { + margin-top: 16px; } +/* Media Queries */ + /* WARNING: RUSTDOC_MOBILE_BREAKPOINT MEDIA QUERY If you update this line, then you also need to update the line with the same warning -in storage.js plus the media query with (min-width: 701px) +in storage.js */ @media (max-width: 700px) { /* When linking to an item with an `id` (for instance, by clicking a link in the sidebar, diff --git a/src/librustdoc/html/static/js/main.js b/src/librustdoc/html/static/js/main.js index 3bcadcda534dc..1251d6bfda352 100644 --- a/src/librustdoc/html/static/js/main.js +++ b/src/librustdoc/html/static/js/main.js @@ -737,7 +737,7 @@ function loadCss(cssFileName) { window.rustdocMobileScrollLock = function() { const mobile_topbar = document.querySelector(".mobile-topbar"); - if (window.innerWidth < window.RUSTDOC_MOBILE_BREAKPOINT) { + if (window.innerWidth <= window.RUSTDOC_MOBILE_BREAKPOINT) { // This is to keep the scroll position on mobile. oldSidebarScrollPosition = window.scrollY; document.body.style.width = `${document.body.offsetWidth}px`; @@ -783,7 +783,7 @@ function loadCss(cssFileName) { } window.addEventListener("resize", () => { - if (window.innerWidth >= window.RUSTDOC_MOBILE_BREAKPOINT && + if (window.innerWidth > window.RUSTDOC_MOBILE_BREAKPOINT && oldSidebarScrollPosition !== null) { // If the user opens the sidebar in "mobile" mode, and then grows the browser window, // we need to switch away from mobile mode and make the main content area scrollable. diff --git a/src/librustdoc/html/static/js/storage.js b/src/librustdoc/html/static/js/storage.js index 0c5389d45e5b7..b462a2c50f145 100644 --- a/src/librustdoc/html/static/js/storage.js +++ b/src/librustdoc/html/static/js/storage.js @@ -10,9 +10,9 @@ window.currentTheme = document.getElementById("themeStyle"); window.mainTheme = document.getElementById("mainThemeStyle"); // WARNING: RUSTDOC_MOBILE_BREAKPOINT MEDIA QUERY -// If you update this line, then you also need to update the two media queries with the same +// If you update this line, then you also need to update the media query with the same // warning in rustdoc.css -window.RUSTDOC_MOBILE_BREAKPOINT = 701; +window.RUSTDOC_MOBILE_BREAKPOINT = 700; const settingsDataset = (function() { const settingsElement = document.getElementById("default-settings"); diff --git a/src/test/rustdoc-gui/code-color.goml b/src/test/rustdoc-gui/code-color.goml index 4136677cdd547..118f04ad6dcba 100644 --- a/src/test/rustdoc-gui/code-color.goml +++ b/src/test/rustdoc-gui/code-color.goml @@ -5,26 +5,20 @@ goto: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html" // If the text isn't displayed, the browser doesn't compute color style correctly... show-text: true -// Set the theme to dark. -local-storage: {"rustdoc-theme": "dark", "rustdoc-preferred-dark-theme": "dark", "rustdoc-use-system-theme": "false"} -// We reload the page so the local storage settings are being used. -reload: -assert-css: (".docblock pre > code", {"color": "rgb(221, 221, 221)"}, ALL) -assert-css: (".docblock > p > code", {"color": "rgb(221, 221, 221)"}, ALL) +define-function: ( + "check-colors", + (theme, doc_code_color, doc_inline_code_color), + [ + // Set the theme. + ("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}), + // We reload the page so the local storage settings are being used. + ("reload"), + ("assert-css", (".docblock pre > code", {"color": |doc_code_color|}, ALL)), + ("assert-css", (".docblock > p > code", {"color": |doc_inline_code_color|}, ALL)), + ], +) -// Set the theme to ayu. -local-storage: {"rustdoc-theme": "ayu", "rustdoc-preferred-dark-theme": "ayu", "rustdoc-use-system-theme": "false"} -// We reload the page so the local storage settings are being used. -reload: - -assert-css: (".docblock pre > code", {"color": "rgb(230, 225, 207)"}, ALL) -assert-css: (".docblock > p > code", {"color": "rgb(255, 180, 84)"}, ALL) - -// Set the theme to light. -local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"} -// We reload the page so the local storage settings are being used. -reload: - -assert-css: (".docblock pre > code", {"color": "rgb(0, 0, 0)"}, ALL) -assert-css: (".docblock > p > code", {"color": "rgb(0, 0, 0)"}, ALL) +call-function: ("check-colors", ("ayu", "rgb(230, 225, 207)", "rgb(255, 180, 84)")) +call-function: ("check-colors", ("dark", "rgb(221, 221, 221)", "rgb(221, 221, 221)")) +call-function: ("check-colors", ("light", "rgb(0, 0, 0)", "rgb(0, 0, 0)")) diff --git a/src/test/rustdoc-gui/headers-color.goml b/src/test/rustdoc-gui/headers-color.goml index 9b7e3a2311263..c80a49c52f03a 100644 --- a/src/test/rustdoc-gui/headers-color.goml +++ b/src/test/rustdoc-gui/headers-color.goml @@ -1,117 +1,70 @@ // This test check for headers text and background colors for the different themes. -goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html" -// This is needed so that the text color is computed. -show-text: true - -// Ayu theme -local-storage: { - "rustdoc-theme": "ayu", - "rustdoc-preferred-dark-theme": "ayu", - "rustdoc-use-system-theme": "false", -} -reload: - -assert-css: ( - ".impl", - {"color": "rgb(197, 197, 197)", "background-color": "rgba(0, 0, 0, 0)"}, - ALL, -) -assert-css: ( - ".impl .code-header", - {"color": "rgb(230, 225, 207)", "background-color": "rgba(0, 0, 0, 0)"}, - ALL, +define-function: ( + "check-colors", + (theme, color, code_header_color, focus_background_color, headings_color), + [ + ("goto", "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"), + // This is needed so that the text color is computed. + ("show-text", true), + ("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}), + ("reload"), + ("assert-css", ( + ".impl", + {"color": |color|, "background-color": "rgba(0, 0, 0, 0)"}, + ALL, + )), + ("assert-css", ( + ".impl .code-header", + {"color": |code_header_color|, "background-color": "rgba(0, 0, 0, 0)"}, + ALL, + )), + ("goto", "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html#impl-Foo"), + ("assert-css", ( + "#impl-Foo", + {"color": |color|, "background-color": |focus_background_color|}, + )), + ("goto", "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html#method.must_use"), + ("assert-css", ( + "#method\.must_use", + {"color": |color|, "background-color": |focus_background_color|}, + ALL, + )), + ("goto", "file://" + |DOC_PATH| + "/test_docs/index.html"), + ("assert-css", (".small-section-header a", {"color": |color|}, ALL)), + ("goto", "file://" + |DOC_PATH| + "/test_docs/struct.HeavilyDocumentedStruct.html"), + // We select headings (h2, h3, h...). + ("assert-css", (".docblock > :not(p) > a", {"color": |headings_color|}, ALL)), + ], ) -goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html#impl-Foo" -assert-css: ( - "#impl-Foo", - {"color": "rgb(197, 197, 197)", "background-color": "rgba(255, 236, 164, 0.06)"}, +call-function: ( + "check-colors", + { + "theme": "ayu", + "color": "rgb(197, 197, 197)", + "code_header_color": "rgb(230, 225, 207)", + "focus_background_color": "rgba(255, 236, 164, 0.06)", + "headings_color": "rgb(57, 175, 215)", + }, ) - -goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html#method.must_use" -assert-css: ( - "#method\.must_use", - {"color": "rgb(197, 197, 197)", "background-color": "rgba(255, 236, 164, 0.06)"}, - ALL, +call-function: ( + "check-colors", + { + "theme": "dark", + "color": "rgb(221, 221, 221)", + "code_header_color": "rgb(221, 221, 221)", + "focus_background_color": "rgb(73, 74, 61)", + "headings_color": "rgb(210, 153, 29)", + }, ) - -goto: "file://" + |DOC_PATH| + "/test_docs/index.html" -assert-css: (".small-section-header a", {"color": "rgb(197, 197, 197)"}, ALL) - -goto: "file://" + |DOC_PATH| + "/test_docs/struct.HeavilyDocumentedStruct.html" -// We select headings (h2, h3, h...). -assert-css: (".docblock > :not(p) > a", {"color": "rgb(57, 175, 215)"}, ALL) - -// Dark theme -local-storage: { - "rustdoc-theme": "dark", - "rustdoc-preferred-dark-theme": "dark", - "rustdoc-use-system-theme": "false", -} -goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html" - -assert-css: ( - ".impl", - {"color": "rgb(221, 221, 221)", "background-color": "rgba(0, 0, 0, 0)"}, - ALL, -) -assert-css: ( - ".impl .code-header", - {"color": "rgb(221, 221, 221)", "background-color": "rgba(0, 0, 0, 0)"}, - ALL, -) - -goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html#impl-Foo" -assert-css: ( - "#impl-Foo", - {"color": "rgb(221, 221, 221)", "background-color": "rgb(73, 74, 61)"}, -) - -goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html#method.must_use" -assert-css: ( - "#method\.must_use", - {"color": "rgb(221, 221, 221)", "background-color": "rgb(73, 74, 61)"}, - ALL, +call-function: ( + "check-colors", + { + "theme": "light", + "color": "rgb(0, 0, 0)", + "code_header_color": "rgb(0, 0, 0)", + "focus_background_color": "rgb(253, 255, 211)", + "headings_color": "rgb(56, 115, 173)", + }, ) - -goto: "file://" + |DOC_PATH| + "/test_docs/index.html" -assert-css: (".small-section-header a", {"color": "rgb(221, 221, 221)"}, ALL) - -goto: "file://" + |DOC_PATH| + "/test_docs/struct.HeavilyDocumentedStruct.html" -// We select headings (h2, h3, h...). -assert-css: (".docblock > :not(p) > a", {"color": "rgb(210, 153, 29)"}, ALL) - -// Light theme -local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"} -reload: - -goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html" - -assert-css: ( - ".impl", - {"color": "rgb(0, 0, 0)", "background-color": "rgba(0, 0, 0, 0)"}, - ALL, -) -assert-css: ( - ".impl .code-header", - {"color": "rgb(0, 0, 0)", "background-color": "rgba(0, 0, 0, 0)"}, - ALL, -) - -goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html#impl-Foo" -assert-css: ("#impl-Foo", {"color": "rgb(0, 0, 0)", "background-color": "rgb(253, 255, 211)"}) - -goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html#method.must_use" -assert-css: ( - "#method\.must_use", - {"color": "rgb(0, 0, 0)", "background-color": "rgb(253, 255, 211)"}, - ALL, -) - -goto: "file://" + |DOC_PATH| + "/test_docs/index.html" -assert-css: (".small-section-header a", {"color": "rgb(0, 0, 0)"}, ALL) - -goto: "file://" + |DOC_PATH| + "/test_docs/struct.HeavilyDocumentedStruct.html" -// We select headings (h2, h3, h...). -assert-css: (".docblock > :not(p) > a", {"color": "rgb(56, 115, 173)"}, ALL) diff --git a/src/test/rustdoc-gui/sidebar-mobile-scroll.goml b/src/test/rustdoc-gui/sidebar-mobile-scroll.goml index f1cba172ee358..2449269b192aa 100644 --- a/src/test/rustdoc-gui/sidebar-mobile-scroll.goml +++ b/src/test/rustdoc-gui/sidebar-mobile-scroll.goml @@ -1,12 +1,12 @@ // This test ensures that the mobile sidebar preserves scroll position. goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html" // Switching to "mobile view" by reducing the width to 600px. -size: (600, 600) +size: (700, 600) assert-css: (".sidebar", {"display": "block", "left": "-1000px"}) // Scroll down. scroll-to: "//h2[@id='blanket-implementations']" -assert-window-property: {"pageYOffset": "651"} +assert-window-property: {"pageYOffset": "627"} // Open the sidebar menu. click: ".sidebar-menu-toggle" @@ -21,11 +21,11 @@ assert-window-property: {"pageYOffset": "0"} // Close the sidebar menu. Make sure the scroll position gets restored. click: ".sidebar-menu-toggle" wait-for-css: (".sidebar", {"left": "-1000px"}) -assert-window-property: {"pageYOffset": "651"} +assert-window-property: {"pageYOffset": "627"} // Now test that scrollability returns when the browser window is just resized. click: ".sidebar-menu-toggle" wait-for-css: (".sidebar", {"left": "0px"}) assert-window-property: {"pageYOffset": "0"} size: (900, 600) -assert-window-property: {"pageYOffset": "651"} +assert-window-property: {"pageYOffset": "627"} diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs index 6f85227500361..0d9a629e179b8 100644 --- a/src/tools/compiletest/src/header.rs +++ b/src/tools/compiletest/src/header.rs @@ -4,6 +4,7 @@ use std::fs::File; use std::io::prelude::*; use std::io::BufReader; use std::path::{Path, PathBuf}; +use std::process::Command; use tracing::*; @@ -843,6 +844,20 @@ pub fn extract_llvm_version(version: &str) -> Option { Some(version) } +pub fn extract_llvm_version_from_binary(binary_path: &str) -> Option { + let output = Command::new(binary_path).arg("--version").output().ok()?; + if !output.status.success() { + return None; + } + let version = String::from_utf8(output.stdout).ok()?; + for line in version.lines() { + if let Some(version) = line.split("LLVM version ").skip(1).next() { + return extract_llvm_version(version); + } + } + None +} + /// Takes a directive of the form " [- ]", /// returns the numeric representation of and as /// tuple: ( as u32, as u32) diff --git a/src/tools/compiletest/src/main.rs b/src/tools/compiletest/src/main.rs index b48395035d4f0..417b429161f52 100644 --- a/src/tools/compiletest/src/main.rs +++ b/src/tools/compiletest/src/main.rs @@ -200,7 +200,9 @@ pub fn parse_config(args: Vec) -> Config { Some(x) => panic!("argument for --color must be auto, always, or never, but found `{}`", x), }; let llvm_version = - matches.opt_str("llvm-version").as_deref().and_then(header::extract_llvm_version); + matches.opt_str("llvm-version").as_deref().and_then(header::extract_llvm_version).or_else( + || header::extract_llvm_version_from_binary(&matches.opt_str("llvm-filecheck")?), + ); let src_base = opt_path(matches, "src-base"); let run_ignored = matches.opt_present("ignored"); diff --git a/triagebot.toml b/triagebot.toml index 69bd49394099d..49a59806b7f10 100644 --- a/triagebot.toml +++ b/triagebot.toml @@ -183,6 +183,11 @@ trigger_files = [ "x.ps1", "src/bootstrap", "src/tools/rust-installer", + "configure", + "Cargo.toml", + "Cargo.lock", + "config.toml.example", + "src/stage0.json" ] [autolabel."T-infra"] @@ -210,6 +215,38 @@ trigger_files = [ "compiler/rustc_macros/src/query.rs" ] +[autolabel."A-testsuite"] +trigger_files = [ + "src/test", + "src/ci", + "src/tools/compiletest", + "src/tools/cargotest", + "src/tools/tidy", + "src/tools/remote-test-server", + "src/tools/remote-test-client", + "src/tools/tier-check" +] + +[autolabel."A-meta"] +trigger_files = [ + "triagebot.toml", + "rustfmt.toml", + "LICENSES", + "README.md", + "CONTRIBUTING.md", + ".reuse", + ".mailmap", + ".git-blame-ignore-revs", + ".editorconfig" +] + +[autolabel."T-release"] +trigger_files = [ + "RELEASES.md", + "src/stage0.json", + "src/version" +] + [notify-zulip."I-prioritize"] zulip_stream = 245100 # #t-compiler/wg-prioritization/alerts topic = "#{number} {title}"