Skip to content

Commit

Permalink
Auto merge of rust-lang#124377 - matthiaskrgr:rollup-ajxjq35, r=matth…
Browse files Browse the repository at this point in the history
…iaskrgr

Rollup of 2 pull requests

Successful merges:

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

r? `@ghost`
`@rustbot` modify labels: rollup
  • Loading branch information
bors committed Apr 25, 2024
2 parents 9e6c4fd + c125e9d commit 38dd569
Show file tree
Hide file tree
Showing 13 changed files with 20 additions and 28 deletions.
6 changes: 3 additions & 3 deletions compiler/rustc_lexer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ impl Cursor<'_> {
// 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' => {
Expand Down Expand Up @@ -661,7 +661,7 @@ impl Cursor<'_> {
// 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 {
Expand All @@ -677,7 +677,7 @@ impl Cursor<'_> {
// 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),
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_lexer/src/unescape.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_llvm/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_macros/build.rs
Original file line number Diff line number Diff line change
@@ -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"
);
Expand Down
2 changes: 0 additions & 2 deletions tests/ui/codemap_tests/huge_multispan_highlight.rs
Original file line number Diff line number Diff line change
@@ -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 => (
Expand Down
6 changes: 3 additions & 3 deletions tests/ui/codemap_tests/huge_multispan_highlight.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 0 additions & 2 deletions tests/ui/diagnostic-flags/colored-session-opt-error.rs
Original file line number Diff line number Diff line change
@@ -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() {}
2 changes: 0 additions & 2 deletions tests/ui/error-emitter/highlighting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/error-emitter/highlighting.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions tests/ui/error-emitter/highlighting.windows.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 0 additions & 2 deletions tests/ui/error-emitter/multiline-multipart-suggestion.rs
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 3 additions & 3 deletions tests/ui/error-emitter/multiline-multipart-suggestion.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 38dd569

Please sign in to comment.