Skip to content

Commit

Permalink
rustdoc: heavily simplify synthesis of auto trait impls
Browse files Browse the repository at this point in the history
  • Loading branch information
fmease committed Apr 1, 2024
1 parent cbd593e commit c8070f5
Show file tree
Hide file tree
Showing 8 changed files with 428 additions and 732 deletions.
15 changes: 4 additions & 11 deletions compiler/rustc_trait_selection/src/traits/auto_trait.rs
Expand Up @@ -25,8 +25,8 @@ pub enum RegionTarget<'tcx> {

#[derive(Default, Debug, Clone)]
pub struct RegionDeps<'tcx> {
larger: FxIndexSet<RegionTarget<'tcx>>,
smaller: FxIndexSet<RegionTarget<'tcx>>,
pub larger: FxIndexSet<RegionTarget<'tcx>>,
pub smaller: FxIndexSet<RegionTarget<'tcx>>,
}

pub enum AutoTraitResult<A> {
Expand Down Expand Up @@ -81,19 +81,12 @@ impl<'tcx> AutoTraitFinder<'tcx> {

let infcx = tcx.infer_ctxt().build();
let mut selcx = SelectionContext::new(&infcx);
for polarity in [true, false] {
for polarity in [ty::PredicatePolarity::Positive, ty::PredicatePolarity::Negative] {
let result = selcx.select(&Obligation::new(
tcx,
ObligationCause::dummy(),
orig_env,
ty::TraitPredicate {
trait_ref,
polarity: if polarity {
ty::PredicatePolarity::Positive
} else {
ty::PredicatePolarity::Negative
},
},
ty::TraitPredicate { trait_ref, polarity },
));
if let Ok(Some(ImplSource::UserDefined(_))) = result {
debug!(
Expand Down

0 comments on commit c8070f5

Please sign in to comment.