]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoDo not ICE when encountering `yield` inside `async` block
Esteban Küber [Sat, 15 Feb 2020 01:49:16 +0000 (17:49 -0800)]
Do not ICE when encountering `yield` inside `async` block

4 years agoAuto merge of #67953 - cjgillot:split_infer, r=Zoxc
bors [Sun, 16 Feb 2020 22:24:54 +0000 (22:24 +0000)]
Auto merge of #67953 - cjgillot:split_infer, r=Zoxc

Split librustc::{traits,infer} to a separate crate rustc_infer

This is still very much work in progress.
Three functions are between dimensions (at the end of `rustc::traits`), waiting for some dependency breaking scheme.
Please tell me if the approach seems sound, and how you would like to split this PR up.

The formatting is deliberately off, to ease rebasing.

cc #65031

4 years agoAuto merge of #67885 - tobithiel:fix_group_lint_allow_override, r=Mark-Simulacrum
bors [Sun, 16 Feb 2020 15:28:41 +0000 (15:28 +0000)]
Auto merge of #67885 - tobithiel:fix_group_lint_allow_override, r=Mark-Simulacrum

rustc_session: allow overriding lint level of individual lints from a group

Fixes #58211 and fixes rust-lang/rust-clippy#4778 and fixes rust-lang/rust-clippy#4091

Instead of hard-coding the lint level preferences (from lowest to highest precedence: `lint::Allow -> lint::Warn -> lint::Deny -> lint::Forbid`), the position of the argument in the command line gets taken into account.

Examples:
1. Passing `-D unused -A unused-variables` denies everything in the lint group `unused` **except** `unused-variables` which is explicitly allowed.
1. Passing `-A unused-variables -D unused` denies everything in the lint group `unused` **including** `unused-variables` since the allow is specified before the deny (and therefore overridden by the deny).

This matches the behavior that is already being used when specifying `allow`/`deny` in the source code.

4 years agoAuto merge of #68997 - Zoxc:pure-node-id, r=petrochenkov
bors [Sun, 16 Feb 2020 12:16:49 +0000 (12:16 +0000)]
Auto merge of #68997 - Zoxc:pure-node-id, r=petrochenkov

Panic if NodeIds are used for incremental compilation

r? @michaelwoerister

4 years agoPrune rustc dependencies.
Camille GILLOT [Fri, 7 Feb 2020 08:06:08 +0000 (09:06 +0100)]
Prune rustc dependencies.

4 years agoGate macro use.
Camille GILLOT [Wed, 8 Jan 2020 09:18:48 +0000 (10:18 +0100)]
Gate macro use.

4 years agoPrune features.
Camille GILLOT [Wed, 8 Jan 2020 08:31:01 +0000 (09:31 +0100)]
Prune features.

4 years agoRemove librustc_infer crate re-exports.
Camille GILLOT [Tue, 7 Jan 2020 21:07:22 +0000 (22:07 +0100)]
Remove librustc_infer crate re-exports.

4 years agoOther crates.
Camille GILLOT [Mon, 6 Jan 2020 22:31:06 +0000 (23:31 +0100)]
Other crates.

4 years agoMake librustc_traits compile.
Camille GILLOT [Mon, 6 Jan 2020 22:28:45 +0000 (23:28 +0100)]
Make librustc_traits compile.

4 years agoMake librustc_mir compile.
Camille GILLOT [Mon, 6 Jan 2020 22:21:41 +0000 (23:21 +0100)]
Make librustc_mir compile.

4 years agoMake librustc_typeck compile.
Camille GILLOT [Mon, 6 Jan 2020 22:12:31 +0000 (23:12 +0100)]
Make librustc_typeck compile.

4 years agoMake librustc_infer compile.
Camille GILLOT [Mon, 6 Jan 2020 19:13:24 +0000 (20:13 +0100)]
Make librustc_infer compile.

4 years agoMake librustc compile.
Camille GILLOT [Mon, 6 Jan 2020 19:13:24 +0000 (20:13 +0100)]
Make librustc compile.

4 years agoMove librustc/{traits,infer} to librustc_infer.
Camille GILLOT [Mon, 6 Jan 2020 19:13:24 +0000 (20:13 +0100)]
Move librustc/{traits,infer} to librustc_infer.

4 years agoAuto merge of #69156 - ecstatic-morse:unified-dataflow-impls2, r=eddyb
bors [Sun, 16 Feb 2020 05:08:08 +0000 (05:08 +0000)]
Auto merge of #69156 - ecstatic-morse:unified-dataflow-impls2, r=eddyb

Use `ResultsCursor` for `elaborate_drops`

Some cleanup after #68241. The old code was using a custom cursor-like struct called `InitializationData`.

4 years agoAuto merge of #68814 - Aaron1011:fix/proc-macro-order-two, r=petrochenkov
bors [Sun, 16 Feb 2020 01:46:05 +0000 (01:46 +0000)]
Auto merge of #68814 - Aaron1011:fix/proc-macro-order-two, r=petrochenkov

Record proc macro harness order for use during metadata deserialization

Fixes #68690

When we generate the proc macro harness, we now explicitly recorder the
order in which we generate entries. We then use this ordering data to
deserialize the correct proc-macro-data from the crate metadata.

4 years agoAuto merge of #68668 - GuillaumeGomez:struct-variant-field-search, r=ollie27
bors [Sat, 15 Feb 2020 22:32:51 +0000 (22:32 +0000)]
Auto merge of #68668 - GuillaumeGomez:struct-variant-field-search, r=ollie27

Struct variant field search

Fixes #16017.

Reopening of #64724.

cc @tomjakubowski
cc @ollie27

r? @kinnison

4 years agoAdd additional comment
Aaron Hill [Sat, 15 Feb 2020 20:51:40 +0000 (15:51 -0500)]
Add additional comment

4 years agoRecord proc macro harness order for use during metadata deserialization
Aaron Hill [Mon, 3 Feb 2020 23:34:36 +0000 (18:34 -0500)]
Record proc macro harness order for use during metadata deserialization

Fixes #68690

When we generate the proc macro harness, we now explicitly recorder the
order in which we generate entries. We then use this ordering data to
deserialize the correct proc-macro-data from the crate metadata.

4 years agoPanic when hashing node IDs
John Kåre Alsaker [Sat, 15 Feb 2020 17:07:17 +0000 (18:07 +0100)]
Panic when hashing node IDs

4 years agoTreat NodeIs as pure values for incremental compilation
John Kåre Alsaker [Sun, 9 Feb 2020 14:08:31 +0000 (15:08 +0100)]
Treat NodeIs as pure values for incremental compilation

4 years agoAuto merge of #69168 - brainlock:test-textrel-regression, r=Mark-Simulacrum,tmandry
bors [Sat, 15 Feb 2020 13:48:53 +0000 (13:48 +0000)]
Auto merge of #69168 - brainlock:test-textrel-regression, r=Mark-Simulacrum,tmandry

add regression test for issue #68794

This is a minimal regression test for the issue #68794: "TEXTREL in
i686", which was fixed with e86019c4a0968a1e393cdd0731649168624a88b8.

The test links a minimal rust static library into a shared library, and
checks that the linker didn't have to add the TEXTREL flag.

4 years agoAuto merge of #69182 - Dylan-DPC:rollup-ifsa9fx, r=Dylan-DPC
bors [Sat, 15 Feb 2020 10:20:05 +0000 (10:20 +0000)]
Auto merge of #69182 - Dylan-DPC:rollup-ifsa9fx, r=Dylan-DPC

Rollup of 6 pull requests

Successful merges:

 - #64069 (Added From<Vec<NonZeroU8>> for CString)
 - #66721 (implement LowerExp and UpperExp for integers)
 - #69106 (Fix std::fs::copy on WASI target)
 - #69154 (Avoid calling `fn_sig` on closures)
 - #69166 (Check `has_typeck_tables` before calling `typeck_tables_of`)
 - #69180 (Suggest a comma if a struct initializer field fails to parse)

Failed merges:

r? @ghost

4 years agoRollup merge of #69180 - Aaron1011:feature/comma-struct-init, r=petrochenkov
Dylan DPC [Sat, 15 Feb 2020 08:45:49 +0000 (09:45 +0100)]
Rollup merge of #69180 - Aaron1011:feature/comma-struct-init, r=petrochenkov

Suggest a comma if a struct initializer field fails to parse

