-
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.
Don't skip inner const when looking for body for suggestion
- Loading branch information
1 parent
5baee04
commit c58b7c9
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`. |