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 #84691

Closed
wants to merge 22 commits into from
Closed
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
3090b01
Use flex more consistently.
Apr 22, 2021
fb7018b
Test that non_default_option is not the default option
jyn514 Apr 16, 2021
2720151
Add [TRACKED_NO_CRATE_HASH] and [SUBSTRUCT] directives
jyn514 Apr 15, 2021
39648ea
Make `real_rust_path_dir` a TRACKED_NO_CRATE_HASH option
jyn514 Apr 27, 2021
9d170be
Use doc-comment instad of comments consistently
jyn514 Apr 27, 2021
aeb67ad
Drop branching blocks with same span as expanded macro
richkadel Apr 26, 2021
2c4fc3e
More improvements to macro coverage
richkadel Apr 26, 2021
bbf6bce
spanview debug output caused ICE when a function had no body
richkadel Apr 25, 2021
fd85fd3
addressed review feedback
richkadel Apr 28, 2021
31ae3b2
Add HAS_RE_LATE_BOUND if there are bound vars
jackh726 Apr 28, 2021
27fc7cb
Update LLVM for more wasm simd updates
alexcrichton Apr 28, 2021
e6a731e
Be stricter about rejecting LLVM reserved registers in asm!
Amanieu Apr 28, 2021
c9fbaa6
Add a comment
jackh726 Apr 28, 2021
51b0cb2
Add integration test for `--remap-pathh-prefix`
jyn514 Apr 28, 2021
8c04695
Remove unnecessary CSS rules for search results
GuillaumeGomez Apr 29, 2021
8dd8938
Rollup merge of #84233 - jyn514:track-path-prefix, r=michaelwoerister
Dylan-DPC Apr 29, 2021
1d65997
Rollup merge of #84451 - torhovland:flex, r=jsha
Dylan-DPC Apr 29, 2021
623ecb0
Rollup merge of #84582 - richkadel:issue-84561, r=tmandry
Dylan-DPC Apr 29, 2021
5dc594a
Rollup merge of #84653 - jackh726:erase-flags, r=nikomatsakis
Dylan-DPC Apr 29, 2021
da22cea
Rollup merge of #84654 - alexcrichton:update-llvm-, r=cuviper
Dylan-DPC Apr 29, 2021
27fc2d4
Rollup merge of #84658 - Amanieu:reserved_regs, r=petrochenkov
Dylan-DPC Apr 29, 2021
6acead4
Rollup merge of #84688 - GuillaumeGomez:remove-unnecessary-css-for-se…
Dylan-DPC Apr 29, 2021
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 compiler/rustc_incremental/src/persist/load.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ pub fn load_dep_graph(sess: &Session) -> DepGraphFuture {
// Fortunately, we just checked that this isn't the case.
let path = dep_graph_path_from(&sess.incr_comp_session_dir());
let report_incremental_info = sess.opts.debugging_opts.incremental_info;
let expected_hash = sess.opts.dep_tracking_hash();
let expected_hash = sess.opts.dep_tracking_hash(false);

let mut prev_work_products = FxHashMap::default();
let nightly_build = sess.is_nightly_build();
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_incremental/src/persist/save.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ pub fn build_dep_graph(
}

// First encode the commandline arguments hash
if let Err(err) = sess.opts.dep_tracking_hash().encode(&mut encoder) {
if let Err(err) = sess.opts.dep_tracking_hash(false).encode(&mut encoder) {
sess.err(&format!(
"failed to write dependency graph hash `{}`: {}",
path_buf.display(),
Expand Down
143 changes: 78 additions & 65 deletions compiler/rustc_interface/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ use rustc_span::symbol::sym;
use rustc_span::SourceFileHashAlgorithm;
use rustc_target::spec::{CodeModel, LinkerFlavor, MergeFunctions, PanicStrategy};
use rustc_target::spec::{RelocModel, RelroLevel, SanitizerSet, SplitDebuginfo, TlsModel};

use std::collections::{BTreeMap, BTreeSet};
use std::iter::FromIterator;
use std::num::NonZeroUsize;
Expand Down Expand Up @@ -74,6 +75,27 @@ fn mk_map<K: Ord, V>(entries: Vec<(K, V)>) -> BTreeMap<K, V> {
BTreeMap::from_iter(entries.into_iter())
}

fn assert_same_clone(x: &Options) {
assert_eq!(x.dep_tracking_hash(true), x.clone().dep_tracking_hash(true));
assert_eq!(x.dep_tracking_hash(false), x.clone().dep_tracking_hash(false));
}

fn assert_same_hash(x: &Options, y: &Options) {
assert_eq!(x.dep_tracking_hash(true), y.dep_tracking_hash(true));
assert_eq!(x.dep_tracking_hash(false), y.dep_tracking_hash(false));
// Check clone
assert_same_clone(x);
assert_same_clone(y);
}

fn assert_different_hash(x: &Options, y: &Options) {
assert_ne!(x.dep_tracking_hash(true), y.dep_tracking_hash(true));
assert_ne!(x.dep_tracking_hash(false), y.dep_tracking_hash(false));
// Check clone
assert_same_clone(x);
assert_same_clone(y);
}

// When the user supplies --test we should implicitly supply --cfg test
#[test]
fn test_switch_implies_cfg_test() {
Expand Down Expand Up @@ -130,14 +152,9 @@ fn test_output_types_tracking_hash_different_paths() {
v2.output_types = OutputTypes::new(&[(OutputType::Exe, Some(PathBuf::from("/some/thing")))]);
v3.output_types = OutputTypes::new(&[(OutputType::Exe, None)]);

assert!(v1.dep_tracking_hash() != v2.dep_tracking_hash());
assert!(v1.dep_tracking_hash() != v3.dep_tracking_hash());
assert!(v2.dep_tracking_hash() != v3.dep_tracking_hash());

// Check clone
assert_eq!(v1.dep_tracking_hash(), v1.clone().dep_tracking_hash());
assert_eq!(v2.dep_tracking_hash(), v2.clone().dep_tracking_hash());
assert_eq!(v3.dep_tracking_hash(), v3.clone().dep_tracking_hash());
assert_different_hash(&v1, &v2);
assert_different_hash(&v1, &v3);
assert_different_hash(&v2, &v3);
}

#[test]
Expand All @@ -155,10 +172,7 @@ fn test_output_types_tracking_hash_different_construction_order() {
(OutputType::Exe, Some(PathBuf::from("./some/thing"))),
]);

assert_eq!(v1.dep_tracking_hash(), v2.dep_tracking_hash());

// Check clone
assert_eq!(v1.dep_tracking_hash(), v1.clone().dep_tracking_hash());
assert_same_hash(&v1, &v2);
}

#[test]
Expand All @@ -182,14 +196,9 @@ fn test_externs_tracking_hash_different_construction_order() {
(String::from("d"), new_public_extern_entry(vec!["f", "e"])),
]));

assert_eq!(v1.dep_tracking_hash(), v2.dep_tracking_hash());
assert_eq!(v1.dep_tracking_hash(), v3.dep_tracking_hash());
assert_eq!(v2.dep_tracking_hash(), v3.dep_tracking_hash());

// Check clone
assert_eq!(v1.dep_tracking_hash(), v1.clone().dep_tracking_hash());
assert_eq!(v2.dep_tracking_hash(), v2.clone().dep_tracking_hash());
assert_eq!(v3.dep_tracking_hash(), v3.clone().dep_tracking_hash());
assert_same_hash(&v1, &v2);
assert_same_hash(&v1, &v3);
assert_same_hash(&v2, &v3);
}

#[test]
Expand Down Expand Up @@ -219,14 +228,9 @@ fn test_lints_tracking_hash_different_values() {
(String::from("d"), Level::Deny),
];

assert!(v1.dep_tracking_hash() != v2.dep_tracking_hash());
assert!(v1.dep_tracking_hash() != v3.dep_tracking_hash());
assert!(v2.dep_tracking_hash() != v3.dep_tracking_hash());

// Check clone
assert_eq!(v1.dep_tracking_hash(), v1.clone().dep_tracking_hash());
assert_eq!(v2.dep_tracking_hash(), v2.clone().dep_tracking_hash());
assert_eq!(v3.dep_tracking_hash(), v3.clone().dep_tracking_hash());
assert_different_hash(&v1, &v2);
assert_different_hash(&v1, &v3);
assert_different_hash(&v2, &v3);
}

