Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
9cd1de5
suggest swapping equality on e0277
makai410 Feb 17, 2025
f462cb7
Update `compiler-builtins` to 0.1.149
tgross35 Feb 25, 2025
6e4adbe
Remove visit_const_block in typeck writeback
nbdd0121 Feb 26, 2025
8282181
Use Binder<Vec<T>> instead of Vec<Binder<T>> in new solver
compiler-errors Feb 26, 2025
ad74788
Use bound_coroutine_witnesses in old solver
compiler-errors Feb 26, 2025
f482460
Handle asm const similar to inline const
nbdd0121 Feb 26, 2025
395b0fb
Bless tests
nbdd0121 Feb 26, 2025
f20dd49
Use original command for showing sccache stats
Kobzol Feb 27, 2025
31388f5
checked_ilog tests: deal with a bit of float imprecision
RalfJung Feb 27, 2025
b3cae68
move `rust.description` to `build.description`
onur-ozkan Feb 27, 2025
0becb57
add change-entry
onur-ozkan Feb 27, 2025
f877b12
pass `CFG_VER_DESCRIPTION` to tool builds
onur-ozkan Feb 27, 2025
6cc6b86
Update E0133 docs for 2024 edition
ehuss Feb 27, 2025
d504f70
Unconditionally lower match arm even if it's unneeded for never patte…
mu001999 Feb 27, 2025
0f7da1a
replace `rust.description` with `build.description`
onur-ozkan Feb 27, 2025
cdd8895
Add inference constraining Copy impl test
BoxyUwU Feb 14, 2025
dc6db19
Defer repeat expr `Copy` check
BoxyUwU Feb 14, 2025
6c3243f
Bless
BoxyUwU Feb 15, 2025
86945c0
Tweak incorrect ABI suggestion
estebank Feb 28, 2025
e6b3b88
Rollup merge of #137045 - BoxyUwU:defer_repeat_expr_checks, r=compile…
matthiaskrgr Feb 28, 2025
3a92645
Rollup merge of #137171 - makai410:swapping-e0277, r=compiler-errors
matthiaskrgr Feb 28, 2025
32405da
Rollup merge of #137634 - tgross35:update-builtins, r=tgross35
matthiaskrgr Feb 28, 2025
59a5466
Rollup merge of #137686 - nbdd0121:asm_const, r=compiler-errors
matthiaskrgr Feb 28, 2025
2dd51d1
Rollup merge of #137689 - compiler-errors:coroutine, r=lcnr
matthiaskrgr Feb 28, 2025
ff6c07d
Rollup merge of #137718 - Kobzol:sccache-stats, r=marcoieni
matthiaskrgr Feb 28, 2025
7d3015a
Rollup merge of #137723 - onur-ozkan:cfg-ver-description, r=pietroalb…
matthiaskrgr Feb 28, 2025
c2711e8
Rollup merge of #137730 - RalfJung:checked_ilog_tests, r=tgross35
matthiaskrgr Feb 28, 2025
0ba2a8a
Rollup merge of #137735 - ehuss:e0133-edition-docs, r=compiler-errors
matthiaskrgr Feb 28, 2025
ba63753
Rollup merge of #137742 - mu001999-contrib:fix-137708, r=compiler-errors
matthiaskrgr Feb 28, 2025
1a45baa
Rollup merge of #137771 - estebank:abi-sugg, r=compiler-errors
matthiaskrgr Feb 28, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions compiler/rustc_ast_lowering/src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -671,10 +671,13 @@ impl<'hir> LoweringContext<'_, 'hir> {
let span = self.lower_span(arm.span);
self.lower_attrs(hir_id, &arm.attrs, arm.span);
let is_never_pattern = pat.is_never_pattern();
let body = if let Some(body) = &arm.body
// We need to lower the body even if it's unneeded for never pattern in match,
// ensure that we can get HirId for DefId if need (issue #137708).
let body = arm.body.as_ref().map(|x| self.lower_expr(x));
let body = if let Some(body) = body
&& !is_never_pattern
{
self.lower_expr(body)
body
} else {
// Either `body.is_none()` or `is_never_pattern` here.
if !is_never_pattern {
Expand Down
12 changes: 12 additions & 0 deletions tests/ui/never_type/unused_trait_in_never_pattern_body.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
fn a() {
match 0 {
! => || { //~ ERROR `!` patterns are experimental
//~^ ERROR a never pattern is always unreachable
//~^^ ERROR mismatched types
use std::ops::Add;
0.add(1)
},
}
}

fn main() {}
36 changes: 36 additions & 0 deletions tests/ui/never_type/unused_trait_in_never_pattern_body.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
error[E0658]: `!` patterns are experimental
--> $DIR/unused_trait_in_never_pattern_body.rs:3:9
|
LL | ! => || {
| ^
|
= note: see issue #118155 <https://github.com/rust-lang/rust/issues/118155> for more information
= help: add `#![feature(never_patterns)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error: a never pattern is always unreachable
--> $DIR/unused_trait_in_never_pattern_body.rs:3:14
|
LL | ! => || {
| ______________^
LL | |
LL | |
LL | | use std::ops::Add;
LL | | 0.add(1)
LL | | },
| | ^
| | |
| |_________this will never be executed
| help: remove this expression

error: mismatched types
--> $DIR/unused_trait_in_never_pattern_body.rs:3:9
|
LL | ! => || {
| ^ a never pattern must be used on an uninhabited type
|
= note: the matched value is of type `i32`

error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0658`.