Commit graph

142512 commits

Author SHA1 Message Date
Benoît du Garreau
4a8671a2fa Override clone_from method for PathBuf and OsString 2021-04-27 15:20:59 +02:00
bors
dc8cb63078 Auto merge of #84606 - JohnTitor:test-84408, r=lcnr
Add a regression test for issue-84408

Closes #84408
r? `@lcnr`
2021-04-27 09:56:33 +00:00
bors
e1886935b7 Auto merge of #84532 - richkadel:issue-83792, r=tmandry
Fix coverage ICE because fn_sig can have a span that crosses file bou…

Fixes: #83792

MIR `InstrumentCoverage` assumed the `FnSig` span was contained within a
single file, but this is not always the case. Some macro constructions
can result in a span that starts in one `SourceFile` and ends in a
different one.

The `FnSig` span is included in coverage results as long as that span is
in the same `SourceFile` and the same macro context, but by assuming the
`FnSig` span's `hi()` and `lo()` were in the same file, I took this for
granted, and checked only that the `FnSig` `hi()` was in the same
`SourceFile` as the `body_span`.

I actually drop the `hi()` though, and extend the `FnSig` span to the
`body_span.lo()`, so I really should have simply checked that the
`FnSig` span's `lo()` was in the `SourceFile` of the `body_span`.

r? `@tmandry`
cc: `@wesleywiser`
2021-04-27 07:29:26 +00:00
bors
22b686ad99 Auto merge of #77246 - yaahc:typeof-errors, r=oli-obk
try enabling typeof for fun error messages
2021-04-27 04:46:45 +00:00
Yuki Okushi
f1239e15c8 Rename a test for consistency 2021-04-27 13:16:56 +09:00
Yuki Okushi
c660a51cc4 Add a regression test for issue-84408 2021-04-27 13:16:39 +09:00
bors
6eb956fcbb 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`
2021-04-27 01:58:29 +00:00
Jane Lusby
ed903f9b91 add ui test for new typeof error messages 2021-04-26 16:36:48 -07:00
bors
61e171566a 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.)
2021-04-26 23:17:31 +00:00
bors
9684258936 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
2021-04-26 19:58:11 +00:00
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
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
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
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
Ralf Jung
b1ad1fbc03 make sure raw ptr casts in 'const' context are unsafe 2021-04-25 16:34:38 +02: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