Skip to content

Conversation

@WaffleLapkin
Copy link
Member

This commit is dated 2025-02-02, I accidentally found it while looking for something else lol.

@rustbot rustbot added the S-waiting-on-review Status: The marked PR is awaiting review from a maintainer label May 7, 2025

r[coerce.types.never]
* `!` to any `T`
* `!` to any `T` which is `Sized`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you happen to have an example of something that would work but for this?

@WaffleLapkin
Copy link
Member Author

Checking again, it doesn't seem like this restriction is present in rustc (anymore?). Indeed this program (using incomplete features though!) compiles:

#![feature(unsized_locals)]

fn main() {
    let x: [()] = panic!();
    f(&x);
}

fn f(_: &[()]) {}

In practice though you can't make code that would do this coercion, simply because all coercion sites require sized types.

@WaffleLapkin WaffleLapkin deleted the never-sized branch May 9, 2025 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: The marked PR is awaiting review from a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants