Skip to content

Commit 5f2ae21

Browse files
committed
Parse and lower never type
1 parent 1840c2c commit 5f2ae21

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

chalk-integration/src/lowering.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1427,6 +1427,12 @@ impl LowerTy for Ty {
14271427
substitution: chalk_ir::Substitution::empty(interner),
14281428
})
14291429
.intern(interner)),
1430+
1431+
Ty::Never => Ok(chalk_ir::TyData::Apply(chalk_ir::ApplicationTy {
1432+
name: chalk_ir::TypeName::Never,
1433+
substitution: chalk_ir::Substitution::empty(interner),
1434+
})
1435+
.intern(interner)),
14301436
}
14311437
}
14321438
}

chalk-parse/src/ast.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ pub enum Ty {
222222
ty: Box<Ty>,
223223
},
224224
Str,
225+
Never,
225226
}
226227

227228
#[derive(Copy, Clone, PartialEq, Eq, Debug)]

chalk-parse/src/parser.lalrpop

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ TyWithoutId: Ty = {
224224
},
225225
<ScalarType> => Ty::Scalar { ty: <> },
226226
"str" => Ty::Str,
227+
"!" => Ty::Never,
227228
"fn" "(" <t:Ty> ")" => Ty::ForAll {
228229
lifetime_names: vec![],
229230
ty: Box::new(t)

0 commit comments

Comments
 (0)