Commit Graph

72422 Commits

Author SHA1 Message Date
Vadim Petrochenkov 3a2ad576c5 Remove NOTE/HELP annotations from error index tests 2017-12-14 23:23:07 +03:00
bors 2974104276 Auto merge of #45002 - oli-obk:miri, r=eddyb
Validate miri against the HIR const evaluator

r? @eddyb

cc @alexcrichton @arielb1 @RalfJung

The interesting parts are the last few functions in `librustc_const_eval/eval.rs`

* We warn if miri produces an error while HIR const eval does not.
* We warn if miri produces a value that does not match the value produced by HIR const eval
* if miri succeeds and HIR const eval fails, nothing is emitted, but we still return the HIR error
* if both error, nothing is emitted and the HIR const eval error is returned

So there are no actual changes, except that miri is forced to produce the same values as the old const eval.

* This does **not** touch the const evaluator in trans at all. That will come in a future PR.
* This does **not** cause any code to compile that didn't compile before. That will also come in the future

It would be great if someone could start a crater run if travis passes
2017-12-14 15:37:39 +00:00
Oliver Schneider 7a2bff7f1a
Do not produce debuginfo for tools 2017-12-14 15:40:51 +01:00
bors 8624ea5117 Auto merge of #46335 - oli-obk:cleanups, r=jseyfried
Use PathBuf instead of String where applicable

r? @jseyfried
2017-12-14 12:50:00 +00:00
Oliver Schneider 1ba46dc378
Move mir validation out of tree 2017-12-14 11:36:28 +01:00
Oliver Schneider d732da813b
Use PathBuf instead of String where applicable 2017-12-14 11:22:08 +01:00
bors 75a02a919c Auto merge of #46633 - estebank:arg-mismatch, r=arielb1
Point at whole method call instead of args

To avoid confusion in cases where the code is

```rust
fn foo() {}
/ foo(
|     bar()
|     ^^^ current diagnostics point here for arg count mismatch
| );
|_^ new diagnostic span points here
```

as this leads to confusion making people think that the diagnostic is
talking about `bar`'s arg count, not `foo`'s.

Point at `fn`s definition on arg mismatch, just like we do for closures.

Re #42855, Fix #45633.
2017-12-14 10:08:48 +00:00
bors 8954b16beb Auto merge of #46605 - estebank:macro-backtrace-spans, r=pnkfelix
Use spans for -Z external-macro-backtrace

```
% rustc ui/type-check/cannot_infer_local_or_vec.rs -Z external-macro-backtrace
error[E0282]: type annotations needed
  --> <vec macros>:3:1
   |
1  | / ( $ elem : expr ; $ n : expr ) => (
2  | | $ crate :: vec :: from_elem ( $ elem , $ n ) ) ; ( $ ( $ x : expr ) , * ) => (
3  | | < [ _ ] > :: into_vec ( box [ $ ( $ x ) , * ] ) ) ; ( $ ( $ x : expr , ) * )
   | | ^^^^^^^^^^^^^^^^^^^^^
   | | |
   | | cannot infer type for `T`
4  | | => ( vec ! [ $ ( $ x ) , * ] )
   | |______________________________- in this expansion of `vec!`
   |
  ::: ui/type-check/cannot_infer_local_or_vec.rs
   |
12 |       let x = vec![];
   |           -   ------ in this macro invocation
   |           |
   |           consider giving `x` a type

error: aborting due to previous error
```
2017-12-14 07:06:02 +00:00
bors f03e06762e Auto merge of #46582 - nikomatsakis:nll-master-to-rust-master-4, r=arielb1
make MIR type checker handle a number of other cases

The existing type checker was primarily used to verify types, but was skipping over a number of details. For example, it was not checking that the predicates on functions were satisfied and so forth. This meant that the NLL region checker was not getting a lot of the constraints it needed. This PR closes those gaps. It also includes a bit of refactoring for the way that we store region values, encapsulating the bit matrix over into its own module and improving the data structures in use.

This is mostly work by @spastorino being ported over from nll-master.

r? @arielb1 or @pnkfelix
2017-12-14 04:32:14 +00:00
bors 0142781ad1 Auto merge of #46708 - pnkfelix:fix-issue-46112, r=arielb1
Fix visible_parent_map to choose globally minimal paths

