Skip to content
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

Generalize binary operators #23673

Merged
merged 5 commits into from
Mar 30, 2015
Merged

Commits on Mar 30, 2015

  1. Implement new type-checking strategy for binary operators. Basically,

    the plan is to treat all binary operators as if they were overloaded,
    relying on the fact that we have impls for all the builtin scalar
    operations (and no more). But then during writeback we clear the
    overload if the types correspond to a builtin op.
    
    This strategy allows us to avoid having to know the types of the
    operands ahead of time. It also avoids us overspecializing as we did in
    the past.
    nikomatsakis committed Mar 30, 2015
    Configuration menu
    Copy the full SHA
    d649292 View commit details
    Browse the repository at this point in the history
  2. Driveby cleanup of the impl for negation, which had some kind of

    surprising casts. This version more obviously corresponds to the builtin
    semantics.
    nikomatsakis committed Mar 30, 2015
    Configuration menu
    Copy the full SHA
    d6466ff View commit details
    Browse the repository at this point in the history
  3. Fallout where types must be specified.

    This is due to a [breaking-change] to operators. The primary affected
    code is uses of the `Rng` trait where we used to (incorrectly) infer the
    right-hand-side type from the left-hand-side, in the case that the LHS
    type was a scalar like `i32`. The fix is to add a type annotation like
    `x + rng.gen::<i32>()`.
    nikomatsakis committed Mar 30, 2015
    Configuration menu
    Copy the full SHA
    c92bdcb View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    e2b2a53 View commit details
    Browse the repository at this point in the history
  5. Add test case for rust-lang#22743.

    Fixes rust-lang#22743.
    Fixes rust-lang#19035.
    Fixes rust-lang#22099.
    
    (Those all seem to be exactly the same scenario.)
    nikomatsakis committed Mar 30, 2015
    Configuration menu
    Copy the full SHA
    7595c25 View commit details
    Browse the repository at this point in the history