Skip to content
Permalink
Branch: cmp
Commits on Dec 3, 2019
Commits on Dec 1, 2019
  1. Remove ord lang item

    CAD97 committed Dec 1, 2019
  2. Auto merge of rust-lang#66917 - Centril:rollup-xj2enik, r=Centril

    bors committed Dec 1, 2019
    Rollup of 9 pull requests
    
    Successful merges:
    
     - rust-lang#66503 (More useful test error messages on should_panic(expected=...) mismatch)
     - rust-lang#66662 (Miri: run panic-catching tests in liballoc)
     - rust-lang#66679 (Improve lifetime errors with implicit trait object lifetimes)
     - rust-lang#66726 (Use recursion_limit for const eval stack limit)
     - rust-lang#66790 (Do `min_const_fn` checks for `SetDiscriminant`s target)
     - rust-lang#66832 (const_prop: detect and avoid catching Miri errors that require allocation)
     - rust-lang#66880 (Add long error code explanation message for E0203)
     - rust-lang#66890 (Format liballoc with rustfmt)
     - rust-lang#66896 (pass Queries to compiler callbacks)
    
    Failed merges:
    
    r? @ghost
  3. Rollup merge of rust-lang#66896 - RalfJung:queries, r=Zoxc

    Centril committed Dec 1, 2019
    pass Queries to compiler callbacks
    
    rust-lang#66791 made it impossible to access the tcx in the callbacks; this should fix that.
    
    r? @Zoxc
  4. Rollup merge of rust-lang#66890 - dtolnay:fmt4, r=Dylan-DPC

    Centril committed Dec 1, 2019
    Format liballoc with rustfmt
    
    Same strategy as rust-lang#66691 -- as with my previous formatting PRs, I am avoiding causing merge conflicts in other PRs by only touches those files that are not involved in any currently open PR. Files that appear in new PRs between when this PR is opened and when it makes it to the top of the bors queue will be reverted from this PR.
    
    The list of files involved in open PRs is determined by querying GitHub's GraphQL API [with this script](https://gist.github.com/dtolnay/aa9c34993dc051a4f344d1b10e4487e8).
    
    With the list of files from the script in outstanding_files, the relevant commands were:
    
    ```
    $ find src/liballoc -name '*.rs' \
        | xargs rustfmt --edition=2018 --unstable-features --skip-children
    $ rg liballoc outstanding_files | xargs git checkout --
    ```
    
    To confirm no funny business:
    
    ```
    $ git checkout $THIS_COMMIT^
    $ git show --pretty= --name-only $THIS_COMMIT \
        | xargs rustfmt --edition=2018 --unstable-features --skip-children
    $ git diff $THIS_COMMIT  # there should be no difference
    ```
    
    r? @Dylan-DPC
  5. Rollup merge of rust-lang#66880 - aDotInTheVoid:add-E0203-long, r=Gui…

    Centril committed Dec 1, 2019
    …llaumeGomez
    
    Add long error code explanation message for E0203
    
    Addressed some of rust-lang#61137
    
    r? @GuillaumeGomez
  6. Rollup merge of rust-lang#66832 - RalfJung:const-prop-no-alloc, r=oli…

    Centril committed Dec 1, 2019
    …-obk
    
    const_prop: detect and avoid catching Miri errors that require allocation
    
    r? @wesleywiser @oli-obk
  7. Rollup merge of rust-lang#66790 - christianpoveda:check-set-discrimin…

    Centril committed Dec 1, 2019
    …ant, r=oli-obk
    
    Do `min_const_fn` checks for `SetDiscriminant`s target
    
    Fixes rust-lang#66556
    
    r? @oli-obk @ecstatic-morse
  8. Rollup merge of rust-lang#66726 - CAD97:miri-recursion-limit, r=RalfJung

    Centril committed Dec 1, 2019
    Use recursion_limit for const eval stack limit
    
    cc rust-lang/miri#643 @orium @RalfJung
    
    I'm really not certain how exactly to handle this change, but it looks like it's that simple.
    
    Reuse `recursion_limit` ("The maximum recursion limit for potentially infinitely recursive operations such as auto-dereference and monomorphization") which is configurable by the user for the const evaluation stack frame limit.
    
    The other option is to make `const_eval_stack_frame_limit` configurable in the same way as `recursion_limit` (but I'm not sure how to do that and it'd be a bigger change).
    
    Fixes rust-lang/miri#643.
  9. Rollup merge of rust-lang#66679 - mark-i-m:fix-anon-lifetime-errors, …

    Centril committed Dec 1, 2019
    …r=matthewjasper
    
    Improve lifetime errors with implicit trait object lifetimes
    
    r? @matthewjasper
    
    cc @estebank
    
    I still think the ideal solution would be to construct a `BrAnon`, but that seems like a more invasive change, and can be done later. This at least gets rid of the hack in `OutliveSuggestion` and is slightly more principled.
  10. Rollup merge of rust-lang#66662 - RalfJung:miri-test-liballoc, r=dtolnay

    Centril committed Dec 1, 2019
    Miri: run panic-catching tests in liballoc
    
    I also converted two tests from using `thread::spawn(...).join()` just for catching panics, to `catch_panic`, so that Miri can run them.
  11. Rollup merge of rust-lang#66503 - thomasetter:panic-error-msg, r=josh…

    Centril committed Dec 1, 2019
    …triplett
    
    More useful test error messages on should_panic(expected=...) mismatch
    
    Fixes  rust-lang#66304
    r? @gilescope
    
    Shows both the actual as well as the expected panic value when a test with `should_panic(expected=...)` fails.
    This makes `should_panic` more consistent with `assert_eq`.
    
    I am not sure whether printing the `Any::type_id()` is useful, is there something better that we could print for non-string panic values?
  12. Auto merge of rust-lang#66908 - Centril:rollup-26givp6, r=Centril

    bors committed Dec 1, 2019
    Rollup of 9 pull requests
    
    Successful merges:
    
     - rust-lang#66612 (Initial implementation of or-pattern usefulness checking)
     - rust-lang#66705 (Atomic as_mut_ptr)
     - rust-lang#66759 (impl TrustedLen for vec::Drain)
     - rust-lang#66858 (Use LLVMAddAnalysisPasses instead of Rust's wrapper)
     - rust-lang#66870 (SimplifyArmIdentity only for locals with the same type)
     - rust-lang#66883 (rustc_typeck: gate AnonConst's generics on feature(const_generics).)
     - rust-lang#66889 (Make python-generated source files compatible with rustfmt)
     - rust-lang#66894 (Remove unneeded prelude imports in libcore tests)
     - rust-lang#66895 (Feature gating *declarations* => new crate `rustc_feature`)
    
    Failed merges:
    
     - rust-lang#66905 (rustc_plugin: Remove some remaining plugin features)
    
    r? @ghost
