1. 02 8月, 2023 5 次提交
  2. 01 8月, 2023 35 次提交
    • M
      Rollup merge of #114320 - ouz-a:smir_statements, r=oli-obk · 41364c7c
      Matthias Krüger 提交于
      Cover statements for stable_mir
      
      Added missing statements to stable_mir, used opaque types for few types that are only used for diagnostic.
      
      cc https://github.com/rust-lang/project-stable-mir/issues/16
      
      r? `@oli-obk`
      41364c7c
    • M
      Rollup merge of #114306 - ttsugriy:push_str, r=wesleywiser · 00ad3cca
      Matthias Krüger 提交于
      [rustc_data_structures][perf] Simplify base_n::push_str.
      
      This minor change removes the need to reverse resulting digits. Since reverse is O(|digit_num|) but bounded by 128, it's unlikely to be a noticeable in practice. At the same time, this code is also a 1 line shorter, so combined with tiny perf win, why not?
      
      I ran https://gist.github.com/ttsugriy/ed14860ef597ab315d4129d5f8adb191 on M1 macbook air and got a small improvement
      ```
      Running benches/base_n_benchmark.rs (target/release/deps/base_n_benchmark-825fe5895b5c2693)
      push_str/old            time:   [14.180 µs 14.313 µs 14.462 µs]
                              Performance has improved.
      Found 5 outliers among 100 measurements (5.00%)
        4 (4.00%) high mild
        1 (1.00%) high severe
      push_str/new            time:   [13.741 µs 13.839 µs 13.973 µs]
                              Performance has improved.
      Found 8 outliers among 100 measurements (8.00%)
        3 (3.00%) high mild
        5 (5.00%) high severe
      ```
      00ad3cca
    • M
      Rollup merge of #114296 - RalfJung:interpret-repeat-align, r=oli-obk · fa33d6e1
      Matthias Krüger 提交于
      interpret: fix alignment handling for Repeat expressions
      fa33d6e1
    • M
      Rollup merge of #114288 - Urgau:fix-issue-109352, r=b-naber · c726dcb9
      Matthias Krüger 提交于
      Improve diagnostic for wrong borrow on binary operations
      
      This PR improves the diagnostic for wrong borrow on binary operations by suggesting to reborrow on appropriate expressions.
      
      ```diff
      +    = note: an implementation for `&Foo * &Foo` exist
      + help: consider reborrowing both sides
      +    |
      + LL |     let _ = &*ref_mut_foo * &*ref_mut_foo;
      +    |             ++              ++
      ```
      
      Fixes https://github.com/rust-lang/rust/issues/109352
      c726dcb9
    • M
      Rollup merge of #114283 - oli-obk:parkin_lot_rwlock, r=SparrowLii · b3871809
      Matthias Krüger 提交于
      Use parking lot's rwlock even without parallel-rustc
      
      Considering that this doesn't affect perf, I think we should use the simplest solution.
      b3871809
    • M
      Rollup merge of #113428 - Zalathar:operand, r=davidtwco · 52bfceb8
      Matthias Krüger 提交于
      coverage: Replace `ExpressionOperandId` with enum `Operand`
      
      *This is one step in my larger coverage refactoring ambitions described at <https://github.com/rust-lang/compiler-team/issues/645>.*
      
      LLVM coverage has a concept of “mapping expressions” that allow a span's execution count to be computed as a simple arithmetic expression over other counters/expressions, instead of requiring a dedicated physical counter for every control-flow branch.
      
      These expressions have an operator (`+` or `-`) and two operands. Operands are currently represented as `ExpressionOperandId`, which wraps a `u32` with the following semantics:
      
      - 0 represents a special counter that always has a value of zero
      - Values ascending from 1 represent counter IDs
      - Values descending from `u32::MAX` represent the IDs of other expressions
      
      ---
      
      This change replaces that whole `ExpressionOperandId` scheme with a simple enum that explicitly distinguishes between the three cases.
      
      This lets us remove a lot of fiddly code for dealing with the different operand kinds:
      - Previously it was only possible to distinguish between counter-ID operands and expression-ID operands by comparing the operand ID with the total number of counters in a function. This is unnecessary now that the enum distinguishes them explicitly.
      - There's no need for expression IDs to descend from `u32::MAX` and then get translated into zero-based indices in certain places. Now that they ascend from zero, they can be used as indices directly.
      - There's no need to reserve ID number 0 for the special zero operand, since it can just have its own variant in the enum, so counter IDs can count up from 0.
      
      (Making counter IDs ascend from 0 also lets us fix an off-by-one error in the query for counting the total number of counters, which would cause LLVM to emit an extra unused counter for every instrumented function.)
      
      ---
      
      This PR may be easiest to review as individual patches, since that breaks it up into clearly distinct parts:
      - Replace a `u32` wrapper with an explicit enum, without changing the semantics of the underlying IDs being stored.
      - Change the numbering scheme used by `Operand::Expression` to make expression IDs ascend from 0 (instead of descending from `u32::MAX`).
      - Change the numbering scheme used by `Operand::Counter` to make counter IDs ascend from 0 (instead of ascending from 1).
      52bfceb8
    • M
      Rollup merge of #100455 - xfix:backtrace-ref-unwind-safe, r=dtolnay · c97af34d
      Matthias Krüger 提交于
      Implement RefUnwindSafe for Backtrace
      
      Backtrace doesn't have visible mutable state.
      
      See also https://internals.rust-lang.org/t/should-backtrace-be-refunwindsafe/17169?u=xfix
      c97af34d
    • O
      clean up, use opaque types · 2ff62fdf
      ouz-a 提交于
      2ff62fdf
    • B
      Auto merge of #112849 - m-ou-se:panic-message-format, r=thomcc · 828bdc2c
      bors 提交于
      Change default panic handler message format.
      
      This changes the default panic hook's message format from:
      
      ```
      thread '{thread}' panicked at '{message}', {location}
      ```
      
      to
      
      ```
      thread '{thread}' panicked at {location}:
      {message}
      ```
      
      This puts the message on its own line without surrounding quotes, making it easiser to read. For example:
      
      Before:
      ```
      thread 'main' panicked at 'env variable `IMPORTANT_PATH` should be set by `wrapper_script.sh`', src/main.rs:4:6
      ```
      After:
      ```
      thread 'main' panicked at src/main.rs:4:6:
      env variable `IMPORTANT_PATH` should be set by `wrapper_script.sh`
      ```
      
      ---
      
      See this PR by `@nyurik,` which does that for only multi-line messages (specifically because of `assert_eq`): https://github.com/rust-lang/rust/pull/111071
      
      This is the change that does that for *all* panic messages.
      828bdc2c
    • Y
      Fix windows test output. · 2c5ecf22
      Yuri Astrakhan 提交于
      2c5ecf22
    • O
      Cover statements for stable_mir · 206bfc47
      ouz-a 提交于
      206bfc47
    • B
      Auto merge of #114318 - matthiaskrgr:rollup-c7gcw18, r=matthiaskrgr · c435af0d
      bors 提交于
      Rollup of 7 pull requests
      
      Successful merges:
      
       - #111081 (impl SliceIndex<str> for (Bound<usize>, Bound<usize>))
       - #113394 (style-guide: Document style editions, start 2024 style edition)
       - #113588 (bootstrap: use git merge-base for LLVM CI download logic)
       - #113743 (Directly link more target docs)
       - #114262 (Improve the rust style guide doc)
       - #114309 (Update books)
       - #114313 ([rustc_data_structures] Simplify SortedMap::insert.)
      
      r? `@ghost`
      `@rustbot` modify labels: rollup
      c435af0d
    • U
      Improve diagnostic for wrong borrow on binary operations · ad0729e9
      Urgau 提交于
      ad0729e9
    • O
      3eb5733e
    • M
      Rollup merge of #114313 - ttsugriy:sm-insert, r=petrochenkov · a9025502
      Matthias Krüger 提交于
      [rustc_data_structures] Simplify SortedMap::insert.
      
      It looks like current usage of `swap` is aimed at achieving what `std::mem::replace` does but more concisely and idiomatically.
      a9025502
    • M
      Rollup merge of #114309 - rustbot:docs-update, r=ehuss · ff8b96f8
      Matthias Krüger 提交于
      Update books
      
      ## rust-lang/reference
      
      7 commits in 1ea0178266b3f3f613b0fabdaf16a83961c99cdb..9cd5c5a6ccbd4c07c65ab5c69a53286280308c95
      2023-07-29 22:29:51 UTC to 2023-07-16 20:12:46 UTC
      
      - Fix merge queue building twice. (rust-lang/reference#1383)
      - Clarify UB around immutability & mutation (rust-lang/reference#1385)
      - mention the extra const UB (rust-lang/reference#1273)
      - Operator expressions: make the note about division by zero clearer. (rust-lang/reference#1384)
      - Make unsafe keyword docs less confusing (rust-lang/reference#1379)
      - Say that division by zero for primitive types panics (rust-lang/reference#1382)
      - Add CI trigger for merge queues. (rust-lang/reference#1381)
      
      ## rust-lang/rust-by-example
      
      3 commits in 8a87926a985ce32ca1fad1be4008ee161a0b91eb..07e0df2f006e59d171c6bf3cafa9d61dbeb520d8
      2023-07-24 11:37:55 UTC to 2023-07-24 11:35:36 UTC
      
      - Added attribute unused_labels - fixed warning. (rust-lang/rust-by-example#1729)
      - more explanation about panic (rust-lang/rust-by-example#1728)
      - chore: add the portuguese version of this project to `readme.md` (rust-lang/rust-by-example#1727)
      
      ## rust-lang/rustc-dev-guide
      
      26 commits in b5a12d95e32ae53791cc6ab44417774667ed2ac6..24eebb6df96d037aad285e4f7793bd0393a66878
      2023-07-30 11:23:23 UTC to 2023-07-11 06:02:34 UTC
      
      - fix(name-resolution): remove unnecessary closing paranthesis (rust-lang/rustc-dev-guide#1760)
      - fix(macro-expansion.md): fix the article `an` to `a` (rust-lang/rustc-dev-guide#1759)
      - fix(serialization.md): fix the name of a derive macro (rust-lang/rustc-dev-guide#1756)
      - fix(serialization.md): add a necessary plural suffix (rust-lang/rustc-dev-guide#1757)
      - fix(salsa.md): add punctuation to prevent confusion (rust-lang/rustc-dev-guide#1754)
      - fix(salsa.md): remove duplicate "To Be" verb (rust-lang/rustc-dev-guide#1755)
      - feat(fuzzing.md): make `halfempty` word a link (rust-lang/rustc-dev-guide#1750)
      - fix(about.md): use `a` instead of `an` (rust-lang/rustc-dev-guide#1751)
      - refactor(git.md): make git-scm links clickable (rust-lang/rustc-dev-guide#1747)
      - fix(walkthrough.md) add a comma operator to eliminate ambiguity (rust-lang/rustc-dev-guide#1749)
      - fix(git.md): remove a confusing end of sentence character (rust-lang/rustc-dev-guide#1748)
      - refactor(profiling/with_perf): remove a wrong to be verb (rust-lang/rustc-dev-guide#1746)
      - refactor(tests/headers): remove duplicate list item (rust-lang/rustc-dev-guide#1745)
      - refactor(test/headers.md): make the meaning more obvious (rust-lang/rustc-dev-guide#1744)
      - refactor(tests/ui): remove unnecessary duplicate word (rust-lang/rustc-dev-guide#1743)
      - refactor(compiletest): remove unnecessary duplicate word (rust-lang/rustc-dev-guide#1742)
      - generic_arguments.md: substs -> GenericArgs (rust-lang/rustc-dev-guide#1741)
      - fix(suggested): remove an unnecessary and confusing statement (rust-lang/rustc-dev-guide#1739)
      - fix(how-to-build-and-run): fix a typo ("fromer" -> "former") (rust-lang/rustc-dev-guide#1736)
      - fix(how-to-build-and-run): remove a wrong paragraph (rust-lang/rustc-dev-guide#1735)
      - coverage code has moved (rust-lang/rustc-dev-guide#1728)
      - linked issue is closed (rust-lang/rustc-dev-guide#1729)
      - remove duplicate reference in about-this-guide.md (rust-lang/rustc-dev-guide#1734)
      - Explain more in depth what early and late bound generic parameters are (rust-lang/rustc-dev-guide#1732)
      - add section for normalization with the new solver (rust-lang/rustc-dev-guide#1731)
      - Improve cleanup-crew.md with an example post (rust-lang/rustc-dev-guide#1730)
      ff8b96f8
    • M
      Rollup merge of #114262 - ShapelessCat:fix-style-guide-md, r=joshtriplett · 2fac3972
      Matthias Krüger 提交于
      Improve the rust style guide doc
      
      - Make the levels of headings consistent in this whole document.
         Before this change, the highest level of headings in some file is level 1, but in most of the files the that is level 2. Not consistent.
      
      - Fix some headings
      
      - Follow the markdown linter advices
        - Remove redundant empty lines
        - Surround each heading with empty lines
        - Use the same symbol for different levels of unordered list entries
      2fac3972
    • M
      Rollup merge of #113743 - workingjubilee:link-more-platform-support-docs, r=joshtriplett · 4e60d99a
      Matthias Krüger 提交于
      Directly link more target docs
      
      Some platforms were not linked from platform-support.md
      
      This fixes that, but errs towards extremely conservative, only directly linking platform docs if the docs actively mention the target, as otherwise I do not necessarily know if there was a reason for the omission.
      4e60d99a
    • M
      Rollup merge of #113588 - RalfJung:llvm-merge-base, r=albertlarsan68 · 849f4f88
      Matthias Krüger 提交于
      bootstrap: use git merge-base for LLVM CI download logic
      
      Fixes https://github.com/rust-lang/rust/issues/101907
      I tested this with a local branch that has extra merge commits due to Miri, and it worked fine there. But I am sure there are tons of other situations I did not think of...
      
      r? `@jyn514`
      849f4f88
    • M
      Rollup merge of #113394 - joshtriplett:style-edition-snapshot, r=calebcartwright · 02426434
      Matthias Krüger 提交于
      style-guide: Document style editions, start 2024 style edition
      
      Link to a snapshot for the 2015/2018/2021 style edition.
      
      This is a draft, because I'd like to wait for a few style guide fixes to merge
      before snapshotting the 2015/2018/2021 style edition:
      
      - https://github.com/rust-lang/rust/pull/113145
      - https://github.com/rust-lang/rust/pull/113380
      - https://github.com/rust-lang/rust/pull/113384
      - https://github.com/rust-lang/rust/pull/113385
      - https://github.com/rust-lang/rust/pull/113386
      - https://github.com/rust-lang/rust/pull/113392
      
      I'd like to wait for these for two reasons: to make it easier to see the
      differences between the 2015/2018/2021 style edition and the 2024 style
      edition (without the noise of guide-wide changes), and to minimize confusion so
      that bugfixes to the style guide that we include in the previous edition don't
      look like they're only part of the 2024 style edition.
      
      I've used "Miscellaneous `rustfmt` bugfixes" as a starting point for the list
      of 2024 changes, for now. We can update that when we add more 2024 changes.
      
      The section added in this PR can then serve as a baseline for our drafts of
      2024 style edition changes.
      
      In the meantime, I'd like to get someone from `@rust-lang/style` to review and
      approve the text here; I'll update it with a commit hash when the above PRs
      have merged.
      02426434
    • M
      Rollup merge of #111081 - mattfbacon:master, r=workingjubilee · 14a5dc52
      Matthias Krüger 提交于
      impl SliceIndex<str> for (Bound<usize>, Bound<usize>)
      
      This impl is conspicuously missing.
      14a5dc52
    • B
      Auto merge of #111753 - cjgillot:simp-place-conflict, r=compiler-errors · 866710c5
      bors 提交于
      Only consider places with the same local in each_borrow_involving_path.
      
      This avoids having a busy loop that repeatedly checks for equality of locals.
      866710c5
    • J
      Directly link more target docs · 467cb52c
      Jubilee Young 提交于
      Some platforms were not linked from platform-support.md
      
      This fixes that, but errs towards extremely conservative,
      only directly linking platform docs if the docs actively
      mention the target, as otherwise I do not necessarily
      know if there was a reason for the omission.
      467cb52c
    • Z
      Make coverage counter IDs count up from 0, not 1 · 3920e07f
      Zalathar 提交于
      Operand types are now tracked explicitly, so there is no need to reserve ID 0
      for the special always-zero counter.
      
      As part of the renumbering, this change fixes an off-by-one error in the way
      counters were counted by the `coverageinfo` query. As a result, functions
      should now have exactly the number of counters they actually need, instead of
      always having an extra counter that is never used.
      3920e07f
    • Z
      Make coverage expression IDs count up from 0, not down from `u32::MAX` · f103db89
      Zalathar 提交于
      Operand types are now tracked explicitly, so there is no need for expression
      IDs to avoid counter IDs by descending from `u32::MAX`. Instead they can just
      count up from 0, and can be used directly as indices when necessary.
      f103db89
    • Z
      Replace `ExpressionOperandId` with enum `Operand` · 1a014d42
      Zalathar 提交于
      Because the three kinds of operand are now distinguished explicitly, we no
      longer need fiddly code to disambiguate counter IDs and expression IDs based on
      the total number of counters/expressions in a function.
      
      This does increase the size of operands from 4 bytes to 8 bytes, but that
      shouldn't be a big deal since they are mostly stored inside boxed structures,
      and the current coverage code is not particularly size-optimized anyway.
      1a014d42
    • Z
      Add some line comments to enum `CoverageKind` · 5a808d40
      Zalathar 提交于
      The actual motivation here is to prevent `rustfmt` from suddenly reformatting
      these enum variants onto a single line, when they become slightly shorter in
      the future.
      
      But there's no harm in adding some helpful documentation at the same time.
      5a808d40
    • B
      Auto merge of #114310 - flip1995:clippyup, r=Manishearth · b484c878
      bors 提交于
      Update Clippy
      
      r? `@Manishearth`
      
      This is a bit delayed, because I thought it is a difficult conflict resolution and didn't have time for that over the weekend. Turns out, I just used the wrong merge base and it was actually easy... Don't do syncs in the middle of the night (even though I broke this rule with this PR again).
      b484c878
    • J
    • J
      style-guide: Document style editions, start 2024 style edition · 0217565e
      Josh Triplett 提交于
      Link to a snapshot for the 2015/2018/2021 style edition.
      0217565e
    • T
      [rustc_data_structures] Simplify SortedMap::insert. · 9eae73a5
      Taras Tsugrii 提交于
      It looks like current usage of `swap` is aimed at achieving what
      `std::mem::replace` does but more concisely and idiomatically.
      9eae73a5
    • B
      Auto merge of #114308 - matthiaskrgr:rollup-m64bkm7, r=matthiaskrgr · 706a4d9a
      bors 提交于
      Rollup of 7 pull requests
      
      Successful merges:
      
       - #109318 (Make `Debug` representations of `[Lazy, Once]*[Cell, Lock]` consistent with `Mutex` and `RwLock`)
       - #113701 (Re-export core::ffi::FromBytesUntilNulError in std::ffi)
       - #113804 (Resolve correct archive version name in `opt-dist`)
       - #114165 (Add missing rvalues to smir)
       - #114182 (clean up after 113312)
       - #114193 (Update lexer emoji diagnostics to Unicode 15.0)
       - #114200 (Detect trait upcasting through struct tail unsizing in new solver select)
      
      r? `@ghost`
      `@rustbot` modify labels: rollup
      706a4d9a
    • P
      Merge commit '5436dba8' into clippyup · 53f09d95
      Philipp Krones 提交于
      53f09d95
    • B
      Auto merge of #114307 - matthiaskrgr:rollup-8k5rq16, r=matthiaskrgr · db7ff98a
      bors 提交于
      Rollup of 8 pull requests
      
      Successful merges:
      
       - #112858 (Update Android system definitions and add riscv-linux-android as tier 3 target)
       - #113717 (remove repetitive words)
       - #113725 (Move MinGW linker dist option to proper section)
       - #113740 (Update `.gitmodules` to use shallow submodule clones)
       - #113889 (Fix ice tests when librustc-driver is linked dynamically)
       - #113906 (etc: add `RUSTC_BOOTSTRAP` to rust-analyzer config)
       - #113920 (fix(resolve): report unresolved imports firstly)
       - #114111 (Improve test case for experimental API remove_matches)
      
      r? `@ghost`
      `@rustbot` modify labels: rollup
      db7ff98a
    • R
      Update books · 1216ae75
      rustbot 提交于
      1216ae75