Commit Graph

101263 Commits

Author SHA1 Message Date
Esteban Küber
7ea28e761f review comment: use Default 2019-10-26 15:26:08 -07:00
Esteban Küber
93bb780e38 review comments and tweaks 2019-10-26 15:26:08 -07:00
Esteban Küber
55e4e2d52e Remove unnecessary error in test 2019-10-26 15:26:08 -07:00
Esteban Küber
6206a5a1b4 Use heuristics to suggest assignment
When detecting a possible `=` -> `:` typo in a `let` binding, suggest
assigning instead of setting the type.
2019-10-26 15:26:08 -07:00
bors
46e6c533d0 Auto merge of #65845 - Centril:rollup-28jtjfc, r=Centril
Rollup of 8 pull requests

Successful merges:

 - #65743 (rustc_typeck: don't record direct callees in generator_interior.)
 - #65761 (libsyntax: Enhance documentation of the AST module)
 - #65772 (Remove the last remaining READMEs)
 - #65773 (Increase spacing for suggestions in diagnostics)
 - #65791 (Adding doc on keyword continue)
 - #65824 (rustc: make DefPathData (and friends) Copy (now that it uses Symbol).)
 - #65828 (Derive Eq and Hash for SourceInfo again)
 - #65842 (Add more information on rustdoc search)

Failed merges:

 - #65825 (rustc: use IndexVec<DefIndex, T> instead of Vec<T>.)

r? @ghost
2019-10-26 16:14:16 +00:00
Mazdak Farrokhzad
d319ba2ccc
Rollup merge of #65842 - GuillaumeGomez:more-search-information, r=Dylan-DPC
Add more information on rustdoc search

Fixes #65735.

r? @kinnison
2019-10-26 14:17:51 +02:00
Mazdak Farrokhzad
d0d284eb39
Rollup merge of #65828 - bjorn3:add_source_info_eq_hash, r=petrochenkov
Derive Eq and Hash for SourceInfo again

In 75c24b9c96/src/common.rs (L368) I store it in a `indexmap::IndexSet`, which requires `Eq` and `Hash`. Unfortunately they were removed in https://github.com/rust-lang/rust/pull/65647, so I can't update to latest nightly.
2019-10-26 14:17:50 +02:00
Mazdak Farrokhzad
84b62a08b9
Rollup merge of #65824 - eddyb:def-key-copy, r=varkor
rustc: make DefPathData (and friends) Copy (now that it uses Symbol).

Spotted this while working on something else.
2019-10-26 14:17:48 +02:00
Mazdak Farrokhzad
7325a886e2
Rollup merge of #65791 - dorfsmay:doc_keyword_continue, r=Mark-Simulacrum
Adding doc on keyword continue

Partial solution of issue #34601.
2019-10-26 14:17:46 +02:00
Mazdak Farrokhzad
0aa7c6f96b
Rollup merge of #65773 - estebank:sugg-whitespace, r=Centril
Increase spacing for suggestions in diagnostics

Make the spacing between the code snippet and verbose structured
suggestions consistent with note and help messages.

r? @Centril
2019-10-26 14:17:45 +02:00
Mazdak Farrokhzad
78a4f8c8ce
Rollup merge of #65772 - mark-i-m:final-readmes, r=nikomatsakis
Remove the last remaining READMEs

cc https://github.com/rust-lang/rustc-guide/pull/481

closes #48478

r? @nikomatsakis
2019-10-26 14:17:43 +02:00
Mazdak Farrokhzad
d51a84259e
Rollup merge of #65761 - popzxc:document-ast, r=petrochenkov
libsyntax: Enhance documentation of the AST module

