-
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
error[E0713] unexpectedly disappeared between 1.52 and 1.53 #89848
Comments
@rustbot label +E-needs-mcve |
So nobody does duplicate work: I should have the example in a few minutes, down to about 15 lines right now. (Also in my defence, I wrote my buggy code at something like 3AM, I should be more careful there 😴) |
use std::ptr::NonNull;
#[derive(Clone)]
pub struct A(NonNull<()>);
impl Drop for A {
fn drop(&mut self) {
unimplemented!()
}
}
impl A {
pub fn bug(&self) -> &() {
unsafe { self.clone().0.as_ref() }
}
} This (in standard lib.rs) shows the aforementioned behaviour. It does (correctly) fail to compile in newer versions if the field is a plain |
I see, seems like I hit the odd corner case where it would have been a helpful heuristic, (I personally would prefer a small speed bump here, but I'm unsure what that would look like without getting in the way elsewhere.) |
Looks like then this should be added to a changelog or somewhere to let people know. @rust-lang/release perhaps ? @rustbot label -I-prioritize +T-release |
Cc @thomcc @rust-lang/libs-api since at least my skin of the PR which introduced this suggests we didn't expect changes like this (which could be viewed as code that used to be "sound" since it didn't compile and now does). #80771 But I expect we probably don't want to do anything here - this feels a little similar to the known gap in lints around CString::as_ptr (lack of) lifetime. So just a heads up in case anyone has particular thoughts. I'm not sure that anything in the release notes would be all that meaningful here, but if there's a PR posted amending those we can probably merge it. |
Code
I tried this code:
(https://github.com/Tamschi/tiptoe/blob/11e8b4fc7d8e012273df15eb6429999ef98e9682/src/sync.rs#L336-L352)
I expected to see this happen:
The code above is wrong, as it implicitly decrements the Arc's counter. (
Self
is a customArc
.)On Rust 1.52 and earlier, I get the following very helpful error here:
Instead, this happened:
Starting with Rust 1.53, I get no error:
Version it worked on
It most recently worked on:
rustc +1.52 --version --verbose
Version with regression
rustc +1.53 --version --verbose
:Backtrace
Not applicable.
I couldn't find anything related in the release notes, so I assume this is right:
@rustbot modify labels: +regression-from-stable-to-stable -regression-untriaged
The text was updated successfully, but these errors were encountered: