-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #104889 - GuillaumeGomez:fix-impl-block-in-const-expr, …
…r=notriddle Fix impl block in const expr Fixes #83026. The problem was that we didn't visit block expressions. Considering how big the [walk_expr](https://doc.rust-lang.org/nightly/nightly-rustc/src/rustc_hir/intravisit.rs.html#678) function is, I decided to instead implement the `hir` visitor on the struct. It also answers the question which was in a comment for `RustdocVisitor`: we should have used a visitor instead of our ad-hoc implementation. Adding this visitor also added some extra checks that weren't present before (check changes in `rustdoc-ui` tests). r? `@notriddle`
- Loading branch information
Showing
7 changed files
with
193 additions
and
56 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
4 changes: 1 addition & 3 deletions
4
src/test/rustdoc-ui/infinite-recursive-type-impl-trait-return.rs
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
16 changes: 16 additions & 0 deletions
16
src/test/rustdoc-ui/infinite-recursive-type-impl-trait-return.stderr
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,16 @@ | ||
error[E0072]: recursive type `DEF_ID` has infinite size | ||
--> $DIR/infinite-recursive-type-impl-trait-return.rs:7:5 | ||
| | ||
LL | enum E { | ||
| ^^^^^^ | ||
LL | This(E), | ||
| - recursive without indirection | ||
| | ||
help: insert some indirection (e.g., a `DEF_ID`) to break the cycle | ||
| | ||
LL | This(Box<E>), | ||
| ++++ + | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `DEF_ID`. |
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
16 changes: 16 additions & 0 deletions
16
src/test/rustdoc-ui/infinite-recursive-type-impl-trait.stderr
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,16 @@ | ||
error[E0072]: recursive type `f::E` has infinite size | ||
--> $DIR/infinite-recursive-type-impl-trait.rs:2:5 | ||
| | ||
LL | enum E { | ||
| ^^^^^^ | ||
LL | V(E), | ||
| - recursive without indirection | ||
| | ||
help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle | ||
| | ||
LL | V(Box<E>), | ||
| ++++ + | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0072`. |
Oops, something went wrong.