Add Char ty to SMIR
This commit is contained in:
parent
61adcaf87b
commit
73e816e37c
3 changed files with 8 additions and 3 deletions
|
@ -71,7 +71,7 @@ impl<'tcx> Tables<'tcx> {
|
||||||
fn rustc_ty_to_ty(&mut self, ty: Ty<'tcx>) -> TyKind {
|
fn rustc_ty_to_ty(&mut self, ty: Ty<'tcx>) -> TyKind {
|
||||||
match ty.kind() {
|
match ty.kind() {
|
||||||
ty::Bool => TyKind::RigidTy(RigidTy::Bool),
|
ty::Bool => TyKind::RigidTy(RigidTy::Bool),
|
||||||
ty::Char => todo!(),
|
ty::Char => TyKind::RigidTy(RigidTy::Char),
|
||||||
ty::Int(_) => todo!(),
|
ty::Int(_) => todo!(),
|
||||||
ty::Uint(_) => todo!(),
|
ty::Uint(_) => todo!(),
|
||||||
ty::Float(_) => todo!(),
|
ty::Float(_) => todo!(),
|
||||||
|
|
|
@ -17,5 +17,6 @@ pub enum TyKind {
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub enum RigidTy {
|
pub enum RigidTy {
|
||||||
Bool,
|
Bool,
|
||||||
|
Char,
|
||||||
Tuple(Vec<Ty>),
|
Tuple(Vec<Ty>),
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,7 @@ fn test_stable_mir(tcx: TyCtxt<'_>) {
|
||||||
|
|
||||||
let types = get_item(tcx, &items, (DefKind::Fn, "types")).unwrap();
|
let types = get_item(tcx, &items, (DefKind::Fn, "types")).unwrap();
|
||||||
let body = types.body();
|
let body = types.body();
|
||||||
assert_eq!(body.locals.len(), 2);
|
assert_eq!(body.locals.len(), 3);
|
||||||
assert_matches!(
|
assert_matches!(
|
||||||
body.locals[0].kind(),
|
body.locals[0].kind(),
|
||||||
stable_mir::ty::TyKind::RigidTy(stable_mir::ty::RigidTy::Bool)
|
stable_mir::ty::TyKind::RigidTy(stable_mir::ty::RigidTy::Bool)
|
||||||
|
@ -76,6 +76,10 @@ fn test_stable_mir(tcx: TyCtxt<'_>) {
|
||||||
body.locals[1].kind(),
|
body.locals[1].kind(),
|
||||||
stable_mir::ty::TyKind::RigidTy(stable_mir::ty::RigidTy::Bool)
|
stable_mir::ty::TyKind::RigidTy(stable_mir::ty::RigidTy::Bool)
|
||||||
);
|
);
|
||||||
|
assert_matches!(
|
||||||
|
body.locals[2].kind(),
|
||||||
|
stable_mir::ty::TyKind::RigidTy(stable_mir::ty::RigidTy::Char)
|
||||||
|
);
|
||||||
|
|
||||||
let drop = get_item(tcx, &items, (DefKind::Fn, "drop")).unwrap();
|
let drop = get_item(tcx, &items, (DefKind::Fn, "drop")).unwrap();
|
||||||
let body = drop.body();
|
let body = drop.body();
|
||||||
|
@ -167,7 +171,7 @@ fn generate_input(path: &str) -> std::io::Result<()> {
|
||||||
x_64.wrapping_add(y_64)
|
x_64.wrapping_add(y_64)
|
||||||
}}
|
}}
|
||||||
|
|
||||||
pub fn types(b: bool) -> bool {{
|
pub fn types(b: bool, _: char) -> bool {{
|
||||||
b
|
b
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue