-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Traits extending kinds / built-in traits #7083
Comments
Nominating for milestone feature complete. |
Testcase: trait Foo: Send {
pub fn sendit(self) {
do spawn {
printfln!("%?", self);
}
}
}
fn foo<T: Foo>(x: T) {
x.sendit();
}
impl Foo for int;
fn main() {
let x = 5i;
foo(x);
} fails with:
@nikomatsakis I think this error is a different bug? |
In addition to inheriting from the builtin kinds, should we allow boxing up as the builtin kinds? I can't imagine what possible use this could have, as no vtable could be generated, but something like: fn main() {
let x = ~() as ~Send;
} currently errors with
because of code very similar to the code I will be changing for this, in |
I ... see no reason to allow that in particular, since the built-in kinds have no methods, but I guess if it's easy to do? |
Probably it is not trivial to do. |
For #7083. The metadata issue with the old version is now fixed. Ready for review. This is also not the full solution to #7083, because this is not supported yet: ``` trait Foo : Send { } impl <T: Send> Foo for T { } fn foo<T: Foo>(val: T, chan: std::comm::Chan<T>) { chan.send(val); } ``` cc @nikomatsakis
For #7083. The metadata issue with the old version is now fixed. Ready for review. This is also not the full solution to #7083, because this is not supported yet: ``` trait Foo : Send { } impl <T: Send> Foo for T { } fn foo<T: Foo>(val: T, chan: std::comm::Chan<T>) { chan.send(val); } ``` cc @nikomatsakis
…effen Add lint to check for boolean comparison in assert macro calls This PR adds a lint to check if an assert macro is using a boolean as "comparison value". For example: ```rust assert_eq!("a".is_empty(), false); ``` Could be rewritten as: ```rust assert!(!"a".is_empty()); ``` PS: The dev guidelines are amazing. Thanks a lot for writing them! changelog: Add `bool_assert_comparison` lint
You should be able to write:
and then have a parameter like
where this also implies that
T
isSized
.Related to #5527
The text was updated successfully, but these errors were encountered: