Skip to content

Rollup of 6 pull requests #64257

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

Closed
wants to merge 19 commits into from
Closed
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
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
36 changes: 12 additions & 24 deletions Cargo.lock
Original file line number Diff line number Diff line change
@@ -277,7 +277,7 @@ dependencies = [
"crypto-hash",
"curl",
"curl-sys",
"env_logger 0.6.0",
"env_logger",
"failure",
"filetime",
"flate2",
@@ -507,7 +507,7 @@ name = "compiletest"
version = "0.0.0"
dependencies = [
"diff",
"env_logger 0.5.13",
"env_logger",
"getopts",
"lazy_static 1.3.0",
"libc",
@@ -909,21 +909,9 @@ dependencies = [

[[package]]
name = "env_logger"
version = "0.5.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "15b0a4d2e39f8420210be8b27eeda28029729e2fd4291019455016c348240c38"
dependencies = [
"atty",
"humantime",
"log",
"termcolor",
]

[[package]]
name = "env_logger"
version = "0.6.0"
version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "afb070faf94c85d17d50ca44f6ad076bce18ae92f0037d350947240a36e9d42e"
checksum = "aafcde04e90a5226a6443b7aabdb016ba2f8307c847d524724bd9b346dd1a2d3"
dependencies = [
"atty",
"humantime",
@@ -1774,7 +1762,7 @@ dependencies = [
"chrono",
"clap",
"elasticlunr-rs",
"env_logger 0.6.0",
"env_logger",
"error-chain",
"handlebars",
"itertools 0.8.0",
@@ -1799,7 +1787,7 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77d1f0ba4d1e6b86fa18e8853d026d7d76a97eb7eb5eb052ed80901e43b7fc10"
dependencies = [
"env_logger 0.6.0",
"env_logger",
"failure",
"log",
"mdbook",
@@ -1992,7 +1980,7 @@ dependencies = [
"colored",
"compiletest_rs",
"directories",
"env_logger 0.6.0",
"env_logger",
"getrandom",
"hex",
"log",
@@ -2363,7 +2351,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df8b3f4e0475def7d9c2e5de8e5a1306949849761e107b360d03e98eafaffd61"
dependencies = [
"chrono",
"env_logger 0.6.0",
"env_logger",
"log",
]

@@ -2440,7 +2428,7 @@ dependencies = [
"bitflags",
"clap",
"derive_more",
"env_logger 0.6.0",
"env_logger",
"humantime",
"lazy_static 1.3.0",
"log",
@@ -2734,7 +2722,7 @@ dependencies = [
"clippy_lints",
"crossbeam-channel",
"difference",
"env_logger 0.6.0",
"env_logger",
"failure",
"futures",
"heck",
@@ -3203,7 +3191,7 @@ dependencies = [
name = "rustc_driver"
version = "0.0.0"
dependencies = [
"env_logger 0.5.13",
"env_logger",
"graphviz",
"log",
"rustc",
@@ -3590,7 +3578,7 @@ dependencies = [
"derive-new",
"diff",
"dirs",
"env_logger 0.6.0",
"env_logger",
"failure",
"getopts",
"ignore",
13 changes: 7 additions & 6 deletions src/bootstrap/bin/rustc.rs
Original file line number Diff line number Diff line change
@@ -119,17 +119,18 @@ fn main() {
cmd.arg(format!("-Cdebuginfo={}", debuginfo_level));
}

if env::var_os("RUSTC_DENY_WARNINGS").is_some() &&
env::var_os("RUSTC_EXTERNAL_TOOL").is_none() {
if env::var_os("RUSTC_EXTERNAL_TOOL").is_none() {
// When extending this list, add the new lints to the RUSTFLAGS of the
// build_bootstrap function of src/bootstrap/bootstrap.py as well as
// some code doesn't go through this `rustc` wrapper.
cmd.arg("-Dwarnings");
cmd.arg("-Drust_2018_idioms");
cmd.arg("-Dunused_lifetimes");
cmd.arg("-Wrust_2018_idioms");
cmd.arg("-Wunused_lifetimes");
if use_internal_lints(crate_name) {
cmd.arg("-Zunstable-options");
cmd.arg("-Drustc::internal");
cmd.arg("-Wrustc::internal");
}
if env::var_os("RUSTC_DENY_WARNINGS").is_some() {
cmd.arg("-Dwarnings");
}
}

3 changes: 2 additions & 1 deletion src/bootstrap/bootstrap.py
Original file line number Diff line number Diff line change
@@ -631,8 +631,9 @@ def build_bootstrap(self):
target_linker = self.get_toml("linker", build_section)
if target_linker is not None:
env["RUSTFLAGS"] += "-C linker=" + target_linker + " "
env["RUSTFLAGS"] += " -Wrust_2018_idioms -Wunused_lifetimes "
if self.get_toml("deny-warnings", "rust") != "false":
env["RUSTFLAGS"] += "-Dwarnings -Drust_2018_idioms -Dunused_lifetimes "
env["RUSTFLAGS"] += "-Dwarnings "

env["PATH"] = os.path.join(self.bin_root(), "bin") + \
os.pathsep + env["PATH"]
6 changes: 3 additions & 3 deletions src/bootstrap/flags.rs
Original file line number Diff line number Diff line change
@@ -36,7 +36,7 @@ pub struct Flags {
// This overrides the deny-warnings configuation option,
// which passes -Dwarnings to the compiler invocations.
//
// true => deny, false => allow
// true => deny, false => warn
pub deny_warnings: Option<bool>,
}

@@ -556,10 +556,10 @@ fn split(s: &[String]) -> Vec<String> {
fn parse_deny_warnings(matches: &getopts::Matches) -> Option<bool> {
match matches.opt_str("warnings").as_ref().map(|v| v.as_str()) {
Some("deny") => Some(true),
Some("allow") => Some(false),
Some("warn") => Some(false),
Some(value) => {
eprintln!(
r#"invalid value for --warnings: {:?}, expected "allow" or "deny""#,
r#"invalid value for --warnings: {:?}, expected "warn" or "deny""#,
value,
);
process::exit(1);
2 changes: 1 addition & 1 deletion src/doc/rustc-guide
2 changes: 1 addition & 1 deletion src/librustc/arena.rs
Original file line number Diff line number Diff line change
@@ -187,7 +187,7 @@ impl<T: Copy> ArenaAllocatable for T {}

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

7 changes: 3 additions & 4 deletions src/librustc/hir/check_attr.rs
Original file line number Diff line number Diff line change
@@ -4,13 +4,12 @@
//! conflicts between multiple such attributes attached to the same
//! item.


use crate::ty::TyCtxt;
use crate::ty::query::Providers;

use crate::hir;
use crate::hir::def_id::DefId;
use crate::hir::intravisit::{self, Visitor, NestedVisitorMap};
use crate::ty::TyCtxt;
use crate::ty::query::Providers;

use std::fmt::{self, Display};
use syntax::symbol::sym;
use syntax_pos::Span;
22 changes: 14 additions & 8 deletions src/librustc/hir/def.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
use self::Namespace::*;

use crate::hir::def_id::{DefId, CRATE_DEF_INDEX, LOCAL_CRATE};
use crate::hir;
use crate::ty;
use crate::util::nodemap::DefIdMap;

use syntax::ast;
use syntax::ext::base::MacroKind;
use syntax::ast::NodeId;
use syntax_pos::Span;
use rustc_macros::HashStable;
use crate::hir;
use crate::ty;
use std::fmt::Debug;

use self::Namespace::*;
use std::fmt::Debug;

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

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

// Type namespace

PrimTy(hir::PrimTy),
SelfTy(Option<DefId> /* trait */, Option<DefId> /* impl */),
ToolMod, // e.g., `rustfmt` in `#[rustfmt::skip]`

// Value namespace

SelfCtor(DefId /* impl */), // `DefId` refers to the impl
Local(Id),

// Macro namespace

NonMacroAttr(NonMacroAttrKind), // e.g., `#[inline]` or `#[rustfmt::skip]`

// All namespaces

Err,
}

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

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

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

/// An English article for the res.
/// Gets an English article for the `Res`.
pub fn article(&self) -> &'static str {
match *self {
Res::Def(kind, _) => kind.article(),
7 changes: 3 additions & 4 deletions src/librustc/hir/def_id.rs
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@ newtype_index! {

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

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


impl Idx for CrateNum {
#[inline]
fn new(value: usize) -> Self {
20 changes: 11 additions & 9 deletions src/librustc/hir/intravisit.rs
Original file line number Diff line number Diff line change
@@ -31,11 +31,13 @@
//! This order consistency is required in a few places in rustc, for
//! example generator inference, and possibly also HIR borrowck.

use syntax::ast::{Ident, Name, Attribute};
use syntax_pos::Span;
use super::itemlikevisit::DeepVisitor;

use crate::hir::*;
use crate::hir::map::Map;
use super::itemlikevisit::DeepVisitor;

use syntax::ast::{Ident, Name, Attribute};
use syntax_pos::Span;

#[derive(Copy, Clone)]
pub enum FnKind<'a> {
@@ -139,7 +141,7 @@ impl<'this, 'tcx> NestedVisitorMap<'this, 'tcx> {
/// explicitly, you need to override each method. (And you also need
/// to monitor future changes to `Visitor` in case a new method with a
/// new default implementation gets introduced.)
pub trait Visitor<'v> : Sized {
pub trait Visitor<'v>: Sized {
///////////////////////////////////////////////////////////////////////////
// Nested items.

@@ -162,8 +164,8 @@ pub trait Visitor<'v> : Sized {
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'v>;

/// Invoked when a nested item is encountered. By default does
/// nothing unless you override `nested_visit_map` to return
/// `Some(_)`, in which case it will walk the item. **You probably
/// nothing unless you override `nested_visit_map` to return other than
/// `None`, in which case it will walk the item. **You probably
/// don't want to override this method** -- instead, override
/// `nested_visit_map` or use the "shallow" or "deep" visit
/// patterns described on `itemlikevisit::ItemLikeVisitor`. The only
@@ -201,8 +203,8 @@ pub trait Visitor<'v> : Sized {

/// Invoked to visit the body of a function, method or closure. Like
/// visit_nested_item, does nothing by default unless you override
/// `nested_visit_map` to return `Some(_)`, in which case it will walk the
/// body.
/// `nested_visit_map` to return other htan `None`, in which case it will walk
/// the body.
fn visit_nested_body(&mut self, id: BodyId) {
let opt_body = self.nested_visit_map().intra().map(|map| map.body(id));
if let Some(body) = opt_body {
@@ -603,7 +605,7 @@ pub fn walk_ty<'v, V: Visitor<'v>>(visitor: &mut V, typ: &'v Ty) {
visitor.visit_lifetime(lifetime);
visitor.visit_ty(&mutable_type.ty)
}
TyKind::Never => {},
TyKind::Never => {}
TyKind::Tup(ref tuple_element_types) => {
walk_list!(visitor, visit_ty, tuple_element_types);
}
Loading