rust/src/test/ui/hrtb
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
..
hrtb-cache-issue-54302.nll.stderr Change compare mode to use -Zborrowck=mir 2019-05-12 18:46:43 +01:00
hrtb-cache-issue-54302.rs make evaluation track whether outlives relationships mattered 2019-01-02 17:35:05 -05:00
hrtb-cache-issue-54302.stderr Update tests 2019-03-11 23:10:26 +03:00
hrtb-conflate-regions.rs tests: worse diagnostics, but basically same errors 2019-01-02 17:35:05 -05:00
hrtb-conflate-regions.stderr Update tests 2019-03-11 23:10:26 +03:00
hrtb-debruijn-in-receiver.rs Remove licenses 2018-12-25 21:08:33 -07:00
hrtb-debruijn-in-receiver.stderr update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
hrtb-exists-forall-fn.rs address tmandry nits 2019-01-02 17:35:06 -05:00
hrtb-exists-forall-fn.stderr Update tests 2019-03-11 23:10:26 +03:00
hrtb-exists-forall-trait-contravariant.rs update test files to reflect new output 2019-02-21 11:32:17 -05:00
hrtb-exists-forall-trait-contravariant.stderr update test files to reflect new output 2019-02-21 11:32:17 -05:00
hrtb-exists-forall-trait-covariant.rs update test files to reflect new output 2019-02-21 11:32:17 -05:00
hrtb-exists-forall-trait-covariant.stderr update test files to reflect new output 2019-02-21 11:32:17 -05:00
hrtb-exists-forall-trait-invariant.rs update test files to reflect new output 2019-02-21 11:32:17 -05:00
hrtb-exists-forall-trait-invariant.stderr Update tests 2019-03-11 23:10:26 +03:00
hrtb-higher-ranker-supertraits-transitive.rs tests: worse diagnostics, but basically same errors 2019-01-02 17:35:05 -05:00
hrtb-higher-ranker-supertraits-transitive.stderr Update tests 2019-03-11 23:10:26 +03:00
hrtb-higher-ranker-supertraits.rs update test files to reflect new output 2019-02-21 11:32:17 -05:00
hrtb-higher-ranker-supertraits.stderr Update tests 2019-03-11 23:10:26 +03:00
hrtb-identity-fn-borrows.rs update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
hrtb-identity-fn-borrows.stderr update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
hrtb-just-for-static.rs apply the new placeholder errors even with just one placeholder 2019-01-02 17:35:06 -05:00
hrtb-just-for-static.stderr Update tests 2019-03-11 23:10:26 +03:00
hrtb-perfect-forwarding.nll.stderr normalize use of backticks in compiler messages for librustc/lint 2019-07-17 22:49:48 +02:00
hrtb-perfect-forwarding.rs fix tests post-rebase 2019-02-15 15:52:29 +01:00
hrtb-perfect-forwarding.stderr Update tests 2019-03-11 23:10:26 +03:00
issue-30786.migrate.stderr Ignore test hrtb/issue-30786.rs in Polonius compare mode 2019-07-22 11:36:45 +02:00
issue-30786.nll.stderr Ignore test hrtb/issue-30786.rs in Polonius compare mode 2019-07-22 11:36:45 +02:00
issue-30786.rs Ignore test hrtb/issue-30786.rs in Polonius compare mode 2019-07-22 11:36:45 +02:00
issue-46989.rs restore the actual leak-check 2019-02-21 11:32:17 -05:00
issue-46989.stderr update test files to reflect new output 2019-02-21 11:32:17 -05:00
issue-57639.rs restore the actual leak-check 2019-02-21 11:32:17 -05:00
issue-58451.rs update test files to reflect new output 2019-02-21 11:32:17 -05:00
issue-58451.stderr Update tests 2019-03-11 23:10:26 +03:00
issue-62203-hrtb-ice.rs Regression test. 2019-07-09 13:57:22 +02:00
issue-62203-hrtb-ice.stderr Regression test. 2019-07-09 13:57:22 +02:00