Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 12 pull requests #136849

Closed
wants to merge 26 commits into from
Closed

Conversation

jhpratt
Copy link
Member

@jhpratt jhpratt commented Feb 11, 2025

Successful merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

compiler-errors and others added 26 commits February 4, 2025 21:28
This text was placed in the wrong column.
rustfmt fails to format this match expression, because it has several
long string literals over the maximum line width. This seems to exhibit
rustfmt issues rust-lang#3863 (Gives up on chains if any line is too long) and
rust-lang#3156 (Fail to format match arm when other arm has long line).
…r-type-test-failure, r=BoxyUwU

Resolve named regions when reporting type test failures in NLL

Just a improvement tweak to an error message that I broke out of a bigger PR that I had to close lol
…braheemdev

Fix long lines which rustfmt fails to format

rustfmt fails to format this match expression, because it has several long string literals over the maximum line width. This seems to exhibit rustfmt issues [rust-lang#3863](rust-lang/rustfmt#3863) (Gives up on chains if any line is too long) and [rust-lang#3156](rust-lang/rustfmt#3156) (Fail to format match arm when other arm has long line).

Format it with a large line width (e.g., by setting `max_width = 200` in rustfmt.toml) and, in case the rustfmt bugs are later fixed, mark it with `#[rustfmt::skip]`, as it is more legible with each case on one line.
… r=cuviper

library: doc: core::alloc::Allocator: trivial typo fix

(see subject)
Improve examples for file locking

The `lock` and `try_lock` documentation states that "if the file not open for writing, it is unspecified whether this function returns an error." With this change, the examples use `File::create` instead of `File::open`, eliminating the possibility of someone blindly copying code with unspecified behavior.
cg_llvm: Reduce visibility of some items outside the `llvm` module

Next piece of rust-lang#135502

This reduces the visibility of items (other than those in the `llvm` module) so that dead code analysis will correctly identify unused items.
…ture, r=davidtwco

rustc_target: Add the fp16 target feature for AArch32

As in the commit description. The feature is already available in rustc for AArch64.
…trieb

fix i686-unknown-hurd-gnu x87 footnote

I missed this in rust-lang#136700.

r? `@Noratrieb`
…er-errors

Fix platform support table for i686-unknown-uefi

This text was placed in the wrong column.
…k, r=celinval

Stop using span hack for contracts feature gating

The contracts machinery is a pretty straightforward case of an *external* feature using a (perma-unstable) *internal* feature within its implementation. There's no reason why it needs to be implemented any differently than other features by using global span tracking hacks to change whether the internals are gated behind the `contracts` or `contracts_internals` feature gate -- for the case of macro expansions we already have `allow_internal_unstable` for exactly this situation.

This PR changes the internal, perma-unstable AST syntax to use the `contracts_internals` gate always, and adjusts the macro expansion to use the right spans so that `allow_internal_unstable` works correctly.

As a follow-up, there's really no reason to have `contracts` be a *compiler feature* since it's at this point fully a *library feature*; the only reason it's a compiler feature today is so we can mark it as incomplete, but that seems like a weak reason. I didn't do anything in this PR for this.

r? `@celinval`
…ering, r=celinval

Overhaul how contracts are lowered on fn-like bodies

Consolidates all of the contracts lowering logic into `lower_fn_body`, rather than having it be split between `lower_item_kind` and `lower_fn_body`. This should fix rust-lang#136683.

r? celinval
…ough, r=compiler-errors

fix ensure_monomorphic_enough

When polymorphization was still a thing, the visitor was used to only recurse into *used generic parameters* of function/closure/coroutine types and allow unused parameters (i.e. the polymorphized parameters) to remain generic.

When polymorphization got removed, this got changed to always treat all parameters as polymorphic and never recurse into them: https://github.com/rust-lang/rust/pull/133883/files#diff-210c59e321070d0ca4625c04e9fb064bf43ddc34082e7e33a7ee8a6c577e95afL44-L62

This is clearly wrong and can cause MIR opts to misbehave, for example this currently prints "false" in release mode:

```rust
#![feature(core_intrinsics)]

fn generic<T>() {}

const fn type_id_of_val<T: 'static>(_: &T) -> u128 {
    std::intrinsics::type_id::<T>()
}

fn cursed_is_i32<T: 'static>() -> bool {
    (const { type_id_of_val(&generic::<T>) } == const { type_id_of_val(&generic::<i32>) })
}

fn main() {
    dbg!(cursed_is_i32::<i32>());
}
```

This PR reverts to the old behavior of always treating all types that contain type parameters as too generic, like we used to do without `-Zpolymorphize` before.

~~I'm not including the above as a test case here, because I think there is little value in testing code paths that have been removed and this seems unlikely to regress in a way that would be caught by a regression test, but let me know if you disagree and want me to add a test anyway.~~
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Feb 11, 2025
@rustbot rustbot added the rollup A PR which is a rollup label Feb 11, 2025
@jhpratt
Copy link
Member Author

jhpratt commented Feb 11, 2025

@bors r+ rollup=never p=5

@bors
Copy link
Contributor

bors commented Feb 11, 2025

📌 Commit 57be4a3 has been approved by jhpratt

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 11, 2025
@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-llvm-18 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
#22 exporting to docker image format
#22 sending tarball 28.5s done
#22 DONE 34.2s
##[endgroup]
Setting extra environment values for docker:  --env ENABLE_GCC_CODEGEN=1 --env GCC_EXEC_PREFIX=/usr/lib/gcc/
[CI_JOB_NAME=x86_64-gnu-llvm-18]
debug: `DISABLE_CI_RUSTC_IF_INCOMPATIBLE` configured.
---
sccache: Starting the server...
##[group]Configure the build
configure: processing command line
configure: 
configure: build.configure-args := ['--build=x86_64-unknown-linux-gnu', '--llvm-root=/usr/lib/llvm-18', '--enable-llvm-link-shared', '--set', 'rust.randomize-layout=true', '--set', 'rust.thin-lto-import-instr-limit=10', '--enable-verbose-configure', '--enable-sccache', '--disable-manage-submodules', '--enable-locked-deps', '--enable-cargo-native-static', '--set', 'rust.codegen-units-std=1', '--set', 'dist.compression-profile=balanced', '--dist-compression-formats=xz', '--set', 'rust.lld=false', '--disable-dist-src', '--release-channel=nightly', '--enable-debug-assertions', '--enable-overflow-checks', '--enable-llvm-assertions', '--set', 'rust.verify-llvm-ir', '--set', 'rust.codegen-backends=llvm,cranelift,gcc', '--set', 'llvm.static-libstdcpp', '--enable-new-symbol-mangling']
configure: target.x86_64-unknown-linux-gnu.llvm-config := /usr/lib/llvm-18/bin/llvm-config
configure: llvm.link-shared     := True
configure: rust.randomize-layout := True
configure: rust.thin-lto-import-instr-limit := 10
---

9    |
10 help: consider adding an explicit lifetime bound
11    |
- LL |     <T as MyTrait<'a>>::Output: 'b, <T as MyTrait<'a>>::Output: 'a
-    |                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ LL -     <T as MyTrait<'a>>::Output: 'b,
+ LL +     <T as MyTrait<'a>>::Output: 'b, <T as MyTrait<'a>>::Output: 'a
14 
15 error: aborting due to 1 previous error
16 



The actual stderr differed from the expected stderr.
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args nll/ty-outlives/projection-where-clause-env-wrong-bound.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound.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/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-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/x86_64-unknown-linux-gnu/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-bound" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers"
--- stderr -------------------------------
--- stderr -------------------------------
error[E0309]: the associated type `<T as MyTrait<'a>>::Output` may not live long enough
   |
   |
LL | fn foo1<'a, 'b, T>() -> &'a ()
   |         -- the associated type `<T as MyTrait<'a>>::Output` must be valid for the lifetime `'a` as defined here...
...
LL |     bar::<T::Output>() //~ ERROR may not live long enough
   |     ^^^^^^^^^^^^^^^^ ...so that the type `<T as MyTrait<'a>>::Output` will meet its required lifetime bounds
help: consider adding an explicit lifetime bound
   |
   |
LL -     <T as MyTrait<'a>>::Output: 'b,
LL +     <T as MyTrait<'a>>::Output: 'b, <T as MyTrait<'a>>::Output: 'a

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0309`.
---

9    |
10 help: consider adding an explicit lifetime bound
11    |
- LL |     <T as MyTrait<'b>>::Output: 'a, <T as MyTrait<'a>>::Output: 'a
-    |                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ LL -     <T as MyTrait<'b>>::Output: 'a,
+ LL +     <T as MyTrait<'b>>::Output: 'a, <T as MyTrait<'a>>::Output: 'a
14 
15 error: aborting due to 1 previous error
16 



The actual stderr differed from the expected stderr.
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args nll/ty-outlives/projection-where-clause-env-wrong-lifetime.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime.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/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-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/x86_64-unknown-linux-gnu/test/ui/nll/ty-outlives/projection-where-clause-env-wrong-lifetime" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers"
--- stderr -------------------------------
--- stderr -------------------------------
error[E0309]: the associated type `<T as MyTrait<'a>>::Output` may not live long enough
   |
   |
LL | fn foo1<'a, 'b, T>() -> &'a ()
   |         -- the associated type `<T as MyTrait<'a>>::Output` must be valid for the lifetime `'a` as defined here...
...
LL |     bar::<<T as MyTrait<'a>>::Output>()
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `<T as MyTrait<'a>>::Output` will meet its required lifetime bounds
help: consider adding an explicit lifetime bound
   |
   |
LL -     <T as MyTrait<'b>>::Output: 'a,
LL +     <T as MyTrait<'b>>::Output: 'a, <T as MyTrait<'a>>::Output: 'a

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0309`.
---

34    |
35 help: consider adding an explicit lifetime bound
36    |
- LL |     T: Anything<'b, 'c>, <T as Anything<'b/#0, 'c/#1>>::AssocType: 'a
-    |                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ LL -     T: Anything<'b, 'c>,
+ LL +     T: Anything<'b, 'c>, <T as Anything<'b/#0, 'c/#1>>::AssocType: 'a
39 
40 note: external requirements
41   --> $DIR/projection-two-region-trait-bound-closure.rs:48:29


73    |
74 help: consider adding an explicit lifetime bound
75    |
- LL |     'a: 'a, <T as Anything<'b/#1, 'c/#2>>::AssocType: 'a
-    |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ LL -     'a: 'a,
+ LL +     'a: 'a, <T as Anything<'b/#1, 'c/#2>>::AssocType: 'a
78 
79 note: external requirements
80   --> $DIR/projection-two-region-trait-bound-closure.rs:61:29



The actual stderr differed from the expected stderr.
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args nll/ty-outlives/projection-two-region-trait-bound-closure.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.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/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-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/x86_64-unknown-linux-gnu/test/ui/nll/ty-outlives/projection-two-region-trait-bound-closure" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-Zverbose-internals"
--- stderr -------------------------------
note: external requirements
  --> /checkout/tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.rs:38:29
   |
   |
LL |     with_signature(cell, t, |cell, t| require(cell, t));
   |
   |
   = note: defining type: no_relationships_late::<'?1, '?2, T>::{closure#0} with closure args [
               i32,
               extern "rust-call" fn((std::cell::Cell<&'?3 ()>, T)),
           ]
   = note: late-bound region is '?4
   = note: late-bound region is '?4
   = note: number of external vids: 5
   = note: where <T as Anything<'?1, '?2>>::AssocType: '?3
note: no external requirements
  --> /checkout/tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.rs:34:1
   |
   |
LL | / fn no_relationships_late<'a, 'b, 'c, T>(cell: Cell<&'a ()>, t: T)
LL | | where
LL | |     T: Anything<'b, 'c>,
   |
   |
   = note: defining type: no_relationships_late::<'?1, '?2, T>

error[E0309]: the associated type `<T as Anything<'b/#0, 'c/#1>>::AssocType` may not live long enough
   |
   |
LL | fn no_relationships_late<'a, 'b, 'c, T>(cell: Cell<&'a ()>, t: T)
   |                          -- the associated type `<T as Anything<'b/#0, 'c/#1>>::AssocType` must be valid for the lifetime `'a` as defined here...
