Skip to content

Commit 8989029

Browse files
committed
borrow_check/type_check: normalize Aggregate and Call operands.
1 parent ad1617b commit 8989029

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

src/librustc_mir/borrow_check/type_check/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1760,6 +1760,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
17601760
}
17611761
for (n, (fn_arg, op_arg)) in sig.inputs().iter().zip(args).enumerate() {
17621762
let op_arg_ty = op_arg.ty(body, self.tcx());
1763+
let op_arg_ty = self.normalize(op_arg_ty, term_location);
17631764
let category = if from_hir_call {
17641765
ConstraintCategory::CallArgument
17651766
} else {
@@ -2402,6 +2403,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
24022403
}
24032404
};
24042405
let operand_ty = operand.ty(body, tcx);
2406+
let operand_ty = self.normalize(operand_ty, location);
24052407

24062408
if let Err(terr) = self.sub_types(
24072409
operand_ty,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// run-pass
2+
3+
const HASH_LEN: usize = 20;
4+
struct Hash([u8; HASH_LEN]);
5+
fn init_hash(_: &mut [u8; HASH_LEN]) {}
6+
7+
fn foo<'a>() -> &'a () {
8+
Hash([0; HASH_LEN]);
9+
init_hash(&mut [0; HASH_LEN]);
10+
&()
11+
}
12+
13+
fn main() {
14+
foo();
15+
}

0 commit comments

Comments
 (0)