Skip to content

Commit 06a237f

Browse files
committed
coerce reborrow multi arg test
1 parent 9b47586 commit 06a237f

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
fn test<T>(_a: T, _b: T) {}
2+
3+
fn main() {
4+
test(&mut 7, &7);
5+
//~^ mismatched types
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
error[E0308]: mismatched types
2+
--> $DIR/coerce-reborrow-multi-arg-fail.rs:4:18
3+
|
4+
LL | test(&mut 7, &7);
5+
| ^^ types differ in mutability
6+
|
7+
= note: expected mutable reference `&mut {integer}`
8+
found reference `&{integer}`
9+
10+
error: aborting due to previous error
11+
12+
For more information about this error, try `rustc --explain E0308`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// build-pass
2+
fn test<T>(_a: T, _b: T) {}
3+
4+
fn main() {
5+
test(&7, &7);
6+
test(&7, &mut 7);
7+
test::<&i32>(&mut 7, &7);
8+
test::<&i32>(&mut 7, &mut 7);
9+
}

0 commit comments

Comments
 (0)