mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
Unconditional check FRU expression, even if there are errors present
This commit is contained in:
parent
d442c015d6
commit
1c81540206
@ -1646,6 +1646,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
// the fields with the base_expr. This could cause us to hit errors later
|
||||
// when certain fields are assumed to exist that in fact do not.
|
||||
if error_happened {
|
||||
if let Some(base_expr) = base_expr {
|
||||
self.check_expr(base_expr);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
10
src/test/ui/async-await/drop-track-bad-field-in-fru.rs
Normal file
10
src/test/ui/async-await/drop-track-bad-field-in-fru.rs
Normal file
@ -0,0 +1,10 @@
|
||||
// compile-flags: -Zdrop-tracking
|
||||
// edition: 2021
|
||||
|
||||
fn main() {}
|
||||
|
||||
async fn foo() {
|
||||
None { value: (), ..Default::default() }.await;
|
||||
//~^ ERROR `Option<_>` is not a future
|
||||
//~| ERROR variant `Option<_>::None` has no field named `value`
|
||||
}
|
23
src/test/ui/async-await/drop-track-bad-field-in-fru.stderr
Normal file
23
src/test/ui/async-await/drop-track-bad-field-in-fru.stderr
Normal file
@ -0,0 +1,23 @@
|
||||
error[E0559]: variant `Option<_>::None` has no field named `value`
|
||||
--> $DIR/drop-track-bad-field-in-fru.rs:7:12
|
||||
|
|
||||
LL | None { value: (), ..Default::default() }.await;
|
||||
| ^^^^^ `Option<_>::None` does not have this field
|
||||
|
||||
error[E0277]: `Option<_>` is not a future
|
||||
--> $DIR/drop-track-bad-field-in-fru.rs:7:45
|
||||
|
|
||||
LL | None { value: (), ..Default::default() }.await;
|
||||
| ^^^^^^
|
||||
| |
|
||||
| `Option<_>` is not a future
|
||||
| help: remove the `.await`
|
||||
|
|
||||
= help: the trait `Future` is not implemented for `Option<_>`
|
||||
= note: Option<_> must be a future or must implement `IntoFuture` to be awaited
|
||||
= note: required for `Option<_>` to implement `IntoFuture`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0277, E0559.
|
||||
For more information about an error, try `rustc --explain E0277`.
|
Loading…
Reference in New Issue
Block a user