Skip to content

Commit 2dc5b60

Browse files
committed
Auto merge of #71410 - JohnTitor:rollup-vh6dut5, r=JohnTitor
Rollup of 7 pull requests Successful merges: - #70998 (Suggest `-> impl Trait` and `-> Box<dyn Trait>` on fn that doesn't return) - #71236 (Remove unused rustc_serialize::hex module) - #71366 (Use assoc int consts3) - #71372 (Fix #! (shebang) stripping account space issue) - #71384 (Fix stage0.txt version number comment) - #71390 (Fix incorrect description of E0690) - #71399 (Clean up E0554 explanation) Failed merges: r? @ghost
2 parents 70f4f32 + 66eaead commit 2dc5b60

File tree

46 files changed

+209
-324
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+209
-324
lines changed

Cargo.lock

-15
Original file line numberDiff line numberDiff line change
@@ -3577,7 +3577,6 @@ version = "0.0.0"
35773577
dependencies = [
35783578
"log",
35793579
"rustc_ast",
3580-
"rustc_data_structures",
35813580
"rustc_span",
35823581
]
35833582

@@ -3594,7 +3593,6 @@ dependencies = [
35943593
"rustc_session",
35953594
"rustc_span",
35963595
"serialize",
3597-
"smallvec 1.0.0",
35983596
]
35993597

