Skip to content

Commit

Permalink
Rollup merge of rust-lang#41912 - oli-obk:patch-3, r=eddyb
Browse files Browse the repository at this point in the history
Upgrade some comments to doc comments
  • Loading branch information
Mark-Simulacrum authored May 13, 2017
2 parents 605d727 + 43349e6 commit 8b62560
Showing 1 changed file with 23 additions and 24 deletions.
47 changes: 23 additions & 24 deletions src/librustc/ty/sty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ pub enum BoundRegion {
/// Fresh bound identifiers created during GLB computations.
BrFresh(u32),

// Anonymous region for the implicit env pointer parameter
// to a closure
/// Anonymous region for the implicit env pointer parameter
/// to a closure
BrEnv,
}

Expand All @@ -95,8 +95,8 @@ pub struct Issue32330 {
pub region_name: ast::Name,
}

// NB: If you change this, you'll probably want to change the corresponding
// AST structure in libsyntax/ast.rs as well.
/// NB: If you change this, you'll probably want to change the corresponding
/// AST structure in libsyntax/ast.rs as well.
#[derive(Clone, PartialEq, Eq, Hash, Debug, RustcEncodable, RustcDecodable)]
pub enum TypeVariants<'tcx> {
/// The primitive boolean type. Written as `bool`.
Expand Down Expand Up @@ -283,11 +283,11 @@ impl<'a, 'gcx, 'acx, 'tcx> ClosureSubsts<'tcx> {

#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)]
pub enum ExistentialPredicate<'tcx> {
// e.g. Iterator
/// e.g. Iterator
Trait(ExistentialTraitRef<'tcx>),
// e.g. Iterator::Item = T
/// e.g. Iterator::Item = T
Projection(ExistentialProjection<'tcx>),
// e.g. Send
/// e.g. Send
AutoTrait(DefId),
}

Expand Down Expand Up @@ -683,8 +683,8 @@ impl<'a, 'gcx, 'tcx> ParamTy {
/// [dbi]: http://en.wikipedia.org/wiki/De_Bruijn_index
#[derive(Clone, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable, Debug, Copy)]
pub struct DebruijnIndex {
// We maintain the invariant that this is never 0. So 1 indicates
// the innermost binder. To ensure this, create with `DebruijnIndex::new`.
/// We maintain the invariant that this is never 0. So 1 indicates
/// the innermost binder. To ensure this, create with `DebruijnIndex::new`.
pub depth: u32,
}

Expand Down Expand Up @@ -908,7 +908,7 @@ impl DebruijnIndex {
}
}

// Region utilities
/// Region utilities
impl<'tcx> RegionKind<'tcx> {
pub fn is_bound(&self) -> bool {
match *self {
Expand Down Expand Up @@ -972,7 +972,7 @@ impl<'tcx> RegionKind<'tcx> {
}
}

// Type utilities
/// Type utilities
impl<'a, 'gcx, 'tcx> TyS<'tcx> {
pub fn as_opt_param_ty(&self) -> Option<ty::ParamTy> {
match self.sty {
Expand All @@ -995,8 +995,8 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
}
}

// Test whether this is a `()` which was produced by defaulting a
// diverging type variable with feature(never_type) disabled.
/// Test whether this is a `()` which was produced by defaulting a
/// diverging type variable with feature(never_type) disabled.
pub fn is_defaulted_unit(&self) -> bool {
match self.sty {
TyTuple(_, true) => true,
Expand Down Expand Up @@ -1171,18 +1171,17 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
}
}

/// panics if called on any type other than `Box<T>`
pub fn boxed_ty(&self) -> Ty<'tcx> {
match self.sty {
TyAdt(def, substs) if def.is_box() => substs.type_at(0),
_ => bug!("`boxed_ty` is called on non-box type {:?}", self),
}
}

/*
A scalar type is one that denotes an atomic datum, with no sub-components.
(A TyRawPtr is scalar because it represents a non-managed pointer, so its
contents are abstract to rustc.)
*/
/// A scalar type is one that denotes an atomic datum, with no sub-components.
/// (A TyRawPtr is scalar because it represents a non-managed pointer, so its
/// contents are abstract to rustc.)
pub fn is_scalar(&self) -> bool {
match self.sty {
TyBool | TyChar | TyInt(_) | TyFloat(_) | TyUint(_) |
Expand Down Expand Up @@ -1278,10 +1277,10 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
}
}

// Returns the type and mutability of *ty.
//
// The parameter `explicit` indicates if this is an *explicit* dereference.
// Some types---notably unsafe ptrs---can only be dereferenced explicitly.
/// Returns the type and mutability of *ty.
///
/// The parameter `explicit` indicates if this is an *explicit* dereference.
/// Some types---notably unsafe ptrs---can only be dereferenced explicitly.
pub fn builtin_deref(&self, explicit: bool, pref: ty::LvaluePreference)
-> Option<TypeAndMut<'tcx>>
{
Expand All @@ -1302,7 +1301,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
}
}

// Returns the type of ty[i]
/// Returns the type of ty[i]
pub fn builtin_index(&self) -> Option<Ty<'tcx>> {
match self.sty {
TyArray(ty, _) | TySlice(ty) => Some(ty),
Expand All @@ -1317,7 +1316,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
}
}

// Type accessors for substructures of types
/// Type accessors for substructures of types
pub fn fn_args(&self) -> ty::Binder<&'tcx [Ty<'tcx>]> {
self.fn_sig().inputs()
}
Expand Down

0 comments on commit 8b62560

Please sign in to comment.