diff options
| author | Christopher Vittal <christopher.vittal@gmail.com> | 2017-11-10 13:02:06 -0500 |
|---|---|---|
| committer | Christopher Vittal <christopher.vittal@gmail.com> | 2017-11-15 15:46:01 -0500 |
| commit | 06dff800614cab4e662ace032a2e61568db8bbdf (patch) | |
| tree | 3ad71f55d103de486295c360751e24919a05c917 /src/test/compile-fail/impl-trait/impl-generic-mismatch.rs | |
| parent | bdff9463a0afbbdcd52825ead6b6f9f1245652db (diff) | |
| download | rust-06dff800614cab4e662ace032a2e61568db8bbdf.tar.gz rust-06dff800614cab4e662ace032a2e61568db8bbdf.zip | |
Add/Modify tests for argument position impl Trait
Diffstat (limited to 'src/test/compile-fail/impl-trait/impl-generic-mismatch.rs')
| -rw-r--r-- | src/test/compile-fail/impl-trait/impl-generic-mismatch.rs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/test/compile-fail/impl-trait/impl-generic-mismatch.rs b/src/test/compile-fail/impl-trait/impl-generic-mismatch.rs new file mode 100644 index 00000000000..41583d3b795 --- /dev/null +++ b/src/test/compile-fail/impl-trait/impl-generic-mismatch.rs @@ -0,0 +1,32 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(universal_impl_trait)] +use std::fmt::Debug; + +trait Foo { + fn foo(&self, &impl Debug); +} + +impl Foo for () { + fn foo<U: Debug>(&self, _: &U) { } + //~^ Error method `foo` has incompatible signature for trait +} + +trait Bar { + fn bar<U: Debug>(&self, &U); +} + +impl Bar for () { + fn bar(&self, _: &impl Debug) { } + //~^ Error method `bar` has incompatible signature for trait +} + +fn main() {} |
