Commit graph

89732 commits

Author SHA1 Message Date
bors
c67d4749a5 Auto merge of #58446 - Centril:rollup, r=Centril
Rollup of 8 pull requests

Successful merges:

 - #57451 (suggestion-diagnostics: as_ref improve snippet)
 - #57856 (Convert old first edition links to current edition one)
 - #57992 (Update the future/task API)
 - #58258 (Reduce the size of `hir::Expr`.)
 - #58267 (Tweak "incompatible match arms" error)
 - #58296 (Hidden suggestion support)
 - #58301 (Enable comparing fat pointers)
 - #58308 (Extract block to insert an intrinsic into its own function)

Failed merges:

r? @ghost
2019-02-14 04:22:35 +00:00
Mazdak Farrokhzad
a0767d6096
Rollup merge of #58308 - gnzlbg:context_insert_intr, r=eddyb
Extract block to insert an intrinsic into its own function

r? @eddyb
2019-02-14 02:41:24 +01:00
Mazdak Farrokhzad
fab0f9be32
Rollup merge of #58301 - RalfJung:fat-ptr-eq, r=oli-obk
Enable comparing fat pointers

Also refactor our binops a bit to make that happen more easily.

r? @oli-obk
2019-02-14 02:41:23 +01:00
Mazdak Farrokhzad
56e19160af
Rollup merge of #58296 - estebank:hidden-suggestion, r=oli-obk
Hidden suggestion support

Add way to hide suggestion snippet window from cli output to avoid cluttered spans that don't enhance understanding.

r? @pietroalbini CC @zackmdavis
2019-02-14 02:41:21 +01:00
Mazdak Farrokhzad
4ad3cf2533
Rollup merge of #58267 - estebank:match-arms, r=matthewjasper
Tweak "incompatible match arms" error

- Point at the body expression of the match arm with the type error.
- Point at the prior match arms explicitly stating the evaluated type.
- Point at the entire match expr in a secondary span, instead of primary.
- For type errors in the first match arm, the cause is outside of the
  match, treat as implicit block error to give a more appropriate error.

Fix #46776, fix #57206.
CC #24157, #38234.
2019-02-14 02:41:20 +01:00
Mazdak Farrokhzad
b6ed206484
Rollup merge of #58258 - nnethercote:shrink-hir-Expr, r=michaelwoerister
Reduce the size of `hir::Expr`.

From 104 bytes to 72 bytes on x86-64. This slightly reduces instruction
counts.

Also add an assertion about the size.
2019-02-14 02:41:19 +01:00
Mazdak Farrokhzad
919cf42feb
Rollup merge of #57992 - Matthias247:waker4, r=cramertj
Update the future/task API

This change updates the future and task API as discussed in the stabilization RFC at https://github.com/rust-lang/rfcs/pull/2592.

Changes:
- Replacing UnsafeWake with RawWaker and RawWakerVtable
- Removal of LocalWaker
- Removal of Arc-based Wake trait
2019-02-14 02:41:17 +01:00
Mazdak Farrokhzad
aa896f30bb
Rollup merge of #57856 - lzutao:fix-old-first-edition, r=steveklabnik
Convert old first edition links to current edition one

r? @steveklabnik
2019-02-14 02:41:16 +01:00
Mazdak Farrokhzad
93ecae63d8
Rollup merge of #57451 - dlrobertson:can_use_as_ref_nit, r=estebank
suggestion-diagnostics: as_ref improve snippet

Improve the code snippet suggested in suggestion-diagnostics when
suggesting the use of as_ref.

Given:

```rust
fn test(x: &usize) {}
fn main() {
    Some(42).map(|x| test(x));
}
```

Suggest

```
  help: consider using `as_ref` instead: `as_ref().map`
```

Instead of

```
  help: consider using `as_ref` instead: `as_ref().`
```
2019-02-14 02:41:15 +01:00
Nicholas Nethercote
5d65e8cc7a Reduce the size of hir::Expr.
From 104 bytes to 72 bytes on x86-64. This slightly reduces instruction
counts.

Also add an assertion about the size.
2019-02-14 11:52:03 +11:00
bors
4772dc8087 Auto merge of #58432 - Centril:rollup, r=Centril
Rollup of 10 pull requests

