Skip to content

Commit 73e816e

Browse files
committed
Add Char ty to SMIR
1 parent 61adcaf commit 73e816e

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

compiler/rustc_smir/src/rustc_smir/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ impl<'tcx> Tables<'tcx> {
7171
fn rustc_ty_to_ty(&mut self, ty: Ty<'tcx>) -> TyKind {
7272
match ty.kind() {
7373
ty::Bool => TyKind::RigidTy(RigidTy::Bool),
74-
ty::Char => todo!(),
74+
ty::Char => TyKind::RigidTy(RigidTy::Char),
7575
ty::Int(_) => todo!(),
7676
ty::Uint(_) => todo!(),
7777
ty::Float(_) => todo!(),

compiler/rustc_smir/src/stable_mir/ty.rs

+1
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,6 @@ pub enum TyKind {
1717
#[derive(Clone, Debug)]
1818
pub enum RigidTy {
1919
Bool,
20+
Char,
2021
Tuple(Vec<Ty>),
2122
}

tests/ui-fulldeps/stable-mir/crate-info.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ fn test_stable_mir(tcx: TyCtxt<'_>) {
6767

6868
let types = get_item(tcx, &items, (DefKind::Fn, "types")).unwrap();
6969
let body = types.body();
70-
assert_eq!(body.locals.len(), 2);
70+
assert_eq!(body.locals.len(), 3);
7171
assert_matches!(
7272
body.locals[0].kind(),
7373
stable_mir::ty::TyKind::RigidTy(stable_mir::ty::RigidTy::Bool)
@@ -76,6 +76,10 @@ fn test_stable_mir(tcx: TyCtxt<'_>) {
7676
body.locals[1].kind(),
7777
stable_mir::ty::TyKind::RigidTy(stable_mir::ty::RigidTy::Bool)
7878
);
79+
assert_matches!(
80+
body.locals[2].kind(),
81+
stable_mir::ty::TyKind::RigidTy(stable_mir::ty::RigidTy::Char)
82+
);
7983

8084
let drop = get_item(tcx, &items, (DefKind::Fn, "drop")).unwrap();
8185
let body = drop.body();
@@ -167,7 +171,7 @@ fn generate_input(path: &str) -> std::io::Result<()> {
167171
x_64.wrapping_add(y_64)
168172
}}
169173
170-
pub fn types(b: bool) -> bool {{
174+
pub fn types(b: bool, _: char) -> bool {{
171175
b
172176
}}
173177

0 commit comments

Comments
 (0)