Currently, we emit a "try adding a comma" suggestion if a comma is
missing in a struct definition. However, we emit no such suggestion if a
comma is missing in a struct initializer.

This commit adds a "try adding a comma" suggestion when we don't find a
comma during the parsing of a struct initializer field.

The change to `src/test/ui/parser/removed-syntax-with-1.stderr` isn't
great, but I don't see a good way of avoiding it.

4 years agoRollup merge of #69166 - JohnTitor:ice-const-enum, r=matthewjasper
Dylan DPC [Sat, 15 Feb 2020 08:45:48 +0000 (09:45 +0100)]
Rollup merge of #69166 - JohnTitor:ice-const-enum, r=matthewjasper

Check `has_typeck_tables` before calling `typeck_tables_of`

Fixes #68684

r? @matthewjasper

4 years agoRollup merge of #69154 - JohnTitor:fix-macro-ices, r=petrochenkov
Dylan DPC [Sat, 15 Feb 2020 08:45:46 +0000 (09:45 +0100)]
Rollup merge of #69154 - JohnTitor:fix-macro-ices, r=petrochenkov

Avoid calling `fn_sig` on closures

Fixes #68060

r? @petrochenkov

4 years agoRollup merge of #69106 - RReverser:wasi-fs-copy, r=KodrAus
Dylan DPC [Sat, 15 Feb 2020 08:45:45 +0000 (09:45 +0100)]
Rollup merge of #69106 - RReverser:wasi-fs-copy, r=KodrAus

Fix std::fs::copy on WASI target

Previously `std::fs::copy` on wasm32-wasi would reuse code from the `sys_common` module and would successfully copy contents of the file just to fail right before closing it.

This was happening because `sys_common::copy` tries to copy permissions of the file, but permissions are not a thing in WASI (at least yet) and `set_permissions` is implemented as an unconditional runtime error.

This change instead adds a custom working implementation of `std::fs::copy` (like Rust already has on some other targets) that doesn't try to call `set_permissions` and is essentially a thin wrapper around `std::io::copy`.

Fixes #68560.

4 years agoRollup merge of #66721 - maxbla:exp-format-integers, r=KodrAus
Dylan DPC [Sat, 15 Feb 2020 08:45:43 +0000 (09:45 +0100)]
Rollup merge of #66721 - maxbla:exp-format-integers, r=KodrAus

implement LowerExp and UpperExp for integers

Addresses https://github.com/rust-lang/rust/issues/39479

This implementation is heavily based on the preexisting `macro_rules! impl_Display` in the same file. I don't like the liberal use of unsafe in that macro and would like to modify it so `unsafe` is only present where necessary. What is Rust's policy on doing such modifications?

Also, I couldn't figure out where to put tests, can I have some help with that?

4 years agoRollup merge of #64069 - danielhenrymantilla:feature/cstring_from_vec_of_nonzerou8...
Dylan DPC [Sat, 15 Feb 2020 08:45:38 +0000 (09:45 +0100)]
Rollup merge of #64069 - danielhenrymantilla:feature/cstring_from_vec_of_nonzerou8, r=KodrAus

Added From<Vec<NonZeroU8>> for CString

Added a `From<Vec<NonZeroU8>>` `impl` for `CString`

# Rationale

  - `CString::from_vec_unchecked` is a subtle function, that makes `unsafe` code harder to audit when the generated `Vec`'s creation is non-trivial. This `impl` allows to write safer `unsafe` code thanks to the very explicit semantics of the `Vec<NonZeroU8>` type.

  - One such situation is when trying to `.read()` a `CString`, see issue #59229.

      - this lead to a PR: #59314, that was closed for being too specific / narrow (it only targetted being able to `.read()` a `CString`, when this pattern could have been generalized).

     - the issue suggested another route, based on `From<Vec<NonZeroU8>>`, which is indeed a less general and more concise code pattern.

  - quoting @shnatsel:

      - >  For me the main thing about making this safe is simplifying auditing - people have spent like an hour looking at just this one unsafe block in libflate because it's not clear what exactly is unchecked, so you have to look it up when auditing anyway. This has distracted us from much more serious memory safety issues the library had.
Having this trivial impl in stdlib would turn this into safe code with compiler more or less guaranteeing that it's fine, and save anyone auditing the code a whole lot of time.

4 years agoSuggest a comma if a struct initializer field fails to parse
Aaron Hill [Sat, 15 Feb 2020 03:28:13 +0000 (22:28 -0500)]
Suggest a comma if a struct initializer field fails to parse

Currently, we emit a "try adding a comma" suggestion if a comma is
missing in a struct definition. However, we emit no such suggestion if a
comma is missing in a struct initializer.

This commit adds a "try adding a comma" suggestion when we don't find a
comma during the parsing of a struct initializer field.

The change to `src/test/ui/parser/removed-syntax-with-1.stderr` isn't
great, but I don't see a good way of avoiding it.

4 years agoimplement LowerExp and UpperExp for integers
Max Blachman [Sun, 24 Nov 2019 22:30:56 +0000 (14:30 -0800)]
implement LowerExp and UpperExp for integers

4 years agoAuto merge of #67681 - matthewjasper:infer-regions-in-borrowck, r=nikomatsakis
bors [Sat, 15 Feb 2020 02:24:04 +0000 (02:24 +0000)]
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

4 years agoAuto merge of #69172 - JohnTitor:rollup-6cbmwcw, r=JohnTitor
bors [Fri, 14 Feb 2020 23:11:03 +0000 (23:11 +0000)]
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

4 years agoFix tests after rebase
Matthew Jasper [Fri, 14 Feb 2020 22:39:55 +0000 (22:39 +0000)]
Fix tests after rebase

4 years agoSplit `type_of` out of collect.rs
Matthew Jasper [Fri, 17 Jan 2020 21:15:03 +0000 (21:15 +0000)]
Split `type_of` out of collect.rs

4 years agoAdd fast path to eq_opaque_type_and_type
Matthew Jasper [Fri, 17 Jan 2020 20:11:51 +0000 (20:11 +0000)]
Add fast path to eq_opaque_type_and_type

4 years agoFix and test nested impl Trait
Matthew Jasper [Sun, 12 Jan 2020 10:19:19 +0000 (10:19 +0000)]
Fix and test nested impl Trait

4 years agoUpdate tests
Matthew Jasper [Sat, 11 Jan 2020 17:18:58 +0000 (17:18 +0000)]
Update tests

4 years agoUse member constraint for most opaque types in NLL
Matthew Jasper [Sat, 11 Jan 2020 17:18:52 +0000 (17:18 +0000)]
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.

4 years agoAlways check upper bounds when choosing member regions
Matthew Jasper [Sat, 11 Jan 2020 16:58:50 +0000 (16:58 +0000)]
Always check upper bounds when choosing member regions

Also correctly calculate what the upper bounds are.

4 years agoImprove opaque type lifetime errors
Matthew Jasper [Sat, 11 Jan 2020 14:12:39 +0000 (14:12 +0000)]
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.

4 years agoHandle equal regions in opaque type inference
Matthew Jasper [Wed, 8 Jan 2020 21:20:38 +0000 (21:20 +0000)]
Handle equal regions in opaque type inference

4 years agoShow inferred opaque types with `#[rustc_regions]`
Matthew Jasper [Sun, 5 Jan 2020 18:27:51 +0000 (18:27 +0000)]
Show inferred opaque types with `#[rustc_regions]`

4 years agoAddress review comments
Matthew Jasper [Sun, 29 Dec 2019 14:23:20 +0000 (14:23 +0000)]
Address review comments

4 years agoUpdate tests
Matthew Jasper [Sat, 28 Dec 2019 15:54:27 +0000 (15:54 +0000)]
Update tests

4 years agoErase regions in opaque types in typeck
Matthew Jasper [Sat, 28 Dec 2019 15:52:51 +0000 (15:52 +0000)]
Erase regions in opaque types in typeck

4 years agoEnsure RPIT types get recorded in borrowck
Matthew Jasper [Sat, 28 Dec 2019 15:50:39 +0000 (15:50 +0000)]
Ensure RPIT types get recorded in borrowck

4 years agoAvoid unnecessary opaque type errors in borrowck
Matthew Jasper [Sat, 28 Dec 2019 15:50:06 +0000 (15:50 +0000)]
Avoid unnecessary opaque type errors in borrowck

4 years agoInfer opaque type regions in borrow checking
Matthew Jasper [Thu, 26 Dec 2019 21:16:28 +0000 (21:16 +0000)]
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.

4 years agoPrepare to use borrowck to resolve opaque types
Matthew Jasper [Wed, 25 Dec 2019 09:50:07 +0000 (09:50 +0000)]
Prepare to use borrowck to resolve opaque types

4 years agoArena allocate the result of mir_borrowck
Matthew Jasper [Thu, 26 Dec 2019 17:26:53 +0000 (17:26 +0000)]
Arena allocate the result of mir_borrowck

4 years agoGenerate more accurate MIR in `construct_error`
Matthew Jasper [Thu, 26 Dec 2019 17:51:39 +0000 (17:51 +0000)]
Generate more accurate MIR in `construct_error`

4 years agoAvoid calling `fn_sig` on closures
Yuki Okushi [Fri, 14 Feb 2020 03:46:06 +0000 (12:46 +0900)]
Avoid calling `fn_sig` on closures

4 years agoRollup merge of #69164 - GuillaumeGomez:update-pulldown-cmark, r=Dylan-DPC
Yuki Okushi [Fri, 14 Feb 2020 22:17:53 +0000 (07:17 +0900)]
Rollup merge of #69164 - GuillaumeGomez:update-pulldown-cmark, r=Dylan-DPC

Update pulldown-cmark dependency

r? @kinnison

cc @ollie27

Reopening of  #65894.

4 years agoRollup merge of #69150 - nnethercote:68848-follow-up, r=petrochenkov
Yuki Okushi [Fri, 14 Feb 2020 22:17:52 +0000 (07:17 +0900)]
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

4 years agoRollup merge of #69128 - Centril:fix-69103, r=davidtwco
Yuki Okushi [Fri, 14 Feb 2020 22:17:50 +0000 (07:17 +0900)]
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

4 years agoRollup merge of #69051 - Centril:st-fixes, r=eddyb
Yuki Okushi [Fri, 14 Feb 2020 22:17:49 +0000 (07:17 +0900)]
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

4 years agoRollup merge of #68856 - Centril:or-pat-ref-pat, r=matthewjasper
Yuki Okushi [Fri, 14 Feb 2020 22:17:47 +0000 (07:17 +0900)]
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

4 years agoRollup merge of #68475 - Aaron1011:fix/forest-caching, r=nikomatsakis
Yuki Okushi [Fri, 14 Feb 2020 22:17:45 +0000 (07:17 +0900)]
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.

4 years agoRollup merge of #68129 - varkor:infer-binary-operand-behind-reference, r=nikomatsakis
Yuki Okushi [Fri, 14 Feb 2020 22:17:43 +0000 (07:17 +0900)]
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

4 years agoUpdate pulldown-cmark dependency
Guillaume Gomez [Thu, 13 Feb 2020 17:39:40 +0000 (18:39 +0100)]
Update pulldown-cmark dependency

4 years agoSimplify function signature in opaque_types
Matthew Jasper [Thu, 26 Dec 2019 20:46:38 +0000 (20:46 +0000)]
Simplify function signature in opaque_types

4 years agoGive some more queries descriptions
Matthew Jasper [Sat, 28 Dec 2019 11:24:26 +0000 (11:24 +0000)]
Give some more queries descriptions

4 years agoDistinguish RPIT from other impl trait
Matthew Jasper [Sat, 28 Dec 2019 15:39:52 +0000 (15:39 +0000)]
Distinguish RPIT from other impl trait

4 years agoCall `is_freeze` less in unsafety-checking
Matthew Jasper [Sat, 28 Dec 2019 15:51:44 +0000 (15:51 +0000)]
Call `is_freeze` less in unsafety-checking

This is to avoid cycles when calling `is_freeze` on an opaque type.

4 years agoCheck associated opaque types don't use unconstrained lifetimes
Matthew Jasper [Thu, 26 Dec 2019 23:41:32 +0000 (23:41 +0000)]
Check associated opaque types don't use unconstrained lifetimes

4 years agoExplain a test
Matthew Jasper [Thu, 26 Dec 2019 21:13:51 +0000 (21:13 +0000)]
Explain a test

