Commit Graph

99942 Commits

Author SHA1 Message Date
Lzu Tao
eb4ca2120e Add lower bound doctests for saturating_{add,sub} signed ints 2019-10-01 05:46:50 +00:00
Mazdak Farrokhzad
5c5dd8069d syntax: reformat passing of FnHeader to parse_item_fn. 2019-10-01 06:10:06 +02:00
Mazdak Farrokhzad
e04690440b syntax: de-closure-ify check_or_expected. 2019-10-01 05:55:28 +02:00
Mazdak Farrokhzad
49780d21b6 syntax: merge things back into parse_visibility. 2019-10-01 05:53:23 +02:00
Mazdak Farrokhzad
30647d1a85 syntax: put helpers of parse_self_param in the method. 2019-10-01 05:45:41 +02:00
Mazdak Farrokhzad
df298b49f2 syntax: document some methods. 2019-10-01 05:13:42 +02:00
bors
42ec6831b0 Auto merge of #64932 - tmandry:rollup-7t8x1nz, r=tmandry
Rollup of 9 pull requests

Successful merges:

 - #64377 (Add long error explanation for E0493)
 - #64786 (Use https for curl when building for linux)
 - #64828 (Graphviz debug output for generic dataflow analysis)
 - #64838 (Add long error explanation for E0550)
 - #64891 (Fix `vec![x; n]` with null raw fat pointer zeroing the pointer metadata)
 - #64893 (Zero-initialize `vec![None; n]` for `Option<&T>`, `Option<&mut T>` and `Option<Box<T>>`)
 - #64911 (Fixed a misleading documentation issue #64844)
 - #64921 (Add test for issue-64662)
 - #64923 (Add missing links for mem::needs_drop)

Failed merges:

 - #64918 (Add long error explanation for E0551)

r? @ghost
2019-10-01 02:31:48 +00:00
Esteban Küber
13e9b3deb4 Deduplicate closure type errors
Closure typing obligations flow in both direcitons to properly infer
types. Because of this, we will get 2 type errors whenever there's
an unfulfilled obligation. To avoid this, we deduplicate them in the
`InferCtxt`.
2019-09-30 17:48:22 -07:00
AnthonyMikh
50c2a58d08
Fix borrowck errors
Reborrowing doesn't work for loops
2019-10-01 03:22:07 +03:00
AnthonyMikh
fdce4168fc
Hint type for .sum() 2019-10-01 03:04:01 +03:00
AnthonyMikh
515262cc13
Ascript type explicitly 2019-10-01 02:53:44 +03:00
AnthonyMikh
61bc38ecaa
Fix errors 2019-10-01 02:38:35 +03:00
AnthonyMikh
e5db5b34d7
(fmt) remove trailing whitespaces 2019-10-01 02:30:52 +03:00
David Wood
04fa9b1b3f
async/await: improve obligation errors
This commit improves obligation errors for async/await:

```
note: future does not implement `std::marker::Send` because this value is used across an
      await
  --> $DIR/issue-64130-non-send-future-diags.rs:15:5
   |
LL |     let g = x.lock().unwrap();
   |         - has type `std::sync::MutexGuard<'_, u32>`
LL |     baz().await;
   |     ^^^^^^^^^^^ await occurs here, with `g` maybe used later
LL | }
   | - `g` is later dropped here
