]> git.lizzy.rs Git - rust.git/log
rust.git
6 years agorustc: Load the `rustc_trans` crate at runtime
Alex Crichton [Mon, 22 Jan 2018 15:29:24 +0000 (07:29 -0800)]
rustc: Load the `rustc_trans` crate at runtime

Building on the work of # 45684 this commit updates the compiler to
unconditionally load the `rustc_trans` crate at runtime instead of linking to it
at compile time. The end goal of this work is to implement # 46819 where rustc
will have multiple backends available to it to load.

This commit starts off by removing the `extern crate rustc_trans` from the
driver. This involved moving some miscellaneous functionality into the
`TransCrate` trait and also required an implementation of how to locate and load
the trans backend. This ended up being a little tricky because the sysroot isn't
always the right location (for example `--sysroot` arguments) so some extra code
was added as well to probe a directory relative to the current dll (the
rustc_driver dll).

Rustbuild has been updated accordingly as well to have a separate compilation
invocation for the `rustc_trans` crate and assembly it accordingly into the
sysroot. Finally, the distribution logic for the `rustc` package was also
updated to slurp up the trans backends folder.

A number of assorted fallout changes were included here as well to ensure tests
pass and such, and they should all be commented inline.

6 years agoAuto merge of #47748 - alexcrichton:rollup, r=alexcrichton
bors [Fri, 26 Jan 2018 17:41:36 +0000 (17:41 +0000)]
Auto merge of #47748 - alexcrichton:rollup, r=alexcrichton

Rollup of 19 pull requests

- Successful merges: #47415, #47437, #47439, #47453, #47460, #47502, #47529, #47600, #47607, #47618, #47626, #47656, #47668, #47696, #47701, #47705, #47710, #47711, #47719
- Failed merges: #47455, #47521

6 years agoIgnore a test on emscripten
Alex Crichton [Fri, 26 Jan 2018 17:41:00 +0000 (09:41 -0800)]
Ignore a test on emscripten

6 years agoFix a test case on Windows
Alex Crichton [Fri, 26 Jan 2018 15:37:57 +0000 (07:37 -0800)]
Fix a test case on Windows

6 years agoMerge branch 'mlsm' of https://github.com/dotdash/rust into rollup
Alex Crichton [Fri, 26 Jan 2018 14:53:18 +0000 (06:53 -0800)]
Merge branch 'mlsm' of https://github.com/dotdash/rust into rollup

6 years agoMerge branch 'beta-prerelease' of https://github.com/cuviper/rust into rollup
Alex Crichton [Fri, 26 Jan 2018 14:52:55 +0000 (06:52 -0800)]
Merge branch 'beta-prerelease' of https://github.com/cuviper/rust into rollup

6 years agoMerge branch 'android-run-pass' of https://github.com/malbarbo/rust into rollup
Alex Crichton [Fri, 26 Jan 2018 14:52:36 +0000 (06:52 -0800)]
Merge branch 'android-run-pass' of https://github.com/malbarbo/rust into rollup

6 years agoMerge branch 'fix-regression' of https://github.com/estebank/rust into rollup
Alex Crichton [Fri, 26 Jan 2018 14:52:21 +0000 (06:52 -0800)]
Merge branch 'fix-regression' of https://github.com/estebank/rust into rollup

6 years agoMerge branch 'rustdoc_masked' of https://github.com/ollie27/rust into rollup
Alex Crichton [Fri, 26 Jan 2018 14:51:58 +0000 (06:51 -0800)]
Merge branch 'rustdoc_masked' of https://github.com/ollie27/rust into rollup

6 years agoMerge branch 'simd-always-mem' of https://github.com/alexcrichton/rust into rollup
Alex Crichton [Fri, 26 Jan 2018 14:51:43 +0000 (06:51 -0800)]
Merge branch 'simd-always-mem' of https://github.com/alexcrichton/rust into rollup

6 years agoMerge branch 'llvm5-indirect-deref' of https://github.com/cuviper/rust into rollup
Alex Crichton [Fri, 26 Jan 2018 14:51:14 +0000 (06:51 -0800)]
Merge branch 'llvm5-indirect-deref' of https://github.com/cuviper/rust into rollup

6 years agoMerge branch 'explain' of https://github.com/estebank/rust into rollup
Alex Crichton [Fri, 26 Jan 2018 14:50:31 +0000 (06:50 -0800)]
Merge branch 'explain' of https://github.com/estebank/rust into rollup

6 years agoMerge branch 'no-stderr-sink' of https://github.com/Zoxc/rust into rollup
Alex Crichton [Fri, 26 Jan 2018 14:49:55 +0000 (06:49 -0800)]
Merge branch 'no-stderr-sink' of https://github.com/Zoxc/rust into rollup

6 years agoShorten another test path for MSVC
Alex Crichton [Fri, 26 Jan 2018 14:48:38 +0000 (06:48 -0800)]
Shorten another test path for MSVC

6 years agoAuto merge of #47252 - Zoxc:backtrace-win, r=alexcrichton
bors [Fri, 26 Jan 2018 12:18:00 +0000 (12:18 +0000)]
Auto merge of #47252 - Zoxc:backtrace-win, r=alexcrichton

Print inlined functions on Windows

