@@ -2,14 +2,12 @@ use crate::dep_graph::{DepConstructor, DepNode, WorkProduct, WorkProductId};
2
2
use crate :: ich:: { NodeIdHashingMode , StableHashingContext } ;
3
3
use crate :: ty:: print:: obsolete:: DefPathBasedNames ;
4
4
use crate :: ty:: { subst:: InternalSubsts , Instance , InstanceDef , SymbolName , TyCtxt } ;
5
- use rustc_attr:: InlineAttr ;
6
5
use rustc_data_structures:: base_n;
7
6
use rustc_data_structures:: fingerprint:: Fingerprint ;
8
7
use rustc_data_structures:: fx:: FxHashMap ;
9
8
use rustc_data_structures:: stable_hasher:: { HashStable , StableHasher } ;
10
9
use rustc_hir:: def_id:: { CrateNum , DefId , LOCAL_CRATE } ;
11
10
use rustc_hir:: HirId ;
12
- use rustc_session:: config:: OptLevel ;
13
11
use rustc_span:: source_map:: Span ;
14
12
use rustc_span:: symbol:: Symbol ;
15
13
use std:: fmt;
@@ -80,13 +78,9 @@ impl<'tcx> MonoItem<'tcx> {
80
78
}
81
79
82
80
pub fn instantiation_mode ( & self , tcx : TyCtxt < ' tcx > ) -> InstantiationMode {
83
- let generate_cgu_internal_copies = tcx
84
- . sess
85
- . opts
86
- . debugging_opts
87
- . inline_in_all_cgus
88
- . unwrap_or_else ( || tcx. sess . opts . optimize != OptLevel :: No )
89
- && !tcx. sess . opts . cg . link_dead_code ;
81
+ let generate_cgu_internal_copies =
82
+ tcx. sess . opts . debugging_opts . inline_in_all_cgus . unwrap_or ( false )
83
+ && !tcx. sess . opts . cg . link_dead_code ;
90
84
91
85
match * self {
92
86
MonoItem :: Fn ( ref instance) => {
@@ -107,15 +101,7 @@ impl<'tcx> MonoItem<'tcx> {
107
101
return InstantiationMode :: LocalCopy ;
108
102
}
109
103
110
- // Finally, if this is `#[inline(always)]` we're sure to respect
111
- // that with an inline copy per CGU, but otherwise we'll be
112
- // creating one copy of this `#[inline]` function which may
113
- // conflict with upstream crates as it could be an exported
114
- // symbol.
115
- match tcx. codegen_fn_attrs ( instance. def_id ( ) ) . inline {
116
- InlineAttr :: Always => InstantiationMode :: LocalCopy ,
117
- _ => InstantiationMode :: GloballyShared { may_conflict : true } ,
118
- }
104
+ return InstantiationMode :: GloballyShared { may_conflict : true } ;
119
105
}
120
106
MonoItem :: Static ( ..) | MonoItem :: GlobalAsm ( ..) => {
121
107
InstantiationMode :: GloballyShared { may_conflict : false }
0 commit comments