]> git.lizzy.rs Git - rust.git/log
rust.git
22 months agoRollup merge of #101367 - compiler-errors:suggest-copied-or-cloned, r=lcnr
Dylan DPC [Mon, 5 Sep 2022 08:45:51 +0000 (14:15 +0530)]
Rollup merge of #101367 - compiler-errors:suggest-copied-or-cloned, r=lcnr

Suggest `{Option,Result}::{copied,clone}()` to satisfy type mismatch

Fixes #100699, but in the opposite direction (instead of suggesting to fix the signature, it fixes the body)

22 months agoRollup merge of #101142 - nnethercote:improve-hir-stats, r=davidtwco
Dylan DPC [Mon, 5 Sep 2022 08:45:51 +0000 (14:15 +0530)]
Rollup merge of #101142 - nnethercote:improve-hir-stats, r=davidtwco

Improve HIR stats

#100398 improve the AST stats collection done by `-Zhir-stats`. This PR does the same for HIR stats collection.

r? `@davidtwco`

22 months agoAuto merge of #101386 - aDotInTheVoid:rdj-discriminant, r=GuillaumeGomez
bors [Mon, 5 Sep 2022 04:16:08 +0000 (04:16 +0000)]
Auto merge of #101386 - aDotInTheVoid:rdj-discriminant, r=GuillaumeGomez

Rustdoc-Json: Add enum discriminant

Does the first part of #101337, by adding it to `clean`, but doesn't change HTML output, as

1. [No Consensus has appeared on the UI for this](https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/Enum.20discriminant.20values.20in.20HTML.20output)
2. [When inlining across crates, information is lost](https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/.60clean_variant_def.20.60vs.20.60clean_variant_data.60)

JSON doesn't have either of these limitations.

r? `@GuillaumeGomez`

22 months agoAuto merge of #100759 - fee1-dead-contrib:const_eval_select_real_intrinsic, r=oli...
bors [Mon, 5 Sep 2022 01:35:01 +0000 (01:35 +0000)]
Auto merge of #100759 - fee1-dead-contrib:const_eval_select_real_intrinsic, r=oli-obk,RalfJung

Make `const_eval_select` a real intrinsic

This fixes issues where `track_caller` functions do not have nice panic
messages anymore when there is a call to the function, and uses the
MIR system to replace the call instead of dispatching via lang items.

Fixes #100696.

22 months agoAuto merge of #100576 - joboet:movable_const_remutex, r=Mark-Simulacrum
bors [Sun, 4 Sep 2022 22:53:58 +0000 (22:53 +0000)]
Auto merge of #100576 - joboet:movable_const_remutex, r=Mark-Simulacrum

Make `ReentrantMutex` movable and `const`

As `MovableMutex` is now `const`, it can be used to simplify the implementation and interface of the internal reentrant mutex type. Consequently, the standard error stream does not need to be wrapped in `OnceLock` and `OnceLock::get_or_init_pin()` can be removed.

22 months agoAuto merge of #93455 - asquared31415:vec-zero-opts, r=thomcc
bors [Sun, 4 Sep 2022 20:33:50 +0000 (20:33 +0000)]
Auto merge of #93455 - asquared31415:vec-zero-opts, r=thomcc

Implement internal `IsZero` for Wrapping and Saturating for `Vec` optimizations

This implements the `IsZero` trait for the `Wrapping` and `Saturating` types so that users of these types can get the improved performance from the specialization of creating a `Vec` from a single element repeated when it has a zero bit pattern (example `vec![0_i32; 500]`, or after this PR `vec![Wrapping(0_i32); 500]`)

CC #60978

22 months agoAuto merge of #101411 - matthiaskrgr:rollup-uj24yb5, r=matthiaskrgr
bors [Sun, 4 Sep 2022 18:10:04 +0000 (18:10 +0000)]
Auto merge of #101411 - matthiaskrgr:rollup-uj24yb5, r=matthiaskrgr

Rollup of 7 pull requests

Successful merges:

 - #101322 (Fix internal doc link)
 - #101385 (updated description of File struct in std::fs)
 - #101388 (Don't delay invalid LHS bug unless it will be covered by an error in `check_overloaded_binop`)
 - #101394 (Forbid mixing `System` with direct sytem allocator calls)
 - #101397 (rustdoc: remove redundant mobile-sized `.source nav:not(.sidebar).sub`)
 - #101401 (Make `char::is_lowercase` and `char::is_uppercase` const)
 - #101407 (Remove duplicated test (superseeded by search-form-elements.goml))

Failed merges:

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

22 months agoRollup merge of #101407 - GuillaumeGomez:rm-duplicated-gui-test, r=Dylan-DPC
Matthias Krüger [Sun, 4 Sep 2022 16:55:50 +0000 (18:55 +0200)]
Rollup merge of #101407 - GuillaumeGomez:rm-duplicated-gui-test, r=Dylan-DPC

Remove duplicated test (superseeded by search-form-elements.goml)

I realized it when I worked on https://github.com/rust-lang/rust/pull/101348. The checks are more complete in `search-form-elements.goml` (for example [here](https://github.com/rust-lang/rust/blob/master/src/test/rustdoc-gui/search-form-elements.goml#L12-L29)).

r? `@Dylan-DPC`

22 months agoRollup merge of #101401 - mx00s:expand-const, r=fee1-dead
Matthias Krüger [Sun, 4 Sep 2022 16:55:48 +0000 (18:55 +0200)]
Rollup merge of #101401 - mx00s:expand-const, r=fee1-dead

Make `char::is_lowercase` and `char::is_uppercase` const

Implements #101400.

22 months agoRollup merge of #101397 - notriddle:notriddle/source-nav-not-sidebar-sub, r=Guillaume...
Matthias Krüger [Sun, 4 Sep 2022 16:55:47 +0000 (18:55 +0200)]
Rollup merge of #101397 - notriddle:notriddle/source-nav-not-sidebar-sub, r=GuillaumeGomez

rustdoc: remove redundant mobile-sized `.source nav:not(.sidebar).sub`

It's redundant because there's already a selector `.source nav.sub` with exactly the same margin-left at [line 796].

[line 796]: https://github.com/rust-lang/rust/blob/84f0c3f79a85329dd79a54694ff8a7f427c842e9/src/librustdoc/html/static/css/rustdoc.css#L796

This selector was added in 1e98fb10274ea0245f865ddb1e295e454382000b, along with an identical desktop selector, but that desktop selector was removed in 6a5f8b1aef1417d7dc85b5d0a229d2db1930eb7c as part of a larger simplification.

22 months agoRollup merge of #101394 - CAD97:patch-3, r=Mark-Simulacrum
Matthias Krüger [Sun, 4 Sep 2022 16:55:46 +0000 (18:55 +0200)]
Rollup merge of #101394 - CAD97:patch-3, r=Mark-Simulacrum

Forbid mixing `System` with direct sytem allocator calls

e.g. [on windows](https://github.com/rust-lang/rust/blob/dec689432fac6720b2f18101ac28a21add98b1b8/library/std/src/sys/windows/alloc.rs#L129-L178), trying to mix `System::alloc` and `HeapFree` will not work because of the extra work done to serve higher alignments.

22 months agoRollup merge of #101388 - compiler-errors:issue-101376, r=fee1-dead
Matthias Krüger [Sun, 4 Sep 2022 16:55:45 +0000 (18:55 +0200)]
Rollup merge of #101388 - compiler-errors:issue-101376, r=fee1-dead

Don't delay invalid LHS bug unless it will be covered by an error in `check_overloaded_binop`

Fixes #101376

22 months agoRollup merge of #101385 - BartMassey-upstream:file-doc, r=thomcc
Matthias Krüger [Sun, 4 Sep 2022 16:55:43 +0000 (18:55 +0200)]
Rollup merge of #101385 - BartMassey-upstream:file-doc, r=thomcc

updated description of File struct in std::fs

I've seen several folks confused by the description of `std::fs::File` as "A reference to an open file on the filesystem." Apparently the word `reference` is sometimes taken to mean a Rust `&` reference, leading to confusion. Here's a recent representative [Reddit thread](https://www.reddit.com/r/rust/comments/x4k0lv/comment/imxu7v2/?utm_source=share&utm_medium=web2x&context=3), but I've seen this before as well.

This patch changes the description to "An object providing access to an open file on the filesystem." Hopefully this is clearer.

22 months agoRollup merge of #101322 - ChrisDenton:internal-doc, r=Mark-Simulacrum
Matthias Krüger [Sun, 4 Sep 2022 16:55:42 +0000 (18:55 +0200)]
Rollup merge of #101322 - ChrisDenton:internal-doc, r=Mark-Simulacrum

Fix internal doc link

The doc link from `DedupSortedIter` to `BTreeMap::bulk_build_from_sorted_iter` was broken when building internal documentation,

This prevented me from building internal documentation locally:

```
R:\Rust\rust> $env:RUSTDOCFLAGS="--document-private-items"
R:\Rust\rust> x doc library/std --open --stage 0
Building rustbuild
   Compiling bootstrap v0.0.0 (R:\Rust\rust\src\bootstrap)
    Finished dev [unoptimized] target(s) in 3.15s
Documenting stage0 std (x86_64-pc-windows-msvc)
 Documenting core v0.0.0 (R:\Rust\rust\library\core)
    Finished release [optimized] target(s) in 36.42s
    Checking core v0.0.0 (R:\Rust\rust\library\core)
    Checking rustc-std-workspace-core v1.99.0 (R:\Rust\rust\library\rustc-std-workspace-core)
    Checking compiler_builtins v0.1.79
 Documenting alloc v0.0.0 (R:\Rust\rust\library\alloc)
error: unresolved link to `BTreeMap::bulk_build_from_sorted_iter`
 --> library\alloc\src\collections\btree\dedup_sorted_iter.rs:6:15
  |
6 | /// Used by [`BTreeMap::bulk_build_from_sorted_iter`].
  |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no item named `BTreeMap` in scope
  |
  = note: `-D rustdoc::broken-intra-doc-links` implied by `-D warnings`

error: could not document `alloc`
```

22 months agoTest internal documentation
Chris Denton [Sun, 4 Sep 2022 15:51:11 +0000 (16:51 +0100)]
Test internal documentation

22 months agoAddress feedback from PR #101401
Sage Mitchell [Sun, 4 Sep 2022 15:07:00 +0000 (08:07 -0700)]
Address feedback from PR #101401

22 months agoMake `char::is_lowercase` and `char::is_uppercase` const
Sage Mitchell [Sat, 3 Sep 2022 03:52:28 +0000 (20:52 -0700)]
Make `char::is_lowercase` and `char::is_uppercase` const

Implements #101400.

22 months agoRemove duplicated test (superseeded by search-form-elements.goml)
Guillaume Gomez [Sun, 4 Sep 2022 13:16:55 +0000 (15:16 +0200)]
Remove duplicated test (superseeded by search-form-elements.goml)

22 months agoAuto merge of #101296 - compiler-errors:head-span-for-enclosing-scope, r=oli-obk
bors [Sun, 4 Sep 2022 13:03:07 +0000 (13:03 +0000)]
Auto merge of #101296 - compiler-errors:head-span-for-enclosing-scope, r=oli-obk

Use head span for `rustc_on_unimplemented`'s `enclosing_scope` attr

This may make #101281 slightly easier to understand

22 months agoAdd `inline(always)` to rt functions
Deadbeef [Thu, 1 Sep 2022 10:53:17 +0000 (18:53 +0800)]
Add `inline(always)` to rt functions

22 months agoremap mir before running optimization passes
Deadbeef [Wed, 31 Aug 2022 13:28:55 +0000 (13:28 +0000)]
remap mir before running optimization passes

22 months agoAdd `inline(always)` to function generated by macro
Deadbeef [Fri, 26 Aug 2022 16:44:07 +0000 (16:44 +0000)]
Add `inline(always)` to function generated by macro

22 months agoMake `const_eval_select` a real intrinsic
Deadbeef [Tue, 23 Aug 2022 00:07:26 +0000 (00:07 +0000)]
Make `const_eval_select` a real intrinsic

22 months agorustdoc: Compute enum discriminant on demand
Nixon Enraght-Moony [Sun, 4 Sep 2022 11:53:25 +0000 (12:53 +0100)]
rustdoc: Compute enum discriminant on demand

22 months agoAuto merge of #101250 - klensy:bump-deps-08-22, r=Dylan-DPC
bors [Sun, 4 Sep 2022 10:43:44 +0000 (10:43 +0000)]
Auto merge of #101250 - klensy:bump-deps-08-22, r=Dylan-DPC

bump deps

Update few crates to drop old/duplicated versions.

updates pest* crates (no separate changelog, sadly: https://github.com/pest-parser/pest/releases), thiserror, handlebars(https://github.com/sunng87/handlebars-rust/blob/v4.3.3/CHANGELOG.md#433---2022-07-20) to drop old ones:
```
 Removing block-buffer v0.7.3
 Removing block-padding v0.1.5
 Removing byte-tools v0.3.1
 Removing byteorder v1.3.4
 Removing digest v0.8.1
 Removing fake-simd v0.1.2
 Removing generic-array v0.12.4
 Updating handlebars v4.1.0 -> v4.3.3
 Removing opaque-debug v0.2.3
 Updating pest v2.1.3 -> v2.3.0
 Updating pest_derive v2.1.0 -> v2.3.0
 Updating pest_generator v2.1.3 -> v2.3.0
 Updating pest_meta v2.1.3 -> v2.3.0
 Removing quick-error v2.0.0
 Removing sha-1 v0.8.2
 Updating thiserror v1.0.30 -> v1.0.33
 Updating thiserror-impl v1.0.30 -> v1.0.33
```

combine v4.6.3 -> v4.6.6: drops `use_std` features, addressed this comment:
https://github.com/rust-lang/rust/blob/4fd4de7ea358ad6fc28c5780533ea8ccc09e1006/src/tools/rustc-workspace-hack/Cargo.toml#L80-L82

im-rc v15.0.0 -> v15.1.0 to drop rand_xoshiro duplicated version
```
Updating im-rc v15.0.0 -> v15.1.0
Removing rand_xoshiro v0.4.0
```

22 months agoAuto merge of #100726 - jswrenn:transmute, r=oli-obk
bors [Sun, 4 Sep 2022 07:55:44 +0000 (07:55 +0000)]
Auto merge of #100726 - jswrenn:transmute, r=oli-obk

safe transmute: use `Assume` struct to provide analysis options

This task was left as a TODO in #92268; resolving it brings [`BikeshedIntrinsicFrom`](https://doc.rust-lang.org/nightly/core/mem/trait.BikeshedIntrinsicFrom.html) more in line with the API defined in [MCP411](https://github.com/rust-lang/compiler-team/issues/411).

**Before:**
```rust
pub unsafe trait BikeshedIntrinsicFrom<
    Src,
    Context,
    const ASSUME_ALIGNMENT: bool,
    const ASSUME_LIFETIMES: bool,
    const ASSUME_VALIDITY: bool,
    const ASSUME_VISIBILITY: bool,
> where
    Src: ?Sized,
{}
```
**After:**
```rust
pub unsafe trait BikeshedIntrinsicFrom<Src, Context, const ASSUME: Assume = { Assume::NOTHING }>
where
    Src: ?Sized,
{}
```

`Assume::visibility` has also been renamed to `Assume::safety`, as library safety invariants are what's actually being assumed; visibility is just the mechanism by which it is currently checked (and that may change).

r? `@oli-obk`

---

Related:
- https://github.com/rust-lang/compiler-team/issues/411
- https://github.com/rust-lang/rust/issues/99571

22 months agoAlso suggest dereferencing LHS when both &mut T and T are valid binop LHS
Michael Goulet [Sat, 3 Sep 2022 19:13:17 +0000 (19:13 +0000)]
Also suggest dereferencing LHS when both &mut T and T are valid binop LHS

22 months agoAuto merge of #101312 - nikic:update-llvm-7, r=cuviper
bors [Sun, 4 Sep 2022 05:14:34 +0000 (05:14 +0000)]
Auto merge of #101312 - nikic:update-llvm-7, r=cuviper

Update LLVM submodule

This updates to the current 15.x branch plus one cherry-pick.

Fixes #100834.
Fixes #101121.

22 months agoAuto merge of #101396 - matthiaskrgr:rollup-9n0257m, r=matthiaskrgr
bors [Sun, 4 Sep 2022 02:59:45 +0000 (02:59 +0000)]
Auto merge of #101396 - matthiaskrgr:rollup-9n0257m, r=matthiaskrgr

Rollup of 4 pull requests

Successful merges:

 - #100302 (Suggest associated method on deref types when path syntax method fails)
 - #100647 ( Make trait bound not satisfied specify kind)
 - #101349 (rustdoc: remove `.impl-items { flex-basis }` CSS, not in flex container)
 - #101369 (Fix `global_asm` macro pretty printing)

Failed merges:

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

22 months agoAddress nits, rename enclosing_scope => parent_label
Michael Goulet [Sun, 4 Sep 2022 02:10:31 +0000 (02:10 +0000)]
Address nits, rename enclosing_scope => parent_label

22 months agoUse head span for rustc_on_unimplemented's enclosing_scope attr
Michael Goulet [Thu, 1 Sep 2022 19:52:39 +0000 (19:52 +0000)]
Use head span for rustc_on_unimplemented's enclosing_scope attr

22 months agorustdoc: remove redundant mobile-sized `.source nav:not(.sidebar).sub`
Michael Howell [Sat, 3 Sep 2022 22:07:48 +0000 (15:07 -0700)]
rustdoc: remove redundant mobile-sized `.source nav:not(.sidebar).sub`

It's redundant because there's already a selector `.source nav.sub` with
exactly the same margin-left at line 796.

This selector was added in 1e98fb10274ea0245f865ddb1e295e454382000b, along
with an identical desktop selector, but that desktop selector was removed in
6a5f8b1aef1417d7dc85b5d0a229d2db1930eb7c as part of a larger simplification.

22 months agoRollup merge of #101369 - compiler-errors:global-asm-pprint, r=jackh726
Matthias Krüger [Sat, 3 Sep 2022 22:20:43 +0000 (00:20 +0200)]
Rollup merge of #101369 - compiler-errors:global-asm-pprint, r=jackh726

Fix `global_asm` macro pretty printing

Fixes #101051
Fixes #101047

22 months agoRollup merge of #101349 - notriddle:notriddle/flex-basis, r=GuillaumeGomez
Matthias Krüger [Sat, 3 Sep 2022 22:20:42 +0000 (00:20 +0200)]
Rollup merge of #101349 - notriddle:notriddle/flex-basis, r=GuillaumeGomez

rustdoc: remove `.impl-items { flex-basis }` CSS, not in flex container

Added in 34bd2b845b3acd84c5a9bddae3ff8081c19ec5e9

For this to actually do anything, [according to MDN] (and Firefox Dev Tools), it must be a "flex item", which only happens if its a direct child of a node with `display: flex` on it. It seems like it could not have worked at the time when this rule was added, because the only items in `rustdoc.css` with `display: flex` active were:

* `#help`

  This should not contain anything like this.

* `.impl-items h4, h4.impl, h3.impl`

  These are all headers, so they shouldn't contain `.impl-items` either.

* `.content .impl-items .method, .content .impl-items > .type, .impl-items > .associatedconstant`

  Associated constants and methods definitely shouldn't contain a list of impl items, and the `.type` class seems to refer to type aliases, which, when shown inside of an impl, only show a link to the aliased type.

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

Nowadays, `display: flex` is a lot more prolific, but `.impl-items` still seems to only be used in plain block parents:

* If it's not a trait impl, then it's nested below a `<div>` with an id but no class, added in a5216cf67d93de97091b41ecba85de2e08f39863. This will be `display: block`, probably. For example, [vec deref]
* Inherent impls also get a `<div>` tag, for example [vec impl], and they are also wrapped by their own non-flexbox `<details>` tag.
* If it's a tait implementation, then it's also nested below a `<details>` container, like [deref cstring].

[vec impl]: https://doc.rust-lang.org/1.63.0/std/vec/struct.Vec.html#impl
[vec deref]: https://doc.rust-lang.org/1.63.0/std/vec/struct.Vec.html#deref-methods-%5BT%5D
[deref cstring]: https://doc.rust-lang.org/1.63.0/std/ops/trait.Deref.html#impl-Deref

Also, this would imply that trait items ought to take up as much space as possible, pushing everything else to the edge of the screen. If this is nested directly below the `.rustdoc` container, which has a row basis, that would be bad.

22 months agoRollup merge of #100647 - obeis:issue-99875, r=nagisa
Matthias Krüger [Sat, 3 Sep 2022 22:20:40 +0000 (00:20 +0200)]
Rollup merge of #100647 - obeis:issue-99875, r=nagisa

 Make trait bound not satisfied specify kind

Closes #99875

22 months agoRollup merge of #100302 - compiler-errors:deref-path-methods, r=jackh726
Matthias Krüger [Sat, 3 Sep 2022 22:20:39 +0000 (00:20 +0200)]
Rollup merge of #100302 - compiler-errors:deref-path-methods, r=jackh726

Suggest associated method on deref types when path syntax method fails

Fixes #100278

22 months agoForbid mixing `System` with sytem allocator calls
Christopher Durham [Sat, 3 Sep 2022 21:47:12 +0000 (16:47 -0500)]
Forbid mixing `System` with sytem allocator calls

22 months agorustdoc: remove `.impl-items { flex-basis }` CSS, not in flex container
Michael Howell [Fri, 2 Sep 2022 22:44:06 +0000 (15:44 -0700)]
rustdoc: remove `.impl-items { flex-basis }` CSS, not in flex container

Added in 34bd2b845b3acd84c5a9bddae3ff8081c19ec5e9

For this to actually do anything, [according to MDN] (and Firefox Dev Tools),
it must be a "flex item", which only happens if its a direct child of a node
with `display: flex` on it. It seems like it could not have worked at the time
when this rule was added, because the only items in `rustdoc.css` with
`display: flex` active were:

* `#help`

  This should not contain anything like this.

* `.impl-items h4, h4.impl, h3.impl`

  These are all headers, so they shouldn't contain `.impl-items` either.

* `.content .impl-items .method, .content .impl-items > .type, .impl-items > .associatedconstant`

  Associated constants and methods definitely shouldn't contain a list of impl
  items, and the `.type` class seems to refer to type aliases, which, when
  shown inside of an impl, only show a link to the aliased type.

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

Nowadays, `display: flex` is a lot more prolific, but `.impl-items` still
seems to only be used in plain block parents:

* If it's not a trait impl, then it's nested below a `<div>` with an id but no
  class, added in a5216cf67d93de97091b41ecba85de2e08f39863. This will be
  `display: block`, probably. For example, [vec deref]
* Inherent impls also get a `<div>` tag, for example [vec impl], and they are
  also wrapped by their own non-flexbox `<details>` tag.
* If it's a tait implementation, then it's also nested below a `<details>`
  container, like [deref cstring].

[vec impl]: https://doc.rust-lang.org/1.63.0/std/vec/struct.Vec.html#impl
[vec deref]: https://doc.rust-lang.org/1.63.0/std/vec/struct.Vec.html#deref-methods-%5BT%5D
[deref cstring]: https://doc.rust-lang.org/1.63.0/std/ops/trait.Deref.html#impl-Deref

Also, this would imply that trait items ought to take up as much space as
possible, pushing everything else to the edge of the screen. If this is nested
directly below the `.rustdoc` container, which has a row basis, that would
be bad.

22 months agoRustdoc-Json: Add enum discriminant
Nixon Enraght-Moony [Sat, 3 Sep 2022 18:36:28 +0000 (19:36 +0100)]
Rustdoc-Json: Add enum discriminant

22 months agoAuto merge of #101214 - cjgillot:old-no-lt, r=estebank
bors [Sat, 3 Sep 2022 19:32:41 +0000 (19:32 +0000)]
Auto merge of #101214 - cjgillot:old-no-lt, r=estebank

Do not call object_lifetime_default on lifetime params.

Small cleanup to avoid unnecessary query invocations in trivial cases.

22 months agoDon't delay invalid lhs bug unless we know it'll be replaced by one in check_overload...
Michael Goulet [Sat, 3 Sep 2022 19:12:44 +0000 (19:12 +0000)]
Don't delay invalid lhs bug unless we know it'll be replaced by one in check_overloaded_binop

22 months agoDo not call object_lifetime_default on lifetime params.
Camille GILLOT [Tue, 30 Aug 2022 20:47:58 +0000 (22:47 +0200)]
Do not call object_lifetime_default on lifetime params.

22 months agoupdated description of File struct in std::fs
Bart Massey [Sat, 3 Sep 2022 18:09:06 +0000 (11:09 -0700)]
updated description of File struct in std::fs

22 months agoAuto merge of #101342 - saethlin:update-backtrace, r=Mark-Simulacrum
bors [Sat, 3 Sep 2022 17:12:17 +0000 (17:12 +0000)]
Auto merge of #101342 - saethlin:update-backtrace, r=Mark-Simulacrum

Update backtrace

Most notably, this pulls in https://github.com/rust-lang/backtrace-rs/commit/ebc9a85466506e4fd0ba9cb72b15c42e320a0867, which is both a bugfix and a significant performance improvement for Miri, since fixing the bug makes `RUST_BACKTRACE=1` backtraces much smaller: https://github.com/rust-lang/miri/issues/2273, https://github.com/rust-lang/miri-test-libstd/issues/8

This also pulls in other commits which turn the backtrace-rs CI green. That's nice.

22 months agoAuto merge of #101378 - matthiaskrgr:rollup-s1awa47, r=matthiaskrgr
bors [Sat, 3 Sep 2022 14:23:58 +0000 (14:23 +0000)]
Auto merge of #101378 - matthiaskrgr:rollup-s1awa47, r=matthiaskrgr

Rollup of 4 pull requests

Successful merges:

 - #101335 (rustdoc: remove old CSS selector that causes weird spacing)
 - #101347 (ffx component run should provide a collection)
 - #101364 (Shrink suggestion span of argument mismatch error)
 - #101365 (remove redundant clones)

Failed merges:

 - #101349 (rustdoc: remove `.impl-items { flex-basis }` CSS, not in flex container)

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

22 months agoRollup merge of #101365 - matthiaskrgr:clones2, r=fee1-dead
Matthias Krüger [Sat, 3 Sep 2022 12:20:53 +0000 (14:20 +0200)]
Rollup merge of #101365 - matthiaskrgr:clones2, r=fee1-dead

remove redundant clones

22 months agoRollup merge of #101364 - compiler-errors:arg-suggestion-spans, r=wesleywiser
Matthias Krüger [Sat, 3 Sep 2022 12:20:52 +0000 (14:20 +0200)]
Rollup merge of #101364 - compiler-errors:arg-suggestion-spans, r=wesleywiser

Shrink suggestion span of argument mismatch error

This doesn't really help with #101242, but I wanted to put this up while I work on other fixes.

22 months agoRollup merge of #101347 - diminishedprime:patch-4, r=tmandry
Matthias Krüger [Sat, 3 Sep 2022 12:20:51 +0000 (14:20 +0200)]
Rollup merge of #101347 - diminishedprime:patch-4, r=tmandry

ffx component run should provide a collection

In the future,`ffx component run` will not default to the using the `/core/ffx-laboratory` collection. Updated the run commands to include this.

22 months agoRollup merge of #101335 - notriddle:notriddle/methods-stability, r=notriddle
Matthias Krüger [Sat, 3 Sep 2022 12:20:49 +0000 (14:20 +0200)]
Rollup merge of #101335 - notriddle:notriddle/methods-stability, r=notriddle

rustdoc: remove old CSS selector that causes weird spacing

It was added with e08a84a0c18739417a50c3e46917ced5037244eb (actually, it was called `.methods > .stability` at the time) and was directly nested that way.

**EDIT**: It is technically reachable code still, but it seems wrong.

## With the old CSS rule still present

https://notriddle.com/notriddle-rustdoc-test/weird-spacing/lib/struct.Foo.html

![image](https://user-images.githubusercontent.com/1593513/188216226-c667c560-d33d-494f-a492-4e0ec3ac0009.png)

## Version 2 (an older version of this PR)

https://notriddle.com/notriddle-rustdoc-test/normal-spacing-2/lib/struct.Foo.html

![image](https://user-images.githubusercontent.com/1593513/188216418-9fcd3109-f1b2-425d-b4fc-0c6b3b54e48e.png)

## Version 3 (with alignment fix for mobile)

https://notriddle.com/notriddle-rustdoc-test/normal-spacing-3/lib/struct.Foo.html

![image](https://user-images.githubusercontent.com/1593513/188223161-0e1ebce7-842f-41cb-8a0c-ae43aedcfccc.png)

22 months agostd: make `ReentrantMutex` movable and `const`; simplify `Stdout` initialization
joboet [Sat, 3 Sep 2022 12:05:28 +0000 (14:05 +0200)]
std: make `ReentrantMutex` movable and `const`; simplify `Stdout` initialization

22 months agoAuto merge of #100574 - Urgau:check-cfg-warn-cfg, r=petrochenkov
bors [Sat, 3 Sep 2022 12:02:14 +0000 (12:02 +0000)]
Auto merge of #100574 - Urgau:check-cfg-warn-cfg, r=petrochenkov

Add warning against unexpected --cfg with --check-cfg

This PR adds a warning when an unexpected `--cfg` is specified but not in the specified list of `--check-cfg`.

This is the follow-up PR I mentioned in https://github.com/rust-lang/rust/pull/99519.

r? `@petrochenkov`

22 months agoAuto merge of #101154 - RalfJung:validation-perf, r=oli-obk
bors [Sat, 3 Sep 2022 09:20:54 +0000 (09:20 +0000)]
Auto merge of #101154 - RalfJung:validation-perf, r=oli-obk

interpret: fix unnecessary allocation in validation visitor

Should fix the perf regression introduced by https://github.com/rust-lang/rust/pull/100043.

r? `@oli-obk`

22 months agoFix global_asm macro pretty printing
Michael Goulet [Sat, 3 Sep 2022 08:05:48 +0000 (08:05 +0000)]
Fix global_asm macro pretty printing

22 months agoSuggest copied or cloned
Michael Goulet [Sat, 3 Sep 2022 07:29:57 +0000 (07:29 +0000)]
Suggest copied or cloned

22 months agoSuggest associated method on deref types
Michael Goulet [Sat, 3 Sep 2022 07:24:55 +0000 (07:24 +0000)]
Suggest associated method on deref types

22 months agoAuto merge of #101361 - Dylan-DPC:rollup-xj1syld, r=Dylan-DPC
bors [Sat, 3 Sep 2022 07:00:07 +0000 (07:00 +0000)]
Auto merge of #101361 - Dylan-DPC:rollup-xj1syld, r=Dylan-DPC

Rollup of 7 pull requests

Successful merges:

 - #99736 (Partially stabilize `bound_as_ref` by stabilizing `Bound::as_ref`)
 - #100928 (Migrate rustc_metadata to SessionDiagnostics)
 - #101217 ([drop tracking] Use parent expression for scope, not parent node )
 - #101325 (Windows RNG: Use `BCRYPT_RNG_ALG_HANDLE` by default)
 - #101330 (Fix `std::collections::HashSet::drain` documentation)
 - #101338 (Fix unsupported syntax in .manifest file)
 - #101348 (Cleanup css theme)

Failed merges:

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

22 months agoremove redundant clones
Matthias Krüger [Sat, 3 Sep 2022 05:58:41 +0000 (07:58 +0200)]
remove redundant clones

22 months agoShrink suggestion span of argument mismatch error
Michael Goulet [Fri, 2 Sep 2022 02:17:44 +0000 (02:17 +0000)]
Shrink suggestion span of argument mismatch error

22 months agoRollup merge of #101348 - GuillaumeGomez:cleanup-css-theme, r=notriddle
Dylan DPC [Sat, 3 Sep 2022 05:03:09 +0000 (10:33 +0530)]
Rollup merge of #101348 - GuillaumeGomez:cleanup-css-theme, r=notriddle

Cleanup css theme

Follow-up of https://github.com/rust-lang/rust/pull/100494.

The change for the border color of the search input in the dark mode was actually a weird case: the search input border was unique, it didn't share the same variable with other items with borders. This weird case being unique to the dark theme, I removed it, hence the modification in the GUI test.

Live demo is [here](https://rustdoc.crud.net/imperio/cleanup-css-theme/std/index.html).

cc `@jsha`
r? `@notriddle`

22 months agoRollup merge of #101338 - diminishedprime:patch-2, r=tmandry
Dylan DPC [Sat, 3 Sep 2022 05:03:08 +0000 (10:33 +0530)]
Rollup merge of #101338 - diminishedprime:patch-2, r=tmandry

Fix unsupported syntax in .manifest file

Fuchsia .manifest files do not support a `#` comment syntax. Because of this, if you copy and paste the current example code for this file, and then remove the line you don't need, you still see an error. To make this a bit easier to follow, split this into two code blocks, one for rustc, and one for cargo.

22 months agoRollup merge of #101330 - wkordalski:hashset-drain-doc, r=jyn514
Dylan DPC [Sat, 3 Sep 2022 05:03:07 +0000 (10:33 +0530)]
Rollup merge of #101330 - wkordalski:hashset-drain-doc, r=jyn514

Fix `std::collections::HashSet::drain` documentation

Hi!

`std::collections::HashSet::drain` contains small typo in the docstring.

I didn't read too much about the model of contributing to Rust, so merge this PR or close and fix the typo the right way :)

Thanks for Rust!

22 months agoRollup merge of #101325 - ChrisDenton:BCRYPT_RNG_ALG_HANDLE, r=thomcc
Dylan DPC [Sat, 3 Sep 2022 05:03:06 +0000 (10:33 +0530)]
Rollup merge of #101325 - ChrisDenton:BCRYPT_RNG_ALG_HANDLE, r=thomcc

Windows RNG: Use `BCRYPT_RNG_ALG_HANDLE` by default

This only changes a small amount of actual code, the rest is documentation outlining the history of this module as I feel it will be relevant to any future issues that might crop up.

The code change is to use the `BCRYPT_RNG_ALG_HANDLE` [pseudo-handle](https://docs.microsoft.com/en-us/windows/win32/seccng/cng-algorithm-pseudo-handles) by default, which simply uses the default RNG. Previously we used `BCRYPT_USE_SYSTEM_PREFERRED_RNG` which has to load the system configuration and then find and load that RNG. I suspect this was the cause of failures on some systems (e.g. due to corrupted config). However, this is admittedly speculation as I can't reproduce the issue myself (and it does seem quite rare even in the wild). Still, removing a possible point of failure is likely worthwhile in any case.

r? libs

22 months agoRollup merge of #101217 - eholk:drop-tracking-73137, r=jyn514
Dylan DPC [Sat, 3 Sep 2022 05:03:06 +0000 (10:33 +0530)]
Rollup merge of #101217 - eholk:drop-tracking-73137, r=jyn514

[drop tracking] Use parent expression for scope, not parent node

Previously we were just using the parent node as the scope for a temporary value, but it turns out this is too narrow. For example, in an expression like

    Foo {
        b: &42,
        a: async { 0 }.await,
    }

the scope for the &42 was set to the ExprField node for `b: &42`, when we actually want to use the Foo struct expression.

We fix this by recursively searching through parent nodes until we find a Node::Expr. It may be that we don't find one, and if so that's okay, we will just fall back on the enclosing temporary scope which is always sufficient.

Helps with #97331

r? ``@jyn514``

22 months agoRollup merge of #100928 - CleanCut:rustc_metadata_diagnostics, r=davidtwco
Dylan DPC [Sat, 3 Sep 2022 05:03:05 +0000 (10:33 +0530)]
Rollup merge of #100928 - CleanCut:rustc_metadata_diagnostics, r=davidtwco

Migrate rustc_metadata to SessionDiagnostics

Migrate rustc_metadata to SessionDiagnostics.

Part of https://github.com/rust-lang/rust/issues/100717

22 months agoRollup merge of #99736 - lopopolo:lopopolo/gh-80996-partial-stabilization-bounds...
Dylan DPC [Sat, 3 Sep 2022 05:03:04 +0000 (10:33 +0530)]
Rollup merge of #99736 - lopopolo:lopopolo/gh-80996-partial-stabilization-bounds-as-ref, r=dtolnay

Partially stabilize `bound_as_ref` by stabilizing `Bound::as_ref`

Stabilizing `Bound::as_ref` will simplify the implementation for `RangeBounds<usize>` for custom range types:

```rust
impl RangeBounds<usize> for Region {
    fn start_bound(&self) -> Bound<&usize> {
        // TODO: Use `self.start.as_ref()` when upstream `std` stabilizes:
        // https://github.com/rust-lang/rust/issues/80996
        match self.start {
            Bound::Included(ref bound) => Bound::Included(bound),
            Bound::Excluded(ref bound) => Bound::Excluded(bound),
            Bound::Unbounded => Bound::Unbounded,
        }
    }

    fn end_bound(&self) -> Bound<&usize> {
        // TODO: Use `self.end.as_ref()` when upstream `std` stabilizes:
        // https://github.com/rust-lang/rust/issues/80996
        match self.end {
            Bound::Included(ref bound) => Bound::Included(bound),
            Bound::Excluded(ref bound) => Bound::Excluded(bound),
            Bound::Unbounded => Bound::Unbounded,
        }
    }
}
```

See:

- #80996
- https://github.com/rust-lang/rust/issues/80996#issuecomment-1194575470

cc `@yaahc` who suggested partial stabilization.

22 months agoAuto merge of #101139 - nnethercote:shrink-thir-Pat, r=cjgillot
bors [Sat, 3 Sep 2022 04:19:00 +0000 (04:19 +0000)]
Auto merge of #101139 - nnethercote:shrink-thir-Pat, r=cjgillot

Shrink `thir::Pat`

r? `@cjgillot`

22 months agoAuto merge of #100966 - compiler-errors:revert-remove-deferred-sized-checks, r=pnkfelix
bors [Sat, 3 Sep 2022 00:02:41 +0000 (00:02 +0000)]
Auto merge of #100966 - compiler-errors:revert-remove-deferred-sized-checks, r=pnkfelix

Revert "Remove deferred sized checks"

cc: https://github.com/rust-lang/rust/pull/100652#issuecomment-1225798572

I'm okay with reverting this for now, and I will look into the diagnostic regressions.

This reverts commit 33212bf7f527798a8cfa2bbb38781742f4ca718a.

r? `@pnkfelix`

----

EDIT: This _also_ fixes #101066, a regression in method selection logic/coercion(?) due to the early registering of a `Sized` bound.

22 months agoimplement IsZero for Saturating and Wrapping
asquared31415 [Fri, 2 Sep 2022 22:53:20 +0000 (18:53 -0400)]
implement IsZero for Saturating and Wrapping

22 months agoffx component run should provide a collection
Matt Hamrick [Fri, 2 Sep 2022 22:16:51 +0000 (15:16 -0700)]
ffx component run should provide a collection

In the future,`ffx component run` will not default to the using the `/core/ffx-laboratory` collection. Updated the run commands to include this.

22 months agoUpdate rustdoc-gui tests for search-input border color on dark theme
Guillaume Gomez [Fri, 2 Sep 2022 15:40:28 +0000 (17:40 +0200)]
Update rustdoc-gui tests for search-input border color on dark theme

22 months agoClean up themes CSS
Guillaume Gomez [Fri, 2 Sep 2022 13:08:23 +0000 (15:08 +0200)]
Clean up themes CSS

22 months agoAuto merge of #97802 - Enselic:add-no_ignore_sigkill-feature, r=joshtriplett
bors [Fri, 2 Sep 2022 21:08:08 +0000 (21:08 +0000)]
Auto merge of #97802 - Enselic:add-no_ignore_sigkill-feature, r=joshtriplett

Support `#[unix_sigpipe = "inherit|sig_dfl"]` on `fn main()` to prevent ignoring `SIGPIPE`

When enabled, programs don't have to explicitly handle `ErrorKind::BrokenPipe` any longer. Currently, the program

```rust
fn main() { loop { println!("hello world"); } }
```

will print an error if used with a short-lived pipe, e.g.

    % ./main | head -n 1
    hello world
    thread 'main' panicked at 'failed printing to stdout: Broken pipe (os error 32)', library/std/src/io/stdio.rs:1016:9
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

by enabling `#[unix_sigpipe = "sig_dfl"]` like this

```rust
#![feature(unix_sigpipe)]
#[unix_sigpipe = "sig_dfl"]
fn main() { loop { println!("hello world"); } }
```

there is no error, because `SIGPIPE` will not be ignored and thus the program will be killed appropriately:

    % ./main | head -n 1
    hello world

The current libstd behaviour of ignoring `SIGPIPE` before `fn main()` can be explicitly requested by using `#[unix_sigpipe = "sig_ign"]`.

With `#[unix_sigpipe = "inherit"]`, no change at all is made to `SIGPIPE`, which typically means the behaviour will be the same as `#[unix_sigpipe = "sig_dfl"]`.

See https://github.com/rust-lang/rust/issues/62569 and referenced issues for discussions regarding the `SIGPIPE` problem itself

See the [this](https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/Proposal.3A.20First.20step.20towards.20solving.20the.20SIGPIPE.20problem) Zulip topic for more discussions, including about this PR.

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

22 months agorustdoc: put in rule to get alignment in desktop and mobile layouts
Michael Howell [Fri, 2 Sep 2022 19:15:06 +0000 (12:15 -0700)]
rustdoc: put in rule to get alignment in desktop and mobile layouts

22 months agoUpdate backtrace
Ben Kimock [Fri, 2 Sep 2022 20:09:58 +0000 (16:09 -0400)]
Update backtrace

22 months agorustdoc: remove incorrect CSS rule causing misaligned item-info
Michael Howell [Fri, 2 Sep 2022 18:50:19 +0000 (11:50 -0700)]
rustdoc: remove incorrect CSS rule causing misaligned item-info

22 months agorustdoc: remove unused CSS selector `.methods > .item-info`
Michael Howell [Fri, 2 Sep 2022 17:54:40 +0000 (10:54 -0700)]
rustdoc: remove unused CSS selector `.methods > .item-info`

It was added with e08a84a0c18739417a50c3e46917ced5037244eb
(actually, it was called `.methods > .stability` at the time) and was
directly nested that way.

But with the switch to `<details>`, the code has changed drastically out from
under it, to the point where you have to go out of your way to actually get
it to render this way, and the result looks overly-tight and weird alongside
the normal version where this code is not reachable.

22 months agoAuto merge of #101333 - matthiaskrgr:rollup-qpf1otj, r=matthiaskrgr
bors [Fri, 2 Sep 2022 18:40:21 +0000 (18:40 +0000)]
Auto merge of #101333 - matthiaskrgr:rollup-qpf1otj, r=matthiaskrgr

Rollup of 6 pull requests

Successful merges:

 - #100121 (Try normalizing types without RevealAll in ParamEnv in MIR validation)
 - #100200 (Change implementation of `-Z gcc-ld` and `lld-wrapper` again)
 - #100814 ( Porting 'compiler/rustc_trait_selection' to translatable diagnostics - Part 1)
 - #101215 (Also replace the version placeholder in rustc_attr)
 - #101260 (Use `FILE_ATTRIBUTE_TAG_INFO` to get reparse tag)
 - #101323 (Remove unused .toggle-label CSS rule)

Failed merges:

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

22 months agoFix unsupported syntax in .manifest file
Matt Hamrick [Fri, 2 Sep 2022 18:14:22 +0000 (11:14 -0700)]
Fix unsupported syntax in .manifest file

Fuchsia .manifest files do not support a `#` comment syntax. Because of this, if you copy and paste the current example code for this file, and then remove the line you don't need, you still see an error. To make this a bit easier to follow, split this into two code blocks, one for rustc, and one for cargo.

22 months agoRollup merge of #101323 - GuillaumeGomez:remove-unused-css, r=notriddle
Matthias Krüger [Fri, 2 Sep 2022 16:22:04 +0000 (18:22 +0200)]
Rollup merge of #101323 - GuillaumeGomez:remove-unused-css, r=notriddle

Remove unused .toggle-label CSS rule

It was added in https://github.com/rust-lang/rust/pull/44192 but since we moved to `<details>`, we don't use this rule any more.

r? `@notriddle`

22 months agoRollup merge of #101260 - ChrisDenton:attribute-tag, r=thomcc
Matthias Krüger [Fri, 2 Sep 2022 16:22:02 +0000 (18:22 +0200)]
Rollup merge of #101260 - ChrisDenton:attribute-tag, r=thomcc

Use `FILE_ATTRIBUTE_TAG_INFO` to get reparse tag

I've been looking at this code recently and it just occurred to me we don't actually use the full reparse data at this point, only the tag. [`GetFileInformationByHandleEx`](https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-getfileinformationbyhandleex) can do exactly that by filling a [`FILE_ATTRIBUTE_TAG_INFO`](https://docs.microsoft.com/en-us/windows/win32/api/winbase/ns-winbase-file_attribute_tag_info) struct.

r? ```````@thomcc``````` since you've made changes here recently (which is why I have this code on my mind atm)

22 months agoRollup merge of #101215 - est31:rustdoc_version_placeholder, r=Mark-Simulacrum
Matthias Krüger [Fri, 2 Sep 2022 16:22:01 +0000 (18:22 +0200)]
Rollup merge of #101215 - est31:rustdoc_version_placeholder, r=Mark-Simulacrum

Also replace the version placeholder in rustc_attr

Replace the version placeholder with the current version in the rustc_attr crate too so that users won't see the placeholder but instead the explicit version. This especially fixes the bug for rustdoc not showing it but instead the placeholder.

Originally reported [here](https://rust-lang.zulipchat.com/#narrow/stream/241545-t-release/topic/libs.20stabilization.20placeholder/near/296057188).

cc #100591

![Screenshot_20220830_233727](https://user-images.githubusercontent.com/8872119/187548079-6207776b-4481-4351-afff-607f5b3fe03a.png)

22 months agoRollup merge of #100814 - gabrielBusta:port_trait_selection_diagnostics, r=davidtwco
Matthias Krüger [Fri, 2 Sep 2022 16:22:00 +0000 (18:22 +0200)]
Rollup merge of #100814 - gabrielBusta:port_trait_selection_diagnostics, r=davidtwco

 Porting 'compiler/rustc_trait_selection' to translatable diagnostics - Part 1

``@rustbot`` label +A-translation

r? rust-lang/diagnostics
cc #100717

22 months agoRollup merge of #100200 - petrochenkov:zgccld2, r=lqd,Mark-Simulacrum
Matthias Krüger [Fri, 2 Sep 2022 16:21:59 +0000 (18:21 +0200)]
Rollup merge of #100200 - petrochenkov:zgccld2, r=lqd,Mark-Simulacrum

Change implementation of `-Z gcc-ld` and `lld-wrapper` again

This PR partially reverts https://github.com/rust-lang/rust/pull/97375 and uses the strategy described in https://github.com/rust-lang/rust/issues/97402#issuecomment-1147404520 instead, thus fixes https://github.com/rust-lang/rust/issues/97755.

22 months agoRollup merge of #100121 - Nilstrieb:mir-validator-param-env, r=oli-obk
Matthias Krüger [Fri, 2 Sep 2022 16:21:58 +0000 (18:21 +0200)]
Rollup merge of #100121 - Nilstrieb:mir-validator-param-env, r=oli-obk

Try normalizing types without RevealAll in ParamEnv in MIR validation

Before, the MIR validator used RevealAll in its ParamEnv for type
checking. This could cause false negatives in some cases due to
RevealAll ParamEnvs not always use all predicates as expected here.

Since some MIR passes like inlining use RevealAll as well, keep using
it in the MIR validator too, but when it fails usign RevealAll, also
try the check without it, to stop false negatives.

Fixes #99866

cc ````````@compiler-errors```````` who nicely helped me on zulip

22 months agoAuto merge of #101331 - RalfJung:miri, r=RalfJung
bors [Fri, 2 Sep 2022 16:10:04 +0000 (16:10 +0000)]
Auto merge of #101331 - RalfJung:miri, r=RalfJung

update Miri

Fixes https://github.com/rust-lang/rust/issues/101324
r? `@ghost`
now finally with the FFI support we had to bail out last time :D

22 months agoupdate Miri
Ralf Jung [Fri, 2 Sep 2022 14:49:38 +0000 (16:49 +0200)]
update Miri

22 months agoFix `std::collections::HashSet::drain` documentation
Wojciech Kordalski [Fri, 2 Sep 2022 14:35:40 +0000 (16:35 +0200)]
Fix `std::collections::HashSet::drain` documentation

22 months agoUse `BCRYPT_RNG_ALG_HANDLE` by default
Chris Denton [Fri, 2 Sep 2022 12:23:52 +0000 (13:23 +0100)]
Use `BCRYPT_RNG_ALG_HANDLE` by default

Also briefly document the history of `sys/windows/rand.rs` as they may be relevant to any future changes.

22 months agoRemove unused .toggle-label CSS rule
Guillaume Gomez [Fri, 2 Sep 2022 13:09:59 +0000 (15:09 +0200)]
Remove unused .toggle-label CSS rule

22 months agoFix internal doc link
Chris Denton [Fri, 2 Sep 2022 12:32:16 +0000 (13:32 +0100)]
Fix internal doc link

The doc link from `DedupSortedIter` to `BTreeMap::bulk_build_from_sorted_iter` was broken when building internal documentation,

22 months agoAuto merge of #101318 - GuillaumeGomez:rollup-qsr51z4, r=GuillaumeGomez
bors [Fri, 2 Sep 2022 10:55:24 +0000 (10:55 +0000)]
Auto merge of #101318 - GuillaumeGomez:rollup-qsr51z4, r=GuillaumeGomez

Rollup of 9 pull requests

Successful merges:

 - #97739 (Uplift the `let_underscore` lints from clippy into rustc.)
 - #99583 (Add additional methods to the Demand type)
 - #100147 (optimization of access level table construction)
 - #100552 (rustc_target: Add a compatibility layer to separate internal and user-facing linker flavors)
 - #100827 (Simplify MIR opt tests)
 - #101166 (Generate error index with mdbook instead of raw HTML pages)
 - #101294 (Fix #100844 rebase accident)
 - #101298 (rustdoc: remove unused CSS `#main-content > .since`)
 - #101304 (Add autolabels for `A-query-system`)

Failed merges:

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

22 months agoAdd warning against unexpected --cfg with --check-cfg
Urgau [Thu, 11 Aug 2022 17:50:48 +0000 (19:50 +0200)]
Add warning against unexpected --cfg with --check-cfg

22 months agoMake CrateConfig make order depended for linting purpose
Urgau [Thu, 1 Sep 2022 14:22:30 +0000 (16:22 +0200)]
Make CrateConfig make order depended for linting purpose

22 months agoRollup merge of #101304 - jyn514:jnelson/tag-query-system, r=Dylan-DPC
Guillaume Gomez [Fri, 2 Sep 2022 09:34:55 +0000 (11:34 +0200)]
Rollup merge of #101304 - jyn514:jnelson/tag-query-system, r=Dylan-DPC

Add autolabels for `A-query-system`

r? `@cjgillot`

22 months agoRollup merge of #101298 - notriddle:notriddle/rustdoc-main-since, r=GuillaumeGomez
Guillaume Gomez [Fri, 2 Sep 2022 09:34:54 +0000 (11:34 +0200)]
Rollup merge of #101298 - notriddle:notriddle/rustdoc-main-since, r=GuillaumeGomez

rustdoc: remove unused CSS `#main-content > .since`

This rule was added (actually, it was called `#main > .since` back then) with cdca0843779eed0b9046e9fee48c91458ad51605 and you can see an example of the bug it's intended to fix in <https://doc.rust-lang.org/1.9.0/std/fmt/fn.write.html> by looking at the `1.0.0` version marker.

However, a5a2f2b951ea982a666eaf52b1874d8f1b17290b changed it so that `<span class="since">` is always placed in an out-of-band wrapper, so it's never nested directly below `#main` / `#main-content` any more.

22 months agoRollup merge of #101294 - Xiretza:fix-100844-accident, r=davidtwco
Guillaume Gomez [Fri, 2 Sep 2022 09:34:53 +0000 (11:34 +0200)]
Rollup merge of #101294 - Xiretza:fix-100844-accident, r=davidtwco

Fix #100844 rebase accident

This undoes the rebase accident in #100844, which accidentally caused #100970 to be reverted.

22 months agoRollup merge of #101166 - GuillaumeGomez:error-index-mdbook, r=notriddle
Guillaume Gomez [Fri, 2 Sep 2022 09:34:51 +0000 (11:34 +0200)]
Rollup merge of #101166 - GuillaumeGomez:error-index-mdbook, r=notriddle

Generate error index with mdbook instead of raw HTML pages

This is a follow-up of https://github.com/rust-lang/rust/pull/100922.

This comes from a remark from ````@estebank```` who said that the search was a nice thing on the previous version and that it wasn't possible anymore. An easy way to come around this limitation was to use `mdbook`, which is what I did here.

Now some explanations on the code. I'll explain how I developed this and why I reached this solution. First I did it very basically by simply setting the source directory and the output directory, generated a `SUMMARY.md` manually which listed all error codes and that was it. Two problems arose from this:
 1. A lot of new HTML files were generated at the top level
 2. An `index.html` file was generated at the top-level (the summary in short).

So for `1.`, it's not great to have too many files at the top-level as it could create file conflicts more easily. And for `2.`, this is actually a huge issue because <doc.rust-lang.org> generates an `index.html` file with a links to a few different resources, so it should never be overwritten. <s>Unfortunately, `mdbook` **always** generates an `index.html` file so the only solution I could see (except for sending them a contribution, I'll maybe do that later) was to temporaly move a potentially existing `index.html` file and then puts it back once done. For this last part, to ensure that we don't return *before* it has been put back, I wrapped the `mdbook` generation code inside `render_html_inner` which is called from `render_html` which in turn handle the "save" of `index.html`.</s>

EDIT: `mdbook` completely deletes ALL the content in the target directory so I instead generate into a sub directory and then I move the files to the real target directory.

To keep compatibility with the old version, I also put the `<script>` ````@notriddle```` nicely provided in the previous PR only into the `error-index.html` file to prevent unneeded repetition. I didn't use `mdbook` `additional-js` option because the JS is included at the end of all HTML files, which we don't want for two reasons:
 1. It's slow.
 2. We only want it to be run in `error-index.html` (even if we also ensure in the JS itself too!).

<s>Now the last part: why we generate the summary twice. We actually generate it once to tell `mdbook` what the book will look like and a second time because a create a new chapter content which will actually list all the error codes (with the updated paths).</s>

EDIT: I removed the need for two summaries.

You can test it [here](https://rustdoc.crud.net/imperio/error-index-mdbook/error-index.html).

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

22 months agoRollup merge of #100827 - JakobDegen:better-tests, r=wesleywiser
Guillaume Gomez [Fri, 2 Sep 2022 09:34:50 +0000 (11:34 +0200)]
Rollup merge of #100827 - JakobDegen:better-tests, r=wesleywiser

Simplify MIR opt tests

This commit removes many cases of MIR opt tests emitting `.diff`s for more than one pass. These tests cannot be `unit-test`s, and so they are easy to break, and they also provide little value due to having excessively strong opinions over *how* a piece of code should be optimized.

Where reasonable, we instead add separate test files that only emit the `PreCodegen.after` MIR for code where we want to track what the end to end effect of the optimization pipeline on the example code is.

r? `````@wesleywiser`````

22 months agoRollup merge of #100552 - petrochenkov:flavorcompat, r=lqd
Guillaume Gomez [Fri, 2 Sep 2022 09:34:49 +0000 (11:34 +0200)]
Rollup merge of #100552 - petrochenkov:flavorcompat, r=lqd

rustc_target: Add a compatibility layer to separate internal and user-facing linker flavors

I want to do some refactorings in `rustc_target` - merge `lld_flavor` and `linker_is_gnu` into `linker_flavor`, support combination gcc+lld (https://github.com/rust-lang/rust/pull/96827).
This PR adds some compatibility infra that makes that possible without making any changes to user-facing interfaces - `-Clinker-flavor` values and json target specs. (For json target specs this infra may eventually go away since they are not very stable.)

The second commit does some light refactoring of internal linker flavors (applies changes from https://github.com/petrochenkov/rust/commit/53eca42973b7e379b9fa0469c33f08680b57c35f that don't require mass-editing target specs).

22 months agoRollup merge of #100147 - Bryanskiy:private-in-public, r=petrochenkov
Guillaume Gomez [Fri, 2 Sep 2022 09:34:48 +0000 (11:34 +0200)]
Rollup merge of #100147 - Bryanskiy:private-in-public, r=petrochenkov

optimization of access level table construction

Refactoring which was mentioned in #87487