Split from https://github.com/rust-lang/rust/pull/45637

r? @alexcrichton

6 years agoUpgrade LLVM to incorporate a fix for #47364
Björn Steinbrink [Fri, 26 Jan 2018 08:53:48 +0000 (09:53 +0100)]
Upgrade LLVM to incorporate a fix for #47364

Fixes #47364

6 years agoIgnore an i128 test on emscripten
Alex Crichton [Fri, 26 Jan 2018 05:04:01 +0000 (21:04 -0800)]
Ignore an i128 test on emscripten

6 years agoAuto merge of #47676 - topecongiro:update-rls, r=alexcrichton
bors [Fri, 26 Jan 2018 04:10:10 +0000 (04:10 +0000)]
Auto merge of #47676 - topecongiro:update-rls, r=alexcrichton

Update rls

Currently rls is missing from the latest nightly component. This PR brings it back.

6 years agoUpdate rls
topecongiro [Fri, 26 Jan 2018 03:55:22 +0000 (12:55 +0900)]
Update rls

6 years agoDo not capture stderr in the compiler. Instead just panic silently for fatal errors
John Kåre Alsaker [Sun, 21 Jan 2018 11:47:58 +0000 (12:47 +0100)]
Do not capture stderr in the compiler. Instead just panic silently for fatal errors

6 years agoPrint inlined functions on Windows
John Kåre Alsaker [Wed, 15 Nov 2017 17:01:09 +0000 (18:01 +0100)]
Print inlined functions on Windows

6 years agoShorten a filename for MSVC
Alex Crichton [Fri, 26 Jan 2018 02:11:42 +0000 (18:11 -0800)]
Shorten a filename for MSVC

6 years agoCall non-git beta builds simply x.y.z-beta
Josh Stone [Fri, 26 Jan 2018 00:22:58 +0000 (16:22 -0800)]
Call non-git beta builds simply x.y.z-beta

We can't use git commands to compute a prerelease version when we're
building from a source tarball, or if git is otherwise unavailable.
We'll just call such builds `x.y.z-beta`, without a prerelease.

6 years agoRevert update of the i686-freebsd builder
Alex Crichton [Thu, 25 Jan 2018 22:53:30 +0000 (14:53 -0800)]
Revert update of the i686-freebsd builder

Looks like llvm 4.0.0 isn't read for that either.

6 years agoRemove stray src/llvm-emscripten module
Alex Crichton [Thu, 25 Jan 2018 20:46:45 +0000 (12:46 -0800)]
Remove stray src/llvm-emscripten module

Accidentally added in e9a64996b

6 years agoMerge branch 'configure-lto' of https://github.com/alexcrichton/rust into rollup
Alex Crichton [Thu, 25 Jan 2018 18:51:20 +0000 (10:51 -0800)]
Merge branch 'configure-lto' of https://github.com/alexcrichton/rust into rollup

6 years agoMerge branch 'cache-ty-collect' of https://github.com/michaelwoerister/rust into...
Alex Crichton [Thu, 25 Jan 2018 18:50:35 +0000 (10:50 -0800)]
Merge branch 'cache-ty-collect' of https://github.com/michaelwoerister/rust into rollup

6 years agoRollup merge of #47719 - malbarbo:run-pass-arch-powerpc, r=alexcrichton
Alex Crichton [Thu, 25 Jan 2018 18:49:03 +0000 (12:49 -0600)]
Rollup merge of #47719 - malbarbo:run-pass-arch-powerpc, r=alexcrichton

Add powerpc to run-pass/conditional-compile-arch.rs

6 years agoRollup merge of #47711 - alexcrichton:update-compiler-builtins, r=nikomatsakis
Alex Crichton [Thu, 25 Jan 2018 18:49:02 +0000 (12:49 -0600)]
Rollup merge of #47711 - alexcrichton:update-compiler-builtins, r=nikomatsakis

Update compiler-builtins submodule

No sense of urgency, just wanted to make sure we don't lag too far behind!

6 years agoRollup merge of #47710 - alexcrichton:llvm-6-compat, r=nikomatsakis
Alex Crichton [Thu, 25 Jan 2018 18:49:01 +0000 (12:49 -0600)]
Rollup merge of #47710 - alexcrichton:llvm-6-compat, r=nikomatsakis

First round of LLVM 6.0.0 compatibility

This includes a number of commits for the first round of upgrading to LLVM 6. There are still [lingering bugs](https://github.com/rust-lang/rust/issues/47683) but I believe all of this will nonetheless be necessary!

6 years agoRollup merge of #47705 - pietroalbini:fix-47673, r=petrochenkov
Alex Crichton [Thu, 25 Jan 2018 18:49:00 +0000 (12:49 -0600)]
Rollup merge of #47705 - pietroalbini:fix-47673, r=petrochenkov

Fix ICE when use trees have multiple empty nested groups

The issue was caused by an oversight of mine in the original use_nested_groups PR, where different paths were resolved with the same `NodeId` in some cases (such as in `use {{}, {}};`).

Fixes #47673
r? @petrochenkov

6 years agoRollup merge of #47701 - Manishearth:intra-fixes, r=QuietMisdreavus
Alex Crichton [Thu, 25 Jan 2018 18:48:59 +0000 (12:48 -0600)]
Rollup merge of #47701 - Manishearth:intra-fixes, r=QuietMisdreavus

Fixes for intra-doc-links

Turn errors into warnings, also handle methods, trait items, and variants.

r? @killercup @QuietMisdreavus

6 years agoRollup merge of #47696 - Zoxc:variance-rg, r=nikomatsakis
Alex Crichton [Thu, 25 Jan 2018 18:48:58 +0000 (12:48 -0600)]
Rollup merge of #47696 - Zoxc:variance-rg, r=nikomatsakis

Make use of the implemented red/green algorithm for variance

r? @michaelwoerister

6 years agoRollup merge of #47668 - nikomatsakis:issue-47511, r=eddyb
Alex Crichton [Thu, 25 Jan 2018 18:48:57 +0000 (12:48 -0600)]
Rollup merge of #47668 - nikomatsakis:issue-47511, r=eddyb

do not ICE when return type includes unconstrained anon region

It turns out that this *can* happen after all, if the region is only
used in projections from the input types.

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

r? @eddyb

6 years agoRollup merge of #47656 - ishitatsuyuki:patch-1, r=nikomatsakis
Alex Crichton [Thu, 25 Jan 2018 18:48:56 +0000 (12:48 -0600)]
Rollup merge of #47656 - ishitatsuyuki:patch-1, r=nikomatsakis

[perf] Use std based dedup in projection

Unstable sort was added recently, and the code that is being modified is 3 years old. As quicksort doesn't allocate it will likely perform as well as, or better than linear search.

I didn't benchmark. Have a perf run.

6 years agoRollup merge of #47626 - eddyb:one-less-unwrap, r=nagisa
Alex Crichton [Thu, 25 Jan 2018 18:48:55 +0000 (12:48 -0600)]
Rollup merge of #47626 - eddyb:one-less-unwrap, r=nagisa

rustc_trans: remove an unwrap by replacing a bool with Result.

Prompted by @shepmaster.
r? @nagisa

6 years agoRollup merge of #47618 - mrhota:dw_at_noreturn, r=michaelwoerister
Alex Crichton [Thu, 25 Jan 2018 18:48:54 +0000 (12:48 -0600)]
Rollup merge of #47618 - mrhota:dw_at_noreturn, r=michaelwoerister

Teach rustc about DW_AT_noreturn and a few more DIFlags

We achieve two small things with this PR:
1. We provide definitions for a few additional llvm debuginfo flags
1. We _use_ one of these new flags, `FlagNoReturn`, and add it to debuginfo for functions with the never return type (`!`).

6 years agoMake 3 run-pass tests works on android (aarch64 and x86)
Marco A L Barbosa [Thu, 25 Jan 2018 19:31:35 +0000 (17:31 -0200)]
Make 3 run-pass tests works on android (aarch64 and x86)

6 years agorustc: SIMD types use pointers in Rust's ABI
Alex Crichton [Thu, 25 Jan 2018 16:00:22 +0000 (08:00 -0800)]
rustc: SIMD types use pointers in Rust's ABI

This commit changes the ABI of SIMD types in the "Rust" ABI to unconditionally
be passed via pointers instead of being passed as immediates. This should fix a
longstanding issue, #44367, where SIMD-using programs ended up showing very odd
behavior at runtime because the ABI between functions was mismatched.

As a bit of a recap, this is sort of an LLVM bug and sort of an LLVM feature
(today's behavior). LLVM will generate code for a function solely looking at the
function it's generating, including calls to other functions. Let's then say
you've got something that looks like:

```llvm
define void @foo() { ; no target features enabled
  call void @bar(<i64 x 4> zeroinitializer)
  ret void
}

define void @bar(<i64 x 4>) #0 { ; enables the AVX feature
  ...
}
```

LLVM will codegen the call to `bar` *without* using AVX registers becauase `foo`
doesn't have access to these registers. Instead it's generated with emulation
that uses two 128-bit registers. The `bar` function, on the other hand, will
expect its argument in an AVX register (as it has AVX enabled). This means we've
got a codegen problem!

Comments on #44367 have some more contexutal information but the crux of the
issue is that if we want SIMD to work in general we'll need to ensure that
whenever a function calls another they ABI of the arguments being passed is in
agreement.

One possible solution to this would be to insert "shim functions" where whenever
a `target_feature` mismatch is detected the compiler inserts a shim function
where you pass arguments via memory to the shim and then the shim loads the
values and calls the target function (where the shim and the target have the
same target features enabled). This unfortunately is quite nontrivial to
implement in rustc today (especially when accounting for function pointers and
such).

This commit takes a different solution, *always* passing SIMD arguments through
memory instead of passing as immediates. This strategy solves the problem at the
LLVM layer because the ABI between two functions never uses SIMD registers. This
also shouldn't be a hit to performance because SIMD performance is thought to
often rely on inlining anyway, where a `call` instruction, even if using SIMD
registers, would be disastrous to performance regardless. LLVM should then be
more than capable of fixing all our memory usage to use registers instead after
enough inlining has been performed.

Note that there's a few caveats to this commit though:

* The "platform intrinsic" ABI is omitted from "always pass via memory". This
  ABI is used to define intrinsics like `simd_shuffle4` where LLVM and rustc
  need to have the arguments as an immediate.

* Additionally this commit does *not* fix the `extern` ("C") ABI. This means
  that the bug in #44367 can still happen when using non-Rust-ABI functions. My
  hope is that before stabilization we can ban and/or warn about SIMD types in
  these functions (as AFAIK there's not much motivation to belong there anyway),
  but I'll leave that for a later commit and if this is merged I'll file a
  follow-up issue.

All in all this...

Closes #44367

6 years agoAdd description to field and method
Esteban Küber [Thu, 25 Jan 2018 19:40:33 +0000 (11:40 -0800)]
Add description to field and method

6 years agoFix regression: account for impl methods in arg count mismatch error
Esteban Küber [Thu, 25 Jan 2018 18:41:01 +0000 (10:41 -0800)]
Fix regression: account for impl methods in arg count mismatch error

6 years agoRollup merge of #47600 - varkor:empty-never-array, r=eddyb
Alex Crichton [Thu, 25 Jan 2018 18:48:52 +0000 (12:48 -0600)]
Rollup merge of #47600 - varkor:empty-never-array, r=eddyb

Fix type inhabitedness check for arrays

Arrays of uninhabited types were considered to also be uninhabited if
their length had not been evaluated, causing unsoundness.

Fixes #47563.

r? @eddyb

6 years agoRollup merge of #47529 - nikomatsakis:impl-trait-issue-38064, r=cramertj
Alex Crichton [Thu, 25 Jan 2018 18:48:51 +0000 (12:48 -0600)]
Rollup merge of #47529 - nikomatsakis:impl-trait-issue-38064, r=cramertj

track recursion limit when expanding existential impl trait

r? @cramertj

6 years agoRollup merge of #47502 - petrochenkov:label, r=eddyb
Alex Crichton [Thu, 25 Jan 2018 18:48:49 +0000 (12:48 -0600)]
Rollup merge of #47502 - petrochenkov:label, r=eddyb

AST/HIR: Add a separate structure for labels

6 years agoRollup merge of #47460 - Mark-Simulacrum:bootstrap-check, r=alexcrichton
Alex Crichton [Thu, 25 Jan 2018 18:48:48 +0000 (12:48 -0600)]
Rollup merge of #47460 - Mark-Simulacrum:bootstrap-check, r=alexcrichton

Add ./x.py check src/{libstd,libtest,librustc}

This currently only supports a limited subset of the full compilation,
but is likely 90% of what people will want and is possible without
building a full compiler (and also building LLVM). In theory, this means
that contributors who don't want to build LLVM now have an easy way to
compile locally, though running tests won't work.

6 years agoRollup merge of #47453 - pftbest:nointas, r=alexcrichton
Alex Crichton [Thu, 25 Jan 2018 18:48:47 +0000 (12:48 -0600)]
Rollup merge of #47453 - pftbest:nointas, r=alexcrichton

Fix no_integrated_as option to work with new codegen architecture.

Old implementation called the assembler once per crate, but we need to call
it for each object file instead, because a single crate can now have more
than one object file.

This patch fixes issue #45836 (Can't compile core for msp430 in release mode)

This change can be tested on x86_64 using
```sh
export RUSTFLAGS="-C no_integrated_as -C save_temps"
```

r? @alexcrichton
cc @japaric

6 years agoRollup merge of #47439 - eddyb:issue-45662, r=nagisa
Alex Crichton [Thu, 25 Jan 2018 18:48:46 +0000 (12:48 -0600)]
Rollup merge of #47439 - eddyb:issue-45662, r=nagisa

rustc_trans: ignore trailing padding larger than 8 bytes.

Fixes #45662 by ignoring a missing second register component, as it could be entirely padding.

6 years agoRollup merge of #47437 - eddyb:issue-38763, r=nagisa
Alex Crichton [Thu, 25 Jan 2018 18:48:45 +0000 (12:48 -0600)]
Rollup merge of #47437 - eddyb:issue-38763, r=nagisa

rustc_trans: take into account primitives larger than 8 bytes.

Fixes #38763 by marking all "eightbytes" covered by a primitive appropriately, not just the first.

6 years agoRollup merge of #47415 - varkor:cgu-partition-heuristic, r=michaelwoerister
Alex Crichton [Thu, 25 Jan 2018 18:48:44 +0000 (12:48 -0600)]
Rollup merge of #47415 - varkor:cgu-partition-heuristic, r=michaelwoerister

Add CGU size heuristic for partitioning

This addresses the concern of #47316 by estimating CGU size based on
the size of its MIR. Looking at the size estimate differences for a
small selection of crates, this heuristic produces different orderings,
which should more accurately reflect optimisation time. (Fixes #47316.)

r? @michaelwoerister

6 years agoFix rustdoc-js test
Oliver Middleton [Thu, 25 Jan 2018 17:18:52 +0000 (17:18 +0000)]
Fix rustdoc-js test

6 years agoAuto merge of #47740 - GuillaumeGomez:rollup, r=GuillaumeGomez
bors [Thu, 25 Jan 2018 15:27:18 +0000 (15:27 +0000)]
Auto merge of #47740 - GuillaumeGomez:rollup, r=GuillaumeGomez

Rollup of 10 pull requests

- Successful merges: #47534, #47609, #47679, #47691, #47700, #47702, #47717, #47721, #47726, #47729
- Failed merges:

6 years agoRollup merge of #47729 - alexcrichton:update-cargo, r=sfackler
Guillaume Gomez [Thu, 25 Jan 2018 14:52:19 +0000 (15:52 +0100)]
Rollup merge of #47729 - alexcrichton:update-cargo, r=sfackler

Update Cargo submodule to master

Just a routine update

6 years agoRollup merge of #47726 - pietroalbini:fix-nested-empty-groups-span, r=petrochenkov
Guillaume Gomez [Thu, 25 Jan 2018 14:52:18 +0000 (15:52 +0100)]
Rollup merge of #47726 - pietroalbini:fix-nested-empty-groups-span, r=petrochenkov

Fix spans in unused import lint for nested groups

This fixes an inconsistency for empty nested groups, and adds a test for all the possible cases of the lint.

```
warning: unused imports: `*`, `Foo`, `baz::{}`, `foobar::*`
  --> test.rs:16:11
   |
16 | use foo::{Foo, bar::{baz::{}, foobar::*}, *};
   |           ^^^        ^^^^^^^  ^^^^^^^^^   ^
   |
   = note: #[warn(unused_imports)] on by default

warning: unused import: `*`
  --> test.rs:17:24
   |
17 | use foo::bar::baz::{*, *};
   |                        ^

warning: unused import: `use foo::{};`
  --> test.rs:18:1
   |
18 | use foo::{};
   | ^^^^^^^^^^^^
```

cc #44494

6 years agoRollup merge of #47721 - GuillaumeGomez:experimental-color, r=QuietMisdreavus
Guillaume Gomez [Thu, 25 Jan 2018 14:52:17 +0000 (15:52 +0100)]
Rollup merge of #47721 - GuillaumeGomez:experimental-color, r=QuietMisdreavus

Fix experimental text display on default theme

r? @QuietMisdreavus

6 years agoRollup merge of #47717 - evelynmitchell:47716-doc-fix, r=steveklabnik
Guillaume Gomez [Thu, 25 Jan 2018 14:52:16 +0000 (15:52 +0100)]
Rollup merge of #47717 - evelynmitchell:47716-doc-fix, r=steveklabnik

fix for documentation error issue 47716

Fix #47716

6 years agoRollup merge of #47702 - etaoins:fix-into-cast-paren-precedence, r=petrochenkov
Guillaume Gomez [Thu, 25 Jan 2018 14:52:15 +0000 (15:52 +0100)]
Rollup merge of #47702 - etaoins:fix-into-cast-paren-precedence, r=petrochenkov

Fix into() cast paren check precedence

As discussed in #47699 the logic for determining if an expression needs parenthesis when suggesting an `.into()` cast is incorrect. Two broken examples from nightly are:

```
error[E0308]: mismatched types
 --> main.rs:4:10
  |
4 |     test(foo as i8);
  |          ^^^^^^^^^ expected i32, found i8
help: you can cast an `i8` to `i32`, which will sign-extend the source value
  |
4 |     test(foo as i8.into());
  |
```

```
error[E0308]: mismatched types
 --> main.rs:4:10
  |
4 |     test(*foo);
  |          ^^^^ expected i32, found i8
help: you can cast an `i8` to `i32`, which will sign-extend the source value
  |
4 |     test(*foo.into());
  |
```

As suggested by @petrochenkov switch the precedence check to `PREC_POSTFIX`. This catches both `as` and unary operators. Fixes #47699.

r? @petrochenkov

6 years agoRollup merge of #47700 - EdSchouten:cc104, r=kennytm
Guillaume Gomez [Thu, 25 Jan 2018 14:52:15 +0000 (15:52 +0100)]
Rollup merge of #47700 - EdSchouten:cc104, r=kennytm

Remove workarounds for cc 1.0.3.

Now that the Rust codebase depends on cc 1.0.4, there is no longer any
need to specify a compiler for CloudABI manually. Cargo will
automatically call into the right compiler executable.

6 years agoRollup merge of #47691 - estebank:unknown-lang-item-sp, r=rkruppe
Guillaume Gomez [Thu, 25 Jan 2018 14:52:14 +0000 (15:52 +0100)]
Rollup merge of #47691 - estebank:unknown-lang-item-sp, r=rkruppe

Point at unknown lang item attribute

6 years agoRollup merge of #47679 - etaoins:remove-redundant-backtrace-hint, r=estebank
Guillaume Gomez [Thu, 25 Jan 2018 14:52:13 +0000 (15:52 +0100)]
Rollup merge of #47679 - etaoins:remove-redundant-backtrace-hint, r=estebank

Remove broken redundant backtrace hint

When the compiler driver panics it attempts to show a hint about using `RUST_BACKTRACE`. However, the logic is currently reversed to the hint is only shown if `RUST_BACKTRACE` is **already**   set:

```shell
> RUST_BACKTRACE=1 rustc /dev/null --crate-type proc-macro
error: internal compiler error: unexpected panic
...
note: run with `RUST_BACKTRACE=1` for a backtrace

thread 'rustc' panicked at 'attempt to subtract with overflow', librustc_errors/emitter.rs:287:49
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

> RUST_BACKTRACE=0 rustc /dev/null --crate-type proc-macro
error: internal compiler error: unexpected panic
...
thread 'rustc' panicked at 'attempt to subtract with overflow', librustc_errors/emitter.rs:287:49
note: Run with `RUST_BACKTRACE=1` for a backtrace.
```

As the `panic` itself already has a working `RUST_BACKTRACE` hint just remove the broken duplicate hint entirely.

6 years agoRollup merge of #47609 - ritiek:test-mutating-references, r=nikomatsakis
Guillaume Gomez [Thu, 25 Jan 2018 14:52:12 +0000 (15:52 +0100)]
Rollup merge of #47609 - ritiek:test-mutating-references, r=nikomatsakis

NLL test for mutating &mut references

As mentioned in #46361.

cc @nikomatsakis?

6 years agoRollup merge of #47534 - estebank:suggest-public-traits, r=petrochenkov
Guillaume Gomez [Thu, 25 Jan 2018 14:52:11 +0000 (15:52 +0100)]
Rollup merge of #47534 - estebank:suggest-public-traits, r=petrochenkov

On missing method do not suggest private traits

When encountering a method call for an ADT that doesn't have any
implementation of it, we search for traits that could be implemented
that do have that method. Filter out private non-local traits that would
not be able to be implemented.

This doesn't account for public traits that are in a private scope, but
works as a first approximation and is a more correct behavior than the
current one.

Fix #45781.

6 years agoAuto merge of #47686 - GuillaumeGomez:theme-fixes, r=QuietMisdreavus
bors [Thu, 25 Jan 2018 06:12:06 +0000 (06:12 +0000)]
Auto merge of #47686 - GuillaumeGomez:theme-fixes, r=QuietMisdreavus

Few fixes for multiple themes support feature

r? @QuietMisdreavus

Fixes #47695.

6 years agoAdd tests
Manish Goregaokar [Thu, 25 Jan 2018 04:41:25 +0000 (10:11 +0530)]
Add tests

6 years agoHandle variants
Manish Goregaokar [Wed, 24 Jan 2018 12:05:31 +0000 (17:35 +0530)]
Handle variants

6 years agoUpdate Cargo submodule to master
Alex Crichton [Thu, 25 Jan 2018 04:01:42 +0000 (20:01 -0800)]
Update Cargo submodule to master

Just a routine update

6 years agoAuto merge of #47374 - topecongiro:issue-47096, r=nikomatsakis
bors [Thu, 25 Jan 2018 03:20:54 +0000 (03:20 +0000)]
Auto merge of #47374 - topecongiro:issue-47096, r=nikomatsakis

Simplify irrefutable slice patterns

Closes #47096.

6 years agoUpdate compiler-builtins submodule
Alex Crichton [Wed, 24 Jan 2018 15:47:40 +0000 (07:47 -0800)]
Update compiler-builtins submodule

No sense of urgency, just wanted to make sure we don't lag too far behind!

6 years agoAuto merge of #47006 - bitshifter:stabilize-repr-align, r=eddyb
bors [Thu, 25 Jan 2018 00:26:17 +0000 (00:26 +0000)]
Auto merge of #47006 - bitshifter:stabilize-repr-align, r=eddyb

Stabilized `#[repr(align(x))]` attribute (RFC 1358)

Stabilzed `#[repr(align(x))]` with attr_literal syntax as proposed by @eddyb https://github.com/rust-lang/rust/issues/33626#issuecomment-348467804

6 years agollvm6: Update FreeBSD images to Ubuntu 18.04
Alex Crichton [Tue, 23 Jan 2018 18:25:50 +0000 (10:25 -0800)]
llvm6: Update FreeBSD images to Ubuntu 18.04

Looks like the clang with 16.04 fails to compile LLVM 6, but it looks like clang
in 18.04 can indeed compile LLVM 6.

6 years agoFix wrong span for nested empty groups
Pietro Albini [Wed, 24 Jan 2018 22:32:17 +0000 (23:32 +0100)]
Fix wrong span for nested empty groups

6 years agoFix experimental text display on default theme
Guillaume Gomez [Wed, 24 Jan 2018 18:15:41 +0000 (19:15 +0100)]
Fix experimental text display on default theme

6 years agoAdd powerpc to run-pass/conditional-compile-arch.rs
Marco A L Barbosa [Wed, 24 Jan 2018 17:16:18 +0000 (15:16 -0200)]
Add powerpc to run-pass/conditional-compile-arch.rs

6 years agofix for documentation error issue 47716
evelynmitchell [Wed, 24 Jan 2018 16:25:46 +0000 (09:25 -0700)]
fix for documentation error issue 47716

6 years agollvm6: Don't clone LLVM modules on wasm
Alex Crichton [Wed, 24 Jan 2018 05:59:53 +0000 (21:59 -0800)]
llvm6: Don't clone LLVM modules on wasm

The comment for why cloning exists doesn't actually apply for wasm today and
apparently cloning is causing subtle bugs in LLVM, so let's just avoid it
altogether. More specifically after we emit the assembly for the wasm target we
don't actually use the module again, so there's no need to keep both around.

This seemed to be causing some scary verifier assertions in LLVM which seemed to
be uncovered by presumably (?) buggy behavior. Let's just avoid it for now and
make the wasm target slightly more lean in the process.

6 years agollvm6: Different return value for writeArchive
Alex Crichton [Tue, 23 Jan 2018 01:59:27 +0000 (17:59 -0800)]
llvm6: Different return value for writeArchive

Updated in llvm-mirror/llvm@203c90ba this function now just returns an `Error`,
so this updates the C++ bindings accordingly

6 years agollvm6: Remove MIPS64 archive variant
Alex Crichton [Tue, 23 Jan 2018 01:30:22 +0000 (17:30 -0800)]
llvm6: Remove MIPS64 archive variant

It looks like LLVM also removed it in llvm-mirror/llvm@f45adc29d in favor of the
name "GNU64". This was added in the thought that we'd need such a variant when
adding mips64 support but we ended up not needing it! For now let's just
removing the various support on the Rust side of things.

6 years agollvm6: Tweak fast math intrinsics
Alex Crichton [Tue, 23 Jan 2018 01:28:23 +0000 (17:28 -0800)]
llvm6: Tweak fast math intrinsics

Looks like they did some refactoring of flags in the backend and this should
catch us up! The "unsafe algebra" boolean has been split into a number of
boolean flags for various operations, and this updates to use the `setFast`
function which should hopefully have the same behavior as before.

This was updated in llvm-mirror/llvm@00e900afd

6 years agollvm6: Missing include for LLVM 6 in PassWrapper.cpp
Alex Crichton [Tue, 23 Jan 2018 01:28:09 +0000 (17:28 -0800)]
llvm6: Missing include for LLVM 6 in PassWrapper.cpp

Just bog-standard compile error fixed by adding some new header files

6 years agollvm6: CodeModel::{JIT,}Default no longer exists
Alex Crichton [Tue, 23 Jan 2018 01:01:36 +0000 (17:01 -0800)]
llvm6: CodeModel::{JIT,}Default no longer exists

LLVM has since removed the `CodeModel::Default` enum value in favor of an
`Optional` implementationg throughout LLVM. Let's mirror the same change in Rust
and update the various bindings we call accordingly.

Removed in llvm-mirror/llvm@9aafb854c

6 years agoFix ICE when use trees have multiple empty nested groups
Pietro Albini [Wed, 24 Jan 2018 12:13:39 +0000 (13:13 +0100)]
Fix ICE when use trees have multiple empty nested groups

6 years agoMake it work for traits
Manish Goregaokar [Wed, 24 Jan 2018 11:14:26 +0000 (16:44 +0530)]
Make it work for traits

6 years agoFew fixes for multiple themes support feature
Guillaume Gomez [Tue, 23 Jan 2018 21:10:16 +0000 (22:10 +0100)]
Few fixes for multiple themes support feature

6 years agoMake use of the implemented red/green algorithm for variance
John Kåre Alsaker [Wed, 24 Jan 2018 02:51:02 +0000 (03:51 +0100)]
Make use of the implemented red/green algorithm for variance

6 years agoHandle methods
Manish Goregaokar [Wed, 24 Jan 2018 10:45:36 +0000 (16:15 +0530)]
Handle methods

6 years agoAuto merge of #47300 - remexre:duration-constructors-as-const-fns, r=alexcrichton
bors [Wed, 24 Jan 2018 10:39:25 +0000 (10:39 +0000)]
Auto merge of #47300 - remexre:duration-constructors-as-const-fns, r=alexcrichton

Makes the constructors of Duration const fns.

This affects `Duration::new`, `Duration::from_secs`, `Duration::from_millis`, `Duration::from_micros`, and `Duration::from_nanos`.

6 years agoReturn Def from resolve()
Manish Goregaokar [Wed, 24 Jan 2018 10:27:31 +0000 (15:57 +0530)]
Return Def from resolve()

6 years agoReturn Err() if resolve() is called before modules are set up
Manish Goregaokar [Wed, 24 Jan 2018 10:24:45 +0000 (15:54 +0530)]
Return Err() if resolve() is called before modules are set up

6 years agoFix into() cast paren check precedence
Ryan Cumming [Wed, 24 Jan 2018 09:31:36 +0000 (20:31 +1100)]
Fix into() cast paren check precedence

As discussed in #47699 the logic for determining if an expression needs
parenthesis when suggesting an `.into()` cast is incorrect. Two broken
examples from nightly are:

```
error[E0308]: mismatched types
 --> main.rs:4:10
  |
4 |     test(foo as i8);
  |          ^^^^^^^^^ expected i32, found i8
help: you can cast an `i8` to `i32`, which will sign-extend the source value
  |
4 |     test(foo as i8.into());
  |
```

```
error[E0308]: mismatched types
 --> main.rs:4:10
  |
4 |     test(*foo);
  |          ^^^^ expected i32, found i8
help: you can cast an `i8` to `i32`, which will sign-extend the source value
  |
4 |     test(*foo.into());
  |
```

As suggested by @petrochenkov switch the precedence check to
PREC_POSTFIX. This catches both `as` and unary operators. Fixes #47699.

6 years agoTurn error into warning
Manish Goregaokar [Wed, 24 Jan 2018 08:19:57 +0000 (13:49 +0530)]
Turn error into warning

6 years agoRemove workarounds for cc 1.0.3.
Ed Schouten [Wed, 24 Jan 2018 07:30:17 +0000 (08:30 +0100)]
Remove workarounds for cc 1.0.3.

Now that the Rust codebase depends on cc 1.0.4, there is no longer any
need to specify a compiler for CloudABI manually. Cargo will
automatically call into the right compiler executable.

6 years agoAuto merge of #47299 - cramertj:unsafe-placer, r=alexcrichton
bors [Wed, 24 Jan 2018 07:22:22 +0000 (07:22 +0000)]
Auto merge of #47299 - cramertj:unsafe-placer, r=alexcrichton

Make core::ops::Place an unsafe trait

Consumers of `Place` would reasonably expect that the `pointer` function returns a valid pointer to memory that can actually be written to.

6 years agoPoint at unknown lang item attribute
Esteban Küber [Tue, 23 Jan 2018 23:34:16 +0000 (15:34 -0800)]
Point at unknown lang item attribute

6 years agoAuto merge of #46931 - clarcharr:float_bits_core, r=alexcrichton
bors [Wed, 24 Jan 2018 03:02:15 +0000 (03:02 +0000)]
Auto merge of #46931 - clarcharr:float_bits_core, r=alexcrichton

Expose float from_bits and to_bits in libcore.

These methods have no dependencies on libm and thus should be offered in libcore.

6 years agoAdd ./x.py check src/{libstd,libtest,rustc}.
Mark Simulacrum [Mon, 15 Jan 2018 17:44:00 +0000 (10:44 -0700)]
Add ./x.py check src/{libstd,libtest,rustc}.

This currently only supports a limited subset of the full compilation,
but is likely 90% of what people will want and is possible without
building a full compiler (i.e., running LLVM). In theory, this means
that contributors who don't want to build LLVM now have an easy way to
compile locally, though running tests won't work.

6 years agoRename check.rs to test.rs
Mark Simulacrum [Mon, 15 Jan 2018 17:43:37 +0000 (10:43 -0700)]
Rename check.rs to test.rs

6 years agoAuto merge of #45337 - Zoxc:gen-static, r=nikomatsakis
bors [Tue, 23 Jan 2018 22:50:03 +0000 (22:50 +0000)]
Auto merge of #45337 - Zoxc:gen-static, r=nikomatsakis

Immovable generators

This adds support for immovable generators which allow you to borrow local values inside generator across suspension points. These are declared using a `static` keyword:
```rust
let mut generator = static || {
    let local = &Vec::new();
    yield;
    local.push(0i8);
};
generator.resume();

// ERROR moving the generator after it has resumed would invalidate the interior reference
// drop(generator);
```

Region inference is no longer affected by the types stored in generators so the regions inside should be similar to other code (and unaffected by the presence of `yield` expressions). The borrow checker is extended to pick up the slack so interior references still result in errors for movable generators. This fixes #44197, #45259 and #45093.

This PR depends on [PR #44917 (immovable types)](https://github.com/rust-lang/rust/pull/44917), I suggest potential reviewers ignore the first commit as it adds immovable types.

6 years agorustc: Add `-C lto=val` option
Alex Crichton [Tue, 16 Jan 2018 23:02:31 +0000 (15:02 -0800)]
rustc: Add `-C lto=val` option

This commit primarily adds the ability to control what kind of LTO happens when
rustc performs LTO, namely allowing values to be specified to the `-C lto`
option, such as `-C lto=thin` and `-C lto=fat`. (where "fat" is the previous
kind of LTO, throw everything in one giant module)

Along the way this also refactors a number of fields which store information
about whether LTO/ThinLTO are enabled to unify them all into one field through
which everything is dispatched, hopefully removing a number of special cases
throughout.

This is intended to help mitigate #47409 but will require a backport as well,
and this would unfortunately need to be an otherwise insta-stable option.

6 years agoLet LLVM 5 add DW_OP_deref to indirect args itself
Josh Stone [Tue, 23 Jan 2018 21:53:01 +0000 (13:53 -0800)]
Let LLVM 5 add DW_OP_deref to indirect args itself

We needed to manually added the `DW_OP_deref` ourselves in earlier LLVM,
but starting with [D31439] in LLVM 5, it appears that LLVM will always
handle this itself.  When we were still adding this manually, the
resulting `.debug_loc` had too many derefs, and this failed test
`debuginfo/by-value-self-argument-in-trait-impl.rs`.

[D31439]: https://reviews.llvm.org/D31439

Fixes #47611.
cc @alexcrichton
r? @michaelwoerister

6 years agoRename `-Z explain` to `-Z teach`
Esteban Küber [Tue, 23 Jan 2018 19:34:57 +0000 (11:34 -0800)]
Rename `-Z explain` to `-Z teach`

6 years agoCreate `StructuredDiagnostic`
Esteban Küber [Tue, 23 Jan 2018 02:07:35 +0000 (18:07 -0800)]
Create `StructuredDiagnostic`

Create the concept of an `StructuredDiagnostic` that is self-contained
with enough knowledge of all variables to create a `DiagnosticBuilder`,
including different possible versions (one line output and expanded
explanations).