Skip to content

Commit 29cb1c8

Browse files
committed
improve the span for "wrong judgment name" error
1 parent 4285909 commit 29cb1c8

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

crates/formality-core/src/judgment.rs

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -178,15 +178,20 @@ macro_rules! push_rules {
178178
) => {
179179
// Found the conclusion.
180180
{
181-
// give the user a type error if the name they gave
182-
// in the conclusion is not the same as the name of the
183-
// function
184-
#[allow(dead_code)]
185-
struct WrongJudgmentNameInConclusion;
186-
const _: WrongJudgmentNameInConclusion = {
187-
let $judgment_name = WrongJudgmentNameInConclusion;
181+
$crate::respan!(
188182
$conclusion_name
189-
};
183+
(
184+
// give the user a type error if the name they gave
185+
// in the conclusion is not the same as the name of the
186+
// function
187+
#[allow(dead_code)]
188+
struct WrongJudgmentNameInConclusion;
189+
const _: WrongJudgmentNameInConclusion = {
190+
let $judgment_name = WrongJudgmentNameInConclusion;
191+
$conclusion_name
192+
};
193+
)
194+
);
190195

191196
if let Some(__JudgmentStruct($($input_names),*)) = Some($input_value) {
192197
$crate::push_rules!(@match

0 commit comments

Comments
 (0)