Commit graph

5183 commits

Author SHA1 Message Date
lrh2000
060deec4b1 Move outer fields of enums into variant parts in debuginfo
All fields except the discriminant (including `outer_fields`)
should be put into structures inside the variant part, which gives
an equivalent layout but offers us much better integration with
debuggers.
2021-04-30 16:30:25 +08:00
Jack Huey
e6d8683239
Rollup merge of #84705 - lcnr:const_generics-rec, r=joshtriplett
make feature recommendations optional

this is what we're already doing for other feature gates, so it's better to be consistent
2021-04-29 19:27:26 -04:00
Jack Huey
26a4f461d7
Rollup merge of #84682 - jackh726:transitive_bounds_rebind, r=nikomatsakis
Don't rebind in `transitive_bounds_that_define_assoc_type`

Fixes #83737
Fixes #84604

Also fixes another issue that I don't have a test for, popped up in [zulip](https://rust-lang.zulipchat.com/#narrow/stream/144729-wg-traits/topic/Duplicate.20symbol.20error.20.2384604/near/236570445)

r? `````@nikomatsakis`````
2021-04-29 19:27:22 -04:00
bors
478a07df05 Auto merge of #84708 - pnkfelix:revert-77885-everywhere, r=Mark-Simulacrum
Revert PR 77885 everywhere

Change to probe-stack=call (instead of inline-or-call) everywhere again, for now.

We had already reverted the change on stable back in PR #83412.

Since then, we've had some movement on issue #83139, but not a 100% fix.

But also since then, we had bug reported, issue #84667, that looks like outright codegen breakage, rather than problems confined to debuginfo issues.    So we are reverting PR #77885 on stable and beta. We'll reland PR #77885 (or some    variant) switching back to an LLVM-dependent selection of out-of-line call vs    inline-asm, after these other issues have been resolved.
2021-04-29 20:06:07 +00:00
Felix S. Klock II
8d1083e319 Change to probe-stack=call (instead of inline-or-call) everywhere again, for now.
We had already reverted the change on stable back in PR #83412.

Since then, we've had some movement on issue #83139, but not a 100% fix.

But also since then, we had bug reported, issue #84667, that looks like outright
codegen breakage, rather than problems confined to debuginfo issues.

So we are reverting PR #77885 on stable and beta. We'll reland PR #77885 (or some
variant) switching back to an LLVM-dependent selection of out-of-line call vs
inline-asm, after these other issues have been resolved.
2021-04-29 15:13:21 -04:00
lcnr
da6261e07f make feature recommendations optional 2021-04-29 20:44:19 +02:00
bors
18587b14d1 Auto merge of #84556 - RalfJung:const-fn-trait-bound, r=oli-obk
use correct feature flag for impl-block-level trait bounds on const fn

I am not sure what that special hack was needed for, but it doesn't seem needed any more...

This removes the last use of the `const_fn` feature flag -- Cc https://github.com/rust-lang/rust/issues/84510
r? `@oli-obk`
2021-04-29 17:38:37 +00:00
bors
814a560072 Auto merge of #84233 - jyn514:track-path-prefix, r=michaelwoerister
Add TRACKED_NO_CRATE_HASH and use it for `--remap-path-prefix`

I verified locally that this fixes https://github.com/rust-lang/rust/issues/66955.

r? `@Aaron1011` (feel free to reassign)
2021-04-29 14:57:17 +00:00
Joshua Nelson
bfa74c270f Use doc-comment instad of comments consistently
This makes the comments show up in the generated docs.

- Fix markdown formatting
2021-04-29 12:53:49 +00:00
Ralf Jung
9a852776f4 don't let const_fn feature flag affect impl-block-level trait bounds 2021-04-29 09:27:45 +02:00
bors
d337cec9af Auto merge of #84684 - jackh726:rollup-qxc5cos, r=jackh726
Rollup of 11 pull requests

Successful merges:

 - #84484 (Don't rebuild rustdoc and clippy after checking bootstrap)
 - #84530 (`test tidy` should ignore alternative `build` dir patterns)
 - #84531 (Ignore commented out lines when finding features)
 - #84540 (Build sanitizers for x86_64-unknown-linux-musl)
 - #84555 (Set `backtrace-on-ice` by default for compiler and codegen profiles)
 - #84585 (Add `x.py check src/librustdoc` as an alias for `x.py check src/tools/rustdoc`)
 - #84636 (rustdoc: change aliases attribute to data-aliases)
 - #84646 (Add some regression tests related to #82494)
 - #84661 (Remove extra word in `rustc_mir` docs)
 - #84663 (Remove `DropGuard` in `sys::windows::process` and use `StaticMutex` instead)
 - #84668 (Update books)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-04-29 05:24:45 +00:00
