]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoInitial work for doing minimum capture analysis for RFC-2229
Aman Arora [Sat, 26 Sep 2020 21:07:00 +0000 (17:07 -0400)]
Initial work for doing minimum capture analysis for RFC-2229

Co-authored-by: Chris Pardy <chrispardy36@gmail.com>
Co-authored-by: Logan Mosier <logmosier@gmail.com>
3 years agoAdd helper function for Capture Esclations and expressions
Aman Arora [Sat, 17 Oct 2020 05:49:11 +0000 (01:49 -0400)]
Add helper function for Capture Esclations and expressions

Co-authored-by: Dhruv Jauhar <dhruvjhr@gmail.com>
3 years agoAdd initial set of testcases for RFC 2229
Aman Arora [Tue, 13 Oct 2020 00:16:02 +0000 (20:16 -0400)]
Add initial set of testcases for RFC 2229

Co-authored-by: Dhruv Jauhar <dhruvjhr@gmail.com>
3 years agoIndroduce feature flag for RFC-2229
Aman Arora [Sun, 11 Oct 2020 04:14:11 +0000 (00:14 -0400)]
Indroduce feature flag for RFC-2229

Signed-off-by: Aman Arora <me@aman-arora.com>
3 years agoUse Places to express closure/generator Captures
Aman Arora [Wed, 9 Sep 2020 05:18:28 +0000 (01:18 -0400)]
Use Places to express closure/generator Captures

Co-authored-by: Archer Zhang <archer.xn@gmail.com>
3 years agoAuto merge of #78904 - Dylan-DPC:rollup-8d2w3vu, r=Dylan-DPC
bors [Tue, 10 Nov 2020 10:43:14 +0000 (10:43 +0000)]
Auto merge of #78904 - Dylan-DPC:rollup-8d2w3vu, r=Dylan-DPC

Rollup of 12 pull requests

Successful merges:

 - #74754 (Add `#[cfg(panic = '...')]`)
 - #76468 (Improve lifetime name annotations for closures & async functions)
 - #77016 (Test clippy on PR CI on changes)
 - #78480 (BTreeMap: fix pointer provenance rules)
 - #78502 (Update Chalk to 0.36.0)
 - #78513 (Infer the default host target from the host toolchain if possible)
 - #78566 (Enable LLVM Polly via llvm-args.)
 - #78580 (inliner: Break inlining cycles)
 - #78710 (rustc_ast: Do not panic by default when visiting macro calls)
 - #78746 (Demote i686-unknown-freebsd to tier 2 compiler target)
 - #78830 (fix `super_visit_with` for `Terminator`)
 - #78844 (Monomorphize a type argument of size-of operation during codegen)

Failed merges:

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

3 years agoRollup merge of #78844 - tmiasko:monomorphize-sizeof, r=oli-obk
Dylan DPC [Mon, 9 Nov 2020 18:07:02 +0000 (19:07 +0100)]
Rollup merge of #78844 - tmiasko:monomorphize-sizeof, r=oli-obk

Monomorphize a type argument of size-of operation during codegen

This wasn't necessary until MIR inliner started to consider drop glue as
a candidate for inlining; introducing for the first time a generic use
of size-of operation.

No test at this point since this only happens with a custom inlining
threshold.

3 years agoRollup merge of #78830 - lcnr:mir-folder, r=oli-obk
Dylan DPC [Mon, 9 Nov 2020 18:06:59 +0000 (19:06 +0100)]
Rollup merge of #78830 - lcnr:mir-folder, r=oli-obk

fix `super_visit_with` for `Terminator`

fixes https://github.com/rust-lang/rust/pull/78182#discussion_r509265149

r? `@oli-obk`

cc `@LeSeulArtichaut`

3 years agoRollup merge of #78746 - pietroalbini:i686-freebsd, r=Mark-Simulacrum
Dylan DPC [Mon, 9 Nov 2020 18:06:57 +0000 (19:06 +0100)]
Rollup merge of #78746 - pietroalbini:i686-freebsd, r=Mark-Simulacrum

Demote i686-unknown-freebsd to tier 2 compiler target

While technically the `i686-unknown-freebsd` target has been a tier 2 development platform for a long time, with full toolchain tarballs available on static.rust-lang.org, due to a bug in the manifest generation the target was never available for download through rustup.

The infrastructure team privately inquired the FreeBSD package maintainers, and they weren't relying on those tarballs either, so it's a fair assumption to say practically nobody is using those tarballs.

This PR then removes the CI builder that produces full tarballs for the target, and moves the compilation of `rust-std` for the target in `dist-various-2`. The `x86_64-unknown-freebsd` target is *not* affected.

cc `@rust-lang/infra` `@rust-lang/compiler` `@rust-lang/release`
r? `@Mark-Simulacrum`

3 years agoRollup merge of #78710 - petrochenkov:macvisit, r=davidtwco
Dylan DPC [Mon, 9 Nov 2020 18:06:55 +0000 (19:06 +0100)]
Rollup merge of #78710 - petrochenkov:macvisit, r=davidtwco

rustc_ast: Do not panic by default when visiting macro calls

Panicking by default made sense when we didn't have HIR or MIR and everything worked on AST, but now all AST visitors run early and majority of them have to deal with macro calls, often by ignoring them.

The second commit renames `visit_mac` to `visit_mac_call`, the corresponding structures were renamed earlier in https://github.com/rust-lang/rust/pull/69589.

3 years agoRollup merge of #78580 - tmiasko:inline-loop, r=oli-obk
Dylan DPC [Mon, 9 Nov 2020 18:06:53 +0000 (19:06 +0100)]
Rollup merge of #78580 - tmiasko:inline-loop, r=oli-obk

inliner: Break inlining cycles

Keep track of all instances inlined so far. When examining a new call
sites from an inlined body, skip those where callee had been inlined
already to avoid potential inlining cycles.

Fixes #78573.

3 years agoRollup merge of #78566 - JRF63:polly, r=Mark-Simulacrum
Dylan DPC [Mon, 9 Nov 2020 18:06:51 +0000 (19:06 +0100)]
Rollup merge of #78566 - JRF63:polly, r=Mark-Simulacrum

Enable LLVM Polly via llvm-args.

I think doing it this way is better than in #51061. Polly has other useful options and we probably don't want to create a `-Z` flag for each one of them.

