]> git.lizzy.rs Git - rust.git/log
rust.git
20 months agoRemove some redundant span arguments
Oli Scherer [Wed, 9 Nov 2022 16:07:59 +0000 (16:07 +0000)]
Remove some redundant span arguments

20 months agoRemove an unnecessary `resolve_vars_if_possible`
Oli Scherer [Wed, 9 Nov 2022 14:43:51 +0000 (14:43 +0000)]
Remove an unnecessary `resolve_vars_if_possible`

20 months agoFlip a boolean that was used wrongly (has no effect though)
Oli Scherer [Wed, 9 Nov 2022 14:37:33 +0000 (14:37 +0000)]
Flip a boolean that was used wrongly (has no effect though)

20 months agoAuto merge of #104428 - matthiaskrgr:rollup-jo3078i, r=matthiaskrgr
bors [Tue, 15 Nov 2022 06:43:28 +0000 (06:43 +0000)]
Auto merge of #104428 - matthiaskrgr:rollup-jo3078i, r=matthiaskrgr

Rollup of 13 pull requests

Successful merges:

 - #103842 (Adding Fuchsia compiler testing script, docs)
 - #104354 (Remove leading newlines from `NonZero*` doc examples)
 - #104372 (Update compiler-builtins)
 - #104380 (rustdoc: remove unused CSS `code { opacity: 1 }`)
 - #104381 (Remove dead NoneError diagnostic handling)
 - #104383 (Remove unused symbols and diagnostic items)
 - #104391 (Deriving cleanups)
 - #104403 (Specify language of code comment to generate document)
 - #104404 (Fix missing minification for static files)
 - #104413 ([llvm-wrapper] adapt for LLVM API change)
 - #104415 (rustdoc: fix corner case in search keyboard commands)
 - #104422 (Fix suggest associated call syntax)
 - #104426 (Add test for #102154)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

20 months agoAuto merge of #104418 - matthiaskrgr:rollup-y4i6xjc, r=matthiaskrgr
bors [Tue, 15 Nov 2022 03:37:07 +0000 (03:37 +0000)]
Auto merge of #104418 - matthiaskrgr:rollup-y4i6xjc, r=matthiaskrgr

Rollup of 11 pull requests

Successful merges:

 - #101967 (Move `unix_socket_abstract` feature API to `SocketAddrExt`.)
 - #102470 (Stabilize const char convert)
 - #104223 (Recover from function pointer types with generic parameter list)
 - #104229 (Don't print full paths in overlap errors)
 - #104294 (Don't ICE with inline const errors during MIR build)
 - #104332 (Fixed some `_i32` notation in `maybe_uninit`’s doc)
 - #104349 (fix some typos in comments)
 - #104350 (Fix x finding Python on Windows)
 - #104356 (interpret: make check_mplace public)
 - #104364 (rustdoc: Resolve doc links in external traits having local impls)
 - #104378 (Bump chalk to v0.87)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

20 months agoRollup merge of #104426 - aDotInTheVoid:test-102154, r=compiler-errors
Matthias Krüger [Tue, 15 Nov 2022 00:40:47 +0000 (01:40 +0100)]
Rollup merge of #104426 - aDotInTheVoid:test-102154, r=compiler-errors

Add test for #102154

Closes #102154

20 months agoRollup merge of #104422 - compiler-errors:fix-suggest_associated_call_syntax, r=BoxyUwU
Matthias Krüger [Tue, 15 Nov 2022 00:40:47 +0000 (01:40 +0100)]
Rollup merge of #104422 - compiler-errors:fix-suggest_associated_call_syntax, r=BoxyUwU

Fix suggest associated call syntax

Fixes #104412

20 months agoRollup merge of #104415 - notriddle:notriddle/search-keyboard-commands, r=GuillaumeGomez
Matthias Krüger [Tue, 15 Nov 2022 00:40:46 +0000 (01:40 +0100)]
Rollup merge of #104415 - notriddle:notriddle/search-keyboard-commands, r=GuillaumeGomez

rustdoc: fix corner case in search keyboard commands

This fixes a bug when that shows up in nightly and in stable where:

* Search something
* Press down: first result is highlighted
* Press down: second result is highlighted
* Press down: third result is highlighted
* Press right: first result of second tab is highlighted
* Press left: third result of first tab is highlighted
* Press up: second result is highlighted
* Press up: first result is highlighted
* Press up: Search box is highlighted
* Press down: **third result** is highlighted, where it ought to highlight the first result

20 months agoRollup merge of #104413 - krasimirgg:llvm-16-mref, r=nikic
Matthias Krüger [Tue, 15 Nov 2022 00:40:46 +0000 (01:40 +0100)]
Rollup merge of #104413 - krasimirgg:llvm-16-mref, r=nikic

[llvm-wrapper] adapt for LLVM API change

for https://github.com/llvm/llvm-project/commit/feda983ff89b7be27a9bfabbabce7d2b59869eba.

20 months agoRollup merge of #104404 - GuillaumeGomez:fix-missing-minification, r=notriddle
Matthias Krüger [Tue, 15 Nov 2022 00:40:45 +0000 (01:40 +0100)]
Rollup merge of #104404 - GuillaumeGomez:fix-missing-minification, r=notriddle

Fix missing minification for static files

It's a fix for https://github.com/rust-lang/rust/pull/101702.

The problem was that `Path::ends_with` doesn't do what we thought it does: it checks if the entire item is the last path part, no just if the "path string" ends with the given argument. So instead, I just used the `extension()` method to get the information we want.

cc `@jsha`
r? `@notriddle`

PS: Is it worth it to add a CI test to ensure that the minification was performed on JS and CSS files or not?

20 months agoRollup merge of #104403 - koka831:lint-doc, r=Dylan-DPC
Matthias Krüger [Tue, 15 Nov 2022 00:40:45 +0000 (01:40 +0100)]
Rollup merge of #104403 - koka831:lint-doc, r=Dylan-DPC

Specify language of code comment to generate document

Fix `let_underscore_drop` comment
https://doc.rust-lang.org/rustc/lints/listing/allowed-by-default.html#example-7

20 months agoRollup merge of #104391 - nnethercote:deriving-cleanups, r=jackh726
Matthias Krüger [Tue, 15 Nov 2022 00:40:44 +0000 (01:40 +0100)]
Rollup merge of #104391 - nnethercote:deriving-cleanups, r=jackh726

Deriving cleanups

Fixing some minor problems `@RalfJung` found in #99046.

r? `@RalfJung`

20 months agoRollup merge of #104383 - WaffleLapkin:rustc_undiagnostic_item, r=compiler-errors
Matthias Krüger [Tue, 15 Nov 2022 00:40:44 +0000 (01:40 +0100)]
Rollup merge of #104383 - WaffleLapkin:rustc_undiagnostic_item, r=compiler-errors

Remove unused symbols and diagnostic items

As the title suggests, this removes unused symbols from `sym::` and `#[rustc_diagnostic_item]` annotations that weren't mentioned anywhere.

Originally I tried to use grep, to find symbols and item names that are never mentioned via `sym::name`, however this produced a lot of false positives (?), for example clippy matching on `Symbol::as_str` or macros "implicitly" adding `sym::`. I ended up fixing all these false positives (?) by hand, but tbh I'm not sure if it was worth it...

20 months agoRollup merge of #104381 - mejrs:none_error, r=compiler-errors
Matthias Krüger [Tue, 15 Nov 2022 00:40:44 +0000 (01:40 +0100)]
Rollup merge of #104381 - mejrs:none_error, r=compiler-errors

Remove dead NoneError diagnostic handling

`NoneError` was removed some time ago, so this was dead code.

20 months agoRollup merge of #104380 - rust-lang:notriddle/code-opacity, r=GuillaumeGomez
Matthias Krüger [Tue, 15 Nov 2022 00:40:43 +0000 (01:40 +0100)]
Rollup merge of #104380 - rust-lang:notriddle/code-opacity, r=GuillaumeGomez

rustdoc: remove unused CSS `code { opacity: 1 }`

According to https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/CSS.20cleanup this style was added for declarations that no longer use opacity.

20 months agoRollup merge of #104372 - Ayush1325:compiler-builtins, r=JohnTitor
Matthias Krüger [Tue, 15 Nov 2022 00:40:43 +0000 (01:40 +0100)]
Rollup merge of #104372 - Ayush1325:compiler-builtins, r=JohnTitor

Update compiler-builtins

This was originally a part of https://github.com/rust-lang/rust/pull/100316. However, extracting it to a seperate PR should help with any extra testing that might be needed.

Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
20 months agoRollup merge of #104354 - lukas-code:blank-lines-2, r=JohnTitor
Matthias Krüger [Tue, 15 Nov 2022 00:40:42 +0000 (01:40 +0100)]
Rollup merge of #104354 - lukas-code:blank-lines-2, r=JohnTitor

Remove leading newlines from `NonZero*` doc examples

Like https://github.com/rust-lang/rust/pull/103045, but for `NonZero*`.

`@rustbot` label A-docs

20 months agoRollup merge of #103842 - andrewpollack:add-fuchsia-test-script, r=tmandry
Matthias Krüger [Tue, 15 Nov 2022 00:40:42 +0000 (01:40 +0100)]
Rollup merge of #103842 - andrewpollack:add-fuchsia-test-script, r=tmandry

Adding Fuchsia compiler testing script, docs

Adding Fuchsia compiler testing script and related docs updates

r? `@tmandry`

cc. `@djkoloski`

20 months agoAuto merge of #104091 - BelovDV:issue-103044, r=petrochenkov
bors [Tue, 15 Nov 2022 00:38:08 +0000 (00:38 +0000)]
Auto merge of #104091 - BelovDV:issue-103044, r=petrochenkov

Wrap bundled static libraries into object files

Fixes #103044 (not sure, couldn't test locally)

Bundled static libraries should be wrapped into object files as it's done for metadata file.

r? `@petrochenkov`

20 months agoAdd test for #102154
Nixon Enraght-Moony [Mon, 14 Nov 2022 22:42:57 +0000 (22:42 +0000)]
Add test for #102154

20 months agorustdoc: fix corner case in search keyboard commands
Michael Howell [Mon, 14 Nov 2022 17:41:07 +0000 (10:41 -0700)]
rustdoc: fix corner case in search keyboard commands

20 months agoAdd regression test
Michael Goulet [Mon, 14 Nov 2022 19:29:17 +0000 (19:29 +0000)]
Add regression test

20 months agoDo autoderef to match impl against rcvr
Michael Goulet [Mon, 14 Nov 2022 19:18:38 +0000 (19:18 +0000)]
Do autoderef to match impl against rcvr

20 months agoMove logic into method
Michael Goulet [Mon, 14 Nov 2022 18:40:20 +0000 (18:40 +0000)]
Move logic into method

20 months agoDrive-by: actual -> rcvr_ty
Michael Goulet [Mon, 14 Nov 2022 17:25:37 +0000 (17:25 +0000)]
Drive-by: actual -> rcvr_ty
20 months agoRollup merge of #104378 - compiler-errors:chalk-up, r=jackh726
Matthias Krüger [Mon, 14 Nov 2022 18:26:19 +0000 (19:26 +0100)]
Rollup merge of #104378 - compiler-errors:chalk-up, r=jackh726

Bump chalk to v0.87

1. Removes `ReEmpty` from chalk
2. Adds support for the `std::marker::Tuple` trait

20 months agoRollup merge of #104364 - petrochenkov:docice2, r=GuillaumeGomez
Matthias Krüger [Mon, 14 Nov 2022 18:26:19 +0000 (19:26 +0100)]
Rollup merge of #104364 - petrochenkov:docice2, r=GuillaumeGomez

rustdoc: Resolve doc links in external traits having local impls

For external impls it was done in https://github.com/rust-lang/rust/pull/103192 right away, but the local impl case was forgotten.

Fixes https://github.com/rust-lang/rust/issues/104145.

20 months agoRollup merge of #104356 - RalfJung:interpret-check-mplace, r=oli-obk
Matthias Krüger [Mon, 14 Nov 2022 18:26:18 +0000 (19:26 +0100)]
Rollup merge of #104356 - RalfJung:interpret-check-mplace, r=oli-obk

interpret: make check_mplace public

This helps avoid code duplication in https://github.com/rust-lang/miri/pull/2661.

20 months agoRollup merge of #104350 - SparkyPotato:fix-x-wrapper, r=jyn514
Matthias Krüger [Mon, 14 Nov 2022 18:26:18 +0000 (19:26 +0100)]
Rollup merge of #104350 - SparkyPotato:fix-x-wrapper, r=jyn514

Fix x finding Python on Windows

`x` searches through the path for `{dir}/python{2|3}?`, but this fails on Windows because the appropriate path is `{dir}/python.exe`.

This PR adds the expected `.exe` extension on Windows while searching.

20 months agoRollup merge of #104349 - rustaceanclub:master, r=oli-obk
Matthias Krüger [Mon, 14 Nov 2022 18:26:18 +0000 (19:26 +0100)]
Rollup merge of #104349 - rustaceanclub:master, r=oli-obk

fix some typos in comments

20 months agoRollup merge of #104332 - Elarcis:maybe_uninit_doc_fix, r=m-ou-se
Matthias Krüger [Mon, 14 Nov 2022 18:26:17 +0000 (19:26 +0100)]
Rollup merge of #104332 - Elarcis:maybe_uninit_doc_fix, r=m-ou-se

Fixed some `_i32` notation in `maybe_uninit`’s doc

This PR just changed two lines in the documentation for `MaybeUninit`:

```rs
let val = 0x12345678i32;
```
was changed to:
```rs
let val = 0x12345678_i32;
```
in two doctests, making the values a tad easier to read.

It does not seem like there are other literals needing this change in the file.

20 months agoRollup merge of #104294 - compiler-errors:inline-ct-err-in-mir-build, r=davidtwco
Matthias Krüger [Mon, 14 Nov 2022 18:26:17 +0000 (19:26 +0100)]
Rollup merge of #104294 - compiler-errors:inline-ct-err-in-mir-build, r=davidtwco

Don't ICE with inline const errors during MIR build

Fixes #104277

20 months agoRollup merge of #104229 - compiler-errors:overlap-full-path, r=davidtwco
Matthias Krüger [Mon, 14 Nov 2022 18:26:16 +0000 (19:26 +0100)]
Rollup merge of #104229 - compiler-errors:overlap-full-path, r=davidtwco

Don't print full paths in overlap errors

We don't print the full path in other diagnostics -- I don't think it particularly helps with the error message. I also delayed the printing until actually needing to render the error message.

r? diagnostics

20 months agoRollup merge of #104223 - fmease:recover-fn-ptr-with-generics, r=estebank
Matthias Krüger [Mon, 14 Nov 2022 18:26:16 +0000 (19:26 +0100)]
Rollup merge of #104223 - fmease:recover-fn-ptr-with-generics, r=estebank

Recover from function pointer types with generic parameter list

Give a more helpful error when encountering function pointer types with a generic parameter list like `fn<'a>(&'a str) -> bool` or `fn<T>(T) -> T` and suggest moving lifetime parameters to a `for<>` parameter list.

I've added a bunch of extra code to properly handle (unlikely?) corner cases like `for<'a> fn<'b>()` (where there already exists a `for<>` parameter list) correctly suggesting `for<'a, 'b> fn()` (merging the lists). If you deem this useless, I can simplify the code by suggesting nothing at all in this case.

I am quite open to suggestions regarding the wording of the diagnostic messages.

Fixes #103487.
``@rustbot`` label A-diagnostics
r? diagnostics

20 months agoRollup merge of #102470 - est31:stabilize_const_char_convert, r=joshtriplett
Matthias Krüger [Mon, 14 Nov 2022 18:26:15 +0000 (19:26 +0100)]
Rollup merge of #102470 - est31:stabilize_const_char_convert, r=joshtriplett

Stabilize const char convert

Split out `const_char_from_u32_unchecked` from `const_char_convert` and stabilize the rest, i.e. stabilize the following functions:

```Rust
impl char {
    pub const fn from_u32(self, i: u32) -> Option<char>;
    pub const fn from_digit(self, num: u32, radix: u32) -> Option<char>;
    pub const fn to_digit(self, radix: u32) -> Option<u32>;
}

// Available through core::char and std::char
mod char {
    pub const fn from_u32(i: u32) -> Option<char>;
    pub const fn from_digit(num: u32, radix: u32) -> Option<char>;
}
```

And put the following under the `from_u32_unchecked` const stability gate as it needs `Option::unwrap` which isn't const-stable (yet):

```Rust
impl char {
    pub const unsafe fn from_u32_unchecked(i: u32) -> char;
}

// Available through core::char and std::char
mod char {
    pub const unsafe fn from_u32_unchecked(i: u32) -> char;
}
```

cc the tracking issue #89259 (which I'd like to keep open for `const_char_from_u32_unchecked`).

20 months agoRollup merge of #101967 - jmillikin:linux-abstract-socket-addr, r=joshtriplett
Matthias Krüger [Mon, 14 Nov 2022 18:26:14 +0000 (19:26 +0100)]
Rollup merge of #101967 - jmillikin:linux-abstract-socket-addr, r=joshtriplett

Move `unix_socket_abstract` feature API to `SocketAddrExt`.

The pre-stabilized API for abstract socket addresses exposes methods on `SocketAddr` that are only enabled for `cfg(any(target_os = "android", target_os = "linux"))`. Per discussion in <https://github.com/rust-lang/rust/issues/85410>, moving these methods to an OS-specific extension trait is required before stabilization can be considered.

This PR makes four changes:
1. The internal module `std::os::net` contains logic for the unstable feature `tcp_quickack` (https://github.com/rust-lang/rust/issues/96256). I moved that code into `linux_ext/tcp.rs` and tried to adjust the module tree so it could accommodate a second unstable feature there.
2. Moves the public API out of `impl SocketAddr`, into `impl SocketAddrExt for SocketAddr` (the headline change).
3. The existing function names and docs for `unix_socket_abstract` refer to addresses as being created from abstract namespaces, but a more accurate description is that they create sockets in *the* abstract namespace. I adjusted the function signatures correspondingly and tried to update the docs to be clearer.
4. I also tweaked `from_abstract_name` so it takes an `AsRef<[u8]>` instead of `&[u8]`, allowing `b""` literals to be passed directly.

Issues:
1. The public module `std::os::linux::net` is marked as part of `tcp_quickack`. I couldn't figure out how to mark a module as being part of two unstable features, so I just left the existing attributes in place. My hope is that this will be fixed as a side-effect of stabilizing either feature.

20 months ago[llvm-wrapper] adapt for LLVM API change
Krasimir Georgiev [Mon, 14 Nov 2022 14:59:32 +0000 (14:59 +0000)]
[llvm-wrapper] adapt for LLVM API change

20 months agoFix missing minification for static files
Guillaume Gomez [Mon, 14 Nov 2022 14:14:54 +0000 (15:14 +0100)]
Fix missing minification for static files

20 months agoSpecify language of code comment to generate document
koka [Mon, 14 Nov 2022 13:55:50 +0000 (22:55 +0900)]
Specify language of code comment to generate document

20 months agoWrap bundlen static libraries into object files
Daniil Belov [Sun, 16 Oct 2022 14:05:53 +0000 (17:05 +0300)]
Wrap bundlen static libraries into object files

20 months agoAuto merge of #104387 - Manishearth:rollup-9e551p5, r=Manishearth
bors [Mon, 14 Nov 2022 06:30:18 +0000 (06:30 +0000)]
Auto merge of #104387 - Manishearth:rollup-9e551p5, r=Manishearth

Rollup of 9 pull requests

Successful merges:

 - #103709 (ci: Upgrade dist-x86_64-netbsd to NetBSD 9.0)
 - #103744 (Upgrade cc for working is_flag_supported on cross-compiles)
 - #104105 (llvm: dwo only emitted when object code emitted)
 - #104158 (Return .efi extension for EFI executable)
 - #104181 (Add a few known-bug tests)
 - #104266 (Regression test for coercion of mut-ref to dyn-star)
 - #104300 (Document `Path::parent` behavior around relative paths)
 - #104304 (Enable profiler in dist-s390x-linux)
 - #104362 (Add `delay_span_bug` to `AttrWrapper::take_for_recovery`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

20 months agoRemove TraitDef::generics.
Nicholas Nethercote [Mon, 14 Nov 2022 04:43:10 +0000 (15:43 +1100)]
Remove TraitDef::generics.

Because it's always empty.

20 months agoAuto merge of #104188 - jyn514:download-config-only, r=Mark-Simulacrum
bors [Mon, 14 Nov 2022 03:15:03 +0000 (03:15 +0000)]
Auto merge of #104188 - jyn514:download-config-only, r=Mark-Simulacrum

Make all download functions need only Config, not Builder

This also adds a new `mod download` instead of scattering the download code across `config.rs` and `native.rs`.

This is the simplest and also most bit-rotty part of https://github.com/rust-lang/rust/pull/102282. Opening it earlier so it's not mixed in with behavior changes and to avoid rebase hell.

cc https://github.com/rust-lang/rust/issues/94829 (which nows has the hackmd linked).

r? `@Mark-Simulacrum`

20 months agoRemove `addr_of` argument from `create_struct_pattern_fields`.
Nicholas Nethercote [Mon, 14 Nov 2022 02:59:54 +0000 (13:59 +1100)]
Remove `addr_of` argument from `create_struct_pattern_fields`.

Because it's always false.

20 months agoMake all download functions need only Config, not Builder
Joshua Nelson [Sun, 30 Oct 2022 22:29:51 +0000 (17:29 -0500)]
Make all download functions need only Config, not Builder

This also adds a new `mod download` instead of scattering the download code
across `config.rs` and `native.rs`.

20 months agoRollup merge of #104362 - WaffleLapkin:span_bug_won't_come_on_time_today, r=Aaron1011
Manish Goregaokar [Mon, 14 Nov 2022 02:49:27 +0000 (21:49 -0500)]
Rollup merge of #104362 - WaffleLapkin:span_bug_won't_come_on_time_today, r=Aaron1011

Add `delay_span_bug` to `AttrWrapper::take_for_recovery`

`take_for_recovery` should only be used for recovery (when we should already have an error), so using `delay_span_bug` seems appropriate.

cc `@Aaron1011` (you've added the `FIXME` that this pr fixes)

20 months agoRollup merge of #104304 - uweigand:s390x-profiler, r=Mark-Simulacrum
Manish Goregaokar [Mon, 14 Nov 2022 02:49:27 +0000 (21:49 -0500)]
Rollup merge of #104304 - uweigand:s390x-profiler, r=Mark-Simulacrum

Enable profiler in dist-s390x-linux

Build the profiler runtime to allow using -C profile-generate and -C instrument-coverage on s390x-linux.

I've verified in a local build that the runtime builds and the profiler is working fine on the platform.

20 months agoRollup merge of #104300 - tbu-:pr_path_parent_caveats, r=Mark-Simulacrum
Manish Goregaokar [Mon, 14 Nov 2022 02:49:27 +0000 (21:49 -0500)]
Rollup merge of #104300 - tbu-:pr_path_parent_caveats, r=Mark-Simulacrum

Document `Path::parent` behavior around relative paths

A relative path with just one component will return `Some("")` as its parent, which wasn't clear to me from the documentation.

The parent of `""` is `None`, which was missing from the documentation as well.

20 months agoRollup merge of #104266 - compiler-errors:issue-102430, r=Mark-Simulacrum
Manish Goregaokar [Mon, 14 Nov 2022 02:49:26 +0000 (21:49 -0500)]
Rollup merge of #104266 - compiler-errors:issue-102430, r=Mark-Simulacrum

Regression test for coercion of mut-ref to dyn-star

Closes #102430

20 months agoRollup merge of #104181 - jackh726:known-bug-tests, r=Mark-Simulacrum
Manish Goregaokar [Mon, 14 Nov 2022 02:49:26 +0000 (21:49 -0500)]
Rollup merge of #104181 - jackh726:known-bug-tests, r=Mark-Simulacrum

Add a few known-bug tests

The labels of these tests should be changed from `S-bug-has-mcve` to `S-bug-has-test` once this is merged.

cc:
#101518
#99492
#90950
#89196
#104034
#101350
#103705
#103899

I couldn't reproduce the failures in #101962 and #100772 (so either these have started passing, or I didn't repro properly), so leaving those out for now.

#102065 was a bit more complicated, since it uses `rustc_private` and I didn't want to mess with that.

20 months agoRollup merge of #104158 - Ayush1325:executable, r=Mark-Simulacrum
Manish Goregaokar [Mon, 14 Nov 2022 02:49:25 +0000 (21:49 -0500)]
Rollup merge of #104158 - Ayush1325:executable, r=Mark-Simulacrum

Return .efi extension for EFI executable

Originally part of https://github.com/rust-lang/rust/pull/100316

Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
20 months agoRollup merge of #104105 - davidtwco:split-dwarf-lto, r=michaelwoerister
Manish Goregaokar [Mon, 14 Nov 2022 02:49:25 +0000 (21:49 -0500)]
Rollup merge of #104105 - davidtwco:split-dwarf-lto, r=michaelwoerister

llvm: dwo only emitted when object code emitted

Fixes #103932.

`CompiledModule` should not think a DWARF object was emitted when a bitcode-only compilation has happened, this can confuse archive file creation (which expects to create an archive containing non-existent dwo files).

r? ``````@michaelwoerister``````

20 months agoRollup merge of #103744 - palfrey:unwind-upgrade-cc, r=Mark-Simulacrum
Manish Goregaokar [Mon, 14 Nov 2022 02:49:24 +0000 (21:49 -0500)]
Rollup merge of #103744 - palfrey:unwind-upgrade-cc, r=Mark-Simulacrum

Upgrade cc for working is_flag_supported on cross-compiles

https://github.com/rust-lang/rust/pull/85806 fixed unwind v.s gcc support on later Android ndks using `is_flag_supported`. However, due to https://github.com/rust-lang/cc-rs/issues/675, this didn't work properly on cross-compiles. https://github.com/rust-lang/cc-rs/commit/3eeb50b391a7543a6fed96276ee9388b5430a50d fixes this, and was released in cc 1.0.74, hence the upgrade

20 months agoRollup merge of #103709 - cuviper:netbsd-9, r=pietroalbini
Manish Goregaokar [Mon, 14 Nov 2022 02:49:24 +0000 (21:49 -0500)]
Rollup merge of #103709 - cuviper:netbsd-9, r=pietroalbini

ci: Upgrade dist-x86_64-netbsd to NetBSD 9.0

This is another step in toolchain upgrades for LLVM 16, which will need at least GCC 7.1.

Our previous NetBSD 8.0 cross-toolchain used its system GCC 5.5. While there are newer versions available in pkgsrc, I could not get those working for cross-compilation. Upgrading to NetBSD 9.0 gets us GCC 7.4, which is sufficient for now.

This will affect the compatibility of the build we ship for `x86_64-unknown-netbsd`, but others may still build their own from source if that is needed. It is expected that NetBSD 8 will reach EOL soon anyway, approximately one month after 10 is released, but there is no firm date for that.

20 months agoClarify `expand_struct_method_body`.
Nicholas Nethercote [Mon, 14 Nov 2022 02:49:08 +0000 (13:49 +1100)]
Clarify `expand_struct_method_body`.

Spotted by @RalfJung. This causes no behavioural changes.

20 months agoAuto merge of #103858 - Mark-Simulacrum:bump-bootstrap, r=pietroalbini
bors [Mon, 14 Nov 2022 00:07:19 +0000 (00:07 +0000)]
Auto merge of #103858 - Mark-Simulacrum:bump-bootstrap, r=pietroalbini

Bump bootstrap compiler to 1.66

This PR:

- Bumps version placeholders to release
- Bumps to latest beta
- cfg-steps code

r? `@pietroalbini`

20 months agoAdd a few known-bug tests
Jack Huey [Wed, 9 Nov 2022 03:15:02 +0000 (22:15 -0500)]
Add a few known-bug tests

20 months agoFix clippy and rustdoc
Maybe Waffle [Sun, 13 Nov 2022 22:58:20 +0000 (22:58 +0000)]
Fix clippy and rustdoc

please, please, don't match on `Symbol::as_str`s, every time you do,
somewhere in the world another waffle becomes sad...

20 months agorustdoc: remove unused CSS `code { opacity: 1 }`
Michael Howell [Sun, 13 Nov 2022 21:56:22 +0000 (14:56 -0700)]
rustdoc: remove unused CSS `code { opacity: 1 }`

According to https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/CSS.20cleanup
this style was added for declarations that no longer use opacity.

20 months agoRemove dead NoneError error handling
mejrs [Sun, 13 Nov 2022 21:48:27 +0000 (22:48 +0100)]
Remove dead NoneError error handling

20 months agoAuto merge of #103894 - mati865:gnullvm-libunwind-changes, r=thomcc
bors [Sun, 13 Nov 2022 21:12:48 +0000 (21:12 +0000)]
Auto merge of #103894 - mati865:gnullvm-libunwind-changes, r=thomcc

Change the way libunwind is linked for *-windows-gnullvm targets

I have no idea why previous way works for `x86_64-fortanix-unknown-sgx` (assuming it actually works...) but not for `gnullvm`. It fails when linking libtest during Rust build (unless somebody adds `RUSTFLAGS='-Clinkarg=-lunwind'`).
Also fixes exception handling on AArch64.

20 months agoRemove unused symbols
Maybe Waffle [Sun, 13 Nov 2022 20:05:32 +0000 (20:05 +0000)]
Remove unused symbols

20 months agoMake rustc build with new chalk
Michael Goulet [Sun, 13 Nov 2022 19:53:35 +0000 (19:53 +0000)]
Make rustc build with new chalk

20 months agoBump chalk to v0.87
Michael Goulet [Sun, 13 Nov 2022 19:29:38 +0000 (19:29 +0000)]
Bump chalk to v0.87

20 months agoRemove unused diagnostic items
Maybe Waffle [Sun, 13 Nov 2022 18:49:21 +0000 (18:49 +0000)]
Remove unused diagnostic items

20 months agoAuto merge of #104370 - matthiaskrgr:rollup-c3b38sm, r=matthiaskrgr
bors [Sun, 13 Nov 2022 18:13:08 +0000 (18:13 +0000)]
Auto merge of #104370 - matthiaskrgr:rollup-c3b38sm, r=matthiaskrgr

Rollup of 5 pull requests

Successful merges:

 - #103996 (Add small clarification around using pointers derived from references)
 - #104315 (Improve spans with `use crate::{self}`)
 - #104320 (Use `derive_const` and rm manual StructuralEq impl)
 - #104357 (add is_sized method on Abi and Layout, and use it)
 - #104365 (Add x tool to triagebot)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

20 months agoUpdate compiler-builtins
Ayush Singh [Sun, 13 Nov 2022 16:50:54 +0000 (22:20 +0530)]
Update compiler-builtins

This was originally a part of https://github.com/rust-lang/rust/pull/100316.
However, extracting it to a seperate PR should help with any extra
testing that might be needed.

Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
20 months agoRollup merge of #104365 - albertlarsan68:add-x-tool-to-triagebot, r=Mark-Simulacrum
Matthias Krüger [Sun, 13 Nov 2022 16:37:38 +0000 (17:37 +0100)]
Rollup merge of #104365 - albertlarsan68:add-x-tool-to-triagebot, r=Mark-Simulacrum

Add x tool to triagebot

Assign the A-bootstrap label when a pr modifies the x tool.

Happened in #104350.

20 months agoRollup merge of #104357 - RalfJung:is-sized, r=cjgillot
Matthias Krüger [Sun, 13 Nov 2022 16:37:38 +0000 (17:37 +0100)]
Rollup merge of #104357 - RalfJung:is-sized, r=cjgillot

add is_sized method on Abi and Layout, and use it

This avoids the double negation of `!is_unsized()` that we have quite a lot.

20 months agoRollup merge of #104320 - fee1-dead-contrib:use-derive-const-in-std, r=oli-obk
Matthias Krüger [Sun, 13 Nov 2022 16:37:37 +0000 (17:37 +0100)]
Rollup merge of #104320 - fee1-dead-contrib:use-derive-const-in-std, r=oli-obk

Use `derive_const` and rm manual StructuralEq impl

This does not change any semantics of the impl except for the const stability. It should be fine because trait methods and const bounds can never be used in stable without enabling `const_trait_impl`.

cc `@oli-obk`

20 months agoRollup merge of #104315 - SparkyPotato:fix-104276, r=cjgillot
Matthias Krüger [Sun, 13 Nov 2022 16:37:37 +0000 (17:37 +0100)]
Rollup merge of #104315 - SparkyPotato:fix-104276, r=cjgillot

Improve spans with `use crate::{self}`

Fixes #104276.

The error becomes:
```
error: crate root imports need to be explicitly named: `use crate as name;`
 --> src/lib.rs.rs:1:13
  |
1 | use crate::{self};
  |             ^^^^

warning: unused import: `self`
 --> src/lib.rs:1:13
  |
1 | use crate::{self};
  |             ^^^^
  |
  = note: `#[warn(unused_imports)]` on by default
```

20 months agoRollup merge of #103996 - SUPERCILEX:docs, r=RalfJung
Matthias Krüger [Sun, 13 Nov 2022 16:37:36 +0000 (17:37 +0100)]
Rollup merge of #103996 - SUPERCILEX:docs, r=RalfJung

Add small clarification around using pointers derived from references

r? `@RalfJung`

One question about your example from https://github.com/rust-lang/libs-team/issues/122: at what point does UB arise? If writing 0 does not cause UB and the reference `x` is never read or written to (explicitly or implicitly by being wrapped in another data structure) after the call to `foo`, does UB only arise when dropping the value? I don't really get that since I thought references were always supposed to point to valid data?

```rust
fn foo(x: &mut NonZeroI32)  {
  let ptr = x as *mut NonZeroI32;
  unsafe { ptr.cast::<i32>().write(0); } // no UB here
  // What now? x is considered garbage when?
}
```

20 months agoMake it also assign correct people
Albert Larsan [Sun, 13 Nov 2022 15:09:15 +0000 (16:09 +0100)]
Make it also assign correct people

20 months agoAuto merge of #104292 - GuillaumeGomez:fix-missing-reexports-doc-comments, r=notriddle
bors [Sun, 13 Nov 2022 15:02:10 +0000 (15:02 +0000)]
Auto merge of #104292 - GuillaumeGomez:fix-missing-reexports-doc-comments, r=notriddle

Fix missing reexports' doc comments

Fixes #81893.

The issue was that an import directly "links" to the target without the intermediate imports. Unfortunately, to fix this bug we need to go through them one by one. To do so, I take the import path direct parent (so `b` in `a::b::c`) and then look for `c` into it.

r? `@notriddle`

20 months agoAdd x tool to triagebot
Albert Larsan [Sun, 13 Nov 2022 14:31:49 +0000 (15:31 +0100)]
Add x tool to triagebot

Assign the A-bootstrap label when a pr modifies the x tool.

20 months agorustdoc: Resolve doc links in external traits having local impls
Vadim Petrochenkov [Sun, 13 Nov 2022 13:31:00 +0000 (16:31 +0300)]
rustdoc: Resolve doc links in external traits having local impls

20 months agoAdd `delay_span_bug` to `AttrWrapper::take_for_recovery`
Maybe Waffle [Sun, 13 Nov 2022 13:08:58 +0000 (13:08 +0000)]
Add `delay_span_bug` to `AttrWrapper::take_for_recovery`

20 months agoAuto merge of #93563 - ibraheemdev:crossbeam-channel, r=Amanieu
bors [Sun, 13 Nov 2022 12:08:42 +0000 (12:08 +0000)]
Auto merge of #93563 - ibraheemdev:crossbeam-channel, r=Amanieu

Merge crossbeam-channel into `std::sync::mpsc`

This PR imports the [`crossbeam-channel`](https://github.com/crossbeam-rs/crossbeam/tree/master/crossbeam-channel#crossbeam-channel) crate into the standard library as a private module, `sync::mpmc`. `sync::mpsc` is now implemented as a thin wrapper around `sync::mpmc`. The primary purpose of this PR is to resolve https://github.com/rust-lang/rust/issues/39364. The public API intentionally remains the same.

The reason https://github.com/rust-lang/rust/issues/39364 has not been fixed in over 5 years is that the current channel is *incredibly* complex. It was written many years ago and has sat mostly untouched since. `crossbeam-channel` has become the most popular alternative on crates.io, amassing over 30 million downloads. While crossbeam's channel is also complex, like all fast concurrent data structures, it avoids some of the major issues with the current implementation around dynamic flavor upgrades. The new implementation decides on the datastructure to be used when the channel is created, and the channel retains that structure until it is dropped.

Replacing `sync::mpsc` with a simpler, less performant implementation has been discussed as an alternative. However, Rust touts itself as enabling *fearless concurrency*, and having the standard library feature a subpar implementation of a core concurrency primitive doesn't feel right. The argument is that slower is better than broken, but this PR shows that we can do better.

As mentioned before, the primary purpose of this PR is to fix https://github.com/rust-lang/rust/issues/39364, and so the public API intentionally remains the same. *After* that problem is fixed, the fact that `sync::mpmc` now exists makes it easier to fix the primary limitation of `mpsc`, the fact that it only supports a single consumer. spmc and mpmc are two other common concurrency patterns, and this change enables a path to deprecating `mpsc` and exposing a general `sync::channel` module that supports multiple consumers. It also implements other useful methods such as `send_timeout`. That said, exposing MPMC and other new functionality is mostly out of scope for this PR, and it would be helpful if discussion stays on topic :)

For what it's worth, the new implementation has also been shown to be more performant in [some basic benchmarks](https://github.com/crossbeam-rs/crossbeam/tree/master/crossbeam-channel/benchmarks#results).

cc `@taiki-e`

r? rust-lang/libs

20 months agointerpret: make check_mplace public
Ralf Jung [Sun, 13 Nov 2022 11:22:06 +0000 (12:22 +0100)]
interpret: make check_mplace public

20 months agoadd is_sized method on Abi and Layout, and use it
Ralf Jung [Sun, 13 Nov 2022 11:14:59 +0000 (12:14 +0100)]
add is_sized method on Abi and Layout, and use it

20 months agoremove leading newlines from `NonZero*` doc examples
Lukas Markeffsky [Sun, 13 Nov 2022 10:32:57 +0000 (11:32 +0100)]
remove leading newlines from `NonZero*` doc examples

20 months agouse `EXE_EXTENSION` while searching for python
SparkyPotato [Sun, 13 Nov 2022 10:21:16 +0000 (15:51 +0530)]
use `EXE_EXTENSION` while searching for python

20 months agoAuto merge of #104351 - JohnTitor:rollup-ikh2dzr, r=JohnTitor
bors [Sun, 13 Nov 2022 09:13:41 +0000 (09:13 +0000)]
Auto merge of #104351 - JohnTitor:rollup-ikh2dzr, r=JohnTitor

Rollup of 5 pull requests

Successful merges:

 - #103650 (rustdoc: change `.src-line-numbers > span` to `.src-line-numbers > a`)
 - #104177 (rustdoc: use consistent "popover" styling for notable traits)
 - #104318 (Move tests)
 - #104323 (rustdoc: remove no-op CSS `.scrape-help { background: transparent }`)
 - #104345 (Fix up a Fluent message)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

20 months agomove span to `self` instead of `crate`
SparkyPotato [Sun, 13 Nov 2022 08:16:11 +0000 (13:46 +0530)]
move span to `self` instead of `crate`

20 months agoRollup merge of #104345 - fmease:fix-up-a-fluent-message, r=compiler-errors
Yuki Okushi [Sun, 13 Nov 2022 07:41:46 +0000 (16:41 +0900)]
Rollup merge of #104345 - fmease:fix-up-a-fluent-message, r=compiler-errors

Fix up a Fluent message

Fix up a Fluent message which contained arrows `->` after [selectors](https://projectfluent.org/fluent/guide/selectors.html). The original author probably thought that they were required as part of the selector syntax but in reality they were interpreted as literal text and actually showed up in the emitted diagnostic.

This wasn't caught during the diagnostic migration since the branch constructing the diagnostic in question (`rustc_infer::errors::LifetimeMismatchLabels::Normal`) was not exercised by the UI test suite. I've added two more test cases to do so (one testing `LifetimeMismatchLabels::Normal` where `hir_equal == true` and one where `hir_equal == false`).

Diff visualizing the `->` bug (`master` vs `fix-up-a-fluent-message`):

```diff
 error[E0623]: lifetime mismatch
   --> src/test/ui/implied-bounds/hrlt-implied-trait-bounds-guard.rs:39:30
    |
 39 | fn badboi3<'in_, 'out, T>(a: Foo<'in_, 'out, (&'in_ T, &'out T)>, sadness: &'in_ T) {
    |                              ^^^^^^^^^^^^^^^^^-------^^-------^^
    |                              |                |
    |                              |                these two types are declared with different lifetimes...
-   |                              ...but data->  from `a` flows->  into `a` here
+   |                              ...but data from `a` flows into `a` here
```

20 months agoRollup merge of #104323 - notriddle:notriddle/scrape-help-background, r=GuillaumeGomez
Yuki Okushi [Sun, 13 Nov 2022 07:41:45 +0000 (16:41 +0900)]
Rollup merge of #104323 - notriddle:notriddle/scrape-help-background, r=GuillaumeGomez

rustdoc: remove no-op CSS `.scrape-help { background: transparent }`

It's a link. This is the default CSS for it.

20 months agoRollup merge of #104318 - c410-f3r:moar-errors, r=petrochenkov
Yuki Okushi [Sun, 13 Nov 2022 07:41:45 +0000 (16:41 +0900)]
Rollup merge of #104318 - c410-f3r:moar-errors, r=petrochenkov

Move tests

r? `@petrochenkov`

https://github.com/rust-lang/rust/pull/46521 -> enum-discriminant

20 months agoRollup merge of #104177 - notriddle:notriddle/js-notable-trait-v2, r=GuillaumeGomez
Yuki Okushi [Sun, 13 Nov 2022 07:41:44 +0000 (16:41 +0900)]
Rollup merge of #104177 - notriddle:notriddle/js-notable-trait-v2, r=GuillaumeGomez

rustdoc: use consistent "popover" styling for notable traits

Follow-up to #104129
Fixes https://github.com/rust-lang/rust/issues/104313.

Preview: https://notriddle.com/notriddle-rustdoc-demos/js-notable-trait-v2/std/iter/trait.Iterator.html#method.step_by

## Before

![image](https://user-images.githubusercontent.com/1593513/200710372-d2d992ce-0bdc-4437-9a2e-379a29df09cf.png)

![image](https://user-images.githubusercontent.com/1593513/200711266-e372b176-daa9-45f3-a022-738ef0a77d3c.png)

## After

![image](https://user-images.githubusercontent.com/1593513/200710601-09b3b717-116f-43c6-b14f-34a8b02b33c0.png)

![image](https://user-images.githubusercontent.com/1593513/200711288-3978cdc1-a6c2-47f6-9216-e22e3c1f5bdf.png)

20 months agoRollup merge of #103650 - notriddle:notriddle/line-anchors, r=GuillaumeGomez
Yuki Okushi [Sun, 13 Nov 2022 07:41:44 +0000 (16:41 +0900)]
Rollup merge of #103650 - notriddle:notriddle/line-anchors, r=GuillaumeGomez

rustdoc: change `.src-line-numbers > span` to `.src-line-numbers > a`

Example: https://notriddle.com/notriddle-rustdoc-demos/line-anchors/test_dingus/fn.test.html

This allows people to treat them like real links, such as right-click to copy URL, and makes the line numbers in a scraped example work at all, when before this commit was added, they had the clickable pointer cursor but did not actually do anything when clicked.

20 months agofix some typos in comments
cui fliter [Sun, 13 Nov 2022 07:26:17 +0000 (15:26 +0800)]
fix some typos in comments

Signed-off-by: cui fliter <imcusg@gmail.com>
20 months agoAuto merge of #104282 - cjgillot:intern-span, r=compiler-errors
bors [Sun, 13 Nov 2022 06:23:18 +0000 (06:23 +0000)]
Auto merge of #104282 - cjgillot:intern-span, r=compiler-errors

Hash spans when interning types

Ignoring hash for spans creates an inconsistency between the `Hash` impl for `WithStableHash`, which takes them into account, and the `HashStable` impl which does not.

cc `@compiler-errors`

Fixes https://github.com/rust-lang/rust/issues/104271
Fixes https://github.com/rust-lang/rust/issues/104255
Fixes https://github.com/rust-lang/rust/issues/104238

20 months agoavoid using channels in thread-local tests
Ibraheem Ahmed [Sun, 13 Nov 2022 04:44:52 +0000 (23:44 -0500)]
avoid using channels in thread-local tests

20 months agoavoid calling `thread::current` in channel destructor
Ibraheem Ahmed [Sun, 13 Nov 2022 04:13:58 +0000 (23:13 -0500)]
avoid calling `thread::current` in channel destructor

20 months agoAuto merge of #104078 - jyn514:dry-run-progress, r=Mark-Simulacrum
bors [Sun, 13 Nov 2022 03:38:31 +0000 (03:38 +0000)]
Auto merge of #104078 - jyn514:dry-run-progress, r=Mark-Simulacrum

Print "Checking/Building ..." message even when --dry-run is passed

Print "Checking/Building ..." message even when --dry-run is passed

This makes it a lot easier to understand what commands will be run without
having to parse the `-vv` output, which isn't meant to be user facing.

I also want to change these messages at some point (https://github.com/rust-lang/rust/issues/102003) and this change will make it easier to paste a before/after comparison without having to actually build a stage 2 compiler.

20 months agofix up a fluent message
León Orell Valerian Liehr [Sun, 13 Nov 2022 03:10:56 +0000 (04:10 +0100)]
fix up a fluent message

20 months agoAuto merge of #103311 - petrochenkov:pblfix, r=bjorn3
bors [Sat, 12 Nov 2022 23:29:11 +0000 (23:29 +0000)]
Auto merge of #103311 - petrochenkov:pblfix, r=bjorn3

linker: Refactoring and fixes to native library linking

This PR contains a bunch of code cleanup and comment rearrangements + 2 fixes for `-Zpacked-bundled-libs`.
It's better to look at individual commits.

20 months agoPrint "Checking/Building ..." message even when --dry-run is passed
Joshua Nelson [Sun, 6 Nov 2022 23:00:58 +0000 (17:00 -0600)]
Print "Checking/Building ..." message even when --dry-run is passed

This makes it a lot easier to understand what commands will be run without
having to parse the `-vv` output, which isn't meant to be user facing.

20 months agoDistinguish `--dry-run` from the automatic dry run check
Joshua Nelson [Sun, 6 Nov 2022 22:59:43 +0000 (16:59 -0600)]
Distinguish `--dry-run` from the automatic dry run check

20 months agoAuto merge of #103913 - Neutron3529:patch-1, r=thomcc
bors [Sat, 12 Nov 2022 20:48:27 +0000 (20:48 +0000)]
Auto merge of #103913 - Neutron3529:patch-1, r=thomcc

Improve performance of `rem_euclid()` for signed integers

such code is copy from
https://github.com/rust-lang/rust/blob/master/library/std/src/f32.rs and
https://github.com/rust-lang/rust/blob/master/library/std/src/f64.rs
using `r+rhs.abs()` is faster than calc it with an if clause. Bench result:
```
$ cargo bench
   Compiling div-euclid v0.1.0 (/me/div-euclid)
    Finished bench [optimized] target(s) in 1.01s
     Running unittests src/lib.rs (target/release/deps/div_euclid-7a4530ca7817d1ef)

running 7 tests
test tests::it_works ... ignored
test tests::bench_aaabs     ... bench:  10,498,793 ns/iter (+/- 104,360)
test tests::bench_aadefault ... bench:  11,061,862 ns/iter (+/- 94,107)
test tests::bench_abs       ... bench:  10,477,193 ns/iter (+/- 81,942)
test tests::bench_default   ... bench:  10,622,983 ns/iter (+/- 25,119)
test tests::bench_zzabs     ... bench:  10,481,971 ns/iter (+/- 43,787)
test tests::bench_zzdefault ... bench:  11,074,976 ns/iter (+/- 29,633)

test result: ok. 0 passed; 0 failed; 1 ignored; 6 measured; 0 filtered out; finished in 19.35s
```
It seems that, default `rem_euclid` triggered a branch prediction, thus `bench_default` is faster than `bench_aadefault` and `bench_aadefault`, which shuffles the order of calculations. but all of them slower than what it was in `f64`'s and `f32`'s `rem_euclid`, thus I submit this PR.

bench code:
```rust
#![feature(test)]
extern crate test;

fn rem_euclid(a:i32,rhs:i32)->i32{
    let r = a % rhs;
    if r < 0 { r + rhs.abs() } else { r }
}

#[cfg(test)]
mod tests {
    use super::*;
    use test::Bencher;
    use rand::prelude::*;
    use rand::rngs::SmallRng;
    const N:i32=1000;
    #[test]
    fn it_works() {
        let a: i32 = 7; // or any other integer type
        let b = 4;

        let d:Vec<i32>=(-N..=N).collect();
        let n:Vec<i32>=(-N..0).chain(1..=N).collect();

        for i in &d {
            for j in &n {
                assert_eq!(i.rem_euclid(*j),rem_euclid(*i,*j));
            }
        }

        assert_eq!(rem_euclid(a,b), 3);
        assert_eq!(rem_euclid(-a,b), 1);
        assert_eq!(rem_euclid(a,-b), 3);
        assert_eq!(rem_euclid(-a,-b), 1);
    }

    #[bench]
    fn bench_aaabs(b: &mut Bencher) {
        let mut d:Vec<i32>=(-N..=N).collect();
        let mut n:Vec<i32>=(-N..0).chain(1..=N).collect();
        let mut rng=SmallRng::from_seed([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,21]);
        n.shuffle(&mut rng);
        d.shuffle(&mut rng);
        n.shuffle(&mut rng);
        b.iter(||{
            let mut res=0;
            for i in &d {
                for j in &n {
                    res+=rem_euclid(*i,*j);
                }
            }
            res
        });
    }
    #[bench]
    fn bench_aadefault(b: &mut Bencher) {
        let mut d:Vec<i32>=(-N..=N).collect();
        let mut n:Vec<i32>=(-N..0).chain(1..=N).collect();
        let mut rng=SmallRng::from_seed([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,21]);
        n.shuffle(&mut rng);
        d.shuffle(&mut rng);
        n.shuffle(&mut rng);
        b.iter(||{
            let mut res=0;
            for i in &d {
                for j in &n {
                    res+=i.rem_euclid(*j);
                }
            }
            res
        });
    }

    #[bench]
    fn bench_abs(b: &mut Bencher) {
        let d:Vec<i32>=(-N..=N).collect();
        let n:Vec<i32>=(-N..0).chain(1..=N).collect();
        b.iter(||{
            let mut res=0;
            for i in &d {
                for j in &n {
                    res+=rem_euclid(*i,*j);
                }
            }
            res
        });
    }
    #[bench]
    fn bench_default(b: &mut Bencher) {
        let d:Vec<i32>=(-N..=N).collect();
        let n:Vec<i32>=(-N..0).chain(1..=N).collect();
        b.iter(||{
            let mut res=0;
            for i in &d {
                for j in &n {
                    res+=i.rem_euclid(*j);
                }
            }
            res
        });
    }

    #[bench]
    fn bench_zzabs(b: &mut Bencher) {
        let mut d:Vec<i32>=(-N..=N).collect();
        let mut n:Vec<i32>=(-N..0).chain(1..=N).collect();
        let mut rng=SmallRng::from_seed([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,21]);
        d.shuffle(&mut rng);
        n.shuffle(&mut rng);
        d.shuffle(&mut rng);
        b.iter(||{
            let mut res=0;
            for i in &d {
                for j in &n {
                    res+=rem_euclid(*i,*j);
                }
            }
            res
        });
    }
    #[bench]
    fn bench_zzdefault(b: &mut Bencher) {
        let mut d:Vec<i32>=(-N..=N).collect();
        let mut n:Vec<i32>=(-N..0).chain(1..=N).collect();
        let mut rng=SmallRng::from_seed([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,21]);
        d.shuffle(&mut rng);
        n.shuffle(&mut rng);
        d.shuffle(&mut rng);
        b.iter(||{
            let mut res=0;
            for i in &d {
                for j in &n {
                    res+=i.rem_euclid(*j);
                }
            }
            res
        });
    }
}
```

20 months agolinker: Link `profiler_builtins` even if it's marked as `NotLinked`
Vadim Petrochenkov [Sat, 12 Nov 2022 20:02:15 +0000 (23:02 +0300)]
linker: Link `profiler_builtins` even if it's marked as `NotLinked`