diff options
| author | Michael Goulet <michael@errs.io> | 2024-02-03 18:39:24 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2024-02-07 22:57:06 +0000 |
| commit | 1d74589facef77f9f72b5d7a9917a174ca30c2c8 (patch) | |
| tree | 091be2e21a2353367d470b34f16267a8c1cc1c9e | |
| parent | 8ace7ea1f7cbba7b4f031e66c54ca237a0d65de6 (diff) | |
| download | rust-1d74589facef77f9f72b5d7a9917a174ca30c2c8.tar.gz rust-1d74589facef77f9f72b5d7a9917a174ca30c2c8.zip | |
Assert that ParamTy and ParamConst have identical names for identical indices
| -rw-r--r-- | compiler/rustc_middle/src/ty/relate.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/compiler/rustc_middle/src/ty/relate.rs b/compiler/rustc_middle/src/ty/relate.rs index f2321e7e1d2..29d5e5b2b9b 100644 --- a/compiler/rustc_middle/src/ty/relate.rs +++ b/compiler/rustc_middle/src/ty/relate.rs @@ -435,7 +435,10 @@ pub fn structurally_relate_tys<'tcx, R: TypeRelation<'tcx>>( Ok(a) } - (ty::Param(a_p), ty::Param(b_p)) if a_p.index == b_p.index => Ok(a), + (ty::Param(a_p), ty::Param(b_p)) if a_p.index == b_p.index => { + debug_assert_eq!(a_p.name, b_p.name, "param types with same index differ in name"); + Ok(a) + }, (ty::Placeholder(p1), ty::Placeholder(p2)) if p1 == p2 => Ok(a), @@ -593,7 +596,10 @@ pub fn structurally_relate_consts<'tcx, R: TypeRelation<'tcx>>( (ty::ConstKind::Error(_), _) => return Ok(a), (_, ty::ConstKind::Error(_)) => return Ok(b), - (ty::ConstKind::Param(a_p), ty::ConstKind::Param(b_p)) => a_p.index == b_p.index, + (ty::ConstKind::Param(a_p), ty::ConstKind::Param(b_p)) if a_p.index == b_p.index => { + debug_assert_eq!(a_p.name, b_p.name, "param types with same index differ in name"); + true + } (ty::ConstKind::Placeholder(p1), ty::ConstKind::Placeholder(p2)) => p1 == p2, (ty::ConstKind::Value(a_val), ty::ConstKind::Value(b_val)) => a_val == b_val, |
