Skip to content

Commit fe5b813

Browse files
committed
Tidy up
1 parent 1f3ee7f commit fe5b813

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

compiler/rustc_trait_selection/src/traits/select/confirmation.rs

+8-4
Original file line numberDiff line numberDiff line change
@@ -1051,8 +1051,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
10511051
#[cfg(bootstrap)]
10521052
{}
10531053

1054-
if obligation.predicate.skip_binder().def_id() == drop_trait
1055-
{
1054+
if obligation.predicate.skip_binder().def_id() == drop_trait {
10561055
return Ok(ImplSourceConstDestructData { nested: vec![] });
10571056
}
10581057

@@ -1068,7 +1067,10 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
10681067
if let Some(impl_def_id) = impl_def_id {
10691068
let obligations = self.infcx.commit_unconditionally(|_| {
10701069
let mut new_obligation = obligation.clone();
1071-
new_obligation.predicate = new_obligation.predicate.map_bound(|mut trait_pred| { trait_pred.trait_ref.def_id = drop_trait; trait_pred });
1070+
new_obligation.predicate = new_obligation.predicate.map_bound(|mut trait_pred| {
1071+
trait_pred.trait_ref.def_id = drop_trait;
1072+
trait_pred
1073+
});
10721074
let substs = self.rematch_impl(impl_def_id, &new_obligation);
10731075
debug!(?substs, "impl substs");
10741076
let cause = obligation.derived_cause(ImplDerivedObligation);
@@ -1140,7 +1142,9 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
11401142
self_ty
11411143
.rebind(ty::TraitPredicate {
11421144
trait_ref: ty::TraitRef {
1143-
def_id: self.tcx().require_lang_item(LangItem::Destruct, None),
1145+
def_id: self
1146+
.tcx()
1147+
.require_lang_item(LangItem::Destruct, None),
11441148
substs: self.tcx().mk_substs_trait(nested_ty, &[]),
11451149
},
11461150
constness: ty::BoundConstness::ConstIfConst,

src/test/ui/rfc-2632-const-trait-impl/const-drop-bound.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ const fn foo<T, E>(res: Result<T, E>) -> Option<T> where E: ~const Destruct {
1414

1515
pub struct Foo<T>(T);
1616

17-
const fn baz<T: ~const Destruct, E: ~const Destruct>(res: Result<Foo<T>, Foo<E>>) -> Option<Foo<T>> {
17+
const fn baz<T, E>(res: Result<Foo<T>, Foo<E>>) -> Option<Foo<T>>
18+
where
19+
T: ~const Destruct,
20+
E: ~const Destruct,
21+
{
1822
foo(res)
1923
}
2024

0 commit comments

Comments
 (0)