4 years agoAuto merge of #69115 - ehuss:update-books, r=Dylan-DPC
bors [Fri, 14 Feb 2020 19:59:05 +0000 (19:59 +0000)]
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)

4 years agoAuto merge of #69100 - cjgillot:resolve_instance, r=Zoxc
bors [Fri, 14 Feb 2020 16:30:31 +0000 (16:30 +0000)]
Auto merge of #69100 - cjgillot:resolve_instance, r=Zoxc

Move resolve_instance to rustc_ty.

r? @Zoxc

4 years agoadd regression test for issue #68794
Alberto Piai [Fri, 14 Feb 2020 13:27:22 +0000 (14:27 +0100)]
add regression test for issue #68794

This is a minimal regression test for the issue #68794: "TEXTREL in
i686", which was fixed with e86019c4a0968a1e393cdd0731649168624a88b8.

The test links a minimal rust static library into a shared library, and
checks that the linker didn't have to add the TEXTREL flag.

4 years agoCheck `has_typeck_tables` before calling `typeck_tables_of`
Yuki Okushi [Fri, 14 Feb 2020 12:49:57 +0000 (21:49 +0900)]
Check `has_typeck_tables` before calling `typeck_tables_of`

4 years agoAuto merge of #69162 - RalfJung:miri, r=RalfJung
bors [Fri, 14 Feb 2020 12:46:52 +0000 (12:46 +0000)]
Auto merge of #69162 - RalfJung:miri, r=RalfJung

update miri

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

Cc @oli-obk r? @ghost

4 years agoupdate miri
Ralf Jung [Fri, 14 Feb 2020 08:41:32 +0000 (09:41 +0100)]
update miri

4 years agoPrint flow state in debug messages for `find_dead_unwinds`
Dylan MacKenzie [Fri, 14 Feb 2020 05:34:19 +0000 (21:34 -0800)]
Print flow state in debug messages for `find_dead_unwinds`

4 years agoUse more descriptive name to get `InitializationData` state
Dylan MacKenzie [Fri, 14 Feb 2020 05:30:10 +0000 (21:30 -0800)]
Use more descriptive name to get `InitializationData` state

4 years agoUse `seek_before` instead of `seek_after`
Dylan MacKenzie [Fri, 14 Feb 2020 04:48:17 +0000 (20:48 -0800)]
Use `seek_before` instead of `seek_after`

4 years agoUse `ResultsCursor` for `elaborate_drops`
Dylan MacKenzie [Wed, 22 Jan 2020 04:00:55 +0000 (20:00 -0800)]
Use `ResultsCursor` for `elaborate_drops`

The old code hard-coded the transfer function for the initialized places
analyses.

4 years agoAuto merge of #68693 - Zoxc:query-no-arc, r=michaelwoerister
bors [Fri, 14 Feb 2020 01:37:50 +0000 (01:37 +0000)]
Auto merge of #68693 - Zoxc:query-no-arc, r=michaelwoerister

Construct query job latches on-demand

r? @michaelwoerister

4 years agoFix a typo in a variable name.
Nicholas Nethercote [Mon, 10 Feb 2020 21:44:55 +0000 (08:44 +1100)]
Fix a typo in a variable name.

4 years agoAvoid `base_parser`, it's not needed.
Nicholas Nethercote [Tue, 4 Feb 2020 22:44:03 +0000 (09:44 +1100)]
Avoid `base_parser`, it's not needed.

4 years agoAuto merge of #69144 - Dylan-DPC:rollup-apt6zjj, r=Dylan-DPC
bors [Thu, 13 Feb 2020 22:20:58 +0000 (22:20 +0000)]
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

4 years agoRollup merge of #69141 - mark-i-m:proper-linkcheck-2, r=Dylan-DPC
Dylan DPC [Thu, 13 Feb 2020 20:28:14 +0000 (21:28 +0100)]
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

4 years agoRollup merge of #69135 - drewrip:drewrip-spelling, r=jonas-schievink
Dylan DPC [Thu, 13 Feb 2020 20:28:12 +0000 (21:28 +0100)]
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.

