Skip to content

Commit 4ea2bd1

Browse files
committed
bless more
1 parent 14a674c commit 4ea2bd1

File tree

4 files changed

+24
-11
lines changed

4 files changed

+24
-11
lines changed

src/tools/clippy/tests/ui/self_assignment.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ pub fn positives(mut a: usize, b: &mut u32, mut s: S) {
1414
*b = *b;
1515
s = s;
1616
s.a = s.a;
17-
s.b[10] = s.b[5 + 5];
17+
s.b[9] = s.b[5 + 4];
1818
s.c[0][1] = s.c[0][1];
1919
s.b[a] = s.b[a];
2020
*s.e = *s.e;

src/tools/clippy/tests/ui/self_assignment.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ error: self-assignment of `s.a` to `s.a`
2424
LL | s.a = s.a;
2525
| ^^^^^^^^^
2626

27-
error: self-assignment of `s.b[5 + 5]` to `s.b[10]`
27+
error: self-assignment of `s.b[5 + 4]` to `s.b[9]`
2828
--> $DIR/self_assignment.rs:17:5
2929
|
30-
LL | s.b[10] = s.b[5 + 5];
31-
| ^^^^^^^^^^^^^^^^^^^^
30+
LL | s.b[9] = s.b[5 + 4];
31+
| ^^^^^^^^^^^^^^^^^^^
3232

3333
error: self-assignment of `s.c[0][1]` to `s.c[0][1]`
3434
--> $DIR/self_assignment.rs:18:5

tests/ui/consts/const-eval/raw-bytes.32bit.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ error[E0080]: it is undefined behavior to use this value
2424
--> $DIR/raw-bytes.rs:42:1
2525
|
2626
LL | const BAD_UNINHABITED_VARIANT1: UninhDiscriminant = unsafe { mem::transmute(1u8) };
27-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(B)>.0: encountered a value of the never type `!`
27+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered an uninhabited enum variant
2828
|
2929
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
3030
= note: the raw bytes of the constant (size: 1, align: 1) {
@@ -35,7 +35,7 @@ error[E0080]: it is undefined behavior to use this value
3535
--> $DIR/raw-bytes.rs:44:1
3636
|
3737
LL | const BAD_UNINHABITED_VARIANT2: UninhDiscriminant = unsafe { mem::transmute(3u8) };
38-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(D)>.0: encountered a value of uninhabited type `Never`
38+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered an uninhabited enum variant
3939
|
4040
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
4141
= note: the raw bytes of the constant (size: 1, align: 1) {

tests/ui/consts/const-eval/ub-enum.32bit.stderr

+18-5
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ error[E0080]: it is undefined behavior to use this value
7575
--> $DIR/ub-enum.rs:81:1
7676
|
7777
LL | const BAD_UNINHABITED_VARIANT1: UninhDiscriminant = unsafe { mem::transmute(1u8) };
78-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(B)>.0: encountered a value of the never type `!`
78+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered an uninhabited enum variant
7979
|
8080
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
8181
= note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
@@ -86,7 +86,7 @@ error[E0080]: it is undefined behavior to use this value
8686
--> $DIR/ub-enum.rs:83:1
8787
|
8888
LL | const BAD_UNINHABITED_VARIANT2: UninhDiscriminant = unsafe { mem::transmute(3u8) };
89-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(D)>.0: encountered a value of uninhabited type `Never`
89+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered an uninhabited enum variant
9090
|
9191
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
9292
= note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
@@ -108,14 +108,27 @@ error[E0080]: evaluation of constant value failed
108108
--> $DIR/ub-enum.rs:96:77
109109
|
110110
LL | const BAD_UNINHABITED_WITH_DATA1: Result<(i32, Never), (i32, !)> = unsafe { mem::transmute(0u64) };
111-
| ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(Ok)>.0.1: encountered a value of uninhabited type `Never`
111+
| ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered an uninhabited enum variant
112112

113113
error[E0080]: evaluation of constant value failed
114114
--> $DIR/ub-enum.rs:98:77
115115
|
116116
LL | const BAD_UNINHABITED_WITH_DATA2: Result<(i32, !), (i32, Never)> = unsafe { mem::transmute(0u64) };
117-
| ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(Ok)>.0.1: encountered a value of the never type `!`
117+
| ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered an uninhabited enum variant
118118

119-
error: aborting due to 13 previous errors
119+
error[E0080]: evaluation of constant value failed
120+
--> $SRC_DIR/core/src/mem/mod.rs:LL:COL
121+
|
122+
= note: read discriminant of an uninhabited enum variant
123+
|
124+
note: inside `discriminant::<Never>`
125+
--> $SRC_DIR/core/src/mem/mod.rs:LL:COL
126+
note: inside `TEST_ICE_89765`
127+
--> $DIR/ub-enum.rs:103:14
128+
|
129+
LL | unsafe { std::mem::discriminant(&*(&() as *const () as *const Never)); };
130+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
131+
132+
error: aborting due to 14 previous errors
120133

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

0 commit comments

Comments
 (0)