forked from rust-lang/rust
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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~~
- Loading branch information
Showing
4 changed files
with
73 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// check-pass | ||
|
||
use std::borrow::Borrow; | ||
|
||
trait TNode: Sized { | ||
type ConcreteElement: TElement<ConcreteNode = Self>; | ||
} | ||
|
||
trait TElement: Sized { | ||
type ConcreteNode: TNode<ConcreteElement = Self>; | ||
} | ||
|
||
trait DomTraversal<N: TNode> { | ||
type BorrowElement: Borrow<N::ConcreteElement>; | ||
} | ||
|
||
#[allow(dead_code)] | ||
fn recalc_style_at<E, D>() | ||
where | ||
E: TElement, | ||
D: DomTraversal<E::ConcreteNode>, | ||
{ | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// check-pass | ||
|
||
pub trait Test { | ||
type Item; | ||
type Bundle: From<Self::Item>; | ||
} | ||
|
||
fn fails<T>() | ||
where | ||
T: Test<Item = String>, | ||
{ | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// check-pass | ||
|
||
trait Foo { type FooT: Foo; } | ||
impl Foo for () { type FooT = (); } | ||
trait Bar<T: Foo> { type BarT: Bar<T::FooT>; } | ||
impl Bar<()> for () { type BarT = (); } | ||
|
||
#[allow(dead_code)] | ||
fn test<C: Bar<()>>() { } | ||
fn main() { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// check-pass | ||
|
||
#![feature(associated_type_bounds)] | ||
#![feature(type_alias_impl_trait)] | ||
|
||
fn main() {} | ||
|
||
trait Bar { type Assoc; } | ||
|
||
trait Thing { | ||
type Out; | ||
fn func() -> Self::Out; | ||
} | ||
|
||
struct AssocIsCopy; | ||
impl Bar for AssocIsCopy { type Assoc = u8; } | ||
|
||
impl Thing for AssocIsCopy { | ||
type Out = impl Bar<Assoc: Copy>; | ||
|
||
fn func() -> Self::Out { | ||
AssocIsCopy | ||
} | ||
} |