Uh oh!
There was an error while loading. Please reload this page.
typeck: prohibit foreign statics w/ generics - #65133
Conversation
rust-highfive
commented
Oct 5, 2019
r? @cramertj (rust_highfive has picked a reviewer for you, use r? to override) |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Centril
commented
Oct 6, 2019
Odd... ISTM that |
petrochenkov
commented
Oct 6, 2019
Yeah, this should be prevented by some barrier in resolve like |
davidtwco
commented
Oct 6, 2019
I'll modify this PR to prohibit this in resolve instead. |
Centril
commented
Oct 6, 2019
bf1e55c to
1f7a051Compare@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) |
petrochenkov
commented
Oct 8, 2019
I'd rather add a flag for this to ( |
Uh oh!
There was an error while loading. Please reload this page.
1f7a051 to
b514344Comparedavidtwco
commented
Oct 8, 2019
@petrochenkov I've updated the PR to add a flag to |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
b514344 to
5a46a09CompareThis 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
ccbf2b7Comparepetrochenkov
commented
Oct 8, 2019
Thanks! |
bors
commented
Oct 8, 2019
📌 Commit ccbf2b7 has been approved by |
…eneric-in-foreign-mod, r=petrochenkov typeck: prohibit foreign statics w/ generics Fixesrust-lang#65035 and fixesrust-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_ctypesis 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).