@@ -24,10 +24,16 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
2424 ) -> & ' hir hir:: InlineAsm < ' hir > {
2525 // Rustdoc needs to support asm! from foreign architectures: don't try
2626 // lowering the register constraints in this case.
27- let asm_arch = if self . sess . opts . actually_rustdoc { None } else { self . sess . asm_arch } ;
28- if asm_arch. is_none ( ) && !self . sess . opts . actually_rustdoc {
29- struct_span_err ! ( self . sess, sp, E0472 , "inline assembly is unsupported on this target" )
30- . emit ( ) ;
27+ let asm_arch =
28+ if self . tcx . sess . opts . actually_rustdoc { None } else { self . tcx . sess . asm_arch } ;
29+ if asm_arch. is_none ( ) && !self . tcx . sess . opts . actually_rustdoc {
30+ struct_span_err ! (
31+ self . tcx. sess,
32+ sp,
33+ E0472 ,
34+ "inline assembly is unsupported on this target"
35+ )
36+ . emit ( ) ;
3137 }
3238 if let Some ( asm_arch) = asm_arch {
3339 // Inline assembly is currently only stable for these architectures.
@@ -40,9 +46,9 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
4046 | asm:: InlineAsmArch :: RiscV32
4147 | asm:: InlineAsmArch :: RiscV64
4248 ) ;
43- if !is_stable && !self . sess . features_untracked ( ) . asm_experimental_arch {
49+ if !is_stable && !self . tcx . features ( ) . asm_experimental_arch {
4450 feature_err (
45- & self . sess . parse_sess ,
51+ & self . tcx . sess . parse_sess ,
4652 sym:: asm_experimental_arch,
4753 sp,
4854 "inline assembly is not stable yet on this architecture" ,
@@ -52,17 +58,16 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
5258 }
5359 if asm. options . contains ( InlineAsmOptions :: ATT_SYNTAX )
5460 && !matches ! ( asm_arch, Some ( asm:: InlineAsmArch :: X86 | asm:: InlineAsmArch :: X86_64 ) )
55- && !self . sess . opts . actually_rustdoc
61+ && !self . tcx . sess . opts . actually_rustdoc
5662 {
57- self . sess
63+ self . tcx
64+ . sess
5865 . struct_span_err ( sp, "the `att_syntax` option is only supported on x86" )
5966 . emit ( ) ;
6067 }
61- if asm. options . contains ( InlineAsmOptions :: MAY_UNWIND )
62- && !self . sess . features_untracked ( ) . asm_unwind
63- {
68+ if asm. options . contains ( InlineAsmOptions :: MAY_UNWIND ) && !self . tcx . features ( ) . asm_unwind {
6469 feature_err (
65- & self . sess . parse_sess ,
70+ & self . tcx . sess . parse_sess ,
6671 sym:: asm_unwind,
6772 sp,
6873 "the `may_unwind` option is unstable" ,
@@ -73,20 +78,20 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
7378 let mut clobber_abis = FxHashMap :: default ( ) ;
7479 if let Some ( asm_arch) = asm_arch {
7580 for ( abi_name, abi_span) in & asm. clobber_abis {
76- match asm:: InlineAsmClobberAbi :: parse ( asm_arch, & self . sess . target , * abi_name) {
81+ match asm:: InlineAsmClobberAbi :: parse ( asm_arch, & self . tcx . sess . target , * abi_name) {
7782 Ok ( abi) => {
7883 // If the abi was already in the list, emit an error
7984 match clobber_abis. get ( & abi) {
8085 Some ( ( prev_name, prev_sp) ) => {
81- let mut err = self . sess . struct_span_err (
86+ let mut err = self . tcx . sess . struct_span_err (
8287 * abi_span,
8388 & format ! ( "`{}` ABI specified multiple times" , prev_name) ,
8489 ) ;
8590 err. span_label ( * prev_sp, "previously specified here" ) ;
8691
8792 // Multiple different abi names may actually be the same ABI
8893 // If the specified ABIs are not the same name, alert the user that they resolve to the same ABI
89- let source_map = self . sess . source_map ( ) ;
94+ let source_map = self . tcx . sess . source_map ( ) ;
9095 if source_map. span_to_snippet ( * prev_sp)
9196 != source_map. span_to_snippet ( * abi_span)
9297 {
@@ -101,16 +106,19 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
101106 }
102107 }
103108 Err ( & [ ] ) => {
104- self . sess
109+ self . tcx
110+ . sess
105111 . struct_span_err (
106112 * abi_span,
107113 "`clobber_abi` is not supported on this target" ,
108114 )
109115 . emit ( ) ;
110116 }
111117 Err ( supported_abis) => {
112- let mut err =
113- self . sess . struct_span_err ( * abi_span, "invalid ABI for `clobber_abi`" ) ;
118+ let mut err = self
119+ . tcx
120+ . sess
121+ . struct_span_err ( * abi_span, "invalid ABI for `clobber_abi`" ) ;
114122 let mut abis = format ! ( "`{}`" , supported_abis[ 0 ] ) ;
115123 for m in & supported_abis[ 1 ..] {
116124 let _ = write ! ( abis, ", `{}`" , m) ;
@@ -128,7 +136,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
128136 // Lower operands to HIR. We use dummy register classes if an error
129137 // occurs during lowering because we still need to be able to produce a
130138 // valid HIR.
131- let sess = self . sess ;
139+ let sess = self . tcx . sess ;
132140 let mut operands: Vec < _ > = asm
133141 . operands
134142 . iter ( )
@@ -184,9 +192,9 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
184192 }
185193 }
186194 InlineAsmOperand :: Const { ref anon_const } => {
187- if !self . sess . features_untracked ( ) . asm_const {
195+ if !self . tcx . features ( ) . asm_const {
188196 feature_err (
189- & self . sess . parse_sess ,
197+ & sess. parse_sess ,
190198 sym:: asm_const,
191199 * op_sp,
192200 "const operands for inline assembly are unstable" ,
@@ -198,9 +206,9 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
198206 }
199207 }
200208 InlineAsmOperand :: Sym { ref sym } => {
201- if !self . sess . features_untracked ( ) . asm_sym {
209+ if !self . tcx . features ( ) . asm_sym {
202210 feature_err (
203- & self . sess . parse_sess ,
211+ & sess. parse_sess ,
204212 sym:: asm_sym,
205213 * op_sp,
206214 "sym operands for inline assembly are unstable" ,
0 commit comments