8000 Rollup of 9 pull requests by Centril · Pull Request #65723 · rust-lang/rust · GitHub
[go: up one dir, main page]

Skip to content

Rollup of 9 pull requests #65723

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 44 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
47a443c
Duplicate lint specifications are always bug!
Mark-Simulacrum Sep 24, 2019
577d442
De-propagate optional session from lint registration
Mark-Simulacrum Sep 24, 2019
2121b04
Handle lints, not passes in push_lints
Mark-Simulacrum Sep 24, 2019
748eccd
Lints being from a plugin is dependent on the lint, not the registration
Mark-Simulacrum Oct 7, 2019
b060f3b
Split module and crate late pass registration
Mark-Simulacrum Oct 7, 2019
e1079c8
Split out just registration to separate function
Mark-Simulacrum Oct 7, 2019
68c07db
No longer implicitly register lints when registering passes
Mark-Simulacrum Oct 7, 2019
7fef397
Make get_lints be a static function
Mark-Simulacrum Oct 7, 2019
2454512
Take lint passes as constructor functions
Mark-Simulacrum Oct 7, 2019
aa4ee2c
Move to storing constructor functions inside LintStore
Mark-Simulacrum Oct 7, 2019
c1abc30
Make declare_lint take any amount of boolean fields
Mark-Simulacrum Oct 8, 2019
7abb1fa
Remove side table of future incompatibility info
Mark-Simulacrum Oct 9, 2019
c4475c7
Access future incompatibility information directly
Mark-Simulacrum Oct 9, 2019
da56d1d
Remove all borrows of lint store from Session from librustc
Mark-Simulacrum Oct 9, 2019
dab3bd6
Create lint store during plugin registration
Mark-Simulacrum Oct 9, 2019
b761367
Fix test fallout
Mark-Simulacrum Oct 9, 2019
6be0a70
Update API to be more compatible with plugin needs
Mark-Simulacrum Oct 10, 2019
c290293
Derive `Rustc{En,De}codable` for `TokenStream`.
nnethercote Oct 15, 2019
02edd14
Convert some `InternedString`s to `Symbols`.
nnethercote Oct 18, 2019
c325553
Convert `InternedString`s to `Symbols` in `UnsafetyViolation`.
nnethercote Oct 18, 2019
78c3427
Remove unnecessary `impl Clean<String> for InternedString`.
nnethercote Oct 19, 2019
ddc1c27
Eliminate `intersect_opt`.
nnethercote Sep 19, 2019
b8214e9
Convert fields within `DefPathData` from `InternedString` to `Symbol`.
nnethercote Oct 21, 2019
dddacf1
Change `SymbolName::name` from `InternedString` to `Symbol`.
nnethercote Oct 21, 2019
2da7a9c
Use `Symbol` for codegen unit names.
nnethercote Oct 21, 2019
08e2f05
Remove `InternedString`.
nnethercote Oct 21, 2019
33910f9
Deprecated proc_macro doesn't trigger warning on build library
XiangQingW Oct 21, 2019
c027be0
Deprecated proc_macro doesn't trigger warning on build library
XiangQingW Oct 21, 2019
ed965f1
Update E0659 error code long explanation to 2018 edition
GuillaumeGomez Oct 22, 2019
74db3e8
rustc_metadata: use a table for super_predicates.
eddyb Oct 18, 2019
7a80a11
rustc_metadata: use a table for fn_sig.
eddyb Oct 18, 2019
371cc39
rustc_metadata: use a table for impl_trait_ref.
eddyb Oct 18, 2019
fe84809
relax ExactSizeIterator bound on write_bytes: too many iterators don'…
RalfJung Oct 22, 2019
4e8d1b2
Add some documentation
Mark-Simulacrum Oct 22, 2019
eeb549b
Add Cow::is_borrowed and Cow::is_owned
Oct 5, 2019
360cdf4
Rollup merge of #65144 - clarfon:moo, r=sfackler
Centril Oct 23, 2019
2cb7d20
Rollup merge of #65193 - Mark-Simulacrum:lockless-lintstore, r=nikoma…
Centril Oct 23, 2019
d41bf54
Rollup merge of #65583 - eddyb:more-query-like-cross-crate-tables, r=…
Centril Oct 23, 2019
dd47daf
Rollup merge of #65641 - nnethercote:derive-TokenStream-Encodable-Dec…
Centril Oct 23, 2019
d8015f6
Rollup merge of #65648 - nnethercote:rm-intersect_opt, r=nikomatsakis
Centril Oct 23, 2019
c020d64
Rollup merge of #65657 - nnethercote:rm-InternedString-properly, r=eddyb
Centril Oct 23, 2019
cea5879
Rollup merge of #65666 - XiangQingW:proc_macro, r=petrochenkov
Centril Oct 23, 2019
9bcebab
Rollup merge of #65691 - GuillaumeGomez:2018-edition-E0659, r=Dylan-DPC
Centril Oct 23, 2019
fe3eb32
Rollup merge of #65704 - RalfJung:exact-size, r=oli-obk
Centril Oct 23, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
8000 Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use Symbol for codegen unit names.
This is a straightforward replacement except for two places where we
have to convert to `LocalInternedString` to get a stable sort.
  • Loading branch information