Fix #46112: visible_parent_map construction needs a BFS over whole crate forest to get globally minimal paths.

(There are other latent bugs that were e.g. causing this test case to have weirdness like `<unnamed>` in the diagnostic output. Those bugs are not fixed here, since they are issues long-standing in the stable channel.)
2017-12-13 23:43:56 +00:00
bors f8af59d952 Auto merge of #46715 - kennytm:download-crosstool-ng-from-github, r=TimNN
Download crosstool-ng from GitHub

Workaround the current problem where http://crosstool-ng.org was done, causing all non-x86 jobs to fail spuriously (cc #40474).

If http://crosstool-ng.org becomes online before this PR is merged, this PR should be closed and the tree should be reopened.
2017-12-13 20:55:53 +00:00
kennytm bf0653ea8e
Download the crosstool from GitHub instead of crosstool-ng.org
Temporary workaround since crosstool-ng.org was down. Consider mirroring
the release tarball as a more permanent solution.
2017-12-14 04:50:13 +08:00
Esteban Küber d4b8e99540 Move error checks out of span for easier to follow `.stderr` 2017-12-13 11:27:18 -08:00
Niko Matsakis 237dd41211 correct comment in test 2017-12-13 12:20:29 -05:00
Niko Matsakis 51847a1b18 add FIXME related to constant well-formedness 2017-12-13 12:20:28 -05:00
Niko Matsakis abd6d0d76e comments for `defining_ty` and `compute_indices`
Plus an extra assertion.
2017-12-13 12:20:28 -05:00
Niko Matsakis 75ac071cd6 document return value of `add_live_point` 2017-12-13 12:20:28 -05:00
Niko Matsakis f6723a9592 improve comments on `safe_to_unsafe_fn_ty` and `coerce_closure_fn_ty` 2017-12-13 12:20:28 -05:00
Niko Matsakis 7a20a3f161 change to use an O(1) data structure for looking up point indices
Converting a `RegionElementIndex` to a `Location` is O(n) though could
trivially be O(log n), but we don't do it that much anyhow -- just on
error and debugging.
2017-12-13 12:20:28 -05:00
Niko Matsakis 77663a677d refactor region value bitmatrix 2017-12-13 12:20:27 -05:00
Niko Matsakis a30e2259da fix closure tests now that MIR typeck works properly
These tests had FIXMEs for errors that were not previously being
reported.
2017-12-13 12:20:27 -05:00
bors 3dfbc88a62 Auto merge of #46550 - jseyfried:cleanup_builtin_hygiene, r=nrc
macros: hygienize use of `core`/`std` in builtin macros

Today, if a builtin macro wants to access an item from `core` or `std` (depending `#![no_std]`), it generates `::core::path::to::item` or `::std::path::to::item` respectively (c.f. `fn std_path()` in `libsyntax/ext/base.rs`).

This PR refactors the builtin macros to instead always emit `$crate::path::to::item` here. That is, the def site of builtin macros is taken to be in `extern crate core;` or `extern crate std;`. Since builtin macros are macros 1.0 (i.e. mostly unhygienic), changing the def site can only effect the resolution of `$crate`.

r? @nrc
2017-12-13 11:09:55 +00:00
Niko Matsakis decbbb3fc0 when reifying a safe fn as an unsafe fn ptr, insert two casts
Otherwise, `run-pass/typeck-fn-to-unsafe-fn-ptr.rs` fails the MIR type checker.
2017-12-13 06:03:28 -05:00
Niko Matsakis d5cff0740f normalize fn sig as part of reification 2017-12-13 06:03:28 -05:00
Santiago Pastorino 0c26d8fcd1 Mir typeck Cast for Unsize value 2017-12-13 06:03:28 -05:00
Santiago Pastorino 14700e58b4 Mir typeck Cast for ClosureFnPtr value 2017-12-13 06:03:27 -05:00
Santiago Pastorino ae035cb731 Extract coerce_closure_fn_ty function 2017-12-13 06:03:27 -05:00
Santiago Pastorino 900d4d5bda Mir typeck Cast for UnsafeFnPtr value 2017-12-13 06:03:27 -05:00
Santiago Pastorino 7d56131e83 Mir typeck Cast for ReifyFnPtr value 2017-12-13 06:03:27 -05:00
Santiago Pastorino 86355480bd Restructure a bit check_aggregate_rvalue code 2017-12-13 06:03:27 -05:00
Santiago Pastorino 4449240d1e Add more debug logs 2017-12-13 06:03:26 -05:00
Santiago Pastorino 688ab5af81 Check functions predicates 2017-12-13 06:03:26 -05:00
Santiago Pastorino 5010496677 Check Aggregate predicates 2017-12-13 06:03:26 -05:00
Santiago Pastorino c9159262d1 Check NullaryOp Rvalue 2017-12-13 06:03:26 -05:00
Niko Matsakis 7f20b9142d fix universal regions to handle constant expressions like `[T; 22]` 2017-12-13 06:03:25 -05:00
Santiago Pastorino d6772cb972 Check Repeat Rvalue 2017-12-13 06:03:25 -05:00
bors 61100840e5 Auto merge of #46419 - jseyfried:all_imports_in_metadata, r=nrc
Record all imports (`use`, `extern crate`) in the crate metadata

