File tree 4 files changed +8
-7
lines changed
library/core/src/iter/traits
4 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -267,8 +267,9 @@ pub trait IntoIterator {
267
267
fn into_iter ( self ) -> Self :: IntoIter ;
268
268
}
269
269
270
+ #[ rustc_const_unstable( feature = "const_intoiterator_identity" , issue = "90603" ) ]
270
271
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
271
- impl < I : Iterator > IntoIterator for I {
272
+ impl < I : ~ const Iterator > const IntoIterator for I {
272
273
type Item = I :: Item ;
273
274
type IntoIter = I ;
274
275
Original file line number Diff line number Diff line change @@ -22,8 +22,8 @@ LL | for i in 0..x {
22
22
note: impl defined here, but it is not `const`
23
23
--> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
24
24
|
25
- LL | impl<I: Iterator> IntoIterator for I {
26
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
25
+ LL | impl<I: ~const Iterator> const IntoIterator for I {
26
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
27
27
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
28
28
29
29
error[E0658]: mutable references are not allowed in constant functions
Original file line number Diff line number Diff line change @@ -7,8 +7,8 @@ LL | for _ in 0..5 {}
7
7
note: impl defined here, but it is not `const`
8
8
--> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
9
9
|
10
- LL | impl<I: Iterator> IntoIterator for I {
11
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
10
+ LL | impl<I: ~const Iterator> const IntoIterator for I {
11
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12
12
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
13
13
14
14
error[E0015]: cannot call non-const fn `<std::ops::Range<i32> as Iterator>::next` in constants
Original file line number Diff line number Diff line change @@ -47,8 +47,8 @@ LL | [(); { for _ in 0usize.. {}; 0}];
47
47
note: impl defined here, but it is not `const`
48
48
--> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
49
49
|
50
- LL | impl<I: Iterator> IntoIterator for I {
51
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
50
+ LL | impl<I: ~const Iterator> const IntoIterator for I {
51
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
52
52
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
53
53
54
54
error[E0658]: mutable references are not allowed in constants
You can’t perform that action at this time.
0 commit comments