#[test]
Expand All @@ -248,11 +252,7 @@ fn test_lints_tracking_hash_different_construction_order() {
(String::from("d"), Level::Forbid),
];

assert_eq!(v1.dep_tracking_hash(), v2.dep_tracking_hash());

// Check clone
assert_eq!(v1.dep_tracking_hash(), v1.clone().dep_tracking_hash());
assert_eq!(v2.dep_tracking_hash(), v2.clone().dep_tracking_hash());
assert_same_hash(&v1, &v2);
}

#[test]
Expand Down Expand Up @@ -292,15 +292,9 @@ fn test_search_paths_tracking_hash_different_order() {
v4.search_paths.push(SearchPath::from_cli_opt("dependency=ghi", JSON));
v4.search_paths.push(SearchPath::from_cli_opt("framework=jkl", JSON));

assert!(v1.dep_tracking_hash() == v2.dep_tracking_hash());
assert!(v1.dep_tracking_hash() == v3.dep_tracking_hash());
assert!(v1.dep_tracking_hash() == v4.dep_tracking_hash());

// Check clone
assert_eq!(v1.dep_tracking_hash(), v1.clone().dep_tracking_hash());
assert_eq!(v2.dep_tracking_hash(), v2.clone().dep_tracking_hash());
assert_eq!(v3.dep_tracking_hash(), v3.clone().dep_tracking_hash());
assert_eq!(v4.dep_tracking_hash(), v4.clone().dep_tracking_hash());
assert_same_hash(&v1, &v2);
assert_same_hash(&v1, &v3);
assert_same_hash(&v1, &v4);
}

