diff --git a/compiler/rustc_hir_typeck/src/closure.rs b/compiler/rustc_hir_typeck/src/closure.rs index 7037f1fde73b4..40b12fd84f4cd 100644 --- a/compiler/rustc_hir_typeck/src/closure.rs +++ b/compiler/rustc_hir_typeck/src/closure.rs @@ -100,11 +100,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // Create a type variable (for now) to represent the closure kind. // It will be unified during the upvar inference phase (`upvar.rs`) - None => self.next_ty_var(TypeVariableOrigin { - // FIXME(eddyb) distinguish closure kind inference variables from the rest. - param_def_id: None, - span: expr_span, - }), + None => { + self.next_ty_var(TypeVariableOrigin { param_def_id: None, span: expr_span }) + } }; let closure_args = ty::ClosureArgs::new( @@ -217,11 +215,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { self.next_ty_var(TypeVariableOrigin { param_def_id: None, span: expr_span }); let interior = self.next_ty_var(TypeVariableOrigin { param_def_id: None, span: expr_span }); - let closure_kind_ty = self.next_ty_var(TypeVariableOrigin { - // FIXME(eddyb) distinguish closure kind inference variables from the rest. - param_def_id: None, - span: expr_span, - }); + let closure_kind_ty = + self.next_ty_var(TypeVariableOrigin { param_def_id: None, span: expr_span }); let coroutine_captures_by_ref_ty = self.next_ty_var(TypeVariableOrigin { param_def_id: None, span: expr_span }); let closure_args = ty::CoroutineClosureArgs::new( diff --git a/compiler/rustc_hir_typeck/src/pat.rs b/compiler/rustc_hir_typeck/src/pat.rs index a38bf5b2b7938..b63cb86117ff4 100644 --- a/compiler/rustc_hir_typeck/src/pat.rs +++ b/compiler/rustc_hir_typeck/src/pat.rs @@ -1340,13 +1340,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } let max_len = cmp::max(expected_len, elements.len()); - let element_tys_iter = (0..max_len).map(|_| { - self.next_ty_var( - // FIXME: `MiscVariable` for now -- obtaining the span and name information - // from all tuple elements isn't trivial. - TypeVariableOrigin { param_def_id: None, span }, - ) - }); + let element_tys_iter = + (0..max_len).map(|_| self.next_ty_var(TypeVariableOrigin { param_def_id: None, span })); let element_tys = tcx.mk_type_list_from_iter(element_tys_iter); let pat_ty = Ty::new_tup(tcx, element_tys); if let Some(err) = self.demand_eqtype_pat_diag(span, expected, pat_ty, pat_info.top_info) { diff --git a/compiler/rustc_infer/src/infer/opaque_types/mod.rs b/compiler/rustc_infer/src/infer/opaque_types/mod.rs index 6f095ad45d95b..ae3bd132100a1 100644 --- a/compiler/rustc_infer/src/infer/opaque_types/mod.rs +++ b/compiler/rustc_infer/src/infer/opaque_types/mod.rs @@ -69,9 +69,6 @@ impl<'tcx> InferCtxt<'tcx> { let span = if span.contains(def_span) { def_span } else { span }; let code = traits::ObligationCauseCode::OpaqueReturnType(None); let cause = ObligationCause::new(span, body_id, code); - // FIXME(compiler-errors): We probably should add a new TypeVariableOriginKind - // for opaque types, and then use that kind to fix the spans for type errors - // that we see later on. let ty_var = self.next_ty_var(TypeVariableOrigin { param_def_id: None, span }); obligations.extend( self.handle_opaque_type(ty, ty_var, &cause, param_env).unwrap().obligations, diff --git a/compiler/rustc_infer/src/infer/type_variable.rs b/compiler/rustc_infer/src/infer/type_variable.rs index e6cc950ab25b0..96afa257ebbad 100644 --- a/compiler/rustc_infer/src/infer/type_variable.rs +++ b/compiler/rustc_infer/src/infer/type_variable.rs @@ -37,7 +37,9 @@ pub struct TypeVariableTable<'a, 'tcx> { #[derive(Copy, Clone, Debug)] pub struct TypeVariableOrigin { pub span: Span, - // `DefId` of the type parameter this was instantiated for, if any. + /// `DefId` of the type parameter this was instantiated for, if any. + /// + /// This should only be used for diagnostics. pub param_def_id: Option, } diff --git a/compiler/rustc_middle/src/infer/unify_key.rs b/compiler/rustc_middle/src/infer/unify_key.rs index 5280acd72ce7d..105be21f27279 100644 --- a/compiler/rustc_middle/src/infer/unify_key.rs +++ b/compiler/rustc_middle/src/infer/unify_key.rs @@ -106,7 +106,9 @@ impl ToType for ty::FloatVarValue { #[derive(Copy, Clone, Debug)] pub struct ConstVariableOrigin { pub span: Span, - // `DefId` of the const parameter this was instantiated for, if any. + /// `DefId` of the const parameter this was instantiated for, if any. + /// + /// This should only be used for diagnostics. pub param_def_id: Option, }