-
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
rustc: inference for numeric literals does not take default type parameters into account #15760
Comments
cc @wycats, @brson, @alexcrichton |
This seems like it would be nice to have, especially for the |
A pointer size integer doesn't make much sense as a default for |
@alexcrichton I think we should probably push for un-feature gating anyway, as we're using this feature in other important places in @thestinger The I do think that providing a default for |
I tried implementing a more general form of this, and it's not that hard to hook it up to our existing inference infrastructure. |
@eddyb :( I'm sorry to hear that. I've spoken to @nikomatsakis about the general idea of using default type parameters as a fallback, and he seems to think it's a good idea. If you'd like, we could collaborate on an RFC and then try to revive your PR. |
@eddyb Relatedly, I would like to push to un-feature gate default type parameters, as they are proving useful in multiple places in |
What happened to this? |
AIUI, rust-lang/rfcs#213 proposes this feature, but hasn’t been merged yet. |
This code now compiles. |
It only compiles because we default to |
Triage: the OP's code compiles fine on nightly with many warnings:
On stable, without the feature pragma, the warning on default for functions will be a hard error in future release, as mentioned on the nightly warnings. |
@Mark-Simulacrum I think this issue can be closed as a subissue of #27336, the fate of this will be decided by what we do with that RFC. It's certainly not "just a bug". |
Yeah, that's true. Thanks -- closing. |
… for Default Type Parameter Fallback)
make mir::ProjectionStore-impls pub-accessible When using RA as a crate the `mir::Place` `projection` is accessible, however there is no way to translate the `ProjectionId` to a `&[PlaceElem]`, as the `ProjectionId::lookup` is private. Personally, I would only need the `ProjectionId::lookup`-fn to be `pub`, but I don't see any reason why the others should be kept private.. am I missing something `@HKalbasi` ? Relates to: rust-lang/rust-analyzer#15575
The following code fails to compile:
with
despite the fact that the actual type is determinant.
Fixing this problem could help mitigate problems with the
int
fallback: for functions likerange
, we could provide a default type parameter of, say,uint
while retaining flexibility for other types. (Doing so loses some of the benefit of the fallback removal, but we can introduce defaults in a controlled way.)The text was updated successfully, but these errors were encountered: