Description
In Servo, we have a proc_macro_attribute
named dom_struct
which emits a bunch of other attributes on the types it adorns, among which a derive
attribute. Node
, being itself a DOM struct, obviously uses it.
In the process of making use of inert
, I added an #[inert::neutralize]
attribute on Node
but I put it after #[dom_struct]
, so rustc emitted an "macro attributes must be placed before #[derive]
" error as it should, so far so good.
#[dom_struct]
#[inert::neutralize(as pub unsafe InertNode)] // ERROR: macro attributes must be placed before `#[derive]`
pub struct Node {
...
}
The problem is that the span itself of the error is completely wrong:
error: macro attributes must be placed before `#[derive]`
--> components/script/lib.rs:1:1
|
1 | / /* This Source Code Form is subject to the terms of the Mozilla Public
2 | | * License, v. 2.0. If a copy of the MPL was not distributed with this
3 | | * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4 | |
... |
97 | | use crate::dom::bindings::proxyhandler;
98 | | use crate::serviceworker_manager::ServiceWorkerManager;
| |_____________^
Most notably, use crate::serviceworker_manager::ServiceWorkerManager;
is line 56 in that file.
Things that should be kept in mind while trying to debug that is that I don't use quote_spanned!
for this specific kind of inert::neutralize
attribute, but dom_struct
itself does weird things because of #46489, but I really don't know if the wrong span is related to that bug.