mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-24 15:54:15 +00:00
edafbaffb2
- Either explicitly annotate `let x: () = expr;` where `x` has unit type, or remove the unit binding to leave only `expr;` instead. - Fix disjoint-capture-in-same-closure test
35 lines
562 B
Rust
35 lines
562 B
Rust
// build-pass
|
|
|
|
trait Trait { type Item; }
|
|
|
|
impl<'a, X> Trait for &'a Vec<X> {
|
|
type Item = &'a X;
|
|
}
|
|
|
|
impl<X> Trait for Box<dyn Trait<Item = X>> {
|
|
type Item = X;
|
|
}
|
|
|
|
fn make_dyn_trait(_: &()) -> Box<dyn Trait<Item = &()>> {
|
|
todo!()
|
|
}
|
|
|
|
fn diff<'a, M, N, S>(_: N, _: S)
|
|
where
|
|
M: 'a,
|
|
N: Trait<Item = &'a M>,
|
|
S: Trait<Item = &'a M>,
|
|
{
|
|
todo!()
|
|
}
|
|
|
|
fn may_panic<X>(_: X) { }
|
|
|
|
fn main() {
|
|
let dyn_trait = make_dyn_trait(&());
|
|
let storage = vec![()];
|
|
may_panic(());
|
|
let storage_ref = &storage;
|
|
diff(dyn_trait, storage_ref);
|
|
}
|