Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
rustdoc: heavily simplify synthesis of auto trait impls
  • Loading branch information
fmease committed Apr 1, 2024
commit 069e7f2a768874536e8688e3df120cd74cd03b0b
15 changes: 4 additions & 11 deletions compiler/rustc_trait_selection/src/traits/auto_trait.rs
Original file line number Diff line number Diff line change
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
Loading