]> git.lizzy.rs Git - rust.git/log
rust.git
19 months ago`track_errors` use a delay_span_bug
Boxy [Thu, 17 Nov 2022 21:09:59 +0000 (21:09 +0000)]
`track_errors` use a delay_span_bug

19 months agomake `replaced_with_error` store `ErrorGuaranteed`
Boxy [Thu, 17 Nov 2022 21:03:06 +0000 (21:03 +0000)]
make `replaced_with_error` store `ErrorGuaranteed`

19 months ago`InferCtxt::is_tainted_by_errors` returns `ErrorGuaranteed`
Boxy [Thu, 17 Nov 2022 20:57:45 +0000 (20:57 +0000)]
`InferCtxt::is_tainted_by_errors` returns `ErrorGuaranteed`

19 months agodont unchecked create `ErrorGuaranteed` in `BorrowckErrors`
Boxy [Thu, 17 Nov 2022 20:45:11 +0000 (20:45 +0000)]
dont unchecked create `ErrorGuaranteed` in `BorrowckErrors`

19 months agoRollup merge of #104550 - RalfJung:typo, r=compiler-errors
Matthias Krüger [Fri, 18 Nov 2022 13:13:39 +0000 (14:13 +0100)]
Rollup merge of #104550 - RalfJung:typo, r=compiler-errors

fix a typo

r? `@lcnr`

19 months agoRollup merge of #104516 - notriddle:notriddle/flex-basis-sidebar-width, r=GuillaumeGomez
Matthias Krüger [Fri, 18 Nov 2022 13:13:38 +0000 (14:13 +0100)]
Rollup merge of #104516 - notriddle:notriddle/flex-basis-sidebar-width, r=GuillaumeGomez

rustdoc: clean up sidebar width CSS

This commit takes advantage of the ability to set [flex-basis] to a specific length instead of setting it to `auto` and changing min-/max-width, and setting flex-grow/-shrink both to 0.

This PR should not cause any visual changes.

preview: https://notriddle.com/notriddle-rustdoc-demos/flex-basis-sidebar-width/std/index.html

[flex-basis]: https://developer.mozilla.org/en-US/docs/Web/CSS/flex-basis

19 months agoRollup merge of #104494 - GuillaumeGomez:migrate-gui-test-to-func, r=notriddle
Matthias Krüger [Fri, 18 Nov 2022 13:13:38 +0000 (14:13 +0100)]
Rollup merge of #104494 - GuillaumeGomez:migrate-gui-test-to-func, r=notriddle

Migrate GUI test to use functions

r? `@notriddle`

19 months agoRollup merge of #104006 - flip1995:lang-items-clippy, r=oli-obk
Matthias Krüger [Fri, 18 Nov 2022 13:13:37 +0000 (14:13 +0100)]
Rollup merge of #104006 - flip1995:lang-items-clippy, r=oli-obk

Add variant_name function to `LangItem`

Clippy has an internal lint that checks for the usage of hardcoded def paths and suggests to replace them with a lang or diagnostic item, if possible. This was implemented with a hack, by getting all the variants of the `LangItem` enum and then index into it with the position of the `LangItem` in the `items` list. This is no longer possible, because the `items` list can't be accessed anymore.

Follow up to #103603

cc `@camsteffen`
r? `@oli-obk`

This is blocking the sync between Clippy and Rust. I'm not sure if this is the best solution here, or if I should add a method `items()` to `LanguageItems` and keep the code in Clippy unchanged.

19 months agoRollup merge of #103594 - maniwani:fix-issue-91417, r=thomcc
Matthias Krüger [Fri, 18 Nov 2022 13:13:36 +0000 (14:13 +0100)]
Rollup merge of #103594 - maniwani:fix-issue-91417, r=thomcc

Fix non-associativity of `Instant` math on `aarch64-apple-darwin` targets

This is a duplicate of #94100 (since the original author is unresponsive), which resolves #91417.

On `aarch64-apple-darwin` targets, the internal resolution of `Instant` is lower than that of `Duration`, so math between them becomes non-associative with small-enough durations.

This PR makes this target use the standard Unix implementation (where `Instant` has 1ns resolution), but with `CLOCK_UPTIME_RAW` so it still returns the same values as `mach_absolute_time`[^1].

(Edit: I need someone to confirm that this still works, I do not have access to an M1 device.)

[^1]: https://www.manpagez.com/man/3/clock_gettime/

19 months agoRollup merge of #103405 - chenyukang:yukang/fix-103381-and-if, r=compiler-errors
Matthias Krüger [Fri, 18 Nov 2022 13:13:36 +0000 (14:13 +0100)]
Rollup merge of #103405 - chenyukang:yukang/fix-103381-and-if, r=compiler-errors

Detect incorrect chaining of if and if let conditions and recover

Fixes #103381

19 months agoRollup merge of #103386 - compiler-errors:no-coerceunsized-to-dynstar, r=eholk
Matthias Krüger [Fri, 18 Nov 2022 13:13:35 +0000 (14:13 +0100)]
Rollup merge of #103386 - compiler-errors:no-coerceunsized-to-dynstar, r=eholk

Don't allow `CoerceUnsized` into `dyn*` (except for trait upcasting)

This makes sure we don't accidentally allow coercions like `Box<T>` -> `Box<dyn* Trait>`, or in the case of this ICE, `&T` to `&dyn* Trait`. These coercions don't make sense, at least not via the `CoerceUnsized` trait.

Fixes #102172
Fixes #102429

19 months agoRollup merge of #101162 - rajputrajat:master, r=davidtwco
Matthias Krüger [Fri, 18 Nov 2022 13:13:35 +0000 (14:13 +0100)]
Rollup merge of #101162 - rajputrajat:master, r=davidtwco

Migrate rustc_resolve to use SessionDiagnostic, part # 1

crate a somewhat on larger size, so plz allow some time to get it finished.

19 months agoAuto merge of #104330 - CastilloDel:ast_lowering, r=cjgillot
bors [Fri, 18 Nov 2022 13:12:18 +0000 (13:12 +0000)]
Auto merge of #104330 - CastilloDel:ast_lowering, r=cjgillot

