Commit Graph

4976 Commits

Author SHA1 Message Date
Mazdak Farrokhzad 3b19dc96fc
Rollup merge of #60066 - sfackler:type-name, r=Centril
Stabilize the type_name intrinsic in core::any

Stabilize `type_name` in `core::any`.

Closes rust-lang/rfcs#1428

FCP completed over there.

`RELEASES.md`: Prefer T-libs for categorization.
2019-07-25 23:20:49 +02:00
Steven Fackler 91fa898975 Stabilize the type_name intrinsic in core::any
Closes rust-lang/rfcs#1428
2019-07-24 21:35:49 -07:00
Mazdak Farrokhzad 5a7db0e19a
Rollup merge of #62901 - petrochenkov:serde, r=Centril
cleanup: Remove `extern crate serialize as rustc_serialize`s
2019-07-25 01:05:03 +02:00
Mazdak Farrokhzad a676a36662
Rollup merge of #62736 - lqd:polonius_tests3, r=matthewjasper
Polonius: fix some cases of `killed` fact generation, and most of the `ui` test suite

Since basic Polonius functionality was re-enabled by @matthewjasper in #54468, some tests were still failing in the polonius compare-mode.

This PR fixes all but one test in the `ui` suite by:
- fixing some bugs in the fact generation code, related to the `killed` relation: Polonius would incorrectly reject some NLL-accepted code, because of these missing `killed` facts.
- ignoring some tests in the polonius compare-mode: a lot of those manually test the NLL or migrate mode, and the failures were mostly artifacts of the test revisions, e.g. that `-Z polonius` requires full NLLs. Some others were also both failing with NLL and succeeding with Polonius, which we can't encode in tests at the moment.
- blessing the output of some tests: whenever Polonius and NLL have basically the same errors, except for diagnostics differences, the Polonius output is blessed. Whenever we've advanced into a less experimental phase, we'll want to revisit these cases (much like we did on the NLL test suite last year) to specifically work on diagnostics.

Fact generation changes:
- we now kill loans on the destination place of `Call` terminators
- we now kill loans on the locals destroyed by `StorageDead`
- we now also handle assignments to projections: killing the loans on a either a deref-ed local, or the ones whose `borrowed_place` conflicts with the current place.