Jack Huey
096375451d
Rollup merge of #84661 - pierwill:patch-1, r=jackh726
Remove extra word in `rustc_mir` docs

Changes "is includes" to "includes" in `rustc_mir::borrow_check::type_check::type_check`.
2021-04-28 22:59:30 -04:00
bors
ada102456d Auto merge of #84614 - RalfJung:daily, r=Mark-Simulacrum
don't enable parking_lot nightly features

Having the compiler itself depend on external libraries that use nightly features can lead to "fun" bootstrap situations. Within the rustc repo we use `cfg(bootstrap)` to resolve those, but that is not a reasonable option for external dependencies.

So I propose we stop enabling the "nightly" feature of `parking_lot` here. In my experiments, this then indeed leads to the feature not being enabled (i.e., nothing else enables it), and everything still builds. However, this means parking_lot's `RwLock` will no longer have hardware lock elision for readers -- I hope that is okay to lose in exchange for less bootstrap brain twisting. ;)

Cc `@Amanieu`
2021-04-29 02:53:52 +00:00
Jack Huey
5f82e22ba4 Don't rebind in transitive_bounds_that_define_assoc_type 2021-04-28 18:10:44 -04:00
bors
ca075d268d Auto merge of #83386 - mark-i-m:stabilize-pat2015, r=nikomatsakis
Stabilize `:pat_param` and remove `:pat2021`

Blocked on #83384

cc `@rust-lang/lang` #79278

If I understand `@nikomatsakis` in  https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/or.20patterns/near/231133873, another FCP is not needed.

r? `@nikomatsakis`
2021-04-28 20:35:17 +00:00
pierwill
8b806bcd41
Remove extra word in rustc_mir docs
Changes "is includes" to "includes" in `rustc_mir::borrow_check::type_check::type_check`.
2021-04-28 09:53:32 -07:00
Jack Huey
31ae3b2bdb Add HAS_RE_LATE_BOUND if there are bound vars 2021-04-28 10:18:52 -04:00
bors
20040fa332 Auto merge of #84562 - richkadel:issue-83601, r=tmandry
Adds feature-gated `#[no_coverage]` function attribute, to fix derived Eq `0` coverage issue #83601

Derived Eq no longer shows uncovered

The Eq trait has a special hidden function. MIR `InstrumentCoverage`
would add this function to the coverage map, but it is never called, so
the `Eq` trait would always appear uncovered.

Fixes: #83601

The fix required creating a new function attribute `no_coverage` to mark
functions that should be ignored by `InstrumentCoverage` and the
coverage `mapgen` (during codegen).

Adding a `no_coverage` feature gate with tracking issue #84605.

r? `@tmandry`
cc: `@wesleywiser`
2021-04-28 13:05:16 +00:00
bors
237eab1156 Auto merge of #83401 - fee1-dead:master, r=davidtwco
Fix ICE of for-loop mut borrowck where no suggestions are available

Fixes #83309.
2021-04-28 10:46:02 +00:00
bors
76a04dd3f8 Auto merge of #84644 - JohnTitor:rollup-nzq9rjz, r=JohnTitor
Rollup of 5 pull requests

Successful merges:

 - #84529 (Improve coverage spans for chained function calls)
 - #84616 (Fix empty dom toggle)
 - #84622 (Make traits with GATs not object safe)
 - #84624 (Make sentence in env::args_os' docs plain and simple)
 - #84642 (Stabilize vec_extend_from_within)

Failed merges:

 - #84636 (rustdoc: change aliases attribute to data-aliases)

r? `@ghost`
`@rustbot` modify labels: rollup
2021-04-28 08:20:19 +00:00
Yuki Okushi
35eac429f6
Rollup merge of #84622 - jackh726:gats-trait-object, r=nikomatsakis
Make traits with GATs not object safe

Closes #81823

r? `@nikomatsakis`
2021-04-28 16:59:08 +09:00
Yuki Okushi
3f89ca1a32
Rollup merge of #84529 - richkadel:issue-84180, r=tmandry
Improve coverage spans for chained function calls

Fixes: #84180

For chained function calls separated by the `?` try operator, the
function call following the try operator produced a MIR `Call` span that
matched the span of the first call. The `?` try operator started a new
span, so the second call got no span.

It turns out the MIR `Call` terminator has a `func` `Operand`
for the `Constant` representing the function name, and the function
name's Span can be used to reset the starting position of the span.

