Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[WIP] Check coroutine upvars and resume ty in dtorck constraint, this time based off ofTypingMode#144158

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
compiler-errors wants to merge2 commits intorust-lang:master
base:master
Choose a base branch
Loading
fromcompiler-errors:dtorck-better

Conversation

compiler-errors
Copy link
Member

@compiler-errorscompiler-errors commentedJul 18, 2025
edited by rustbot
Loading

cc#144156, see the paragraph about a better approach.

This is broken until we start usingTypingMode::Borrowck unconditionally. This also has some perf implications, since there were a few places we were collapsingTypingMode::Borrowck { defining_opaque_types: [] } into a non-body analysis typing mode.

@rustbotrustbot added S-waiting-on-authorStatus: This is awaiting some action (such as code changes or more information) from the author. T-compilerRelevant to the compiler team, which will review and decide on the PR/issue. labelsJul 18, 2025
@rust-log-analyzer
Copy link
Collaborator

The jobaarch64-gnu-llvm-19-1 failed! Check out the build log:(web)(plain enhanced)(plain)

Click to see the possible cause of the failure (guessed by this bot)
1 error[E0597]: `a` does not live long enough2   --> $DIR/borrowing.rs:9:463    |- LL |     let _b = {-    |         -- borrow later stored here6 LL |         let a = 3;7    |             - binding `a` declared here8 LL |         Pin::new(&mut #[coroutine] || yield &a).resume(())-    |                                    --        ^ borrowed value does not live long enough-    |                                    |+    |                                    ----------^+    |                                    |         |---+    |     |+    |     `a` dropped here while still borrowed+    |+    = note: the temporary is part of an expression at the end of a block;+            consider forcing this temporary to be dropped sooner, before the block's local variables are dropped+ help: for example, you could save the expression's value in a new local variable `x` and then make `x` be the expression at the end of the block+    |+ LL |         let x = Pin::new(&mut #[coroutine] || yield &a).resume(()); x+    |         +++++++                                                   +++15 16 error[E0597]: `a` does not live long enough17   --> $DIR/borrowing.rs:16:20The actual stderr differed from the expected stderrTo update references, rerun the tests and pass the `--bless` flagTo only update this specific test, also pass `--test-args coroutine/borrowing.rs`error: 1 errors occurred comparing output.status: exit status: 1command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/coroutine/borrowing.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/coroutine/borrowing" "-A" "unused" "-A" "internal_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers"stdout: none--- stderr -------------------------------error[E0597]: `a` does not live long enough##[error]  --> /checkout/tests/ui/coroutine/borrowing.rs:9:46   |LL |         let a = 3;   |             - binding `a` declared hereLL |         Pin::new(&mut #[coroutine] || yield &a).resume(())   |                                    ----------^   |                                    |         |   |                                    |         borrowed value does not live long enough   |                                    value captured here by coroutine   |                                    a temporary with access to the borrow is created here ...LL |         //~^ ERROR: `a` does not live long enoughLL |     };   |     -- ... and the borrow might be used here, when that temporary is dropped and runs the destructor for coroutine   |     |   |     `a` dropped here while still borrowed   |   = note: the temporary is part of an expression at the end of a block;           consider forcing this temporary to be dropped sooner, before the block's local variables are droppedhelp: for example, you could save the expression's value in a new local variable `x` and then make `x` be the expression at the end of the block   |LL |         let x = Pin::new(&mut #[coroutine] || yield &a).resume(()); x   |         +++++++                                                   +++error[E0597]: `a` does not live long enough##[error]  --> /checkout/tests/ui/coroutine/borrowing.rs:16:20   |LL |     let _b = {   |         -- borrow later stored hereLL |         let a = 3;   |             - binding `a` declared hereLL |         #[coroutine] || {   |                      -- value captured here by coroutineLL |             yield &a   |                    ^ borrowed value does not live long enough...LL |     };   |     - `a` dropped here while still borrowederror: aborting due to 2 previous errors------- [ui] tests/ui/coroutine/check-resume-ty-lifetimes.rs stdout ----Saved the actual stderr to `/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/coroutine/check-resume-ty-lifetimes/check-resume-ty-lifetimes.stderr`diff of stderr:7 LL |             let x: &'static str = yield ();8    |                    ^^^^^^^^^^^^ type annotation requires that `'1` must outlive `'static`9 - error: aborting due to 1 previous error+ error[E0503]: cannot use `storage` because it was mutably borrowed+   --> $DIR/check-resume-ty-lifetimes.rs:24:5+    |+ LL |         |_: &str| {+    |         --------- `storage` is borrowed here+ ...+ LL |             storage = Some(x);+    |             ------- borrow occurs due to use of `storage` in coroutine+ ...+ LL |     storage.unwrap()----   --> /checkout/tests/ui/coroutine/check-resume-ty-lifetimes.rs:24:5+ error[E0503]: cannot use `storage` because it was mutably borrowed+   --> $DIR/check-resume-ty-lifetimes.rs:24:5+    |+ LL |         |_: &str| {+    |         --------- `storage` is borrowed here+ ...+ LL |             storage = Some(x);+    |             ------- borrow occurs due to use of `storage` in coroutine+ ...+ LL |     storage.unwrap()---To only update this specific test, also pass `--test-args coroutine/check-resume-ty-lifetimes.rs`error: 1 errors occurred comparing output.status: exit status: 1command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/coroutine/check-resume-ty-lifetimes.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/coroutine/check-resume-ty-lifetimes" "-A" "unused" "-A" "internal_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers"stdout: none--- stderr -------------------------------error: lifetime may not live long enough##[error]  --> /checkout/tests/ui/coroutine/check-resume-ty-lifetimes.rs:15:20   |LL | fn mk_static(s: &str) -> &'static str {   |                 - let's call the lifetime of this reference `'1`...LL |             let x: &'static str = yield ();   |                    ^^^^^^^^^^^^ type annotation requires that `'1` must outlive `'static`error[E0503]: cannot use `storage` because it was mutably borrowed##[error]  --> /checkout/tests/ui/coroutine/check-resume-ty-lifetimes.rs:24:5   |LL |         |_: &str| {   |         --------- `storage` is borrowed here...LL |             storage = Some(x);   |             ------- borrow occurs due to use of `storage` in coroutine...LL |     storage.unwrap()------- [ui] tests/ui/coroutine/issue-110929-coroutine-conflict-error-ice.rs stdout ----error: test compilation failed although it shouldn't!status: exit status: 1command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/coroutine/issue-110929-coroutine-conflict-error-ice.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/coroutine/issue-110929-coroutine-conflict-error-ice" "-A" "unused" "-A" "internal_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers" "--edition=2021"stdout: none--- stderr -------------------------------error[E0499]: cannot borrow `*x` as mutable more than once at a time##[error]  --> /checkout/tests/ui/coroutine/issue-110929-coroutine-conflict-error-ice.rs:10:9   |LL |         || yield *&mut *x;   |         --             -- first borrow occurs due to use of `*x` in coroutine   |         |   |         first mutable borrow occurs hereLL |         || _ = &mut *x;   |         ^^          -- second borrow occurs due to use of `*x` in closure   |         |   |         second mutable borrow occurs hereLL |     };   |     - first borrow might be used here, when `_c` is dropped and runs the destructor for coroutineerror: aborting due to 1 previous errorFor more information about this error, try `rustc --explain E0499`.---------------------------------------------11 error: aborting due to 1 previous error12 Note: some mismatched output was normalized before being compared- LL |     //~^ ERROR cannot borrow `thing` as mutable more than once at a time+    |                         ^^^^^^^^^^ second mutable borrow occurs here+ LL |+ LL | }+    | - first borrow might be used here, when `gen` is dropped and runs the destructor for coroutineThe actual stderr differed from the expected stderrTo update references, rerun the tests and pass the `--bless` flagTo only update this specific test, also pass `--test-args coroutine/retain-resume-ref.rs`error: 1 errors occurred comparing output.status: exit status: 1command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/coroutine/retain-resume-ref.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/coroutine/retain-resume-ref" "-A" "unused" "-A" "internal_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers"stdout: none--- stderr -------------------------------error[E0499]: cannot borrow `thing` as mutable more than once at a time##[error]  --> /checkout/tests/ui/coroutine/retain-resume-ref.rs:24:25   |LL |     gen.as_mut().resume(&mut thing);   |                         ---------- first mutable borrow occurs hereLL |     gen.as_mut().resume(&mut thing);   |                         ^^^^^^^^^^ second mutable borrow occurs hereLL |     //~^ ERROR cannot borrow `thing` as mutable more than once at a timeLL | }   | - first borrow might be used here, when `gen` is dropped and runs the destructor for coroutineerror: aborting due to 1 previous error------- [ui] tests/ui/dropck/coroutine-liveness-1.rs stdout ----error: test compilation failed although it shouldn't!status: exit status: 1command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/dropck/coroutine-liveness-1.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/dropck/coroutine-liveness-1" "-A" "unused" "-A" "internal_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers" "--edition=2021"stdout: none--- stderr -------------------------------error[E0505]: cannot move out of `recv` because it is borrowed##[error]  --> /checkout/tests/ui/dropck/coroutine-liveness-1.rs:13:10   |---...LL |     drop(recv);   |          ^^^^ move out of `recv` occurs hereLL | }   | - borrow might be used here, when `_combined_fut` is dropped and runs the destructor for coroutineerror: aborting due to 1 previous errorFor more information about this error, try `rustc --explain E0505`.---------------------------------------------- [ui] tests/ui/dropck/coroutine-liveness-2.rs stdout ----error: test compilation failed although it shouldn't!status: exit status: 1command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/dropck/coroutine-liveness-2.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/dropck/coroutine-liveness-2" "-A" "unused" "-A" "internal_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers" "--edition=2021"stdout: none--- stderr -------------------------------error[E0505]: cannot move out of `recv` because it is borrowed##[error]  --> /checkout/tests/ui/dropck/coroutine-liveness-2.rs:18:10   |---...LL |     drop(recv);   |          ^^^^ move out of `recv` occurs hereLL | }   | - borrow might be used here, when `_uwu` is dropped and runs the destructor for type `(String, {async block@/checkout/tests/ui/dropck/coroutine-liveness-2.rs:9:25: 9:30})`error: aborting due to 1 previous errorFor more information about this error, try `rustc --explain E0505`.------------------------------------------

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
S-waiting-on-authorStatus: This is awaiting some action (such as code changes or more information) from the author.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@compiler-errors@rust-log-analyzer@rustbot

[8]ページ先頭

©2009-2025 Movatter.jp