-
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
Make Box<dyn FnOnce> respect self alignment #71170
Conversation
f630df3
to
da12757
Compare
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.
Also, needs a test!
da12757
to
d8549c0
Compare
oh, test was left untracked on my computer. |
733373a
to
cb22781
Compare
This is still not working :/ |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
a94808a
to
c8e6669
Compare
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
4755471
to
b285807
Compare
b285807
to
b3d4262
Compare
@nikomatsakis @eddyb this should be now ready for review. |
986b0e2
to
33ceb58
Compare
let local_scope = self.local_scope(); | ||
let expr = self.hir.mirror(expr); | ||
|
||
if tcx.features().unsized_locals { |
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.
Do we need this feature check? I guess that unsized locals, if passed, will get an error elsewhere in the compiler anyway.
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 I suppose it doesn't hurt.
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 think @eddyb had talked about possibly adding a second feature gate here.. not sure if we want to consider that in this PR? Probably not, since I imagine it may require unrelated changes elsewhere.
--> $DIR/double-move.rs:45:9 | ||
| | ||
LL | let _y = *x; | ||
| -- value moved here | ||
LL | x.foo(); | ||
| ^ value used here after move | ||
| ^ value used here after partial move |
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.
These changes seem ok 👍
@@ -45,12 +45,12 @@ LL | println!("{}", &y); | |||
error[E0382]: borrow of moved value: `x` | |||
--> $DIR/borrow-after-move.rs:39:24 | |||
| | |||
LL | let x = "hello".to_owned().into_boxed_str(); | |||
| - move occurs because `x` has type `std::boxed::Box<str>`, which does not implement the `Copy` trait |
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.
So... this is a bit suboptimal, in that the move is really occurring because foo
was invoked on *x
-- i.e., the type str
-- but the new IR makes the borrow checker see it otherwise. I'm not sure how easy/hard that would be to fix. Probably not worth worrying about, I think.
33ceb58
to
683a5fb
Compare
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
844a496
to
365807f
Compare
@spastorino I pushed the edits to the comments that I made, as requested. I think they're a mild improvement. |
@bors r+ |
📌 Commit 4e53a9a has been approved by |
☀️ Test successful - checks-azure |
Remove the `<Box<F> as FnOnce>::call_once` hack now that rust-lang/rust#71170 is merged.
Did this also fix #61042? |
Closes #68304
r? @eddyb @nikomatsakis