@@ -200,8 +200,7 @@ pub fn find_stability(
200
200
sym:: rustc_allowed_through_unstable_modules => allowed_through_unstable_modules = true ,
201
201
sym:: unstable => {
202
202
if stab. is_some ( ) {
203
- sess. parse_sess
204
- . emit_err ( session_diagnostics:: MultipleStabilityLevels { span : attr. span } ) ;
203
+ sess. emit_err ( session_diagnostics:: MultipleStabilityLevels { span : attr. span } ) ;
205
204
break ;
206
205
}
207
206
@@ -211,8 +210,7 @@ pub fn find_stability(
211
210
}
212
211
sym:: stable => {
213
212
if stab. is_some ( ) {
214
- sess. parse_sess
215
- . emit_err ( session_diagnostics:: MultipleStabilityLevels { span : attr. span } ) ;
213
+ sess. emit_err ( session_diagnostics:: MultipleStabilityLevels { span : attr. span } ) ;
216
214
break ;
217
215
}
218
216
if let Some ( ( feature, level) ) = parse_stability ( sess, attr) {
@@ -256,8 +254,7 @@ pub fn find_const_stability(
256
254
sym:: rustc_promotable => promotable = true ,
257
255
sym:: rustc_const_unstable => {
258
256
if const_stab. is_some ( ) {
259
- sess. parse_sess
260
- . emit_err ( session_diagnostics:: MultipleStabilityLevels { span : attr. span } ) ;
257
+ sess. emit_err ( session_diagnostics:: MultipleStabilityLevels { span : attr. span } ) ;
261
258
break ;
262
259
}
263
260
@@ -268,8 +265,7 @@ pub fn find_const_stability(
268
265
}
269
266
sym:: rustc_const_stable => {
270
267
if const_stab. is_some ( ) {
271
- sess. parse_sess
272
- . emit_err ( session_diagnostics:: MultipleStabilityLevels { span : attr. span } ) ;
268
+ sess. emit_err ( session_diagnostics:: MultipleStabilityLevels { span : attr. span } ) ;
273
269
break ;
274
270
}
275
271
if let Some ( ( feature, level) ) = parse_stability ( sess, attr) {
@@ -303,8 +299,7 @@ pub fn find_body_stability(
303
299
for attr in attrs {
304
300
if attr. has_name ( sym:: rustc_default_body_unstable) {
305
301
if body_stab. is_some ( ) {
306
- sess. parse_sess
307
- . emit_err ( session_diagnostics:: MultipleStabilityLevels { span : attr. span } ) ;
302
+ sess. emit_err ( session_diagnostics:: MultipleStabilityLevels { span : attr. span } ) ;
308
303
break ;
309
304
}
310
305
@@ -319,7 +314,7 @@ pub fn find_body_stability(
319
314
320
315
fn insert_or_error ( sess : & Session , meta : & MetaItem , item : & mut Option < Symbol > ) -> Option < ( ) > {
321
316
if item. is_some ( ) {
322
- sess. parse_sess . emit_err ( session_diagnostics:: MultipleItem {
317
+ sess. emit_err ( session_diagnostics:: MultipleItem {
323
318
span : meta. span ,
324
319
item : pprust:: path_to_string ( & meta. path ) ,
325
320
} ) ;
@@ -343,11 +338,11 @@ fn parse_stability(sess: &Session, attr: &Attribute) -> Option<(Symbol, Stabilit
343
338
let mut since = None ;
344
339
for meta in metas {
345
340
let Some ( mi) = meta. meta_item ( ) else {
346
- sess. parse_sess . emit_err ( session_diagnostics:: UnsupportedLiteral {
341
+ sess. emit_err ( session_diagnostics:: UnsupportedLiteral {
347
342
span : meta. span ( ) ,
348
343
reason : UnsupportedLiteralReason :: Generic ,
349
344
is_bytestr : false ,
350
- start_point_span : sess. parse_sess . source_map ( ) . start_point ( meta. span ( ) ) ,
345
+ start_point_span : sess. source_map ( ) . start_point ( meta. span ( ) ) ,
351
346
} ) ;
352
347
return None ;
353
348
} ;
@@ -356,7 +351,7 @@ fn parse_stability(sess: &Session, attr: &Attribute) -> Option<(Symbol, Stabilit
356
351
sym:: feature => insert_or_error ( sess, mi, & mut feature) ?,
357
352
sym:: since => insert_or_error ( sess, mi, & mut since) ?,
358
353
_ => {
359
- sess. parse_sess . emit_err ( session_diagnostics:: UnknownMetaItem {
354
+ sess. emit_err ( session_diagnostics:: UnknownMetaItem {
360
355
span : meta. span ( ) ,
361
356
item : pprust:: path_to_string ( & mi. path ) ,
362
357
expected : & [ "feature" , "since" ] ,
@@ -378,11 +373,11 @@ fn parse_stability(sess: &Session, attr: &Attribute) -> Option<(Symbol, Stabilit
378
373
Some ( ( feature, level) )
379
374
}
380
375
( None , _) => {
381
- sess. parse_sess . emit_err ( session_diagnostics:: MissingFeature { span : attr. span } ) ;
376
+ sess. emit_err ( session_diagnostics:: MissingFeature { span : attr. span } ) ;
382
377
None
383
378
}
384
379
_ => {
385
- sess. parse_sess . emit_err ( session_diagnostics:: MissingSince { span : attr. span } ) ;
380
+ sess. emit_err ( session_diagnostics:: MissingSince { span : attr. span } ) ;
386
381
None
387
382
}
388
383
}
@@ -402,11 +397,11 @@ fn parse_unstability(sess: &Session, attr: &Attribute) -> Option<(Symbol, Stabil
402
397
let mut implied_by = None ;
403
398
for meta in metas {
404
399
let Some ( mi) = meta. meta_item ( ) else {
405
- sess. parse_sess . emit_err ( session_diagnostics:: UnsupportedLiteral {
400
+ sess. emit_err ( session_diagnostics:: UnsupportedLiteral {
406
401
span : meta. span ( ) ,
407
402
reason : UnsupportedLiteralReason :: Generic ,
408
403
is_bytestr : false ,
409
- start_point_span : sess. parse_sess . source_map ( ) . start_point ( meta. span ( ) ) ,
404
+ start_point_span : sess. source_map ( ) . start_point ( meta. span ( ) ) ,
410
405
} ) ;
411
406
return None ;
412
407
} ;
@@ -446,7 +441,7 @@ fn parse_unstability(sess: &Session, attr: &Attribute) -> Option<(Symbol, Stabil
446
441
}
447
442
sym:: implied_by => insert_or_error ( sess, mi, & mut implied_by) ?,
448
443
_ => {
449
- sess. parse_sess . emit_err ( session_diagnostics:: UnknownMetaItem {
444
+ sess. emit_err ( session_diagnostics:: UnknownMetaItem {
450
445
span : meta. span ( ) ,
451
446
item : pprust:: path_to_string ( & mi. path ) ,
452
447
expected : & [ "feature" , "reason" , "issue" , "soft" , "implied_by" ] ,
@@ -459,7 +454,7 @@ fn parse_unstability(sess: &Session, attr: &Attribute) -> Option<(Symbol, Stabil
459
454
match ( feature, reason, issue) {
460
455
( Some ( feature) , reason, Some ( _) ) => {
461
456
if !rustc_lexer:: is_ident ( feature. as_str ( ) ) {
462
- sess. parse_sess . emit_err ( session_diagnostics:: NonIdentFeature { span : attr. span } ) ;
457
+ sess. emit_err ( session_diagnostics:: NonIdentFeature { span : attr. span } ) ;
463
458
return None ;
464
459
}
465
460
let level = StabilityLevel :: Unstable {
@@ -471,7 +466,7 @@ fn parse_unstability(sess: &Session, attr: &Attribute) -> Option<(Symbol, Stabil
471
466
Some ( ( feature, level) )
472
467
}
473
468
( None , _, _) => {
474
- sess. parse_sess . emit_err ( session_diagnostics:: MissingFeature { span : attr. span } ) ;
469
+ sess. emit_err ( session_diagnostics:: MissingFeature { span : attr. span } ) ;
475
470
return None ;
476
471
}
477
472
_ => {
@@ -753,7 +748,7 @@ pub fn find_deprecation(
753
748
MetaItemKind :: List ( list) => {
754
749
let get = |meta : & MetaItem , item : & mut Option < Symbol > | {
755
750
if item. is_some ( ) {
756
- sess. parse_sess . emit_err ( session_diagnostics:: MultipleItem {
751
+ sess. emit_err ( session_diagnostics:: MultipleItem {
757
752
span : meta. span ,
758
753
item : pprust:: path_to_string ( & meta. path ) ,
759
754
} ) ;
@@ -764,14 +759,11 @@ pub fn find_deprecation(
764
759
true
765
760
} else {
766
761
if let Some ( lit) = meta. name_value_literal ( ) {
767
- sess. parse_sess . emit_err ( session_diagnostics:: UnsupportedLiteral {
762
+ sess. emit_err ( session_diagnostics:: UnsupportedLiteral {
768
763
span : lit. span ,
769
764
reason : UnsupportedLiteralReason :: DeprecatedString ,
770
765
is_bytestr : lit. kind . is_bytestr ( ) ,
771
- start_point_span : sess
772
- . parse_sess
773
- . source_map ( )
774
- . start_point ( lit. span ) ,
766
+ start_point_span : sess. source_map ( ) . start_point ( lit. span ) ,
775
767
} ) ;
776
768
} else {
777
769
sess. emit_err ( session_diagnostics:: IncorrectMetaItem {
@@ -810,7 +802,7 @@ pub fn find_deprecation(
810
802
}
811
803
}
812
804
_ => {
813
- sess. parse_sess . emit_err ( session_diagnostics:: UnknownMetaItem {
805
+ sess. emit_err ( session_diagnostics:: UnknownMetaItem {
814
806
span : meta. span ( ) ,
815
807
item : pprust:: path_to_string ( & mi. path ) ,
816
808
expected : if features. deprecated_suggestion {
@@ -823,14 +815,11 @@ pub fn find_deprecation(
823
815
}
824
816
} ,
825
817
NestedMetaItem :: Lit ( lit) => {
826
- sess. parse_sess . emit_err ( session_diagnostics:: UnsupportedLiteral {
818
+ sess. emit_err ( session_diagnostics:: UnsupportedLiteral {
827
819
span : lit. span ,
828
820
reason : UnsupportedLiteralReason :: DeprecatedKvPair ,
829
821
is_bytestr : false ,
830
- start_point_span : sess
831
- . parse_sess
832
- . source_map ( )
833
- . start_point ( lit. span ) ,
822
+ start_point_span : sess. source_map ( ) . start_point ( lit. span ) ,
834
823
} ) ;
835
824
continue ' outer;
836
825
}
@@ -841,7 +830,7 @@ pub fn find_deprecation(
841
830
842
831
if is_rustc {
843
832
if since. is_none ( ) {
844
- sess. parse_sess . emit_err ( session_diagnostics:: MissingSince { span : attr. span } ) ;
833
+ sess. emit_err ( session_diagnostics:: MissingSince { span : attr. span } ) ;
845
834
continue ;
846
835
}
847
836
0 commit comments