-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not allow extern unsized_fn_param #123894
Conversation
type ExternType; | ||
} | ||
|
||
fn f(_: ExternType) {} //~ ERROR the size for values of type `ExternType` cannot be known at compilation time |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, what happens when we monomorphize some fn f<T: ?Sized>(_: T)
by calling it with a value of ExternType
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another good point! I'm not hugely familiar with the monomorphization code, but have pushed a solution d98f42b. I'm not hugely comfortable with it though:
- it can trigger new recursion depth failures (perhaps this can't be avoided however?);
- I guess it could end up being evaluated for the same mono item multiple times, which would be unnecessary—but I don't quite understand the monomorphization process well enough to see how this can best be avoided?
- does it need a perf run?
somewhat afraid this solution is not general enough -- can you check that this makes sense in other related cases? r? compiler-errors |
Hm -- I believe might be the correct approach if we were going to stabilize The problem here is that if we were to check unsized param validity in a principled way, it would be making sure that all params are Honestly |
…iler-errors make unsized_fn_params an internal feature As suggested [here](rust-lang#123894 (comment)). r? `@compiler-errors` Fixes rust-lang#123887 (kind of -- ICEs on internal features are considered acceptable so this issue is not-a-bug once this PR lands)
…iler-errors make unsized_fn_params an internal feature As suggested [here](rust-lang#123894 (comment)). r? ``@compiler-errors`` Fixes rust-lang#123887 (kind of -- ICEs on internal features are considered acceptable so this issue is not-a-bug once this PR lands)
…iler-errors make unsized_fn_params an internal feature As suggested [here](rust-lang#123894 (comment)). r? `@compiler-errors` Fixes rust-lang#123887 (kind of -- ICEs on internal features are considered acceptable so this issue is not-a-bug once this PR lands)
Rollup merge of rust-lang#126830 - RalfJung:unsized-fn-params, r=compiler-errors make unsized_fn_params an internal feature As suggested [here](rust-lang#123894 (comment)). r? `@compiler-errors` Fixes rust-lang#123887 (kind of -- ICEs on internal features are considered acceptable so this issue is not-a-bug once this PR lands)
make unsized_fn_params an internal feature As suggested [here](rust-lang/rust#123894 (comment)). r? `@compiler-errors` Fixes rust-lang/rust#123887 (kind of -- ICEs on internal features are considered acceptable so this issue is not-a-bug once this PR lands)
Fixes #123887