Commit Graph

120726 Commits

Author SHA1 Message Date
Dylan DPC
4adb9a85c3
Rollup merge of #72283 - jonas-schievink:elaborate-drop-elaboration, r=cramertj
Drop Elaboration Elaboration

As in, adding more documentation to it.
2020-05-18 19:04:04 +02:00
Dylan DPC
c6030c957a
Rollup merge of #71973 - lcnr:lazy-norm, r=nikomatsakis
Lazy normalization of constants (Reprise)

Continuation of #67890 by @skinny121.

Initial implementation of #60471 for constants.

Perform normalization/evaluation of constants lazily, which is known as lazy normalization. Lazy normalization is only enabled when using `#![feature(lazy_normalization_consts)]`, by default constants are still evaluated eagerly as there are currently.

Lazy normalization of constants is achieved with a new ConstEquate predicate which type inferences uses to delay checking whether constants are equal to each other until later, avoiding cycle errors.

Note this doesn't allow the use of generics within repeat count expressions as that is still evaluated during conversion to mir. There are also quite a few other known problems with lazy normalization which will be fixed in future PRs.

r? @nikomatsakis

fixes #71922, fixes #71986
2020-05-18 19:04:03 +02:00
Dylan DPC
58e6447365
Rollup merge of #71599 - ldm0:fnclo, r=nikomatsakis
Support coercion between (FnDef | Closure) and (FnDef | Closure)

Fixes #46742, fixes #48109
Inject `Closure` into the `FnDef x FnDef` coercion special case, which makes coercion of `(FnDef | Closure) x (FnDef | Closure)` possible, where closures should be **non-capturing**.
2020-05-18 19:04:01 +02:00
Nadrieril
4c6510bee5
Typo
Co-authored-by: varkor <github@varkor.com>
2020-05-18 16:12:01 +01:00
Alex Crichton
cc91041f26 Always generated object code for #![no_builtins]
This commit updates the code generation for `#![no_builtins]` to always
produce object files instead of conditionally respecting
`-Clinker-plugin-lto` and sometimes producing bitcode. This is intended
to address rust-lang/cargo#8239.

The issue at hand here is that Cargo has tried to get "smarter" about
codegen in whole crate graph scenarios. When LTO is enabled it attempts
to avoid codegen on as many crates as possible, opting to pass
`-Clinker-plugin-lto` where it can to only generate bitcode. When this
is combined with `-Zbuild-std`, however, it means that
`compiler-builtins` only generates LLVM bitcode instead of object files.
Rustc's own LTO passes then explicitly skip `compiler-builtins` (because
it wouldn't work anyway) which means that LLVM bitcode gets sent to the
linker, which chokes most of the time.

The fix in this PR is to not actually respect `-Clinker-plugin-lto` for
`#![no_builtins]` crates. These crates, even if slurped up by the linker
rather than rustc, will not work with LTO. They define symbols which are
only referenced as part of codegen, so LTO's aggressive internalization
would trivially remove the symbols only to have the linker realize later
that the symbol is undefined. Since pure-bitcode never makes sense for
these libraries, the `-Clinker-plugin-lto` flag is silently ignored.
2020-05-18 08:00:44 -07:00
Amanieu d'Antras
09efea5f54 Update unstable book documentation with the latest RFC text 2020-05-18 14:41:35 +01:00
Amanieu d'Antras
32471f4d87 Update LLVM submodule 2020-05-18 14:41:35 +01:00
Amanieu d'Antras
62ff543c36 Simplify register name output for x86 2020-05-18 14:41:35 +01:00
Amanieu d'Antras
5a20f39672 Update compiler_builtins to 0.1.28 2020-05-18 14:41:35 +01:00
Amanieu d'Antras
3233565cdf Mark asm unstable book doctests as allow_fail since they don't work with system LLVM 2020-05-18 14:41:35 +01:00
Amanieu d'Antras
cecffdc1d7 Fix const handling and add tests for const operands 2020-05-18 14:41:35 +01:00
Amanieu d'Antras
6f8be8cc8c Fix docs 2020-05-18 14:41:34 +01:00
Amanieu d'Antras
9215ead1ee Fix handling on InlineAsm for the unconditional recursion lint. 2020-05-18 14:41:34 +01:00
Amanieu d'Antras
46db0dfe8c Fix tests 2020-05-18 14:41:34 +01:00
Amanieu d'Antras
ac1fb93fce Fix feature gate tests 2020-05-18 14:41:34 +01:00
Amanieu d'Antras
6ba9696f5e Add documentation for asm! 2020-05-18 14:41:34 +01:00
Amanieu d'Antras
2aa9aaada5 Add borrow-check test 2020-05-18 14:41:34 +01:00
Amanieu d'Antras
f10803c81c Minor fixes 2020-05-18 14:41:34 +01:00
Amanieu d'Antras
1c6a9351d8 Handle InlineAsm in clippy 2020-05-18 14:41:33 +01:00
Amanieu d'Antras
a656349b55 Move InlineAsmTemplatePiece and InlineAsmOptions to librustc_ast 2020-05-18 14:41:33 +01:00
Amanieu d'Antras
330bdf89b1 Disable asm tests on system llvm 2020-05-18 14:41:33 +01:00
Amanieu d'Antras
ddcdea45b6 The h modifier is only supported by reg_abcd 2020-05-18 14:41:33 +01:00
Amanieu d'Antras
9ac4ef40d4 Update llvm-project submodule 2020-05-18 14:41:33 +01:00
Amanieu d'Antras
08822546a5 Implement att_syntax option 2020-05-18 14:41:33 +01:00
Amanieu d'Antras
3590f4cf57 Work around more LLVM limitations 2020-05-18 14:41:32 +01:00
Amanieu d'Antras
19a0d14b5c Add notes about functions that are not currently used 2020-05-18 14:41:32 +01:00
Amanieu d'Antras
7dfa486d4a Add support for high byte registers on x86 2020-05-18 14:41:32 +01:00
Amanieu d'Antras
93e2946d0c Un-deprecate asm! macro 2020-05-18 14:41:32 +01:00
Amanieu d'Antras
ff97db1e54 Apply review feedback 2020-05-18 14:41:32 +01:00
Amanieu d'Antras
8ab0f2d3c5 Add tests for asm! 2020-05-18 14:41:32 +01:00
Amanieu d'Antras
abed45ff9f Implement asm! codegen 2020-05-18 14:41:32 +01:00
Amanieu d'Antras
342a64caef Check that asm const operands are actually constants 2020-05-18 14:41:31 +01:00
Amanieu d'Antras
1e7b246086 Add asm! to MIR 2020-05-18 14:41:31 +01:00
Amanieu d'Antras
10510b5820 HIR passes for asm! 2020-05-18 14:41:31 +01:00
Amanieu d'Antras
ec1ad61f88 Implement AST lowering for asm! 2020-05-18 14:41:29 +01:00
Amanieu d'Antras
d5b1501d8c Add asm! to HIR 2020-05-18 14:39:54 +01:00
Amanieu d'Antras
a0adf53bc9 Implement asm! in librustc_builtin_macros 2020-05-18 14:39:54 +01:00
Amanieu d'Antras
813a9fc4f1 Add asm! to AST 2020-05-18 14:39:54 +01:00
Amanieu d'Antras
989edf6dd9 Add inline asm register definitions to librustc_target 2020-05-18 14:39:53 +01:00
Amanieu d'Antras
62d5784a8f Add RISC-V target features 2020-05-18 14:39:53 +01:00
Tom Eccles
5b9941ca47 Add remote-test-client help text 2020-05-18 12:33:18 +01:00
bors
9e2a6a29ce Auto merge of #72289 - RalfJung:abort_internal, r=Mark-Simulacrum
abort_internal is safe

`sys::abort_internal` is stably exposed as a safe function. Forward that assumption "inwards" to the `sys` module by making the function itself safe, too.

This corresponds to what https://github.com/rust-lang/rust/pull/72204 did for the intrinsic. We should probably wait until that lands because some of the intrinsic calls in this PR might then need adjustments.
2020-05-18 11:11:19 +00:00
bors
d4bf05693c Auto merge of #72316 - RalfJung:rollup-70g6bln, r=RalfJung
Rollup of 2 pull requests

Successful merges:

 - #72143 (make offset must_use)
 - #72307 (use the new interface to initialize conditional variables)

Failed merges:

r? @ghost
2020-05-18 07:53:03 +00:00
Nicholas Nethercote
959bd48887 Add some more rfold implementations. 2020-05-18 16:51:39 +10:00
Ralf Jung
2cff5d961a
Rollup merge of #72307 - hermitcore:condvar, r=Mark-Simulacrum
use the new interface to initialize conditional variables

HermitCore introduce a new interface to intialize conditional variables.
Consequently, minor changes are required to support this interface.
2020-05-18 08:48:45 +02:00
Ralf Jung
2a90664798
Rollup merge of #72143 - rust-lang:steveklabnik-must-use, r=sfackler
make offset must_use

https://djugei.github.io/bad-at-unsafe/ describes an error a user had when trying to use offset:

> At first I just assumed that the .add() and .offset() methods on pointers would mutate the pointer. They do not. Instead they return a new pointer, which gets dropped silently if you don't use it. Unlike for example Result, which is must_use annotated.

This PR only adds `offset`, because I wanted to float the idea; I'm imagining that there's more than just `add` and `offset` that could use this. I am also very open to re-wording the warning.

r? @rust-lang/libs
2020-05-18 08:48:43 +02:00
Nicholas Nethercote
f4b9dc31f6 Tiny Vecs are dumb.
Currently, if you repeatedly push to an empty vector, the capacity
growth sequence is 0, 1, 2, 4, 8, 16, etc. This commit changes the
relevant code (the "amortized" growth strategy) to skip 1 and 2 in most
cases, instead using 0, 4, 8, 16, etc. (You can still get a capacity of
1 or 2 using the "exact" growth strategy, e.g. via `reserve_exact()`.)

This idea (along with the phrase "tiny Vecs are dumb") comes from the
"doubling" growth strategy that was removed from `RawVec` in #72013.
That strategy was barely ever used -- only when a `VecDeque` was grown,
oddly enough -- which is why it was removed in #72013.

(Fun fact: until just a few days ago, I thought the "doubling" strategy
was used for repeated push case. In other words, this commit makes
`Vec`s behave the way I always thought they behaved.)

This change reduces the number of allocations done by rustc itself by
10% or more. It speeds up rustc, and will also speed up any other Rust
program that uses `Vec`s a lot.
2020-05-18 15:26:59 +10:00
bors
1baf85c7e0 Auto merge of #72300 - flip1995:clippyup, r=Mark-Simulacrum
Sync Clippy

cc rust-lang/rust-clippy#5608

Included changes:

- renames/merges of some lints
- ICE fix
- Downgrade useless_let_if_seq to nursery
- FP fixes
- formatting

r? @oli-obk
2020-05-18 04:10:01 +00:00
bors
35d86693ac Auto merge of #72269 - RalfJung:unsafe-borrow-of-packed, r=Mark-Simulacrum
move borrow-of-packed-field unsafety check out of loop

Looks like during the place refactoring, this code somehow got into this loop even though it does not actually depend on the loop variables.
2020-05-18 00:54:42 +00:00
Aaron Hill
b6844489f9
Emit a better diagnostic when function actually has a 'self' parameter
Fixes #66898

When we are unable to resolve a reference to `self`, we current assume
that the containing function doesn't have a `self` parameter, and
emit an error message accordingly.

However, if the reference to `self` was created by a macro invocation,
then resolution will correctly fail, due to hygiene. In this case, we
don't want to tell the user that the containing fuction doesn't have a
'self' paramter if it actually has one.

This PR checks for the precense of a 'self' parameter, and adjusts the
error message we emit accordingly.

TODO: The exact error message we emit could probably be improved. Should
we explicitly mention hygiene?
2020-05-17 19:04:13 -04:00