rust/tests/ui/const-generics/defaults/trait_object_lt_defaults.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

25 lines
653 B
Rust
Raw Normal View History

2021-12-13 13:47:10 -06:00
// aux-build:trait_object_lt_defaults_lib.rs
// run-pass
#![allow(dead_code)]
extern crate trait_object_lt_defaults_lib;
// Tests that `A<'a, 3, dyn Test>` is short for `A<'a, 3, dyn Test + 'a>`
// and `Foo<'a, 3, dyn Test>` is short for `Foo<'a, 3, dyn Test + 'a>`
// Test is in `const-generics/defaults` because it relies on param ordering
trait Test {}
struct A<'a, const N: usize, T: ?Sized + 'a>(&'a T, [(); N]);
fn blah<'a>(mut a: A<'a, 3, dyn Test>, arg: &'a (dyn Test + 'a)) {
a.0 = arg;
}
fn other_blah<'a>(
mut a: trait_object_lt_defaults_lib::Foo<'a, 3, dyn Test>,
arg: &'a (dyn Test + 'a),
) {
a.0 = arg;
}
fn main() {}