Remove allow(rustc::potential_query_instability) from rustc_ast_lowering

Related to https://github.com/rust-lang/rust/issues/84447.

`@cjgillot` Thanks for helping me!

19 months agoDon't focus on notable trait parent when hiding it
Guillaume Gomez [Fri, 18 Nov 2022 12:36:18 +0000 (13:36 +0100)]
Don't focus on notable trait parent when hiding it

19 months agoRemove Vec/Rc storage reuse opt
clubby789 [Fri, 18 Nov 2022 10:38:51 +0000 (10:38 +0000)]
Remove Vec/Rc storage reuse opt

19 months agoAuto merge of #104555 - matthiaskrgr:rollup-tncyca8, r=matthiaskrgr
bors [Fri, 18 Nov 2022 10:06:28 +0000 (10:06 +0000)]
Auto merge of #104555 - matthiaskrgr:rollup-tncyca8, r=matthiaskrgr

Rollup of 11 pull requests

Successful merges:

 - #103852 (Don't remap early-bound regions for return-position `impl Trait` in trait originating from `impl`)
 - #104366 (Simplify settings theme choice)
 - #104433 (Fix `emit_unused_delims_expr` ICE)
 - #104444 (Fix ICE in in_operand for ty error)
 - #104483 (Convert predicates into Predicate in the Obligation constructor)
 - #104496 (Don't attempt to normalize compiler backtraces)
 - #104503 (rustdoc: remove redundant font-color CSS on `.where`)
 - #104508 (Check `dyn*` return type correctly)
 - #104515 (ICE fixing, remove is_tainted_by_errors since we have ty_error for delay bug)
 - #104532 (Migrate tooltip style to CSS variables)
 - #104545 (Readd the matches_macro diag item)

Failed merges:

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

19 months agocouple of clippy::perf fixes
Matthias Krüger [Fri, 18 Nov 2022 09:30:47 +0000 (10:30 +0100)]
couple of clippy::perf fixes

19 months agoAuto merge of #103179 - ferrocene:pa-run-in-run-make, r=jyn514
bors [Fri, 18 Nov 2022 06:54:37 +0000 (06:54 +0000)]
Auto merge of #103179 - ferrocene:pa-run-in-run-make, r=jyn514

Fix `src/test/run-make/issue-36710` on cross-compiled targets

This PR fixes the `src/test/run-make/issue-36710` test not working on cross-compiled targets by telling the make infra how to run tests remotely with `remote-test-server`.

This PR includes a revert of #102723 (cc `@pcc),` which disabled that test on all cross-compiled targets.

19 months agorustdoc: update tests for enum variant margin tweak
Michael Howell [Thu, 17 Nov 2022 22:35:36 +0000 (15:35 -0700)]
rustdoc: update tests for enum variant margin tweak

19 months agorustdoc: use `code-header` class to format enum variants
Michael Howell [Thu, 17 Nov 2022 22:24:39 +0000 (15:24 -0700)]
rustdoc: use `code-header` class to format enum variants

The font size and weights should be exactly the same after this commit,
but the spacing is changed to be exactly the same as methods.

19 months agoEdit docs for `rustc_errors::Handler::stash_diagnostic`
pierwill [Wed, 16 Nov 2022 18:21:15 +0000 (12:21 -0600)]
Edit docs for `rustc_errors::Handler::stash_diagnostic`

Clarify that the diagnostic can be retrieved with `steal_diagnostic`.

19 months agoRollup merge of #104545 - flip1995:diag_item_matches_macro, r=compiler-errors
Matthias Krüger [Thu, 17 Nov 2022 21:33:22 +0000 (22:33 +0100)]
Rollup merge of #104545 - flip1995:diag_item_matches_macro, r=compiler-errors

Readd the matches_macro diag item

This is now used by Clippy

r? `@compiler-errors`

This was removed in #104383. But in the meantime Clippy now makes use of it https://github.com/rust-lang/rust-clippy/blob/dac600e32fce89cb4b05ae6edb0c47982b99eb48/clippy_lints/src/manual_is_ascii_check.rs#L153

---

This is blocking the Clippy sync. (kinda. I could work around it, but I don't want to play ping-pong with this change.)

19 months agoRollup merge of #104532 - GuillaumeGomez:migrate-tooltip-css, r=notriddle
Matthias Krüger [Thu, 17 Nov 2022 21:33:22 +0000 (22:33 +0100)]
Rollup merge of #104532 - GuillaumeGomez:migrate-tooltip-css, r=notriddle

Migrate tooltip style to CSS variables

19 months agoRollup merge of #104515 - chenyukang:yukang/fix-104510-ice, r=compiler-errors
Matthias Krüger [Thu, 17 Nov 2022 21:33:21 +0000 (22:33 +0100)]
Rollup merge of #104515 - chenyukang:yukang/fix-104510-ice, r=compiler-errors

ICE fixing, remove is_tainted_by_errors since we have ty_error for delay bug

Fixes #104510

19 months agoRollup merge of #104508 - compiler-errors:dyn-return, r=oli-obk
Matthias Krüger [Thu, 17 Nov 2022 21:33:21 +0000 (22:33 +0100)]
Rollup merge of #104508 - compiler-errors:dyn-return, r=oli-obk

Check `dyn*` return type correctly

In `check_fn`, if the declared return type is `dyn Trait`, then we check the return type separately to produce better diagnostics, because this is never valid -- however, when `dyn*` was introduced, this check was never adjusted to only account for *unsized* `dyn Trait` and not *sized* `dyn* Trait`.

Fixes #104501

19 months agoRollup merge of #104503 - notriddle:notriddle/where, r=GuillaumeGomez
Matthias Krüger [Thu, 17 Nov 2022 21:33:20 +0000 (22:33 +0100)]
Rollup merge of #104503 - notriddle:notriddle/where, r=GuillaumeGomez

rustdoc: remove redundant font-color CSS on `.where`

Before 7f6ce7dddd49f453da15bb4d586a5990985814d8, light-theme where clauses had color `#4E4C4C` while the main color was `#000`. One of that commit's simplifications made it so that everything used the same black.

19 months agoRollup merge of #104496 - djkoloski:dont_normalize_compiler_backtraces, r=jackh726
Matthias Krüger [Thu, 17 Nov 2022 21:33:20 +0000 (22:33 +0100)]
Rollup merge of #104496 - djkoloski:dont_normalize_compiler_backtraces, r=jackh726

Don't attempt to normalize compiler backtraces

Backtraces can very significantly depending on environment and cause spurious test suite failures. Ensuring a proper failure-status should be sufficient to keep a crash properly documented.

This caused a failure in Fuchsia's test suite CI due to an extra newline between "stack" and "error" appearing after normalization.

cc ````@jackh726````
r? ````@tmandry````

19 months agoRollup merge of #104483 - oli-obk:santa-clauses-make-goals, r=compiler-errors
Matthias Krüger [Thu, 17 Nov 2022 21:33:19 +0000 (22:33 +0100)]
Rollup merge of #104483 - oli-obk:santa-clauses-make-goals, r=compiler-errors

Convert predicates into Predicate in the Obligation constructor

instead of having almost all callers do that.

This reduces a bit of boilerplate, and also paves the way for my work towards https://github.com/rust-lang/compiler-team/issues/531 (as it makes it easier to accept both goals and clauses where right now it only accepts predicates).

19 months agoRollup merge of #104444 - chenyukang:yukang/fix-104390, r=compiler-errors
Matthias Krüger [Thu, 17 Nov 2022 21:33:19 +0000 (22:33 +0100)]
Rollup merge of #104444 - chenyukang:yukang/fix-104390, r=compiler-errors

Fix ICE in in_operand for ty error

Fixes #104390

By the way, moving some test cases to proper directory for tidy bless.

19 months agoRollup merge of #104433 - TaKO8Ki:fix-104392, r=estebank
Matthias Krüger [Thu, 17 Nov 2022 21:33:18 +0000 (22:33 +0100)]
Rollup merge of #104433 - TaKO8Ki:fix-104392, r=estebank

Fix `emit_unused_delims_expr` ICE

Fixes #104392

19 months agoRollup merge of #104366 - GuillaumeGomez:simplify-settings-theme-choice, r=notriddle
Matthias Krüger [Thu, 17 Nov 2022 21:33:18 +0000 (22:33 +0100)]
Rollup merge of #104366 - GuillaumeGomez:simplify-settings-theme-choice, r=notriddle

Simplify settings theme choice

I removed the storage changes from https://github.com/rust-lang/rust/pull/98765 and only kept the UI changes.

You can test it [here](https://rustdoc.crud.net/imperio/simplify-settings-theme-choice/foo/index.html).

Discussion about this still in progress [on zulip](https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/Last.20part.20of.20settings.20simplification).

r? ````@notriddle````

19 months agoRollup merge of #103852 - compiler-errors:rpitit-early-from-impl, r=lcnr
Matthias Krüger [Thu, 17 Nov 2022 21:33:17 +0000 (22:33 +0100)]
Rollup merge of #103852 - compiler-errors:rpitit-early-from-impl, r=lcnr

Don't remap early-bound regions for return-position `impl Trait` in trait originating from `impl`

long title :sweat:

We don't want to remap early-bound regions that originate from the `impl`s themselves, since they have no corresponding region in the trait. Not sure if there's a better condition than checking if the EBR's def-id's parent is the impl -- maybe we should be checking if the region comes from the method or RPITIT... :shrug:

r? types

Fixes #103850

19 months agoImprove accuracy of asinh and acosh
Max Willsey [Thu, 17 Nov 2022 20:50:33 +0000 (12:50 -0800)]
Improve accuracy of asinh and acosh

19 months agofix a typo
Ralf Jung [Thu, 17 Nov 2022 20:13:23 +0000 (21:13 +0100)]
fix a typo

19 months agoMigrate GUI test to use functions
Guillaume Gomez [Wed, 16 Nov 2022 16:36:43 +0000 (17:36 +0100)]
Migrate GUI test to use functions

19 months agoAdd variant_name function to `LangItem`
Philipp Krones [Sat, 5 Nov 2022 14:08:37 +0000 (15:08 +0100)]
Add variant_name function to `LangItem`

Clippy has an internal lint that checks for the usage of hardcoded def
paths and suggests to replace them with a lang or diagnostic item, if
possible. This was implemented with a hack, by getting all the variants
of the `LangItem` enum and then index into it with the position of the
`LangItem` in the `items` list. This is no longer possible, because the
`items` list can't be accessed anymore.

19 months agoReadd the matches_macro diag item
Philipp Krones [Thu, 17 Nov 2022 18:32:28 +0000 (19:32 +0100)]
Readd the matches_macro diag item

This is now used by Clippy

19 months agoAuto merge of #104361 - vladimir-ea:watchos_fix_linking, r=oli-obk
bors [Thu, 17 Nov 2022 17:15:31 +0000 (17:15 +0000)]
Auto merge of #104361 - vladimir-ea:watchos_fix_linking, r=oli-obk

[watchos] Dynamic linking is not allowed for watchos targets

Dynamic linking of all apple targets was (re-) enabled in PR #100636. However, dynamic linking is not allowed on WatchOS so this broke the build of standard library for WatchOS.

This change disables dynamic linking for WatchOS non-simulator targets.

19 months agodetect () to avoid redundant <> suggestion for type
Yiming Lei [Wed, 16 Nov 2022 18:13:51 +0000 (10:13 -0800)]
detect () to avoid redundant <> suggestion for type
fix #104379

19 months agoExtend codeblock GUI test to include tooltips
Guillaume Gomez [Thu, 17 Nov 2022 13:31:50 +0000 (14:31 +0100)]
Extend codeblock GUI test to include tooltips

19 months agoMigrate tooltip style to CSS variables
Guillaume Gomez [Thu, 17 Nov 2022 13:31:34 +0000 (14:31 +0100)]
Migrate tooltip style to CSS variables

19 months agoAuto merge of #104219 - bryangarza:async-track-caller-dup, r=eholk
bors [Thu, 17 Nov 2022 13:47:03 +0000 (13:47 +0000)]
Auto merge of #104219 - bryangarza:async-track-caller-dup, r=eholk

Support `#[track_caller]` on async fns

Adds `#[track_caller]` to the generator that is created when we desugar the async fn.

Fixes #78840

Open questions:
- What is the performance impact of adding `#[track_caller]` to every `GenFuture`'s `poll(...)` function, even if it's unused (i.e., the parent span does not set `#[track_caller]`)? We might need to set it only conditionally, if the indirection causes overhead we don't want.

20 months agoProperly link `{Once,Lazy}{Cell,Lock}` in docs
Maybe Waffle [Thu, 17 Nov 2022 10:44:12 +0000 (10:44 +0000)]
Properly link `{Once,Lazy}{Cell,Lock}` in docs

20 months agoAuto merge of #104205 - clubby789:grow-rc, r=thomcc
bors [Thu, 17 Nov 2022 10:48:22 +0000 (10:48 +0000)]
Auto merge of #104205 - clubby789:grow-rc, r=thomcc

Attempt to reuse `Vec<T>` backing storage for `Rc/Arc<[T]>`

If a `Vec<T>` has sufficient capacity to store the inner `RcBox<[T]>`, we can just reuse the existing allocation and shift the elements up, instead of making a new allocation.

20 months agoUse custom entry name in cranelift
Ayush Singh [Thu, 17 Nov 2022 09:29:32 +0000 (14:59 +0530)]
Use custom entry name in cranelift

This is a continuation of 9f0a8620bd7d325e6d42417b08daff3e55cb88f6 for
cranelift.

Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
20 months agofmt
Pietro Albini [Thu, 17 Nov 2022 08:56:59 +0000 (09:56 +0100)]
fmt

20 months agorun tests on the remote device even when the default address is used
Pietro Albini [Thu, 3 Nov 2022 15:04:07 +0000 (16:04 +0100)]
run tests on the remote device even when the default address is used

When running tests inside the Android emulator, bootstrap doesn't set
the TEST_DEVICE_ADDR environment variable, as the default address
(127.0.0.1:12345) is used.

Instead, REMOTE_TEST_CLIENT is set all the times when remote testing is
needed, and in no other cases. To ensure Android tests are executed in
the emulator, change the check.

20 months agoset correct default value for cc and cxx on android
Pietro Albini [Thu, 3 Nov 2022 14:01:39 +0000 (15:01 +0100)]
set correct default value for cc and cxx on android

20 months agoinstall the target g++ in armhf-gnu
Pietro Albini [Tue, 25 Oct 2022 08:26:34 +0000 (10:26 +0200)]
install the target g++ in armhf-gnu

20 months agoissue-36710 test can now run on cross-compiled targets
Pietro Albini [Tue, 18 Oct 2022 07:48:55 +0000 (09:48 +0200)]
issue-36710 test can now run on cross-compiled targets

20 months agoRevert "test: run-make: skip when cross-compiling"
Pietro Albini [Tue, 18 Oct 2022 07:47:55 +0000 (09:47 +0200)]
Revert "test: run-make: skip when cross-compiling"

This reverts commit 0567fec8e47f83ddda623f93deccddddd3f6744f.

20 months agoadd support for running binaries with remote-test-client on run-make
Pietro Albini [Mon, 26 Sep 2022 10:59:22 +0000 (12:59 +0200)]
add support for running binaries with remote-test-client on run-make

20 months agotry_normalize_after_erasing_regions: promote an assertion to always run
Ralf Jung [Thu, 17 Nov 2022 08:06:15 +0000 (09:06 +0100)]
try_normalize_after_erasing_regions: promote an assertion to always run

20 months agoAuto merge of #104170 - cjgillot:hir-def-id, r=fee1-dead
bors [Thu, 17 Nov 2022 07:42:27 +0000 (07:42 +0000)]
Auto merge of #104170 - cjgillot:hir-def-id, r=fee1-dead

Record `LocalDefId` in HIR nodes instead of a side table

This is part of an attempt to remove the `HirId -> LocalDefId` table from HIR.
This attempt is a prerequisite to creation of `LocalDefId` after HIR lowering (https://github.com/rust-lang/rust/pull/96840), by controlling how `def_id` information is accessed.

This first part adds the information to HIR nodes themselves instead of a table.
The second part is https://github.com/rust-lang/rust/pull/103902
The third part will be to make `hir::Visitor::visit_fn` take a `LocalDefId` as last parameter.
The fourth part will be to completely remove the side table.

20 months agorustdoc: clean up sidebar width CSS
Michael Howell [Thu, 17 Nov 2022 05:52:30 +0000 (22:52 -0700)]
rustdoc: clean up sidebar width CSS

This commit takes advantage of the ability to set [flex-basis] to a specific
length instead of setting it to `auto` and changing min-/max-width, and
setting flex-grow/-shrink both to 0.

[flex-basis]: https://developer.mozilla.org/en-US/docs/Web/CSS/flex-basis

20 months agoAuto merge of #103779 - the8472:simd-str-contains, r=thomcc
bors [Thu, 17 Nov 2022 04:47:11 +0000 (04:47 +0000)]
Auto merge of #103779 - the8472:simd-str-contains, r=thomcc

x86_64 SSE2 fast-path for str.contains(&str) and short needles

Based on Wojciech Muła's [SIMD-friendly algorithms for substring searching](http://0x80.pl/articles/simd-strfind.html#sse-avx2)

The two-way algorithm is Big-O efficient but it needs to preprocess the needle
to find a "critical factorization" of it. This additional work is significant
for short needles. Additionally it mostly advances needle.len() bytes at a time.

The SIMD-based approach used here on the other hand can advance based on its
vector width, which can exceed the needle length. Except for pathological cases,
but due to being limited to small needles the worst case blowup is also small.

benchmarks taken on a Zen2, compiled with `-Ccodegen-units=1`:

```
OLD:
test str::bench_contains_16b_in_long                     ... bench:         504 ns/iter (+/- 14) = 5061 MB/s
test str::bench_contains_2b_repeated_long                ... bench:         948 ns/iter (+/- 175) = 2690 MB/s
test str::bench_contains_32b_in_long                     ... bench:         445 ns/iter (+/- 6) = 5732 MB/s
test str::bench_contains_bad_naive                       ... bench:         130 ns/iter (+/- 1) = 569 MB/s
test str::bench_contains_bad_simd                        ... bench:          84 ns/iter (+/- 8) = 880 MB/s
test str::bench_contains_equal                           ... bench:         142 ns/iter (+/- 7) = 394 MB/s
test str::bench_contains_short_long                      ... bench:         677 ns/iter (+/- 25) = 3768 MB/s
test str::bench_contains_short_short                     ... bench:          27 ns/iter (+/- 2) = 2074 MB/s

NEW:
test str::bench_contains_16b_in_long                     ... bench:          82 ns/iter (+/- 0) = 31109 MB/s
test str::bench_contains_2b_repeated_long                ... bench:          73 ns/iter (+/- 0) = 34945 MB/s
test str::bench_contains_32b_in_long                     ... bench:          71 ns/iter (+/- 1) = 35929 MB/s
test str::bench_contains_bad_naive                       ... bench:           7 ns/iter (+/- 0) = 10571 MB/s
test str::bench_contains_bad_simd                        ... bench:          97 ns/iter (+/- 41) = 762 MB/s
test str::bench_contains_equal                           ... bench:           4 ns/iter (+/- 0) = 14000 MB/s
test str::bench_contains_short_long                      ... bench:          73 ns/iter (+/- 0) = 34945 MB/s
test str::bench_contains_short_short                     ... bench:          12 ns/iter (+/- 0) = 4666 MB/s
```

20 months agoUse `ThinVec` in `ast::Path`.
Nicholas Nethercote [Thu, 8 Sep 2022 07:22:52 +0000 (17:22 +1000)]
Use `ThinVec` in `ast::Path`.

20 months agoBox `ExprKind::{Closure,MethodCall}`, and `QSelf` in expressions, types, and patterns.
Nicholas Nethercote [Thu, 8 Sep 2022 00:52:51 +0000 (10:52 +1000)]
Box `ExprKind::{Closure,MethodCall}`, and `QSelf` in expressions, types, and patterns.

20 months agoAuto merge of #103138 - nnethercote:merge-BBs, r=bjorn3
bors [Thu, 17 Nov 2022 01:56:24 +0000 (01:56 +0000)]
Auto merge of #103138 - nnethercote:merge-BBs, r=bjorn3

Merge basic blocks where possible when generating LLVM IR.

r? `@ghost`

20 months agoIgnore the unchecked-shifts codegen test in debug-assertions builds
Scott McMurray [Wed, 16 Nov 2022 23:58:43 +0000 (15:58 -0800)]
Ignore the unchecked-shifts codegen test in debug-assertions builds

20 months agoAuto merge of #102944 - nnethercote:ast-Lit-third-time-lucky, r=petrochenkov
bors [Wed, 16 Nov 2022 23:03:14 +0000 (23:03 +0000)]
Auto merge of #102944 - nnethercote:ast-Lit-third-time-lucky, r=petrochenkov

Use `token::Lit` in `ast::ExprKind::Lit`.

Instead of `ast::Lit`.

Literal lowering now happens at two different times. Expression literals are lowered when HIR is crated. Attribute literals are lowered during parsing.

r? `@petrochenkov`

20 months agoCheck `dyn*` return type correctly
Michael Goulet [Wed, 16 Nov 2022 22:21:41 +0000 (22:21 +0000)]
Check `dyn*` return type correctly

20 months agorustdoc: remove redundant font-color CSS on `.where`
Michael Howell [Wed, 16 Nov 2022 20:28:51 +0000 (13:28 -0700)]
rustdoc: remove redundant font-color CSS on `.where`

Before 7f6ce7dddd49f453da15bb4d586a5990985814d8, light-theme where clauses
had color `#4E4C4C` while the main color was `#000`. One of that commit's
simplifications made it so that everything used the same black.

20 months agoAuto merge of #104456 - RalfJung:miri, r=RalfJung
bors [Wed, 16 Nov 2022 19:52:45 +0000 (19:52 +0000)]
Auto merge of #104456 - RalfJung:miri, r=RalfJung

update Miri

Not a huge sync, but there was a conflict and [josh](https://github.com/josh-project/josh/) seems to prefer those to be merged back ASAP.

20 months agoDon't attempt to normalize compiler backtraces
David Koloski [Wed, 16 Nov 2022 17:35:30 +0000 (12:35 -0500)]
Don't attempt to normalize compiler backtraces

Backtraces can very significantly depending on environment and cause
test suite failures spuriously. Ensuring a proper failure-status should
be sufficient to keep a crash properly documented.

20 months agoAuto merge of #104492 - matthiaskrgr:rollup-3xyjynz, r=matthiaskrgr
bors [Wed, 16 Nov 2022 15:55:30 +0000 (15:55 +0000)]
Auto merge of #104492 - matthiaskrgr:rollup-3xyjynz, r=matthiaskrgr

Rollup of 8 pull requests

Successful merges:

 - #103750 (Fix some misleading target feature aliases)
 - #104137 (Issue error when -C link-self-contained option is used on unsupported platforms)
 - #104317 (cleanup and dedupe CTFE and Miri error reporting)
 - #104335 (Only do parser recovery on retried macro matching)
 - #104394 (various cleanups to try to reduce the use of spans inside method resolution)
 - #104459 (rustdoc: remove unused JS IIFE from main.js)
 - #104462 (rustdoc: remove pointless CSS `.rightside { padding-right: 2px }`)
 - #104466 (rustdoc: remove no-op CSS `#crate-search-div { display: inline-block }`)

Failed merges:

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

20 months agoensure rand has its default features enabled
Ralf Jung [Wed, 16 Nov 2022 15:13:55 +0000 (16:13 +0100)]
ensure rand has its default features enabled

20 months agoRollup merge of #104466 - notriddle:notriddle/crate-search-div-display, r=GuillaumeGomez
Matthias Krüger [Wed, 16 Nov 2022 14:39:48 +0000 (15:39 +0100)]
Rollup merge of #104466 - notriddle:notriddle/crate-search-div-display, r=GuillaumeGomez

rustdoc: remove no-op CSS `#crate-search-div { display: inline-block }`

`#crate-search-div` is nested directly below `.search-results-title`, which has `display: inline-flex`. This makes the crate-search-div a [flex item], which makes its display property irrelevant, because flex items have their display [blockified] in any case.

[flex item]: https://developer.mozilla.org/en-US/docs/Glossary/Flex_Item
[blockified]: https://www.w3.org/TR/css-flexbox-1/#flex-items

20 months agoRollup merge of #104462 - notriddle:notriddle/rightside-padding-right, r=GuillaumeGomez
Matthias Krüger [Wed, 16 Nov 2022 14:39:47 +0000 (15:39 +0100)]
Rollup merge of #104462 - notriddle:notriddle/rightside-padding-right, r=GuillaumeGomez

rustdoc: remove pointless CSS `.rightside { padding-right: 2px }`

This CSS was added in 34bd2b845b3acd84c5a9bddae3ff8081c19ec5e9, as `.since { padding-right: 2px }`, to prevent it from uncomfortably touching the srclink, which were separate floated elements. It was carried forward with 962c0a4ee59e3c1a2413e785694c9433ffd0a9e1 to the new `.rightside`, but its role was replaced with adding " &bull; " between them. All it does now is pushes the element 2px away from the page's right margin.

Removing this rule changes the page layout, but you have to look for it to notice it.

20 months agoRollup merge of #104459 - notriddle:notriddle/main-js-iife, r=GuillaumeGomez
Matthias Krüger [Wed, 16 Nov 2022 14:39:47 +0000 (15:39 +0100)]
Rollup merge of #104459 - notriddle:notriddle/main-js-iife, r=GuillaumeGomez

rustdoc: remove unused JS IIFE from main.js

This [IIFE] made sense when it was added in f0683f98fa114cc4f9e795031f44be3eebb65790 and there was a local variable scoped to it, but now it only sets two globals, so it does nothing.

[IIFE]: https://developer.mozilla.org/en-US/docs/Glossary/IIFE "immediately invoked function expression"

20 months agoRollup merge of #104394 - oli-obk:suggest_method_call, r=lcnr
Matthias Krüger [Wed, 16 Nov 2022 14:39:46 +0000 (15:39 +0100)]
Rollup merge of #104394 - oli-obk:suggest_method_call, r=lcnr

various cleanups to try to reduce the use of spans inside method resolution

definitely review commit by commit.

20 months agoRollup merge of #104335 - Nilstrieb:macrowo, r=compiler-errors
Matthias Krüger [Wed, 16 Nov 2022 14:39:46 +0000 (15:39 +0100)]
Rollup merge of #104335 - Nilstrieb:macrowo, r=compiler-errors

Only do parser recovery on retried macro matching

Eager parser recovery can break macros, so we don't do it at first. But when we already know that the macro failed, we can retry it with recovery enabled to still emit useful diagnostics.

Helps with #103534

20 months agoRollup merge of #104317 - RalfJung:ctfe-error-reporting, r=oli-obk
Matthias Krüger [Wed, 16 Nov 2022 14:39:45 +0000 (15:39 +0100)]
Rollup merge of #104317 - RalfJung:ctfe-error-reporting, r=oli-obk

cleanup and dedupe CTFE and Miri error reporting

It looks like most of the time, this error raised from const_prop_lint is just redundant -- it duplicates the error reported when evaluating the const-eval query. This lets us make `ConstEvalErr` private to the const_eval module which I think is a good step.

The Miri change mostly replaces a `match` by `if let`, and dedupes the "this error is impossible in Miri" checks.

r? ``@oli-obk``
Fixes https://github.com/rust-lang/rust/issues/75461

20 months agoRollup merge of #104137 - StackDoubleFlow:err-lsc-unsupported, r=bjorn3
Matthias Krüger [Wed, 16 Nov 2022 14:39:45 +0000 (15:39 +0100)]
Rollup merge of #104137 - StackDoubleFlow:err-lsc-unsupported, r=bjorn3

Issue error when -C link-self-contained option is used on unsupported platforms

The documentation was also updated to reflect this.

I'm assuming the supported platforms are the same as initially written in [RELEASES.md](https://github.com/rust-lang/rust/blob/master/RELEASES.md#compiler-17).

Fixes #103576

20 months agoRollup merge of #103750 - calebzulawski:master, r=workingjubilee
Matthias Krüger [Wed, 16 Nov 2022 14:39:44 +0000 (15:39 +0100)]
Rollup merge of #103750 - calebzulawski:master, r=workingjubilee

Fix some misleading target feature aliases

This is the first half of a fix for #100752.  It looks like these aliases were added in #78361 and slipped under the radar, as these features are not AVX512.  These features _do_ add AVX512 instructions when used _in combination_ with AVX512F, but without AVX512F, these features still provide 128-bit and 256-bit vector instructions.  A user might be mislead into thinking these features imply AVX512F (which is true of the actual AVX512 features).  This PR allows using the names as defined by LLVM, which matches Intel documentation.

A future PR should change the `std::arch` intrinsics to use these names, and finally remove these aliases from rustc.

r? ```@workingjubilee```

cc ```@Amanieu```

20 months agofix #104510, Remove is_tainted_by_errors since we have ty_error for delay bug
yukang [Wed, 16 Nov 2022 11:40:35 +0000 (19:40 +0800)]
fix #104510, Remove is_tainted_by_errors since we have ty_error for delay bug

20 months agoAuto merge of #104481 - matthiaskrgr:rollup-hf8rev0, r=matthiaskrgr
bors [Wed, 16 Nov 2022 10:27:24 +0000 (10:27 +0000)]
Auto merge of #104481 - matthiaskrgr:rollup-hf8rev0, r=matthiaskrgr

Rollup of 10 pull requests

Successful merges:

 - #103484 (Add `rust` to `let_underscore_lock` example)
 - #103489 (Make `pointer::byte_offset_from` more generic)
 - #104193 (Shift no characters when using raw string literals)
 - #104348 (Respect visibility & stability of inherent associated types)
 - #104401 (avoid memory leak in mpsc test)
 - #104419 (Fix test/ui/issues/issue-30490.rs)
 - #104424 (rustdoc: remove no-op CSS `.popover { font-size: 1rem }`)
 - #104425 (rustdoc: remove no-op CSS `.main-header { justify-content }`)
 - #104450 (Fuchsia test suite script fix)
 - #104471 (Update PROBLEMATIC_CONSTS in style.rs)

Failed merges:

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

20 months agofix #104390, fix ICE in in_operand for ty error
yukang [Tue, 15 Nov 2022 05:20:55 +0000 (13:20 +0800)]
fix #104390, fix ICE in in_operand for ty error

20 months agoConvert predicates into Predicate in the Obligation constructor
Oli Scherer [Wed, 9 Nov 2022 10:49:28 +0000 (10:49 +0000)]
Convert predicates into Predicate in the Obligation constructor

20 months agoGeneralize the `ToPredicate` trait
Oli Scherer [Wed, 20 Jul 2022 10:56:57 +0000 (10:56 +0000)]
Generalize the `ToPredicate` trait

Its name is now not accurate anymore, but we'll adjust that later

20 months agocleanup and dedupe CTFE and Miri error reporting
Ralf Jung [Tue, 15 Nov 2022 11:06:20 +0000 (12:06 +0100)]
cleanup and dedupe CTFE and Miri error reporting

20 months agonormalize download-rustc's prefix when running compiletests
Pietro Albini [Wed, 16 Nov 2022 09:07:42 +0000 (10:07 +0100)]
normalize download-rustc's prefix when running compiletests

20 months agonormalize source paths from sysroot in compiletest
Pietro Albini [Fri, 4 Nov 2022 11:58:07 +0000 (12:58 +0100)]
normalize source paths from sysroot in compiletest

20 months agoRollup merge of #104471 - scruss:patch-1, r=jyn514
Matthias Krüger [Wed, 16 Nov 2022 07:36:14 +0000 (08:36 +0100)]
Rollup merge of #104471 - scruss:patch-1, r=jyn514

Update PROBLEMATIC_CONSTS in style.rs

added 3735932941, since 3735927486 was already present.

20 months agoRollup merge of #104450 - andrewpollack:fix-fuchsia-compiler-docs, r=tmandry
Matthias Krüger [Wed, 16 Nov 2022 07:36:14 +0000 (08:36 +0100)]
Rollup merge of #104450 - andrewpollack:fix-fuchsia-compiler-docs, r=tmandry

Fuchsia test suite script fix

Fixing error from https://github.com/rust-lang/rust/pull/103842#discussion_r1022178201

r? ```@tmandry```

20 months agoRollup merge of #104425 - notriddle:notriddle/main-heading-justify-content, r=Guillau...
Matthias Krüger [Wed, 16 Nov 2022 07:36:13 +0000 (08:36 +0100)]
Rollup merge of #104425 - notriddle:notriddle/main-heading-justify-content, r=GuillaumeGomez

rustdoc: remove no-op CSS `.main-header { justify-content }`

This rule was added in 152e8889052adaaa6c12652486292be34059713c to push the out-of-band content to the right while allowing it to line wrap when it got too big. The idea was that the justification rule would fill the space between the `<h1>` element and the `<div class="out-of-band">` element.

A later commit, 3cb03cb34247383ffb67a017ae70134741e8c4da, flattened the in-band element into the `<h1>`, copying the `flex-grow` rule. This means the `<h1>` element now grows to fill the space, so there's no need to justify-content any more.

This commit also adds a test case for this.

20 months agoRollup merge of #104424 - notriddle:notriddle/popover-font-size, r=GuillaumeGomez
Matthias Krüger [Wed, 16 Nov 2022 07:36:13 +0000 (08:36 +0100)]
Rollup merge of #104424 - notriddle:notriddle/popover-font-size, r=GuillaumeGomez

rustdoc: remove no-op CSS `.popover { font-size: 1rem }`

This rule was added in cc4f804829ae because the help popover inherited the font-size from the help button "?" icon.

It doesn't inherit this any more, because it was moved from being nested inside the link to sharing a wrapper DIV with it.

20 months agoRollup merge of #104419 - Ayush1325:test-issue-30490, r=lcnr
Matthias Krüger [Wed, 16 Nov 2022 07:36:12 +0000 (08:36 +0100)]
Rollup merge of #104419 - Ayush1325:test-issue-30490, r=lcnr

Fix test/ui/issues/issue-30490.rs

Since the empty main is used for `not(unix)`, all the targets that will use this empty main will also need `allow(unused_imports)`.

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

Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
20 months agoRollup merge of #104401 - RalfJung:mpsc-leak, r=Amanieu
Matthias Krüger [Wed, 16 Nov 2022 07:36:12 +0000 (08:36 +0100)]
Rollup merge of #104401 - RalfJung:mpsc-leak, r=Amanieu

avoid memory leak in mpsc test

r? ```@Amanieu```

20 months agoRollup merge of #104348 - fmease:iat-vis-stab, r=cjgillot
Matthias Krüger [Wed, 16 Nov 2022 07:36:11 +0000 (08:36 +0100)]
Rollup merge of #104348 - fmease:iat-vis-stab, r=cjgillot

Respect visibility & stability of inherent associated types

As discussed in #103621, this probably won't be the final location of the code that resolves inherent associated types. Still, I think it's valuable to push correctness fixes for this feature (in regards to visibility and stability).

Let me know if I should write a translatable diagnostic instead and if I should move the tests to `privacy/` and `stability-attribute/` respectively.

Fixes #104243.
````@rustbot```` label A-visibility F-inherent_associated_types
r? ````@cjgillot```` (since you reviewed #103621, feel free to reroll though)

20 months agoRollup merge of #104193 - TaKO8Ki:fix-104142, r=cjgillot
Matthias Krüger [Wed, 16 Nov 2022 07:36:11 +0000 (08:36 +0100)]
Rollup merge of #104193 - TaKO8Ki:fix-104142, r=cjgillot

Shift no characters when using raw string literals

Fixes #104142

Given the following code:

```rust
fn main() {
    println!(r#"\'\'\'\'\'\'\'\'\'\'\'\'\'\'}"#);
}
```

The current output is:

```
error: invalid format string: unmatched `}` found
 --> src/main.rs:2:59
  |
2 |     println!(r#"\'\'\'\'\'\'\'\'\'\'\'\'\'\'}"#); //~ ERROR invalid format string: unmatched `}` found
  |                                                           ^ unmatched `}` in format string
  |
  = note: if you intended to print `}`, you can escape it using `}}`

error: could not compile `debug_playground` due to previous error
```

The output should look like:

```
error: invalid format string: unmatched `}` found
 --> src/main.rs:2:45
  |
2 |     println!(r#"\'\'\'\'\'\'\'\'\'\'\'\'\'\'}"#); //~ ERROR invalid format string: unmatched `}` found
  |                                             ^ unmatched `}` in format string
  |
  = note: if you intended to print `}`, you can escape it using `}}`

error: could not compile `debug_playground` due to previous error
```

This pull request fixes the wrong span for `invalid format string` error and also solves the ICE.

20 months agoRollup merge of #103489 - WaffleLapkin:byte_offset_from_you, r=scottmcm
Matthias Krüger [Wed, 16 Nov 2022 07:36:10 +0000 (08:36 +0100)]
Rollup merge of #103489 - WaffleLapkin:byte_offset_from_you, r=scottmcm

Make `pointer::byte_offset_from` more generic

As suggested by https://github.com/rust-lang/rust/issues/96283#issuecomment-1288792955 (cc ````@scottmcm),```` make `pointer::byte_offset_from` work on pointers of different types. `byte_offset_from` really doesn't care about pointer types, so this is totally fine and, for example, allows patterns like this:
```rust
ptr::addr_of!(x.b).byte_offset_from(ptr::addr_of!(x))
```

The only possible downside is that this removes the `T` == `U` hint to inference, but I don't think this matter much. I don't think there are a lot of cases where you'd want to use `byte_offset_from` with a pointer of unbounded type (and in such cases you can just specify the type).

````@rustbot```` label +T-libs-api

20 months agoRollup merge of #103484 - saschanaz:patch-2, r=ehuss
Matthias Krüger [Wed, 16 Nov 2022 07:36:10 +0000 (08:36 +0100)]
Rollup merge of #103484 - saschanaz:patch-2, r=ehuss

Add `rust` to `let_underscore_lock` example

Currently https://doc.rust-lang.org/beta/rustc/lints/listing/deny-by-default.html#let-underscore-lock has no colored grammar and raw `{{produces}}` command is exposed.

20 months agoallow fastrand dependency
Ralf Jung [Wed, 16 Nov 2022 07:30:41 +0000 (08:30 +0100)]
allow fastrand dependency

20 months agoAuto merge of #102935 - ajtribick:display-float-0.5-fixed-0, r=scottmcm
bors [Wed, 16 Nov 2022 07:20:30 +0000 (07:20 +0000)]
Auto merge of #102935 - ajtribick:display-float-0.5-fixed-0, r=scottmcm

Fix inconsistent rounding of 0.5 when formatted to 0 decimal places

As described in #70336, when displaying values to zero decimal places the value of 0.5 is rounded to 1, which is inconsistent with the display of other half-integer values which round to even.

From testing the flt2dec implementation, it looks like this comes down to the condition in the fixed-width Dragon implementation where an empty buffer is treated as a case to apply rounding up. I believe the change below fixes it and updates only the relevant tests.

Nevertheless I am aware this is very much a core piece of functionality, so please take a very careful look to make sure I haven't missed anything. I hope this change does not break anything in the wider ecosystem as having a consistent rounding behaviour in floating point formatting is in my opinion a useful feature to have.

Resolves #70336

20 months agoMerge basic blocks where possible when generating LLVM IR.
Nicholas Nethercote [Sun, 16 Oct 2022 21:29:40 +0000 (08:29 +1100)]
Merge basic blocks where possible when generating LLVM IR.

In `codegen_assert_terminator` we decide if a BB's successor is a
candidate for merging, which requires that it be the only successor, and
that it only have one predecessor. That result then gets passed down,
and if it reaches `funclet_br` with the appropriate BB characteristics,
then no `br` instruction is issued, a `MergingSucc::True` result is
passed back, and the merging proceeds in `codegen_block`.

The commit also adds `CachedLlbb`, a new type to help keep track of
each BB that has been merged into its predecessor.

20 months agoUse `&mut Bx` more.
Nicholas Nethercote [Wed, 9 Nov 2022 00:04:10 +0000 (11:04 +1100)]
Use `&mut Bx` more.

For the next commit, `FunctionCx::codegen_*_terminator` need to take a
`&mut Bx` instead of consuming a `Bx`. This triggers a cascade of
similar changes across multiple functions. The resulting code is more
concise and replaces many `&mut bx` expressions with `bx`.

