Skip to content

Commit 23ea42c

Browse files
Update tests
1 parent 0ac4ba0 commit 23ea42c

13 files changed

+49
-94
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error: `?const` on trait bounds is not yet implemented
2-
--> $DIR/feature-gate.rs:11:29
1+
error: fatal error triggered by #[rustc_error]
2+
--> $DIR/feature-gate.rs:16:1
33
|
4-
LL | const fn get_assoc_const<S: ?const T>() -> i32 { <S as T>::CONST }
5-
| ^^^^^^^^
4+
LL | fn main() {}
5+
| ^^^^^^^^^^^^
66

77
error: aborting due to previous error
88

src/test/ui/rfc-2632-const-trait-impl/const-trait-bound-opt-out/feature-gate.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@
33

44
#![cfg_attr(gated, feature(const_trait_bound_opt_out))]
55
#![allow(incomplete_features)]
6+
#![feature(rustc_attrs)]
67

78
trait T {
89
const CONST: i32;
910
}
1011

1112
const fn get_assoc_const<S: ?const T>() -> i32 { <S as T>::CONST }
1213
//[stock]~^ ERROR `?const` on trait bounds is experimental
13-
//[stock,gated]~^^ ERROR `?const` on trait bounds is not yet implemented
1414

15-
fn main() {}
15+
#[rustc_error]
16+
fn main() {} //[gated]~ ERROR fatal error triggered by #[rustc_error]
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,12 @@
11
error[E0658]: `?const` on trait bounds is experimental
2-
--> $DIR/feature-gate.rs:11:29
2+
--> $DIR/feature-gate.rs:12:29
33
|
44
LL | const fn get_assoc_const<S: ?const T>() -> i32 { <S as T>::CONST }
55
| ^^^^^^
66
|
77
= note: for more information, see https://github.com/rust-lang/rust/issues/67794
88
= help: add `#![feature(const_trait_bound_opt_out)]` to the crate attributes to enable
99

10-
error: `?const` on trait bounds is not yet implemented
11-
--> $DIR/feature-gate.rs:11:29
12-
|
13-
LL | const fn get_assoc_const<S: ?const T>() -> i32 { <S as T>::CONST }
14-
| ^^^^^^^^
15-
16-
error: aborting due to 2 previous errors
10+
error: aborting due to previous error
1711

1812
For more information about this error, try `rustc --explain E0658`.

src/test/ui/rfc-2632-const-trait-impl/const-trait-bound-opt-out/in-impl-trait.rs

-4
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,14 @@ impl T for S {}
88

99
fn rpit() -> impl ?const T { S }
1010
//~^ ERROR `?const` is not permitted in `impl Trait`
11-
//~| ERROR `?const` on trait bounds is not yet implemented
1211

1312
fn apit(_: impl ?const T) {}
1413
//~^ ERROR `?const` is not permitted in `impl Trait`
15-
//~| ERROR `?const` on trait bounds is not yet implemented
1614

1715
fn rpit_assoc_bound() -> impl IntoIterator<Item: ?const T> { Some(S) }
1816
//~^ ERROR `?const` is not permitted in `impl Trait`
19-
//~| ERROR `?const` on trait bounds is not yet implemented
2017

2118
fn apit_assoc_bound(_: impl IntoIterator<Item: ?const T>) {}
2219
//~^ ERROR `?const` is not permitted in `impl Trait`
23-
//~| ERROR `?const` on trait bounds is not yet implemented
2420

2521
fn main() {}

src/test/ui/rfc-2632-const-trait-impl/const-trait-bound-opt-out/in-impl-trait.stderr

+4-28
Original file line numberDiff line numberDiff line change
@@ -5,46 +5,22 @@ LL | fn rpit() -> impl ?const T { S }
55
| ^^^^^^^^
66

77
error: `?const` is not permitted in `impl Trait`
8-
--> $DIR/in-impl-trait.rs:13:17
8+
--> $DIR/in-impl-trait.rs:12:17
99
|
1010
LL | fn apit(_: impl ?const T) {}
1111
| ^^^^^^^^
1212

