Commit Graph

4419 Commits

Author SHA1 Message Date
Remy Rakic
f5a74d40d9 Test new placeholder error messages in previously untested combinations 2019-01-27 10:52:43 +01:00
Remy Rakic
a79f135be6 Update test expectations for new placeholder error messages 2019-01-27 10:52:43 +01:00
lqd
ce61b1b9fa Update two E308 tests to the new placeholder error 2019-01-27 10:52:42 +01:00
bors
20c2cba61d Auto merge of #57918 - Centril:rollup, r=Centril
Rollup of 7 pull requests

Successful merges:

 - #57407 (Stabilize extern_crate_self)
 - #57703 (Make MutexGuard's Debug implementation more useful.)
 - #57764 (Fix some minor warnings)
 - #57825 (un-deprecate mem::zeroed)
 - #57827 (Ignore aarch64 in simd-intrinsic-generic-reduction)
 - #57908 (resolve: Fix span arithmetics in the import conflict error)
 - #57913 (Change crate-visibility-modifier issue number in The Unstable Book)

Failed merges:

r? @ghost
2019-01-26 18:14:46 +00:00
Mazdak Farrokhzad
bbe8dd9ca3
Rollup merge of #57908 - petrochenkov:errepice, r=estebank
resolve: Fix span arithmetics in the import conflict error

https://github.com/rust-lang/rust/pull/56937 rebased and fixed

Fixes https://github.com/rust-lang/rust/issues/56411
Fixes https://github.com/rust-lang/rust/issues/57071
Fixes https://github.com/rust-lang/rust/issues/57787

r? @estebank
2019-01-26 18:21:47 +01:00
Mazdak Farrokhzad
5e6c2f40d0
Rollup merge of #57407 - mehcode:stabilize-extern-crate-self, r=Centril
Stabilize extern_crate_self

Fixes #56409
2019-01-26 18:21:41 +01:00
bors
46a43dc1e9 Auto merge of #57852 - davidtwco:issue-57819, r=estebank
Suggest removing leading left angle brackets.

Fixes #57819.

This PR adds errors and accompanying suggestions as below:

```
bar::<<<<<T as Foo>::Output>();
     ^^^ help: remove extra angle brackets
```

r? @estebank
2019-01-26 15:33:43 +00:00
bors
42eb5ff404 Auto merge of #55641 - nagisa:optimize-attr, r=pnkfelix
Implement optimize(size) and optimize(speed) attributes

This PR implements both `optimize(size)` and `optimize(speed)` attributes.

While the functionality itself works fine now, this PR is not yet complete: the code might be messy in places and, most importantly, the compiletest must be improved with functionality to run tests with custom optimization levels. Otherwise the new attribute cannot be tested properly. Oh, and not all of the RFC is implemented – attribute propagation is not implemented for example.

# TODO

* [x] Improve compiletest so that tests can be written;
* [x] Assign a proper error number (E9999 currently, no idea how to allocate a number properly);
* [ ] Perhaps reduce the duplication in LLVM attribute assignment code…
2019-01-26 07:08:18 +00:00
bors
37d51aa8f3 Auto merge of #57898 - Centril:rollup, r=Centril
Rollup of 5 pull requests

Successful merges:

 - #56233 (Miri and miri-related code contains repetitions of `(n << amt) >> amt`)
 - #57645 (distinguish "no data" from "heterogeneous" in ABI)
 - #57734 (Fix evaluating trivial drop glue in constants)
 - #57886 (Add suggestion for moving type declaration before associated type bindings in generic arguments.)
 - #57890 (Fix wording in diagnostics page)

Failed merges:

r? @ghost
2019-01-25 23:27:20 +00:00
Vadim Petrochenkov
1b659d69bc Address review comments and cleanup code 2019-01-26 01:49:55 +03:00
François Mockers
ac4b685650 #56411 do not suggest a fix for a import conflict in a macro 2019-01-25 22:39:14 +03:00
Simonas Kazlauskas
ce289c6c99 Resolve breakage 2019-01-25 19:20:38 +02:00
Mazdak Farrokhzad
7768358e72
Rollup merge of #57886 - davidtwco:issue-57385, r=estebank
Add suggestion for moving type declaration before associated type bindings in generic arguments.

