Commit Graph

106878 Commits

Author SHA1 Message Date
Yuki Okushi
f32447d541 Add test for issue-51798 2020-02-16 02:54:16 +09:00
Yuki Okushi
6351bfd182 Add test for issue-39618 2020-02-16 02:53:58 +09:00
bors
19288ddfd6 Auto merge of #67681 - matthewjasper:infer-regions-in-borrowck, r=nikomatsakis
Infer regions for opaque types in borrowck

This is a step towards the goal of typeck not doing region inference.

The commits up to `Arena allocate the result of mir_borrowck` are various bug fixes and prerequisites.
The remaining commits move opaque type inference to borrow checking.

r? @nikomatsakis
2020-02-15 02:24:04 +00:00
bors
b92c6ee882 Auto merge of #69172 - JohnTitor:rollup-6cbmwcw, r=JohnTitor
Rollup of 7 pull requests

Successful merges:

 - #68129 (Correct inference of primitive operand type behind binary operation)
 - #68475 (Use a `ParamEnvAnd<Predicate>` for caching in `ObligationForest`)
 - #68856 (typeck: clarify def_bm adjustments & add tests for or-patterns)
 - #69051 (simplify_try: address some of eddyb's comments)
 - #69128 (Fix extra subslice lowering)
 - #69150 (Follow-up to #68848)
 - #69164 (Update pulldown-cmark dependency)

Failed merges:

r? @ghost
2020-02-14 23:11:03 +00:00
Matthew Jasper
d863978f89 Fix tests after rebase 2020-02-14 22:40:03 +00:00
Matthew Jasper
edddb62099 Split type_of out of collect.rs 2020-02-14 22:40:03 +00:00
Matthew Jasper
223a2ee306 Add fast path to eq_opaque_type_and_type 2020-02-14 22:40:03 +00:00
Matthew Jasper
6d9e270a4d Fix and test nested impl Trait 2020-02-14 22:40:03 +00:00
Matthew Jasper
78e0ab53fb Update tests 2020-02-14 22:40:03 +00:00
Matthew Jasper
e3e5d27f23 Use member constraint for most opaque types in NLL
This ensures that NLL will infer suitable values for regions in opaque
types when it's possible.
2020-02-14 22:40:03 +00:00
Matthew Jasper
dd1687ef41 Always check upper bounds when choosing member regions
Also correctly calculate what the upper bounds are.
2020-02-14 22:40:03 +00:00
Matthew Jasper
2bd16f3c81 Improve opaque type lifetime errors
* Use better span for member constraint errors
* Avoid a bad suggestion
* Don't report member constraint errors if we have other universal
  region errors.
2020-02-14 22:40:03 +00:00
Matthew Jasper
5cfa7d1dfb Handle equal regions in opaque type inference 2020-02-14 22:40:03 +00:00
Matthew Jasper
728224d1e0 Show inferred opaque types with #[rustc_regions] 2020-02-14 22:40:03 +00:00
Matthew Jasper
f23bca79d4 Address review comments 2020-02-14 22:40:03 +00:00
Matthew Jasper
93ac5bc7de Update tests 2020-02-14 22:40:03 +00:00
Matthew Jasper
bb8c9911f5 Erase regions in opaque types in typeck 2020-02-14 22:40:03 +00:00
Matthew Jasper
2fb02549b8 Ensure RPIT types get recorded in borrowck 2020-02-14 22:40:03 +00:00
Matthew Jasper
edee23ee25 Avoid unnecessary opaque type errors in borrowck 2020-02-14 22:40:03 +00:00
Matthew Jasper
d9b9f00109 Infer opaque type regions in borrow checking
We want type checking for function bodies to ignore/erase regions. As
such, we need to infer the regions in opaque types in borrow check
instead.
2020-02-14 22:40:02 +00:00
Matthew Jasper
75ac0cca36 Prepare to use borrowck to resolve opaque types 2020-02-14 22:40:02 +00:00
Matthew Jasper
43a3348fd9 Arena allocate the result of mir_borrowck 2020-02-14 22:40:02 +00:00
Matthew Jasper
378b5b4ca0 Generate more accurate MIR in construct_error 2020-02-14 22:40:02 +00:00
Yuki Okushi
a6ff1dbaa4
Rollup merge of #69164 - GuillaumeGomez:update-pulldown-cmark, r=Dylan-DPC
Update pulldown-cmark dependency

r? @kinnison

cc @ollie27

Reopening of  #65894.
2020-02-15 07:17:53 +09:00
Yuki Okushi
72def9a3f5
Rollup merge of #69150 - nnethercote:68848-follow-up, r=petrochenkov
Follow-up to #68848

This PR contains some late changes to #68848 that somehow didn't get included when that PR was merged in a roll-up.

r? @petrochenkov
2020-02-15 07:17:52 +09:00
Yuki Okushi
940fff7250
Rollup merge of #69128 - Centril:fix-69103, r=davidtwco
Fix extra subslice lowering

We are currently ICEing on e.g.
```rust
fn main() {
    let [.., b @ ..] = [1, 2];
    b;
}
```
This happens because `b @ ..` registers a binding such that `b;` is OK, but then we forget to lower that binding in `rustc_ast_lowering`.

Fixes #69103.

r? @davidtwco
2020-02-15 07:17:50 +09:00
Yuki Okushi
e0ea1e759f
Rollup merge of #69051 - Centril:st-fixes, r=eddyb
simplify_try: address some of eddyb's comments

Addresses only https://github.com/rust-lang/rust/pull/66282#discussion_r376730986 and https://github.com/rust-lang/rust/pull/66282#discussion_r376730824.

r? @eddyb
cc @oli-obk
2020-02-15 07:17:49 +09:00
Yuki Okushi
829a3635e4
Rollup merge of #68856 - Centril:or-pat-ref-pat, r=matthewjasper
typeck: clarify def_bm adjustments & add tests for or-patterns

Clarify the adjustment algorithm for the expected type / default binding-modes when type checking patterns with more documentation and tweaks that make the algorithm more independent of the pattern forms.

Also resolve the FIXME noted for or-patterns by deciding that the current implementation is correct, noting the rationale and adding tests for the current implementation.

cc https://github.com/rust-lang/rust/issues/54883

r? @oli-obk @varkor
2020-02-15 07:17:47 +09:00
Yuki Okushi
2c5bdee9e4
Rollup merge of #68475 - Aaron1011:fix/forest-caching, r=nikomatsakis
Use a `ParamEnvAnd<Predicate>` for caching in `ObligationForest`

Previously, we used a plain `Predicate` to cache results (e.g. successes
and failures) in ObligationForest. However, fulfillment depends on the
precise `ParamEnv` used, so this is unsound in general.

This commit changes the impl of `ForestObligation` for
`PendingPredicateObligation` to use `ParamEnvAnd<Predicate>` instead of
`Predicate` for the associated type. The associated type and method are
renamed from 'predicate' to 'cache_key' to reflect the fact that type is
no longer just a predicate.
2020-02-15 07:17:45 +09:00
Yuki Okushi
3f7ed88fdc
Rollup merge of #68129 - varkor:infer-binary-operand-behind-reference, r=nikomatsakis
Correct inference of primitive operand type behind binary operation

Fixes https://github.com/rust-lang/rust/issues/57447.

r? @nikomatsakis
2020-02-15 07:17:43 +09:00
Guillaume Gomez
d8589de1f0 Update pulldown-cmark dependency 2020-02-14 22:39:45 +01:00
Matthew Jasper
9664122b1f Simplify function signature in opaque_types 2020-02-14 20:12:46 +00:00
Matthew Jasper
43dae91821 Give some more queries descriptions 2020-02-14 20:12:46 +00:00
Matthew Jasper
60970be1fd Distinguish RPIT from other impl trait 2020-02-14 20:12:46 +00:00
Matthew Jasper
4af0952961 Call is_freeze less in unsafety-checking
This is to avoid cycles when calling `is_freeze` on an opaque type.
2020-02-14 20:12:46 +00:00
Matthew Jasper
7f41cf4cef Check associated opaque types don't use unconstrained lifetimes 2020-02-14 20:12:46 +00:00
Matthew Jasper
033bd8c7af Explain a test 2020-02-14 20:12:45 +00:00
bors
433aae93e4 Auto merge of #69115 - ehuss:update-books, r=Dylan-DPC
Update books.

This required some changes in how the books are tested due to some changes in rust-lang/book.  It uses new syntax that is not compatible with bare `rustdoc --test`.  This changes it so that it uses rustbook to run the tests, which is essentially the same as `mdbook test`.

## reference

