-
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
RFC: Centralize on special types as a way of informing inference about special constraints #10834
Comments
Some arguments I considered in favor of using marker types:
|
Marker types seem relatively straightforward to use for structs, but could it result in awkwardness for enum variants, especially because they are more frequently destructured? Even if there they are easily ignored, there is still some programmer overhead in ignoring a field that does not contain any data. |
|
One positive aspect of this is that it commits us to basically nothing in terms of backwards compatibility at the language level. If we later come up with a better way to do these, we can add that and also keep the marker types around without any awkwardness. |
On Fri, Dec 06, 2013 at 06:41:20AM -0800, zkamsler wrote:
There is an easy workaround. Convert
to
|
@sfackler I agree that non copyable should be integrated as a lang item into the compiler, though I don't think that we should necessarily prohibit types that contain dtors from appearing as static items (as I explained in that issue at some point). |
cc @thestinger, as one of the bigger users of these sorts of annotations. This was discussed in meeting on dec 10 and generally approved of. |
Accepted for 1.0, P-backcompat-libs |
This pull request partially addresses the 2 issues listed before. As part of the work required for this PR, `NonCopyable` was completely removed. This PR also replaces the content of `type_is_pod` with `TypeContents::is_pod`, although `type_is_content` is currently not being used anywhere. I kept it for consistency with the other functions that exist in this module. cc #10834 cc #10577 Proposed static restrictions ===================== Taken from [this](#11979 (comment)) comment. I expect some code that, at a high-level, works like this: - For each *mutable* static item, check that the **type**: - cannot own any value whose type has a dtor - cannot own any values whose type is an owned pointer - For each *immutable* static item, check that the **value**: - does not contain any ~ or box expressions (including ~[1, 2, 3] sort of things, for now) - does not contain a struct literal or call to an enum variant / struct constructor where - the type of the struct/enum is freeze - the type of the struct/enum has a dtor
This pull request partially addresses the 2 issues listed before. As part of the work required for this PR, `NonCopyable` was completely removed. This PR also replaces the content of `type_is_pod` with `TypeContents::is_pod`, although `type_is_content` is currently not being used anywhere. I kept it for consistency with the other functions that exist in this module. cc #10834 cc #10577 Proposed static restrictions ===================== Taken from [this](#11979 (comment)) comment. I expect some code that, at a high-level, works like this: - For each *mutable* static item, check that the **type**: - cannot own any value whose type has a dtor - cannot own any values whose type is an owned pointer - For each *immutable* static item, check that the **value**: - does not contain any ~ or box expressions (including ~[1, 2, 3] sort of things, for now) - does not contain a struct literal or call to an enum variant / struct constructor where - the type of the struct/enum is freeze - the type of the struct/enum has a dtor
…xFrednet Use URL parameters for filter states This fixes rust-lang#8510 by storing Clippy Lints page filter configuration in the URL parameters. This includes: - Lint levels - Lint groups - Version filters "Filter" was already present in the URL and its behavior is retained. There is existing support for passing a `sel` query parameter; this is also retained, but I am not sure if it used in the wild. The URL parameters only get included if they are modified after loading the page. I have these changes available here in case people want to play with it: https://whee.github.io/rust-clippy/master/ An example with levels, groups, and versions set (oddly): https://whee.github.io/rust-clippy/master/#/?groups=pedantic,perf&levels=allow,warn&versions=gte:53,lte:57,eq:54 Adding a filter: https://whee.github.io/rust-clippy/master/#/manual_str_repeat?groups=pedantic,perf&levels=allow,warn&versions=gte:53,lte:57,eq:54 --- changelog: Docs: [`Clippy's lint list`] now stores filter parameters in the URL, to allow easy sharing [rust-lang#10834](rust-lang/rust-clippy#10834) <!-- changelog_checked -->
As part of the discussion in #5922, it became clear that there are a number of cases in which we must inform the compiler about special constraints that pertain to specific types. These constraints almost always arise because of unsafe code that does things the compiler can't know about. We don't have a central mechanism for propagating such constraints:
#[no_freeze]
are used to inform the builtin-bounds.I think we should centralize on one mechanism. My current thought is to employ 0-sized types for this. So we would remove the
#[no_freeze]
annotations and add types likeNonfreezable
, as well asCovariantLifetime<'a>
and so on. These would be lang items specially recognized by the compiler.Nominating and adding to the agenda for next week.
The text was updated successfully, but these errors were encountered: