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

Closed
wants to merge 28 commits into from

Conversation

matthiaskrgr
Copy link
Member

Successful merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

artemagvanian and others added 28 commits August 16, 2024 14:28
* Choose test inputs more thoroughly and systematically.
* Check that `isqrt` and `checked_isqrt` have equivalent results for
  signed types, either equivalent numerically or equivalent as a panic
  and a `None`.
* Check that `isqrt` has numerically-equivalent results for unsigned
  types and their `NonZero` counterparts.
* Reuse `ilog10` benchmarks, plus benchmarks that use a uniform
  distribution.
* Use a lookup table for 8-bit integers and the Karatsuba square root
  algorithm for larger integers.
* Include optimization hints that give the compiler the exact numeric
  range of results.
Previously `libname.a` naming was supported as a fallback when producing rlibs, but not when producing executables or dynamic libraries
Improved `checked_isqrt` and `isqrt` methods

### Improved tests of `isqrt` and `checked_isqrt` implementations

* Inputs chosen more thoroughly and systematically.
* Checks that `isqrt` and `checked_isqrt` have equivalent results for signed types, either equivalent numerically or equivalent as a panic and a `None`.
* Checks that `isqrt` has numerically-equivalent results for unsigned types and their `NonZero` counterparts.

### Added benchmarks for `isqrt` implementations

### Greatly sped up `checked_isqrt` and `isqrt` methods

* Uses a lookup table for 8-bit integers and then the Karatsuba square root algorithm for larger integers.
* Includes optimization hints that give the compiler the exact numeric range of results.

### Feature tracking issue

`isqrt` is an unstable feature tracked at rust-lang#116226.

<details><summary>Benchmarked improvements</summary>

### Command used to benchmark

    ./x bench library/core -- int_sqrt

### Before

    benchmarks:
        num::int_sqrt::i128::isqrt           439591.65/iter  +/- 6652.70
        num::int_sqrt::i16::isqrt              5302.97/iter   +/- 160.93
        num::int_sqrt::i32::isqrt             62999.11/iter  +/- 2022.05
        num::int_sqrt::i64::isqrt            125248.81/iter  +/- 1674.43
        num::int_sqrt::i8::isqrt                123.56/iter     +/- 1.87
        num::int_sqrt::isize::isqrt          125356.56/iter  +/- 1017.03
        num::int_sqrt::non_zero_u128::isqrt  437443.75/iter  +/- 3535.43
        num::int_sqrt::non_zero_u16::isqrt     8604.58/iter    +/- 94.76
        num::int_sqrt::non_zero_u32::isqrt    62933.33/iter   +/- 517.30
        num::int_sqrt::non_zero_u64::isqrt   125076.38/iter +/- 11340.61
        num::int_sqrt::non_zero_u8::isqrt       221.51/iter     +/- 1.58
        num::int_sqrt::non_zero_usize::isqrt 136005.21/iter  +/- 2020.35
        num::int_sqrt::u128::isqrt           439014.55/iter  +/- 3920.45
        num::int_sqrt::u16::isqrt              8575.08/iter   +/- 148.06
        num::int_sqrt::u32::isqrt             63008.89/iter   +/- 803.67
        num::int_sqrt::u64::isqrt            125088.09/iter   +/- 879.29
        num::int_sqrt::u8::isqrt                230.18/iter     +/- 2.04
        num::int_sqrt::usize::isqrt          125237.51/iter  +/- 4747.83
### After

    benchmarks:
        num::int_sqrt::i128::isqrt           105184.89/iter +/- 1171.38
        num::int_sqrt::i16::isqrt              1910.26/iter   +/- 78.50
        num::int_sqrt::i32::isqrt             34260.34/iter  +/- 960.84
        num::int_sqrt::i64::isqrt             45939.19/iter +/- 2525.65
        num::int_sqrt::i8::isqrt                 22.87/iter    +/- 0.45
        num::int_sqrt::isize::isqrt           45884.17/iter  +/- 595.49
        num::int_sqrt::non_zero_u128::isqrt  106344.27/iter  +/- 780.99
        num::int_sqrt::non_zero_u16::isqrt     2790.19/iter   +/- 53.43
        num::int_sqrt::non_zero_u32::isqrt    33613.99/iter  +/- 362.96
        num::int_sqrt::non_zero_u64::isqrt    46235.42/iter  +/- 429.69
        num::int_sqrt::non_zero_u8::isqrt        31.78/iter    +/- 0.75
        num::int_sqrt::non_zero_usize::isqrt  46208.75/iter  +/- 375.27
        num::int_sqrt::u128::isqrt           106385.94/iter +/- 1649.95
        num::int_sqrt::u16::isqrt              2747.69/iter   +/- 28.72
        num::int_sqrt::u32::isqrt             33627.09/iter  +/- 475.68
        num::int_sqrt::u64::isqrt             46182.29/iter  +/- 311.16
        num::int_sqrt::u8::isqrt                 33.10/iter    +/- 0.30
        num::int_sqrt::usize::isqrt           46165.00/iter  +/- 388.41

