1
Fork 0

Make rustc_parse_format compile on stable

This allows it to be used by lightweight formatting systems and may
allow it to be used by rust-analyzer.
This commit is contained in:
bjorn3 2022-04-29 18:48:58 +02:00
parent 683c582c1e
commit d33140d2dc
9 changed files with 231 additions and 191 deletions

View file

@ -254,7 +254,10 @@ fn check_panic_str<'tcx>(
if n_arguments > 0 && fmt_parser.errors.is_empty() {
let arg_spans: Vec<_> = match &fmt_parser.arg_places[..] {
[] => vec![fmt_span],
v => v.iter().map(|span| fmt_span.from_inner(*span)).collect(),
v => v
.iter()
.map(|span| fmt_span.from_inner(InnerSpan::new(span.start, span.end)))
.collect(),
};
cx.struct_span_lint(NON_FMT_PANICS, arg_spans, |lint| {
let mut l = lint.build(match n_arguments {