mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-04 19:29:07 +00:00
coerce reborrow multi arg test
This commit is contained in:
parent
9b47586a47
commit
06a237fe2c
6
src/test/ui/coercion/coerce-reborrow-multi-arg-fail.rs
Normal file
6
src/test/ui/coercion/coerce-reborrow-multi-arg-fail.rs
Normal file
@ -0,0 +1,6 @@
|
||||
fn test<T>(_a: T, _b: T) {}
|
||||
|
||||
fn main() {
|
||||
test(&mut 7, &7);
|
||||
//~^ mismatched types
|
||||
}
|
12
src/test/ui/coercion/coerce-reborrow-multi-arg-fail.stderr
Normal file
12
src/test/ui/coercion/coerce-reborrow-multi-arg-fail.stderr
Normal 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`.
|
9
src/test/ui/coercion/coerce-reborrow-multi-arg.rs
Normal file
9
src/test/ui/coercion/coerce-reborrow-multi-arg.rs
Normal 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);
|
||||
}
|
Loading…
Reference in New Issue
Block a user