Rollup merge of #73783 - estebank:impl-dyn-trait-static-lifetime, r=nikomatsakis
Detect when `'static` obligation might come from an `impl` Partly address #71341.
This commit is contained in:
commit
fe9babbaed
60 changed files with 1308 additions and 446 deletions
|
|
@ -1,8 +1,7 @@
|
|||
use std::any::Any;
|
||||
|
||||
fn foo<T: Any>(value: &T) -> Box<dyn Any> {
|
||||
Box::new(value) as Box<dyn Any>
|
||||
//~^ ERROR cannot infer an appropriate lifetime
|
||||
Box::new(value) as Box<dyn Any> //~ ERROR E0759
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
error[E0759]: cannot infer an appropriate lifetime
|
||||
error[E0759]: `value` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement
|
||||
--> $DIR/issue-16922.rs:4:14
|
||||
|
|
||||
LL | fn foo<T: Any>(value: &T) -> Box<dyn Any> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue