-
Notifications
You must be signed in to change notification settings - Fork 13.3k
More 0.7 release notes #7165
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
More 0.7 release notes #7165
Conversation
* The `main` function is only detected at the topmost level of the crate. | ||
The `#[main]` attribute is still valid anywhere. | ||
* Struct fields may no longer be mutable. Use inherited mutability. | ||
* Oh, but actually you can put `#[mutable]` on a field if you *really* |
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.
Is this true? I thought that this just turned on some bit about the type information in middle::ty
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.
Well, it's required if you're going to use unsafe code to hack around the mutability rules. Perhaps it shouldn't be mentioned at all, since it's just an edge case feature.
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.
But this doesn't mean that this is valid code, right?
struct A {
#[mutable]
a: int
}
fn main() {
let a = A{ a: 3 };
a.a = 4;
}
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.
I concur, don't even mention the attribute.
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.
That won't work. It can only be applied to the type (not a field or variant) and all it does is make it not classified as Const
(soon to be Freeze
). Making it safe is still entirely up to the user, it's just one tool required to make a type like RcMut
safe.
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.
If #[mutable]
and #[non_owned]
both turn off traits perhaps we can name them similarly, #[non_send]
, #[non_freeze]
, etc?
Both of these are added in 0.7. It seems notable that we are providing this way to turn off a feature of the type system, so I'm inclined to mention it.
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.
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.
OK, updated to reflect this feedback. Thanks.
Fix needless_quesiton_mark false positive changelog: Fix [`needless_question_mark`] false positive where the inner value is implicity dereferenced by the question mark. Fixes rust-lang#7107
No description provided.