relax restriction - allow errors to be emmitted within macro spans, as long as the same error message has not been used before (i.e. use the None as the span key, for errors that occur within macros)
This commit is contained in:
parent
4e16e30b07
commit
52d0e51473
1 changed files with 8 additions and 9 deletions
|
|
@ -598,29 +598,28 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
|
|||
None => format!("use of unstable library feature '{}'", &feature)
|
||||
};
|
||||
|
||||
|
||||
let msp: MultiSpan = span.into();
|
||||
let cm = &self.sess.parse_sess.codemap();
|
||||
let real_file_location =
|
||||
let span_key =
|
||||
msp.primary_span().and_then(|sp:Span|
|
||||
if sp != DUMMY_SP {
|
||||
let fname = cm.lookup_char_pos(sp.lo()).file.as_ref().name.clone();
|
||||
if fname.starts_with("<") && fname.ends_with(" macros>") {
|
||||
None
|
||||
} else {
|
||||
Some(fname)
|
||||
Some(span)
|
||||
}
|
||||
} else {
|
||||
None
|
||||
}
|
||||
);
|
||||
|
||||
if let Some(_) = real_file_location {
|
||||
let tuple = (None, Some(span), msg.clone());
|
||||
let fresh = self.sess.one_time_diagnostics.borrow_mut().insert(tuple);
|
||||
if fresh {
|
||||
emit_feature_err(&self.sess.parse_sess, &feature.as_str(), span,
|
||||
GateIssue::Library(Some(issue)), &msg);
|
||||
}
|
||||
let tuple = (None, span_key, msg.clone());
|
||||
let fresh = self.sess.one_time_diagnostics.borrow_mut().insert(tuple);
|
||||
if fresh {
|
||||
emit_feature_err(&self.sess.parse_sess, &feature.as_str(), span,
|
||||
GateIssue::Library(Some(issue)), &msg);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue