Skip to content

Commit 98d5db3

Browse files
nikomatsakischrisvittal
authored andcommitted
add a new test featuring two impl traits to show what it looks like
1 parent 337dee4 commit 98d5db3

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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, y: impl Debug) -> String {
16+
let mut a = x;
17+
a = y;
18+
format!("{:?}", a)
19+
}
20+
21+
fn main() { }
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
error[E0308]: mismatched types
2+
--> $DIR/universal-two-impl-traits.rs:17:9
3+
|
4+
17 | a = y;
5+
| ^ expected type parameter, found a different type parameter
6+
|
7+
= note: expected type `impl Debug` (type parameter)
8+
found type `impl Debug` (type parameter)
9+
10+
error: aborting due to previous error
11+

0 commit comments

Comments
 (0)