diff options
Diffstat (limited to 'tests/ui/fn')
-rw-r--r-- | tests/ui/fn/fn-ptr-trait-int-float-infer-var.rs | 10 | ||||
-rw-r--r-- | tests/ui/fn/fn-ptr-trait.rs | 9 | ||||
-rw-r--r-- | tests/ui/fn/issue-39259.rs | 13 | ||||
-rw-r--r-- | tests/ui/fn/issue-39259.stderr | 15 |
4 files changed, 47 insertions, 0 deletions
diff --git a/tests/ui/fn/fn-ptr-trait-int-float-infer-var.rs b/tests/ui/fn/fn-ptr-trait-int-float-infer-var.rs new file mode 100644 index 000000000..eec7da044 --- /dev/null +++ b/tests/ui/fn/fn-ptr-trait-int-float-infer-var.rs @@ -0,0 +1,10 @@ +// check-pass +trait MyCmp { + fn cmp(&self) {} +} +impl MyCmp for f32 {} + +fn main() { + // Ensure that `impl<F: FnPtr> Ord for F` is never considered for int and float infer vars. + 0.0.cmp(); +} diff --git a/tests/ui/fn/fn-ptr-trait.rs b/tests/ui/fn/fn-ptr-trait.rs new file mode 100644 index 000000000..45918ae5b --- /dev/null +++ b/tests/ui/fn/fn-ptr-trait.rs @@ -0,0 +1,9 @@ +#![feature(fn_ptr_trait)] +// check-pass + +use std::marker::FnPtr; + +trait Foo {} +impl<T> Foo for Vec<T> where T: FnPtr {} + +fn main() {} diff --git a/tests/ui/fn/issue-39259.rs b/tests/ui/fn/issue-39259.rs new file mode 100644 index 000000000..5872f1007 --- /dev/null +++ b/tests/ui/fn/issue-39259.rs @@ -0,0 +1,13 @@ +#![feature(fn_traits)] +#![feature(unboxed_closures)] + +struct S; + +impl Fn(u32) -> u32 for S { +//~^ ERROR associated type bindings are not allowed here [E0229] + fn call(&self) -> u32 { + 5 + } +} + +fn main() {} diff --git a/tests/ui/fn/issue-39259.stderr b/tests/ui/fn/issue-39259.stderr new file mode 100644 index 000000000..b656b76bf --- /dev/null +++ b/tests/ui/fn/issue-39259.stderr @@ -0,0 +1,15 @@ +error[E0229]: associated type bindings are not allowed here + --> $DIR/issue-39259.rs:6:17 + | +LL | impl Fn(u32) -> u32 for S { + | ^^^ associated type not allowed here + | +help: parenthesized trait syntax expands to `Fn<(u32,), Output=u32>` + --> $DIR/issue-39259.rs:6:6 + | +LL | impl Fn(u32) -> u32 for S { + | ^^^^^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0229`. |