Skip to content

Commit 069e7f2

Browse files
committed
rustdoc: heavily simplify synthesis of auto trait impls
1 parent cbd593e commit 069e7f2

File tree

8 files changed

+430
-733
lines changed

8 files changed

+430
-733
lines changed

compiler/rustc_trait_selection/src/traits/auto_trait.rs

+4-11
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ pub enum RegionTarget<'tcx> {
2525

2626
#[derive(Default, Debug, Clone)]
2727
pub struct RegionDeps<'tcx> {
28-
larger: FxIndexSet<RegionTarget<'tcx>>,
29-
smaller: FxIndexSet<RegionTarget<'tcx>>,
28+
pub larger: FxIndexSet<RegionTarget<'tcx>>,
29+
pub smaller: FxIndexSet<RegionTarget<'tcx>>,
3030
}
3131

3232
pub enum AutoTraitResult<A> {
@@ -81,19 +81,12 @@ impl<'tcx> AutoTraitFinder<'tcx> {
8181

8282
let infcx = tcx.infer_ctxt().build();
8383
let mut selcx = SelectionContext::new(&infcx);
84-
for polarity in [true, false] {
84+
for polarity in [ty::PredicatePolarity::Positive, ty::PredicatePolarity::Negative] {
8585
let result = selcx.select(&Obligation::new(
8686
tcx,
8787
ObligationCause::dummy(),
8888
orig_env,
89-
ty::TraitPredicate {
90-
trait_ref,
91-
polarity: if polarity {
92-
ty::PredicatePolarity::Positive
93-
} else {
94-
ty::PredicatePolarity::Negative
95-
},
96-
},
89+
ty::TraitPredicate { trait_ref, polarity },
9790
));
9891
if let Ok(Some(ImplSource::UserDefined(_))) = result {
9992
debug!(

0 commit comments

Comments
 (0)