]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoRollup merge of #98430 - camsteffen:flatten-refactor, r=joshtriplett
Dylan DPC [Tue, 28 Jun 2022 10:00:05 +0000 (15:30 +0530)]
Rollup merge of #98430 - camsteffen:flatten-refactor, r=joshtriplett

Refactor iter adapters with less macros

Just some code cleanup. Introduced a util `and_then_or_clear` for each of chain, flatten and fuse iter adapter impls. This reduces code nicely for flatten, but admittedly the other modules are more of a lateral move replacing macros with a function. But I think consistency across the modules and avoiding macros when possible is good.

2 years agoRollup merge of #98420 - davidtwco:translation-lint-fixes-and-more-migration, r=compi...
Dylan DPC [Tue, 28 Jun 2022 10:00:04 +0000 (15:30 +0530)]
Rollup merge of #98420 - davidtwco:translation-lint-fixes-and-more-migration, r=compiler-errors

translation: lint fix + more migration

- Unfortunately, the diagnostic lints are very broken and trigger much more often than they should. This PR corrects the conditional which checks if the function call being made is to a diagnostic function so that it returns in every intended case.
- The `rustc_lint_diagnostics` attribute is used by the diagnostic translation/struct migration lints to identify calls where non-translatable diagnostics or diagnostics outwith impls are being created. Any function used in creating a diagnostic should be annotated with this attribute so this PR adds the attribute to many more functions.
- Port the diagnostics from the `rustc_privacy` crate and enable the lints for that crate.

r? ``@compiler-errors``

2 years agoRollup merge of #98384 - rdzhaafar:fix-macos-rss-reporting, r=davidtwco,michaelwoerister
Dylan DPC [Tue, 28 Jun 2022 10:00:03 +0000 (15:30 +0530)]
Rollup merge of #98384 - rdzhaafar:fix-macos-rss-reporting, r=davidtwco,michaelwoerister

Fix RSS reporting on macOS

> NOTE: This is a duplicate of #98164, which I closed because I borked my rustc fork

Currently, `rustc_data_structures::profiling::get_resident_set_size()` always returns `None` on macOS. This is because
macOS does not implement procfs used in the unix version of the function:

```rust
...
else if #[cfg(unix)] {
        pub fn get_resident_set_size() -> Option<usize> {
            let field = 1;
            let contents = fs::read("/proc/self/statm").ok()?;
            let contents = String::from_utf8(contents).ok()?;
            let s = contents.split_whitespace().nth(field)?;
            let npages = s.parse::<usize>().ok()?;
            Some(npages * 4096)
        }
...
```

The proposed solution uses libproc, and more specifically `proc_pidinfo`, which has been available on macOS since 10.5 if the function signature inside libproc.h is to be believed:

```c
int proc_pidinfo(int pid, int flavor, uint64_t arg, void *buffer, int buffersize) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
```

2 years agoRollup merge of #98337 - c410-f3r:assert-compiler, r=oli-obk
Dylan DPC [Tue, 28 Jun 2022 10:00:02 +0000 (15:30 +0530)]
Rollup merge of #98337 - c410-f3r:assert-compiler, r=oli-obk

[RFC 2011] Optimize non-consuming operators

Tracking issue: https://github.com/rust-lang/rust/issues/44838
Fifth step of https://github.com/rust-lang/rust/pull/96496

The most non-invasive approach that will probably have very little to no performance impact.

## Current behaviour

Captures are handled "on-the-fly", i.e., they are performed in the same place expressions are located.

```rust
// `let a = 1; let b = 2; assert!(a > 1 && b < 100);`

if !(
  { ***try capture `a` and then return `a`*** } > 1 && { ***try capture `b` and then return `b`*** } < 100
) {
  panic!( ... );
}
```

As such, some overhead is likely to occur (Specially with very large chains of conditions).

## New behaviour for non-consuming operators

When an operator is known to not take `self`, then it is possible to capture variables **AFTER** the condition.

```rust
// `let a = 1; let b = 2; assert!(a > 1 && b < 100);`

if !( a > 1 && b < 100 ) {
  { ***try capture `a`*** }
  { ***try capture `b`*** }
  panic!( ... );
}
```

So the possible impact on the runtime execution time will be diminished.

r? ````@oli-obk````

2 years agoRollup merge of #98261 - WaffleLapkin:attempt_to_remove_max_suggestion_highlight_line...
Dylan DPC [Tue, 28 Jun 2022 10:00:01 +0000 (15:30 +0530)]
Rollup merge of #98261 - WaffleLapkin:attempt_to_remove_max_suggestion_highlight_lines, r=flip1995

Remove `MAX_SUGGESTION_HIGHLIGHT_LINES`

After #97798 the `MAX_SUGGESTION_HIGHLIGHT_LINES` constant doesn't really make sense since we always show full suggestions. This PR removes last usages of the constant and the constant itself.

r? ``@flip1995`` (this mostly does changes in clippy)

2 years agoRollup merge of #97346 - JohnTitor:remove-back-compat-hacks, r=oli-obk
Dylan DPC [Tue, 28 Jun 2022 10:00:00 +0000 (15:30 +0530)]
Rollup merge of #97346 - JohnTitor:remove-back-compat-hacks, r=oli-obk

Remove a back-compat hack on lazy TAIT

This PR's motivation is here: https://github.com/rust-lang/rust/issues/72614#issuecomment-1134595446
~~But removing a hack doesn't seem to reject the code on the issue, there're some more hacks?~~
r? ``@oli-obk``

2 years agoAuto merge of #98324 - conradludgate:write-vectored-vec, r=Mark-Simulacrum
bors [Tue, 28 Jun 2022 06:25:19 +0000 (06:25 +0000)]
Auto merge of #98324 - conradludgate:write-vectored-vec, r=Mark-Simulacrum

attempt to optimise vectored write

benchmarked:

old:
```
test io::cursor::tests::bench_write_vec                     ... bench:          68 ns/iter (+/- 2)
test io::cursor::tests::bench_write_vec_vectored            ... bench:         913 ns/iter (+/- 31)
```

new:
```
test io::cursor::tests::bench_write_vec                     ... bench:          64 ns/iter (+/- 0)
test io::cursor::tests::bench_write_vec_vectored            ... bench:         747 ns/iter (+/- 27)
```

More unsafe than I wanted (and less gains) in the end, but it still does the job

2 years agoAuto merge of #98222 - cjgillot:single-wf, r=michaelwoerister
bors [Tue, 28 Jun 2022 03:44:33 +0000 (03:44 +0000)]
Auto merge of #98222 - cjgillot:single-wf, r=michaelwoerister

Only keep a single query for well-formed checking

There are currently 3 queries to perform wf checks on different item-likes.  This complexity is not required.

This PR replaces the query by:
- one query per item;
- one query to invoke it for a whole module.

This allows to remove HIR `ParItemLikeVisitor`.

2 years agoAuto merge of #98591 - matthiaskrgr:rollup-7dok1wq, r=matthiaskrgr
bors [Mon, 27 Jun 2022 22:22:58 +0000 (22:22 +0000)]
Auto merge of #98591 - matthiaskrgr:rollup-7dok1wq, r=matthiaskrgr

Rollup of 9 pull requests

Successful merges:

 - #98331 (Fix rustdoc argument error)
 - #98506 (Fix span issues in object safety suggestions)
 - #98563 (interpret: refactor allocation info query)
 - #98576 (small regions refactoring)
 - #98577 (Fix "kind" for associated types in trait implementations in rustdoc JSON)
 - #98578 (Remove eddyb from miri failure pings)
 - #98579 (liballoc tests: avoid int2ptr cast)
 - #98581 (Add triagebot mentions.)
 - #98587 (libcore tests: avoid int2ptr casts)

Failed merges:

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

2 years agoRollup merge of #98587 - RalfJung:core-tests, r=thomcc
Matthias Krüger [Mon, 27 Jun 2022 20:35:14 +0000 (22:35 +0200)]
Rollup merge of #98587 - RalfJung:core-tests, r=thomcc

libcore tests: avoid int2ptr casts

We don't need any of these pointers to actually be dereferenceable so using `ptr::invalid` should be fine. And then we can run Miri with strict provenance enforcement on the tests.

2 years agoRollup merge of #98581 - ehuss:triagebot-mentions, r=Mark-Simulacrum
Matthias Krüger [Mon, 27 Jun 2022 20:35:14 +0000 (22:35 +0200)]
Rollup merge of #98581 - ehuss:triagebot-mentions, r=Mark-Simulacrum

Add triagebot mentions.

This migrates the configuration of mentions from highfive to triagebot.

I also fixed a few broken paths (error_codes.rs src/librustdoc/html/static/themes src/librustdoc/html/static/themes/ayu.css).

2 years agoRollup merge of #98579 - RalfJung:alloc-tests, r=thomcc
Matthias Krüger [Mon, 27 Jun 2022 20:35:13 +0000 (22:35 +0200)]
Rollup merge of #98579 - RalfJung:alloc-tests, r=thomcc

liballoc tests: avoid int2ptr cast

I think we don't need `ptr::from_exposed_addr` here; `ptr::invalid` should be enough for this test. (And this makes Miri less unhappy when running these tests.)

2 years agoRollup merge of #98578 - rust-lang:oli-obk-patch-1, r=eddyb
Matthias Krüger [Mon, 27 Jun 2022 20:35:11 +0000 (22:35 +0200)]
Rollup merge of #98578 - rust-lang:oli-obk-patch-1, r=eddyb

Remove eddyb from miri failure pings

r? `@eddyb`

2 years agoRollup merge of #98577 - GuillaumeGomez:associated-items, r=notriddle
Matthias Krüger [Mon, 27 Jun 2022 20:35:11 +0000 (22:35 +0200)]
Rollup merge of #98577 - GuillaumeGomez:associated-items, r=notriddle

Fix "kind" for associated types in trait implementations in rustdoc JSON

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

Contrary to what is suggested in the issue, I really think we should distinguish between associated items and "normal" constants and types.

cc `@CraftSpider` `@SimonSapin`
r? `@notriddle`

2 years agoRollup merge of #98576 - lcnr:region-stuff-cool-beans, r=jackh726
Matthias Krüger [Mon, 27 Jun 2022 20:35:09 +0000 (22:35 +0200)]
Rollup merge of #98576 - lcnr:region-stuff-cool-beans, r=jackh726

small regions refactoring

these commits should be fairly self-contained

r? rust-lang/types

2 years agoRollup merge of #98563 - RalfJung:interpret-alloc-check, r=oli-obk
Matthias Krüger [Mon, 27 Jun 2022 20:35:08 +0000 (22:35 +0200)]
Rollup merge of #98563 - RalfJung:interpret-alloc-check, r=oli-obk

interpret: refactor allocation info query

We now have an infallible function that also tells us which kind of allocation we are talking about.
Also we do longer have to distinguish between data and function allocations for liveness.

This will help us to avoid "catching" `InterpError`s in Miri.
r? `@oli-obk`

2 years agoRollup merge of #98506 - compiler-errors:object-safety-suggestions, r=oli-obk
Matthias Krüger [Mon, 27 Jun 2022 20:35:07 +0000 (22:35 +0200)]
Rollup merge of #98506 - compiler-errors:object-safety-suggestions, r=oli-obk

Fix span issues in object safety suggestions

Fixes #98500

2 years agoRollup merge of #98331 - GuillaumeGomez:rustdoc-arg-error, r=notriddle
Matthias Krüger [Mon, 27 Jun 2022 20:35:06 +0000 (22:35 +0200)]
Rollup merge of #98331 - GuillaumeGomez:rustdoc-arg-error, r=notriddle

Fix rustdoc argument error

Fixes #88756.

It's a take over of #88831. I cherry-picked the commits, fixed the merge conflict and the failing test.

cc `@inashivb` `@jyn514`

r? `@notriddle`

2 years agoAuto merge of #97307 - SparrowLii:parallel, r=cjgillot
bors [Mon, 27 Jun 2022 19:42:09 +0000 (19:42 +0000)]
Auto merge of #97307 - SparrowLii:parallel, r=cjgillot

catch unwind in parallel mode during wfcheck

Update #75760
When performing wfcheck, from the test results, the parallel mode will stop all checks when an `item`'s check failed, (e.g. the first ui test failure raised from [here](https://github.com/rust-lang/rust/blob/master/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs#L249))while the serial mode will output each `item`'s check result via `catch_unwind`. This leads to inconsistencies in the final output of the two mode.
In my local environment, this modification prevents the following ui tests from failing when set `parallel-compiler = true` in `config.toml`:

```
    [ui] src/test\ui\associated-types\defaults-cyclic-fail-1.rs
    [ui] src/test\ui\associated-types\defaults-cyclic-fail-2.rs
    [ui] src/test\ui\associated-types\hr-associated-type-bound-2.rs
    [ui] src/test\ui\associated-types\impl-wf-cycle-1.rs
    [ui] src/test\ui\associated-types\impl-wf-cycle-2.rs
    [ui] src/test\ui\issues\issue-20413.rs
    [ui] src/test\ui\parallel_test\defaults-cyclic-fail-para.rs
```

2 years agoAdd triagebot mentions.
Eric Huss [Mon, 27 Jun 2022 15:57:06 +0000 (08:57 -0700)]
Add triagebot mentions.

2 years agolibcore tests: avoid int2ptr casts
Ralf Jung [Mon, 27 Jun 2022 15:09:53 +0000 (11:09 -0400)]
libcore tests: avoid int2ptr casts

2 years agoAuto merge of #98566 - matthiaskrgr:rollup-43etyls, r=matthiaskrgr
bors [Mon, 27 Jun 2022 16:28:58 +0000 (16:28 +0000)]
Auto merge of #98566 - matthiaskrgr:rollup-43etyls, r=matthiaskrgr

Rollup of 5 pull requests

Successful merges:

 - #97389 (Improve memory ordering diagnostics)
 - #97780 (Check ADT field is well-formed before checking it is sized)
 - #98530 (compiletest: add issue number param to `known-bug`)
 - #98556 (Fix builds on Windows (closes #98546))
 - #98561 (Fix spelling in SAFETY comment)

Failed merges:

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

2 years agomake AllocKind actually public
Ralf Jung [Mon, 27 Jun 2022 14:58:30 +0000 (10:58 -0400)]
make AllocKind actually public

2 years agoliballoc tests: avoid int2ptr cast
Ralf Jung [Mon, 27 Jun 2022 14:50:56 +0000 (10:50 -0400)]
liballoc tests: avoid int2ptr cast

2 years agoRemove eddyb from miri failure pings
Oli Scherer [Mon, 27 Jun 2022 14:08:19 +0000 (16:08 +0200)]
Remove eddyb from miri failure pings

2 years agolower-generic vs. outlive
lcnr [Mon, 27 Jun 2022 14:06:46 +0000 (16:06 +0200)]
lower-generic vs. outlive

2 years agoAdd test for associated items in rustdoc JSON
Guillaume Gomez [Mon, 27 Jun 2022 13:59:18 +0000 (15:59 +0200)]
Add test for associated items in rustdoc JSON

2 years agoFix kind for associated types in rustdoc JSON output for trait implementations
Guillaume Gomez [Mon, 27 Jun 2022 13:59:02 +0000 (15:59 +0200)]
Fix kind for associated types in rustdoc JSON output for trait implementations

2 years agofold_region: remove unused parameter
lcnr [Mon, 27 Jun 2022 13:55:03 +0000 (15:55 +0200)]
fold_region: remove unused parameter

2 years agooutside of borrowck, do not provide an implicit_region_bound
lcnr [Mon, 27 Jun 2022 13:48:54 +0000 (15:48 +0200)]
outside of borrowck, do not provide an implicit_region_bound

see comment added to the field in `VerifyBoundCx`.

2 years agoRemove a back-compat hack on lazy TAIT
Yuki Okushi [Tue, 24 May 2022 08:55:13 +0000 (17:55 +0900)]
Remove a back-compat hack on lazy TAIT

2 years agoFinish rustdoc error improvement
Guillaume Gomez [Tue, 21 Jun 2022 10:05:59 +0000 (12:05 +0200)]
Finish rustdoc error improvement

2 years agoAdd test for help output with -W
Shivani Bhardwaj [Thu, 27 Jan 2022 08:17:10 +0000 (13:47 +0530)]
Add test for help output with -W

2 years agoAdd test for default rustdoc run
Shivani Bhardwaj [Wed, 15 Sep 2021 01:28:59 +0000 (06:58 +0530)]
Add test for default rustdoc run

2 years agoFix `rustdoc` argument error
Shivani Bhardwaj [Fri, 10 Sep 2021 18:35:16 +0000 (00:05 +0530)]
Fix `rustdoc` argument error

2 years agocatch unwind of every iter in parallel mode during wfcheck
SparrowLii [Mon, 27 Jun 2022 08:39:10 +0000 (16:39 +0800)]
catch unwind of every iter in parallel mode during wfcheck

2 years agoprivacy: deny diagnostic migration lints
David Wood [Wed, 22 Jun 2022 13:17:14 +0000 (14:17 +0100)]
privacy: deny diagnostic migration lints

Signed-off-by: David Wood <david.wood@huawei.com>
2 years agoprivacy: port "in public interface" diag
David Wood [Wed, 22 Jun 2022 13:11:39 +0000 (14:11 +0100)]
privacy: port "in public interface" diag

Signed-off-by: David Wood <david.wood@huawei.com>
2 years agoprivacy: port unnamed "item is private" diag
David Wood [Wed, 22 Jun 2022 12:42:30 +0000 (13:42 +0100)]
privacy: port unnamed "item is private" diag

Signed-off-by: David Wood <david.wood@huawei.com>
2 years agoprivacy: port "item is private" diag
David Wood [Wed, 22 Jun 2022 12:31:24 +0000 (13:31 +0100)]
privacy: port "item is private" diag

Signed-off-by: David Wood <david.wood@huawei.com>
2 years agoprivacy: port "field is private" diag
David Wood [Wed, 22 Jun 2022 13:17:34 +0000 (14:17 +0100)]
privacy: port "field is private" diag

Signed-off-by: David Wood <david.wood@huawei.com>
2 years agovarious: add `rustc_lint_diagnostics` to diag fns
David Wood [Wed, 22 Jun 2022 12:24:35 +0000 (13:24 +0100)]
various: add `rustc_lint_diagnostics` to diag fns

The `rustc_lint_diagnostics` attribute is used by the diagnostic
translation/struct migration lints to identify calls where
non-translatable diagnostics or diagnostics outwith impls are being
created. Any function used in creating a diagnostic should be annotated
with this attribute so this commit adds the attribute to many more
functions.

Signed-off-by: David Wood <david.wood@huawei.com>
2 years agolint: fix condition in diagnostic lints
David Wood [Wed, 22 Jun 2022 10:25:10 +0000 (11:25 +0100)]
lint: fix condition in diagnostic lints

Unfortunately, the diagnostic lints are very broken and trigger much
more often than they should. Correct the conditional which checks if the
function call being made is to a diagnostic function so that it returns
in every intended case.

Signed-off-by: David Wood <david.wood@huawei.com>
2 years agoRollup merge of #98561 - Wilfred:patch-4, r=fee1-dead
Matthias Krüger [Mon, 27 Jun 2022 06:06:49 +0000 (08:06 +0200)]
Rollup merge of #98561 - Wilfred:patch-4, r=fee1-dead

Fix spelling in SAFETY comment

"can not" should be "cannot", and add punctuation.

2 years agoRollup merge of #98556 - BlaCoiso:patch-1, r=jyn514
Matthias Krüger [Mon, 27 Jun 2022 06:06:48 +0000 (08:06 +0200)]
Rollup merge of #98556 - BlaCoiso:patch-1, r=jyn514

Fix builds on Windows (closes #98546)

closes https://github.com/rust-lang/rust/issues/98546

2 years agoRollup merge of #98530 - davidkna:known-bug-ref, r=Mark-Simulacrum
Matthias Krüger [Mon, 27 Jun 2022 06:06:47 +0000 (08:06 +0200)]
Rollup merge of #98530 - davidkna:known-bug-ref, r=Mark-Simulacrum

compiletest: add issue number param to `known-bug`

I was getting some errors while testing this, but I'm pretty sure that was unrelated to my changes.

Closes #98436

> Basically, instead of `// known-bug`, do `// known-bug #00000` or maybe `// known-bug chalk#00`?
>
> From: https://rust-lang.zulipchat.com/#narrow/stream/326866-t-types.2Fnominated/topic/.2398095.3A.20NLL.3A.20unsound.20verification.20of.20higher.20ranked.20outlives.E2.80.A6/near/287258738

I also added an `unknown` escape-hatch because I didn't find corresponding issues for every `// known-bug`.

The syntax also ended up being `// known-bug: `, because of `set_name_value_directive`.

2 years agoRollup merge of #97780 - compiler-errors:field-wfcheck-before-sized, r=jackh726
Matthias Krüger [Mon, 27 Jun 2022 06:06:46 +0000 (08:06 +0200)]
Rollup merge of #97780 - compiler-errors:field-wfcheck-before-sized, r=jackh726

Check ADT field is well-formed before checking it is sized

Fixes #96810.

There is one diagnostics regression, in [`src/test/ui/generic-associated-types/bugs/issue-80626.stderr`](https://github.com/rust-lang/rust/pull/97780/files#diff-53795946378e78a0af23a10277c628ff79091c18090fdc385801ee70c1ba6963). I am not super concerned about it, since it's GAT related.
We _could_ fix it, possibly by using the `FieldSized` obligation cause code instead of `BuiltinDerivedObligation`. But that would require changing `Sized` trait confirmation and the `adt_sized_constraint` query.

2 years agoRollup merge of #97389 - m-ou-se:memory-ordering-diagnostics, r=estebank
Matthias Krüger [Mon, 27 Jun 2022 06:06:45 +0000 (08:06 +0200)]
Rollup merge of #97389 - m-ou-se:memory-ordering-diagnostics, r=estebank

Improve memory ordering diagnostics

Before:

![image](https://user-images.githubusercontent.com/783247/170234545-891cac30-eaa2-4186-847b-35cd51e00f2b.png)

After:

![image](https://user-images.githubusercontent.com/783247/170239684-645f186f-5a02-4eb9-8651-2e5fe9591352.png)

---

Before this change, the compiler suggests the failure ordering is too strong and suggests choosing a weaker ordering. After this change, it instead suggests the success ordering is not strong enough, and suggests chosing a stronger one. This is more likely to be correct.

Also, before this change, the compiler suggested downgrading an invalid AcqRel failure ordering to Relaxed, without mentioning Acquire as an option.

2 years agoAuto merge of #98285 - nikic:update-llvm-5, r=cuviper
bors [Mon, 27 Jun 2022 05:36:50 +0000 (05:36 +0000)]
Auto merge of #98285 - nikic:update-llvm-5, r=cuviper

Rebase LLVM submodule

This is a rebase of our LLVM fork onto LLVM 14.0.5, which is intended to be the last release of the 14.x series. Additionally:

 * I've dropped three patches that were needed to build on FreeBSD 11, which is no longer necessary after #97944.
 * I've dropped some cherry-picks that were later reverted.
 * I've cherry-picked https://github.com/llvm/llvm-project/commit/caa2a829cdf905a5e8664d96a464d414b2adb42e for https://github.com/rust-lang/rust/issues/96797 (fyi `@Amanieu)`

2 years agoAuto merge of #98221 - cjgillot:single-coh, r=lcnr
bors [Mon, 27 Jun 2022 02:56:06 +0000 (02:56 +0000)]
Auto merge of #98221 - cjgillot:single-coh, r=lcnr

Perform coherence checking per impl.

r? `@ghost`

2 years agointerpret: refactor allocation info query
Ralf Jung [Mon, 27 Jun 2022 02:49:38 +0000 (22:49 -0400)]
interpret: refactor allocation info query

We now have an infallible function that also tells us which kind of allocation we are talking about.
Also we do longer have to distinguish between data and function allocations for liveness.

2 years agoFix spelling in SAFETY comment
Wilfred Hughes [Mon, 27 Jun 2022 02:17:34 +0000 (19:17 -0700)]
Fix spelling in SAFETY comment

"can not" should be "cannot", and add punctuation.

2 years agoAuto merge of #98212 - petrochenkov:addlinkargs, r=lqd
bors [Mon, 27 Jun 2022 00:27:40 +0000 (00:27 +0000)]
Auto merge of #98212 - petrochenkov:addlinkargs, r=lqd

rustc_target: Add convenience functions for adding linker arguments

They ensure that lld and non-lld linker flavors get the same set of arguments.

The second commit also adds some tests checking for linker argument inconsistencies, and tweaks some arguments to fix those inconsistencies.

2 years agoFix builds on Windows (closes #98546)
BlaCoiso [Sun, 26 Jun 2022 22:27:44 +0000 (23:27 +0100)]
Fix builds on Windows (closes #98546)

2 years agoAuto merge of #98187 - mystor:fast_span_call_site, r=eddyb
bors [Sun, 26 Jun 2022 21:28:24 +0000 (21:28 +0000)]
Auto merge of #98187 - mystor:fast_span_call_site, r=eddyb

proc_macro/bridge: cache static spans in proc_macro's client thread-local state

This is the second part of https://github.com/rust-lang/rust/pull/86822, split off as requested in https://github.com/rust-lang/rust/pull/86822#pullrequestreview-1008655452. This patch removes the RPC calls required for the very common operations of `Span::call_site()`, `Span::def_site()` and `Span::mixed_site()`.

Some notes:

This part is one of the ones I don't love as a final solution from a design standpoint, because I don't like how the spans are serialized immediately at macro invocation. I think a more elegant solution might've been to reserve special IDs for `call_site`, `def_site`, and `mixed_site` at compile time (either starting at 1 or from `u32::MAX`) and making reading a Span handle automatically map these IDs to the relevant values, rather than doing extra serialization.

This would also have an advantage for potential future work to allow `proc_macro` to operate more independently from the compiler (e.g. to reduce the necessity of `proc-macro2`), as methods like `Span::call_site()` could be made to function without access to the compiler backend.

That was unfortunately tricky to do at the time, as this was the first part I wrote of the patches. After the later part (#98188, #98189), the other uses of `InternedStore` are removed meaning that a custom serialization strategy for `Span` is easier to implement.

If we want to go that path, we'll still need the majority of the work to split the bridge object and introduce the `Context` trait for free methods, and it will be easier to do after `Span` is the only user of `InternedStore` (after #98189).

2 years agocompiletest: add issue number param to `known-bug`
David Knaack [Sun, 26 Jun 2022 08:51:23 +0000 (10:51 +0200)]
compiletest: add issue number param to `known-bug`

2 years agoAuto merge of #98545 - matthiaskrgr:rollup-njely29, r=matthiaskrgr
bors [Sun, 26 Jun 2022 19:02:00 +0000 (19:02 +0000)]
Auto merge of #98545 - matthiaskrgr:rollup-njely29, r=matthiaskrgr

Rollup of 11 pull requests

Successful merges:

 - #97140 (std: use an event-flag-based thread parker on SOLID)
 - #97295 ([rustc_parse] Forbid `let`s in certain places)
 - #97743 (make const_err show up in future breakage reports)
 - #97908 (Stabilize NonZero* checked operations constness.)
 - #98297 (Transform help popup into a pocket menu)
 - #98428 (macros: use typed identifiers in diag and subdiag derive)
 - #98528 (Respect --color when building rustbuild itself)
 - #98535 (Add regression test for generic const in rustdoc)
 - #98538 (Add a ui test for issue #91883)
 - #98540 (Add regression test for #87558)
 - #98541 (Update `std::alloc::System` doc example code style)

Failed merges:

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

2 years agoRollup merge of #98541 - Veykril:patch-2, r=Dylan-DPC
Matthias Krüger [Sun, 26 Jun 2022 17:47:09 +0000 (19:47 +0200)]
Rollup merge of #98541 - Veykril:patch-2, r=Dylan-DPC

Update `std::alloc::System` doc example code style

`return` on the last line of a block is unidiomatic so I don't think the example should be using that here

2 years agoRollup merge of #98540 - TaKO8Ki:add-regression-test-for-87558, r=Mark-Simulacrum
Matthias Krüger [Sun, 26 Jun 2022 17:47:08 +0000 (19:47 +0200)]
Rollup merge of #98540 - TaKO8Ki:add-regression-test-for-87558, r=Mark-Simulacrum

Add regression test for #87558

Fixes #87558

2 years agoRollup merge of #98538 - TaKO8Ki:add-test-for-issue-91883, r=Mark-Simulacrum
Matthias Krüger [Sun, 26 Jun 2022 17:47:07 +0000 (19:47 +0200)]
Rollup merge of #98538 - TaKO8Ki:add-test-for-issue-91883, r=Mark-Simulacrum

Add a ui test for issue #91883

closes #91883

2 years agoRollup merge of #98535 - GuillaumeGomez:regression-test-92859, r=lcnr
Matthias Krüger [Sun, 26 Jun 2022 17:47:06 +0000 (19:47 +0200)]
Rollup merge of #98535 - GuillaumeGomez:regression-test-92859, r=lcnr

Add regression test for generic const in rustdoc

Fixes #92859.

r? ```@lcnr```

2 years agoRollup merge of #98528 - jyn514:bootstrap-color, r=Mark-Simulacrum
Matthias Krüger [Sun, 26 Jun 2022 17:47:05 +0000 (19:47 +0200)]
Rollup merge of #98528 - jyn514:bootstrap-color, r=Mark-Simulacrum

Respect --color when building rustbuild itself

Separated out from https://github.com/rust-lang/rust/pull/95503.

2 years agoRollup merge of #98428 - davidtwco:translation-derive-typed-identifiers, r=oli-obk
Matthias Krüger [Sun, 26 Jun 2022 17:47:04 +0000 (19:47 +0200)]
Rollup merge of #98428 - davidtwco:translation-derive-typed-identifiers, r=oli-obk

macros: use typed identifiers in diag and subdiag derive

Using typed identifiers instead of strings with the Fluent identifiers in the diagnostic and subdiagnostic derives - this enables the diagnostic derive to benefit from the compile-time validation that comes with typed identifiers, namely that use of a non-existent Fluent identifier will not compile.

r? `````@oli-obk`````

2 years agoRollup merge of #98297 - GuillaumeGomez:help-pocket-menu, r=notriddle
Matthias Krüger [Sun, 26 Jun 2022 17:47:03 +0000 (19:47 +0200)]
Rollup merge of #98297 - GuillaumeGomez:help-pocket-menu, r=notriddle

Transform help popup into a pocket menu

Just like we moved the settings menu into a "pocket menu", it's doing the same to the help popup.

You can test it [here](https://rustdoc.crud.net/imperio/help-pocket-menu/doc/foo/index.html) and here is a screenshot:

![Screenshot from 2022-06-20 20-58-29](https://user-images.githubusercontent.com/3050060/174663718-538e9d11-3bf9-48b2-8909-f9bfe75af135.png)

r? ``````````@jsha``````````

2 years agoRollup merge of #97908 - iago-lito:stabilize_nonzero_checked_ops_constness, r=scottmcm
Matthias Krüger [Sun, 26 Jun 2022 17:47:02 +0000 (19:47 +0200)]
Rollup merge of #97908 - iago-lito:stabilize_nonzero_checked_ops_constness, r=scottmcm

Stabilize NonZero* checked operations constness.

Partial stabilization for #97547 (continued).

2 years agoRollup merge of #97743 - RalfJung:const-err-future-breakage, r=estebank
Matthias Krüger [Sun, 26 Jun 2022 17:47:01 +0000 (19:47 +0200)]
Rollup merge of #97743 - RalfJung:const-err-future-breakage, r=estebank

make const_err show up in future breakage reports

As tracked in https://github.com/rust-lang/rust/issues/71800, const_err should become a hard error Any Day Now (TM). I'd love to move forward with that sooner rather than later; it has been deny-by-default for many years and a future incompat lint since https://github.com/rust-lang/rust/pull/80394 (landed more than a year ago). Some CTFE errors are already hard errors since https://github.com/rust-lang/rust/pull/86194. But before we truly make it a hard error in all cases, we now have one more intermediate step we can take -- to make it show up in future breakage reports.

Cc `````@rust-lang/wg-const-eval`````

2 years agoRollup merge of #97295 - c410-f3r:yet-another-let-chain, r=compiler-errors
Matthias Krüger [Sun, 26 Jun 2022 17:47:00 +0000 (19:47 +0200)]
Rollup merge of #97295 - c410-f3r:yet-another-let-chain, r=compiler-errors

[rustc_parse] Forbid `let`s in certain places

Currently only forbids in locals to resolve https://github.com/rust-lang/rust/pull/94927#issuecomment-1099605024 but feel free to point any other places.

2 years agoRollup merge of #97140 - joboet:solid_parker, r=m-ou-se
Matthias Krüger [Sun, 26 Jun 2022 17:46:59 +0000 (19:46 +0200)]
Rollup merge of #97140 - joboet:solid_parker, r=m-ou-se

std: use an event-flag-based thread parker on SOLID

`Mutex` and `Condvar` are being replaced by more efficient implementations, which need thread parking themselves (see #93740). Therefore, the generic `Parker` needs to be replaced on all platforms where the new lock implementation will be used, which, after #96393, are SOLID, SGX and Hermit (more PRs coming soon).

SOLID, conforming to the [μITRON specification](http://www.ertl.jp/ITRON/SPEC/FILE/mitron-400e.pdf), has event flags, which are a thread parking primitive very similar to `Parker`. However, they do not make any atomic ordering guarantees (even though those can probably be assumed) and necessitate a system call even when the thread token is already available. Hence, this `Parker`, like the Windows parker, uses an extra atomic state variable.

I future-proofed the code by wrapping the event flag in a `WaitFlag` structure, as both SGX and Hermit can share the Parker implementation, they just have slightly different primitives (SGX uses signals and Hermit has a thread blocking API).

`````@kawadakk````` I assume you are the target maintainer? Could you test this for me?

2 years agoproc_macro: Rename ExpnContext to ExpnGlobals, and unify method on Server trait
Nika Layzell [Sun, 26 Jun 2022 16:48:33 +0000 (12:48 -0400)]
proc_macro: Rename ExpnContext to ExpnGlobals, and unify method on Server trait

2 years agoattempt to optimise vectored write
Conrad Ludgate [Tue, 21 Jun 2022 05:42:25 +0000 (06:42 +0100)]
attempt to optimise vectored write

2 years agoAuto merge of #98190 - nnethercote:optimize-derive-Debug-code, r=scottmcm
bors [Sun, 26 Jun 2022 15:00:04 +0000 (15:00 +0000)]
Auto merge of #98190 - nnethercote:optimize-derive-Debug-code, r=scottmcm

Improve `derive(Debug)`

r? `@ghost`

2 years agoUpdate `std::alloc::System` docs
Lukas Wirth [Sun, 26 Jun 2022 14:31:29 +0000 (16:31 +0200)]
Update `std::alloc::System` docs

2 years agoadd a ui test for issue #91883
Takayuki Maeda [Sun, 26 Jun 2022 13:28:17 +0000 (22:28 +0900)]
add a ui test for issue #91883

2 years agoadd regression test for #87558
Takayuki Maeda [Sun, 26 Jun 2022 13:10:10 +0000 (22:10 +0900)]
add regression test for #87558

2 years agoAuto merge of #98518 - RalfJung:miri, r=RalfJung
bors [Sun, 26 Jun 2022 12:16:10 +0000 (12:16 +0000)]
Auto merge of #98518 - RalfJung:miri, r=RalfJung

update Miri

Fixes https://github.com/rust-lang/rust/issues/98493 (this is a flaky test, that's why the toolstate already says Miri is fixed)
r? `@ghost` Cc `@rust-lang/miri`

2 years agoAdd regression test for #92859
Guillaume Gomez [Sun, 26 Jun 2022 12:01:00 +0000 (14:01 +0200)]
Add regression test for  #92859

2 years agoRespect --color when building rustbuild itself
Joshua Nelson [Sun, 19 Jun 2022 21:19:56 +0000 (16:19 -0500)]
Respect --color when building rustbuild itself

2 years agoUpdate `since` to 1.64 (since we're after 1.63)
scottmcm [Sun, 26 Jun 2022 08:45:53 +0000 (08:45 +0000)]
Update `since` to 1.64 (since we're after 1.63)

2 years agoAuto merge of #98521 - JohnTitor:rollup-tl9sblx, r=JohnTitor
bors [Sun, 26 Jun 2022 07:12:16 +0000 (07:12 +0000)]
Auto merge of #98521 - JohnTitor:rollup-tl9sblx, r=JohnTitor

Rollup of 8 pull requests

Successful merges:

 - #98371 (Fix printing `impl trait` under binders)
 - #98385 (Work around llvm 12's memory ordering restrictions.)
 - #98474 (x.py: Support systems with only `python3` not `python`)
 - #98488 (Bump RLS to latest master on rust-lang/rls)
 - #98491 (Fix backtrace UI test when panic=abort is used)
 - #98502 (Fix source sidebar hover in ayu theme)
 - #98509 (diagnostics: consider parameter count when suggesting smart pointers)
 - #98513 (Fix LLVM rebuild with download-ci-llvm.)

Failed merges:

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

2 years agoRollup merge of #98513 - ehuss:rebuild-llvm-download, r=Mark-Simulacrum
Yuki Okushi [Sun, 26 Jun 2022 04:15:03 +0000 (13:15 +0900)]
Rollup merge of #98513 - ehuss:rebuild-llvm-download, r=Mark-Simulacrum

Fix LLVM rebuild with download-ci-llvm.

This fixes an issue where updating a local checkout that includes a change in `src/version` causes a linking failure.

The cause is that the `rustc_llvm` build script uses `rerun-if-changed` of `llvm-config` to know if it needs to rerun. Cargo only compares the timestamp of the last time the build script to the file. However, extracting the tar files retains the timestamps in the tarball which may be some time in the past. Since `src/version` is included in the LLVM `.so` filename, `rustc` attempts to load the wrong shared library since the `rustc_llvm` build script doesn't rerun.

https://github.com/rust-lang/cargo/issues/10791 contains a more detailed explanation.

The solution here is a hack which updates the timestamp of `llvm-config` to the current time when it is extracted.

This is a bit of a hack, but seems to be the best solution I can think of until https://github.com/rust-lang/cargo/issues/10791 is fixed. There are likely several other situations where this is a problem (such as using system LLVM), and this isn't really a complete fix.

Note that apple platforms are not directly affected by this problem because they don't have a version in the dylib filename.

How to test this:

1. On a linux host, enable download-ci-llvm
2. Check out 7036449c774860a5b348dbbe01c20704c557382e (the commit just before the last version bump)
3. `./x.py build library/std`
4. Check out 5f015a24f99f52ea9b67beb420aff24f82acf1af (the commit that bumped the version)
5. `./x.py build library/std`

Fixes #98495

2 years agoRollup merge of #98509 - rust-lang:notriddle/precise-pin-diag, r=compiler-errors
Yuki Okushi [Sun, 26 Jun 2022 04:15:02 +0000 (13:15 +0900)]
Rollup merge of #98509 - rust-lang:notriddle/precise-pin-diag, r=compiler-errors

diagnostics: consider parameter count when suggesting smart pointers

Fixes #96834

2 years agoRollup merge of #98502 - GuillaumeGomez:source-sidebar-hover, r=notriddle
Yuki Okushi [Sun, 26 Jun 2022 04:15:01 +0000 (13:15 +0900)]
Rollup merge of #98502 - GuillaumeGomez:source-sidebar-hover, r=notriddle

Fix source sidebar hover in ayu theme

In the screenshot below, `rc.rs` should be orange:

![Screenshot from 2022-06-25 22-24-06](https://user-images.githubusercontent.com/3050060/175789532-99e8781d-2e62-43f7-bbd9-1b1151e1f8c1.png)

It's because the CSS selector was not precise enough and was "overloaded" with another one. This PR fixes it and adds a test for the colors in the source sidebar.

cc `@jsha`
r? `@notriddle`

2 years agoRollup merge of #98491 - antoyo:fix/ui-test-backtrace-panic-abort, r=Dylan-DPC
Yuki Okushi [Sun, 26 Jun 2022 04:15:00 +0000 (13:15 +0900)]
Rollup merge of #98491 - antoyo:fix/ui-test-backtrace-panic-abort, r=Dylan-DPC

Fix backtrace UI test when panic=abort is used

The function `contains_verbose_expected` is only used when the panic strategy is not abort, so it caused a warning when it was abort, which made the UI test failed on stderr comparison.

2 years agoRollup merge of #98488 - Mark-Simulacrum:bump-rls, r=pietroalbini
Yuki Okushi [Sun, 26 Jun 2022 04:14:59 +0000 (13:14 +0900)]
Rollup merge of #98488 - Mark-Simulacrum:bump-rls, r=pietroalbini

Bump RLS to latest master on rust-lang/rls

Of primary interest, this merges
rust-lang/rls@ece09b88c0365947af79c0ffdeea02bc6c1eec25 into rust-lang/rust,
which brings in the changes that fix RLS tests broken by #97853. #97853 already
introduced that commit's changes (under
rust-lang/rls@27f4044df03d15c7c38a483c3e4635cf4f51807d) but without putting those changes on
rust-lang/rls as a branch, so we ended up with an orphan commit that caused
trouble when updating submodules in rust-lang/rust.

This commit, once merged into rust-lang/rust, should continue to let RLS tests
to pass on rust-lang/rust's side and move us back into a healthy state where tip
of the submodule points to a valid master commit in the rust-lang/rls
repository.

cc https://github.com/rust-lang/rust/issues/98451, but not marking as fixed as I believe we need to add verification to prevent future oversights.

2 years agoRollup merge of #98474 - dtolnay:python3, r=Mark-Simulacrum
Yuki Okushi [Sun, 26 Jun 2022 04:14:58 +0000 (13:14 +0900)]
Rollup merge of #98474 - dtolnay:python3, r=Mark-Simulacrum

x.py: Support systems with only `python3` not `python`

Fixes #71818 without the pitfalls so far described in previous attempts.

2 years agoRollup merge of #98385 - m-ou-se:llvm-12-memory-order, r=petrochenkov
Yuki Okushi [Sun, 26 Jun 2022 04:14:57 +0000 (13:14 +0900)]
Rollup merge of #98385 - m-ou-se:llvm-12-memory-order, r=petrochenkov

Work around llvm 12's memory ordering restrictions.

Older llvm has the pre-C++17 restriction on success and failure memory ordering, requiring the former to be at least as strong as the latter. So, for llvm 12, this upgrades the success ordering to a stronger one if necessary.

See https://github.com/rust-lang/rust/issues/68464

2 years agoRollup merge of #98371 - compiler-errors:better-opaque-printing, r=oli-obk
Yuki Okushi [Sun, 26 Jun 2022 04:14:56 +0000 (13:14 +0900)]
Rollup merge of #98371 - compiler-errors:better-opaque-printing, r=oli-obk

Fix printing `impl trait` under binders

Before, we would render `impl for<'a> Trait<'a>` like `impl Trait<for<'a> 'a>`, lol.

2 years agoupdate Miri
Ralf Jung [Sun, 26 Jun 2022 02:21:49 +0000 (22:21 -0400)]
update Miri

2 years agoAuto merge of #98140 - klensy:compiletest-strip, r=Mark-Simulacrum
bors [Sun, 26 Jun 2022 00:03:07 +0000 (00:03 +0000)]
Auto merge of #98140 - klensy:compiletest-strip, r=Mark-Simulacrum

compiletest: strip debuginfo by default for mode=ui

This reduces occupied disk space, for example for src/test/ui it drops from 1972mb to 132mb (x86_64-pc-windows-msvc).

Individual tests that require debuginfo/symbols should turn this option off (as in fixed tests).

2 years agoFix LLVM rebuild with download-ci-llvm.
Eric Huss [Sat, 25 Jun 2022 23:49:00 +0000 (16:49 -0700)]
Fix LLVM rebuild with download-ci-llvm.

2 years agodiagnostics: consider parameter count when suggesting smart pointers
Michael Howell [Sat, 25 Jun 2022 22:46:47 +0000 (15:46 -0700)]
diagnostics: consider parameter count when suggesting smart pointers

2 years agoFix span issues in object safety suggestions
Michael Goulet [Sat, 25 Jun 2022 21:59:45 +0000 (14:59 -0700)]
Fix span issues in object safety suggestions

2 years agoAuto merge of #97513 - jyn514:submodule-handling, r=Mark-Simulacrum
bors [Sat, 25 Jun 2022 21:01:10 +0000 (21:01 +0000)]
Auto merge of #97513 - jyn514:submodule-handling, r=Mark-Simulacrum

Fully remove submodule handling from bootstrap.py

These submodules were previously updated in python because Cargo gives a hard error if toml files
are missing from the workspace:

```
error: failed to load manifest for workspace member `/home/jnelson/rust-lang/rust/src/tools/rls`

Caused by:
  failed to read `/home/jnelson/rust-lang/rust/src/tools/rls/Cargo.toml`

Caused by:
  No such file or directory (os error 2)
failed to run: /home/jnelson/rust-lang/rust/build/x86_64-unknown-linux-gnu/stage0/bin/cargo build --manifest-path /home/jnelson/rust-lang/rust/src/bootstrap/Cargo.toml
```

However, bootstrap doesn't actually need to be part of the workspace.
Remove it so we can move submodule handling fully to Rust, avoiding duplicate code between Rust and Python.

Note that this does break `cargo run`; it has to be `cd src/bootstrap && cargo run` now.
Given that we're planning to make the main entrypoint a shell script (or rust binary),
I think this is a good tradeoff for reduced complexity in bootstrap.py.

To get this working, I also had to remove support for vendoring when using the git sources, because `cargo vendor` requires all submodules to be checked out. I think this is ok; people who care about this are likely already using the pre-vendored `rustc-src` tarball.

Fixes https://github.com/rust-lang/rust/issues/90764. Helps with #94829

2 years agoAdd test for source sidebar elements colors
Guillaume Gomez [Sat, 25 Jun 2022 20:22:35 +0000 (22:22 +0200)]
Add test for source sidebar elements colors

2 years agobless after rebase
Ralf Jung [Sat, 25 Jun 2022 13:31:36 +0000 (09:31 -0400)]
bless after rebase

2 years agoFix CSS rule for selected and hovered items in the source sidebar
Guillaume Gomez [Sat, 25 Jun 2022 19:43:54 +0000 (21:43 +0200)]
Fix CSS rule for selected and hovered items in the source sidebar

2 years agorustc_target: Some more tests and fixes for linker arguments
Vadim Petrochenkov [Fri, 17 Jun 2022 20:53:00 +0000 (23:53 +0300)]
rustc_target: Some more tests and fixes for linker arguments

2 years agorustc_target: Add convenience functions for adding linker arguments
Vadim Petrochenkov [Fri, 17 Jun 2022 14:38:42 +0000 (17:38 +0300)]
rustc_target: Add convenience functions for adding linker arguments

They ensure that lld and non-lld linker flavors get the same set of arguments

2 years agoAuto merge of #98412 - calebcartwright:sync-rustfmt, r=calebcartwright
bors [Sat, 25 Jun 2022 18:00:12 +0000 (18:00 +0000)]
Auto merge of #98412 - calebcartwright:sync-rustfmt, r=calebcartwright

Sync rustfmt

We had a bug in the update we made ~1 week ago, so running a somewhat early sync to pull the fix in

2 years agoproc_macro: remove Context trait, and put span methods directly on Server
Nika Layzell [Sat, 25 Jun 2022 16:11:44 +0000 (12:11 -0400)]
proc_macro: remove Context trait, and put span methods directly on Server