IAT: Introduce AliasKind::Inherent
This commit is contained in:
parent
6f8c0557e0
commit
e8139dfd5a
82 changed files with 1008 additions and 167 deletions
|
@ -257,11 +257,11 @@ impl<'cx, 'tcx> FallibleTypeFolder<TyCtxt<'tcx>> for QueryNormalizer<'cx, 'tcx>
|
|||
|
||||
ty::Opaque => ty.try_super_fold_with(self)?,
|
||||
|
||||
ty::Projection => {
|
||||
ty::Projection | ty::Inherent => {
|
||||
// See note in `rustc_trait_selection::traits::project`
|
||||
|
||||
let tcx = self.infcx.tcx;
|
||||
let infcx = self.infcx;
|
||||
let tcx = infcx.tcx;
|
||||
// Just an optimization: When we don't have escaping bound vars,
|
||||
// we don't need to replace them with placeholders.
|
||||
let (data, maps) = if data.has_escaping_bound_vars() {
|
||||
|
@ -276,12 +276,15 @@ impl<'cx, 'tcx> FallibleTypeFolder<TyCtxt<'tcx>> for QueryNormalizer<'cx, 'tcx>
|
|||
let mut orig_values = OriginalQueryValues::default();
|
||||
// HACK(matthewjasper) `'static` is special-cased in selection,
|
||||
// so we cannot canonicalize it.
|
||||
let c_data = self
|
||||
.infcx
|
||||
let c_data = infcx
|
||||
.canonicalize_query_keep_static(self.param_env.and(data), &mut orig_values);
|
||||
debug!("QueryNormalizer: c_data = {:#?}", c_data);
|
||||
debug!("QueryNormalizer: orig_values = {:#?}", orig_values);
|
||||
let result = tcx.normalize_projection_ty(c_data)?;
|
||||
let result = match kind {
|
||||
ty::Projection => tcx.normalize_projection_ty(c_data),
|
||||
ty::Inherent => tcx.normalize_inherent_projection_ty(c_data),
|
||||
_ => unreachable!(),
|
||||
}?;
|
||||
// We don't expect ambiguity.
|
||||
if result.is_ambiguous() {
|
||||
// Rustdoc normalizes possibly not well-formed types, so only
|
||||
|
@ -294,8 +297,8 @@ impl<'cx, 'tcx> FallibleTypeFolder<TyCtxt<'tcx>> for QueryNormalizer<'cx, 'tcx>
|
|||
}
|
||||
return Err(NoSolution);
|
||||
}
|
||||
let InferOk { value: result, obligations } =
|
||||
self.infcx.instantiate_query_response_and_region_obligations(
|
||||
let InferOk { value: result, obligations } = infcx
|
||||
.instantiate_query_response_and_region_obligations(
|
||||
self.cause,
|
||||
self.param_env,
|
||||
&orig_values,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue