Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
c7552928
R
Rust
项目概览
int
/
Rust
11 个月 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
Rust
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c7552928
编写于
6月 11, 2020
作者:
L
Lzu Tao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Prefer the associated consts for pattern matching error
上级
f4fbb931
变更
23
展开全部
隐藏空白更改
内联
并排
Showing
23 changed file
with
139 addition
and
139 deletion
+139
-139
src/librustc_middle/ty/print/pretty.rs
src/librustc_middle/ty/print/pretty.rs
+3
-3
src/test/mir-opt/const_prop/bad_op_div_by_zero/rustc.main.ConstProp.diff
...t/const_prop/bad_op_div_by_zero/rustc.main.ConstProp.diff
+1
-1
src/test/mir-opt/const_prop/bad_op_mod_by_zero/rustc.main.ConstProp.diff
...t/const_prop/bad_op_mod_by_zero/rustc.main.ConstProp.diff
+1
-1
src/test/ui/consts/const-match-check.eval1.stderr
src/test/ui/consts/const-match-check.eval1.stderr
+2
-2
src/test/ui/consts/const-match-check.eval2.stderr
src/test/ui/consts/const-match-check.eval2.stderr
+2
-2
src/test/ui/consts/const-match-check.matchck.stderr
src/test/ui/consts/const-match-check.matchck.stderr
+8
-8
src/test/ui/consts/const-pattern-irrefutable.rs
src/test/ui/consts/const-pattern-irrefutable.rs
+3
-3
src/test/ui/consts/const-pattern-irrefutable.stderr
src/test/ui/consts/const-pattern-irrefutable.stderr
+3
-3
src/test/ui/for/for-loop-refutable-pattern-error-message.stderr
...st/ui/for/for-loop-refutable-pattern-error-message.stderr
+2
-2
src/test/ui/half-open-range-patterns/half-open-range-pats-exhaustive-fail.stderr
...ange-patterns/half-open-range-pats-exhaustive-fail.stderr
+70
-70
src/test/ui/or-patterns/exhaustiveness-non-exhaustive.rs
src/test/ui/or-patterns/exhaustiveness-non-exhaustive.rs
+3
-3
src/test/ui/or-patterns/exhaustiveness-non-exhaustive.stderr
src/test/ui/or-patterns/exhaustiveness-non-exhaustive.stderr
+6
-6
src/test/ui/or-patterns/issue-69875-should-have-been-expanded-earlier-non-exhaustive.stderr
...5-should-have-been-expanded-earlier-non-exhaustive.stderr
+4
-4
src/test/ui/pattern/usefulness/exhaustive_integer_patterns.stderr
.../ui/pattern/usefulness/exhaustive_integer_patterns.stderr
+14
-14
src/test/ui/pattern/usefulness/match-byte-array-patterns-2.stderr
.../ui/pattern/usefulness/match-byte-array-patterns-2.stderr
+2
-2
src/test/ui/pattern/usefulness/match-non-exhaustive.stderr
src/test/ui/pattern/usefulness/match-non-exhaustive.stderr
+2
-2
src/test/ui/pattern/usefulness/non-exhaustive-match.rs
src/test/ui/pattern/usefulness/non-exhaustive-match.rs
+2
-2
src/test/ui/pattern/usefulness/non-exhaustive-match.stderr
src/test/ui/pattern/usefulness/non-exhaustive-match.stderr
+2
-2
src/test/ui/pattern/usefulness/refutable-pattern-errors.rs
src/test/ui/pattern/usefulness/refutable-pattern-errors.rs
+1
-1
src/test/ui/pattern/usefulness/refutable-pattern-errors.stderr
...est/ui/pattern/usefulness/refutable-pattern-errors.stderr
+2
-2
src/test/ui/precise_pointer_size_matching.stderr
src/test/ui/precise_pointer_size_matching.stderr
+4
-4
src/test/ui/suggestions/const-pat-non-exaustive-let-new-var.rs
...est/ui/suggestions/const-pat-non-exaustive-let-new-var.rs
+1
-1
src/test/ui/suggestions/const-pat-non-exaustive-let-new-var.stderr
...ui/suggestions/const-pat-non-exaustive-let-new-var.stderr
+1
-1
未找到文件。
src/librustc_middle/ty/print/pretty.rs
浏览文件 @
c7552928
...
...
@@ -986,7 +986,7 @@ fn pretty_print_const_scalar(
let
ui_str
=
ui
.name_str
();
if
data
==
max
{
p!
(
write
(
"
std::
{}::MAX"
,
ui_str
))
p!
(
write
(
"{}::MAX"
,
ui_str
))
}
else
{
if
print_ty
{
p!
(
write
(
"{}{}"
,
data
,
ui_str
))
}
else
{
p!
(
write
(
"{}"
,
data
))
}
};
...
...
@@ -999,8 +999,8 @@ fn pretty_print_const_scalar(
let
i_str
=
i
.name_str
();
match
data
{
d
if
d
==
min
=>
p!
(
write
(
"
std::
{}::MIN"
,
i_str
)),
d
if
d
==
max
=>
p!
(
write
(
"
std::
{}::MAX"
,
i_str
)),
d
if
d
==
min
=>
p!
(
write
(
"{}::MIN"
,
i_str
)),
d
if
d
==
max
=>
p!
(
write
(
"{}::MAX"
,
i_str
)),
_
=>
{
let
data
=
sign_extend
(
data
,
size
)
as
i128
;
if
print_ty
{
...
...
src/test/mir-opt/const_prop/bad_op_div_by_zero/rustc.main.ConstProp.diff
浏览文件 @
c7552928
...
...
@@ -59,7 +59,7 @@
// mir::Constant
// + span: $DIR/bad_op_div_by_zero.rs:5:14: 5:19
- // + literal: Const { ty: i32, val: Value(Scalar(0xffffffff)) }
- _6 = Eq(const 1i32, const
std::
i32::MIN); // scope 1 at $DIR/bad_op_div_by_zero.rs:5:14: 5:19
- _6 = Eq(const 1i32, const i32::MIN); // scope 1 at $DIR/bad_op_div_by_zero.rs:5:14: 5:19
+ // + literal: Const { ty: bool, val: Value(Scalar(0x00)) }
+ _6 = const false; // scope 1 at $DIR/bad_op_div_by_zero.rs:5:14: 5:19
// ty::Const
...
...
src/test/mir-opt/const_prop/bad_op_mod_by_zero/rustc.main.ConstProp.diff
浏览文件 @
c7552928
...
...
@@ -59,7 +59,7 @@
// mir::Constant
// + span: $DIR/bad_op_mod_by_zero.rs:5:14: 5:19
- // + literal: Const { ty: i32, val: Value(Scalar(0xffffffff)) }
- _6 = Eq(const 1i32, const
std::
i32::MIN); // scope 1 at $DIR/bad_op_mod_by_zero.rs:5:14: 5:19
- _6 = Eq(const 1i32, const i32::MIN); // scope 1 at $DIR/bad_op_mod_by_zero.rs:5:14: 5:19
+ // + literal: Const { ty: bool, val: Value(Scalar(0x00)) }
+ _6 = const false; // scope 1 at $DIR/bad_op_mod_by_zero.rs:5:14: 5:19
// ty::Const
...
...
src/test/ui/consts/const-match-check.eval1.stderr
浏览文件 @
c7552928
error[E0005]: refutable pattern in local binding: `
std::i32::MIN..=-1i32` and `1i32..=std::
i32::MAX` not covered
error[E0005]: refutable pattern in local binding: `
i32::MIN..=-1i32` and `1i32..=
i32::MAX` not covered
--> $DIR/const-match-check.rs:25:15
|
LL | A = { let 0 = 0; 0 },
| ^ patterns `
std::i32::MIN..=-1i32` and `1i32..=std::
i32::MAX` not covered
| ^ patterns `
i32::MIN..=-1i32` and `1i32..=
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
...
...
src/test/ui/consts/const-match-check.eval2.stderr
浏览文件 @
c7552928
error[E0005]: refutable pattern in local binding: `
std::i32::MIN..=-1i32` and `1i32..=std::
i32::MAX` not covered
error[E0005]: refutable pattern in local binding: `
i32::MIN..=-1i32` and `1i32..=
i32::MAX` not covered
--> $DIR/const-match-check.rs:31:24
|
LL | let x: [i32; { let 0 = 0; 0 }] = [];
| ^ patterns `
std::i32::MIN..=-1i32` and `1i32..=std::
i32::MAX` not covered
| ^ patterns `
i32::MIN..=-1i32` and `1i32..=
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
...
...
src/test/ui/consts/const-match-check.matchck.stderr
浏览文件 @
c7552928
error[E0005]: refutable pattern in local binding: `
std::i32::MIN..=-1i32` and `1i32..=std::
i32::MAX` not covered
error[E0005]: refutable pattern in local binding: `
i32::MIN..=-1i32` and `1i32..=
i32::MAX` not covered
--> $DIR/const-match-check.rs:4:22
|
LL | const X: i32 = { let 0 = 0; 0 };
| ^ patterns `
std::i32::MIN..=-1i32` and `1i32..=std::
i32::MAX` not covered
| ^ patterns `
i32::MIN..=-1i32` and `1i32..=
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
...
...
@@ -12,11 +12,11 @@ help: you might want to use `if let` to ignore the variant that isn't matched
LL | const X: i32 = { if let 0 = 0 { /* */ } 0 };
| ^^^^^^^^^^^^^^^^^^^^^^
error[E0005]: refutable pattern in local binding: `
std::i32::MIN..=-1i32` and `1i32..=std::
i32::MAX` not covered
error[E0005]: refutable pattern in local binding: `
i32::MIN..=-1i32` and `1i32..=
i32::MAX` not covered
--> $DIR/const-match-check.rs:8:23
|
LL | static Y: i32 = { let 0 = 0; 0 };
| ^ patterns `
std::i32::MIN..=-1i32` and `1i32..=std::
i32::MAX` not covered
| ^ patterns `
i32::MIN..=-1i32` and `1i32..=
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
...
...
@@ -26,11 +26,11 @@ help: you might want to use `if let` to ignore the variant that isn't matched
LL | static Y: i32 = { if let 0 = 0 { /* */ } 0 };
| ^^^^^^^^^^^^^^^^^^^^^^
error[E0005]: refutable pattern in local binding: `
std::i32::MIN..=-1i32` and `1i32..=std::
i32::MAX` not covered
error[E0005]: refutable pattern in local binding: `
i32::MIN..=-1i32` and `1i32..=
i32::MAX` not covered
--> $DIR/const-match-check.rs:13:26
|
LL | const X: i32 = { let 0 = 0; 0 };
| ^ patterns `
std::i32::MIN..=-1i32` and `1i32..=std::
i32::MAX` not covered
| ^ patterns `
i32::MIN..=-1i32` and `1i32..=
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
...
...
@@ -40,11 +40,11 @@ help: you might want to use `if let` to ignore the variant that isn't matched
LL | const X: i32 = { if let 0 = 0 { /* */ } 0 };
| ^^^^^^^^^^^^^^^^^^^^^^
error[E0005]: refutable pattern in local binding: `
std::i32::MIN..=-1i32` and `1i32..=std::
i32::MAX` not covered
error[E0005]: refutable pattern in local binding: `
i32::MIN..=-1i32` and `1i32..=
i32::MAX` not covered
--> $DIR/const-match-check.rs:19:26
|
LL | const X: i32 = { let 0 = 0; 0 };
| ^ patterns `
std::i32::MIN..=-1i32` and `1i32..=std::
i32::MAX` not covered
| ^ patterns `
i32::MIN..=-1i32` and `1i32..=
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
...
...
src/test/ui/consts/const-pattern-irrefutable.rs
浏览文件 @
c7552928
...
...
@@ -9,8 +9,8 @@ mod foo {
const
a
:
u8
=
2
;
fn
main
()
{
let
a
=
4
;
//~ ERROR refutable pattern in local binding: `0u8..=1u8` and `3u8..=
std::
u8::MAX
let
c
=
4
;
//~ ERROR refutable pattern in local binding: `0u8..=1u8` and `3u8..=
std::
u8::MAX
let
d
=
4
;
//~ ERROR refutable pattern in local binding: `0u8..=1u8` and `3u8..=
std::
u8::MAX
let
a
=
4
;
//~ ERROR refutable pattern in local binding: `0u8..=1u8` and `3u8..=u8::MAX
let
c
=
4
;
//~ ERROR refutable pattern in local binding: `0u8..=1u8` and `3u8..=u8::MAX
let
d
=
4
;
//~ ERROR refutable pattern in local binding: `0u8..=1u8` and `3u8..=u8::MAX
fn
f
()
{}
// Check that the `NOTE`s still work with an item here (cf. issue #35115).
}
src/test/ui/consts/const-pattern-irrefutable.stderr
浏览文件 @
c7552928
error[E0005]: refutable pattern in local binding: `0u8..=1u8` and `3u8..=
std::
u8::MAX` not covered
error[E0005]: refutable pattern in local binding: `0u8..=1u8` and `3u8..=u8::MAX` not covered
--> $DIR/const-pattern-irrefutable.rs:12:9
|
LL | const a: u8 = 2;
...
...
@@ -12,7 +12,7 @@ LL | let a = 4;
|
= note: the matched value is of type `u8`
error[E0005]: refutable pattern in local binding: `0u8..=1u8` and `3u8..=
std::
u8::MAX` not covered
error[E0005]: refutable pattern in local binding: `0u8..=1u8` and `3u8..=u8::MAX` not covered
--> $DIR/const-pattern-irrefutable.rs:13:9
|
LL | pub const b: u8 = 2;
...
...
@@ -26,7 +26,7 @@ LL | let c = 4;
|
= note: the matched value is of type `u8`
error[E0005]: refutable pattern in local binding: `0u8..=1u8` and `3u8..=
std::
u8::MAX` not covered
error[E0005]: refutable pattern in local binding: `0u8..=1u8` and `3u8..=u8::MAX` not covered
--> $DIR/const-pattern-irrefutable.rs:14:9
|
LL | pub const d: u8 = 2;
...
...
src/test/ui/for/for-loop-refutable-pattern-error-message.stderr
浏览文件 @
c7552928
error[E0005]: refutable pattern in `for` loop binding: `&
std::i32::MIN..=0i32` and `&2i32..=std::
i32::MAX` not covered
error[E0005]: refutable pattern in `for` loop binding: `&
i32::MIN..=0i32` and `&2i32..=
i32::MAX` not covered
--> $DIR/for-loop-refutable-pattern-error-message.rs:2:9
|
LL | for &1 in [1].iter() {}
| ^^ patterns `&
std::i32::MIN..=0i32` and `&2i32..=std::
i32::MAX` not covered
| ^^ patterns `&
i32::MIN..=0i32` and `&2i32..=
i32::MAX` not covered
|
= note: the matched value is of type `&i32`
...
...
src/test/ui/half-open-range-patterns/half-open-range-pats-exhaustive-fail.stderr
浏览文件 @
c7552928
此差异已折叠。
点击以展开。
src/test/ui/or-patterns/exhaustiveness-non-exhaustive.rs
浏览文件 @
c7552928
...
...
@@ -4,15 +4,15 @@
// We wrap patterns in a tuple because top-level or-patterns were special-cased.
fn
main
()
{
match
(
0u8
,
0u8
)
{
//~^ ERROR non-exhaustive patterns: `(2u8..=
std::
u8::MAX, _)`
//~^ ERROR non-exhaustive patterns: `(2u8..=u8::MAX, _)`
(
0
|
1
,
2
|
3
)
=>
{}
}
match
((
0u8
,),)
{
//~^ ERROR non-exhaustive patterns: `((4u8..=
std::
u8::MAX))`
//~^ ERROR non-exhaustive patterns: `((4u8..=u8::MAX))`
((
0
|
1
,)
|
(
2
|
3
,),)
=>
{}
}
match
(
Some
(
0u8
),)
{
//~^ ERROR non-exhaustive patterns: `(Some(2u8..=
std::
u8::MAX))`
//~^ ERROR non-exhaustive patterns: `(Some(2u8..=u8::MAX))`
(
None
|
Some
(
0
|
1
),)
=>
{}
}
}
src/test/ui/or-patterns/exhaustiveness-non-exhaustive.stderr
浏览文件 @
c7552928
error[E0004]: non-exhaustive patterns: `(2u8..=
std::
u8::MAX, _)` not covered
error[E0004]: non-exhaustive patterns: `(2u8..=u8::MAX, _)` not covered
--> $DIR/exhaustiveness-non-exhaustive.rs:6:11
|
LL | match (0u8, 0u8) {
| ^^^^^^^^^^ pattern `(2u8..=
std::
u8::MAX, _)` not covered
| ^^^^^^^^^^ pattern `(2u8..=u8::MAX, _)` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `(u8, u8)`
error[E0004]: non-exhaustive patterns: `((4u8..=
std::
u8::MAX))` not covered
error[E0004]: non-exhaustive patterns: `((4u8..=u8::MAX))` not covered
--> $DIR/exhaustiveness-non-exhaustive.rs:10:11
|
LL | match ((0u8,),) {
| ^^^^^^^^^ pattern `((4u8..=
std::
u8::MAX))` not covered
| ^^^^^^^^^ pattern `((4u8..=u8::MAX))` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `((u8,),)`
error[E0004]: non-exhaustive patterns: `(Some(2u8..=
std::
u8::MAX))` not covered
error[E0004]: non-exhaustive patterns: `(Some(2u8..=u8::MAX))` not covered
--> $DIR/exhaustiveness-non-exhaustive.rs:14:11
|
LL | match (Some(0u8),) {
| ^^^^^^^^^^^^ pattern `(Some(2u8..=
std::
u8::MAX))` not covered
| ^^^^^^^^^^^^ pattern `(Some(2u8..=u8::MAX))` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `(std::option::Option<u8>,)`
...
...
src/test/ui/or-patterns/issue-69875-should-have-been-expanded-earlier-non-exhaustive.stderr
浏览文件 @
c7552928
error[E0005]: refutable pattern in local binding: `
std::i32::MIN..=-1i32` and `3i32..=std::
i32::MAX` not covered
error[E0005]: refutable pattern in local binding: `
i32::MIN..=-1i32` and `3i32..=
i32::MAX` not covered
--> $DIR/issue-69875-should-have-been-expanded-earlier-non-exhaustive.rs:4:9
|
LL | let 0 | (1 | 2) = 0;
| ^^^^^^^^^^^ patterns `
std::i32::MIN..=-1i32` and `3i32..=std::
i32::MAX` not covered
| ^^^^^^^^^^^ patterns `
i32::MIN..=-1i32` and `3i32..=
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
...
...
@@ -12,11 +12,11 @@ help: you might want to use `if let` to ignore the variant that isn't matched
LL | if let 0 | (1 | 2) = 0 { /* */ }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0004]: non-exhaustive patterns: `
std::i32::MIN..=-1i32` and `3i32..=std::
i32::MAX` not covered
error[E0004]: non-exhaustive patterns: `
i32::MIN..=-1i32` and `3i32..=
i32::MAX` not covered
--> $DIR/issue-69875-should-have-been-expanded-earlier-non-exhaustive.rs:5:11
|
LL | match 0 {
| ^ patterns `
std::i32::MIN..=-1i32` and `3i32..=std::
i32::MAX` not covered
| ^ patterns `
i32::MIN..=-1i32` and `3i32..=
i32::MAX` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `i32`
...
...
src/test/ui/pattern/usefulness/exhaustive_integer_patterns.stderr
浏览文件 @
c7552928
...
...
@@ -10,11 +10,11 @@ note: the lint level is defined here
LL | #![deny(unreachable_patterns)]
| ^^^^^^^^^^^^^^^^^^^^
error[E0004]: non-exhaustive patterns: `128u8..=
std::
u8::MAX` not covered
error[E0004]: non-exhaustive patterns: `128u8..=u8::MAX` not covered
--> $DIR/exhaustive_integer_patterns.rs:28:11
|
LL | match x {
| ^ pattern `128u8..=
std::
u8::MAX` not covered
| ^ pattern `128u8..=u8::MAX` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u8`
...
...
@@ -34,20 +34,20 @@ error: unreachable pattern
LL | -2..=20 => {}
| ^^^^^^^
error[E0004]: non-exhaustive patterns: `
std::
i8::MIN..=-8i8`, `-6i8`, `121i8..=124i8` and 1 more not covered
error[E0004]: non-exhaustive patterns: `i8::MIN..=-8i8`, `-6i8`, `121i8..=124i8` and 1 more not covered
--> $DIR/exhaustive_integer_patterns.rs:41:11
|
LL | match x {
| ^ patterns `
std::
i8::MIN..=-8i8`, `-6i8`, `121i8..=124i8` and 1 more not covered
| ^ patterns `i8::MIN..=-8i8`, `-6i8`, `121i8..=124i8` and 1 more not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `i8`
error[E0004]: non-exhaustive patterns: `
std::
i8::MIN` not covered
error[E0004]: non-exhaustive patterns: `i8::MIN` not covered
--> $DIR/exhaustive_integer_patterns.rs:83:11
|
LL | match 0i8 {
| ^^^ pattern `
std::
i8::MIN` not covered
| ^^^ pattern `i8::MIN` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `i8`
...
...
@@ -61,20 +61,20 @@ LL | match 0i16 {
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `i16`
error[E0004]: non-exhaustive patterns: `128u8..=
std::
u8::MAX` not covered
error[E0004]: non-exhaustive patterns: `128u8..=u8::MAX` not covered
--> $DIR/exhaustive_integer_patterns.rs:109:11
|
LL | match 0u8 {
| ^^^ pattern `128u8..=
std::
u8::MAX` not covered
| ^^^ pattern `128u8..=u8::MAX` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u8`
error[E0004]: non-exhaustive patterns: `(0u8, Some(_))` and `(2u8..=
std::
u8::MAX, Some(_))` not covered
error[E0004]: non-exhaustive patterns: `(0u8, Some(_))` and `(2u8..=u8::MAX, Some(_))` not covered
--> $DIR/exhaustive_integer_patterns.rs:121:11
|
LL | match (0u8, Some(())) {
| ^^^^^^^^^^^^^^^ patterns `(0u8, Some(_))` and `(2u8..=
std::
u8::MAX, Some(_))` not covered
| ^^^^^^^^^^^^^^^ patterns `(0u8, Some(_))` and `(2u8..=u8::MAX, Some(_))` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `(u8, std::option::Option<()>)`
...
...
@@ -102,20 +102,20 @@ note: the lint level is defined here
LL | #![deny(overlapping_patterns)]
| ^^^^^^^^^^^^^^^^^^^^
error[E0004]: non-exhaustive patterns: `
std::
u128::MAX` not covered
error[E0004]: non-exhaustive patterns: `u128::MAX` not covered
--> $DIR/exhaustive_integer_patterns.rs:146:11
|
LL | match 0u128 {
| ^^^^^ pattern `
std::
u128::MAX` not covered
| ^^^^^ pattern `u128::MAX` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u128`
error[E0004]: non-exhaustive patterns: `5u128..=
std::
u128::MAX` not covered
error[E0004]: non-exhaustive patterns: `5u128..=u128::MAX` not covered
--> $DIR/exhaustive_integer_patterns.rs:150:11
|
LL | match 0u128 {
| ^^^^^ pattern `5u128..=
std::
u128::MAX` not covered
| ^^^^^ pattern `5u128..=u128::MAX` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `u128`
...
...
src/test/ui/pattern/usefulness/match-byte-array-patterns-2.stderr
浏览文件 @
c7552928
error[E0004]: non-exhaustive patterns: `&[0u8..=64u8, _, _, _]` and `&[66u8..=
std::
u8::MAX, _, _, _]` not covered
error[E0004]: non-exhaustive patterns: `&[0u8..=64u8, _, _, _]` and `&[66u8..=u8::MAX, _, _, _]` not covered
--> $DIR/match-byte-array-patterns-2.rs:4:11
|
LL | match buf {
| ^^^ patterns `&[0u8..=64u8, _, _, _]` and `&[66u8..=
std::
u8::MAX, _, _, _]` not covered
| ^^^ patterns `&[0u8..=64u8, _, _, _]` and `&[66u8..=u8::MAX, _, _, _]` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `&[u8; 4]`
...
...
src/test/ui/pattern/usefulness/match-non-exhaustive.stderr
浏览文件 @
c7552928
error[E0004]: non-exhaustive patterns: `
std::i32::MIN..=0i32` and `2i32..=std::
i32::MAX` not covered
error[E0004]: non-exhaustive patterns: `
i32::MIN..=0i32` and `2i32..=
i32::MAX` not covered
--> $DIR/match-non-exhaustive.rs:2:11
|
LL | match 0 { 1 => () }
| ^ patterns `
std::i32::MIN..=0i32` and `2i32..=std::
i32::MAX` not covered
| ^ patterns `
i32::MIN..=0i32` and `2i32..=
i32::MAX` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `i32`
...
...
src/test/ui/pattern/usefulness/non-exhaustive-match.rs
浏览文件 @
c7552928
...
...
@@ -11,8 +11,8 @@ fn main() {
match
Some
(
10
)
{
//~ ERROR non-exhaustive patterns: `Some(_)` not covered
None
=>
{}
}
match
(
2
,
3
,
4
)
{
//~ ERROR non-exhaustive patterns: `(_, _,
std::
i32::MIN..=3i32)`
// and `(_, _, 5i32..=
std::
i32::MAX)` not covered
match
(
2
,
3
,
4
)
{
//~ ERROR non-exhaustive patterns: `(_, _, i32::MIN..=3i32)`
// and `(_, _, 5i32..=i32::MAX)` not covered
(
_
,
_
,
4
)
=>
{}
}
match
(
T
::
A
,
T
::
A
)
{
//~ ERROR non-exhaustive patterns: `(A, A)` not covered
...
...
src/test/ui/pattern/usefulness/non-exhaustive-match.stderr
浏览文件 @
c7552928
...
...
@@ -36,11 +36,11 @@ LL | Some(#[stable(feature = "rust1", since = "1.0.0")] T),
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `std::option::Option<i32>`
error[E0004]: non-exhaustive patterns: `(_, _,
std::i32::MIN..=3i32)` and `(_, _, 5i32..=std::
i32::MAX)` not covered
error[E0004]: non-exhaustive patterns: `(_, _,
i32::MIN..=3i32)` and `(_, _, 5i32..=
i32::MAX)` not covered
--> $DIR/non-exhaustive-match.rs:14:11
|
LL | match (2, 3, 4) {
| ^^^^^^^^^ patterns `(_, _,
std::i32::MIN..=3i32)` and `(_, _, 5i32..=std::
i32::MAX)` not covered
| ^^^^^^^^^ patterns `(_, _,
i32::MIN..=3i32)` and `(_, _, 5i32..=
i32::MAX)` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `(i32, i32, i32)`
...
...
src/test/ui/pattern/usefulness/refutable-pattern-errors.rs
浏览文件 @
c7552928
...
...
@@ -5,5 +5,5 @@ fn func((1, (Some(1), 2..=3)): (isize, (Option<isize>, isize))) { }
fn
main
()
{
let
(
1
,
(
Some
(
1
),
2
..=
3
))
=
(
1
,
(
None
,
2
));
//~^ ERROR refutable pattern in local binding: `(
std::i32::MIN..=0i32, _)` and `(2i32..=std::
i32::MAX, _)` not covered
//~^ ERROR refutable pattern in local binding: `(
i32::MIN..=0i32, _)` and `(2i32..=
i32::MAX, _)` not covered
}
src/test/ui/pattern/usefulness/refutable-pattern-errors.stderr
浏览文件 @
c7552928
...
...
@@ -6,11 +6,11 @@ LL | fn func((1, (Some(1), 2..=3)): (isize, (Option<isize>, isize))) { }
|
= note: the matched value is of type `(isize, (std::option::Option<isize>, isize))`
error[E0005]: refutable pattern in local binding: `(
std::i32::MIN..=0i32, _)` and `(2i32..=std::
i32::MAX, _)` not covered
error[E0005]: refutable pattern in local binding: `(
i32::MIN..=0i32, _)` and `(2i32..=
i32::MAX, _)` not covered
--> $DIR/refutable-pattern-errors.rs:7:9
|
LL | let (1, (Some(1), 2..=3)) = (1, (None, 2));
| ^^^^^^^^^^^^^^^^^^^^^ patterns `(
std::i32::MIN..=0i32, _)` and `(2i32..=std::
i32::MAX, _)` not covered
| ^^^^^^^^^^^^^^^^^^^^^ patterns `(
i32::MIN..=0i32, _)` and `(2i32..=
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
...
...
src/test/ui/precise_pointer_size_matching.stderr
浏览文件 @
c7552928
error[E0004]: non-exhaustive patterns: `
std::isize::MIN..=-6isize` and `21isize..=std::
isize::MAX` not covered
error[E0004]: non-exhaustive patterns: `
isize::MIN..=-6isize` and `21isize..=
isize::MAX` not covered
--> $DIR/precise_pointer_size_matching.rs:24:11
|
LL | match 0isize {
| ^^^^^^ patterns `
std::isize::MIN..=-6isize` and `21isize..=std::
isize::MAX` not covered
| ^^^^^^ patterns `
isize::MIN..=-6isize` and `21isize..=
isize::MAX` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `isize`
error[E0004]: non-exhaustive patterns: `0usize` and `21usize..=
std::
usize::MAX` not covered
error[E0004]: non-exhaustive patterns: `0usize` and `21usize..=usize::MAX` not covered
--> $DIR/precise_pointer_size_matching.rs:29:11
|
LL | match 0usize {
| ^^^^^^ patterns `0usize` and `21usize..=
std::
usize::MAX` not covered
| ^^^^^^ patterns `0usize` and `21usize..=usize::MAX` not covered
|
= help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms
= note: the matched value is of type `usize`
...
...
src/test/ui/suggestions/const-pat-non-exaustive-let-new-var.rs
浏览文件 @
c7552928
fn
main
()
{
let
A
=
3
;
//~^ ERROR refutable pattern in local binding: `
std::
i32::MIN..=1i32` and
//~^ ERROR refutable pattern in local binding: `i32::MIN..=1i32` and
//~| interpreted as a constant pattern, not a new variable
//~| HELP introduce a variable instead
//~| SUGGESTION a_var
...
...
src/test/ui/suggestions/const-pat-non-exaustive-let-new-var.stderr
浏览文件 @
c7552928
error[E0005]: refutable pattern in local binding: `
std::i32::MIN..=1i32` and `3i32..=std::
i32::MAX` not covered
error[E0005]: refutable pattern in local binding: `
i32::MIN..=1i32` and `3i32..=
i32::MAX` not covered
--> $DIR/const-pat-non-exaustive-let-new-var.rs:2:9
|
LL | let A = 3;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录