Skip to content

Commit 43a5ff4

Browse files
committed
Auto merge of #64264 - Centril:rollup-w1khzun, r=Centril
Rollup of 7 pull requests Successful merges: - #64023 (libstd fuchsia fixes) - #64098 (Ensure edition lints and internal lints are enabled with deny-warnings=false) - #64139 (Migrate internal diagnostic registration to macro_rules) - #64226 (Aggregation of cosmetic changes made during work on REPL PRs: libsyntax) - #64227 (Aggregation of cosmetic changes made during work on REPL PRs: librustc) - #64235 (Upgrade env_logger to 0.6) - #64258 (compiletest: Match suffixed environments) Failed merges: r? @ghost
2 parents ef54f57 + 635c3bc commit 43a5ff4

File tree

133 files changed

+1805
-2036
lines changed

Some content is hidden

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

133 files changed

+1805
-2036
lines changed

Cargo.lock

+12-28
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ dependencies = [
277277
"crypto-hash",
278278
"curl",
279279
"curl-sys",
280-
"env_logger 0.6.0",
280+
"env_logger",
281281
"failure",
282282
"filetime",
283283
"flate2",
@@ -507,7 +507,7 @@ name = "compiletest"
507507
version = "0.0.0"
508508
dependencies = [
509509
"diff",
510-
"env_logger 0.5.13",
510+
"env_logger",
511511
"getopts",
512512
"lazy_static 1.3.0",
513513
"libc",
@@ -909,21 +909,9 @@ dependencies = [
909909

910910
[[package]]
911911
name = "env_logger"
912-
version = "0.5.13"
913-
source = "registry+https://github.com/rust-lang/crates.io-index"
914-
checksum = "15b0a4d2e39f8420210be8b27eeda28029729e2fd4291019455016c348240c38"
915-
dependencies = [
916-
"atty",
917-
"humantime",
918-
"log",
919-
"termcolor",
920-
]
921-
922-
[[package]]
923-
name = "env_logger"
924-
version = "0.6.0"
912+
version = "0.6.2"
925913
source = "registry+https://github.com/rust-lang/crates.io-index"
926-
checksum = "afb070faf94c85d17d50ca44f6ad076bce18ae92f0037d350947240a36e9d42e"
914+
checksum = "aafcde04e90a5226a6443b7aabdb016ba2f8307c847d524724bd9b346dd1a2d3"
927915
dependencies = [
928916
"atty",
929917
"humantime",
@@ -1774,7 +1762,7 @@ dependencies = [
17741762
"chrono",
17751763
"clap",
17761764
"elasticlunr-rs",
1777-
"env_logger 0.6.0",
1765+
"env_logger",
17781766
"error-chain",
17791767
"handlebars",
17801768
"itertools 0.8.0",
@@ -1799,7 +1787,7 @@ version = "0.3.0"
17991787
source = "registry+https://github.com/rust-lang/crates.io-index"
18001788
checksum = "77d1f0ba4d1e6b86fa18e8853d026d7d76a97eb7eb5eb052ed80901e43b7fc10"
18011789
dependencies = [
1802-
"env_logger 0.6.0",
1790+
"env_logger",
18031791
"failure",
18041792
"log",
18051793
"mdbook",
@@ -1992,7 +1980,7 @@ dependencies = [
19921980
"colored",
19931981
"compiletest_rs",
19941982
"directories",
1995-
"env_logger 0.6.0",
1983+
"env_logger",
19961984
"getrandom",
19971985
"hex",
19981986
"log",
@@ -2363,7 +2351,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
23632351
checksum = "df8b3f4e0475def7d9c2e5de8e5a1306949849761e107b360d03e98eafaffd61"
23642352
dependencies = [
23652353
"chrono",
2366-
"env_logger 0.6.0",
2354+
"env_logger",
23672355
"log",
23682356
]
23692357

@@ -2440,7 +2428,7 @@ dependencies = [
24402428
"bitflags",
24412429
"clap",
24422430
"derive_more",
2443-
"env_logger 0.6.0",
2431+
"env_logger",
24442432
"humantime",
24452433
"lazy_static 1.3.0",
24462434
"log",
@@ -2734,7 +2722,7 @@ dependencies = [
27342722
"clippy_lints",
27352723
"crossbeam-channel",
27362724
"difference",
2737-
"env_logger 0.6.0",
2725+
"env_logger",
27382726
"failure",
27392727
"futures",
27402728
"heck",
@@ -3129,11 +3117,7 @@ dependencies = [
31293117
name = "rustc_codegen_llvm"
31303118
version = "0.0.0"
31313119
dependencies = [
3132-
"cc",
3133-
"memmap",
3134-
"num_cpus",
31353120
"rustc_llvm",
3136-
"tempfile",
31373121
]
31383122

31393123
[[package]]
@@ -3203,7 +3187,7 @@ dependencies = [
32033187
name = "rustc_driver"
32043188
version = "0.0.0"
32053189
dependencies = [
3206-
"env_logger 0.5.13",
3190+
"env_logger",
32073191
"graphviz",
32083192
"log",
32093193
"rustc",
@@ -3590,7 +3574,7 @@ dependencies = [
35903574
"derive-new",
35913575
"diff",
35923576
"dirs",
3593-
"env_logger 0.6.0",
3577+
"env_logger",
35943578
"failure",
35953579
"getopts",
35963580
"ignore",

src/bootstrap/bin/rustc.rs

+7-6
Original file line numberDiff line numberDiff line change
@@ -119,17 +119,18 @@ fn main() {
119119
cmd.arg(format!("-Cdebuginfo={}", debuginfo_level));
120120
}
121121

122-
if env::var_os("RUSTC_DENY_WARNINGS").is_some() &&
123-
env::var_os("RUSTC_EXTERNAL_TOOL").is_none() {
122+
if env::var_os("RUSTC_EXTERNAL_TOOL").is_none() {
124123
// When extending this list, add the new lints to the RUSTFLAGS of the
125124
// build_bootstrap function of src/bootstrap/bootstrap.py as well as
126125
// some code doesn't go through this `rustc` wrapper.
127-
cmd.arg("-Dwarnings");
128-
cmd.arg("-Drust_2018_idioms");
129-
cmd.arg("-Dunused_lifetimes");
126+
cmd.arg("-Wrust_2018_idioms");
127+
cmd.arg("-Wunused_lifetimes");
130128
if use_internal_lints(crate_name) {
131129
cmd.arg("-Zunstable-options");
132-
cmd.arg("-Drustc::internal");
130+
cmd.arg("-Wrustc::internal");
131+
}
132+
if env::var_os("RUSTC_DENY_WARNINGS").is_some() {
133+
cmd.arg("-Dwarnings");
133134
}
134135
}
135136

src/bootstrap/bootstrap.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -631,8 +631,9 @@ def build_bootstrap(self):
631631
target_linker = self.get_toml("linker", build_section)
632632
if target_linker is not None:
633633
env["RUSTFLAGS"] += "-C linker=" + target_linker + " "
634+
env["RUSTFLAGS"] += " -Wrust_2018_idioms -Wunused_lifetimes "
634635
if self.get_toml("deny-warnings", "rust") != "false":
635-
env["RUSTFLAGS"] += "-Dwarnings -Drust_2018_idioms -Dunused_lifetimes "
636+
env["RUSTFLAGS"] += "-Dwarnings "
636637

637638
env["PATH"] = os.path.join(self.bin_root(), "bin") + \
638639
os.pathsep + env["PATH"]

src/bootstrap/flags.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ pub struct Flags {
3636
// This overrides the deny-warnings configuation option,
3737
// which passes -Dwarnings to the compiler invocations.
3838
//
39-
// true => deny, false => allow
39+
// true => deny, false => warn
4040
pub deny_warnings: Option<bool>,
4141
}
4242

@@ -556,10 +556,10 @@ fn split(s: &[String]) -> Vec<String> {
556556
fn parse_deny_warnings(matches: &getopts::Matches) -> Option<bool> {
557557
match matches.opt_str("warnings").as_ref().map(|v| v.as_str()) {
558558
Some("deny") => Some(true),
559-
Some("allow") => Some(false),
559+
Some("warn") => Some(false),
560560
Some(value) => {
561561
eprintln!(
562-
r#"invalid value for --warnings: {:?}, expected "allow" or "deny""#,
562+
r#"invalid value for --warnings: {:?}, expected "warn" or "deny""#,
563563
value,
564564
);
565565
process::exit(1);

src/bootstrap/test.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -1327,7 +1327,10 @@ impl Step for Compiletest {
13271327
cmd.env("RUSTC_PROFILER_SUPPORT", "1");
13281328
}
13291329

1330-
cmd.env("RUST_TEST_TMPDIR", builder.out.join("tmp"));
1330+
let tmp = builder.out.join("tmp");
1331+
std::fs::create_dir_all(&tmp).unwrap();
1332+
cmd.env("RUST_TEST_TMPDIR", tmp);
1333+
13311334

13321335
cmd.arg("--adb-path").arg("adb");
13331336
cmd.arg("--adb-test-dir").arg(ADB_TEST_DIR);

src/librustc/arena.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ impl<T: Copy> ArenaAllocatable for T {}
187187

188188
unsafe trait ArenaField<'tcx>: Sized {
189189
/// Returns a specific arena to allocate from.
190-
/// If None is returned, the DropArena will be used.
190+
/// If `None` is returned, the `DropArena` will be used.
191191
fn arena<'a>(arena: &'a Arena<'tcx>) -> Option<&'a TypedArena<Self>>;
192192
}
193193

src/librustc/error_codes.rs

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// Error messages for EXXXX errors.
2-
// Each message should start and end with a new line, and be wrapped to 80 characters.
3-
// In vim you can `:set tw=80` and use `gq` to wrap paragraphs. Use `:set tw=0` to disable.
4-
register_long_diagnostics! {
2+
// Each message should start and end with a new line, and be wrapped to 80
3+
// characters. In vim you can `:set tw=80` and use `gq` to wrap paragraphs. Use
4+
// `:set tw=0` to disable.
5+
syntax::register_diagnostics! {
56
E0038: r##"
67
Trait objects like `Box<Trait>` can only be constructed when certain
78
requirements are satisfied by the trait in question.
@@ -2183,11 +2184,7 @@ Examples of erroneous code:
21832184
static X: u32 = 42;
21842185
```
21852186
"##,
2186-
2187-
}
2188-
2189-
2190-
register_diagnostics! {
2187+
;
21912188
// E0006, // merged with E0005
21922189
// E0101, // replaced with E0282
21932190
// E0102, // replaced with E0282
@@ -2206,7 +2203,8 @@ register_diagnostics! {
22062203
// E0305, // expected constant
22072204
E0311, // thing may not live long enough
22082205
E0312, // lifetime of reference outlives lifetime of borrowed content
2209-
E0313, // lifetime of borrowed pointer outlives lifetime of captured variable
2206+
E0313, // lifetime of borrowed pointer outlives lifetime of captured
2207+
// variable
22102208
E0314, // closure outlives stack frame
22112209
E0315, // cannot invoke closure outside of its lifetime
22122210
E0316, // nested quantification of lifetimes
@@ -2223,12 +2221,13 @@ register_diagnostics! {
22232221
E0483, // lifetime of operand does not outlive the operation
22242222
E0484, // reference is not valid at the time of borrow
22252223
E0485, // automatically reference is not valid at the time of borrow
2226-
E0486, // type of expression contains references that are not valid during...
2224+
E0486, // type of expression contains references that are not valid during..
22272225
E0487, // unsafe use of destructor: destructor might be called while...
22282226
E0488, // lifetime of variable does not enclose its declaration
22292227
E0489, // type/lifetime parameter not in scope here
22302228
E0490, // a value of type `..` is borrowed for too long
2231-
E0495, // cannot infer an appropriate lifetime due to conflicting requirements
2229+
E0495, // cannot infer an appropriate lifetime due to conflicting
2230+
// requirements
22322231
E0566, // conflicting representation hints
22332232
E0623, // lifetime mismatch where both parameters are anonymous regions
22342233
E0628, // generators cannot have explicit parameters
@@ -2239,7 +2238,8 @@ register_diagnostics! {
22392238
E0688, // in-band lifetimes cannot be mixed with explicit lifetime binders
22402239
E0697, // closures cannot be static
22412240
E0707, // multiple elided lifetimes used in arguments of `async fn`
2242-
E0708, // `async` non-`move` closures with parameters are not currently supported
2241+
E0708, // `async` non-`move` closures with parameters are not currently
2242+
// supported
22432243
E0709, // multiple different lifetimes used in arguments of `async fn`
22442244
E0710, // an unknown tool name found in scoped lint
22452245
E0711, // a feature has been declared with conflicting stability attributes

src/librustc/hir/check_attr.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@
44
//! conflicts between multiple such attributes attached to the same
55
//! item.
66
7-
8-
use crate::ty::TyCtxt;
9-
use crate::ty::query::Providers;
10-
117
use crate::hir;
128
use crate::hir::def_id::DefId;
139
use crate::hir::intravisit::{self, Visitor, NestedVisitorMap};
10+
use crate::ty::TyCtxt;
11+
use crate::ty::query::Providers;
12+
1413
use std::fmt::{self, Display};
1514
use syntax::symbol::sym;
1615
use syntax_pos::Span;

src/librustc/hir/def.rs

+14-8
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1+
use self::Namespace::*;
2+
13
use crate::hir::def_id::{DefId, CRATE_DEF_INDEX, LOCAL_CRATE};
4+
use crate::hir;
5+
use crate::ty;
26
use crate::util::nodemap::DefIdMap;
7+
38
use syntax::ast;
49
use syntax::ext::base::MacroKind;
510
use syntax::ast::NodeId;
611
use syntax_pos::Span;
712
use rustc_macros::HashStable;
8-
use crate::hir;
9-
use crate::ty;
10-
use std::fmt::Debug;
1113

12-
use self::Namespace::*;
14+
use std::fmt::Debug;
1315

1416
/// Encodes if a `DefKind::Ctor` is the constructor of an enum variant or a struct.
1517
#[derive(Clone, Copy, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, HashStable)]
@@ -115,7 +117,7 @@ impl DefKind {
115117
}
116118
}
117119

118-
/// An English article for the def.
120+
/// Gets an English article for the definition.
119121
pub fn article(&self) -> &'static str {
120122
match *self {
121123
DefKind::AssocTy
@@ -134,18 +136,22 @@ pub enum Res<Id = hir::HirId> {
134136
Def(DefKind, DefId),
135137

136138
// Type namespace
139+
137140
PrimTy(hir::PrimTy),
138141
SelfTy(Option<DefId> /* trait */, Option<DefId> /* impl */),
139142
ToolMod, // e.g., `rustfmt` in `#[rustfmt::skip]`
140143

141144
// Value namespace
145+
142146
SelfCtor(DefId /* impl */), // `DefId` refers to the impl
143147
Local(Id),
144148

145149
// Macro namespace
150+
146151
NonMacroAttr(NonMacroAttrKind), // e.g., `#[inline]` or `#[rustfmt::skip]`
147152

148153
// All namespaces
154+
149155
Err,
150156
}
151157

@@ -330,7 +336,7 @@ impl NonMacroAttrKind {
330336
}
331337

332338
impl<Id> Res<Id> {
333-
/// Return the `DefId` of this `Def` if it has an id, else panic.
339+
/// Return the `DefId` of this `Def` if it has an ID, else panic.
334340
pub fn def_id(&self) -> DefId
335341
where
336342
Id: Debug,
@@ -340,7 +346,7 @@ impl<Id> Res<Id> {
340346
})
341347
}
342348

343-
/// Return `Some(..)` with the `DefId` of this `Res` if it has a id, else `None`.
349+
/// Return `Some(..)` with the `DefId` of this `Res` if it has a ID, else `None`.
344350
pub fn opt_def_id(&self) -> Option<DefId> {
345351
match *self {
346352
Res::Def(_, id) => Some(id),
@@ -379,7 +385,7 @@ impl<Id> Res<Id> {
379385
}
380386
}
381387

382-
/// An English article for the res.
388+
/// Gets an English article for the `Res`.
383389
pub fn article(&self) -> &'static str {
384390
match *self {
385391
Res::Def(kind, _) => kind.article(),

src/librustc/hir/def_id.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ newtype_index! {
1111

1212
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
1313
pub enum CrateNum {
14-
/// A special CrateNum that we use for the tcx.rcache when decoding from
14+
/// A special `CrateNum` that we use for the `tcx.rcache` when decoding from
1515
/// the incr. comp. cache.
1616
ReservedForIncrCompCache,
1717
Index(CrateId),
@@ -26,11 +26,10 @@ impl ::std::fmt::Debug for CrateNum {
2626
}
2727
}
2828

29-
/// Item definitions in the currently-compiled crate would have the CrateNum
30-
/// LOCAL_CRATE in their DefId.
29+
/// Item definitions in the currently-compiled crate would have the `CrateNum`
30+
/// `LOCAL_CRATE` in their `DefId`.
3131
pub const LOCAL_CRATE: CrateNum = CrateNum::Index(CrateId::from_u32_const(0));
3232

33-
3433
impl Idx for CrateNum {
3534
#[inline]
3635
fn new(value: usize) -> Self {

0 commit comments

Comments
 (0)