Skip to content

Commit

Permalink
coerce reborrow multi arg test
Browse files Browse the repository at this point in the history
  • Loading branch information
lcnr committed Jun 19, 2020
1 parent 9b47586 commit 06a237f
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/test/ui/coercion/coerce-reborrow-multi-arg-fail.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
fn test<T>(_a: T, _b: T) {}

fn main() {
test(&mut 7, &7);
//~^ mismatched types
}
12 changes: 12 additions & 0 deletions src/test/ui/coercion/coerce-reborrow-multi-arg-fail.stderr
Original file line number Diff line number Diff line change
@@ -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`.
9 changes: 9 additions & 0 deletions src/test/ui/coercion/coerce-reborrow-multi-arg.rs
Original file line number Diff line number Diff line change
@@ -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);
}

0 comments on commit 06a237f

Please sign in to comment.