Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Edit rustc_middle::ty::cast docs #81131

Merged
merged 1 commit into from
Jan 18, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions compiler/rustc_middle/src/ty/cast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,16 @@ pub enum CastTy<'tcx> {
/// Various types that are represented as ints and handled mostly
/// in the same way, merged for easier matching.
Int(IntTy),
/// Floating-Point types
/// Floating-point types.
Float,
/// Function Pointers
/// Function pointers.
FnPtr,
/// Raw pointers
/// Raw pointers.
Ptr(ty::TypeAndMut<'tcx>),
}

/// Cast Kind. See RFC 401 (or librustc_typeck/check/cast.rs)
/// Cast Kind. See [RFC 401](https://rust-lang.github.io/rfcs/0401-coercions.html)
/// (or librustc_typeck/check/cast.rs).
#[derive(Copy, Clone, Debug, TyEncodable, TyDecodable, HashStable)]
pub enum CastKind {
CoercionCast,
Expand All @@ -48,7 +49,7 @@ pub enum CastKind {

impl<'tcx> CastTy<'tcx> {
/// Returns `Some` for integral/pointer casts.
/// casts like unsizing casts will return `None`
/// Casts like unsizing casts will return `None`.
pub fn from_ty(t: Ty<'tcx>) -> Option<CastTy<'tcx>> {
match *t.kind() {
ty::Bool => Some(CastTy::Int(IntTy::Bool)),
Expand Down