Skip to content

Commit 7d10caf

Browse files
committed
bless diagnostics
1 parent 0eacaab commit 7d10caf

15 files changed

+66
-36
lines changed

src/test/mir-opt/remove_storage_markers.main.RemoveStorageMarkers.diff

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,37 @@
44
fn main() -> () {
55
let mut _0: (); // return place in scope 0 at $DIR/remove_storage_markers.rs:6:11: 6:11
66
let mut _1: i32; // in scope 0 at $DIR/remove_storage_markers.rs:7:9: 7:16
7-
let mut _2: std::ops::Range<i32>; // in scope 0 at $DIR/remove_storage_markers.rs:8:14: 8:19
7+
let mut _2: std::iter::loop_desugar::ForLoopDesugar<std::ops::Range<i32>>; // in scope 0 at $DIR/remove_storage_markers.rs:8:14: 8:19
88
let mut _3: std::ops::Range<i32>; // in scope 0 at $DIR/remove_storage_markers.rs:8:14: 8:19
99
let mut _5: (); // in scope 0 at $DIR/remove_storage_markers.rs:6:1: 11:2
1010
let _6: (); // in scope 0 at $DIR/remove_storage_markers.rs:8:14: 8:19
1111
let mut _7: std::option::Option<i32>; // in scope 0 at $DIR/remove_storage_markers.rs:8:14: 8:19
12-
let mut _8: &mut std::ops::Range<i32>; // in scope 0 at $DIR/remove_storage_markers.rs:8:14: 8:19
13-
let mut _9: &mut std::ops::Range<i32>; // in scope 0 at $DIR/remove_storage_markers.rs:8:14: 8:19
12+
let mut _8: &mut std::iter::loop_desugar::ForLoopDesugar<std::ops::Range<i32>>; // in scope 0 at $DIR/remove_storage_markers.rs:8:14: 8:19
13+
let mut _9: &mut std::iter::loop_desugar::ForLoopDesugar<std::ops::Range<i32>>; // in scope 0 at $DIR/remove_storage_markers.rs:8:14: 8:19
1414
let mut _10: isize; // in scope 0 at $DIR/remove_storage_markers.rs:8:5: 10:6
1515
let mut _11: !; // in scope 0 at $DIR/remove_storage_markers.rs:8:5: 10:6
1616
let mut _13: i32; // in scope 0 at $DIR/remove_storage_markers.rs:9:16: 9:17
1717
scope 1 {
1818
debug sum => _1; // in scope 1 at $DIR/remove_storage_markers.rs:7:9: 7:16
19-
let mut _4: std::ops::Range<i32>; // in scope 1 at $DIR/remove_storage_markers.rs:8:14: 8:19
19+
let mut _4: std::iter::loop_desugar::ForLoopDesugar<std::ops::Range<i32>>; // in scope 1 at $DIR/remove_storage_markers.rs:8:14: 8:19
2020
scope 2 {
2121
debug iter => _4; // in scope 2 at $DIR/remove_storage_markers.rs:8:14: 8:19
2222
let _12: i32; // in scope 2 at $DIR/remove_storage_markers.rs:8:9: 8:10
2323
scope 3 {
2424
debug i => _12; // in scope 3 at $DIR/remove_storage_markers.rs:8:9: 8:10
2525
}
26-
scope 5 (inlined iter::range::<impl Iterator for std::ops::Range<i32>>::next) { // at $DIR/remove_storage_markers.rs:8:14: 8:19
27-
debug self => _8; // in scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL
28-
let mut _14: &mut std::ops::Range<i32>; // in scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL
26+
scope 6 (inlined <iter::loop_desugar::ForLoopDesugar<std::ops::Range<i32>> as Iterator>::next) { // at $DIR/remove_storage_markers.rs:8:14: 8:19
27+
debug self => _8; // in scope 6 at $SRC_DIR/core/src/iter/loop_desugar.rs:LL:COL
28+
let mut _16: &mut std::iter::loop_desugar::ForLoopDesugar<std::ops::Range<i32>>; // in scope 6 at $SRC_DIR/core/src/iter/loop_desugar.rs:LL:COL
2929
}
3030
}
31-
scope 4 (inlined <std::ops::Range<i32> as IntoIterator>::into_iter) { // at $DIR/remove_storage_markers.rs:8:14: 8:19
32-
debug self => _3; // in scope 4 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
31+
scope 4 (inlined <std::ops::Range<i32> as iter::loop_desugar::IntoIterator>::into_iter) { // at $DIR/remove_storage_markers.rs:8:14: 8:19
32+
debug self => _3; // in scope 4 at $SRC_DIR/core/src/iter/loop_desugar.rs:LL:COL
33+
let mut _14: std::ops::Range<i32>; // in scope 4 at $SRC_DIR/core/src/iter/loop_desugar.rs:LL:COL
34+
let mut _15: std::ops::Range<i32>; // in scope 4 at $SRC_DIR/core/src/iter/loop_desugar.rs:LL:COL
35+
scope 5 (inlined <std::ops::Range<i32> as IntoIterator>::into_iter) { // at $SRC_DIR/core/src/iter/loop_desugar.rs:LL:COL
36+
debug self => _15; // in scope 5 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
37+
}
3338
}
3439
}
3540

@@ -41,7 +46,14 @@
4146
Deinit(_3); // scope 1 at $DIR/remove_storage_markers.rs:8:14: 8:19
4247
(_3.0: i32) = const 0_i32; // scope 1 at $DIR/remove_storage_markers.rs:8:14: 8:19
4348
(_3.1: i32) = const 10_i32; // scope 1 at $DIR/remove_storage_markers.rs:8:14: 8:19
44-
_2 = move _3; // scope 4 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
49+
- StorageLive(_14); // scope 4 at $SRC_DIR/core/src/iter/loop_desugar.rs:LL:COL
50+
- StorageLive(_15); // scope 4 at $SRC_DIR/core/src/iter/loop_desugar.rs:LL:COL
51+
_15 = move _3; // scope 4 at $SRC_DIR/core/src/iter/loop_desugar.rs:LL:COL
52+
_14 = move _15; // scope 5 at $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
53+
- StorageDead(_15); // scope 4 at $SRC_DIR/core/src/iter/loop_desugar.rs:LL:COL
54+
(_2.0: std::ops::Range<i32>) = move _14; // scope 4 at $SRC_DIR/core/src/iter/loop_desugar.rs:LL:COL
55+
(_2.1: usize) = const 0_usize; // scope 4 at $SRC_DIR/core/src/iter/loop_desugar.rs:LL:COL
56+
- StorageDead(_14); // scope 4 at $SRC_DIR/core/src/iter/loop_desugar.rs:LL:COL
4557
- StorageDead(_3); // scope 1 at $DIR/remove_storage_markers.rs:8:18: 8:19
4658
- StorageLive(_4); // scope 1 at $DIR/remove_storage_markers.rs:8:14: 8:19
4759
_4 = move _2; // scope 1 at $DIR/remove_storage_markers.rs:8:14: 8:19
@@ -55,12 +67,12 @@
5567
- StorageLive(_9); // scope 2 at $DIR/remove_storage_markers.rs:8:14: 8:19
5668
_9 = &mut _4; // scope 2 at $DIR/remove_storage_markers.rs:8:14: 8:19
5769
_8 = &mut (*_9); // scope 2 at $DIR/remove_storage_markers.rs:8:14: 8:19
58-
- StorageLive(_14); // scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL
59-
_14 = &mut (*_8); // scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL
60-
_7 = <std::ops::Range<i32> as iter::range::RangeIteratorImpl>::spec_next(move _14) -> bb4; // scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL
70+
- StorageLive(_16); // scope 6 at $SRC_DIR/core/src/iter/loop_desugar.rs:LL:COL
71+
_16 = &mut (*_8); // scope 6 at $SRC_DIR/core/src/iter/loop_desugar.rs:LL:COL
72+
_7 = <iter::loop_desugar::ForLoopDesugar<std::ops::Range<i32>> as iter::loop_desugar::DesugarSpec<i32>>::next_spec(move _16) -> bb4; // scope 6 at $SRC_DIR/core/src/iter/loop_desugar.rs:LL:COL
6173
// mir::Constant
62-
// + span: $SRC_DIR/core/src/iter/range.rs:LL:COL
63-
// + literal: Const { ty: for<'r> fn(&'r mut std::ops::Range<i32>) -> Option<<std::ops::Range<i32> as iter::range::RangeIteratorImpl>::Item> {<std::ops::Range<i32> as iter::range::RangeIteratorImpl>::spec_next}, val: Value(Scalar(<ZST>)) }
74+
// + span: $SRC_DIR/core/src/iter/loop_desugar.rs:LL:COL
75+
// + literal: Const { ty: for<'r> fn(&'r mut iter::loop_desugar::ForLoopDesugar<std::ops::Range<i32>>) -> Option<i32> {<iter::loop_desugar::ForLoopDesugar<std::ops::Range<i32>> as iter::loop_desugar::DesugarSpec<i32>>::next_spec}, val: Value(Scalar(<ZST>)) }
6476
}
6577

6678
bb2: {
@@ -91,7 +103,7 @@
91103
}
92104

93105
bb4: {
94-
- StorageDead(_14); // scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL
106+
- StorageDead(_16); // scope 6 at $SRC_DIR/core/src/iter/loop_desugar.rs:LL:COL
95107
- StorageDead(_8); // scope 2 at $DIR/remove_storage_markers.rs:8:18: 8:19
96108
_10 = discriminant(_7); // scope 2 at $DIR/remove_storage_markers.rs:8:14: 8:19
97109
switchInt(move _10) -> [0_isize: bb3, otherwise: bb2]; // scope 2 at $DIR/remove_storage_markers.rs:8:14: 8:19

src/test/ui/consts/const-fn-error.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ LL | for i in 0..x {
3535
= note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
3636
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
3737

38-
error[E0015]: cannot call non-const fn `<std::ops::Range<usize> as Iterator>::next` in constant functions
38+
error[E0015]: cannot call non-const fn `<iter::loop_desugar::ForLoopDesugar<std::ops::Range<usize>> as Iterator>::next` in constant functions
3939
--> $DIR/const-fn-error.rs:5:14
4040
|
4141
LL | for i in 0..x {

src/test/ui/consts/const-for.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ LL | impl<I: Iterator> IntoIterator for I {
1111
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1212
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
1313

14-
error[E0015]: cannot call non-const fn `<std::ops::Range<i32> as Iterator>::next` in constants
14+
error[E0015]: cannot call non-const fn `<iter::loop_desugar::ForLoopDesugar<std::ops::Range<i32>> as Iterator>::next` in constants
1515
--> $DIR/const-for.rs:5:14
1616
|
1717
LL | for _ in 0..5 {}

src/test/ui/issues/issue-20605.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ error[E0277]: the size for values of type `dyn Iterator<Item = &'a mut u8>` cann
22
--> $DIR/issue-20605.rs:2:17
33
|
44
LL | for item in *things { *item = 0 }
5-
| ^^^^^^^ expected an implementor of trait `IntoIterator`
5+
| ^^^^^^^ expected an implementor of trait `iter::loop_desugar::IntoIterator`
66
|
7-
= note: the trait bound `dyn Iterator<Item = &'a mut u8>: IntoIterator` is not satisfied
8-
= note: required because of the requirements on the impl of `IntoIterator` for `dyn Iterator<Item = &'a mut u8>`
7+
= note: the trait bound `dyn Iterator<Item = &'a mut u8>: iter::loop_desugar::IntoIterator` is not satisfied
8+
= note: required because of the requirements on the impl of `iter::loop_desugar::IntoIterator` for `dyn Iterator<Item = &'a mut u8>`
99
help: consider mutably borrowing here
1010
|
1111
LL | for item in &mut *things { *item = 0 }

src/test/ui/issues/issue-33941.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ fn main() {
66
for _ in HashMap::new().iter().cloned() {} //~ ERROR type mismatch
77
//~^ ERROR type mismatch
88
//~| ERROR type mismatch
9+
//~| ERROR type mismatch
910
}

src/test/ui/issues/issue-33941.stderr

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,18 @@ LL | for _ in HashMap::new().iter().cloned() {}
3333
found reference `&_`
3434
= note: required because of the requirements on the impl of `Iterator` for `Cloned<std::collections::hash_map::Iter<'_, _, _>>`
3535

36-
error: aborting due to 3 previous errors
36+
error[E0271]: type mismatch resolving `<std::collections::hash_map::Iter<'_, _, _> as Iterator>::Item == &_`
37+
--> $DIR/issue-33941.rs:6:14
38+
|
39+
LL | for _ in HashMap::new().iter().cloned() {}
40+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected tuple, found reference
41+
|
42+
= note: expected tuple `(&_, &_)`
43+
found reference `&_`
44+
= note: required because of the requirements on the impl of `Iterator` for `Cloned<std::collections::hash_map::Iter<'_, _, _>>`
45+
= note: 1 redundant requirement hidden
46+
= note: required because of the requirements on the impl of `Iterator` for `iter::loop_desugar::ForLoopDesugar<Cloned<std::collections::hash_map::Iter<'_, _, _>>>`
47+
48+
error: aborting due to 4 previous errors
3749

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

src/test/ui/issues/issue-61108.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ LL | bad_letters.push('s');
1010
| ^^^^^^^^^^^^^^^^^^^^^ value borrowed here after move
1111
|
1212
note: this function takes ownership of the receiver `self`, which moves `bad_letters`
13-
--> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
13+
--> $SRC_DIR/core/src/iter/loop_desugar.rs:LL:COL
1414
|
1515
LL | fn into_iter(self) -> Self::IntoIter;
1616
| ^^^^

src/test/ui/issues/issue-64559.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ LL | let _closure = || orig;
1111
| value used here after move
1212
|
1313
note: this function takes ownership of the receiver `self`, which moves `orig`
14-
--> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
14+
--> $SRC_DIR/core/src/iter/loop_desugar.rs:LL:COL
1515
|
1616
LL | fn into_iter(self) -> Self::IntoIter;
1717
| ^^^^

src/test/ui/issues/issue-83924.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ LL | for n in v {
1111
| ^ value used here after move
1212
|
1313
note: this function takes ownership of the receiver `self`, which moves `v`
14-
--> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
14+
--> $SRC_DIR/core/src/iter/loop_desugar.rs:LL:COL
1515
|
1616
LL | fn into_iter(self) -> Self::IntoIter;
1717
| ^^^^

src/test/ui/loops/issue-82916.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ LL | let z = x;
1010
| ^ value used here after move
1111
|
1212
note: this function takes ownership of the receiver `self`, which moves `x`
13-
--> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
13+
--> $SRC_DIR/core/src/iter/loop_desugar.rs:LL:COL
1414
|
1515
LL | fn into_iter(self) -> Self::IntoIter;
1616
| ^^^^

src/test/ui/moves/move-fn-self-receiver.stderr

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,11 @@ LL | for _val in implicit_into_iter {}
123123
LL | implicit_into_iter;
124124
| ^^^^^^^^^^^^^^^^^^ value used here after move
125125
|
126+
note: this function takes ownership of the receiver `self`, which moves `implicit_into_iter`
127+
--> $SRC_DIR/core/src/iter/loop_desugar.rs:LL:COL
128+
|
129+
LL | fn into_iter(self) -> Self::IntoIter;
130+
| ^^^^
126131
help: consider iterating over a slice of the `Vec<bool>`'s content to avoid moving into the `for` loop
127132
|
128133
LL | for _val in &implicit_into_iter {}

src/test/ui/never_type/issue-52443.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ LL | [(); { for _ in 0usize.. {}; 0}];
6060
= note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
6161
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
6262

63-
error[E0015]: cannot call non-const fn `<RangeFrom<usize> as Iterator>::next` in constants
63+
error[E0015]: cannot call non-const fn `<iter::loop_desugar::ForLoopDesugar<RangeFrom<usize>> as Iterator>::next` in constants
6464
--> $DIR/issue-52443.rs:9:21
6565
|
6666
LL | [(); { for _ in 0usize.. {}; 0}];

src/test/ui/suggestions/borrow-for-loop-head.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ LL | for j in a {
1616
| ^ `a` moved due to this implicit call to `.into_iter()`, in previous iteration of loop
1717
|
1818
note: this function takes ownership of the receiver `self`, which moves `a`
19-
--> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
19+
--> $SRC_DIR/core/src/iter/loop_desugar.rs:LL:COL
2020
|
2121
LL | fn into_iter(self) -> Self::IntoIter;
2222
| ^^^^

src/test/ui/suggestions/for-i-in-vec.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ LL | for _ in self.v {
88
| move occurs because `self.v` has type `Vec<u32>`, which does not implement the `Copy` trait
99
|
1010
note: this function takes ownership of the receiver `self`, which moves `self.v`
11-
--> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
11+
--> $SRC_DIR/core/src/iter/loop_desugar.rs:LL:COL
1212
|
1313
LL | fn into_iter(self) -> Self::IntoIter;
1414
| ^^^^
@@ -41,7 +41,7 @@ LL | for loader in *LOADERS {
4141
| move occurs because value has type `Vec<&u8>`, which does not implement the `Copy` trait
4242
|
4343
note: this function takes ownership of the receiver `self`, which moves value
44-
--> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
44+
--> $SRC_DIR/core/src/iter/loop_desugar.rs:LL:COL
4545
|
4646
LL | fn into_iter(self) -> Self::IntoIter;
4747
| ^^^^

src/test/ui/suggestions/slice-issue-87994.stderr

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ error[E0277]: the size for values of type `[i32]` cannot be known at compilation
22
--> $DIR/slice-issue-87994.rs:3:12
33
|
44
LL | for _ in v[1..] {
5-
| ^^^^^^ expected an implementor of trait `IntoIterator`
5+
| ^^^^^^ expected an implementor of trait `iter::loop_desugar::IntoIterator`
66
|
7-
= note: the trait bound `[i32]: IntoIterator` is not satisfied
8-
= note: required because of the requirements on the impl of `IntoIterator` for `[i32]`
7+
= note: the trait bound `[i32]: iter::loop_desugar::IntoIterator` is not satisfied
8+
= note: required because of the requirements on the impl of `iter::loop_desugar::IntoIterator` for `[i32]`
99
help: consider borrowing here
1010
|
1111
LL | for _ in &v[1..] {
@@ -32,10 +32,10 @@ error[E0277]: the size for values of type `[K]` cannot be known at compilation t
3232
--> $DIR/slice-issue-87994.rs:11:13
3333
|
3434
LL | for i2 in v2[1..] {
35-
| ^^^^^^^ expected an implementor of trait `IntoIterator`
35+
| ^^^^^^^ expected an implementor of trait `iter::loop_desugar::IntoIterator`
3636
|
37-
= note: the trait bound `[K]: IntoIterator` is not satisfied
38-
= note: required because of the requirements on the impl of `IntoIterator` for `[K]`
37+
= note: the trait bound `[K]: iter::loop_desugar::IntoIterator` is not satisfied
38+
= note: required because of the requirements on the impl of `iter::loop_desugar::IntoIterator` for `[K]`
3939
help: consider borrowing here
4040
|
4141
LL | for i2 in &v2[1..] {

0 commit comments

Comments
 (0)