]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoeplace usages of vec![].into_iter with [].into_iter
Lucas Kent [Fri, 17 Dec 2021 07:36:18 +0000 (18:36 +1100)]
eplace usages of vec![].into_iter with [].into_iter

2 years agoAuto merge of #92068 - fee1-dead:libcore2021, r=m-ou-se
bors [Sat, 8 Jan 2022 21:41:48 +0000 (21:41 +0000)]
Auto merge of #92068 - fee1-dead:libcore2021, r=m-ou-se

Switch all libraries to the 2021 edition

The fix for https://github.com/rust-lang/rust/issues/88638#issuecomment-996620107 is to simply add const-stability for these functions.

r? `@m-ou-se`

Closes #88638.

2 years agoAuto merge of #91919 - Aaron1011:query-recursive-read, r=michaelwoerister
bors [Sat, 8 Jan 2022 18:32:31 +0000 (18:32 +0000)]
Auto merge of #91919 - Aaron1011:query-recursive-read, r=michaelwoerister

Don't perform any new queries while reading a query result on disk

In addition to being very confusing, this can cause us to add dep node edges between two queries that would not otherwise have an edge.

We now panic if any new dep node edges are created during the deserialization of a query result. This requires serializing the full `AdtDef` to disk, instead of just serializing the `DefId` and invoking the `adt_def` query during deserialization.

I'll probably split this up into several smaller PRs for perf runs.

2 years agoAuto merge of #90639 - matthewjasper:leaf-def-cache, r=cjgillot
bors [Sat, 8 Jan 2022 15:20:33 +0000 (15:20 +0000)]
Auto merge of #90639 - matthewjasper:leaf-def-cache, r=cjgillot

Add a query for resolving an impl item from the trait item

This makes finding the item in an impl that implements a given trait item a query. This is for a few reasons:

- To slightly improve performance
- To avoid having to do name resolution during monomorphisation
- To make it easier to implement potential future features that create anonymous associated items

2 years agoAuto merge of #92639 - pietroalbini:bump-version, r=pietroalbini
bors [Sat, 8 Jan 2022 12:06:40 +0000 (12:06 +0000)]
Auto merge of #92639 - pietroalbini:bump-version, r=pietroalbini

Bump version to 1.60.0

Part of the release process, cc `@rust-lang/release`

r? `@ghost`

2 years agoAuto merge of #91305 - camelid:rm-cond, r=GuillaumeGomez
bors [Sat, 8 Jan 2022 08:55:46 +0000 (08:55 +0000)]
Auto merge of #91305 - camelid:rm-cond, r=GuillaumeGomez

rustdoc: Remove apparently unnecessary conditional in `doc_value`

I need to remove this conditional for #91072, but while it seems
unnecessary, we are not certain. So, the plan is to first remove the
conditional and see if any regressions pop up before doing the refactor.
This way, it will be easier to revert if there are subtle regressions.

r? `@jyn514`

2 years agoAuto merge of #92664 - ehuss:rollup-t9yrvk5, r=ehuss
bors [Sat, 8 Jan 2022 06:01:37 +0000 (06:01 +0000)]
Auto merge of #92664 - ehuss:rollup-t9yrvk5, r=ehuss

Rollup of 8 pull requests

Successful merges:

 - #84640 (Implement `TryFrom<char>` for `u8`)
 - #92336 (Remove &self from PrintState::to_string)
 - #92375 (Consolidate checking for msvc when generating debuginfo)
 - #92568 (Add note about non_exhaustive to variant_count)
 - #92600 (Add some missing `#[must_use]` to some `f{32,64}` operations)
 - #92610 (Create CSS class instead of using inline style for search results)
 - #92632 (Implement stabilization of `#[feature(available_parallelism)]`)
 - #92650 (Fix typo in `StableCrateId` docs)

Failed merges:

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

2 years agoRollup merge of #92650 - pierwill:patch-2, r=michaelwoerister
Eric Huss [Sat, 8 Jan 2022 04:21:02 +0000 (20:21 -0800)]
Rollup merge of #92650 - pierwill:patch-2, r=michaelwoerister

Fix typo in `StableCrateId` docs

2 years agoRollup merge of #92632 - yoshuawuyts:stabilize-available-parallelism, r=joshtriplett
Eric Huss [Sat, 8 Jan 2022 04:21:01 +0000 (20:21 -0800)]
Rollup merge of #92632 - yoshuawuyts:stabilize-available-parallelism, r=joshtriplett

Implement stabilization of `#[feature(available_parallelism)]`

Stabilized in https://github.com/rust-lang/rust/issues/74479#issuecomment-984379800. Closes https://github.com/rust-lang/rust/issues/74479. Thanks!

cc/ ``@rust-lang/libs-api``

2 years agoRollup merge of #92610 - GuillaumeGomez:css-class-instead-of-inline-style, r=jsha
Eric Huss [Sat, 8 Jan 2022 04:21:01 +0000 (20:21 -0800)]
Rollup merge of #92610 - GuillaumeGomez:css-class-instead-of-inline-style, r=jsha

Create CSS class instead of using inline style for search results

I saw this change in the update you proposed in https://github.com/rust-lang/rust/pull/92404. :)

r? ``@jsha``

2 years agoRollup merge of #92600 - asquared31415:float-must-use, r=joshtriplett
Eric Huss [Sat, 8 Jan 2022 04:21:00 +0000 (20:21 -0800)]
Rollup merge of #92600 - asquared31415:float-must-use, r=joshtriplett

Add some missing `#[must_use]` to some `f{32,64}` operations

This PR adds `#[must_use]` to the following methods:
 - `f32::recip`
 - `f32::max`
 - `f32::min`
 - `f32::maximum`
 - `f32::minimum`
 and their equivalents in `f64`.
 These methods all produce a new value without modifying the original and so are pointless to call without using the result.

2 years agoRollup merge of #92568 - Mark-Simulacrum:non-exhaustive-variant-count, r=the8472
Eric Huss [Sat, 8 Jan 2022 04:20:59 +0000 (20:20 -0800)]
Rollup merge of #92568 - Mark-Simulacrum:non-exhaustive-variant-count, r=the8472

Add note about non_exhaustive to variant_count

Since `variant_count` isn't returning something opaque, I thought it makes sense to explicitly call out that its return value may change for some enums.

cc #73662

2 years agoRollup merge of #92375 - wesleywiser:consolidate_debuginfo_msvc_check, r=michaelwoerister
Eric Huss [Sat, 8 Jan 2022 04:20:58 +0000 (20:20 -0800)]
Rollup merge of #92375 - wesleywiser:consolidate_debuginfo_msvc_check, r=michaelwoerister

Consolidate checking for msvc when generating debuginfo

If the target we're generating code for is msvc, then we do two main
things differently: we generate type names in a C++ style instead of a
Rust style and we generate debuginfo for enums differently.

I've refactored the code so that there is one function
(`cpp_like_debuginfo`) which determines if we should use the C++ style
of naming types and other debuginfo generation or the regular Rust one.

r? ``@michaelwoerister``