Successful merges:

 - #58110 (libpanic_unwind => 2018)
 - #58167 (HirId-ify hir::BodyId)
 - #58202 (Ignore future deprecations in #[deprecated])
 - #58272 (Cut down on number formating code size)
 - #58276 (Improve the error messages for missing stability attributes)
 - #58354 (Fix ICE and invalid filenames in MIR printing code)
 - #58381 (Only suggest imports if not imported.)
 - #58386 (Fix #54242)
 - #58400 (Fix rustc_driver swallowing errors when compilation is stopped)
 - #58420 (target/uefi: clarify documentation)

Failed merges:

r? @ghost
2019-02-13 22:23:09 +00:00
Dan Robertson
285d4a7eb6
suggestion-diagnostics: as_ref improve snippet
Improve the code snippet suggested in suggestion-diagnostics when
suggesting the use of as_ref.
2019-02-13 17:52:22 +00:00
Mazdak Farrokhzad
05cfcb5eb2
Rollup merge of #58420 - dvdhrm:target-uefi-comments, r=nagisa
target/uefi: clarify documentation

This clarifies why FP-units are disabled on UEFI targets, as well as
why we must opt into the NXCOMPAT feature.

I did find some time to investigate why GRUB and friends disable FP on
UEFI. The specification explicitly allows using MMX/SSE/AVX, but as it
turns out it does not mandate enabling the instruction sets explicitly.
Hence, any use of these instructions will trigger CPU exceptions,
unless an application explicitly enables them (which is not an option,
as these are global flags that better be controlled by the
kernel/firmware).

Furthermore, UEFI systems are allowed to mark any non-code page as
non-executable. Hence, we must make sure to never place code on the
stack or heap. So we better pass /NXCOMPAT to the linker for it to
complain if it ever places code in non-code pages.

Lastly, this fixes some typos in related comments.

r? @alexcrichton
2019-02-13 18:12:39 +01:00
Mazdak Farrokhzad
0178f31869
Rollup merge of #58400 - gnzlbg:fix_driver, r=oli-obk
Fix rustc_driver swallowing errors when compilation is stopped

r? @oli-obk
2019-02-13 18:12:37 +01:00
Mazdak Farrokhzad
fceb16911e
Rollup merge of #58386 - Zoxc:fix-54242, r=michaelwoerister
Fix #54242

r? @michaelwoerister
2019-02-13 18:12:36 +01:00
Mazdak Farrokhzad
8a4f8e6adc
Rollup merge of #58381 - davidtwco:issue-42944, r=estebank
Only suggest imports if not imported.

Fixes #42944 and fixes #53430.

This commit modifies name resolution error reporting so that if a name
is in scope and has been imported then we do not suggest importing it.

This can occur when we add a label about constructors not being visible
due to private fields. In these cases, we know that the struct/variant
has been imported and we should silence any suggestions to import the
struct/variant.

r? @estebank
2019-02-13 18:12:35 +01:00
Mazdak Farrokhzad
b39b62534d
Rollup merge of #58354 - matthewjasper:mir-dump-fixes, r=wesleywiser
Fix ICE and invalid filenames in MIR printing code

* Don't panic when printing MIR for associated constants
* Don't use `<` and `>` in filenames, since they aren't allowed on Windows.

r? @eddyb

cc @RalfJung
2019-02-13 18:12:34 +01:00
Mazdak Farrokhzad
c6590e7dc7
Rollup merge of #58276 - varkor:missing-stability-attr-top-level, r=davidtwco
Improve the error messages for missing stability attributes

This makes the capitalisation consistent and provides more context (especially for missing top-level attributes).
2019-02-13 18:12:32 +01:00
Mazdak Farrokhzad
c0d507d73b
Rollup merge of #58272 - fitzgen:num-format-code-size, r=Mark-Simulacrum
Cut down on number formating code size

r? @alexcrichton
2019-02-13 18:12:31 +01:00
Mazdak Farrokhzad
193c3773c2
Rollup merge of #58202 - varkor:deprecated-future-external, r=GuillaumeGomez
Ignore future deprecations in #[deprecated]

The future deprecation warnings should only apply to `#[rustc_deprecated]` as they take into account rustc's version. Fixes #57952.

I've also slightly modified rustdoc's display of future deprecation notices to make it more consistent, so I'm assigning a rustdoc team member for review to make sure this is okay.

r? @GuillaumeGomez
2019-02-13 18:12:30 +01:00
Mazdak Farrokhzad
adb2bb6e61
Rollup merge of #58167 - ljedrz:HirIdify_body_id, r=Zoxc
HirId-ify hir::BodyId

Another step towards https://github.com/rust-lang/rust/pull/57578.
2019-02-13 18:12:28 +01:00
Mazdak Farrokhzad
78c60bb865
Rollup merge of #58110 - Centril:libpanic_unwind-2018, r=oli-obk
libpanic_unwind => 2018

Transitions `libpanic_unwind` to Rust 2018; cc #58099

r? @oli-obk
2019-02-13 18:12:27 +01:00
Mazdak Farrokhzad
bb08499626 libpanic_unwind => 2018: remove unused extern crate. 2019-02-13 18:09:09 +01:00
Mazdak Farrokhzad
f9e9c9196a libpanic_unwind => 2018: fix ICEs. 2019-02-13 18:09:09 +01:00
Mazdak Farrokhzad
f2fe12a8ab libpanic_unwind => 2018 2019-02-13 18:09:09 +01:00
Lzu Tao
e7f8e63ed4 Convert old doc links to current edition
Use footnote style to bypass the tidy check
2019-02-13 14:39:25 +00:00
bors
e544947278 Auto merge of #56951 - oli-obk:auto_toolstate_issue, r=kennytm
Automatically open an issue when a tool breaks

cc @nikomatsakis

fixes https://github.com/rust-lang-nursery/rust-toolstate/issues/6

documentation about issue opening via the github api: https://developer.github.com/v3/issues/#create-an-issue
2019-02-13 13:08:30 +00:00
David Rheinsberg
15e4bd3bf4 target/uefi: clarify documentation
This clarifies why FP-units are disabled on UEFI targets, as well as
why we must opt into the NXCOMPAT feature.

I did find some time to investigate why GRUB and friends disable FP on
UEFI. The specification explicitly allows using MMX/SSE/AVX, but as it
turns out it does not mandate enabling the instruction sets explicitly.
Hence, any use of these instructions will trigger CPU exceptions,
unless an application explicitly enables them (which is not an option,
as these are global flags that better be controlled by the
kernel/firmware).

Furthermore, UEFI systems are allowed to mark any non-code page as
non-executable. Hence, we must make sure to never place code on the
stack or heap. So we better pass /NXCOMPAT to the linker for it to
complain if it ever places code in non-code pages.

Lastly, this fixes some typos in related comments.
2019-02-13 11:55:17 +01:00
bors
c005afcb1e Auto merge of #58238 - Mark-Simulacrum:doctest-fix, r=alexcrichton
Fixes rustdoc in stage 0, stage 1

When a request for rustdoc is passed for stage 0, x.py build --stage 0
src/tools/rustdoc or ensure(tool::Rustdoc { .. }) with top_stage = 0, we
return the rustdoc for that compiler (i.e., the beta rustdoc).

This fixes stage 0 of https://github.com/rust-lang/rust/issues/52186 as well as being part of general workflow improvements (making stage 0 testing for std work) for rustbuild.

The stage 1 fix (second commit) completely resolves the problem, so this fixes https://github.com/rust-lang/rust/issues/52186.
2019-02-13 10:27:50 +00:00
Ralf Jung
22d5e6a37a fix rebase fallout 2019-02-13 11:14:40 +01:00
Ralf Jung
1a5304ae93 fix whitespace 2019-02-13 10:14:56 +01:00
Ralf Jung
b376ae6671 make bin_op and unary_op APIs consistently work on ImmTy 2019-02-13 10:14:56 +01:00
Ralf Jung
e73f96abe7 make OpTy.op private, and ImmTy.imm public instead 2019-02-13 10:14:56 +01:00
ljedrz
eac43ccda4 HirId-ify hir::BodyId 2019-02-13 09:54:58 +01:00
bors
ccd23b95e5 Auto merge of #58235 - jethrogb:jb/sgx-usercall-internals, r=alexcrichton
SGX target: simplify usercall internals

This moves logic from assembly to Rust and removes the special case for exit/panic handling, merging it with regular usercall handling.

Also, this fixes a bug in the exit usercall introduced in a75ae00. The bug would make regular exits look like panics with high probability. It would also with some probability leak information through uncleared registers.

cc @VardhanThigle

r? @alexcrichton
2019-02-13 07:46:21 +00:00
Matthias Einwag
871338c3ae Merging master 2019-02-12 22:46:14 -08:00
bors
827a141466 Auto merge of #58415 - Centril:rollup, r=Centril
Rollup of 12 pull requests

Successful merges:

 - #57693 (Doc rewording)
 - #57815 (Speed up the fast path for assert_eq! and assert_ne!)
 - #58034 (Stabilize the time_checked_add feature)
 - #58057 (Stabilize linker-plugin based LTO (aka cross-language LTO))
 - #58137 (Cleanup: rename node_id_to_type(_opt))
 - #58166 (allow shorthand syntax for deprecation reason)
 - #58200 (fix str mutating through a ptr derived from &self)
 - #58273 (Rename rustc_errors dependency in rust 2018 crates)
 - #58289 (impl iter() for dyn Error)
 - #58387 (Disallow `auto` trait alias syntax)
 - #58404 (use Ubuntu keyserver for CloudABI ports)
 - #58405 (Remove some dead code from libcore)

Failed merges:

r? @ghost
2019-02-13 05:14:12 +00:00
Mazdak Farrokhzad
6562c28607
Rollup merge of #58405 - gnzlbg:remove_unused_macros, r=alexcrichton
Remove some dead code from libcore

These macros are not required to glue the `core_arch` crate anymore.
2019-02-13 04:37:09 +01:00
Mazdak Farrokhzad
f3c4652d0c
Rollup merge of #58404 - euclio:cloudabi-keyserver, r=alexcrichton
use Ubuntu keyserver for CloudABI ports

The Ubuntu keyserver is more reliable than the MIT PGP server, which is
prone to going down. This commit also explicitly uses port 80 on the
keyserver for reasons outlined in #57844.
2019-02-13 04:37:08 +01:00
Mazdak Farrokhzad
a5e869eb62
Rollup merge of #58387 - alexreg:fix-trait-alias-2, r=centril
Disallow `auto` trait alias syntax

See https://github.com/rust-lang/rust/issues/41517#issuecomment-462567679.

r? @Centril

CC @topecongiro @nikomatsakis
2019-02-13 04:37:07 +01:00
Mazdak Farrokhzad
5aa260a4b5
Rollup merge of #58289 - haraldh:master, r=sfackler
impl iter() for dyn Error

Examples:

```rust
let next_error_type_a = err
    .iter()
    .filter_map(Error::downcast_ref::<ErrorTypeA>)
    .next();
```

```rust
let source_root_error = err.iter().last();
```

Credit for the ErrorIter goes to reddit user /u/tdiekmann (Tim Diekmann)
https://www.reddit.com/r/rust/comments/aj3lpg/is_an_iterator_impl_over_errorsource_possible/
2019-02-13 04:37:05 +01:00
Mazdak Farrokhzad
0bc8f6f3f4
Rollup merge of #58273 - taiki-e:rename-dependency, r=matthewjasper
Rename rustc_errors dependency in rust 2018 crates

I think this is a better solution than `use rustc_errors as errors` in `lib.rs` and `use crate::errors` in modules.

Related: rust-lang/cargo#5653

cc #58099

r? @Centril
2019-02-13 04:37:04 +01:00
Mazdak Farrokhzad
ecb6503169
Rollup merge of #58200 - RalfJung:str-as-mut-ptr, r=SimonSapin
fix str mutating through a ptr derived from &self

Found by Miri: In `get_unchecked_mut` (also used by the checked variants internally) uses `str::as_ptr` to create a mutable reference, but `as_ptr` takes `&self`.  This means the mutable references we return here got created from a shared reference, which violates the shared-references-are-read-only discipline!

For this by using a newly introduced `as_mut_ptr` instead.
2019-02-13 04:37:03 +01:00
Mazdak Farrokhzad
856e41142c
Rollup merge of #58166 - euclio:deprecation-shorthand, r=petrochenkov
allow shorthand syntax for deprecation reason

Fixes #48271.

Created based on discussion in #56896.
2019-02-13 04:37:02 +01:00
Mazdak Farrokhzad
81434cbf84
Rollup merge of #58137 - ljedrz:cleanup_node_id_to_type, r=estebank
Cleanup: rename node_id_to_type(_opt)

Renames `node_id_to_type(_opt)` to `hir_id_to_type(_opt)`; this makes it clear we are dealing with HIR nodes and their IDs here.

In addition, a drive-by commit removing `ty::item_path::hir_path_str` (as requested by @eddyb).
2019-02-13 04:37:00 +01:00
Mazdak Farrokhzad
1c1d2e44c5
Rollup merge of #58057 - michaelwoerister:stabilize-xlto, r=alexcrichton
Stabilize linker-plugin based LTO (aka cross-language LTO)

This PR stabilizes [linker plugin based LTO](https://github.com/rust-lang/rust/issues/49879), also known as "cross-language LTO" because it allows for doing inlining and other optimizations across language boundaries in mixed Rust/C/C++ projects.

As described in the tracking issue, it works by making `rustc` emit LLVM bitcode instead of machine code, the same as `clang` does. A linker with the proper plugin (like LLD) can then run (Thin)LTO across all modules.

The feature has been implemented over a number of pull requests and there are various [codegen](https://github.com/rust-lang/rust/blob/master/src/test/codegen/no-dllimport-w-cross-lang-lto.rs) and [run](https://github.com/rust-lang/rust/tree/master/src/test/run-make-fulldeps/cross-lang-lto-clang)-[make](https://github.com/rust-lang/rust/tree/master/src/test/run-make-fulldeps/cross-lang-lto-upstream-rlibs) [tests](https://github.com/rust-lang/rust/tree/master/src/test/run-make-fulldeps/cross-lang-lto) that make sure that it keeps working.

It also works for building big projects like [Firefox](https://treeherder.mozilla.org/#/jobs?repo=try&revision=2ce2d5ddcea6fbff790503eac406954e469b2f5d).

The PR makes the feature available under the `-C linker-plugin-lto` flag. As discussed in the tracking issue it is not cross-language specific and also not LLD specific. `-C linker-plugin-lto` is descriptive of what it does. If someone has a better name, let me know `:)`
2019-02-13 04:36:59 +01:00
Mazdak Farrokhzad
0ab1057a56
Rollup merge of #58034 - faern:stabilize-time-checked-add, r=alexcrichton
Stabilize the time_checked_add feature

Closes #55940

Stabilizes `checked_add` and `checked_sub` on `Instant` and `SystemTime`.
2019-02-13 04:36:58 +01:00
Mazdak Farrokhzad
0ed894afae
Rollup merge of #57815 - dotdash:asserts, r=sfackler
Speed up the fast path for assert_eq! and assert_ne!

Currently, the panic!() calls directly borrow the value bindings. This
causes those bindings to always be initialized, i.e. they're initialized
even before the values are even compared. This causes noticeable
overhead in what should be a really cheap operation.

By performing a reborrow of the value in the call to panic!(), we allow
LLVM to optimize that code, so that the extra borrow only happens in the
error case.

We could achieve the same result by dereferencing the values passed to
panic!(), as the format machinery borrows them anyway, but this causes
assertions to fail to compile if one of the values is unsized, i.e. it
would be a breaking change.
2019-02-13 04:36:56 +01:00
Mazdak Farrokhzad
734cc3e79e
Rollup merge of #57693 - king6cong:word, r=Centril
Doc rewording

None
2019-02-13 04:36:55 +01:00
bors
0f949c2fcc Auto merge of #58051 - SimonSapin:str_escape, r=alexcrichton
Stabilize str::escape_* methods with new return types…

… that implement `Display` and `Iterator<Item=char>`, as proposed in FCP: https://github.com/rust-lang/rust/issues/27791#issuecomment-376864727
2019-02-12 23:30:16 +00:00