Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 7 pull requests #71410

Merged
merged 22 commits into from
Apr 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
33905ad
Remove unused dependencies
sinkuu Apr 17, 2020
fae4e2a
Remove unused ToHex/FromHex trait
sinkuu Apr 17, 2020
d3c96f0
Suggest `-> impl Trait` and `-> Box<dyn Trait>` on fn that doesn't re…
estebank Apr 10, 2020
e536257
Ensure tail expression will have a `Ty` for E0746
estebank Apr 11, 2020
9fc0833
Stop accessing module level int consts via crate::<Ty>
faern Apr 16, 2020
4ddf661
Define module level int consts from assoc consts
faern Apr 16, 2020
6850e4a
Use assoc float consts instead of module level
faern Apr 16, 2020
9af047f
Fix show-const-contents rustdoc test
faern Apr 20, 2020
0315864
Fix #! (shebang) stripping account space issue #70528
Apr 21, 2020
ee5a212
Refactoring and added test-cases #70528
Apr 21, 2020
365b3cc
Fix formatting issue
Apr 21, 2020
20de922
Fix stage0.txt version number comment
RalfJung Apr 21, 2020
e2901c4
Fix incorrect description of E0690
aticu Apr 21, 2020
1b362cd
Minor refactoring
Apr 21, 2020
410fc9d
Clean up E0554 explanation
GuillaumeGomez Apr 21, 2020
24fb393
Rollup merge of #70998 - estebank:suggest-impl-trait-empty-fn, r=varkor
JohnTitor Apr 22, 2020
567e54f
Rollup merge of #71236 - sinkuu:cleanup, r=nikomatsakis
JohnTitor Apr 22, 2020
f28e387
Rollup merge of #71366 - faern:use-assoc-int-consts3, r=dtolnay
JohnTitor Apr 22, 2020
46a8dce
Rollup merge of #71372 - ayushmishra2005:shebang_stripping, r=estebank
JohnTitor Apr 22, 2020
836a64a
Rollup merge of #71384 - RalfJung:RalfJung-patch-1, r=Mark-Simulacrum
JohnTitor Apr 22, 2020
3efa70f
Rollup merge of #71390 - aticu:master, r=Dylan-DPC
JohnTitor Apr 22, 2020
66eaead
Rollup merge of #71399 - rust-lang:cleanup-e0554, r=Dylan-DPC
JohnTitor Apr 22, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3577,7 +3577,6 @@ version = "0.0.0"
dependencies = [
"log",
"rustc_ast",
"rustc_data_structures",
"rustc_span",
]

Expand All @@ -3594,7 +3593,6 @@ dependencies = [
"rustc_session",
"rustc_span",
"serialize",
"smallvec 1.0.0",
]

