]> git.lizzy.rs Git - rust.git/log
rust.git
19 months agoUpdate compiler_builtins to 0.1.84
Nicholas Bishop [Fri, 18 Nov 2022 03:11:39 +0000 (22:11 -0500)]
Update compiler_builtins to 0.1.84

19 months agoAuto merge of #104571 - clubby789:remove-vec-rc-opt, r=the8472
bors [Sat, 19 Nov 2022 12:44:57 +0000 (12:44 +0000)]
Auto merge of #104571 - clubby789:remove-vec-rc-opt, r=the8472

Revert Vec/Rc storage reuse opt

Remove the optimization for using storage added by #104205.
The perf wins were pretty small, and it relies on non-guarenteed behaviour. On platforms that don't implement shrinking in place, the performance will be significantly worse.

While it could be gated to platforms that do this (such as GNU), I don't think it's worth the overhead of maintaining it for very small gains. (#104565, #104563)

cc `@RalfJung` `@matthiaskrgr`

Fixes #104565
Fixes #104563

19 months agoAuto merge of #103509 - compiler-errors:opaques-w-bound-vars-r-hard, r=oli-obk
bors [Sat, 19 Nov 2022 09:30:35 +0000 (09:30 +0000)]
Auto merge of #103509 - compiler-errors:opaques-w-bound-vars-r-hard, r=oli-obk

Revert "Normalize opaques with escaping bound vars"

This caused a perf regression in #103423, cc `@skyzh` this should fix #103423.

reverts #100980

r? `@oli-obk`

19 months agoAuto merge of #104600 - Dylan-DPC:rollup-glw1e8b, r=Dylan-DPC
bors [Sat, 19 Nov 2022 06:40:38 +0000 (06:40 +0000)]
Auto merge of #104600 - Dylan-DPC:rollup-glw1e8b, r=Dylan-DPC

Rollup of 8 pull requests

Successful merges:

 - #104001 (Improve generating Custom entry function)
 - #104411 (nll: correctly deal with bivariance)
 - #104528 (Properly link `{Once,Lazy}{Cell,Lock}` in docs)
 - #104553 (Improve accuracy of asinh and acosh)
 - #104554 (Use `ErrorGuaranteed::unchecked_claim_error_was_emitted` less)
 - #104566 (couple of clippy::perf fixes)
 - #104575 (deduplicate tests)
 - #104580 (diagnostics: only show one suggestion for method -> assoc fn)

Failed merges:

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

19 months agoRollup merge of #104580 - notriddle:notriddle/issue-102354-hide-sugg, r=compiler...
Dylan DPC [Sat, 19 Nov 2022 06:24:47 +0000 (11:54 +0530)]
Rollup merge of #104580 - notriddle:notriddle/issue-102354-hide-sugg, r=compiler-errors

diagnostics: only show one suggestion for method -> assoc fn

Fixes #102354

19 months agoRollup merge of #104575 - lcnr:dedup-tests, r=jackh726
Dylan DPC [Sat, 19 Nov 2022 06:24:46 +0000 (11:54 +0530)]
Rollup merge of #104575 - lcnr:dedup-tests, r=jackh726

deduplicate tests

originally added in #100514. Using revisions for this reduces the amount of tests in the repo

19 months agoRollup merge of #104566 - matthiaskrgr:clippy_perf_nov18, r=oli-obk
Dylan DPC [Sat, 19 Nov 2022 06:24:46 +0000 (11:54 +0530)]
Rollup merge of #104566 - matthiaskrgr:clippy_perf_nov18, r=oli-obk

couple of clippy::perf fixes

19 months agoRollup merge of #104554 - BoxyUwU:less_unchecked_pls, r=lcnr
Dylan DPC [Sat, 19 Nov 2022 06:24:45 +0000 (11:54 +0530)]
Rollup merge of #104554 - BoxyUwU:less_unchecked_pls, r=lcnr

Use `ErrorGuaranteed::unchecked_claim_error_was_emitted` less

there are only like 3 or 4 call sites left after this but it wasnt obvious to me how to remove them

19 months agoRollup merge of #104553 - mwillsey:asinh-acosh-accuracy, r=thomcc
Dylan DPC [Sat, 19 Nov 2022 06:24:45 +0000 (11:54 +0530)]
Rollup merge of #104553 - mwillsey:asinh-acosh-accuracy, r=thomcc

Improve accuracy of asinh and acosh

This PR addresses the inaccuracy of `asinh` and `acosh` identified by the [Herbie](http://herbie.uwplse.org/) tool, `@pavpanchekha,` `@finnbear` in #104548. It also adds a couple tests that failed in the existing implementations and now pass.

Closes #104548

r? rust-lang/libs

19 months agoRollup merge of #104528 - WaffleLapkin:lazy_lock_docfix, r=matklad
Dylan DPC [Sat, 19 Nov 2022 06:24:44 +0000 (11:54 +0530)]
Rollup merge of #104528 - WaffleLapkin:lazy_lock_docfix, r=matklad

Properly link `{Once,Lazy}{Cell,Lock}` in docs

See https://github.com/rust-lang/rust/issues/74465#issuecomment-1317947443

19 months agoRollup merge of #104411 - lcnr:bivariance-nll, r=compiler-errors
Dylan DPC [Sat, 19 Nov 2022 06:24:44 +0000 (11:54 +0530)]
Rollup merge of #104411 - lcnr:bivariance-nll, r=compiler-errors

nll: correctly deal with bivariance

fixes #104409

when in a bivariant context, relating stuff should always trivially succeed. Also changes the mir validator to correctly deal with higher ranked regions.

r? types cc ``@RalfJung``

19 months agoRollup merge of #104001 - Ayush1325:custom-entry, r=bjorn3
Dylan DPC [Sat, 19 Nov 2022 06:24:43 +0000 (11:54 +0530)]
Rollup merge of #104001 - Ayush1325:custom-entry, r=bjorn3

Improve generating Custom entry function

This commit is aimed at making compiler-generated entry functions (Basically just C `main` right now) more generic so other targets can do similar things for custom entry. This was initially implemented as part of https://github.com/rust-lang/rust/pull/100316.

Currently, this moves the entry function name and Call convention to the target spec.

Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
19 months agoAuto merge of #97870 - eggyal:inplace_fold_spec, r=wesleywiser
bors [Sat, 19 Nov 2022 02:28:47 +0000 (02:28 +0000)]
Auto merge of #97870 - eggyal:inplace_fold_spec, r=wesleywiser

Use liballoc's specialised in-place vec collection

liballoc already specialises in-place vector collection, so manually
reimplementing it in `IdFunctor::try_map_id` was superfluous.

19 months agoAuto merge of #104591 - Manishearth:rollup-b3ser4e, r=Manishearth
bors [Fri, 18 Nov 2022 23:20:53 +0000 (23:20 +0000)]
Auto merge of #104591 - Manishearth:rollup-b3ser4e, r=Manishearth

Rollup of 8 pull requests

Successful merges:

 - #102977 (remove HRTB from `[T]::is_sorted_by{,_key}`)
 - #103378 (Fix mod_inv termination for the last iteration)
 - #103456 (`unchecked_{shl|shr}` should use `u32` as the RHS)
 - #103701 (Simplify some pointer method implementations)
 - #104047 (Diagnostics `icu4x` based list formatting.)
 - #104338 (Enforce that `dyn*` coercions are actually pointer-sized)
 - #104498 (Edit docs for `rustc_errors::Handler::stash_diagnostic`)
 - #104556 (rustdoc: use `code-header` class to format enum variants)

Failed merges:

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

19 months agoRollup merge of #104556 - notriddle:notriddle/variant, r=GuillaumeGomez
Manish Goregaokar [Fri, 18 Nov 2022 22:48:19 +0000 (17:48 -0500)]
Rollup merge of #104556 - notriddle:notriddle/variant, r=GuillaumeGomez

rustdoc: use `code-header` class to format enum variants

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

Preview: http://notriddle.com/notriddle-rustdoc-demos/variant/test_dingus_enum/enum.TestEnum.html

19 months agoRollup merge of #104498 - pierwill:stash-diag-docs, r=compiler-errors
Manish Goregaokar [Fri, 18 Nov 2022 22:48:19 +0000 (17:48 -0500)]
Rollup merge of #104498 - pierwill:stash-diag-docs, r=compiler-errors

Edit docs for `rustc_errors::Handler::stash_diagnostic`

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

r? ```@compiler-errors```

19 months agoRollup merge of #104338 - compiler-errors:pointer-sized, r=eholk
Manish Goregaokar [Fri, 18 Nov 2022 22:48:18 +0000 (17:48 -0500)]
Rollup merge of #104338 - compiler-errors:pointer-sized, r=eholk

Enforce that `dyn*` coercions are actually pointer-sized

Implement a perma-unstable, rudimentary `PointerSized` trait to enforce `dyn*` casts are `usize`-sized for now, at least to prevent ICEs and weird codegen issues from cropping up after monomorphization since currently we enforce *nothing*.

This probably can/should be removed in favor of a more sophisticated trait for handling `dyn*` conversions when we decide on one, but I just want to get something up for discussion and experimentation for now.

r? ```@eholk``` cc ```@tmandry``` (though feel free to claim/reassign)

Fixes #102141
Fixes #102173

19 months agoRollup merge of #104047 - crlf0710:icu_based_list_formatting, r=davidtwco
Manish Goregaokar [Fri, 18 Nov 2022 22:48:17 +0000 (17:48 -0500)]
Rollup merge of #104047 - crlf0710:icu_based_list_formatting, r=davidtwco

Diagnostics `icu4x` based list formatting.

This adds a new kind of `DiagnosticArg` and add the ability to convert it to a `FluentValue::Custom`. When emitting fluent output, it makes use of `ListFormatter` from `icu4x` project to convert it to localized version of list following the fluent locale, as a kind of eager translation.

Tested locally with locales like `en`, `ja`, etc, and they work fine. <del>Though neither `zh-CN` nor `zh-Hans` works correctly, it seems they fallback to `und` locale somehow, emitting only comma-based list. I believe this is an internal issue of `icu4x` itself.</del>(Works fine after https://github.com/rust-lang/rust/pull/104047#issuecomment-1304860940)

Would love to hear what others think.

r? `@davidtwco`
cc `@Manishearth`

19 months agoRollup merge of #103701 - WaffleLapkin:__points-at-implementation__--this-can-be...
Manish Goregaokar [Fri, 18 Nov 2022 22:48:17 +0000 (17:48 -0500)]
Rollup merge of #103701 - WaffleLapkin:__points-at-implementation__--this-can-be-simplified, r=scottmcm

Simplify some pointer method implementations

- Make `pointer::with_metadata_of` const (+simplify implementation) (cc #75091)
- Simplify implementation of various pointer methods

r? ```@scottmcm```

----

`from_raw_parts::<T>(this, metadata(self))` was annoying me for a while and I've finally figured out how it should _actually_ be done.

19 months agoRollup merge of #103456 - scottmcm:fix-unchecked-shifts, r=scottmcm
Manish Goregaokar [Fri, 18 Nov 2022 22:48:17 +0000 (17:48 -0500)]
Rollup merge of #103456 - scottmcm:fix-unchecked-shifts, r=scottmcm

`unchecked_{shl|shr}` should use `u32` as the RHS

The other shift methods, such as https://doc.rust-lang.org/nightly/std/primitive.u64.html#method.checked_shr and https://doc.rust-lang.org/nightly/std/primitive.i16.html#method.wrapping_shl, use `u32` for the shift amount.  That's consistent with other things, like `count_ones`, which also always use `u32` for a bit count, regardless of the size of the type.

This PR changes `unchecked_shl` and `unchecked_shr` to also use `u32` for the shift amount (rather than Self).

cc #85122, the `unchecked_math` tracking issue

19 months agoRollup merge of #103378 - nagisa:fix-infinite-offset, r=scottmcm
Manish Goregaokar [Fri, 18 Nov 2022 22:48:16 +0000 (17:48 -0500)]
Rollup merge of #103378 - nagisa:fix-infinite-offset, r=scottmcm

Fix mod_inv termination for the last iteration

On usize=u64 platforms, the 4th iteration would overflow the `mod_gate` back to 0. Similarly for usize=u32 platforms, the 3rd iteration would overflow much the same way.

I tested various approaches to resolving this, including approaches with `saturating_mul` and `widening_mul` to a double usize. Turns out LLVM likes `mul_with_overflow` the best. In fact now, that LLVM can see the iteration count is limited, it will happily unroll the loop into a nice linear sequence.

You will also notice that the code around the loop got simplified somewhat. Now that LLVM is handling the loop nicely, there isn’t any more reasons to manually unroll the first iteration out of the loop (though looking at the code today I’m not sure all that complexity was necessary in the first place).

Fixes #103361

19 months agoRollup merge of #102977 - lukas-code:is-sorted-hrtb, r=m-ou-se
Manish Goregaokar [Fri, 18 Nov 2022 22:48:16 +0000 (17:48 -0500)]
Rollup merge of #102977 - lukas-code:is-sorted-hrtb, r=m-ou-se

remove HRTB from `[T]::is_sorted_by{,_key}`

Changes the signature of `[T]::is_sorted_by{,_key}` to match `[T]::binary_search_by{,_key}` and make code like https://github.com/rust-lang/rust/issues/53485#issuecomment-885393452 compile.

Tracking issue: https://github.com/rust-lang/rust/issues/53485

~~Do we need an ACP for something like this?~~ Edit: Filed ACP here: https://github.com/rust-lang/libs-team/issues/121

19 months agoFix lockfile
Manish Goregaokar [Fri, 18 Nov 2022 22:46:52 +0000 (14:46 -0800)]
Fix lockfile

19 months agoUpdate crate documentation of `rustc_baked_icu_data` crate
Charles Lew [Tue, 15 Nov 2022 18:37:00 +0000 (02:37 +0800)]
Update crate documentation of `rustc_baked_icu_data` crate

19 months agoFix compilation issue after rebase
Charles Lew [Sat, 12 Nov 2022 10:50:57 +0000 (18:50 +0800)]
Fix compilation issue after rebase

19 months agoInclude `zh` locale in icu data
Charles Lew [Sun, 6 Nov 2022 17:34:22 +0000 (01:34 +0800)]
Include `zh` locale in icu data

19 months agoEnable icu sync feature for parallel compiler
Charles Lew [Sun, 6 Nov 2022 17:25:48 +0000 (01:25 +0800)]
Enable icu sync feature for parallel compiler

19 months agoImport icu locale fallback data
Charles Lew [Sun, 6 Nov 2022 06:58:22 +0000 (14:58 +0800)]
Import icu locale fallback data

19 months agoMigrate diagnostics list output to use icu list formatter.
Charles Lew [Sun, 6 Nov 2022 06:43:25 +0000 (14:43 +0800)]
Migrate diagnostics list output to use icu list formatter.

19 months agoAdd `rustc_baked_icu_data` crate.
Charles Lew [Sat, 5 Nov 2022 05:09:13 +0000 (13:09 +0800)]
Add `rustc_baked_icu_data` crate.

19 months agoAuto merge of #104573 - matthiaskrgr:rollup-k36ybtp, r=matthiaskrgr
bors [Fri, 18 Nov 2022 20:26:58 +0000 (20:26 +0000)]
Auto merge of #104573 - matthiaskrgr:rollup-k36ybtp, r=matthiaskrgr

Rollup of 8 pull requests

Successful merges:

 - #101162 (Migrate rustc_resolve to use SessionDiagnostic, part # 1)
 - #103386 (Don't allow `CoerceUnsized` into `dyn*` (except for trait upcasting))
 - #103405 (Detect incorrect chaining of if and if let conditions and recover)
 - #103594 (Fix non-associativity of `Instant` math on `aarch64-apple-darwin` targets)
 - #104006 (Add variant_name function to `LangItem`)
 - #104494 (Migrate GUI test to use functions)
 - #104516 (rustdoc: clean up sidebar width CSS)
 - #104550 (fix a typo)

Failed merges:

 - #104554 (Use `ErrorGuaranteed::unchecked_claim_error_was_emitted` less)

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

19 months agoOnly enforce ABI-mandated align, not preferred align is compatible
Michael Goulet [Wed, 16 Nov 2022 04:29:41 +0000 (04:29 +0000)]
Only enforce ABI-mandated align, not preferred align is compatible

19 months agoCheck both align and size in PointerSized
Michael Goulet [Tue, 15 Nov 2022 22:26:28 +0000 (22:26 +0000)]
Check both align and size in PointerSized

19 months agoEnforce that dyn* casts are actually pointer-sized
Michael Goulet [Sat, 12 Nov 2022 22:27:18 +0000 (22:27 +0000)]
Enforce that dyn* casts are actually pointer-sized

19 months agoDelete miri test
Michael Goulet [Fri, 18 Nov 2022 18:06:32 +0000 (18:06 +0000)]
Delete miri test

19 months agoAdd test
Michael Goulet [Tue, 25 Oct 2022 02:11:24 +0000 (02:11 +0000)]
Add test

19 months agoRevert "Normalize opaques with escaping bound vars"
Michael Goulet [Mon, 24 Oct 2022 19:39:19 +0000 (19:39 +0000)]
Revert "Normalize opaques with escaping bound vars"

This reverts commit 43119d643857efc366bfca527ac2dadfc3f2e906.

19 months agodiagnostics: only show one suggestion for method -> assoc fn
Michael Howell [Fri, 18 Nov 2022 17:39:26 +0000 (10:39 -0700)]
diagnostics: only show one suggestion for method -> assoc fn

Fixes #102354

19 months agoAuto merge of #101562 - nnethercote:shrink-ast-Expr-harder, r=petrochenkov
bors [Fri, 18 Nov 2022 16:56:12 +0000 (16:56 +0000)]
Auto merge of #101562 - nnethercote:shrink-ast-Expr-harder, r=petrochenkov

Shrink `ast::Expr` harder

r? `@ghost`

19 months agodeduplicate tests
lcnr [Fri, 18 Nov 2022 13:51:24 +0000 (14:51 +0100)]
deduplicate tests

19 months agoreview comments 2 electric boogalo
Boxy [Fri, 18 Nov 2022 13:45:42 +0000 (13:45 +0000)]
review comments 2 electric boogalo

19 months agorequire an `ErrorGuaranteed` to taint infcx with errors
Boxy [Fri, 18 Nov 2022 11:30:21 +0000 (11:30 +0000)]
require an `ErrorGuaranteed` to taint infcx with errors

19 months agorename `is_tainted_by_errors`
Boxy [Fri, 18 Nov 2022 10:25:32 +0000 (10:25 +0000)]
rename `is_tainted_by_errors`

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 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 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.

19 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

19 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.

19 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>
19 months agofmt
Pietro Albini [Thu, 17 Nov 2022 08:56:59 +0000 (09:56 +0100)]
fmt

19 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.

19 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

19 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

19 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

19 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.

19 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

19 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.

19 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

19 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
```

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

19 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.

19 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`

19 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