Skip to content

Commit 15001ee

Browse files
nikomatsakischrisvittal
authored andcommitted
add a UI test showing the current output from an impl trait type
1 parent 9d71bf6 commit 15001ee

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright 2017 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(universal_impl_trait)]
12+
13+
use std::fmt::Debug;
14+
15+
fn foo(x: impl Debug) -> String {
16+
x
17+
}
18+
19+
fn main() { }
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
error[E0308]: mismatched types
2+
--> $DIR/universal-mismatched-type.rs:16:5
3+
|
4+
15 | fn foo(x: impl Debug) -> String {
5+
| ------ expected `std::string::String` because of return type
6+
16 | x
7+
| ^ expected struct `std::string::String`, found type parameter
8+
|
9+
= note: expected type `std::string::String`
10+
found type ``
11+
12+
error: aborting due to previous error
13+

0 commit comments

Comments
 (0)