Skip to content

const prop missing diagnostic with unrelated changes #101470

Closed
@oli-obk

Description

@oli-obk
Contributor

Since rustc 1.61, the following code is not giving a compile-time error:

fn main() {
    let xs = [10, 20, 30];
    println!("{}", xs[10]);

    let _n = xs.len();
}

If I uncomment the last line, the compile-time error shows up.
Is this right? I would expect the compile-time error to show up in both cases (this is what happens for rustc < 1.61).

cc @oli-obk

Originally posted by @paolieri in #48920 (comment)

Activity

added
C-bugCategory: This is a bug.
A-mir-optArea: MIR optimizations
A-diagnosticsArea: Messages for errors, warnings, and lints
on Sep 6, 2022
steffahn

steffahn commented on Sep 6, 2022

@steffahn
Member

@rustbot label A-lint, regression-from-stable-to-stable

For context, the “error” pre-1.61 is the deny-by-default unconditional_panic lint

error: this operation will panic at runtime
 --> <source>:3:20
  |
3 |     println!("{}", xs[10]);
  |                    ^^^^^^ index out of bounds: the length is 3 but the index is 10
  |
  = note: `#[deny(unconditional_panic)]` on by default

error: aborting due to previous error

Bisection points to regression in #94934.

added
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.
regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.
I-prioritizeIssue: Indicates that prioritization has been requested for this issue.
on Sep 6, 2022
self-assigned this
on Sep 6, 2022
Dajamante

Dajamante commented on Sep 6, 2022

@Dajamante
Contributor

@rustbot claim

assigned and unassigned on Sep 6, 2022
apiraino

apiraino commented on Sep 8, 2022

@apiraino
Contributor

WG-prioritization assigning priority (Zulip discussion).

@rustbot label -I-prioritize +P-high T-compiler

added
P-highHigh priority
T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
and removed
I-prioritizeIssue: Indicates that prioritization has been requested for this issue.
on Sep 8, 2022
oli-obk

oli-obk commented on Sep 14, 2022

@oli-obk
ContributorAuthor

duplicate of #98444

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.A-mir-optArea: MIR optimizationsC-bugCategory: This is a bug.P-highHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @oli-obk@steffahn@apiraino@Dajamante@rustbot

      Issue actions

        const prop missing diagnostic with unrelated changes · Issue #101470 · rust-lang/rust