Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stabilise exhaustive integer patterns #56362

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
103 changes: 44 additions & 59 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/doc/nomicon
2 changes: 1 addition & 1 deletion src/doc/rustc-guide
3 changes: 3 additions & 0 deletions src/test/ui/precise_pointer_size_matching.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
// normalize-stderr-16bit: "-32768isize" -> "$$ISIZE_MIN"
// normalize-stderr-32bit: "-2147483648isize" -> "$$ISIZE_MIN"
// normalize-stderr-64bit: "-9223372036854775808isize" -> "$$ISIZE_MIN"
// normalize-stderr-16bit: "32767isize" -> "$$ISIZE_MAX"
// normalize-stderr-32bit: "2147483647isize" -> "$$ISIZE_MAX"
// normalize-stderr-64bit: "9223372036854775807isize" -> "$$ISIZE_MAX"
// normalize-stderr-16bit: "65535usize" -> "$$USIZE_MAX"
// normalize-stderr-32bit: "4294967295usize" -> "$$USIZE_MAX"
// normalize-stderr-64bit: "18446744073709551615usize" -> "$$USIZE_MAX"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this is neat but it's not enough for 16-bit targets.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

compilertest itself doesn't recognize 16-bit targets 🙁

pub fn get_pointer_width(triple: &str) -> &'static str {
if (triple.contains("64") && !triple.ends_with("gnux32")) || triple.starts_with("s390x") {
"64bit"
} else {
"32bit"
}
}


Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/precise_pointer_size_matching.stderr
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
error[E0004]: non-exhaustive patterns: `$ISIZE_MIN..=-6isize` and `21isize..=$ISIZE_MAX` not covered
--> $DIR/precise_pointer_size_matching.rs:24:11
--> $DIR/precise_pointer_size_matching.rs:27:11
|
LL | match 0isize { //~ ERROR non-exhaustive patterns
| ^^^^^^ patterns `$ISIZE_MIN..=-6isize` and `21isize..=$ISIZE_MAX` not covered

error[E0004]: non-exhaustive patterns: `0usize` and `21usize..=$USIZE_MAX` not covered
--> $DIR/precise_pointer_size_matching.rs:29:11
--> $DIR/precise_pointer_size_matching.rs:32:11
|
LL | match 0usize { //~ ERROR non-exhaustive patterns
| ^^^^^^ patterns `0usize` and `21usize..=$USIZE_MAX` not covered
Expand Down
2 changes: 1 addition & 1 deletion src/tools/cargo
Submodule cargo updated 100 files
2 changes: 1 addition & 1 deletion src/tools/clippy
2 changes: 1 addition & 1 deletion src/tools/miri
Submodule miri updated from 61f207 to 32e93e
2 changes: 1 addition & 1 deletion src/tools/rls
Submodule rls updated from cfd844 to daa138
2 changes: 1 addition & 1 deletion src/tools/rustfmt