Skip to main content

## FUNCTION_ITEM_REFERENCES

# Static FUNCTION_ITEM_REFERENCES

Source

    pub static FUNCTION_ITEM_REFERENCES: &'static Lint

Expand description

The `function_item_references` lint detects function references that are formatted with `fmt::Pointer` or transmuted.

#### §Example

    fn foo() { }

    fn main() {
        println!("{:p}", &foo);
    }

{{produces}}

#### §Explanation

Taking a reference to a function may be mistaken as a way to obtain a pointer to that function. This can give unexpected results when formatting the reference as a pointer or transmuting it. This lint is issued when function references are formatted as pointers, passed as arguments bound by `fmt::Pointer` or transmuted.