Skip to content

Commit fb669bc

Browse files
committed
Do some suggested changes, push to show compilation errors.
1 parent 72c9dd7 commit fb669bc

File tree

6 files changed

+27
-22
lines changed

6 files changed

+27
-22
lines changed

compiler/rustc_codegen_ssa/src/base.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -910,17 +910,14 @@ pub fn provide(providers: &mut Providers) {
910910
};
911911

912912
let (defids, _) = tcx.collect_and_partition_mono_items(cratenum);
913-
for id in defids.sorted_vector() {
913+
if defids.any(|x| {
914914
let CodegenFnAttrs { optimize, .. } = tcx.codegen_fn_attrs(*id);
915-
match optimize {
916-
attr::OptimizeAttr::None => continue,
917-
attr::OptimizeAttr::Size => continue,
918-
attr::OptimizeAttr::Speed => {
919-
return for_speed;
920-
}
921-
}
915+
optimize == attr::OptimizeAttr::Speed
916+
}) {
917+
for_speed
918+
} else {
919+
tcx.sess.opts.optimize
922920
}
923-
tcx.sess.opts.optimize
924921
};
925922
}
926923

compiler/rustc_data_structures/src/stable_set.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,22 @@ impl<T: Hash + Eq> StableSet<T> {
102102
pub fn contains(&self, value: &T) -> bool {
103103
self.base.contains(value)
104104
}
105+
106+
#[inline]
107+
pub fn any<F>(&self, f: F) -> bool
108+
where
109+
F: FnMut(&T) -> bool,
110+
{
111+
self.base.iter().any(f)
112+
}
113+
114+
#[inline]
115+
pub fn all<F>(&self, f: F) -> bool
116+
where
117+
F: FnMut(&T) -> bool,
118+
{
119+
self.base.iter().all(f)
120+
}
105121
}
106122

107123
impl<T, HCX> HashStable<HCX> for StableSet<T>

compiler/rustc_middle/src/middle/stability.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,12 @@ use crate::ty::{self, DefIdTree, TyCtxt};
77
use rustc_ast::NodeId;
88
use rustc_attr::{self as attr, ConstStability, Deprecation, Stability};
99
use rustc_data_structures::fx::FxHashMap;
10-
use rustc_data_structures::stable_set::StableSet;
1110
use rustc_errors::{Applicability, Diagnostic};
1211
use rustc_feature::GateIssue;
1312
use rustc_hir as hir;
1413
use rustc_hir::def::DefKind;
1514
use rustc_hir::def_id::{DefId, LocalDefId, CRATE_DEF_INDEX};
16-
use rustc_hir::{self, def_id::CrateNum, HirId};
15+
use rustc_hir::{self, HirId};
1716
use rustc_middle::ty::print::with_no_trimmed_paths;
1817
use rustc_session::lint::builtin::{DEPRECATED, DEPRECATED_IN_FUTURE, SOFT_UNSTABLE};
1918
use rustc_session::lint::{BuiltinLintDiagnostics, Level, Lint, LintBuffer};
@@ -64,12 +63,6 @@ pub struct Index {
6463
pub stab_map: FxHashMap<LocalDefId, Stability>,
6564
pub const_stab_map: FxHashMap<LocalDefId, ConstStability>,
6665
pub depr_map: FxHashMap<LocalDefId, DeprecationEntry>,
67-
68-
/// Maps for each crate whether it is part of the staged API.
69-
pub staged_api: FxHashMap<CrateNum, bool>,
70-
71-
/// Features enabled for this crate.
72-
pub active_features: StableSet<Symbol>,
7366
}
7467

7568
impl Index {

compiler/rustc_middle/src/ty/context.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ use rustc_data_structures::memmap::Mmap;
3131
use rustc_data_structures::profiling::SelfProfilerRef;
3232
use rustc_data_structures::sharded::{IntoPointer, ShardedHashMap};
3333
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
34-
use rustc_data_structures::stable_set::StableSet;
34+
use rustc_data_structures::stable_set::{FxHashSet, StableSet};
3535
use rustc_data_structures::steal::Steal;
3636
use rustc_data_structures::sync::{self, Lock, Lrc, WorkerLocal};
3737
use rustc_data_structures::vec_map::VecMap;
@@ -2209,7 +2209,7 @@ impl<'tcx> TyCtxt<'tcx> {
22092209
/// to identify which traits may define a given associated type to help avoid cycle errors.
22102210
/// Returns a `DefId` iterator.
22112211
fn super_traits_of(self, trait_def_id: DefId) -> impl Iterator<Item = DefId> + 'tcx {
2212-
let mut set = StableSet::default();
2212+
let mut set = FxHashSet::default();
22132213
let mut stack = vec![trait_def_id];
22142214

22152215
set.insert(trait_def_id);

compiler/rustc_middle/src/ty/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ pub use adt::*;
1818
pub use assoc::*;
1919
pub use generics::*;
2020
use rustc_data_structures::fingerprint::Fingerprint;
21-
use rustc_data_structures::stable_set::StableSet;
2221
pub use vtable::*;
2322

2423
use crate::metadata::ModChild;
@@ -136,7 +135,7 @@ pub struct ResolverOutputs {
136135
pub maybe_unused_trait_imports: FxHashSet<LocalDefId>,
137136
pub maybe_unused_extern_crates: Vec<(LocalDefId, Span)>,
138137
pub reexport_map: FxHashMap<LocalDefId, Vec<ModChild>>,
139-
pub glob_map: FxHashMap<LocalDefId, StableSet<Symbol>>,
138+
pub glob_map: FxHashMap<LocalDefId, FxHashSet<Symbol>>,
140139
/// Extern prelude entries. The value is `true` if the entry was introduced
141140
/// via `extern crate` item and not `--extern` option or compiler built-in.
142141
pub extern_prelude: FxHashMap<Symbol, bool>,

compiler/rustc_middle/src/ty/print/pretty.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2765,7 +2765,7 @@ fn trimmed_def_paths(tcx: TyCtxt<'_>, (): ()) -> FxHashMap<DefId, Symbol> {
27652765

27662766
let hcx = tcx.create_stable_hashing_context();
27672767
for symbol_set in tcx.resolutions(()).glob_map.values() {
2768-
for symbol in symbol_set.sorted_vector(&hcx) {
2768+
for symbol in symbol_set {
27692769
unique_symbols_rev.insert((Namespace::TypeNS, *symbol), None);
27702770
unique_symbols_rev.insert((Namespace::ValueNS, *symbol), None);
27712771
unique_symbols_rev.insert((Namespace::MacroNS, *symbol), None);

0 commit comments

Comments
 (0)