]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoAuto merge of #84552 - GuillaumeGomez:open-impl-blocks-by-default, r=jsha
bors [Tue, 27 Apr 2021 01:58:29 +0000 (01:58 +0000)]
Auto merge of #84552 - GuillaumeGomez:open-impl-blocks-by-default, r=jsha

Open impl blocks by default

Fixes #84558.
Part of #84422.

As you can see on https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/context/struct.TyCtxt.html, impl blocks are currently not open by default whereas they should.

I also realized that a test was outdated so I removed it and opened #84550 because it seems like the rustdoc-gui test suite isn't run on CI...

cc `@jyn514`
r? `@jsha`

3 years agoAuto merge of #84092 - scottmcm:try_trait_initial, r=yaahc,m-ou-se
bors [Mon, 26 Apr 2021 23:17:31 +0000 (23:17 +0000)]
Auto merge of #84092 - scottmcm:try_trait_initial, r=yaahc,m-ou-se

Add the `try_trait_v2` library basics

No compiler changes as part of this -- just new unstable traits and impls thereof.

The goal here is to add the things that aren't going to break anything, to keep the feature implementation simpler in the next PR.

(Draft since the FCP won't end until Saturday, but I was feeling optimistic today -- and had forgotten that FCP was 10 days, not 7 days.)

3 years agoAuto merge of #84600 - m-ou-se:rollup-mf5m2z8, r=m-ou-se
bors [Mon, 26 Apr 2021 19:58:11 +0000 (19:58 +0000)]
Auto merge of #84600 - m-ou-se:rollup-mf5m2z8, r=m-ou-se

Rollup of 4 pull requests

Successful merges:

 - #84120 (Stabilize Duration::MAX)
 - #84523 (Stabilize ordering_helpers.)
 - #84551 (Unify the docs of std::env::{args_os, args} more)
 - #84574 (rustdoc: Fix typos in maybe_inline_local fn)

Failed merges:

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

3 years agoRollup merge of #84574 - hi-rustin:rustin-patch-typo, r=jyn514
Mara Bos [Mon, 26 Apr 2021 19:06:49 +0000 (21:06 +0200)]
Rollup merge of #84574 - hi-rustin:rustin-patch-typo, r=jyn514

rustdoc: Fix typos in maybe_inline_local fn

Introduced by https://github.com/rust-lang/rust/pull/79061.

r? `@jyn514`

3 years agoRollup merge of #84551 - r00ster91:patch-4, r=yaahc
Mara Bos [Mon, 26 Apr 2021 19:06:48 +0000 (21:06 +0200)]
Rollup merge of #84551 - r00ster91:patch-4, r=yaahc

Unify the docs of std::env::{args_os, args} more

I noticed that `args_os` was missing some information and I thought it should mention `args` for when you want more safety just like how `args` mentions `args_os` if you don't want it to panic on invalid Unicode.

3 years agoRollup merge of #84523 - m-ou-se:stabilize-ordering-helpers, r=m-ou-se
Mara Bos [Mon, 26 Apr 2021 19:06:47 +0000 (21:06 +0200)]
Rollup merge of #84523 - m-ou-se:stabilize-ordering-helpers, r=m-ou-se

Stabilize ordering_helpers.

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

Closes https://github.com/rust-lang/rust/issues/79885

3 years agoRollup merge of #84120 - workingjubilee:stabilize-duration-max, r=m-ou-se
Mara Bos [Mon, 26 Apr 2021 19:06:46 +0000 (21:06 +0200)]
Rollup merge of #84120 - workingjubilee:stabilize-duration-max, r=m-ou-se

Stabilize Duration::MAX

Following the suggested direction from https://github.com/rust-lang/rust/issues/76416#issuecomment-817278338, this PR proposes that `Duration::MAX` should have been part of the `duration_saturating_ops` feature flag all along, having been

0. heavily referenced by that feature flag
1. an odd duck next to most of `duration_constants`, as I expressed in https://github.com/rust-lang/rust/issues/57391#issuecomment-717681193
2. introduced in #76114 which added `duration_saturating_ops`

and accordingly should be folded into `duration_saturating_ops` and therefore stabilized.

r? `@m-ou-se`

3 years agoAuto merge of #84174 - camsteffen:slice-diag, r=Mark-Simulacrum
bors [Mon, 26 Apr 2021 17:16:03 +0000 (17:16 +0000)]
Auto merge of #84174 - camsteffen:slice-diag, r=Mark-Simulacrum

Remove slice diagnostic item

...because it is unusally placed on an impl and is redundant with a lang item.

Depends on rust-lang/rust-clippy#7074 (next clippy sync). ~I expect clippy tests to fail in the meantime.~ Nope tests passed...

CC `@flip1995`

3 years agoAuto merge of #84583 - joshtriplett:target-tier-policy, r=pietroalbini
bors [Mon, 26 Apr 2021 14:35:13 +0000 (14:35 +0000)]
Auto merge of #84583 - joshtriplett:target-tier-policy, r=pietroalbini

Add the target tier policy from accepted RFC 2803

3 years agoAuto merge of #84546 - CohenArthur:fix-liveness-typo, r=jyn514
bors [Mon, 26 Apr 2021 11:18:25 +0000 (11:18 +0000)]
Auto merge of #84546 - CohenArthur:fix-liveness-typo, r=jyn514

Fix typo  in report_unsed_assign

The function was called `report_unsed_assign`, which I assume is a typo, considering the rest of the file.
This replaces `report_unsed_assign` with `report_unused_assign`.

3 years agoCross-reference target tier policy from platform-support
Josh Triplett [Mon, 26 Apr 2021 10:33:28 +0000 (03:33 -0700)]
Cross-reference target tier policy from platform-support

3 years agoAdd the target tier policy from accepted RFC 2803
Josh Triplett [Mon, 26 Apr 2021 10:29:37 +0000 (03:29 -0700)]
Add the target tier policy from accepted RFC 2803

3 years agoAdd open attribute on details which are supposed to be open by default instead of...
Guillaume Gomez [Mon, 26 Apr 2021 08:43:49 +0000 (10:43 +0200)]
Add open attribute on details which are supposed to be open by default instead of opening them with JS

3 years agoAuto merge of #83390 - clarfonthey:hasher_docs, r=Amanieu
bors [Mon, 26 Apr 2021 08:21:55 +0000 (08:21 +0000)]
Auto merge of #83390 - clarfonthey:hasher_docs, r=Amanieu

Document Hasher spec decision from #42951

Since that ticket was closed without the decision actually being documented.

Fixes #42951.

3 years agorustdoc: Fix typo for maybe_inline_local fn
hi-rustin [Mon, 26 Apr 2021 05:43:30 +0000 (13:43 +0800)]
rustdoc: Fix typo for maybe_inline_local fn

3 years agoAuto merge of #84543 - paolobarbolini:reverse_bits-const-since, r=m-ou-se
bors [Mon, 26 Apr 2021 05:41:04 +0000 (05:41 +0000)]
Auto merge of #84543 - paolobarbolini:reverse_bits-const-since, r=m-ou-se

Fix 'const-stable since' of reverse_bits

This fixes the const_stable `since` of `reverse_bits` for the signed and unsigned integer types. The previous value was incorrect, as it pointed to an older version where `reverse_bits` hadn't been stabilized yet.

`reverse_bits` was const-stable from the start, as can be seen from:

https://doc.rust-lang.org/1.37.0/std/primitive.u32.html#method.reverse_bits
https://doc.rust-lang.org/1.37.0/std/primitive.i32.html#method.reverse_bits

3 years agoDocument Hasher spec decision from #42951
ltdk [Mon, 22 Mar 2021 19:39:22 +0000 (15:39 -0400)]
Document Hasher spec decision from #42951

3 years agoAuto merge of #84544 - RalfJung:const_fn_in_trait, r=oli-obk
bors [Mon, 26 Apr 2021 02:56:25 +0000 (02:56 +0000)]
Auto merge of #84544 - RalfJung:const_fn_in_trait, r=oli-obk

Always reject `const fn` in `trait` during parsing.

'const fn' in trait are rejected in the AST:
https://github.com/rust-lang/rust/blob/b78c0d8a4d5af91a4a55d029293e3ecb879ec142/compiler/rustc_ast_passes/src/ast_validation.rs#L1411
So this feature gate check is a NOP and we can just remove it.

The src/test/ui/feature-gates/feature-gate-min_const_fn.rs and src/test/ui/feature-gates/feature-gate-const_fn.rs tests ensure that we still reject `const fn` in `trait`

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

3 years agoAuto merge of #84564 - Dylan-DPC:rollup-wxa2yr0, r=Dylan-DPC
bors [Sun, 25 Apr 2021 23:24:14 +0000 (23:24 +0000)]
Auto merge of #84564 - Dylan-DPC:rollup-wxa2yr0, r=Dylan-DPC

Rollup of 8 pull requests

Successful merges:

 - #84235 (refactor StyledBuffer)
 - #84450 (Give a better error when `std` or `core` are missing)
 - #84486 (Handle pretty printing of `else if let` clauses without ICEing)
 - #84499 (Tweak trait not `use`d suggestion)
 - #84516 (Add suggestion to "use break" when attempting to implicit-break a loop)
 - #84520 (Improve diagnostics for function passed when a type was expected.)
 - #84541 (Inline most raw socket, fd and handle conversions)
 - #84547 (Get rid of is_min_const_fn)

Failed merges:

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

3 years agoRollup merge of #84547 - RalfJung:max_const_fn, r=oli-obk
Dylan DPC [Sun, 25 Apr 2021 21:15:18 +0000 (23:15 +0200)]
Rollup merge of #84547 - RalfJung:max_const_fn, r=oli-obk

Get rid of is_min_const_fn

This removes the last trace of the min_const_fn mechanism by making the unsafety checker agnostic about whether something is a min or "non-min" const fn. It seems this distinction was used to disallow some features inside `const fn`, but that is the responsibility of the const checker, not of the unsafety checker. No test seems to even notice this change in the unsafety checker so I guess we are good...

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

3 years agoRollup merge of #84541 - KaiJewson:inline-raw, r=m-ou-se
Dylan DPC [Sun, 25 Apr 2021 21:15:17 +0000 (23:15 +0200)]
Rollup merge of #84541 - KaiJewson:inline-raw, r=m-ou-se

Inline most raw socket, fd and handle conversions

Now that file descriptor types on Unix have niches, it is advantageous for user libraries which provide file descriptor wrappers (e.g. `Socket` from socket2) to store a `File` internally instead of a `RawFd`, so that the niche can be taken advantage of. However, doing so will currently result in worse performance as `IntoRawFd`, `FromRawFd` and `AsRawFd` are not inlined. This change adds `#[inline]` to those methods on std types that wrap file descriptors, handles or sockets.

3 years agoRollup merge of #84520 - hameerabbasi:fn-as-ty, r=lcnr
Dylan DPC [Sun, 25 Apr 2021 21:15:16 +0000 (23:15 +0200)]
Rollup merge of #84520 - hameerabbasi:fn-as-ty, r=lcnr

Improve diagnostics for function passed when a type was expected.

This PR improves diagnostics, it provides more information when a function is passed where a type is expected.

r? `@lcnr`

3 years agoRollup merge of #84516 - torhovland:issue-84114, r=estebank
Dylan DPC [Sun, 25 Apr 2021 21:15:14 +0000 (23:15 +0200)]
Rollup merge of #84516 - torhovland:issue-84114, r=estebank

Add suggestion to "use break" when attempting to implicit-break a loop

Fixes #84114

3 years agoRollup merge of #84499 - estebank:issue-84272, r=jackh726
Dylan DPC [Sun, 25 Apr 2021 21:15:13 +0000 (23:15 +0200)]
Rollup merge of #84499 - estebank:issue-84272, r=jackh726

Tweak trait not `use`d suggestion

Fix #84272. Follow up to #83667.

3 years agoRollup merge of #84486 - Smittyvb:else-if-let-hir-pretty-print, r=petrochenkov
Dylan DPC [Sun, 25 Apr 2021 21:15:12 +0000 (23:15 +0200)]
Rollup merge of #84486 - Smittyvb:else-if-let-hir-pretty-print, r=petrochenkov

Handle pretty printing of `else if let` clauses without ICEing

When pretty printing the HIR of `if ... {} else if let ... {}` clauses, this displays it the `else if let` part as `match` it gets desugared to, the same way normal `if let` statements are currently displayed, instead of ICEing.

```rust
pub fn main() {
    if true {
        // 1
    } else if let a = 1 {
        // 2
    } else {
        // 3
    }
}
```

now gets desugared (via `rustc -Zunpretty=hir,typed src/x.rs`) to:

```rust
#[prelude_import]
use ::std::prelude::rust_2015::*;
#[macro_use]
extern crate std;
pub fn main() ({
                   (if (true as bool)
                       ({
                            // 1
                        } as
                           ()) else {match (1 as i32) {
                                         a => {
                                             // 2
                                         }
                                         _ => {
                                             // 3
                                         }
                                     }} as ())
                    } as ())
```

For comparison, this code gets HIR prettyprinted the same way before and after this change:

```rust
pub fn main() {
    if let a = 1 {
        // 2
    } else {
        // 3
    }
}
```
turns into
```rust
#[prelude_import]
use ::std::prelude::rust_2015::*;
#[macro_use]
extern crate std;
pub fn main() ({
                   (match (1 as i32) {
                        a => {
                            // 2
                        }
                        _ => {
                            // 3
                        }
                    } as ())
               } as ())
```

This closes #82329. It closes #84434 as well, due to having the same root cause.

3 years agoRollup merge of #84450 - jyn514:missing-std, r=petrochenkov
Dylan DPC [Sun, 25 Apr 2021 21:15:11 +0000 (23:15 +0200)]
Rollup merge of #84450 - jyn514:missing-std, r=petrochenkov

Give a better error when `std` or `core` are missing

- Suggest using `rustup target add` if `RUSTUP_HOME` is set. I don't know if there's any precedent for doing this, but it seems harmless enough and it will be a big help.
- On nightly, suggest using `cargo build -Z build-std` if `CARGO` is set
- Add a note about `#![no_std]` if `std` is missing but not core
- Add a note that std may be unsupported if `std` is missing but not core

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

r? `@petrochenkov`

3 years agoRollup merge of #84235 - klensy:styled-buffer, r=lcnr
Dylan DPC [Sun, 25 Apr 2021 21:15:10 +0000 (23:15 +0200)]
Rollup merge of #84235 - klensy:styled-buffer, r=lcnr

refactor StyledBuffer

Refactors StyledBuffer `text` and `styles` fields content into StyledChar and touches some other stuff.

3 years agoAuto merge of #84325 - jsha:ephemeral-collapse, r=GuillaumeGomez
bors [Sun, 25 Apr 2021 20:42:11 +0000 (20:42 +0000)]
Auto merge of #84325 - jsha:ephemeral-collapse, r=GuillaumeGomez

rustdoc: make expand/collapse all ephemeral

The `[+]` in the upper right of a rustdoc page expands or collapses all toggles on the page. That state is stored across page loads, but is used inconsistently. This change explicitly stops storing or using the state.

This also moves the code for toggling display of trait implementations so that it's near the other toggling code.

Fixes #84318

3 years agoAuto merge of #84481 - RalfJung:miri, r=RalfJung
bors [Sun, 25 Apr 2021 18:17:45 +0000 (18:17 +0000)]
Auto merge of #84481 - RalfJung:miri, r=RalfJung

update Miri

Fixes https://github.com/rust-lang/rust/issues/84553
Cc `@rust-lang/miri` r? `@ghost`

3 years agoUpdate to reflect feedback on the constraints
Jubilee Young [Sun, 25 Apr 2021 17:28:23 +0000 (10:28 -0700)]
Update to reflect feedback on the constraints

3 years agoDocumentation improvements (hopefully)
Scott McMurray [Sun, 25 Apr 2021 17:04:23 +0000 (10:04 -0700)]
Documentation improvements (hopefully)

3 years agoupdate Miri
Ralf Jung [Sun, 25 Apr 2021 16:47:26 +0000 (18:47 +0200)]
update Miri

3 years agoGive a better error when std or core are missing
Joshua Nelson [Thu, 22 Apr 2021 19:23:30 +0000 (15:23 -0400)]
Give a better error when std or core are missing

- Suggest using `rustup target add` if `RUSTUP_HOME` is set. I don't know if there's any precedent for doing this, but it seems harmless enough and it will be a big help.
- Add a note about `#![no_std]` if `std` is missing but not core
- On nightly, suggest using `cargo build -Z build-std` if `CARGO` is set
- Add a note that std may be unsupported if `std` is missing but not core
- Don't suggest `#![no_std]` when the load isn't injected by the
  compiler

3 years agofix typography
Ralf Jung [Sun, 25 Apr 2021 16:41:14 +0000 (18:41 +0200)]
fix typography

3 years agofix clippy
Ralf Jung [Sun, 25 Apr 2021 15:05:48 +0000 (17:05 +0200)]
fix clippy

3 years agomake sure raw ptr casts in 'const' context are unsafe
Ralf Jung [Sun, 25 Apr 2021 14:32:05 +0000 (16:32 +0200)]
make sure raw ptr casts in 'const' context are unsafe

3 years agoAdd test to ensure that the element pointed to by the URL hash is "expanded"
Guillaume Gomez [Sun, 25 Apr 2021 14:06:42 +0000 (16:06 +0200)]
Add test to ensure that the element pointed to by the URL hash is "expanded"

3 years agoAuto merge of #84299 - lcnr:const-generics-defaults-name-res, r=varkor
bors [Sun, 25 Apr 2021 14:00:49 +0000 (14:00 +0000)]
Auto merge of #84299 - lcnr:const-generics-defaults-name-res, r=varkor

various const parameter defaults improvements

Actually resolve names in const parameter defaults, fixing `struct Foo<const N: usize = { usize::MAX }>`.

---
Split generic parameter ban rib for types and consts, allowing
```rust
#![feature(const_generics_defaults)]
struct Q;
struct Foo<T = Q, const Q: usize = 3>(T);
```

---
Remove the type/const ordering restriction if `const_generics_defaults` is active, even if `const_generics` is not. allowing us to stabilize and test const param defaults separately.

---
Check well formedness of const parameter defaults, eagerly emitting an error for `struct Foo<const N: usize = { 0 - 1 }>`

---
Do not forbid const parameters in param defaults, allowing `struct Foo<const N: usize, T = [u8; N]>(T)` and `struct Foo<const N: usize, const M: usize = N>`. Note that this should not change anything which is stabilized, as on stable, type parameters must be in front of const parameters, which means that type parameter defaults are only allowed if no const parameters exist.

We still forbid generic parameters inside of const param types.

r? `@varkor` `@petrochenkov`

3 years agoFix expansion for item pointed to by the URL hash
Guillaume Gomez [Sun, 25 Apr 2021 13:23:07 +0000 (15:23 +0200)]
Fix expansion for item pointed to by the URL hash

3 years agoRemove unneeded rustdoc-gui test because DOM changed
Guillaume Gomez [Sun, 25 Apr 2021 12:49:29 +0000 (14:49 +0200)]
Remove unneeded rustdoc-gui test because DOM changed

3 years agoAdd test to ensure that impl blocks are open by default
Guillaume Gomez [Sun, 25 Apr 2021 12:49:43 +0000 (14:49 +0200)]
Add test to ensure that impl blocks are open by default

3 years agoChange wording
r00ster [Sun, 25 Apr 2021 13:48:24 +0000 (15:48 +0200)]
Change wording

3 years agoOpen all impl blocks by default
Guillaume Gomez [Sun, 25 Apr 2021 12:34:16 +0000 (14:34 +0200)]
Open all impl blocks by default

3 years agoUnify the docs of std::env::{args_os, args} more
r00ster [Sun, 25 Apr 2021 12:45:48 +0000 (14:45 +0200)]
Unify the docs of std::env::{args_os, args} more

3 years agoget rid of min_const_fn references in library/ and rustdoc
Ralf Jung [Sun, 25 Apr 2021 11:59:10 +0000 (13:59 +0200)]
get rid of min_const_fn references in library/ and rustdoc

3 years agoliveness: Fix typo report_unsed_assign -> report_unused_assign
CohenArthur [Sun, 25 Apr 2021 12:10:57 +0000 (14:10 +0200)]
liveness: Fix typo report_unsed_assign -> report_unused_assign

3 years agoremove now-unused 'is_min_const_fn'
Ralf Jung [Sun, 25 Apr 2021 10:53:55 +0000 (12:53 +0200)]
remove now-unused 'is_min_const_fn'

3 years agounsafety checking: no longer care about is_min_const_fn
Ralf Jung [Sun, 25 Apr 2021 10:52:42 +0000 (12:52 +0200)]
unsafety checking: no longer care about is_min_const_fn

Rejecting the forbidden unsafe ops is done by const checking, not by unsafety checking

3 years agoAuto merge of #84216 - RalfJung:black-box, r=Mark-Simulacrum
bors [Sun, 25 Apr 2021 10:35:24 +0000 (10:35 +0000)]
Auto merge of #84216 - RalfJung:black-box, r=Mark-Simulacrum

move core::hint::black_box under its own feature gate

The `black_box` function had its own RFC and is tracked separately from the `test` feature at https://github.com/rust-lang/rust/issues/64102. Let's reflect this in the feature gate.

To avoid breaking all the benchmarks, libtest's `test::black_box` is a wrapping definition, not a reexport -- this means it is still under the `test` feature gate.

3 years agoremove const_fn from some error_code descriptions
Ralf Jung [Sun, 25 Apr 2021 10:19:06 +0000 (12:19 +0200)]
remove const_fn from some error_code descriptions

3 years agoFix 'const-stable since' of reverse_bits
Paolo Barbolini [Sun, 25 Apr 2021 09:58:59 +0000 (11:58 +0200)]
Fix 'const-stable since' of reverse_bits

3 years agofix sanitizer tests
Ralf Jung [Sat, 24 Apr 2021 09:55:32 +0000 (11:55 +0200)]
fix sanitizer tests

3 years agomove core::hint::black_box under its own feature gate
Ralf Jung [Thu, 15 Apr 2021 09:19:24 +0000 (11:19 +0200)]
move core::hint::black_box under its own feature gate

3 years ago'const fn' in trait are rejected in the AST, this feature gate check is a NOP
Ralf Jung [Sun, 25 Apr 2021 09:02:08 +0000 (11:02 +0200)]
'const fn' in trait are rejected in the AST, this feature gate check is a NOP

3 years agoAuto merge of #84147 - cuviper:array-method-dispatch, r=nikomatsakis,m-ou-se
bors [Sun, 25 Apr 2021 07:26:49 +0000 (07:26 +0000)]
Auto merge of #84147 - cuviper:array-method-dispatch, r=nikomatsakis,m-ou-se

Cautiously add IntoIterator for arrays by value

Add the attribute described in #84133, `#[rustc_skip_array_during_method_dispatch]`, which effectively hides a trait from method dispatch when the receiver type is an array.

Then cherry-pick `IntoIterator for [T; N]` from #65819 and gate it with that attribute. Arrays can now be used as `IntoIterator` normally, but `array.into_iter()` has edition-dependent behavior, returning `slice::Iter` for 2015 and 2018 editions, or `array::IntoIter` for 2021 and later.

r? `@nikomatsakis`
cc `@LukasKalbertodt` `@rust-lang/libs`

3 years agoImprove diagnostics for function passed when a type was expected.
Hameer Abbasi [Sat, 24 Apr 2021 14:25:36 +0000 (16:25 +0200)]
Improve diagnostics for function passed when a type was expected.

3 years agoInline most raw socket, fd and handle conversions
KaiJewson [Sun, 25 Apr 2021 06:39:09 +0000 (07:39 +0100)]
Inline most raw socket, fd and handle conversions

3 years agoIgnore array IntoIterator tests in bootstrap
Josh Stone [Sun, 25 Apr 2021 05:33:51 +0000 (22:33 -0700)]
Ignore array IntoIterator tests in bootstrap

3 years agoAuto merge of #84115 - CDirkx:rt, r=m-ou-se
bors [Sun, 25 Apr 2021 04:45:39 +0000 (04:45 +0000)]
Auto merge of #84115 - CDirkx:rt, r=m-ou-se

Rework `init` and `cleanup`

This PR reworks the code in `std` that runs before and after `main` and centralizes this code respectively in the functions `init` and `cleanup` in both `sys_common` and `sys`. This makes is easy to see what code is executed during initialization and cleanup on each platform just by looking at e.g. `sys::windows::init`.

Full list of changes:
- new module `rt` in `sys_common` to contain `init` and `cleanup` and the runtime macros.
- `at_exit` and the mechanism to register exit handlers has been completely removed. In practice this was only used for closing sockets on windows and flushing stdout, which have been moved to `cleanup`.
- <s>On windows `alloc` and `net` initialization is now done in `init`, this saves a runtime check in every allocation and network use.</s>

3 years agoAuto merge of #80339 - jyn514:no-span, r=GuillaumeGomez
bors [Sun, 25 Apr 2021 01:57:10 +0000 (01:57 +0000)]
Auto merge of #80339 - jyn514:no-span, r=GuillaumeGomez

Calculate `span` info on-demand

- Add helper `attr_span` for common reused function
- Stop storing `Span`s on `Item` directly; calculate them on demand instead
- Special case modules, which have different spans depending on whether
  you use inner or outer attributes
- Special case impls with fake IDs, which can have either dummy spans (for auto traits) or the DefId of the impl block (for blanket impls)
- Use a fake ID for primitives instead of the ID of the crate; this lets
  `source()` know that it should use a dummy span instead of the span of
  the crate.

This shrinks `Item` from 48 to 40 bytes.

Helps with https://github.com/rust-lang/rust/issues/76382.

3 years agoClarify Duration::MAX depends on Instant
Jubilee Young [Mon, 19 Apr 2021 23:31:30 +0000 (16:31 -0700)]
Clarify Duration::MAX depends on Instant

Duration is used in std to represent a difference between two Instants.
As such, it has to at least contain that span of time in it. However,
Instant can vary by platform. Thus, we should explain the impl of
Duration::MAX is sensitive to these vagaries of the platform.

3 years agoFinally (finally) ((finally!!!!)) fix spans for the standard library
Joshua Nelson [Fri, 23 Apr 2021 04:26:29 +0000 (00:26 -0400)]
Finally (finally) ((finally!!!!)) fix spans for the standard library

3 years agoGet rid of `item.span`
Joshua Nelson [Wed, 24 Mar 2021 05:20:13 +0000 (01:20 -0400)]
Get rid of `item.span`

- Remove `span` field, adding `Item::span()` instead
- Special-case `Impl` and `Module` items
- Use dummy spans for primitive items

3 years agoDo the hard part first
Joshua Nelson [Wed, 24 Mar 2021 04:52:52 +0000 (00:52 -0400)]
Do the hard part first

The only bit failing was the module, so change that before removing the
`span` field.

3 years agoAuto merge of #84310 - RalfJung:const-fn-feature-flags, r=oli-obk
bors [Sat, 24 Apr 2021 23:16:03 +0000 (23:16 +0000)]
Auto merge of #84310 - RalfJung:const-fn-feature-flags, r=oli-obk

further split up const_fn feature flag

This continues the work on splitting up `const_fn` into separate feature flags:
* `const_fn_trait_bound` for `const fn` with trait bounds
* `const_fn_unsize` for unsizing coercions in `const fn` (looks like only `dyn` unsizing is still guarded here)

I don't know if there are even any things left that `const_fn` guards... at least libcore and liballoc do not need it any more.

`@oli-obk` are you currently able to do reviews?

3 years agoAdd attr_span helper function
Joshua Nelson [Wed, 24 Mar 2021 05:49:12 +0000 (01:49 -0400)]
Add attr_span helper function

3 years agoupdate rustc-perf version that is used for PGO
Ralf Jung [Sat, 24 Apr 2021 21:17:06 +0000 (23:17 +0200)]
update rustc-perf version that is used for PGO

3 years agoAuto merge of #84511 - davidhewitt:revert-84445, r=GuillaumeGomez
bors [Sat, 24 Apr 2021 20:35:12 +0000 (20:35 +0000)]
Auto merge of #84511 - davidhewitt:revert-84445, r=GuillaumeGomez

Revert "rustdoc: Hide `#text` in doc-tests"

See discussion in #84502 - I'm worried that #84445 may cause a lot of breakages if this were to hit stable, so I think it's safer to revert and work on the known correct fix #84478.

3 years agoOne more test case.
Tor Hovland [Sat, 24 Apr 2021 20:20:08 +0000 (22:20 +0200)]
One more test case.

3 years agoreview
klensy [Sat, 17 Apr 2021 23:15:15 +0000 (02:15 +0300)]
review

3 years agoAuto merge of #84525 - JohnTitor:rollup-t2qigt3, r=JohnTitor
bors [Sat, 24 Apr 2021 17:44:46 +0000 (17:44 +0000)]
Auto merge of #84525 - JohnTitor:rollup-t2qigt3, r=JohnTitor

Rollup of 8 pull requests

Successful merges:

 - #83519 (Implement a lint that highlights all moves larger than a configured limit)
 - #84105 (stabilize `core::array::{from_ref,from_mut}` in `1.53.0`)
 - #84179 (Explicitly implement `!Send` and `!Sync` for `sys::{Args, Env}`)
 - #84427 (Update Clippy)
 - #84459 (rustdoc: Turn `JsonRenderer::mod_item_in` into `unreachable!()`)
 - #84460 (rustdoc: Remove unnecessary `is_crate` field from doctree::Module and clean::Module)
 - #84464 (rustdoc: Get rid of `clean::TypeKind`)
 - #84518 (Clean up DOM strings)

Failed merges:

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

3 years agoMore tests.
Tor Hovland [Sat, 24 Apr 2021 17:00:24 +0000 (19:00 +0200)]
More tests.

3 years agoRollup merge of #84518 - GuillaumeGomez:cleanup-up-dom-string, r=jsha
Yuki Okushi [Sat, 24 Apr 2021 16:53:16 +0000 (01:53 +0900)]
Rollup merge of #84518 - GuillaumeGomez:cleanup-up-dom-string, r=jsha

Clean up DOM strings

Follow-up of #84320.

r? ``@jsha``

3 years agoRollup merge of #84464 - jyn514:type-kind, r=CraftSpider
Yuki Okushi [Sat, 24 Apr 2021 16:53:15 +0000 (01:53 +0900)]
Rollup merge of #84464 - jyn514:type-kind, r=CraftSpider

rustdoc: Get rid of `clean::TypeKind`

It does exactly the same thing as ItemType.

3 years agoRollup merge of #84460 - jyn514:doctree-is-crate, r=camelid
Yuki Okushi [Sat, 24 Apr 2021 16:53:14 +0000 (01:53 +0900)]
Rollup merge of #84460 - jyn514:doctree-is-crate, r=camelid

rustdoc: Remove unnecessary `is_crate` field from doctree::Module and clean::Module

It can be calculated on-demand even without a TyCtxt.

This also changed `json::conversions::from_item_kind` to take a whole item, which avoids
having to add more and more parameters.

Helps with https://github.com/rust-lang/rust/issues/76382.

r? ```@camelid```

3 years agoRollup merge of #84459 - jyn514:json-mod, r=aDotInTheVoid
Yuki Okushi [Sat, 24 Apr 2021 16:53:13 +0000 (01:53 +0900)]
Rollup merge of #84459 - jyn514:json-mod, r=aDotInTheVoid

rustdoc: Turn `JsonRenderer::mod_item_in` into `unreachable!()`

The JSON renderer no longer gets called on modules (since https://github.com/rust-lang/rust/pull/83055).

r? ``@aDotInTheVoid``

3 years agoRollup merge of #84427 - flip1995:clippyup, r=Manishearth
Yuki Okushi [Sat, 24 Apr 2021 16:53:12 +0000 (01:53 +0900)]
Rollup merge of #84427 - flip1995:clippyup, r=Manishearth

Update Clippy

r? ```@Manishearth```

Biweekly Clippy update.

3 years agoRollup merge of #84179 - CDirkx:dont_send_sync, r=m-ou-se
Yuki Okushi [Sat, 24 Apr 2021 16:53:11 +0000 (01:53 +0900)]
Rollup merge of #84179 - CDirkx:dont_send_sync, r=m-ou-se

Explicitly implement `!Send` and `!Sync` for `sys::{Args, Env}`

Remove the field `_dont_send_or_sync_me: PhantomData<*mut ()>` in favor of an explicit implementation of `!Send` and `!Sync`.

3 years agoRollup merge of #84105 - WaffleLapkin:stabilize_array_from_ref, r=m-ou-se
Yuki Okushi [Sat, 24 Apr 2021 16:53:10 +0000 (01:53 +0900)]
Rollup merge of #84105 - WaffleLapkin:stabilize_array_from_ref, r=m-ou-se

stabilize `core::array::{from_ref,from_mut}` in `1.53.0`

I didn't get any response in https://github.com/rust-lang/rust/issues/77101#issuecomment-761831104, so I figured out I can try opening stabilization pr.

---

This PR stabilizes following functions:
```rust
// core::array
pub fn from_ref<T>(s: &T) -> &[T; 1];
pub fn from_mut<T>(s: &mut T) -> &mut [T; 1];
```

Functions are similar to already stabilized `core::slice::{`[`from_ref`](https://doc.rust-lang.org/std/slice/fn.from_ref.html),[`from_mut`](https://doc.rust-lang.org/std/slice/fn.from_mut.html)`}` and were unstable without any problems/questions for a while now.

---

resolves #77101

``@rustbot`` modify labels: +T-libs

3 years agoRollup merge of #83519 - oli-obk:assign_shrink_your_normal_code, r=pnkfelix
Yuki Okushi [Sat, 24 Apr 2021 16:53:09 +0000 (01:53 +0900)]
Rollup merge of #83519 - oli-obk:assign_shrink_your_normal_code, r=pnkfelix

Implement a lint that highlights all moves larger than a configured limit

Tracking issue: #83518
[MCP 420](https://github.com/rust-lang/compiler-team/issues/420) still ~blazing~ in progress

r? ```@pnkfelix```

The main open issue I see with this minimal impl of the feature is that the lint is immediately "stable" (so it can be named on stable), even if it is never executed on stable. I don't think we have the concept of unstable lint names or hiding lint names without an active feature gate, so that would be a bigger change.

3 years agoRefactor.
Tor Hovland [Sat, 24 Apr 2021 16:49:21 +0000 (18:49 +0200)]
Refactor.

3 years agoStabilize ordering_helpers.
Mara Bos [Sat, 24 Apr 2021 16:45:20 +0000 (18:45 +0200)]
Stabilize ordering_helpers.

3 years agoAdded a test.
Tor Hovland [Sat, 24 Apr 2021 16:08:22 +0000 (18:08 +0200)]
Added a test.

3 years agorustdoc: Turn `JsonRenderer::mod_item_in` into `unreachable!()`
Joshua Nelson [Thu, 22 Apr 2021 23:47:58 +0000 (19:47 -0400)]
rustdoc: Turn `JsonRenderer::mod_item_in` into `unreachable!()`

The JSON renderer no longer gets called on modules.

3 years agoAuto merge of #84412 - ehuss:update-cargo, r=ehuss
bors [Sat, 24 Apr 2021 14:49:26 +0000 (14:49 +0000)]
Auto merge of #84412 - ehuss:update-cargo, r=ehuss

Update cargo, rls

## cargo

18 commits in 65d57e6f384c2317f76626eac116f683e2b63665..0ed318d182e465cd66071b91ac3d265af63ef8a1
2021-04-04 15:07:52 +0000 to 2021-04-23 20:54:54 +0000
- Restore crates.io's `SourceId` hash value to before (rust-lang/cargo#9397)
- Fix loading `branch=master` patches in the v3 lock transition (rust-lang/cargo#9392)
- Update changelog for 1.52 beta changes. (rust-lang/cargo#9396)
- Fix build-std updating the index on every build. (rust-lang/cargo#9393)
- Fix typo in profile docs (rust-lang/cargo#9386)
- Fix disagreement about lockfile ordering on stable/nightly (rust-lang/cargo#9384)
- Don't give a hard error when the end-user specifies RUSTC_BOOTSTRAP=crate_name (rust-lang/cargo#9365)
- Fix rust-lang/cargo#9350 (cargo build -Z help is missing options) (rust-lang/cargo#9369)
- an struct -&gt; a struct (rust-lang/cargo#9379)
- Handle man pages better on Windows. (rust-lang/cargo#9378)
- fix: better error message when dependency/workspace member missing (rust-lang/cargo#9368)
- Fix typo in book (rust-lang/cargo#9376)
- Don't re-use rustc cache when RUSTC_WRAPPER changes (rust-lang/cargo#9348)
- doc: add split-debuginfo doc in config chapter (rust-lang/cargo#9372)
- refactor: remove `CargoResultExt` (rust-lang/cargo#9367)
- Track "CARGO" in environment fingerprint. (rust-lang/cargo#9363)
- Update clippy lint allow set. (rust-lang/cargo#9356)
- Fix 'suport' typo in documentation (rust-lang/cargo#9338)

## rls

3 commits in 32c0fe006dcdc13e1ca0ca31de543e4436c1299e..74d1800c25498689c5b5120a1e8495fce0cd0d0d
2021-04-12 11:21:12 +0000 to 2021-04-22 21:29:51 +0000
- Bump default integration test message timeout to 30s (rust-lang-nursery/rls#1731)
- itertools = 0.9, fst = 0.4 (rust-lang-nursery/rls#1729)
- Update cargo (rust-lang-nursery/rls#1728)

3 years agoClean up DOM strings
Guillaume Gomez [Sat, 24 Apr 2021 12:44:43 +0000 (14:44 +0200)]
Clean up DOM strings

3 years agoImplemented suggestion.
Tor Hovland [Sat, 24 Apr 2021 11:57:41 +0000 (13:57 +0200)]
Implemented suggestion.

3 years agoRevert "rustdoc: Hide `#text` in doc-tests"
David Hewitt [Sat, 24 Apr 2021 10:54:44 +0000 (11:54 +0100)]
Revert "rustdoc: Hide `#text` in doc-tests"

This reverts commit af6c3201fc3d5ec2559836454ea4f43eec583fa2.

3 years agoAuto merge of #84501 - JohnTitor:rollup-wxu1thu, r=JohnTitor
bors [Sat, 24 Apr 2021 04:54:10 +0000 (04:54 +0000)]
Auto merge of #84501 - JohnTitor:rollup-wxu1thu, r=JohnTitor

Rollup of 10 pull requests

Successful merges:

 - #83990 (implement `TrustedRandomAccess` for `Take` iterator adapter)
 - #84250 (bootstrap: use bash on illumos to run install scripts)
 - #84320 (Use details tag for trait implementors.)
 - #84436 (Make a few functions private)
 - #84453 (Document From implementations for Waker and RawWaker)
 - #84458 (Remove unnecessary fields and parameters in rustdoc)
 - #84485 (Add some associated type bounds tests)
 - #84489 (Mention FusedIterator case in Iterator::fuse doc)
 - #84492 (rustdoc: Remove unnecessary dummy span)
 - #84496 (Add some specialization tests)

Failed merges:

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

3 years agoRollup merge of #84496 - marmeladema:specialization-test, r=JohnTitor
Yuki Okushi [Sat, 24 Apr 2021 03:17:11 +0000 (12:17 +0900)]
Rollup merge of #84496 - marmeladema:specialization-test, r=JohnTitor

Add some specialization tests

Closes #33017
Closes #51892

r? `@JohnTitor`

3 years agoRollup merge of #84492 - jyn514:span, r=camelid
Yuki Okushi [Sat, 24 Apr 2021 03:17:10 +0000 (12:17 +0900)]
Rollup merge of #84492 - jyn514:span, r=camelid

rustdoc: Remove unnecessary dummy span

Follow-up to https://github.com/rust-lang/rust/pull/84460#discussion_r619447655.

r? `@camelid`

3 years agoRollup merge of #84489 - amorison:issue-83969-fix, r=yaahc
Yuki Okushi [Sat, 24 Apr 2021 03:17:09 +0000 (12:17 +0900)]
Rollup merge of #84489 - amorison:issue-83969-fix, r=yaahc

Mention FusedIterator case in Iterator::fuse doc

Using `fuse` on an iterator that incorrectly implements
`FusedIterator` does not fuse the iterator. This commit adds a
note about this in the documentation of this method to increase
awareness about this potential issue (esp. when relying on fuse
in unsafe code).

Closes #83969

3 years agoRollup merge of #84485 - marmeladema:trait-tests, r=jackh726
Yuki Okushi [Sat, 24 Apr 2021 03:17:08 +0000 (12:17 +0900)]
Rollup merge of #84485 - marmeladema:trait-tests, r=jackh726

Add some associated type bounds tests

Closes #83017
Closes #81193

r? `@jackh726`

3 years agoRollup merge of #84458 - jyn514:cleanup-after-krate, r=GuillaumeGomez
Yuki Okushi [Sat, 24 Apr 2021 03:17:07 +0000 (12:17 +0900)]
Rollup merge of #84458 - jyn514:cleanup-after-krate, r=GuillaumeGomez

Remove unnecessary fields and parameters in rustdoc

r? `@GuillaumeGomez`

3 years agoRollup merge of #84453 - notriddle:waker-from-docs, r=cramertj
Yuki Okushi [Sat, 24 Apr 2021 03:17:06 +0000 (12:17 +0900)]
Rollup merge of #84453 - notriddle:waker-from-docs, r=cramertj

Document From implementations for Waker and RawWaker

CC #51430

3 years agoRollup merge of #84436 - jyn514:private, r=petrochenkov
Yuki Okushi [Sat, 24 Apr 2021 03:17:04 +0000 (12:17 +0900)]
Rollup merge of #84436 - jyn514:private, r=petrochenkov

Make a few functions private

These were made public in 3105bcfdc11030abf9855af7a693cbf904460813. This
is so long ago I doubt anyone remembers why they're public. No one outside rustc_session uses
them, including in-tree tools.

3 years agoRollup merge of #84320 - jsha:details-implementors, r=Manishearth,Nemo157,GuillaumeGomez
Yuki Okushi [Sat, 24 Apr 2021 03:17:03 +0000 (12:17 +0900)]
Rollup merge of #84320 - jsha:details-implementors, r=Manishearth,Nemo157,GuillaumeGomez

Use details tag for trait implementors.

Part of #83332 and following on from #83337 and #83355.

This removes one category of JS-generated toggles (implementors), and replaces them with a `<details>` tag. This simplifies the JS, and fixes some bugs where things that were supposed to be hidden by the toggle were not hidden. Compare https://hoffman-andrews.com/rust/details-implementors/std/io/trait.Read.html#impl-Read vs https://doc.rust-lang.org/nightly/std/io/trait.Read.html#implementors.

This introduces a `left: -23px` to put the toggle in the correct place, matching the current style for `.collapse-toggle`.

It's worth noting this introduces a slight behavior change: since the entire line is now a `<summary>`, any part of the line is clickable. So for instance, in `impl Read for File`, clicking `impl` or `for` will collapse / expand the docs. Clicking `Read` or `File` still links to the appropriate documentation as before.

3 years agoRollup merge of #84250 - jclulow:illumos-bash-bootstrap, r=Mark-Simulacrum
Yuki Okushi [Sat, 24 Apr 2021 03:17:02 +0000 (12:17 +0900)]
Rollup merge of #84250 - jclulow:illumos-bash-bootstrap, r=Mark-Simulacrum

bootstrap: use bash on illumos to run install scripts

The default illumos shell ("sh" in the default PATH) is ksh93, rather
than bash, and does not support constructs like "local" that came from
bash.  The bootstrap function for invoking "install.sh" scripts should
use "bash" explicitly there to avoid issues.

3 years agoRollup merge of #83990 - the8472:take-trusted-len, r=dtolnay
Yuki Okushi [Sat, 24 Apr 2021 03:17:01 +0000 (12:17 +0900)]
Rollup merge of #83990 - the8472:take-trusted-len, r=dtolnay

implement `TrustedRandomAccess` for `Take` iterator adapter

`TrustedRandomAccess` requires the iterator length to fit within `usize`. `take(n)` only constrains the upper bound of an iterator. So if the inner is `TrustedRandomAccess` (which already implies a finite length) then so can be `Take`.

```````@rustbot``````` label T-libs-impl

3 years agoAuto merge of #83722 - jyn514:stable-help, r=estebank
bors [Sat, 24 Apr 2021 02:25:54 +0000 (02:25 +0000)]
Auto merge of #83722 - jyn514:stable-help, r=estebank

On stable, suggest removing `#![feature]` for features that have been stabilized

I don't know how to test this (https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/Run.20tests.20without.20enabling.20nightly.20features.3F). I confirmed locally that this gives the
appropriate help with `channel = "beta"`:

```
error[E0554]: `#![feature]` may not be used on the beta release channel
 --> src/lib.rs:2:1
  |
2 | #![feature(min_const_generics)]
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove the attribute
  |
  = help: the feature `min_const_generics` has been stable since 1.51.0 and no longer requires an attribute to enable

error[E0554]: `#![feature]` may not be used on the beta release channel
 --> src/lib.rs:3:1
  |
3 | #![feature(min_const_generics, min_specialization)]
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = help: the feature `min_const_generics` has been stable since 1.51.0 and no longer requires an attribute to enable

error[E0554]: `#![feature]` may not be used on the beta release channel
 --> src/lib.rs:4:1
  |
4 | #![feature(box_patterns)]
  | ^^^^^^^^^^^^^^^^^^^^^^^^^
```

Closes https://github.com/rust-lang/rust/issues/83715.