diff options
| author | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2022-02-09 16:44:17 +0000 |
|---|---|---|
| committer | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2022-03-28 16:30:59 +0000 |
| commit | d5b6510bfb8484a964428fe44e2a66eebb15e66e (patch) | |
| tree | 955ae88047b6109822e7734ee2a98d509c341787 /compiler/rustc_trait_selection/src | |
| parent | 4b249b062bea6c3ed81e605ccac852ca8ad60986 (diff) | |
| download | rust-d5b6510bfb8484a964428fe44e2a66eebb15e66e.tar.gz rust-d5b6510bfb8484a964428fe44e2a66eebb15e66e.zip | |
Have the spans of TAIT type conflict errors point to the actual site instead of the owning function
Diffstat (limited to 'compiler/rustc_trait_selection/src')
| -rw-r--r-- | compiler/rustc_trait_selection/src/opaque_types.rs | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/compiler/rustc_trait_selection/src/opaque_types.rs b/compiler/rustc_trait_selection/src/opaque_types.rs index c5531222fef..eb70de48368 100644 --- a/compiler/rustc_trait_selection/src/opaque_types.rs +++ b/compiler/rustc_trait_selection/src/opaque_types.rs @@ -5,15 +5,14 @@ use rustc_infer::infer::error_reporting::unexpected_hidden_region_diagnostic; use rustc_infer::infer::InferCtxt; use rustc_middle::ty::fold::{TypeFoldable, TypeFolder}; use rustc_middle::ty::subst::{GenericArg, GenericArgKind, InternalSubsts}; -use rustc_middle::ty::{self, OpaqueTypeKey, Ty, TyCtxt}; +use rustc_middle::ty::{self, OpaqueHiddenType, OpaqueTypeKey, Ty, TyCtxt}; use rustc_span::Span; pub trait InferCtxtExt<'tcx> { fn infer_opaque_definition_from_instantiation( &self, opaque_type_key: OpaqueTypeKey<'tcx>, - instantiated_ty: Ty<'tcx>, - span: Span, + instantiated_ty: OpaqueHiddenType<'tcx>, ) -> Ty<'tcx>; } @@ -45,8 +44,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { fn infer_opaque_definition_from_instantiation( &self, opaque_type_key: OpaqueTypeKey<'tcx>, - instantiated_ty: Ty<'tcx>, - span: Span, + instantiated_ty: OpaqueHiddenType<'tcx>, ) -> Ty<'tcx> { if self.is_tainted_by_errors() { return self.tcx.ty_error(); @@ -69,12 +67,12 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { // Convert the type from the function into a type valid outside // the function, by replacing invalid regions with 'static, // after producing an error for each of them. - let definition_ty = instantiated_ty.fold_with(&mut ReverseMapper::new( + let definition_ty = instantiated_ty.ty.fold_with(&mut ReverseMapper::new( self.tcx, def_id, map, - instantiated_ty, - span, + instantiated_ty.ty, + instantiated_ty.span, )); debug!(?definition_ty); |
