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 13 pull requests #62419

Merged
merged 46 commits into from
Jul 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
7d0a952
Implement initernal lint LINT_PASS_IMPL_WITHOUT_MACRO
flip1995 May 2, 2019
37f09cb
Only allow {declare,impl}_lint_pass macros for implementing LintPass
flip1995 Jun 13, 2019
084c829
Enable internal lints in bootstrap
flip1995 Jun 17, 2019
65c81de
Allow default_hash_types in some crates
flip1995 Jun 17, 2019
08b81f2
Rename internal -> rustc::internal
flip1995 Jun 17, 2019
7de6f54
Turn internal lints into tool lints
flip1995 Jun 24, 2019
8e087cd
Use symbols in lint tool list
flip1995 Jun 24, 2019
d0625a3
Allow usage_of_ty_tykind only in sty
flip1995 Jun 24, 2019
e475539
Add MemoryExtra in InterpretCx constructor params
pvdrz Jun 26, 2019
e32b8eb
Remove default bound for Machine::MemoryExtra
pvdrz Jun 26, 2019
0ffb643
Make sure `#[rustc_doc_only_macro]` and other rustc attributes are re…
petrochenkov Jun 29, 2019
e4e7eb2
Feature gate `rustc` attributes harder
petrochenkov Jun 30, 2019
e45bbaf
Fix merge conflicts
pvdrz Jul 4, 2019
7987719
remove FIXMEs for functions that won't go away
ljedrz Jun 27, 2019
4f7ba51
rename hir::map::local_def_id to local_def_id_from_node_id
ljedrz Jun 27, 2019
37d7e1f
rename hir::map::local_def_id_from_hir_id to local_def_id
ljedrz Jun 27, 2019
c6131b2
rename hir::map::opt_local_def_id*
ljedrz Jun 27, 2019
01e0d83
infer::error_reporting: adjust 2 debug messages
ljedrz Jun 28, 2019
675bfb6
fix a dep_graph doc regarding type_of_item
ljedrz Jul 2, 2019
a6030ff
infer: fix a Region-related debug message
ljedrz Jul 2, 2019
7f035ba
Fix a typo in Write::write_vectored docs
pawroman Jul 4, 2019
61ddf5e
Create async version of the dynamic-drop test
matthewjasper Jun 27, 2019
f4b30f4
Update README.md
markebrooks Jul 4, 2019
90419d3
Remove `solve_nll_region_constraints` measurements from `-Ztime-passe…
nnethercote Jun 25, 2019
87b103d
Add a "total" measurement to -Ztime-passes.
nnethercote Jun 25, 2019
50510e4
remove Scalar::is_null_ptr
RalfJung Jul 5, 2019
050a71b
rustc_target: avoid negative register counts in the SysV x86_64 ABI.
eddyb Jul 4, 2019
f01e5e6
Lint on invalid values passed to x.py --warnings
Mark-Simulacrum Jul 5, 2019
7fb17d8
Remove last use of mem::uninitialized in SGX
Jul 5, 2019
ce77031
Remove compile-pass from compiletest
JohnTitor Jul 4, 2019
db93d01
Remove compile-pass from error codes' explanation
JohnTitor Jul 4, 2019
211b52b
Update rustc-guide
JohnTitor Jul 4, 2019
1640ab2
Fix test annotation
JohnTitor Jul 5, 2019
485a084
Rollup merge of #61545 - flip1995:internal_lints, r=oli-obk
Centril Jul 5, 2019
40841e0
Rollup merge of #62110 - nnethercote:improve-Ztime-passes, r=Zoxc
Centril Jul 5, 2019
0224532
Rollup merge of #62133 - petrochenkov:norustc, r=eddyb
Centril Jul 5, 2019
b41a62e
Rollup merge of #62158 - christianpoveda:ecx-memory-extra, r=RalfJung
Centril Jul 5, 2019
2e86c00
Rollup merge of #62168 - ljedrz:the_culmination_of_hiridification, r=…
Centril Jul 5, 2019
30aa245
Rollup merge of #62193 - matthewjasper:dynamic-drop-async, r=Centril
Centril Jul 5, 2019
216a187
Rollup merge of #62369 - JohnTitor:remove-compile-pass, r=petrochenkov
Centril Jul 5, 2019
58f402a
Rollup merge of #62380 - eddyb:x64-sysv-regs, r=nagisa
Centril Jul 5, 2019
c5d1860
Rollup merge of #62381 - pawroman:fix_typo_in_write_vectored, r=Centril
Centril Jul 5, 2019
4ac3e62
Rollup merge of #62390 - markebrooks:encourage, r=Centril
Centril Jul 5, 2019
3c2cba8
Rollup merge of #62396 - RalfJung:miri-no-null, r=alexcrichton
Centril Jul 5, 2019
cc453d9
Rollup merge of #62406 - Mark-Simulacrum:warnings-lint, r=RalfJung
Centril Jul 5, 2019
e89bd8c
Rollup merge of #62414 - jethrogb:jb/sgx-uninit, r=Mark-Simulacrum
Centril Jul 5, 2019
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Read ["Installation"] from [The Book].

_Note: If you wish to contribute to the compiler, you should read
[this chapter](https://rust-lang.github.io/rustc-guide/how-to-build-and-run.html)
of the rustc-guide instead._
of the rustc-guide instead of this section._

### Building on *nix
1. Make sure you have installed the dependencies:
Expand Down
15 changes: 14 additions & 1 deletion src/bootstrap/bin/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,20 @@ fn main() {
}

// This is required for internal lints.
cmd.arg("-Zunstable-options");
if let Some(crate_name) = args.windows(2).find(|a| &*a[0] == "--crate-name") {
let crate_name = crate_name[1].to_string_lossy();
if crate_name != "rustc_version"
&& (crate_name.starts_with("rustc")
|| crate_name.starts_with("syntax")
|| crate_name == "arena"
|| crate_name == "fmt_macros")
{
cmd.arg("-Zunstable-options");
if stage != "0" {
cmd.arg("-Wrustc::internal");
}
}
}

// Force all crates compiled by this compiler to (a) be unstable and (b)
// allow the `rustc_private` feature to link to other unstable crates
Expand Down
4 changes: 2 additions & 2 deletions src/bootstrap/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ impl Config {
config.incremental = flags.incremental;
config.dry_run = flags.dry_run;
config.keep_stage = flags.keep_stage;
if let Some(value) = flags.warnings {
if let Some(value) = flags.deny_warnings {
config.deny_warnings = value;
}

Expand Down Expand Up @@ -571,7 +571,7 @@ impl Config {
config.rustc_default_linker = rust.default_linker.clone();
config.musl_root = rust.musl_root.clone().map(PathBuf::from);
config.save_toolstates = rust.save_toolstates.clone().map(PathBuf::from);
set(&mut config.deny_warnings, rust.deny_warnings.or(flags.warnings));
set(&mut config.deny_warnings, flags.deny_warnings.or(rust.deny_warnings));
set(&mut config.backtrace_on_ice, rust.backtrace_on_ice);
set(&mut config.rust_verify_llvm_ir, rust.verify_llvm_ir);
set(&mut config.rust_remap_debuginfo, rust.remap_debuginfo);
Expand Down
24 changes: 21 additions & 3 deletions src/bootstrap/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,11 @@ pub struct Flags {
pub rustc_error_format: Option<String>,
pub dry_run: bool,

// true => deny
pub warnings: Option<bool>,
// This overrides the deny-warnings configuation option,
// which passes -Dwarnings to the compiler invocations.
//
// true => deny, false => allow
pub deny_warnings: Option<bool>,
}

pub enum Subcommand {
Expand Down Expand Up @@ -468,7 +471,7 @@ Arguments:
.into_iter()
.map(|p| p.into())
.collect::<Vec<_>>(),
warnings: matches.opt_str("warnings").map(|v| v == "deny"),
deny_warnings: parse_deny_warnings(&matches),
}
}
}
Expand Down Expand Up @@ -549,3 +552,18 @@ fn split(s: &[String]) -> Vec<String> {
.map(|s| s.to_string())
.collect()
}

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(value) => {
eprintln!(
r#"invalid value for --warnings: {:?}, expected "allow" or "deny""#,
value,
);
process::exit(1);
},
None => None,
}
}
2 changes: 1 addition & 1 deletion src/doc/rustc-guide
1 change: 0 additions & 1 deletion src/libarena/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
test(no_crate_inject, attr(deny(warnings))))]

#![deny(rust_2018_idioms)]
#![deny(internal)]
#![deny(unused_lifetimes)]

#![feature(core_intrinsics)]
Expand Down
1 change: 1 addition & 0 deletions src/libcore/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
#![feature(concat_idents)]
#![feature(const_fn)]
#![feature(const_fn_union)]
#![feature(custom_inner_attributes)]
#![feature(doc_cfg)]
#![feature(doc_spotlight)]
#![feature(extern_types)]
Expand Down
1 change: 0 additions & 1 deletion src/libfmt_macros/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
test(attr(deny(warnings))))]

#![deny(rust_2018_idioms)]
#![deny(internal)]
#![deny(unused_lifetimes)]

#![feature(nll)]
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/dep_graph/dep_tracking_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ impl<M: DepTrackingMapConfig> MemoizationMap for RefCell<DepTrackingMap<M>> {
///
/// ```
/// fn type_of_item(..., item: &hir::Item) -> Ty<'tcx> {
/// let item_def_id = ccx.tcx.hir().local_def_id(it.id);
/// let item_def_id = ccx.tcx.hir().local_def_id(it.hir_id);
/// ccx.tcx.item_types.memoized(item_def_id, || {
/// ccx.tcx.dep_graph.read(DepNode::Hir(item_def_id)); // (*)
/// compute_type_of_item(ccx, item)
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/hir/check_attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ impl CheckAttrVisitor<'tcx> {
/// Checks any attribute.
fn check_attributes(&self, item: &hir::Item, target: Target) {
if target == Target::Fn || target == Target::Const {
self.tcx.codegen_fn_attrs(self.tcx.hir().local_def_id_from_hir_id(item.hir_id));
self.tcx.codegen_fn_attrs(self.tcx.hir().local_def_id(item.hir_id));
} else if let Some(a) = item.attrs.iter().find(|a| a.check_name(sym::target_feature)) {
self.tcx.sess.struct_span_err(a.span, "attribute should be applied to a function")
.span_label(item.span, "not a function")
Expand Down
1 change: 0 additions & 1 deletion src/librustc/hir/map/definitions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,6 @@ impl Definitions {
None
}

// FIXME(@ljedrz): replace the NodeId variant
#[inline]
pub fn as_local_hir_id(&self, def_id: DefId) -> Option<hir::HirId> {
if def_id.krate == LOCAL_CRATE {
Expand Down
5 changes: 3 additions & 2 deletions src/librustc/hir/map/hir_id_validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ pub fn check_crate(hir_map: &hir::map::Map<'_>) {
let errors = Lock::new(Vec::new());

par_iter(&hir_map.krate().modules).for_each(|(module_id, _)| {
hir_map.visit_item_likes_in_module(hir_map.local_def_id(*module_id), &mut OuterVisitor {
let local_def_id = hir_map.local_def_id_from_node_id(*module_id);
hir_map.visit_item_likes_in_module(local_def_id, &mut OuterVisitor {
hir_map,
errors: &errors,
});
Expand Down Expand Up @@ -79,7 +80,7 @@ impl<'a, 'hir> HirIdValidator<'a, 'hir> {
hir_id: HirId,
walk: F) {
assert!(self.owner_def_index.is_none());
let owner_def_index = self.hir_map.local_def_id_from_hir_id(hir_id).index;
let owner_def_index = self.hir_map.local_def_id(hir_id).index;
self.owner_def_index = Some(owner_def_index);
walk(self);

Expand Down
29 changes: 13 additions & 16 deletions src/librustc/hir/map/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ impl<'hir> Map<'hir> {
}

pub fn def_path_from_hir_id(&self, id: HirId) -> Option<DefPath> {
self.opt_local_def_id_from_hir_id(id).map(|def_id| {
self.opt_local_def_id(id).map(|def_id| {
self.def_path(def_id)
})
}
Expand All @@ -230,32 +230,30 @@ impl<'hir> Map<'hir> {
}

#[inline]
pub fn local_def_id(&self, node: NodeId) -> DefId {
self.opt_local_def_id(node).unwrap_or_else(|| {
pub fn local_def_id_from_node_id(&self, node: NodeId) -> DefId {
self.opt_local_def_id_from_node_id(node).unwrap_or_else(|| {
let hir_id = self.node_to_hir_id(node);
bug!("local_def_id: no entry for `{}`, which has a map of `{:?}`",
bug!("local_def_id_from_node_id: no entry for `{}`, which has a map of `{:?}`",
node, self.find_entry(hir_id))
})
}

// FIXME(@ljedrz): replace the `NodeId` variant.
#[inline]
pub fn local_def_id_from_hir_id(&self, hir_id: HirId) -> DefId {
self.opt_local_def_id_from_hir_id(hir_id).unwrap_or_else(|| {
bug!("local_def_id_from_hir_id: no entry for `{:?}`, which has a map of `{:?}`",
pub fn local_def_id(&self, hir_id: HirId) -> DefId {
self.opt_local_def_id(hir_id).unwrap_or_else(|| {
bug!("local_def_id: no entry for `{:?}`, which has a map of `{:?}`",
hir_id, self.find_entry(hir_id))
})
}

// FIXME(@ljedrz): replace the `NodeId` variant.
#[inline]
pub fn opt_local_def_id_from_hir_id(&self, hir_id: HirId) -> Option<DefId> {
pub fn opt_local_def_id(&self, hir_id: HirId) -> Option<DefId> {
let node_id = self.hir_to_node_id(hir_id);
self.definitions.opt_local_def_id(node_id)
}

#[inline]
pub fn opt_local_def_id(&self, node: NodeId) -> Option<DefId> {
pub fn opt_local_def_id_from_node_id(&self, node: NodeId) -> Option<DefId> {
self.definitions.opt_local_def_id(node)
}

Expand All @@ -264,7 +262,6 @@ impl<'hir> Map<'hir> {
self.definitions.as_local_node_id(def_id)
}

// FIXME(@ljedrz): replace the `NodeId` variant.
#[inline]
pub fn as_local_hir_id(&self, def_id: DefId) -> Option<HirId> {
self.definitions.as_local_hir_id(def_id)
Expand Down Expand Up @@ -429,7 +426,7 @@ impl<'hir> Map<'hir> {
}

pub fn body_owner_def_id(&self, id: BodyId) -> DefId {
self.local_def_id_from_hir_id(self.body_owner(id))
self.local_def_id(self.body_owner(id))
}

/// Given a `HirId`, returns the `BodyId` associated with it,
Expand Down Expand Up @@ -765,7 +762,7 @@ impl<'hir> Map<'hir> {
/// Returns the `DefId` of `id`'s nearest module parent, or `id` itself if no
/// module parent is in this map.
pub fn get_module_parent(&self, id: HirId) -> DefId {
self.local_def_id_from_hir_id(self.get_module_parent_node(id))
self.local_def_id(self.get_module_parent_node(id))
}

/// Returns the `HirId` of `id`'s nearest module parent, or `id` itself if no
Expand Down Expand Up @@ -841,7 +838,7 @@ impl<'hir> Map<'hir> {
}

pub fn get_parent_did(&self, id: HirId) -> DefId {
self.local_def_id_from_hir_id(self.get_parent_item(id))
self.local_def_id(self.get_parent_item(id))
}

pub fn get_foreign_abi(&self, hir_id: HirId) -> Abi {
Expand Down Expand Up @@ -1247,7 +1244,7 @@ fn hir_id_to_string(map: &Map<'_>, id: HirId, include_id: bool) -> String {
// the user-friendly path, otherwise fall back to stringifying DefPath.
crate::ty::tls::with_opt(|tcx| {
if let Some(tcx) = tcx {
let def_id = map.local_def_id_from_hir_id(id);
let def_id = map.local_def_id(id);
tcx.def_path_str(def_id)
} else if let Some(path) = map.def_path_from_hir_id(id) {
path.data.into_iter().map(|elem| {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/hir/upvars.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ impl Visitor<'tcx> for CaptureCollector<'a, 'tcx> {

fn visit_expr(&mut self, expr: &'tcx hir::Expr) {
if let hir::ExprKind::Closure(..) = expr.node {
let closure_def_id = self.tcx.hir().local_def_id_from_hir_id(expr.hir_id);
let closure_def_id = self.tcx.hir().local_def_id(expr.hir_id);
if let Some(upvars) = self.tcx.upvars(closure_def_id) {
// Every capture of a closure expression is a local in scope,
// that is moved/copied/borrowed into the closure value, and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,7 @@ impl Visitor<'tcx> for FindNestedTypeVisitor<'tcx> {
// error. We will then search the function parameters for a bound
// region at the right depth with the same index
(Some(rl::Region::EarlyBound(_, id, _)), ty::BrNamed(def_id, _)) => {
debug!(
"EarlyBound self.infcx.tcx.hir().local_def_id(id)={:?} \
def_id={:?}",
id,
def_id
);
debug!("EarlyBound id={:?} def_id={:?}", id, def_id);
if id == def_id {
self.found_type = Some(arg);
return; // we can stop visiting now
Expand All @@ -162,8 +157,7 @@ impl Visitor<'tcx> for FindNestedTypeVisitor<'tcx> {
"FindNestedTypeVisitor::visit_ty: LateBound depth = {:?}",
debruijn_index
);
debug!("self.infcx.tcx.hir().local_def_id(id)={:?}", id);
debug!("def_id={:?}", def_id);
debug!("LateBound id={:?} def_id={:?}", id, def_id);
if debruijn_index == self.current_index && id == def_id {
self.found_type = Some(arg);
return; // we can stop visiting now
Expand Down Expand Up @@ -231,12 +225,7 @@ impl Visitor<'tcx> for TyPathVisitor<'tcx> {
}

(Some(rl::Region::EarlyBound(_, id, _)), ty::BrNamed(def_id, _)) => {
debug!(
"EarlyBound self.infcx.tcx.hir().local_def_id(id)={:?} \
def_id={:?}",
id,
def_id
);
debug!("EarlyBound id={:?} def_id={:?}", id, def_id);
if id == def_id {
self.found_it = true;
return; // we can stop visiting now
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/infer/opaque_types/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -951,8 +951,8 @@ impl<'a, 'tcx> Instantiator<'a, 'tcx> {
let parent_def_id = self.parent_def_id;
let def_scope_default = || {
let opaque_parent_hir_id = tcx.hir().get_parent_item(opaque_hir_id);
parent_def_id
== tcx.hir().local_def_id_from_hir_id(opaque_parent_hir_id)
parent_def_id == tcx.hir()
.local_def_id(opaque_parent_hir_id)
};
let (in_definition_scope, origin) = match tcx.hir().find(opaque_hir_id) {
Some(Node::Item(item)) => match item.node {
Expand Down
1 change: 0 additions & 1 deletion src/librustc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/")]

#![deny(rust_2018_idioms)]
#![deny(internal)]
#![deny(unused_lifetimes)]

#![feature(arbitrary_self_types)]
Expand Down
6 changes: 4 additions & 2 deletions src/librustc/lint/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -926,7 +926,7 @@ impl<'a, 'tcx, T: LateLintPass<'a, 'tcx>> LateContextAndPass<'a, 'tcx, T> {
{
let old_param_env = self.context.param_env;
self.context.param_env = self.context.tcx.param_env(
self.context.tcx.hir().local_def_id_from_hir_id(id)
self.context.tcx.hir().local_def_id(id)
);
f(self);
self.context.param_env = old_param_env;
Expand Down Expand Up @@ -1341,6 +1341,7 @@ struct LateLintPassObjects<'a> {
lints: &'a mut [LateLintPassObject],
}

#[cfg_attr(not(bootstrap), allow(rustc::lint_pass_impl_without_macro))]
impl LintPass for LateLintPassObjects<'_> {
fn name(&self) -> &'static str {
panic!()
Expand Down Expand Up @@ -1500,7 +1501,7 @@ pub fn check_crate<'tcx, T: for<'a> LateLintPass<'a, 'tcx>>(
time(tcx.sess, "module lints", || {
// Run per-module lints
par_iter(&tcx.hir().krate().modules).for_each(|(&module, _)| {
tcx.ensure().lint_mod(tcx.hir().local_def_id(module));
tcx.ensure().lint_mod(tcx.hir().local_def_id_from_node_id(module));
});
});
});
Expand All @@ -1510,6 +1511,7 @@ struct EarlyLintPassObjects<'a> {
lints: &'a mut [EarlyLintPassObject],
}

#[cfg_attr(not(bootstrap), allow(rustc::lint_pass_impl_without_macro))]
impl LintPass for EarlyLintPassObjects<'_> {
fn name(&self) -> &'static str {
panic!()
Expand Down
Loading