4 years agoRollup merge of #69127 - tmiasko:new-pass-manager-use-after-scope, r=nikic
Dylan DPC [Thu, 13 Feb 2020 20:28:11 +0000 (21:28 +0100)]
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 08a1c566a792dcf9657d293155f7ada87746bb65 for the new LLVM pass manager, support for which landed in the meantime.

4 years agoRollup merge of #69126 - RalfJung:exact-div, r=oli-obk
Dylan DPC [Thu, 13 Feb 2020 20:28:09 +0000 (21:28 +0100)]
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

4 years agoRollup merge of #69125 - jethrogb:jb/cleanup-sgx-entry, r=Dylan-DPC
Dylan DPC [Thu, 13 Feb 2020 20:28:07 +0000 (21:28 +0100)]
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

4 years agoRollup merge of #69108 - cjgillot:trait_candidate, r=Zoxc
Dylan DPC [Thu, 13 Feb 2020 20:28:06 +0000 (21:28 +0100)]
Rollup merge of #69108 - cjgillot:trait_candidate, r=Zoxc

Use HirId in TraitCandidate.

I had to duplicate the `TraitMap` type to hold `NodeId`s until AST->HIR lowering is done.

r? @Zoxc

4 years agoRollup merge of #69057 - Centril:clean-expand, r=petrochenkov
Dylan DPC [Thu, 13 Feb 2020 20:28:05 +0000 (21:28 +0100)]
Rollup merge of #69057 - Centril:clean-expand, r=petrochenkov

expand: misc cleanups and simplifications

Some work I did while trying to understand expand for the purposes of https://github.com/rust-lang/rust/issues/64197.

r? @petrochenkov

4 years agoRollup merge of #68938 - Areredify:gat_lifetime_shadowing, r=estebank
Dylan DPC [Thu, 13 Feb 2020 20:28:00 +0000 (21:28 +0100)]
Rollup merge of #68938 - Areredify:gat_lifetime_shadowing, r=estebank

fix lifetime shadowing check in GATs

closes #67512

4 years agoRollup merge of #68728 - Centril:towards-fn-merge, r=petrochenkov
Dylan DPC [Thu, 13 Feb 2020 20:27:58 +0000 (21:27 +0100)]
Rollup merge of #68728 - Centril:towards-fn-merge, r=petrochenkov

parse: merge `fn` syntax + cleanup item parsing

Here we continue the work in https://github.com/rust-lang/rust/pull/67131 in particular to merge the grammars of `fn` items in various positions.

