Skip to content

variable in macro output incorrectly reported as unused  #5718

Closed
@metajack

Description

@metajack

In the code here:

macro_rules! handle_heading_element(
    ($tag:expr, $string:expr, $ctor:ident, $type_id:expr, $level:expr) => (
        if eq_slice($tag, $string) {
            let _element = ~HTMLHeadingElement {
                parent: Element::new($type_id, ($tag).to_str()),
                level: $level
            };
            unsafe {
                return Node::as_abstract_node(_element);
            }
        }
    )
)

(taken from jack's servo repo.)

The compiler will complain that element is unused unless I prefix it with _, even though it is clearly used shortly after.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.A-syntaxextArea: Syntax extensionsE-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.P-lowLow priority

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions