Skip to content

Commit da09a03

Browse files
committed
rustc: Remove a few kludges intended to work around rustboot's lack of structural comparison from equal_type_structures()
1 parent 6953841 commit da09a03

File tree

1 file changed

+4
-74
lines changed

1 file changed

+4
-74
lines changed

src/comp/middle/ty.rs

Lines changed: 4 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,78 +1160,8 @@ fn hash_ty(&t typ) -> uint { ret typ.hash; }
11601160
// Type equality. This function is private to this module (and slow); external
11611161
// users should use `eq_ty()` instead.
11621162
fn equal_type_structures(&sty a, &sty b) -> bool {
1163-
1164-
fn equal_proto(ast.proto a, ast.proto b) -> bool {
1165-
alt (a) {
1166-
case (ast.proto_iter) {
1167-
alt (b) {
1168-
case (ast.proto_iter) { ret true; }
1169-
case (_) { ret false; }
1170-
}
1171-
}
1172-
case (ast.proto_fn) {
1173-
alt (b) {
1174-
case (ast.proto_fn) { ret true; }
1175-
case (_) { ret false; }
1176-
}
1177-
}
1178-
}
1179-
}
1180-
1181-
fn equal_abi(ast.native_abi a, ast.native_abi b) -> bool {
1182-
alt (a) {
1183-
case (ast.native_abi_rust) {
1184-
alt (b) {
1185-
case (ast.native_abi_rust) { ret true; }
1186-
case (_) { ret false; }
1187-
}
1188-
}
1189-
case (ast.native_abi_rust_intrinsic) {
1190-
alt (b) {
1191-
case (ast.native_abi_rust_intrinsic) { ret true; }
1192-
case (_) { ret false; }
1193-
}
1194-
}
1195-
case (ast.native_abi_cdecl) {
1196-
alt (b) {
1197-
case (ast.native_abi_cdecl) { ret true; }
1198-
case (_) { ret false; }
1199-
}
1200-
}
1201-
case (ast.native_abi_llvm) {
1202-
alt (b) {
1203-
case (ast.native_abi_llvm) { ret true; }
1204-
case (_) { ret false; }
1205-
}
1206-
}
1207-
}
1208-
}
1209-
1210-
fn equal_mut(ast.mutability a, ast.mutability b) -> bool {
1211-
alt (a) {
1212-
case (ast.mut) {
1213-
alt (b) {
1214-
case (ast.mut) { ret true; }
1215-
case (_) { ret false; }
1216-
}
1217-
}
1218-
case (ast.imm) {
1219-
alt (b) {
1220-
case (ast.imm) { ret true; }
1221-
case (_) { ret false; }
1222-
}
1223-
}
1224-
case (ast.maybe_mut) {
1225-
alt (b) {
1226-
case (ast.maybe_mut) { ret true; }
1227-
case (_) { ret false; }
1228-
}
1229-
}
1230-
}
1231-
}
1232-
12331163
fn equal_mt(&mt a, &mt b) -> bool {
1234-
ret equal_mut(a.mut, b.mut) && eq_ty(a.ty, b.ty);
1164+
ret a.mut == b.mut && eq_ty(a.ty, b.ty);
12351165
}
12361166

12371167
fn equal_fn(&vec[arg] args_a, &t rty_a,
@@ -1390,7 +1320,7 @@ fn equal_type_structures(&sty a, &sty b) -> bool {
13901320
case (ty_fn(?p_a, ?args_a, ?rty_a)) {
13911321
alt (b) {
13921322
case (ty_fn(?p_b, ?args_b, ?rty_b)) {
1393-
ret equal_proto(p_a, p_b) &&
1323+
ret p_a == p_b &&
13941324
equal_fn(args_a, rty_a, args_b, rty_b);
13951325
}
13961326
case (_) { ret false; }
@@ -1399,7 +1329,7 @@ fn equal_type_structures(&sty a, &sty b) -> bool {
13991329
case (ty_native_fn(?abi_a, ?args_a, ?rty_a)) {
14001330
alt (b) {
14011331
case (ty_native_fn(?abi_b, ?args_b, ?rty_b)) {
1402-
ret equal_abi(abi_a, abi_b) &&
1332+
ret abi_a == abi_b &&
14031333
equal_fn(args_a, rty_a, args_b, rty_b);
14041334
}
14051335
case (_) { ret false; }
@@ -1413,7 +1343,7 @@ fn equal_type_structures(&sty a, &sty b) -> bool {
14131343
auto i = 0u;
14141344
while (i < len) {
14151345
auto m_a = methods_a.(i); auto m_b = methods_b.(i);
1416-
if (!equal_proto(m_a.proto, m_b.proto) ||
1346+
if (m_a.proto != m_b.proto ||
14171347
!Str.eq(m_a.ident, m_b.ident) ||
14181348
!equal_fn(m_a.inputs, m_a.output,
14191349
m_b.inputs, m_b.output)) {

0 commit comments

Comments
 (0)