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 12 pull requests #91469

Merged
merged 33 commits into from
Dec 3, 2021
Merged

Rollup of 12 pull requests #91469

merged 33 commits into from
Dec 3, 2021

Commits on Nov 26, 2021

  1. Configuration menu
    Copy the full SHA
    2a83c11 View commit details
    Browse the repository at this point in the history

Commits on Nov 28, 2021

  1. Fix incorrect usage of EvaluatedToOk when evaluating TypeOutlives

    A global predicate is not guarnatenteed to outlive all regions.
    If the predicate involves late-bound regions, then it may fail
    to outlive other regions (e.g. `for<'b> &'b bool: 'static` does not
    hold)
    
    We now only produce `EvaluatedToOk` when a global predicate has no
    late-bound regions - in that case, the ony region that can be present
    in the type is 'static
    Aaron1011 committed Nov 28, 2021
    Configuration menu
    Copy the full SHA
    4910fe6 View commit details
    Browse the repository at this point in the history

Commits on Nov 29, 2021

  1. Configuration menu
    Copy the full SHA
    821b92b View commit details
    Browse the repository at this point in the history

Commits on Nov 30, 2021

  1. Configuration menu
    Copy the full SHA
    7907fa8 View commit details
    Browse the repository at this point in the history

Commits on Dec 1, 2021

  1. Separate RemoveFalseEdges from SimplifyBranches

    Otherwise dataflow state will propagate along false edges and cause
    things to be marked as maybe init unnecessarily. These should be
    separate, since `SimplifyBranches` also makes `if true {} else {}` into
    a `goto`, which means we wouldn't lint anything in the `else` block.
    ecstatic-morse committed Dec 1, 2021
    Configuration menu
    Copy the full SHA
    bb27b05 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    d707707 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    4f7605b View commit details
    Browse the repository at this point in the history
  4. Add rationale for RemoveUnneededDrops

    ...since its name is very close to `RemoveUninitDrops`.
    ecstatic-morse committed Dec 1, 2021
    Configuration menu
    Copy the full SHA
    ce2959d View commit details
    Browse the repository at this point in the history
  5. Handle DropAndReplace in const-checking

    It runs before the real drop elaboration pass.
    ecstatic-morse committed Dec 1, 2021
    Configuration menu
    Copy the full SHA
    3e0e8be View commit details
    Browse the repository at this point in the history
  6. Move post-elaboration const-checking earlier in the pipeline

    Instead we run `RemoveFalseEdges` and `RemoveUninitDrops` at the
    appropriate time. The extra `SimplifyCfg` avoids visiting unreachable
    blocks during `RemoveUninitDrops`.
    ecstatic-morse committed Dec 1, 2021
    Configuration menu
    Copy the full SHA
    58c996c View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    9aaca1d View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    37fa925 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    ba7374e View commit details
    Browse the repository at this point in the history