7 commits in 11e893fc1357bc688418ddf1087c2b7aa25d154d..64239df6d173562b9deb4f012e4c3e6e960c4754
2020-01-18 21:24:08 +0100 to 2020-02-10 19:05:13 +0100
- Update for nested receivers. (rust-lang-nursery/reference#724)
- clarify note re. leading `::` in 2018 (rust-lang-nursery/reference#752)
- Update macro-ambiguity.md (rust-lang-nursery/reference#754)
- typo fix: add missing `by` (rust-lang-nursery/reference#753)
- fix `TypeParamBounds` link on trait objects (rust-lang-nursery/reference#749)
- reorganize docs on references (rust-lang-nursery/reference#745)
- add MacroRepOp usage for ? (rust-lang-nursery/reference#744)

## book

49 commits in 87dd6843678575f8dda962f239d14ef4be14b352..6fb3705e5230311b096d47f7e2c91f9ce24393d0
2020-01-20 15:20:40 -0500 to 2020-02-12 13:48:57 -0500
- Fix nomicon links. (rust-lang/book#2253)
- Update to Rust 1.41.0 (rust-lang/book#2244)
- Listing 19-6: use ptr.add instead of ptr.offset (rust-lang/book#2201)
- Remove unneeded mutable reference
- Clarify deref coercion explanation
- Fix typo in link to 1.30 book
- Acknowledge Murphy's Law
- Clarify that buffer overread is UB in C
- Change from "must" to "idiomatic" about comments
- Fancy quotes
- Make HashMap types match previous example; add fwd ref to ch 13
- Tweak wording to array clarification
- Merge remote-tracking branch 'origin/pr/2236'
- Update all our crates (rust-lang/book#2235)
- Reword git caveat
- Merge remote-tracking branch 'origin/pr/2234'
- Merge remote-tracking branch 'origin/pr/2230'
- println! is a macro (rust-lang/book#2224)
- Update a translated version link (rust-lang/book#2221)
- move `Macro invocation` from section on tuple to section on mac… (rust-lang/book#2206)
- Do not limit `Self` usage in trait implementation (rust-lang/book#2197)
- Merge remote-tracking branch 'origin/pr/2191'
- Fix wrapping
- Merge remote-tracking branch 'origin/pr/2187'
- Updated appendix 07 to reflect deprecation of rustup install (rust-lang/book#2181)
- Make links to the Nomicon consistent
- Merge remote-tracking branch 'origin/pr/2180'
- Merge remote-tracking branch 'origin/pr/2175'
- Merge remote-tracking branch 'origin/pr/2171'
- Merge remote-tracking branch 'origin/pr/2170'
- Clarify and make consistent the explanation of unions
- Merge remote-tracking branch 'origin/pr/2166'
- Handle dev or test in the Finished output line
- Link to macros by example rather than macros (rust-lang/book#2164)
- Merge remote-tracking branch 'origin/pr/2147'
- Fix parens (rust-lang/book#2132)
- Clarify type inference with closures requires calling the closures
- Update link to French translation (rust-lang/book#2119)
- Merge remote-tracking branch 'origin/pr/2108'
- Add an explicit cross reference to data type
- Merge remote-tracking branch 'origin/pr/2105'
- ch15-02-deref: Improve explanation on immut-to-mut (rust-lang/book#2030)
- Remove unnecessary quotes
- Make markdown link identifier match
- Remove extra newline
- Merge remote-tracking branch 'origin/pr/2004'
- Extract code and output; script formatting and updating them (rust-lang/book#2231)
- Switch "Finally" to "Next" to reflect new chapters having been… (rust-lang/book#2098)
- ch19-06 added curly braces to macro output (rust-lang/book#2050)

## rust-by-example

2 commits in 1c2bd024d13f8011307e13386cf1fea2180352b5..32facd5522ddbbf37baf01e4e4b6562bc55c071a
2020-01-20 12:18:36 -0300 to 2020-02-11 09:25:06 -0300
- Add missing `dyn` in code sample (rust-lang/rust-by-example#1306)
- Improve grammar in a few sections (rust-lang/rust-by-example#1305)

## edition-guide

1 commits in 1a2390247ad6d08160e0dd74f40a01a9578659c2..37f9e6848411188a1062ead1bd8ebe4b8aa16899
2019-12-29 10:40:55 -0800 to 2020-02-10 14:36:14 +0100
- Fixed typo (rust-lang-nursery/edition-guide#196)

## embedded-book

4 commits in 4d78994915af1bde9a95c04a8c27d8dca066232a..b2e1092bf67bd4d7686c4553f186edbb7f5f92db
2020-01-14 08:25:25 +0000 to 2020-01-30 08:45:46 +0000
- Make typestate initialization notes correct  (rust-embedded/book#224)
- Mention discovery book more prominently  (rust-embedded/book#219)
- Replace nursery links with rust-lang links  (rust-embedded/book#222)
- Add a Glossary appendix page  (rust-embedded/book#223)
2020-02-14 19:59:05 +00:00
bors
35071e3e2e Auto merge of #69100 - cjgillot:resolve_instance, r=Zoxc
Move resolve_instance to rustc_ty.

r? @Zoxc
2020-02-14 16:30:31 +00:00
bors
e168dcd254 Auto merge of #69162 - RalfJung:miri, r=RalfJung
update miri

Fixes https://github.com/rust-lang/rust/issues/69117

Cc @oli-obk r? @ghost
2020-02-14 12:46:52 +00:00
Ralf Jung
cdb4a59633 update miri 2020-02-14 09:41:32 +01:00
bors
21ed50522d Auto merge of #68693 - Zoxc:query-no-arc, r=michaelwoerister
Construct query job latches on-demand

r? @michaelwoerister
2020-02-14 01:37:50 +00:00
Nicholas Nethercote
88b0912d27 Fix a typo in a variable name. 2020-02-14 10:51:08 +11:00
Nicholas Nethercote
dbd8220891 Avoid base_parser, it's not needed. 2020-02-14 10:50:59 +11:00
bors
10104085e4 Auto merge of #69144 - Dylan-DPC:rollup-apt6zjj, r=Dylan-DPC
Rollup of 9 pull requests

Successful merges:

 - #68728 (parse: merge `fn` syntax + cleanup item parsing)
 - #68938 (fix lifetime shadowing check in GATs)
 - #69057 (expand: misc cleanups and simplifications)
 - #69108 (Use HirId in TraitCandidate.)
 - #69125 (Add comment to SGX entry code)
 - #69126 (miri: fix exact_div)
 - #69127 (Enable use after scope detection in the new LLVM pass manager)
 - #69135 (Spelling error "represening" to "representing")
 - #69141 (Don't error on network failures)

Failed merges:

r? @ghost
2020-02-13 22:20:58 +00:00
Dylan DPC
7704e590ec
Rollup merge of #69141 - mark-i-m:proper-linkcheck-2, r=Dylan-DPC
Don't error on network failures

This should further reduce spurious failures.

r? @JohnTitor and/or @ehuss
2020-02-13 21:28:14 +01:00
Dylan DPC
0bdf568ce4
Rollup merge of #69135 - drewrip:drewrip-spelling, r=jonas-schievink
Spelling error "represening" to "representing"

Small spelling mistake I noticed when looking through the Rust lexer.
2020-02-13 21:28:12 +01:00
Dylan DPC
a8a2c141ec
Rollup merge of #69127 - tmiasko:new-pass-manager-use-after-scope, r=nikic
Enable use after scope detection in the new LLVM pass manager

Implementation of 08a1c566a7 for the new LLVM pass manager, support for which landed in the meantime.
2020-02-13 21:28:11 +01:00
Dylan DPC
c8343b8653
Rollup merge of #69126 - RalfJung:exact-div, r=oli-obk
miri: fix exact_div

Turns out `exact_div` was relying on the broken behavior of `Rem` for `int_min % -1` that was fixed in https://github.com/rust-lang/rust/pull/69002. This PR fixes `exact_div`.

Inside rustc, `exact_div` is only used in a single place where the divisor is always positive (in `ptr_offset_from`), so we cannot test the fix in rustc. The Miri test suite covers this through the `exact_div` intrinsic, though (and it is how I found out).

One step to https://github.com/rust-lang/rust/issues/69117 (then we also need to address build failures introduced by https://github.com/rust-lang/rust/pull/68969)

r? @oli-obk
2020-02-13 21:28:09 +01:00
Dylan DPC
8e2772c0fd
Rollup merge of #69125 - jethrogb:jb/cleanup-sgx-entry, r=Dylan-DPC
Add comment to SGX entry code

Meant to force push this to be included in #69040, but forgot

r? @nagisa
2020-02-13 21:28:07 +01:00