]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoRollup merge of #79302 - est31:issue_73899_test, r=lcnr
Guillaume Gomez [Sun, 22 Nov 2020 15:15:15 +0000 (16:15 +0100)]
Rollup merge of #79302 - est31:issue_73899_test, r=lcnr

Add regression test for issue 73899

Closes #73899

3 years agoRollup merge of #79300 - GuillaumeGomez:hidden-feature-info, r=jyn514
Guillaume Gomez [Sun, 22 Nov 2020 15:15:13 +0000 (16:15 +0100)]
Rollup merge of #79300 - GuillaumeGomez:hidden-feature-info, r=jyn514

Prevent feature information to be hidden if it's on the impl directly

Fixes #79279.

So when a `#[doc(cfg...)]` is used on a trait impl directly, it's not hidden by the toggle.

![Screenshot from 2020-11-22 14-40-11](https://user-images.githubusercontent.com/3050060/99905528-997fab00-2cd1-11eb-83be-ed06b0cb97df.png)

r? `@jyn514`

3 years agoRollup merge of #79292 - nico-abram:master, r=jonas-schievink
Guillaume Gomez [Sun, 22 Nov 2020 15:15:12 +0000 (16:15 +0100)]
Rollup merge of #79292 - nico-abram:master, r=jonas-schievink

Fix typo in doc comment for report_too_many_hashes

"to big" -> "too big"

3 years agoRollup merge of #78670 - sasurau4:test/check-pass-incremental, r=jyn514
Guillaume Gomez [Sun, 22 Nov 2020 15:15:10 +0000 (16:15 +0100)]
Rollup merge of #78670 - sasurau4:test/check-pass-incremental, r=jyn514

Remove FIXME comment in some incremental test suite

Helps with #62277

I removed FIXME comment in some incremental tests with [rustc_partition_codegened](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_incremental/assert_module_sources/index.html). This seems using codegen process. So it uses intentionally `build-pass`

3 years agoPrevent feature information to be hidden if it's on the impl directly
Guillaume Gomez [Sun, 22 Nov 2020 13:45:54 +0000 (14:45 +0100)]
Prevent feature information to be hidden if it's on the impl directly

3 years agoAdd regression test for issue 73899
est31 [Sun, 22 Nov 2020 13:53:31 +0000 (14:53 +0100)]
Add regression test for issue 73899

Adds regression test for https://github.com/rust-lang/rust/issues/73899

3 years agoAuto merge of #77872 - Xaeroxe:stabilize-clamp, r=scottmcm
bors [Sun, 22 Nov 2020 10:50:04 +0000 (10:50 +0000)]
Auto merge of #77872 - Xaeroxe:stabilize-clamp, r=scottmcm

Stabilize clamp

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

Clamp has been merged and unstable for about a year and a half now. How do we feel about stabilizing this?

3 years agoFix typo in doc comment for report_too_many_hashes
Nicolas [Sun, 22 Nov 2020 10:02:58 +0000 (07:02 -0300)]
Fix typo in doc comment for report_too_many_hashes

"to big" -> "too big"

3 years agoAuto merge of #79275 - integer32llc:doc-style, r=jonas-schievink
bors [Sun, 22 Nov 2020 08:30:23 +0000 (08:30 +0000)]
Auto merge of #79275 - integer32llc:doc-style, r=jonas-schievink

More consistently use spaces after commas in lists in docs

This PR changes instances of lists that didn't use spaces after commas, like `vec![1,2,3]`, to `vec![1, 2, 3]` to be more consistent with idiomatic Rust style (the way these were looks strange to me, especially because there are often lists that *do* use spaces after the commas later in the same code block ðŸ˜¬).

I noticed one of these in an example in the stdlib docs and went looking for more, but as far as I can see, I'm only changing those spots in user-facing documentation or rustc output, and the changes make no semantic difference.

3 years agoAuto merge of #79229 - sdroege:slice-fill-memset, r=dtolnay
bors [Sun, 22 Nov 2020 04:27:03 +0000 (04:27 +0000)]
Auto merge of #79229 - sdroege:slice-fill-memset, r=dtolnay

Add "memset" as doc alias to slice::fill()

Similar to 53f969dfd1b5c128145c24653c668193e8c50f85 and should make it easier for people coming from C to find this function.

3 years agoAuto merge of #78752 - jyn514:html-diff, r=GuillaumeGomez
bors [Sun, 22 Nov 2020 01:09:04 +0000 (01:09 +0000)]
Auto merge of #78752 - jyn514:html-diff, r=GuillaumeGomez

Give a better error when rustdoc tests fail

- Run the default rustdoc against the current rustdoc
- Diff output recursively
- Colorize diff output

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

## Resolved questions

- Should this be opt-in instead of on by default?
  + No
- Should this call through to `delta`? That's not a very common program to have installed, but I'm not sure how to do diffs after the fact. Maybe `compiletest` can take a `--syntax-highlighter` parameter or something?
  + I decided to use `delta` if available and `diff --color` otherwise. It prints a warning if delta isn't installed so you know you can get nicer diffs

## Open questions.

- What version of rustdoc would this compare against? Ideally it would compare against `$(git merge-base HEAD origin/master)` - maybe that's feasible if we install those artifacts from CI?
- Does it always make sense to compare the tests? Especially for new tests, I'm not sure how useful it would be ... but then again, one of the questions I want to know most as a reviewer is 'did it break before?'.

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

3 years agoAuto merge of #78461 - TimDiekmann:vec-alloc, r=Amanieu
bors [Sat, 21 Nov 2020 22:46:50 +0000 (22:46 +0000)]
Auto merge of #78461 - TimDiekmann:vec-alloc, r=Amanieu

Add support for custom allocators in `Vec`

This follows the [roadmap](https://github.com/rust-lang/wg-allocators/issues/7) of the allocator WG to add custom allocators to collections.

r? `@Amanieu`

This pull request requires a crater run.

### Prior work:
- #71873: Crater-test to solve rust-lang/wg-allocators#1
- [`alloc-wg`](https://github.com/TimDiekmann/alloc-wg)-crate

3 years agoAuto merge of #79273 - Dylan-DPC:rollup-zd10xlt, r=Dylan-DPC
bors [Sat, 21 Nov 2020 20:18:11 +0000 (20:18 +0000)]
Auto merge of #79273 - Dylan-DPC:rollup-zd10xlt, r=Dylan-DPC

Rollup of 8 pull requests

Successful merges:

 - #77844 (clarify rules for ZST Boxes)
 - #79067 (Refactor the abi handling code a bit)
 - #79182 (Fix links to extern types in rustdoc (fixes #78777))
 - #79231 (Exhaustively match in variant count instrinsic)
 - #79238 (Direct RUSTC_LOG (tracing/log) output to stderr instead of stdout.)
 - #79256 (Fix typos)
 - #79264 (Get rid of some doctree items)
 - #79272 (Support building clone shims for arrays with generic size)

Failed merges:

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

3 years agoMore consistently use spaces after commas in lists in docs
Carol (Nichols || Goulding) [Sat, 21 Nov 2020 19:43:34 +0000 (14:43 -0500)]
More consistently use spaces after commas in lists in docs

3 years agoRollup merge of #79272 - tmiasko:array-clone, r=jonas-schievink
Dylan DPC [Sat, 21 Nov 2020 18:44:20 +0000 (19:44 +0100)]
Rollup merge of #79272 - tmiasko:array-clone, r=jonas-schievink

Support building clone shims for arrays with generic size

Fixes #79269.

3 years agoRollup merge of #79264 - jyn514:less-doctree, r=GuillaumeGomez
Dylan DPC [Sat, 21 Nov 2020 18:44:18 +0000 (19:44 +0100)]
Rollup merge of #79264 - jyn514:less-doctree, r=GuillaumeGomez

Get rid of some doctree items

They can be derived directly from the `hir::Item`, there's no special logic.

- TypeDef
- OpaqueTy
- Constant
- Static
- TraitAlias
- Enum
- Union
- Struct

Part of #78082 (the easiest part, I'm still debugging some other changes).
r? `@GuillaumeGomez`

3 years agoRollup merge of #79256 - bugadani:query-typo, r=jonas-schievink
Dylan DPC [Sat, 21 Nov 2020 18:44:16 +0000 (19:44 +0100)]
Rollup merge of #79256 - bugadani:query-typo, r=jonas-schievink

Fix typos

3 years agoRollup merge of #79238 - eddyb:rustc-log-stderr, r=jyn514
Dylan DPC [Sat, 21 Nov 2020 18:44:15 +0000 (19:44 +0100)]
Rollup merge of #79238 - eddyb:rustc-log-stderr, r=jyn514

Direct RUSTC_LOG (tracing/log) output to stderr instead of stdout.

Looks like this got missed in the initial implementation, AFAIK the old behavior was to output on stderr.
(Hit this while trying to debug `rustc` running inside a build script which was only letting stderr through)

r? ``@oli-obk`` cc ``@davidbarsky`` ``@hawkw``

3 years agoRollup merge of #79231 - wusyong:issue-79137, r=lcnr
Dylan DPC [Sat, 21 Nov 2020 18:44:13 +0000 (19:44 +0100)]
Rollup merge of #79231 - wusyong:issue-79137, r=lcnr

Exhaustively match in variant count instrinsic

Fix #79137

3 years agoRollup merge of #79182 - lochsh:78777-fix-extern-types-ref, r=jyn514
Dylan DPC [Sat, 21 Nov 2020 18:44:11 +0000 (19:44 +0100)]
Rollup merge of #79182 - lochsh:78777-fix-extern-types-ref, r=jyn514

Fix links to extern types in rustdoc (fixes #78777)

 r? `@jyn514`
 Fixes #78777.
The initial fix we tried was:
```diff
diff --git a/src/librustdoc/passes/collect_intra_doc_links.rs b/src/librustdoc/passes/collect_intra_doc_links.rs
index 8be9482acff..c4b7086fdb1 100644
--- a/src/librustdoc/passes/collect_intra_doc_links.rs
+++ b/src/librustdoc/passes/collect_intra_doc_links.rs
`@@` -433,8 +433,9 `@@` impl<'a, 'tcx> LinkCollector<'a, 'tcx> {
             Res::PrimTy(prim) => Some(
                 self.resolve_primitive_associated_item(prim, ns, module_id, item_name, item_str),
             ),
-            Res::Def(DefKind::Struct | DefKind::Union | DefKind::Enum | DefKind::TyAlias, did) => {
+            Res::Def(kind, did) if kind.ns() == Some(Namespace::TypeNS) => {
                 debug!("looking for associated item named {} for item {:?}", item_name, did);
+
                 // Checks if item_name belongs to `impl SomeItem`
                 let assoc_item = cx
                     .tcx
```

However, this caused traits to be matched, resulting in a panic when `resolve_associated_trait_item` is called further down in this function.

This PR also adds an error message for that panic. Currently it will look something like:
```rust
thread 'rustc' panicked at 'Not a type: DefIndex(8624)', compiler/rustc_metadata/src/rmeta/decoder.rs:951:32
```
I wasn't sure how to get a better debug output than `DefIndex(...)`, and am open to suggestions.

3 years agoRollup merge of #79067 - bjorn3:abi_refactor, r=nagisa
Dylan DPC [Sat, 21 Nov 2020 18:44:10 +0000 (19:44 +0100)]
Rollup merge of #79067 - bjorn3:abi_refactor, r=nagisa

Refactor the abi handling code a bit

I am not quite sure if all changes are improvements.

3 years agoRollup merge of #77844 - RalfJung:zst-box, r=nikomatsakis
Dylan DPC [Sat, 21 Nov 2020 18:44:07 +0000 (19:44 +0100)]
Rollup merge of #77844 - RalfJung:zst-box, r=nikomatsakis

clarify rules for ZST Boxes

LLVM's rules around `getelementptr inbounds` with offset 0 are a bit annoying, and as a consequence we have no choice but say that a `Box<()>` pointing to previously allocated memory that has since been freed is UB. Clarify the docs to reflect this.

This is based on conversations on the LLVM mailing list.
* Here's my initial mail: https://lists.llvm.org/pipermail/llvm-dev/2019-February/130452.html
* The first email of the March part of that thread: https://lists.llvm.org/pipermail/llvm-dev/2019-March/130831.html
* First email of the April part: https://lists.llvm.org/pipermail/llvm-dev/2019-April/131693.html

The conclusion for me at least was that `getelementptr inbounds` with offset 0 is *not* the identity function, but can sometimes return `poison` even when the input is a regular pointer -- specifically, it returns `poison` when this pointer points into something that LLVM "knows has been deallocated", i.e., a former LLVM-managed allocation. It is however the identity function on pointers obtained by casting integers.

Note that there [are formal proposals](https://people.mpi-sws.org/~jung/twinsem/twinsem.pdf) for LLVM semantics where `getelementptr inbounds` with offset 0 isn't quite the identity function but never returns `poison` (it affects the provenance of the pointer but in a way that doesn't matter if this pointer is never used for memory accesses), and indeed this is likely necessary to consistently describe LLVM semantics. But with the informal LLVM LangRef that we have right now, and with LLVM devs insisting otherwise, it seems unwise to rely on this.

3 years agoReplace sext() and zext() with single ext() method
bjorn3 [Sat, 21 Nov 2020 18:06:35 +0000 (19:06 +0100)]
Replace sext() and zext() with single ext() method

3 years agoRename prefix_chunk to prefix_chunk_size
bjorn3 [Sun, 15 Nov 2020 09:12:10 +0000 (10:12 +0100)]
Rename prefix_chunk to prefix_chunk_size

3 years agoRemove StructRet arg attr
bjorn3 [Sat, 14 Nov 2020 18:16:43 +0000 (19:16 +0100)]
Remove StructRet arg attr

It is applied exactly when the return value has an indirect pass mode.
Except for InReg on x86 fastcall, arg attrs are now only used for
optimization purposes and thus are fine to ignore.

3 years agoReplace ByVal attribute with on_stack field for Indirect
bjorn3 [Sat, 14 Nov 2020 13:29:40 +0000 (14:29 +0100)]
Replace ByVal attribute with on_stack field for Indirect

This makes it clearer that only PassMode::Indirect allows ByVal

3 years agoReplace ZExt and SExt flags with ArgExtension enum
bjorn3 [Sat, 14 Nov 2020 11:27:57 +0000 (12:27 +0100)]
Replace ZExt and SExt flags with ArgExtension enum

Both flags are mutually exclusive

3 years agoAuto merge of #79237 - alexcrichton:update-backtrace, r=Mark-Simulacrum
bors [Sat, 21 Nov 2020 18:05:07 +0000 (18:05 +0000)]
Auto merge of #79237 - alexcrichton:update-backtrace, r=Mark-Simulacrum

std: Update the bactrace crate submodule

This commit updates the `library/backtrace` submodule which primarily
pulls in support for split-debuginfo on macOS, avoiding the need for
`dsymutil` to get run to get line numbers and filenames in backtraces.

3 years agox.py test --bless
Joshua Nelson [Sat, 21 Nov 2020 16:08:58 +0000 (11:08 -0500)]
x.py test --bless

3 years agoAuto merge of #79115 - cuviper:rust-description, r=Mark-Simulacrum
bors [Sat, 21 Nov 2020 15:43:09 +0000 (15:43 +0000)]
Auto merge of #79115 - cuviper:rust-description, r=Mark-Simulacrum

x.py: allow a custom string appended to the version

This adds `rust.description` to the config as a descriptive string to be
appended to `rustc --version` output, which is also used in places like
debuginfo `DW_AT_producer`. This may be useful for supplementary build
information, like distro-specific package versions.

For example, in Fedora 33, `gcc --version` outputs:

    gcc (GCC) 10.2.1 20201016 (Red Hat 10.2.1-6)

With this change, we can add similar vendor info to `rustc --version`.

3 years agoFix wrong names when inlining
Joshua Nelson [Sat, 21 Nov 2020 15:10:03 +0000 (10:10 -0500)]
Fix wrong names when inlining

3 years agoAdd more tests for renamed items
Joshua Nelson [Sat, 21 Nov 2020 15:16:07 +0000 (10:16 -0500)]
Add more tests for renamed items

3 years agoGet rid of some doctree items
Joshua Nelson [Sat, 21 Nov 2020 04:50:13 +0000 (23:50 -0500)]
Get rid of some doctree items

They can be derived directly from the `hir::Item`, there's no special
logic.

- TypeDef
- OpaqueTy
- Constant
- Static
- TraitAlias
- Enum
- Union
- Struct

3 years agoAuto merge of #77805 - JohnTitor:non-standard-char-sugg, r=Dylan-DPC
bors [Sat, 21 Nov 2020 13:11:35 +0000 (13:11 +0000)]
Auto merge of #77805 - JohnTitor:non-standard-char-sugg, r=Dylan-DPC

lint: Do not provide suggestions for non standard characters

Fixes #77273

Only provide suggestions if the case-fixed result is different than the original.

3 years agoAuto merge of #79250 - RalfJung:miri, r=RalfJung
bors [Sat, 21 Nov 2020 10:53:56 +0000 (10:53 +0000)]
Auto merge of #79250 - RalfJung:miri, r=RalfJung

update miri

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

3 years agoAuto merge of #79222 - yoshuawuyts:slice-fill-with, r=m-ou-se
bors [Sat, 21 Nov 2020 08:15:16 +0000 (08:15 +0000)]
Auto merge of #79222 - yoshuawuyts:slice-fill-with, r=m-ou-se

Add `core::slice::fill_with`

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

As suggested by `@m-ou-se` in https://github.com/rust-lang/rust/issues/70758#issuecomment-726838099 this implements `slice::fill_with` as a counterpart to `slice::fill`. This mirrors `Vec::resize` and `Vec::resize_with`. Thanks!

r? `@m-ou-se`

3 years agoFix typos
Dániel Buga [Sat, 21 Nov 2020 08:06:45 +0000 (09:06 +0100)]
Fix typos

3 years agoAuto merge of #79003 - petrochenkov:innertest, r=estebank
bors [Sat, 21 Nov 2020 05:52:16 +0000 (05:52 +0000)]
Auto merge of #79003 - petrochenkov:innertest, r=estebank

rustc_expand: Mark inner `#![test]` attributes as soft-unstable

Custom inner attributes are feature gated (https://github.com/rust-lang/rust/issues/54726) except for attributes having name `test` literally, which are not gated for historical reasons.

`#![test]` is an inner proc macro attribute, so it has all the issues described in https://github.com/rust-lang/rust/issues/54726 too.
This PR gates it with the `soft_unstable` lint.

3 years agoFix comments of toogeneris test
Ngo Iok Ui [Sat, 21 Nov 2020 05:47:09 +0000 (13:47 +0800)]
Fix comments of toogeneris test

3 years agoList all variants of TyKind
Ngo Iok Ui [Sat, 21 Nov 2020 05:45:59 +0000 (13:45 +0800)]
List all variants of TyKind

3 years agoMove from bash to rust
Joshua Nelson [Sat, 21 Nov 2020 03:58:46 +0000 (22:58 -0500)]
Move from bash to rust

3 years agoAuto merge of #78588 - HeroicKatora:sccc, r=nikomatsakis
bors [Sat, 21 Nov 2020 01:30:26 +0000 (01:30 +0000)]
Auto merge of #78588 - HeroicKatora:sccc, r=nikomatsakis

Reworks Sccc computation to iteration instead of recursion

Linear graphs, producing as many scc's as nodes, would recurse once for every node when entered from the start of the list. This adds a test that exhausted the stack at least on my machine with error:

```
thread 'graph::scc::tests::test_deep_linear' has overflowed its stack
fatal runtime error: stack overflow
```

This may or may not be connected to #78567. I was only reminded that I started this rework some time ago. It might be plausible as borrow checking a long function with many borrow regions around each other—((((((…))))))— may produce the linear list setup to trigger this stack overflow ? I don't know enough about borrow check to say for sure.

This is best read in two separate commits. The first addresses only `find_state` internally. This is classical union phase from union-find. There's also a common solution of using the parent pointers in the (virtual) linked list to track the backreferences while traversing upwards and then following them backwards in a second path compression phase.

The second is more involved as it rewrites the mutually recursive `walk_node` and `walk_unvisited_node`. Firstly, the caller is required to handle the unvisited case of `walk_node` so a new `start_walk_from` method is added to handle that by walking the unvisited node if necessary. Then `walk_unvisited_node`, where we would previously recurse into in the missing case, is rewritten to construct a manual stack of its frames. The state fields consist of the previous stack slots.

3 years agoSupport building clone shims for arrays with generic size
Tomasz MiÄ…sko [Sat, 21 Nov 2020 00:00:00 +0000 (00:00 +0000)]
Support building clone shims for arrays with generic size

3 years agoupdate miri
Ralf Jung [Fri, 20 Nov 2020 23:35:48 +0000 (00:35 +0100)]
update miri

3 years agoAuto merge of #78569 - bugadani:arena-spec, r=Mark-Simulacrum
bors [Fri, 20 Nov 2020 23:21:34 +0000 (23:21 +0000)]
Auto merge of #78569 - bugadani:arena-spec, r=Mark-Simulacrum

Arena: use specialization to avoid copying data

In several cases, a `Vec` or `SmallVec` is passed to `Arena::alloc_from_iter` directly. This PR makes sure those cases don't copy their data unnecessarily, by specializing the `alloc_from_iter` implementation.

3 years agoUse specialization to avoid copying
Dániel Buga [Fri, 30 Oct 2020 10:42:44 +0000 (11:42 +0100)]
Use specialization to avoid copying

3 years agostd: Update the backtrace crate submodule
Alex Crichton [Fri, 20 Nov 2020 17:12:14 +0000 (09:12 -0800)]
std: Update the backtrace crate submodule

This commit updates the `library/backtrace` submodule which primarily
pulls in support for split-debuginfo on macOS, avoiding the need for
`dsymutil` to get run to get line numbers and filenames in backtraces.

3 years agoWe missed 1.49.0, so bump version to 1.50.0
Jacob Kiesel [Fri, 20 Nov 2020 17:37:22 +0000 (10:37 -0700)]
We missed 1.49.0, so bump version to 1.50.0

3 years agoDirect RUSTC_LOG (tracing/log) output to stderr instead of stdout.
Eduard-Mihai Burtescu [Fri, 20 Nov 2020 17:34:44 +0000 (19:34 +0200)]
Direct RUSTC_LOG (tracing/log) output to stderr instead of stdout.

3 years agorustc_expand: Mark inner `#![test]` attributes as soft-unstable
Vadim Petrochenkov [Thu, 12 Nov 2020 20:42:42 +0000 (23:42 +0300)]
rustc_expand: Mark inner `#![test]` attributes as soft-unstable

3 years agoAuto merge of #78104 - ssomers:btree_root_redux, r=Mark-Simulacrum
bors [Fri, 20 Nov 2020 16:12:35 +0000 (16:12 +0000)]
Auto merge of #78104 - ssomers:btree_root_redux, r=Mark-Simulacrum

BTreeMap: replace Root with NodeRef<Owned, ...>

`NodeRef<marker::Owned, â€¦>` already exists as a representation of root nodes, and it makes more sense to alias `Root` to that than to reuse the space-efficient `BoxedNode` that is oblivious to height, where height is required.

r? `@Mark-Simulacrum`

3 years agoExhaustively match in variant count instrinsic
Ngo Iok Ui [Fri, 20 Nov 2020 13:49:49 +0000 (21:49 +0800)]
Exhaustively match in variant count instrinsic

3 years agoAuto merge of #79205 - rust-lang:jdm-patch-1, r=m-ou-se
bors [Fri, 20 Nov 2020 13:42:44 +0000 (13:42 +0000)]
Auto merge of #79205 - rust-lang:jdm-patch-1, r=m-ou-se

Extend meta parameters to all generated code in compat_fn.

Fixes https://github.com/rust-lang/rust/issues/79203. This addresses a regression from 7e2032390cf34f3ffa726b7bd890141e2684ba63 for UWP targets.

3 years agoAdd "memset" as doc alias to slice::fill()
Sebastian Dröge [Fri, 20 Nov 2020 13:18:41 +0000 (15:18 +0200)]
Add "memset" as doc alias to slice::fill()

3 years agoAdd `core::slice::fill_with`
Yoshua Wuyts [Fri, 20 Nov 2020 00:42:43 +0000 (01:42 +0100)]
Add `core::slice::fill_with`

3 years agoRemove FIXME comment from incremental
Daiki Ihara [Fri, 20 Nov 2020 12:33:48 +0000 (21:33 +0900)]
Remove FIXME comment from incremental

3 years agoAuto merge of #78646 - tgnottingham:packed_fingerprints, r=nnethercote
bors [Fri, 20 Nov 2020 11:11:19 +0000 (11:11 +0000)]
Auto merge of #78646 - tgnottingham:packed_fingerprints, r=nnethercote

Use PackedFingerprint in DepNode to reduce memory consumption

3 years agoreference NonNull::dangling
Ralf Jung [Fri, 20 Nov 2020 09:25:59 +0000 (10:25 +0100)]
reference NonNull::dangling

3 years agoSet unaligned_references lint to deny in rustc_data_structures
Tyson Nottingham [Fri, 20 Nov 2020 09:13:15 +0000 (01:13 -0800)]
Set unaligned_references lint to deny in rustc_data_structures

To detect misuse of private packed field in `PackedFingerprint`.

3 years agoAuto merge of #79196 - RalfJung:syscall, r=m-ou-se
bors [Fri, 20 Nov 2020 08:46:42 +0000 (08:46 +0000)]
Auto merge of #79196 - RalfJung:syscall, r=m-ou-se

unix/weak: pass arguments to syscall at the given type

Given that we know the type the argument should have, it seems a bit strange not to use that information.

r? `@m-ou-se` `@cuviper`

3 years agoAuto merge of #79192 - tmiasko:naked-noinline, r=oli-obk
bors [Fri, 20 Nov 2020 06:01:49 +0000 (06:01 +0000)]
Auto merge of #79192 - tmiasko:naked-noinline, r=oli-obk

Never inline naked functions

The `#[naked]` attribute disabled prologue / epilogue emission for the
function and it is responsibility of a developer to provide them. The
compiler is no position to inline such functions correctly.

Disable inlining of naked functions at LLVM and MIR level.

Closes #60919.

3 years agoAuto merge of #78088 - fusion-engineering-forks:panic-fmt-lint, r=estebank
bors [Fri, 20 Nov 2020 03:40:20 +0000 (03:40 +0000)]
Auto merge of #78088 - fusion-engineering-forks:panic-fmt-lint, r=estebank

Add lint for panic!("{}")

This adds a lint that warns about `panic!("{}")`.

`panic!(msg)` invocations with a single argument use their argument as panic payload literally, without using it as a format string. The same holds for `assert!(expr, msg)`.

This lints checks if `msg` is a string literal (after expansion), and warns in case it contained braces. It suggests to insert `"{}", ` to use the message literally, or to add arguments to use it as a format string.

![image](https://user-images.githubusercontent.com/783247/96643867-79eb1080-1328-11eb-8d4e-a5586837c70a.png)

This lint is also a good starting point for adding warnings about `panic!(not_a_string)` later, once [`panic_any()`](https://github.com/rust-lang/rust/pull/74622) becomes a stable alternative.

3 years agoAuto merge of #79220 - Dylan-DPC:rollup-5bpbygd, r=Dylan-DPC
bors [Fri, 20 Nov 2020 00:51:54 +0000 (00:51 +0000)]
Auto merge of #79220 - Dylan-DPC:rollup-5bpbygd, r=Dylan-DPC

Rollup of 11 pull requests

Successful merges:

 - #79119 (Clarify availability of atomic operations)
 - #79123 (Add u128 and i128 integer tests)
 - #79177 (Test drop order for (destructuring) assignments)
 - #79181 (rustdoc: add [src] links to methods on a trait's page)
 - #79183 (Make compiletest testing use the local sysroot)
 - #79185 (expand/resolve: Pre-requisites to "Turn `#[derive]` into a regular macro attribute")
 - #79193 (Revert #78969 "Normalize function type during validation")
 - #79194 (Make as{_mut,}_slice on array::IntoIter public)
 - #79204 (Add jyn514 email alias to mailmap)
 - #79212 (Move `rustc_ty` -> `rustc_ty_utils`)
 - #79217 (Add the "memcpy" doc alias to slice::copy_from_slice)

Failed merges:

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

3 years agoNever inline naked functions
Tomasz MiÄ…sko [Fri, 20 Nov 2020 00:00:00 +0000 (00:00 +0000)]
Never inline naked functions

The `#[naked]` attribute disabled prologue / epilogue emission for the
function and it is responsibility of a developer to provide them. The
compiler is no position to inline such functions correctly.

Disable inlining of naked functions at LLVM and MIR level.

3 years agounix/weak: pass arguments to syscall at the given type
Ralf Jung [Thu, 19 Nov 2020 09:09:40 +0000 (10:09 +0100)]
unix/weak: pass arguments to syscall at the given type

3 years agoRollup merge of #79217 - yoshuawuyts:copy_from_slice-alias, r=Mark-Simulacrum
Dylan DPC [Thu, 19 Nov 2020 22:58:50 +0000 (23:58 +0100)]
Rollup merge of #79217 - yoshuawuyts:copy_from_slice-alias, r=Mark-Simulacrum

Add the "memcpy" doc alias to slice::copy_from_slice

[RFC1419](https://github.com/rust-lang/rfcs/pull/1419) describes `slice::copy_from_slice` as a "safe memcpy". This enables people searching for `memcpy` to find the `slice::copy_from_slice` method. Thanks!

## Screenshots

This is currently the output when searching for "memcpy" -- `copy_from_slice` is safe, and should be part of this list.

![Screenshot_2020-11-19 Results for memcpy - Rust](https://user-images.githubusercontent.com/2467194/99722964-c9e8fe80-2ab1-11eb-82a5-4afe703a0eea.png)

3 years agoRollup merge of #79212 - LeSeulArtichaut:rustc-ty, r=jonas-schievink
Dylan DPC [Thu, 19 Nov 2020 22:58:48 +0000 (23:58 +0100)]
Rollup merge of #79212 - LeSeulArtichaut:rustc-ty, r=jonas-schievink

Move `rustc_ty` -> `rustc_ty_utils`

Implements MCP rust-lang/compiler-team#387.
r? `@jonas-schievink`

3 years agoRollup merge of #79204 - pickfire:patch-3, r=jyn514
Dylan DPC [Thu, 19 Nov 2020 22:58:47 +0000 (23:58 +0100)]
Rollup merge of #79204 - pickfire:patch-3, r=jyn514

Add jyn514 email alias to mailmap

r? ```@jyn514```

3 years agoRollup merge of #79194 - est31:array_into_iter_slice, r=scottmcm
Dylan DPC [Thu, 19 Nov 2020 22:58:45 +0000 (23:58 +0100)]
Rollup merge of #79194 - est31:array_into_iter_slice, r=scottmcm

Make as{_mut,}_slice on array::IntoIter public

The functions are useful in cases where you want to move data out of the IntoIter in bulk, by transmute_copy'ing the slice and then forgetting the IntoIter.

In the compiler, this is useful for providing a sped up IntoIter implementation. One can alternatively provide a separate allocate_array function but one can avoid duplicating some logic by passing everything through the generic iterator using interface.

As per suggestion in https://github.com/rust-lang/rust/pull/78569/files#r526506964

3 years agoRollup merge of #79193 - tmiasko:revert-78969-normalize, r=davidtwco
Dylan DPC [Thu, 19 Nov 2020 22:58:43 +0000 (23:58 +0100)]
Rollup merge of #79193 - tmiasko:revert-78969-normalize, r=davidtwco

Revert #78969 "Normalize function type during validation"

Closes #79066.
Reopens #78442.

3 years agoRollup merge of #79185 - petrochenkov:derattr2, r=Aaron1011
Dylan DPC [Thu, 19 Nov 2020 22:58:42 +0000 (23:58 +0100)]
Rollup merge of #79185 - petrochenkov:derattr2, r=Aaron1011

expand/resolve: Pre-requisites to "Turn `#[derive]` into a regular macro attribute"

Miscellaneous refactorings and error reporting changes extracted from https://github.com/rust-lang/rust/pull/79078.

Unlike https://github.com/rust-lang/rust/pull/79078 this PR doesn't make any observable changes to the language or library.
r? ```@Aaron1011```

3 years agoRollup merge of #79183 - cuviper:compiletest-test-sysroot, r=Mark-Simulacrum
Dylan DPC [Thu, 19 Nov 2020 22:58:40 +0000 (23:58 +0100)]
Rollup merge of #79183 - cuviper:compiletest-test-sysroot, r=Mark-Simulacrum

Make compiletest testing use the local sysroot

We already set `compiletest` to use the local sysroot in #68019, but
that missed the configuration for testing `compiletest` itself.

3 years agoRollup merge of #79181 - aDotInTheVoid:provided-method-source-link, r=jyn514,Guillaum...
Dylan DPC [Thu, 19 Nov 2020 22:58:39 +0000 (23:58 +0100)]
Rollup merge of #79181 - aDotInTheVoid:provided-method-source-link, r=jyn514,GuillaumeGomez

rustdoc: add [src] links to methods on a trait's page

Closes #45150

![image](https://user-images.githubusercontent.com/28781354/99565541-aba4d500-29c3-11eb-99c7-11c1f91584e9.png)

### Caveats

- The way I've implemented it, links are also provided for required methods, that just link to the signature in the code. I'm not sure if this is the desired behaviour.

![image](https://user-images.githubusercontent.com/28781354/99566222-849ad300-29c4-11eb-9897-08cc5842954f.png)

- I'm not sure if the css changes are correct. I inspected them visualy on firefox on desktop, and they seem to be fine.
- I can't tell how `src/librustdoc/html/render/mod.rs` is structured, so I probably

3 years agoRollup merge of #79177 - fanzier:drop-order-test, r=RalfJung
Dylan DPC [Thu, 19 Nov 2020 22:58:37 +0000 (23:58 +0100)]
Rollup merge of #79177 - fanzier:drop-order-test, r=RalfJung

Test drop order for (destructuring) assignments

Add a test that checks whether the drop order of `let` bindings is consistent with the drop order of the corresponding destructuring assignments.

Thanks to ```@RalfJung``` for the suggesting this test ([here](https://github.com/rust-lang/rust/pull/79016#issuecomment-727608732)) and an implementation!

r? ```@RalfJung```

3 years agoRollup merge of #79123 - CDirkx:128-bits, r=Mark-Simulacrum
Dylan DPC [Thu, 19 Nov 2020 22:58:35 +0000 (23:58 +0100)]
Rollup merge of #79123 - CDirkx:128-bits, r=Mark-Simulacrum

Add u128 and i128 integer tests

Add the missing integer tests for u128 and i128 for completeness with the other integer types.

3 years agoRollup merge of #79119 - jamesmunns:patch-1, r=Mark-Simulacrum
Dylan DPC [Thu, 19 Nov 2020 22:58:33 +0000 (23:58 +0100)]
Rollup merge of #79119 - jamesmunns:patch-1, r=Mark-Simulacrum

Clarify availability of atomic operations

This was noticed while we were updating the embedded rust book: https://github.com/rust-embedded/book/pull/273/files

These targets do natively have atomic load/stores, but do not support CAS operations.

3 years agoAuto merge of #79060 - dtolnay:symlinkarg, r=Mark-Simulacrum
bors [Thu, 19 Nov 2020 22:26:32 +0000 (22:26 +0000)]
Auto merge of #79060 - dtolnay:symlinkarg, r=Mark-Simulacrum

Disambiguate symlink argument names

The current argument naming in the following standard library functions is horribly ambiguous.

symlink: https://doc.rust-lang.org/1.47.0/std/os/unix/fs/fn.symlink.html
- std::os::windows::fs::symlink_file: https://doc.rust-lang.org/1.47.0/std/os/windows/fs/fn.symlink_file.html
- std::os::windows::fs::symlink_dir: https://doc.rust-lang.org/1.47.0/std/os/windows/fs/fn.symlink_dir.html

**Notice that Swift uses one of the same names we do (`dst`) to refer to the opposite thing.**

<br>

| | the&nbsp;one&nbsp;that&nbsp;exists | the&nbsp;one&nbsp;that&nbsp;is<br>being&nbsp;created | reference |
| --- | --- | --- | --- |
| Rust | `src` | `dst` | |
| Swift | `withDestinationPath`<br>`destPath` | `atPath`<br>`path` | <sub>https://developer.apple.com/documentation/foundation/filemanager/1411007-createsymboliclink</sub> |
| D | `original` | `link` | <sub>https://dlang.org/library/std/file/symlink.html</sub> |
| Go | `oldname` | `newname` | <sub>https://golang.org/pkg/os/#Symlink</sub> |
| C++| `target` | `link` | <sub>https://en.cppreference.com/w/cpp/filesystem/create_symlink</sub> |
| POSIX | `path1` | `path2` | <sub>https://pubs.opengroup.org/onlinepubs/9699919799/functions/symlink.html</sub> |
| Linux | `target` | `linkpath` | <sub>https://man7.org/linux/man-pages/man2/symlink.2.html</sub> |

Out of these I happen to like D's argument names and am proposing that we adopt them.

3 years agoMove `rustc_ty` -> `rustc_ty_utils`
LeSeulArtichaut [Thu, 19 Nov 2020 20:32:37 +0000 (21:32 +0100)]
Move `rustc_ty` -> `rustc_ty_utils`

3 years agoAdd the "memcpy" doc alias to slice::copy_from_slice
Yoshua Wuyts [Thu, 19 Nov 2020 20:52:08 +0000 (21:52 +0100)]
Add the "memcpy" doc alias to slice::copy_from_slice

3 years agoClippy: Match on assert!() expansions without an inner block.
Mara Bos [Thu, 19 Nov 2020 18:47:25 +0000 (19:47 +0100)]
Clippy: Match on assert!() expansions without an inner block.

3 years agoRemove the clippy::panic-params lint.
Mara Bos [Thu, 19 Nov 2020 17:13:32 +0000 (18:13 +0100)]
Remove the clippy::panic-params lint.

Rustc itself now warns for all cases that triggered this lint.

3 years agoAuto merge of #79200 - Dylan-DPC:rollup-su689pq, r=Dylan-DPC
bors [Thu, 19 Nov 2020 17:27:24 +0000 (17:27 +0000)]
Auto merge of #79200 - Dylan-DPC:rollup-su689pq, r=Dylan-DPC

Rollup of 14 pull requests

Successful merges:

 - #78961 (Make bad "rust-call" arguments no longer ICE)
 - #79082 (Improve the diagnostic for when an `fn` contains qualifiers inside an `extern` block.)
 - #79090 (libary: Forward compiler-builtins "asm"  and "mangled-names" feature)
 - #79094 (Add //ignore-macos to pretty-std-collections.rs)
 - #79101 (Don't special case constant operands when lowering intrinsics)
 - #79102 (Add two regression tests)
 - #79110 (Remove redundant notes in E0275)
 - #79116 (compiletest: Fix a warning in debuginfo tests on windows-gnu)
 - #79117 (add optimization fuel checks to some mir passes)
 - #79147 (Highlight MIR as Rust on GitHub)
 - #79149 (Move capture lowering from THIR to MIR)
 - #79155 (fix handling the default config for profiler and sanitizers)
 - #79156 (Allow using `download-ci-llvm` from directories other than the root)
 - #79164 (Permit standalone generic parameters as const generic arguments in macros)

Failed merges:

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

3 years agoExtend meta parameters to all generated code in compat_fn.
Josh Matthews [Thu, 19 Nov 2020 16:43:50 +0000 (11:43 -0500)]
Extend meta parameters to all generated code in compat_fn.

3 years agoexpand: Mark some dead code in derive expansion as unreachable
Vadim Petrochenkov [Wed, 18 Nov 2020 22:55:59 +0000 (01:55 +0300)]
expand: Mark some dead code in derive expansion as unreachable

3 years agoexpand: Stop derive expansion un unexpected targets early
Vadim Petrochenkov [Wed, 18 Nov 2020 22:54:19 +0000 (01:54 +0300)]
expand: Stop derive expansion un unexpected targets early

Collect derive placeholders using `collect` instead of `push`

3 years agoexpand: Cleanup attribute collection in invocation collector
Vadim Petrochenkov [Wed, 18 Nov 2020 22:51:52 +0000 (01:51 +0300)]
expand: Cleanup attribute collection in invocation collector

3 years agoresolve/expand: Misc cleanup
Vadim Petrochenkov [Wed, 18 Nov 2020 22:50:16 +0000 (01:50 +0300)]
resolve/expand: Misc cleanup

3 years agoresolve: Centralize some error reporting for unexpected macro resolutions
Vadim Petrochenkov [Wed, 18 Nov 2020 22:49:20 +0000 (01:49 +0300)]
resolve: Centralize some error reporting for unexpected macro resolutions

3 years agoresolve: Introduce a separate `NonMacroAttrKind` for legacy derive helpers
Vadim Petrochenkov [Wed, 18 Nov 2020 22:45:10 +0000 (01:45 +0300)]
resolve: Introduce a separate `NonMacroAttrKind` for legacy derive helpers

3 years agoexpand: Move `fully_configure` to `config.rs`
Vadim Petrochenkov [Wed, 18 Nov 2020 22:43:23 +0000 (01:43 +0300)]
expand: Move `fully_configure` to `config.rs`

3 years agoexpand: Tell built-in macros whether we are currently in forced expansion mode
Vadim Petrochenkov [Sat, 14 Nov 2020 11:47:14 +0000 (14:47 +0300)]
expand: Tell built-in macros whether we are currently in forced expansion mode

3 years agoAdd jyn514 email alias to mailmap
Ivan Tham [Thu, 19 Nov 2020 16:22:04 +0000 (00:22 +0800)]
Add jyn514 email alias to mailmap

3 years agoRollup merge of #79164 - varkor:unbraced-single-segment-const-arguments, r=petrochenkov
Dylan DPC [Thu, 19 Nov 2020 15:26:44 +0000 (16:26 +0100)]
Rollup merge of #79164 - varkor:unbraced-single-segment-const-arguments, r=petrochenkov

Permit standalone generic parameters as const generic arguments in macros

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

r? ```@petrochenkov```

3 years agoRollup merge of #79156 - jyn514:relative-llvm, r=Mark-Simulacrum
Dylan DPC [Thu, 19 Nov 2020 15:26:42 +0000 (16:26 +0100)]
Rollup merge of #79156 - jyn514:relative-llvm, r=Mark-Simulacrum

Allow using `download-ci-llvm` from directories other than the root

Previously, bootstrap.py would attempt to find the LLVM commit from
`src/llvm-project`. However, it assumed it was always being run from the
top-level directory, which isn't always the case.

Before:

```
downloading https://ci-artifacts.rust-lang.org/rustc-builds//rust-dev-nightly-x86_64-unknown-linux-gnu.tar.gz

curl: (22) The requested URL returned error: 404
failed to run: curl -# -y 30 -Y 10 --connect-timeout 30 --retry 3 -Sf -o /tmp/tmppyh4w8 https://ci-artifacts.rust-lang.org/rustc-builds//rust-dev-nightly-x86_64-unknown-linux-gnu.tar.gz
Build completed unsuccessfully in 0:00:02
```

After:

```
downloading https://ci-artifacts.rust-lang.org/rustc-builds/430feb24a46993e5073c1bb1b39da190d83fa2bf/rust-dev-nightly-x86_64-unknown-linux-gnu.tar.gz
 ###################################################################################################################################################################### 100.0%
extracting /home/joshua/rustc/src/bootstrap/build/cache/llvm-430feb24a46993e5073c1bb1b39da190d83fa2bf-False/rust-dev-nightly-x86_64-unknown-linux-gnu.tar.gz
```

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

3 years agoRollup merge of #79155 - 12101111:fix-profiler-config, r=Mark-Simulacrum
Dylan DPC [Thu, 19 Nov 2020 15:26:40 +0000 (16:26 +0100)]
Rollup merge of #79155 - 12101111:fix-profiler-config, r=Mark-Simulacrum

fix handling the default config for profiler and sanitizers

#78354 don't handle the case that user don't add any target-specific config in `[target.*]` of `config.toml`:
```toml
changelog-seen = 2
[llvm]
link-shared = true
[build]
sanitizers = true
profiler = true
[install]
[rust]
[dist]
```

The previes code handle the default config in `Config::prase()`:

```rust
target.sanitizers = cfg.sanitizers.unwrap_or(build.sanitizers.unwrap_or_default());
target.profiler = cfg.profiler.unwrap_or(build.profiler.unwrap_or_default());
config.target_config.insert(TargetSelection::from_user(&triple), target);
```

In this case, `toml.target` don't contain any target, so the above code won't execute. Instead, a default `Target` is insert in https://github.com/rust-lang/rust/blob/c919f490bbcd2b29b74016101f7ec71aaa24bdbb/src/bootstrap/sanity.rs#L162-L166

The default value for `bool` is false, hence the issue in #79124

This fix change the type of `sanitizers` and `profiler` to `Option<bool>`, so the default value is `None`, and fallback config is handled in  `Config::sanitizers_enabled` and `Config::profiler_enabled`

fix #79124

cc `@Mark-Simulacrum` `@richkadel`

3 years agoRollup merge of #79149 - sexxi-goose:upvar_ref, r=nikomatsakis
Dylan DPC [Thu, 19 Nov 2020 15:26:39 +0000 (16:26 +0100)]
Rollup merge of #79149 - sexxi-goose:upvar_ref, r=nikomatsakis

Move capture lowering from THIR to MIR

This allows us to:
- Handle precise Places captured by a closure directly in MIR. Handling
  captures in MIR is easier since we can rely on/ tweak PlaceBuilder to
  generate `mir::Place`s that resemble how we store captures (`hir::Place`).

- Handle `let _ = x` case when feature `capture_disjoint_fields`
  is enabled directly in MIR. This is required to be done in MIR since
  patterns are desugared in MIR.

Closes: rust-lang/project-rfc-2229#25
r? ```@nikomatsakis```

3 years agoRollup merge of #79147 - camelid:mir-gitattributes, r=oli-obk
Dylan DPC [Thu, 19 Nov 2020 15:26:37 +0000 (16:26 +0100)]
Rollup merge of #79147 - camelid:mir-gitattributes, r=oli-obk

Highlight MIR as Rust on GitHub

3 years agoRollup merge of #79117 - cjkenn:mir-fuel, r=oli-obk
Dylan DPC [Thu, 19 Nov 2020 15:26:35 +0000 (16:26 +0100)]
Rollup merge of #79117 - cjkenn:mir-fuel, r=oli-obk

add optimization fuel checks to some mir passes

Fixes #77402

Inserts a bunch of calls to `consider_optimizing`. Note that `consider_optimizing` is the method that actually decrements the fuel count, so the point at which it's called is when the optimization takes place, from a fuel perspective. This means that where we call it has some thought behind it:

1. We probably don't want to decrement the fuel count before other simple checks, otherwise we count an optimization as being performed even if nothing was mutated (ie. it returned early).
2. In cases like `InstCombine`, where we gather optimizations in a pass and then mutate values, we probably would rather skip the gathering pass for performance reasons rather than skip the mutations afterwards.

3 years agoRollup merge of #79116 - petrochenkov:gdbwarn, r=Mark-Simulacrum
Dylan DPC [Thu, 19 Nov 2020 15:26:33 +0000 (16:26 +0100)]
Rollup merge of #79116 - petrochenkov:gdbwarn, r=Mark-Simulacrum

compiletest: Fix a warning in debuginfo tests on windows-gnu

The warning looked like this for me:
```
Warning: C:msys64homewerust./src/etc: No such file or directory.
```
It didn't affect actual testing because we don't currently emit gdb pretty-printer information into executables on windows-gnu.

3 years agoRollup merge of #79110 - estebank:issue-58964, r=oli-obk
Dylan DPC [Thu, 19 Nov 2020 15:26:31 +0000 (16:26 +0100)]
Rollup merge of #79110 - estebank:issue-58964, r=oli-obk

Remove redundant notes in E0275

Fix #58964.