Skip to content

Commit 7dead92

Browse files
nits
1 parent 455b439 commit 7dead92

File tree

5 files changed

+11
-17
lines changed

5 files changed

+11
-17
lines changed

compiler/rustc_hir_typeck/src/closure.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
100100

101101
// Create a type variable (for now) to represent the closure kind.
102102
// It will be unified during the upvar inference phase (`upvar.rs`)
103-
None => self.next_ty_var(TypeVariableOrigin {
104-
// FIXME(eddyb) distinguish closure kind inference variables from the rest.
105-
param_def_id: None,
106-
span: expr_span,
107-
}),
103+
None => {
104+
self.next_ty_var(TypeVariableOrigin { param_def_id: None, span: expr_span })
105+
}
108106
};
109107

110108
let closure_args = ty::ClosureArgs::new(

compiler/rustc_hir_typeck/src/pat.rs

+2-7
Original file line numberDiff line numberDiff line change
@@ -1365,13 +1365,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
13651365
}
13661366
let max_len = cmp::max(expected_len, elements.len());
13671367

1368-
let element_tys_iter = (0..max_len).map(|_| {
1369-
self.next_ty_var(
1370-
// FIXME: `MiscVariable` for now -- obtaining the span and name information
1371-
// from all tuple elements isn't trivial.
1372-
TypeVariableOrigin { param_def_id: None, span },
1373-
)
1374-
});
1368+
let element_tys_iter =
1369+
(0..max_len).map(|_| self.next_ty_var(TypeVariableOrigin { param_def_id: None, span }));
13751370
let element_tys = tcx.mk_type_list_from_iter(element_tys_iter);
13761371
let pat_ty = Ty::new_tup(tcx, element_tys);
13771372
if let Some(err) = self.demand_eqtype_pat_diag(span, expected, pat_ty, pat_info.top_info) {

compiler/rustc_infer/src/infer/opaque_types/mod.rs

-3
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,6 @@ impl<'tcx> InferCtxt<'tcx> {
6969
let span = if span.contains(def_span) { def_span } else { span };
7070
let code = traits::ObligationCauseCode::OpaqueReturnType(None);
7171
let cause = ObligationCause::new(span, body_id, code);
72-
// FIXME(compiler-errors): We probably should add a new TypeVariableOriginKind
73-
// for opaque types, and then use that kind to fix the spans for type errors
74-
// that we see later on.
7572
let ty_var = self.next_ty_var(TypeVariableOrigin { param_def_id: None, span });
7673
obligations.extend(
7774
self.handle_opaque_type(ty, ty_var, &cause, param_env).unwrap().obligations,

compiler/rustc_infer/src/infer/type_variable.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ pub struct TypeVariableTable<'a, 'tcx> {
3737
#[derive(Copy, Clone, Debug)]
3838
pub struct TypeVariableOrigin {
3939
pub span: Span,
40-
// `DefId` of the type parameter this was instantiated for, if any.
40+
/// `DefId` of the type parameter this was instantiated for, if any.
41+
///
42+
/// This should only be used for diagnostics.
4143
pub param_def_id: Option<DefId>,
4244
}
4345

compiler/rustc_middle/src/infer/unify_key.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,9 @@ impl ToType for ty::FloatVarValue {
106106
#[derive(Copy, Clone, Debug)]
107107
pub struct ConstVariableOrigin {
108108
pub span: Span,
109-
// `DefId` of the const parameter this was instantiated for, if any.
109+
/// `DefId` of the const parameter this was instantiated for, if any.
110+
///
111+
/// This should only be used for diagnostics.
110112
pub param_def_id: Option<DefId>,
111113
}
112114

0 commit comments

Comments
 (0)