-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-negativeIssue: The lint should have been triggered on code, but wasn'tIssue: The lint should have been triggered on code, but wasn't
Description
Note from maintainer:
NOTE: This has been turned from an ICE into a False negative in #13877
Summary
#![deny(clippy::borrow_interior_mutable_const)]
use std::cell::UnsafeCell;
const ATOMIC_TUPLE: (Vec<UnsafeCell<u8>>, u8) = (Vec::new(), 42);
fn main() {
let _x = &ATOMIC_TUPLE.0;
}
reports:
error: internal compiler error: /home/ben/rust/compiler/rustc_middle/src/ty/consts/valtree.rs:55:18: expected branch, got Leaf(0x0000000000000000)
thread 'rustc' panicked at /home/ben/rust/compiler/rustc_middle/src/ty/consts/valtree.rs:55:18:
The problem is this unwrap_branch:
rust-clippy/clippy_lints/src/non_copy_const.rs
Lines 222 to 223 in 0ce07f6
ty::Adt(def, args) => val | |
.unwrap_branch() |
Version
rustc 1.81.0-nightly (c1b336cb6 2024-06-21)
binary: rustc
commit-hash: c1b336cb6b491b3be02cd821774f03af4992f413
commit-date: 2024-06-21
host: x86_64-unknown-linux-gnu
release: 1.81.0-nightly
LLVM version: 18.1.7
Figuring out what's broken here is blocking rust-lang/rust#126793
Metadata
Metadata
Assignees
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-negativeIssue: The lint should have been triggered on code, but wasn'tIssue: The lint should have been triggered on code, but wasn't