Skip to content

Commit 0aeab9a

Browse files
committed
move early lint over to multispan
1 parent ddabd50 commit 0aeab9a

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

src/librustc/lint/context.rs

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ pub struct EarlyLint {
9090
/// what span was it attached to (this is used for Eq comparisons;
9191
/// it duplicates to some extent the information in
9292
/// `diagnostic.span`)
93-
pub span: Span,
93+
pub span: MultiSpan,
9494

9595
/// the main message
9696
pub diagnostic: Diagnostic,
@@ -109,11 +109,11 @@ impl fmt::Debug for EarlyLint {
109109
impl EarlyLint {
110110
pub fn new<M: EarlyLintMessage>(id: LintId, span: Span, msg: M) -> Self {
111111
let diagnostic = msg.into_diagnostic(span);
112-
EarlyLint { id: id, span: span, diagnostic: diagnostic }
112+
EarlyLint { id: id, span: MultiSpan::from(span), diagnostic: diagnostic }
113113
}
114114

115115
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 }
117117
}
118118

119119
pub fn matches(&self, other: &EarlyLint) -> bool {
@@ -449,12 +449,12 @@ pub fn gather_attr(attr: &ast::Attribute)
449449
/// in trans that run after the main lint pass is finished. Most
450450
/// lints elsewhere in the compiler should call
451451
/// `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) {
458458
raw_struct_lint(sess, lints, lint, lvlsrc, span, msg).emit();
459459
}
460460

@@ -559,11 +559,11 @@ pub trait LintContext: Sized {
559559
raw_emit_lint(&self.sess(), self.lints(), lint, (level, src), span, msg);
560560
}
561561

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 {
567567
let (level, src) = match self.level_src(lint) {
568568
None => return self.sess().diagnostic().struct_dummy(),
569569
Some(pair) => pair,
@@ -585,11 +585,11 @@ pub trait LintContext: Sized {
585585
err.emit();
586586
}
587587

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 {
593593
self.lookup(lint, Some(span), msg)
594594
}
595595

@@ -1283,7 +1283,7 @@ pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
12831283
// in the iteration code.
12841284
for (id, v) in tcx.sess.lints.borrow().iter() {
12851285
for early_lint in v {
1286-
span_bug!(early_lint.span,
1286+
span_bug!(early_lint.span.clone(),
12871287
"unprocessed lint {:?} at {}",
12881288
early_lint, tcx.map.node_to_string(*id));
12891289
}
@@ -1321,7 +1321,7 @@ pub fn check_ast_crate(sess: &Session, krate: &ast::Crate) {
13211321
// in the iteration code.
13221322
for (_, v) in sess.lints.borrow().iter() {
13231323
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);
13251325
}
13261326
}
13271327
}

0 commit comments

Comments
 (0)