fix: parsing of ? opt-out trait bounds

thanks to Veykril
This commit is contained in:
XFFXFF 2022-06-02 21:30:18 +08:00
parent 2f0814ea35
commit df67bbdcb3
3 changed files with 54 additions and 0 deletions

View file

@ -133,6 +133,12 @@ fn type_bound(p: &mut Parser) -> bool {
match p.current() {
LIFETIME_IDENT => lifetime(p),
T![for] => types::for_type(p, false),
T![?] if p.nth_at(1, T![for]) => {
// test question_for_type_trait_bound
// fn f<T>() where T: ?for<> Sized {}
p.bump_any();
types::for_type(p, false)
}
current => {
match current {
T![?] => p.bump_any(),