summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_type_ir
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:20:39 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:20:39 +0000
commit1376c5a617be5c25655d0d7cb63e3beaa5a6e026 (patch)
tree3bb8d61aee02bc7a15eab3f36e3b921afc2075d0 /compiler/rustc_type_ir
parentReleasing progress-linux version 1.69.0+dfsg1-1~progress7.99u1. (diff)
downloadrustc-1376c5a617be5c25655d0d7cb63e3beaa5a6e026.tar.xz
rustc-1376c5a617be5c25655d0d7cb63e3beaa5a6e026.zip
Merging upstream version 1.70.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'compiler/rustc_type_ir')
-rw-r--r--compiler/rustc_type_ir/src/fold.rs2
-rw-r--r--compiler/rustc_type_ir/src/lib.rs24
-rw-r--r--compiler/rustc_type_ir/src/sty.rs2
3 files changed, 25 insertions, 3 deletions
diff --git a/compiler/rustc_type_ir/src/fold.rs b/compiler/rustc_type_ir/src/fold.rs
index ee4ef57c3..3a053d4c6 100644
--- a/compiler/rustc_type_ir/src/fold.rs
+++ b/compiler/rustc_type_ir/src/fold.rs
@@ -18,7 +18,7 @@
//! It defines a "skeleton" of how they should be folded.
//! - `TypeSuperFoldable`. This is implemented only for each type of interest,
//! and defines the folding "skeleton" for these types.
-//! - `TypeFolder`/`FallibleTypeFolder. One of these is implemented for each
+//! - `TypeFolder`/`FallibleTypeFolder`. One of these is implemented for each
//! folder. This defines how types of interest are folded.
//!
//! This means each fold is a mixture of (a) generic folding operations, and (b)
diff --git a/compiler/rustc_type_ir/src/lib.rs b/compiler/rustc_type_ir/src/lib.rs
index 5a991e03d..a3c98ae00 100644
--- a/compiler/rustc_type_ir/src/lib.rs
+++ b/compiler/rustc_type_ir/src/lib.rs
@@ -83,7 +83,7 @@ pub trait CollectAndApply<T, R>: Sized {
/// Produce a result of type `Self::Output` from `iter`. The result will
/// typically be produced by applying `f` on the elements produced by
/// `iter`, though this may not happen in some impls, e.g. if an error
- /// occured during iteration.
+ /// occurred during iteration.
fn collect_and_apply<I, F>(iter: I, f: F) -> Self::Output
where
I: Iterator<Item = Self>,
@@ -432,6 +432,17 @@ impl IntTy {
_ => *self,
}
}
+
+ pub fn to_unsigned(self) -> UintTy {
+ match self {
+ IntTy::Isize => UintTy::Usize,
+ IntTy::I8 => UintTy::U8,
+ IntTy::I16 => UintTy::U16,
+ IntTy::I32 => UintTy::U32,
+ IntTy::I64 => UintTy::U64,
+ IntTy::I128 => UintTy::U128,
+ }
+ }
}
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Copy, Debug)]
@@ -479,6 +490,17 @@ impl UintTy {
_ => *self,
}
}
+
+ pub fn to_signed(self) -> IntTy {
+ match self {
+ UintTy::Usize => IntTy::Isize,
+ UintTy::U8 => IntTy::I8,
+ UintTy::U16 => IntTy::I16,
+ UintTy::U32 => IntTy::I32,
+ UintTy::U64 => IntTy::I64,
+ UintTy::U128 => IntTy::I128,
+ }
+ }
}
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
diff --git a/compiler/rustc_type_ir/src/sty.rs b/compiler/rustc_type_ir/src/sty.rs
index ebe2b76ae..62e699eef 100644
--- a/compiler/rustc_type_ir/src/sty.rs
+++ b/compiler/rustc_type_ir/src/sty.rs
@@ -167,7 +167,7 @@ pub enum TyKind<I: Interner> {
/// lifetimes bound by the witness itself.
///
/// This variant is only using when `drop_tracking_mir` is set.
- /// This contains the `DefId` and the `SubstRef` of the generator.
+ /// This contains the `DefId` and the `SubstsRef` of the generator.
/// The actual witness types are computed on MIR by the `mir_generator_witnesses` query.
///
/// Looking at the following example, the witness for this generator