diff --git a/compiler/rustc_trait_selection/src/traits/wf.rs b/compiler/rustc_trait_selection/src/traits/wf.rs index 8908fe230b0..fc0a9f69003 100644 --- a/compiler/rustc_trait_selection/src/traits/wf.rs +++ b/compiler/rustc_trait_selection/src/traits/wf.rs @@ -547,7 +547,7 @@ impl<'tcx> WfPredicates<'tcx> { } ty::FnDef(did, substs) => { - let obligations = self.nominal_obligations(did, substs); + let obligations = self.nominal_obligations_without_const(did, substs); self.out.extend(obligations); } diff --git a/src/test/ui/consts/issue-104155.rs b/src/test/ui/consts/issue-104155.rs new file mode 100644 index 00000000000..1cc8f81b0d2 --- /dev/null +++ b/src/test/ui/consts/issue-104155.rs @@ -0,0 +1,5 @@ +// check-pass +const _: () = core::mem::forget(Box::::default); +const _: () = core::mem::forget(|| Box::::default()); + +fn main() {}