File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed
tests/rustdoc/source-code-pages Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change 1+ // This code crashed because a `if` followed by a `!` was considered a macro,
2+ // creating an invalid class stack.
3+ // Regression test for <https://github.com/rust-lang/rust/issues/148617>.
4+
5+ //@ compile-flags: -Zunstable-options --generate-macro-expansion
6+
7+ enum Enum {
8+ Variant ,
9+ }
10+
11+ pub fn repro ( ) {
12+ if !matches ! ( Enum :: Variant , Enum :: Variant ) { }
13+ }
Original file line number Diff line number Diff line change 1+ // This test ensures that keywords which can be followed by values (and therefore `!`)
2+ // are not considered as macros.
3+ // This is a regression test for <https://github.com/rust-lang/rust/issues/148617>.
4+
5+ #![ crate_name = "foo" ]
6+
7+ //@ has 'src/foo/keyword-macros.rs.html'
8+
9+ fn a ( ) {
10+ //@ has - '//*[@class="rust"]//*[@class="kw"]' 'if'
11+ if !true { }
12+ //@ has - '//*[@class="rust"]//*[@class="kw"]' 'match'
13+ match !true { _ => { } }
14+ //@ has - '//*[@class="rust"]//*[@class="kw"]' 'while'
15+ let _ = while !true {
16+ //@ has - '//*[@class="rust"]//*[@class="kw"]' 'break'
17+ break !true ;
18+ } ;
19+ }
You can’t perform that action at this time.
0 commit comments