Skip to content

Commit 4d28bdd

Browse files
authored
Unrolled build for rust-lang#123348
Rollup merge of rust-lang#123348 - fmease:add-synth-auto-trait-impls-tests, r=GuillaumeGomez rustdoc: add a couple of regression tests Fixes rust-lang#114657. Fixes rust-lang#112828. Fixes rust-lang#107715. r? rustdoc
2 parents a77322c + 5ee4d13 commit 4d28bdd

5 files changed

+85
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// We used to ICE here while trying to synthesize auto trait impls.
2+
// issue: 107715
3+
//@ check-pass
4+
5+
pub const N: usize = 1;
6+
7+
pub struct MapType<K: Supertrait<V>, V> {
8+
_array: K::Array,
9+
}
10+
11+
pub trait Subtrait: Supertrait<[u8; N]> {}
12+
13+
pub trait Supertrait<V> {
14+
type Array: AnotherTrait<V>;
15+
}
16+
17+
pub trait AnotherTrait<V> {
18+
const LENGTH: usize;
19+
}
20+
21+
pub struct Container<S: Subtrait> {
22+
_x: MapType<S, [u8; N]>,
23+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// We used to ICE here while trying to synthesize auto trait impls.
2+
// issue: 114657
3+
4+
pub trait Foo {
5+
type FooType;
6+
}
7+
8+
pub trait Bar<const A: usize>: Foo<FooType = <Self as Bar<A>>::BarType> {
9+
type BarType;
10+
}
11+
12+
pub(crate) const B: usize = 5;
13+
14+
pub trait Tec: Bar<B> {}
15+
16+
pub struct Structure<C: Tec> { //~ ERROR the trait bound `C: Bar<5>` is not satisfied
17+
_field: C::BarType, //~ ERROR the trait bound `C: Bar<5>` is not satisfied
18+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
error[E0277]: the trait bound `C: Bar<5>` is not satisfied
2+
--> $DIR/projections-in-super-trait-bound-unsatisfied.rs:16:1
3+
|
4+
LL | pub struct Structure<C: Tec> {
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar<5>` is not implemented for `C`
6+
|
7+
help: consider further restricting this bound
8+
|
9+
LL | pub struct Structure<C: Tec + Bar<5>> {
10+
| ++++++++
11+
12+
error[E0277]: the trait bound `C: Bar<5>` is not satisfied
13+
--> $DIR/projections-in-super-trait-bound-unsatisfied.rs:17:13
14+
|
15+
LL | _field: C::BarType,
16+
| ^^^^^^^^^^ the trait `Bar<5>` is not implemented for `C`
17+
|
18+
help: consider further restricting this bound
19+
|
20+
LL | pub struct Structure<C: Tec + Bar<5>> {
21+
| ++++++++
22+
23+
error: aborting due to 2 previous errors
24+
25+
For more information about this error, try `rustc --explain E0277`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// We used to ICE here while trying to synthesize auto trait impls.
2+
// issue: 112828
3+
4+
struct Outer(Inner);
5+
struct Inner;
6+
7+
unsafe impl<Q: Trait> Send for Inner {}
8+
//~^ ERROR the type parameter `Q` is not constrained by the impl trait, self type, or predicates
9+
10+
trait Trait {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0207]: the type parameter `Q` is not constrained by the impl trait, self type, or predicates
2+
--> $DIR/unconstrained-param-in-impl-ambiguity.rs:7:13
3+
|
4+
LL | unsafe impl<Q: Trait> Send for Inner {}
5+
| ^ unconstrained type parameter
6+
7+
error: aborting due to 1 previous error
8+
9+
For more information about this error, try `rustc --explain E0207`.

0 commit comments

Comments
 (0)