-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Remove the default Send bound on traits #13050
Conversation
LGTM. I always try to keep each commit "compilable" so, I'd prefer if these commits were squashed. |
@flaper87 these cases are often a good time to break that (useful) rule, to make it super-clear what the core change is, and what the purely mechanical fix-ups are. |
@huonw agreed, I find them useful as well. Perhaps those could be squashed after the review and before the final approve. With that we'd loose the benefit of these commits being split in the history, though. Anyway, probably not a big deal. |
There doesn't seem to be a way to specific bounds on generic trait objects (#9265). Neither of these parse: trait Foo<T> {}
let _: ~Foo:Freeze<int>;
let _: ~Foo<int>:Freeze; This PR is blocked on that issue. |
Why is this blocked on that issue? The issue is certainly more pressing, but it would be nice to get off the default bounds as soon as possible. |
Because without the new parsing there's literally no way to have a sendable generic trait object; while the current situation just means you're forced to use sendable ones even when a non-sendable one is sufficient. (In any case, the point is moot since you opened #13079.) |
👍 I'm happy to see this, I was just thinking "Oh, I should go implement that by now, might be something I can do in my spare time." Instead, I'll review. :) |
@@ -686,7 +686,7 @@ fn test_repr() { | |||
exact_test(&println, "fn(&str)"); | |||
exact_test(&swap::<int>, "fn(&mut int, &mut int)"); | |||
exact_test(&is_alphabetic, "fn(char) -> bool"); | |||
exact_test(&(~5 as ~ToStr), "~to_str::ToStr:Send"); | |||
exact_test(&(~5 as ~ToStr), "~to_str::ToStr<no-bounds>"); |
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.
We have got to change this printout. (not necessarily in this PR)
The changes look good to me. I say r+ pending resolution of @huonw's objection. |
@nikomatsakis, @huonw, with #13079 soon-to-land (hopefully!), are you guys ok with this? @nikomatsakis, you may also be interested in #13155 as to why I had to write |
@alexcrichton could you also update the docs? There's a line in the tutorial that says |
@flaper87, good catch, I've updated the docs a bit. |
r=me with minor docs edits |
This commit removes implicitly adding the Send bound to ~Trait objects and procedure types. It will now be manually required to specify that a procedure or trait must be send-able. Closes rust-lang#10296
This is all purely fallout of getting the previous commit to compile.
See #10296 for the rationale, and commits for the implementation.
Misc refactorings Various small re-orderings to check the HIR tree or AST before doing other checks. Also includes a small bug fix for `arc_with_small_send_sync` not actually checking for `Arc::new`. changelog: none
See #10296 for the rationale, and commits for the implementation.