diff --git a/src/librustc_mir/monomorphize/partitioning.rs b/src/librustc_mir/monomorphize/partitioning.rs index fd094ffc1cf4f..db96a7fe4553f 100644 --- a/src/librustc_mir/monomorphize/partitioning.rs +++ b/src/librustc_mir/monomorphize/partitioning.rs @@ -303,7 +303,6 @@ fn place_root_mono_items<'a, 'tcx, I>(tcx: TyCtxt<'a, 'tcx, 'tcx>, { let mut roots = FxHashSet(); let mut codegen_units = FxHashMap(); - let is_incremental_build = tcx.sess.opts.incremental.is_some(); let mut internalization_candidates = FxHashSet(); // Determine if monomorphizations instantiated in this crate will be made @@ -323,14 +322,11 @@ fn place_root_mono_items<'a, 'tcx, I>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } let characteristic_def_id = characteristic_def_id_of_mono_item(tcx, mono_item); - let is_volatile = is_incremental_build && - mono_item.is_generic_fn(); let codegen_unit_name = match characteristic_def_id { Some(def_id) => compute_codegen_unit_name(tcx, cgu_name_builder, def_id, - is_volatile, cgu_name_cache), None => fallback_cgu_name(cgu_name_builder), }; @@ -794,12 +790,11 @@ fn characteristic_def_id_of_mono_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } } -type CguNameCache = FxHashMap<(DefId, bool), InternedString>; +type CguNameCache = FxHashMap; fn compute_codegen_unit_name(tcx: TyCtxt, name_builder: &mut CodegenUnitNameBuilder, def_id: DefId, - volatile: bool, cache: &mut CguNameCache) -> InternedString { // Find the innermost module that is not nested within a function @@ -838,7 +833,7 @@ fn compute_codegen_unit_name(tcx: TyCtxt, let cgu_def_id = cgu_def_id.unwrap(); - cache.entry((cgu_def_id, volatile)).or_insert_with(|| { + cache.entry(cgu_def_id).or_insert_with(|| { let def_path = tcx.def_path(cgu_def_id); let components = def_path @@ -846,13 +841,8 @@ fn compute_codegen_unit_name(tcx: TyCtxt, .iter() .map(|part| part.data.as_interned_str()); - let volatile_suffix = if volatile { - Some("volatile") - } else { - None - }; - - name_builder.build_cgu_name(def_path.krate, components, volatile_suffix) + let suffix: Option<&str> = None; + name_builder.build_cgu_name(def_path.krate, components, suffix) }).clone() } diff --git a/src/test/codegen-units/partitioning/extern-generic.rs b/src/test/codegen-units/partitioning/extern-generic.rs index a774376690a97..e6b9d829aed78 100644 --- a/src/test/codegen-units/partitioning/extern-generic.rs +++ b/src/test/codegen-units/partitioning/extern-generic.rs @@ -58,5 +58,5 @@ mod mod3 { // Make sure the two generic functions from the extern crate get instantiated // once for the current crate -//~ MONO_ITEM fn cgu_generic_function::foo[0]<&str> @@ cgu_generic_function.volatile[External] -//~ MONO_ITEM fn cgu_generic_function::bar[0]<&str> @@ cgu_generic_function.volatile[External] +//~ MONO_ITEM fn cgu_generic_function::foo[0]<&str> @@ cgu_generic_function[External] +//~ MONO_ITEM fn cgu_generic_function::bar[0]<&str> @@ cgu_generic_function[External] diff --git a/src/test/codegen-units/partitioning/local-generic.rs b/src/test/codegen-units/partitioning/local-generic.rs index 7c8ca20e1e3c0..fe1fd8cc65572 100644 --- a/src/test/codegen-units/partitioning/local-generic.rs +++ b/src/test/codegen-units/partitioning/local-generic.rs @@ -16,10 +16,10 @@ #![allow(dead_code)] #![crate_type="lib"] -//~ MONO_ITEM fn local_generic::generic[0] @@ local_generic.volatile[External] -//~ MONO_ITEM fn local_generic::generic[0] @@ local_generic.volatile[External] -//~ MONO_ITEM fn local_generic::generic[0] @@ local_generic.volatile[External] -//~ MONO_ITEM fn local_generic::generic[0]<&str> @@ local_generic.volatile[External] +//~ MONO_ITEM fn local_generic::generic[0] @@ local_generic[External] +//~ MONO_ITEM fn local_generic::generic[0] @@ local_generic[External] +//~ MONO_ITEM fn local_generic::generic[0] @@ local_generic[External] +//~ MONO_ITEM fn local_generic::generic[0]<&str> @@ local_generic[External] pub fn generic(x: T) -> T { x } //~ MONO_ITEM fn local_generic::user[0] @@ local_generic[Internal] diff --git a/src/test/codegen-units/partitioning/shared-generics.rs b/src/test/codegen-units/partitioning/shared-generics.rs index 880361fac2ee0..c64a4545e40d1 100644 --- a/src/test/codegen-units/partitioning/shared-generics.rs +++ b/src/test/codegen-units/partitioning/shared-generics.rs @@ -19,7 +19,7 @@ extern crate shared_generics_aux; //~ MONO_ITEM fn shared_generics::foo[0] pub fn foo() { - //~ MONO_ITEM fn shared_generics_aux::generic_fn[0] @@ shared_generics_aux.volatile[External] + //~ MONO_ITEM fn shared_generics_aux::generic_fn[0] @@ shared_generics_aux[External] let _ = shared_generics_aux::generic_fn(0u16, 1u16); // This should not generate a monomorphization because it's already diff --git a/src/test/codegen-units/partitioning/vtable-through-const.rs b/src/test/codegen-units/partitioning/vtable-through-const.rs index 74533c1015b60..49cbeb0965589 100644 --- a/src/test/codegen-units/partitioning/vtable-through-const.rs +++ b/src/test/codegen-units/partitioning/vtable-through-const.rs @@ -78,20 +78,20 @@ fn start(_: isize, _: *const *const u8) -> isize { // Since Trait1::do_something() is instantiated via its default implementation, // it is considered a generic and is instantiated here only because it is // referenced in this module. - //~ MONO_ITEM fn vtable_through_const::mod1[0]::Trait1[0]::do_something_else[0] @@ vtable_through_const-mod1.volatile[External] + //~ MONO_ITEM fn vtable_through_const::mod1[0]::Trait1[0]::do_something_else[0] @@ vtable_through_const-mod1[External] // Although it is never used, Trait1::do_something_else() has to be // instantiated locally here too, otherwise the <&u32 as &Trait1> vtable // could not be fully constructed. - //~ MONO_ITEM fn vtable_through_const::mod1[0]::Trait1[0]::do_something[0] @@ vtable_through_const-mod1.volatile[External] + //~ MONO_ITEM fn vtable_through_const::mod1[0]::Trait1[0]::do_something[0] @@ vtable_through_const-mod1[External] mod1::TRAIT1_REF.do_something(); // Same as above - //~ MONO_ITEM fn vtable_through_const::mod1[0]::{{impl}}[1]::do_something[0] @@ vtable_through_const-mod1.volatile[External] - //~ MONO_ITEM fn vtable_through_const::mod1[0]::{{impl}}[1]::do_something_else[0] @@ vtable_through_const-mod1.volatile[External] + //~ MONO_ITEM fn vtable_through_const::mod1[0]::{{impl}}[1]::do_something[0] @@ vtable_through_const-mod1[External] + //~ MONO_ITEM fn vtable_through_const::mod1[0]::{{impl}}[1]::do_something_else[0] @@ vtable_through_const-mod1[External] mod1::TRAIT1_GEN_REF.do_something(0u8); - //~ MONO_ITEM fn vtable_through_const::mod1[0]::id[0] @@ vtable_through_const-mod1.volatile[External] + //~ MONO_ITEM fn vtable_through_const::mod1[0]::id[0] @@ vtable_through_const-mod1[External] mod1::ID_CHAR('x'); 0