nnethercote committed Oct 21, 2019
commit 2da7a9c0d943e694eef17c0b47e87cbcde03a957
4 changes: 2 additions & 2 deletions src/librustc/dep_graph/dep_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ use crate::ich::{Fingerprint, StableHashingContext};
use rustc_data_structures::stable_hasher::{StableHasher, HashStable};
use std::fmt;
use std::hash::Hash;
use syntax_pos::symbol::InternedString;
use syntax_pos::symbol::Symbol;
use crate::traits;
use crate::traits::query::{
CanonicalProjectionGoal, CanonicalTyGoal, CanonicalTypeOpAscribeUserTypeGoal,
Expand Down Expand Up @@ -426,7 +426,7 @@ rustc_dep_node_append!([define_dep_nodes!][ <'tcx>

[anon] TraitSelect,

[] CompileCodegenUnit(InternedString),
[] CompileCodegenUnit(Symbol),

[eval_always] Analysis(CrateNum),
]);
Expand Down
20 changes: 10 additions & 10 deletions src/librustc/mir/mono.rs
E30A
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::hir::def_id::{DefId, CrateNum, LOCAL_CRATE};
use crate::hir::HirId;
use syntax::symbol::{InternedString, Symbol};
use syntax::symbol::Symbol;
use syntax::attr::InlineAttr;
use syntax::source_map::Span;
use crate::ty::{Instance, InstanceDef, TyCtxt, SymbolName, subst::InternalSubsts};
Expand Down Expand Up @@ -246,7 +246,7 @@ pub struct CodegenUnit<'tcx> {
/// name be unique amongst **all** crates. Therefore, it should
/// contain something unique to this crate (e.g., a module path)
/// as well as the crate name and disambiguator.
name: InternedString,
name: Symbol,
items: FxHashMap<MonoItem<'tcx>, (Linkage, Visibility)>,
size_estimate: Option<usize>,
}
Expand Down Expand Up @@ -294,19 +294,19 @@ impl_stable_hash_for!(enum self::Visibility {
});

impl<'tcx> CodegenUnit<'tcx> {
pub fn new(name: InternedString) -> CodegenUnit<'tcx> {
pub fn new(name: Symbol) -> CodegenUnit<'tcx> {
CodegenUnit {
name: name,
items: Default::default(),
size_estimate: None,
}
}

pub fn name(&self) -> &InternedString {
&self.name
pub fn name(&self) -> Symbol {
self.name
}

pub fn set_name(&mut self, name: InternedString) {
pub fn set_name(&mut self, name: Symbol) {
self.name = name;
}

Expand Down Expand Up @@ -474,7 +474,7 @@ impl CodegenUnitNameBuilder<'tcx> {
cnum: CrateNum,
components: I,
special_suffix: Option<S>)
-> InternedString
-> Symbol
where I: IntoIterator<Item=C>,
C: fmt::Display,
S: fmt::Display,
Expand All @@ -487,7 +487,7 @@ impl CodegenUnitNameBuilder<'tcx> {
cgu_name
} else {
let cgu_name = &cgu_name.as_str()[..];
InternedString::intern(&CodegenUnit::mangle_name(cgu_name))
Symbol::intern(&CodegenUnit::mangle_name(cgu_name))
}
}

Expand All @@ -497,7 +497,7 @@ impl CodegenUnitNameBuilder<'tcx> {
cnum: CrateNum,
components: I,
special_suffix: Option<S>)
-> InternedString
-> Symbol
where I: IntoIterator<Item=C>,
C: fmt::Display,
S: fmt::Display,
Expand Down Expand Up @@ -543,6 +543,6 @@ impl CodegenUnitNameBuilder<'tcx> {
write!(cgu_name, ".{}", special_suffix).unwrap();
}