36003598
[[package]]
@@ -3666,7 +3664,6 @@ dependencies = [
36663664
"rustc_hir",
36673665
"rustc_incremental",
36683666
"rustc_index",
3669-
"rustc_metadata",
36703667
"rustc_middle",
36713668
"rustc_session",
36723669
"rustc_span",
@@ -3809,7 +3806,6 @@ version = "0.0.0"
38093806
dependencies = [
38103807
"rustc_ast",
38113808
"rustc_ast_pretty",
3812-
"rustc_data_structures",
38133809
"rustc_hir",
38143810
"rustc_span",
38153811
"rustc_target",
@@ -3879,7 +3875,6 @@ dependencies = [
38793875
"rustc_expand",
38803876
"rustc_hir",
38813877
"rustc_incremental",
3882-
"rustc_infer",
38833878
"rustc_lint",
38843879
"rustc_metadata",
38853880
"rustc_middle",
@@ -3924,7 +3919,6 @@ dependencies = [
39243919
"rustc_feature",
39253920
"rustc_hir",
39263921
"rustc_index",
3927-
"rustc_infer",
39283922
"rustc_middle",
39293923
"rustc_session",
39303924
"rustc_span",
@@ -3986,10 +3980,8 @@ dependencies = [
39863980
"backtrace",
39873981
"bitflags",
39883982
"byteorder",
3989-
"jobserver",
39903983
"log",
39913984
"measureme",
3992-
"parking_lot 0.10.2",
39933985
"polonius-engine",
39943986
"rustc-rayon",
39953987
"rustc-rayon-core",
@@ -4023,7 +4015,6 @@ dependencies = [
40234015
"polonius-engine",
40244016
"rustc_apfloat",
40254017
"rustc_ast",
4026-
"rustc_ast_pretty",
40274018
"rustc_attr",
40284019
"rustc_data_structures",
40294020
"rustc_errors",
@@ -4079,7 +4070,6 @@ dependencies = [
40794070
"rustc_lexer",
40804071
"rustc_session",
40814072
"rustc_span",
4082-
"smallvec 1.0.0",
40834073
"unicode-normalization",
40844074
]
40854075

@@ -4092,10 +4082,8 @@ dependencies = [
40924082
"rustc_attr",
40934083
"rustc_data_structures",
40944084
"rustc_errors",
4095-
"rustc_feature",
40964085
"rustc_hir",
40974086
"rustc_index",
4098-
"rustc_infer",
40994087
"rustc_middle",
41004088
"rustc_session",
41014089
"rustc_span",
@@ -4143,7 +4131,6 @@ dependencies = [
41434131
"rustc_data_structures",
41444132
"rustc_errors",
41454133
"rustc_index",
4146-
"rustc_macros",
41474134
"rustc_span",
41484135
"serialize",
41494136
"smallvec 1.0.0",
@@ -4296,10 +4283,8 @@ dependencies = [
42964283
"rustc_data_structures",
42974284
"rustc_hir",
42984285
"rustc_infer",
4299-
"rustc_macros",
43004286
"rustc_middle",
43014287
"rustc_span",
4302-
"rustc_target",
43034288
"rustc_trait_selection",
43044289
"smallvec 1.0.0",
43054290
]

src/libcore/iter/adapters/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ use crate::cmp;
22
use crate::fmt;
33
use crate::intrinsics;
44
use crate::ops::{Add, AddAssign, Try};
5-
use crate::usize;
65

76
use super::{from_fn, LoopState};
87
use super::{DoubleEndedIterator, ExactSizeIterator, FusedIterator, Iterator, TrustedLen};

src/libcore/iter/range.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use crate::convert::TryFrom;
22
use crate::mem;
33
use crate::ops::{self, Add, Sub, Try};
4-
use crate::usize;
54

65
use super::{FusedIterator, TrustedLen};
76

src/libcore/iter/sources.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use crate::fmt;
22
use crate::marker;
3-
use crate::usize;
43

54
use super::{FusedIterator, TrustedLen};
65

src/libcore/num/f32.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ impl f32 {
265265
#[stable(feature = "rust1", since = "1.0.0")]
266266
#[inline]
267267
pub fn is_infinite(self) -> bool {
268-
self.abs_private() == INFINITY
268+
self.abs_private() == Self::INFINITY
269269
}
270270

271271
/// Returns `true` if this number is neither infinite nor `NaN`.
@@ -287,7 +287,7 @@ impl f32 {
287287
pub fn is_finite(self) -> bool {
288288
// There's no need to handle NaN separately: if self is NaN,
289289
// the comparison is not true, exactly as desired.
290-
self.abs_private() < INFINITY
290+
self.abs_private() < Self::INFINITY
291291
}
292292

293293
/// Returns `true` if the number is neither zero, infinite,

src/libcore/num/f64.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ impl f64 {
264264
#[stable(feature = "rust1", since = "1.0.0")]
265265
#[inline]
266266
pub fn is_infinite(self) -> bool {
267-
self.abs_private() == INFINITY
267+
self.abs_private() == Self::INFINITY
268268
}
269269

270270
/// Returns `true` if this number is neither infinite nor `NaN`.
@@ -286,7 +286,7 @@ impl f64 {
286286
pub fn is_finite(self) -> bool {
287287
// There's no need to handle NaN separately: if self is NaN,
288288
// the comparison is not true, exactly as desired.
289-
self.abs_private() < INFINITY
289+
self.abs_private() < Self::INFINITY
290290
}
291291

292292
/// Returns `true` if the number is neither zero, infinite,

src/libcore/num/flt2dec/decoder.rs

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
33
use crate::num::dec2flt::rawfp::RawFloat;
44
use crate::num::FpCategory;
5-
use crate::{f32, f64};
65

76
/// Decoded unsigned finite value, such that:
87
///

src/libcore/num/flt2dec/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ functions.
123123
)]
124124

125125
pub use self::decoder::{decode, DecodableFloat, Decoded, FullDecoded};
126-
use crate::i16;
127126

128127
pub mod decoder;
129128
pub mod estimator;

src/libcore/num/int_macros.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ macro_rules! int_module {
1414
concat!("The smallest value that can be represented by this integer type.
1515
Use [`", stringify!($T), "::MIN", "`](../../std/primitive.", stringify!($T), ".html#associatedconstant.MIN) instead."),
1616
#[$attr]
17-
pub const MIN: $T = $T::min_value();
17+
pub const MIN: $T = $T::MIN;
1818
}
1919

2020
doc_comment! {
2121
concat!("The largest value that can be represented by this integer type.
2222
Use [`", stringify!($T), "::MAX", "`](../../std/primitive.", stringify!($T), ".html#associatedconstant.MAX) instead."),
2323
#[$attr]
24-
pub const MAX: $T = $T::max_value();
24+
pub const MAX: $T = $T::MAX;
2525
}
2626
)
2727
}

src/libcore/slice/memchr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ fn repeat_byte(b: u8) -> usize {
3434
#[cfg(not(target_pointer_width = "16"))]
3535
#[inline]
3636
fn repeat_byte(b: u8) -> usize {
37-
(b as usize) * (crate::usize::MAX / 255)
37+
(b as usize) * (usize::MAX / 255)
3838
}
3939

4040
/// Returns the first index matching the byte `x` in `text`.

src/libcore/slice/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ use crate::cmp;
2828
use crate::cmp::Ordering::{self, Equal, Greater, Less};
2929
use crate::fmt;
3030
use crate::intrinsics::{assume, exact_div, is_aligned_and_not_null, unchecked_sub};
31-
use crate::isize;
3231
use crate::iter::*;
3332
use crate::marker::{self, Copy, Send, Sized, Sync};
3433
use crate::mem;

src/libcore/str/pattern.rs

-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
use crate::cmp;
4747
use crate::fmt;
4848
use crate::slice::memchr;
49-
use crate::usize;
5049

5150
// Pattern
5251

src/libcore/time.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
//! assert_eq!(Duration::new(5, 0), Duration::from_secs(5));
1313
//! ```
1414
15+
use crate::fmt;
1516
use crate::iter::Sum;
1617
use crate::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Sub, SubAssign};
17-
use crate::{fmt, u64};
1818

1919
const NANOS_PER_SEC: u32 = 1_000_000_000;
2020
const NANOS_PER_MILLI: u32 = 1_000_000;

src/librustc_ast_pretty/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,4 @@ doctest = false
1212
[dependencies]
1313
log = "0.4"
1414
rustc_span = { path = "../librustc_span" }
15-
rustc_data_structures = { path = "../librustc_data_structures" }
1615
rustc_ast = { path = "../librustc_ast" }

src/librustc_attr/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,5 @@ rustc_span = { path = "../librustc_span" }
1717
rustc_data_structures = { path = "../librustc_data_structures" }
1818
rustc_feature = { path = "../librustc_feature" }
1919
rustc_macros = { path = "../librustc_macros" }
20-
smallvec = { version = "1.0", features = ["union", "may_dangle"] }
2120
rustc_session = { path = "../librustc_session" }
2221
rustc_ast = { path = "../librustc_ast" }

src/librustc_codegen_ssa/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,3 @@ rustc_incremental = { path = "../librustc_incremental" }
3434
rustc_index = { path = "../librustc_index" }
3535
rustc_target = { path = "../librustc_target" }
3636
rustc_session = { path = "../librustc_session" }
37-
rustc_metadata = { path = "../librustc_metadata" }

src/librustc_data_structures/lib.rs

-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ extern crate log;
2929
#[macro_use]
3030
extern crate cfg_if;
3131

32-
pub use rustc_serialize::hex::ToHex;
33-
3432
#[inline(never)]
3533
#[cold]
3634
pub fn cold_path<F: FnOnce() -> R, R>(f: F) -> R {

src/librustc_error_codes/error_codes/E0554.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Feature attributes are only allowed on the nightly release channel. Stable or
22
beta compilers will not comply.
33

4-
Example of erroneous code (on a stable compiler):
4+
Erroneous code example:
55

66
```ignore (depends on release channel)
77
#![feature(non_ascii_idents)] // error: `#![feature]` may not be used on the

src/librustc_error_codes/error_codes/E0690.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ struct LengthWithUnit<U> { // error: transparent struct needs exactly one
1414
Because transparent structs are represented exactly like one of their fields at
1515
run time, said field must be uniquely determined. If there is no field, or if
1616
there are multiple fields, it is not clear how the struct should be represented.
17-
Note that fields of zero-typed types (e.g., `PhantomData`) can also exist
17+
Note that fields of zero-sized types (e.g., `PhantomData`) can also exist
1818
alongside the field that contains the actual data, they do not count for this
1919
error. When generic types are involved (as in the above example), an error is
2020
reported because the type parameter could be non-zero-sized.

src/librustc_error_codes/error_codes/E0746.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ Return types cannot be `dyn Trait`s as they must be `Sized`.
22

33
Erroneous code example:
44

5-
```compile_fail,E0277
6-
# // FIXME: after E0746 is in beta, change the above
5+
```compile_fail,E0746
76
trait T {
87
fn bar(&self);
98
}

src/librustc_hir_pretty/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,5 @@ doctest = false
1313
rustc_ast_pretty = { path = "../librustc_ast_pretty" }
1414
rustc_hir = { path = "../librustc_hir" }
1515
rustc_target = { path = "../librustc_target" }
16-
rustc_data_structures = { path = "../librustc_data_structures" }
1716
rustc_span = { path = "../librustc_span" }
1817
rustc_ast = { path = "../librustc_ast" }

src/librustc_interface/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ rustc_codegen_ssa = { path = "../librustc_codegen_ssa" }
3232
rustc_symbol_mangling = { path = "../librustc_symbol_mangling" }
3333
rustc_codegen_llvm = { path = "../librustc_codegen_llvm", optional = true }
3434
rustc_hir = { path = "../librustc_hir" }
35-
rustc_infer = { path = "../librustc_infer" }
3635
rustc_metadata = { path = "../librustc_metadata" }
3736
rustc_mir = { path = "../librustc_mir" }
3837
rustc_mir_build = { path = "../librustc_mir_build" }

src/librustc_lexer/src/lib.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -236,12 +236,17 @@ pub enum Base {
236236
/// (e.g. "#![deny(missing_docs)]").
237237
pub fn strip_shebang(input: &str) -> Option<usize> {
238238
debug_assert!(!input.is_empty());
239-
if !input.starts_with("#!") || input.starts_with("#![") {
239+
let s: &str = &remove_whitespace(input);
240+
if !s.starts_with("#!") || s.starts_with("#![") {
240241
return None;
241242
}
242243
Some(input.find('\n').unwrap_or(input.len()))
243244
}
244245

246+
fn remove_whitespace(s: &str) -> String {
247+
s.chars().filter(|c| !c.is_whitespace()).collect()
248+
}
249+
245250
/// Parses the first token from the provided input string.
246251
pub fn first_token(input: &str) -> Token {
247252
debug_assert!(!input.is_empty());

src/librustc_lexer/src/tests.rs

+18
Original file line numberDiff line numberDiff line change
@@ -145,4 +145,22 @@ mod tests {
145145
}),
146146
);
147147
}
148+
149+
#[test]
150+
fn test_valid_shebang() {
151+
// https://github.com/rust-lang/rust/issues/70528
152+
let input = "#!/usr/bin/rustrun";
153+
let actual = strip_shebang(input);
154+
let expected: Option<usize> = Some(18);
155+
assert_eq!(expected, actual);
156+
}
157+
158+
#[test]
159+
fn test_invalid_shebang_valid_rust_syntax() {
160+
// https://github.com/rust-lang/rust/issues/70528
161+
let input = "#! [bad_attribute]";
162+
let actual = strip_shebang(input);
163+
let expected: Option<usize> = None;
164+
assert_eq!(expected, actual);
165+
}
148166
}

src/librustc_lint/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,4 @@ rustc_data_structures = { path = "../librustc_data_structures" }
2323
rustc_feature = { path = "../librustc_feature" }
2424
rustc_index = { path = "../librustc_index" }
2525
rustc_session = { path = "../librustc_session" }
26-
rustc_infer = { path = "../librustc_infer" }
2726
rustc_trait_selection = { path = "../librustc_trait_selection" }

src/librustc_middle/Cargo.toml

-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ doctest = false
1212
[dependencies]
1313
arena = { path = "../libarena" }
1414
bitflags = "1.2.1"
15-
jobserver = "0.1"
1615
scoped-tls = "1.0"
1716
log = { version = "0.4", features = ["release_max_level_info", "std"] }
1817
rustc-rayon = "0.3.0"
@@ -32,7 +31,6 @@ rustc_serialize = { path = "../libserialize", package = "serialize" }
3231
rustc_ast = { path = "../librustc_ast" }
3332
rustc_span = { path = "../librustc_span" }
3433
backtrace = "0.3.40"
35-
parking_lot = "0.10"
3634
byteorder = { version = "1.3" }
3735
smallvec = { version = "1.0", features = ["union", "may_dangle"] }
3836
measureme = "0.7.1"

src/librustc_mir/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ log = "0.4"
1717
log_settings = "0.1.1"
1818
polonius-engine = "0.12.0"
1919
rustc_middle = { path = "../librustc_middle" }
20-
rustc_ast_pretty = { path = "../librustc_ast_pretty" }
2120
rustc_attr = { path = "../librustc_attr" }
2221
rustc_data_structures = { path = "../librustc_data_structures" }
2322
rustc_errors = { path = "../librustc_errors" }

src/librustc_parse/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ rustc_data_structures = { path = "../librustc_data_structures" }
1717
rustc_feature = { path = "../librustc_feature" }
1818
rustc_lexer = { path = "../librustc_lexer" }
1919
rustc_errors = { path = "../librustc_errors" }
20-
smallvec = { version = "1.0", features = ["union", "may_dangle"] }
2120
rustc_session = { path = "../librustc_session" }
2221
rustc_span = { path = "../librustc_span" }
2322
rustc_ast = { path = "../librustc_ast" }

src/librustc_passes/Cargo.toml

-2
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,8 @@ rustc_middle = { path = "../librustc_middle" }
1414
rustc_attr = { path = "../librustc_attr" }
1515
rustc_data_structures = { path = "../librustc_data_structures" }
1616
rustc_errors = { path = "../librustc_errors" }
17-
rustc_feature = { path = "../librustc_feature" }
1817
rustc_hir = { path = "../librustc_hir" }
1918
rustc_index = { path = "../librustc_index" }
20-
rustc_infer = { path = "../librustc_infer" }
2119
rustc_session = { path = "../librustc_session" }
2220
rustc_target = { path = "../librustc_target" }
2321
rustc_ast = { path = "../librustc_ast" }

0 commit comments

Comments
 (0)