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

Rollup of 11 pull requests #32496

Merged
merged 35 commits into from
Mar 26, 2016
Merged

Rollup of 11 pull requests #32496

merged 35 commits into from
Mar 26, 2016

Commits on Mar 15, 2016

  1. std: Fix inheriting stdin on status()

    This regression was accidentally introduced in rust-lang#31618, and it's just flipping a
    boolean!
    
    Closes rust-lang#32254
    alexcrichton committed Mar 15, 2016
    Configuration menu
    Copy the full SHA
    4124466 View commit details
    Browse the repository at this point in the history

Commits on Mar 22, 2016

  1. Configuration menu
    Copy the full SHA
    3ee841c View commit details
    Browse the repository at this point in the history
  2. Error recovery in the tokeniser

    nrc committed Mar 22, 2016
    Configuration menu
    Copy the full SHA
    2731dc1 View commit details
    Browse the repository at this point in the history

Commits on Mar 23, 2016

  1. Remove ungrammatical dots from the error index.

    They were probably meant as a shorthand for omitted code.
    
    Part of rust-lang#32446 but there should be a separate fix for the issue.
    
    Signed-off-by: NODA, Kai <nodakai@gmail.com>
    nodakai committed Mar 23, 2016
    Configuration menu
    Copy the full SHA
    0950dc3 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    be87650 View commit details
    Browse the repository at this point in the history
  3. Mark str::split_at inline

    bluss committed Mar 23, 2016
    Configuration menu
    Copy the full SHA
    80e7a1b View commit details
    Browse the repository at this point in the history

Commits on Mar 24, 2016

  1. Accept 0 as a valid str char boundary

    Index 0 must be a valid char boundary (invariant of str that it contains
    valid UTF-8 data).
    
    If we check explicitly for index == 0, that removes the need to read the
    byte at index 0, so it avoids a trip to the string's memory, and it
    optimizes out the slicing index' bounds check whenever it is zero.
    
    With this change, the following examples all change from having a read of
    the byte at 0 and a branch to possibly panicing, to having the bounds
    checking optimized away.
    
    ```rust
    pub fn split(s: &str) -> (&str, &str) {
        s.split_at(0)
    }
    
    pub fn both(s: &str) -> &str {
        &s[0..s.len()]
    }
    
    pub fn first(s: &str) -> &str {
        &s[..0]
    }
    
    pub fn last(s: &str) -> &str {
        &s[0..]
    }
    ```
    bluss committed Mar 24, 2016
    Configuration menu
    Copy the full SHA
    f621193 View commit details
    Browse the repository at this point in the history
  2. Tests

    nrc committed Mar 24, 2016
    Configuration menu
    Copy the full SHA
    180d6b5 View commit details
    Browse the repository at this point in the history
  3. make available monomorphizations shared by CGU

    The current setup means that all generics are local to a codegen-unit,
    which means massive duplication.
    nikomatsakis committed Mar 24, 2016
    Configuration menu
    Copy the full SHA
    13877ac View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    8d4b1d1 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    77f033b View commit details
    Browse the repository at this point in the history
  6. Cleanup

    + Fix a comment and add a test based on it
    petrochenkov committed Mar 24, 2016
    Configuration menu
    Copy the full SHA
    b418cd2 View commit details
    Browse the repository at this point in the history

Commits on Mar 25, 2016

  1. Fix unsound behaviour with null characters in thread names (issue rus…

    …t-lang#32475)
    
    Previously, the thread name (&str) was converted to a CString in the
    new thread, but outside unwind::try, causing a panic to continue into FFI.
    
    This patch changes that behaviour, so that the panic instead happens
    in the parent thread (where panic infrastructure is properly set up),
    not the new thread.
    
    This could potentially be a breaking change for architectures who don't
    support thread names.
    
    Signed-off-by: David Henningsson <diwic@ubuntu.com>
    diwic committed Mar 25, 2016
    Configuration menu
    Copy the full SHA
    78495d5 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    5bc2868 View commit details
    Browse the repository at this point in the history
  3. modify #[deriving(Eq)] to emit #[structural_match]

    to careful use of the span from deriving, we
    can permit it in stable code if it derives from
    deriving (not-even-a-pun intended)
    nikomatsakis committed Mar 25, 2016
    Configuration menu
    Copy the full SHA
    99c2a6b View commit details
    Browse the repository at this point in the history
  4. do not overwrite spans as eagerly

    this was required to preserve the span from
    the #[structural_match] attribute -- but honestly
    I am not 100% sure if it makes sense.
    nikomatsakis committed Mar 25, 2016
    Configuration menu
    Copy the full SHA
    05baf64 View commit details
    Browse the repository at this point in the history
  5. issue a future-compat lint for constants of invalid type

    This is a [breaking-change]: according to RFC rust-lang#1445, constants used as
    patterns must be of a type that *derives* `Eq`. If you encounter a
    problem, you are most likely using a constant in an expression where the
    type of the constant is some struct that does not currently implement
    `Eq`. Something like the following:
    
    ```rust
    struct SomeType { ... }
    const SOME_CONST: SomeType = ...;
    
    match foo {
        SOME_CONST => ...
    }
    ```
    
    The easiest and most future compatible fix is to annotate the type in
    question with `#[derive(Eq)]` (note that merely *implementing* `Eq` is
    not enough, it must be *derived*):
    
    ```rust
    struct SomeType { ... }
    const SOME_CONST: SomeType = ...;
    
    match foo {
        SOME_CONST => ...
    }
    ```
    
    Another good option is to rewrite the match arm to use an `if`
    condition (this is also particularly good for floating point types,
    which implement `PartialEq` but not `Eq`):
    
    ```rust
    match foo {
        c if c == SOME_CONST => ...
    }
    ```
    
    Finally, a third alternative is to tag the type with
    `#[structural_match]`; but this is not recommended, as the attribute is
    never expected to be stabilized. Please see RFC rust-lang#1445 for more details.
    nikomatsakis committed Mar 25, 2016
    Configuration menu
    Copy the full SHA
    f69eb8e View commit details
    Browse the repository at this point in the history
  6. suppress duplicate lints

    nikomatsakis committed Mar 25, 2016
    Configuration menu
    Copy the full SHA
    73b4f06 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    56ebf2b View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    7f661ec View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    93e4443 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    e539b74 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    944dc4a View commit details
    Browse the repository at this point in the history
  12. fix error message

    nikomatsakis committed Mar 25, 2016
    Configuration menu
    Copy the full SHA
    2536ae5 View commit details
    Browse the repository at this point in the history

Commits on Mar 26, 2016

  1. Rollup merge of rust-lang#32131 - petrochenkov:prim, r=eddyb

    resolve: Minimize hacks in name resolution of primitive types
    
    When resolving the first unqualified segment in a path with `n` segments and `n - 1` associated item segments, e.g. (`a` or `a::assoc` or `a::assoc::assoc` etc) try to resolve `a` without considering primitive types first. If the "normal" lookup fails or results in a module, then try to resolve `a` as a primitive type as a fallback.
    
    This way backward compatibility is respected, but the restriction from E0317 can be lifted, i.e. primitive names mostly can be shadowed like any other names.
    
    Furthermore, if names of primitive types are [put into prelude](https://github.com/petrochenkov/rust/tree/prim2) (now it's possible to do), then most of names will be resolved in conventional way and amount of code relying on this fallback will be greatly reduced. Although, it's not entirely convenient to put them into prelude right now due to temporary conflicts like `use prelude::v1::*; use usize;` in libcore/libstd, I'd better wait for proper glob shadowing before doing it.
    I wish the `no_prelude` attribute were unstable as intended :(
    
    cc @jseyfried @arielb1
    r? @eddyb
    Manishearth committed Mar 26, 2016
    Configuration menu
    Copy the full SHA
    b8b17a5 View commit details
    Browse the repository at this point in the history
  2. Rollup merge of rust-lang#32199 - nikomatsakis:limiting-constants-in-…

    …patterns-2, r=pnkfelix
    
    Restrict constants in patterns
    
    This implements [RFC 1445](https://github.com/rust-lang/rfcs/blob/master/text/1445-restrict-constants-in-patterns.md). The primary change is to limit the types of constants used in patterns to those that *derive* `Eq` (note that implementing `Eq` is not sufficient). This has two main effects:
    
    1. Floating point constants are linted, and will eventually be disallowed. This is because floating point constants do not implement `Eq` but only `PartialEq`. This check replaces the existing special case code that aimed to detect the use of `NaN`.
    2. Structs and enums must derive `Eq` to be usable within a match.
    
    This is a [breaking-change]: if you encounter a problem, you are most likely using a constant in an expression where the type of the constant is some struct that does not currently implement
    `Eq`. Something like the following:
    
    ```rust
    struct SomeType { ... }
    const SOME_CONST: SomeType = ...;
    
    match foo {
        SOME_CONST => ...
    }
    ```
    
    The easiest and most future compatible fix is to annotate the type in question with `#[derive(Eq)]` (note that merely *implementing* `Eq` is not enough, it must be *derived*):
    
    ```rust
    struct SomeType { ... }
    const SOME_CONST: SomeType = ...;
    
    match foo {
        SOME_CONST => ...
    }
    ```
    
    Another good option is to rewrite the match arm to use an `if` condition (this is also particularly good for floating point types, which implement `PartialEq` but not `Eq`):
    
    ```rust
    match foo {
        c if c == SOME_CONST => ...
    }
    ```
    
    Finally, a third alternative is to tag the type with `#[structural_match]`; but this is not recommended, as the attribute is never expected to be stabilized. Please see RFC rust-lang#1445 for more details.
    
    cc rust-lang#31434
    
    r? @pnkfelix
    Manishearth committed Mar 26, 2016
    Configuration menu
    Copy the full SHA
    128b2ad View commit details
    Browse the repository at this point in the history
  3. Rollup merge of rust-lang#32257 - alexcrichton:fix-status-stdin, r=at…

    …uron
    
    std: Fix inheriting stdin on status()
    
    This regression was accidentally introduced in rust-lang#31618, and it's just flipping a
    boolean!
    
    Closes rust-lang#32254
    Manishearth committed Mar 26, 2016
    Configuration menu
    Copy the full SHA
    a8d59e0 View commit details
    Browse the repository at this point in the history
  4. Rollup merge of rust-lang#32435 - nrc:fix-err-recover, r=nikomatsakis

    Some fixes for error recovery in the compiler
    Manishearth committed Mar 26, 2016
    Configuration menu
    Copy the full SHA
    b55d772 View commit details
    Browse the repository at this point in the history
  5. Rollup merge of rust-lang#32447 - nodakai:dots-in-err-idx, r=Manishearth

    Remove ungrammatical dots from the error index.
    
    They were probably meant as a shorthand for omitted code.
    
    Part of rust-lang#32446 but there should be a separate fix for the issue.
    Manishearth committed Mar 26, 2016
    Configuration menu
    Copy the full SHA
    515e87d View commit details
    Browse the repository at this point in the history
  6. Rollup merge of rust-lang#32448 - sfackler:time-augmented-assignment,…

    … r=alexcrichton
    
    Add augmented assignment operator impls for time types
    
    r? @alexcrichton
    Manishearth committed Mar 26, 2016
    Configuration menu
    Copy the full SHA
    023fae6 View commit details
    Browse the repository at this point in the history
  7. Rollup merge of rust-lang#32456 - bluss:str-zero, r=alexcrichton

    Hardcode accepting 0 as a valid str char boundary
    
    If we check explicitly for index == 0, that removes the need to read the
    byte at index 0, so it avoids a trip to the string's memory, and it
    optimizes out the slicing index' bounds check whenever it is (a constant) zero.
    Manishearth committed Mar 26, 2016
    Configuration menu
    Copy the full SHA
    6710278 View commit details
    Browse the repository at this point in the history
  8. Rollup merge of rust-lang#32469 - nikomatsakis:shared-cgu, r=eddyb

    make available monomorphizations shared by CGU
    
    The current setup means that all generics are local to a codegen-unit,
    which means massive duplication.
    Manishearth committed Mar 26, 2016
    Configuration menu
    Copy the full SHA
    e3e5824 View commit details
    Browse the repository at this point in the history
  9. Rollup merge of rust-lang#32476 - diwic:63-null-thread-name, r=alexcr…

    …ichton
    
    Fix unsound behaviour with null characters in thread names (issue rust-lang#32475)
    
    Previously, the thread name (&str) was converted to a CString in the
    new thread, but outside unwind::try, causing a panic to continue into FFI.
    
    This patch changes that behaviour, so that the panic instead happens
    in the parent thread (where panic infrastructure is properly set up),
    not the new thread.
    
    This could potentially be a breaking change for architectures who don't
    support thread names.
    Manishearth committed Mar 26, 2016
    Configuration menu
    Copy the full SHA
    d36cb22 View commit details
    Browse the repository at this point in the history
  10. Rollup merge of rust-lang#32482 - nikomatsakis:erase-via-visitor, r=n…

    …agisa
    
    use new visitor to erase regions
    
    r? @nagisa
    Manishearth committed Mar 26, 2016
    Configuration menu
    Copy the full SHA
    317acb7 View commit details
    Browse the repository at this point in the history
  11. Fixup rust-lang#32476

    Manishearth committed Mar 26, 2016
    Configuration menu
    Copy the full SHA
    6c10866 View commit details
    Browse the repository at this point in the history