...
LL |     with_signature(cell, t, |cell, t| require(cell, t));
   |                                       ^^^^^^^^^^^^^^^^ ...so that the type `<T as Anything<'b/#0, 'c/#1>>::AssocType` will meet its required lifetime bounds
help: consider adding an explicit lifetime bound
   |
   |
LL -     T: Anything<'b, 'c>,
LL +     T: Anything<'b, 'c>, <T as Anything<'b/#0, 'c/#1>>::AssocType: 'a

note: external requirements
  --> /checkout/tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.rs:48:29
   |
   |
LL |     with_signature(cell, t, |cell, t| require(cell, t));
   |
   |
   = note: defining type: no_relationships_early::<'?1, '?2, '?3, T>::{closure#0} with closure args [
               i32,
               extern "rust-call" fn((std::cell::Cell<&'?4 ()>, T)),
           ]
           ]
   = note: number of external vids: 5
   = note: where <T as Anything<'?2, '?3>>::AssocType: '?4
note: no external requirements
  --> /checkout/tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.rs:43:1
   |
   |
LL | / fn no_relationships_early<'a, 'b, 'c, T>(cell: Cell<&'a ()>, t: T)
LL | | where
LL | |     T: Anything<'b, 'c>,
LL | |     'a: 'a,
   |
   |
   = note: defining type: no_relationships_early::<'?1, '?2, '?3, T>

