Skip to content

Commit 6eb6010

Browse files
committed
Add test for issue 127911 and 128839
1 parent 419897c commit 6eb6010

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//@ check-pass
2+
3+
#![deny(dead_code)]
4+
5+
struct T<X>(X);
6+
7+
type A<X> = T<X>;
8+
9+
trait Tr {
10+
fn foo();
11+
}
12+
13+
impl<X> Tr for T<A<X>> {
14+
fn foo() {}
15+
}
16+
17+
fn main() {
18+
T::<T<()>>::foo();
19+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
//@ check-pass
2+
3+
#![deny(dead_code)]
4+
5+
trait UInt: Copy + From<u8> {}
6+
7+
impl UInt for u16 {}
8+
9+
trait Int: Copy {
10+
type Unsigned: UInt;
11+
12+
fn as_unsigned(self) -> Self::Unsigned;
13+
}
14+
15+
impl Int for i16 {
16+
type Unsigned = u16;
17+
18+
fn as_unsigned(self) -> u16 {
19+
self as _
20+
}
21+
}
22+
23+
fn priv_func<T: Int>(x: u8, y: T) -> (T::Unsigned, T::Unsigned) {
24+
(T::Unsigned::from(x), y.as_unsigned())
25+
}
26+
27+
pub fn pub_func(x: u8, y: i16) -> (u16, u16) {
28+
priv_func(x, y)
29+
}
30+
31+
fn main() {}

0 commit comments

Comments
 (0)