[[package]]
Expand Down Expand Up @@ -3666,7 +3664,6 @@ dependencies = [
"rustc_hir",
"rustc_incremental",
"rustc_index",
"rustc_metadata",
"rustc_middle",
"rustc_session",
"rustc_span",
Expand Down Expand Up @@ -3809,7 +3806,6 @@ version = "0.0.0"
dependencies = [
"rustc_ast",
"rustc_ast_pretty",
"rustc_data_structures",
"rustc_hir",
"rustc_span",
"rustc_target",
Expand Down Expand Up @@ -3879,7 +3875,6 @@ dependencies = [
"rustc_expand",
"rustc_hir",
"rustc_incremental",
"rustc_infer",
"rustc_lint",
"rustc_metadata",
"rustc_middle",
Expand Down Expand Up @@ -3924,7 +3919,6 @@ dependencies = [
"rustc_feature",
"rustc_hir",
"rustc_index",
"rustc_infer",
"rustc_middle",
"rustc_session",
"rustc_span",
Expand Down Expand Up @@ -3986,10 +3980,8 @@ dependencies = [
"backtrace",
"bitflags",
"byteorder",
"jobserver",
"log",
"measureme",
"parking_lot 0.10.2",
"polonius-engine",
"rustc-rayon",
"rustc-rayon-core",
Expand Down Expand Up @@ -4023,7 +4015,6 @@ dependencies = [
"polonius-engine",
"rustc_apfloat",
"rustc_ast",
"rustc_ast_pretty",
"rustc_attr",
"rustc_data_structures",
"rustc_errors",
Expand Down Expand Up @@ -4079,7 +4070,6 @@ dependencies = [
"rustc_lexer",
"rustc_session",
"rustc_span",
"smallvec 1.0.0",
"unicode-normalization",
]

Expand All @@ -4092,10 +4082,8 @@ dependencies = [
"rustc_attr",
"rustc_data_structures",
"rustc_errors",
"rustc_feature",
"rustc_hir",
"rustc_index",
"rustc_infer",
"rustc_middle",
"rustc_session",
"rustc_span",
Expand Down Expand Up @@ -4143,7 +4131,6 @@ dependencies = [
"rustc_data_structures",
"rustc_errors",
"rustc_index",
"rustc_macros",
"rustc_span",
"serialize",
"smallvec 1.0.0",
Expand Down Expand Up @@ -4296,10 +4283,8 @@ dependencies = [
"rustc_data_structures",
"rustc_hir",
"rustc_infer",
"rustc_macros",
"rustc_middle",
"rustc_span",
"rustc_target",
"rustc_trait_selection",
"smallvec 1.0.0",
]
Expand Down
1 change: 0 additions & 1 deletion src/libcore/iter/adapters/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use crate::cmp;
use crate::fmt;
use crate::intrinsics;
use crate::ops::{Add, AddAssign, Try};
use crate::usize;

use super::{from_fn, LoopState};
use super::{DoubleEndedIterator, ExactSizeIterator, FusedIterator, Iterator, TrustedLen};
Expand Down
1 change: 0 additions & 1 deletion src/libcore/iter/range.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use crate::convert::TryFrom;
use crate::mem;
use crate::ops::{self, Add, Sub, Try};
use crate::usize;

use super::{FusedIterator, TrustedLen};

Expand Down
1 change: 0 additions & 1 deletion src/libcore/iter/sources.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use crate::fmt;
use crate::marker;
use crate::usize;

use super::{FusedIterator, TrustedLen};

Expand Down
4 changes: 2 additions & 2 deletions src/libcore/num/f32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ impl f32 {
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
pub fn is_infinite(self) -> bool {
self.abs_private() == INFINITY
self.abs_private() == Self::INFINITY
}

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

/// Returns `true` if the number is neither zero, infinite,
Expand Down
4 changes: 2 additions & 2 deletions src/libcore/num/f64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ impl f64 {
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
pub fn is_infinite(self) -> bool {
self.abs_private() == INFINITY
self.abs_private() == Self::INFINITY
}

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

/// Returns `true` if the number is neither zero, infinite,
Expand Down
1 change: 0 additions & 1 deletion src/libcore/num/flt2dec/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

use crate::num::dec2flt::rawfp::RawFloat;
use crate::num::FpCategory;
use crate::{f32, f64};

/// Decoded unsigned finite value, such that:
///
Expand Down
1 change: 0 additions & 1 deletion src/libcore/num/flt2dec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ functions.
)]

pub use self::decoder::{decode, DecodableFloat, Decoded, FullDecoded};
use crate::i16;

pub mod decoder;
pub mod estimator;
Expand Down
4 changes: 2 additions & 2 deletions src/libcore/num/int_macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ macro_rules! int_module {
concat!("The smallest value that can be represented by this integer type.
Use [`", stringify!($T), "::MIN", "`](../../std/primitive.", stringify!($T), ".html#associatedconstant.MIN) instead."),
#[$attr]
pub const MIN: $T = $T::min_value();
pub const MIN: $T = $T::MIN;
}

doc_comment! {
concat!("The largest value that can be represented by this integer type.
Use [`", stringify!($T), "::MAX", "`](../../std/primitive.", stringify!($T), ".html#associatedconstant.MAX) instead."),
#[$attr]
pub const MAX: $T = $T::max_value();
pub const MAX: $T = $T::MAX;
}
)
}
2 changes: 1 addition & 1 deletion src/libcore/slice/memchr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ fn repeat_byte(b: u8) -> usize {
#[cfg(not(target_pointer_width = "16"))]
#[inline]
fn repeat_byte(b: u8) -> usize {
(b as usize) * (crate::usize::MAX / 255)
(b as usize) * (usize::MAX / 255)
}

/// Returns the first index matching the byte `x` in `text`.
Expand Down
1 change: 0 additions & 1 deletion src/libcore/slice/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ use crate::cmp;
use crate::cmp::Ordering::{self, Equal, Greater, Less};
use crate::fmt;
use crate::intrinsics::{assume, exact_div, is_aligned_and_not_null, unchecked_sub};
use crate::isize;
use crate::iter::*;
use crate::marker::{self, Copy, Send, Sized, Sync};
use crate::mem;
Expand Down
1 change: 0 additions & 1 deletion src/libcore/str/pattern.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
use crate::cmp;
use crate::fmt;
use crate::slice::memchr;
use crate::usize;

// Pattern

Expand Down
2 changes: 1 addition & 1 deletion src/libcore/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
//! assert_eq!(Duration::new(5, 0), Duration::from_secs(5));
//! ```

use crate::fmt;
use crate::iter::Sum;
use crate::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Sub, SubAssign};
use crate::{fmt, u64};

const NANOS_PER_SEC: u32 = 1_000_000_000;
const NANOS_PER_MILLI: u32 = 1_000_000;
Expand Down
1 change: 0 additions & 1 deletion src/librustc_ast_pretty/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,4 @@ doctest = false
[dependencies]
log = "0.4"
rustc_span = { path = "../librustc_span" }
rustc_data_structures = { path = "../librustc_data_structures" }
rustc_ast = { path = "../librustc_ast" }
1 change: 0 additions & 1 deletion src/librustc_attr/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,5 @@ rustc_span = { path = "../librustc_span" }
rustc_data_structures = { path = "../librustc_data_structures" }
rustc_feature = { path = "../librustc_feature" }
rustc_macros = { path = "../librustc_macros" }
smallvec = { version = "1.0", features = ["union", "may_dangle"] }
rustc_session = { path = "../librustc_session" }
rustc_ast = { path = "../librustc_ast" }
1 change: 0 additions & 1 deletion src/librustc_codegen_ssa/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,3 @@ rustc_incremental = { path = "../librustc_incremental" }
rustc_index = { path = "../librustc_index" }
rustc_target = { path = "../librustc_target" }
rustc_session = { path = "../librustc_session" }
rustc_metadata = { path = "../librustc_metadata" }
2 changes: 0 additions & 2 deletions src/librustc_data_structures/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ extern crate log;
#[macro_use]
extern crate cfg_if;

pub use rustc_serialize::hex::ToHex;

#[inline(never)]
#[cold]
pub fn cold_path<F: FnOnce() -> R, R>(f: F) -> R {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_error_codes/error_codes/E0554.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Feature attributes are only allowed on the nightly release channel. Stable or
beta compilers will not comply.

Example of erroneous code (on a stable compiler):
Erroneous code example:

```ignore (depends on release channel)
#![feature(non_ascii_idents)] // error: `#![feature]` may not be used on the
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_error_codes/error_codes/E0690.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ struct LengthWithUnit<U> { // error: transparent struct needs exactly one
Because transparent structs are represented exactly like one of their fields at
run time, said field must be uniquely determined. If there is no field, or if
there are multiple fields, it is not clear how the struct should be represented.
Note that fields of zero-typed types (e.g., `PhantomData`) can also exist
Note that fields of zero-sized types (e.g., `PhantomData`) can also exist
alongside the field that contains the actual data, they do not count for this
error. When generic types are involved (as in the above example), an error is
reported because the type parameter could be non-zero-sized.
Expand Down
3 changes: 1 addition & 2 deletions src/librustc_error_codes/error_codes/E0746.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ Return types cannot be `dyn Trait`s as they must be `Sized`.

Erroneous code example:

```compile_fail,E0277
# // FIXME: after E0746 is in beta, change the above
```compile_fail,E0746
trait T {
fn bar(&self);
}
Expand Down
1 change: 0 additions & 1 deletion src/librustc_hir_pretty/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,5 @@ doctest = false
rustc_ast_pretty = { path = "../librustc_ast_pretty" }
rustc_hir = { path = "../librustc_hir" }
rustc_target = { path = "../librustc_target" }
rustc_data_structures = { path = "../librustc_data_structures" }
rustc_span = { path = "../librustc_span" }
rustc_ast = { path = "../librustc_ast" }
1 change: 0 additions & 1 deletion src/librustc_interface/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ rustc_codegen_ssa = { path = "../librustc_codegen_ssa" }
rustc_symbol_mangling = { path = "../librustc_symbol_mangling" }
rustc_codegen_llvm = { path = "../librustc_codegen_llvm", optional = true }
rustc_hir = { path = "../librustc_hir" }
rustc_infer = { path = "../librustc_infer" }
rustc_metadata = { path = "../librustc_metadata" }
rustc_mir = { path = "../librustc_mir" }
rustc_mir_build = { path = "../librustc_mir_build" }
Expand Down
7 changes: 6 additions & 1 deletion src/librustc_lexer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,12 +236,17 @@ pub enum Base {
/// (e.g. "#![deny(missing_docs)]").
pub fn strip_shebang(input: &str) -> Option<usize> {
debug_assert!(!input.is_empty());
if !input.starts_with("#!") || input.starts_with("#![") {
let s: &str = &remove_whitespace(input);
if !s.starts_with("#!") || s.starts_with("#![") {
return None;
}
Some(input.find('\n').unwrap_or(input.len()))
}

fn remove_whitespace(s: &str) -> String {
s.chars().filter(|c| !c.is_whitespace()).collect()
}

/// Parses the first token from the provided input string.
pub fn first_token(input: &str) -> Token {
debug_assert!(!input.is_empty());
Expand Down
18 changes: 18 additions & 0 deletions src/librustc_lexer/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,22 @@ mod tests {
}),
);
}

#[test]
fn test_valid_shebang() {
// https://github.com/rust-lang/rust/issues/70528
let input = "#!/usr/bin/rustrun";
let actual = strip_shebang(input);
let expected: Option<usize> = Some(18);
assert_eq!(expected, actual);
}

#[test]
fn test_invalid_shebang_valid_rust_syntax() {
// https://github.com/rust-lang/rust/issues/70528
let input = "#! [bad_attribute]";
let actual = strip_shebang(input);
let expected: Option<usize> = None;
assert_eq!(expected, actual);
}
}
1 change: 0 additions & 1 deletion src/librustc_lint/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,4 @@ rustc_data_structures = { path = "../librustc_data_structures" }
rustc_feature = { path = "../librustc_feature" }
rustc_index = { path = "../librustc_index" }
rustc_session = { path = "../librustc_session" }
rustc_infer = { path = "../librustc_infer" }
rustc_trait_selection = { path = "../librustc_trait_selection" }
2 changes: 0 additions & 2 deletions src/librustc_middle/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ doctest = false
[dependencies]
arena = { path = "../libarena" }
bitflags = "1.2.1"
jobserver = "0.1"
scoped-tls = "1.0"
log = { version = "0.4", features = ["release_max_level_info", "std"] }
rustc-rayon = "0.3.0"
Expand All @@ -32,7 +31,6 @@ rustc_serialize = { path = "../libserialize", package = "serialize" }
rustc_ast = { path = "../librustc_ast" }
rustc_span = { path = "../librustc_span" }
backtrace = "0.3.40"
parking_lot = "0.10"
byteorder = { version = "1.3" }
smallvec = { version = "1.0", features = ["union", "may_dangle"] }
measureme = "0.7.1"
Expand Down
1 change: 0 additions & 1 deletion src/librustc_mir/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ log = "0.4"
log_settings = "0.1.1"
polonius-engine = "0.12.0"
rustc_middle = { path = "../librustc_middle" }
rustc_ast_pretty = { path = "../librustc_ast_pretty" }
rustc_attr = { path = "../librustc_attr" }
rustc_data_structures = { path = "../librustc_data_structures" }
rustc_errors = { path = "../librustc_errors" }
Expand Down
1 change: 0 additions & 1 deletion src/librustc_parse/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ rustc_data_structures = { path = "../librustc_data_structures" }
rustc_feature = { path = "../librustc_feature" }
rustc_lexer = { path = "../librustc_lexer" }
rustc_errors = { path = "../librustc_errors" }
smallvec = { version = "1.0", features = ["union", "may_dangle"] }
rustc_session = { path = "../librustc_session" }
rustc_span = { path = "../librustc_span" }
rustc_ast = { path = "../librustc_ast" }
Expand Down
2 changes: 0 additions & 2 deletions src/librustc_passes/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@ rustc_middle = { path = "../librustc_middle" }
rustc_attr = { path = "../librustc_attr" }
rustc_data_structures = { path = "../librustc_data_structures" }
rustc_errors = { path = "../librustc_errors" }
rustc_feature = { path = "../librustc_feature" }
rustc_hir = { path = "../librustc_hir" }
rustc_index = { path = "../librustc_index" }
rustc_infer = { path = "../librustc_infer" }
rustc_session = { path = "../librustc_session" }
rustc_target = { path = "../librustc_target" }
rustc_ast = { path = "../librustc_ast" }
Expand Down
Loading