]>
git.proxmox.com Git - rustc.git/blob - src/test/ui/regions/regions-close-over-type-parameter-1.rs
1 // Test for what happens when a type parameter `A` is closed over into
2 // an object. This should yield errors unless `A` (and the object)
3 // both have suitable bounds.
6 // ignore-compare-mode-nll
7 //[nll] compile-flags: -Z borrowck=mir
10 fn get(&self) -> isize;
14 fn make_object1
<A
: SomeTrait
>(v
: A
) -> Box
<dyn SomeTrait
+ '
static> {
15 Box
::new(v
) as Box
<dyn SomeTrait
+ '
static>
16 //~^ ERROR the parameter type `A` may not live long enough
19 fn make_object2
<'a
, A
: SomeTrait
+ 'a
>(v
: A
) -> Box
<dyn SomeTrait
+ 'a
> {
20 Box
::new(v
) as Box
<dyn SomeTrait
+ 'a
>
23 fn make_object3
<'a
, 'b
, A
: SomeTrait
+ 'a
>(v
: A
) -> Box
<dyn SomeTrait
+ 'b
> {
24 Box
::new(v
) as Box
<dyn SomeTrait
+ 'b
>
25 //~^ ERROR the parameter type `A` may not live long enough