![results](https://user-images.githubusercontent.com/7283601/97695555-338f7180-1adf-11eb-82bd-5130e0e6fa89.png)

[Benchmark](https://gist.github.com/JRF63/9a6268b91720958e90dbe7abffe20298)

I noticed that `-lto` seems to interfere with polly in this specific microbenchmark, as enabling it causes the perf to drop to that of non-polly builds.

Other related PRs: #75615

3 years agoRollup merge of #78513 - jyn514:rustup-toolchain, r=Mark-Simulacrum
Dylan DPC [Mon, 9 Nov 2020 18:06:49 +0000 (19:06 +0100)]
Rollup merge of #78513 - jyn514:rustup-toolchain, r=Mark-Simulacrum

Infer the default host target from the host toolchain if possible

- `beta-x86_64-unknown-linux-gnu` has beta stripped
- `rustc2` is ignored

This fixes ongoing issues where x.py will detect the wrong host triple
between MSVC and GNU.

I don't think this will break anyone's workflow - I'd be very surprised if you a) had no `[build]` section in `config.toml`, b) had rustc installed, and c) expected the default target to be something other than the default target used by `rustc`. But I could be wrong - I'm happy to hear user stories :)

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

r? ``@Mark-Simulacrum``
cc ``@Lokathor``

3 years agoRollup merge of #78502 - matthewjasper:chalkup, r=nikomatsakis
Dylan DPC [Mon, 9 Nov 2020 18:06:46 +0000 (19:06 +0100)]
Rollup merge of #78502 - matthewjasper:chalkup, r=nikomatsakis

Update Chalk to 0.36.0

This PR updates Chalk and fixes a number of bugs in the chalk integration code.

cc `@rust-lang/wg-traits`
r? `@nikomatsakis`

3 years agoRollup merge of #78480 - ssomers:btree-alias, r=Mark-Simulacrum
Dylan DPC [Mon, 9 Nov 2020 18:06:44 +0000 (19:06 +0100)]
Rollup merge of #78480 - ssomers:btree-alias, r=Mark-Simulacrum

BTreeMap: fix pointer provenance rules

Fixes #78477 and includes #78476

r? `@Mark-Simulacrum`

3 years agoRollup merge of #77016 - Mark-Simulacrum:clippy-tests, r=pietroalbini
Dylan DPC [Mon, 9 Nov 2020 18:06:42 +0000 (19:06 +0100)]
Rollup merge of #77016 - Mark-Simulacrum:clippy-tests, r=pietroalbini

Test clippy on PR CI on changes

This runs the tools builder (which builds and tests tools, including clippy) when the clippy submodule changes. This essentially returns us to the prior state when clippy was a submodule; it makes sense for us to test it on CI when it changes. It might make sense for it to be tested regardless of changing but it is somewhat rare for it to fail and we don't want to add to CI time for the majority of PRs which don't affect it.

Fixes #76999.

3 years agoRollup merge of #76468 - SNCPlay42:lifetime-names, r=Mark-Simulacrum
Dylan DPC [Mon, 9 Nov 2020 18:06:39 +0000 (19:06 +0100)]
Rollup merge of #76468 - SNCPlay42:lifetime-names, r=Mark-Simulacrum

Improve lifetime name annotations for closures & async functions

* Don't refer to async functions as "generators" in error output
* Where possible, emit annotations pointing exactly at the `&` in the return type of closures (when they have explicit return types) and async functions, like we do for arguments.
Addresses #74072, but I wouldn't call that *closed* until annotations are identical for async and non-async functions.
* Emit a better annotation when the lifetime doesn't appear in the full name type, which currently happens for opaque types like `impl Future`. Addresses #74497, but further improves could probably be made (why *doesn't* it appear in the type as `impl Future + '1`?)
This is included in the same PR because the changes to `give_name_if_anonymous_region_appears_in_output` would introduce ICE otherwise (it would return `None` in cases where it didn't previously, which then gets `unwrap`ped)

3 years agoRollup merge of #74754 - davidhewitt:cfg-panic, r=ecstatic-morse
Dylan DPC [Mon, 9 Nov 2020 18:06:37 +0000 (19:06 +0100)]
Rollup merge of #74754 - davidhewitt:cfg-panic, r=ecstatic-morse

Add `#[cfg(panic = '...')]`

This PR adds conditional compilation according to the panic strategy.

I've come across a need for a flag like this a couple of times while writing tests: #74301 , https://github.com/rust-lang/rust/pull/73670#issuecomment-653629031

I'm not sure if I need to add a feature gate for this flag?

3 years agouse RegionNameHighlight for async fn and closure returns
SNCPlay42 [Tue, 8 Sep 2020 04:35:24 +0000 (05:35 +0100)]
use RegionNameHighlight for async fn and closure returns

3 years agoAdd `#[cfg(panic = "...")]`
David Hewitt [Sat, 25 Jul 2020 18:02:49 +0000 (19:02 +0100)]
Add `#[cfg(panic = "...")]`

3 years agoAuto merge of #78201 - joshtriplett:rustc-tls-model, r=Mark-Simulacrum
bors [Mon, 9 Nov 2020 11:08:07 +0000 (11:08 +0000)]
Auto merge of #78201 - joshtriplett:rustc-tls-model, r=Mark-Simulacrum

Compile rustc crates with the initial-exec TLS model

This should produce more efficient code, with fewer calls to
__tls_get_addr. The tradeoff is that libraries using it won't work with
dlopen, but that shouldn't be a problem for rustc's internal libraries.

3 years agoBTreeMap: fix pointer provenance rules, make borrowing explicit
Stein Somers [Wed, 28 Oct 2020 10:58:06 +0000 (11:58 +0100)]
BTreeMap: fix pointer provenance rules, make borrowing explicit

3 years agoAuto merge of #78889 - Dylan-DPC:rollup-6zjhahf, r=Dylan-DPC
bors [Mon, 9 Nov 2020 00:36:58 +0000 (00:36 +0000)]
Auto merge of #78889 - Dylan-DPC:rollup-6zjhahf, r=Dylan-DPC

Rollup of 12 pull requests

Successful merges:

 - #77640 (Refactor IntErrorKind to avoid "underflow" terminology)
 - #78026 (Define `fs::hard_link` to not follow symlinks.)
 - #78114 (Recognize `private_intra_doc_links` as a lint)
 - #78228 (Promote aarch64-unknown-linux-gnu to Tier 1)
 - #78345 (Fix handling of item names for HIR)
 - #78437 (BTreeMap: stop mistaking node for an orderly place)
 - #78476 (fix some incorrect aliasing in the BTree)
 - #78674 (inliner: Use substs_for_mir_body)
 - #78748 (Implement destructuring assignment for tuples)
 - #78868 (Fix tab focus on restyled switches)
 - #78878 (Avoid overlapping cfg attributes when both macOS and aarch64)
 - #78882 (Nicer hunk headers for rust files)

Failed merges:

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

3 years agoRollup merge of #78882 - bjorn3:nicer_hunk_headers, r=Mark-Simulacrum
Dylan DPC [Mon, 9 Nov 2020 00:13:50 +0000 (01:13 +0100)]
Rollup merge of #78882 - bjorn3:nicer_hunk_headers, r=Mark-Simulacrum

Nicer hunk headers for rust files

I found this trick at <https://tekin.co.uk/2020/10/better-git-diff-output-for-ruby-python-elixir-and-more>

Before the hunk headers for changes in methods would refer to the impl:

```diff
diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs
index 1c6937e685c..fa4264d729b 100644
--- a/compiler/rustc_middle/src/ty/context.rs
+++ b/compiler/rustc_middle/src/ty/context.rs
``@@`` -678,7 +678,7 ``@@`` impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for TypeckResults<'tcx> {
             ref closure_captures,
             ref generator_interior_types,
         } = *self;
-
+        // foo
         hcx.with_node_id_hashing_mode(NodeIdHashingMode::HashDefPath, |hcx| {
             type_dependent_defs.hash_stable(hcx, hasher);
             field_indices.hash_stable(hcx, hasher);
```

After the hunk headers refer to the actual function signature:

```diff
diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs
index 1c6937e685c..fa4264d729b 100644
--- a/compiler/rustc_middle/src/ty/context.rs
+++ b/compiler/rustc_middle/src/ty/context.rs
``@@`` -678,7 +678,7 ``@@`` fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHas
             ref closure_captures,
             ref generator_interior_types,
         } = *self;
-
+        // foo
         hcx.with_node_id_hashing_mode(NodeIdHashingMode::HashDefPath, |hcx| {
             type_dependent_defs.hash_stable(hcx, hasher);
             field_indices.hash_stable(hcx, hasher);
```

When the function signature is visible, it will use the function
signature of the previous method as hunk header:

```diff
diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs
index 1c6937e685c..63058dfc837 100644
--- a/compiler/rustc_middle/src/ty/context.rs
+++ b/compiler/rustc_middle/src/ty/context.rs
``@@`` -992,6 +992,7 ``@@`` pub fn typeck_opt_const_arg(
     }

     pub fn alloc_steal_mir(self, mir: Body<'tcx>) -> &'tcx Steal<Body<'tcx>> {
+        // foo
         self.arena.alloc(Steal::new(mir))
     }
```

3 years agoRollup merge of #78878 - shepmaster:intersecting-ignores, r=Mark-Simulacrum
Dylan DPC [Mon, 9 Nov 2020 00:13:48 +0000 (01:13 +0100)]
Rollup merge of #78878 - shepmaster:intersecting-ignores, r=Mark-Simulacrum

Avoid overlapping cfg attributes when both macOS and aarch64

r? ``@Mark-Simulacrum``

3 years agoRollup merge of #78868 - notriddle:master, r=GuillaumeGomez
Dylan DPC [Mon, 9 Nov 2020 00:13:46 +0000 (01:13 +0100)]
Rollup merge of #78868 - notriddle:master, r=GuillaumeGomez

Fix tab focus on restyled switches

Setting a checkbox to `display:none` makes it impossible to tab onto it, which makes the rustdoc settings page completely keyboard inaccessible.

3 years agoRollup merge of #78748 - fanzier:tuple-assignment, r=petrochenkov
Dylan DPC [Mon, 9 Nov 2020 00:13:44 +0000 (01:13 +0100)]
Rollup merge of #78748 - fanzier:tuple-assignment, r=petrochenkov

Implement destructuring assignment for tuples

This is the first step towards implementing destructuring assignment (RFC: https://github.com/rust-lang/rfcs/pull/2909, tracking issue: #71126). This PR is the first part of #71156, which was split up to allow for easier review.

Quick summary: This change allows destructuring the LHS of an assignment if it's a (possibly nested) tuple.
It is implemented via a desugaring (AST -> HIR lowering) as follows:
```rust
(a,b) = (1,2)
```
... becomes ...
```rust
{
  let (lhs0,lhs1) = (1,2);
  a = lhs0;
  b = lhs1;
}
```

Thanks to `@varkor` who helped with the implementation, particularly around default binding modes.

r? `@petrochenkov`

3 years agoRollup merge of #78674 - tmiasko:inline-substs-for-mir-body, r=oli-obk
Dylan DPC [Mon, 9 Nov 2020 00:13:42 +0000 (01:13 +0100)]
Rollup merge of #78674 - tmiasko:inline-substs-for-mir-body, r=oli-obk

inliner: Use substs_for_mir_body

Changes from 68965 extended the kind of instances that are being
inlined. For some of those, the `instance_mir` returns a MIR body that
is already expressed in terms of the types found in substitution array,
and doesn't need further substitution.

Use `substs_for_mir_body` to take that into account.

Resolves #78529.
Resolves #78560.

3 years agoRollup merge of #78476 - RalfJung:btree-alias, r=Mark-Simulacrum
Dylan DPC [Mon, 9 Nov 2020 00:13:40 +0000 (01:13 +0100)]
Rollup merge of #78476 - RalfJung:btree-alias, r=Mark-Simulacrum

fix some incorrect aliasing in the BTree

This line is wrong:
```
ptr::copy(slice.as_ptr().add(idx), slice.as_mut_ptr().add(idx + 1), slice.len() - idx);
```
When `slice.as_mut_ptr()` is called, that creates a mutable reference to the entire slice, which invalidates the raw pointer previously returned by `slice.as_ptr()`. (Miri currently misses this because raw pointers are not tracked properly.)

Cc ````````@ssomers````````

3 years agoRollup merge of #78437 - ssomers:btree_no_ord_at_node_level, r=Mark-Simulacrum
Dylan DPC [Mon, 9 Nov 2020 00:13:38 +0000 (01:13 +0100)]
Rollup merge of #78437 - ssomers:btree_no_ord_at_node_level, r=Mark-Simulacrum

BTreeMap: stop mistaking node for an orderly place

A second mistake in #77612 was to ignore the node module's rightful comment "this module doesn't care whether the entries are sorted". And there's a much simpler way to visit the keys in order, if you check this separately from a single pass checking everything.

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

3 years agoRollup merge of #78345 - jyn514:proper-names, r=varkor
Dylan DPC [Mon, 9 Nov 2020 00:13:35 +0000 (01:13 +0100)]
Rollup merge of #78345 - jyn514:proper-names, r=varkor

Fix handling of item names for HIR

- Handle variants, fields, macros in `Node::ident()`
- Handle the crate root in `opt_item_name`
- Rewrite `item_name` in terms of `opt_item_name`

I need this for both https://github.com/rust-lang/rust/pull/77820 and https://github.com/rust-lang/rust/pull/78082, so splitting it out into a separate PR so it can land early.

3 years agoRollup merge of #78228 - pietroalbini:finally, r=Mark-Simulacrum
Dylan DPC [Mon, 9 Nov 2020 00:13:33 +0000 (01:13 +0100)]
Rollup merge of #78228 - pietroalbini:finally, r=Mark-Simulacrum

Promote aarch64-unknown-linux-gnu to Tier 1

This PR promotes the `aarch64-unknown-linux-gnu` target to Tier 1, as proposed by [RFC 2959]:

* The `aarch64-gnu` CI job is moved from `auto-fallible` to `auto`.
* The platform support documentation is updated, uplifting the target to Tiert 1 with a note about missing stack probes support.
* Building the documentation is enabled for the target, as we produce the `rust-docs` component for all Tier 1 platforms.

[RFC 2959]: https://github.com/rust-lang/rfcs/pull/2959

3 years agoRollup merge of #78114 - jyn514:private, r=oli-obk
Dylan DPC [Mon, 9 Nov 2020 00:13:31 +0000 (01:13 +0100)]
Rollup merge of #78114 - jyn514:private, r=oli-obk

Recognize `private_intra_doc_links` as a lint

Previously, trying to allow this would give another error!

```
warning: unknown lint: `private_intra_doc_links`
 --> private.rs:1:10
  |
1 | #![allow(private_intra_doc_links)]
  |          ^^^^^^^^^^^^^^^^^^^^^^^ help: did you mean: `broken_intra_doc_links`
  |
  = note: `#[warn(unknown_lints)]` on by default

warning: public documentation for `DocMe` links to private item `DontDocMe`
 --> private.rs:2:11
  |
2 | /// docs [DontDocMe]
  |           ^^^^^^^^^ this item is private
  |
  = note: `#[warn(private_intra_doc_links)]` on by default
  = note: this link will resolve properly if you pass `--document-private-items`
```

Fixes the issue found in https://github.com/rust-lang/rust/pull/77249#issuecomment-712339227.

r? ````````@Manishearth````````

Does anyone know why this additional step is necessary? It seems weird this has to be declared in 3 different places.

3 years agoRollup merge of #78026 - sunfishcode:symlink-hard-link, r=dtolnay
Dylan DPC [Mon, 9 Nov 2020 00:13:28 +0000 (01:13 +0100)]
Rollup merge of #78026 - sunfishcode:symlink-hard-link, r=dtolnay

Define `fs::hard_link` to not follow symlinks.

POSIX leaves it [implementation-defined] whether `link` follows symlinks.
In practice, for example, on Linux it does not and on FreeBSD it does.
So, switch to `linkat`, so that we can pick a behavior rather than
depending on OS defaults.

Pick the option to not follow symlinks. This is somewhat arbitrary, but
seems the less surprising choice because hard linking is a very
low-level feature which requires the source and destination to be on
the same mounted filesystem, and following a symbolic link could end
up in a different mounted filesystem.

[implementation-defined]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/link.html

3 years agoRollup merge of #77640 - ethanboxx:int_error_matching_attempt_2, r=KodrAus
Dylan DPC [Mon, 9 Nov 2020 00:13:25 +0000 (01:13 +0100)]
Rollup merge of #77640 - ethanboxx:int_error_matching_attempt_2, r=KodrAus

Refactor IntErrorKind to avoid "underflow" terminology

This PR is a continuation of #76455

# Changes

- `Overflow` renamed to `PosOverflow` and `Underflow` renamed to `NegOverflow` after discussion in #76455
- Changed some of the parsing code to return `InvalidDigit` rather than `Empty` for strings "+" and "-". https://users.rust-lang.org/t/misleading-error-in-str-parse-for-int-types/49178
- Carry the problem `char` with the `InvalidDigit` variant.
- Necessary changes were made to the compiler as it depends on `int_error_matching`.
- Redid tests to match on specific errors.

r? ```@KodrAus```

3 years agoinliner: Break inlining cycles
Tomasz Miąsko [Mon, 9 Nov 2020 00:00:00 +0000 (00:00 +0000)]
inliner: Break inlining cycles

When examining candidates for inlining, reject those that are determined
to be recursive either because of self-recursive calls or calls to any
instances already inlined.

3 years agoinliner: Make `inline_call` infallible
Tomasz Miąsko [Fri, 6 Nov 2020 00:00:00 +0000 (00:00 +0000)]
inliner: Make `inline_call` infallible

The inliner does not support inlining of divering calls. Reject them
early on and turn `inline_call` into an infallible operation.

3 years agoAuto merge of #78712 - petrochenkov:visitok, r=Aaron1011
bors [Sun, 8 Nov 2020 20:00:51 +0000 (20:00 +0000)]
Auto merge of #78712 - petrochenkov:visitok, r=Aaron1011

rustc_ast: Visit tokens stored in AST nodes in mutable visitor

After #77271 token visiting is enabled only for one visitor in `rustc_expand\src\mbe\transcribe.rs` which applies hygiene marks to tokens produced by declarative macros (`macro_rules` or `macro`), so this change doesn't affect anything else.

When a macro has some interpolated token from an outer macro in its output
```rust
macro inner() {
    $interpolated
}
```
we can use the usual interpretation of interpolated tokens in token-based model - a None-delimited group - to write this macro in an equivalent form
```rust
macro inner() {
    ⟪ a b c d ⟫
}
```

When we are expanding the macro `inner` we need to apply hygiene marks to all tokens produced by it, including the tokens inside the group.

Before this PR we did this by visiting the AST piece inside the interpolated token and applying marks to all spans in it.
I'm not sure this is 100% correct (ideally we should apply the marks to tokens and then re-parse the AST from tokens), but it's a very good approximation at least.
We didn't however apply the marks to actual tokens stored in the nonterminal, so if we used the nonterminal as a token rather than as an AST piece (e.g. passed it to a proc macro), then we got hygiene bugs.
This PR applies the marks to tokens in addition to the AST pieces thus fixing the issue.

r? `@Aaron1011`

3 years agoNicer hunk headers for rust files
bjorn3 [Sun, 8 Nov 2020 15:40:00 +0000 (16:40 +0100)]
Nicer hunk headers for rust files

I found this trick at
<https://tekin.co.uk/2020/10/better-git-diff-output-for-ruby-python-elixir-and-more>

Before the hunk headers for changes in methods would refer to the impl:

```diff
diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs
index 1c6937e685c..fa4264d729b 100644
--- a/compiler/rustc_middle/src/ty/context.rs
+++ b/compiler/rustc_middle/src/ty/context.rs
@@ -678,7 +678,7 @@ impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for TypeckResults<'tcx> {
             ref closure_captures,
             ref generator_interior_types,
         } = *self;
-
+        // foo
         hcx.with_node_id_hashing_mode(NodeIdHashingMode::HashDefPath, |hcx| {
             type_dependent_defs.hash_stable(hcx, hasher);
             field_indices.hash_stable(hcx, hasher);
```

After the hunk headers refer to the actual function signature:

```diff
diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs
index 1c6937e685c..fa4264d729b 100644
--- a/compiler/rustc_middle/src/ty/context.rs
+++ b/compiler/rustc_middle/src/ty/context.rs
@@ -678,7 +678,7 @@ fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHas
             ref closure_captures,
             ref generator_interior_types,
         } = *self;
-
+        // foo
         hcx.with_node_id_hashing_mode(NodeIdHashingMode::HashDefPath, |hcx| {
             type_dependent_defs.hash_stable(hcx, hasher);
             field_indices.hash_stable(hcx, hasher);
```

When the function signature is visible, it will use the function
signature of the previous method as hunk header:

```diff
diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs
index 1c6937e685c..63058dfc837 100644
--- a/compiler/rustc_middle/src/ty/context.rs
+++ b/compiler/rustc_middle/src/ty/context.rs
@@ -992,6 +992,7 @@ pub fn typeck_opt_const_arg(
     }

     pub fn alloc_steal_mir(self, mir: Body<'tcx>) -> &'tcx Steal<Body<'tcx>> {
+        // foo
         self.arena.alloc(Steal::new(mir))
     }
```

3 years agoAvoid overlapping cfg attributes when both macOS and aarch64
Jake Goulding [Sun, 8 Nov 2020 14:43:51 +0000 (09:43 -0500)]
Avoid overlapping cfg attributes when both macOS and aarch64

3 years agoAuto merge of #78874 - m-ou-se:rollup-3jp1ijj, r=m-ou-se
bors [Sun, 8 Nov 2020 13:49:17 +0000 (13:49 +0000)]
Auto merge of #78874 - m-ou-se:rollup-3jp1ijj, r=m-ou-se

Rollup of 19 pull requests

Successful merges:

 - #76097 (Stabilize hint::spin_loop)
 - #76227 (Stabilize `Poll::is_ready` and `is_pending` as const)
 - #78065 (make concurrency helper more pleasant to read)
 - #78570 (Remove FIXME comment in print_type_sizes ui test suite)
 - #78572 (Use SOCK_CLOEXEC and accept4() on more platforms.)
 - #78658 (Add a tool to run `x.py` from any subdirectory)
 - #78706 (Fix run-make tests running when LLVM is disabled)
 - #78728 (Constantify `UnsafeCell::into_inner` and related)
 - #78775 (Bump Rustfmt and RLS)
 - #78788 (Correct unsigned equivalent of isize to be usize)
 - #78811 (Make some std::io functions `const`)
 - #78828 (use single char patterns for split() (clippy::single_char_pattern))
 - #78841 (Small cleanup in `TypeFoldable` derive macro)
 - #78842 (Honor the rustfmt setting in config.toml)
 - #78843 (Less verbose debug logging from inlining integrator)
 - #78852 (Convert a bunch of intra-doc links)
 - #78860 (rustc_resolve: Use `#![feature(format_args_capture)]`)
 - #78861 (typo and formatting)
 - #78865 (Don't fire `CONST_ITEM_MUTATION` lint when borrowing a deref)

Failed merges:

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

3 years agoRollup merge of #78865 - Aaron1011:fix/const-item-mut-reborrow, r=varkor
Mara Bos [Sun, 8 Nov 2020 12:36:33 +0000 (13:36 +0100)]
Rollup merge of #78865 - Aaron1011:fix/const-item-mut-reborrow, r=varkor

Don't fire `CONST_ITEM_MUTATION` lint when borrowing a deref

Fixes #78819

This extends the check for dereferences added in PR #77324
to cover mutable borrows, as well as direct writes. If we're operating
on a dereference of a `const` item, we shouldn't be firing the lint.

3 years agoRollup merge of #78861 - o752d:patch-1, r=jonas-schievink
Mara Bos [Sun, 8 Nov 2020 12:36:32 +0000 (13:36 +0100)]
Rollup merge of #78861 - o752d:patch-1, r=jonas-schievink

typo and formatting

fixed a typo and modified some line formatting justification while I'm here :)

3 years agoRollup merge of #78860 - petrochenkov:resolvefmt, r=Mark-Simulacrum
Mara Bos [Sun, 8 Nov 2020 12:36:30 +0000 (13:36 +0100)]
Rollup merge of #78860 - petrochenkov:resolvefmt, r=Mark-Simulacrum

rustc_resolve: Use `#![feature(format_args_capture)]`

This is the best new sugar for quite some time.

(I only changed places that already used named arguments.)

3 years agoRollup merge of #78852 - camelid:intra-doc-bonanza, r=jyn514
Mara Bos [Sun, 8 Nov 2020 12:36:28 +0000 (13:36 +0100)]
Rollup merge of #78852 - camelid:intra-doc-bonanza, r=jyn514

Convert a bunch of intra-doc links

An intra-doc link bonanza!

This was accomplished using a bunch of trial-and-error with sed.

3 years agoRollup merge of #78843 - tmiasko:inline-trace, r=wesleywiser
Mara Bos [Sun, 8 Nov 2020 12:36:26 +0000 (13:36 +0100)]
Rollup merge of #78843 - tmiasko:inline-trace, r=wesleywiser

Less verbose debug logging from inlining integrator

The inlining integrator produces relatively verbose and uninteresting
logs.  Move them from a debug log level to a trace level, so that they
can be easily isolated from others.

3 years agoRollup merge of #78842 - shepmaster:bootstrap-rustfmt, r=Mark-Simulacrum
Mara Bos [Sun, 8 Nov 2020 12:36:25 +0000 (13:36 +0100)]
Rollup merge of #78842 - shepmaster:bootstrap-rustfmt, r=Mark-Simulacrum

Honor the rustfmt setting in config.toml

Prior to this, setting the rustfmt configuration was ignored:

```
% mkdir example

% cd example

% ../configure --set build.rustfmt=/usr/bin/true

% ../x.py fmt
./x.py fmt is not supported on this channel
failed to run: /Users/shep/Projects/rust/example/build/bootstrap/debug/bootstrap fmt
Build completed unsuccessfully in 0:00:01
```

And after:

```
% ../x.py fmt
Build completed successfully in 0:00:11
```

r? `@Mark-Simulacrum`

3 years agoRollup merge of #78841 - LeSeulArtichaut:foldable-derive, r=lcnr
Mara Bos [Sun, 8 Nov 2020 12:36:23 +0000 (13:36 +0100)]
Rollup merge of #78841 - LeSeulArtichaut:foldable-derive, r=lcnr

Small cleanup in `TypeFoldable` derive macro

r? ```@lcnr```

3 years agoRollup merge of #78828 - matthiaskrgr:sing_chr, r=lcnr
Mara Bos [Sun, 8 Nov 2020 12:36:21 +0000 (13:36 +0100)]
Rollup merge of #78828 - matthiaskrgr:sing_chr, r=lcnr

use single char patterns for split() (clippy::single_char_pattern)

3 years agoRollup merge of #78811 - a1phyr:const_io_structs, r=dtolnay
Mara Bos [Sun, 8 Nov 2020 12:36:19 +0000 (13:36 +0100)]
Rollup merge of #78811 - a1phyr:const_io_structs, r=dtolnay

Make some std::io functions `const`

Tracking issue: #78812

Make the following functions `const`:
- `io::Cursor::new`
- `io::Cursor::get_ref`
- `io::Cursor::position`
- `io::empty`
- `io::repeat`
- `io::sink`

r? `````@dtolnay`````

3 years agoRollup merge of #78788 - jhpratt:isize-impl-fix, r=m-ou-se
Mara Bos [Sun, 8 Nov 2020 12:36:18 +0000 (13:36 +0100)]
Rollup merge of #78788 - jhpratt:isize-impl-fix, r=m-ou-se

Correct unsigned equivalent of isize to be usize

See [#74913 (comment)](https://github.com/rust-lang/rust/issues/74913#issuecomment-722334456) for why this matters. Apparently it hasn't been used anywhere else, though CI will tell for sure.

3 years agoRollup merge of #78775 - ghedo:bump-rustfmt-rls, r=Mark-Simulacrum
Mara Bos [Sun, 8 Nov 2020 12:36:16 +0000 (13:36 +0100)]
Rollup merge of #78775 - ghedo:bump-rustfmt-rls, r=Mark-Simulacrum

Bump Rustfmt and RLS

Should hopefully fix #78341 and fix #78340.

3 years agoRollup merge of #78728 - a1phyr:const_cell_into_inner, r=dtolnay
Mara Bos [Sun, 8 Nov 2020 12:36:14 +0000 (13:36 +0100)]
Rollup merge of #78728 - a1phyr:const_cell_into_inner, r=dtolnay

Constantify `UnsafeCell::into_inner` and related

Tracking issue: #78729

This PR constantifies:
- `UnsafeCell::into_inner`
- `Cell::into_inner`
- `RefCell::into_inner`
- `Atomic*::into_inner`

r? `````@dtolnay`````

3 years agoRollup merge of #78706 - bjorn3:fix_run_make_without_llvm, r=Mark-Simulacrum
Mara Bos [Sun, 8 Nov 2020 12:36:12 +0000 (13:36 +0100)]
Rollup merge of #78706 - bjorn3:fix_run_make_without_llvm, r=Mark-Simulacrum

Fix run-make tests running when LLVM is disabled

The `--cc`, `--cxx`, `--cflags` and `--ar` flags were only passed to compiletest when `builder.config.llvm_enabled()` returned true. This is preventing me from running the tests on cg_clif.

3 years agoRollup merge of #78658 - casey:x, r=Mark-Simulacrum
Mara Bos [Sun, 8 Nov 2020 12:36:09 +0000 (13:36 +0100)]
Rollup merge of #78658 - casey:x, r=Mark-Simulacrum

Add a tool to run `x.py` from any subdirectory

This adds a binary called `x` in `src/tools/x`. All it does is check the current directory and its ancestors for a file called `x.py`, and if it finds one, runs it.

By installing x, you can easily run `x.py` from any subdirectory, and only need to type `x`.

It can be installed with `cargo install --path src/tools/x`

This is a copy of a [binary I've been using myself when working on rust](https://github.com/casey/bootstrap), currently published to crates.io as `bootstrap`.

It could be changed to avoid indirecting through `x.py`, and instead call the bootstrap module directly. However, this seemed like the simplest thing possible, and won't break if the details of how the bootstrap module is invoked change.

3 years agoRollup merge of #78572 - de-vri-es:bsd-cloexec, r=m-ou-se
Mara Bos [Sun, 8 Nov 2020 12:36:07 +0000 (13:36 +0100)]
Rollup merge of #78572 - de-vri-es:bsd-cloexec, r=m-ou-se

Use SOCK_CLOEXEC and accept4() on more platforms.

This PR enables the use of `SOCK_CLOEXEC` and `accept4` on more platforms.

-----

Android uses the linux kernel, so it should also support it.

DragonflyBSD introduced them in 4.4 (December 2015):
https://www.dragonflybsd.org/release44/

FreeBSD introduced them in 10.0 (January 2014):
https://wiki.freebsd.org/AtomicCloseOnExec

Illumos introduced them in a commit in April 2013, not sure when it was released. It is quite possible that is has always been in Illumos:
https://github.com/illumos/illumos-gate/commit/5dbfd19ad5fcc2b779f40f80fa05c1bd28fd0b4e
https://illumos.org/man/3socket/socket
https://illumos.org/man/3socket/accept4

NetBSD introduced them in 6.0 (Oktober 2012) and 8.0 (July 2018):
https://man.netbsd.org/NetBSD-6.0/socket.2
https://man.netbsd.org/NetBSD-8.0/accept.2

OpenBSD introduced them in 5.7 (May 2015):
https://man.openbsd.org/socket https://man.openbsd.org/accept

3 years agoRollup merge of #78570 - sasurau4:test/check-pass-print-type-size, r=jyn514
Mara Bos [Sun, 8 Nov 2020 12:36:05 +0000 (13:36 +0100)]
Rollup merge of #78570 - sasurau4:test/check-pass-print-type-size, r=jyn514

Remove FIXME comment in print_type_sizes ui test suite

## Overview
Helps with #62277

> The type sizes are likely only printed when the actual layout is computed. For generic types, this only happens during codegen.

ref: https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/Codegen.20process.20question/near/215836807

Some tests like `multiple_types.rs` are passed even if using `check-pass`. But tests should be agnostic to when the actual layout is computed. The `build-pass` is intentionally used for them. I remove FIXME comments.

3 years agoRollup merge of #78065 - tshepang:nits, r=dtolnay
Mara Bos [Sun, 8 Nov 2020 12:36:01 +0000 (13:36 +0100)]
Rollup merge of #78065 - tshepang:nits, r=dtolnay

make concurrency helper more pleasant to read

3 years agoRollup merge of #76227 - CDirkx:const-poll, r=KodrAus
Mara Bos [Sun, 8 Nov 2020 12:35:58 +0000 (13:35 +0100)]
Rollup merge of #76227 - CDirkx:const-poll, r=KodrAus

Stabilize `Poll::is_ready` and `is_pending` as const

Insta-stabilize the methods `is_ready` and `is_pending` of `std::task::Poll` as const, in the same way as [PR#76198](https://github.com/rust-lang/rust/pull/76198).

Possible because of the recent stabilization of const control flow.

Part of #76225.

3 years agoRollup merge of #76097 - pickfire:stabilize-spin-loop, r=KodrAus
Mara Bos [Sun, 8 Nov 2020 12:35:54 +0000 (13:35 +0100)]
Rollup merge of #76097 - pickfire:stabilize-spin-loop, r=KodrAus

Stabilize hint::spin_loop

Partially fix #55002, deprecate in another release

r? ``````@KodrAus``````

3 years agoAuto merge of #78410 - lcnr:revert75443, r=nikomatsakis
bors [Sun, 8 Nov 2020 11:27:06 +0000 (11:27 +0000)]
Auto merge of #78410 - lcnr:revert75443, r=nikomatsakis

revert #75443, update mir validator

This PR reverts rust-lang#75443 to fix rust-lang#75992 and instead uses rust-lang#75419 to fix rust-lang#75313.

Adapts rust-lang#75419 to correctly deal with unevaluated constants as otherwise some `feature(const_evaluatable_checked)` tests would ICE.

Note that rust-lang#72793 was also fixed by rust-lang#75443, but as that issue only concerns `feature(type_alias_impl_trait)` I deleted that test case for now and would reopen that issue.

rust-lang#75443 may have also allowed some other code to now successfully compile which would make this revert a breaking change after 2 stable versions, but I hope that this is a purely theoretical concern.

See https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/generator.20upvars/near/214617274 for more reasoning about this.

r? `@nikomatsakis` `@eddyb` `@RalfJung`

3 years agoRun tools builder on subtree changes
Mark Rousskov [Sun, 8 Nov 2020 02:22:48 +0000 (21:22 -0500)]
Run tools builder on subtree changes

3 years agoAuto merge of #77729 - petrochenkov:mergetarg, r=Mark-Simulacrum
bors [Sun, 8 Nov 2020 02:21:55 +0000 (02:21 +0000)]
Auto merge of #77729 - petrochenkov:mergetarg, r=Mark-Simulacrum

rustc_target: Move some target options from `Target` to `TargetOptions`

The only reason for `Target` to `TargetOptions` to be separate structures is that options in `TargetOptions` have reasonable defaults and options in `Target` don't.
(Otherwise all the options logically belong to a single `Target` struct.)

This PR moves a number of options with reasonable defaults from `Target` to `TargetOptions`, so they no longer needs to be specified explicitly for majority of the targets.
The move also allows to inherit the options from `rustc_target/src/spec/*_base.rs` files in a nicer way.
I didn't change any specific option values here.

The moved options are `target_c_int_width` (defaults to `"32"`), `target_endian` (defaults to `"little"`), `target_os` (defaults to `"none"`), `target_env` (defaults to `""`), `target_vendor` (defaults to `"unknown"`) and `linker_flavor` (defaults to `LinkerFlavor::Gcc`).

Next steps (in later PRs):
- Find a way to merge `TargetOptions` into `Target`
- If not, always access `TargetOptions` fields through `Deref` making it a part of `Target` at least logically (`session.target.target.options.foo` -> `session.target.target.foo`)
- ~Eliminate `session::config::Config` and use `Target` instead (`session.target.target.foo` -> `session.target.foo`)~ Done in https://github.com/rust-lang/rust/pull/77943.
- Avoid tautologies in option names (`target.target_os` -> `target.os`)
- Resolve _ https://github.com/rust-lang/rust/issues/77730 (rustc_target: The differences between `target_os = "none"` and `target_os = "unknown"`, and `target_vendor = "unknown"` and `target_vendor = ""` are unclear) noticed during implementation of this PR.

3 years agoFix tab focus on restyled switches
Michael Howell [Sun, 8 Nov 2020 02:01:06 +0000 (19:01 -0700)]
Fix tab focus on restyled switches

Setting a checkbox to `display:none` makes it impossible to tab onto it,
which makes the rustdoc settings page completely keyboard inaccessible.

3 years agoUse a semicolon instead of a dash in lint note
Aaron Hill [Sun, 8 Nov 2020 01:39:35 +0000 (20:39 -0500)]
Use a semicolon instead of a dash in lint note

3 years agoDon't fire `CONST_ITEM_MUTATION` lint when borrowing a deref
Aaron Hill [Sun, 8 Nov 2020 01:11:53 +0000 (20:11 -0500)]
Don't fire `CONST_ITEM_MUTATION` lint when borrowing a deref

Fixes #78819

This extends the check for dereferences added in PR #77324
to cover mutable borrows, as well as direct writes. If we're operating
on a dereference of a `const` item, we shouldn't be firing the lint.

3 years agotypo and formatting
o752d [Sat, 7 Nov 2020 23:25:10 +0000 (23:25 +0000)]
typo and formatting

fixed a typo and modified some line formatting justification while I'm here :)

3 years agorustc_resolve: Use `#![feature(format_args_capture)]`
Vadim Petrochenkov [Sat, 7 Nov 2020 22:38:11 +0000 (01:38 +0300)]
rustc_resolve: Use `#![feature(format_args_capture)]`

3 years agoAuto merge of #78784 - Mark-Simulacrum:revert-77421, r=petrochenkov
bors [Sat, 7 Nov 2020 21:57:02 +0000 (21:57 +0000)]
Auto merge of #78784 - Mark-Simulacrum:revert-77421, r=petrochenkov

Revert "Revert "resolve: Avoid "self-confirming" import resolutions in one more case""

Specifically, this reverts commit b20bce8ce54ea9d47c2e3eb0b17cbb6baf916ae2 from #77421 to fix #77586.

The lang team has decided that for the time being we want to avoid the breakage here (perhaps for a future edition; though almost certainly not the upcoming one), though a future PR may want to add a lint around this case (and perhaps others) which are unlikely to be readable code.

r? `@petrochenkov` to confirm this is the right way to fix #77586.

3 years agoConvert a bunch of intra-doc links
Camelid [Sat, 7 Nov 2020 20:22:24 +0000 (12:22 -0800)]
Convert a bunch of intra-doc links

3 years agoLess verbose debug logging from inlining integrator
Tomasz Miąsko [Sat, 7 Nov 2020 00:00:00 +0000 (00:00 +0000)]
Less verbose debug logging from inlining integrator

The inlining integrator produces relatively verbose and uninteresting
logs.  Move them from a debug log level to a trace level, so that they
can be easily isolated from others.

3 years agoHonor the rustfmt setting in config.toml
Jake Goulding [Sat, 7 Nov 2020 18:26:42 +0000 (13:26 -0500)]
Honor the rustfmt setting in config.toml

Prior to this, setting the rustfmt configuration was ignored:

```
% mkdir example

% cd example

% ../configure --set build.rustfmt=/usr/bin/true

% ../x.py fmt
./x.py fmt is not supported on this channel
failed to run: /Users/shep/Projects/rust/example/build/bootstrap/debug/bootstrap fmt
Build completed unsuccessfully in 0:00:01
```

And after:

```
% ../x.py fmt
Build completed successfully in 0:00:11
```

3 years agoSmall cleanup in `TypeFoldable` derive macro
LeSeulArtichaut [Sat, 7 Nov 2020 17:20:42 +0000 (18:20 +0100)]
Small cleanup in `TypeFoldable` derive macro

3 years agoAuto merge of #75199 - Mark-Simulacrum:debug-asserts, r=pietroalbini
bors [Sat, 7 Nov 2020 16:54:23 +0000 (16:54 +0000)]
Auto merge of #75199 - Mark-Simulacrum:debug-asserts, r=pietroalbini

Re-enable debug and LLVM assertions

Historically we've disabled these assertions on a number of platforms with the
goal of speeding up CI. Now, though, having migrated to GitHub actions, CI is
already pretty fast, and these debug assertions do bring us some value.

This does leave in some debug assertions that are performance-related: macOS
currently hovers at just under 2 hours.

There are also some other builders which have debug and LLVM assertions
disabled:

llvm-8, PR builder:

In one view, this builder tests our support for older LLVMs. But in reality, a
lot of our tests already disable themselves on older LLVMs, and I think our
general stance is that we really only support the in-tree LLVM. Plus, we really
want CI times on this builder to be really low, as it's run on *every* PR --
that's a lot of CI time.

test-various:

This disables debug asserts still -- as noted in the Dockerfile, we test code
size, and we need debug asserts off for that to work well.

Helps with #59637 -- but doesn't close it, macOS still has asserts off.

r? `@pietroalbini`

3 years agoRemove unused `from_hir` call
Joshua Nelson [Sat, 7 Nov 2020 15:34:00 +0000 (10:34 -0500)]
Remove unused `from_hir` call

3 years agoFix handling of item names for HIR
Joshua Nelson [Thu, 22 Oct 2020 02:00:32 +0000 (22:00 -0400)]
Fix handling of item names for HIR

- Handle variants, fields, macros in `Node::ident()`
- Handle the crate root in `opt_item_name`
- Factor out `item_name_from_def_id` to reduce duplication
- Look at HIR before the DefId for `opt_item_name`

  This gives accurate spans, which are not available from serialized
  metadata.

- Don't panic on the crate root in `opt_item_name`
- Add comments

3 years agoImplement destructuring assignment for tuples
Fabian Zaiser [Wed, 4 Nov 2020 16:32:52 +0000 (16:32 +0000)]
Implement destructuring assignment for tuples

Co-authored-by: varkor <github@varkor.com>
3 years agoremove FIXME comment of #62277 in print_type_sizez ui tests
Daiki Ihara [Sat, 7 Nov 2020 12:34:40 +0000 (21:34 +0900)]
remove FIXME comment of #62277 in print_type_sizez ui tests

3 years agoUpdate recently added targets
Vadim Petrochenkov [Sat, 7 Nov 2020 11:34:44 +0000 (14:34 +0300)]
Update recently added targets

3 years agorustc_target: Move `linker_flavor` from `Target` to `TargetOptions`
Vadim Petrochenkov [Thu, 8 Oct 2020 19:22:28 +0000 (22:22 +0300)]
rustc_target: Move `linker_flavor` from `Target` to `TargetOptions`

3 years agorustc_target: Move `target_vendor` from `Target` to `TargetOptions`
Vadim Petrochenkov [Thu, 8 Oct 2020 19:10:13 +0000 (22:10 +0300)]
rustc_target: Move `target_vendor` from `Target` to `TargetOptions`

3 years agorustc_target: Move `target_env` from `Target` to `TargetOptions`
Vadim Petrochenkov [Thu, 8 Oct 2020 18:47:22 +0000 (21:47 +0300)]
rustc_target: Move `target_env` from `Target` to `TargetOptions`

3 years agorustc_target: Move `target_os` from `Target` to `TargetOptions`
Vadim Petrochenkov [Thu, 8 Oct 2020 17:54:45 +0000 (20:54 +0300)]
rustc_target: Move `target_os` from `Target` to `TargetOptions`

3 years agorustc_target: Move `target_endian` from `Target` to `TargetOptions`
Vadim Petrochenkov [Thu, 8 Oct 2020 16:57:41 +0000 (19:57 +0300)]
rustc_target: Move `target_endian` from `Target` to `TargetOptions`

3 years agorustc_target: Move `target_c_int_width` from `Target` to `TargetOptions`
Vadim Petrochenkov [Thu, 8 Oct 2020 16:36:11 +0000 (19:36 +0300)]
rustc_target: Move `target_c_int_width` from `Target` to `TargetOptions`

3 years agofix `super_visit_with` for `Terminator`
Bastian Kauschke [Sat, 7 Nov 2020 10:54:35 +0000 (11:54 +0100)]
fix `super_visit_with` for `Terminator`

3 years agoAuto merge of #78817 - RalfJung:miri, r=RalfJung
bors [Sat, 7 Nov 2020 08:40:56 +0000 (08:40 +0000)]
Auto merge of #78817 - RalfJung:miri, r=RalfJung

update Miri

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

3 years agouse single char patterns for split() (clippy::single_char_pattern)
Matthias Krüger [Sat, 7 Nov 2020 00:23:02 +0000 (01:23 +0100)]
use single char patterns for split() (clippy::single_char_pattern)

3 years agoMonomorphize a type argument of size-of operation during codegen
Tomasz Miąsko [Sat, 7 Nov 2020 00:00:00 +0000 (00:00 +0000)]
Monomorphize a type argument of size-of operation during codegen

This wasn't necessary until MIR inliner started to consider drop glue as
a candidate for inlining; introducing for the first time a generic use
of size-of operation.

No test at this point since this only happens with a custom inlining
threshold.

3 years agoCompile tools and internal libraries with the initial-exec TLS model
Josh Triplett [Mon, 26 Oct 2020 05:11:20 +0000 (22:11 -0700)]
Compile tools and internal libraries with the initial-exec TLS model

This should produce more efficient code, with fewer calls to
__tls_get_addr. The tradeoff is that libraries using it won't work with
dlopen, but that shouldn't be a problem for tools or for our own
internal libraries.

Co-authored-by: Mark Rousskov <mark.simulacrum@gmail.com>
3 years agoimprove fixme
Bastian Kauschke [Fri, 6 Nov 2020 18:21:17 +0000 (19:21 +0100)]
improve fixme

3 years agoupdate Miri
Ralf Jung [Fri, 6 Nov 2020 20:46:07 +0000 (21:46 +0100)]
update Miri

3 years agoAdd debug asserts to PR builder
Mark Rousskov [Wed, 5 Aug 2020 21:43:59 +0000 (17:43 -0400)]
Add debug asserts to PR builder

This is helpful to catch slightly more bugs before things hit main CI, and
doesn't cost too much extra CI time.

3 years agoRe-enable debug and LLVM assertions
Mark Rousskov [Wed, 5 Aug 2020 20:17:18 +0000 (16:17 -0400)]
Re-enable debug and LLVM assertions

Historically we've disabled these assertions on a number of platforms with the
goal of speeding up CI. Now, though, having migrated to GitHub actions, CI is
already pretty fast, and these debug assertions do bring us some value.

This does leave in some debug assertions that are performance-related: macOS
currently hovers at just under 2 hours.

There are also some other builders which have debug and LLVM assertions
disabled:

llvm-8, PR builder:

In one view, this builder tests our support for older LLVMs. But in reality, a
lot of our tests already disable themselves on older LLVMs, and I think our
general stance is that we really only support the in-tree LLVM. Plus, we really
want CI times on this builder to be really low, as it's run on *every* PR --
that's a lot of CI time.

test-various:

This disables debug asserts still -- as noted in the Dockerfile, we test code
size, and we need debug asserts off for that to work well.

3 years agoAuto merge of #75778 - AndyGauge:75521-rustdoc-book-improvements, r=jyn514
bors [Fri, 6 Nov 2020 19:01:10 +0000 (19:01 +0000)]
Auto merge of #75778 - AndyGauge:75521-rustdoc-book-improvements, r=jyn514

75521 rustdoc book improvements

Added some guidelines about documenting with rustdoc
Fixes #75521

3 years agoBump Rustfmt and RLS
Alessandro Ghedini [Thu, 5 Nov 2020 15:58:23 +0000 (15:58 +0000)]
Bump Rustfmt and RLS

Should hopefully fix #78341 and #78340.

3 years agoAdd tracking issue
Benoît du Garreau [Fri, 6 Nov 2020 17:04:52 +0000 (18:04 +0100)]
Add tracking issue

3 years agoMake some std::io functions `const`
Benoît du Garreau [Fri, 6 Nov 2020 16:46:56 +0000 (17:46 +0100)]
Make some std::io functions `const`

Includes:
- io::Cursor::new
- io::Cursor::get_ref
- io::Cursor::position
- io::empty
- io::repeat
- io::sink

3 years agoRevert "Revert "resolve: Avoid "self-confirming" import resolutions in one more case""
Mark Rousskov [Thu, 5 Nov 2020 20:16:12 +0000 (15:16 -0500)]
Revert "Revert "resolve: Avoid "self-confirming" import resolutions in one more case""

This reverts commit b20bce8ce54ea9d47c2e3eb0b17cbb6baf916ae2.

It retains the test added in that commit as a check-pass test, intended to
prevent future (unintentional) regressions.

3 years agoAuto merge of #78810 - JohnTitor:rollup-8fhtvxu, r=JohnTitor
bors [Fri, 6 Nov 2020 16:12:13 +0000 (16:12 +0000)]
Auto merge of #78810 - JohnTitor:rollup-8fhtvxu, r=JohnTitor

Rollup of 15 pull requests

Successful merges:

 - #74979 (`#![deny(unsafe_op_in_unsafe_fn)]` in sys/hermit)
 - #78006 (Use Intra-doc links for std::io::buffered)
 - #78167 (Fix unreachable sub-branch detection in or-patterns)
 - #78514 (Allow using 1/2/3/4 for `x.py setup` options)
 - #78538 (BTreeMap: document a curious assumption in test cases)
 - #78559 (Add LLVM upgrades from 7 to 10 to RELEASES.md)
 - #78666 (Fix shellcheck error)
 - #78705 (Print a summary of which test suite failed)
 - #78726 (Add link to rust website)
 - #78730 (Expand explanation of reverse_bits)
 - #78760 (`deny(invalid_codeblock_attributes)` for rustc_error_codes)
 - #78771 (inliner: Copy unevaluated constants only after successful inlining)
 - #78794 (rustc_expand: use collect_bang helper instead of manual reimplementation)
 - #78795 (The renumber pass is long gone)
 - #78798 (Fixing Spelling Typos)

Failed merges:

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