InternedString::intern(&cgu_name[..])
Symbol::intern(&cgu_name[..])
}
}
4 changes: 2 additions & 2 deletions src/librustc/query/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use crate::traits::query::{
};

use std::borrow::Cow;
use syntax_pos::symbol::InternedString;
use syntax_pos::symbol::Symbol;

// Each of these queries corresponds to a function pointer field in the
// `Providers` struct for requesting a value of that type, and a method
Expand Down Expand Up @@ -924,7 +924,7 @@ rustc_queries! {
desc { "collect_and_partition_mono_items" }
}
query is_codegened_item(_: DefId) -> bool {}
query codegen_unit(_: InternedString) -> Arc<CodegenUnit<'tcx>> {
query codegen_unit(_: Symbol) -> Arc<CodegenUnit<'tcx>> {
no_force
desc { "codegen_unit" }
}
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/ty/query/keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use crate::mir;
use std::fmt::Debug;
use std::hash::Hash;
use syntax_pos::{Span, DUMMY_SP};
use syntax_pos::symbol::InternedString;
use syntax_pos::symbol::Symbol;

/// The `Key` trait controls what types can legally be used as the key
/// for a query.
Expand Down Expand Up @@ -190,7 +190,7 @@ impl<'tcx> Key for traits::Environment<'tcx> {
}
}

impl Key for InternedString {
impl Key for Symbol {
fn query_crate(&self) -> CrateNum {
LOCAL_CRATE
}
Expand Down
1 change: 0 additions & 1 deletion src/librustc/ty/query/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ use std::ops::Deref;
use std::sync::Arc;
use std::any::type_name;
use syntax_pos::{Span, DUMMY_SP};
use syntax_pos::symbol::InternedString;
use syntax::attr;
use syntax::ast;
use syntax::feature_gate;
Expand Down
6 changes: 3 additions & 3 deletions src/librustc_codegen_llvm/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ use rustc_codegen_ssa::back::write::submit_codegened_module_to_llvm;

use std::ffi::CString;
use std::time::Instant;
use syntax_pos::symbol::InternedString;
use syntax_pos::symbol::Symbol;
use rustc::hir::CodegenFnAttrs;

use crate::value::Value;
Expand Down Expand Up @@ -105,7 +105,7 @@ pub fn iter_globals(llmod: &'ll llvm::Module) -> ValueIter<'ll> {

pub fn compile_codegen_unit(
tcx: TyCtxt<'tcx>,
cgu_name: InternedString,
cgu_name: Symbol,
tx_to_llvm_workers: &std::sync::mpsc::Sender<Box<dyn std::any::Any + Send>>,
) {
let prof_timer = tcx.prof.generic_activity("codegen_module");
Expand All @@ -131,7 +131,7 @@ pub fn compile_codegen_unit(

fn module_codegen(
tcx: TyCtxt<'_>,
cgu_name: InternedString,
cgu_name: Symbol,
) -> ModuleCodegen<ModuleLlvm> {
let cgu = tcx.codegen_unit(cgu_name);
// Instantiate monomorphizations without filling out definitions yet...
Expand Down
3 changes: 1 addition & 2 deletions src/librustc_codegen_llvm/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ use rustc_codegen_ssa::CompiledModule;
use errors::{FatalError, Handler};
use rustc::dep_graph::WorkProduct;
use syntax_expand::allocator::AllocatorKind;
use syntax_pos::symbol::InternedString;
pub use llvm_util::target_features;
use std::any::Any;
use std::sync::Arc;
Expand Down Expand Up @@ -123,7 +122,7 @@ impl ExtraBackendMethods for LlvmCodegenBackend {
}
fn compile_codegen_unit(
&self, tcx: TyCtxt<'_>,
cgu_name: InternedString,
cgu_name: Symbol,
tx: &std::sync::mpsc::Sender<Box<dyn Any + Send>>,
) {
base::compile_codegen_unit(tcx, cgu_name, tx);
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_codegen_ssa/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ pub fn codegen_crate<B: ExtraBackendMethods>(
// unnecessarily.
if tcx.dep_graph.is_fully_enabled() {
for cgu in &codegen_units {
tcx.codegen_unit(cgu.name().clone());
tcx.codegen_unit(cgu.name());
}
}

Expand Down Expand Up @@ -603,7 +603,7 @@ pub fn codegen_crate<B: ExtraBackendMethods>(
match cgu_reuse {
CguReuse::No => {
let start_time = Instant::now();
backend.compile_codegen_unit(tcx, *cgu.name(), &ongoing_codegen.coordinator_send);
backend.compile_codegen_unit(tcx, cgu.name(), &ongoing_codegen.coordinator_send);
total_codegen_time += start_time.elapsed();
false
}
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_codegen_ssa/traits/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use rustc_codegen_utils::codegen_backend::CodegenBackend;
use std::sync::Arc;
use std::sync::mpsc;
use syntax_expand::allocator::AllocatorKind;
use syntax_pos::symbol::InternedString;
use syntax_pos::symbol::Symbol;

pub trait BackendTypes {
type Value: CodegenObject;
Expand Down Expand Up @@ -50,7 +50,7 @@ pub trait ExtraBackendMethods: CodegenBackend + WriteBackendMethods + Sized + Se
fn compile_codegen_unit(
&self,
tcx: TyCtxt<'_>,
cgu_name: InternedString,
cgu_name: Symbol,
tx_to_llvm_workers: &mpsc::Sender<Box<dyn std::any::Any + Send>>,
);
// If find_features is true this won't access `sess.crate_types` by assuming
Expand Down
8 changes: 4 additions & 4 deletions src/librustc_incremental/assert_module_sources.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use rustc::mir::mono::CodegenUnitNameBuilder;
use rustc::ty::TyCtxt;
use std::collections::BTreeSet;
use syntax::ast;
use syntax::symbol::{InternedString, Symbol, sym};
use syntax::symbol::{Symbol, sym};
use rustc::ich::{ATTR_PARTITION_REUSED, ATTR_PARTITION_CODEGENED,
ATTR_EXPECTED_CGU_REUSE};

Expand All @@ -45,8 +45,8 @@ pub fn assert_module_sources(tcx: TyCtxt<'_>) {
.collect_and_partition_mono_items(LOCAL_CRATE)
.1
.iter()
.map(|cgu| *cgu.name())
.collect::<BTreeSet<InternedString>>();
.map(|cgu| cgu.name())
.collect::<BTreeSet<Symbol>>();

let ams = AssertModuleSource {
tcx,
Expand All @@ -61,7 +61,7 @@ pub fn assert_module_sources(tcx: TyCtxt<'_>) {

struct AssertModuleSource<'tcx> {
tcx: TyCtxt<'tcx>,
available_cgus: BTreeSet<InternedString>,
available_cgus: BTreeSet<Symbol>,
}

impl AssertModuleSource<'tcx> {
Expand Down
39 changes: 18 additions & 21 deletions src/librustc_mir/monomorphize/partitioning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ use std::collections::hash_map::Entry;
use std::cmp;
use std::sync::Arc;

use syntax::symbol::InternedString;
use syntax::symbol::Symbol;
use rustc::hir::CodegenFnAttrFlags;
use rustc::hir::def::DefKind;
use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE, CRATE_DEF_INDEX};
Expand All @@ -121,7 +121,7 @@ pub enum PartitioningStrategy {
}

// Anything we can't find a proper codegen unit for goes into this.
fn fallback_cgu_name(name_builder: &mut CodegenUnitNameBuilder<'_>) -> InternedString {
fn fallback_cgu_name(name_builder: &mut CodegenUnitNameBuilder<'_>) -> Symbol {
name_builder.build_cgu_name(LOCAL_CRATE, &["fallback"], Some("cgu"))
}

Expand Down Expand Up @@ -185,9 +185,7 @@ where
internalization_candidates: _,
} = post_inlining;

result.sort_by(|cgu1, cgu2| {
cgu1.name().cmp(cgu2.name())
});
result.sort_by_cached_key(|cgu| cgu.name().as_str());

result
}
Expand All @@ -203,7 +201,7 @@ struct PreInliningPartitioning<'tcx> {
/// to keep track of that.
#[derive(Clone, PartialEq, Eq, Debug)]
enum MonoItemPlacement {
SingleCgu { cgu_name: InternedString },
SingleCgu { cgu_name: Symbol },
MultipleCgus,
}

Expand Down Expand Up @@ -251,8 +249,8 @@ where
None => fallback_cgu_name(cgu_name_builder),
};

let codegen_unit = codegen_units.entry(codegen_unit_name.clone())
.or_insert_with(|| CodegenUnit::new(codegen_unit_name.clone()));
let codegen_unit = codegen_units.entry(codegen_unit_name)
.or_insert_with(|| CodegenUnit::new(codegen_unit_name));

let mut can_be_internalized = true;
let (linkage, visibility) = mono_item_linkage_and_visibility(
Expand All @@ -273,8 +271,7 @@ where
// crate with just types (for example), we could wind up with no CGU.
if codegen_units.is_empty() {
let codegen_unit_name = fallback_cgu_name(cgu_name_builder);
codegen_units.insert(codegen_unit_name.clone(),
CodegenUnit::new(codegen_unit_name.clone()));
codegen_units.insert(codegen_unit_name, CodegenUnit::new(codegen_unit_name));
}

PreInliningPartitioning {
Expand Down Expand Up @@ -492,7 +489,7 @@ fn merge_codegen_units<'tcx>(
// smallest into each other) we're sure to start off with a deterministic
// order (sorted by name). This'll mean that if two cgus have the same size
// the stable sort below will keep everything nice and deterministic.
codegen_units.sort_by_key(|cgu| *cgu.name());
codegen_units.sort_by_cached_key(|cgu| cgu.name().as_str());

// Merge the two smallest codegen units until the target size is reached.
while codegen_units.len() > target_cgu_count {
Expand Down Expand Up @@ -537,7 +534,7 @@ fn place_inlined_mono_items<'tcx>(initial_partitioning: PreInliningPartitioning<
follow_inlining(*root, inlining_map, &mut reachable);
}

let mut new_codegen_unit = CodegenUnit::new(old_codegen_unit.name().clone());
let mut new_codegen_unit = CodegenUnit::new(old_codegen_unit.name());

// Add all monomorphizations that are not already there.
for mono_item in reachable {
Expand All @@ -564,16 +561,16 @@ fn place_inlined_mono_items<'tcx>(initial_partitioning: PreInliningPartitioning<
Entry::Occupied(e) => {
let placement = e.into_mut();
debug_assert!(match *placement {
MonoItemPlacement::SingleCgu { ref cgu_name } => {
*cgu_name != *new_codegen_unit.name()
MonoItemPlacement::SingleCgu { cgu_name } => {
cgu_name != new_codegen_unit.name()
}
MonoItemPlacement::MultipleCgus => true,
});
*placement = MonoItemPlacement::MultipleCgus;
}
Entry::Vacant(e) => {
e.insert(MonoItemPlacement::SingleCgu {
cgu_name: new_codegen_unit.name().clone()
cgu_name: new_codegen_unit.name()
});
}
}
Expand Down Expand Up @@ -638,7 +635,7 @@ fn internalize_symbols<'tcx>(
// accessed from outside its defining codegen unit.
for cgu in &mut partitioning.codegen_units {
let home_cgu = MonoItemPlacement::SingleCgu {
cgu_name: cgu.name().clone()
cgu_name: cgu.name()
};

for (accessee, linkage_and_visibility) in cgu.items_mut() {
Expand Down Expand Up @@ -717,15 +714,15 @@ fn characteristic_def_id_of_mono_item<'tcx>(
}
}

type CguNameCache = FxHashMap<(DefId, bool), InternedString>;
type CguNameCache = FxHashMap<(DefId, bool), Symbol>;

fn compute_codegen_unit_name(
tcx: TyCtxt<'_>,
name_builder: &mut CodegenUnitNameBuilder<'_>,
def_id: DefId,
volatile: bool,
cache: &mut CguNameCache,
) -> InternedString {
) -> Symbol {
// Find the innermost module that is not nested within a function.
let mut current_def_id = def_id;
let mut cgu_def_id = None;
Expand Down Expand Up @@ -777,7 +774,7 @@ fn compute_codegen_unit_name(
fn numbered_codegen_unit_name(
name_builder: &mut CodegenUnitNameBuilder<'_>,
index: usize,
) -> InternedString {
) -> Symbol {
name_builder.build_cgu_name_no_mangle(LOCAL_CRATE, &["cgu"], Some(index))
}

Expand Down Expand Up @@ -929,7 +926,7 @@ fn collect_and_partition_mono_items(
for (&mono_item, &linkage) in cgu.items() {
item_to_cgus.entry(mono_item)
.or_default()
.push((cgu.name().clone(), linkage));
.push((cgu.name(), linkage));
}
}

Expand Down Expand Up @@ -991,7 +988,7 @@ pub fn provide(providers: &mut Providers<'_>) {
providers.codegen_unit = |tcx, name| {
let (_, all) = tcx.collect_and_partition_mono_items(LOCAL_CRATE);
all.iter()
.find(|cgu| *cgu.name() == name)
.find(|cgu| cgu.name() == name)
.cloned()
.unwrap_or_else(|| panic!("failed to find cgu with name {:?}", name))
};
Expand Down
0