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 5 pull requests #71803

Closed
wants to merge 14 commits into from

Commits on May 1, 2020

  1. doc: make Stack and StackElement a little pretty

    Also, fix rustdoc warnings.
    tshepang committed May 1, 2020
    Configuration menu
    Copy the full SHA
    ad46044 View commit details
    Browse the repository at this point in the history

Commits on May 2, 2020

  1. Configuration menu
    Copy the full SHA
    b5c1f45 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    60d62be View commit details
    Browse the repository at this point in the history
  3. Add comments for deref_steps()

    ldm0 committed May 2, 2020
    Configuration menu
    Copy the full SHA
    80d04cc View commit details
    Browse the repository at this point in the history
  4. Suggestion for immutable reference -> mutable pointer should be emitted

    as `Applicability::Unspecified`
    ldm0 committed May 2, 2020
    Configuration menu
    Copy the full SHA
    089d4bb View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    9a212c1 View commit details
    Browse the repository at this point in the history
  6. Update src/libserialize/json.rs

    Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
    tshepang and jonas-schievink authored May 2, 2020
    Configuration menu
    Copy the full SHA
    3406b53 View commit details
    Browse the repository at this point in the history
  7. fix rustdoc warnings

    tshepang committed May 2, 2020
    Configuration menu
    Copy the full SHA
    3be52b5 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    ff86a45 View commit details
    Browse the repository at this point in the history
  9. Rollup merge of rust-lang#71726 - ldm0:ref2ptr, r=oli-obk

    Suggest deref when coercing `ty::Ref` to `ty::RawPtr` with arbitrary mutability
    
    Fixes rust-lang#71676
    1. Implement dereference suggestion when coercing `ty::Ref` to `ty::RawPtr` with arbitrary mutability.
    2. Extract the dereference steps into `deref_steps()`, which removes all the `use` and `pub` noise introduced by last PR rust-lang#71540, and makes the code more readable.
    3. Use the `remove_prefix()` closure which makes the prefix removal more readable.
    4. Introduce `Applicability` as a return value of `check_ref` to suggest `Applicability::Unspecified` suggestion.
    
    **Special**: I found it is not possible to genereate `Applicability::MachineApplicable` suggestion for situation like this:
    ```rust
    use std::ops::Deref;
    use std::ops::DerefMut;
    struct Bar(u8);
    struct Foo(Bar);
    struct Emm(Foo);
    impl Deref for Bar{
        type Target = u8;
        fn deref(&self) -> &Self::Target {
            &self.0
        }
    }
    impl Deref for Foo {
        type Target = Bar;
        fn deref(&self) -> &Self::Target {
            &self.0
        }
    }
    impl Deref for Emm {
        type Target = Foo;
        fn deref(&self) -> &Self::Target {
            &self.0
        }
    }
    impl DerefMut for Bar{
        fn deref_mut(&mut self) -> &mut Self::Target {
            &mut self.0
        }
    }
    impl DerefMut for Foo {
        fn deref_mut(&mut self) -> &mut Self::Target {
            &mut self.0
        }
    }
    impl DerefMut for Emm {
        fn deref_mut(&mut self) -> &mut Self::Target {
            &mut self.0
        }
    }
    fn main() {
        let a = Emm(Foo(Bar(0)));
        let _: *mut u8 = &a; //~ ERROR mismatched types
    }
    ```
    We may suggest `&mut ***a` here, but the `a` is not declared as mutable variable. And also when processing HIR, it's not possible to check if `a` is declared as a mutable variable (currently we do borrow checking with MIR). So we cannot ensure that suggestion when coercing immutable reference to mutable pointer is always machine applicable. Therefore I added a `Applicability` return value in `check_ref()`. And move the `immutable reference -> mutable pointer` situation into a sperate test file without `run-rustfix`. (It seems that `run-rustfix` will also adopt `Applicability::Unspecified` suggestion, which is strange)
    Dylan-DPC authored May 2, 2020
    Configuration menu
    Copy the full SHA
    b121d7c View commit details
    Browse the repository at this point in the history
  10. Rollup merge of rust-lang#71767 - tshepang:stack-stuff, r=jonas-schie…

    …vink
    
    doc: make Stack and StackElement a little pretty
    
    Also, fix rustdoc warnings.
    Dylan-DPC authored May 2, 2020
    Configuration menu
    Copy the full SHA
    a299abd View commit details
    Browse the repository at this point in the history
  11. Rollup merge of rust-lang#71777 - petrochenkov:crtype, r=Mark-Simulacrum

    cleanup: `config::CrateType` -> `CrateType`
    Dylan-DPC authored May 2, 2020
    Configuration menu
    Copy the full SHA
    c311c0d View commit details
    Browse the repository at this point in the history
  12. Rollup merge of rust-lang#71784 - Xaeroxe:patch-1, r=jonas-schievink

    Remove recommendation for unmaintained dirs crate
    
    See rust-lang#71684 for reasoning here
    Dylan-DPC authored May 2, 2020
    Configuration menu
    Copy the full SHA
    48a2946 View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    ffd9301 View commit details
    Browse the repository at this point in the history