]> git.lizzy.rs Git - rust.git/log
rust.git
20 months agoAuto merge of #2620 - RalfJung:getname, r=RalfJung
bors [Wed, 26 Oct 2022 08:58:53 +0000 (08:58 +0000)]
Auto merge of #2620 - RalfJung:getname, r=RalfJung

add pthread_getname_np

A new libstd test needs this, and there doesn't seem to be a good reason not to have this.

20 months agoaccount for different max thread name lengths on different platforms
Ralf Jung [Wed, 26 Oct 2022 08:50:11 +0000 (10:50 +0200)]
account for different max thread name lengths on different platforms

20 months agoadd pthread_getname_np
Ralf Jung [Wed, 26 Oct 2022 08:42:43 +0000 (10:42 +0200)]
add pthread_getname_np

20 months agocheck lld version to choose correct flag for tests
Daniil Belov [Wed, 21 Sep 2022 10:59:03 +0000 (13:59 +0300)]
check lld version to choose correct flag for tests

20 months agoAuto merge of #2614 - saethlin:stack-inspection-tools, r=RalfJung
bors [Wed, 26 Oct 2022 07:58:36 +0000 (07:58 +0000)]
Auto merge of #2614 - saethlin:stack-inspection-tools, r=RalfJung

Improve miri_print_borrow_stacks

Per post-merge review on https://github.com/rust-lang/miri/pull/2322

* `miri_print_stacks` renamed to `miri_print_borrow_stacks`
* A bit more details in docs, clarified how unstable these functions are meant to be
* Print an `unknown_bottom` if one exists

Open question: Currently `miri_get_alloc_id` gets the expected `AllocId` for `Wildcard` pointers, but for pointers with no provenance, the function reports UB and halts the interpreter. That's definitely wrong. But what _should_ we do? Is it reasonable to check if the pointer has `None` provenance and try to get an `AllocId` for its address? That still leaves us with a failure path, which in this case might be best-handled as an ICE? I'm just not sure that changing the return type of `miri_get_alloc_id` to `Option` is a win because it complicates all normal uses of this.

20 months agoAuto merge of #103562 - Dylan-DPC:rollup-sheepp5, r=Dylan-DPC
bors [Wed, 26 Oct 2022 07:58:28 +0000 (07:58 +0000)]
Auto merge of #103562 - Dylan-DPC:rollup-sheepp5, r=Dylan-DPC

Rollup of 10 pull requests

Successful merges:

 - #102951 (suggest type annotation for local statement initialed by ref expression)
 - #103209 (Diagnostic derives: allow specifying multiple alternative suggestions)
 - #103287 (Use a faster allocation size check in slice::from_raw_parts)
 - #103416 (Name the `impl Trait` in region bound suggestions)
 - #103430 (Workaround unstable stmt_expr_attributes for method receiver expressions)
 - #103444 (Remove extra type error after missing semicolon error)
 - #103520 (rustc_middle: Rearrange resolver outputs structures slightly)
 - #103533 (Use &self instead of &mut self for cast methods)
 - #103536 (Remove `rustc_driver::set_sigpipe_handler()`)
 - #103542 (Pinning tests for some `macro_rules!` errors discussed in the lang meeting)

Failed merges:

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

20 months agotweak docs
Ralf Jung [Wed, 26 Oct 2022 07:58:21 +0000 (09:58 +0200)]
tweak docs

20 months agolibrary: allow some unused things in Miri
Ralf Jung [Wed, 26 Oct 2022 07:48:47 +0000 (09:48 +0200)]
library: allow some unused things in Miri

20 months agoRollup merge of #103542 - scottmcm:invalid-macro-patterns, r=compiler-errors
Dylan DPC [Wed, 26 Oct 2022 05:59:57 +0000 (11:29 +0530)]
Rollup merge of #103542 - scottmcm:invalid-macro-patterns, r=compiler-errors

Pinning tests for some `macro_rules!` errors discussed in the lang meeting

r? ``@nikomatsakis``

Mind just stamping these, since they were useful for the meeting discussion today?

20 months agoRollup merge of #103536 - Enselic:remove-set_sigpipe_handler, r=tmiasko
Dylan DPC [Wed, 26 Oct 2022 05:59:57 +0000 (11:29 +0530)]
Rollup merge of #103536 - Enselic:remove-set_sigpipe_handler, r=tmiasko

Remove `rustc_driver::set_sigpipe_handler()`

Its usage was removed in https://github.com/rust-lang/rust/pull/102587 and https://github.com/rust-lang/rust/pull/103495, so we do not need to keep it around any longer. According to [preliminary input](https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/Find.20.60rustc_driver.60.20dependent.20projects.3F/near/304490764), we do not need to worry about any deprecation cycle for this explicitly unstable API, and can just straight up remove it.

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

Tracking issue for `unix_sigpipe`: #97889

Migration instructions for any remaining clients
---

Change from

```rust
#![feature(rustc_private)]

extern crate rustc_driver;

fn main() {
    rustc_driver::set_sigpipe_handler();
    // ...
```

to

```rust
#![feature(unix_sigpipe)]

#[unix_sigpipe = "sig_dfl"]
fn main() {
    // ...
```

``@rustbot`` labels +T-compiler

20 months agoRollup merge of #103533 - jachris:cast-without-mut, r=oli-obk
Dylan DPC [Wed, 26 Oct 2022 05:59:56 +0000 (11:29 +0530)]
Rollup merge of #103533 - jachris:cast-without-mut, r=oli-obk

Use &self instead of &mut self for cast methods

r? ``@oli-obk``

20 months agoRollup merge of #103520 - petrochenkov:resout, r=cjgillot
Dylan DPC [Wed, 26 Oct 2022 05:59:56 +0000 (11:29 +0530)]
Rollup merge of #103520 - petrochenkov:resout, r=cjgillot

rustc_middle: Rearrange resolver outputs structures slightly

Addresses https://github.com/rust-lang/rust/pull/98106#discussion_r898427061.
I also haven't seen the motivation for moving `cstore` from its old place, so I moved it back in this PR.
r? ```@cjgillot```

20 months agoRollup merge of #103444 - chenyukang:yukang/fix-103425-extra-diag, r=davidtwco
Dylan DPC [Wed, 26 Oct 2022 05:59:55 +0000 (11:29 +0530)]
Rollup merge of #103444 - chenyukang:yukang/fix-103425-extra-diag, r=davidtwco

Remove extra type error after missing semicolon error

Fixes #103425

20 months agoRollup merge of #103430 - cjgillot:receiver-attrs, r=petrochenkov
Dylan DPC [Wed, 26 Oct 2022 05:59:55 +0000 (11:29 +0530)]
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``

20 months agoRollup merge of #103416 - compiler-errors:rpit-named, r=cjgillot
Dylan DPC [Wed, 26 Oct 2022 05:59:54 +0000 (11:29 +0530)]
Rollup merge of #103416 - compiler-errors:rpit-named, r=cjgillot

Name the `impl Trait` in region bound suggestions

Slightly more descriptive message

20 months agoRollup merge of #103287 - saethlin:faster-len-check, r=thomcc
Dylan DPC [Wed, 26 Oct 2022 05:59:53 +0000 (11:29 +0530)]
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```

20 months agoRollup merge of #103209 - Xiretza:multiple-suggestions, r=davidtwco
Dylan DPC [Wed, 26 Oct 2022 05:59:53 +0000 (11:29 +0530)]
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.

20 months agoRollup merge of #102951 - SparrowLii:type_annotation, r=estebank
Dylan DPC [Wed, 26 Oct 2022 05:59:53 +0000 (11:29 +0530)]
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

20 months agoAuto merge of #103279 - compiler-errors:normalize-hack-back, r=lcnr
bors [Wed, 26 Oct 2022 05:17:46 +0000 (05:17 +0000)]
Auto merge of #103279 - compiler-errors:normalize-hack-back, r=lcnr

Add eval hack in `super_relate_consts` back

Partially reverts 01adb7e98d5656c06497f33dd2747df144e78356.

This extra eval call *still* needs to happen, for example, in `normalize_param_env_or_error` when a param-env predicate has an unnormalized constant, since the param-env candidates never get normalized during candidate assembly (everywhere else we can assume that they are normalized fully).

r? `@lcnr,` though I feel like I've assigned quite a few PRs to you in the last few days, so feel free to reassign to someone else familiar with this code if you're busy!

cc #103243 (fixes the issue, but don't want to auto-close that until a backport is performed).

20 months agoModify ui tests to reflect the change
Byron Zhong [Tue, 25 Oct 2022 22:50:11 +0000 (17:50 -0500)]
Modify ui tests to reflect the change

20 months agoModify check to output 'you might have meant' for indirect reference
Byron Zhong [Tue, 25 Oct 2022 22:29:29 +0000 (17:29 -0500)]
Modify check to output 'you might have meant' for indirect reference

20 months agoAdd check to only output 'you might have meant' when the candidate name is in the...
Byron Zhong [Tue, 25 Oct 2022 17:35:04 +0000 (12:35 -0500)]
Add check to only output 'you might have meant' when the candidate name is in the same crate

20 months agoAdd Span in TypoSuggestion and TypoCandidate
Byron Zhong [Tue, 25 Oct 2022 06:14:39 +0000 (01:14 -0500)]
Add Span in TypoSuggestion and TypoCandidate

20 months agoAuto merge of #103158 - Bryanskiy:resolve_perf, r=petrochenkov
bors [Wed, 26 Oct 2022 02:30:18 +0000 (02:30 +0000)]
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`

20 months agoUpdate cargo
Weihang Lo [Wed, 26 Oct 2022 01:20:22 +0000 (09:20 +0800)]
Update cargo

5 commits in 071eeaf210708219a5a1b2c4728ca2f97df7f2ae..9210810d1fd7b51ae0439a0a363cc50e36963455
2022-10-22 01:17:55 +0000 to 2022-10-25 22:31:50 +0000

- Fix 410 gone response handling (rust-lang/cargo#11286)
- Fix inequality in "stale mtime" log messages (rust-lang/cargo#11281)
- doc(cargo-tree): mention it considering feature unification (rust-lang/cargo#11282)
- Improve the error message if `publish` is `false` or empty list (rust-lang/cargo#11280)
- Add test for deleted index entry (rust-lang/cargo#11278)

20 months agorustdoc: add visible focus outline to rustdoc-toggle
Michael Howell [Tue, 25 Oct 2022 23:52:50 +0000 (16:52 -0700)]
rustdoc: add visible focus outline to rustdoc-toggle

The change in opacity is inconsistent with most of rustdoc, which uses
default browser styles for the focus outline. Unfortunately, just using
the default focus outline here won't work, because it gets applied to
the summary itself instead of the pseudo-element "real button."

20 months agoAuto merge of #102903 - compiler-errors:region-var-leak, r=jackh726
bors [Tue, 25 Oct 2022 23:24:36 +0000 (23:24 +0000)]
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`

20 months agodiagnostics: add test case for issue 102354
Michael Howell [Tue, 25 Oct 2022 22:28:02 +0000 (15:28 -0700)]
diagnostics: add test case for issue 102354

20 months agoUpdate books
Eric Huss [Tue, 25 Oct 2022 19:34:05 +0000 (12:34 -0700)]
Update books

20 months agollvm-16: Don't initialize removed legacy passes
Matthew Maurer [Tue, 25 Oct 2022 22:03:21 +0000 (15:03 -0700)]
llvm-16: Don't initialize removed legacy passes

LLVM removed initialization for legacy passes:
https://reviews.llvm.org/D136615

20 months agoTry to say that memory outside the AM is always exposed
Ben Kimock [Sun, 16 Oct 2022 05:03:52 +0000 (01:03 -0400)]
Try to say that memory outside the AM is always exposed

Co-authored-by: Ralf Jung <post@ralfj.de>
20 months agoRename, improve docs, fail better
Ben Kimock [Sun, 23 Oct 2022 16:32:45 +0000 (12:32 -0400)]
Rename, improve docs, fail better

20 months agodiagnostics: do not suggest static candidates as traits to import
Michael Howell [Tue, 25 Oct 2022 21:46:14 +0000 (14:46 -0700)]
diagnostics: do not suggest static candidates as traits to import

If it's a static candidate, then it's already implemented. Do not suggest
it a second time for implementing.

20 months agoAdd regression test for inlined doc comment on impl block
Guillaume Gomez [Tue, 25 Oct 2022 14:28:27 +0000 (16:28 +0200)]
Add regression test for inlined doc comment on impl block

20 months agoDon't merge inline doc comments for impl blocks
Guillaume Gomez [Tue, 25 Oct 2022 14:27:21 +0000 (16:27 +0200)]
Don't merge inline doc comments for impl blocks

20 months agointerpret: a bit of cast cleanup
Ralf Jung [Tue, 25 Oct 2022 20:09:35 +0000 (22:09 +0200)]
interpret: a bit of cast cleanup

20 months agoAdd flag to forbid recovery in the parser
Nilstrieb [Tue, 25 Oct 2022 19:24:01 +0000 (21:24 +0200)]
Add flag to forbid recovery in the parser

20 months agoPinning tests for some macro_rules things discussed in the lang meeting
Scott McMurray [Tue, 25 Oct 2022 19:16:25 +0000 (12:16 -0700)]
Pinning tests for some macro_rules things discussed in the lang meeting

20 months agoSplit diagnostic details out into a separate function and fluent files
Oli Scherer [Tue, 25 Oct 2022 18:28:04 +0000 (18:28 +0000)]
Split diagnostic details out into a separate function and fluent files

20 months agoAuto merge of #2618 - RalfJung:rustup, r=RalfJung
bors [Tue, 25 Oct 2022 18:02:23 +0000 (18:02 +0000)]
Auto merge of #2618 - RalfJung:rustup, r=RalfJung

Rustup

20 months agobless clippy
Ralf Jung [Tue, 25 Oct 2022 17:59:36 +0000 (19:59 +0200)]
bless clippy

20 months agorustup
Ralf Jung [Tue, 25 Oct 2022 17:49:12 +0000 (19:49 +0200)]
rustup

20 months agoMerge branch 'master' of http://localhost:8000/rust-lang/rust.git:at_commit=75dd959a3...
Ralf Jung [Tue, 25 Oct 2022 17:48:23 +0000 (19:48 +0200)]
Merge branch 'master' of http://localhost:8000/rust-lang/rust.git:at_commit=75dd959a3a40eb5b4574f8d2e23aa6efbeb33573[:prefix=src/tools/miri]:/src/tools/miri

20 months agorustdoc: combine shared CSS between `.*-line-numbers`
Michael Howell [Tue, 25 Oct 2022 17:43:08 +0000 (10:43 -0700)]
rustdoc: combine shared CSS between `.*-line-numbers`

20 months agoRemove `rustc_driver::set_sigpipe_handler()`
Martin Nordholts [Mon, 24 Oct 2022 18:59:22 +0000 (20:59 +0200)]
Remove `rustc_driver::set_sigpipe_handler()`

Its usage was removed in 5e624bf4ba and 093b075d32, so we do not need to
keep it around any longer. According to [preliminary
input](https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/Find.20.60rustc_driver.60.20dependent.20projects.3F/near/304490764),
we do not need to worry about any deprecation cycle for this API and can
just straight up remove it.

Migration instructions for remaining clients
--------------------------------------------

Change from

```rust

extern crate rustc_driver;

fn main() {
    rustc_driver::set_sigpipe_handler();
    // ...
```

to

```rust

fn main() {
    // ...
```

20 months agoName impl trait in region bound suggestion
Michael Goulet [Sat, 22 Oct 2022 21:38:05 +0000 (21:38 +0000)]
Name impl trait in region bound suggestion

20 months agoUse &self instead of &mut self for cast methods
Jannis Christopher Köhl [Tue, 25 Oct 2022 16:31:11 +0000 (18:31 +0200)]
Use &self instead of &mut self for cast methods

20 months agoAuto merge of #102340 - JakobDegen:pass-manager-simplification, r=oli-obk
bors [Tue, 25 Oct 2022 15:55:39 +0000 (15:55 +0000)]
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`

20 months agomore dupe typos again
Rageking8 [Tue, 25 Oct 2022 14:51:47 +0000 (22:51 +0800)]
more dupe typos again

20 months agoMove a wf-check into the site where the value is instantiated
Oli Scherer [Thu, 20 Oct 2022 09:39:09 +0000 (09:39 +0000)]
Move a wf-check into the site where the value is instantiated

20 months agorustc_metadata: Add constructors to module children at encoding time
Vadim Petrochenkov [Tue, 25 Oct 2022 12:13:02 +0000 (16:13 +0400)]
rustc_metadata: Add constructors to module children at encoding time

instead of decoding time.

20 months agoadopt to compiler changes
Maybe Waffle [Tue, 25 Oct 2022 13:47:43 +0000 (13:47 +0000)]
adopt to compiler changes

20 months agoBubble the opaque type ordering int opaque type handling
Oli Scherer [Fri, 7 Oct 2022 09:56:42 +0000 (09:56 +0000)]
Bubble the opaque type ordering int opaque type handling

20 months agoUse the general type API instead of directly accessing register_hidden_type
Oli Scherer [Fri, 7 Oct 2022 09:33:22 +0000 (09:33 +0000)]
Use the general type API instead of directly accessing register_hidden_type

20 months agoPull opaque type handling out of the type relating delegate
Oli Scherer [Fri, 7 Oct 2022 09:29:51 +0000 (09:29 +0000)]
Pull opaque type handling out of the type relating delegate

20 months agoadd a test for gate `impl_trait_in_fn_trait_return`
Maybe Waffle [Thu, 28 Jul 2022 22:28:36 +0000 (02:28 +0400)]
add a test for gate `impl_trait_in_fn_trait_return`

20 months ago--bless
Maybe Waffle [Thu, 28 Jul 2022 20:18:32 +0000 (00:18 +0400)]
--bless

20 months agoFeature gate `impl_trait_in_fn_trait_return`
Maybe Waffle [Sun, 24 Jul 2022 21:54:47 +0000 (01:54 +0400)]
Feature gate `impl_trait_in_fn_trait_return`

20 months agoAdd even more tests for `impl Fn() -> impl Trait`
Maybe Waffle [Thu, 23 Jun 2022 15:12:13 +0000 (19:12 +0400)]
Add even more tests for `impl Fn() -> impl Trait`

20 months agoAdd more tests for `impl Fn() -> impl Trait`
Maybe Waffle [Thu, 23 Jun 2022 15:00:03 +0000 (19:00 +0400)]
Add more tests for `impl Fn() -> impl Trait`

20 months agoAllow `impl Fn() -> impl Trait` in return position
Maybe Waffle [Wed, 2 Feb 2022 12:09:44 +0000 (15:09 +0300)]
Allow `impl Fn() -> impl Trait` in return position

This allows writing the following function signatures:
```rust
fn f0() -> impl Fn() -> impl Trait;
fn f3() -> &'static dyn Fn() -> impl Trait;
```

These signatures were already allowed for common traits and associated
types, there is no reason why `Fn*` traits should be special in this
regard.

20 months agoAuto merge of #103392 - RalfJung:miri, r=oli-obk
bors [Tue, 25 Oct 2022 12:33:39 +0000 (12:33 +0000)]
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.

20 months agoPerf improvements for effective visibility calculating
Bryanskiy [Mon, 17 Oct 2022 17:09:03 +0000 (20:09 +0300)]
Perf improvements for effective visibility calculating

20 months agorustc_middle: Rearrange resolver outputs structures slightly
Vadim Petrochenkov [Tue, 25 Oct 2022 10:45:02 +0000 (14:45 +0400)]
rustc_middle: Rearrange resolver outputs structures slightly

20 months agoMiri: disable macOS testing for now
Ralf Jung [Tue, 25 Oct 2022 11:40:38 +0000 (13:40 +0200)]
Miri: disable macOS testing for now

20 months agoAuto merge of #103513 - Dylan-DPC:rollup-nn3ite2, r=Dylan-DPC
bors [Tue, 25 Oct 2022 09:37:06 +0000 (09:37 +0000)]
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

20 months agoRollup merge of #103511 - nnethercote:bb-tweaks, r=bjorn3
Dylan DPC [Tue, 25 Oct 2022 09:13:16 +0000 (14:43 +0530)]
Rollup merge of #103511 - nnethercote:bb-tweaks, r=bjorn3

Codegen tweaks

Best reviewed one commit at a time.

r? `@bjorn3`

20 months agoRollup merge of #103482 - aDotInTheVoid:vec-cap-docs, r=thomcc
Dylan DPC [Tue, 25 Oct 2022 09:13:15 +0000 (14:43 +0530)]
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

20 months agoRollup merge of #103379 - cuviper:truncate-thread-name, r=thomcc
Dylan DPC [Tue, 25 Oct 2022 09:13:15 +0000 (14:43 +0530)]
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``````

20 months agoRollup merge of #103122 - ouz-a:mir-technical-debt, r=oli-obk
Dylan DPC [Tue, 25 Oct 2022 09:13:14 +0000 (14:43 +0530)]
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````

20 months agoRollup merge of #102587 - Enselic:rustc-unix_sigpipe, r=jackh726
Dylan DPC [Tue, 25 Oct 2022 09:13:14 +0000 (14:43 +0530)]
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

20 months agoRollup merge of #98204 - Kixiron:stable-unzip, r=thomcc
Dylan DPC [Tue, 25 Oct 2022 09:13:13 +0000 (14:43 +0530)]
Rollup merge of #98204 - Kixiron:stable-unzip, r=thomcc

Stabilize `Option::unzip()`

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

```@rustbot``` modify labels: +T-libs-api

20 months agoAdded helper to prevent verbose printing from the `PrettyPrinter` when printing constants
Sarthak Singh [Sun, 23 Oct 2022 06:59:59 +0000 (12:29 +0530)]
Added helper to prevent verbose printing from the `PrettyPrinter` when printing constants

20 months agoAuto merge of #102988 - dpaoliello:inlinerawdylib, r=dpaoliello
bors [Tue, 25 Oct 2022 04:57:51 +0000 (04:57 +0000)]
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.

20 months agoSimplify `cast_shift_expr_rhs`.
Nicholas Nethercote [Tue, 25 Oct 2022 03:39:20 +0000 (14:39 +1100)]
Simplify `cast_shift_expr_rhs`.

It's only ever used with shift operators.

20 months agoInline and remove `cast_shift_rhs`.
Nicholas Nethercote [Tue, 25 Oct 2022 02:51:52 +0000 (13:51 +1100)]
Inline and remove `cast_shift_rhs`.

It has a single call site.

20 months agoAuto merge of #103502 - JohnTitor:rollup-o6mhyzq, r=JohnTitor
bors [Tue, 25 Oct 2022 02:16:57 +0000 (02:16 +0000)]
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

20 months agoClarify some cleanup stuff.
Nicholas Nethercote [Tue, 18 Oct 2022 23:59:02 +0000 (10:59 +1100)]
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.

20 months agoRename two `TerminatorCodegenHelper` methods.
Nicholas Nethercote [Tue, 18 Oct 2022 23:53:38 +0000 (10:53 +1100)]
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.

20 months agorustc_codegen_ssa: use more consistent naming.
Nicholas Nethercote [Tue, 18 Oct 2022 23:34:45 +0000 (10:34 +1100)]
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.

20 months agorustdoc: parse self-closing tags and attributes in `invalid_html_tags`
Michael Howell [Tue, 25 Oct 2022 00:46:23 +0000 (17:46 -0700)]
rustdoc: parse self-closing tags and attributes in `invalid_html_tags`

Fixes #103460

20 months agoSupport raw-dylib functions being used inside inlined functions
Daniel Paoliello [Wed, 12 Oct 2022 21:44:01 +0000 (14:44 -0700)]
Support raw-dylib functions being used inside inlined functions

20 months agoMigrate from highfive to triagebot
Eric Huss [Mon, 24 Oct 2022 16:16:45 +0000 (09:16 -0700)]
Migrate from highfive to triagebot

20 months agoRollup merge of #103495 - Enselic:rustdoc-unix_sigpipe, r=notriddle
Yuki Okushi [Mon, 24 Oct 2022 23:01:31 +0000 (08:01 +0900)]
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

20 months agoRollup merge of #103494 - notriddle:notriddle/test-arrow-hover, r=GuillaumeGomez
Yuki Okushi [Mon, 24 Oct 2022 23:01:31 +0000 (08:01 +0900)]
Rollup merge of #103494 - notriddle:notriddle/test-arrow-hover, r=GuillaumeGomez

rustdoc: remove redundant CSS `a.test-arrow:hover`

In 4b402dbe690dd00f567542ca9e41042826a168b5, 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, 7585632052298f9c84cc12ac5afcb23786ae1d3d changed the pro-underline rule to exclude the test-arrow link anyway.

20 months agoRollup merge of #103493 - notriddle:notriddle/source-sidebar-logo, r=GuillaumeGomez
Yuki Okushi [Mon, 24 Oct 2022 23:01:30 +0000 (08:01 +0900)]
Rollup merge of #103493 - notriddle:notriddle/source-sidebar-logo, r=GuillaumeGomez

rustdoc: remove unused `.sidebar-logo` DOM on source pages

20 months agoRollup merge of #103486 - GuillaumeGomez:cleanup-rustdoc-gui-highlight-colors, r...
Yuki Okushi [Mon, 24 Oct 2022 23:01:30 +0000 (08:01 +0900)]
Rollup merge of #103486 - GuillaumeGomez:cleanup-rustdoc-gui-highlight-colors, r=notriddle

Use functions in highlight-colors rustdoc GUI test

r? ``@notriddle``

20 months agoRollup merge of #103465 - jruderman:patch-1, r=compiler-errors
Yuki Okushi [Mon, 24 Oct 2022 23:01:30 +0000 (08:01 +0900)]
Rollup merge of #103465 - jruderman:patch-1, r=compiler-errors

E0210 explanation: remove redundant sentence

20 months agoRollup merge of #103462 - notriddle:notriddle/source-pre-rust-white-space, r=Dylan-DPC
Yuki Okushi [Mon, 24 Oct 2022 23:01:29 +0000 (08:01 +0900)]
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 49e6db7f3510a99ab3d3723b2430add985629c39, overrode a rule in normalize.css.

https://github.com/rust-lang/rust/blob/49e6db7f3510a99ab3d3723b2430add985629c39/src/librustdoc/html/static/normalize.css#L169-L175

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

https://github.com/necolas/normalize.css/commit/a8edd0c5aa06b905e8e1550fd6a5c01e46375194

20 months agoRollup merge of #103410 - camsteffen:link-unstable-book, r=JohnTitor
Yuki Okushi [Mon, 24 Oct 2022 23:01:28 +0000 (08:01 +0900)]
Rollup merge of #103410 - camsteffen:link-unstable-book, r=JohnTitor

-Z docs: Add link to unstable book

20 months agoRollup merge of #103409 - compiler-errors:rpitit-signature-mismatch, r=lcnr
Yuki Okushi [Mon, 24 Oct 2022 23:01:28 +0000 (08:01 +0900)]
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

20 months agoRollup merge of #103382 - compiler-errors:anon-apit-lt-region-ice, r=cjgillot
Yuki Okushi [Mon, 24 Oct 2022 23:01:28 +0000 (08:01 +0900)]
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``

20 months agoRollup merge of #103350 - clubby789:refer-to-assoc-method, r=wesleywiser
Yuki Okushi [Mon, 24 Oct 2022 23:01:27 +0000 (08:01 +0900)]
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

20 months agoRollup merge of #103333 - chenyukang:yukang/fix-103143, r=wesleywiser
Yuki Okushi [Mon, 24 Oct 2022 23:01:27 +0000 (08:01 +0900)]
Rollup merge of #103333 - chenyukang:yukang/fix-103143, r=wesleywiser

Fix assertion failed for break_last_token and trailing token

Fixes #103143

20 months agoAssert if inference vars are leaking from fully_resolve
Michael Goulet [Mon, 10 Oct 2022 22:39:41 +0000 (22:39 +0000)]
Assert if inference vars are leaking from fully_resolve

20 months agoDelay span bug when we can't map lifetimes back in collect_trait_impl_trait_tys
Michael Goulet [Mon, 24 Oct 2022 18:45:50 +0000 (18:45 +0000)]
Delay span bug when we can't map lifetimes back in collect_trait_impl_trait_tys

20 months agorustdoc: Use `unix_sigpipe` instead of `rustc_driver::set_sigpipe_handler`
Martin Nordholts [Mon, 24 Oct 2022 18:14:28 +0000 (20:14 +0200)]
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

20 months agorustdoc: remove redundant CSS `a.test-arrow:hover`
Michael Howell [Mon, 24 Oct 2022 18:39:19 +0000 (11:39 -0700)]
rustdoc: remove redundant CSS `a.test-arrow:hover`

In 4b402dbe690dd00f567542ca9e41042826a168b5, 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,
7585632052298f9c84cc12ac5afcb23786ae1d3d changed the pro-underline rule to
exclude the test-arrow link anyway.

20 months agorustdoc: fix weird toggle-all-docs style in iOS
Michael Howell [Sat, 17 Sep 2022 16:53:31 +0000 (09:53 -0700)]
rustdoc: fix weird toggle-all-docs style in iOS

20 months agorustdoc: clean up `#toggle-all-docs`
Michael Howell [Sat, 17 Sep 2022 16:38:57 +0000 (09:38 -0700)]
rustdoc: clean up `#toggle-all-docs`

This change converts the element from an `<a>` link to a button. It's
pretty much directly trading slightly more CSS for slightly less HTML, and
it's also semantically correct (so you don't get a broken "bookmark" option
when you right click on it).

While doing this, I also got rid of the unnecessary `class="inner"`
attribute on the inner span. There was a style targeting
`.collapse-toggle > .inner`, but no CSS ever targeted the
`#toggle-all-docs > .inner`.