Rollup merge of #116244 - estebank:issue-73497, r=b-naber

Apply structured suggestion that allows test to work since 1.64

Close #73497.
This commit is contained in:
Matthias Krüger 2023-11-14 21:50:37 +01:00 committed by GitHub
commit 00ba7fc007
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 2 deletions

View File

@ -10,7 +10,7 @@
const ENTRY_LIMIT: usize = 900; const ENTRY_LIMIT: usize = 900;
// FIXME: The following limits should be reduced eventually. // FIXME: The following limits should be reduced eventually.
const ISSUES_ENTRY_LIMIT: usize = 1854; const ISSUES_ENTRY_LIMIT: usize = 1852;
const ROOT_ENTRY_LIMIT: usize = 867; const ROOT_ENTRY_LIMIT: usize = 867;
const EXPECTED_TEST_FILE_EXTENSIONS: &[&str] = &[ const EXPECTED_TEST_FILE_EXTENSIONS: &[&str] = &[

View File

@ -0,0 +1,11 @@
// run-rustfix
use std::any::Any;
fn foo<T: Any>(value: &T) -> Box<dyn Any + '_> {
Box::new(value) as Box<dyn Any>
//~^ ERROR lifetime may not live long enough
}
fn main() {
let _ = foo(&5);
}

View File

@ -1,3 +1,4 @@
// run-rustfix
use std::any::Any; use std::any::Any;
fn foo<T: Any>(value: &T) -> Box<dyn Any> { fn foo<T: Any>(value: &T) -> Box<dyn Any> {

View File

@ -1,5 +1,5 @@
error: lifetime may not live long enough error: lifetime may not live long enough
--> $DIR/issue-16922.rs:4:5 --> $DIR/suggest-using-tick-underscore-lifetime-in-return-trait-object.rs:5:5
| |
LL | fn foo<T: Any>(value: &T) -> Box<dyn Any> { LL | fn foo<T: Any>(value: &T) -> Box<dyn Any> {
| - let's call the lifetime of this reference `'1` | - let's call the lifetime of this reference `'1`