Skip to content

Commit a754ea6

Browse files
committed
Move TraitRef impl next to struct definition.
1 parent 23d9211 commit a754ea6

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

src/librustc/ty/mod.rs

-18
Original file line numberDiff line numberDiff line change
@@ -1086,24 +1086,6 @@ impl<'tcx> InstantiatedPredicates<'tcx> {
10861086
}
10871087
}
10881088

1089-
impl<'tcx> TraitRef<'tcx> {
1090-
pub fn new(def_id: DefId, substs: &'tcx Substs<'tcx>) -> TraitRef<'tcx> {
1091-
TraitRef { def_id: def_id, substs: substs }
1092-
}
1093-
1094-
pub fn self_ty(&self) -> Ty<'tcx> {
1095-
self.substs.type_at(0)
1096-
}
1097-
1098-
pub fn input_types<'a>(&'a self) -> impl DoubleEndedIterator<Item=Ty<'tcx>> + 'a {
1099-
// Select only the "input types" from a trait-reference. For
1100-
// now this is all the types that appear in the
1101-
// trait-reference, but it should eventually exclude
1102-
// associated types.
1103-
self.substs.types()
1104-
}
1105-
}
1106-
11071089
/// When type checking, we use the `ParameterEnvironment` to track
11081090
/// details about the type/lifetime parameters that are in scope.
11091091
/// It primarily stores the bounds information.

src/librustc/ty/sty.rs

+18
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,24 @@ pub struct TraitRef<'tcx> {
389389
pub substs: &'tcx Substs<'tcx>,
390390
}
391391

392+
impl<'tcx> TraitRef<'tcx> {
393+
pub fn new(def_id: DefId, substs: &'tcx Substs<'tcx>) -> TraitRef<'tcx> {
394+
TraitRef { def_id: def_id, substs: substs }
395+
}
396+
397+
pub fn self_ty(&self) -> Ty<'tcx> {
398+
self.substs.type_at(0)
399+
}
400+
401+
pub fn input_types<'a>(&'a self) -> impl DoubleEndedIterator<Item=Ty<'tcx>> + 'a {
402+
// Select only the "input types" from a trait-reference. For
403+
// now this is all the types that appear in the
404+
// trait-reference, but it should eventually exclude
405+
// associated types.
406+
self.substs.types()
407+
}
408+
}
409+
392410
pub type PolyTraitRef<'tcx> = Binder<TraitRef<'tcx>>;
393411

394412
impl<'tcx> PolyTraitRef<'tcx> {

0 commit comments

Comments
 (0)