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 #120980

Merged
merged 29 commits into from
Feb 12, 2024
Merged

Rollup of 11 pull requests #120980

merged 29 commits into from
Feb 12, 2024

Commits on Feb 10, 2024

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

Commits on Feb 11, 2024

  1. Add test

    c410-f3r committed Feb 11, 2024
    Configuration menu
    Copy the full SHA
    1fa75af View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    89abbb0 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    d5de9a6 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    e13de31 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    792fa24 View commit details
    Browse the repository at this point in the history
  6. fix incorrect doctest

    ripytide committed Feb 11, 2024
    Configuration menu
    Copy the full SHA
    f415339 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    9789e88 View commit details
    Browse the repository at this point in the history
  8. fix intra-doc links

    ripytide committed Feb 11, 2024
    Configuration menu
    Copy the full SHA
    f34d9da View commit details
    Browse the repository at this point in the history
  9. Reorder the diagnostic API methods.

    The current order is almost perfectly random. This commit puts them into
    a predictable order in their own impl block, going from the highest
    level (`Block`) to the lowest (`Expect`). Within each level this is the
    order:
    
    - struct_err, err
    - struct_span_err, span_err
    - create_err, emit_err
    
    The first one in each pair creates a diagnostic, the second one creates
    *and* emits a diagnostic. Not every method is present for every level.
    
    The diff is messy, but other than moving methods around, the only thing
    it does is create the new `impl DiagCtxt` block with its own comment.
    nnethercote committed Feb 11, 2024
    Configuration menu
    Copy the full SHA
    c35983a View commit details
    Browse the repository at this point in the history
  10. Fix inconsistencies in the diagnostic API methods.

    - Remove low-value comments about functionality that is obvious.
    
    - Add missing `track_caller` attributes -- every method should have one.
    
    - Adjust `rustc_lint_diagnostic` attributes. Every method involving a
      `impl Into<DiagnosticMessage>` or `impl Into<SubdiangnosticMessage>`
      argument should have one, except for those producing bugs, which
      aren't user-facing.
    nnethercote committed Feb 11, 2024
    Configuration menu
    Copy the full SHA
    b7b6ebc View commit details
    Browse the repository at this point in the history

