Skip to content

Commit 373e906

Browse files
committed
bless UI tests
1 parent f852a2c commit 373e906

File tree

73 files changed

+870
-819
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+870
-819
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,21 @@
1-
error[E0080]: evaluation of `foo::<()>::{constant#0}` failed
1+
error[E0308]: mismatched types
22
--> $DIR/constifconst-call-in-const-position.rs:17:38
33
|
44
LL | const fn foo<T: ~const Tr>() -> [u8; T::a()] {
5-
| ^^^^^^ calling non-const function `<() as Tr>::a`
5+
| ^^^^^^ expected `false`, found `host`
6+
|
7+
= note: expected constant `false`
8+
found constant `host`
9+
10+
error[E0308]: mismatched types
11+
--> $DIR/constifconst-call-in-const-position.rs:18:9
12+
|
13+
LL | [0; T::a()]
14+
| ^^^^^^ expected `false`, found `host`
15+
|
16+
= note: expected constant `false`
17+
found constant `host`
618

7-
error: aborting due to 1 previous error
19+
error: aborting due to 2 previous errors
820

9-
For more information about this error, try `rustc --explain E0080`.
21+
For more information about this error, try `rustc --explain E0308`.

tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage-0.qualified.stderr

+10-6
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,20 @@ LL | #![feature(const_trait_impl, effects)]
77
= note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
88
= note: `#[warn(incomplete_features)]` on by default
99

10-
error[E0277]: the trait bound `T: Trait` is not satisfied
11-
--> $DIR/assoc-type-const-bound-usage-0.rs:21:6
10+
error[E0277]: the trait bound `Trait::{synthetic#0}: Compat` is not satisfied
11+
--> $DIR/assoc-type-const-bound-usage-0.rs:21:5
1212
|
1313
LL | <T as /* FIXME: ~const */ Trait>::Assoc::func()
14-
| ^ the trait `Trait` is not implemented for `T`
14+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Compat` is not implemented for `Trait::{synthetic#0}`
1515
|
16-
help: consider further restricting this bound
16+
note: required by a bound in `Trait::func`
17+
--> $DIR/assoc-type-const-bound-usage-0.rs:8:1
1718
|
18-
LL | const fn qualified<T: ~const Trait + Trait>() -> i32 {
19-
| +++++++
19+
LL | #[const_trait]
20+
| ^^^^^^^^^^^^^^ required by this bound in `Trait::func`
21+
...
22+
LL | fn func() -> i32;
23+
| ---- required by a bound in this associated function
2024

2125
error: aborting due to 1 previous error; 1 warning emitted
2226

Original file line numberDiff line numberDiff line change
@@ -1,24 +1,20 @@
1-
// FIXME(effects): Collapse the revisions into one once we support `<Ty as ~const Trait>::Proj`.
2-
//@ revisions: unqualified qualified
3-
//@[unqualified] check-pass
4-
//@[qualified] known-bug: unknown
1+
//@ known-bug: unknown
52

6-
#![feature(const_trait_impl, effects)] //[unqualified]~ WARN the feature `effects` is incomplete
3+
#![allow(incomplete_features)]
4+
#![feature(const_trait_impl, effects)]
75

86
#[const_trait]
97
trait Trait {
108
type Assoc: ~const Trait;
119
fn func() -> i32;
1210
}
1311

14-
#[cfg(unqualified)]
1512
const fn unqualified<T: ~const Trait>() -> i32 {
1613
T::Assoc::func()
1714
}
1815

19-
#[cfg(qualified)]
2016
const fn qualified<T: ~const Trait>() -> i32 {
21-
<T as /* FIXME: ~const */ Trait>::Assoc::func()
17+
<T as Trait>::Assoc::func()
2218
}
2319

2420
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
error[E0277]: the trait bound `Trait::{synthetic#0}: Compat` is not satisfied
2+
--> $DIR/assoc-type-const-bound-usage-0.rs:13:5
3+
|
4+
LL | T::Assoc::func()
5+
| ^^^^^^^^ the trait `Compat` is not implemented for `Trait::{synthetic#0}`
6+
|
7+
note: required by a bound in `Trait::func`
8+
--> $DIR/assoc-type-const-bound-usage-0.rs:6:1
9+
|
10+
LL | #[const_trait]
11+
| ^^^^^^^^^^^^^^ required by this bound in `Trait::func`
12+
...
13+
LL | fn func() -> i32;
14+
| ---- required by a bound in this associated function
15+
16+
error[E0277]: the trait bound `Trait::{synthetic#0}: Compat` is not satisfied
17+
--> $DIR/assoc-type-const-bound-usage-0.rs:17:5
18+
|
19+
LL | <T as Trait>::Assoc::func()
20+
| ^^^^^^^^^^^^^^^^^^^ the trait `Compat` is not implemented for `Trait::{synthetic#0}`
21+
|
22+
note: required by a bound in `Trait::func`
23+
--> $DIR/assoc-type-const-bound-usage-0.rs:6:1
24+
|
25+
LL | #[const_trait]
26+
| ^^^^^^^^^^^^^^ required by this bound in `Trait::func`
27+
...
28+
LL | fn func() -> i32;
29+
| ---- required by a bound in this associated function
30+
31+
error: aborting due to 2 previous errors
32+
33+
For more information about this error, try `rustc --explain E0277`.
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,33 @@
1-
error[E0277]: the trait bound `T: Trait` is not satisfied
2-
--> $DIR/assoc-type-const-bound-usage-1.rs:23:43
1+
error[E0277]: the trait bound `Trait::{synthetic#0}: Compat` is not satisfied
2+
--> $DIR/assoc-type-const-bound-usage-1.rs:16:44
33
|
4-
LL | fn qualified<T: const Trait>() -> Type<{ <T as /* FIXME: const */ Trait>::Assoc::func() }> {
5-
| ^ the trait `Trait` is not implemented for `T`
4+
LL | fn unqualified<T: const Trait>() -> Type<{ T::Assoc::func() }> {
5+
| ^^^^^^^^ the trait `Compat` is not implemented for `Trait::{synthetic#0}`
66
|
7-
help: consider further restricting this bound
7+
note: required by a bound in `Trait::func`
8+
--> $DIR/assoc-type-const-bound-usage-1.rs:8:1
89
|
9-
LL | fn qualified<T: const Trait + Trait>() -> Type<{ <T as /* FIXME: const */ Trait>::Assoc::func() }> {
10-
| +++++++
10+
LL | #[const_trait]
11+
| ^^^^^^^^^^^^^^ required by this bound in `Trait::func`
12+
...
13+
LL | fn func() -> i32;
14+
| ---- required by a bound in this associated function
1115

12-
error: aborting due to 1 previous error
16+
error[E0277]: the trait bound `Trait::{synthetic#0}: Compat` is not satisfied
17+
--> $DIR/assoc-type-const-bound-usage-1.rs:20:42
18+
|
19+
LL | fn qualified<T: const Trait>() -> Type<{ <T as Trait>::Assoc::func() }> {
20+
| ^^^^^^^^^^^^^^^^^^^ the trait `Compat` is not implemented for `Trait::{synthetic#0}`
21+
|
22+
note: required by a bound in `Trait::func`
23+
--> $DIR/assoc-type-const-bound-usage-1.rs:8:1
24+
|
25+
LL | #[const_trait]
26+
| ^^^^^^^^^^^^^^ required by this bound in `Trait::func`
27+
...
28+
LL | fn func() -> i32;
29+
| ---- required by a bound in this associated function
30+
31+
error: aborting due to 2 previous errors
1332

1433
For more information about this error, try `rustc --explain E0277`.

tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage-1.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// FIXME(effects): Collapse the revisions into one once we support `<Ty as const Trait>::Proj`.
22
//@ revisions: unqualified qualified
3-
//@[unqualified] check-pass
4-
//@[qualified] known-bug: unknown
3+
//@known-bug: unknown
54

65
#![feature(const_trait_impl, effects, generic_const_exprs)]
76
#![allow(incomplete_features)]
@@ -14,13 +13,11 @@ trait Trait {
1413

1514
struct Type<const N: i32>;
1615

17-
#[cfg(unqualified)]
1816
fn unqualified<T: const Trait>() -> Type<{ T::Assoc::func() }> {
1917
Type
2018
}
2119

22-
#[cfg(qualified)]
23-
fn qualified<T: const Trait>() -> Type<{ <T as /* FIXME: const */ Trait>::Assoc::func() }> {
20+
fn qualified<T: const Trait>() -> Type<{ <T as Trait>::Assoc::func() }> {
2421
Type
2522
}
2623

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
error[E0277]: the trait bound `Trait::{synthetic#0}: Compat` is not satisfied
2+
--> $DIR/assoc-type-const-bound-usage-1.rs:16:44
3+
|
4+
LL | fn unqualified<T: const Trait>() -> Type<{ T::Assoc::func() }> {
5+
| ^^^^^^^^ the trait `Compat` is not implemented for `Trait::{synthetic#0}`
6+
|
7+
note: required by a bound in `Trait::func`
8+
--> $DIR/assoc-type-const-bound-usage-1.rs:8:1
9+
|
10+
LL | #[const_trait]
11+
| ^^^^^^^^^^^^^^ required by this bound in `Trait::func`
12+
...
13+
LL | fn func() -> i32;
14+
| ---- required by a bound in this associated function
15+
16+
error[E0277]: the trait bound `Trait::{synthetic#0}: Compat` is not satisfied
17+
--> $DIR/assoc-type-const-bound-usage-1.rs:20:42
18+
|
19+
LL | fn qualified<T: const Trait>() -> Type<{ <T as Trait>::Assoc::func() }> {
20+
| ^^^^^^^^^^^^^^^^^^^ the trait `Compat` is not implemented for `Trait::{synthetic#0}`
21+
|
22+
note: required by a bound in `Trait::func`
23+
--> $DIR/assoc-type-const-bound-usage-1.rs:8:1
24+
|
25+
LL | #[const_trait]
26+
| ^^^^^^^^^^^^^^ required by this bound in `Trait::func`
27+
...
28+
LL | fn func() -> i32;
29+
| ---- required by a bound in this associated function
30+
31+
error: aborting due to 2 previous errors
32+
33+
For more information about this error, try `rustc --explain E0277`.

tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,13 @@ trait Foo {
3232
}
3333

3434
impl const Foo for NonConstAdd {
35-
type Bar = NonConstAdd; //~ ERROR the trait bound `NonConstAdd: ~const Add` is not satisfied
35+
type Bar = NonConstAdd; // FIXME(effects) ERROR the trait bound `NonConstAdd: ~const Add` is not satisfied
3636
}
3737

3838
#[const_trait]
3939
trait Baz {
4040
type Qux: Add;
41+
//~^ ERROR the trait bound
4142
}
4243

4344
impl const Baz for NonConstAdd {

tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type.stderr

+7-9
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,16 @@ LL | #![feature(const_trait_impl, effects)]
77
= note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
88
= note: `#[warn(incomplete_features)]` on by default
99

10-
error[E0277]: the trait bound `NonConstAdd: ~const Add` is not satisfied
11-
--> $DIR/assoc-type.rs:35:16
10+
error[E0277]: the trait bound `Add::{synthetic#0}: Compat` is not satisfied
11+
--> $DIR/assoc-type.rs:40:15
1212
|
13-
LL | type Bar = NonConstAdd;
14-
| ^^^^^^^^^^^ the trait `~const Add` is not implemented for `NonConstAdd`
13+
LL | type Qux: Add;
14+
| ^^^ the trait `Compat` is not implemented for `Add::{synthetic#0}`
1515
|
16-
= help: the trait `Add` is implemented for `NonConstAdd`
17-
note: required by a bound in `Foo::Bar`
18-
--> $DIR/assoc-type.rs:31:15
16+
help: consider further restricting the associated type
1917
|
20-
LL | type Bar: ~const Add;
21-
| ^^^^^^^^^^ required by this bound in `Foo::Bar`
18+
LL | trait Baz where Add::{synthetic#0}: Compat {
19+
| ++++++++++++++++++++++++++++++++
2220

2321
error: aborting due to 1 previous error; 1 warning emitted
2422

tests/ui/rfcs/rfc-2632-const-trait-impl/call-const-trait-method-fail.stderr

+11-3
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,21 @@ LL | #![feature(const_trait_impl, effects)]
77
= note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
88
= note: `#[warn(incomplete_features)]` on by default
99

10-
error[E0277]: the trait bound `u32: ~const Plus` is not satisfied
10+
error[E0277]: the trait bound `Runtime: ~const Compat` is not satisfied
1111
--> $DIR/call-const-trait-method-fail.rs:25:5
1212
|
1313
LL | a.plus(b)
14-
| ^ the trait `~const Plus` is not implemented for `u32`
14+
| ^ the trait `~const Compat` is not implemented for `Runtime`
1515
|
16-
= help: the trait `Plus` is implemented for `u32`
16+
= help: the trait `Compat` is implemented for `Runtime`
17+
note: required by a bound in `Plus::plus`
18+
--> $DIR/call-const-trait-method-fail.rs:3:1
19+
|
20+
LL | #[const_trait]
21+
| ^^^^^^^^^^^^^^ required by this bound in `Plus::plus`
22+
LL | pub trait Plus {
23+
LL | fn plus(self, rhs: Self) -> Self;
24+
| ---- required by a bound in this associated function
1725

1826
error: aborting due to 1 previous error; 1 warning emitted
1927

Original file line numberDiff line numberDiff line change
@@ -1,20 +1,66 @@
1+
error: const `impl` for trait `Add` which is not marked with `#[const_trait]`
2+
--> $DIR/call-const-trait-method-pass.rs:7:12
3+
|
4+
LL | impl const std::ops::Add for Int {
5+
| ^^^^^^^^^^^^^
6+
|
7+
= note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
8+
= note: adding a non-const method body in the future would be a breaking change
9+
10+
error: const `impl` for trait `PartialEq` which is not marked with `#[const_trait]`
11+
--> $DIR/call-const-trait-method-pass.rs:15:12
12+
|
13+
LL | impl const PartialEq for Int {
14+
| ^^^^^^^^^
15+
|
16+
= note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
17+
= note: adding a non-const method body in the future would be a breaking change
18+
19+
error[E0049]: method `plus` has 1 const parameter but its trait declaration has 0 const parameters
20+
--> $DIR/call-const-trait-method-pass.rs:24:1
21+
|
22+
LL | #[const_trait]
23+
| ^^^^^^^^^^^^^^ found 1 const parameter
24+
LL | pub trait Plus {
25+
LL | fn plus(self, rhs: Self) -> Self;
26+
| - expected 0 const parameters
27+
128
error[E0015]: cannot call non-const operator in constants
229
--> $DIR/call-const-trait-method-pass.rs:39:22
330
|
431
LL | const ADD_INT: Int = Int(1i32) + Int(2i32);
532
| ^^^^^^^^^^^^^^^^^^^^^
633
|
7-
note: impl defined here, but it is not `const`
8-
--> $DIR/call-const-trait-method-pass.rs:7:1
9-
|
10-
LL | impl const std::ops::Add for Int {
11-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1234
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
1335
help: add `#![feature(effects)]` to the crate attributes to enable
1436
|
1537
LL + #![feature(effects)]
1638
|
1739

40+
error[E0015]: cannot call non-const fn `<i32 as Plus>::plus` in constant functions
41+
--> $DIR/call-const-trait-method-pass.rs:11:20
42+
|
43+
LL | Int(self.0.plus(rhs.0))
44+
| ^^^^^^^^^^^
45+
|
46+
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
47+
help: add `#![feature(effects)]` to the crate attributes to enable
48+
|
49+
LL + #![feature(effects)]
50+
|
51+
52+
error[E0015]: cannot call non-const fn `<Int as PartialEq>::eq` in constant functions
53+
--> $DIR/call-const-trait-method-pass.rs:20:15
54+
|
55+
LL | !self.eq(other)
56+
| ^^^^^^^^^
57+
|
58+
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
59+
help: add `#![feature(effects)]` to the crate attributes to enable
60+
|
61+
LL + #![feature(effects)]
62+
|
63+
1864
error[E0015]: cannot call non-const fn `<i32 as Plus>::plus` in constant functions
1965
--> $DIR/call-const-trait-method-pass.rs:36:7
2066
|
@@ -27,6 +73,7 @@ help: add `#![feature(effects)]` to the crate attributes to enable
2773
LL + #![feature(effects)]
2874
|
2975

30-
error: aborting due to 2 previous errors
76+
error: aborting due to 7 previous errors
3177

32-
For more information about this error, try `rustc --explain E0015`.
78+
Some errors have detailed explanations: E0015, E0049.
79+
For more information about an error, try `rustc --explain E0015`.

tests/ui/rfcs/rfc-2632-const-trait-impl/call-generic-in-impl.stderr

+24-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,28 @@ error: `~const` can only be applied to `#[const_trait]` traits
44
LL | impl<T: ~const PartialEq> const MyPartialEq for T {
55
| ^^^^^^^^^
66

7-
error: aborting due to 1 previous error
7+
error[E0049]: method `eq` has 1 const parameter but its trait declaration has 0 const parameters
8+
--> $DIR/call-generic-in-impl.rs:5:1
9+
|
10+
LL | #[const_trait]
11+
| ^^^^^^^^^^^^^^ found 1 const parameter
12+
LL | trait MyPartialEq {
13+
LL | fn eq(&self, other: &Self) -> bool;
14+
| - expected 0 const parameters
15+
16+
error[E0015]: cannot call non-const fn `<T as PartialEq>::eq` in constant functions
17+
--> $DIR/call-generic-in-impl.rs:12:9
18+
|
19+
LL | PartialEq::eq(self, other)
20+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
21+
|
22+
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
23+
help: add `#![feature(effects)]` to the crate attributes to enable
24+
|
25+
LL + #![feature(effects)]
26+
|
27+
28+
error: aborting due to 3 previous errors
829

30+
Some errors have detailed explanations: E0015, E0049.
31+
For more information about an error, try `rustc --explain E0015`.

0 commit comments

Comments
 (0)