One failing test remains: an overflow during fact generation, on a case of polymorphic recursion (and which I'll continue investigating later).

This adds some tests for the fact generation changes, with some simple Polonius cases similar to the existing smoke tests, but also for some cases encountered in the wild (in the `rand` crate for example).

A more detailed write-up is available [here](https://hackmd.io/CjYB0fs4Q9CweyeTdKWyEg?view) with an explanation for each test failure, the steps taken to resolve it (as a commit in the current PR), NLL and Polonius outputs (and diff), etc.

Since they've worked on this before, and we've discussed some of these failures together:

r? @matthewjasper
2019-07-25 01:04:55 +02:00
Ralf Jung 495f9509fe use PanicMessage type for MIR assertion errors 2019-07-24 10:24:55 +02:00
Ralf Jung c0420b1a59 do not use InterpError::description outside librustc::mir 2019-07-24 09:12:21 +02:00
Mark Rousskov b2155dd747
Rollup merge of #62859 - spastorino:rename-to-as-ref, r=Centril
Place::as_place_ref is now Place::as_ref

r? @oli-obk
2019-07-23 12:51:16 -04:00
Mark Rousskov 52e9e44c7f
Rollup merge of #60951 - saleemjaffer:mir_better_error_enum, r=oli-obk
more specific errors in src/librustc/mir/interpret/error.rs

Implements [this](https://github.com/rust-rfcs/const-eval/issues/4)
2019-07-23 12:51:02 -04:00
Vadim Petrochenkov 614037171b cleanup: Remove `extern crate serialize as rustc_serialize`s 2019-07-23 19:20:16 +03:00
Saleem Jaffer 3730ed9e5b renames EvalErrorPanic to PanicMessage 2019-07-23 16:42:46 +05:30
Saleem Jaffer 90426ed642 moving some variants from InterpError to EvalErrorPanic 2019-07-23 13:37:04 +05:30
lqd 2f3e36f51a Polonius: generate `killed` facts for assignments to projections 2019-07-22 12:46:53 +02:00
lqd 6d9a4f9783 Polonius facts: kill loans on Call terminators and StorageDead 2019-07-22 11:36:42 +02:00
Santiago Pastorino 795d96d87b Place::as_place_ref is now Place::as_ref 2019-07-22 00:25:07 +02:00
Saleem Jaffer fd352b02e1 alters the panic variant of InterpError 2019-07-20 11:48:16 +05:30
Santiago Pastorino a8ceeeb5a0 Avoid cloning Place in check_and_patch 2019-07-20 05:08:39 +02:00
Santiago Pastorino b59ded8ae0 Avoid cloning Place in visit_rvalue 2019-07-20 05:08:39 +02:00
Santiago Pastorino 7789cbf700 Avoid cloning Place in assign #2 2019-07-20 05:08:39 +02:00
Santiago Pastorino b490032893 Avoid cloning Place in assign #1 2019-07-20 05:08:39 +02:00
Santiago Pastorino 2a7d600ee0 Avoid cloning Place in in_projection_structurally 2019-07-20 05:08:39 +02:00
Santiago Pastorino 7b456df4ab Avoid cloning Place in is_stable 2019-07-20 05:08:39 +02:00
Santiago Pastorino 17a465cb85 Avoid unneeded else branches 2019-07-20 05:08:39 +02:00
Santiago Pastorino 9b549d3c9d Avoid cloning Place in gather_init 2019-07-20 05:08:39 +02:00
Santiago Pastorino d77653e88b Avoid cloning Place in calculate_fake_borrows 2019-07-20 05:08:39 +02:00
Santiago Pastorino 2ffd3c64f9 Avoid cloning Place in limit_capture_mutability 2019-07-20 05:08:39 +02:00
Santiago Pastorino 10470797a6 Avoid cloning Place in report_cannot_move_from_borrowed_content 2019-07-20 05:08:39 +02:00
Santiago Pastorino 09014fc793 Avoid cloning Place in report_cannot_move_from_static 2019-07-20 05:08:39 +02:00
Santiago Pastorino 95e727a5c3 Avoid cloning Place in check_access_permissions 2019-07-20 05:08:39 +02:00
Santiago Pastorino 34e3b7076c Avoid cloning Place in append_place_to_string 2019-07-20 05:08:39 +02:00
Santiago Pastorino 72251d5595 Avoid cloning Place in classify_drop_access_kind 2019-07-20 05:08:39 +02:00
Santiago Pastorino 75c0c8c6dc Avoid cloning Place in describe_place_for_conflicting_borrow 2019-07-20 05:08:39 +02:00
Santiago Pastorino 46f81fc53d Avoid cloning Place in report_use_of_moved_or_uninitialized and friends 2019-07-20 05:08:39 +02:00
Santiago Pastorino ec65db07ef Remove explicit lifetime 2019-07-20 05:08:39 +02:00
Santiago Pastorino d0accade3e Migrate from Place enum to Place struct 2019-07-20 05:08:38 +02:00
bors a3369981de Auto merge of #61749 - davidtwco:rfc-2203-const-array-repeat-exprs, r=eddyb
rustc/rustc_mir: Implement RFC 2203.

This PR implements RFC 2203, allowing constants in array repeat
expressions. Part of #49147.

r? @eddyb
2019-07-18 20:41:40 +00:00
bors 4ed008a420 Auto merge of #62682 - alessandrod:issue-58375, r=eddyb
Normalize type parameters in create_mono_items_for_default_impls.

Fix for https://github.com/rust-lang/rust/issues/58375. I've added a test in `src/tests/run-pass` to reproduce the bug, not sure that's the best place for it.

See https://github.com/rust-lang/rust/issues/58375#issuecomment-509156977 for more context.
2019-07-18 13:09:01 +00:00
bors d36b7f6944 Auto merge of #62322 - wesleywiser:promoted_query, r=oli-obk
Add a query to get the `promoted`s for a `mir::Body`

This is a builidng block toward removing a lot of duplicated code
between miri and the cosnt-propagator pass.

See this thread for more info:
https://rust-lang.zulipchat.com/#narrow/stream/189540-t-compiler.2Fwg-mir-opt/topic/Using.20.60InterpCx.60.20more/near/169030661

r? @spastorino but feel free to hand it off to somebody else
2019-07-16 12:19:35 +00:00
Mark Rousskov 83ead58917
Rollup merge of #62680 - ecstatic-morse:fix-dataflow-results-consumer, r=matthewjasper
Actually call `visit_block_entry` in `DataflowResultsConsumer`

This fixes a trivial bug in `DataflowResultsConsumer`: `visit_block_entry` is never called when visiting dataflow results.

A previous version of #62547 used this API and included this fix, but it has since switched to `DataflowResultsCursor` making this commit irrelevant.
2019-07-15 19:55:12 -04:00
Mark Rousskov 879c610557
Rollup merge of #62673 - RalfJung:validity-msg, r=oli-obk
miri validation: better error messages for dangling references

Cc @oli-obk
2019-07-15 19:55:11 -04:00
Mark Rousskov 99e7328d13
Rollup merge of #62405 - hellow554:patch-1, r=varkor
Remove never_type feature requirement for exhaustive patterns

I **think** this resolves #51221
At least for me, it doesn't ICE anymore and all tests are still passing, so LGTM
2019-07-15 19:55:00 -04:00
Alessandro Decina 745c76d657 Normalize the trait_ref 2019-07-16 09:47:08 +10:00
bors 5480b47d7f Auto merge of #62629 - matthewjasper:cleanup-borrowck-errors, r=petrochenkov
Cleanup borrowck errors

This removes some of the unnecessary code that allowed sharing error reporting between two borrow checkers.

closes #59193
2019-07-15 09:05:18 +00:00
bors 9bb855cda0 Auto merge of #62674 - RalfJung:miri-abi, r=eddyb
RustIntrinsic and PlatformIntrinsic are also the same ABI as Rust

r? @eddyb
2019-07-15 05:40:41 +00:00
Alessandro Decina a907b7c519 Normalize type parameters in create_mono_items_for_default_impls.
Fixes http://github.com/rust-lang/rust/issues/58375
2019-07-15 10:28:17 +10:00
Dylan MacKenzie 2ce227dcc6 Actually call `visit_block_entry` in `DataflowResultsConsumer`
Previously, this callback was never actually called.
2019-07-14 13:45:43 -07:00
Matthew Jasper 9709b73561 `pub(crate)` -> `crate`
The borrow checker code is already using `crate` extensively, so prefer
being consistent with it.
2019-07-14 20:22:20 +01:00
Matthew Jasper abfd4d1e55 Move suggest_ref_mut into rustc_mir::borrow_check 2019-07-14 20:22:19 +01:00
Matthew Jasper 2cc2b942cf Remove BorrowckErrors trait
Its methods are now inherent methods of `MirBorrowckCtxt`
2019-07-14 20:22:19 +01:00
Matthew Jasper 37a99038d0 Remove rustc_mir::borrowck_errors::Origin 2019-07-14 20:20:50 +01:00
Matthew Jasper 2975c01747 Remove unused BorrowckErrors methods 2019-07-14 20:19:16 +01:00