Commit Graph

133709 Commits

Author SHA1 Message Date
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
Dylan DPC
b5fffdc12b
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```
2020-11-19 16:26:44 +01:00
Dylan DPC
de62272548
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```
2020-11-19 16:26:42 +01:00
Dylan DPC
3b857a5a3a
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 c919f490bb/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`
2020-11-19 16:26:40 +01:00
Dylan DPC
5c7d530b5e
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```
2020-11-19 16:26:39 +01:00
Dylan DPC
62838c6b39
Rollup merge of #79147 - camelid:mir-gitattributes, r=oli-obk
Highlight MIR as Rust on GitHub
2020-11-19 16:26:37 +01:00
Dylan DPC
2fdcd245df
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.
2020-11-19 16:26:35 +01:00
Dylan DPC
04a4404016
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.
2020-11-19 16:26:33 +01:00
Dylan DPC
470f768c97
Rollup merge of #79110 - estebank:issue-58964, r=oli-obk
Remove redundant notes in E0275

Fix #58964.
2020-11-19 16:26:31 +01:00
Dylan DPC
6010f7b7e9
Rollup merge of #79102 - Alexendoo:ice-regression-tests, r=Mark-Simulacrum
Add two regression tests

For #78721 and #78722
2020-11-19 16:26:29 +01:00
Dylan DPC
05ff58e645
Rollup merge of #79101 - tmiasko:lower-func-type, r=jonas-schievink
Don't special case constant operands when lowering intrinsics
2020-11-19 16:26:27 +01:00
Dylan DPC
552d8c5cb1
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
2020-11-19 16:26:26 +01:00
Dylan DPC
29c8e50a10
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.
2020-11-19 16:26:23 +01:00
Dylan DPC
3f0f224be4
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.
2020-11-19 16:26:21 +01:00
Dylan DPC
5a58b50698
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
2020-11-19 16:26:19 +01:00
bors
3d3c8c5e0d 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`
2020-11-19 14:57:39 +00:00
cjkenn
07de70250b update print fuel test output again... 2020-11-19 08:47:00 -05:00
cjkenn
1d3305aa66 remove check from const promotion 2020-11-19 08:21:20 -05:00
bors
7e2032390c 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.
2020-11-19 10:52:19 +00:00
Ralf Jung
74df1cab1f update Miri 2020-11-19 11:25:27 +01:00