Rollup merge of #136891 - compiler-errors:unconstrained-anon-lt, r=lqd
Check sig for errors before checking for unconstrained anonymous lifetime Fixes #136841
This commit is contained in:
commit
77a1d6b266
3 changed files with 40 additions and 20 deletions
|
@ -2561,6 +2561,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
|
|||
// reject function types that violate cmse ABI requirements
|
||||
cmse::validate_cmse_abi(self.tcx(), self.dcx(), hir_id, abi, bare_fn_ty);
|
||||
|
||||
if !bare_fn_ty.references_error() {
|
||||
// Find any late-bound regions declared in return type that do
|
||||
// not appear in the arguments. These are not well-formed.
|
||||
//
|
||||
|
@ -2582,6 +2583,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
|
|||
br_name
|
||||
)
|
||||
});
|
||||
}
|
||||
|
||||
bare_fn_ty
|
||||
}
|
||||
|
|
9
tests/ui/async-await/unconstrained-lifetimes.rs
Normal file
9
tests/ui/async-await/unconstrained-lifetimes.rs
Normal file
|
@ -0,0 +1,9 @@
|
|||
//@ edition: 2021
|
||||
|
||||
// Make sure we don't complain about the implicit `-> impl Future` capturing an
|
||||
// unconstrained anonymous lifetime.
|
||||
|
||||
async fn foo(_: Missing<'_>) {}
|
||||
//~^ ERROR cannot find type `Missing` in this scope
|
||||
|
||||
fn main() {}
|
9
tests/ui/async-await/unconstrained-lifetimes.stderr
Normal file
9
tests/ui/async-await/unconstrained-lifetimes.stderr
Normal file
|
@ -0,0 +1,9 @@
|
|||
error[E0412]: cannot find type `Missing` in this scope
|
||||
--> $DIR/unconstrained-lifetimes.rs:6:17
|
||||
|
|
||||
LL | async fn foo(_: Missing<'_>) {}
|
||||
| ^^^^^^^ not found in this scope
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0412`.
|
Loading…
Add table
Add a link
Reference in a new issue