mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-31 06:22:00 +00:00
Broken tests
This commit is contained in:
parent
25c342f30a
commit
4560b61cd1
14
tests/ui/closures/self-supertrait-bounds.rs
Normal file
14
tests/ui/closures/self-supertrait-bounds.rs
Normal file
@ -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(|_| {}, |_| {});
|
||||
}
|
15
tests/ui/lint/unused/trait-alias-supertrait.rs
Normal file
15
tests/ui/lint/unused/trait-alias-supertrait.rs
Normal file
@ -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<()>>();
|
||||
}
|
10
tests/ui/traits/alias/dont-elaborate-non-self.rs
Normal file
10
tests/ui/traits/alias/dont-elaborate-non-self.rs
Normal file
@ -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
Block a user