]>
git.proxmox.com Git - rustc.git/blob - src/test/run-pass/specialization/specialization-translate-projections.rs
1 // Copyright 2015 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.
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.
11 // Ensure that provided items are inherited properly even when impls vary in
12 // type parameters *and* rely on projections.
14 #![feature(specialization)]
16 use std
::convert
::Into
;
19 fn to_u8(&self) -> u8;
23 fn to_item(&self) -> Self::Item
;
26 impl<T
, U
> Trait
for T
where T
: WithAssoc
<Item
=U
>, U
: Into
<u8> {
27 fn to_u8(&self) -> u8 {
32 impl WithAssoc
for u8 {
34 fn to_item(&self) -> u8 { *self }
40 assert
!(3u8.to_u8() == 3u8);