Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
26c4893
Mark 'get_mut' and 'set_position' in 'std::io::Cursor' as const;
bjoernager Sep 24, 2024
3727a8c
uefi: process: Add args support
Ayush1325 Aug 31, 2024
1709a85
Store resolution for self and crate root module segments
compiler-errors Oct 27, 2024
ba12a99
we should not be reporting generic error if there is not a segment to…
compiler-errors Oct 26, 2024
ff2f7a7
Point at `const` definition when used instead of a binding in a `let`…
estebank Nov 6, 2024
c25b44b
Fold `PatKind::NamedConstant` into `PatKind::Constant`
estebank Nov 6, 2024
6dc79f6
Use `item_name` instead of a span snippet when talking about const pa…
estebank Nov 6, 2024
a5b4d45
Point at const when intended binding fall-through pattern is a const
estebank Nov 7, 2024
f563efe
Unify expanded constants and named constants in `PatKind`
estebank Nov 7, 2024
f1772d5
Make suggestion verbose
estebank Nov 7, 2024
bb37e5d
review comments
estebank Nov 12, 2024
6480b76
review comments
estebank Nov 13, 2024
912ee65
review comment: modify doc comment
estebank Nov 17, 2024
29acf8b
Account for `ExpandedConstant` in `parse_match`
estebank Nov 17, 2024
f37d021
Account for `wasm32v1-none` when exporting TLS symbols
daxpedda Nov 20, 2024
06e66d7
Rip out built-in PointerLike impl
compiler-errors Nov 19, 2024
228068b
Make PointerLike opt-in as a trait
compiler-errors Nov 20, 2024
8a8069a
Rollup merge of #129838 - Ayush1325:uefi-process-args, r=joboet
matthiaskrgr Nov 20, 2024
ce1543f
Rollup merge of #130800 - bjoernager:const-mut-cursor, r=joshtriplett
matthiaskrgr Nov 20, 2024
edf0995
Rollup merge of #132207 - compiler-errors:tweak-res-mod-segment, r=pe…
matthiaskrgr Nov 20, 2024
4f53fa2
Rollup merge of #132708 - estebank:const-as-binding, r=Nadrieril
matthiaskrgr Nov 20, 2024
eb9fbb0
Rollup merge of #133226 - compiler-errors:opt-in-pointer-like, r=lcnr
matthiaskrgr Nov 20, 2024
6199e01
Rollup merge of #133244 - daxpedda:wasm32v1-none-atomic, r=alexcrichton
matthiaskrgr Nov 20, 2024
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
Prev Previous commit
Next Next commit
Make suggestion verbose
  • Loading branch information
estebank committed Nov 17, 2024
commit f1772d57399272f69fa69ad10ae21d380efc2e7e
3 changes: 2 additions & 1 deletion compiler/rustc_mir_build/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -913,7 +913,8 @@ impl<'tcx> Subdiagnostic for AdtDefinedHere<'tcx> {
#[suggestion(
mir_build_interpreted_as_const,
code = "{variable}_var",
applicability = "maybe-incorrect"
applicability = "maybe-incorrect",
style = "verbose"
)]
pub(crate) struct InterpretedAsConst {
#[primary_span]
Expand Down
9 changes: 5 additions & 4 deletions tests/ui/closures/2229_closure_analysis/bad-pattern.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,15 @@ LL | const PAT: u32 = 0;
| -------------- missing patterns are not covered because `PAT` is interpreted as a constant pattern, not a new variable
...
LL | let PAT = v1;
| ^^^
| |
| pattern `1_u32..=u32::MAX` not covered
| help: introduce a variable instead: `PAT_var`
| ^^^ pattern `1_u32..=u32::MAX` not covered
|
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
= note: the matched value is of type `u32`
help: introduce a variable instead
|
LL | let PAT_var = v1;
| ~~~~~~~

error: aborting due to 7 previous errors

Expand Down
36 changes: 20 additions & 16 deletions tests/ui/consts/const-pattern-irrefutable.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ LL | const a: u8 = 2;
| ----------- missing patterns are not covered because `a` is interpreted as a constant pattern, not a new variable
...
LL | let a = 4;
| ^
| |
| patterns `0_u8..=1_u8` and `3_u8..=u8::MAX` not covered
| help: introduce a variable instead: `a_var`
| ^ patterns `0_u8..=1_u8` and `3_u8..=u8::MAX` not covered
|
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
= note: the matched value is of type `u8`
help: introduce a variable instead
|
LL | let a_var = 4;
| ~~~~~

error[E0005]: refutable pattern in local binding
--> $DIR/const-pattern-irrefutable.rs:28:9
Expand All @@ -21,14 +22,15 @@ LL | pub const b: u8 = 2;
| --------------- missing patterns are not covered because `b` is interpreted as a constant pattern, not a new variable
...
LL | let c = 4;
| ^
| |
| patterns `0_u8..=1_u8` and `3_u8..=u8::MAX` not covered
| help: introduce a variable instead: `b_var`
| ^ patterns `0_u8..=1_u8` and `3_u8..=u8::MAX` not covered
|
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
= note: the matched value is of type `u8`
help: introduce a variable instead
|
LL | let b_var = 4;
| ~~~~~

error[E0005]: refutable pattern in local binding
--> $DIR/const-pattern-irrefutable.rs:32:9
Expand All @@ -37,14 +39,15 @@ LL | pub const d: (u8, u8) = (2, 1);
| --------------------- missing patterns are not covered because `d` is interpreted as a constant pattern, not a new variable
...
LL | let d = (4, 4);
| ^
| |
| patterns `(0_u8..=1_u8, _)` and `(3_u8..=u8::MAX, _)` not covered
| help: introduce a variable instead: `d_var`
| ^ patterns `(0_u8..=1_u8, _)` and `(3_u8..=u8::MAX, _)` not covered
|
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
= note: the matched value is of type `(u8, u8)`
help: introduce a variable instead
|
LL | let d_var = (4, 4);
| ~~~~~

error[E0005]: refutable pattern in local binding
--> $DIR/const-pattern-irrefutable.rs:36:9
Expand All @@ -53,10 +56,7 @@ LL | const e: S = S {
| ---------- missing patterns are not covered because `e` is interpreted as a constant pattern, not a new variable
...
LL | let e = S {
| ^
| |
| pattern `S { foo: 1_u8..=u8::MAX }` not covered
| help: introduce a variable instead: `e_var`
| ^ pattern `S { foo: 1_u8..=u8::MAX }` not covered
|
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
Expand All @@ -66,6 +66,10 @@ note: `S` defined here
LL | struct S {
| ^
= note: the matched value is of type `S`
help: introduce a variable instead
|
LL | let e_var = S {
| ~~~~~

error: aborting due to 4 previous errors

Expand Down
18 changes: 10 additions & 8 deletions tests/ui/mir/issue-112269.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,31 @@ error[E0005]: refutable pattern in local binding
LL | const x: i32 = 4;
| ------------ missing patterns are not covered because `x` is interpreted as a constant pattern, not a new variable
LL | let x: i32 = 3;
| ^
| |
| patterns `i32::MIN..=3_i32` and `5_i32..=i32::MAX` not covered
| help: introduce a variable instead: `x_var`
| ^ patterns `i32::MIN..=3_i32` and `5_i32..=i32::MAX` not covered
|
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
= note: the matched value is of type `i32`
help: introduce a variable instead
|
LL | let x_var: i32 = 3;
| ~~~~~

error[E0005]: refutable pattern in local binding
--> $DIR/issue-112269.rs:7:9
|
LL | const y: i32 = 3;
| ------------ missing patterns are not covered because `y` is interpreted as a constant pattern, not a new variable
LL | let y = 4;
| ^
| |
| patterns `i32::MIN..=2_i32` and `4_i32..=i32::MAX` not covered
| help: introduce a variable instead: `y_var`
| ^ patterns `i32::MIN..=2_i32` and `4_i32..=i32::MAX` not covered
|
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
= note: the matched value is of type `i32`
help: introduce a variable instead
|
LL | let y_var = 4;
| ~~~~~

error: aborting due to 2 previous errors

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@ error[E0005]: refutable pattern in local binding
--> $DIR/const-pat-non-exaustive-let-new-var.rs:2:9
|
LL | let A = 3;
| ^
| |
| patterns `i32::MIN..=1_i32` and `3_i32..=i32::MAX` not covered
| help: introduce a variable instead: `A_var`
| ^ patterns `i32::MIN..=1_i32` and `3_i32..=i32::MAX` not covered
...
LL | const A: i32 = 2;
| ------------ missing patterns are not covered because `A` is interpreted as a constant pattern, not a new variable
|
= note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
= note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
= note: the matched value is of type `i32`
help: introduce a variable instead
|
LL | let A_var = 3;
| ~~~~~

error: aborting due to 1 previous error

Expand Down