2013-08-21 19:11:30 -07:00
|
|
|
// Copyright 2013 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.
|
|
|
|
|
|
2013-08-21 19:58:27 -07:00
|
|
|
// test for #8664
|
|
|
|
|
|
2015-01-08 02:25:56 +01:00
|
|
|
#![feature(box_syntax)]
|
2014-05-05 18:56:44 -07:00
|
|
|
|
2015-02-12 10:29:52 -05:00
|
|
|
use std::marker;
|
|
|
|
|
|
2013-08-21 19:58:27 -07:00
|
|
|
pub trait Trait2<A> {
|
2015-02-12 10:29:52 -05:00
|
|
|
fn doit(&self) -> A;
|
2013-08-21 19:58:27 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub struct Impl<A1, A2, A3> {
|
2015-02-12 10:29:52 -05:00
|
|
|
m1: marker::PhantomData<(A1,A2,A3)>,
|
2013-08-21 19:58:27 -07:00
|
|
|
/*
|
|
|
|
|
* With A2 we get the ICE:
|
2014-02-05 16:33:10 -06:00
|
|
|
* task <unnamed> failed at 'index out of bounds: the len is 1 but the index is 1',
|
|
|
|
|
* src/librustc/middle/subst.rs:58
|
2013-08-21 19:58:27 -07:00
|
|
|
*/
|
2014-08-27 21:46:52 -04:00
|
|
|
t: Box<Trait2<A2>+'static>
|
2013-08-21 19:58:27 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl<A1, A2, A3> Impl<A1, A2, A3> {
|
|
|
|
|
pub fn step(&self) {
|
2015-02-12 10:29:52 -05:00
|
|
|
self.t.doit();
|
2013-08-21 19:58:27 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-21 19:11:30 -07:00
|
|
|
// test for #8601
|
|
|
|
|
|
2015-02-12 10:29:52 -05:00
|
|
|
enum Type<T> { Constant(T) }
|
2013-08-21 19:11:30 -07:00
|
|
|
|
|
|
|
|
trait Trait<K,V> {
|
2017-06-25 05:29:10 +03:00
|
|
|
fn method(&self, _: Type<(K,V)>) -> isize;
|
2013-08-21 19:11:30 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl<V> Trait<u8,V> for () {
|
2015-03-25 17:06:52 -07:00
|
|
|
fn method(&self, _x: Type<(u8,V)>) -> isize { 0 }
|
2013-08-21 19:11:30 -07:00
|
|
|
}
|
|
|
|
|
|
2014-02-07 00:38:33 +02:00
|
|
|
pub fn main() {
|
2015-09-24 18:00:08 +03:00
|
|
|
let a = box () as Box<Trait<u8, u8>>;
|
2015-03-03 10:42:26 +02:00
|
|
|
assert_eq!(a.method(Type::Constant((1, 2))), 0);
|
2013-08-21 19:11:30 -07:00
|
|
|
}
|