mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 21:13:37 +00:00
Auto merge of #18226 - SabrinaJewson:fix-impl-use, r=Veykril
Correctly parse `use` in generic parameters Fixes: #18225
This commit is contained in:
commit
b5187ab853
3 changed files with 29 additions and 1 deletions
|
@ -145,7 +145,7 @@ fn type_bound(p: &mut Parser<'_>) -> bool {
|
||||||
T![for] => types::for_type(p, false),
|
T![for] => types::for_type(p, false),
|
||||||
// test precise_capturing
|
// test precise_capturing
|
||||||
// fn captures<'a: 'a, 'b: 'b, T>() -> impl Sized + use<'b, T> {}
|
// fn captures<'a: 'a, 'b: 'b, T>() -> impl Sized + use<'b, T> {}
|
||||||
T![use] => {
|
T![use] if p.nth_at(1, T![<]) => {
|
||||||
p.bump_any();
|
p.bump_any();
|
||||||
generic_param_list(p)
|
generic_param_list(p)
|
||||||
}
|
}
|
||||||
|
|
26
crates/parser/test_data/parser/err/0055_impl_use.rast
Normal file
26
crates/parser/test_data/parser/err/0055_impl_use.rast
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
SOURCE_FILE
|
||||||
|
IMPL
|
||||||
|
IMPL_KW "impl"
|
||||||
|
GENERIC_PARAM_LIST
|
||||||
|
L_ANGLE "<"
|
||||||
|
TYPE_PARAM
|
||||||
|
NAME
|
||||||
|
IDENT "T"
|
||||||
|
COLON ":"
|
||||||
|
WHITESPACE "\n"
|
||||||
|
TYPE_BOUND_LIST
|
||||||
|
ERROR
|
||||||
|
USE_KW "use"
|
||||||
|
WHITESPACE " "
|
||||||
|
MACRO_CALL
|
||||||
|
PATH
|
||||||
|
PATH_SEGMENT
|
||||||
|
NAME_REF
|
||||||
|
IDENT "std"
|
||||||
|
SEMICOLON ";"
|
||||||
|
WHITESPACE "\n"
|
||||||
|
error 8: expected R_ANGLE
|
||||||
|
error 8: expected type
|
||||||
|
error 11: expected `{`
|
||||||
|
error 15: expected BANG
|
||||||
|
error 15: expected `{`, `[`, `(`
|
2
crates/parser/test_data/parser/err/0055_impl_use.rs
Normal file
2
crates/parser/test_data/parser/err/0055_impl_use.rs
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
impl<T:
|
||||||
|
use std;
|
Loading…
Reference in a new issue