Commit graph

133675 commits

Author SHA1 Message Date
bors
432d116a5c 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.
2020-11-20 23:21:34 +00:00
Dániel Buga
e93a4637c0 Use specialization to avoid copying 2020-11-20 21:02:09 +01:00
Alex Crichton
f99410bb4b 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.
2020-11-20 11:56:07 -08:00
Jacob Kiesel
fb6ceac46b We missed 1.49.0, so bump version to 1.50.0 2020-11-20 10:37:22 -07:00
Eduard-Mihai Burtescu
5ed2d42334 Direct RUSTC_LOG (tracing/log) output to stderr instead of stdout. 2020-11-20 19:34:44 +02:00
Vadim Petrochenkov
993bb072ff rustc_expand: Mark inner #![test] attributes as soft-unstable 2020-11-20 19:35:03 +03:00
bors
593fe977a7 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`
2020-11-20 16:12:35 +00:00
Ngo Iok Ui
459c83f980
Exhaustively match in variant count instrinsic 2020-11-20 21:49:49 +08:00
bors
c9c57fadc4 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 7e2032390c for UWP targets.
2020-11-20 13:42:44 +00:00
Sebastian Dröge
7a3b331587 Add "memset" as doc alias to slice::fill() 2020-11-20 15:19:47 +02:00
Yoshua Wuyts
a64d0d4774 Add core::slice::fill_with 2020-11-20 14:12:54 +01:00
Daiki Ihara
f02296a6ed Remove FIXME comment from incremental 2020-11-20 21:33:48 +09:00
bors
ae6aa22cf2 Auto merge of #78646 - tgnottingham:packed_fingerprints, r=nnethercote
Use PackedFingerprint in DepNode to reduce memory consumption
2020-11-20 11:11:19 +00:00
Ralf Jung
a7677f7714 reference NonNull::dangling 2020-11-20 11:09:49 +01:00
Tyson Nottingham
142932ab19 Set unaligned_references lint to deny in rustc_data_structures
To detect misuse of private packed field in `PackedFingerprint`.
2020-11-20 01:13:15 -08:00
bors
172acf8f61 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`
2020-11-20 08:46:42 +00:00
bors
5c45969502 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.
2020-11-20 06:01:49 +00:00
bors
74285eb3a8 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.
2020-11-20 03:40:20 +00:00
bors
4ec27e4b79 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
2020-11-20 00:51:54 +00:00
Jake Goulding
dcef5ff372 Bump bootstrap compiler version 2020-11-19 19:23:36 -05:00
Tomasz Miąsko
c2fb99984c 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.
2020-11-20 00:00:00 +00:00
Ralf Jung
d8d763da86 unix/weak: pass arguments to syscall at the given type 2020-11-20 00:23:05 +01:00
Dylan DPC
5adc00fbb8
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)
2020-11-19 23:58:50 +01:00
Dylan DPC
95da425593
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`
2020-11-19 23:58:48 +01:00
Dylan DPC
39495cb342
Rollup merge of #79204 - pickfire:patch-3, r=jyn514
Add jyn514 email alias to mailmap

r? ```@jyn514```
2020-11-19 23:58:47 +01:00
Dylan DPC
169e2212d9
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
2020-11-19 23:58:45 +01:00
Dylan DPC
084fc293eb
Rollup merge of #79193 - tmiasko:revert-78969-normalize, r=davidtwco
Revert #78969 "Normalize function type during validation"

Closes #79066.
Reopens #78442.
2020-11-19 23:58:43 +01:00
Dylan DPC
8216b359e5
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```
2020-11-19 23:58:42 +01:00
Dylan DPC
d5ee4edee1
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.
2020-11-19 23:58:40 +01:00
Dylan DPC
192ed76cb9
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
2020-11-19 23:58:39 +01:00
Dylan DPC
acc2e23901
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```
2020-11-19 23:58:37 +01:00
Dylan DPC
c2a277c11d
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.
2020-11-19 23:58:35 +01:00
Dylan DPC
138e96d222
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.
2020-11-19 23:58:33 +01:00
bors
09c9c9f7da 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.

- std::os::unix::fs::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.
2020-11-19 22:26:32 +00:00
LeSeulArtichaut
f59d03038c Move rustc_ty -> rustc_ty_utils 2020-11-19 21:57:29 +01:00
Yoshua Wuyts
53f969dfd1 Add the "memcpy" doc alias to slice::copy_from_slice 2020-11-19 21:52:08 +01:00
Nadrieril
82bf5b61cd Regroup many usefulness-related test in the same folder 2020-11-19 19:52:54 +00:00
Mara Bos
a125ef2e8e Clippy: Match on assert!() expansions without an inner block. 2020-11-19 19:47:25 +01:00
Mara Bos
454eaec1dc Remove the clippy::panic-params lint.
Rustc itself now warns for all cases that triggered this lint.
2020-11-19 18:34:40 +01:00
bors
fe982319aa 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
2020-11-19 17:27:24 +00:00
Josh Matthews
24bbca4917
Extend meta parameters to all generated code in compat_fn. 2020-11-19 11:43:50 -05:00
Vadim Petrochenkov
d575aa4d58 expand: Mark some dead code in derive expansion as unreachable 2020-11-19 19:25:20 +03:00
Vadim Petrochenkov
cd2177f3de expand: Stop derive expansion un unexpected targets early
Collect derive placeholders using `collect` instead of `push`
2020-11-19 19:25:20 +03:00
Vadim Petrochenkov
ec547202b4 expand: Cleanup attribute collection in invocation collector 2020-11-19 19:25:20 +03:00
Vadim Petrochenkov
dfb690eaa9 resolve/expand: Misc cleanup 2020-11-19 19:25:20 +03:00
Vadim Petrochenkov
68f94e94ed resolve: Centralize some error reporting for unexpected macro resolutions 2020-11-19 19:25:20 +03:00
Vadim Petrochenkov
69894ce9ac resolve: Introduce a separate NonMacroAttrKind for legacy derive helpers 2020-11-19 19:25:20 +03:00
Vadim Petrochenkov
e7ee4d66ce expand: Move fully_configure to config.rs 2020-11-19 19:25:20 +03:00
Vadim Petrochenkov
b49fbc9432 expand: Tell built-in macros whether we are currently in forced expansion mode 2020-11-19 19:25:20 +03:00
Ivan Tham
54588c8434
Add jyn514 email alias to mailmap 2020-11-20 00:22:04 +08:00