1313
error: `?const` is not permitted in `impl Trait`
14-
--> $DIR/in-impl-trait.rs:17:50
14+
--> $DIR/in-impl-trait.rs:15:50
1515
|
1616
LL | fn rpit_assoc_bound() -> impl IntoIterator<Item: ?const T> { Some(S) }
1717
| ^^^^^^^^
1818

1919
error: `?const` is not permitted in `impl Trait`
20-
--> $DIR/in-impl-trait.rs:21:48
20+
--> $DIR/in-impl-trait.rs:18:48
2121
|
2222
LL | fn apit_assoc_bound(_: impl IntoIterator<Item: ?const T>) {}
2323
| ^^^^^^^^
2424

25-
error: `?const` on trait bounds is not yet implemented
26-
--> $DIR/in-impl-trait.rs:9:19
27-
|
28-
LL | fn rpit() -> impl ?const T { S }
29-
| ^^^^^^^^
30-
31-
error: `?const` on trait bounds is not yet implemented
32-
--> $DIR/in-impl-trait.rs:13:17
33-
|
34-
LL | fn apit(_: impl ?const T) {}
35-
| ^^^^^^^^
36-
37-
error: `?const` on trait bounds is not yet implemented
38-
--> $DIR/in-impl-trait.rs:17:50
39-
|
40-
LL | fn rpit_assoc_bound() -> impl IntoIterator<Item: ?const T> { Some(S) }
41-
| ^^^^^^^^
42-
43-
error: `?const` on trait bounds is not yet implemented
44-
--> $DIR/in-impl-trait.rs:21:48
45-
|
46-
LL | fn apit_assoc_bound(_: impl IntoIterator<Item: ?const T>) {}
47-
| ^^^^^^^^
48-
49-
error: aborting due to 8 previous errors
25+
error: aborting due to 4 previous errors
5026

src/test/ui/rfc-2632-const-trait-impl/const-trait-bound-opt-out/in-trait-bounds.rs

-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,5 @@
44
trait Super {}
55
trait T: ?const Super {}
66
//~^ ERROR `?const` is not permitted in supertraits
7-
//~| ERROR `?const` on trait bounds is not yet implemented
87

98
fn main() {}

src/test/ui/rfc-2632-const-trait-impl/const-trait-bound-opt-out/in-trait-bounds.stderr

+1-7
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,5 @@ error: `?const` is not permitted in supertraits
44
LL | trait T: ?const Super {}
55
| ^^^^^^^^^^^^
66

7-
error: `?const` on trait bounds is not yet implemented
8-
--> $DIR/in-trait-bounds.rs:5:10
9-
|
10-
LL | trait T: ?const Super {}
11-
| ^^^^^^^^^^^^
12-
13-
error: aborting due to 2 previous errors
7+
error: aborting due to previous error
148

src/test/ui/rfc-2632-const-trait-impl/const-trait-bound-opt-out/in-trait-object.rs

-3
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,11 @@ impl T for S {}
99
// An inherent impl for the trait object `?const T`.
1010
impl ?const T {}
1111
//~^ ERROR `?const` is not permitted in trait objects
12-
//~| ERROR `?const` on trait bounds is not yet implemented
1312

1413
fn trait_object() -> &'static dyn ?const T { &S }
1514
//~^ ERROR `?const` is not permitted in trait objects
16-
//~| ERROR `?const` on trait bounds is not yet implemented
1715

1816
fn trait_object_in_apit(_: impl IntoIterator<Item = Box<dyn ?const T>>) {}
1917
//~^ ERROR `?const` is not permitted in trait objects
20-
//~| ERROR `?const` on trait bounds is not yet implemented
2118

2219
fn main() {}

src/test/ui/rfc-2632-const-trait-impl/const-trait-bound-opt-out/in-trait-object.stderr

+3-21
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,16 @@ LL | impl ?const T {}
55
| ^^^^^^^^
66

77
error: `?const` is not permitted in trait objects
8-
--> $DIR/in-trait-object.rs:14:35
8+
--> $DIR/in-trait-object.rs:13:35
99
|
1010
LL | fn trait_object() -> &'static dyn ?const T { &S }
1111
| ^^^^^^^^
1212