```

Signed-off-by: David Wood <david@davidtw.co>
2019-09-30 23:41:20 +01:00
Sam Radhakrishnan
c9baaa70be Fixes #64919. Suggest fix based on operator precendence. 2019-09-30 18:16:34 -04:00
AnthonyMikh
bb442881fc
Use pattern matching instead of indexing tuples 2019-10-01 01:12:36 +03:00
Esteban Küber
0e6fb8e8da review comments 2019-09-30 15:11:19 -07:00
Esteban Küber
2ae87ff59d Avoid ICE on return outside of fn with literal array
Do not ICE when encountering `enum E { A = return [0][0] }`.
2019-09-30 15:11:19 -07:00
Vadim Petrochenkov
6ea4a52f47 Address review comments 2019-10-01 01:10:12 +03:00
AnthonyMikh
55b54285c8
Simplify a conditional in collect_annotations
Also avoid excessive cloning
2019-10-01 01:08:51 +03:00
Tyler Mandry
913c095bcf
Rollup merge of #64923 - lzutao:improve-doc-needs_drop, r=jonas-schievink
Add missing links for mem::needs_drop

r? @jonas-schievink
2019-09-30 14:38:32 -07:00
Tyler Mandry
e9d28796ec
Rollup merge of #64921 - JohnTitor:add-test-enum, r=varkor
Add test for issue-64662

Closes #64662
r? @varkor
2019-09-30 14:38:31 -07:00
Tyler Mandry
5560f8c664
Rollup merge of #64911 - hman523:64844, r=Dylan-DPC
Fixed a misleading documentation issue #64844

Made the suggested change from @steveklabnik on issue #64844
2019-09-30 14:38:28 -07:00
Tyler Mandry
a8ed9bfe02
Rollup merge of #64893 - SimonSapin:vec-of-option-box, r=sfackler
Zero-initialize `vec![None; n]` for `Option<&T>`, `Option<&mut T>` and `Option<Box<T>>`
2019-09-30 14:38:27 -07:00
Tyler Mandry
1cd9b4bc85
Rollup merge of #64891 - SimonSapin:vec-of-fat-raw-ptr, r=sfackler
Fix `vec![x; n]` with null raw fat pointer zeroing the pointer metadata

https://github.com/rust-lang/rust/pull/49496 introduced specialization based on:

```rust
unsafe impl<T: ?Sized> IsZero for *mut T {
    fn is_zero(&self) -> bool {
        (*self).is_null()
    }
}
```

… to call `RawVec::with_capacity_zeroed` for creating `Vec<*mut T>`, which is incorrect for fat pointers since `<*mut T>::is_null` only looks at the data component. That is, a fat pointer can be “null” without being made entirely of zero bits.

This commit fixes it by removing the `?Sized` bound on this impl (and the corresponding `*const T` one). This regresses `vec![x; n]` with `x` a null raw slice of length zero, but that seems exceptionally uncommon. (Vtable pointers are never null, so raw trait objects would not take the fast path anyway.)

An alternative to keep the `?Sized` bound (or even generalize to `impl<U: Copy> IsZero for U`) would be to cast to `&[u8]` of length `size_of::<U>()`, but the optimizer seems not to be able to propagate alignment information and sticks with comparing one byte at a time:

https://rust.godbolt.org/z/xQFkwL

----

Without the library change, the new test fails as follows:

```rust
---- vec::vec_macro_repeating_null_raw_fat_pointer stdout ----
[src/liballoc/tests/vec.rs:1301] ptr_metadata(raw_dyn) = 0x00005596ef95f9a8
[src/liballoc/tests/vec.rs:1306] ptr_metadata(vec[0]) = 0x0000000000000000
thread 'vec::vec_macro_repeating_null_raw_fat_pointer' panicked at 'assertion failed: vec[0] == null_raw_dyn', src/liballoc/tests/vec.rs:1307:5
```
2019-09-30 14:38:25 -07:00
Tyler Mandry
3add9790ab
Rollup merge of #64838 - GuillaumeGomez:long-err-explanation-e0550, r=oli-obk
Add long error explanation for E0550

Part of #61137
2019-09-30 14:38:24 -07:00
Tyler Mandry
686ad4da9e
Rollup merge of #64828 - ecstatic-morse:generic-dataflow-graphviz, r=oli-obk
Graphviz debug output for generic dataflow analysis

A follow up to #64566.

This outputs graphviz diagrams in the generic dataflow engine when `#[rustc_mir(borrowck_graphviz_postflow="suffix.dot")]` is set on an item. This code is based on [`dataflow/graphviz.rs`](https://github.com/rust-lang/rust/blob/master/src/librustc_mir/dataflow/graphviz.rs), but displays different information since there are no "gen"/"kill" sets and transfer functions cannot be coalesced in the generic analysis. As a result, we show the dataflow state at the start and end of each block, as well as the changes resulting from each statement. I also render the state bitset in full  (`{_1,_2}`) instead of hex-encoded as the current renderer does (`06`).
2019-09-30 14:38:22 -07:00
Tyler Mandry
fb8f9b47eb
Rollup merge of #64786 - tmandry:patch-1, r=alexcrichton
Use https for curl when building for linux

