@@ -90,7 +90,7 @@ pub struct EarlyLint {
90
90
/// what span was it attached to (this is used for Eq comparisons;
91
91
/// it duplicates to some extent the information in
92
92
/// `diagnostic.span`)
93
- pub span : Span ,
93
+ pub span : MultiSpan ,
94
94
95
95
/// the main message
96
96
pub diagnostic : Diagnostic ,
@@ -109,11 +109,11 @@ impl fmt::Debug for EarlyLint {
109
109
impl EarlyLint {
110
110
pub fn new < M : EarlyLintMessage > ( id : LintId , span : Span , msg : M ) -> Self {
111
111
let diagnostic = msg. into_diagnostic ( span) ;
112
- EarlyLint { id : id, span : span, diagnostic : diagnostic }
112
+ EarlyLint { id : id, span : MultiSpan :: from ( span) , diagnostic : diagnostic }
113
113
}
114
114
115
115
pub fn with_diagnostic ( id : LintId , span : Span , diagnostic : Diagnostic ) -> Self {
116
- EarlyLint { id : id, span : span, diagnostic : diagnostic }
116
+ EarlyLint { id : id, span : MultiSpan :: from ( span) , diagnostic : diagnostic }
117
117
}
118
118
119
119
pub fn matches ( & self , other : & EarlyLint ) -> bool {
@@ -449,12 +449,12 @@ pub fn gather_attr(attr: &ast::Attribute)
449
449
/// in trans that run after the main lint pass is finished. Most
450
450
/// lints elsewhere in the compiler should call
451
451
/// `Session::add_lint()` instead.
452
- pub fn raw_emit_lint ( sess : & Session ,
453
- lints : & LintStore ,
454
- lint : & ' static Lint ,
455
- lvlsrc : LevelSource ,
456
- span : Option < Span > ,
457
- msg : & str ) {
452
+ pub fn raw_emit_lint < S : Into < MultiSpan > > ( sess : & Session ,
453
+ lints : & LintStore ,
454
+ lint : & ' static Lint ,
455
+ lvlsrc : LevelSource ,
456
+ span : Option < S > ,
457
+ msg : & str ) {
458
458
raw_struct_lint ( sess, lints, lint, lvlsrc, span, msg) . emit ( ) ;
459
459
}
460
460
@@ -559,11 +559,11 @@ pub trait LintContext: Sized {
559
559
raw_emit_lint ( & self . sess ( ) , self . lints ( ) , lint, ( level, src) , span, msg) ;
560
560
}
561
561
562
- fn lookup ( & self ,
563
- lint : & ' static Lint ,
564
- span : Option < Span > ,
565
- msg : & str )
566
- -> DiagnosticBuilder {
562
+ fn lookup < S : Into < MultiSpan > > ( & self ,
563
+ lint : & ' static Lint ,
564
+ span : Option < S > ,
565
+ msg : & str )
566
+ -> DiagnosticBuilder {
567
567
let ( level, src) = match self . level_src ( lint) {
568
568
None => return self . sess ( ) . diagnostic ( ) . struct_dummy ( ) ,
569
569
Some ( pair) => pair,
@@ -585,11 +585,11 @@ pub trait LintContext: Sized {
585
585
err. emit ( ) ;
586
586
}
587
587
588
- fn struct_span_lint ( & self ,
589
- lint : & ' static Lint ,
590
- span : Span ,
591
- msg : & str )
592
- -> DiagnosticBuilder {
588
+ fn struct_span_lint < S : Into < MultiSpan > > ( & self ,
589
+ lint : & ' static Lint ,
590
+ span : S ,
591
+ msg : & str )
592
+ -> DiagnosticBuilder {
593
593
self . lookup ( lint, Some ( span) , msg)
594
594
}
595
595
@@ -1283,7 +1283,7 @@ pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
1283
1283
// in the iteration code.
1284
1284
for ( id, v) in tcx. sess . lints . borrow ( ) . iter ( ) {
1285
1285
for early_lint in v {
1286
- span_bug ! ( early_lint. span,
1286
+ span_bug ! ( early_lint. span. clone ( ) ,
1287
1287
"unprocessed lint {:?} at {}" ,
1288
1288
early_lint, tcx. map. node_to_string( * id) ) ;
1289
1289
}
@@ -1321,7 +1321,7 @@ pub fn check_ast_crate(sess: &Session, krate: &ast::Crate) {
1321
1321
// in the iteration code.
1322
1322
for ( _, v) in sess. lints . borrow ( ) . iter ( ) {
1323
1323
for early_lint in v {
1324
- span_bug ! ( early_lint. span, "unprocessed lint {:?}" , early_lint) ;
1324
+ span_bug ! ( early_lint. span. clone ( ) , "unprocessed lint {:?}" , early_lint) ;
1325
1325
}
1326
1326
}
1327
1327
}
0 commit comments