This PR adds non-`pub` `use` and `extern crate` imports in the crate metadata since hygienic macros invoked in other crates may use them. We already include all other non-`pub` items in the crate metadata. This improves import suggestions in some cases.

Fixes #42337.

r? @nrc
2017-12-13 08:32:25 +00:00
Jeffrey Seyfried 85d19b3335 Improve pretty printing `$crate::` paths. 2017-12-12 22:32:19 -08:00
Felix S. Klock II 35bcd9913e Regression test for issue #46112. 2017-12-12 23:18:53 -06:00
bors dcf3db47c7 Auto merge of #46616 - cramertj:impl-trait-elision, r=nikomatsakis
Implement impl Trait lifetime elision

Fixes #43396.

There's one weird ICE in the interaction with argument-position `impl Trait`. I'm still debugging it-- I've left a test for it commented out with a FIXME.

Also included a FIXME to ensure that `impl Trait` traits are caught under the lint in https://github.com/rust-lang/rust/issues/45992.

r? @nikomatsakis
2017-12-13 04:19:26 +00:00
bors 691f022767 Auto merge of #46613 - petrochenkov:absext, r=nikomatsakis
Resolve absolute paths as extern under a feature flag

cc https://github.com/rust-lang/rust/issues/44660
r? @nikomatsakis
2017-12-13 01:44:36 +00:00
Felix S. Klock II 43406d2681 Fix #46112: visible_parent_map construction needs a BFS over whole crate forest. 2017-12-12 19:06:19 -06:00
bors 442b7bd10a Auto merge of #46570 - AgustinCB:issue-46553, r=oli-obk
Ignore `unsopported constant expr` error

Fixes #46553
2017-12-12 23:08:56 +00:00
Jeffrey Seyfried f79c7e442d Refactor `MarkData` field `modern: bool` to `kind: MarkKind`. 2017-12-12 13:15:09 -08:00
Jeffrey Seyfried 8dbe79ae5e Fix fallout in tests. 2017-12-12 13:15:03 -08:00
Vadim Petrochenkov b07e26e36e Resolve absolute paths as extern under a feature flag 2017-12-13 00:02:23 +03:00
Vadim Petrochenkov 9552b9cfd2 rustc_metadata: Refactor away `ExternCrateInfo` 2017-12-12 23:50:35 +03:00
bors 6a36019440 Auto merge of #46696 - kennytm:rollup, r=kennytm
Rollup of 4 pull requests

- Successful merges: #46668, #46672, #46691, #46694
- Failed merges:
2017-12-12 20:31:17 +00:00
kennytm 80d1de97ad Rollup merge of #46694 - kennytm:temporarily-use-old-travis-image, r=aidanhs
Temporarily use the old Travis image.

Use it until travis-ci/travis-ci#8891 is fixed.

(See also https://blog.travis-ci.com/2017-12-12-new-trusty-images-q4-launch)

r? @aidanhs
2017-12-13 04:28:09 +08:00
kennytm 37cc63ab13 Rollup merge of #46691 - varkor:contrib-3, r=rkruppe
Fix return value of `LLVMRustMetadataAsValue`

`LLVMRustMetadataAsValue` would previously return `void`, despite the
corresponding Rust function expecting to return a `ValueRef`.
2017-12-13 04:28:08 +08:00