-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
typeck: prohibit foreign statics w/ generics #65133
typeck: prohibit foreign statics w/ generics #65133
Conversation
r? @cramertj (rust_highfive has picked a reviewer for you, use r? to override) |
Odd... ISTM that |
Yeah, this should be prevented by some barrier in resolve like |
I'll modify this PR to prohibit this in resolve instead. |
bf1e55c
to
1f7a051
Compare
@petrochenkov I've re-worked this PR to fix this in resolve instead. I've introduced a (cc @varkor, this also resolves your comment about const params) |
I'd rather add a flag for this to ( |
1f7a051
to
b514344
Compare
@petrochenkov I've updated the PR to add a flag to |
b514344
to
5a46a09
Compare
This commit modifies resolve to disallow foreign statics that use parent generics. `improper_ctypes` is not written to support type parameters, as these are normally disallowed before the lint is run. Thus, type parameters in foreign statics must be prohibited before the lint. The only other case where this *could* have occured is in functions, but typeck prohibits this with a "foreign items may not have type parameters" error - a similar error did not exist for statics, because statics cannot have type parameters, but they can use any type parameters that are in scope (which isn't the case for functions). Signed-off-by: David Wood <david@davidtw.co>
5a46a09
to
ccbf2b7
Compare
Thanks! |
📌 Commit ccbf2b7 has been approved by |
…eneric-in-foreign-mod, r=petrochenkov typeck: prohibit foreign statics w/ generics Fixes rust-lang#65035 and fixes rust-lang#65025. This PR modifies resolve to disallow foreign statics that have generics. `improper_ctypes` is not written to support type parameters, as these are normally disallowed before the lint is run. Thus, type parameters in foreign statics must be prohibited before the lint. The only other case where this *could* have occured is in functions, but typeck prohibits this with a "foreign items may not have type parameters" error - a similar error did not exist for statics, because statics cannot have type parameters, but they can use any type parameters that are in scope (which isn't the case for functions).
Rollup of 7 pull requests Successful merges: - #64284 (Warn if include macro fails to include entire file) - #65081 (Remove -Zprofile-queries) - #65133 (typeck: prohibit foreign statics w/ generics) - #65135 (Add check for missing tests for error codes) - #65141 (Replace code of conduct with link) - #65194 (Use structured suggestion for removal of `as_str()` call) - #65213 (Ignore `ExprKind::DropTemps` for some ref suggestions) Failed merges: r? @ghost
Fixes #65035 and fixes #65025.
This PR modifies resolve to disallow foreign statics that have
generics.
improper_ctypes
is not written to support type parameters, as theseare normally disallowed before the lint is run. Thus, type parameters in
foreign statics must be prohibited before the lint.
The only other case where this could have occured is in functions,
but typeck prohibits this with a "foreign items may not have type
parameters" error - a similar error did not exist for statics, because
statics cannot have type parameters, but they can use any
type parameters that are in scope (which isn't the case for functions).