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 6 pull requests #129202

Merged
merged 12 commits into from
Aug 17, 2024
Merged

Rollup of 6 pull requests #129202

merged 12 commits into from
Aug 17, 2024

Commits on Aug 16, 2024

  1. mir/pretty: use Option instead of Either<Once, Empty>

    `Either` is wasteful for a one-or-none iterator, especially since `Once`
    is already an `option::IntoIter` internally. We don't really need any of
    the iterator mechanisms in this case, just a single conditional insert.
    cuviper committed Aug 16, 2024
    Configuration menu
    Copy the full SHA
    29017e4 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    ed6315b View commit details
    Browse the repository at this point in the history

Commits on Aug 17, 2024

  1. Configuration menu
    Copy the full SHA
    3c8dad1 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    321d40f View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    7bde314 View commit details
    Browse the repository at this point in the history
  4. Remove a useless ref/id/ref round-trip from pattern_from_hir

    This re-lookup of `&hir::Pat` by its ID appears to be an artifact of earlier
    complexity that has since been removed from the compiler.
    Zalathar committed Aug 17, 2024
    Configuration menu
    Copy the full SHA
    194ade1 View commit details
    Browse the repository at this point in the history
  5. Rollup merge of rust-lang#128989 - s7tya:check-linkage-attribute-pos,…

    … r=petrochenkov
    
    Emit an error for invalid use of the linkage attribute
    
    fixes rust-lang#128486
    
    Currently, the use of the linkage attribute for Mod, Impl,... is incorrectly permitted. This PR will correct this issue by generating errors, and I've also added some UI test cases for it.
    
    Related: rust-lang#128552.
    matthiaskrgr committed Aug 17, 2024
    Configuration menu
    Copy the full SHA
    cfeded4 View commit details
    Browse the repository at this point in the history
  6. Rollup merge of rust-lang#129167 - cuviper:either-once-empty, r=Nadri…

    …eril
    
    mir/pretty: use `Option` instead of `Either<Once, Empty>`
    
    `Either` is wasteful for a one-or-none iterator, especially since `Once`
    is already an `option::IntoIter` internally. We don't really need any of
    the iterator mechanisms in this case, just a single conditional insert.
    matthiaskrgr committed Aug 17, 2024
    Configuration menu
    Copy the full SHA
    9c910ae View commit details
    Browse the repository at this point in the history
  7. Rollup merge of rust-lang#129168 - BoxyUwU:mismatched_ty_correct_id, …

    …r=compiler-errors
    
    Return correct HirId when finding body owner in diagnostics
    
    Fixes rust-lang#129145
    Fixes rust-lang#128810
    
    r? ```@compiler-errors```
    
    ```rust
    fn generic<const N: u32>() {}
    
    trait Collate<const A: u32> {
        type Pass;
        fn collate(self) -> Self::Pass;
    }
    
    impl<const B: u32> Collate<B> for i32 {
        type Pass = ();
        fn collate(self) -> Self::Pass {
            generic::<{ true }>()
            //~^ ERROR: mismatched types
        }
    }
    ```
    
    When type checking the `{ true }` anon const we would error with a type mismatch. This then results in diagnostics code attempting to check whether its due to a type mismatch with the return type. That logic was implemented by walking up the hir until we reached the body owner, except instead of using the `enclosing_body_owner` function it special cased various hir nodes incorrectly resulting in us walking out of the anon const and stopping at `fn collate` instead.
    
    This then resulted in diagnostics logic inside of the anon consts `ParamEnv` attempting to do trait solving involving the `<i32 as Collate<B>>::Pass` type which ICEs because it is in the wrong environment.
    
    I have rewritten this function to just walk up until it hits the `enclosing_body_owner` and made some other changes since I found this pretty hard to read/understand. Hopefully it's easier to understand now, it also makes it more obvious that this is not implemented in a very principled way and is definitely missing cases :)
    matthiaskrgr committed Aug 17, 2024
    Configuration menu
    Copy the full SHA
    ddbbda4 View commit details
    Browse the repository at this point in the history
  8. Rollup merge of rust-lang#129191 - aDotInTheVoid:rdj-serial-cleanup, …

    …r=GuillaumeGomez
    
    rustdoc-json: Clean up serialization and printing.
    
    Somewhat a followup to rust-lang#128963, but makes sense regardless.
    
    - Renames `out_path` to `out_dir` because it's not the path to the JSON, but the directory
      - Also adds a comment explaining `None`
    - Renames `write` to `serialize_and_write` because it does both.
      - Also renames the self-profile activity name to be clear this measures both IO cost and serialization CPU cost
      - Expands the timer to cover flushing
    - Renames `output` to `output_crate`, to emphasize it's the contents, not the `--output` flag.
    
    r? `@GuillaumeGomez`
    matthiaskrgr committed Aug 17, 2024
    Configuration menu
    Copy the full SHA
    1a95a5f View commit details
    Browse the repository at this point in the history
  9. Rollup merge of rust-lang#129192 - GuillaumeGomez:rm-useless-merged-d…

    …octest-attrs, r=notriddle
    
    Remove useless attributes in merged doctest generated code
    
    I took another look at the generated code for merged doctests and it seems like those attributes are only useful when running `rustc --test`, which isn't the case for merged doctests. Less code generated. \o/
    
    r? `@notriddle`
    matthiaskrgr committed Aug 17, 2024
    Configuration menu
    Copy the full SHA
    8a023b3 View commit details
    Browse the repository at this point in the history
  10. Rollup merge of rust-lang#129196 - Zalathar:ref-id-ref, r=compiler-er…

    …rors
    
    Remove a useless ref/id/ref round-trip from `pattern_from_hir`
    
    This re-lookup of `&hir::Pat` by its ID appears to be an artifact of earlier complexity that has since been removed from the compiler.
    
    Merely deleting the let/match results in borrow errors, but sprinkling `'tcx` in the signature allows it to work again, so I suspect that this code's current function is simply to compensate for overly loose lifetimes in the signature. Perhaps it made more sense at a time when HIR lifetimes were not tied to `'tcx`.
    
    I spotted this while working on some more experimental changes, which is why I've extracted it into its own PR.
    matthiaskrgr committed Aug 17, 2024
    Configuration menu
    Copy the full SHA
    4e6147d View commit details
    Browse the repository at this point in the history