This PR is not urgent so please don't let it interrupt your holidays! 🎄 🎁

2 years agoRollup merge of #92336 - dtolnay:printstateself, r=michaelwoerister
Eric Huss [Sat, 8 Jan 2022 04:20:56 +0000 (20:20 -0800)]
Rollup merge of #92336 - dtolnay:printstateself, r=michaelwoerister

Remove &self from PrintState::to_string

The point of `PrintState::to_string` is to create a `State` and evaluate the caller's closure on it:

https://github.com/rust-lang/rust/blob/e9fbe79292783972a222afd270db3f77c0b4f3c8/compiler/rustc_ast_pretty/src/pprust/state.rs#L868-L872

Making the caller *also* construct and pass in a `State`, which is then ignored, was confusing.

2 years agoRollup merge of #84640 - ids1024:u8_from_char, r=m-ou-se
Eric Huss [Sat, 8 Jan 2022 04:20:55 +0000 (20:20 -0800)]
Rollup merge of #84640 - ids1024:u8_from_char, r=m-ou-se

Implement `TryFrom<char>` for `u8`

Previously suggested in https://github.com/rust-lang/rfcs/issues/2854.

It makes sense to have this since `char` implements `From<u8>`. Likewise `u32`, `u64`, and `u128` (since #79502) implement `From<char>`.

2 years agoFix accidental undo of 5e1972eba7e95e68f6fc05b07dec15fb1e553e1b
Noah Lev [Fri, 7 Jan 2022 22:16:56 +0000 (14:16 -0800)]
Fix accidental undo of 5e1972eba7e95e68f6fc05b07dec15fb1e553e1b

2 years agoUpdate clippy for associated item changes
Matthew Jasper [Thu, 18 Nov 2021 22:33:49 +0000 (22:33 +0000)]
Update clippy for associated item changes

2 years agoAdd query to avoid name comparison in `leaf_def`
Matthew Jasper [Thu, 18 Nov 2021 22:29:07 +0000 (22:29 +0000)]
Add query to avoid name comparison in `leaf_def`

2 years agoMove associated_item* providers to their own module
Matthew Jasper [Thu, 18 Nov 2021 21:44:45 +0000 (21:44 +0000)]
Move associated_item* providers to their own module

2 years agoImplement `TryFrom<char>` for `u8`
Ian Douglas Scott [Wed, 28 Apr 2021 04:05:26 +0000 (21:05 -0700)]
Implement `TryFrom<char>` for `u8`

Previously suggested in https://github.com/rust-lang/rfcs/issues/2854.

It makes sense to have this since `char` implements `From<u8>`. Likewise
`u32`, `u64`, and `u128` (since #79502) implement `From<char>`.

2 years agoAdd `trait_item_def_id` to `AssocItem`
Matthew Jasper [Thu, 18 Nov 2021 21:35:42 +0000 (21:35 +0000)]
Add `trait_item_def_id` to `AssocItem`

This allows avoiding some lookups by name

2 years agoDeserialization less in associated_item_def_ids
Matthew Jasper [Thu, 18 Nov 2021 20:59:12 +0000 (20:59 +0000)]
Deserialization less in associated_item_def_ids

2 years agoConsolidate checking for msvc when generating debuginfo
Wesley Wiser [Tue, 28 Dec 2021 21:57:18 +0000 (16:57 -0500)]
Consolidate checking for msvc when generating debuginfo

If the target we're generating code for is msvc, then we do two main
things differently: we generate type names in a C++ style instead of a
Rust style and we generate debuginfo for enums differently.

I've refactored the code so that there is one function
(`cpp_like_debuginfo`) which determines if we should use the C++ style
of naming types and other debuginfo generation or the regular Rust one.

2 years agoFix typo in `StableCrateId` docs
pierwill [Fri, 7 Jan 2022 16:26:26 +0000 (10:26 -0600)]
Fix typo in `StableCrateId` docs

2 years agobump version to 1.60.0
Pietro Albini [Fri, 7 Jan 2022 09:04:15 +0000 (10:04 +0100)]
bump version to 1.60.0

2 years agoStabilize `#[feature(available_parallelism)]`
Yoshua Wuyts [Fri, 7 Jan 2022 00:04:37 +0000 (01:04 +0100)]
Stabilize `#[feature(available_parallelism)]`

2 years agoAuto merge of #92627 - matthiaskrgr:rollup-xmz0rib, r=matthiaskrgr
bors [Thu, 6 Jan 2022 22:56:13 +0000 (22:56 +0000)]
Auto merge of #92627 - matthiaskrgr:rollup-xmz0rib, r=matthiaskrgr

Rollup of 8 pull requests

Successful merges:

 - #91055 (return the correct type for closures in `type_of`)
 - #92207 (Delay remaining `span_bug`s in drop elaboration)
 - #92417 (Fix spacing and ordering of words in pretty printed Impl)
 - #92504 (Exit nonzero on rustc -Wall)
 - #92559 (RustWrapper: adapt to new AttributeMask API)
 - #92589 (Break the loop)
 - #92607 (rustc_metadata: Some minor cleanups and optimizations)
 - #92620 (Remove unused `ExtendDefault` struct)

Failed merges:

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

2 years agoRollup merge of #92620 - steffahn:remove_unused_ExtendDefault_struct, r=Mark-Simulacrum
Matthias Krüger [Thu, 6 Jan 2022 22:15:23 +0000 (23:15 +0100)]
Rollup merge of #92620 - steffahn:remove_unused_ExtendDefault_struct, r=Mark-Simulacrum

Remove unused `ExtendDefault` struct

As noted in https://github.com/rust-lang/rust/pull/77850#issuecomment-1002272054, this struct is no longer used.

2 years agoRollup merge of #92607 - petrochenkov:doctrscope2, r=cjgillot
Matthias Krüger [Thu, 6 Jan 2022 22:15:21 +0000 (23:15 +0100)]
Rollup merge of #92607 - petrochenkov:doctrscope2, r=cjgillot

rustc_metadata: Some minor cleanups and optimizations

Mostly extracted from https://github.com/rust-lang/rust/pull/88679 (which is otherwise a rustdoc PR).
r? ``@cjgillot``

2 years agoRollup merge of #92589 - ChrisDenton:break-loop, r=Mark-Simulacrum
Matthias Krüger [Thu, 6 Jan 2022 22:15:20 +0000 (23:15 +0100)]
Rollup merge of #92589 - ChrisDenton:break-loop, r=Mark-Simulacrum

Break the loop

A missing break statement lead to an infinite loop in bootstrap.py.

I also added a short sleep so it's not constantly running at 100%. But I can remove that if it's not wanted.

Fixes #76661

2 years agoRollup merge of #92559 - durin42:llvm-14-attributemask, r=nikic
Matthias Krüger [Thu, 6 Jan 2022 22:15:18 +0000 (23:15 +0100)]
Rollup merge of #92559 - durin42:llvm-14-attributemask, r=nikic

RustWrapper: adapt to new AttributeMask API

Upstream LLVM change 9290ccc3c1a1 migrated attribute removal to use
AttributeMask instead of AttrBuilder, so we need to follow suit here.

r? ``@nagisa`` cc ``@nikic``

2 years agoRollup merge of #92504 - dtolnay:wall, r=jackh726
Matthias Krüger [Thu, 6 Jan 2022 22:15:17 +0000 (23:15 +0100)]
Rollup merge of #92504 - dtolnay:wall, r=jackh726

Exit nonzero on rustc -Wall

Previously `rustc -Wall /dev/null` would print a paragraph explaining that `-Wall` is not a thing in Rust, but would then exit 0. I believe exiting 0 is not the right behavior. For something like `rustc --version` or `rustc --help` or `rustc -C help` the user is requesting rustc to print some information; rustc prints that information and exits 0 because what the user requested has been accomplished. In the case of `rustc -Wall path/to/main.rs`, I don't find it correct to conceptualize this as "the user requested rustc to print information about the fact that Wall doesn't exist". The user requested a particular thing, and despite rustc knowing what they probably meant and informing them about that, the thing they requested has *not* been accomplished. Thus a nonzero exit code is needed.

2 years agoRollup merge of #92417 - dtolnay:printimpl, r=jackh726
Matthias Krüger [Thu, 6 Jan 2022 22:15:16 +0000 (23:15 +0100)]
Rollup merge of #92417 - dtolnay:printimpl, r=jackh726

Fix spacing and ordering of words in pretty printed Impl

Follow-up to #92238 fixing one of the FIXMEs.

```rust
macro_rules! repro {
    ($item:item) => {
        stringify!($item)
    };
}

fn main() {
    println!("{}", repro!(impl<T> Struct<T> {}));
    println!("{}", repro!(impl<T> const Trait for T {}));
}
```

Before:&ensp;`impl <T> Struct<T> {}`
After:&ensp;`impl<T> Struct<T> {}`

Before:&ensp;`impl const <T> Trait for T {}` :crying_cat_face:
After:&ensp;`impl<T> const Trait for T {}`

2 years agoRollup merge of #92207 - tmiasko:delay-drop-elaboration-bug, r=jackh726
Matthias Krüger [Thu, 6 Jan 2022 22:15:14 +0000 (23:15 +0100)]
Rollup merge of #92207 - tmiasko:delay-drop-elaboration-bug, r=jackh726

Delay remaining `span_bug`s in drop elaboration

This follows changes from #67967 and converts remaining `span_bug`s into
delayed bugs, since for const items drop elaboration might be executed
on a MIR which failed borrowck.

Fixes #81708.
Fixes #91816.

2 years agoRollup merge of #91055 - lcnr:type_of-closures, r=nikomatsakis
Matthias Krüger [Thu, 6 Jan 2022 22:15:13 +0000 (23:15 +0100)]
Rollup merge of #91055 - lcnr:type_of-closures, r=nikomatsakis

return the correct type for closures in `type_of`

A bit unhappy about the way `typeck::check_crate` works rn. Would have preferred to not change `CollectItemTypesVisitor` in this way.

r? ``@nikomatsakis``

2 years agoExit nonzero on rustc -Wall
David Tolnay [Sun, 2 Jan 2022 22:24:11 +0000 (14:24 -0800)]
Exit nonzero on rustc -Wall

2 years agoremove unused ExtendDefault struct
Frank Steffahn [Thu, 6 Jan 2022 17:48:10 +0000 (18:48 +0100)]
remove unused ExtendDefault struct

2 years agoAuto merge of #92609 - matthiaskrgr:rollup-ldp47ot, r=matthiaskrgr
bors [Thu, 6 Jan 2022 15:30:46 +0000 (15:30 +0000)]
Auto merge of #92609 - matthiaskrgr:rollup-ldp47ot, r=matthiaskrgr

Rollup of 7 pull requests

Successful merges:

 - #92058 (Make Run button visible on hover)
 - #92288 (Fix a pair of mistyped test cases in `std::net::ip`)
 - #92349 (Fix rustdoc::private_doc_tests lint for public re-exported items)
 - #92360 (Some cleanups around check_argument_types)
 - #92389 (Regression test for borrowck ICE #92015)
 - #92404 (Fix font size for [src] links in headers)
 - #92443 (Rustdoc: resolve associated traits for non-generic primitive types)

Failed merges:

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

2 years agoCreate CSS class instead of using inline style for search results
Guillaume Gomez [Thu, 6 Jan 2022 12:08:57 +0000 (13:08 +0100)]
Create CSS class instead of using inline style for search results

2 years agoAuto merge of #89819 - davidtwco:issue-81024-multiple-crates-multiple-dwarves, r...
bors [Thu, 6 Jan 2022 12:21:10 +0000 (12:21 +0000)]
Auto merge of #89819 - davidtwco:issue-81024-multiple-crates-multiple-dwarves, r=nagisa

cg: split dwarf for crate dependencies

Fixes #81024.

- In #79570, `-Z split-dwarf-kind={none,single,split}` was replaced by `-C split-debuginfo={off,packed,unpacked}`. `-C split-debuginfo`'s packed and unpacked aren't exact parallels to single and split, respectively.

  On Unix, `-C split-debuginfo=packed` will put debuginfo in object files and package debuginfo into a DWARF package file (`.dwp`) and `-C split-debuginfo=unpacked` will put debuginfo in dwarf object files and won't package it.

  In the initial implementation of Split DWARF, split mode wrote sections which did not require relocation into a DWARF object (`.dwo`) file which was ignored by the linker and then packaged those DWARF objects into DWARF packages (`.dwp`). In single mode, sections which did not require relocation were written into object files but ignored by the linker and were not packaged. However, both split and single modes could be packaged or not, the primary difference in behaviour was where the debuginfo sections that did not require link-time relocation were written (in a DWARF object or the object file).

  In the first commit of this PR, I re-introduce a `-Z split-dwarf-kind` flag, which can be used to pick between split and single modes when `-C split-debuginfo` is used to enable Split DWARF (either packed or unpacked).
- Split DWARF packaging requires all of the object files to exist, including those in dependencies. ~~Therefore, the second commit of this PR makes rustc keep all objects or dwarf objects for unpacked mode and if the crate is a dependency in packed mode (determined by heuristic: if no linking is taking place), then objects or dwarf objects are kept. Objects are kept if `-Z split-dwarf-kind` is `SplitDwarfKind::Single`, and dwarf objects if `SplitDwarfKind::Split`.~~

  ~~There are other approaches that could be taken to supporting packed Split DWARF with crate dependencies but this seemed like the least complicated and was contained to only rustc. Other potential approaches are described in https://github.com/rust-lang/rust/issues/81024#issuecomment-760478223, I'm happy to change the approach I've taken here if it isn't what we're looking for.~~ See https://github.com/rust-lang/rust/pull/89819#issuecomment-985671867 for the current approach.
- ~~There's still a dependency on `llvm-dwp` after this change, which [we probably want to move away from](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/llvm-dwp.20is.20not.20recommended) but that seems out-of-scope for this PR. Ideally, Split DWARF (in packed or unpacked modes) will be usable on nightly after this lands. If there aren't any bugs reported then it's possible we could allow Split DWARF to be used on stable after this change, it depends whether or not switching away from `llvm-dwp` later would break any guarantees, or whether we'd want to change how we handle this cross-crate case in future.~~ See https://github.com/rust-lang/rust/pull/89819#issuecomment-985671867.

r? `@nagisa`
cc `@alexcrichton`

2 years agoRollup merge of #92443 - mdibaiee:90703/resolve-traits-of-primitive-types, r=Manishearth
Matthias Krüger [Thu, 6 Jan 2022 11:01:05 +0000 (12:01 +0100)]
Rollup merge of #92443 - mdibaiee:90703/resolve-traits-of-primitive-types, r=Manishearth

Rustdoc: resolve associated traits for non-generic primitive types

Fixes #90703

This seems to work:
<img width="457" alt="image" src="https://user-images.githubusercontent.com/2807772/147774059-9556ff96-4519-409e-8ed0-c33ecc436171.png">

I'm just afraid I might have missed some cases / broken previous functionality.

I also have not written tests yet, I will have to take a look to see where tests are and how they are structured, but any help there is also appreciated.

2 years agoRollup merge of #92404 - GuillaumeGomez:src-font-size, r=jsha
Matthias Krüger [Thu, 6 Jan 2022 11:01:04 +0000 (12:01 +0100)]
Rollup merge of #92404 - GuillaumeGomez:src-font-size, r=jsha

Fix font size for [src] links in headers

Fixes #90384.

cc `@jsha`
r? `@camelid`

2 years agoRollup merge of #92389 - chordtoll:test-92015, r=Mark-Simulacrum
Matthias Krüger [Thu, 6 Jan 2022 11:01:03 +0000 (12:01 +0100)]
Rollup merge of #92389 - chordtoll:test-92015, r=Mark-Simulacrum

Regression test for borrowck ICE #92015

This issue has come up a few times. Creating a regression test.
Closes #92015.

2 years agoRollup merge of #92360 - jackh726:param-heuristics-1, r=davidtwco
Matthias Krüger [Thu, 6 Jan 2022 11:01:02 +0000 (12:01 +0100)]
Rollup merge of #92360 - jackh726:param-heuristics-1, r=davidtwco

Some cleanups around check_argument_types

Split out in ways from my rebase/continuation of #71827

Commits are mostly self-explanatory and these changes should be fairly straightforward

2 years agoRollup merge of #92349 - avitex:fix-rustdoc-private-doc-tests, r=GuillaumeGomez
Matthias Krüger [Thu, 6 Jan 2022 11:01:01 +0000 (12:01 +0100)]
Rollup merge of #92349 - avitex:fix-rustdoc-private-doc-tests, r=GuillaumeGomez

Fix rustdoc::private_doc_tests lint for public re-exported items

Closes #72081

This involves changing the lint to check the access level is exported, rather than public.
The [exported access level](https://github.com/rust-lang/rust/blob/e91ad5fc62bdee4a29c18baa5fad2ca42fc91bf4/compiler/rustc_middle/src/middle/privacy.rs#L24) accounts for public items and items accessible to other crates with the help of `pub use` re-exports.
The pattern of re-exporting public items from a private module is usage seen in a number of popular crates.

2 years agoRollup merge of #92288 - yescallop:patch-1, r=m-ou-se
Matthias Krüger [Thu, 6 Jan 2022 11:01:00 +0000 (12:01 +0100)]
Rollup merge of #92288 - yescallop:patch-1, r=m-ou-se

Fix a pair of mistyped test cases in `std::net::ip`

These two test cases are not consistent with their comments, which I believe is unintended.

2 years agoRollup merge of #92058 - jsha:run-on-hover, r=GuillaumeGomez
Matthias Krüger [Thu, 6 Jan 2022 11:00:59 +0000 (12:00 +0100)]
Rollup merge of #92058 - jsha:run-on-hover, r=GuillaumeGomez

Make Run button visible on hover

This slightly reduces the noisiness of doc pages, making them easier to read.

Demo: https://rustdoc.crud.net/jsha/run-on-hover/std/string/struct.String.html

[Discussed on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/.22Run.22.20button.20visible.20on.20hover).

Part of #59845

2 years agoRevert "bootstrap: copy `llvm-dwp` to sysroot"
David Wood [Fri, 3 Dec 2021 14:34:35 +0000 (14:34 +0000)]
Revert "bootstrap: copy `llvm-dwp` to sysroot"

This reverts commit 241160de72b5b55187ca54243e2a6e82e336d07c.

2 years agocg: use thorin instead of llvm-dwp
David Wood [Fri, 3 Dec 2021 14:24:05 +0000 (14:24 +0000)]
cg: use thorin instead of llvm-dwp

`thorin` is a Rust implementation of a DWARF packaging utility that
supports reading DWARF objects from archive files (i.e. rlibs) and
therefore is better suited for integration into rustc.

Signed-off-by: David Wood <david.wood@huawei.com>
2 years agosess/cg: re-introduce split dwarf kind
David Wood [Fri, 8 Oct 2021 16:10:17 +0000 (16:10 +0000)]
sess/cg: re-introduce split dwarf kind

In #79570, `-Z split-dwarf-kind={none,single,split}` was replaced by `-C
split-debuginfo={off,packed,unpacked}`. `-C split-debuginfo`'s packed
and unpacked aren't exact parallels to single and split, respectively.

On Unix, `-C split-debuginfo=packed` will put debuginfo into object
files and package debuginfo into a DWARF package file (`.dwp`) and
`-C split-debuginfo=unpacked` will put debuginfo into dwarf object files
and won't package it.

In the initial implementation of Split DWARF, split mode wrote sections
which did not require relocation into a DWARF object (`.dwo`) file which
was ignored by the linker and then packaged those DWARF objects into
DWARF packages (`.dwp`). In single mode, sections which did not require
relocation were written into object files but ignored by the linker and
were not packaged. However, both split and single modes could be
packaged or not, the primary difference in behaviour was where the
debuginfo sections that did not require link-time relocation were
written (in a DWARF object or the object file).

This commit re-introduces a `-Z split-dwarf-kind` flag, which can be
used to pick between split and single modes when `-C split-debuginfo` is
used to enable Split DWARF (either packed or unpacked).

Signed-off-by: David Wood <david.wood@huawei.com>
2 years agorustc_metadata: Split `fn get_implementations_for_trait` into two functions
Vadim Petrochenkov [Thu, 6 Jan 2022 07:13:22 +0000 (15:13 +0800)]
rustc_metadata: Split `fn get_implementations_for_trait` into two functions

2 years agorustc_metadata: Make `opt_item_ident` in decoder faster and stricter
Vadim Petrochenkov [Thu, 6 Jan 2022 04:23:01 +0000 (12:23 +0800)]
rustc_metadata: Make `opt_item_ident` in decoder faster and stricter

By avoiding formatting and allocations in the no-ident case, and by making the span mandatory if the ident exists.

Use the optimized `opt_item_ident` to cleanup `fn each_child_of_item`

2 years agoadd some missing must use to float ops
asquared31415 [Wed, 5 Jan 2022 23:58:45 +0000 (18:58 -0500)]
add some missing must use to float ops

2 years agorustc_metadata: Make attribute decoding slightly faster and stricter
Vadim Petrochenkov [Thu, 6 Jan 2022 04:13:41 +0000 (12:13 +0800)]
rustc_metadata: Make attribute decoding slightly faster and stricter

Rename `CStore::item_attrs` -> `CStore::item_attrs_untracked` top follow conventions

2 years agorustc_middle: Add a method for getting a `SimplifiedType` definition/ID
Vadim Petrochenkov [Thu, 6 Jan 2022 04:02:00 +0000 (12:02 +0800)]
rustc_middle: Add a method for getting a `SimplifiedType` definition/ID

Import `SimplifiedType` more

2 years agoSimplify :target CSS selector
Guillaume Gomez [Wed, 5 Jan 2022 20:28:19 +0000 (21:28 +0100)]
Simplify :target CSS selector

2 years agoRustWrapper: simplify removing attributes
Augie Fackler [Wed, 5 Jan 2022 18:51:59 +0000 (13:51 -0500)]
RustWrapper: simplify removing attributes

Avoids some extra conversions. Spotted by nikic during review.

2 years agoBreak the loop
Chris Denton [Wed, 5 Jan 2022 17:55:52 +0000 (17:55 +0000)]
Break the loop

A missing break statement lead to an infinite loop in bootstrap.py.

2 years agoAdd test for [src] font-size in headers
Guillaume Gomez [Wed, 29 Dec 2021 13:56:07 +0000 (14:56 +0100)]
Add test for [src] font-size in headers

2 years agoFix font size for [src] links in headers
Guillaume Gomez [Wed, 29 Dec 2021 13:55:49 +0000 (14:55 +0100)]
Fix font size for [src] links in headers

2 years agoAuto merge of #92587 - matthiaskrgr:rollup-qnwa8qx, r=matthiaskrgr
bors [Wed, 5 Jan 2022 15:28:36 +0000 (15:28 +0000)]
Auto merge of #92587 - matthiaskrgr:rollup-qnwa8qx, r=matthiaskrgr

Rollup of 7 pull requests

Successful merges:

 - #92092 (Drop guards in slice sorting derive src pointers from &mut T, which is invalidated by interior mutation in comparison)
 - #92388 (Fix a minor mistake in `String::try_reserve_exact` examples)
 - #92442 (Add negative `impl` for `Ord`, `PartialOrd` on `LocalDefId`)
 - #92483 (Stabilize `result_cloned` and `result_copied`)
 - #92574 (Add RISC-V detection macro and more architecture instructions)
 - #92575 (ast: Always keep a `NodeId` in `ast::Crate`)
 - #92583 (:arrow_up: rust-analyzer)

Failed merges:

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

2 years agoMake Run button visible on hover
Jacob Hoffman-Andrews [Sat, 18 Dec 2021 06:38:18 +0000 (22:38 -0800)]
Make Run button visible on hover

This slightly reduces the noisiness of doc pages, making them easier to
read.

2 years agoRollup merge of #92583 - lnicola:rust-analyzer-2022-01-05, r=lnicola
Matthias Krüger [Wed, 5 Jan 2022 14:05:50 +0000 (15:05 +0100)]
Rollup merge of #92583 - lnicola:rust-analyzer-2022-01-05, r=lnicola

:arrow_up: rust-analyzer

r? `@ghost`

2 years agoRollup merge of #92575 - petrochenkov:cratenodeid, r=Aaron1011
Matthias Krüger [Wed, 5 Jan 2022 14:05:49 +0000 (15:05 +0100)]
Rollup merge of #92575 - petrochenkov:cratenodeid, r=Aaron1011

ast: Always keep a `NodeId` in `ast::Crate`

This makes it more uniform with other expanded nodes.
It makes generic code in https://github.com/rust-lang/rust/pull/92573 simpler in particular.

This is another follow-up to https://github.com/rust-lang/rust/pull/91313.
r? `@Aaron1011`

2 years agoRollup merge of #92574 - luojia65:riscv-kernel-dev-rust, r=Amanieu
Matthias Krüger [Wed, 5 Jan 2022 14:05:48 +0000 (15:05 +0100)]
Rollup merge of #92574 - luojia65:riscv-kernel-dev-rust, r=Amanieu

Add RISC-V detection macro and more architecture instructions

This pull request includes:

- Update `stdarch` dependency to include ratified RISC-V supervisor and hypervisor instruction intrinsics which is useful in Rust kernel development
- Add macro `is_riscv_feature_detected!`
- Modify impl of `core::hint::spin_loop` to comply with latest version of `core::arch`

After this update, users may now develop RISC-V kernels and user applications more freely.

r? `@Amanieu`

2 years agoRollup merge of #92483 - ksqsf:master, r=dtolnay
Matthias Krüger [Wed, 5 Jan 2022 14:05:47 +0000 (15:05 +0100)]
Rollup merge of #92483 - ksqsf:master, r=dtolnay

Stabilize `result_cloned` and `result_copied`

Tracking issue: #63168

The FCP is now completed.

2 years agoRollup merge of #92442 - pierwill:localdefid-doc-ord, r=Aaron1011
Matthias Krüger [Wed, 5 Jan 2022 14:05:46 +0000 (15:05 +0100)]
Rollup merge of #92442 - pierwill:localdefid-doc-ord, r=Aaron1011

Add negative `impl` for `Ord`, `PartialOrd` on `LocalDefId`

Suggested in https://github.com/rust-lang/rust/pull/92233#discussion_r776123222.

This also fixes some formatting in the doc comment.

r? `@cjgillot`

2 years agoRollup merge of #92388 - SpriteOvO:master, r=Mark-Simulacrum
Matthias Krüger [Wed, 5 Jan 2022 14:05:45 +0000 (15:05 +0100)]
Rollup merge of #92388 - SpriteOvO:master, r=Mark-Simulacrum

Fix a minor mistake in `String::try_reserve_exact` examples

The examples of `String::try_reserve_exact` didn't actually use `try_reserve_exact`, which was probably a minor mistake, and this PR fixed it.

2 years agoRollup merge of #92092 - saethlin:fix-sort-guards-sb, r=danielhenrymantilla
Matthias Krüger [Wed, 5 Jan 2022 14:05:44 +0000 (15:05 +0100)]
Rollup merge of #92092 - saethlin:fix-sort-guards-sb, r=danielhenrymantilla

Drop guards in slice sorting derive src pointers from &mut T, which is invalidated by interior mutation in comparison

I tried to run https://github.com/rust-lang/miri-test-libstd on `alloc` with `-Zmiri-track-raw-pointers`, and got a failure on the test `slice::panic_safe`. The test failure has nothing to do with panic safety, it's from how the test tests for panic safety.

I minimized the test failure into this very silly program:
```rust
use std::cell::Cell;
use std::cmp::Ordering;

#[derive(Clone)]
struct Evil(Cell<usize>);

fn main() {
    let mut input = vec![Evil(Cell::new(0)); 3];

    // Hits the bug pattern via CopyOnDrop in core
    input.sort_unstable_by(|a, _b| {
        a.0.set(0);
        Ordering::Less
    });

    // Hits the bug pattern via InsertionHole in alloc
    input.sort_by(|_a, b| {
        b.0.set(0);
        Ordering::Less
    });
}
```

To fix this, I'm just removing the mutability/uniqueness where it wasn't required.

2 years agoAuto merge of #92580 - matthiaskrgr:rollup-nzyn65y, r=matthiaskrgr
bors [Wed, 5 Jan 2022 12:32:28 +0000 (12:32 +0000)]
Auto merge of #92580 - matthiaskrgr:rollup-nzyn65y, r=matthiaskrgr

Rollup of 7 pull requests

Successful merges:

 - #92182 (Label more build steps)
 - #92188 (rustdoc: Clean up NestedAttributesExt trait/implementation)
 - #92322 (Add another implementation example to Debug trait)
 - #92448 (Set font size proportional to user's font size)
 - #92517 (Explicitly pass `PATH` to the Windows exe resolver)
 - #92545 (Extract init_env_logger to crate)
 - #92579 (update Miri)

Failed merges:

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

2 years ago:arrow_up: rust-analyzer
Laurențiu Nicola [Wed, 5 Jan 2022 11:43:32 +0000 (13:43 +0200)]
:arrow_up: rust-analyzer

2 years agoRollup merge of #92579 - RalfJung:miri, r=RalfJung
Matthias Krüger [Wed, 5 Jan 2022 10:26:09 +0000 (11:26 +0100)]
Rollup merge of #92579 - RalfJung:miri, r=RalfJung

update Miri

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

2 years agoRollup merge of #92545 - dtolnay:rustlog, r=petrochenkov
Matthias Krüger [Wed, 5 Jan 2022 10:26:08 +0000 (11:26 +0100)]
Rollup merge of #92545 - dtolnay:rustlog, r=petrochenkov

Extract init_env_logger to crate

I've been doing some work on rustc_ast_pretty using an out-of-tree main.rs and Cargo.toml with the following:

```toml
[dependencies]
rustc_ast = { path = "../rust/compiler/rustc_ast" }
rustc_ast_pretty = { path = "../rust/compiler/rustc_ast_pretty" }
rustc_span = { path = "../rust/compiler/rustc_span" }
```

Rustc_ast_pretty helpfully uses `tracing::debug!` but I found that in order to enable the debug output, my test crate must depend on rustc_driver which is an enormously bigger dependency than what I have been using so far, and slows down iteration time because an enormous dependency tree between rustc_ast and rustc_driver must now be rebuilt after every ast change.

I pulled out the tracing initialization to a new minimal rustc_log crate so that projects depending on the other rustc crates, like rustc_ast_pretty, can access the `debug!` messages in them without building all the rest of rustc.

2 years agoRollup merge of #92517 - ChrisDenton:explicit-path, r=dtolnay
Matthias Krüger [Wed, 5 Jan 2022 10:26:07 +0000 (11:26 +0100)]
Rollup merge of #92517 - ChrisDenton:explicit-path, r=dtolnay

Explicitly pass `PATH` to the Windows exe resolver

This allows for testing different `PATH`s without using the actual environment.

2 years agoRollup merge of #92448 - jsha:font-size-access, r=GuillaumeGomez
Matthias Krüger [Wed, 5 Jan 2022 10:26:06 +0000 (11:26 +0100)]
Rollup merge of #92448 - jsha:font-size-access, r=GuillaumeGomez

Set font size proportional to user's font size

According to MDN (https://developer.mozilla.org/en-US/docs/Web/CSS/font-size),

> To maximize accessibility, it is generally best to use values that are relative to the user's default font size.

> Defining font sizes in px is not accessible, because the user cannot change the font size in some browsers.

Note that changing font size (in browser or OS settings) is distinct from the zoom functionality triggered with Ctrl/Cmd-+. Zoom
functionality increases the size of everything on the page, effectively applying a multiplier to all pixel sizes. Font size changes apply to just text.

For relative font sizes, we could use `em`, as we do in several places already. However that has a problem of "compounding" (see MDN article for details). The compounding problem is nicely solved by `rem`, which make font sizes relative to the root element, not the parent element.

Since we were using a hodge-podge of pixel sizes, em, rem, and percentage sizes before, this change switches everything to rem, while keeping the same size relative to our old default of 16px.

16px is still the default on most browsers, for users that haven't set a larger or smaller font size.

Part of #59845. Note: this will conflict with #92404. We should merge that first (once it's done) and I'll resolve the merge conflicts.

r? `@GuillaumeGomez`

Demo: https://rustdoc.crud.net/jsha/font-size-access/std/string/struct.String.html

2 years agoRollup merge of #92322 - alper:add_debug_trait_documentation, r=dtolnay
Matthias Krüger [Wed, 5 Jan 2022 10:26:05 +0000 (11:26 +0100)]
Rollup merge of #92322 - alper:add_debug_trait_documentation, r=dtolnay

Add another implementation example to Debug trait

As per the discussion in: #92276

2 years agoRollup merge of #92188 - vacuus:nested-attributes-ext, r=jyn514
Matthias Krüger [Wed, 5 Jan 2022 10:26:04 +0000 (11:26 +0100)]
Rollup merge of #92188 - vacuus:nested-attributes-ext, r=jyn514

rustdoc: Clean up NestedAttributesExt trait/implementation

2 years agoRollup merge of #92182 - nnethercote:label-more-build-steps, r=Mark-Simulacrum
Matthias Krüger [Wed, 5 Jan 2022 10:26:03 +0000 (11:26 +0100)]
Rollup merge of #92182 - nnethercote:label-more-build-steps, r=Mark-Simulacrum

Label more build steps

Some small improvements.

r? ```@Mark-Simulacrum```

2 years agoupdate Miri
Ralf Jung [Wed, 5 Jan 2022 09:41:22 +0000 (10:41 +0100)]
update Miri

2 years agoAuto merge of #92103 - Kobzol:stable-hash-skip-zero-bytes, r=the8472
bors [Wed, 5 Jan 2022 09:27:18 +0000 (09:27 +0000)]
Auto merge of #92103 - Kobzol:stable-hash-skip-zero-bytes, r=the8472

Do not hash leading zero bytes of i64 numbers in Sip128 hasher

I was poking into the stable hasher, trying to improve its performance by compressing the number of hashed bytes. First I was experimenting with LEB128, but it was painful to implement because of the many assumptions that the SipHasher makes, so I tried something simpler - just ignoring leading zero bytes. For example, if an 8-byte integer can fit into a 4-byte integer, I will just hash the four bytes.

I wonder if this could produce any hashing ambiguity. Originally I thought so, but then I struggled to find any counter-example where this could cause different values to have the same hash. I'd be glad for any examples that could be broken by this (there are some ways of mitigating it if that would be the case). It could happen if you had e.g. 2x `u8` vs 1x `u16` hashed after one another in two different runs, but that can also happen now, without this "trick". And with collections, it should be fine, because the length is included in their hash.

I gathered some statistics for common values used in the `clap` benchmark. I observed that especially `i64` often had very low values, so I started with that type, let's see what perf does on CI.

There are some tradeoffs that we can try:
1) What types to use this optimization for? `u64`, `u32`, `u16`? Locally it was a slight loss for `u64`, I noticed that its values are often quite large.
2) What byte sizes to check? E.g. we can only distinguish between `u64`/`u32` or `u64`/`u8` instead of `u64`/`u32`/`u16`/`u8` to reduce branching (with `i64` it seemed to be better to go all the way down to `u8` locally though).

(The macro was introduced because I expect that I will be trying out this "trick" for different types).

Can you please schedule a perf. run? Thanks.

r? `@the8472`

2 years agoast: Always keep a `NodeId` in `ast::Crate`
Vadim Petrochenkov [Wed, 5 Jan 2022 08:09:55 +0000 (16:09 +0800)]
ast: Always keep a `NodeId` in `ast::Crate`

This makes it more uniform with other expanded nodes

2 years agoRemove unsupported types in primitive_to_ty conversion, add FIXME note
Mahdi Dibaiee [Mon, 3 Jan 2022 18:08:19 +0000 (18:08 +0000)]
Remove unsupported types in primitive_to_ty conversion, add FIXME note

2 years agoadd a test case for each supported primitive type
Mahdi Dibaiee [Mon, 3 Jan 2022 10:28:01 +0000 (10:28 +0000)]
add a test case for each supported primitive type

2 years agoRustdoc: resolve associated traits for primitive types
Mahdi Dibaiee [Thu, 30 Dec 2021 17:07:05 +0000 (17:07 +0000)]
Rustdoc: resolve associated traits for primitive types

Fixes #90703

2 years agoAdd is_riscv_feature_detected!; modify impl of hint::spin_loop
luojia65 [Wed, 5 Jan 2022 07:28:03 +0000 (15:28 +0800)]
Add is_riscv_feature_detected!; modify impl of hint::spin_loop

Update library/core/src/hint.rs

Co-authored-by: Amanieu d'Antras <amanieu@gmail.com>
Remove redundant config gate

2 years agoAuto merge of #92498 - camelid:ignore-flaky-test, r=Mark-Simulacrum
bors [Wed, 5 Jan 2022 06:18:57 +0000 (06:18 +0000)]
Auto merge of #92498 - camelid:ignore-flaky-test, r=Mark-Simulacrum

Ignore flaky `panic-short-backtrace-windows-x86_64.rs` test for now

Mitigates (but does not fix) #92000.

It has been causing a lot of spurious test failures recently that slow
down the bors queue.

2 years agoIgnore flaky `panic-short-backtrace-windows-x86_64.rs` test for now
Noah Lev [Sun, 2 Jan 2022 20:13:18 +0000 (12:13 -0800)]
Ignore flaky `panic-short-backtrace-windows-x86_64.rs` test for now

It has been causing a lot of spurious test failures recently that slow
down the bors queue.

2 years agoAuto merge of #92567 - ehuss:update-cargo, r=ehuss
bors [Wed, 5 Jan 2022 03:03:17 +0000 (03:03 +0000)]
Auto merge of #92567 - ehuss:update-cargo, r=ehuss

Update cargo

10 commits in fcef61230c3b6213b6b0d233a36ba4ebd1649ec3..358e79fe56fe374649275ca7aebaafd57ade0e8d
2021-12-17 02:30:38 +0000 to 2022-01-04 18:39:45 +0000
- Make rmeta_required no longer depend on whether timing is enabled (rust-lang/cargo#10254)
- The first version of pull request template (rust-lang/cargo#10218)
- Stabilize the `strip` profile option, now that rustc has stable `-C strip` (rust-lang/cargo#10088)
- Update docs for windows ssh-agent. (rust-lang/cargo#10248)
- Fix typo: substract -&gt; subtract (rust-lang/cargo#10244)
- timings: Fix tick mark alignment (rust-lang/cargo#10239)
- Remove unused lifetimes (rust-lang/cargo#10238)
- Make levenshtein distance case insensitive. (rust-lang/cargo#10224)
- [docs] Adds basic CI yaml for GitHub Actions (rust-lang/cargo#10212)
- Add function for parsing already-read manifest (rust-lang/cargo#10209)

2 years agoAdd note about non_exhaustive to variant_count
Mark Rousskov [Wed, 5 Jan 2022 02:57:33 +0000 (21:57 -0500)]
Add note about non_exhaustive to variant_count

2 years agoUpdate cargo
Eric Huss [Wed, 5 Jan 2022 02:41:07 +0000 (18:41 -0800)]
Update cargo

2 years agoAuto merge of #92560 - matthiaskrgr:rollup-jeli7ip, r=matthiaskrgr
bors [Tue, 4 Jan 2022 23:01:49 +0000 (23:01 +0000)]
Auto merge of #92560 - matthiaskrgr:rollup-jeli7ip, r=matthiaskrgr

Rollup of 7 pull requests

Successful merges:

 - #91587 (core::ops::unsize: improve docs for DispatchFromDyn)
 - #91907 (Allow `_` as the length of array types and repeat expressions)
 - #92515 (RustWrapper: adapt for an LLVM API change)
 - #92516 (Do not use deprecated -Zsymbol-mangling-version in bootstrap)
 - #92530 (Move `contains` method of Option and Result lower in docs)
 - #92546 (Update books)
 - #92551 (rename StackPopClean::None to Root)

Failed merges:

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

2 years agoTouch up Debug example from PR 92322
David Tolnay [Tue, 4 Jan 2022 22:25:20 +0000 (14:25 -0800)]
Touch up Debug example from PR 92322

2 years agoRollup merge of #92551 - RalfJung:stack-pop-cleanup, r=oli-obk
Matthias Krüger [Tue, 4 Jan 2022 20:23:12 +0000 (21:23 +0100)]
Rollup merge of #92551 - RalfJung:stack-pop-cleanup, r=oli-obk

rename StackPopClean::None to Root

With https://github.com/rust-lang/rust/pull/90102, `StackPopClean::None` is now only used for the "root" frame of the stack, so adjust its name accordingly and add an assertion.

r? `@oli-obk`

2 years agoRollup merge of #92546 - ehuss:update-books, r=ehuss
Matthias Krüger [Tue, 4 Jan 2022 20:23:11 +0000 (21:23 +0100)]
Rollup merge of #92546 - ehuss:update-books, r=ehuss

Update books

## reference

3 commits in 06f9e61931bcf58b91dfe6c924057e42ce273ee1..f8ba2f12df60ee19b96de24ae5b73af3de8a446b
2021-12-17 07:31:40 -0800 to 2022-01-03 11:02:08 -0800
- Switch the default edition for examples to 2021 (rust-lang/reference#1125)
- Clarify behavior of x87 FP registers in inline assembly (rust-lang/reference#1126)
- Add inline assembly to the reference (rust-lang/reference#1105)

## book

36 commits in 8a0bb3c96e71927b80fa2286d7a5a5f2547c6aa4..d3740fb7aad0ea4a80ae20f64dee3a8cfc0c5c3c
2021-12-22 20:54:27 -0500 to 2022-01-03 21:46:04 -0500
- Add a concrete example of an optional value. Fixes rust-lang/book#2848.
- match isn't really an operator. Fixes rust-lang/book#2859
- Edits to edits of chapter 6
- Make fixes recommended by shellcheck
- Use shellcheck
- SIGH fix all the typos that were missed while spellcheck was broken
- SIGH add all the words to the dictionary that were missed while spellcheck was broken
- Remove test_harness from the dictionary
- sigh, the xkcd sandwich one
- Install aspell in CI
- set -eu in all bash scripts
- typo: assignement -&gt; assignment
- Fix quotes
- Snapshot of ch12 for nostarch
- Use 'static lifetime earlier because that's more correct. Fixes rust-lang/book#2864.
- Add does_not_compile annotation to intermediate steps that don't compile
- Sidestep who provides output streams. Fixes rust-lang/book#2933.
- Remove note about primitive obsession. Fixes rust-lang/book#2863.
- Remove sentence encouraging writing tests on your own. Fixes rust-lang/book#2223.
- Bump mdBook version to 0.4.14 in workflow main.yml
- Past tense make better sense
- Past tense makes better sense
- Update the edition in all the listings' Cargo.toml
- Update the book to either say 2021 edition or not talk about editions
- Remove most of the 2018 edition text from the title page. Fixes rust-lang/book#2852.
- Fix word wrapping
- Emphasize return type is mandatory
- fix title capitalization
- Further edits to mention of --include-ignored, propagate to src
- feat: mention `cargo test -- --include-ignored`
- wording: get rid of "to from"
- interchanged position of `binary` and `library`
- Fix wrong word typo
- Further edits in rust-analyzer text
- appendix-04 IDE integration: Replaced rls by rust-analyzer
- Update link to Italian translation. Connects to rust-lang/book#2484.

## rustc-dev-guide

3 commits in 9bf0028b557798ddd07a6f652e4d0c635d3d6620..875464457c4104686faf667f47848aa7b0f0a744
2021-12-20 21:53:57 +0900 to 2021-12-28 22:17:49 -0600
- Update link to moved section (rust-lang/rustc-dev-guide#1282)
- Fix link in contributing.md (rust-lang/rustc-dev-guide#1280)
- Streamline "Getting Started" (rust-lang/rustc-dev-guide#1279)

2 years agoRollup merge of #92530 - dtolnay:contains, r=yaahc
Matthias Krüger [Tue, 4 Jan 2022 20:23:10 +0000 (21:23 +0100)]
Rollup merge of #92530 - dtolnay:contains, r=yaahc

Move `contains` method of Option and Result lower in docs

Follow-up to #92444 trying to get the `Option` and `Result` rustdocs in better shape.

This addresses the request in https://github.com/rust-lang/rust/issues/62358#issuecomment-645676285. The `contains` methods are previously too high up in the docs on both `Option` and `Result` &mdash; stuff like `ok` and `map` and `and_then` should all be featured higher than `contains`. All of those are more ubiquitously useful than `contains`.

2 years agoRollup merge of #92516 - Kobzol:bootstrap-symbol-mangling, r=Mark-Simulacrum
Matthias Krüger [Tue, 4 Jan 2022 20:23:09 +0000 (21:23 +0100)]
Rollup merge of #92516 - Kobzol:bootstrap-symbol-mangling, r=Mark-Simulacrum

Do not use deprecated -Zsymbol-mangling-version in bootstrap

`-Zsymbol-mangling-version` now produces warnings unconditionally. So if you want to use legacy mangling for the compiler (`new-symbol-mangling = false` in `config.toml`), the build is now littered with warnings.

However, with this change, stage 1 `std` doesn't compile:
```
error: `-C symbol-mangling-version=legacy` requires `-Z unstable-options`
```
Even after the bootstrap compiler is updated and it will support `-Csymbol-mangling-version`, the bootstrap code would either need to use `-Z` for the legacy mangling or use `-C` in combination with `-Z unstable-options` (because `-C` + legacy is not allowed without the unstable options). Should we just add `-Z unstable-options` to `std` compilation to resolve this?

Btw I use legacy mangling because the new mangling is not supported by [Hotspot](https://github.com/KDAB/hotspot).

2 years agoRollup merge of #92515 - krasimirgg:rust-head-llvm-0301, r=nagisa
Matthias Krüger [Tue, 4 Jan 2022 20:23:08 +0000 (21:23 +0100)]
Rollup merge of #92515 - krasimirgg:rust-head-llvm-0301, r=nagisa

RustWrapper: adapt for an LLVM API change

No functional changes intended.

The LLVM commit https://github.com/llvm/llvm-project/commit/ec501f15a8b8ace2b283732740d6d65d40d82e09 removed the signed version of `createExpression`.
This adapts the Rust LLVM wrappers accordingly.

2 years agoRollup merge of #91907 - lcnr:const-arg-infer, r=BoxyUwU
Matthias Krüger [Tue, 4 Jan 2022 20:23:06 +0000 (21:23 +0100)]
Rollup merge of #91907 - lcnr:const-arg-infer, r=BoxyUwU

Allow `_` as the length of array types and repeat expressions

r? `@BoxyUwU` cc `@varkor`

2 years agoRollup merge of #91587 - nrc:dispatchfromdyn-docs, r=yaahc
Matthias Krüger [Tue, 4 Jan 2022 20:23:05 +0000 (21:23 +0100)]
Rollup merge of #91587 - nrc:dispatchfromdyn-docs, r=yaahc

core::ops::unsize: improve docs for DispatchFromDyn

Docs-only PR, improves documentation for DispatchFromDyn.

2 years agoAuto merge of #92556 - matthiaskrgr:rollup-s9vopuj, r=matthiaskrgr
bors [Tue, 4 Jan 2022 19:56:13 +0000 (19:56 +0000)]
Auto merge of #92556 - matthiaskrgr:rollup-s9vopuj, r=matthiaskrgr

Rollup of 7 pull requests

Successful merges:

 - #91754 (Modifications to `std::io::Stdin` on Windows so that there is no longer a 4-byte buffer minimum in read().)
 - #91884 (Constify `Box<T, A>` methods)
 - #92107 (Actually set IMAGE_SCN_LNK_REMOVE for .rmeta)
 - #92456 (Make the documentation of builtin macro attributes accessible)
 - #92507 (Suggest single quotes when char expected, str provided)
 - #92525 (intra-doc: Make `Receiver::into_iter` into a clickable link)
 - #92532 (revert #92254 "Bump gsgdt to 0.1.3")

Failed merges:

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