</details>
…celinval

Add an ability to convert between `Span` and `visit::Location`

AFAIK, there is no way to create a `Location` from a `Span` because its only field is private. This makes it impossible to use visitor methods like `visit_statement` or `visit_terminator`.

This PR adds an implementation for`From<Span>` for `Location` to fix this.

r? `@celinval`
linker: Synchronize native library search in rustc and linker

Also search for static libraries with alternative naming (`libname.a`) on MSVC when producing executables or dynamic libraries, and not just rlibs.

This unblocks rust-lang#123436.

try-job: x86_64-msvc
…ax-pointee, r=compiler-errors

derive(SmartPointer): assume pointee from the single generic and better error messages

Fix rust-lang#129465

Actually RFC says that `#[pointee]` can be inferred when there is no ambiguity, or there is only one generic type parameter so to say.

cc `@Darksonn`

r? `@compiler-errors`
…adrieril

format code in tests/ui/threads-sendsync

was thinking of fixing formatting for 1 test in the directory, but found a bunch of them to also be in need
Don't use `TyKind` in a lint

Allows us to remove an inherent method from `TyKind` from the type ir crate.
Update books

## rust-lang/book

4 commits in 04bc1396bb857f35b5dda1d773c9571e1f253304..e7d217be2a75ef1753f0988d6ccaba4d7e376259
2024-08-14 01:19:47 UTC to 2024-08-13 16:51:00 UTC

- Backport/forward port ch12 (rust-lang/book#4008)
- Found some more things to fix in ch7; I forgot to update the snapshot (rust-lang/book#4007)
- Remove redundant sentence. Send to nostarch (rust-lang/book#4006)
- Fix: typo (rust-lang/book#4003)

## rust-lang/edition-guide

5 commits in aeeb287d41a0332c210da122bea8e0e91844ab3e..eeba2cb9c37ab74118a4fb5e5233f7397e4a91f8
2024-08-19 23:28:06 UTC to 2024-08-15 15:12:33 UTC

- 2024: Add rustdoc combined doctests (rust-lang/edition-guide#320)
- Update for unsafe attributes stabilization (rust-lang/edition-guide#319)
- 2024: Add macro-fragment-specifiers. (rust-lang/edition-guide#312)
- Fix deprecated_safe_2024 link (rust-lang/edition-guide#317)
- Add 2024 unsafe functions (rust-lang/edition-guide#304)

## rust-embedded/book

1 commits in 019f3928d8b939ec71b63722dcc2e46330156441..ff5d61d56f11e1986bfa9652c6aff7731576c37d
2024-08-20 07:26:19 UTC to 2024-08-20 07:26:19 UTC

- Use aligned address to demonstrate HardFault (rust-embedded/book#374)

## rust-lang/nomicon

1 commits in 6ecf95c5f2bfa0e6314dfe282bf775fd1405f7e9..14649f15d232d509478206ee9ed5105641aa60d0
2024-08-14 14:49:09 UTC to 2024-08-14 14:49:09 UTC

- CI: Switch to merge queue (rust-lang/nomicon#459)

## rust-lang/reference

14 commits in 62cd0df95061ba0ac886333f5cd7f3012f149da1..0668397076da350c404dadcf07b6cbc433ad3743
2024-08-11 21:06:12 +0000 to 2024-08-27 21:47:20 +0000
- Update enum.md (rust-lang/reference#1354)
- Be consistent about how "Edition differences" is capitalized (rust-lang/reference#1586)
- Sync denied lints with upstream (rust-lang/reference#1589)
- const_eval: update for const-fn float stabilization (rust-lang/reference#1566)
- Add spec identifier syntax to destructors.md (rust-lang/reference#1571)
- Say that `pub(in path)` can't depend on `use` statements (rust-lang/reference#1559)
- bytes inside implicitly const-promoted expressions are immutable (rust-lang/reference#1554)
- Tweak `repr(transparent)` to mention requiring *at most* one non-1-ZST (rust-lang/reference#1568)
- operator expressions: add &raw (rust-lang/reference#1567)
- Rewrite the automatic std link translation, and switch to automatic links (rust-lang/reference#1578)
- Add some basic docs for unsafe attrs (rust-lang/reference#1539)
- don't capitalize Undefined Behavior (rust-lang/reference#1575)
- add the `const` operand to docs for inline assembly (rust-lang/reference#1556)
- Typo: 'a' to 'an' in type-coercions.md (rust-lang/reference#1572)

## rust-lang/rust-by-example

1 commits in 8f94061936e492159f4f6c09c0f917a7521893ff..859786c5bc99301bbc22fc631a5c2b341860da08
2024-08-26 10:30:48 UTC to 2024-08-26 10:30:48 UTC

- Update primitives.md with examples (rust-lang/rust-by-example#1878)

## rust-lang/rustc-dev-guide

7 commits in 43d83780db545a1ed6d45773312fc578987e3968..fa928a6d19e1666d8d811dfe3fd35cdad3b4e459
2024-08-26 14:46:50 UTC to 2024-08-12 21:07:49 UTC

- Fix x.py reference (rust-lang/rustc-dev-guide#2049)
- Update `stabilization_guide.md` (rust-lang/rustc-dev-guide#2034)
- Explain the internal `#[rustc_*]` TEST attributes used for debugging and inside tests (rust-lang/rustc-dev-guide#2046)
- missing char (rust-lang/rustc-dev-guide#2047)
- Replace direct http links to rustc-dev-guide.rust-lang.org (rust-lang/rustc-dev-guide#2044)
- Update index.html, 39. The MIR: fix typo (rust-lang/rustc-dev-guide#2043)
- Update LLVM docs (rust-lang/rustc-dev-guide#2039)
… r=dtolnay

Add fmt::Debug to sync::Weak<T, A>

Currently, `sync::Weak<T>` implements `Debug`, but `sync::Weak<T, A>` does not. This appears to be an oversight, as `rc::Weak<T, A>` implements `Debug`. (Note: `sync::Weak` is the weak for `Arc`, and `rc::Weak` is the weak for `Rc`.)

This PR adds the Debug trait for `sync::Weak<T, A>`. The issue was initially brought up here: rust-lang/wg-allocators#131
copysign with sign being a NaN can have non-portable results

Follow-up to rust-lang#129559.
Cc `@tgross35` `@beetrees`

There's no portable variant we can recommend instead here, is there? Something with a semantics like "if `sign` is a NaN, then return `self` unaltered, otherwise return `self` with the sign changed to that of `sign`"?
…ichaelwoerister

Move `'tcx` lifetime off of impl and onto methods for `CrateMetadataRef`

Unconstrained type and const variables are not allowed, but unconstrained lifetimes are. This is not very good style, though, and it leads to unnecessary captures of a lifetime in edition 2024 (not that it matters, but it does trigger the edition migration lint).
…path, r=onur-ozkan

Fix path to run clippy on rustdoc

Took me a while to find out that the path clippy expected was `src/tools/rustdoc` and not `src/librustdoc`. I think it makes more sense this way as most commands rely on source paths.

r? `@Kobzol`
@rustbot rustbot added A-run-make Area: port run-make Makefiles to rmake.rs S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 28, 2024
@rustbot rustbot added T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. rollup A PR which is a rollup labels Aug 28, 2024
@matthiaskrgr
Copy link
Member Author

@bors r+ rollup=never p=11

@bors
Copy link
Contributor

bors commented Aug 28, 2024

📌 Commit 7320663 has been approved by matthiaskrgr

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 28, 2024
@bors
Copy link
Contributor

bors commented Aug 28, 2024

⌛ Testing commit 7320663 with merge 75a0d20...

bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 28, 2024
…iaskrgr

Rollup of 11 pull requests

Successful merges:

 - rust-lang#128166 (Improved `checked_isqrt` and `isqrt` methods)
 - rust-lang#129170 (Add an ability to convert between `Span` and `visit::Location`)
 - rust-lang#129366 (linker: Synchronize native library search in rustc and linker)
 - rust-lang#129467 (derive(SmartPointer): assume pointee from the single generic and better error messages)
 - rust-lang#129494 (format code in tests/ui/threads-sendsync)
 - rust-lang#129527 (Don't use `TyKind` in a lint)
 - rust-lang#129617 (Update books)
 - rust-lang#129673 (Add fmt::Debug to sync::Weak<T, A>)
 - rust-lang#129683 (copysign with sign being a NaN can have non-portable results)
 - rust-lang#129689 (Move `'tcx` lifetime off of impl and onto methods for `CrateMetadataRef`)
 - rust-lang#129695 (Fix path to run clippy on rustdoc)

r? `@ghost`
`@rustbot` modify labels: rollup
@rust-log-analyzer
Copy link
Collaborator

The job test-various failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
test num::int_log::ilog3_of_0_panic ... ignored
Error: failed to run main module `/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/wasm32-wasip1/release/deps/coretests-725e4eb03cd34f4a.wasm`

Caused by:
    0: failed to invoke command default
    1: error while executing at wasm backtrace:
           0: 0x1889da - coretests-725e4eb03cd34f4a.wasm!__rust_start_panic
           1: 0x1884ac - coretests-725e4eb03cd34f4a.wasm!rust_panic
           2: 0x18830a - coretests-725e4eb03cd34f4a.wasm!std::panicking::rust_panic_with_hook::hf04efb191ce3392e
           3: 0x187157 - coretests-725e4eb03cd34f4a.wasm!std::panicking::begin_panic_handler::{{closure}}::h7defca744e17c78e
           4: 0x187096 - coretests-725e4eb03cd34f4a.wasm!std::sys::backtrace::__rust_end_short_backtrace::h427af008ae1a84bd
           5: 0x187c46 - coretests-725e4eb03cd34f4a.wasm!rust_begin_unwind
           6: 0x195f62 - coretests-725e4eb03cd34f4a.wasm!core::panicking::panic_fmt::hd5d261443cee0636
           7: 0x195fa6 - coretests-725e4eb03cd34f4a.wasm!core::num::int_sqrt::panic_for_negative_argument::h62c83f7e533f378c
           8: 0x2238 - coretests-725e4eb03cd34f4a.wasm!std::panicking::try::do_call::hc33202f997516c92
           9: 0xeb885 - coretests-725e4eb03cd34f4a.wasm!core::ops::function::FnOnce::call_once::hd65a034fca4b99af
          10: 0x17931b - coretests-725e4eb03cd34f4a.wasm!test::__rust_begin_short_backtrace::hd22e190ef996ab22
          11: 0x17917f - coretests-725e4eb03cd34f4a.wasm!test::types::RunnableTest::run::h2b98afe203cc006f
          12: 0x163118 - coretests-725e4eb03cd34f4a.wasm!test::run_test::hec081ccd76c269e0
          13: 0x15aec3 - coretests-725e4eb03cd34f4a.wasm!test::console::run_tests_console::h30e4f1e9e8806bf8
          14: 0x1794b9 - coretests-725e4eb03cd34f4a.wasm!test::test_main::hdf4c781f2f296b97
          15: 0x17a16f - coretests-725e4eb03cd34f4a.wasm!test::test_main_static::h3544b107033f4795
          16: 0x1433f8 - coretests-725e4eb03cd34f4a.wasm!coretests::main::he15e84837f12155c
          17: 0x1e57 - coretests-725e4eb03cd34f4a.wasm!std::sys::backtrace::__rust_begin_short_backtrace::h418d929656dffe26
          18: 0x1e4a - coretests-725e4eb03cd34f4a.wasm!std::rt::lang_start::{{closure}}::hdcddd723e82acd6a
          19: 0x181bc1 - coretests-725e4eb03cd34f4a.wasm!std::rt::lang_start_internal::h3b803df402ec9302
          20: 0x143430 - coretests-725e4eb03cd34f4a.wasm!__main_void
          21: 0x1814 - coretests-725e4eb03cd34f4a.wasm!_start
       note: using the `WASMTIME_BACKTRACE_DETAILS=1` environment variable may show more debugging information
    2: wasm trap: wasm `unreachable` instruction executed
error: test failed, to rerun pass `-p core --test coretests`
Caused by:
Caused by:
  process didn't exit successfully: `/wasmtime-v19.0.0-x86_64-linux/wasmtime run -C cache=n --dir . --env RUSTC_BOOTSTRAP /checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/wasm32-wasip1/release/deps/coretests-725e4eb03cd34f4a.wasm -Z unstable-options --format json` (exit status: 134)
note: test exited abnormally; to see the full output pass --nocapture to the harness.
  local time: Wed Aug 28 22:52:58 UTC 2024
  network time: Wed, 28 Aug 2024 22:52:58 GMT
##[error]Process completed with exit code 1.
Post job cleanup.

@bors
Copy link
Contributor

bors commented Aug 28, 2024

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Aug 28, 2024
@matthiaskrgr matthiaskrgr deleted the rollup-zqpqyyl branch September 1, 2024 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-run-make Area: port run-make Makefiles to rmake.rs rollup A PR which is a rollup S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.