-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #73157 - Aaron1011:where-oh-where-has-my-little-span-…
…gone, r=ecstatic-morse Don't lose empty `where` clause when pretty-printing Previously, we would parse `struct Foo where;` and `struct Foo;` identically, leading to an 'empty' `where` clause being omitted during pretty printing. This will cause us to lose spans when proc-macros involved, since we will have a collected `where` token that does not appear in the pretty-printed item. We now explicitly track the presence of a `where` token during parsing, so that we can distinguish between `struct Foo where;` and `struct Foo;` during pretty-printing
- Loading branch information
Showing
7 changed files
with
68 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// aux-build:test-macros.rs | ||
|
||
extern crate test_macros; | ||
use test_macros::recollect_attr; | ||
|
||
#[recollect_attr] | ||
struct FieldStruct where { | ||
field: MissingType1 //~ ERROR cannot find | ||
} | ||
|
||
#[recollect_attr] | ||
struct TupleStruct(MissingType2) where; //~ ERROR cannot find | ||
|
||
enum MyEnum where { | ||
Variant(MissingType3) //~ ERROR cannot find | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
error[E0412]: cannot find type `MissingType1` in this scope | ||
--> $DIR/empty-where-clause.rs:8:12 | ||
| | ||
LL | field: MissingType1 | ||
| ^^^^^^^^^^^^ not found in this scope | ||
|
||
error[E0412]: cannot find type `MissingType2` in this scope | ||
--> $DIR/empty-where-clause.rs:12:20 | ||
| | ||
LL | struct TupleStruct(MissingType2) where; | ||
| ^^^^^^^^^^^^ not found in this scope | ||
|
||
error[E0412]: cannot find type `MissingType3` in this scope | ||
--> $DIR/empty-where-clause.rs:15:13 | ||
| | ||
LL | Variant(MissingType3) | ||
| ^^^^^^^^^^^^ not found in this scope | ||
|
||
error: aborting due to 3 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0412`. |