Skip to content

Extern fn declarations can have dangling lifetimes #35851

Closed
@Manishearth

Description

@Manishearth
extern {
    fn foo() -> &u8;
}

(playpen)

compiles fine. The &u8 has a dangling lifetime, which doesn't compile for functions that have bodies.

This probably should throw an error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lifetimesArea: Lifetimes / regionsC-bugCategory: This is a bug.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.I-unsoundIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessP-mediumMedium priorityT-langRelevant to the language team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions