Skip to content

Commit 4560b61

Browse files
Broken tests
1 parent 25c342f commit 4560b61

File tree

4 files changed

+72
-0
lines changed

4 files changed

+72
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// check-pass
2+
3+
// Makes sure that we only consider `Self` supertrait predicates while
4+
// elaborating during closure signature deduction.
5+
6+
#![feature(trait_alias)]
7+
8+
trait Confusing<F> = Fn(i32) where F: Fn(u32);
9+
10+
fn alias<T: Confusing<F>, F>(_: T, _: F) {}
11+
12+
fn main() {
13+
alias(|_| {}, |_| {});
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// check-pass
2+
3+
// Make sure that we only consider *Self* supertrait predicates
4+
// in the `unused_must_use` lint.
5+
6+
#![feature(trait_alias)]
7+
#![deny(unused_must_use)]
8+
9+
trait Foo<T> = Sized where T: Iterator;
10+
11+
fn test<T: Iterator>() -> impl Foo<T> {}
12+
13+
fn main() {
14+
test::<std::iter::Once<()>>();
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#![feature(trait_alias)]
2+
3+
use std::future::Future;
4+
5+
trait F<Fut: Future<Output = usize>> = Fn() -> Fut;
6+
7+
fn f<Fut>(a: dyn F<Fut>) {}
8+
//~^ ERROR the size for values of type `(dyn Fn() -> Fut + 'static)` cannot be known at compilation time
9+
10+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#![feature(trait_upcasting)]
2+
#![feature(trait_alias)]
3+
4+
// Although we *elaborate* `T: Alias` to `i32: B`, we should
5+
// not consider `B` to be a supertrait of the type.
6+
trait Alias = A where i32: B;
7+
8+
trait A {}
9+
10+
trait B {
11+
fn test(&self);
12+
}
13+
14+
trait C: Alias {}
15+
16+
impl A for () {}
17+
18+
impl C for () {}
19+
20+
impl B for i32 {
21+
fn test(&self) {
22+
println!("hi {self}");
23+
}
24+
}
25+
26+
fn test(x: &dyn C) -> &dyn B {
27+
x
28+
//~^ ERROR mismatched types
29+
}
30+
31+
fn main() {
32+
let x: &dyn C = &();
33+
}

0 commit comments

Comments
 (0)