1
Fork 0

Bless ui tests after typeck code change

This commit is contained in:
Deadbeef 2022-09-10 07:07:49 +00:00
parent f8813cf10e
commit f937a10c4e
16 changed files with 113 additions and 135 deletions

View file

@ -3,8 +3,10 @@ const X : usize = 2;
const fn f(x: usize) -> usize {
let mut sum = 0;
for i in 0..x {
//~^ ERROR the trait bound
//~^ ERROR cannot convert
//~| ERROR `for` is not allowed in a `const fn`
//~| ERROR mutable references are not allowed in constant functions
//~| ERROR cannot call non-const fn
sum += i;
}
sum

View file

@ -4,6 +4,8 @@ error[E0658]: `for` is not allowed in a `const fn`
LL | / for i in 0..x {
LL | |
LL | |
LL | |
LL | |
LL | | sum += i;
LL | | }
| |_____^
@ -11,25 +13,37 @@ LL | | }
= note: see issue #87575 <https://github.com/rust-lang/rust/issues/87575> for more information
= help: add `#![feature(const_for)]` to the crate attributes to enable
error[E0277]: the trait bound `std::ops::Range<usize>: Iterator` is not satisfied
--> $DIR/const-fn-error.rs:5:14
|
LL | for i in 0..x {
| ^^^^ `std::ops::Range<usize>` is not an iterator
|
= help: the trait `~const Iterator` is not implemented for `std::ops::Range<usize>`
note: the trait `Iterator` is implemented for `std::ops::Range<usize>`, but that implementation is not `const`
error[E0015]: cannot convert `std::ops::Range<usize>` into an iterator in constant functions
--> $DIR/const-fn-error.rs:5:14
|
LL | for i in 0..x {
| ^^^^
= note: required for `std::ops::Range<usize>` to implement `~const IntoIterator`
help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement
|
LL | const fn f(x: usize) -> usize where std::ops::Range<usize>: ~const Iterator {
| +++++++++++++++++++++++++++++++++++++++++++++
note: impl defined here, but it is not `const`
--> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
|
LL | impl<I: ~const Iterator> const IntoIterator for I {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
error: aborting due to 2 previous errors
error[E0658]: mutable references are not allowed in constant functions
--> $DIR/const-fn-error.rs:5:14
|
LL | for i in 0..x {
| ^^^^
|
= note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
Some errors have detailed explanations: E0277, E0658.
For more information about an error, try `rustc --explain E0277`.
error[E0015]: cannot call non-const fn `<std::ops::Range<usize> as Iterator>::next` in constant functions
--> $DIR/const-fn-error.rs:5:14
|
LL | for i in 0..x {
| ^^^^
|
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
error: aborting due to 4 previous errors
Some errors have detailed explanations: E0015, E0658.
For more information about an error, try `rustc --explain E0015`.

View file

@ -3,7 +3,6 @@
const _: () = {
for _ in 0..5 {}
//~^ error: `for` is not allowed in a `const`
//~| error: the trait bound
};
fn main() {}

View file

@ -7,21 +7,6 @@ LL | for _ in 0..5 {}
= note: see issue #87575 <https://github.com/rust-lang/rust/issues/87575> for more information
= help: add `#![feature(const_for)]` to the crate attributes to enable
error[E0277]: the trait bound `std::ops::Range<{integer}>: Iterator` is not satisfied
--> $DIR/const-for-feature-gate.rs:4:14
|
LL | for _ in 0..5 {}
| ^^^^ `std::ops::Range<{integer}>` is not an iterator
|
= help: the trait `~const Iterator` is not implemented for `std::ops::Range<{integer}>`
note: the trait `Iterator` is implemented for `std::ops::Range<{integer}>`, but that implementation is not `const`
--> $DIR/const-for-feature-gate.rs:4:14
|
LL | for _ in 0..5 {}
| ^^^^
= note: required for `std::ops::Range<{integer}>` to implement `~const IntoIterator`
error: aborting due to previous error
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0277, E0658.
For more information about an error, try `rustc --explain E0277`.
For more information about this error, try `rustc --explain E0658`.

View file

@ -3,7 +3,8 @@
const _: () = {
for _ in 0..5 {}
//~^ error: the trait bound
//~^ error: cannot call
//~| error: cannot convert
};
fn main() {}

View file

@ -1,17 +1,24 @@
error[E0277]: the trait bound `std::ops::Range<{integer}>: Iterator` is not satisfied
--> $DIR/const-for.rs:5:14
|
LL | for _ in 0..5 {}
| ^^^^ `std::ops::Range<{integer}>` is not an iterator
|
= help: the trait `~const Iterator` is not implemented for `std::ops::Range<{integer}>`
note: the trait `Iterator` is implemented for `std::ops::Range<{integer}>`, but that implementation is not `const`
error[E0015]: cannot convert `std::ops::Range<i32>` into an iterator in constants
--> $DIR/const-for.rs:5:14
|
LL | for _ in 0..5 {}
| ^^^^
= note: required for `std::ops::Range<{integer}>` to implement `~const IntoIterator`
|
note: impl defined here, but it is not `const`
--> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
|
LL | impl<I: ~const Iterator> const IntoIterator for I {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
error: aborting due to previous error
error[E0015]: cannot call non-const fn `<std::ops::Range<i32> as Iterator>::next` in constants
--> $DIR/const-for.rs:5:14
|
LL | for _ in 0..5 {}
| ^^^^
|
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
For more information about this error, try `rustc --explain E0277`.
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0015`.

View file

@ -51,12 +51,10 @@ const _: i32 = {
let mut x = 0;
for i in 0..4 { //~ ERROR `for` is not allowed in a `const`
//~^ ERROR the trait bound
x += i;
}
for i in 0..4 { //~ ERROR `for` is not allowed in a `const`
//~^ ERROR the trait bound
x += i;
}

View file

@ -2,7 +2,6 @@ error[E0658]: `for` is not allowed in a `const`
--> $DIR/loop.rs:53:5
|
LL | / for i in 0..4 {
LL | |
LL | | x += i;
LL | | }
| |_____^
@ -11,10 +10,9 @@ LL | | }
= help: add `#![feature(const_for)]` to the crate attributes to enable
error[E0658]: `for` is not allowed in a `const`
--> $DIR/loop.rs:58:5
--> $DIR/loop.rs:57:5
|
LL | / for i in 0..4 {
LL | |
LL | | x += i;
LL | | }
| |_____^
@ -22,35 +20,6 @@ LL | | }
= note: see issue #87575 <https://github.com/rust-lang/rust/issues/87575> for more information
= help: add `#![feature(const_for)]` to the crate attributes to enable
error[E0277]: the trait bound `std::ops::Range<{integer}>: Iterator` is not satisfied
--> $DIR/loop.rs:53:14
|
LL | for i in 0..4 {
| ^^^^ `std::ops::Range<{integer}>` is not an iterator
|
= help: the trait `~const Iterator` is not implemented for `std::ops::Range<{integer}>`
note: the trait `Iterator` is implemented for `std::ops::Range<{integer}>`, but that implementation is not `const`
--> $DIR/loop.rs:53:14
|
LL | for i in 0..4 {
| ^^^^
= note: required for `std::ops::Range<{integer}>` to implement `~const IntoIterator`
error: aborting due to 2 previous errors
error[E0277]: the trait bound `std::ops::Range<{integer}>: Iterator` is not satisfied
--> $DIR/loop.rs:58:14
|
LL | for i in 0..4 {
| ^^^^ `std::ops::Range<{integer}>` is not an iterator
|
= help: the trait `~const Iterator` is not implemented for `std::ops::Range<{integer}>`
note: the trait `Iterator` is implemented for `std::ops::Range<{integer}>`, but that implementation is not `const`
--> $DIR/loop.rs:58:14
|
LL | for i in 0..4 {
| ^^^^
= note: required for `std::ops::Range<{integer}>` to implement `~const IntoIterator`
error: aborting due to 4 previous errors
Some errors have detailed explanations: E0277, E0658.
For more information about an error, try `rustc --explain E0277`.
For more information about this error, try `rustc --explain E0658`.

View file

@ -2,5 +2,4 @@ fn main() {
Vec::<[(); 1 + for x in 0..1 {}]>::new();
//~^ ERROR cannot add
//~| ERROR `for` is not allowed in a `const`
//~| ERROR the trait bound
}

View file

@ -7,20 +7,6 @@ LL | Vec::<[(); 1 + for x in 0..1 {}]>::new();
= note: see issue #87575 <https://github.com/rust-lang/rust/issues/87575> for more information
= help: add `#![feature(const_for)]` to the crate attributes to enable
error[E0277]: the trait bound `std::ops::Range<{integer}>: Iterator` is not satisfied
--> $DIR/issue-50582.rs:2:29
|
LL | Vec::<[(); 1 + for x in 0..1 {}]>::new();
| ^^^^ `std::ops::Range<{integer}>` is not an iterator
|
= help: the trait `~const Iterator` is not implemented for `std::ops::Range<{integer}>`
note: the trait `Iterator` is implemented for `std::ops::Range<{integer}>`, but that implementation is not `const`
--> $DIR/issue-50582.rs:2:29
|
LL | Vec::<[(); 1 + for x in 0..1 {}]>::new();
| ^^^^
= note: required for `std::ops::Range<{integer}>` to implement `~const IntoIterator`
error[E0277]: cannot add `()` to `{integer}` in const contexts
--> $DIR/issue-50582.rs:2:18
|
@ -39,7 +25,7 @@ LL | Vec::<[(); 1 + for x in 0..1 {}]>::new();
<&'a isize as Add<isize>>
and 48 others
error: aborting due to 3 previous errors
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0277, E0658.
For more information about an error, try `rustc --explain E0277`.

View file

@ -2,5 +2,4 @@ fn main() {
|y: Vec<[(); for x in 0..2 {}]>| {};
//~^ ERROR mismatched types
//~| ERROR `for` is not allowed in a `const`
//~| ERROR the trait bound
}

View file

@ -7,27 +7,13 @@ LL | |y: Vec<[(); for x in 0..2 {}]>| {};
= note: see issue #87575 <https://github.com/rust-lang/rust/issues/87575> for more information
= help: add `#![feature(const_for)]` to the crate attributes to enable
error[E0277]: the trait bound `std::ops::Range<{integer}>: Iterator` is not satisfied
--> $DIR/issue-50585.rs:2:27
|
LL | |y: Vec<[(); for x in 0..2 {}]>| {};
| ^^^^ `std::ops::Range<{integer}>` is not an iterator
|
= help: the trait `~const Iterator` is not implemented for `std::ops::Range<{integer}>`
note: the trait `Iterator` is implemented for `std::ops::Range<{integer}>`, but that implementation is not `const`
--> $DIR/issue-50585.rs:2:27
|
LL | |y: Vec<[(); for x in 0..2 {}]>| {};
| ^^^^
= note: required for `std::ops::Range<{integer}>` to implement `~const IntoIterator`
error[E0308]: mismatched types
--> $DIR/issue-50585.rs:2:18
|
LL | |y: Vec<[(); for x in 0..2 {}]>| {};
| ^^^^^^^^^^^^^^^^ expected `usize`, found `()`
error: aborting due to 3 previous errors
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0277, E0308, E0658.
For more information about an error, try `rustc --explain E0277`.
Some errors have detailed explanations: E0308, E0658.
For more information about an error, try `rustc --explain E0308`.

View file

@ -8,5 +8,7 @@ fn main() {
[(); { for _ in 0usize.. {}; 0}];
//~^ ERROR `for` is not allowed in a `const`
//~| ERROR the trait bound
//~| ERROR cannot convert
//~| ERROR mutable references
//~| ERROR cannot call
}

View file

@ -38,25 +38,37 @@ LL | [(); loop { break }];
| expected `usize`, found `()`
| help: give it a value of the expected type: `break 42`
error[E0277]: the trait bound `RangeFrom<usize>: Iterator` is not satisfied
--> $DIR/issue-52443.rs:9:21
|
LL | [(); { for _ in 0usize.. {}; 0}];
| ^^^^^^^^ `RangeFrom<usize>` is not an iterator
|
= help: the trait `~const Iterator` is not implemented for `RangeFrom<usize>`
note: the trait `Iterator` is implemented for `RangeFrom<usize>`, but that implementation is not `const`
error[E0015]: cannot convert `RangeFrom<usize>` into an iterator in constants
--> $DIR/issue-52443.rs:9:21
|
LL | [(); { for _ in 0usize.. {}; 0}];
| ^^^^^^^^
= note: required for `RangeFrom<usize>` to implement `~const IntoIterator`
help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement
|
LL | fn main() where RangeFrom<usize>: ~const Iterator {
| +++++++++++++++++++++++++++++++++++++++
note: impl defined here, but it is not `const`
--> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
|
LL | impl<I: ~const Iterator> const IntoIterator for I {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
error: aborting due to 4 previous errors; 1 warning emitted
error[E0658]: mutable references are not allowed in constants
--> $DIR/issue-52443.rs:9:21
|
LL | [(); { for _ in 0usize.. {}; 0}];
| ^^^^^^^^
|
= note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
Some errors have detailed explanations: E0277, E0308, E0658.
For more information about an error, try `rustc --explain E0277`.
error[E0015]: cannot call non-const fn `<RangeFrom<usize> as Iterator>::next` in constants
--> $DIR/issue-52443.rs:9:21
|
LL | [(); { for _ in 0usize.. {}; 0}];
| ^^^^^^^^
|
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
error: aborting due to 6 previous errors; 1 warning emitted
Some errors have detailed explanations: E0015, E0308, E0658.
For more information about an error, try `rustc --explain E0015`.

View file

@ -4,6 +4,7 @@ fn main() {
<i32 as Add<u32>>::add(1, 2);
//~^ ERROR cannot add `u32` to `i32`
//~| ERROR cannot add `u32` to `i32`
//~| ERROR cannot add `u32` to `i32`
<i32 as Add<i32>>::add(1u32, 2);
//~^ ERROR mismatched types
<i32 as Add<i32>>::add(1, 2u32);

View file

@ -18,8 +18,26 @@ LL | <i32 as Add<u32>>::add(1, 2);
<&'a isize as Add<isize>>
and 48 others
error[E0277]: cannot add `u32` to `i32`
--> $DIR/ufcs-qpath-self-mismatch.rs:4:5
|
LL | <i32 as Add<u32>>::add(1, 2);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `i32 + u32`
|
= help: the trait `Add<u32>` is not implemented for `i32`
= help: the following other types implement trait `Add<Rhs>`:
<&'a f32 as Add<f32>>
<&'a f64 as Add<f64>>
<&'a i128 as Add<i128>>
<&'a i16 as Add<i16>>
<&'a i32 as Add<i32>>
<&'a i64 as Add<i64>>
<&'a i8 as Add<i8>>
<&'a isize as Add<isize>>
and 48 others
error[E0308]: mismatched types
--> $DIR/ufcs-qpath-self-mismatch.rs:7:28
--> $DIR/ufcs-qpath-self-mismatch.rs:8:28
|
LL | <i32 as Add<i32>>::add(1u32, 2);
| ---------------------- ^^^^ expected `i32`, found `u32`
@ -37,7 +55,7 @@ LL | <i32 as Add<i32>>::add(1i32, 2);
| ~~~
error[E0308]: mismatched types
--> $DIR/ufcs-qpath-self-mismatch.rs:9:31
--> $DIR/ufcs-qpath-self-mismatch.rs:10:31
|
LL | <i32 as Add<i32>>::add(1, 2u32);
| ---------------------- ^^^^ expected `i32`, found `u32`
@ -72,7 +90,7 @@ LL | <i32 as Add<u32>>::add(1, 2);
<&'a isize as Add<isize>>
and 48 others
error: aborting due to 4 previous errors
error: aborting due to 5 previous errors
Some errors have detailed explanations: E0277, E0308.
For more information about an error, try `rustc --explain E0277`.