Dylan DPC
6b4dbb196c
Rollup merge of #77582 - ecstatic-morse:disable-early-otherwise-branch, r=wesleywiser
...
Move `EarlyOtherwiseBranch` to mir-opt-level 2
cc #75119
This didn't have an [effect in most cases](https://perf.rust-lang.org/compare.html?start=81e02708f1f4760244756548981277d5199baa9a&end=2e0edc0f28c5647141bedba02e7a222d3a5dc9c3&stat=instructions:u ), and is not trivially sound. Let it bake at `mir-opt-level=2` for a while.
Also, this missed the cutoff for beta, so we'll have to backport this.
r? @wesleywiser
2020-10-07 00:16:08 +02:00
Dylan DPC
83c58d6fb6
Rollup merge of #77568 - lcnr:mir-inline-def-id, r=ecstatic-morse
...
inliner: use caller param_env
We used the callee param env instead of the caller param env by accident in #77430 , this PR fixes that and caches it in the `Inliner` struct.
fixes #77564
r? @ecstatic-morse
2020-10-07 00:16:05 +02:00
Dylan DPC
a7a75b908a
Rollup merge of #77515 - jackh726:chalk-0.31, r=matthewjasper
...
Update to chalk 0.31
Gonna assign @nikomatsakis to the review here, but since he is pretty busy recently, if anyone else wants to review this, that would be much appreciated.
r? @nikomatsakis
2020-10-07 00:16:03 +02:00
Dylan DPC
d26ca984c3
Rollup merge of #76784 - lzutao:rd_doc, r=GuillaumeGomez
...
Add some docs to rustdoc::clean::inline and def_id functions
Split from #76571 .
2020-10-07 00:15:58 +02:00
Jack Huey
23491084bc
Update to chalk 0.31. Implement some unimplemented. Ignore some tests in compare mode chalk don't finish.
2020-10-06 14:14:25 -04:00
Matthew Jasper
69fc6d8c5c
Fix NLL compare mode tests
2020-10-06 11:19:33 +01:00
Matthew Jasper
c9eeb60b63
Deduplicate some code
2020-10-06 11:19:33 +01:00
Matthew Jasper
022c148fcd
Fix tests from rebase
2020-10-06 11:19:33 +01:00
Matthew Jasper
1db284ecb0
Avoid creating useless projection predicate
2020-10-06 11:19:33 +01:00
Matthew Jasper
27534b3932
Fix rebase
2020-10-06 11:19:33 +01:00
Matthew Jasper
852073a7d2
Deduplicate item bounds after normalization
2020-10-06 11:19:32 +01:00
Matthew Jasper
e42c97919c
Don't require lifetime super-bounds on traits apply to trait objects of that trait
2020-10-06 11:19:32 +01:00
Matthew Jasper
e674cf0200
Normalize super trait bounds when confirming object candidates
2020-10-06 11:19:32 +01:00
Matthew Jasper
d08ab945de
Fix rebase
2020-10-06 11:19:32 +01:00
Matthew Jasper
e29765250b
Don't immediately error for recursive projections
2020-10-06 11:19:32 +01:00
Matthew Jasper
6c4feb681f
Fix bootstrap
2020-10-06 11:19:32 +01:00
Matthew Jasper
ed32482534
Handle multiple trait-def projection candidates
2020-10-06 11:19:32 +01:00
Matthew Jasper
0dfa6ff3be
Avoid cycles from projection bounds
...
Only check the own predicates of associated types when confirming
projection candidates.
Also consider implied bounds when comparing trait and impl methods.
2020-10-06 11:19:32 +01:00
Matthew Jasper
596d6c4b3b
Avoid cycle with projections from object types
...
Normalizing `<dyn Iterator<Item = ()> as Iterator>::Item` no longer
requires selecting `dyn Iterator<Item = ()>: Iterator`. This was
previously worked around by using a special type-folder to normalize
things.
2020-10-06 11:19:31 +01:00
Matthew Jasper
34e5a4992c
Normalize projection bounds when considering candidates
...
This unfortunately requires some winnowing hacks to avoid
now ambiguous candidates.
2020-10-06 11:19:31 +01:00
Matthew Jasper
cfee49593d
Handle multiple applicable projection candidates
2020-10-06 11:19:31 +01:00
Matthew Jasper
bc08b791bc
Fix bugs in evaluating WellFormed predicates
...
- List the nestsed obligations in an order that works with the
single pass used by evaluation
- Propagate recursion depth correctly
2020-10-06 11:19:31 +01:00
Matthew Jasper
f52b2d8890
Avoid cycle in nested obligations for object candidate
...
Bounds of the form `type Future: Future<Result=Self::Result>` exist in
some ecosystem crates. To validate these bounds for trait objects we
need to normalize `Self::Result` in a way that doesn't cause a cycle.
2020-10-06 11:19:31 +01:00
Matthew Jasper
582ccec1c5
Remove predicates on associated types from traits
...
These need to only be bounds to avoid cycle errors in trait checking.
2020-10-06 11:19:31 +01:00
Matthew Jasper
8787090964
Address review comments
2020-10-06 11:19:31 +01:00
Matthew Jasper
21eccbb587
Fix ICE
2020-10-06 11:19:30 +01:00
Matthew Jasper
0dda4154bd
Fix tools
2020-10-06 11:19:30 +01:00
Matthew Jasper
042464f75a
Fix tests and bootstrap
2020-10-06 11:19:30 +01:00
Matthew Jasper
2bdf723da7
Ensure that associated types for trait objects satisfy their bounds
2020-10-06 11:19:30 +01:00
Matthew Jasper
0a76584dcc
Move some code from rustc_typeck to rustc_trait_selection
2020-10-06 11:19:30 +01:00
Matthew Jasper
d4d9e7f67f
Remove unused part of return value from replace_bound_vars_with_placeholders
2020-10-06 11:19:30 +01:00
Matthew Jasper
1b07991574
Check associated type bounds for object safety violations
2020-10-06 11:19:30 +01:00
Matthew Jasper
5b279c8016
Check opaque types satisfy their bounds
2020-10-06 11:19:30 +01:00
Matthew Jasper
b3057f4d5f
Check projections are well-formed when using projection candidates
2020-10-06 11:19:29 +01:00
Matthew Jasper
87f2f42dc2
Make projection wf check the predicates for the projection
2020-10-06 11:19:29 +01:00
Matthew Jasper
f958e6c246
Separate bounds and predicates for associated/opaque types
2020-10-06 11:19:29 +01:00
Matthew Jasper
d297147e62
Split bounds from predicates
2020-10-06 11:19:22 +01:00
Matthew Jasper
a7ead3bd53
Move item_bounds to typeck::collect
2020-10-06 11:18:45 +01:00
Matthew Jasper
0eb87ed55f
Rename projection_predicates to item_bounds
2020-10-06 11:18:45 +01:00
Lzu Tao
63e72348d1
Add some docs to rustdoc::clean::inline and def_id functions
...
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2020-10-06 09:46:00 +00:00
Yuki Okushi
552933b79d
Rollup merge of #77591 - Aaron1011:fix/hygiene-def-scope, r=estebank
...
Record `expansion_that_defined` into crate metadata
Fixes #77523
Now that hygiene serialization is implemented, we also need to record
`expansion_that_defined` so that we properly handle a foreign
`SyntaxContext`.
2020-10-06 16:26:16 +09:00
Yuki Okushi
cc908f3b70
Rollup merge of #77587 - ehuss:unicode-escape-span, r=ecstatic-morse
...
Fix span for unicode escape suggestion.
If a unicode escape is missing the curly braces, the suggested fix is to add the curly braces, but the span for the fix was incorrect. It was not covering the `\u`, but the suggested text includes the `\u`, causing the resulting fix to be `"\u\u{1234}"`. This changes it so that the span includes the `\u`. An alternate fix would be to remove `\u` from the suggested fix, but I think the error message reads better if the entire escape is included.
2020-10-06 16:26:14 +09:00
Yuki Okushi
5c1e01196d
Rollup merge of #77560 - rschoon:fix-litkind-rc-bytebuf, r=lcnr
...
Fix LitKind's byte buffer to use refcounted slice
While working on adding a new lint for clippy (see https://github.com/rust-lang/rust-clippy/pull/6044 ) for avoiding shared ownership of "mutable buffer" types (such as using `Rc<Vec<T>>` instead of `Rc<[T]>`), I noticed a type exported from rustc_ast and used by clippy gets caught by the lint. This PR fixes the exported type.
This PR includes the actual change to clippy too, but I will open a PR directly against clippy for that part (although it will currently fail to build there).
2020-10-06 16:26:11 +09:00
Yuki Okushi
2970af8e28
Rollup merge of #77559 - camelid:fix-rustdoc-warnings-invalid-rust-syntax, r=lcnr
...
Fix rustdoc warnings about invalid Rust syntax
2020-10-06 16:26:09 +09:00
Yuki Okushi
bc600c3905
Rollup merge of #77534 - Mark-Simulacrum:issue-70819-disallow-override-forbid-in-same-scope, r=petrochenkov
...
Disallow overriding forbid in same scope
Rebased #73379 .
Fixes #70819 .
2020-10-06 16:26:04 +09:00
Yuki Okushi
d50349ba8d
Rollup merge of #76995 - LingMan:middle_matches, r=varkor
...
Reduce boilerplate with the matches! macro
Replaces simple bool `match`es of the form
match $expr {
$pattern => true
_ => false
}
and their inverse with invocations of the matches! macro.
Limited to rustc_middle for now to get my feet wet.
2020-10-06 16:25:58 +09:00
Camelid
c8d25af698
Fixup
2020-10-05 15:07:27 -07:00
Aaron Hill
8d11f90a16
Record expansion_that_defined
into crate metadata
...
Fixes #77523
Now that hygiene serialization is implemented, we also need to record
`expansion_that_defined` so that we properly handle a foreign
`SyntaxContext`.
2020-10-05 16:01:19 -04:00
bors
a1dfd2490a
Auto merge of #77080 - richkadel:llvm-coverage-counters-2, r=tmandry
...
Working branch-level code coverage
Add a generalized implementation for computing branch-level coverage spans.
This iteration resolves some of the challenges I had identified a few weeks ago.
I've tried to implement a solution that is general enough to work for a lot of different graphs/patterns. It's encouraging to see the results on fairly large and complex crates seem to meet my expectations. This may be a "functionally complete" implementation.
Except for bug fixes or edge cases I haven't run into yet, the next and essentially final step, I think, is to replace some Counters with CounterExpressions (where their counter values can be computed by adding or subtracting other counters/expressions).
Examples of branch-level coverage support enabled in this PR:
* https://github.com/richkadel/rust/blob/llvm-coverage-counters-2/src/test/run-make-fulldeps/instrument-coverage-cov-reports-base/expected_show_coverage.coverage_of_drop_trait.txt
* https://github.com/richkadel/rust/blob/llvm-coverage-counters-2/src/test/run-make-fulldeps/instrument-coverage-cov-reports-base/expected_show_coverage.coverage_of_if.txt
* https://github.com/richkadel/rust/blob/llvm-coverage-counters-2/src/test/run-make-fulldeps/instrument-coverage-cov-reports-base/expected_show_coverage.coverage_of_if_else.txt
* https://github.com/richkadel/rust/blob/llvm-coverage-counters-2/src/test/run-make-fulldeps/instrument-coverage-cov-reports-base/expected_show_coverage.coverage_of_simple_loop.txt
* https://github.com/richkadel/rust/blob/llvm-coverage-counters-2/src/test/run-make-fulldeps/instrument-coverage-cov-reports-base/expected_show_coverage.coverage_of_simple_match.txt
* ... _and others in the same directory_
Examples of coverage analysis results (MIR spanview files) used to inject counters in the right `BasicBlocks`:
* https://htmlpreview.github.io/?https://github.com/richkadel/rust/blob/llvm-coverage-counters-2/src/test/run-make-fulldeps/instrument-coverage-mir-cov-html-base/expected_mir_dump.coverage_of_drop_trait/coverage_of_drop_trait.main.-------.InstrumentCoverage.0.html
* https://htmlpreview.github.io/?https://github.com/richkadel/rust/blob/llvm-coverage-counters-2/src/test/run-make-fulldeps/instrument-coverage-mir-cov-html-base/expected_mir_dump.coverage_of_if/coverage_of_if.main.-------.InstrumentCoverage.0.html
* https://htmlpreview.github.io/?https://github.com/richkadel/rust/blob/llvm-coverage-counters-2/src/test/run-make-fulldeps/instrument-coverage-mir-cov-html-base/expected_mir_dump.coverage_of_if_else/coverage_of_if_else.main.-------.InstrumentCoverage.0.html
* https://htmlpreview.github.io/?https://github.com/richkadel/rust/blob/llvm-coverage-counters-2/src/test/run-make-fulldeps/instrument-coverage-mir-cov-html-base/expected_mir_dump.coverage_of_simple_loop/coverage_of_simple_loop.main.-------.InstrumentCoverage.0.html
* https://htmlpreview.github.io/?https://github.com/richkadel/rust/blob/llvm-coverage-counters-2/src/test/run-make-fulldeps/instrument-coverage-mir-cov-html-base/expected_mir_dump.coverage_of_simple_match/coverage_of_simple_match.main.-------.InstrumentCoverage.0.html
* ... _and others in the same directory_
Here is some sample coverage output after compiling a few real-world crates with the new branch-level coverage features:
<img width="801" alt="Screen Shot 2020-09-25 at 1 03 11 PM" src="https://user-images.githubusercontent.com/3827298/94316848-fd882c00-ff39-11ea-9cff-0402d3abd1e7.png ">
<img width="721" alt="Screen Shot 2020-09-25 at 1 00 36 PM" src="https://user-images.githubusercontent.com/3827298/94316886-11cc2900-ff3a-11ea-9d03-80b26c8a5173.png ">
<img width="889" alt="Screen Shot 2020-09-25 at 12 54 57 PM" src="https://user-images.githubusercontent.com/3827298/94316900-18f33700-ff3a-11ea-8a80-58f67d84b8de.png ">
r? `@tmandry`
FYI: `@wesleywiser`
2020-10-05 19:34:44 +00:00
Eric Huss
35192ff574
Fix span for unicode escape suggestion.
2020-10-05 11:19:08 -07:00