Skip to content

Commit f4c2acb

Browse files
Rollup merge of rust-lang#121120 - nnethercote:LitKind-Err-guar, r=fmease
Add `ErrorGuaranteed` to `ast::LitKind::Err`, `token::LitKind::Err`. Similar to recent work doing the same for `ExprKind::Err` (rust-lang#120586) and `TyKind::Err` (rust-lang#121109). r? `@oli-obk`
2 parents a36a878 + dd3b76d commit f4c2acb

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

proc_macro/src/bridge/mod.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,11 @@ pub enum LitKind {
337337
ByteStrRaw(u8),
338338
CStr,
339339
CStrRaw(u8),
340-
Err,
340+
// This should have an `ErrorGuaranteed`, except that type isn't available
341+
// in this crate. (Imagine it is there.) Hence the `WithGuar` suffix. Must
342+
// only be constructed in `LitKind::from_internal`, where an
343+
// `ErrorGuaranteed` is available.
344+
ErrWithGuar,
341345
}
342346

343347
rpc_encode_decode!(
@@ -352,7 +356,7 @@ rpc_encode_decode!(
352356
ByteStrRaw(n),
353357
CStr,
354358
CStrRaw(n),
355-
Err,
359+
ErrWithGuar,
356360
}
357361
);
358362

proc_macro/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1451,7 +1451,7 @@ impl Literal {
14511451
f(&["cr", hashes, "\"", symbol, "\"", hashes, suffix])
14521452
}
14531453

1454-
bridge::LitKind::Integer | bridge::LitKind::Float | bridge::LitKind::Err => {
1454+
bridge::LitKind::Integer | bridge::LitKind::Float | bridge::LitKind::ErrWithGuar => {
14551455
f(&[symbol, suffix])
14561456
}
14571457
})

0 commit comments

Comments
 (0)