Rollup merge of #63474 - adamAndMath:master, r=Centril
Add tests for issue #53598 and #57700 Closes #53598 and #57700
This commit is contained in:
commit
7bdff66d35
4 changed files with 74 additions and 0 deletions
28
src/test/ui/type-alias-impl-trait/issue-53598.rs
Normal file
28
src/test/ui/type-alias-impl-trait/issue-53598.rs
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
// ignore-tidy-linelength
|
||||||
|
#![feature(type_alias_impl_trait)]
|
||||||
|
|
||||||
|
use std::fmt::Debug;
|
||||||
|
|
||||||
|
pub trait Foo {
|
||||||
|
type Item: Debug;
|
||||||
|
|
||||||
|
fn foo<T: Debug>(_: T) -> Self::Item;
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub struct S<T>(std::marker::PhantomData<T>);
|
||||||
|
|
||||||
|
pub struct S2;
|
||||||
|
|
||||||
|
impl Foo for S2 {
|
||||||
|
type Item = impl Debug;
|
||||||
|
|
||||||
|
fn foo<T: Debug>(_: T) -> Self::Item {
|
||||||
|
//~^ Error type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias
|
||||||
|
S::<T>(Default::default())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
S2::foo(123);
|
||||||
|
}
|
12
src/test/ui/type-alias-impl-trait/issue-53598.stderr
Normal file
12
src/test/ui/type-alias-impl-trait/issue-53598.stderr
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
error: type parameter `T` is part of concrete type but not used in parameter list for the `impl Trait` type alias
|
||||||
|
--> $DIR/issue-53598.rs:20:42
|
||||||
|
|
|
||||||
|
LL | fn foo<T: Debug>(_: T) -> Self::Item {
|
||||||
|
| __________________________________________^
|
||||||
|
LL | |
|
||||||
|
LL | | S::<T>(Default::default())
|
||||||
|
LL | | }
|
||||||
|
| |_____^
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
22
src/test/ui/type-alias-impl-trait/issue-57700.rs
Normal file
22
src/test/ui/type-alias-impl-trait/issue-57700.rs
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
// ignore-tidy-linelength
|
||||||
|
#![feature(arbitrary_self_types)]
|
||||||
|
#![feature(type_alias_impl_trait)]
|
||||||
|
|
||||||
|
use std::ops::Deref;
|
||||||
|
|
||||||
|
trait Foo {
|
||||||
|
type Bar: Foo;
|
||||||
|
|
||||||
|
fn foo(self: impl Deref<Target = Self>) -> Self::Bar;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<C> Foo for C {
|
||||||
|
type Bar = impl Foo;
|
||||||
|
|
||||||
|
fn foo(self: impl Deref<Target = Self>) -> Self::Bar {
|
||||||
|
//~^ Error type parameter `impl Deref<Target = Self>` is part of concrete type but not used in parameter list for the `impl Trait` type alias
|
||||||
|
self
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
12
src/test/ui/type-alias-impl-trait/issue-57700.stderr
Normal file
12
src/test/ui/type-alias-impl-trait/issue-57700.stderr
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
error: type parameter `impl Deref<Target = Self>` is part of concrete type but not used in parameter list for the `impl Trait` type alias
|
||||||
|
--> $DIR/issue-57700.rs:16:58
|
||||||
|
|
|
||||||
|
LL | fn foo(self: impl Deref<Target = Self>) -> Self::Bar {
|
||||||
|
| __________________________________________________________^
|
||||||
|
LL | |
|
||||||
|
LL | | self
|
||||||
|
LL | | }
|
||||||
|
| |_____^
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
Loading…
Reference in a new issue