#[test]
Expand Down Expand Up @@ -338,15 +332,9 @@ fn test_native_libs_tracking_hash_different_values() {
(String::from("c"), None, NativeLibKind::Unspecified),
];

assert!(v1.dep_tracking_hash() != v2.dep_tracking_hash());
assert!(v1.dep_tracking_hash() != v3.dep_tracking_hash());
assert!(v1.dep_tracking_hash() != v4.dep_tracking_hash());

// Check clone
assert_eq!(v1.dep_tracking_hash(), v1.clone().dep_tracking_hash());
assert_eq!(v2.dep_tracking_hash(), v2.clone().dep_tracking_hash());
assert_eq!(v3.dep_tracking_hash(), v3.clone().dep_tracking_hash());
assert_eq!(v4.dep_tracking_hash(), v4.clone().dep_tracking_hash());
assert_different_hash(&v1, &v2);
assert_different_hash(&v1, &v3);
assert_different_hash(&v1, &v4);
}

#[test]
Expand Down Expand Up @@ -374,14 +362,9 @@ fn test_native_libs_tracking_hash_different_order() {
(String::from("b"), None, NativeLibKind::Framework),
];

assert!(v1.dep_tracking_hash() == v2.dep_tracking_hash());
assert!(v1.dep_tracking_hash() == v3.dep_tracking_hash());
assert!(v2.dep_tracking_hash() == v3.dep_tracking_hash());

// Check clone
assert_eq!(v1.dep_tracking_hash(), v1.clone().dep_tracking_hash());
assert_eq!(v2.dep_tracking_hash(), v2.clone().dep_tracking_hash());
assert_eq!(v3.dep_tracking_hash(), v3.clone().dep_tracking_hash());
assert_same_hash(&v1, &v2);
assert_same_hash(&v1, &v3);
assert_same_hash(&v2, &v3);
}

