Rip it out
My type ascription Oh rip it out Ah If you think we live too much then You can sacrifice diagnostics Don't mix your garbage Into my syntax So many weird hacks keep diagnostics alive Yet I don't even step outside So many bad diagnostics keep tyasc alive Yet tyasc doesn't even bother to survive!
This commit is contained in:
parent
2034b6d23c
commit
c63b6a437e
97 changed files with 951 additions and 954 deletions
|
@ -148,9 +148,6 @@ pub struct Parser<'a> {
|
|||
max_angle_bracket_count: u32,
|
||||
|
||||
last_unexpected_token_span: Option<Span>,
|
||||
/// Span pointing at the `:` for the last type ascription the parser has seen, and whether it
|
||||
/// looked like it could have been a mistyped path or literal `Option:Some(42)`).
|
||||
pub last_type_ascription: Option<(Span, bool /* likely path typo */)>,
|
||||
/// If present, this `Parser` is not parsing Rust code but rather a macro call.
|
||||
subparser_name: Option<&'static str>,
|
||||
capture_state: CaptureState,
|
||||
|
@ -165,7 +162,7 @@ pub struct Parser<'a> {
|
|||
// This type is used a lot, e.g. it's cloned when matching many declarative macro rules with nonterminals. Make sure
|
||||
// it doesn't unintentionally get bigger.
|
||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||
rustc_data_structures::static_assert_size!(Parser<'_>, 288);
|
||||
rustc_data_structures::static_assert_size!(Parser<'_>, 320);
|
||||
|
||||
/// Stores span information about a closure.
|
||||
#[derive(Clone)]
|
||||
|
@ -470,7 +467,6 @@ impl<'a> Parser<'a> {
|
|||
unmatched_angle_bracket_count: 0,
|
||||
max_angle_bracket_count: 0,
|
||||
last_unexpected_token_span: None,
|
||||
last_type_ascription: None,
|
||||
subparser_name,
|
||||
capture_state: CaptureState {
|
||||
capturing: Capturing::No,
|
||||
|
@ -832,10 +828,11 @@ impl<'a> Parser<'a> {
|
|||
}
|
||||
|
||||
fn expect_any_with_type(&mut self, kets: &[&TokenKind], expect: TokenExpectType) -> bool {
|
||||
kets.iter().any(|k| match expect {
|
||||
let res = kets.iter().any(|k| match expect {
|
||||
TokenExpectType::Expect => self.check(k),
|
||||
TokenExpectType::NoExpect => self.token == **k,
|
||||
})
|
||||
});
|
||||
res
|
||||
}
|
||||
|
||||
fn parse_seq_to_before_tokens<T>(
|
||||
|
@ -941,10 +938,14 @@ impl<'a> Parser<'a> {
|
|||
// propagate the help message from sub error 'e' to main error 'expect_err;
|
||||
expect_err.children.push(xx.clone());
|
||||
}
|
||||
expect_err.emit();
|
||||
|
||||
e.cancel();
|
||||
break;
|
||||
if self.token == token::Colon {
|
||||
// we will try to recover in `maybe_recover_struct_lit_bad_delims`
|
||||
return Err(expect_err);
|
||||
} else {
|
||||
expect_err.emit();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -959,7 +960,6 @@ impl<'a> Parser<'a> {
|
|||
let t = f(self)?;
|
||||
v.push(t);
|
||||
}
|
||||
|
||||
Ok((v, trailing, recovered))
|
||||
}
|
||||
|
||||
|
@ -1045,6 +1045,7 @@ impl<'a> Parser<'a> {
|
|||
f: impl FnMut(&mut Parser<'a>) -> PResult<'a, T>,
|
||||
) -> PResult<'a, (ThinVec<T>, bool /* trailing */)> {
|
||||
let (val, trailing, recovered) = self.parse_seq_to_before_end(ket, sep, f)?;
|
||||
|
||||
if !recovered {
|
||||
self.eat(ket);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue