Commit Graph

208627 Commits

Author SHA1 Message Date
Dylan DPC c9a04cddc0
Rollup merge of #103430 - cjgillot:receiver-attrs, r=petrochenkov
Workaround unstable stmt_expr_attributes for method receiver expressions

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

cc ``@Mark-Simulacrum`` ``@ehuss``
2022-10-26 11:29:55 +05:30
Dylan DPC 785828744c
Rollup merge of #103416 - compiler-errors:rpit-named, r=cjgillot
Name the `impl Trait` in region bound suggestions

Slightly more descriptive message
2022-10-26 11:29:54 +05:30
Dylan DPC 8ed3a80b9a
Rollup merge of #103287 - saethlin:faster-len-check, r=thomcc
Use a faster allocation size check in slice::from_raw_parts

I've been perusing through the codegen changes that result from turning on the standard library debug assertions. The previous check in here uses saturating arithmetic, which in my experience sometimes makes LLVM just fail to optimize things around the saturating operation.

Here is a demo of the codegen difference: https://godbolt.org/z/WMEqrjajW
Before:
```asm
example::len_check_old:
        mov     rax, rdi
        mov     ecx, 3
        mul     rcx
        setno   cl
        test    rax, rax
        setns   al
        and     al, cl
        ret

example::len_check_old:
        mov     rax, rdi
        mov     ecx, 8
        mul     rcx
        setno   cl
        test    rax, rax
        setns   al
        and     al, cl
        ret
```
After:
```asm
example::len_check_new:
        movabs  rax, 3074457345618258603
        cmp     rdi, rax
        setb    al
        ret

example::len_check_new:
        shr     rdi, 60
        sete    al
        ret
```

Running rustc-perf locally, this looks like up to a 4.5% improvement when `debug-assertions-std = true`.

Thanks ```@LegionMammal978``` (I think that's you?) for turning my idea into a much cleaner implementation.

r? ```@thomcc```
2022-10-26 11:29:53 +05:30
Dylan DPC f2c2e582bd
Rollup merge of #103209 - Xiretza:multiple-suggestions, r=davidtwco
Diagnostic derives: allow specifying multiple alternative suggestions

This allows porting `span_suggestions()` to diagnostic structs.

Doesn't work for `multipart_suggestions()` because the rank would be reversed - the struct would specify multiple spans, each of which has multiple possible replacements, while `multipart_suggestions()` creates multiple possible replacements, each with multiple spans.
2022-10-26 11:29:53 +05:30
Dylan DPC bf6bfcddf6
Rollup merge of #102951 - SparrowLii:type_annotation, r=estebank
suggest type annotation for local statement initialed by ref expression

In a local statement with a type declaration, if a ref expression is used on the right side and not used on the left side, in addition to removing the `&` and `&mut` on the right side, we can add them on the left side alternatively
Fixes #102892
2022-10-26 11:29:53 +05:30
bors a5406feb1c Auto merge of #103158 - Bryanskiy:resolve_perf, r=petrochenkov
Perf improvements for effective visibility calculating

related to https://github.com/rust-lang/rust/pull/102026
r? `@petrochenkov`
2022-10-26 02:30:18 +00:00
bors 6365e5ad9f Auto merge of #102903 - compiler-errors:region-var-leak, r=jackh726
Assert if inference vars are leaking from `InferCtxt::fully_resolve`

`InferCtxt::fully_resolve` shouldn't return unresolved inference vars without us at least being aware of it, so make it an assertion now. This should only happen in cases where we used to be returning `ReEmpty`...

cc `@jackh726`
2022-10-25 23:24:36 +00:00
Michael Goulet 726bf18d2d Name impl trait in region bound suggestion 2022-10-25 16:37:11 +00:00
bors bed4ad65bf Auto merge of #102340 - JakobDegen:pass-manager-simplification, r=oli-obk
Split phase change from `MirPass`

The main goal here is to simplify the pass manager logic. `MirPass` no longer contains the `phase_change` method, and `run_passes` instead accepts an `Option<PhaseChange>`. The hope is that this addresses the comments (and maybe perf regression) from #99102 .

r? `@oli-obk` cc `@RalfJung`
2022-10-25 15:55:39 +00:00
bors 85d089b41e Auto merge of #103392 - RalfJung:miri, r=oli-obk
update Miri

I had to use a hacked version of josh to create this, so let's be careful with merging this and maybe wait a bit to see if the josh issue becomes more clear. But the history looks good to me, we are not adding duplicates of rustc commits that were previously mirrored to Miri.

Also I want to add some cross-testing of Miri in x.py.
2022-10-25 12:33:39 +00:00
Bryanskiy a9447bb9d0 Perf improvements for effective visibility calculating 2022-10-25 15:15:18 +03:00
Ralf Jung a157e0e88f Miri: disable macOS testing for now 2022-10-25 13:40:38 +02:00
bors c6bd7e21c6 Auto merge of #103513 - Dylan-DPC:rollup-nn3ite2, r=Dylan-DPC
Rollup of 6 pull requests

Successful merges:

 - #98204 (Stabilize `Option::unzip()`)
 - #102587 (rustc: Use `unix_sigpipe` instead of `rustc_driver::set_sigpipe_handler`)
 - #103122 (Remove misc_cast and validate types when casting)
 - #103379 (Truncate thread names on Linux and Apple targets)
 - #103482 (Clairify Vec::capacity docs)
 - #103511 (Codegen tweaks)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-10-25 09:37:06 +00:00
Dylan DPC 6aea54c082
Rollup merge of #103511 - nnethercote:bb-tweaks, r=bjorn3
Codegen tweaks

Best reviewed one commit at a time.

r? `@bjorn3`
2022-10-25 14:43:16 +05:30
Dylan DPC 35b46de61b
Rollup merge of #103482 - aDotInTheVoid:vec-cap-docs, r=thomcc
Clairify Vec::capacity docs

Update both the text and example to be clear that the method gives *total*, (not *spare*) capacity

Fixes #103326
2022-10-25 14:43:15 +05:30
Dylan DPC 75023d61a1
Rollup merge of #103379 - cuviper:truncate-thread-name, r=thomcc
Truncate thread names on Linux and Apple targets

These targets have system limits on the thread names, 16 and 64 bytes
respectively, and `pthread_setname_np` returns an error if the name is
longer. However, we're not in a context that can propagate errors when
we call this, and we used to implicitly truncate on Linux with `prctl`,
so now we manually truncate these names ahead of time.

r? ``````@thomcc``````
2022-10-25 14:43:15 +05:30
Dylan DPC 8ba2a651fb
Rollup merge of #103122 - ouz-a:mir-technical-debt, r=oli-obk
Remove misc_cast and validate types when casting

Continuing our work in #102675

r? ````@oli-obk````
2022-10-25 14:43:14 +05:30
Dylan DPC 8a5ce1d615
Rollup merge of #102587 - Enselic:rustc-unix_sigpipe, r=jackh726
rustc: Use `unix_sigpipe` instead of `rustc_driver::set_sigpipe_handler`

This is the first (known) step towards starting to use `unix_sigpipe` in the wild. Eventually, `rustc_driver::set_sigpipe_handler` can be removed and all clients can use `unix_sigpipe` instead.

For now we just start using `unix_sigpipe` in one place: `rustc` itself.

It is easy to manually verify this change. If you remove `#[unix_sigpipe = "sig_dfl"]` and run `./x.py build` you will get an ICE when you do `./build/x86_64-unknown-linux-gnu/stage1/bin/rustc --help | false`. Add back `#[unix_sigpipe = "sig_dfl"]` and the ICE disappears again.

PR that added `set_sigpipe_handler`: https://github.com/rust-lang/rust/pull/49606

Tracking issue for `unix_sigpipe`: #97889

Not sure exactly how to label this PR. Going with T-libs for now since this is a T-libs feature.

````@rustdoc```` labels +T-libs
2022-10-25 14:43:14 +05:30
Dylan DPC d2d44f619f
Rollup merge of #98204 - Kixiron:stable-unzip, r=thomcc
Stabilize `Option::unzip()`

Stabilizes `Option::unzip()`, closes #87800

```@rustbot``` modify labels: +T-libs-api
2022-10-25 14:43:13 +05:30
bors 31d754a1df Auto merge of #102988 - dpaoliello:inlinerawdylib, r=dpaoliello
Support raw-dylib functions being used inside inlined functions

Fixes #102714

Issue Details:
When generating the import library for `raw-dylib` symbols, we currently only use the functions and variables declared within the current crate. This works fine if all crates are static libraries or `rlib`s as the generated import library will be contained in the static library or `rlib` itself, but if a dependency is a dynamic library AND the use of a `raw-dylib` function or variable is inlined or part of a generic instantiation then the current crate won't see its dependency's import library and so linking will fail.

Fix Details:
Instead, when we generate the import library for a `dylib` or `bin` crate, we will now generate it for the symbols both for the current crate and all upstream crates. We do this in two steps so that the import library for the current crate is passed into the linker first, thus it is preferred if there are any ambiguous symbols.
2022-10-25 04:57:51 +00:00
Nicholas Nethercote 6cd35ac203 Simplify `cast_shift_expr_rhs`.
It's only ever used with shift operators.
2022-10-25 14:39:20 +11:00
Nicholas Nethercote 8c02f4d05d Inline and remove `cast_shift_rhs`.
It has a single call site.
2022-10-25 13:51:52 +11:00
bors f2702e922b Auto merge of #103502 - JohnTitor:rollup-o6mhyzq, r=JohnTitor
Rollup of 11 pull requests

Successful merges:

 - #103333 (Fix assertion failed for break_last_token and trailing token)
 - #103350 (Change terminology for assoc method suggestions when they are not called)
 - #103382 (Don't ICE when reporting borrowck errors involving regions from `anonymous_lifetime_in_impl_trait`)
 - #103409 (Delay span bug when we can't map lifetimes back in `collect_trait_impl_trait_tys`)
 - #103410 (-Z docs: Add link to unstable book)
 - #103462 (rustdoc: remove no-op CSS `.source pre.rust { white-space: pre }`)
 - #103465 (E0210 explanation: remove redundant sentence)
 - #103486 (Use functions in highlight-colors rustdoc GUI test)
 - #103493 (rustdoc: remove unused `.sidebar-logo` DOM on source pages)
 - #103494 (rustdoc: remove redundant CSS `a.test-arrow:hover`)
 - #103495 (rustdoc: Use `unix_sigpipe` instead of `rustc_driver::set_sigpipe_handler`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-10-25 02:16:57 +00:00
Nicholas Nethercote 03f350f5a5 Clarify some cleanup stuff.
- Rearrange the match in `llbb_with_landing_pad` so the `(Some,Some)`
  cases are together.
- Add assertions to indicate two MSVC-only paths.
2022-10-25 12:07:35 +11:00
Nicholas Nethercote a5bd5da594 Rename two `TerminatorCodegenHelper` methods.
`TerminatorCodegenHelper` has three methods `llblock`, `llbb`, and
`lltarget`. They're all similar, but the names given no indication of
the differences.

This commit renames `lltarget` as `llbb_with_landing_pad`, and `llblock`
as `llbb_with_cleanup`. These aren't fantastic names, but at least it's
now clear that `llbb` is the lowest-level of the three and the other two
wrap it.
2022-10-25 12:07:26 +11:00
Nicholas Nethercote 4e4092f8cc rustc_codegen_ssa: use more consistent naming.
Ensure:
- builders always have a `bx` suffix;
- backend basic blocks always have an `llbb` suffix,
- paired builders and basic blocks have consistent prefixes.
2022-10-25 12:07:23 +11:00
Daniel Paoliello 3a1ef50b34 Support raw-dylib functions being used inside inlined functions 2022-10-24 16:17:38 -07:00
Yuki Okushi d0ffd20a75
Rollup merge of #103495 - Enselic:rustdoc-unix_sigpipe, r=notriddle
rustdoc: Use `unix_sigpipe` instead of `rustc_driver::set_sigpipe_handler`

Do what was already done for `rustc` in #102587, namely start using `unix_sigpipe` instead of `rustc_driver::set_sigpipe_handler`.

After this has been merged, we can completely remove `rustc_driver::set_sigpipe_handler`.

PR that added `set_sigpipe_handler`: https://github.com/rust-lang/rust/pull/49606

Tracking issue for `unix_sigpipe`: #97889

Verification of this change
---------------------------

1. Remove `#[unix_sigpipe = "sig_dfl"]`
1. Run `./x.py build`
1. Run `./build/aarch64-apple-darwin/stage1/bin/rustdoc --help | false`
1. Observe ICE
1. Add back `#[unix_sigpipe = "sig_dfl"]`
1. Run `./x.py build`
1. Run `./build/aarch64-apple-darwin/stage1/bin/rustdoc --help | false`
1. Observe ICE fixed

``@rustbot`` labels +T-rustdoc
2022-10-25 08:01:31 +09:00
Yuki Okushi b09ce608a8
Rollup merge of #103494 - notriddle:notriddle/test-arrow-hover, r=GuillaumeGomez
rustdoc: remove redundant CSS `a.test-arrow:hover`

In 4b402dbe69, when this rule was added, it was overriding a rule that made all links in docblock get an underline when hovered. This became redundant when, after reordering the rules, 7585632052 changed the pro-underline rule to exclude the test-arrow link anyway.
2022-10-25 08:01:31 +09:00
Yuki Okushi 9ecba382a6
Rollup merge of #103493 - notriddle:notriddle/source-sidebar-logo, r=GuillaumeGomez
rustdoc: remove unused `.sidebar-logo` DOM on source pages
2022-10-25 08:01:30 +09:00
Yuki Okushi d77e2394bd
Rollup merge of #103486 - GuillaumeGomez:cleanup-rustdoc-gui-highlight-colors, r=notriddle
Use functions in highlight-colors rustdoc GUI test

r? ``@notriddle``
2022-10-25 08:01:30 +09:00
Yuki Okushi d1b00c6a74
Rollup merge of #103465 - jruderman:patch-1, r=compiler-errors
E0210 explanation: remove redundant sentence
2022-10-25 08:01:30 +09:00
Yuki Okushi db0e438370
Rollup merge of #103462 - notriddle:notriddle/source-pre-rust-white-space, r=Dylan-DPC
rustdoc: remove no-op CSS `.source pre.rust { white-space: pre }`

This rule, added in 49e6db7f35, overrode a rule in normalize.css.

49e6db7f35/src/librustdoc/html/static/normalize.css (L169-L175)

When normalize.css was updated, this rule went away.

a8edd0c5aa
2022-10-25 08:01:29 +09:00
Yuki Okushi 3a325b101d
Rollup merge of #103410 - camsteffen:link-unstable-book, r=JohnTitor
-Z docs: Add link to unstable book
2022-10-25 08:01:28 +09:00
Yuki Okushi 12babb623a
Rollup merge of #103409 - compiler-errors:rpitit-signature-mismatch, r=lcnr
Delay span bug when we can't map lifetimes back in `collect_trait_impl_trait_tys`

When a lifetime is late-bound in a trait signature, but early-bound in an impl signature, we already emit an error -- however, we also ICE in `collect_trait_impl_trait_tys`, so just delay a bug here.

Fixes #103407
2022-10-25 08:01:28 +09:00
Yuki Okushi 6383540130
Rollup merge of #103382 - compiler-errors:anon-apit-lt-region-ice, r=cjgillot
Don't ICE when reporting borrowck errors involving regions from `anonymous_lifetime_in_impl_trait`

The issue here is that when we have:

```
trait Trait<'a> { .. }

fn foo(arg: impl Trait) { .. }
```

The anonymous lifetime `'_` that we generate for `arg: impl Trait` doesn't end up in the argument type (which is a param) but in a where-clause of the function, in a predicate whose self type is that param ty.

Fixes #101660

r? ``@cjgillot``
2022-10-25 08:01:28 +09:00
Yuki Okushi e47d222a94
Rollup merge of #103350 - clubby789:refer-to-assoc-method, r=wesleywiser
Change terminology for assoc method suggestions when they are not called

Fixes #103325

```@rustbot``` label +A-diagnostics
2022-10-25 08:01:27 +09:00
Yuki Okushi 11d11e3415
Rollup merge of #103333 - chenyukang:yukang/fix-103143, r=wesleywiser
Fix assertion failed for break_last_token and trailing token

Fixes #103143
2022-10-25 08:01:27 +09:00
Michael Goulet 1727c00f1a Assert if inference vars are leaking from fully_resolve 2022-10-24 18:53:32 +00:00
Michael Goulet fa5cf90b8d Delay span bug when we can't map lifetimes back in collect_trait_impl_trait_tys 2022-10-24 18:45:50 +00:00
Martin Nordholts 5e624bf4ba rustdoc: Use `unix_sigpipe` instead of `rustc_driver::set_sigpipe_handler`
Start using `unix_sigpipe` instead of
`rustc_driver::set_sigpipe_handler`.

After this has been merged, we can completely remove
`rustc_driver::set_sigpipe_handler`.

Verification of this change
---------------------------

1. Remove `#[unix_sigpipe = "sig_dfl"]`
1. Run `./x.py build`
1. Run `./build/aarch64-apple-darwin/stage1/bin/rustdoc --help | false`
1. Observe ICE
1. Add back `#[unix_sigpipe = "sig_dfl"]`
1. Run `./x.py build`
1. Run `./build/aarch64-apple-darwin/stage1/bin/rustdoc --help | false`
1. Observe ICE fixed
2022-10-24 20:40:46 +02:00
Michael Howell f0f0a7dbc2 rustdoc: remove redundant CSS `a.test-arrow:hover`
In 4b402dbe69, when this rule was added, it
was overriding a rule that made all links in docblock get an underline when
hovered. This became redundant when, after reordering the rules,
7585632052 changed the pro-underline rule to
exclude the test-arrow link anyway.
2022-10-24 11:39:19 -07:00
Michael Howell 4e1abcda1b rustdoc: remove unused `.sidebar-logo` DOM on source pages 2022-10-24 10:47:24 -07:00
bors 758f19645b Auto merge of #103337 - flip1995:clippyup, r=Manishearth
Update Clippy

r? `@Manishearth`
2022-10-24 16:50:15 +00:00
Guillaume Gomez 1dff99f46c Use functions in highlight-colors rustdoc GUI test 2022-10-24 17:44:17 +02:00
Cameron Steffen c2bc3bcfb0 Document link to unstable book 2022-10-24 10:34:52 -05:00
Nixon Enraght-Moony 674cd6125d Clairify Vec::capacity docs
Fixes #103326
2022-10-24 15:01:58 +01:00
bors c07a6a9c0c Auto merge of #94063 - Aaron1011:pretty-print-rental, r=lcnr
Only apply `ProceduralMasquerade` hack to older versions of `rental`

The latest version of `rental` (v0.5.6) contains a fix that allows it to
compile without relying on the pretty-print back-compat hack.

Hopefully, there are no longer any crates relying on the affected
versions of the (much less popular) `procedural-masquerade` crate. This
should allow us to target the pretty-print back-compat hack specifically
to older versions of `rental`, and specifically mention upgrading to
`rental` v0.5.6 in the lint message.
2022-10-24 13:35:48 +00:00
bors 1481fd964b Auto merge of #103471 - JohnTitor:rollup-tfmy6ab, r=JohnTitor
Rollup of 7 pull requests

Successful merges:

 - #99578 (Remove redundant lifetime bound from `impl Borrow for Cow`)
 - #99939 (Sort tests at compile time, not at startup)
 - #102271 (Stabilize `duration_checked_float`)
 - #102766 (Don't link to `libresolv` in libstd on Darwin)
 - #103277 (Update libstd's libc to 0.2.135 (to make `libstd` no longer pull in `libiconv.dylib` on Darwin))
 - #103437 (Sync rustc_codegen_cranelift)
 - #103466 (Fix grammar in docs for std::io::Read)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-10-24 10:54:40 +00:00
Yuki Okushi a710f56e7d
Rollup merge of #103466 - jruderman:patch-2, r=Dylan-DPC
Fix grammar in docs for std::io::Read

Two independent clauses were incorrectly joined by a bare comma. The simplest fix would be to switch to a semicolon, but I think it's slightly better to keep the comma and use the coordinating conjunction "so".
2022-10-24 19:32:29 +09:00