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

Don't allow consts with unconstrained lifetimes in their types #114713

Conversation

compiler-errors
Copy link
Member

@compiler-errors compiler-errors commented Aug 10, 2023

Let's not do that.

cc #114706

@compiler-errors compiler-errors added needs-fcp This change is insta-stable, so needs a completed FCP to proceed. T-types Relevant to the types team, which will review and decide on the PR/issue. labels Aug 10, 2023
@rustbot
Copy link
Collaborator

rustbot commented Aug 10, 2023

r? @wesleywiser

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 10, 2023
@compiler-errors
Copy link
Member Author

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Aug 10, 2023
@bors
Copy link
Contributor

bors commented Aug 10, 2023

⌛ Trying commit e179d5d with merge 216f55af8dc8a43a1f76405446110a5ac597fc81...

@compiler-errors
Copy link
Member Author

Will re-assign to T-types when crater is done.

@rust-log-analyzer
Copy link
Collaborator

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

Click to see the possible cause of the failure (guessed by this bot)
GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_b256f802-4e5f-4fba-b146-971a942bb5fb
GITHUB_EVENT_NAME=pull_request
GITHUB_EVENT_PATH=/home/runner/work/_temp/_github_workflow/event.json
GITHUB_GRAPHQL_URL=https://github.com/gitapi/graphql
GITHUB_HEAD_REF=oops-unconstrained-lt
GITHUB_JOB=pr
GITHUB_PATH=/home/runner/work/_temp/_runner_file_commands/add_path_b256f802-4e5f-4fba-b146-971a942bb5fb
GITHUB_REF=refs/pull/114713/merge
GITHUB_REF_NAME=114713/merge
GITHUB_REF_PROTECTED=false
---
##[endgroup]
Built container sha256:3943321ff39bf5b959b1df601d21eba70be70dae8d9be663475951fb6b53065e
Uploading finished image to https://ci-caches.rust-lang.org/docker/81ffb10956977f61179e4c596a0e3b6b2e7d3e589c46ba41f8b60297a95ab1bc4f59e3f20a6f9fe7b17273bb168d9d6e8419853543fb546bcc96155689743fc6

<botocore.awsrequest.AWSRequest object at 0x7fe13e2c9bd0>
gzip: stdout: Broken pipe
xargs: docker: terminated by signal 13
[CI_JOB_NAME=x86_64-gnu-llvm-15]
[CI_JOB_NAME=x86_64-gnu-llvm-15]
---
failures:

---- [ui] tests/ui/consts/assoc-const-unconstrained-lifetime.rs stdout ----

error: /checkout/tests/ui/consts/assoc-const-unconstrained-lifetime.rs:3: unexpected error: '3:6: 3:8: the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates [E0207]'

error: /checkout/tests/ui/consts/assoc-const-unconstrained-lifetime.rs:4: expected error not found: the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates
error: 1 unexpected errors found, 1 expected errors not found
status: exit status: 1
command: RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/consts/assoc-const-unconstrained-lifetime.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--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/consts/assoc-const-unconstrained-lifetime" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/consts/assoc-const-unconstrained-lifetime/auxiliary"
unexpected errors (from JSON output): [
unexpected errors (from JSON output): [
    Error {
        line_num: 3,
        kind: Some(
            Error,
        ),
        msg: "3:6: 3:8: the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates [E0207]",
]

not found errors (from test file): [
    Error {
    Error {
        line_num: 4,
        kind: Some(
            Error,
        ),
        msg: "the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates",
]

thread '[ui] tests/ui/consts/assoc-const-unconstrained-lifetime.rs' panicked at src/tools/compiletest/src/runtest.rs:1747:13:
explicit panic
explicit panic
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

---- [ui] tests/ui/nll/trait-associated-constant.rs stdout ----

error: /checkout/tests/ui/nll/trait-associated-constant.rs:20: unexpected error: '20:18: 20:20: the lifetime parameter `'c` is not constrained by the impl trait, self type, or predicates [E0207]'

error: /checkout/tests/ui/nll/trait-associated-constant.rs:21: expected error not found: the lifetime parameter `'c` is not constrained by the impl trait, self type, or predicates
error: 1 unexpected errors found, 1 expected errors not found
status: exit status: 1
command: RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/nll/trait-associated-constant.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--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/trait-associated-constant" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/nll/trait-associated-constant/auxiliary"
unexpected errors (from JSON output): [
unexpected errors (from JSON output): [
    Error {
        line_num: 20,
        kind: Some(
            Error,
        ),
        msg: "20:18: 20:20: the lifetime parameter `'c` is not constrained by the impl trait, self type, or predicates [E0207]",
]

not found errors (from test file): [
    Error {
    Error {
        line_num: 21,
        kind: Some(
            Error,
        ),
        msg: "the lifetime parameter `'c` is not constrained by the impl trait, self type, or predicates",
]

thread '[ui] tests/ui/nll/trait-associated-constant.rs' panicked at src/tools/compiletest/src/runtest.rs:1747:13:
explicit panic

@bors
Copy link
Contributor

bors commented Aug 10, 2023

💔 Test failed - checks-actions

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 10, 2023
bors added a commit to rust-lang/cargo that referenced this pull request Aug 11, 2023
Fix elided lifetime in associated const

Fix an unelided lifetime in an associated const.

The old code was equivalent to:

```rust
impl<'a> RegistryConfig {
    /// File name of [`RegistryConfig`].
    const NAME: &'a str = "config.json";
}
```

and not `&'static str`, as it might be in a regular `const` item.

This "regressed" in rust-lang/rust#97313, which started allowing this behavior (inadvertently, as far as I can tell). It's not necessarily clear to me that this is sound (or at least, it's not something we intended to be able to express), but it's also preventing me from doing crater runs to investigate fallout of this issue (rust-lang/rust#114713 and rust-lang/rust#114716).
@compiler-errors
Copy link
Member Author

I guess this is not necessarily unsound. But I'd still like to crater this, but that's blocked on a cargo sync.

@compiler-errors
Copy link
Member Author

This one probably doesn't actually matter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-fcp This change is insta-stable, so needs a completed FCP to proceed. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. S-waiting-on-perf Status: Waiting on a perf run to be completed. T-types Relevant to the types team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants