Commit Graph

84920 Commits

Author SHA1 Message Date
Ralf Jung
d0c585c525 seems like for generators we cannot access the freevars 2018-10-13 09:09:03 +02:00
Ralf Jung
93f53e5113 size_and_align_of can return no result for extern types 2018-10-13 09:09:03 +02:00
Ralf Jung
f79a22c3d5 validate return value on stack pop 2018-10-13 09:09:02 +02:00
Ralf Jung
a05914e2dc check return type even for uninhabited case 2018-10-13 09:09:02 +02:00
Ralf Jung
5b75ec0a91 fix validation around transmuting copy_op 2018-10-13 09:09:02 +02:00
bors
fb3b47aa42 Auto merge of #54980 - zackmdavis:and_the_case_of_the_universal_call, r=oli-obk
structured suggestion for E0223 ambiguous associated type

(routine (and when are we going to be done finding these, anyway?) but something that stuck out to me while glancing at #54970)

r? @estebank
2018-10-13 06:48:17 +00:00
Zack M. Davis
ab91a6b4df #[must_use] for associated functions is supposed to actually work
In the comments of (closed, defunct) pull request #54884, Mazdak
"Centril" Farrokhzad noted that must-use annotations didn't work on an
associated function (what other communities might call a "static
method"). Subsequent logging revealed that in this case we have a
`Def::Method`, whereas the lint pass was only matching on
`Def::Fn`. (One could argue that those def-names are thereby
misleading—must-use for self-ful methods have always worked—but
documenting or reworking that can be left to another day.)
2018-10-12 22:01:43 -07:00
bors
c47785f6be Auto merge of #54945 - estebank:asm-span, r=petrochenkov
Point to variable in `asm!` macro when failing borrowck

Fix #34940.
2018-10-13 00:56:30 +00:00
Eric Huss
09f42dd902 Add missing lifetime fragment specifier to error message.
A very minor issue, `lifetime` was missing from the error list.
I left `literal` in the list, even though it is unstable. It looks like it may stabilize soon anyways.
2018-10-12 17:51:48 -07:00
Alex Crichton
9562b69b4f rustc: Allow targets to specify SIMD args are by-val
The upcoming SIMD support in the wasm target is unique from the other
platforms where it's either unconditionally available or not available,
there's no halfway where a subsection of the program can use it but no
other parts of the program can use it. In this world it's valid for wasm
SIMD args to always be passed by value and there's no need to pass them
by reference.

This commit adds a new custom target specification option
`simd_types_indirect` which defaults to `true`, but the wasm backend
disables this and sets it to `false`.
2018-10-12 17:04:31 -07:00
Andy Russell
1811f1322a
raise ICE if LLVM worker threads panic 2018-10-12 17:30:13 -04:00
Andy Russell
00e1f5b8df
exit with status code 101 on fatal LLVM error
Fixes #54992.
2018-10-12 17:29:40 -04:00
bors
2c2e2c57dc Auto merge of #54942 - matthewjasper:wf-type-annotations, r=nikomatsakis
[NLL] Check user types are well-formed

Also contains a change of span for AscribeUserType.
I'm not quite sure if this was what @nikomatsakis was thinking.

Closes #54620

r? @nikomatsakis
2018-10-12 21:28:42 +00:00
memoryruins
ba446d72be Add nll stderr to #52240 2018-10-12 14:33:38 -04:00
memoryruins
b041a79f26 Add test for issue #52240
Closes #52240
2018-10-12 13:08:44 -04:00
Andy Russell
0e268d9e89
add test for #24421
Fixes #24421.
2018-10-12 13:07:39 -04:00
memoryruins
146fbc6a96 Add test for issue #54966
Closes #54966
2018-10-12 12:42:33 -04:00
Andy Russell
3855af5734
add test for #23189
Fixes #23189.
2018-10-12 12:21:22 -04:00
bors
945372d268 Auto merge of #55012 - kennytm:rollup, r=kennytm
Rollup of 16 pull requests

Successful merges:

 - #54755 (Documents reference equality by address (#54197))
 - #54811 (During rustc bootstrap, make default for `optimize` independent of `debug`)
 - #54825 (NLL says "borrowed content" instead of more precise "dereference of raw pointer")
 - #54860 (Add doc comments about safest way to initialize a vector of zeros)
 - #54869 (Fix mobile docs)
 - #54891 (Fix tracking issue for Once::is_completed)
 - #54913 (doc fix: it's auto traits that make for automatic implementations)
 - #54920 (Fix handling of #[must_use] on unit and uninhabited types)
 - #54932 (A handful of random string-related improvements)
 - #54936 (impl Eq+Hash for TyLayout)
 - #54950 (std: Synchronize global allocator on wasm32)
 - #54956 ("(using ..." doesn't have the matching ")")
 - #54958 (add a macro for static (compile-time) assertions)
 - #54967 (Remove incorrect span for second label inner macro invocation)
 - #54983 (Fix slice's benchmarks)
 - #54989 (Fix spelling in the documentation to htmldocck.py)

Failed merges:

r? @ghost
2018-10-12 15:00:24 +00:00
kennytm
d64c77a671
Rollup merge of #54989 - Munksgaard:fix-htmldocck-typos, r=tmandry
Fix spelling in the documentation to htmldocck.py

I was reading through htmldocck.py, and decided to attempt to clean it up a little bit. Let me know if you disagree with my edits.
2018-10-12 22:04:19 +08:00
kennytm
9eae552a44
Rollup merge of #54983 - kzys:rand-bench, r=tmandry
Fix slice's benchmarks

Fixes #54013.
2018-10-12 22:04:18 +08:00
kennytm
644dbf99ed
Rollup merge of #54967 - holmgr:master, r=estebank
Remove incorrect span for second label inner macro invocation

A fix for issue #54841
2018-10-12 22:04:16 +08:00
kennytm
0187e81da9
Rollup merge of #54958 - RalfJung:static-assert, r=oli-obk
add a macro for static (compile-time) assertions

Cc @oli-obk
2018-10-12 22:04:15 +08:00
kennytm
8e3f189180
Rollup merge of #54956 - kzys:close-paren, r=varkor
"(using ..." doesn't have the matching ")"

Fixes #54948.
2018-10-12 22:04:14 +08:00
kennytm
8d3d96f08a
Rollup merge of #54950 - alexcrichton:wasm-sync-allocator, r=sfackler
std: Synchronize global allocator on wasm32

We originally didn't have threads, and now we're starting to add them!
Make sure we properly synchronize access to dlmalloc when the `atomics`
feature is enabled for `wasm32-unknown-unknown`.
2018-10-12 22:04:13 +08:00
kennytm
4f1a618e5d
Rollup merge of #54936 - RalfJung:layout-hash, r=oli-obk
impl Eq+Hash for TyLayout

As proposed by @eddyb at https://github.com/rust-lang/rust/pull/53671#pullrequestreview-159761136.

I have an upcoming PR that would also significantly benefit from this.
2018-10-12 22:04:12 +08:00
kennytm
fcb3ce4f53
Rollup merge of #54932 - ljedrz:a_handful_of_string_improvements, r=alexcrichton
A handful of random string-related improvements

- remove a few allocations in `errors/diagnostic`
- make `build_helper::gnu_target` return `Cow<str>`
2018-10-12 22:04:10 +08:00
kennytm
b39535d157
Rollup merge of #54920 - varkor:must_use-unit, r=estebank
Fix handling of #[must_use] on unit and uninhabited types

Fixes https://github.com/rust-lang/rust/issues/54828.
2018-10-12 22:04:09 +08:00
kennytm
80ee322a20
Rollup merge of #54913 - RalfJung:unwind-safe, r=alexcrichton
doc fix: it's auto traits that make for automatic implementations

Being a marker trait is not good enough (that just means "no items in the trait").

r? @alexcrichton who [originally wrote these docs](0a13f1abaf).
2018-10-12 22:04:08 +08:00
kennytm
ef7f77d53d
Rollup merge of #54891 - rust-lang:SimonSapin-patch-1, r=nagisa
Fix tracking issue for Once::is_completed

https://github.com/rust-lang/rust/pull/53027 was merged without a tracking issue. I just filed https://github.com/rust-lang/rust/issues/54890. CC @matklad
2018-10-12 22:04:07 +08:00
kennytm
8d85b893d8
Rollup merge of #54869 - GuillaumeGomez:fix-mobile-docs, r=QuietMisdreavus
Fix mobile docs

Fixes #54836.

<img width="1440" alt="screen shot 2018-10-06 at 18 53 19" src="https://user-images.githubusercontent.com/3050060/46573683-1b4cd700-c999-11e8-9e6b-86a23b332e22.png">

r? @QuietMisdreavus
2018-10-12 22:04:05 +08:00
kennytm
365d4c94f6
Rollup merge of #54860 - mandeep:vec-initialize, r=alexcrichton
Add doc comments about safest way to initialize a vector of zeros

This adds more information about the vec! macro as discussed in #54628. I think this is a good starting point, but I think additional detail is needed so that we can explain why vec! is safer than the alternatives.
2018-10-12 22:04:04 +08:00
kennytm
44a527a27a
Rollup merge of #54825 - davidtwco:issue-52663-deref-raw-pointer, r=pnkfelix
NLL says "borrowed content" instead of more precise "dereference of raw pointer"

Part of #52663.

Previously, move errors involving the dereference of a raw pointer would
say "borrowed content". This commit changes it to say "dereference of
raw pointer".

r? @nikomatsakis
cc @pnkfelix
2018-10-12 22:04:03 +08:00
kennytm
e03db2301e
Rollup merge of #54811 - pnkfelix:issue-24840-separate-bootstrap-default-for-optimize-from-debug-setting, r=nikomatsakis
During rustc bootstrap, make default for `optimize` independent of `debug`

It may have taken me three and a half years, but I'm following through on my ["threat"](https://github.com/rust-lang/rust/issues/24840#issuecomment-97911700)

Fix #24840
2018-10-12 22:04:01 +08:00
kennytm
8455468d0d
Rollup merge of #54755 - lucasloisp:document-reference-address-eq, r=QuietMisdreavus
Documents reference equality by address (#54197)

Clarification of the use of `ptr::eq` to test equality of references via address by pointer coercion,  regarding issue #54197 .

The same example as in `ptr::eq` docs is shown here to clarify that
`PartialEq` compares values pointed-to instead of via address (which can be desired in some cases)
2018-10-12 22:04:00 +08:00
ljedrz
39753c8973 rustc/driver: improve macro calls 2018-10-12 14:01:25 +02:00
bors
e9e27e6a62 Auto merge of #54715 - oli-obk:nll_deref_promotion, r=RalfJung
Fix #54224 (const promotion regression)

r? @eddyb
2018-10-12 12:00:50 +00:00
ljedrz
5bfe08fc71 rustc/driver: simplify profile::trace::cons 2018-10-12 13:55:35 +02:00
bors
849a0e9c40 Auto merge of #53933 - GuillaumeGomez:codeblock-error-display, r=QuietMisdreavus
Improve error display for codeblocks in rustdoc

Part of #53919.

r? @QuietMisdreavus
2018-10-12 09:23:10 +00:00
Oliver Scherer
76f8a90d53 Add comments explaining why some operations are not constant inside normal functions 2018-10-12 09:30:28 +02:00
bors
8dc554a325 Auto merge of #54534 - nagisa:align-offset-simplification, r=alexcrichton
Simplify implementation of align_offset slightly
2018-10-12 06:38:11 +00:00
Zack M. Davis
a5de379b55 structured suggestion for E0223 ambiguous associated type
It looks like we tend to use angle-brackets around the placeholder in
the few other places we use `Applicability::HasPlaceholders`, but that
would be confusing here, so ...
2018-10-11 21:10:35 -07:00
bors
567557f630 Auto merge of #54924 - RalfJung:use-maybe-uninit2, r=cramertj
Use MaybeUninit in liballoc

All code by @japaric. This is a re-submission of a part of https://github.com/rust-lang/rust/pull/53508 that hopefully does not regress performance.
2018-10-12 02:14:47 +00:00
Esteban Küber
5beeb535e1 Reword Range*/[Range*]: Iterator E0277 messages 2018-10-11 13:44:07 -07:00
Guillaume Gomez
c5a025aae6 Fix mobile doc display 2018-10-11 22:23:39 +02:00
bors
77af314083 Auto merge of #54592 - GabrielMajeri:no-plt, r=nagisa
Support for disabling PLT for better function call performance

This PR gives `rustc` the ability to skip the PLT when generating function calls into shared libraries. This can improve performance by reducing branch indirection.

AFAIK, the only advantage of using the PLT is to allow for ELF lazy binding. However, since Rust already [enables full relro for security](https://github.com/rust-lang/rust/pull/43170), lazy binding was disabled anyway.

This is a little known feature which is supported by [GCC](https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html) and [Clang](https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-fplt) as `-fno-plt` (some Linux distros [enable it by default](https://git.archlinux.org/svntogit/packages.git/tree/trunk/makepkg.conf?h=packages/pacman#n40) for all builds).

Implementation inspired by [this patch](https://reviews.llvm.org/D39079#change-YvkpNDlMs_LT) which adds `-fno-plt` support to Clang.

## Performance

I didn't run a lot of benchmarks, but these are the results on my machine for a `clap` [benchmark](https://github.com/clap-rs/clap/blob/master/benches/05_ripgrep.rs):

```
 name              control ns/iter  no-plt ns/iter  diff ns/iter  diff %  speedup
 build_app_long    11,097           10,733                  -364  -3.28%   x 1.03
 build_app_short   11,089           10,742                  -347  -3.13%   x 1.03
 build_help_long   186,835          182,713               -4,122  -2.21%   x 1.02
 build_help_short  80,949           78,455                -2,494  -3.08%   x 1.03
 parse_clean       12,385           12,044                  -341  -2.75%   x 1.03
 parse_complex     19,438           19,017                  -421  -2.17%   x 1.02
 parse_lots        431,493          421,421              -10,072  -2.33%   x 1.02
```

A small performance improvement across the board, with no downsides. It's likely binaries which make a lot of function calls into dynamic libraries could see even more improvements. [This comment](https://patchwork.ozlabs.org/patch/468993/#1028255) suggests that, in some cases, `-fno-plt` could improve PIC/PIE code performance by 10%.

## Security benefits

**Bonus**: some of the speculative execution attacks rely on the PLT, by disabling it we reduce a big attack surface and reduce the need for [`retpoline`](https://reviews.llvm.org/D41723).

## Remaining PLT calls

The compiled binaries still have plenty of PLT calls, coming from C/C++ libraries. Building dependencies with `CFLAGS=-fno-plt CXXFLAGS=-fno-plt` removes them.
2018-10-11 19:38:15 +00:00
Guillaume Gomez
ca517a6ee9 Update minifier version 2018-10-11 21:37:04 +02:00
Esteban Küber
c71228e2f4 review comments
- reword messages
- apply custom comments to all types of ranges
- fix indentation
2018-10-11 12:11:23 -07:00
Vasya Novikov
7a0fa95336
improve docs on thread::sleep 2018-10-11 21:37:30 +03:00
Gabriel Majeri
6009da0794 Support for disabling the PLT on ELF targets
Disable the PLT where possible to improve performance
for indirect calls into shared libraries.

This optimization is enabled by default where possible.

- Add the `NonLazyBind` attribute to `rustllvm`:
  This attribute informs LLVM to skip PLT calls in codegen.

- Disable PLT unconditionally:
  Apply the `NonLazyBind` attribute on every function.

- Only enable no-plt when full relro is enabled:
  Ensures we only enable it when we have linker support.

- Add `-Z plt` as a compiler option
2018-10-11 21:11:00 +03:00