File tree Expand file tree Collapse file tree 2 files changed +39
-1
lines changed
src/tools/rust-analyzer/crates
hir-def/src/macro_expansion_tests Expand file tree Collapse file tree 2 files changed +39
-1
lines changed Original file line number Diff line number Diff line change @@ -1883,3 +1883,41 @@ fn test() {
18831883"# ] ] ,
18841884 ) ;
18851885}
1886+
1887+ #[ test]
1888+ fn test_pat_fragment_eof_17441 ( ) {
1889+ check (
1890+ r#"
1891+ macro_rules! matches {
1892+ ($expression:expr, $pattern:pat $(if $guard:expr)? ) => {
1893+ match $expression {
1894+ $pattern $(if $guard)? => true,
1895+ _ => false
1896+ }
1897+ };
1898+ }
1899+ fn f() {
1900+ matches!(0, 10..);
1901+ matches!(0, 10.. if true);
1902+ }
1903+ "# ,
1904+ expect ! [ [ r#"
1905+ macro_rules! matches {
1906+ ($expression:expr, $pattern:pat $(if $guard:expr)? ) => {
1907+ match $expression {
1908+ $pattern $(if $guard)? => true,
1909+ _ => false
1910+ }
1911+ };
1912+ }
1913+ fn f() {
1914+ match 0 {
1915+ 10.. =>true , _=>false
1916+ };
1917+ match 0 {
1918+ 10..if true =>true , _=>false
1919+ };
1920+ }
1921+ "# ] ] ,
1922+ ) ;
1923+ }
Original file line number Diff line number Diff line change @@ -181,7 +181,7 @@ fn pattern_single_r(p: &mut Parser<'_>, recovery_set: TokenSet) {
181181 // ^
182182 if matches ! (
183183 p. current( ) ,
184- T ![ =] | T ![ , ] | T ![ : ] | T ![ ')' ] | T ![ '}' ] | T ![ ']' ] | T ![ if ]
184+ T ![ =] | T ![ , ] | T ![ : ] | T ![ ')' ] | T ![ '}' ] | T ![ ']' ] | T ![ if ] | EOF
185185 ) {
186186 // test half_open_range_pat
187187 // fn f() {
You can’t perform that action at this time.
0 commit comments