diff options
| author | Corey Farwell <coreyf@rwell.org> | 2017-02-20 09:23:40 -0500 |
|---|---|---|
| committer | Corey Farwell <coreyf@rwell.org> | 2017-02-20 11:40:05 -0500 |
| commit | a754ea6d0a6bc901e1c2dd58e3c0d0e283f8ae17 (patch) | |
| tree | ade9a57247e12769b2dc12adb86f1286adbafa52 /src | |
| parent | 23d9211f1e2413243590757b68ec18b1fbc5d91f (diff) | |
| download | rust-a754ea6d0a6bc901e1c2dd58e3c0d0e283f8ae17.tar.gz rust-a754ea6d0a6bc901e1c2dd58e3c0d0e283f8ae17.zip | |
Move `TraitRef` `impl` next to `struct` definition.
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc/ty/mod.rs | 18 | ||||
| -rw-r--r-- | src/librustc/ty/sty.rs | 18 |
2 files changed, 18 insertions, 18 deletions
diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs index 7937d2ccfe4..2a6ef13bfd2 100644 --- a/src/librustc/ty/mod.rs +++ b/src/librustc/ty/mod.rs @@ -1086,24 +1086,6 @@ impl<'tcx> InstantiatedPredicates<'tcx> { } } -impl<'tcx> TraitRef<'tcx> { - pub fn new(def_id: DefId, substs: &'tcx Substs<'tcx>) -> TraitRef<'tcx> { - TraitRef { def_id: def_id, substs: substs } - } - - pub fn self_ty(&self) -> Ty<'tcx> { - self.substs.type_at(0) - } - - pub fn input_types<'a>(&'a self) -> impl DoubleEndedIterator<Item=Ty<'tcx>> + 'a { - // Select only the "input types" from a trait-reference. For - // now this is all the types that appear in the - // trait-reference, but it should eventually exclude - // associated types. - self.substs.types() - } -} - /// When type checking, we use the `ParameterEnvironment` to track /// details about the type/lifetime parameters that are in scope. /// It primarily stores the bounds information. diff --git a/src/librustc/ty/sty.rs b/src/librustc/ty/sty.rs index 862bc15c052..64e5ec6aeb2 100644 --- a/src/librustc/ty/sty.rs +++ b/src/librustc/ty/sty.rs @@ -389,6 +389,24 @@ pub struct TraitRef<'tcx> { pub substs: &'tcx Substs<'tcx>, } +impl<'tcx> TraitRef<'tcx> { + pub fn new(def_id: DefId, substs: &'tcx Substs<'tcx>) -> TraitRef<'tcx> { + TraitRef { def_id: def_id, substs: substs } + } + + pub fn self_ty(&self) -> Ty<'tcx> { + self.substs.type_at(0) + } + + pub fn input_types<'a>(&'a self) -> impl DoubleEndedIterator<Item=Ty<'tcx>> + 'a { + // Select only the "input types" from a trait-reference. For + // now this is all the types that appear in the + // trait-reference, but it should eventually exclude + // associated types. + self.substs.types() + } +} + pub type PolyTraitRef<'tcx> = Binder<TraitRef<'tcx>>; impl<'tcx> PolyTraitRef<'tcx> { |
