-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Allow bounds on type variables in enums & structs #13302
Conversation
It might be good to have a negative test like: struct Foo<X: TraitDoesntExist>;
enum Bar<X: TraitDoesntExist> {}
trait Trait<T> {}
struct Baz<X: Trait<Invalid>>;
enum Qux<X: Trait<Invalid>> {}
trait Trait2<'a> {}
struct Baz2<X: Trait<'a>>;
enum Quz2<X: Trait<'a>>;
fn main() {} just making sure that the bounds are being resolved correctly (i.e. the non-existent traits/params/lifetimes are being correctly error about). I guess having a (valid) |
Note that the corresponding RFC has not yet been merged. This should likely wait until it is merged. |
Now with more tests. |
Does not do any checking of bounds, just allows them to exist.
The RFC for this has been accepted. r? |
Like the RFC, I'm not sure how useful or expected this is unless the type bounds themselves are checked. I don't think that we're gaining much by merging this before the type bounds are checked, and it seems small enough (surprisingly!). Perhaps merging this should wait until the type checking has been implemented? |
I agree with @alexcrichton It may be confusing to be able to specify type bounds and then realize they're not checked. Lets wait for the type checking to be implemented. |
Yeah, it is not useful until we do the checking. But we do need it for that. Happy to wait for the checking before we land this. |
OK, in that case I'm going to close this for now until the checking is implemented as well. |
Don't auto-publish lib crates I believe this should *just* work? With this cargo-workspaces should not consider them
Rustup r? ghost changelog: none
Does not do any checking of bounds, just allows them to exist. Checking will come later