-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
opaque types explicit self review #8
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
use rustc_data_structures::frozen::Frozen; | ||
use rustc_data_structures::transitive_relation::{TransitiveRelation, TransitiveRelationBuilder}; | ||
use rustc_infer::infer::canonical::QueryRegionConstraints; | ||
use rustc_infer::infer::outlives; | ||
use rustc_infer::infer::{outlives, DefiningAnchor}; | ||
use rustc_infer::infer::outlives::env::RegionBoundPairs; | ||
use rustc_infer::infer::region_constraints::GenericKind; | ||
use rustc_infer::infer::InferCtxt; | ||
|
@@ -243,7 +243,7 @@ impl<'tcx> UniversalRegionRelationsBuilder<'_, 'tcx> { | |
let TypeOpOutput { output: norm_ty, constraints: constraints_normalize, .. } = self | ||
.param_env | ||
.and(type_op::normalize::Normalize::new(ty)) | ||
.fully_perform(self.infcx) | ||
.fully_perform(self.infcx, DefiningAnchor::Error) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this should be bind using the |
||
.unwrap_or_else(|_| { | ||
let guar = self | ||
.infcx | ||
|
@@ -324,7 +324,7 @@ impl<'tcx> UniversalRegionRelationsBuilder<'_, 'tcx> { | |
let TypeOpOutput { output: bounds, constraints, .. } = self | ||
.param_env | ||
.and(type_op::implied_outlives_bounds::ImpliedOutlivesBounds { ty }) | ||
.fully_perform(self.infcx) | ||
.fully_perform(self.infcx, DefiningAnchor::Error) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here |
||
.unwrap_or_else(|_| bug!("failed to compute implied bounds {:?}", ty)); | ||
debug!(?bounds, ?constraints); | ||
self.add_outlives_bounds(bounds); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ use crate::errors::AutoDerefReachedRecursionLimit; | |
use crate::traits::query::evaluate_obligation::InferCtxtExt; | ||
use crate::traits::NormalizeExt; | ||
use crate::traits::{self, TraitEngine, TraitEngineExt}; | ||
use rustc_infer::infer::InferCtxt; | ||
use rustc_infer::infer::{DefiningAnchor, InferCtxt}; | ||
use rustc_middle::ty::TypeVisitableExt; | ||
use rustc_middle::ty::{self, Ty, TyCtxt}; | ||
use rustc_session::Limit; | ||
|
@@ -30,6 +30,7 @@ pub struct Autoderef<'a, 'tcx> { | |
span: Span, | ||
body_id: LocalDefId, | ||
param_env: ty::ParamEnv<'tcx>, | ||
defining_use_anchor: DefiningAnchor, | ||
|
||
// Current state: | ||
state: AutoderefSnapshot<'tcx>, | ||
|
@@ -99,6 +100,7 @@ impl<'a, 'tcx> Autoderef<'a, 'tcx> { | |
body_def_id: LocalDefId, | ||
span: Span, | ||
base_ty: Ty<'tcx>, | ||
defining_use_anchor: DefiningAnchor, | ||
) -> Autoderef<'a, 'tcx> { | ||
Autoderef { | ||
infcx, | ||
|
@@ -114,6 +116,7 @@ impl<'a, 'tcx> Autoderef<'a, 'tcx> { | |
}, | ||
include_raw_pointers: false, | ||
silence_errors: false, | ||
defining_use_anchor, | ||
} | ||
} | ||
|
||
|
@@ -140,9 +143,9 @@ impl<'a, 'tcx> Autoderef<'a, 'tcx> { | |
|
||
let normalized_ty = self | ||
.infcx | ||
.at(&cause, self.param_env) | ||
.at(&cause, self.param_env, DefiningAnchor::Error) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is vry inconsistent :< |
||
.normalize(tcx.mk_projection(tcx.lang_items().deref_target()?, trait_ref.substs)); | ||
let mut fulfillcx = <dyn TraitEngine<'tcx>>::new_in_snapshot(tcx); | ||
let mut fulfillcx = <dyn TraitEngine<'tcx>>::new_in_snapshot(tcx, self.defining_use_anchor); | ||
let normalized_ty = | ||
normalized_ty.into_value_registering_obligations(self.infcx, &mut *fulfillcx); | ||
let errors = fulfillcx.select_where_possible(&self.infcx); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this differs from the bubble in the canonical query? sus