Skip to content

Commit e5992e7

Browse files
committed
Fix Sized requirement for empty tuples in program_clauses
1 parent dfcad82 commit e5992e7

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/librustc_traits/chalk_context/program_clauses.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,10 @@ fn wf_clause_for_tuple<'tcx>(
280280
Some(def_id) => def_id,
281281
None => return ty::List::empty(),
282282
};
283-
let sized_implemented = type_list[0..arity - 1].iter()
283+
284+
// If `arity == 0` (i.e. the unit type) or `arity == 1`, this list of
285+
// hypotheses is actually empty.
286+
let sized_implemented = type_list[0 .. std::cmp::max(arity, 1) - 1].iter()
284287
.map(|ty| ty::TraitRef {
285288
def_id: sized_trait,
286289
substs: tcx.mk_substs_trait(*ty, ty::List::empty()),

0 commit comments

Comments
 (0)