error[E0309]: the associated type `<T as Anything<'b/#1, 'c/#2>>::AssocType` may not live long enough
   |
   |
LL | fn no_relationships_early<'a, 'b, 'c, T>(cell: Cell<&'a ()>, t: T)
   |                           -- the associated type `<T as Anything<'b/#1, 'c/#2>>::AssocType` must be valid for the lifetime `'a` as defined here...
...
LL |     with_signature(cell, t, |cell, t| require(cell, t));
   |                                       ^^^^^^^^^^^^^^^^ ...so that the type `<T as Anything<'b/#1, 'c/#2>>::AssocType` will meet its required lifetime bounds
help: consider adding an explicit lifetime bound
   |
   |
LL -     'a: 'a,
LL +     'a: 'a, <T as Anything<'b/#1, 'c/#2>>::AssocType: 'a

note: external requirements
  --> /checkout/tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.rs:61:29
   |
   |
LL |     with_signature(cell, t, |cell, t| require(cell, t));
   |
   |
   = note: defining type: projection_outlives::<'?1, '?2, '?3, T>::{closure#0} with closure args [
               i32,
               extern "rust-call" fn((std::cell::Cell<&'?4 ()>, T)),
           ]
           ]
   = note: number of external vids: 5
   = note: where <T as Anything<'?2, '?3>>::AssocType: '?4
