Skip to content

Commit fd1c003

Browse files
Add test for ?const in nested impl/dyn trait
1 parent 14730ed commit fd1c003

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

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

+4
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,8 @@ fn trait_object() -> &'static dyn ?const T { &S }
1515
//~^ ERROR `?const` is not permitted in trait objects
1616
//~| ERROR `?const` on trait bounds is not yet implemented
1717

18+
fn trait_object_in_apit(_: impl IntoIterator<Item = Box<dyn ?const T>>) {}
19+
//~^ ERROR `?const` is not permitted in trait objects
20+
//~| ERROR `?const` on trait bounds is not yet implemented
21+
1822
fn main() {}

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

+13-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ error: `?const` is not permitted in trait objects
1010
LL | fn trait_object() -> &'static dyn ?const T { &S }
1111
| ^^^^^^^^
1212

13+
error: `?const` is not permitted in trait objects
14+
--> $DIR/in-trait-object.rs:18:61
15+
|
16+
LL | fn trait_object_in_apit(_: impl IntoIterator<Item = Box<dyn ?const T>>) {}
17+
| ^^^^^^^^
18+
1319
error: `?const` on trait bounds is not yet implemented
1420
--> $DIR/in-trait-object.rs:10:6
1521
|
@@ -22,5 +28,11 @@ error: `?const` on trait bounds is not yet implemented
2228
LL | fn trait_object() -> &'static dyn ?const T { &S }
2329
| ^^^^^^^^
2430

25-
error: aborting due to 4 previous errors
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
2638

0 commit comments

Comments
 (0)