Auto merge of #124377 - matthiaskrgr:rollup-ajxjq35, r=matthiaskrgr

Rollup of 2 pull requests

Successful merges:

 - #124287 (Improved code with clippy)
 - #124326 (tests: remove few ignore-stage2)

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors 2024-04-25 17:12:29 +00:00
commit 38dd569150
13 changed files with 20 additions and 28 deletions

View File

@ -630,7 +630,7 @@ fn number(&mut self, first_digit: char) -> LiteralKind {
// with a number
self.bump();
let mut empty_exponent = false;
if self.first().is_digit(10) {
if self.first().is_ascii_digit() {
self.eat_decimal_digits();
match self.first() {
'e' | 'E' => {
@ -661,7 +661,7 @@ fn lifetime_or_char(&mut self) -> TokenKind {
// If the first symbol is valid for identifier, it can be a lifetime.
// Also check if it's a number for a better error reporting (so '0 will
// be reported as invalid lifetime and not as unterminated char literal).
is_id_start(self.first()) || self.first().is_digit(10)
is_id_start(self.first()) || self.first().is_ascii_digit()
};
if !can_be_a_lifetime {
@ -677,7 +677,7 @@ fn lifetime_or_char(&mut self) -> TokenKind {
// Either a lifetime or a character literal with
// length greater than 1.
let starts_with_number = self.first().is_digit(10);
let starts_with_number = self.first().is_ascii_digit();
// Skip the literal contents.
// First symbol can be a number (which isn't a valid identifier start),

View File

@ -259,7 +259,7 @@ fn scan_escape<T: From<char> + From<u8>>(
} else {
// This may be a high byte, but that will only happen if `T` is
// `MixedUnit`, because of the `allow_high_bytes` check above.
Ok(T::from(value as u8))
Ok(T::from(value))
};
}
'u' => return scan_unicode(chars, mode.allow_unicode_escapes()).map(T::from),
@ -300,7 +300,7 @@ fn scan_unicode(chars: &mut Chars<'_>, allow_unicode_escapes: bool) -> Result<ch
return Err(EscapeError::UnicodeEscapeInByte);
}
break std::char::from_u32(value).ok_or_else(|| {
break std::char::from_u32(value).ok_or({
if value > 0x10FFFF {
EscapeError::OutOfRangeUnicodeEscape
} else {

View File

@ -50,7 +50,7 @@ fn detect_llvm_link() -> (&'static str, &'static str) {
fn restore_library_path() {
let key = tracked_env_var_os("REAL_LIBRARY_PATH_VAR").expect("REAL_LIBRARY_PATH_VAR");
if let Some(env) = tracked_env_var_os("REAL_LIBRARY_PATH") {
env::set_var(&key, &env);
env::set_var(&key, env);
} else {
env::remove_var(&key);
}

View File

@ -1,7 +1,7 @@
fn main() {
println!("cargo:rerun-if-changed=build.rs");
println!("cargo:rerun-if-env-changed=RUSTC_BOOTSTRAP");
if !std::env::var("RUSTC_BOOTSTRAP").is_ok() {
if std::env::var("RUSTC_BOOTSTRAP").is_err() {
eprintln!(
"error: you are attempting to build the compiler without going through bootstrap"
);

View File

@ -1,7 +1,5 @@
//@ compile-flags: --error-format=human --color=always
//@ ignore-windows
// Temporary until next release:
//@ ignore-stage2
fn main() {
let _ = match true {
true => (

View File

@ -1,4 +1,4 @@
<svg width="750px" height="848px" xmlns="http://www.w3.org/2000/svg">
<svg width="740px" height="848px" xmlns="http://www.w3.org/2000/svg">
<style>
.fg { fill: #AAAAAA }
.bg { background: #000000 }
@ -21,7 +21,7 @@
<text xml:space="preserve" class="container fg">
<tspan x="10px" y="28px"><tspan class="fg-ansi256-009 bold">error[E0308]</tspan><tspan class="bold">: `match` arms have incompatible types</tspan>
</tspan>
<tspan x="10px" y="46px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/huge_multispan_highlight.rs:98:18</tspan>
<tspan x="10px" y="46px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/huge_multispan_highlight.rs:96:18</tspan>
</tspan>
<tspan x="10px" y="64px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
</tspan>
@ -59,7 +59,7 @@
</tspan>
<tspan x="10px" y="370px"><tspan class="fg-ansi256-009 bold">error[E0308]</tspan><tspan class="bold">: `match` arms have incompatible types</tspan>
</tspan>
<tspan x="10px" y="388px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/huge_multispan_highlight.rs:215:18</tspan>
<tspan x="10px" y="388px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/huge_multispan_highlight.rs:213:18</tspan>
</tspan>
<tspan x="10px" y="406px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
</tspan>

Before

Width:  |  Height:  |  Size: 8.8 KiB

After

Width:  |  Height:  |  Size: 8.8 KiB

View File

@ -1,6 +1,4 @@
//@ check-pass
//@ ignore-windows
//@ compile-flags: -Cremark=foo --error-format=human --color=always
// Temporary until next release:
//@ ignore-stage2
fn main() {}

View File

@ -3,8 +3,6 @@
//@ compile-flags: --error-format=human --color=always
//@ error-pattern:for<'a> 
//@ edition:2018
// Temporary until next release:
//@ ignore-stage2
use core::pin::Pin;
use core::future::Future;

View File

@ -23,7 +23,7 @@
<text xml:space="preserve" class="container fg">
<tspan x="10px" y="28px"><tspan class="fg-ansi256-009 bold">error[E0308]</tspan><tspan class="bold">: mismatched types</tspan>
</tspan>
<tspan x="10px" y="46px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/highlighting.rs:24:11</tspan>
<tspan x="10px" y="46px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/highlighting.rs:22:11</tspan>
</tspan>
<tspan x="10px" y="64px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
</tspan>
@ -43,7 +43,7 @@
</tspan>
<tspan x="10px" y="208px"><tspan class="fg-ansi256-010 bold">note</tspan><tspan>: function defined here</tspan>
</tspan>
<tspan x="10px" y="226px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/highlighting.rs:13:4</tspan>
<tspan x="10px" y="226px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/highlighting.rs:11:4</tspan>
</tspan>
<tspan x="10px" y="244px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
</tspan>

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

@ -24,7 +24,7 @@
<text xml:space="preserve" class="container fg">
<tspan x="10px" y="28px"><tspan class="fg-ansi256-009 bold">error[E0308]</tspan><tspan class="fg-ansi256-015 bold">: mismatched types</tspan>
</tspan>
<tspan x="10px" y="46px"><tspan> </tspan><tspan class="fg-ansi256-014 bold">--&gt; </tspan><tspan>$DIR/highlighting.rs:24:11</tspan>
<tspan x="10px" y="46px"><tspan> </tspan><tspan class="fg-ansi256-014 bold">--&gt; </tspan><tspan>$DIR/highlighting.rs:22:11</tspan>
</tspan>
<tspan x="10px" y="64px"><tspan> </tspan><tspan class="fg-ansi256-014 bold">|</tspan>
</tspan>
@ -44,7 +44,7 @@
</tspan>
<tspan x="10px" y="208px"><tspan class="fg-ansi256-010 bold">note</tspan><tspan>: function defined here</tspan>
</tspan>
<tspan x="10px" y="226px"><tspan> </tspan><tspan class="fg-ansi256-014 bold">--&gt; </tspan><tspan>$DIR/highlighting.rs:13:4</tspan>
<tspan x="10px" y="226px"><tspan> </tspan><tspan class="fg-ansi256-014 bold">--&gt; </tspan><tspan>$DIR/highlighting.rs:11:4</tspan>
</tspan>
<tspan x="10px" y="244px"><tspan> </tspan><tspan class="fg-ansi256-014 bold">|</tspan>
</tspan>

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

View File

@ -1,7 +1,5 @@
//@ compile-flags: --error-format=human --color=always
//@ error-pattern: missing lifetime specifier
// Temporary until next release:
//@ ignore-stage2
fn short(foo_bar: &Vec<&i32>) -> &i32 {
&12

View File

@ -23,7 +23,7 @@
<text xml:space="preserve" class="container fg">
<tspan x="10px" y="28px"><tspan class="fg-ansi256-009 bold">error[E0106]</tspan><tspan class="bold">: missing lifetime specifier</tspan>
</tspan>
<tspan x="10px" y="46px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/multiline-multipart-suggestion.rs:6:34</tspan>
<tspan x="10px" y="46px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/multiline-multipart-suggestion.rs:4:34</tspan>
</tspan>
<tspan x="10px" y="64px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
</tspan>
@ -47,7 +47,7 @@
</tspan>
<tspan x="10px" y="244px"><tspan class="fg-ansi256-009 bold">error[E0106]</tspan><tspan class="bold">: missing lifetime specifier</tspan>
</tspan>
<tspan x="10px" y="262px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/multiline-multipart-suggestion.rs:13:6</tspan>
<tspan x="10px" y="262px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/multiline-multipart-suggestion.rs:11:6</tspan>
</tspan>
<tspan x="10px" y="280px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
</tspan>
@ -83,7 +83,7 @@
</tspan>
<tspan x="10px" y="568px"><tspan class="fg-ansi256-009 bold">error[E0106]</tspan><tspan class="bold">: missing lifetime specifier</tspan>
</tspan>
<tspan x="10px" y="586px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/multiline-multipart-suggestion.rs:18:29</tspan>
<tspan x="10px" y="586px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">--&gt; </tspan><tspan>$DIR/multiline-multipart-suggestion.rs:16:29</tspan>
</tspan>
<tspan x="10px" y="604px"><tspan> </tspan><tspan class="fg-ansi256-012 bold">|</tspan>
</tspan>

Before

Width:  |  Height:  |  Size: 9.0 KiB

After

Width:  |  Height:  |  Size: 9.0 KiB

View File

@ -23,7 +23,7 @@
<text xml:space="preserve" class="container fg">
<tspan x="10px" y="28px"><tspan class="fg-ansi256-009 bold">error[E0106]</tspan><tspan class="fg-ansi256-015 bold">: missing lifetime specifier</tspan>
</tspan>
<tspan x="10px" y="46px"><tspan> </tspan><tspan class="fg-ansi256-014 bold">--&gt; </tspan><tspan>$DIR/multiline-multipart-suggestion.rs:6:34</tspan>
<tspan x="10px" y="46px"><tspan> </tspan><tspan class="fg-ansi256-014 bold">--&gt; </tspan><tspan>$DIR/multiline-multipart-suggestion.rs:4:34</tspan>
</tspan>
<tspan x="10px" y="64px"><tspan> </tspan><tspan class="fg-ansi256-014 bold">|</tspan>
</tspan>
@ -47,7 +47,7 @@
</tspan>
<tspan x="10px" y="244px"><tspan class="fg-ansi256-009 bold">error[E0106]</tspan><tspan class="fg-ansi256-015 bold">: missing lifetime specifier</tspan>
</tspan>
<tspan x="10px" y="262px"><tspan> </tspan><tspan class="fg-ansi256-014 bold">--&gt; </tspan><tspan>$DIR/multiline-multipart-suggestion.rs:13:6</tspan>
<tspan x="10px" y="262px"><tspan> </tspan><tspan class="fg-ansi256-014 bold">--&gt; </tspan><tspan>$DIR/multiline-multipart-suggestion.rs:11:6</tspan>
</tspan>
<tspan x="10px" y="280px"><tspan> </tspan><tspan class="fg-ansi256-014 bold">|</tspan>
</tspan>
@ -83,7 +83,7 @@
</tspan>
<tspan x="10px" y="568px"><tspan class="fg-ansi256-009 bold">error[E0106]</tspan><tspan class="fg-ansi256-015 bold">: missing lifetime specifier</tspan>
</tspan>
<tspan x="10px" y="586px"><tspan> </tspan><tspan class="fg-ansi256-014 bold">--&gt; </tspan><tspan>$DIR/multiline-multipart-suggestion.rs:18:29</tspan>
<tspan x="10px" y="586px"><tspan> </tspan><tspan class="fg-ansi256-014 bold">--&gt; </tspan><tspan>$DIR/multiline-multipart-suggestion.rs:16:29</tspan>
</tspan>
<tspan x="10px" y="604px"><tspan> </tspan><tspan class="fg-ansi256-014 bold">|</tspan>
</tspan>

Before

Width:  |  Height:  |  Size: 9.1 KiB

After

Width:  |  Height:  |  Size: 9.1 KiB