Skip to content

Infallible nature of windows 10 RNG isn't propagated to user during runtime #592

Closed
@silverstillisntgold

Description

@silverstillisntgold

Pull #579 was made specifically so rustc could eliminate the failure branch when using getrandom in external code. But I failed to realize that since calls to fill_inner are cross-crate, the compiler only sees the returned Result and can't remove the dead branch. This is easily solved by giving fill_inner in the windows backend the inline annotation, but I was unsure if this would be acceptable, since it seems like no other backed implementation is inlined, even when it's just a brief redirect to a system call.

Is it a policy of getrandom to have fill_inner as the crate boundary in final binaries? Would it be worth it to consider an exception for the windows implementation, since it's a unique case of not being able to fail?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions