diff options
| author | Jubilee <46493976+workingjubilee@users.noreply.github.com> | 2024-05-26 15:28:27 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-26 15:28:27 -0700 |
| commit | b65b2b6cedb95d28eb56e18b131810e01a7b9222 (patch) | |
| tree | 5189852c6cf7c86c172189cee99b2b019e6ab1cc /tests | |
| parent | 09e75921f349d7155694f105e2f86b04087063c7 (diff) | |
| parent | c58b7c9c81cf150bf307ca13375f12fb1c8f6420 (diff) | |
| download | rust-b65b2b6cedb95d28eb56e18b131810e01a7b9222.tar.gz rust-b65b2b6cedb95d28eb56e18b131810e01a7b9222.zip | |
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
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ui/return/dont-suggest-through-inner-const.rs | 9 | ||||
| -rw-r--r-- | tests/ui/return/dont-suggest-through-inner-const.stderr | 17 |
2 files changed, 26 insertions, 0 deletions
diff --git a/tests/ui/return/dont-suggest-through-inner-const.rs b/tests/ui/return/dont-suggest-through-inner-const.rs new file mode 100644 index 00000000000..b2347dedd52 --- /dev/null +++ b/tests/ui/return/dont-suggest-through-inner-const.rs @@ -0,0 +1,9 @@ +const fn f() -> usize { + //~^ ERROR mismatched types + const FIELD: usize = loop { + 0 + //~^ ERROR mismatched types + }; +} + +fn main() {} diff --git a/tests/ui/return/dont-suggest-through-inner-const.stderr b/tests/ui/return/dont-suggest-through-inner-const.stderr new file mode 100644 index 00000000000..6aeee74b0ad --- /dev/null +++ b/tests/ui/return/dont-suggest-through-inner-const.stderr @@ -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`. |