note: no external requirements
  --> /checkout/tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.rs:53:1
   |
   |
LL | / fn projection_outlives<'a, 'b, 'c, T>(cell: Cell<&'a ()>, t: T)
LL | | where
LL | |     T: Anything<'b, 'c>,
LL | |     T::AssocType: 'a,
   |
   |
   = note: defining type: projection_outlives::<'?1, '?2, '?3, T>
note: external requirements
  --> /checkout/tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.rs:70:29
   |
   |
LL |     with_signature(cell, t, |cell, t| require(cell, t));
   |
   |
   = note: defining type: elements_outlive1::<'?1, '?2, '?3, T>::{closure#0} with closure args [
               i32,
               extern "rust-call" fn((std::cell::Cell<&'?4 ()>, T)),
           ]
           ]
   = note: number of external vids: 5
   = note: where <T as Anything<'?2, '?3>>::AssocType: '?4
note: no external requirements
  --> /checkout/tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.rs:65:1
   |
   |
LL | / fn elements_outlive1<'a, 'b, 'c, T>(cell: Cell<&'a ()>, t: T)
LL | | where
LL | |     T: Anything<'b, 'c>,
LL | |     'b: 'a,
   |
   |
   = note: defining type: elements_outlive1::<'?1, '?2, '?3, T>
note: external requirements
  --> /checkout/tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.rs:79:29
   |
   |
