X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Flibrustc%2Fty%2Fmod.rs;h=80781dd9bc7360805c35402ceaf0565f9dd0fd89;hb=231b0375f6778bb409305cd3c34bc820d727aab4;hp=e585f9939a0141e0f48e6bc717b779f95ee18ebe;hpb=4c9ecbf3d1a0fdac1d97c77783685c6281136c0b;p=rust.git diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs index e585f9939a0..80781dd9bc7 100644 --- a/src/librustc/ty/mod.rs +++ b/src/librustc/ty/mod.rs @@ -1090,7 +1090,7 @@ pub enum Predicate<'tcx> { /// See the `ProjectionPredicate` struct for details. Projection(PolyProjectionPredicate<'tcx>), - /// no syntax: `T` well-formed + /// No syntax: `T` well-formed. WellFormed(Ty<'tcx>), /// Trait must be object-safe. @@ -1245,19 +1245,17 @@ pub fn self_ty(&self) -> Ty<'tcx> { impl<'tcx> PolyTraitPredicate<'tcx> { pub fn def_id(&self) -> DefId { - // ok to skip binder since trait def-id does not care about regions + // Ok to skip binder since trait def-ID does not care about regions. self.skip_binder().def_id() } } #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, RustcEncodable, RustcDecodable, HashStable)] -pub struct OutlivesPredicate(pub A, pub B); // `A: B` -pub type PolyOutlivesPredicate = ty::Binder>; -pub type RegionOutlivesPredicate<'tcx> = OutlivesPredicate, - ty::Region<'tcx>>; -pub type TypeOutlivesPredicate<'tcx> = OutlivesPredicate, - ty::Region<'tcx>>; +pub struct OutlivesPredicate(pub A, pub B); // `A: B` +pub type PolyOutlivesPredicate = ty::Binder>; +pub type RegionOutlivesPredicate<'tcx> = OutlivesPredicate, ty::Region<'tcx>>; +pub type TypeOutlivesPredicate<'tcx> = OutlivesPredicate, ty::Region<'tcx>>; pub type PolyRegionOutlivesPredicate<'tcx> = ty::Binder>; pub type PolyTypeOutlivesPredicate<'tcx> = ty::Binder>; @@ -1314,7 +1312,7 @@ pub fn ty(&self) -> Binder> { /// Note that this is not the `DefId` of the `TraitRef` containing this /// associated type, which is in `tcx.associated_item(projection_def_id()).container`. pub fn projection_def_id(&self) -> DefId { - // okay to skip binder since trait def-id does not care about regions + // Ok to skip binder since trait def-ID does not care about regions. self.skip_binder().projection_ty.item_def_id } } @@ -1371,7 +1369,7 @@ fn to_predicate(&self) -> Predicate<'tcx> { } } -// A custom iterator used by Predicate::walk_tys. +// A custom iterator used by `Predicate::walk_tys`. enum WalkTysIter<'tcx, I, J, K> where I: Iterator>, J: Iterator>, @@ -1505,7 +1503,7 @@ pub fn to_opt_type_outlives(&self) -> Option> { /// /// Example: /// -/// struct Foo> { ... } +/// struct Foo> { ... } /// /// Here, the `GenericPredicates` for `Foo` would contain a list of bounds like /// `[[], [U:Bar]]`. Now if there were some particular reference @@ -2305,7 +2303,7 @@ pub fn predicates(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> &'tcx GenericPredicates /// Returns an iterator over all fields contained /// by this ADT. #[inline] - pub fn all_fields<'s>(&'s self) -> impl Iterator { + pub fn all_fields<'s>(&'s self) -> impl Iterator + Clone { self.variants.iter().flat_map(|v| v.fields.iter()) } @@ -2785,10 +2783,10 @@ pub fn expr_span(self, id: NodeId) -> Span { e.span } Some(f) => { - bug!("Node id {} is not an expr: {:?}", id, f); + bug!("node-ID {} is not an expr: {:?}", id, f); } None => { - bug!("Node id {} is not present in the node map", id); + bug!("node-ID {} is not present in the node map", id); } } }