]> git.lizzy.rs Git - rust.git/log
rust.git
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 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 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 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 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 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 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 `core::slice::fill_with`
Yoshua Wuyts [Fri, 20 Nov 2020 00:42:43 +0000 (01:42 +0100)]
Add `core::slice::fill_with`

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 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.

3 years agoRollup merge of #79102 - Alexendoo:ice-regression-tests, r=Mark-Simulacrum
Dylan DPC [Thu, 19 Nov 2020 15:26:29 +0000 (16:26 +0100)]
Rollup merge of #79102 - Alexendoo:ice-regression-tests, r=Mark-Simulacrum

Add two regression tests

For #78721 and #78722

3 years agoRollup merge of #79101 - tmiasko:lower-func-type, r=jonas-schievink
Dylan DPC [Thu, 19 Nov 2020 15:26:27 +0000 (16:26 +0100)]
Rollup merge of #79101 - tmiasko:lower-func-type, r=jonas-schievink

Don't special case constant operands when lowering intrinsics

3 years agoRollup merge of #79094 - est31:ignore_macos, r=pietroalbini
Dylan DPC [Thu, 19 Nov 2020 15:26:26 +0000 (16:26 +0100)]
Rollup merge of #79094 - est31:ignore_macos, r=pietroalbini

Add //ignore-macos to pretty-std-collections.rs

On macOS the test is flaky and sometimes fails,
sometimes succeeds on CI.

This is no fix for the underlying issue,
but I feel the workaround is worth it as
the issue makes it harder
to get things merged into master.

cc #78665

3 years agoRollup merge of #79090 - hermitcore:builtins, r=Mark-Simulacrum
Dylan DPC [Thu, 19 Nov 2020 15:26:23 +0000 (16:26 +0100)]
Rollup merge of #79090 - hermitcore:builtins, r=Mark-Simulacrum

libary: Forward compiler-builtins "asm"  and "mangled-names" feature

In principle this is a followup of rust-lang/rust#78472. In the previous PR was the support of the test crate missing.

Now users will be able to do:
```
cargo build -Zbuild-std=core -Zbuild-std-features=compiler-builtins-asm
```
and correctly get the assembly implemenations for `memcpy` and friends.

3 years agoRollup merge of #79082 - ThePuzzlemaker:issue-78941-fix, r=estebank
Dylan DPC [Thu, 19 Nov 2020 15:26:21 +0000 (16:26 +0100)]
Rollup merge of #79082 - ThePuzzlemaker:issue-78941-fix, r=estebank

Improve the diagnostic for when an `fn` contains qualifiers inside an `extern` block.

This mitigates #78941. As suggested by ```@estebank,``` `span_suggestion` was replaced with `span_suggestion_verbose` for this specific diagnostic.

3 years agoRollup merge of #78961 - CraftSpider:22565, r=oli-obk
Dylan DPC [Thu, 19 Nov 2020 15:26:19 +0000 (16:26 +0100)]
Rollup merge of #78961 - CraftSpider:22565, r=oli-obk

Make bad "rust-call" arguments no longer ICE

The simplest of bad rust-call definitions will no longer cause an ICE. There is a FIXME added for future work, as I wanted to get this easy fix in before trying to either add a hack or mess with the whole obligation system

fixes #22565

3 years agoAuto merge of #79198 - RalfJung:miri, r=RalfJung
bors [Thu, 19 Nov 2020 14:57:39 +0000 (14:57 +0000)]
Auto merge of #79198 - RalfJung:miri, r=RalfJung

update Miri

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

3 years agoupdate print fuel test output again...
cjkenn [Thu, 19 Nov 2020 13:47:00 +0000 (08:47 -0500)]
update print fuel test output again...

3 years agoremove check from const promotion
cjkenn [Thu, 19 Nov 2020 13:21:20 +0000 (08:21 -0500)]
remove check from const promotion

3 years agoAuto merge of #78449 - Aaron1011:fix/libstd-semi, r=dtolnay
bors [Thu, 19 Nov 2020 10:52:19 +0000 (10:52 +0000)]
Auto merge of #78449 - Aaron1011:fix/libstd-semi, r=dtolnay

Remove semicolon from internal `err` macro

This macro is used in expression position (a match arm), and only
compiles because of #33953

Regardless of what happens with that issue, this makes the
usage of the macro less confusing at the call site.

3 years agoupdate Miri
Ralf Jung [Thu, 19 Nov 2020 10:25:27 +0000 (11:25 +0100)]
update Miri

3 years agoAuto merge of #79068 - DevJPM:ci-llvm-9-fix, r=pietroalbini
bors [Thu, 19 Nov 2020 08:10:15 +0000 (08:10 +0000)]
Auto merge of #79068 - DevJPM:ci-llvm-9-fix, r=pietroalbini

Remove Hacks and Fixmes from PR CI's LLVM-9 Container

Now with LLVM 9 being the minimum supported version (thanks to #78848 ), we can
finally remove the hacks in the dockerfile.

This wasn't in the main PR bumping the version as I didn't quite
understand what's going on and needed here.

Relevant issues and PRs:

- Issue #69823
- PR #70989

I hope I actually adressed things correctly here?

3 years agoMake as{_mut,}_slice on array::IntoIter public
est31 [Thu, 19 Nov 2020 07:28:49 +0000 (08:28 +0100)]
Make as{_mut,}_slice on array::IntoIter public

3 years agoAuto merge of #79002 - est31:backtrace_colno, r=dtolnay
bors [Thu, 19 Nov 2020 06:00:49 +0000 (06:00 +0000)]
Auto merge of #79002 - est31:backtrace_colno, r=dtolnay

Add column number support to Backtrace

Backtrace frames might include column numbers.
Print them if they are included.

3 years agoRevert "Normalize function type during validation"
Tomasz Miąsko [Thu, 19 Nov 2020 04:36:55 +0000 (05:36 +0100)]
Revert "Normalize function type during validation"

This reverts commit d486bfcbff107e8a6769e00c59d02b13c664b6ee.

3 years agoRevert "Always use param_env_reveal_all_normalized in validator"
Tomasz Miąsko [Thu, 19 Nov 2020 04:36:51 +0000 (05:36 +0100)]
Revert "Always use param_env_reveal_all_normalized in validator"

This reverts commit 99be78d135e73197e04221c139a219ea6436e72a.

3 years agoBump stage0 rustfmt to nightly-2020-11-19
Aaron Hill [Thu, 19 Nov 2020 04:11:38 +0000 (23:11 -0500)]
Bump stage0 rustfmt to nightly-2020-11-19

This pulls in https://github.com/rust-lang/rustfmt/pull/4507,
allowing us to remove a semicolon in an internal libstd macro

3 years agoRemove semicolon from internal `err` macro
Aaron Hill [Tue, 27 Oct 2020 18:48:29 +0000 (14:48 -0400)]
Remove semicolon from internal `err` macro

This macro is used in expression position (a match arm), and only
compiles because of #33953

Regardless of what happens with that issue, this makes the
usage of the macro less confusing at the call site.

3 years agomove checks later into optimization passes
cjkenn [Thu, 19 Nov 2020 00:16:23 +0000 (19:16 -0500)]
move checks later into optimization passes

3 years agoAuto merge of #79106 - tmiasko:inline-hint, r=nagisa,eddyb
bors [Wed, 18 Nov 2020 23:44:54 +0000 (23:44 +0000)]
Auto merge of #79106 - tmiasko:inline-hint, r=nagisa,eddyb

Fix setting inline hint based on `InstanceDef::requires_inline`

For instances where `InstanceDef::requires_inline` is true, an attempt
is made to set an inline hint though a call to the `inline` function.
The attempt is ineffective, since all attributes will be usually removed
by the second call.

Fix the issue by applying the attributes only once, with user provided
attributes having a priority when provided.

Closes #79108.

3 years agoMake PackedFingerprint's Fingerprint private
Tyson Nottingham [Wed, 18 Nov 2020 23:10:43 +0000 (15:10 -0800)]
Make PackedFingerprint's Fingerprint private

3 years agoMake compiletest testing use the local sysroot
Josh Stone [Wed, 18 Nov 2020 22:41:27 +0000 (14:41 -0800)]
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 agoadd [src] links to methods on a trait's page
Nixon Enraght-Moony [Wed, 18 Nov 2020 13:38:17 +0000 (13:38 +0000)]
add [src] links to methods on a trait's page

3 years agoAuto merge of #78995 - Nadrieril:clean-empty-match, r=varkor
bors [Wed, 18 Nov 2020 21:24:40 +0000 (21:24 +0000)]
Auto merge of #78995 - Nadrieril:clean-empty-match, r=varkor

Handle empty matches cleanly in exhaustiveness checking

This removes the special-casing of empty matches that was done in `check_match`. This fixes most of https://github.com/rust-lang/rust/issues/55123.
Somewhat unrelatedly, I also made `_match.rs` more self-contained, because I think it's cleaner.

r? `@varkor`
`@rustbot` modify labels: +A-exhaustiveness-checking

3 years agoUse PackedFingerprint in DepNode to reduce memory consumption
Tyson Nottingham [Wed, 4 Nov 2020 06:23:08 +0000 (22:23 -0800)]
Use PackedFingerprint in DepNode to reduce memory consumption

3 years agoTest drop order for (destructuring) assignments
Fabian Zaiser [Wed, 18 Nov 2020 20:39:17 +0000 (20:39 +0000)]
Test drop order for (destructuring) assignments

3 years agoAuto merge of #79167 - m-ou-se:rollup-4g15apk, r=m-ou-se
bors [Wed, 18 Nov 2020 18:16:31 +0000 (18:16 +0000)]
Auto merge of #79167 - m-ou-se:rollup-4g15apk, r=m-ou-se

Rollup of 11 pull requests

Successful merges:

 - #78361 (Updated the list of white-listed target features for x86)
 - #78785 (linux: try to use libc getrandom to allow interposition)
 - #78999 (stability: More precise location for deprecation lint on macros)
 - #79039 (Tighten the bounds on atomic Ordering in std::sys::unix::weak::Weak)
 - #79079 (Turn top-level comments into module docs in MIR visitor)
 - #79114 (add trailing_zeros and leading_zeros to non zero types)
 - #79131 (Enable AVX512 *epi64 variants by updating stdarch)
 - #79133 (bootstrap: use the same version number for rustc and cargo)
 - #79145 (Fix handling of panic calls)
 - #79151 (Fix typo in `std::io::Write` docs)
 - #79158 (type is too big -> values of the type are too big)

Failed merges:

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

3 years agoreview comment
Esteban Küber [Wed, 18 Nov 2020 17:03:51 +0000 (09:03 -0800)]
review comment

3 years agoAccount for indirect cyclic requirements
Esteban Küber [Wed, 18 Nov 2020 16:33:27 +0000 (08:33 -0800)]
Account for indirect cyclic requirements

3 years agoRemove redundant notes in E0275
Esteban Küber [Mon, 16 Nov 2020 19:16:30 +0000 (11:16 -0800)]
Remove redundant notes in E0275

Fix #58964.

3 years agochange print-fuel ui test to check-pass
cjkenn [Wed, 18 Nov 2020 16:27:37 +0000 (11:27 -0500)]
change print-fuel ui test to check-pass

3 years agoRollup merge of #79158 - lcnr:lazy-norm-coerce, r=oli-obk
Mara Bos [Wed, 18 Nov 2020 14:46:40 +0000 (15:46 +0100)]
Rollup merge of #79158 - lcnr:lazy-norm-coerce, r=oli-obk

type is too big -> values of the type are too big

strictly speaking, `[u8; usize::MAX]` or even `[[[u128; usize::MAX]; usize::MAX]; usize::MAX]` are absolutely fine types as long as you don't try to deal with any values of it.

This error message seems to cause some confusion imo, for example in https://github.com/rust-lang/rust/pull/79135#issuecomment-729361380 so I would prefer us to be more precise here.

See the added test case which uses one of these types without causing an error.

r? ``@oli-obk``

3 years agoRollup merge of #79151 - wchargin:wchargin-io-write-docs, r=jyn514
Mara Bos [Wed, 18 Nov 2020 14:46:38 +0000 (15:46 +0100)]
Rollup merge of #79151 - wchargin:wchargin-io-write-docs, r=jyn514

Fix typo in `std::io::Write` docs

These referred to a “`Write`er”—extra *e*. Presumably a copy-paste
holdover from “`Read`er”.

Test Plan:
Running ``git grep '`\?[Ww]rite`\?er'`` no longer finds any results.

wchargin-branch: io-write-docs

3 years agoRollup merge of #79145 - camelid:clippy-fix-panics, r=flip1995
Mara Bos [Wed, 18 Nov 2020 14:46:36 +0000 (15:46 +0100)]
Rollup merge of #79145 - camelid:clippy-fix-panics, r=flip1995

Fix handling of panic calls

This should make Clippy more resilient and will unblock #78343.

This PR is made against rust-lang/rust to avoid the need for a subtree
sync at ``@flip1995's`` suggestion in rust-lang/rust-clippy#6310.

r? ``@flip1995``
cc ``@m-ou-se``

3 years agoRollup merge of #79133 - pietroalbini:simplify-stage0, r=Mark-Simulacrum
Mara Bos [Wed, 18 Nov 2020 14:46:34 +0000 (15:46 +0100)]
Rollup merge of #79133 - pietroalbini:simplify-stage0, r=Mark-Simulacrum

bootstrap: use the same version number for rustc and cargo

Historically the stable tarballs were named after the version number ofthe specific tool, instead of the version number of Rust. For example, both of the following tarballs were part of the same release:

    rustc-1.48.0-x86_64-unknown-linux-gnu.tar.xz
    cargo-0.49.0-x86_64-unknown-linux-gnu.tar.xz

PR #77336 changed the dist code to instead use Rust's version number for all the tarballs, regardless of the tool they contain:

    rustc-1.48.0-x86_64-unknown-linux-gnu.tar.xz
    cargo-1.48.0-x86_64-unknown-linux-gnu.tar.xz

Because of that there is no need anymore to have a separate `cargo` field in `src/stage0.txt`, as the Cargo version will always be the same as the rustc version. This PR removes the field, simplifying the code and the maintenance work required while producing releases.

r? ``@Mark-Simulacrum``

3 years agoRollup merge of #79131 - vertexclique:stdarch-update, r=Amanieu
Mara Bos [Wed, 18 Nov 2020 14:46:32 +0000 (15:46 +0100)]
Rollup merge of #79131 - vertexclique:stdarch-update, r=Amanieu

Enable AVX512 *epi64 variants by updating stdarch

3 years agoRollup merge of #79114 - andjo403:nonzero_leading_trailing_zeros, r=m-ou-se
Mara Bos [Wed, 18 Nov 2020 14:46:31 +0000 (15:46 +0100)]
Rollup merge of #79114 - andjo403:nonzero_leading_trailing_zeros, r=m-ou-se

add trailing_zeros and leading_zeros to non zero types

as a way towards being able to use the optimized intrinsics ctlz_nonzero and cttz_nonzero from stable.

have not crated any tracking issue if this is not a solution that is wanted

3 years agoRollup merge of #79079 - camelid:mir-visit-docs, r=matthewjasper
Mara Bos [Wed, 18 Nov 2020 14:46:29 +0000 (15:46 +0100)]
Rollup merge of #79079 - camelid:mir-visit-docs, r=matthewjasper

Turn top-level comments into module docs in MIR visitor

3 years agoRollup merge of #79039 - thomcc:weakly-relaxing, r=Amanieu
Mara Bos [Wed, 18 Nov 2020 14:46:27 +0000 (15:46 +0100)]
Rollup merge of #79039 - thomcc:weakly-relaxing, r=Amanieu

Tighten the bounds on atomic Ordering in std::sys::unix::weak::Weak

This moves reading this from multiple SeqCst reads to Relaxed read + Acquire fence if we are actually going to use the data.

Would love to avoid the Acquire fence, but doing so would need Ordering::Consume, which neither Rust, nor LLVM supports (a shame, since this fence is hardly free on ARM, which is what I was hoping to improve).

r? ``@Amanieu`` (Sorry for always picking you, but I know a lot of people wouldn't feel comfortable reviewing atomic ordering changes)

3 years agoRollup merge of #78999 - petrochenkov:deprid, r=eddyb
Mara Bos [Wed, 18 Nov 2020 14:46:25 +0000 (15:46 +0100)]
Rollup merge of #78999 - petrochenkov:deprid, r=eddyb

stability: More precise location for deprecation lint on macros

One missing piece of https://github.com/rust-lang/rust/pull/73178.

3 years agoRollup merge of #78785 - cuviper:weak-getrandom, r=m-ou-se
Mara Bos [Wed, 18 Nov 2020 14:46:23 +0000 (15:46 +0100)]
Rollup merge of #78785 - cuviper:weak-getrandom, r=m-ou-se

linux: try to use libc getrandom to allow interposition

We'll try to use a weak `getrandom` symbol first, because that allows
things like `LD_PRELOAD` interposition. For example, perf measurements
might want to disable randomness to get reproducible results. If the
weak symbol is not found, we fall back to a raw `SYS_getrandom` call.

3 years agoRollup merge of #78361 - DevJPM:master, r=workingjubilee
Mara Bos [Wed, 18 Nov 2020 14:46:19 +0000 (15:46 +0100)]
Rollup merge of #78361 - DevJPM:master, r=workingjubilee

Updated the list of white-listed target features for x86

This PR both adds in-source documentation on what to look out for when adding a new (X86) feature set and [adds all that are detectable at run-time in Rust stable as of 1.27.0](https://github.com/rust-lang/stdarch/blob/master/crates/std_detect/src/detect/arch/x86.rs).

This should only enable the use of the corresponding LLVM intrinsics.
Actual intrinsics need to be added separately in rust-lang/stdarch.

It also re-orders the run-time-detect test statements to be more consistent
with the actual list of intrinsics whitelisted and removes underscores not present
in the actual names (which might be mistaken as being part of the name)

The reference for LLVM's feature names used is [this file](https://github.com/llvm/llvm-project/blob/master/llvm/include/llvm/Support/X86TargetParser.def).

This PR was motivated as the compiler end's part for allowing #67329 to be adressed over on rust-lang/stdarch

3 years agomove fuel checks to later points in instcombine and const_prop, add opt level flag...
cjkenn [Wed, 18 Nov 2020 13:49:46 +0000 (08:49 -0500)]
move fuel checks to later points in instcombine and const_prop, add opt level flag to test

3 years agoAdd tests for multi-segment paths in const generic arguments
varkor [Wed, 18 Nov 2020 12:55:35 +0000 (12:55 +0000)]
Add tests for multi-segment paths in const generic arguments