20 months agoAuto merge of #104468 - weihanglo:update-cargo, r=weihanglo
bors [Wed, 16 Nov 2022 03:23:42 +0000 (03:23 +0000)]
Auto merge of #104468 - weihanglo:update-cargo, r=weihanglo

Update cargo

5 commits in a3dfea71ca0c888a88111086898aa833c291d497..16b097879b6f117c8ae698aab054c87f26ff325e 2022-11-11 03:50:47 +0000 to 2022-11-14 23:28:16 +0000
- improve error message for cargo add/remove (rust-lang/cargo#11375)
- Bump crate versions of `cargo-util` and `crates-io` (rust-lang/cargo#11369)
- doc(changelog): suggestions of cargo fix are nightly only (rust-lang/cargo#11373)
- Add warning when PATH env separator is in project path (rust-lang/cargo#11318)
- Fix git2 safe-directory disable (rust-lang/cargo#11366)

r? `@ghost`

20 months agoUpdate PROBLEMATIC_CONSTS in style.rs
Stewart Russell [Wed, 16 Nov 2022 02:19:47 +0000 (21:19 -0500)]
Update PROBLEMATIC_CONSTS in style.rs

added 3735932941, since 3735927486 was already present.

20 months agoDon't duplicate last cdb debuginfo test command
Eric Huss [Wed, 16 Nov 2022 01:04:20 +0000 (17:04 -0800)]
Don't duplicate last cdb debuginfo test command