*
*/
+use kinds::Sized;
+
/**
*
* The `Drop` trait is used to run some code when a value goes out of scope. This
* ```
*/
#[lang="deref"]
-pub trait Deref<Result> {
+pub trait Deref<Sized? Result> {
/// The method called to dereference a value
fn deref<'a>(&'a self) -> &'a Result;
}
* ```
*/
#[lang="deref_mut"]
-pub trait DerefMut<Result>: Deref<Result> {
+pub trait DerefMut<Sized? Result>: Deref<Result> {
/// The method called to mutably dereference a value
fn deref_mut<'a>(&'a mut self) -> &'a mut Result;
}
cx,
item.span,
&*trait_ref);
+
+ let trait_def = ty::lookup_trait_def(cx.tcx, trait_ref.def_id);
+ for (ty, type_param_def) in trait_ref.substs.types
+ .iter()
+ .zip(trait_def.generics
+ .types
+ .iter()) {
+ check_typaram_bounds(cx, item.span, *ty, type_param_def);
+ }
}
}
}
//~^ ERROR instantiating a type parameter with an incompatible type
}
-// I would like these to fail eventually.
-/*
// impl - bounded
trait T1<Z: T> {
}
struct S3<Sized? Y>;
-impl<Sized? X: T> T1<X> for S3<X> { //ERROR instantiating a type parameter with an incompatible type
+impl<Sized? X: T> T1<X> for S3<X> { //~ ERROR instantiating a type parameter with an incompatible
}
// impl - unbounded
trait T2<Z> {
}
-impl<Sized? X> T2<X> for S3<X> { //ERROR instantiating a type parameter with an incompatible type `X
-*/
+impl<Sized? X> T2<X> for S3<X> { //~ ERROR instantiating a type parameter with an incompatible type
+}
// impl - struct
trait T3<Sized? Z> {