Fixes #57385.

r? @estebank
2019-01-25 16:59:29 +01:00
Mazdak Farrokhzad
141fa859b8
Rollup merge of #57734 - oli-obk:fixes_and_cleanups, r=pnkfelix
Fix evaluating trivial drop glue in constants

```rust
struct A;
impl Drop for A {
    fn drop(&mut self) {}
}

const FOO: Option<A> = None;

const BAR: () = (FOO, ()).1;
```

was erroring with

```
error: any use of this value will cause an error
 --> src/lib.rs:9:1
  |
9 | const BAR: () = (FOO, ()).1;
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^-^
  |                           |
  |                           calling non-const function `std::ptr::real_drop_in_place::<(std::option::Option<A>, ())> - shim(Some((std::option::Option<A>, ())))`
  |
  = note: #[deny(const_err)] on by default

error: aborting due to previous error
```

before this PR. According to godbolt this last compiled successfully in 1.27
2019-01-25 16:59:27 +01:00
Mazdak Farrokhzad
7779bb9907
Rollup merge of #57645 - nikomatsakis:issue-56877-abi-aggregates, r=eddyb
distinguish "no data" from "heterogeneous" in ABI

Ignore zero-sized types when computing whether something is a homogeneous aggregate, except be careful of VLA.

cc #56877

r? @arielb1
cc @eddyb
2019-01-25 16:59:26 +01:00
Niko Matsakis
8e4c57fca2 distinguish "no data" from "heterogeneous" for ABI purposes
Also, add a testing infrastructure and tests that lets us dump layout.
2019-01-25 10:03:47 -05:00
bors
0b1669d96c Auto merge of #57714 - matthewjasper:wellformed-unreachable, r=pnkfelix
[NLL] Clean up handling of type annotations