A list of *language level* changes (as sanctioned by the language team in https://github.com/rust-lang/rust/issues/65041#issuecomment-538105286 and https://github.com/rust-lang/rust/pull/67131):

- `self` parameters are now *syntactically* allowed as the first parameter irrespective of item context (and in function pointers). Instead, semantic validation (`ast_validation`) is used.

- Syntactically, `fn` items in `extern { ... }` blocks can now have bodies (`fn foo() { ... }` as opposed to `fn foo();`). As above, we use semantic restrictions instead.

- Syntactically, `fn` items in free contexts (directly in a file or a module) can now be without bodies (`fn foo();` as opposed to `fn foo() { ... }`. As above, we use semantic restrictions instead, including for non-ident parameter patterns.

- `const extern fn` feature gating is now done post-expansion such that we do not have conditional compatibilities of function qualifiers *in parsing*.

- The `FnFrontMatter` grammar becomes:
   ```rust
   Extern = "extern" StringLit ;
   FnQual = "const"? "async"? "unsafe"? Extern? ;
   FnFrontMatter = FnQual "fn" ;
   ```

   That is, all item contexts now *syntactically* allow `const async unsafe extern "C" fn` and use semantic restrictions to rule out combinations previously prevented syntactically. The semantic restrictions include in particular:

   - `fn`s in `extern { ... }` can have no qualifiers.
   - `const` and `async` cannot be combined.

- To fuse the list-of-items parsing in the 4 contexts that items are allowed, we now must permit inner attributes (`#![attr]`) inside `trait Foo { ... }` definitions. That is, we now allow e.g. `trait Foo { #![attr] }`. This was probably an oversight due to not using a uniform parsing mechanism, which we now do have (`fn parse_item_list`). The semantic support (including e.g. for linting) falls out directly from the attributes infrastructure. To ensure this, we include a test for lints.

Put together, these grammar changes allow us to substantially reduce the complexity of item parsing and its grammar. There are however some other non-language improvements that allow the compression to take place.

A list of *compiler-internal* changes (in particular noting the parser-external data-structure changes):

- We use `enum AllowPlus/RecoverQPath/AllowCVariadic { Yes, No }` in `parser/ty.rs` instead of passing around 3 different `bool`s. I felt this was necessary as it was becoming mentally taxing to track which-is-which.

- `fn visit_trait_item` and `fn visit_impl_item` are merged into `fn visit_assoc_item` which now is passed an `AssocCtxt` to check which one it is.

- We change `FnKind` to:

  ```rust
  pub enum FnKind<'a> {
      Fn(FnCtxt, Ident, &'a FnSig, &'a Visibility, Option<&'a Block>),
      Closure(&'a FnDecl, &'a Expr),
  }
  ```

  with:

  ```rust
  pub enum FnCtxt {
      Free,
      Foreign,
      Assoc(AssocCtxt),
  }
  ```

  This is then taken advantage of in tweaking the various semantic restrictions as well as in pretty printing.

- In `ItemKind::Fn`, we change `P<Block>` to `Option<P<Block>>`.

- In `ForeignItemKind::Fn`, we change `P<FnDecl>` to `FnSig` and `P<Block>` to `Option<P<Block>>`.

- We change `ast::{Unsafety, Spanned<Constness>}>` into `enum ast::{Unsafe, Const} { Yes(Span), No }` respectively. This change in formulation allow us to exclude `Span` in the case of `No`, which facilitates parsing. Moreover, we also add a `Span` to `IsAsync` which is renamed to `Async`. The new `Span`s in `Unsafety` and `Async` are then taken advantage of for better diagnostics. A reason this change was made is to have a more uniform and clear naming scheme.

  The HIR keeps the structures in AST (with those definitions moved into HIR) for now to avoid regressing perf.

- Various cleanups, bug fixes, and diagnostics improvements are made along the way. It is probably best to understand those via the diffs.

I would recommend reviewing this commit-by-commit with whitespace changes hidden.

r? @estebank @petrochenkov

4 years agoAuto merge of #68406 - andjo403:selfprofileLlvm, r=wesleywiser
bors [Thu, 13 Feb 2020 19:12:43 +0000 (19:12 +0000)]
Auto merge of #68406 - andjo403:selfprofileLlvm, r=wesleywiser

[self-profiler] add selfprofiling to llvm

using pass name as event id and add additional data with name of module, function …

![image](https://user-images.githubusercontent.com/844398/72761970-205d8600-3bde-11ea-86de-87386e127944.png)

r? @michaelwoerister or @wesleywiser

4 years agoMove resolve_instance to rustc_ty.
Camille GILLOT [Wed, 12 Feb 2020 16:24:32 +0000 (17:24 +0100)]
Move resolve_instance to rustc_ty.

4 years agodon't error on network failures
Mark Mansi [Thu, 13 Feb 2020 17:53:07 +0000 (11:53 -0600)]
don't error on network failures

4 years agoSpelling error "represening" to "representing"
Drew Ripberger [Thu, 13 Feb 2020 16:14:21 +0000 (11:14 -0500)]
Spelling error "represening" to "representing"

4 years agoUpdate books.
Eric Huss [Wed, 12 Feb 2020 23:20:29 +0000 (15:20 -0800)]
Update books.

4 years agoMake TraitCandidate generic.
Camille GILLOT [Thu, 13 Feb 2020 15:47:51 +0000 (16:47 +0100)]
Make TraitCandidate generic.

4 years agoUse HirId in TraitCandidate.
Camille GILLOT [Wed, 12 Feb 2020 18:46:05 +0000 (19:46 +0100)]
Use HirId in TraitCandidate.

4 years agoparser: inline parse_assoc_macro_invoc
Mazdak Farrokhzad [Sat, 1 Feb 2020 09:26:11 +0000 (10:26 +0100)]
parser: inline parse_assoc_macro_invoc

4 years agoparser: misc small item related improvements & cleanups.
Mazdak Farrokhzad [Sat, 1 Feb 2020 05:18:10 +0000 (06:18 +0100)]
parser: misc small item related improvements & cleanups.