diff options
| author | Jonas Schievink <jonasschievink@gmail.com> | 2021-02-02 12:14:56 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-02-02 12:14:56 +0100 |
| commit | a61e6ab0da332831ff744cdb6062aa3e592dcdc8 (patch) | |
| tree | 2647deaee308a59072f95132d29358e8495c03ad | |
| parent | e6e76c7669fd8c2f53a5c51818c1291d7f68b768 (diff) | |
| parent | fe1fc36f8ed2ab7527536c85f385b717b695a53d (diff) | |
| download | rust-a61e6ab0da332831ff744cdb6062aa3e592dcdc8.tar.gz rust-a61e6ab0da332831ff744cdb6062aa3e592dcdc8.zip | |
Rollup merge of #81485 - jackh726:atb-issues, r=Mark-Simulacrum
Add some tests for associated-type-bounds issues Closes #38917 Closes #40093 Closes #43475 Closes #63591 #47897 is likely closable too, but it needs an MCVE ~~#38917, #40093, #43475, #47897 all are mislabeled and shouldn't have the `F-associated-type-bounds` label~~ ~~#71685 is also mislabeled as commented on in that thread~~
| -rw-r--r-- | src/test/ui/associated-types/issue-38917.rs | 25 | ||||
| -rw-r--r-- | src/test/ui/associated-types/issue-40093.rs | 14 | ||||
| -rw-r--r-- | src/test/ui/associated-types/issue-43475.rs | 10 | ||||
| -rw-r--r-- | src/test/ui/associated-types/issue-63591.rs | 24 |
4 files changed, 73 insertions, 0 deletions
diff --git a/src/test/ui/associated-types/issue-38917.rs b/src/test/ui/associated-types/issue-38917.rs new file mode 100644 index 00000000000..7e898851aa8 --- /dev/null +++ b/src/test/ui/associated-types/issue-38917.rs @@ -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() {} diff --git a/src/test/ui/associated-types/issue-40093.rs b/src/test/ui/associated-types/issue-40093.rs new file mode 100644 index 00000000000..fd325ae1008 --- /dev/null +++ b/src/test/ui/associated-types/issue-40093.rs @@ -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() {} diff --git a/src/test/ui/associated-types/issue-43475.rs b/src/test/ui/associated-types/issue-43475.rs new file mode 100644 index 00000000000..5f177333c93 --- /dev/null +++ b/src/test/ui/associated-types/issue-43475.rs @@ -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() { } diff --git a/src/test/ui/associated-types/issue-63591.rs b/src/test/ui/associated-types/issue-63591.rs new file mode 100644 index 00000000000..4d2e39f4da6 --- /dev/null +++ b/src/test/ui/associated-types/issue-63591.rs @@ -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 + } +} |
