Created
December 19, 2012 23:40
-
-
Save brson/4341739 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub trait Trig<T> { | |
pure fn sin(&self) -> T; | |
} | |
pub trait Angle<T>: Trig<T> {} | |
//type Trait<R> = Trig<R>; | |
type Trait<R> = Angle<R>; | |
pub fn sin<A:Trait<R>, R>(theta: &A) -> R { theta.sin() } | |
fn foo<A:Trait<R>, R>(theta: A) -> R { | |
// I think it's the type variable A on this function call that isn't resolving | |
return sin(&theta); | |
} | |
fn main() { | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rust: ~"commit()" | |
rust: ~"try()" | |
rust: ~"RegionVarBindings: snapshot()=0" | |
rust: ~"sub.tys(<V2>, \'b)" | |
rust: ~"var_sub_t(<V2>={\'b <: \'b} <: \'b)" | |
rust: ~"merge(<V2>,{\'b <: \'b},{none <: \'b})" | |
rust: ~"bnds(\'b <: \'b)" | |
rust: ~"sub.tys(\'b, \'b)" | |
rust: ~"bnds(none <: \'b)" | |
rust: ~"merge_bnd(\'b,\'b)" | |
rust: ~"glb.lattice_tys(\'b, \'b)" | |
rust: ~"merge_bnd(\'b,none)" | |
rust: ~"merge(<V2>): bounds={\'b <: \'b}" | |
rust: ~"bnds(\'b <: \'b)" | |
rust: ~"sub.tys(\'b, \'b)" | |
rust: ~"Updating variable <V2> from root({\'b <: \'b}, 0) to root({\'b <: \'b}, 0)" | |
rust: ~"RegionVarBindings: commit()" | |
rust: ~"vtable: early_resolve_expr() ex with id 60 (early: false): return sin(&theta)" | |
rust: ~"vtable: early_resolve_expr() ex with id 58 (early: false): sin(&theta)" | |
rust: ~"vtable: early_resolve_expr() ex with id 56 (early: false): &theta" | |
rust: ~"vtable: early_resolve_expr() ex with id 54 (early: false): theta" | |
rust: ~"vtable: early_resolve_expr() ex with id 52 (early: false): sin" | |
rust: ~"Resolving fn(&\'a) -> \'b (modes=5)" | |
rust: ~"resolve_type(fn(&\'a) -> \'b)" | |
rust: ~"Resolved to fn(&\'a) -> \'b (modes=5)" | |
rust: ~"early resolve expr: def 52 {crate: 0, node: 38}, def_fn({crate: 0, node: 38}, impure_fn), ~\"fn(&\\\'a) -> \\\'b\"" | |
rust: ~"early_resolve_expr: looking up vtables for bound ~[~\"@Angle<\\\'b>\"]" | |
rust: ~"early_resolve_expr: looking up vtables for bound ~[]" | |
rust: ~"lookup_vtables(location_info=&{span: {lo: BytePos(243), hi: BytePos(246), expn_info: None}, id: 52},\n # bounds=2, substs=substs(self_r=none, self_ty=none, tps=~\"[<V1>, <V2>]\")" | |
rust: ~"AAA @{sty: ty_infer(TyVar(TyVid(1))), id: 897, flags: 4, o_def_id: None}" | |
rust: ~"about to subst: ~\"@Angle<\\\'b>\", ~\"substs(self_r=none, self_ty=none, tps=~\\\"[<V1>, <V2>]\\\")\"" | |
rust: ~"BBB @{sty: ty_infer(TyVar(TyVid(1))), id: 897, flags: 4, o_def_id: None}" | |
rust: ~"after subst: ~\"@Angle<<V2>>\"" | |
rust: ~"Resolving <V1> (modes=5)" | |
rust: ~"resolve_type(<V1>)" | |
rust: ~"nde: {root: TyVid(0), possible_types: {lb: Some((0x2b51883e8d80 as *())), ub: Some((0x2b51882cfe40 as *()))}, rank: 1}" | |
rust: ~"bounds: {lb: Some((0x2b51883e8d80 as *())), ub: Some((0x2b51882cfe40 as *()))}" | |
rust: ~"resolve_type(\'a)" | |
rust: ~"Resolved to \'a (modes=5)" | |
rust: ~"Resolving @Angle<<V2>> (modes=5)" | |
rust: ~"resolve_type(@Angle<<V2>>)" | |
rust: ~"Resolve_if_deep(<V2>)" | |
rust: ~"resolve_type(<V2>)" | |
rust: ~"nde: {root: TyVid(2), possible_types: {lb: Some((0x2b51882b8070 as *())), ub: Some((0x2b51882b8070 as *()))}, rank: 0}" | |
rust: ~"bounds: {lb: Some((0x2b51882b8070 as *())), ub: Some((0x2b51882b8070 as *()))}" | |
rust: ~"resolve_type(\'b)" | |
rust: ~"Resolved to @Angle<\'b> (modes=5)" | |
rust: ~"lookup_vtable(ty=\'a, trait_ty=@Angle<\'b>)" | |
rust: ~"xxx @{sty: ty_infer(TyVar(TyVid(1))), id: 897, flags: 4, o_def_id: None}" | |
rust: ~"Resolving <V1> (modes=dd)" | |
rust: ~"resolve_type(<V1>)" | |
rust: ~"nde: {root: TyVid(0), possible_types: {lb: Some((0x2b51883e8d80 as *())), ub: Some((0x2b51882cfe40 as *()))}, rank: 1}" | |
rust: ~"bounds: {lb: Some((0x2b51883e8d80 as *())), ub: Some((0x2b51882cfe40 as *()))}" | |
rust: ~"resolve_type(\'a)" | |
rust: ~"Resolved to \'a (modes=dd)" | |
rust: ~"XXX @{sty: ty_param({idx: 0, def_id: {crate: 0, node: 6}}), id: 16, flags: 1, o_def_id: None}" | |
rust: ~"YYY @~[]" | |
/home/brian/dev/rust2/src/test/run-pass/trait-inheritance-trait-param.rs:12:46: 12:49 error: failed to find an implementation of trait @Angle<<V2>> for <V1> | |
/home/brian/dev/rust2/src/test/run-pass/trait-inheritance-trait-param.rs:12 fn foo<A:Trait<R>, R>(theta: A) -> R { return sin(&theta); } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment