Skip to content

Commit c84b781

Browse files
nikomatsakisleoyvens
authored andcommitted
add a comment
1 parent a7c7c8a commit c84b781

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/librustc_typeck/check/wfcheck.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,9 @@ impl<'a, 'gcx> CheckTypeWellFormedVisitor<'a, 'gcx> {
370370
// Here the default `Vec<[u32]>` is not WF because `[u32]: Sized` does not hold.
371371
for d in generics.types.iter().cloned().filter(is_our_default).map(|p| p.def_id) {
372372
let ty = fcx.tcx.type_of(d);
373+
// ignore dependent defaults -- that is, where the default of one type
374+
// parameter includes another (e.g., <T, U = T>). In those cases, we can't
375+
// be sure if it will error or not as user might always specify the other.
373376
if !ty.needs_subst() {
374377
fcx.register_wf_obligation(ty, fcx.tcx.def_span(d), self.code.clone());
375378
}

0 commit comments

Comments
 (0)