Skip to content

Commit

Permalink
Switch to proc_macro_error2
Browse files Browse the repository at this point in the history
Fixes #441.

proc_macro_error is marked as unmaintained in rustsec:
https://rustsec.org/advisories/RUSTSEC-2024-0370.html

Because proc_macro_error2 removed automatic nightly detection, the error
messages changed slightly.
  • Loading branch information
sbruder committed Sep 7, 2024
1 parent 0254fe1 commit 8943ad4
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 19 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## [Unreleased]

- Switch to `proc_macro_error2`
[#441](https://github.com/lambda-fairy/maud/issues/441)
[#442](https://github.com/lambda-fairy/maud/pull/442)

## [0.26.0] - 2024-01-15

- Remove `AsRef<str>` restriction from `PreEscaped`
Expand Down
5 changes: 3 additions & 2 deletions maud/tests/warnings/keyword-without-at.stderr
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
error: found keyword `if`

= help: should this be a `@if`?

--> $DIR/keyword-without-at.rs:5:9
|
5 | if {}
| ^^
|
= help: should this be a `@if`?
14 changes: 8 additions & 6 deletions maud/tests/warnings/non-string-literal.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,21 @@ error: expected string
| ^^^^

error: attribute value must be a string

= help: to declare an empty attribute, omit the equals sign: `disabled`
= help: to toggle the attribute, use square brackets: `disabled[some_boolean_flag]`

--> tests/warnings/non-string-literal.rs:13:24
|
13 | input disabled=true;
| ^^^^
|
= help: to declare an empty attribute, omit the equals sign: `disabled`
= help: to toggle the attribute, use square brackets: `disabled[some_boolean_flag]`

error: attribute value must be a string

= help: to declare an empty attribute, omit the equals sign: `disabled`
= help: to toggle the attribute, use square brackets: `disabled[some_boolean_flag]`

--> tests/warnings/non-string-literal.rs:14:24
|
14 | input disabled=false;
| ^^^^^
|
= help: to declare an empty attribute, omit the equals sign: `disabled`
= help: to toggle the attribute, use square brackets: `disabled[some_boolean_flag]`
14 changes: 8 additions & 6 deletions maud/tests/warnings/void-element-slash.stderr
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
error: void elements must use `;`, not `/`

= help: change this to `;`
= help: see https://github.com/lambda-fairy/maud/pull/315 for details

--> $DIR/void-element-slash.rs:5:12
|
5 | br /
| ^
|
= help: change this to `;`
= help: see https://github.com/lambda-fairy/maud/pull/315 for details

error: void elements must use `;`, not `/`

= help: change this to `;`
= help: see https://github.com/lambda-fairy/maud/pull/315 for details

--> $DIR/void-element-slash.rs:7:27
|
7 | input type="text" /
| ^
|
= help: change this to `;`
= help: see https://github.com/lambda-fairy/maud/pull/315 for details
2 changes: 1 addition & 1 deletion maud_macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ edition.workspace = true
syn = "2"
quote = "1.0.7"
proc-macro2 = "1.0.23"
proc-macro-error = { version = "1.0.0", default-features = false }
proc-macro-error2 = { version = "2.0.1", default-features = false }

[lib]
name = "maud_macros"
Expand Down
2 changes: 1 addition & 1 deletion maud_macros/src/ast.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use proc_macro2::{TokenStream, TokenTree};
use proc_macro_error::SpanRange;
use proc_macro_error2::SpanRange;
use syn::Lit;

#[derive(Debug)]
Expand Down
2 changes: 1 addition & 1 deletion maud_macros/src/generate.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use proc_macro2::{Delimiter, Group, Ident, Literal, Span, TokenStream, TokenTree};
use proc_macro_error::SpanRange;
use proc_macro_error2::SpanRange;
use quote::quote;

use crate::{ast::*, escape};
Expand Down
2 changes: 1 addition & 1 deletion maud_macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ mod generate;
mod parse;

use proc_macro2::{Ident, Span, TokenStream, TokenTree};
use proc_macro_error::proc_macro_error;
use proc_macro_error2::proc_macro_error;
use quote::quote;

#[proc_macro]
Expand Down
2 changes: 1 addition & 1 deletion maud_macros/src/parse.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use proc_macro2::{Delimiter, Ident, Literal, Spacing, Span, TokenStream, TokenTree};
use proc_macro_error::{abort, abort_call_site, emit_error, SpanRange};
use proc_macro_error2::{abort, abort_call_site, emit_error, SpanRange};
use std::collections::HashMap;

use syn::Lit;
Expand Down

0 comments on commit 8943ad4

Please sign in to comment.