Improve non-boolean literal error in cfg predicate

This commit is contained in:
Urgau
2024-10-01 10:25:18 +02:00
parent 781f1840cd
commit a3ffa1eae5
5 changed files with 7 additions and 3 deletions

View File

@@ -36,6 +36,7 @@ pub fn is_builtin_attr(attr: &Attribute) -> bool {
pub(crate) enum UnsupportedLiteralReason {
Generic,
CfgString,
CfgBoolean,
DeprecatedString,
DeprecatedKvPair,
}
@@ -623,7 +624,7 @@ pub fn eval_condition(
_ => {
dcx.emit_err(session_diagnostics::UnsupportedLiteral {
span: cfg.span(),
reason: UnsupportedLiteralReason::Generic,
reason: UnsupportedLiteralReason::CfgBoolean,
is_bytestr: false,
start_point_span: sess.source_map().start_point(cfg.span()),
});