mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-15 21:47:04 +00:00
add another test
This commit is contained in:
parent
46ecb23198
commit
b52dea8230
@ -33,5 +33,10 @@ fn change_assoc_1<'a, 'b>(
|
||||
//~| error: lifetime may not live long enough
|
||||
}
|
||||
|
||||
// This tests the default borrow check error, without the special casing for return values.
|
||||
fn require_static(_: *const dyn Trait<'static>) {}
|
||||
fn extend_to_static<'a>(ptr: *const dyn Trait<'a>) {
|
||||
require_static(ptr as _) //~ error: lifetime may not live long enough
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
@ -132,5 +132,13 @@ help: `'b` and `'a` must be the same: replace one with the other
|
||||
|
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error: aborting due to 8 previous errors
|
||||
error: lifetime may not live long enough
|
||||
--> $DIR/ptr-to-trait-obj-different-regions-misc.rs:39:20
|
||||
|
|
||||
LL | fn extend_to_static<'a>(ptr: *const dyn Trait<'a>) {
|
||||
| -- lifetime `'a` defined here
|
||||
LL | require_static(ptr as _)
|
||||
| ^^^ cast requires that `'a` must outlive `'static`
|
||||
|
||||
error: aborting due to 9 previous errors
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user