about summary refs log tree commit diff
path: root/tests/ui/coroutine
AgeCommit message (Collapse)AuthorLines
2025-01-03turn rustc_box into an intrinsicRalf Jung-11/+10
2024-12-31chore: fix some typospeicuiping-1/+1
Signed-off-by: peicuiping <ezc5@sina.cn>
2024-12-27Remove the `-test` suffix from normalize directivesZalathar-1/+1
2024-12-25Use PostBorrowckAnalysis in check_coroutine_obligationsMichael Goulet-0/+2
2024-12-25Actually print all the relevant parts of a coroutine in verbose modeMichael Goulet-3/+3
2024-12-21coroutine_clone: add commentsRalf Jung-8/+10
2024-12-14Rollup merge of #134181 - estebank:trim-render, r=oli-obkMatthias Krüger-21/+1
Tweak multispan rendering to reduce output length Consider comments and bare delimiters the same as an "empty line" for purposes of hiding rendered code output of long multispans. This results in more aggressive shortening of rendered output without losing too much context, specially in `*.stderr` tests that have "hidden" comments. We do that check not only on the first 4 lines of the multispan, but now also on the previous to last line as well.
2024-12-13Stabilize async closuresMichael Goulet-8/+7
2024-12-12Filter empty lines, comments and delimiters from previous to last multiline ↵Esteban Küber-4/+1
span rendering
2024-12-12Tweak multispan renderingEsteban Küber-17/+0
Consider comments and bare delimiters the same as an "empty line" for purposes of hiding rendered code output of long multispans. This results in more aggressive shortening of rendered output without losing too much context, specially in `*.stderr` tests that have "hidden" comments.
2024-12-06Remove polymorphizationBen Kimock-18/+0
2024-12-05Stabilize noop_wakerEric Holk-2/+1
Co-authored-by: zachs18 <8355914+zachs18@users.noreply.github.com>
2024-12-03Don't try and handle unfed `type_of` on anon constsBoxy-11/+1
2024-11-28Update more 2024 tests to remove -Zunstable-optionsEric Huss-2/+2
2024-11-22Stabilize the 2024 editionEric Huss-42/+37
2024-11-06Add --diagnostic-width to some tests failing after 1a0c5021838Hans Wennborg-45/+47
Otherwise the tests would fail depending on the execution environment.
2024-11-02fix testsEsteban Küber-9/+10
Paths in CI can be longer than in devs' machines.
2024-11-02On long E0277 primary span label, move it to a `help`Esteban Küber-45/+47
Long span labels don't read well.
2024-11-02Point at tail expression on rpit E0277Esteban Küber-5/+27
``` error[E0277]: the trait bound `{gen block@$DIR/gen_block_is_coro.rs:7:5: 7:8}: Coroutine` is not satisfied --> $DIR/gen_block_is_coro.rs:6:13 | LL | fn foo() -> impl Coroutine<Yield = u32, Return = ()> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Coroutine` is not implemented for `{gen block@$DIR/gen_block_is_coro.rs:7:5: 7:8}` LL | gen { yield 42 } | ---------------- return type was inferred to be `{gen block@$DIR/gen_block_is_coro.rs:7:5: 7:8}` here ``` The secondary span label is new.
2024-10-29Rollup merge of #132157 - estebank:long-types-3, r=jieyouxuMatthias Krüger-26/+26
Remove detail from label/note that is already available in other note Remove the "which is required by `{root_obligation}`" post-script in "the trait `X` is not implemented for `Y`" explanation in E0277. This information is already conveyed in the notes explaining requirements, making it redundant while making the text (particularly in labels) harder to read. ``` error[E0277]: the trait bound `NotCopy: Copy` is not satisfied --> $DIR/wf-static-type.rs:10:13 | LL | static FOO: IsCopy<Option<NotCopy>> = IsCopy { t: None }; | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `NotCopy` | = note: required for `Option<NotCopy>` to implement `Copy` note: required by a bound in `IsCopy` --> $DIR/wf-static-type.rs:7:17 | LL | struct IsCopy<T:Copy> { t: T } | ^^^^ required by this bound in `IsCopy` ``` vs the prior ``` error[E0277]: the trait bound `NotCopy: Copy` is not satisfied --> $DIR/wf-static-type.rs:10:13 | LL | static FOO: IsCopy<Option<NotCopy>> = IsCopy { t: None }; | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `NotCopy`, which is required by `Option<NotCopy>: Copy` | = note: required for `Option<NotCopy>` to implement `Copy` note: required by a bound in `IsCopy` --> $DIR/wf-static-type.rs:7:17 | LL | struct IsCopy<T:Copy> { t: T } | ^^^^ required by this bound in `IsCopy` ``` *Ignore first three commits from https://github.com/rust-lang/rust/pull/132086.*
2024-10-29Remove detail from label/note that is already available in other noteEsteban Küber-26/+26
Remove the "which is required by `{root_obligation}`" post-script in "the trait `X` is not implemented for `Y`" explanation in E0277. This information is already conveyed in the notes explaining requirements, making it redundant while making the text (particularly in labels) harder to read. ``` error[E0277]: the trait bound `NotCopy: Copy` is not satisfied --> $DIR/wf-static-type.rs:10:13 | LL | static FOO: IsCopy<Option<NotCopy>> = IsCopy { t: None }; | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `NotCopy` | = note: required for `Option<NotCopy>` to implement `Copy` note: required by a bound in `IsCopy` --> $DIR/wf-static-type.rs:7:17 | LL | struct IsCopy<T:Copy> { t: T } | ^^^^ required by this bound in `IsCopy` ``` vs the prior ``` error[E0277]: the trait bound `NotCopy: Copy` is not satisfied --> $DIR/wf-static-type.rs:10:13 | LL | static FOO: IsCopy<Option<NotCopy>> = IsCopy { t: None }; | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `NotCopy`, which is required by `Option<NotCopy>: Copy` | = note: required for `Option<NotCopy>` to implement `Copy` note: required by a bound in `IsCopy` --> $DIR/wf-static-type.rs:7:17 | LL | struct IsCopy<T:Copy> { t: T } | ^^^^ required by this bound in `IsCopy` ```
2024-10-25Ensure that resume arg outlives region bound for coroutinesMichael Goulet-0/+98
2024-10-20Rollup merge of #131814 - Borgerr:misapplied-optimize-attribute, r=jieyouxuMatthias Krüger-0/+40
`optimize` attribute applied to things other than methods/functions/c… …losures gives an error (#128488) Duplicate of #128943, which I had accidentally closed when rebasing. cc. `@jieyouxu` `@compiler-errors` `@nikomatsakis` `@traviscross` `@pnkfelix.`
2024-10-20misapplied optimize attribute throws a compilation error (#128488)ash-0/+40
2024-10-16Stop inverting expectation in normalization errorsMichael Goulet-3/+3
2024-09-25Fixed diagnostics for coroutines with () as input.Virginia Senioria-0/+26
2024-09-13Update tests for hidden references to mutable staticObei Sideg-0/+2
2024-09-11Properly deny const gen/async gen fnsMichael Goulet-0/+32
2024-09-08Auto merge of #129313 - RalfJung:coroutine-niches, r=compiler-errorsbors-3/+6
Supress niches in coroutines to avoid aliasing violations As mentioned [here](https://github.com/rust-lang/rust/issues/63818#issuecomment-2264915918), using niches in fields of coroutines that are referenced by other fields is unsound: the discriminant accesses violate the aliasing requirements of the reference pointing to the relevant field. This issue causes [Miri errors in practice](https://github.com/rust-lang/miri/issues/3780). The "obvious" fix for this is to suppress niches in coroutines. That's what this PR does. However, we have several tests explicitly ensuring that we *do* use niches in coroutines. So I see two options: - We guard this behavior behind a `-Z` flag (that Miri will set by default). There is no known case of these aliasing violations causing miscompilations. But absence of evidence is not evidence of absence... - (What this PR does right now.) We temporarily adjust the coroutine layout logic and the associated tests until the proper fix lands. The "proper fix" here is to wrap fields that other fields can point to in [`UnsafePinned`](https://github.com/rust-lang/rust/issues/125735) and make `UnsafePinned` suppress niches; that would then still permit using niches of *other* fields (those that never get borrowed). However, I know that coroutine sizes are already a problem, so I am not sure if this temporary size regression is acceptable. `@compiler-errors` any opinion? Also who else should be Cc'd here?
2024-08-31Create opaque definitions in resolver.Camille GILLOT-3/+3
2024-08-20bless ui testsRalf Jung-3/+6
2024-08-12Add must_use attribute to Coroutine traitHenry Sloan-2/+3
2024-08-10rustc_ast_lowering: make "yield syntax is experimental" translatablePavel Grigorenko-2/+0
2024-08-03Add test for `coroutine` attributeOli Scherer-0/+25
2024-07-21Explain that coroutine can be marked staticMichael Goulet-0/+56
And also point out the def span of the coroutine
2024-07-14Use ordinal number in argument errorlong-long-float-1/+1
Fix error message Fix tests Format
2024-07-11Always use a colon in `//@ normalize-*:` headersZalathar-1/+1
2024-06-27Tighten spans for async blocksMichael Goulet-59/+46
2024-06-19Rollup merge of #125078 - linyihai:issue-124496, r=compiler-errors许杰友 Jieyou Xu (Joe)-7/+8
fix: break inside async closure has incorrect span for enclosing closure Fixes #124496
2024-06-12Require any function with a tait in its signature to actually constrain a ↵Oli Scherer-28/+30
hidden type
2024-06-05fix: break inside async closure has incorrect span for enclosing closureLin Yihai-7/+8
2024-06-04Handle safety keyword for extern block inner itemsSantiago Pastorino-6/+6
2024-05-19add ui tests for E0373 suggestionJoshua Wong-0/+64
2024-05-07Update TestsVeera-0/+95
2024-04-24Modify `find_expr` from `Span` to better account for closuresEsteban Küber-0/+5
Start pointing to where bindings were declared when they are captured in closures: ``` error[E0597]: `x` does not live long enough --> $DIR/suggest-return-closure.rs:23:9 | LL | let x = String::new(); | - binding `x` declared here ... LL | |c| { | --- value captured here LL | x.push(c); | ^ borrowed value does not live long enough ... LL | } | -- borrow later used here | | | `x` dropped here while still borrowed ``` Suggest cloning in more cases involving closures: ``` error[E0507]: cannot move out of `foo` in pattern guard --> $DIR/issue-27282-move-ref-mut-into-guard.rs:11:19 | LL | if { (|| { let mut bar = foo; bar.take() })(); false } => {}, | ^^ --- move occurs because `foo` has type `&mut Option<&i32>`, which does not implement the `Copy` trait | | | `foo` is moved here | = note: variables bound in patterns cannot be moved from until after the end of the pattern guard help: consider cloning the value if the performance cost is acceptable | LL | if { (|| { let mut bar = foo.clone(); bar.take() })(); false } => {}, | ++++++++ ```
2024-04-24Error on using `yield` without also using `#[coroutine]` on the closureOli Scherer-496/+770
And suggest adding the `#[coroutine]` to the closure
2024-04-24Add explicit syntax for coroutines instead of relying on closures having ↵Oli Scherer-2/+2
`yield` expressions
2024-04-15crash -> testMichael Goulet-0/+27
2024-04-15Do check_coroutine_obligations once per typeck rootMichael Goulet-41/+55
2024-03-25Auto merge of #122721 - oli-obk:merge_queries, r=davidtwcobors-5/+0
Replace `mir_built` query with a hook and use mir_const everywhere instead A small perf improvement due to less dep graph handling. Mostly just a cleanup to get rid of one of our many mir queries