* Renames (Canonical)?UserTypeAnnotation -> (Canonical)?UserType so that the name CanonicalUserTypeAnnotation is free.
* Keep the inferred type associated to user type annotations in the MIR, so that it can be compared against the annotated type, even when the annotated expression gets removed from the MIR. (#54943)
* Use the inferred type to allow infallible handling of user type projections (#57531)
* Uses revisions for the tests in #56993
* Check the types of `Unevaluated` constants with no annotations (#46702)
* Some drive-by cleanup

Closes #46702
Closes #54943
Closes #57531
Closes #57731
cc #56993 leaving this open to track the underlying issue: we are not running tests with full NLL enabled on CI at the moment

r? @nikomatsakis
2019-01-25 14:25:37 +00:00
Felix S. Klock II
620a03f5aa Unit test from #57866. 2019-01-25 15:19:37 +01:00
David Wood
7a0abbff8b
Combining move lifetime and type suggestions.
This commit combines the move lifetime and move type suggestions so that
when rustfix applies them they don't conflict with each other.
2019-01-25 11:54:21 +01:00
David Wood
463e623ca9
Suggestion moving types before associated types.
This commit extends existing suggestions to move lifetimes before types
in generic arguments to also suggest moving types behind associated type
bindings.
2019-01-25 11:15:16 +01:00
Oliver Scherer
506393eaaf Add a compile-fail test for Drop in constants in the presence of Options 2019-01-25 09:54:25 +01:00
Mazdak Farrokhzad
a9950f6a45
Rollup merge of #57802 - davidtwco:issue-56943, r=estebank
Print visible name for types as well as modules.

Fixes #56943 and fixes #57713.

This commit extends previous work in #55007 where the name from the
visible parent was used for modules. Now, we also print the name from
the visible parent for types.

r? @estebank
2019-01-25 01:37:02 +01:00
Mazdak Farrokhzad
f20c6c8581
Rollup merge of #57294 - estebank:point-copy-less, r=nikomatsakis
When using value after move, point at span of local

When trying to use a value after move, instead of using a note, point
at the local declaration that has a type that doesn't implement `Copy`
trait.

```
error[E0382]: use of moved value: `x`
  --> $DIR/issue-34721.rs:27:9
   |
LL |     pub fn baz<T: Foo>(x: T) -> T {
   |                -       - move occurs because `x` has type `T`, which does not implement the `Copy` trait
   |                |
   |                consider adding a `Copy` constraint to this type argument
LL |         if 0 == 1 {
LL |             bar::bar(x.zero())
   |                      - value moved here
LL |         } else {
LL |             x.zero()
   |             - value moved here
LL |         };
LL |         x.zero()
   |         ^ value used here after move
```

Fix #34721.
2019-01-25 01:36:59 +01:00
bors
278067d34d Auto merge of #57879 - Centril:rollup, r=Centril
Rollup of 9 pull requests

Successful merges:

 - #57380 (Fix Instant/Duration math precision & associativity on Windows)
 - #57606 (Get rid of the fake stack frame for reading from constants)
 - #57803 (Several changes to libunwind for SGX target)
 - #57846 (rustdoc: fix ICE from loading proc-macro stubs)
 - #57860 (Add os::fortanix_sgx::ffi module)
 - #57861 (Don't export table by default in wasm)
 - #57863 (Add suggestion for incorrect field syntax.)
 - #57867 (Fix std::future::from_generator documentation)
 - #57873 (Stabilize no_panic_pow)

Failed merges:

r? @ghost
2019-01-24 21:23:11 +00:00
Esteban Küber
baa0828ee3 Fix --compare-mode=nll tests 2019-01-24 10:53:43 -08:00
Esteban Küber
29e8e63c84 review comments 2019-01-24 10:36:50 -08:00
Esteban Küber
0e2d6e0175 Point at type argument suggesting adding Copy constraint 2019-01-24 10:36:50 -08:00
Esteban Küber
e0a606c6a9 Add test for #34721 2019-01-24 10:36:50 -08:00
Esteban Küber
5e9c8d7369 When using value after move, point at span of local
When trying to use a value after move, instead of using a note, point
at the local declaration that has a type that doesn't implement `Copy`
trait.
2019-01-24 10:36:50 -08:00
Simonas Kazlauskas
89e34d3e32 Add a feature gate test for #[optimize] 2019-01-24 20:13:51 +02:00
Mazdak Farrokhzad
1a3b3d4298
Rollup merge of #57863 - davidtwco:issue-57684, r=estebank
Add suggestion for incorrect field syntax.

Fixes #57684.

This commit adds a suggestion when a `=` character is used when
specifying the value of a field in a struct constructor incorrectly
instead of a `:` character.

r? @estebank
2019-01-24 18:25:49 +01:00
Mazdak Farrokhzad
8348f83388
Rollup merge of #57606 - oli-obk:shrink, r=RalfJung
Get rid of the fake stack frame for reading from constants

r? @RalfJung

fixes the ice in https://github.com/rust-lang/rust/issues/53708 but still keeps around the wrong "non-exhaustive match" error

cc @varkor
2019-01-24 18:25:43 +01:00
bors
01f8e25b15 Auto merge of #51285 - Mark-Simulacrum:remove-quote_apis, r=Manishearth
Remove quote_*! macros

This deletes a considerable amount of test cases, some of which we may want to keep. I'm not entirely certain what the primary intent of many of them was; if we should keep them I can attempt to edit each case to continue compiling without the quote_*! macros involved.

Fixes #46849.
Fixes #12265.
Fixes #12266.
Fixes #26994.

r? @Manishearth
2019-01-24 15:48:46 +00:00
Mark Simulacrum
db97c48ad6 Remove quote_*! macros and associated APIs 2019-01-24 07:37:34 -07:00
bors
095b44c83b Auto merge of #57269 - gnzlbg:simd_bitmask, r=rkruppe
Add intrinsic to create an integer bitmask from a vector mask

This PR adds a new simd intrinsic: `simd_bitmask(vector) -> unsigned integer` that creates an integer bitmask from a vector mask by extracting one bit of each vector lane.

This is required to implement: https://github.com/rust-lang-nursery/packed_simd/issues/166 .

EDIT: the reason we need an intrinsics for this is that we have to truncate the vector lanes to an `<i1 x N>` vector, and then bitcast that to an `iN` integer (while making sure that we only materialize `i8`, ... , `i64` - that is, no `i1`, `i2`, `i4`, types), and we can't do any of that in a Rust library.

r? @rkruppe
2019-01-24 13:11:06 +00:00
Mazdak Farrokhzad
d17f62d857
Rollup merge of #57836 - oli-obk:existential_crisis, r=estebank
Fix some cross crate existential type ICEs

fixes #53443
2019-01-24 00:19:59 +01:00
Mazdak Farrokhzad
5749bac989
Rollup merge of #57834 - SimonSapin:type_id, r=Centril
Stabilize Any::get_type_id and rename to type_id

FCP: https://github.com/rust-lang/rust/issues/27745#issuecomment-373906749

Closes https://github.com/rust-lang/rust/issues/27745.
2019-01-24 00:19:58 +01:00
Mazdak Farrokhzad
b5447b50b0
Rollup merge of #57817 - davidtwco:issue-54521, r=estebank
Add error for trailing angle brackets.

Fixes #54521.

This PR adds a error (and accompanying machine applicable
suggestion) for trailing angle brackets on function calls with a
turbofish.

r? @estebank
2019-01-24 00:19:57 +01:00
Mazdak Farrokhzad
da182a0fe7
Rollup merge of #57795 - estebank:did-you-mean, r=zackmdavis
Use structured suggestion in stead of notes
2019-01-24 00:19:55 +01:00
Mazdak Farrokhzad
8ef8d57029
Rollup merge of #57793 - estebank:impl-trait-resolve, r=oli-obk
Explain type mismatch cause pointing to return type when it is `impl Trait`

Fix #57743.
2019-01-24 00:19:54 +01:00
Mazdak Farrokhzad
2dd63a2e10
Rollup merge of #57779 - estebank:recover-struct-fields, r=davidtwco
Recover from parse errors in literal struct fields and incorrect float literals

Fix #52496.
2019-01-24 00:19:53 +01:00
David Wood
f14d007ee4
Add suggestion for incorrect field syntax.
This commit adds a suggestion when a `=` character is used when
specifying the value of a field in a struct constructor incorrectly
instead of a `:` character.
2019-01-23 23:40:58 +01:00
Oliver Scherer
5d6faf7b4a Remove unused feature gates 2019-01-23 11:34:58 +01:00
David Wood
22f794b00f
Suggest removing leading left angle brackets.
This commit adds errors and accompanying suggestions as below:

```
bar::<<<<<T as Foo>::Output>();
     ^^^ help: remove extra angle brackets
```
2019-01-23 11:25:45 +01:00
bors
6bba352cad Auto merge of #57835 - pnkfelix:issue-57673-remove-leaky-nested-probe, r=arielb1
typeck: remove leaky nested probe during trait object method resolution

addresses #57673  (but not marking with f-x because thats now afflicting beta channel).

Fix #57216
2019-01-22 23:02:38 +00:00
Oliver Scherer
2c57d1d256 Add regression test 2019-01-22 17:22:30 +01:00
Oliver Scherer
a59eabbc36 Get rid of the fake stack frame 2019-01-22 17:22:29 +01:00
Oliver Scherer
26edb28d31 Fix some cross crate existential type ICEs 2019-01-22 16:08:00 +01:00
Felix S. Klock II
33c2ceb3a2 unit test for issue 57673. 2019-01-22 14:49:18 +01:00
bors
ad30e9a681 Auto merge of #57830 - Centril:rollup, r=Centril
Rollup of 9 pull requests

Successful merges:

 - #57537 (Small perf improvement for fmt)
 - #57552 (Default images)
 - #57604 (Make `str` indexing generic on `SliceIndex`.)
 - #57667 (Fix memory leak in P::filter_map)
 - #57677 (const_eval: Predetermine the layout of all locals when pushing a stack frame)
 - #57791 (Add regression test for #54582)
 - #57798 (Corrected spelling inconsistency)
 - #57809 (Add powerpc64-unknown-freebsd)
 - #57813 (fix validation range printing when encountering undef)

Failed merges:

r? @ghost
2019-01-22 13:40:01 +00:00