Skip to content

Commit 481068a

Browse files
committed
Auto merge of #62419 - Centril:rollup-82umycq, r=Centril
Rollup of 13 pull requests Successful merges: - #61545 (Implement another internal lints) - #62110 (Improve -Ztime-passes) - #62133 (Feature gate `rustc` attributes harder) - #62158 (Add MemoryExtra in InterpretCx constructor params) - #62168 (The (almost) culmination of HirIdification) - #62193 (Create async version of the dynamic-drop test) - #62369 (Remove `compile-pass` from compiletest) - #62380 (rustc_target: avoid negative register counts in the SysV x86_64 ABI.) - #62381 (Fix a typo in Write::write_vectored docs) - #62390 (Update README.md) - #62396 (remove Scalar::is_null_ptr) - #62406 (Lint on invalid values passed to x.py --warnings) - #62414 (Remove last use of mem::uninitialized in SGX) Failed merges: r? @ghost
2 parents 853f300 + e89bd8c commit 481068a

File tree

178 files changed

+1310
-687
lines changed

Some content is hidden

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

178 files changed

+1310
-687
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Read ["Installation"] from [The Book].
1818

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

2323
### Building on *nix
2424
1. Make sure you have installed the dependencies:

src/bootstrap/bin/rustc.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,20 @@ fn main() {
306306
}
307307

308308
// This is required for internal lints.
309-
cmd.arg("-Zunstable-options");
309+
if let Some(crate_name) = args.windows(2).find(|a| &*a[0] == "--crate-name") {
310+
let crate_name = crate_name[1].to_string_lossy();
311+
if crate_name != "rustc_version"
312+
&& (crate_name.starts_with("rustc")
313+
|| crate_name.starts_with("syntax")
314+
|| crate_name == "arena"
315+
|| crate_name == "fmt_macros")
316+
{
317+
cmd.arg("-Zunstable-options");
318+
if stage != "0" {
319+
cmd.arg("-Wrustc::internal");
320+
}
321+
}
322+
}
310323

311324
// Force all crates compiled by this compiler to (a) be unstable and (b)
312325
// allow the `rustc_private` feature to link to other unstable crates

src/bootstrap/config.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ impl Config {
405405
config.incremental = flags.incremental;
406406
config.dry_run = flags.dry_run;
407407
config.keep_stage = flags.keep_stage;
408-
if let Some(value) = flags.warnings {
408+
if let Some(value) = flags.deny_warnings {
409409
config.deny_warnings = value;
410410
}
411411

@@ -571,7 +571,7 @@ impl Config {
571571
config.rustc_default_linker = rust.default_linker.clone();
572572
config.musl_root = rust.musl_root.clone().map(PathBuf::from);
573573
config.save_toolstates = rust.save_toolstates.clone().map(PathBuf::from);
574-
set(&mut config.deny_warnings, rust.deny_warnings.or(flags.warnings));
574+
set(&mut config.deny_warnings, flags.deny_warnings.or(rust.deny_warnings));
575575
set(&mut config.backtrace_on_ice, rust.backtrace_on_ice);
576576
set(&mut config.rust_verify_llvm_ir, rust.verify_llvm_ir);
577577
set(&mut config.rust_remap_debuginfo, rust.remap_debuginfo);

src/bootstrap/flags.rs

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,11 @@ pub struct Flags {
3333
pub rustc_error_format: Option<String>,
3434
pub dry_run: bool,
3535

36-
// true => deny
37-
pub warnings: Option<bool>,
36+
// This overrides the deny-warnings configuation option,
37+
// which passes -Dwarnings to the compiler invocations.
38+
//
39+
// true => deny, false => allow
40+
pub deny_warnings: Option<bool>,
3841
}
3942

4043
pub enum Subcommand {
@@ -468,7 +471,7 @@ Arguments:
468471
.into_iter()
469472
.map(|p| p.into())
470473
.collect::<Vec<_>>(),
471-
warnings: matches.opt_str("warnings").map(|v| v == "deny"),
474+
deny_warnings: parse_deny_warnings(&matches),
472475
}
473476
}
474477
}
@@ -549,3 +552,18 @@ fn split(s: &[String]) -> Vec<String> {
549552
.map(|s| s.to_string())
550553
.collect()
551554
}
555+
556+
fn parse_deny_warnings(matches: &getopts::Matches) -> Option<bool> {
557+
match matches.opt_str("warnings").as_ref().map(|v| v.as_str()) {
558+
Some("deny") => Some(true),
559+
Some("allow") => Some(false),
560+
Some(value) => {
561+
eprintln!(
562+
r#"invalid value for --warnings: {:?}, expected "allow" or "deny""#,
563+
value,
564+
);
565+
process::exit(1);
566+
},
567+
None => None,
568+
}
569+
}

src/doc/rustc-guide

src/libarena/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
test(no_crate_inject, attr(deny(warnings))))]
1313

1414
#![deny(rust_2018_idioms)]
15-
#![deny(internal)]
1615
#![deny(unused_lifetimes)]
1716

1817
#![feature(core_intrinsics)]

src/libcore/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
#![feature(concat_idents)]
7575
#![feature(const_fn)]
7676
#![feature(const_fn_union)]
77+
#![feature(custom_inner_attributes)]
7778
#![feature(doc_cfg)]
7879
#![feature(doc_spotlight)]
7980
#![feature(extern_types)]

src/libfmt_macros/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
test(attr(deny(warnings))))]
1010

1111
#![deny(rust_2018_idioms)]
12-
#![deny(internal)]
1312
#![deny(unused_lifetimes)]
1413

1514
#![feature(nll)]

src/librustc/dep_graph/dep_tracking_map.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ impl<M: DepTrackingMapConfig> MemoizationMap for RefCell<DepTrackingMap<M>> {
5555
///
5656
/// ```
5757
/// fn type_of_item(..., item: &hir::Item) -> Ty<'tcx> {
58-
/// let item_def_id = ccx.tcx.hir().local_def_id(it.id);
58+
/// let item_def_id = ccx.tcx.hir().local_def_id(it.hir_id);
5959
/// ccx.tcx.item_types.memoized(item_def_id, || {
6060
/// ccx.tcx.dep_graph.read(DepNode::Hir(item_def_id)); // (*)
6161
/// compute_type_of_item(ccx, item)

src/librustc/hir/check_attr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ impl CheckAttrVisitor<'tcx> {
9595
/// Checks any attribute.
9696
fn check_attributes(&self, item: &hir::Item, target: Target) {
9797
if target == Target::Fn || target == Target::Const {
98-
self.tcx.codegen_fn_attrs(self.tcx.hir().local_def_id_from_hir_id(item.hir_id));
98+
self.tcx.codegen_fn_attrs(self.tcx.hir().local_def_id(item.hir_id));
9999
} else if let Some(a) = item.attrs.iter().find(|a| a.check_name(sym::target_feature)) {
100100
self.tcx.sess.struct_span_err(a.span, "attribute should be applied to a function")
101101
.span_label(item.span, "not a function")

0 commit comments

Comments
 (0)