Commit Graph

74044 Commits

Author SHA1 Message Date
bors
9fd7da904b 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:
2018-01-25 15:27:18 +00:00
Guillaume Gomez
89ff1226e5 Rollup merge of #47729 - alexcrichton:update-cargo, r=sfackler
Update Cargo submodule to master

Just a routine update
2018-01-25 15:52:19 +01:00
Guillaume Gomez
58e56cca56 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
2018-01-25 15:52:18 +01:00
Guillaume Gomez
6f2a0c6f68 Rollup merge of #47721 - GuillaumeGomez:experimental-color, r=QuietMisdreavus
Fix experimental text display on default theme

r? @QuietMisdreavus
2018-01-25 15:52:17 +01:00
Guillaume Gomez
f769b9de02 Rollup merge of #47717 - evelynmitchell:47716-doc-fix, r=steveklabnik
fix for documentation error issue 47716

Fix #47716
2018-01-25 15:52:16 +01:00
Guillaume Gomez
a809da3fee 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
2018-01-25 15:52:15 +01:00
Guillaume Gomez
3a863a3f45 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.
2018-01-25 15:52:15 +01:00
Guillaume Gomez
df55cee0e5 Rollup merge of #47691 - estebank:unknown-lang-item-sp, r=rkruppe
Point at unknown lang item attribute
2018-01-25 15:52:14 +01:00
Guillaume Gomez
bbdc5b9637 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.
2018-01-25 15:52:13 +01:00
Guillaume Gomez
83603b8294 Rollup merge of #47609 - ritiek:test-mutating-references, r=nikomatsakis
NLL test for mutating &mut references

As mentioned in #46361.

cc @nikomatsakis?
2018-01-25 15:52:12 +01:00
Guillaume Gomez
e26aac5a9f 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.
2018-01-25 15:52:11 +01:00
bors
4cf26f8a13 Auto merge of #47686 - GuillaumeGomez:theme-fixes, r=QuietMisdreavus
Few fixes for multiple themes support feature

r? @QuietMisdreavus

Fixes #47695.
2018-01-25 06:12:06 +00:00
Manish Goregaokar
08ca4fd135 Add tests 2018-01-25 10:11:25 +05:30
Manish Goregaokar
c26f8877c7 Handle variants 2018-01-25 10:11:14 +05:30
Alex Crichton
15899b0c12 Update Cargo submodule to master
Just a routine update
2018-01-24 20:02:16 -08:00
bors
247835aacb Auto merge of #47374 - topecongiro:issue-47096, r=nikomatsakis
Simplify irrefutable slice patterns

Closes #47096.
2018-01-25 03:20:54 +00:00
Alex Crichton
54462f5705 Update compiler-builtins submodule
No sense of urgency, just wanted to make sure we don't lag too far behind!
2018-01-24 18:26:27 -08:00
bors
a0a9007f8d 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
2018-01-25 00:26:17 +00:00
Alex Crichton
e9a64996be 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.
2018-01-24 15:34:41 -08:00
Pietro Albini
0847ac0265
Fix wrong span for nested empty groups 2018-01-24 23:46:02 +01:00
Guillaume Gomez
e1e991d3d2 Fix experimental text display on default theme 2018-01-24 19:15:41 +01:00
Marco A L Barbosa
5c5d9ddf64 Add powerpc to run-pass/conditional-compile-arch.rs 2018-01-24 15:16:18 -02:00
evelynmitchell
05652d2ae3
fix for documentation error issue 47716 2018-01-24 09:25:46 -07:00
Alex Crichton
63b3168448 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.
2018-01-24 07:18:02 -08:00
Alex Crichton
caedb36f08 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
2018-01-24 07:18:02 -08:00
Alex Crichton
b6fe1127e4 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.
2018-01-24 07:18:02 -08:00
Alex Crichton
9eeecd2ada 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
2018-01-24 07:18:02 -08:00
Alex Crichton
2a7ed74d96 llvm6: Missing include for LLVM 6 in PassWrapper.cpp
Just bog-standard compile error fixed by adding some new header files
2018-01-24 07:18:01 -08:00
Alex Crichton
03f86ae982 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
2018-01-24 07:18:01 -08:00
Pietro Albini
5faba281ad
Fix ICE when use trees have multiple empty nested groups 2018-01-24 13:13:39 +01:00
Manish Goregaokar
a4d36928fd Make it work for traits 2018-01-24 17:19:18 +05:30
Guillaume Gomez
e78f1392b7 Few fixes for multiple themes support feature 2018-01-24 12:13:52 +01:00
John Kåre Alsaker
62afc43a84 Make use of the implemented red/green algorithm for variance 2018-01-24 12:07:37 +01:00
Manish Goregaokar
5a89f40116 Handle methods 2018-01-24 16:34:47 +05:30
bors
a0dcecff90 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`.
2018-01-24 10:39:25 +00:00
Marco A L Barbosa
cd47ddf24d Update libc 2018-01-24 08:37:33 -02:00
Manish Goregaokar
f0e7677272 Return Def from resolve() 2018-01-24 15:57:31 +05:30
Manish Goregaokar
6b26b7472b Return Err() if resolve() is called before modules are set up 2018-01-24 15:54:50 +05:30
Ryan Cumming
65b1e86aed 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.
2018-01-24 20:31:36 +11:00
Manish Goregaokar
f7ba00c636 Turn error into warning 2018-01-24 13:49:59 +05:30
Ed Schouten
583b382deb 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.
2018-01-24 08:30:17 +01:00
bors
9758ff9c0b 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.
2018-01-24 07:22:22 +00:00
Esteban Küber
e6af9ebea2 Point at unknown lang item attribute 2018-01-23 21:36:40 -08:00
bors
a538fe7ce7 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.
2018-01-24 03:02:15 +00:00
Mark Simulacrum
6aeb1cfb64 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.
2018-01-23 19:39:20 -07:00
Mark Simulacrum
734ee0fb43 Rename check.rs to test.rs 2018-01-23 19:39:20 -07:00
Esteban Küber
3a530baec9 For E0277 on for loops, point at first line
When E0277's span points at a `for` loop, the actual issue is in the
element being iterated. Instead of pointing at the entire loop, point
only at the first line (when possible) so that the span ends in the
element for which E0277 was triggered.
2018-01-23 17:05:12 -08:00
Marco A L Barbosa
9b13e40376 Build musl with -fPIC for all targets 2018-01-23 21:39:17 -02:00
bors
fdecb0564b 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.
2018-01-23 22:50:03 +00:00
Alex Crichton
8bde2acfc7 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.
2018-01-23 14:13:47 -08:00