This PR enhances documentation state to the `libsyntax/ast.rs` (as initiative caused by [rustc-guide#474](https://github.com/rust-lang/rustc-guide/issues/474)), by adding:
- Module documentation.
- Doc-comments (and a bit of usual comments) in non-obvious (as for me) places.
- Minor style fixes to improve module readability.
2019-10-26 14:17:42 +02:00
Mazdak Farrokhzad
4f43352964
Rollup merge of #65743 - eddyb:generator-on-call, r=matthewjasper
rustc_typeck: don't record direct callees in generator_interior.

For expressions like `f(g().await)` we were recording `f` as needing to be kept in a temporary (and therefore be tracked by the generator type) across the suspend, even if a function/method path.
However, this is never needed, and can cause issues with complex function types (see #65244).

cc @Zoxc @nikomatsakis
2019-10-26 14:17:40 +02:00
Guillaume Gomez
1f25fd74a0 Add more information on search 2019-10-26 12:59:54 +02:00
bors
8318ef26c1 Auto merge of #65758 - RalfJung:miri, r=oli-obk
update Miri

Fixes https://github.com/rust-lang/rust/issues/65684
2019-10-26 09:19:48 +00:00
Ralf Jung
58da335e83 update miri 2019-10-26 10:15:06 +02:00
Ralf Jung
327ae38a0b use plain cargo to install xargo 2019-10-26 10:15:06 +02:00
Ralf Jung
f809f9e08f bootstrap now takes care of installing xargo 2019-10-26 10:15:06 +02:00
Ralf Jung
1166db7603 update Miri 2019-10-26 10:15:06 +02:00
Igor Aleksanov
ae5203a142 libsyntax: Document ast module
Apply review suggestions

Remove links in the module docs

Flatten imports

Apply review suggestions

Remove useless comments

Fix nits
2019-10-26 06:56:11 +03:00
bors
084edc426f Auto merge of #63812 - eddyb:promo-sanity, r=oli-obk
rustc_mir: double-check const-promotion candidates for sanity.

Previously, const promotion involved tracking information about the value in a MIR local (or any part of the computation leading up to that value), aka "qualifs", in a quite stateful manner, which is hard to extend to arbitrary CFGs without a dataflow pass.

However, the nature of the promotion we do is that it's effectively an SSA-like "tree" (or DAG, really), of assigned-once locals - which is how we can take them from the original MIR in the first place.
This structure means that the subset of the MIR responsible for computing any given part of a const-promoted value is readily analyzable by walking that tree/DAG.

This PR implements such an analysis in `promote_consts`, reusing the `HasMutInterior` / `NeedsDrop` computation from `qualify_consts`, but reimplementing the equivalent of `IsNotPromotable` / `IsNotImplicitlyPromotable`.

Eventually we should be able to remove `IsNotPromotable` / `IsNotImplicitlyPromotable` from `qualify_consts`, which will simplify @ecstatic-morse's dataflow-based const-checking efforts.

But currently this is mainly for a crater check-only run - it will compare the results from the old promotion collection and the new promotion validation and ICE if they don't match.

r? @oli-obk
2019-10-26 00:11:36 +00:00
Eduard-Mihai Burtescu
f2c8628920 rustc_mir: use the new validator's Qualif in promotion. 2019-10-26 01:45:54 +03:00
Eduard-Mihai Burtescu
6c55fb8227 rustc_mir: double-check const-promotion candidates for sanity. 2019-10-26 01:45:53 +03:00
bors
246be7e1a5 Auto merge of #65826 - JohnTitor:rollup-mr6crka, r=JohnTitor
Rollup of 6 pull requests

Successful merges:

 - #65705 (Add {String,Vec}::into_raw_parts)
 - #65749 (Insurance policy in case `iter.size_hint()` lies.)
 - #65799 (Fill tracking issue number for `array_value_iter`)
 - #65800 (self-profiling: Update measureme to 0.4.0 and remove non-RAII methods from profiler.)
 - #65806 (Add [T]::as_ptr_range() and [T]::as_mut_ptr_range().)
 - #65810 (SGX: Clear additional flag on enclave entry)

Failed merges:

r? @ghost
2019-10-25 20:41:28 +00:00
bjorn3
f04867cafb Derive Eq and Hash for SourceInfo again 2019-10-25 21:39:02 +02:00
Yuki Okushi
d40c6afba0
Rollup merge of #65810 - raoulstrackx:ac_mitigation, r=nagisa
SGX: Clear additional flag on enclave entry

An attacker could set both the AC flag in CR0 as in rflags. This causes the enclave to perform an AEX upon a misaligned memory access, and an attacker learns some information about the internal enclave state.
The AC flag in rflags is copied from userspace upon an enclave entry. Upon AEX it is copied and later restored. This patch forces the rflag.AC bit to be reset right after an enter.
2019-10-26 02:46:02 +09:00
Yuki Okushi
f0c58e9d85
Rollup merge of #65806 - fusion-engineering-forks:slice-ptr-range, r=Centril
Add [T]::as_ptr_range() and [T]::as_mut_ptr_range().

Implementation of https://github.com/rust-lang/rfcs/pull/2791
2019-10-26 02:46:01 +09:00
Yuki Okushi
574b0780ab
Rollup merge of #65800 - michaelwoerister:measureme-0.4.0, r=wesleywiser
self-profiling: Update measureme to 0.4.0 and remove non-RAII methods from profiler.

This PR removes all non-RAII based profiling methods from `SelfProfilerRef` 🎉
It also delegates the `TimingGuard` implementation to `measureme`, now that that is available there.

r? @wesleywiser
2019-10-26 02:45:59 +09:00
Yuki Okushi
9192f3625d
Rollup merge of #65799 - LukasKalbertodt:fill-array-value-iter-tracking-issue, r=Centril
Fill tracking issue number for `array_value_iter`

Thanks for [noticing](https://github.com/rust-lang/rust/pull/62959#discussion_r338930448)!

r? @Centril
2019-10-26 02:45:58 +09:00
Yuki Okushi
7068c2d4e9
Rollup merge of #65749 - Centril:insurance-policy, r=RalfJung
Insurance policy in case `iter.size_hint()` lies.

Follow up to https://github.com/rust-lang/rust/pull/64949/files#r334235076.
(If the perf impact is bad we can use `debug_assert!` instead.)

The good news is that the UI tests pass locally so `iter.size_hint()` seems to be honest *thus far*.
On the other hand, with the status quo we do not have an insurance policy should that change in some case. This is problematic because a) this could possibly make some program be accepted which shouldn't, b) the compiler itself could have memory unsafety if the correctness of the iterator is assumed in `unsafe { ... }` code (even though the blame lies with the `unsafe { ... }` block in question.)

r? @RalfJung
cc @nnethercote
2019-10-26 02:45:57 +09:00
Yuki Okushi
a808ba374f
Rollup merge of #65705 - shepmaster:vec-into-raw, r=SimonSapin
Add {String,Vec}::into_raw_parts

Aspects to address:

- [x] Create a tracking issue
  - #65816
2019-10-26 02:45:56 +09:00
Eduard-Mihai Burtescu
595d19e625 rustc: replace a few .cloned() with .copied(). 2019-10-25 20:21:37 +03:00
Eduard-Mihai Burtescu
4d81e9dd2f rustc: make DefPathData (and friends) Copy (now that it uses Symbol). 2019-10-25 20:03:17 +03:00
Mara Bos
381c4425b7 Fix slice::as_ptr_range doctest. 2019-10-25 18:01:31 +02:00
Mazdak Farrokhzad
dfcfca28ad Take out an insurance policy in case iter.size_hint()
lies, underreporting the number of elements.
2019-10-25 17:43:53 +02:00
Jake Goulding
6600cf6040 Add {String,Vec}::into_raw_parts 2019-10-25 11:25:52 -04:00
Jake Goulding
dce8fabc62 Use ManuallyDrop in examples for {Vec,String}::from_raw_parts 2019-10-25 11:22:53 -04:00
Jake Goulding
0d21d257c9 Remove unneeded pointer casting 2019-10-25 11:20:47 -04:00
Raoul Strackx
5aafa98562 forgot pushfq/popqfq: fixed 2019-10-25 16:06:13 +02:00
Mara Bos
de9b660a40 Explain why pointer::add in slice::as_ptr_range is safe. 2019-10-25 15:46:42 +02:00
Raoul Strackx
34f5d5923f cleaning up code 2019-10-25 15:44:07 +02:00
Raoul Strackx
d257c20a1d removed unnecessary push 2019-10-25 15:27:48 +02:00
Mara Bos
f1b69b0a87 Add slice_ptr_range tracking issue number. 2019-10-25 14:33:07 +02:00
Mara Bos
4936f96d42 Add [T]::as_ptr_range() and [T]::as_mut_ptr_range().
See https://github.com/rust-lang/rfcs/pull/2791 for motivation.
2019-10-25 14:09:32 +02:00
bors
23f890f102 Auto merge of #65804 - Centril:rollup-arlxgch, r=Centril
Rollup of 9 pull requests

Successful merges:

 - #64639 (Stabilize `#[non_exhaustive]` (RFC 2008))
 - #65074 (Fix the start/end byte positions in the compiler JSON output)
 - #65315 (Intern place projection)
 - #65685 (Fix check of `statx` and handle EPERM)
 - #65731 (Prevent unnecessary allocation in PathBuf::set_extension.)
 - #65740 (Fix default "disable-shortcuts" feature value)
 - #65787 (move panictry! to where it is used.)
 - #65789 (move Attribute::with_desugared_doc to librustdoc)
 - #65790 (move report_invalid_macro_expansion_item to item.rs)

Failed merges:

r? @ghost
2019-10-25 11:13:30 +00:00
Mazdak Farrokhzad
c0bbb4bcdc
Rollup merge of #65790 - Centril:move-report-invalid, r=davidtwco
move report_invalid_macro_expansion_item to item.rs

From https://github.com/rust-lang/rust/pull/65324.

r? @Mark-Simulacrum
2019-10-25 13:12:55 +02:00
Mazdak Farrokhzad
cbcbba24ac
Rollup merge of #65789 - Centril:with-desugared-doc, r=davidtwco
move Attribute::with_desugared_doc to librustdoc

From https://github.com/rust-lang/rust/pull/65324.

r? @varkor
2019-10-25 13:12:54 +02:00
Mazdak Farrokhzad
0bfe483c5c
Rollup merge of #65787 - Centril:panictry, r=davidtwco
move panictry! to where it is used.

From https://github.com/rust-lang/rust/pull/65324

r? @davidtwco
2019-10-25 13:12:53 +02:00
Mazdak Farrokhzad
07b5c2a46e
Rollup merge of #65740 - GuillaumeGomez:fix-disable-shortcut-feature, r=Dylan-DPC
Fix default "disable-shortcuts" feature value

Follow-up of https://github.com/rust-lang/rust/pull/65656

It fixes the bad handling of the default value of the feature (which would disable shortcut by default, which is bad!).

r? @Dylan-DPC
cc @kinnison
2019-10-25 13:12:51 +02:00
Mazdak Farrokhzad
3e3f21cd0a
Rollup merge of #65731 - fusion-engineering-forks:set-extension, r=dtolnay
Prevent unnecessary allocation in PathBuf::set_extension.

It was allocating a new `OsString` that was immediately dropped after using it with `set_file_name`. Now it directly changes the extension in the original buffer, without touching the rest of the file name or allocating a temporary string.
2019-10-25 13:12:50 +02:00