LL |     with_signature(cell, t, |cell, t| require(cell, t));
   |
   |
   = note: defining type: elements_outlive2::<'?1, '?2, '?3, T>::{closure#0} with closure args [
               i32,
               extern "rust-call" fn((std::cell::Cell<&'?4 ()>, T)),
           ]
           ]
   = note: number of external vids: 5
   = note: where <T as Anything<'?2, '?3>>::AssocType: '?4
note: no external requirements
  --> /checkout/tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.rs:74:1
   |
   |
LL | / fn elements_outlive2<'a, 'b, 'c, T>(cell: Cell<&'a ()>, t: T)
LL | | where
LL | |     T: Anything<'b, 'c>,
LL | |     'c: 'a,
   |
   |
   = note: defining type: elements_outlive2::<'?1, '?2, '?3, T>
note: external requirements
  --> /checkout/tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.rs:87:29
   |
   |
LL |     with_signature(cell, t, |cell, t| require(cell, t));
   |
   |
   = note: defining type: two_regions::<'?1, T>::{closure#0} with closure args [
               i32,
               extern "rust-call" fn((std::cell::Cell<&'?2 ()>, T)),
           ]
   = note: late-bound region is '?3
   = note: late-bound region is '?3
   = note: number of external vids: 4
   = note: where <T as Anything<'?1, '?1>>::AssocType: '?2
note: no external requirements
  --> /checkout/tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.rs:83:1
   |
   |
LL | / fn two_regions<'a, 'b, T>(cell: Cell<&'a ()>, t: T)
LL | | where
LL | |     T: Anything<'b, 'b>,
   |
   |
   = note: defining type: two_regions::<'?1, T>
error: lifetime may not live long enough
##[error]  --> /checkout/tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.rs:87:5
   |
   |
LL | fn two_regions<'a, 'b, T>(cell: Cell<&'a ()>, t: T)
   |                |
   |                lifetime `'a` defined here
...
...
LL |     with_signature(cell, t, |cell, t| require(cell, t));
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ argument requires that `'b` must outlive `'a`
   |
   = help: consider adding the following bound: `'b: 'a`
   = note: requirement occurs because of the type `Cell<&'?6 ()>`, which makes the generic argument `&'?6 ()` invariant
   = note: the struct `Cell<T>` is invariant over the parameter `T`

note: external requirements
  --> /checkout/tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.rs:97:29
   |
   |
LL |     with_signature(cell, t, |cell, t| require(cell, t));
   |
   |
   = note: defining type: two_regions_outlive::<'?1, '?2, T>::{closure#0} with closure args [
               i32,
               extern "rust-call" fn((std::cell::Cell<&'?3 ()>, T)),
           ]
           ]
   = note: number of external vids: 4
   = note: where <T as Anything<'?2, '?2>>::AssocType: '?3
note: no external requirements
  --> /checkout/tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.rs:92:1
   |
   |
LL | / fn two_regions_outlive<'a, 'b, T>(cell: Cell<&'a ()>, t: T)
LL | | where
LL | |     T: Anything<'b, 'b>,
LL | |     'b: 'a,
   |
   |
   = note: defining type: two_regions_outlive::<'?1, '?2, T>
note: external requirements
  --> /checkout/tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.rs:109:29
   |
   |
LL |     with_signature(cell, t, |cell, t| require(cell, t));
   |
   |
   = note: defining type: one_region::<'?1, T>::{closure#0} with closure args [
               i32,
               extern "rust-call" fn((std::cell::Cell<&'?2 ()>, T)),
           ]
           ]
   = note: number of external vids: 3
   = note: where <T as Anything<'?1, '?1>>::AssocType: '?2
note: no external requirements
  --> /checkout/tests/ui/nll/ty-outlives/projection-two-region-trait-bound-closure.rs:101:1
   |
   |
LL | / fn one_region<'a, T>(cell: Cell<&'a ()>, t: T)
LL | | where
LL | |     T: Anything<'a, 'a>,
   |
   |
   = note: defining type: one_region::<'?1, T>
error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0309`.
------------------------------------------

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rollup A PR which is a rollup S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.