mirror of https://github.com/rust-lang/rust.git
Broken tests
This commit is contained in:
parent
25c342f30a
commit
4560b61cd1
|
@ -0,0 +1,14 @@
|
|||
// check-pass
|
||||
|
||||
// Makes sure that we only consider `Self` supertrait predicates while
|
||||
// elaborating during closure signature deduction.
|
||||
|
||||
#![feature(trait_alias)]
|
||||
|
||||
trait Confusing<F> = Fn(i32) where F: Fn(u32);
|
||||
|
||||
fn alias<T: Confusing<F>, F>(_: T, _: F) {}
|
||||
|
||||
fn main() {
|
||||
alias(|_| {}, |_| {});
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
// check-pass
|
||||
|
||||
// Make sure that we only consider *Self* supertrait predicates
|
||||
// in the `unused_must_use` lint.
|
||||
|
||||
#![feature(trait_alias)]
|
||||
#![deny(unused_must_use)]
|
||||
|
||||
trait Foo<T> = Sized where T: Iterator;
|
||||
|
||||
fn test<T: Iterator>() -> impl Foo<T> {}
|
||||
|
||||
fn main() {
|
||||
test::<std::iter::Once<()>>();
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
#![feature(trait_alias)]
|
||||
|
||||
use std::future::Future;
|
||||
|
||||
trait F<Fut: Future<Output = usize>> = Fn() -> Fut;
|
||||
|
||||
fn f<Fut>(a: dyn F<Fut>) {}
|
||||
//~^ ERROR the size for values of type `(dyn Fn() -> Fut + 'static)` cannot be known at compilation time
|
||||
|
||||
fn main() {}
|
|
@ -0,0 +1,33 @@
|
|||
#![feature(trait_upcasting)]
|
||||
#![feature(trait_alias)]
|
||||
|
||||
// Although we *elaborate* `T: Alias` to `i32: B`, we should
|
||||
// not consider `B` to be a supertrait of the type.
|
||||
trait Alias = A where i32: B;
|
||||
|
||||
trait A {}
|
||||
|
||||
trait B {
|
||||
fn test(&self);
|
||||
}
|
||||
|
||||
trait C: Alias {}
|
||||
|
||||
impl A for () {}
|
||||
|
||||
impl C for () {}
|
||||
|
||||
impl B for i32 {
|
||||
fn test(&self) {
|
||||
println!("hi {self}");
|
||||
}
|
||||
}
|
||||
|
||||
fn test(x: &dyn C) -> &dyn B {
|
||||
x
|
||||
//~^ ERROR mismatched types
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let x: &dyn C = &();
|
||||
}
|
Loading…
Reference in New Issue