Commits on Nov 30, 2019
  1. Merge match branches

    christianpoveda committed Nov 30, 2019
  2. Rollup merge of rust-lang#66895 - Centril:rustc_feature, r=oli-obk

    Centril committed Nov 30, 2019
    Feature gating *declarations* => new crate `rustc_feature`
    
    This PR moves the data-oriented parts of feature gating into its own crate, `rustc_feature`.
    The parts consist of some data types as well as `accepted`, `active`, `removed`, and `builtin_attrs`.
    
    Feature gate checking itself remains in `syntax::feature_gate::check`. The parts which define how to emit feature gate errors could probably be moved to `rustc_errors` or to the new `rustc_session` crate introduced in rust-lang#66878. The visitor itself could probably be moved as a pass in `rustc_passes` depending on how the dependency edges work out.
    
    The PR also contains some drive-by cleanup of feature gate checking. As such, the PR probably best read commit-by-commit.
    
    r? @oli-obk
    cc @petrochenkov
    cc @Mark-Simulacrum
  3. Rollup merge of rust-lang#66894 - dtolnay:prelude, r=Centril

    Centril committed Nov 30, 2019
    Remove unneeded prelude imports in libcore tests
    
    These three lines are from c82da7a dating back to 2015.
    
    They cause problems when applying rustfmt to the codebase, because reordering wildcard imports can trigger new unused import warnings.
    
    As a minimized example, the following program compiles successfully:
    
    ```rust
    #![deny(unused_imports)]
    
    use std::fmt::Debug;
    use std::marker::Send;
    
    pub mod repro {
        use std::prelude::v1::*;
        use super::*;
    
        pub type D = dyn Debug;
        pub type S = dyn Send;
    }
    
    pub type S = dyn Send;
    ```
    
    but putting it through rustfmt produces a program that fails to compile:
    
    ```rust
    #![deny(unused_imports)]
    
    use std::fmt::Debug;
    use std::marker::Send;
    
    pub mod repro {
        use super::*;
        use std::prelude::v1::*;
    
        pub type D = dyn Debug;
        pub type S = dyn Send;
    }
    
    pub type S = dyn Send;
    ```
    
    The error is:
    
    ```console
    error: unused import: `std::prelude::v1::*`
     --> src/main.rs:8:9
      |
    8 |     use std::prelude::v1::*;
      |         ^^^^^^^^^^^^^^^^^^^
    ```
  4. Rollup merge of rust-lang#66889 - dtolnay:fmt6, r=rkruppe

    Centril committed Nov 30, 2019
    Make python-generated source files compatible with rustfmt
    
    This PR adjusts the generators for src/libcore/num/dec2flt/table.rs, src/libcore/unicode/printable.rs, and src/libcore/unicode/tables.rs to make it so running `rustfmt` on the generated files no longer needs to apply any changes.
    
    This involves tweaking the python scripts where reasonable to better match rustfmt's style, and adding `#[rustfmt::skip]` to big constant tables that there's no point having rustfmt rewrap.
    
    r? @Dylan-DPC
  5. Rollup merge of rust-lang#66883 - eddyb:we-cant-have-nice-things, r=o…

    Centril committed Nov 30, 2019
    …li-obk
    
    rustc_typeck: gate AnonConst's generics on feature(const_generics).
    
    This PR employs the fix for rust-lang#43408 when `#![feature(const_generics)]` is enabled, making the feature-gate the opt-in for all the possible breakage this may incur.
    
    For example, if this PR lands, this will cause a cycle error (due to rust-lang#60471):
    ```rust
    #![feature(const_generics)]
    
    fn foo<T: Into<[u8; 4]>>() {}
    ```
    And so will anything with type-level const expressions, in its bounds.
    Surprisingly, `impl`s don't seem to be affected (if they were, even libcore wouldn't compile).
    
    One thing I'm worried about is not knowing how much unstable code out there, using const-generics, will be broken. But types like `Foo<{N+1}>` never really worked, and do after this PR, just not in bounds - so ironically, it's type-level const expressions that don't depend on generics, which will break (in bounds).
    
    Also, if we do this, we'll have effectively blocked stabilization of const generics on rust-lang#60471.
    
    r? @oli-obk cc @varkor @yodaldevoid @nikomatsakis
  6. Rollup merge of rust-lang#66870 - tmiasko:simplify-ty, r=oli-obk

    Centril committed Nov 30, 2019
    SimplifyArmIdentity only for locals with the same type
    
    Fixes rust-lang#66856
    Fixes rust-lang#66851
  7. Rollup merge of rust-lang#66858 - 0dvictor:capi, r=rkruppe

    Centril committed Nov 30, 2019
    Use LLVMAddAnalysisPasses instead of Rust's wrapper
    
    LLVM exposes a C API `LLVMAddAnalysisPasses` and hence Rust's own wrapper `LLVMRustAddAnalysisPasses` is not needed anymore.
  8. Rollup merge of rust-lang#66759 - CAD97:patch-3, r=KodrAus

    Centril committed Nov 30, 2019
    impl TrustedLen for vec::Drain
    
    The iterator methods just forward to `slice::Iter`, which is `TrustedLen`.
    
    This can probably be applied to other `Drain` structs as well.
  9. Rollup merge of rust-lang#66705 - pitdicker:atomic_mut_ptr, r=KodrAus

    Centril committed Nov 30, 2019
    Atomic as_mut_ptr
    
    I encountered the following pattern a few times: In Rust we use some atomic type like `AtomicI32`, and an FFI interface exposes this as `*mut i32` (or some similar `libc` type).
    
    It was not obvious to me if a just transmuting a pointer to the atomic was acceptable, or if this should use a cast that goes through an `UnsafeCell`. See rust-lang#66136 (comment)
    
    Transmuting the pointer directly:
    ```rust
    let atomic = AtomicI32::new(1);
    let ptr = &atomic as *const AtomicI32 as *mut i32;
    unsafe {
        ffi(ptr);
    }
    ```
    
    A dance with `UnsafeCell`:
    ```rust
    let atomic = AtomicI32::new(1);
    unsafe {
        let ptr = (&*(&atomic as *const AtomicI32 as *const UnsafeCell<i32>)).get();
        ffi(ptr);
    }
    ```
    
    Maybe in the end both ways could be valid. But why not expose a direct method to get a pointer from the standard library?
    
    An `as_mut_ptr` method on atomics can be safe, because only the use of the resulting pointer is where things can get unsafe. I documented its use for FFI, and "Doing non-atomic reads and writes on the resulting integer can be a data race."
    
    The standard library could make use this method in a few places in the WASM module.
    
    cc @RalfJung as you answered my original question.
  10. Rollup merge of rust-lang#66612 - Nadrieril:or-patterns-initial, r=va…

    Centril committed Nov 30, 2019
    …rkor
    
    Initial implementation of or-pattern usefulness checking
    
    The title says it all.
    I'd like to request a perf run on that, hopefully this doesn't kill performance too much.
    
    cc rust-lang#54883
  11. Apply suggestions from code review

    Nadrieril and varkor committed Nov 30, 2019
    Co-Authored-By: varkor <github@varkor.com>
  12. Auto merge of rust-lang#66887 - dtolnay:rollup-uxowp8d, r=Centril

    bors committed Nov 30, 2019
    Rollup of 4 pull requests
    
    Successful merges:
    
     - rust-lang#66818 (Format libstd/os with rustfmt)
     - rust-lang#66819 (Format libstd/sys with rustfmt)
     - rust-lang#66820 (Format libstd with rustfmt)
     - rust-lang#66847 (Allow any identifier as format arg name)
    
    Failed merges:
    
    r? @ghost
  13. Fill tracking issue

    pitdicker committed Nov 30, 2019
  14. Address review comments

    aDotInTheVoid committed Nov 30, 2019
  15. Remove unneeded prelude imports in libcore tests

    dtolnay committed Nov 30, 2019
    These three lines are from c82da7a in
    2015.
    
    They cause problems when applying rustfmt to the codebase, because
    reordering wildcard imports can trigger new unused import warnings.
    
    As a minimized example, the following program compiles successfully:
    
        #![deny(unused_imports)]
    
        use std::fmt::Debug;
        use std::marker::Send;
    
        pub mod repro {
            use std::prelude::v1::*;
            use super::*;
    
            pub type D = dyn Debug;
            pub type S = dyn Send;
        }
    
        pub type S = dyn Send;
    
    but putting it through rustfmt produces a program that fails to compile:
    
        #![deny(unused_imports)]
    
        use std::fmt::Debug;
        use std::marker::Send;
    
        pub mod repro {
            use super::*;
            use std::prelude::v1::*;
    
            pub type D = dyn Debug;
            pub type S = dyn Send;
        }
    
        pub type S = dyn Send;
    
    The error is:
    
        error: unused import: `std::prelude::v1::*`
         --> src/main.rs:8:9
          |
        8 |     use std::prelude::v1::*;
          |         ^^^^^^^^^^^^^^^^^^^
  16. derive(Default) for Features

    Centril committed Nov 30, 2019
Older
You can’t perform that action at this time.