Commits on Dec 2, 2021

  1. Configuration menu
    Copy the full SHA
    b11d880 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    bd8d7e4 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    5c75a48 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    51875e3 View commit details
    Browse the repository at this point in the history
  5. Change to check-pass

    jackh726 authored Dec 2, 2021
    Configuration menu
    Copy the full SHA
    b77ed83 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    6df44a3 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    d883242 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    66153d7 View commit details
    Browse the repository at this point in the history
  9. Rollup merge of rust-lang#89954 - GuillaumeGomez:legacy-const-generic…

    …-doc, r=Amanieu
    
    Fix legacy_const_generic doc arguments display
    
    Fixes rust-lang#83167.
    
    cc ``@Amanieu``
    matthiaskrgr authored Dec 2, 2021
    Configuration menu
    Copy the full SHA
    444635d View commit details
    Browse the repository at this point in the history
  10. Rollup merge of rust-lang#91321 - matthewjasper:constaint-placeholder…

    …s, r=jackh726
    
    Handle placeholder regions in NLL type outlive constraints
    
    Closes rust-lang#76168
    matthiaskrgr authored Dec 2, 2021
    Configuration menu
    Copy the full SHA
    b56e3d9 View commit details
    Browse the repository at this point in the history
  11. Rollup merge of rust-lang#91329 - Aaron1011:modulo-regions-test, r=ja…

    …ckh726
    
    Fix incorrect usage of `EvaluatedToOk` when evaluating `TypeOutlives`
    
    A global predicate is not guarnatenteed to outlive all regions.
    If the predicate involves late-bound regions, then it may fail
    to outlive other regions (e.g. `for<'b> &'b bool: 'static` does not
    hold)
    
    We now only produce `EvaluatedToOk` when a global predicate has no
    late-bound regions - in that case, the ony region that can be present
    in the type is 'static
    matthiaskrgr authored Dec 2, 2021
    Configuration menu
    Copy the full SHA
    fd6e66f View commit details
    Browse the repository at this point in the history
  12. Rollup merge of rust-lang#91364 - FabianWolff:issue-91210-ptr-field, …

    …r=oli-obk
    
    Improve error message for incorrect field accesses through raw pointers
    
    Fixes rust-lang#91210.
    matthiaskrgr authored Dec 2, 2021
    Configuration menu
    Copy the full SHA
    7483211 View commit details
    Browse the repository at this point in the history
  13. Rollup merge of rust-lang#91387 - graydon:E0038-clarification, r=wesl…

    …eywiser
    
    Clarify and tidy up explanation of E0038
    
    I ran into E0038 (specifically the `Self:Sized` constraint on object-safety) the other day and it seemed to me that the explanations I found floating around the internet were a bit .. wrong. Like they didn't make sense. And then I went and checked the official explanation here and it didn't make sense either.
    
    As far as I can tell (reading through the history of the RFCs), two totally different aspects of object-safety have got tangled up in much of the writing on the subject:
      - Object-safety related to "not even theoretically possible" issues. This includes things like "methods that take or return Self by value", which obviously will never work for an unsized type in a world with fixed-size stack frames (and it'd be an opaque type anyways, which, ugh). This sort of thing was originally decided method-by-method, with non-object-safe methods stripped from objects; but in [RFC 0255](https://rust-lang.github.io/rfcs/0255-object-safety.html) this sort of per-impossible-method reasoning was made into a per-trait safety property (with the escape hatch left in where users could mark methods `where Self:Sized` to have them stripped before the trait's object safety is considered).
      - Object-safety related to "totally possible but ergonomically a little awkward" issues. Specifically in a trait with `Trait:Sized`, there's no a priori reason why this constraint makes the trait impossible to make into an object -- imagine it had nothing but harmless `&self`-taking methods. No problem! Who cares if the Trait requires its implementing types to be sized? As far as I can tell reading the history here, in both RFC 0255 and then later in [RFC 0546](https://rust-lang.github.io/rfcs/0546-Self-not-sized-by-default.html) it seems that the motivation for making `Trait:Sized` be non-object-safe has _nothing to do_ with the impossibility of making objects out of such types, and everything to do with enabling "[a trait object SomeTrait to implement the trait SomeTrait](https://rust-lang.github.io/rfcs/0546-Self-not-sized-by-default.html#motivation)". That is, since `dyn Trait` is unsized, if `Trait:Sized` then you can never have the automatic (and reasonable) ergonomic implicit `impl Trait for dyn Trait`. And the authors of that RFC really wanted that automatic implicit implementation of `Trait` for `dyn Trait`. So they just defined `Trait:Sized` as non-object safe -- no `dyn Trait` can ever exist that the compiler can't synthesize such an impl for. Well enough!
    
    However, I noticed in my reading-and-reconstruction that lots of documentation on the internet, including forum and Q&A site answers and (most worrying) the compiler explanation all kinda grasp at something like the first ("not theoretically possible") explanation, and fail to mention the second ("just an ergonomic constraint") explanation. So I figured I'd clean up the docs to clarify, maybe confuse the next person less (unless of course I'm misreading the history here and misunderstanding motives -- please let me know if so!)
    
    While here I also did some cleanups:
    
      - Rewrote the preamble, trying to help the user get a little better oriented (I found the existing preamble a bit scattered).
      - Modernized notation (using `dyn Trait`)
      - Changed the section headings to all be written with the same logical sense: to all be written as "conditions that violate object safety" rather than a mix of that and the negated form "conditions that must not happen in order to ensure object safety".
    
    I think there's a fair bit more to clean up in this doc -- the later sections get a bit rambly and I suspect there should be a completely separated-out section covering the `where Self:Sized` escape hatch for instructing the compiler to "do the old thing" and strip methods off traits when turning them into objects (it's a bit buried as a digression in the individual sub-error sections). But I did what I had time for now.
    matthiaskrgr authored Dec 2, 2021
    Configuration menu
    Copy the full SHA
    b269213 View commit details
    Browse the repository at this point in the history
  14. Rollup merge of rust-lang#91410 - ecstatic-morse:const-precise-live-d…

    …rops-take-2, r=oli-obk
    
    Move `#![feature(const_precise_live_drops)]` checks earlier in the pipeline
    
    Should mitigate the issues found during MCP on rust-lang#73255.
    
    Once this is done, we should clean up the queries a bit, since I think `mir_drops_elaborated_and_const_checked` can be merged back into `mir_promoted`.
    
    Fixes rust-lang#90770.
    
    cc ``@rust-lang/wg-const-eval``
    r? ``@nikomatsakis`` (since they reviewed rust-lang#71824)
    matthiaskrgr authored Dec 2, 2021
    Configuration menu
    Copy the full SHA
    3964131 View commit details
    Browse the repository at this point in the history
  15. Rollup merge of rust-lang#91435 - FabianWolff:issue-91421-if-then, r=…

    …lcnr
    
    Improve diagnostic for missing half of binary operator in `if` condition
    
    Fixes rust-lang#91421. I've also changed it so that it doesn't consume the `else` token in the error case, because it will try to consume it again afterwards, leading to this incorrect error message (where the `else` reported as missing is actually there):
    ```
    error: expected one of `.`, `;`, `?`, `else`, or an operator, found `{`
     --> src/main.rs:4:12
      |
    4 |     } else { 4 };
      |            ^ expected one of `.`, `;`, `?`, `else`, or an operator
    ```
    
    r? `@lcnr`
    matthiaskrgr authored Dec 2, 2021
    Configuration menu
    Copy the full SHA
    dbb9e22 View commit details
    Browse the repository at this point in the history
  16. Rollup merge of rust-lang#91444 - RalfJung:miri-tests, r=dtolnay

    disable tests in Miri that take too long
    
    Comparing slices of length `usize::MAX` diverges in Miri. In fact these tests even diverge in rustc unless `-O` is passed. I tried this code to check that:
    ```rust
    #![feature(slice_take)]
    
    const EMPTY_MAX: &'static [()] = &[(); usize::MAX];
    
    fn main() {
        let mut slice: &[_] = &[(); usize::MAX];
        println!("1");
        assert_eq!(Some(&[] as _), slice.take(usize::MAX..));
        println!("2");
        let remaining: &[_] = EMPTY_MAX;
        println!("3");
        assert_eq!(remaining, slice);
        println!("4");
    }
    ```
    So, disable these tests in Miri for now.
    matthiaskrgr authored Dec 2, 2021
    Configuration menu
    Copy the full SHA
    fbfa003 View commit details
    Browse the repository at this point in the history
  17. Rollup merge of rust-lang#91457 - steffahn:additional_test_from_91068…

    …, r=jackh726
    
    Add additional test from rust issue number 91068
    
    see rust-lang#91068
    
    r? ``@jackh726``
    matthiaskrgr authored Dec 2, 2021
    Configuration menu
    Copy the full SHA
    d5fc7cf View commit details
    Browse the repository at this point in the history
  18. Rollup merge of rust-lang#91460 - ChrisDenton:doc-last-os-error, r=jo…

    …shtriplett
    
    Document how `last_os_error` should be used
    
    It should be made clear that the state of the last OS error could change if another function call is made before the call to `Error::last_os_error()`.
    
    Fixes: rust-lang#53155
    matthiaskrgr authored Dec 2, 2021
    Configuration menu
    Copy the full SHA
    2ec0f84 View commit details
    Browse the repository at this point in the history
  19. Rollup merge of rust-lang#91464 - ChrisDenton:doc-path-case-sensitivi…

    …ty, r=joshtriplett
    
    Document file path case sensitivity
    
    This describes the current behaviour of the standard library's pure path methods.
    
    Fixes rust-lang#66260.
    matthiaskrgr authored Dec 2, 2021
    Configuration menu
    Copy the full SHA
    6e5f4c2 View commit details
    Browse the repository at this point in the history
  20. Rollup merge of rust-lang#91466 - nnethercote:Symbol-interner-comment…

    …s, r=Mark-Simulacrum
    
    Improve the comments in `Symbol::interner`.
    
    r? `@Mark-Simulacrum`
    matthiaskrgr authored Dec 2, 2021
    Configuration menu
    Copy the full SHA
    f7afd46 View commit details
    Browse the repository at this point in the history