coerce reborrow multi arg test

This commit is contained in:
Bastian Kauschke 2020-05-30 20:54:14 +02:00
parent 9b47586a47
commit 06a237fe2c
3 changed files with 27 additions and 0 deletions

View File

@ -0,0 +1,6 @@
fn test<T>(_a: T, _b: T) {}
fn main() {
test(&mut 7, &7);
//~^ mismatched types
}

View File

@ -0,0 +1,12 @@
error[E0308]: mismatched types
--> $DIR/coerce-reborrow-multi-arg-fail.rs:4:18
|
LL | test(&mut 7, &7);
| ^^ types differ in mutability
|
= note: expected mutable reference `&mut {integer}`
found reference `&{integer}`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0308`.

View File

@ -0,0 +1,9 @@
// build-pass
fn test<T>(_a: T, _b: T) {}
fn main() {
test(&7, &7);
test(&7, &mut 7);
test::<&i32>(&mut 7, &7);
test::<&i32>(&mut 7, &mut 7);
}