Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Correct inference of primitive operand type behind binary operation #68129
The code seems fine, but I think we probably ought to document the behavior of this part of the type-checker better. This effects the lang spec in the end. Perhaps the reference is the right place? I don't think we have a lot of "framework" for doing so, but I think it's probably a good idea for us to start collecting these sorts of things in the reference.
This is tricky, though, as we don't have any sort of "framework", and it's hard to describe the structure of the rules without that. Still, I wouldn't want to get too hung up on (e.g) figuring out the best way to write typing judgements.
Maybe we should start by documenting in rustc-guide or in an open issue to start?
@rfcbot fcp merge
Discussed in today's @rust-lang/lang meeting. The consensus of the meeting was that we should make this change, but we're doing an fcp merge to make it official.
We did think it would be good to add some more tests:
Team member @nikomatsakis has proposed to merge this. The next step is review by the rest of the tagged team members:
No concerns currently listed.
Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!
See this document for info about what commands tagged team members can give me.
Just to clarify, do you mean cases like the following?
let _ = 0 + &0;
This currently passes, as it defaults to
I've added the suggested test cases.
Rollup of 7 pull requests Successful merges: - #68129 (Correct inference of primitive operand type behind binary operation) - #68475 (Use a `ParamEnvAnd<Predicate>` for caching in `ObligationForest`) - #68856 (typeck: clarify def_bm adjustments & add tests for or-patterns) - #69051 (simplify_try: address some of eddyb's comments) - #69128 (Fix extra subslice lowering) - #69150 (Follow-up to #68848) - #69164 (Update pulldown-cmark dependency) Failed merges: r? @ghost