#[test]
Expand All @@ -391,8 +374,9 @@ fn test_codegen_options_tracking_hash() {

macro_rules! untracked {
($name: ident, $non_default_value: expr) => {
assert_ne!(opts.cg.$name, $non_default_value);
opts.cg.$name = $non_default_value;
assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
assert_same_hash(&reference, &opts);
};
}

Expand All @@ -416,8 +400,9 @@ fn test_codegen_options_tracking_hash() {
macro_rules! tracked {
($name: ident, $non_default_value: expr) => {
opts = reference.clone();
assert_ne!(opts.cg.$name, $non_default_value);
opts.cg.$name = $non_default_value;
assert_ne!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
assert_different_hash(&reference, &opts);
};
}

Expand Down Expand Up @@ -454,15 +439,42 @@ fn test_codegen_options_tracking_hash() {
tracked!(target_feature, String::from("all the features, all of them"));
}

#[test]
fn test_top_level_options_tracked_no_crate() {
let reference = Options::default();
let mut opts;

macro_rules! tracked {
($name: ident, $non_default_value: expr) => {
opts = reference.clone();
assert_ne!(opts.$name, $non_default_value);
opts.$name = $non_default_value;
// The crate hash should be the same
assert_eq!(reference.dep_tracking_hash(true), opts.dep_tracking_hash(true));
// The incremental hash should be different
assert_ne!(reference.dep_tracking_hash(false), opts.dep_tracking_hash(false));
};
}

// Make sure that changing a [TRACKED_NO_CRATE_HASH] option leaves the crate hash unchanged but changes the incremental hash.
// This list is in alphabetical order.
tracked!(remap_path_prefix, vec![("/home/bors/rust".into(), "src".into())]);
tracked!(
real_rust_source_base_dir,
Some("/home/bors/rust/.rustup/toolchains/nightly/lib/rustlib/src/rust".into())
);
}

#[test]
fn test_debugging_options_tracking_hash() {
let reference = Options::default();
let mut opts = Options::default();

macro_rules! untracked {
($name: ident, $non_default_value: expr) => {
assert_ne!(opts.debugging_opts.$name, $non_default_value);
opts.debugging_opts.$name = $non_default_value;
assert_eq!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
assert_same_hash(&reference, &opts);
};
}

Expand All @@ -471,7 +483,7 @@ fn test_debugging_options_tracking_hash() {
untracked!(ast_json, true);
untracked!(ast_json_noexpand, true);
untracked!(borrowck, String::from("other"));
untracked!(deduplicate_diagnostics, true);
untracked!(deduplicate_diagnostics, false);
untracked!(dep_tasks, true);
untracked!(dont_buffer_diagnostics, true);
untracked!(dump_dep_graph, true);
Expand Down Expand Up @@ -515,7 +527,7 @@ fn test_debugging_options_tracking_hash() {
untracked!(self_profile_events, Some(vec![String::new()]));
untracked!(span_debug, true);
untracked!(span_free_formats, true);
untracked!(strip, Strip::None);
untracked!(strip, Strip::Debuginfo);
untracked!(terminal_width, Some(80));
untracked!(threads, 99);
untracked!(time, true);
Expand All @@ -532,8 +544,9 @@ fn test_debugging_options_tracking_hash() {
macro_rules! tracked {
($name: ident, $non_default_value: expr) => {
opts = reference.clone();
assert_ne!(opts.debugging_opts.$name, $non_default_value);
opts.debugging_opts.$name = $non_default_value;
assert_ne!(reference.dep_tracking_hash(), opts.dep_tracking_hash());
assert_different_hash(&reference, &opts);
};
}

Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_metadata/src/rmeta/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1617,7 +1617,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
.map(Path::new)
.filter(|_| {
// Only spend time on further checks if we have what to translate *to*.
sess.real_rust_source_base_dir.is_some()
sess.opts.real_rust_source_base_dir.is_some()
})
.filter(|virtual_dir| {
// Don't translate away `/rustc/$hash` if we're still remapping to it,
Expand All @@ -1629,11 +1629,11 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
debug!(
"try_to_translate_virtual_to_real(name={:?}): \
virtual_rust_source_base_dir={:?}, real_rust_source_base_dir={:?}",
name, virtual_rust_source_base_dir, sess.real_rust_source_base_dir,
name, virtual_rust_source_base_dir, sess.opts.real_rust_source_base_dir,
);

if let Some(virtual_dir) = virtual_rust_source_base_dir {
if let Some(real_dir) = &sess.real_rust_source_base_dir {
if let Some(real_dir) = &sess.opts.real_rust_source_base_dir {
if let rustc_span::FileName::Real(old_name) = name {
if let rustc_span::RealFileName::Named(one_path) = old_name {
if let Ok(rest) = one_path.strip_prefix(virtual_dir) {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/hir/map/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -943,7 +943,7 @@ pub(super) fn index_hir<'tcx>(tcx: TyCtxt<'tcx>, cnum: CrateNum) -> &'tcx Indexe
intravisit::walk_crate(&mut collector, tcx.untracked_crate);

let crate_disambiguator = tcx.sess.local_crate_disambiguator();
let cmdline_args = tcx.sess.opts.dep_tracking_hash();
let cmdline_args = tcx.sess.opts.dep_tracking_hash(true);
collector.finalize_and_compute_crate_hash(crate_disambiguator, &*tcx.cstore, cmdline_args)
};

Expand Down
7 changes: 7 additions & 0 deletions compiler/rustc_middle/src/ty/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ impl FlagComputation {
{
let mut computation = FlagComputation::new();

// In some cases, there are binders with variables that are unused (e.g., `for<'a> fn(u32)`).
// Set the flag to represent the `'a` in this example. Note that if there are late bound types
// or consts, this flag will also get set.
if !value.bound_vars().is_empty() {
computation.flags = computation.flags | TypeFlags::HAS_RE_LATE_BOUND;
}

f(&mut computation, value.skip_binder());

self.add_flags(computation.flags);
Expand Down
Loading