Skip to content

Commit acd5b4b

Browse files
authored
Rollup merge of rust-lang#81485 - jackh726:atb-issues, r=Mark-Simulacrum
Add some tests for associated-type-bounds issues Closes rust-lang#38917 Closes rust-lang#40093 Closes rust-lang#43475 Closes rust-lang#63591 rust-lang#47897 is likely closable too, but it needs an MCVE ~~rust-lang#38917, rust-lang#40093, rust-lang#43475, rust-lang#47897 all are mislabeled and shouldn't have the `F-associated-type-bounds` label~~ ~~rust-lang#71685 is also mislabeled as commented on in that thread~~
2 parents 9860b31 + fe1fc36 commit acd5b4b

File tree

4 files changed

+73
-0
lines changed

4 files changed

+73
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// check-pass
2+
3+
use std::borrow::Borrow;
4+
5+
trait TNode: Sized {
6+
type ConcreteElement: TElement<ConcreteNode = Self>;
7+
}
8+
9+
trait TElement: Sized {
10+
type ConcreteNode: TNode<ConcreteElement = Self>;
11+
}
12+
13+
trait DomTraversal<N: TNode> {
14+
type BorrowElement: Borrow<N::ConcreteElement>;
15+
}
16+
17+
#[allow(dead_code)]
18+
fn recalc_style_at<E, D>()
19+
where
20+
E: TElement,
21+
D: DomTraversal<E::ConcreteNode>,
22+
{
23+
}
24+
25+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// check-pass
2+
3+
pub trait Test {
4+
type Item;
5+
type Bundle: From<Self::Item>;
6+
}
7+
8+
fn fails<T>()
9+
where
10+
T: Test<Item = String>,
11+
{
12+
}
13+
14+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// check-pass
2+
3+
trait Foo { type FooT: Foo; }
4+
impl Foo for () { type FooT = (); }
5+
trait Bar<T: Foo> { type BarT: Bar<T::FooT>; }
6+
impl Bar<()> for () { type BarT = (); }
7+
8+
#[allow(dead_code)]
9+
fn test<C: Bar<()>>() { }
10+
fn main() { }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// check-pass
2+
3+
#![feature(associated_type_bounds)]
4+
#![feature(type_alias_impl_trait)]
5+
6+
fn main() {}
7+
8+
trait Bar { type Assoc; }
9+
10+
trait Thing {
11+
type Out;
12+
fn func() -> Self::Out;
13+
}
14+
15+
struct AssocIsCopy;
16+
impl Bar for AssocIsCopy { type Assoc = u8; }
17+
18+
impl Thing for AssocIsCopy {
19+
type Out = impl Bar<Assoc: Copy>;
20+
21+
fn func() -> Self::Out {
22+
AssocIsCopy
23+
}
24+
}

0 commit comments

Comments
 (0)