Auto merge of #111820 - matthiaskrgr:rollup-9sb2lw9, r=matthiaskrgr
Rollup of 5 pull requests Successful merges: - #111745 (Fix overflow in error emitter) - #111770 (Read beta version from the version file if building from a source tarball) - #111797 (Migrate GUI colors test to original CSS color format) - #111809 (Unset MIRI_BLESS for mir-opt-level 4 miri tests) - #111817 (Migrate GUI colors test to original CSS color format) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
965cf5c1f5
11 changed files with 180 additions and 55 deletions
|
@ -2303,6 +2303,8 @@ impl EmitterWriter {
|
||||||
|
|
||||||
// Colorize addition/replacements with green.
|
// Colorize addition/replacements with green.
|
||||||
for &SubstitutionHighlight { start, end } in highlight_parts {
|
for &SubstitutionHighlight { start, end } in highlight_parts {
|
||||||
|
// This is a no-op for empty ranges
|
||||||
|
if start != end {
|
||||||
// Account for tabs when highlighting (#87972).
|
// Account for tabs when highlighting (#87972).
|
||||||
let tabs: usize = line_to_add
|
let tabs: usize = line_to_add
|
||||||
.chars()
|
.chars()
|
||||||
|
@ -2320,6 +2322,7 @@ impl EmitterWriter {
|
||||||
true,
|
true,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
*row_num += 1;
|
*row_num += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -330,12 +330,11 @@ impl CodeSuggestion {
|
||||||
});
|
});
|
||||||
buf.push_str(&part.snippet);
|
buf.push_str(&part.snippet);
|
||||||
let cur_hi = sm.lookup_char_pos(part.span.hi());
|
let cur_hi = sm.lookup_char_pos(part.span.hi());
|
||||||
if cur_hi.line == cur_lo.line && !part.snippet.is_empty() {
|
|
||||||
// Account for the difference between the width of the current code and the
|
// Account for the difference between the width of the current code and the
|
||||||
// snippet being suggested, so that the *later* suggestions are correctly
|
// snippet being suggested, so that the *later* suggestions are correctly
|
||||||
// aligned on the screen.
|
// aligned on the screen. Note that cur_hi and cur_lo can be on different
|
||||||
acc += len - (cur_hi.col.0 - cur_lo.col.0) as isize;
|
// lines, so cur_hi.col can be smaller than cur_lo.col
|
||||||
}
|
acc += len - (cur_hi.col.0 as isize - cur_lo.col.0 as isize);
|
||||||
prev_hi = cur_hi;
|
prev_hi = cur_hi;
|
||||||
prev_line = sf.get_line(prev_hi.line - 1);
|
prev_line = sf.get_line(prev_hi.line - 1);
|
||||||
for line in part.snippet.split('\n').skip(1) {
|
for line in part.snippet.split('\n').skip(1) {
|
||||||
|
|
|
@ -146,6 +146,22 @@ fn alias_and_path_for_library() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_beta_rev_parsing() {
|
||||||
|
use crate::extract_beta_rev;
|
||||||
|
|
||||||
|
// single digit revision
|
||||||
|
assert_eq!(extract_beta_rev("1.99.9-beta.7 (xxxxxx)"), Some("7".to_string()));
|
||||||
|
// multiple digits
|
||||||
|
assert_eq!(extract_beta_rev("1.99.9-beta.777 (xxxxxx)"), Some("777".to_string()));
|
||||||
|
// nightly channel (no beta revision)
|
||||||
|
assert_eq!(extract_beta_rev("1.99.9-nightly (xxxxxx)"), None);
|
||||||
|
// stable channel (no beta revision)
|
||||||
|
assert_eq!(extract_beta_rev("1.99.9 (xxxxxxx)"), None);
|
||||||
|
// invalid string
|
||||||
|
assert_eq!(extract_beta_rev("invalid"), None);
|
||||||
|
}
|
||||||
|
|
||||||
mod defaults {
|
mod defaults {
|
||||||
use super::{configure, first, run_build};
|
use super::{configure, first, run_build};
|
||||||
use crate::builder::*;
|
use crate::builder::*;
|
||||||
|
|
|
@ -1324,7 +1324,7 @@ impl Build {
|
||||||
match &self.config.channel[..] {
|
match &self.config.channel[..] {
|
||||||
"stable" => num.to_string(),
|
"stable" => num.to_string(),
|
||||||
"beta" => {
|
"beta" => {
|
||||||
if self.rust_info().is_managed_git_subrepository() && !self.config.omit_git_hash {
|
if !self.config.omit_git_hash {
|
||||||
format!("{}-beta.{}", num, self.beta_prerelease_version())
|
format!("{}-beta.{}", num, self.beta_prerelease_version())
|
||||||
} else {
|
} else {
|
||||||
format!("{}-beta", num)
|
format!("{}-beta", num)
|
||||||
|
@ -1336,18 +1336,28 @@ impl Build {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn beta_prerelease_version(&self) -> u32 {
|
fn beta_prerelease_version(&self) -> u32 {
|
||||||
|
fn extract_beta_rev_from_file<P: AsRef<Path>>(version_file: P) -> Option<String> {
|
||||||
|
let version = fs::read_to_string(version_file).ok()?;
|
||||||
|
|
||||||
|
extract_beta_rev(&version)
|
||||||
|
}
|
||||||
|
|
||||||
if let Some(s) = self.prerelease_version.get() {
|
if let Some(s) = self.prerelease_version.get() {
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// First check if there is a version file available.
|
||||||
|
// If available, we read the beta revision from that file.
|
||||||
|
// This only happens when building from a source tarball when Git should not be used.
|
||||||
|
let count = extract_beta_rev_from_file(self.src.join("version")).unwrap_or_else(|| {
|
||||||
// Figure out how many merge commits happened since we branched off master.
|
// Figure out how many merge commits happened since we branched off master.
|
||||||
// That's our beta number!
|
// That's our beta number!
|
||||||
// (Note that we use a `..` range, not the `...` symmetric difference.)
|
// (Note that we use a `..` range, not the `...` symmetric difference.)
|
||||||
let count =
|
|
||||||
output(self.config.git().arg("rev-list").arg("--count").arg("--merges").arg(format!(
|
output(self.config.git().arg("rev-list").arg("--count").arg("--merges").arg(format!(
|
||||||
"refs/remotes/origin/{}..HEAD",
|
"refs/remotes/origin/{}..HEAD",
|
||||||
self.config.stage0_metadata.config.nightly_branch
|
self.config.stage0_metadata.config.nightly_branch
|
||||||
)));
|
)))
|
||||||
|
});
|
||||||
let n = count.trim().parse().unwrap();
|
let n = count.trim().parse().unwrap();
|
||||||
self.prerelease_version.set(Some(n));
|
self.prerelease_version.set(Some(n));
|
||||||
n
|
n
|
||||||
|
@ -1707,6 +1717,17 @@ to download LLVM rather than building it.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Extract the beta revision from the full version string.
|
||||||
|
///
|
||||||
|
/// The full version string looks like "a.b.c-beta.y". And we need to extract
|
||||||
|
/// the "y" part from the string.
|
||||||
|
pub fn extract_beta_rev(version: &str) -> Option<String> {
|
||||||
|
let parts = version.splitn(2, "-beta.").collect::<Vec<_>>();
|
||||||
|
let count = parts.get(1).and_then(|s| s.find(' ').map(|p| (&s[..p]).to_string()));
|
||||||
|
|
||||||
|
count
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
fn chmod(path: &Path, perms: u32) {
|
fn chmod(path: &Path, perms: u32) {
|
||||||
use std::os::unix::fs::*;
|
use std::os::unix::fs::*;
|
||||||
|
|
|
@ -620,6 +620,8 @@ impl Step for Miri {
|
||||||
cargo.env("MIRIFLAGS", "-O -Zmir-opt-level=4 -Cdebug-assertions=yes");
|
cargo.env("MIRIFLAGS", "-O -Zmir-opt-level=4 -Cdebug-assertions=yes");
|
||||||
// Optimizations can change backtraces
|
// Optimizations can change backtraces
|
||||||
cargo.env("MIRI_SKIP_UI_CHECKS", "1");
|
cargo.env("MIRI_SKIP_UI_CHECKS", "1");
|
||||||
|
// `MIRI_SKIP_UI_CHECKS` and `MIRI_BLESS` are incompatible
|
||||||
|
cargo.env_remove("MIRI_BLESS");
|
||||||
// Optimizations can change error locations and remove UB so don't run `fail` tests.
|
// Optimizations can change error locations and remove UB so don't run `fail` tests.
|
||||||
cargo.args(&["tests/pass", "tests/panic"]);
|
cargo.args(&["tests/pass", "tests/panic"]);
|
||||||
|
|
||||||
|
|
|
@ -75,35 +75,35 @@ call-function: (
|
||||||
"check-colors",
|
"check-colors",
|
||||||
{
|
{
|
||||||
"theme": "ayu",
|
"theme": "ayu",
|
||||||
"main_color": "rgb(197, 197, 197)",
|
"main_color": "#c5c5c5",
|
||||||
"title_color": "rgb(255, 255, 255)",
|
"title_color": "#fff",
|
||||||
"main_heading_color": "rgb(255, 255, 255)",
|
"main_heading_color": "#fff",
|
||||||
"main_heading_type_color": "rgb(255, 160, 165)",
|
"main_heading_type_color": "#ffa0a5",
|
||||||
"src_link_color": "rgb(57, 175, 215)",
|
"src_link_color": "#39afd7",
|
||||||
"sidebar_link_color": "rgb(83, 177, 219)",
|
"sidebar_link_color": "#53b1db",
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
call-function: (
|
call-function: (
|
||||||
"check-colors",
|
"check-colors",
|
||||||
{
|
{
|
||||||
"theme": "dark",
|
"theme": "dark",
|
||||||
"main_color": "rgb(221, 221, 221)",
|
"main_color": "#ddd",
|
||||||
"title_color": "rgb(221, 221, 221)",
|
"title_color": "#ddd",
|
||||||
"main_heading_color": "rgb(221, 221, 221)",
|
"main_heading_color": "#ddd",
|
||||||
"main_heading_type_color": "rgb(45, 191, 184)",
|
"main_heading_type_color": "#2dbfb8",
|
||||||
"src_link_color": "rgb(210, 153, 29)",
|
"src_link_color": "#d2991d",
|
||||||
"sidebar_link_color": "rgb(253, 191, 53)",
|
"sidebar_link_color": "#fdbf35",
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
call-function: (
|
call-function: (
|
||||||
"check-colors",
|
"check-colors",
|
||||||
{
|
{
|
||||||
"theme": "light",
|
"theme": "light",
|
||||||
"main_color": "rgb(0, 0, 0)",
|
"main_color": "black",
|
||||||
"title_color": "rgb(0, 0, 0)",
|
"title_color": "black",
|
||||||
"main_heading_color": "rgb(0, 0, 0)",
|
"main_heading_color": "black",
|
||||||
"main_heading_type_color": "rgb(173, 55, 138)",
|
"main_heading_type_color": "#ad378a",
|
||||||
"src_link_color": "rgb(56, 115, 173)",
|
"src_link_color": "#3873ad",
|
||||||
"sidebar_link_color": "rgb(53, 109, 164)",
|
"sidebar_link_color": "#356da4",
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
|
@ -109,19 +109,19 @@ define-function: (
|
||||||
|
|
||||||
call-function: ("check-colors", {
|
call-function: ("check-colors", {
|
||||||
"theme": "ayu",
|
"theme": "ayu",
|
||||||
"background": "rgb(15, 20, 25)",
|
"background": "#0f1419",
|
||||||
"color": "rgb(197, 197, 197)",
|
"color": "#c5c5c5",
|
||||||
"border": "rgb(92, 103, 115)",
|
"border": "#5c6773",
|
||||||
})
|
})
|
||||||
call-function: ("check-colors", {
|
call-function: ("check-colors", {
|
||||||
"theme": "dark",
|
"theme": "dark",
|
||||||
"background": "rgb(53, 53, 53)",
|
"background": "#353535",
|
||||||
"color": "rgb(221, 221, 221)",
|
"color": "#ddd",
|
||||||
"border": "rgb(224, 224, 224)",
|
"border": "#e0e0e0",
|
||||||
})
|
})
|
||||||
call-function: ("check-colors", {
|
call-function: ("check-colors", {
|
||||||
"theme": "light",
|
"theme": "light",
|
||||||
"background": "rgb(255, 255, 255)",
|
"background": "white",
|
||||||
"color": "rgb(0, 0, 0)",
|
"color": "black",
|
||||||
"border": "rgb(224, 224, 224)",
|
"border": "#e0e0e0",
|
||||||
})
|
})
|
||||||
|
|
12
tests/ui/suggestions/issue-109854.rs
Normal file
12
tests/ui/suggestions/issue-109854.rs
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
fn generate_setter() {
|
||||||
|
String::with_capacity(
|
||||||
|
//~^ ERROR this function takes 1 argument but 3 arguments were supplied
|
||||||
|
generate_setter,
|
||||||
|
r#"
|
||||||
|
pub(crate) struct Person<T: Clone> {}
|
||||||
|
"#,
|
||||||
|
r#""#,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
31
tests/ui/suggestions/issue-109854.stderr
Normal file
31
tests/ui/suggestions/issue-109854.stderr
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
error[E0061]: this function takes 1 argument but 3 arguments were supplied
|
||||||
|
--> $DIR/issue-109854.rs:2:5
|
||||||
|
|
|
||||||
|
LL | String::with_capacity(
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
...
|
||||||
|
LL | / r#"
|
||||||
|
LL | | pub(crate) struct Person<T: Clone> {}
|
||||||
|
LL | | "#,
|
||||||
|
| |__- unexpected argument of type `&'static str`
|
||||||
|
LL | r#""#,
|
||||||
|
| ----- unexpected argument of type `&'static str`
|
||||||
|
|
|
||||||
|
note: expected `usize`, found fn item
|
||||||
|
--> $DIR/issue-109854.rs:4:5
|
||||||
|
|
|
||||||
|
LL | generate_setter,
|
||||||
|
| ^^^^^^^^^^^^^^^
|
||||||
|
= note: expected type `usize`
|
||||||
|
found fn item `fn() {generate_setter}`
|
||||||
|
note: associated function defined here
|
||||||
|
--> $SRC_DIR/alloc/src/string.rs:LL:COL
|
||||||
|
help: remove the extra arguments
|
||||||
|
|
|
||||||
|
LL - generate_setter,
|
||||||
|
LL + /* usize */,
|
||||||
|
|
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0061`.
|
5
tests/ui/suggestions/issue-94171.rs
Normal file
5
tests/ui/suggestions/issue-94171.rs
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
fn L(]{match
|
||||||
|
(; {`
|
||||||
|
//~^^ ERROR mismatched closing delimiter
|
||||||
|
//~^^ ERROR unknown start of token
|
||||||
|
//~ ERROR this file contains an unclosed delimiter
|
36
tests/ui/suggestions/issue-94171.stderr
Normal file
36
tests/ui/suggestions/issue-94171.stderr
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
error: unknown start of token: `
|
||||||
|
--> $DIR/issue-94171.rs:2:5
|
||||||
|
|
|
||||||
|
LL | (; {`
|
||||||
|
| ^
|
||||||
|
|
|
||||||
|
help: Unicode character '`' (Grave Accent) looks like ''' (Single Quote), but it is not
|
||||||
|
|
|
||||||
|
LL | (; {'
|
||||||
|
| ~
|
||||||
|
|
||||||
|
error: mismatched closing delimiter: `]`
|
||||||
|
--> $DIR/issue-94171.rs:1:5
|
||||||
|
|
|
||||||
|
LL | fn L(]{match
|
||||||
|
| ^^ mismatched closing delimiter
|
||||||
|
| |
|
||||||
|
| unclosed delimiter
|
||||||
|
|
||||||
|
error: this file contains an unclosed delimiter
|
||||||
|
--> $DIR/issue-94171.rs:5:52
|
||||||
|
|
|
||||||
|
LL | fn L(]{match
|
||||||
|
| -- unclosed delimiter
|
||||||
|
| |
|
||||||
|
| missing open `[` for this delimiter
|
||||||
|
LL | (; {`
|
||||||
|
| - - unclosed delimiter
|
||||||
|
| |
|
||||||
|
| unclosed delimiter
|
||||||
|
...
|
||||||
|
LL |
|
||||||
|
| ^
|
||||||
|
|
||||||
|
error: aborting due to 3 previous errors
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue