forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#116279 - cuviper:beta-next, r=cuviper
[beta] backports - Only prevent field projections into opaque types, not types containing opaque types rust-lang#116156 - Update LLVM submodule rust-lang#116227 r? cuviper
- Loading branch information
Showing
4 changed files
with
38 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule llvm-project
updated
29 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// edition: 2021 | ||
|
||
use std::future::Future; | ||
|
||
async fn bop() { | ||
fold(run(), |mut foo| async move { | ||
&mut foo.bar; | ||
}) | ||
} | ||
|
||
fn fold<Fut, F, U>(_: Foo<U>, f: F) | ||
where | ||
F: FnMut(Foo<U>) -> Fut, | ||
{ | ||
loop {} | ||
} | ||
|
||
struct Foo<F> { | ||
bar: Vec<F>, | ||
} | ||
|
||
fn run() -> Foo<impl Future<Output = ()>> { | ||
//~^ ERROR type annotations needed | ||
loop {} | ||
} | ||
|
||
fn main() {} |
9 changes: 9 additions & 0 deletions
9
tests/ui/impl-trait/opaque-cast-field-access-in-future.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
error[E0282]: type annotations needed | ||
--> $DIR/opaque-cast-field-access-in-future.rs:22:17 | ||
| | ||
LL | fn run() -> Foo<impl Future<Output = ()>> { | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0282`. |