I noticed that the dist-x86_64-linux builder uses http to fetch curl and doesn't do any signature verification. It should probably use https.

r? @alexcrichton @Mark-Simulacrum
2019-09-30 14:38:21 -07:00
Tyler Mandry
30ba6fd99c
Rollup merge of #64377 - GuillaumeGomez:E0493, r=estebank
Add long error explanation for E0493

Part of #61137.
2019-09-30 14:38:19 -07:00
AnthonyMikh
9d73176978
Remove redundant .iter_mut() 2019-10-01 00:10:23 +03:00
AnthonyMikh
7a807c5b14
Simplify EmitterWriter::emit_suggestion_default
Make function return early if source map is not present
2019-10-01 00:01:22 +03:00
AnthonyMikh
21724eda05
Update doc comment for style_or_override 2019-09-30 23:50:58 +03:00
Mark Rousskov
1a1067d1a5 Make the default parallelism 1
This changes the default parallelism for parallel compilers to one,
instead of the previous default, which was "num cpus". This is likely
not an optimal default long-term, but it is a good default for testing
whether parallel compilers are not a significant regression over a
sequential compiler.

Notably, this in theory makes a parallel-enabled compiler behave
exactly like a sequential compiler with respect to the jobserver.
2019-09-30 16:49:19 -04:00
AnthonyMikh
7b4c5c62aa
Simplify EmitterWriter::get_max_line_num 2019-09-30 23:47:51 +03:00
AnthonyMikh
6b6a79b190
Simplify EmitterWriter::get_multispan_max_line_num 2019-09-30 23:43:24 +03:00
AnthonyMikh
7dc953b493
Simplify code for special case of annotation 2019-09-30 23:33:17 +03:00
David Wood
870b47fee4
typeck: silence unreachable code from await
This commit silences the unreachable code lint when it originates from
within a await desugaring.

Signed-off-by: David Wood <david@davidtw.co>
2019-09-30 21:27:18 +01:00
Vadim Petrochenkov
957986d056 syntax: Support modern attribute syntax in the meta matcher 2019-09-30 22:58:22 +03:00
Yuki Okushi
9c73131fd0 Add test for #58344 2019-10-01 04:55:46 +09:00
Yuki Okushi
bc25746d48 Add test for #58022 2019-10-01 04:55:29 +09:00
Yuki Okushi
576c215ab9 Add test for #50571 2019-10-01 04:55:12 +09:00
Vadim Petrochenkov
535d4743a4 syntax: Split ast::Attribute into container and inner parts 2019-09-30 22:36:25 +03:00
Vadim Petrochenkov
5ae38bbc7c Stabilize proc macros in type positions 2019-09-30 21:59:35 +03:00
Vadim Petrochenkov
349259d55f Stabilize macros in extern blocks
Add some tests for macros in extern blocks, remove duplicate tests
2019-09-30 21:59:35 +03:00
Dylan MacKenzie
2b8e023b9d Stop printing Qualif results in debug logs
Now we can use the dataflow graphviz debugging.
2019-09-30 11:24:27 -07:00
Dylan MacKenzie
cf5f5c55be Use separate files for debugging Qualif dataflow results 2019-09-30 11:24:27 -07:00
Dylan MacKenzie
cd24cd4eec Update consumers of generic::Engine API 2019-09-30 11:24:27 -07:00
Dylan MacKenzie
d37c318677 Add graphviz debug output for generic dataflow 2019-09-30 11:24:27 -07:00
Dylan MacKenzie
3e88aa20b4 Allow ResultsCursor to borrow the underlying Results 2019-09-30 11:21:16 -07:00
Dylan MacKenzie
f33d94d88f Fix typo in docs 2019-09-30 11:21:16 -07:00