Skip to content

Commit

Permalink
Work around clippy bug in const-checking
Browse files Browse the repository at this point in the history
I really hate having to do this, since I don't think unstable compiler
APIs should have to work around misuse by external crates. However, this
is the only way this change will pass CI without a ton of modifications
to clippy and/or involvement of the clippy team.
  • Loading branch information
ecstatic-morse committed Sep 24, 2020
1 parent 34b821f commit 5b51326
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions compiler/rustc_mir/src/transform/check_consts/qualifs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,11 @@ where
};

// Check the qualifs of the value of `const` items.
if let ty::ConstKind::Unevaluated(def, _, promoted) = constant.literal.val {
assert!(promoted.is_none());
if let ty::ConstKind::Unevaluated(def, _, _promoted) = constant.literal.val {
// FIXME(rust-lang/rust-clippy#6080): Const-checking should never see promoteds, but clippy
// is broken.
// assert!(promoted.is_none());

// Don't peek inside trait associated constants.
if cx.tcx.trait_of_item(def.did).is_none() {
let qualifs = if let Some((did, param_did)) = def.as_const_arg() {
Expand Down

0 comments on commit 5b51326

Please sign in to comment.