Skip to content

Commit b9886c6

Browse files
committed
bless tests part 1
1 parent 74e7b5b commit b9886c6

31 files changed

+368
-392
lines changed

compiler/rustc_hir_analysis/src/bounds.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ impl<'tcx> Bounds<'tcx> {
6565
} else {
6666
self.clauses.push(clause);
6767
}
68+
69+
if !tcx.features().effects {
70+
return;
71+
}
6872
// For `T: ~const Tr` or `T: const Tr`, we need to add an additional bound on the
6973
// associated type of `<T as Tr>` and make sure that the effect is compatible.
7074
if let Some(compat_val) = match (tcx.def_kind(defining_def_id), constness) {

tests/ui/const-generics/const_trait_fn-issue-88433.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
//@ build-pass
22
//@ compile-flags: -Znext-solver
33

4-
#![feature(const_trait_impl, effects)] //~ WARN the feature `effects` is incomplete
4+
#![allow(incomplete_features)]
5+
#![feature(const_trait_impl, effects)]
56

67
#[const_trait]
78
trait Func<T> {

tests/ui/const-generics/const_trait_fn-issue-88433.stderr

Lines changed: 0 additions & 11 deletions
This file was deleted.

tests/ui/const-generics/generic_const_exprs/unify-op-with-fn-call.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//@ known-bug: #110395
22

3-
#![feature(generic_const_exprs, adt_const_params, const_trait_impl)]
3+
#![feature(generic_const_exprs, adt_const_params, const_trait_impl, effects)]
44
#![allow(incomplete_features)]
55

66
// test `N + N` unifies with explicit function calls for non-builtin-types
Lines changed: 11 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
error: const `impl` for trait `Add` which is not marked with `#[const_trait]`
2+
--> $DIR/unify-op-with-fn-call.rs:10:12
3+
|
4+
LL | impl const std::ops::Add for Foo {
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+
110
error[E0741]: `Foo` must implement `ConstParamTy` to be used as the type of a const generic parameter
211
--> $DIR/unify-op-with-fn-call.rs:18:29
312
|
@@ -45,48 +54,6 @@ help: try adding a `where` bound
4554
LL | fn foo2<const N: usize>(a: Evaluatable2<{ N + N }>) where [(); { std::ops::Add::add(N, N) }]: {
4655
| +++++++++++++++++++++++++++++++++++++++++
4756

48-
error[E0015]: cannot call non-const operator in constants
49-
--> $DIR/unify-op-with-fn-call.rs:20:39
50-
|
51-
LL | fn foo<const N: Foo>(a: Evaluatable<{ N + N }>) {
52-
| ^^^^^
53-
|
54-
note: impl defined here, but it is not `const`
55-
--> $DIR/unify-op-with-fn-call.rs:10:1
56-
|
57-
LL | impl const std::ops::Add for Foo {
58-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
59-
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
60-
help: add `#![feature(effects)]` to the crate attributes to enable
61-
|
62-
LL + #![feature(effects)]
63-
|
64-
65-
error[E0015]: cannot call non-const fn `<Foo as Add>::add` in constants
66-
--> $DIR/unify-op-with-fn-call.rs:21:13
67-
|
68-
LL | bar::<{ std::ops::Add::add(N, N) }>();
69-
| ^^^^^^^^^^^^^^^^^^^^^^^^
70-
|
71-
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
72-
help: add `#![feature(effects)]` to the crate attributes to enable
73-
|
74-
LL + #![feature(effects)]
75-
|
76-
77-
error[E0015]: cannot call non-const fn `<usize as Add>::add` in constants
78-
--> $DIR/unify-op-with-fn-call.rs:30:14
79-
|
80-
LL | bar2::<{ std::ops::Add::add(N, N) }>();
81-
| ^^^^^^^^^^^^^^^^^^^^^^^^
82-
|
83-
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
84-
help: add `#![feature(effects)]` to the crate attributes to enable
85-
|
86-
LL + #![feature(effects)]
87-
|
88-
89-
error: aborting due to 7 previous errors
57+
error: aborting due to 5 previous errors
9058

91-
Some errors have detailed explanations: E0015, E0741.
92-
For more information about an error, try `rustc --explain E0015`.
59+
For more information about this error, try `rustc --explain E0741`.

tests/ui/const-generics/issues/issue-88119.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//@ check-pass
22

33
#![allow(incomplete_features)]
4-
#![feature(const_trait_impl, generic_const_exprs)]
4+
#![feature(const_trait_impl, effects, generic_const_exprs)]
55

66
#[const_trait]
77
trait ConstName {

tests/ui/consts/const-float-classify.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#![feature(const_float_bits_conv)]
66
#![feature(const_float_classify)]
77
#![feature(const_trait_impl, effects)]
8+
#![allow(incomplete_features)]
89

910
// Don't promote
1011
const fn nop<T>(x: T) -> T { x }
Lines changed: 2 additions & 214 deletions
Original file line numberDiff line numberDiff line change
@@ -1,223 +1,11 @@
1-
warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
2-
--> $DIR/const-float-classify.rs:7:30
3-
|
4-
LL | #![feature(const_trait_impl, effects)]
5-
| ^^^^^^^
6-
|
7-
= note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
8-
= note: `#[warn(incomplete_features)]` on by default
9-
101
error: const `impl` for trait `PartialEq` which is not marked with `#[const_trait]`
11-
--> $DIR/const-float-classify.rs:12:12
2+
--> $DIR/const-float-classify.rs:13:12
123
|
134
LL | impl const PartialEq<NonDet> for bool {
145
| ^^^^^^^^^^^^^^^^^
156
|
167
= note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
178
= note: adding a non-const method body in the future would be a breaking change
189

19-
error[E0207]: the const parameter `host` is not constrained by the impl trait, self type, or predicates
20-
--> $DIR/const-float-classify.rs:12:6
21-
|
22-
LL | impl const PartialEq<NonDet> for bool {
23-
| ^^^^^ unconstrained const parameter
24-
|
25-
= note: expressions using a const parameter must map each value to a distinct output value
26-
= note: proving the result of expressions other than the parameter are unique is not supported
27-
28-
error[E0284]: type annotations needed
29-
--> $DIR/const-float-classify.rs:21:35
30-
|
31-
LL | const _: () = assert!($a == $b);
32-
| ^^ cannot infer the value of the constant `_`
33-
...
34-
LL | / suite! {
35-
LL | | [is_nan, is_infinite, is_finite, is_normal, is_sign_positive, is_sign_negative]
36-
LL | | -0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet]
37-
LL | | 0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet]
38-
... |
39-
LL | | -1.0 / 0.0 => [ false, true, false, false, false, true]
40-
LL | | }
41-
| |_- in this macro invocation
42-
|
43-
note: required for `bool` to implement `PartialEq<NonDet>`
44-
--> $DIR/const-float-classify.rs:12:12
45-
|
46-
LL | impl const PartialEq<NonDet> for bool {
47-
| ----- ^^^^^^^^^^^^^^^^^ ^^^^
48-
| |
49-
| unsatisfied trait bound introduced here
50-
= note: this error originates in the macro `const_assert` which comes from the expansion of the macro `suite` (in Nightly builds, run with -Z macro-backtrace for more info)
51-
52-
error[E0284]: type annotations needed
53-
--> $DIR/const-float-classify.rs:21:35
54-
|
55-
LL | const _: () = assert!($a == $b);
56-
| ^^ cannot infer the value of the constant `_`
57-
...
58-
LL | / suite! {
59-
LL | | [is_nan, is_infinite, is_finite, is_normal, is_sign_positive, is_sign_negative]
60-
LL | | -0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet]
61-
LL | | 0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet]
62-
... |
63-
LL | | -1.0 / 0.0 => [ false, true, false, false, false, true]
64-
LL | | }
65-
| |_- in this macro invocation
66-
|
67-
note: required for `bool` to implement `PartialEq<NonDet>`
68-
--> $DIR/const-float-classify.rs:12:12
69-
|
70-
LL | impl const PartialEq<NonDet> for bool {
71-
| ----- ^^^^^^^^^^^^^^^^^ ^^^^
72-
| |
73-
| unsatisfied trait bound introduced here
74-
= note: this error originates in the macro `const_assert` which comes from the expansion of the macro `suite` (in Nightly builds, run with -Z macro-backtrace for more info)
75-
76-
error[E0284]: type annotations needed
77-
--> $DIR/const-float-classify.rs:21:35
78-
|
79-
LL | const _: () = assert!($a == $b);
80-
| ^^ cannot infer the value of the constant `_`
81-
...
82-
LL | / suite! {
83-
LL | | [is_nan, is_infinite, is_finite, is_normal, is_sign_positive, is_sign_negative]
84-
LL | | -0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet]
85-
LL | | 0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet]
86-
... |
87-
LL | | -1.0 / 0.0 => [ false, true, false, false, false, true]
88-
LL | | }
89-
| |_- in this macro invocation
90-
|
91-
note: required for `bool` to implement `PartialEq<NonDet>`
92-
--> $DIR/const-float-classify.rs:12:12
93-
|
94-
LL | impl const PartialEq<NonDet> for bool {
95-
| ----- ^^^^^^^^^^^^^^^^^ ^^^^
96-
| |
97-
| unsatisfied trait bound introduced here
98-
= note: this error originates in the macro `const_assert` which comes from the expansion of the macro `suite` (in Nightly builds, run with -Z macro-backtrace for more info)
99-
100-
error[E0284]: type annotations needed
101-
--> $DIR/const-float-classify.rs:21:35
102-
|
103-
LL | const _: () = assert!($a == $b);
104-
| ^^ cannot infer the value of the constant `_`
105-
...
106-
LL | / suite! {
107-
LL | | [is_nan, is_infinite, is_finite, is_normal, is_sign_positive, is_sign_negative]
108-
LL | | -0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet]
109-
LL | | 0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet]
110-
... |
111-
LL | | -1.0 / 0.0 => [ false, true, false, false, false, true]
112-
LL | | }
113-
| |_- in this macro invocation
114-
|
115-
note: required for `bool` to implement `PartialEq<NonDet>`
116-
--> $DIR/const-float-classify.rs:12:12
117-
|
118-
LL | impl const PartialEq<NonDet> for bool {
119-
| ----- ^^^^^^^^^^^^^^^^^ ^^^^
120-
| |
121-
| unsatisfied trait bound introduced here
122-
= note: this error originates in the macro `const_assert` which comes from the expansion of the macro `suite` (in Nightly builds, run with -Z macro-backtrace for more info)
123-
124-
error[E0284]: type annotations needed
125-
--> $DIR/const-float-classify.rs:21:35
126-
|
127-
LL | const _: () = assert!($a == $b);
128-
| ^^ cannot infer the value of the constant `_`
129-
...
130-
LL | / suite! {
131-
LL | | [is_nan, is_infinite, is_finite, is_normal, is_sign_positive, is_sign_negative]
132-
LL | | -0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet]
133-
LL | | 0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet]
134-
... |
135-
LL | | -1.0 / 0.0 => [ false, true, false, false, false, true]
136-
LL | | }
137-
| |_- in this macro invocation
138-
|
139-
note: required for `bool` to implement `PartialEq<NonDet>`
140-
--> $DIR/const-float-classify.rs:12:12
141-
|
142-
LL | impl const PartialEq<NonDet> for bool {
143-
| ----- ^^^^^^^^^^^^^^^^^ ^^^^
144-
| |
145-
| unsatisfied trait bound introduced here
146-
= note: this error originates in the macro `const_assert` which comes from the expansion of the macro `suite` (in Nightly builds, run with -Z macro-backtrace for more info)
147-
148-
error[E0284]: type annotations needed
149-
--> $DIR/const-float-classify.rs:21:35
150-
|
151-
LL | const _: () = assert!($a == $b);
152-
| ^^ cannot infer the value of the constant `_`
153-
...
154-
LL | / suite! {
155-
LL | | [is_nan, is_infinite, is_finite, is_normal, is_sign_positive, is_sign_negative]
156-
LL | | -0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet]
157-
LL | | 0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet]
158-
... |
159-
LL | | -1.0 / 0.0 => [ false, true, false, false, false, true]
160-
LL | | }
161-
| |_- in this macro invocation
162-
|
163-
note: required for `bool` to implement `PartialEq<NonDet>`
164-
--> $DIR/const-float-classify.rs:12:12
165-
|
166-
LL | impl const PartialEq<NonDet> for bool {
167-
| ----- ^^^^^^^^^^^^^^^^^ ^^^^
168-
| |
169-
| unsatisfied trait bound introduced here
170-
= note: this error originates in the macro `const_assert` which comes from the expansion of the macro `suite` (in Nightly builds, run with -Z macro-backtrace for more info)
171-
172-
error[E0284]: type annotations needed
173-
--> $DIR/const-float-classify.rs:21:35
174-
|
175-
LL | const _: () = assert!($a == $b);
176-
| ^^ cannot infer the value of the constant `_`
177-
...
178-
LL | / suite! {
179-
LL | | [is_nan, is_infinite, is_finite, is_normal, is_sign_positive, is_sign_negative]
180-
LL | | -0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet]
181-
LL | | 0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet]
182-
... |
183-
LL | | -1.0 / 0.0 => [ false, true, false, false, false, true]
184-
LL | | }
185-
| |_- in this macro invocation
186-
|
187-
note: required for `bool` to implement `PartialEq<NonDet>`
188-
--> $DIR/const-float-classify.rs:12:12
189-
|
190-
LL | impl const PartialEq<NonDet> for bool {
191-
| ----- ^^^^^^^^^^^^^^^^^ ^^^^
192-
| |
193-
| unsatisfied trait bound introduced here
194-
= note: this error originates in the macro `const_assert` which comes from the expansion of the macro `suite` (in Nightly builds, run with -Z macro-backtrace for more info)
195-
196-
error[E0284]: type annotations needed
197-
--> $DIR/const-float-classify.rs:21:35
198-
|
199-
LL | const _: () = assert!($a == $b);
200-
| ^^ cannot infer the value of the constant `_`
201-
...
202-
LL | / suite! {
203-
LL | | [is_nan, is_infinite, is_finite, is_normal, is_sign_positive, is_sign_negative]
204-
LL | | -0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet]
205-
LL | | 0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet]
206-
... |
207-
LL | | -1.0 / 0.0 => [ false, true, false, false, false, true]
208-
LL | | }
209-
| |_- in this macro invocation
210-
|
211-
note: required for `bool` to implement `PartialEq<NonDet>`
212-
--> $DIR/const-float-classify.rs:12:12
213-
|
214-
LL | impl const PartialEq<NonDet> for bool {
215-
| ----- ^^^^^^^^^^^^^^^^^ ^^^^
216-
| |
217-
| unsatisfied trait bound introduced here
218-
= note: this error originates in the macro `const_assert` which comes from the expansion of the macro `suite` (in Nightly builds, run with -Z macro-backtrace for more info)
219-
220-
error: aborting due to 10 previous errors; 1 warning emitted
10+
error: aborting due to 1 previous error
22111

222-
Some errors have detailed explanations: E0207, E0284.
223-
For more information about an error, try `rustc --explain E0207`.

tests/ui/consts/const-try.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44

55
#![crate_type = "lib"]
66
#![feature(try_trait_v2)]
7-
#![feature(const_trait_impl)]
7+
#![feature(const_trait_impl, effects)]
88
#![feature(const_try)]
9+
#![allow(incomplete_features)]
910

1011
use std::ops::{ControlFlow, FromResidual, Try};
1112

0 commit comments

Comments
 (0)