Skip to content

Commit 3d9cf30

Browse files
committed
More robust testing
1 parent 07e6e81 commit 3d9cf30

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

src/test/compile-fail/issue-35869.rs

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
#![feature(conservative_impl_trait)]
12+
13+
trait Foo {
14+
fn foo(fn(u8) -> ()); //~ NOTE type in trait
15+
fn bar(Option<u8>); //~ NOTE type in trait
16+
fn baz((u8, u16)); //~ NOTE type in trait
17+
fn qux() -> u8; //~ NOTE type in trait
18+
}
19+
20+
struct Bar;
21+
22+
impl Foo for Bar {
23+
fn foo(_: fn(u16) -> ()) {}
24+
//~^ ERROR method `foo` has an incompatible type for trait
25+
//~| NOTE expected u8
26+
fn bar(_: Option<u16>) {}
27+
//~^ ERROR method `bar` has an incompatible type for trait
28+
//~| NOTE expected u8
29+
fn baz(_: (u16, u16)) {}
30+
//~^ ERROR method `baz` has an incompatible type for trait
31+
//~| NOTE expected u8
32+
fn qux() -> u16 { 5u16 }
33+
//~^ ERROR method `qux` has an incompatible type for trait
34+
//~| NOTE expected u8
35+
}
36+
37+
fn main() {}

0 commit comments

Comments
 (0)