r? `@tmandry`
cc: `@wesleywiser`
2021-04-28 16:59:06 +09:00
bors
855c2d130f Auto merge of #83713 - spastorino:revert-pub-macro-rules, r=nikomatsakis
Revert "Rollup merge of #82296 - spastorino:pubrules, r=nikomatsakis"

This reverts commit e2561c58a4, reversing
changes made to 2982ba50fc.

As discussed in #83641 this feature is not complete and in particular doesn't work cross macros and given that this is not going to be included in edition 2021 nobody seems to be trying to fix the underlying problem. When can add this again I guess, whenever somebody has the time to make it work cross crates.

r? `@nikomatsakis`
2021-04-28 05:52:47 +00:00
bors
537544b106 Auto merge of #84498 - workingjubilee:update-grab-bag, r=Mark-Simulacrum
Update grab bag

This PR slides a bunch of crate versions forward until suddenly a bunch of deps fall out of the tree!
In doing so this mostly picks up a version bump in the `redox_users` crate which makes most of the features default to optional.

crossbeam-utils 0.7 => 0.8.3 (where applicable)
https://github.com/crossbeam-rs/crossbeam/blob/master/crossbeam-utils/CHANGELOG.md
directories 3.0.1 => 3.0.2
ignore 0.4.16 => 0.4.17
tempfile 3.0.5 => tempfile 3.2

Removes constant_time_eq from deps exceptions
Removes arrayref from deps exceptions
And also removes:
- blake2b_simd
- const_fn (the package, not the feature)
- constant_time_eq
- redox_users 0.3.4
- rust-argon2
2021-04-28 02:45:03 +00:00
mark
2a9db919ff remove pat2021 2021-04-27 21:15:59 -05:00
Rich Kadel
3a5df48021 adds feature gating of no_coverage at either crate- or function-level 2021-04-27 17:12:51 -07:00
Jack Huey
857cb4de20 Make traits with GATs not object safe 2021-04-27 14:34:23 -04:00
Rich Kadel
888d0b4c96 Derived Eq no longer shows uncovered
The Eq trait has a special hidden function. MIR `InstrumentCoverage`
would add this function to the coverage map, but it is never called, so
the `Eq` trait would always appear uncovered.

Fixes: #83601

The fix required creating a new function attribute `no_coverage` to mark
functions that should be ignored by `InstrumentCoverage` and the
coverage `mapgen` (during codegen).

While testing, I also noticed two other issues:

* spanview debug file output ICEd on a function with no body. The
workaround for this is included in this PR.
* `assert_*!()` macro coverage can appear covered if followed by another
`assert_*!()` macro. Normally they appear uncovered. I submitted a new
Issue #84561, and added a coverage test to demonstrate this issue.
2021-04-27 11:11:56 -07:00
Dylan DPC
24782c7f82
Rollup merge of #84613 - lcnr:recursive-types, r=jackh726
move representability checks to rustc_ty_utils
2021-04-27 19:08:50 +02:00
Joshua Nelson
39648ea467 Make real_rust_path_dir a TRACKED_NO_CRATE_HASH option
This also adds support for doc-comments to Options.
2021-04-27 16:48:25 +00:00
Joshua Nelson
272015190d Add [TRACKED_NO_CRATE_HASH] and [SUBSTRUCT] directives
This is necessary for options that should invalidate the incremental
hash but *not* affect the crate hash (e.g. --remap-path-prefix).

This doesn't add `for_crate_hash` to the trait directly because it's not
relevant for *types*, only for *options*, which are fields on a larger
struct. Instead, it adds a new `SUBSTRUCT` directive for options, which
does take a `for_crate_hash` parameter.

- Use TRACKED_NO_CRATE_HASH for --remap-path-prefix
- Add test that `remap_path_prefix` is tracked
- Reduce duplication in the test suite to avoid future churn
2021-04-27 16:46:33 +00:00
Joshua Nelson
fb7018b41e Test that non_default_option is not the default option
Otherwise the test is useless and does nothing. This caught 2 bugs in
the test suite.
2021-04-27 16:30:39 +00:00
Ralf Jung
170a10b2dd don't enable parking_lot nightly features 2021-04-27 15:05:55 +02:00
lcnr
b3629d21ba move representability out of rustc_middle 2021-04-27 15:01:37 +02: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
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
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
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
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 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
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
CohenArthur
ba9d143118 liveness: Fix typo report_unsed_assign -> report_unused_assign 2021-04-25 14:10:57 +02:00
Ralf Jung
1ecdaa29f9 remove now-unused 'is_min_const_fn' 2021-04-25 12:54:34 +02:00