Commit graph

132066 commits

Author SHA1 Message Date
Yuki Okushi 98e2a9564f
Rollup merge of #78388 - camelid:regression-tests, r=lcnr
Add some regression tests

Closes #75763.
Closes #76179.
2020-10-27 08:45:17 +09:00
Yuki Okushi b72d70ef61
Rollup merge of #78377 - LeSeulArtichaut:patch-docs, r=jonas-schievink
Fix typo in debug statement
2020-10-27 08:45:14 +09:00
Yuki Okushi 5a33fa5179
Rollup merge of #78375 - taiki-e:question-in-macros, r=kennytm
Use ? in core/std macros
2020-10-27 08:45:10 +09:00
Yuki Okushi 6abd2a59e7
Rollup merge of #78349 - JohnTitor:issue-75962, r=davidtwco
Use its own `TypeckResults` to avoid ICE

Fixes #75962
2020-10-27 08:45:07 +09:00
Yuki Okushi ae5442582d
Rollup merge of #78348 - jyn514:pub-crate, r=GuillaumeGomez
Make some functions private that don't have to be public

r? @GuillaumeGomez
2020-10-27 08:45:04 +09:00
Yuki Okushi 727e93dc74
Rollup merge of #78347 - Rustin-Liu:rustin-patch-doc, r=kennytm
Add lexicographical comparison doc

close https://github.com/rust-lang/rust/issues/72255
2020-10-27 08:45:01 +09:00
Yuki Okushi afdd148c03
Rollup merge of #78342 - oliviacrain:checkmate-pass, r=Mark-Simulacrum
Use check-pass in single-use-lifetime ui tests

Rationale: the `single_use_lifetimes` lint is used during late name resolution, which is within the scope of `check-pass` and does not require codegen or linking.

Helps remove some FIXMES associated with #62277. Additionally tidies touched test files.
2020-10-27 08:44:57 +09:00
Yuki Okushi 0b72ca6ea6
Rollup merge of #78332 - PoignardAzur:doc_E0308, r=camelid
Update description for error E0308

Fixes #76462

r? @camelid
2020-10-27 08:44:54 +09:00
Yuki Okushi 9d7db4891b
Rollup merge of #78298 - Aaron1011:fix/nll-ranked-test, r=Mark-Simulacrum
Add test for bad NLL higher-ranked subtype

Fixes #57642
2020-10-27 08:44:51 +09:00
Yuki Okushi f3c94374b9
Rollup merge of #78219 - JohnTitor:print-def-path, r=estebank
Prefer to use `print_def_path`

Follow-up of https://github.com/rust-lang/rust/pull/71310#discussion_r415438577
2020-10-27 08:44:47 +09:00
Yuki Okushi 2c307fab49
Rollup merge of #77703 - Keruspe:system-libunwind, r=Mark-Simulacrum
add system-llvm-libunwind config option

allows using the system-wide llvm-libunwind as the unwinder

Workaround for #76020
2020-10-27 08:44:44 +09:00
Yuki Okushi 13e88d6366
Rollup merge of #76635 - scottmcm:slice-as-chunks, r=LukasKalbertodt
Add [T]::as_chunks(_mut)

Allows getting the slices directly, rather than just through an iterator as in `array_chunks(_mut)`.  The constructors for those iterators are then written in terms of these methods, so the iterator constructors no longer have any `unsafe` of their own.

Unstable, of course. #74985
2020-10-27 08:44:41 +09:00
bors fd542592f0 Auto merge of #77187 - TimDiekmann:box-alloc, r=Amanieu
Support custom allocators in `Box`

r? `@Amanieu`

This pull request requires a crater run.

