Skip to content

Commit

Permalink
Auto merge of rust-lang#115859 - compiler-errors:effect-fallback, r=f…
Browse files Browse the repository at this point in the history
…ee1-dead

Fallback effects even if types also fallback

`||` is short circuiting, so if we do ty/int var fallback, we *don't* do effect fallback 😸

r? `@fee1-dead` or `@oli-obk`

Fixes rust-lang#115791
Fixes rust-lang#115842
  • Loading branch information
bors committed Sep 15, 2023
2 parents ca2b74f + 5c907a7 commit 5ad2d0d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_hir_typeck/src/fallback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
9 changes: 8 additions & 1 deletion tests/ui/rfcs/rfc-2632-const-trait-impl/effects/fallback.rs
Original file line number Diff line number Diff line change
@@ -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;
}

0 comments on commit 5ad2d0d

Please sign in to comment.