Lower RPITIT to ImplTraitPlaceholder item
This commit is contained in:
@@ -2,6 +2,7 @@ use crate::traits::{ObligationCause, ObligationCauseCode};
|
||||
use crate::ty::diagnostics::suggest_constraining_type_param;
|
||||
use crate::ty::print::{FmtPrinter, Printer};
|
||||
use crate::ty::{self, BoundRegionKind, Region, Ty, TyCtxt};
|
||||
use hir::def::DefKind;
|
||||
use rustc_errors::Applicability::{MachineApplicable, MaybeIncorrect};
|
||||
use rustc_errors::{pluralize, Diagnostic, MultiSpan};
|
||||
use rustc_hir as hir;
|
||||
@@ -538,7 +539,7 @@ impl<T> Trait<T> for X {
|
||||
diag.span_label(p_span, "this type parameter");
|
||||
}
|
||||
}
|
||||
(ty::Projection(proj_ty), _) => {
|
||||
(ty::Projection(proj_ty), _) if self.def_kind(proj_ty.item_def_id) != DefKind::ImplTraitPlaceholder => {
|
||||
self.expected_projection(
|
||||
diag,
|
||||
proj_ty,
|
||||
@@ -547,7 +548,7 @@ impl<T> Trait<T> for X {
|
||||
cause.code(),
|
||||
);
|
||||
}
|
||||
(_, ty::Projection(proj_ty)) => {
|
||||
(_, ty::Projection(proj_ty)) if self.def_kind(proj_ty.item_def_id) != DefKind::ImplTraitPlaceholder => {
|
||||
let msg = format!(
|
||||
"consider constraining the associated type `{}` to `{}`",
|
||||
values.found, values.expected,
|
||||
|
||||
@@ -11,6 +11,7 @@ use crate::ty::{
|
||||
TypeVisitor,
|
||||
};
|
||||
use crate::ty::{List, ParamEnv};
|
||||
use hir::def::DefKind;
|
||||
use polonius_engine::Atom;
|
||||
use rustc_data_structures::captures::Captures;
|
||||
use rustc_data_structures::intern::Interned;
|
||||
@@ -1196,7 +1197,9 @@ pub struct ProjectionTy<'tcx> {
|
||||
|
||||
impl<'tcx> ProjectionTy<'tcx> {
|
||||
pub fn trait_def_id(&self, tcx: TyCtxt<'tcx>) -> DefId {
|
||||
tcx.parent(self.item_def_id)
|
||||
let parent = tcx.parent(self.item_def_id);
|
||||
assert_eq!(tcx.def_kind(parent), DefKind::Trait);
|
||||
parent
|
||||
}
|
||||
|
||||
/// Extracts the underlying trait reference and own substs from this projection.
|
||||
|
||||
Reference in New Issue
Block a user