]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoUpdate cargo, rls
Eric Huss [Tue, 21 Apr 2020 21:11:30 +0000 (14:11 -0700)]
Update cargo, rls

4 years agoAuto merge of #71170 - spastorino:dyn-fnonce-alignment, r=nikomatsakis
bors [Tue, 21 Apr 2020 08:58:44 +0000 (08:58 +0000)]
Auto merge of #71170 - spastorino:dyn-fnonce-alignment, r=nikomatsakis

Make Box<dyn FnOnce> respect self alignment

Closes #68304

r? @eddyb @nikomatsakis

4 years agoAuto merge of #71267 - pnkfelix:issue-71248-dont-need-exports-all-green, r=nagisa
bors [Tue, 21 Apr 2020 04:35:17 +0000 (04:35 +0000)]
Auto merge of #71267 - pnkfelix:issue-71248-dont-need-exports-all-green, r=nagisa

attempt to recover perf by removing `exports_all_green`

attempt to recover perf by removing `exports_all_green` flag.

cc #71248

(My hypothesis is that my use of this flag was an overly conservative generalization of PR #67020.)

4 years agoAuto merge of #71367 - Dylan-DPC:rollup-ysj4olr, r=Dylan-DPC
bors [Tue, 21 Apr 2020 01:26:56 +0000 (01:26 +0000)]
Auto merge of #71367 - Dylan-DPC:rollup-ysj4olr, r=Dylan-DPC

Rollup of 4 pull requests

Successful merges:

 - #69362 (Stabilize most common subset of alloc_layout_extras)
 - #71174 (Check that main/start is not async)
 - #71285 (MIR: use HirId instead of NodeId to avoid cycles while inlining)
 - #71346 (Do not build tools if user do not want them)

Failed merges:

r? @ghost

4 years agoRollup merge of #71346 - mati865:rustbuild-tools, r=Mark-Simulacrum
Dylan DPC [Mon, 20 Apr 2020 22:30:58 +0000 (00:30 +0200)]
Rollup merge of #71346 - mati865:rustbuild-tools, r=Mark-Simulacrum

Do not build tools if user do not want them

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

4 years agoRollup merge of #71285 - ljedrz:mir_inline_span_for_optimized_mir, r=ecstatic-morse
Dylan DPC [Mon, 20 Apr 2020 22:30:57 +0000 (00:30 +0200)]
Rollup merge of #71285 - ljedrz:mir_inline_span_for_optimized_mir, r=ecstatic-morse

MIR: use HirId instead of NodeId to avoid cycles while inlining

I wanted to see if I could limit the number of uses of `NodeId` when `HirId` is available and I saw that some of the MIR `Inliner` code could use `Span` instead of `NodeId`, not unlike in https://github.com/rust-lang/rust/pull/71197.

~If I'm understanding the reason for not calling `optimized_mir` in incremental builds here correctly, this change could also allow us to do so.~

This change could affect performance, so if this approach makes sense, a perf run is probably a good idea.

4 years agoRollup merge of #71174 - Nokel81:fix-async-main-error, r=petrochenkov
Dylan DPC [Mon, 20 Apr 2020 22:30:55 +0000 (00:30 +0200)]
Rollup merge of #71174 - Nokel81:fix-async-main-error, r=petrochenkov

Check that main/start is not async

* Add new error code E0752
* Add span to hir::IsAsync::Yes
* Emit an error if main or the start function is marked as async
* Add two regression tests

This PR fixes #68523.

4 years agoRollup merge of #69362 - CAD97:alloc_layout_extras, r=Amanieu
Dylan DPC [Mon, 20 Apr 2020 22:30:53 +0000 (00:30 +0200)]
Rollup merge of #69362 - CAD97:alloc_layout_extras, r=Amanieu

Stabilize most common subset of alloc_layout_extras

Tracking issue: https://github.com/rust-lang/rust/issues/55724

Specifically, this stabilizes:

```rust
pub fn Layout::align_to(&self, align: usize) -> Result<Layout, LayoutErr>;
pub fn Layout::pad_to_align(&self) -> Layout;
pub fn Layout::extend(&self, next: Layout) -> Result<(Layout, usize), LayoutErr>;
pub fn Layout::array<T>(n: usize) -> Result<Layout, LayoutErr>;
```

Methods that are tracked by #55724 but are not stabilized here:

```rust
pub fn Layout::padding_needed_for(&self, align: usize) -> usize;
pub fn Layout::repeat(&self, n: usize) -> Result<(Layout, usize), LayoutErr>;
pub fn Layout::repeat_packed(&self, n: usize) -> Result<Layout, LayoutErr>;
pub fn Layout::extend_packed(&self, next: Layout) -> Result<Layout, LayoutErr>;
```

Combined, these stabilized functions allow code to construct and manipulate `repr(C)` layouts while letting the standard library handle correctness in the face of edge cases. For example use cases, consider the usage in [hashbrown](https://github.com/Amanieu/hashbrown/blob/2f2af1d/src/raw/mod.rs#L143), [crossbeam-skiplist](https://github.com/crossbeam-rs/crossbeam-skiplist/blob/master/src/base.rs#L99), [pointer-utils/slice-dst](https://github.com/CAD97/pointer-utils/blob/92aeefeed9399f28d1b1654b63f8dcbe1242d8d4/crates/slice-dst/src/layout_polyfill.rs), and of course the standard library itself.

Providing a higher-level API such as `Layout::repr_c<const N: usize>(fields: [Layout; N]) -> Result<(Layout, [usize; N]), LayoutErr>` is blocked on const generics, which are a ways off. Providing an API that doesn't provide offsets would be quite suboptimal, as the reason for calculating the layout like this rather than `Layout::new` is to get the field offsets.

The primary issue with the current API is having to call `.pad_to_align()` to match the layout of a `repr(C)` struct. However, I think this is not just a (failing? limitation?) of the API, but rather intrinsic complexity. While all Rust-defined types have size==stride, and probably will for the foreseeable future, there is no inherent reason why this is a limitation of all allocations. As such, the `Layout` manipulation APIs shouldn't impose this limitation, and instead the higher level api of `repr_c` (or just plain old using `Layout::new`) can make keeping it simple.

cc @matklad r? @rust-lang/libs

4 years agoAuto merge of #71356 - Dylan-DPC:rollup-liockhk, r=Dylan-DPC
bors [Mon, 20 Apr 2020 19:11:28 +0000 (19:11 +0000)]
Auto merge of #71356 - Dylan-DPC:rollup-liockhk, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #71250 (Replace big JS dict with JSON parsing)
 - #71270 (Fix `has_no_input_arg` check and rename it to `has_only_self_parameter`)
 - #71284 (fix -Zast-json to output correct JSON form)
 - #71328 (Stabilize PathBuf capacity methods)
 - #71334 (Update pattern docs.)

Failed merges:

r? @ghost

4 years agoDo not build tools if user do not want them
Mateusz Mikuła [Mon, 20 Apr 2020 10:39:12 +0000 (12:39 +0200)]
Do not build tools if user do not want them

4 years agoImprove Layout::extend docs
CAD97 [Mon, 20 Apr 2020 16:30:35 +0000 (12:30 -0400)]
Improve Layout::extend docs

4 years agoUpdate src/libcore/alloc/layout.rs
Christopher Durham [Mon, 20 Apr 2020 16:28:30 +0000 (12:28 -0400)]
Update src/libcore/alloc/layout.rs

Co-Authored-By: Amanieu d'Antras <amanieu@gmail.com>
4 years agoRollup merge of #71334 - ehuss:pattern-docs, r=kennytm
Dylan DPC [Mon, 20 Apr 2020 16:07:12 +0000 (18:07 +0200)]
Rollup merge of #71334 - ehuss:pattern-docs, r=kennytm

Update pattern docs.

A few changes to help clarify string pattern usage:

* Add some examples and stability information in the `pattern` module.
* Fixes the links at https://doc.rust-lang.org/std/str/pattern/ because intra-doc-links don't work with re-exported modules (#65983 I think?).
* Consistently use the same phrasing for `str` methods taking a pattern.
    * Also mention that array of `char` is also accepted.

When `Pattern` is stabilized, the phrasing in the `str` methods can be updated to be more general to reflect the exact behavior. I'm reluctant to do this now because the stability story for `Pattern` is uncertain. It may perhaps look something like:

> The pattern can be any type that implements the [`Pattern`] trait. Notable examples are `&str`, [`char`], arrays of [`char`], or functions or closures that determines if a character matches. Additional libraries might provide more complex patterns like regular expressions.

This is complicated because methods like `trim_matches` have bounds, which for example don't support `str`, so those methods may need more elaboration.

4 years agoRollup merge of #71328 - Mark-Simulacrum:stabilize-pathbuf-capacity, r=sfackler
Dylan DPC [Mon, 20 Apr 2020 16:07:11 +0000 (18:07 +0200)]
Rollup merge of #71328 - Mark-Simulacrum:stabilize-pathbuf-capacity, r=sfackler

Stabilize PathBuf capacity methods

Closes https://github.com/rust-lang/rust/issues/58234.

Stabilization FCP finished in https://github.com/rust-lang/rust/issues/58234#issuecomment-616048777.

4 years agoRollup merge of #71284 - JOE1994:serialize_id, r=petrochenkov
Dylan DPC [Mon, 20 Apr 2020 16:07:09 +0000 (18:07 +0200)]
Rollup merge of #71284 - JOE1994:serialize_id, r=petrochenkov

fix -Zast-json to output correct JSON form

fixes #71086 (Reverts some of the changes made in #70215)

JSON output (from an empty library) after fix has something for **"id"** field
```shell
lonelyjoe@lonelyjoe-desktop:~/workspace/empty_lib/src$ rustc lib.rs -Zast-json
```
```json
{
   "module":{
      "inner":{
         "lo":0,
         "hi":94
      },
      "items":[
         {
            "attrs":[
               {
                  "kind":{
                     "variant":"Normal",
                     "fields":[
                        {
                           "path":{
                              "span":{
                                 "lo":0,
                                 "hi":0
                              },
                              "segments":[
                                 {
                                    "ident":{
                                       "name":"prelude_import",
                                       "span":{
                                          "lo":0,
                                          "hi":0
                                       }
                                    },
                                    "id":3,
                                    "args":null
                                 }
                              ]
                           },
                           "args":"Empty"
                        }
                     ]
                  },
                  "id":null,
                  "style":"Outer",
                  "span":{
                     "lo":0,
                     "hi":0
                  }
               }
            ],
            "id":4,
            "span":{
               "lo":0,
               "hi":0
            },
            "vis":{
               "node":"Inherited",
               "span":{
                  "lo":0,
                  "hi":0
               }
            },
            "ident":{
               "name":"",
               "span":{
                  "lo":0,
                  "hi":0
               }
            },
            "kind":{
               "variant":"Use",
               "fields":[
                  {
                     "prefix":{
                        "span":{
                           "lo":0,
                           "hi":0
                        },
                        "segments":[
                           {
                              "ident":{
                                 "name":"{{root}}",
                                 "span":{
                                    "lo":0,
                                    "hi":0
                                 }
                              },
                              "id":5,
                              "args":null
                           },
                           {
                              "ident":{
                                 "name":"std",
                                 "span":{
                                    "lo":0,
                                    "hi":0
                                 }
                              },
                              "id":6,
                              "args":null
                           },
                           {
                              "ident":{
                                 "name":"prelude",
                                 "span":{
                                    "lo":0,
                                    "hi":0
                                 }
                              },
                              "id":7,
                              "args":null
                           },
                           {
                              "ident":{
                                 "name":"v1",
                                 "span":{
                                    "lo":0,
                                    "hi":0
                                 }
                              },
                              "id":8,
                              "args":null
                           }
                        ]
                     },
                     "kind":"Glob",
                     "span":{
                        "lo":0,
                        "hi":0
                     }
                  }
               ]
            },
            "tokens":null
         },
         {
            "attrs":[
               {
                  "kind":{
                     "variant":"Normal",
                     "fields":[
                        {
                           "path":{
                              "span":{
                                 "lo":0,
                                 "hi":0
                              },
                              "segments":[
                                 {
                                    "ident":{
                                       "name":"macro_use",
                                       "span":{
                                          "lo":0,
                                          "hi":0
                                       }
                                    },
                                    "id":9,
                                    "args":null
                                 }
                              ]
                           },
                           "args":"Empty"
                        }
                     ]
                  },
                  "id":null,
                  "style":"Outer",
                  "span":{
                     "lo":0,
                     "hi":0
                  }
               }
            ],
            "id":10,
            "span":{
               "lo":0,
               "hi":0
            },
            "vis":{
               "node":"Inherited",
               "span":{
                  "lo":0,
                  "hi":0
               }
            },
            "ident":{
               "name":"std",
               "span":{
                  "lo":0,
                  "hi":0
               }
            },
            "kind":{
               "variant":"ExternCrate",
               "fields":[
                  null
               ]
            },
            "tokens":null
         }
      ],
      "inline":true
   },
   "attrs":[

   ],
   "span":{
      "lo":0,
      "hi":94
   },
   "proc_macros":[

   ]
}
```

4 years agoRollup merge of #71270 - Rustin-Liu:rustin-patch-has-self, r=estebank
Dylan DPC [Mon, 20 Apr 2020 16:07:07 +0000 (18:07 +0200)]
Rollup merge of #71270 - Rustin-Liu:rustin-patch-has-self, r=estebank

Fix `has_no_input_arg` check and rename it to `has_only_self_parameter`

Signed-off-by: Rustin-Liu <rustin.liu@gmail.com>
Fixes https://github.com/rust-lang/rust/pull/70643#discussion_r401571789.

4 years agoRollup merge of #71250 - GuillaumeGomez:use-json-instead-of-js, r=kinnison
Dylan DPC [Mon, 20 Apr 2020 16:07:05 +0000 (18:07 +0200)]
Rollup merge of #71250 - GuillaumeGomez:use-json-instead-of-js, r=kinnison

Replace big JS dict with JSON parsing

Part of #56545.

@ollie27 suggested that using JSON instead of a JS dict might be faster, so I decided to test it. And the results far exceeded whatever expectations I had...

I used https://github.com/adamgreig/stm32ral for my tests. If you want to build it locally:

```bash
$ cargo doc --features doc --open
```

But I strongly recommend to do it with this PR. Some numbers:

 * Loading a page with the JSON search-index: less than 1 second
 * Loading a page with the JS search-index: crashed after 30 seconds

I think the results are clear enough...

r? @ollie27

cc @rust-lang/rustdoc

4 years agoExpand comment to justify not checking if all the exports are green.
Felix S. Klock II [Mon, 20 Apr 2020 14:33:27 +0000 (10:33 -0400)]
Expand comment to justify not checking if all the exports are green.

4 years agoCheck that main/start is not async
Sebastian Malton [Wed, 8 Apr 2020 19:39:02 +0000 (15:39 -0400)]
Check that main/start is not async

* Add new error code E0752
* Add span to hir::IsAsync::Yes
* Emit an error if main or the start function is marked as async
* Add two regression tests

Fix formatting errors and bless test outputs
* move tests to ui/async-await

fix test error text

remove span from IsAsync

4 years agoAuto merge of #70729 - nnethercote:a-big-options-clean-up, r=petrochenkov
bors [Mon, 20 Apr 2020 12:30:45 +0000 (12:30 +0000)]
Auto merge of #70729 - nnethercote:a-big-options-clean-up, r=petrochenkov

A big options clean-up

Lots of improvements here.

r? @Centril

4 years agotweak comments
Niko Matsakis [Mon, 20 Apr 2020 09:41:54 +0000 (09:41 +0000)]
tweak comments

4 years agoAuto merge of #71232 - eddyb:print-const-adts, r=oli-obk
bors [Mon, 20 Apr 2020 05:30:12 +0000 (05:30 +0000)]
Auto merge of #71232 - eddyb:print-const-adts, r=oli-obk

ty/print: pretty-print constant aggregates (arrays, tuples and ADTs).

Oddly enough, we don't have any UI tests showing this off in types, only `mir-opt` tests.
However, the pretty form should show up in the test output diff of #71018, if this PR is merged first.

<hr/>

Examples of before/after:
|`Option<bool>`|
|:-:|
|`{transmute(0x01): std::option::Option<bool>}`|
| :sparkles: ↓↓↓ :sparkles: |
|`std::option::Option::<bool>::Some(true)`|

| `RawVec<u32>` |
|:-:|
| `ByRef { alloc: Allocation { bytes: [4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], relocations: Relocations(SortedMap { data: [] }), undef_mask: UndefMask { blocks: [65535], len: Size { raw: 16 } }, size: Size { raw: 16 }, align: Align { pow2: 3 }, mutability: Not, extra: () }, offset: Size { raw: 0 } }: alloc::raw_vec::RawVec::<u32>`|
| :sparkles: ↓↓↓ :sparkles: |
|`alloc::raw_vec::RawVec::<u32> { ptr: std::ptr::Unique::<u32> { pointer: {0x4 as *const u32}, _marker: std::marker::PhantomData::<u32> }, cap: 0usize, alloc: std::alloc::Global }`|

<hr/>

This PR is a prerequisite for #61486, *sort of*, in that we need to be able to pretty-print values in order to even consider how we might mangle them.
We still don't have pretty-printing for constants of reference types, @oli-obk has the necessary support logic in a PR but I didn't want to interfere with that.

<hr/>

Each commit should be reviewed separately, as I've fixed a couple deficiencies along the way.

r? @oli-obk cc @rust-lang/wg-mir-opt @varkor @yodaldevoid

4 years agocheck '-Zast-json' & '-Zast-json-noexpand' to output legal JSON
JOE1994 [Mon, 20 Apr 2020 02:24:42 +0000 (22:24 -0400)]
check '-Zast-json' & '-Zast-json-noexpand' to output legal JSON

4 years agoAuto merge of #71007 - Amanieu:deprecate_asm, r=Mark-Simulacrum
bors [Mon, 20 Apr 2020 02:18:00 +0000 (02:18 +0000)]
Auto merge of #71007 - Amanieu:deprecate_asm, r=Mark-Simulacrum

Deprecate the asm! macro in favor of llvm_asm!

Since we will be changing the syntax of `asm!` soon, deprecate it and encourage people to use `llvm_asm!` instead (which preserves the old syntax). This will avoid breakage when `asm!` is changed.

RFC: https://github.com/rust-lang/rfcs/pull/2843

4 years agoStabilize PathBuf capacity methods
Mark Rousskov [Sun, 19 Apr 2020 15:59:19 +0000 (11:59 -0400)]
Stabilize PathBuf capacity methods

4 years agoUpdate pattern docs.
Eric Huss [Sun, 19 Apr 2020 21:17:32 +0000 (14:17 -0700)]
Update pattern docs.

4 years agoAuto merge of #70598 - vakaras:add-threads-cr3, r=oli-obk,RalfJung
bors [Sun, 19 Apr 2020 23:02:06 +0000 (23:02 +0000)]
Auto merge of #70598 - vakaras:add-threads-cr3, r=oli-obk,RalfJung

Make the necessary changes to support concurrency in Miri.

This pull request makes the necessary changes to the Rust compiler to allow Miri to support concurrency:

1.  Move stack from the interpretation context (`InterpCx`) to machine, so that the machine can switch the stacks when it changes the thread being executed.
2.  Add the callbacks that allow the machine to generate fresh allocation ids for each thread local allocation and to translate them back to original allocations when needed. This allows the machine to ensure the property that allocation ids are unique, which allows using a simpler representation of the memory.

r? @oli-obk

cc @RalfJung

4 years agoAuto merge of #71331 - Dylan-DPC:rollup-5rn1isc, r=Dylan-DPC
bors [Sun, 19 Apr 2020 19:53:42 +0000 (19:53 +0000)]
Auto merge of #71331 - Dylan-DPC:rollup-5rn1isc, r=Dylan-DPC

Rollup of 4 pull requests

Successful merges:

 - #71026 (Fix false "never constructed" warnings for `Self::` variant paths)
 - #71310 (Do not show DefId in diagnostics)
 - #71317 (miri-unleash test for llvm_asm)
 - #71324 (Fix some tests failing in `--pass check` mode)

Failed merges:

r? @ghost

4 years agoMIR: use span instead of NodeId to determine if optimized_mir should be run
ljedrz [Sat, 18 Apr 2020 13:26:45 +0000 (15:26 +0200)]
MIR: use span instead of NodeId to determine if optimized_mir should be run

4 years agoRollup merge of #71324 - petrochenkov:passcheck2, r=RalfJung
Dylan DPC [Sun, 19 Apr 2020 19:11:29 +0000 (21:11 +0200)]
Rollup merge of #71324 - petrochenkov:passcheck2, r=RalfJung

Fix some tests failing in `--pass check` mode

r? @RalfJung

4 years agoRollup merge of #71317 - RalfJung:unleash-inline-asm, r=ecstatic-morse
Dylan DPC [Sun, 19 Apr 2020 19:11:28 +0000 (21:11 +0200)]
Rollup merge of #71317 - RalfJung:unleash-inline-asm, r=ecstatic-morse

miri-unleash test for llvm_asm

r? @oli-obk @ecstatic-morse

4 years agoRollup merge of #71310 - JohnTitor:dont-did, r=estebank
Dylan DPC [Sun, 19 Apr 2020 19:11:24 +0000 (21:11 +0200)]
Rollup merge of #71310 - JohnTitor:dont-did, r=estebank

Do not show DefId in diagnostics

Fixes #71222
r? @estebank cc @eddyb

4 years agoRollup merge of #71026 - seiyab:issue-64362-adhoc, r=varkor
Dylan DPC [Sun, 19 Apr 2020 19:11:22 +0000 (21:11 +0200)]
Rollup merge of #71026 - seiyab:issue-64362-adhoc, r=varkor

Fix false "never constructed" warnings for `Self::` variant paths

Closes #64362 .

4 years agoFix comment
Ralf Jung [Sun, 19 Apr 2020 18:21:26 +0000 (20:21 +0200)]
Fix comment

4 years agoAuto merge of #71231 - cuviper:rustc_or_patterns, r=Mark-Simulacrum
bors [Sun, 19 Apr 2020 16:43:02 +0000 (16:43 +0000)]
Auto merge of #71231 - cuviper:rustc_or_patterns, r=Mark-Simulacrum

Dogfood more or_patterns in the compiler

Another step toward the stabilization of `or_patterns`...

cc #54883 @Centril
r? @Mark-Simulacrum

4 years agofix decode logic for 'AttrId' to be symmetric with encode logic
JOE1994 [Sun, 19 Apr 2020 16:00:45 +0000 (12:00 -0400)]
fix decode logic for 'AttrId' to be symmetric with encode logic

4 years agoDogfood more or_patterns in the compiler
Josh Stone [Fri, 17 Apr 2020 00:38:52 +0000 (17:38 -0700)]
Dogfood more or_patterns in the compiler

4 years agoFix some tests failing in `--pass check` mode
Vadim Petrochenkov [Sun, 19 Apr 2020 13:06:00 +0000 (16:06 +0300)]
Fix some tests failing in `--pass check` mode

4 years agoAuto merge of #71326 - Dylan-DPC:rollup-hdlkdj5, r=Dylan-DPC
bors [Sun, 19 Apr 2020 13:24:05 +0000 (13:24 +0000)]
Auto merge of #71326 - Dylan-DPC:rollup-hdlkdj5, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #71107 (Address concerns of weak-into-raw)
 - #71188 (Fixed missing trait method suggests incorrect code (self parameter not named "self"). )
 - #71300 (Clarify when to use the tracking issue template)
 - #71315 (Add example in the alternative in std::mem::transmute docs)
 - #71319 (Clean up E0522 explanation)

Failed merges:

r? @ghost

4 years agoRollup merge of #71319 - GuillaumeGomez:cleanup-e0522, r=Dylan-DPC
Dylan DPC [Sun, 19 Apr 2020 13:12:42 +0000 (15:12 +0200)]
Rollup merge of #71319 - GuillaumeGomez:cleanup-e0522, r=Dylan-DPC

Clean up E0522 explanation

r? @Dylan-DPC

4 years agoRollup merge of #71315 - huangjiahua:update-documentation, r=Dylan-DPC
Dylan DPC [Sun, 19 Apr 2020 13:12:40 +0000 (15:12 +0200)]
Rollup merge of #71315 - huangjiahua:update-documentation, r=Dylan-DPC

Add example in the alternative in std::mem::transmute docs

It is safer to use `from_ne_bytes` to convert raw bytes to type like u32.  #71187

4 years agoRollup merge of #71300 - rust-lang:jonas-schievink-patch-1, r=XAMPPRocky
Dylan DPC [Sun, 19 Apr 2020 13:12:39 +0000 (15:12 +0200)]
Rollup merge of #71300 - rust-lang:jonas-schievink-patch-1, r=XAMPPRocky

Clarify when to use the tracking issue template

People tend to open this for feature requests. Let's see if this helps.

r? @XAMPPRocky

4 years agoRollup merge of #71188 - Duddino:fix, r=matthewjasper
Dylan DPC [Sun, 19 Apr 2020 13:12:38 +0000 (15:12 +0200)]
Rollup merge of #71188 - Duddino:fix, r=matthewjasper

Fixed missing trait method suggests incorrect code (self parameter not named "self").

fixes #71150

4 years agoRollup merge of #71107 - vorner:weak-into-raw-dangling, r=Amanieu
Dylan DPC [Sun, 19 Apr 2020 13:12:36 +0000 (15:12 +0200)]
Rollup merge of #71107 - vorner:weak-into-raw-dangling, r=Amanieu

Address concerns of weak-into-raw

This should address the standing concerns in https://github.com/rust-lang/rust/issues/60728#issuecomment-612525616.

I've still left the ability to create a new dangling pointer from `null`, as I feel like this is the natural behaviour to expect, but I'm fine removing that too. I've modified the documentation to allow the `as_ptr` or `into_ptr` to return whatever garbage in case of a dangling pointer. I've also removed the guarantee to be able to do `from_raw(as_ptr)` from the documentation (but it would still work right now).

I've renamed the method and added implementations for `Rc`/`Arc`.

I've also tried if I can just „enable“ unsized types. I believe the current interface is compatible with them. But the inner implementation will be a bit challenging ‒ I can't use the `data_offset` as is used by `Rc` or `Arc` because it AFAIK „touches“ (creates a reference to) the live value of `T` ‒ and in case of `Weak`, it might be completely bogus or already dead ‒ so that would be UB.

`./x.py test tidy` is completely mad on my own system all over the code base :-(. I'll just hope it goes through CI, or will fix as necessary.

Is it OK if I ask @Amanieu for review, as the concerns are from you?

~r @Amanieu

4 years agoFix false "never constructed" warnings for `Self::` variant paths
seiya [Sat, 11 Apr 2020 13:34:45 +0000 (22:34 +0900)]
Fix false "never constructed" warnings for `Self::` variant paths

4 years agotest for false "never constructed" warnings for `Self::` variant paths
jakubadamw [Sat, 11 Apr 2020 13:14:33 +0000 (22:14 +0900)]
test for false "never constructed" warnings for `Self::` variant paths

4 years agoClean up E0522 explanation
Guillaume Gomez [Sun, 19 Apr 2020 11:18:45 +0000 (13:18 +0200)]
Clean up E0522 explanation

4 years agomiri-unleash test for llvm_asm
Ralf Jung [Sun, 19 Apr 2020 10:05:28 +0000 (12:05 +0200)]
miri-unleash test for llvm_asm

4 years agoDisallow values for `-C no-*` and `-Z no-*` options again.
Nicholas Nethercote [Sun, 5 Apr 2020 23:29:19 +0000 (09:29 +1000)]
Disallow values for `-C no-*` and `-Z no-*` options again.

With the exception of `-C no-redzone`, because that could take a value
before this PR.

This partially undoes one of the earlier commits in this PR, which added
the ability to take a value to all boolean options that lacked it.

The help output for these options looks like this:
```
    -C         no-vectorize-slp=val -- disable LLVM's SLP vectorization pass
```
The "=val" part is a lie, but hopefully this will be fixed in the future.

4 years agoImprove codegen option docs.
Nicholas Nethercote [Fri, 3 Apr 2020 03:53:03 +0000 (14:53 +1100)]
Improve codegen option docs.

This commit:
- Adds "following values" indicators for all the options that are
  missing them.
- Tweaks some wording and punctuation for consistency.
- Rewords some things for clarity.
- Removes the `no-integrated-as` entry, because that option was removed
  in #70345.

4 years agoShow defaults in options descriptions.
Nicholas Nethercote [Thu, 2 Apr 2020 23:42:29 +0000 (10:42 +1100)]
Show defaults in options descriptions.

For all `-C` and `-Z` options that have them.

The commit also rewords a few options to make them clearer, mostly by
avoiding the word "don't".

It also removes the listed default for `-Cinline-threshold`, which is
incorrect -- that option doesn't have a static default.

4 years agoAuto merge of #70015 - jonas-schievink:gen-needs-drop, r=matthewjasper
bors [Sun, 19 Apr 2020 10:01:16 +0000 (10:01 +0000)]
Auto merge of #70015 - jonas-schievink:gen-needs-drop, r=matthewjasper

Make `needs_drop` less pessimistic on generators

Generators only have non-trivial drop logic when they may store (in upvars or across yields) a type that does.

This prevents generation of some unnecessary MIR in simple generators. There might be some impact on compile times, but this is probably limited in real-world applications.

~~This builds off of https://github.com/rust-lang/rust/pull/69814 since that contains some fixes that are made relevant by *this* PR (see https://github.com/rust-lang/rust/pull/69814#issuecomment-599147269).~~ (this has been merged)

4 years agoReplace uses of `parse_opt_*` with `parse_*` where possible.
Nicholas Nethercote [Thu, 2 Apr 2020 05:44:47 +0000 (16:44 +1100)]
Replace uses of `parse_opt_*` with `parse_*` where possible.

This lets us specify the default at the options declaration point,
instead of using `.unwrap(default)` or `None | Some(default)` at some
use point far away. It also makes the code more concise.

4 years agoMake option type descriptions non-optional.
Nicholas Nethercote [Fri, 3 Apr 2020 03:15:10 +0000 (14:15 +1100)]
Make option type descriptions non-optional.

Because all options now can take a value. This simplifies some code
quite a bit.

4 years agoTweak `parse_opt_uint`.
Nicholas Nethercote [Fri, 3 Apr 2020 03:02:44 +0000 (14:02 +1100)]
Tweak `parse_opt_uint`.

Don't set `slot` on failure, like all the other `parse_*` functions.

4 years agoFix the `-Zsanitizer_memory_track_origins` error message.
Nicholas Nethercote [Thu, 2 Apr 2020 04:58:07 +0000 (15:58 +1100)]
Fix the `-Zsanitizer_memory_track_origins` error message.

Currently, if you give a bogus value like
`-Zsanitizer-memory-track-origins=99` you get this incorrect error:
```
error: debugging option `sanitizer-memory-track-origins` takes no value
```
This commit fixes it so it gives this instead:
```
error: incorrect value `99` for debugging option `sanitizer-memory-track-origins` - 0, 1, or 2 was expected
```
The commit also makes `parse_sanitizer_memory_track_origins` more
readable.

4 years agoClean up the list of parser descriptions.
Nicholas Nethercote [Thu, 2 Apr 2020 05:06:08 +0000 (16:06 +1100)]
Clean up the list of parser descriptions.

Put identical ones next to each other, and avoid duplicated strings.

4 years agoAllow all boolean options to take values.
Nicholas Nethercote [Thu, 2 Apr 2020 04:47:11 +0000 (15:47 +1100)]
Allow all boolean options to take values.

They now all accept yes/no/y/n/on/off values. (Previously only some of
them did.)

This commit also makes `parse_bool` and `parse_opt_bool` more concise
and readable, and adds some helpful comments to some functions.

4 years agoMake some option descriptions fit the usual pattern.
Nicholas Nethercote [Tue, 31 Mar 2020 23:53:24 +0000 (10:53 +1100)]
Make some option descriptions fit the usual pattern.

- No trailing '.' chars.
- Use a lower-case letter at the start.

4 years agoweak-into-raw: Add {Arc,Rc}::as_ptr
Michal 'vorner' Vaner [Mon, 13 Apr 2020 17:08:33 +0000 (19:08 +0200)]
weak-into-raw: Add {Arc,Rc}::as_ptr

For consistency with Weak

4 years agoAuto merge of #69793 - estebank:predicate-obligations-4, r=nikomatsakis
bors [Sun, 19 Apr 2020 06:42:51 +0000 (06:42 +0000)]
Auto merge of #69793 - estebank:predicate-obligations-4, r=nikomatsakis

 Maintain chain of derived obligations

When evaluating the derived obligations from super traits, maintain a
reference to the original obligation in order to give more actionable
context in the output.

Continuation (and built on) #69745, subset of #69709.

r? @eddyb

4 years agoFix `has_no_input_arg` function has self check
Rustin-Liu [Sat, 18 Apr 2020 03:32:39 +0000 (11:32 +0800)]
Fix `has_no_input_arg` function has self check

Signed-off-by: Rustin-Liu <rustin.liu@gmail.com>
rename has_no_input_arg to has_only_self_parameter

Signed-off-by: Rustin-Liu <rustin.liu@gmail.com>
4 years agoDo not show DefId in diagnostics
Yuki Okushi [Sun, 19 Apr 2020 03:20:49 +0000 (12:20 +0900)]
Do not show DefId in diagnostics

4 years agoAuto merge of #71102 - tmiasko:compiler-builtins, r=Mark-Simulacrum
bors [Sun, 19 Apr 2020 02:16:13 +0000 (02:16 +0000)]
Auto merge of #71102 - tmiasko:compiler-builtins, r=Mark-Simulacrum

Update compiler_builtins to 0.1.27

* aarch64: Exclude FP intrinsics on +nofp or +nosimd
* Place intrinsics in individual object files

https://github.com/rust-lang/compiler-builtins/compare/0.1.25...0.1.27

4 years agoAdd label to item source of bound obligation
Esteban Küber [Sat, 18 Apr 2020 23:36:46 +0000 (16:36 -0700)]
Add label to item source of bound obligation

4 years agoDo not emit note for projected derived obligations
Esteban Küber [Sat, 11 Apr 2020 21:14:16 +0000 (14:14 -0700)]
Do not emit note for projected derived obligations

4 years agoRemove `AssocTypeBound` and propagate bound `Span`s
Esteban Küber [Thu, 9 Apr 2020 20:07:22 +0000 (13:07 -0700)]
Remove `AssocTypeBound` and propagate bound `Span`s

4 years agoMaintain chain of derived obligations
Esteban Küber [Sat, 7 Mar 2020 00:24:08 +0000 (16:24 -0800)]
Maintain chain of derived obligations

When evaluating the derived obligations from super traits, maintain a
reference to the original obligation in order to give more actionable
context in the output.

4 years agoAuto merge of #71306 - Dylan-DPC:rollup-kvzc1da, r=Dylan-DPC
bors [Sat, 18 Apr 2020 23:06:08 +0000 (23:06 +0000)]
Auto merge of #71306 - Dylan-DPC:rollup-kvzc1da, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #71271 (Move `MapInPlace` to rustc_data_structures)
 - #71276 (miri-unleashed: test that we detect heap allocations)
 - #71283 (Minor improvements to -Zprofile)
 - #71287 (Explain why we shouldn't add inline attr to into_vec)
 - #71303 (remove build warnings)

Failed merges:

r? @ghost

4 years agoRollup merge of #71303 - tshepang:master, r=Mark-Simulacrum
Dylan DPC [Sat, 18 Apr 2020 23:04:56 +0000 (01:04 +0200)]
Rollup merge of #71303 - tshepang:master, r=Mark-Simulacrum

remove build warnings

Code blocks that are not annotated are assumed to be Rust

4 years agoRollup merge of #71287 - JohnTitor:comment-vec, r=RalfJung
Dylan DPC [Sat, 18 Apr 2020 23:04:54 +0000 (01:04 +0200)]
Rollup merge of #71287 - JohnTitor:comment-vec, r=RalfJung

Explain why we shouldn't add inline attr to into_vec

Follow-up of #71204
r? @RalfJung

4 years agoRollup merge of #71283 - Amanieu:zprofile, r=davidtwco
Dylan DPC [Sat, 18 Apr 2020 23:04:53 +0000 (01:04 +0200)]
Rollup merge of #71283 - Amanieu:zprofile, r=davidtwco

Minor improvements to -Zprofile

- `-Zprofile` is broken with codegen units because GCOV assumes that each source file corresponds to one object file. This PR makes `-Zprofile` automatically set codegen units to 1 and gives an error if `-Ccodegen-units=X` is specified on the command line (with `X != 1`).
- The `profiler_builtins` crate is not suitable for `no_std` applications since it contains C code that depends on libc. In such cases a custom implementation of the LLVM gcov API (`llvm_gcov_init`, `llvm_gcda_*`) is needed. This PR adds `-Zno-profiler-runtime` flag which inhibits automatic injection of the `profiler_builtins` crate.

cc @whitequark who implemented the original `-Zprofile` support

4 years agoRollup merge of #71276 - RalfJung:miri-unleash-box, r=ecstatic-morse
Dylan DPC [Sat, 18 Apr 2020 23:04:49 +0000 (01:04 +0200)]
Rollup merge of #71276 - RalfJung:miri-unleash-box, r=ecstatic-morse

miri-unleashed: test that we detect heap allocations

This removes the second-to-last use of `IS_SUPPORTED_IN_MIRI = false`.

r? @ecstatic-morse @oli-obk

4 years agoRollup merge of #71271 - JohnTitor:map-in-place, r=petrochenkov
Dylan DPC [Sat, 18 Apr 2020 23:04:47 +0000 (01:04 +0200)]
Rollup merge of #71271 - JohnTitor:map-in-place, r=petrochenkov

Move `MapInPlace` to rustc_data_structures

Follow-up of #67786, it fits the purpose of rustc_data_structures.
r? @petrochenkov

4 years agoremove build warnings
Tshepang Lekhonkhobe [Sat, 18 Apr 2020 16:39:40 +0000 (18:39 +0200)]
remove build warnings

Code blocks that are not annotated are assumed to be Rust

4 years agoClarify when to use the tracking issue template
Jonas Schievink [Sat, 18 Apr 2020 19:07:28 +0000 (21:07 +0200)]
Clarify when to use the tracking issue template

4 years agoMake Box<dyn FnOnce> respect self alignment
Santiago Pastorino [Fri, 17 Apr 2020 12:27:35 +0000 (09:27 -0300)]
Make Box<dyn FnOnce> respect self alignment

4 years agoExplain why we shouldn't add inline attr to into_vec
Yuki Okushi [Sat, 18 Apr 2020 16:03:43 +0000 (01:03 +0900)]
Explain why we shouldn't add inline attr to into_vec

4 years agoAuto merge of #71218 - eddyb:a-lifetime-stranded-in-fn-def, r=nikomatsakis
bors [Sat, 18 Apr 2020 14:15:31 +0000 (14:15 +0000)]
Auto merge of #71218 - eddyb:a-lifetime-stranded-in-fn-def, r=nikomatsakis

outlives: ignore lifetimes shallowly found in `ty::FnDef`s.

Fixes #70917 by restoring the pre-#70164 behavior for now.

r? @nikomatsakis

4 years agoAdd an option to inhibit automatic injection of profiler_builtins
Amanieu d'Antras [Fri, 17 Apr 2020 20:21:49 +0000 (21:21 +0100)]
Add an option to inhibit automatic injection of profiler_builtins

4 years agoAuto merge of #71278 - matthiaskrgr:submodule_upd, r=Dylan-DPC
bors [Sat, 18 Apr 2020 11:09:07 +0000 (11:09 +0000)]
Auto merge of #71278 - matthiaskrgr:submodule_upd, r=Dylan-DPC

submodules: update clippy from 6651c1b9 to 891e1a85

This PR gets `cargo clippy --fix -Zunstable-options` into nightly :tada:

Changes:
````
Polished lint and tests
Added final lint and tests
Added basic lint and tests
fix redundant_pattern_matching lint
add lint futures_not_send
Integrate more idiomatic rust changes.
Fix issue #4892.
cargo dev fmt
Cleanup: Rename 'db' variable to 'diag'
question_mark: don't add `as_ref()` for a call expression
unit_arg suggestion may be incorrect
readme: update to cargo clippy --fix command
CI: performing system upgrade fixes broken apt deps on ubuntu 32bit
Do not lint in macros for match lints
[fix] Minor typo in GH Actions 'clippy_dev'
Reenable rustfmt integration test
Add test to map_flatten with an Option
Lint map_flatten if caller is an Option
Apply suggestions from code review
manually fixing formatting at this point lol
fmt
rename field
revert the damn fmt changes
add some tests
split it up for testing but the merge broke tests
dogfood tasted bad
fix rustfmt issue
boycott manish
check for unstable options
Start work on clippy-fix as subcommand
````

Should be save to rollup since we are in no-toolstate-break week (I also didn't see any breakage when testing the clippy with  28742a114)

4 years agosubmodules: update clippy from 6651c1b9 to 891e1a85
Matthias Krüger [Sat, 18 Apr 2020 10:44:30 +0000 (12:44 +0200)]
submodules: update clippy from 6651c1b9 to 891e1a85

Changes:
````
Polished lint and tests
Added final lint and tests
Added basic lint and tests
fix redundant_pattern_matching lint
add lint futures_not_send
Integrate more idiomatic rust changes.
Fix issue #4892.
cargo dev fmt
Cleanup: Rename 'db' variable to 'diag'
question_mark: don't add `as_ref()` for a call expression
unit_arg suggestion may be incorrect
readme: update to cargo clippy --fix command
CI: performing system upgrade fixes broken apt deps on ubuntu 32bit
Do not lint in macros for match lints
[fix] Minor typo in GH Actions 'clippy_dev'
Reenable rustfmt integration test
Add test to map_flatten with an Option
Lint map_flatten if caller is an Option
Apply suggestions from code review
manually fixing formatting at this point lol
fmt
rename field
revert the damn fmt changes
add some tests
split it up for testing but the merge broke tests
dogfood tasted bad
fix rustfmt issue
boycott manish
check for unstable options
Start work on clippy-fix as subcommand
````

4 years agomiri-unleashed: test that we detect heap allocations
Ralf Jung [Sat, 18 Apr 2020 09:16:07 +0000 (11:16 +0200)]
miri-unleashed: test that we detect heap allocations

4 years agocheck_consts: make ops module private
Ralf Jung [Sat, 18 Apr 2020 09:15:23 +0000 (11:15 +0200)]
check_consts: make ops module private

4 years agoAuto merge of #71204 - JohnTitor:into-vec, r=wesleywiser
bors [Sat, 18 Apr 2020 08:03:38 +0000 (08:03 +0000)]
Auto merge of #71204 - JohnTitor:into-vec, r=wesleywiser

perf: Remove inline attribute from `into_vec()`

It was introduced in #70565 and is likely related to this perf results: https://perf.rust-lang.org/compare.html?start=1edcfc83c6a08ddc5e63fc652b149baea0236e7c&end=d249d756374737eb014079901ac132f1e1ed905e&stat=instructions:u
Let's check if it's related to that.
r? @wesleywiser could you kick off perf check? I don't think I can do it.

4 years agoAdd example in the alternative in std::mem::transmute docs
huangjiahua [Sat, 18 Apr 2020 06:58:38 +0000 (14:58 +0800)]
Add example in the alternative in std::mem::transmute docs

It is safer to use `from_ne_bytes` to convert raw bytes to type like u32.

4 years agoMove `MapInPlace` to rustc_data_structures
Yuki Okushi [Sat, 18 Apr 2020 04:01:54 +0000 (13:01 +0900)]
Move `MapInPlace` to rustc_data_structures

4 years agofix -Zast-json to properly output the 'id' field
JOE1994 [Sat, 18 Apr 2020 02:47:26 +0000 (22:47 -0400)]
fix -Zast-json to properly output the 'id' field

4 years agoAuto merge of #71147 - cuviper:min-llvm8, r=Mark-Simulacrum
bors [Sat, 18 Apr 2020 01:37:27 +0000 (01:37 +0000)]
Auto merge of #71147 - cuviper:min-llvm8, r=Mark-Simulacrum

Update the minimum external LLVM to 8

LLVM 8 was released on March 20, 2019, over a year ago.

4 years agoClarify layout information in Layout::extend
CAD97 [Fri, 17 Apr 2020 22:59:36 +0000 (18:59 -0400)]
Clarify layout information in Layout::extend

4 years agoAuto merge of #71264 - Dylan-DPC:rollup-njgbey7, r=Dylan-DPC
bors [Fri, 17 Apr 2020 21:57:06 +0000 (21:57 +0000)]
Auto merge of #71264 - Dylan-DPC:rollup-njgbey7, r=Dylan-DPC

Rollup of 6 pull requests

Successful merges:

 - #70467 (Use `call` instead of `invoke` for functions that cannot unwind )
 - #71070 (rustbuild: Remove stage 0 LLD flavor workaround for MSVC)
 - #71167 (big-O notation: parenthesis for function calls, explicit multiplication)
 - #71238 (Miri: fix typo)
 - #71242 (Format Mailmap To Work With GitHub)
 - #71243 (Account for use of `try!()` in 2018 edition and guide users in the right direction)

Failed merges:

r? @ghost

4 years agoRollup merge of #71243 - Duddino:Fix2, r=estebank
Dylan DPC [Fri, 17 Apr 2020 21:56:04 +0000 (23:56 +0200)]
Rollup merge of #71243 - Duddino:Fix2, r=estebank

Account for use of `try!()` in 2018 edition and guide users in the right direction

fixes #71155

4 years agoRollup merge of #71242 - XAMPPRocky:mailmap, r=Dylan-DPC
Dylan DPC [Fri, 17 Apr 2020 21:56:03 +0000 (23:56 +0200)]
Rollup merge of #71242 - XAMPPRocky:mailmap, r=Dylan-DPC

Format Mailmap To Work With GitHub

r? @Mark-Simulacrum

4 years agoRollup merge of #71238 - RalfJung:miri-typo, r=oli-obk
Dylan DPC [Fri, 17 Apr 2020 21:56:01 +0000 (23:56 +0200)]
Rollup merge of #71238 - RalfJung:miri-typo, r=oli-obk

Miri: fix typo

r? @oli-obk at least I think this should be "without", right?

4 years agoRollup merge of #71167 - RalfJung:big-o, r=shepmaster
Dylan DPC [Fri, 17 Apr 2020 21:56:00 +0000 (23:56 +0200)]
Rollup merge of #71167 - RalfJung:big-o, r=shepmaster

big-O notation: parenthesis for function calls, explicit multiplication

I saw `O(n m log n)` in the docs and found that really hard to parse. In particular, I don't think we should use blank space as syntax for *both* multiplication and function calls, that is just confusing.

This PR makes both multiplication and function calls explicit using Rust-like syntax. If you prefer, I can also leave one of them implicit, but I believe explicit is better here.

While I was at it I also added backticks consistently.

4 years agoRollup merge of #71070 - petrochenkov:nolldaround, r=Mark-Simulacrum
Dylan DPC [Fri, 17 Apr 2020 21:55:58 +0000 (23:55 +0200)]
Rollup merge of #71070 - petrochenkov:nolldaround, r=Mark-Simulacrum

rustbuild: Remove stage 0 LLD flavor workaround for MSVC

4 years agoRollup merge of #70467 - wesleywiser:invoke-vs-call, r=nagisa
Dylan DPC [Fri, 17 Apr 2020 21:55:56 +0000 (23:55 +0200)]
Rollup merge of #70467 - wesleywiser:invoke-vs-call, r=nagisa

Use `call` instead of `invoke` for functions that cannot unwind

The `FnAbi` now knows if the function is allowed to unwind. If a
function isn't allowed to unwind, we can use a `call` instead of an
`invoke`.

This resolves an issue when calling LLVM intrinsics which cannot unwind
LLVM will generate an error if you attempt to invoke them so we need to
ignore cleanup blocks in codegen and generate a call instead.

Fixes #69911

r? @eddyb
cc @rust-lang/wg-ffi-unwind

4 years agoIssue #71248: attempt to recover perf by removing `exports_all_green` flag.
Felix S. Klock II [Fri, 17 Apr 2020 20:04:59 +0000 (16:04 -0400)]
Issue #71248: attempt to recover perf by removing `exports_all_green` flag.

(My hypothesis is that my use of this flag was an overly conservative
generalization of PR 67020.)

4 years agoMake -Zprofile set codegen-units to 1
Amanieu d'Antras [Fri, 17 Apr 2020 18:53:31 +0000 (19:53 +0100)]
Make -Zprofile set codegen-units to 1

4 years agoIgnore generator-drop-cleanup on wasm32-bare
Jonas Schievink [Wed, 25 Mar 2020 21:07:41 +0000 (22:07 +0100)]
Ignore generator-drop-cleanup on wasm32-bare