diff options
| author | Ben Blum <bblum@andrew.cmu.edu> | 2013-08-19 16:50:23 -0400 |
|---|---|---|
| committer | Ben Blum <bblum@andrew.cmu.edu> | 2013-08-20 13:28:50 -0400 |
| commit | 3c3bfb4c3c5f89a6c4f48b7ad8b9f71de792be04 (patch) | |
| tree | 4c57dfadb0c1a6ced94703a77572d57c79918424 | |
| parent | 4ca2e55adbf0cfbc34d8b1e7de773045d36cce2e (diff) | |
| download | rust-3c3bfb4c3c5f89a6c4f48b7ad8b9f71de792be04.tar.gz rust-3c3bfb4c3c5f89a6c4f48b7ad8b9f71de792be04.zip | |
Add more capabilities to typarams bounded by traits with super-builtin-kinds. Close #7083.
| -rw-r--r-- | src/librustc/middle/ty.rs | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index 757f05c208b..3672bfeec86 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -2322,7 +2322,7 @@ pub fn type_contents(cx: ctxt, ty: t) -> TypeContents { let _i = indenter(); let mut tc = TC_ALL; - for bound in type_param_def.bounds.builtin_bounds.iter() { + do each_inherited_builtin_bound(cx, type_param_def.bounds) |bound| { debug!("tc = %s, bound = %?", tc.to_str(), bound); tc = tc - match bound { BoundStatic => TypeContents::nonstatic(cx), @@ -2335,6 +2335,23 @@ pub fn type_contents(cx: ctxt, ty: t) -> TypeContents { debug!("result = %s", tc.to_str()); return tc; + + // Iterates over all builtin bounds on the type parameter def, including + // those inherited from traits with builtin-kind-supertraits. + fn each_inherited_builtin_bound(cx: ctxt, bounds: &ParamBounds, + f: &fn(BuiltinBound)) { + for bound in bounds.builtin_bounds.iter() { + f(bound); + } + + do each_bound_trait_and_supertraits(cx, bounds.trait_bounds) |trait_ref| { + let trait_def = lookup_trait_def(cx, trait_ref.def_id); + for bound in trait_def.bounds.iter() { + f(bound); + } + true + }; + } } } |
