mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-30 02:33:55 +00:00
test our some of the various combinations of fn subtyping
This commit is contained in:
parent
5b8abec92f
commit
dca11e1f99
@ -18,5 +18,19 @@ fn assign_to_unsafe(x: pure fn(), y: fn(), z: unsafe fn()) {
|
||||
let o: unsafe fn() = z;
|
||||
}
|
||||
|
||||
fn assign_to_pure2(x: pure fn@(), y: fn@(), z: unsafe fn@()) {
|
||||
let a: pure fn() = x;
|
||||
let b: pure fn() = y; //! ERROR expected pure fn but found impure fn
|
||||
let c: pure fn() = z; //! ERROR expected pure fn but found unsafe fn
|
||||
|
||||
let a: pure fn~() = x; //! ERROR closure protocol mismatch (fn~ vs fn@)
|
||||
let b: pure fn~() = y; //! ERROR closure protocol mismatch (fn~ vs fn@)
|
||||
let c: pure fn~() = z; //! ERROR closure protocol mismatch (fn~ vs fn@)
|
||||
|
||||
let a: unsafe fn~() = x; //! ERROR closure protocol mismatch (fn~ vs fn@)
|
||||
let b: unsafe fn~() = y; //! ERROR closure protocol mismatch (fn~ vs fn@)
|
||||
let c: unsafe fn~() = z; //! ERROR closure protocol mismatch (fn~ vs fn@)
|
||||
}
|
||||
|
||||
fn main() {
|
||||
}
|
Loading…
Reference in New Issue
Block a user