### Prior work:
- #71873
- #58457
- [`alloc-wg`](https://github.com/TimDiekmann/alloc-wg)-crate

Currently blocked on:
- ~#77118~
- ~https://github.com/rust-lang/chalk/issues/615 (#77515)~
2020-10-26 21:16:33 +00:00
Camelid 4641d2e6aa
Add FIXME note to const generics test
Co-authored-by: lcnr <bastian_kauschke@hotmail.de>
2020-10-26 13:56:31 -07:00
Camelid 94ed9455e8 Add some regression tests 2020-10-26 13:55:37 -07:00
bors 0da6d42f29 Auto merge of #68965 - eddyb:mir-inline-scope, r=nagisa,oli-obk
rustc_mir: track inlined callees in SourceScopeData.

We now record which MIR scopes are the roots of *other* (inlined) functions's scope trees, which allows us to generate the correct debuginfo in codegen, similar to what LLVM inlining generates.
This PR makes the `ui` test `backtrace-debuginfo` pass, if the MIR inliner is turned on by default.

Also, `#[track_caller]` is now correct in the face of MIR inlining (cc `@anp).`

Fixes #76997.

r? `@rust-lang/wg-mir-opt`
2020-10-26 18:50:22 +00:00
bors 35debd4c11 Auto merge of #77975 - bjorn3:cg_clif_subtree3, r=Mark-Simulacrum
Add cg_clif as optional codegen backend

Rustc_codegen_cranelift is an alternative codegen backend for rustc based on Cranelift. It has the potential to improve compilation times in debug mode. In my experience the compile time improvements over debug mode LLVM for a clean build are about 20-30% in most cases.

This PR adds cg_clif as optional codegen backend. By default it is only enabled for `./x.py check`. It can be enabled for `./x.py build` too by adding `cranelift` to the `rust.codegen-backends` array in `config.toml`.

MCP: https://github.com/rust-lang/compiler-team/issues/270

r? `@Mark-Simulacrum`
2020-10-26 16:31:38 +00:00
Rustin-Liu 42844ed2cf Add lexicographical comparison doc
Add links

Fix typo

Use `sequence`

Fix typo

Fix broken link

Fix broken link

Fix broken link

Fix broken links

Fix broken links
2020-10-26 22:39:43 +08:00
bors c96e11c781 Auto merge of #78395 - RalfJung:miri, r=RalfJung
update Miri

Fixes https://github.com/rust-lang/rust/issues/78339
Cc `@rust-lang/miri` r? `@ghost`
2020-10-26 14:13:37 +00:00
oli 2b3f00928c Ignore long lines in test 2020-10-26 14:09:27 +00:00
oli 7ae8bc3957 Add an inlining debuginfo test 2020-10-26 13:18:12 +00:00
oli 7101ce9127 Deduplicate span and dbg_scope adjustment 2020-10-26 13:04:52 +00:00
oli f8aae50469 Prefer bug! over unwrap() 2020-10-26 12:49:49 +00:00
bors 9f6c670c4b Auto merge of #78196 - pietroalbini:shipped-files, r=Mark-Simulacrum
Allow creating a list of files shipped in a release

This PR adds the `BUILD_MANIFEST_SHIPPED_FILES_PATH` environment variable to `build-manifest`, which writes a list of all the files referenced in the manifest to the path defined in the variable. The use for this is for `promote-release` to prune files unused files before publishing a release.

This PR **does not implement any pruning**, it just adds support for it to be implemented in the future on `promote-release`'s side.

r? `@Mark-Simulacrum`
2020-10-26 11:56:59 +00:00
Ralf Jung 3573333208 update Miri 2020-10-26 12:44:41 +01:00
Pietro Albini 0ee1e91c11
build-manifest: allow creating a list of files shipped in a release 2020-10-26 10:47:45 +01:00
bors b9a94c919b Auto merge of #78324 - RalfJung:uninhabited-statics, r=oli-obk
ensure that statics are inhabited

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

r? `@oli-obk`
2020-10-26 09:11:34 +00:00
bjorn3 ac4f7deb2f Add 'compiler/rustc_codegen_cranelift/' from commit '793d26047f994e23415f8f6bb5686ff25d3dda92'
git-subtree-dir: compiler/rustc_codegen_cranelift
git-subtree-mainline: cf798c1ec6
git-subtree-split: 793d26047f
2020-10-26 09:53:27 +01:00
bjorn3 cf798c1ec6 Add support for using cg_clif to bootstrap rustc 2020-10-26 09:52:59 +01:00
bjorn3 793d26047f Rustup to rustc 1.49.0-nightly (4760b8fb8 2020-10-25) 2020-10-26 09:51:48 +01:00
bors 69e68cf550 Auto merge of #75728 - nagisa:improve_align_offset_2, r=Mark-Simulacrum
Optimise align_offset for stride=1 further

`stride == 1` case can be computed more efficiently through `-p (mod
a)`. That, then translates to a nice and short sequence of LLVM
instructions:

    %address = ptrtoint i8* %p to i64
    %negptr = sub i64 0, %address
    %offset = and i64 %negptr, %a_minus_one

And produces pretty much ideal code-gen when this function is used in
isolation.

Typical use of this function will, however, involve use of
the result to offset a pointer, i.e.

    %aligned = getelementptr inbounds i8, i8* %p, i64 %offset

This still looks very good, but LLVM does not really translate that to
what would be considered ideal machine code (on any target). For example
that's the codegen we obtain for an unknown alignment:

    ; x86_64
    dec     rsi
    mov     rax, rdi
    neg     rax
    and     rax, rsi
    add     rax, rdi

In particular negating a pointer is not something that’s going to be
optimised for in the design of CISC architectures like x86_64. They
are much better at offsetting pointers. And so we’d love to utilize this
ability and produce code that's more like this:

    ; x86_64
    lea     rax, [rsi + rdi - 1]
    neg     rsi
    and     rax, rsi

To achieve this we need to give LLVM an opportunity to apply its
various peep-hole optimisations that it does during DAG selection. In
particular, the `and` instruction appears to be a major inhibitor here.
We cannot, sadly, get rid of this load-bearing operation, but we can
reorder operations such that LLVM has more to work with around this
instruction.

One such ordering is proposed in #75579 and results in LLVM IR that
looks broadly like this:

    ; using add enables `lea` and similar CISCisms
    %offset_ptr = add i64 %address, %a_minus_one
    %mask = sub i64 0, %a
    %masked = and i64 %offset_ptr, %mask
    ; can be folded with `gepi` that may follow
    %offset = sub i64 %masked, %address

…and generates the intended x86_64 machine code.
One might also wonder how the increased amount of code would impact a
RISC target. Turns out not much:

    ; aarch64 previous                 ; aarch64 new
    sub     x8, x1, #1                 add     x8, x1, x0
    neg     x9, x0                     sub     x8, x8, #1
    and     x8, x9, x8                 neg     x9, x1
    add     x0, x0, x8                 and     x0, x8, x9

    (and similarly for ppc, sparc, mips, riscv, etc)

The only target that seems to do worse is… wasm32.

Onto actual measurements – the best way to evaluate snipets like these
is to use llvm-mca. Much like Aarch64 assembly would allow to suspect,
there isn’t any performance difference to be found. Both snippets
execute in same number of cycles for the CPUs I tried. On x86_64,
we get throughput improvement of >50%!

Fixes #75579
2020-10-26 06:49:34 +00:00
bors 1cd97cad6e Auto merge of #78387 - Dylan-DPC:rollup-ch0st6z, r=Dylan-DPC
Rollup of 10 pull requests

Successful merges:

 - #74477 (`#[deny(unsafe_op_in_unsafe_fn)]` in sys/wasm)
 - #77836 (transmute_copy: explain that alignment is handled correctly)
 - #78126 (Properly define va_arg and va_list for aarch64-apple-darwin)
 - #78137 (Initialize tracing subscriber in compiletest tool)
 - #78161 (Add issue template link to IRLO)
 - #78214 (Tweak match arm semicolon removal suggestion to account for futures)
 - #78247 (Fix #78192)
 - #78252 (Add codegen test for #45964)
 - #78268 (Do not try to report on closures to avoid ICE)
 - #78295 (Add some regression tests)

Failed merges:

r? `@ghost`
2020-10-26 04:34:46 +00:00
Dylan DPC c8e0f4d90b
Rollup merge of #78295 - Alexendoo:ice-regression-tests, r=nagisa
Add some regression tests

Closes #56229
Closes #59494
Closes #70746
Closes #73229
2020-10-26 03:09:13 +01:00
Dylan DPC 463b6cc0e1
Rollup merge of #78268 - JohnTitor:issue-78262, r=estebank
Do not try to report on closures to avoid ICE

Fixes #78262
2020-10-26 03:09:11 +01:00
Dylan DPC 752bce5197
Rollup merge of #78252 - bugadani:issue-45964, r=Mark-Simulacrum
Add codegen test for #45964

Closes #45964
2020-10-26 03:09:09 +01:00
Dylan DPC 8646c2a15b
Rollup merge of #78247 - simonvandel:fix-78192, r=oli-obk
Fix #78192

Check which places are marked dead.

Fixes #78192
2020-10-26 03:09:08 +01:00
Dylan DPC 083a5cd9a2
Rollup merge of #78214 - estebank:match-semicolon, r=oli-obk
Tweak match arm semicolon removal suggestion to account for futures

* Tweak and extend "use `.await`" suggestions
* Suggest removal of semicolon on prior match arm
* Account for `impl Future` when suggesting semicolon removal
* Silence some errors when encountering `await foo()?` as can't be certain what the intent was

*Thanks to https://twitter.com/a_hoverbear/status/1318960787105353728 for pointing this out!*
2020-10-26 03:09:06 +01:00
Dylan DPC 9e907d420e
Rollup merge of #78161 - jonas-schievink:irlo-issue-link, r=Mark-Simulacrum
Add issue template link to IRLO
2020-10-26 03:09:04 +01:00
Dylan DPC efbbdac163
Rollup merge of #78137 - tmiasko:compiletest-tracing, r=Mark-Simulacrum
Initialize tracing subscriber in compiletest tool

The logging in compiletest was migrated from log crate to a tracing, but
the initialization code was never changed, so logging is non-functional.

Initialize tracing subscriber using default settings.
2020-10-26 03:09:02 +01:00
Dylan DPC 147a001fd3
Rollup merge of #78126 - shepmaster:aarch64-apple-darwin-valist, r=nagisa
Properly define va_arg and va_list for aarch64-apple-darwin

From [Apple][]:

> Because of these changes, the type `va_list` is an alias for `char*`,
> and not for the struct type in the generic procedure call standard.

With this change `/x.py test --stage 1 src/test/ui/abi/variadic-ffi`
passes.

Fixes #78092

[Apple]: https://developer.apple.com/documentation/xcode/writing_arm64_code_for_apple_platforms
2020-10-26 03:09:00 +01:00
Dylan DPC 9885232019
Rollup merge of #77836 - RalfJung:transmute_copy, r=Mark-Simulacrum
transmute_copy: explain that alignment is handled correctly

The doc comment currently is somewhat misleading because if it actually transmuted `&T` to `&U`, a higher-aligned `U` would be problematic.
2020-10-26 03:08:58 +01:00
Dylan DPC e0c08ae4e1
Rollup merge of #74477 - chansuke:sys-wasm-unsafe-op-in-unsafe-fn, r=Mark-Simulacrum
`#[deny(unsafe_op_in_unsafe_fn)]` in sys/wasm

This is part of #73904.

This encloses unsafe operations in unsafe fn in `libstd/sys/wasm`.

@rustbot modify labels: F-unsafe-block-in-unsafe-fn
2020-10-26 03:08:56 +01:00
bors 16e9ed0b1c Auto merge of #77283 - estebank:if-let-sugg, r=Mark-Simulacrum
Tweak `if let` suggestion to be more liberal with suggestion and to not ICE

Fix #77218. Fix #77238.
2020-10-26 01:53:51 +00:00
Jake Goulding 0a91755ff4 Properly define va_arg and va_list for aarch64-apple-darwin
From [Apple][]:

> Because of these changes, the type `va_list` is an alias for `char*`,
> and not for the struct type in the generic procedure call standard.

With this change `/x.py test --stage 1 src/test/ui/abi/variadic-ffi`
passes.

Fixes #78092

[Apple]: https://developer.apple.com/documentation/xcode/writing_arm64_code_for_apple_platforms
2020-10-25 21:37:01 -04:00
bors b6ac411f45 Auto merge of #78015 - ssomers:btree_merge_mergers, r=Mark-Simulacrum
btree: merge the implementations of MergeIter

Also remove the gratuitous Copy bounds. Same benchmark performance.

r? `@Mark-Simulacrum`
2020-10-25 22:29:02 +00:00
Esteban Küber cabf6d0523 Tweak if let suggestion to be more liberal with suggestion and to not ICE
Fix #77218. Fix #77238.
2020-10-25 15:21:14 -07:00
Taiki Endo 04c0018d1b Use ? in core/std macros 2020-10-26 07:15:37 +09:00
bors 4760b8fb88 Auto merge of #78179 - RalfJung:miri-comments, r=oli-obk
Miri engine: entirely skip interning of ZST, and improve some comments

r? `@oli-obk`
2020-10-25 20:15:44 +00:00
LeSeulArtichaut 9de15188b0 Fix typo in debug statement 2020-10-25 20:54:44 +01:00
bors 0dce3f606e Auto merge of #77901 - jonas-schievink:unignore-test-36710, r=Mark-Simulacrum
Unignore test for #36710 on MUSL

This now works fine thanks to autodetected `-C link-self-contained`.

Closes #36710
2020-10-25 16:37:01 +00:00