-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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 #125469 - compiler-errors:dont-skip-inner-const-body,…
… r=cjgillot Don't skip out of inner const when looking for body for suggestion Self-explanatory title, I'll point out the important logic in an inline comment. Fixes #125370
- Loading branch information
Showing
3 changed files
with
29 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
const fn f() -> usize { | ||
//~^ ERROR mismatched types | ||
const FIELD: usize = loop { | ||
0 | ||
//~^ ERROR mismatched types | ||
}; | ||
} | ||
|
||
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,17 @@ | ||
error[E0308]: mismatched types | ||
--> $DIR/dont-suggest-through-inner-const.rs:4:9 | ||
| | ||
LL | 0 | ||
| ^ expected `()`, found integer | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/dont-suggest-through-inner-const.rs:1:17 | ||
| | ||
LL | const fn f() -> usize { | ||
| - ^^^^^ expected `usize`, found `()` | ||
| | | ||
| implicitly returns `()` as its body has no tail or `return` expression | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0308`. |