1313
error: `?const` is not permitted in trait objects
14-
--> $DIR/in-trait-object.rs:18:61
14+
--> $DIR/in-trait-object.rs:16:61
1515
|
1616
LL | fn trait_object_in_apit(_: impl IntoIterator<Item = Box<dyn ?const T>>) {}
1717
| ^^^^^^^^
1818

19-
error: `?const` on trait bounds is not yet implemented
20-
--> $DIR/in-trait-object.rs:10:6
21-
|
22-
LL | impl ?const T {}
23-
| ^^^^^^^^
24-
25-
error: `?const` on trait bounds is not yet implemented
26-
--> $DIR/in-trait-object.rs:14:35
27-
|
28-
LL | fn trait_object() -> &'static dyn ?const T { &S }
29-
| ^^^^^^^^
30-
31-
error: `?const` on trait bounds is not yet implemented
32-
--> $DIR/in-trait-object.rs:18:61
33-
|
34-
LL | fn trait_object_in_apit(_: impl IntoIterator<Item = Box<dyn ?const T>>) {}
35-
| ^^^^^^^^
36-
37-
error: aborting due to 6 previous errors
19+
error: aborting due to 3 previous errors
3820

src/test/ui/rfc-2632-const-trait-impl/const-trait-bound-opt-out/with-maybe-sized.rs

-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,5 @@
33

44
struct S<T: ?const ?Sized>(std::marker::PhantomData<T>);
55
//~^ ERROR `?const` and `?` are mutually exclusive
6-
//~| ERROR `?const` on trait bounds is not yet implemented
76

87
fn main() {}

src/test/ui/rfc-2632-const-trait-impl/const-trait-bound-opt-out/with-maybe-sized.stderr

+1-7
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,5 @@ error: `?const` and `?` are mutually exclusive
44
LL | struct S<T: ?const ?Sized>(std::marker::PhantomData<T>);
55
| ^^^^^^^^^^^^^
66

7-
error: `?const` on trait bounds is not yet implemented
8-
--> $DIR/with-maybe-sized.rs:4:13
9-
|
10-
LL | struct S<T: ?const ?Sized>(std::marker::PhantomData<T>);
11-
| ^^^^^^^^^^^^^
12-
13-
error: aborting due to 2 previous errors
7+
error: aborting due to previous error
148

Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// compile-flags: -Z parse-only
2-
31
#![feature(const_trait_impl)]
42
#![feature(const_trait_bound_opt_out)]
53
#![allow(incomplete_features)]
@@ -8,7 +6,12 @@
86
struct S;
97
trait T {}
108

9+
impl const S {}
10+
//~^ ERROR inherent impls cannot be `const`
11+
//~| ERROR const trait impls are not yet implemented
12+
1113
impl const T {}
12-
//~^ ERROR `const` cannot modify an inherent impl
14+
//~^ ERROR inherent impls cannot be `const`
15+
//~| ERROR const trait impls are not yet implemented
1316

1417
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,30 @@
1-
error: `const` cannot modify an inherent impl
2-
--> $DIR/inherent-impl.rs:11:6
1+
error: inherent impls cannot be `const`
2+
--> $DIR/inherent-impl.rs:9:1
3+
|
4+
LL | impl const S {}
5+
| ^^^^^^^^^^^^^^^
6+
|
7+
= note: only trait implementations may be annotated with `const`
8+
9+
error: inherent impls cannot be `const`
10+
--> $DIR/inherent-impl.rs:13:1
311
|
412
LL | impl const T {}
5-
| ^^^^^
13+
| ^^^^^^^^^^^^^^^
14+
|
15+
= note: only trait implementations may be annotated with `const`
16+
17+
error: const trait impls are not yet implemented
18+
--> $DIR/inherent-impl.rs:9:1
19+
|
20+
LL | impl const S {}
21+
| ^^^^^^^^^^^^^^^
22+
23+
error: const trait impls are not yet implemented
24+
--> $DIR/inherent-impl.rs:13:1
625
|
7-
= help: only a trait impl can be `const`
26+
LL | impl const T {}
27+
| ^^^^^^^^^^^^^^^
828

9-
error: aborting due to previous error
29+
error: aborting due to 4 previous errors
1030

0 commit comments

Comments
 (0)