diff options
| author | Michael Goulet <michael@errs.io> | 2024-03-31 17:20:00 -0400 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2024-04-01 21:41:45 -0400 |
| commit | f2fd2d8c7080f7a7d770b3e3d27e525250c182dc (patch) | |
| tree | 02db689562087e79eef4cf86a588ed5c32ca7c89 /compiler/rustc_hir_analysis/src/bounds.rs | |
| parent | dd5e502d4b095be205c07da1481846f0a07c43b4 (diff) | |
| download | rust-f2fd2d8c7080f7a7d770b3e3d27e525250c182dc.tar.gz rust-f2fd2d8c7080f7a7d770b3e3d27e525250c182dc.zip | |
Make sure to insert Sized bound first into clauses list
Diffstat (limited to 'compiler/rustc_hir_analysis/src/bounds.rs')
| -rw-r--r-- | compiler/rustc_hir_analysis/src/bounds.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/compiler/rustc_hir_analysis/src/bounds.rs b/compiler/rustc_hir_analysis/src/bounds.rs index d5465bb5dd5..d3f51195dfb 100644 --- a/compiler/rustc_hir_analysis/src/bounds.rs +++ b/compiler/rustc_hir_analysis/src/bounds.rs @@ -54,14 +54,20 @@ impl<'tcx> Bounds<'tcx> { span: Span, polarity: ty::PredicatePolarity, ) { - self.clauses.push(( + let clause = ( trait_ref .map_bound(|trait_ref| { ty::ClauseKind::Trait(ty::TraitPredicate { trait_ref, polarity }) }) .to_predicate(tcx), span, - )); + ); + // FIXME(-Znext-solver): We can likely remove this hack once the new trait solver lands. + if tcx.lang_items().sized_trait() == Some(trait_ref.def_id()) { + self.clauses.insert(0, clause); + } else { + self.clauses.push(clause); + } } pub fn push_projection_bound( |
