Commit graph

142575 commits

Author SHA1 Message Date
Mara Bos
8b33dfa8ad
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`
2021-04-26 21:06:49 +02:00
Mara Bos
6d277c7694
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.
2021-04-26 21:06:48 +02:00
Mara Bos
9758d532f0
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
2021-04-26 21:06:47 +02:00
Mara Bos
fb1502d570
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`
2021-04-26 21:06:46 +02:00
bors
ae54ee6507 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`
2021-04-26 17:16:03 +00:00
bors
a362a4d1d0 Auto merge of #7134 - camsteffen:copied-msrv, r=Manishearth
Finish MSRV for cloned_instead_of_copied

changelog: none

r? `@Manishearth`
2021-04-26 16:12:04 +00:00
Cameron Steffen
dcf4e07458 Finish MSRV for cloned_instead_of_copied 2021-04-26 11:09:24 -05:00
bors
154858c430 Auto merge of #84583 - joshtriplett:target-tier-policy, r=pietroalbini
Add the target tier policy from accepted RFC 2803
2021-04-26 14:35:13 +00:00
bors
1bb3b12dfb Auto merge of #7132 - rust-lang:single_element_loop_iter, r=Manishearth
extend `single_element_loop` to match `.iter()`

This extends `single_element_loop` to also match `[..].iter()` in the loop argument. Related to #7125, but not completely fixing it due to the lint only firing if the array expression contains a local variable.

---

changelog: none
2021-04-26 14:28:31 +00:00
Andre Bogus
efc4c6c957 extend single_element_loop to match .iter() 2021-04-26 15:58:58 +02:00
bors
8212de8eb1 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`.
2021-04-26 11:18:25 +00:00
Josh Triplett
42033df1d4 Cross-reference target tier policy from platform-support 2021-04-26 03:33:28 -07:00
Josh Triplett
dc455a338e Add the target tier policy from accepted RFC 2803 2021-04-26 03:29:37 -07:00
Guillaume Gomez
6c8969c43c Add open attribute on details which are supposed to be open by default instead of opening them with JS 2021-04-26 10:43:49 +02:00
bors
7bd62a8f5a 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.
2021-04-26 08:21:55 +00:00
hi-rustin
0d9a1c6762 rustdoc: Fix typo for maybe_inline_local fn 2021-04-26 13:43:30 +08:00
bors
4f0b24fd73 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
2021-04-26 05:41:04 +00:00
ltdk
920de7dd94 Document Hasher spec decision from #42951 2021-04-26 01:11:46 -04:00
bors
ee8382f297 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:
b78c0d8a4d/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`
2021-04-26 02:56:25 +00:00
bors
f8f5968255 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
2021-04-25 23:24:14 +00:00
Dylan DPC
000a630110
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
2021-04-25 23:15:18 +02:00
Dylan DPC
25508ebe68
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.
2021-04-25 23:15:17 +02:00
Dylan DPC
139749934b
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`
2021-04-25 23:15:16 +02:00
Dylan DPC
ad3389a6df
Rollup merge of #84516 - torhovland:issue-84114, r=estebank
Add suggestion to "use break" when attempting to implicit-break a loop

Fixes #84114
2021-04-25 23:15:14 +02:00
Dylan DPC
ae316d6603
Rollup merge of #84499 - estebank:issue-84272, r=jackh726
Tweak trait not `use`d suggestion

Fix #84272. Follow up to #83667.
2021-04-25 23:15:13 +02:00
Dylan DPC
a0dcbdf7fd
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.
2021-04-25 23:15:12 +02:00
Dylan DPC
379a55c64e
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`
2021-04-25 23:15:11 +02:00
Dylan DPC
e7e22b47ad
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.
2021-04-25 23:15:10 +02:00
Joshua M. Clulow
d21fb2bc36 Update backtrace to 0.3.57
Adds support for symbol resolution on illumos systems.
2021-04-25 13:48:03 -07:00
bors
3709ae324c 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
2021-04-25 20:42:11 +00:00
bors
e7ed7e8354 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`
2021-04-25 18:17:45 +00:00
Jubilee Young
8278380047 Update to reflect feedback on the constraints 2021-04-25 10:28:23 -07:00
Scott McMurray
5671647902 Documentation improvements (hopefully) 2021-04-25 10:04:23 -07:00
Ralf Jung
b630c8ba1e update Miri 2021-04-25 18:47:26 +02:00
Joshua Nelson
d326a4b4c9 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
2021-04-25 16:45:31 +00:00
Ralf Jung
588530d096
fix typography 2021-04-25 18:41:14 +02:00
Ralf Jung
421d54e4aa fix clippy 2021-04-25 17:05:48 +02:00
bors
c4e2d3691b Auto merge of #7129 - camsteffen:copied-msrv, r=Manishearth
cloned_instead_of_copied MSRV

changelog: none
(since the lint is still new)

Fixes #7127

r? `@Manishearth`
2021-04-25 14:55:24 +00:00
Cameron Steffen
3f5be5e235 Fix cloned_instead_of_copied MSRV 2021-04-25 09:54:04 -05:00
Ralf Jung
b1ad1fbc03 make sure raw ptr casts in 'const' context are unsafe 2021-04-25 16:34:38 +02:00
Jason Newcomb
db7ad648e7
Fix ICE checking for feature gated const fn 2021-04-25 10:18:15 -04:00
Guillaume Gomez
9b44c4b29c Add test to ensure that the element pointed to by the URL hash is "expanded" 2021-04-25 16:06:42 +02:00
bors
58bdb08947 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`
2021-04-25 14:00:49 +00:00
Guillaume Gomez
1afea79e42 Fix expansion for item pointed to by the URL hash 2021-04-25 15:54:42 +02:00
Guillaume Gomez
175cd9b199 Remove unneeded rustdoc-gui test because DOM changed 2021-04-25 15:54:42 +02:00
Guillaume Gomez
bcad1ec0ac Add test to ensure that impl blocks are open by default 2021-04-25 15:54:42 +02:00
r00ster
82b6983aca
Change wording 2021-04-25 15:48:24 +02:00
Guillaume Gomez
33a70981e2 Open all impl blocks by default 2021-04-25 14:50:02 +02:00
r00ster
22ec96135d
Unify the docs of std::env::{args_os, args} more 2021-04-25 14:45:48 +02:00
Ralf Jung
43126f3573 get rid of min_const_fn references in library/ and rustdoc 2021-04-25 14:14:19 +02:00