From 5c907a78595d5d62506a93613be0da925a676242 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Thu, 14 Sep 2023 21:08:19 +0000 Subject: [PATCH] Fallback effects even if types also fall back --- compiler/rustc_hir_typeck/src/fallback.rs | 2 +- .../rfcs/rfc-2632-const-trait-impl/effects/fallback.rs | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/compiler/rustc_hir_typeck/src/fallback.rs b/compiler/rustc_hir_typeck/src/fallback.rs index 97091c39c652f..952b90d6a35b7 100644 --- a/compiler/rustc_hir_typeck/src/fallback.rs +++ b/compiler/rustc_hir_typeck/src/fallback.rs @@ -24,7 +24,7 @@ impl<'tcx> FnCtxt<'_, 'tcx> { self.fulfillment_cx.borrow_mut().pending_obligations() ); - let fallback_occured = self.fallback_types() || self.fallback_effects(); + let fallback_occured = self.fallback_types() | self.fallback_effects(); if !fallback_occured { return; diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/fallback.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/fallback.rs index 855bbb2e992a8..da2778f610189 100644 --- a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/fallback.rs +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/fallback.rs @@ -1,9 +1,16 @@ // check-pass -#![feature(const_trait_impl, effects)] +#![feature(effects)] pub const fn owo() {} fn main() { + // make sure falling back ty/int vars doesn't cause const fallback to be skipped... + // See issue: 115791. + let _ = 1; + if false { + let x = panic!(); + } + let _ = owo; }