Commits on Feb 12, 2024

  1. Configuration menu
    Copy the full SHA
    2bcbc16 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    fc7693d View commit details
    Browse the repository at this point in the history
  3. Remove final unwanted unchecked_error_guaranteed calls.

    Now that error counts can't go up and down due to stashing/stealing, we
    have a nice property:
    
      (err_count > 0) iff (an ErrorGuaranteed has been produced)
    
    So we can now record `ErrorGuaranteed`s within `DiagCtxt` and use that
    in methods like `has_error`, instead of checking that the count is
    greater than 0 and calling `unchecked_error_guaranteed` to create the
    `ErrorGuaranteed`.
    
    In fact, we can record a `Vec<ErrorGuaranteed>` and use its length to
    count the number, instead of maintaining a separate count.
    nnethercote committed Feb 12, 2024
    Configuration menu
    Copy the full SHA
    30774b0 View commit details
    Browse the repository at this point in the history
  4. Remove dcx arg from ReportErrorExt::add_args.

    Because it also has a `DiagnosticBuilder` arg, which contains a `dcx`
    reference.
    
    Also rename some `builder` variables as `diag`, because that's the usual
    name.
    nnethercote committed Feb 12, 2024
    Configuration menu
    Copy the full SHA
    e0a0cc2 View commit details
    Browse the repository at this point in the history
  5. Tweak delayed bug mentions.

    Now that we have both `delayed_bug` and `span_delayed_bug`, it makes
    sense to use the generic term "delayed bug" more.
    nnethercote committed Feb 12, 2024
    Configuration menu
    Copy the full SHA
    d4b77f6 View commit details
    Browse the repository at this point in the history
  6. Change level used in print_error_count.

    From `Fatal` to `Error`. It has no functional effect, but `Error` makes
    more sense and lines up better with the `Warning` level used just above.
    nnethercote committed Feb 12, 2024
    Configuration menu
    Copy the full SHA
    1f39c8b View commit details
    Browse the repository at this point in the history
  7. fix ICE for deref coercions with type errors

    Lukas Markeffsky committed Feb 12, 2024
    Configuration menu
    Copy the full SHA
    95c5b06 View commit details
    Browse the repository at this point in the history
  8. Rollup merge of rust-lang#120765 - nnethercote:reorder-diag-API, r=co…

    …mpiler-errors
    
    Reorder diagnostics API
    
    The totally random ordering of diagnostic methods in `DiagCtxt` has been low-key driving me crazy for a while now.
    
    r? ``@compiler-errors``
    matthiaskrgr authored Feb 12, 2024
    Configuration menu
    Copy the full SHA
    57a2e91 View commit details
    Browse the repository at this point in the history
  9. Rollup merge of rust-lang#120833 - nnethercote:more-internal-emit_dia…

    …gnostics-cleanups, r=oli-obk
    
    More internal emit diagnostics cleanups
    
    Miscellaneous improvements.
    
    r? ``@oli-obk``
    matthiaskrgr authored Feb 12, 2024
    Configuration menu
    Copy the full SHA
    f08ece3 View commit details
    Browse the repository at this point in the history
  10. Rollup merge of rust-lang#120899 - compiler-errors:non-wf-alias, r=lcnr

    Gracefully handle non-WF alias in `assemble_alias_bound_candidates_recur`
    
    See explanation in test. I think it's fine to delay a bug here -- I don't believe we ever construct a non-wf alias on the good path? If so, then we can just remove the delay.
    
    Fixes rust-lang#120891
    
    r? lcnr
    matthiaskrgr authored Feb 12, 2024
    Configuration menu
    Copy the full SHA
    733f93d View commit details
    Browse the repository at this point in the history
  11. Rollup merge of rust-lang#120917 - chenyukang:yukang-dead-parameters,…

    … r=compiler-errors
    
    Remove a bunch of dead parameters in functions
    
    Found this kind of issue when working on rust-lang#119650
    I wrote a trivial toy lint and manual review to find these.
    matthiaskrgr authored Feb 12, 2024
    Configuration menu
    Copy the full SHA
    ebe36ac View commit details
    Browse the repository at this point in the history
  12. Rollup merge of rust-lang#120928 - c410-f3r:tests-tests-tests, r=davi…

    …dtwco
    
    Add test for recently fixed issue
    
    Adds a test for issue rust-lang#116864.
    matthiaskrgr authored Feb 12, 2024
    Configuration menu
    Copy the full SHA
    02c1e3e View commit details
    Browse the repository at this point in the history
  13. Rollup merge of rust-lang#120933 - RalfJung:const-check-misc, r=oli-obk

    check_consts: fix duplicate errors, make importance consistent
    
    This is stuff I noticed while working on rust-lang#120932, but it's orthogonal to that PR.
    
    r? ``@oli-obk``
    matthiaskrgr authored Feb 12, 2024
    Configuration menu
    Copy the full SHA
    3f67169 View commit details
    Browse the repository at this point in the history
  14. Rollup merge of rust-lang#120936 - ripytide:master, r=Amanieu

    improve `btree_cursors` functions documentation
    
    As suggested by ``@Amanieu`` (and others) in rust-lang#107540 (rust-lang#107540 (comment))
    
    Improvements:
    - Document exact behavior of `{upper/lower}_bound{,_mut}` with each of the three `Bound` types using unambigous words `{greatest,greater,smallest,smaller,before,after}`.
    - Added another doc-example for the `Bound::Unbounded` for each of the methods
    - Changed doc-example to use From<[T; N]> rather than lots of `insert()`s which requires a mutable map which clutters the example when `mut` may not be required for the method (such as for `{upper,lower}_bound`.
    - Removed `# Panics` section from `insert_{before,after}` methods since they were changed to return an error instead a while ago.
    - Reworded some phrases to be more consistent with the more regular `BTreeMap` methods such as calling entries "key-value" rather than "element"s.
    matthiaskrgr authored Feb 12, 2024
    Configuration menu
    Copy the full SHA
    8305686 View commit details
    Browse the repository at this point in the history
  15. Rollup merge of rust-lang#120944 - compiler-errors:inliner-abi, r=oli…

    …-obk
    
    Check that the ABI of the instance we are inlining is correct
    
    When computing the `CallSite` in the mir inliner, double check that the instance of the function that we are inlining is compatible with the signature from the trait definition that we acquire from the MIR.
    
    Fixes rust-lang#120940
    
    r? ``@oli-obk`` or ``@cjgillot``
    matthiaskrgr authored Feb 12, 2024
    Configuration menu
    Copy the full SHA
    8ec144d View commit details
    Browse the repository at this point in the history
  16. Rollup merge of rust-lang#120956 - compiler-errors:clean-type-alias, …

    …r=GuillaumeGomez
    
    Clean inlined type alias with correct param-env
    
    We were cleaning the `hir::Ty` of a type alias item in the param-env of the item that *references* the type alias, and not the alias's own param-env.
    
    Fixes rust-lang#120954
    matthiaskrgr authored Feb 12, 2024
    Configuration menu
    Copy the full SHA
    a0156e5 View commit details
    Browse the repository at this point in the history
  17. Rollup merge of rust-lang#120962 - ChrisDenton:review, r=Nilstrieb

    Add myself to library/std review
    
    I'll see how it goes.
    matthiaskrgr authored Feb 12, 2024
    Configuration menu
    Copy the full SHA
    323f66a View commit details
    Browse the repository at this point in the history
  18. Rollup merge of rust-lang#120972 - lukas-code:autoderef-type-error, r…

    …=compiler-errors
    
    fix ICE for deref coercions with type errors
    
    Follow-up to rust-lang#120895, where I made types with errors go through the full coercion code, which is necessary if we want to build MIR for bodies with errors (rust-lang#120550).
    
    The code for coercing `&T` to `&U` currently assumes that autoderef for `&T` will succeed for at least two steps (`&T` and `T`):
    
    https://github.com/rust-lang/rust/blob/b17491c8f6d555386104dfd82004c01bfef09c95/compiler/rustc_hir_typeck/src/coercion.rs#L339-L464
    
    But for types with errors, we previously only returned the no-op autoderef step (`&{type error}` -> `&{type error}`) and then stopped early. This PR changes autoderef for types with errors to still go through the built-in derefs (e.g. `&&{type error}` -> `&{type error}` -> `{type error}`) and only stop early when it would have to go looking for `Deref` trait impls.
    
    fixes rust-lang#120945
    
    r? ``@compiler-errors`` or compiler
    matthiaskrgr authored Feb 12, 2024
    Configuration menu
    Copy the full SHA
    8e5f722 View commit details
    Browse the repository at this point in the history