]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoRollup merge of #75115 - chansuke:sys-cloudabi-unsafe, r=KodrAus
Jonas Schievink [Sat, 24 Oct 2020 20:39:35 +0000 (22:39 +0200)]
Rollup merge of #75115 - chansuke:sys-cloudabi-unsafe, r=KodrAus

`#[deny(unsafe_op_in_unsafe_fn)]` in sys/cloudabi

Partial fix of #73904.

This encloses unsafe operations in unsafe fn in sys/cloudabi.

3 years agoAuto merge of #78319 - jonas-schievink:rollup-vzj8a6l, r=jonas-schievink
bors [Sat, 24 Oct 2020 16:12:01 +0000 (16:12 +0000)]
Auto merge of #78319 - jonas-schievink:rollup-vzj8a6l, r=jonas-schievink

Rollup of 15 pull requests

Successful merges:

 - #76649 (Add a spin loop hint for Arc::downgrade)
 - #77392 (add `insert` to `Option`)
 - #77716 (Revert "Allow dynamic linking for iOS/tvOS targets.")
 - #78109 (Check for exhaustion in RangeInclusive::contains and slicing)
 - #78198 (Simplify assert terminator only if condition evaluates to expected value)
 - #78243 (--test-args flag description)
 - #78249 (improve const infer error)
 - #78250 (Document inline-const)
 - #78264 (Add regression test for issue-77475)
 - #78274 (Update description of Empty Enum for accuracy)
 - #78278 (move `visit_predicate` into `TypeVisitor`)
 - #78292 (Loop instead of recursion)
 - #78293 (Always store Rustdoc theme when it's changed)
 - #78300 (Make codegen coverage_context optional, and check)
 - #78307 (Revert "Set .llvmbc and .llvmcmd sections as allocatable")

Failed merges:

r? `@ghost`

3 years agoRollup merge of #78307 - rust-lang:revert-77961-embed-bitcode, r=tmandry
Jonas Schievink [Sat, 24 Oct 2020 12:12:20 +0000 (14:12 +0200)]
Rollup merge of #78307 - rust-lang:revert-77961-embed-bitcode, r=tmandry

Revert "Set .llvmbc and .llvmcmd sections as allocatable"

Reverts rust-lang/rust#77961, see discussion starting from https://github.com/rust-lang/rust/pull/77961#issuecomment-712313902

3 years agoRollup merge of #78300 - richkadel:coverage-cx, r=wesleywiser
Jonas Schievink [Sat, 24 Oct 2020 12:12:18 +0000 (14:12 +0200)]
Rollup merge of #78300 - richkadel:coverage-cx, r=wesleywiser

Make codegen coverage_context optional, and check

Addresses Issue #78286

Libraries compiled with coverage and linked with out enabling coverage
would fail when attempting to add the library's coverage statements to
the codegen coverage context (None).

Now, if coverage statements are encountered while compiling / linking
with `-Z instrument-coverage` disabled, codegen will *not* attempt to
add code regions to a coverage map, and it will not inject the LLVM
instrprof_increment intrinsic calls.

3 years agoRollup merge of #78293 - nasso:master, r=GuillaumeGomez
Jonas Schievink [Sat, 24 Oct 2020 12:12:16 +0000 (14:12 +0200)]
Rollup merge of #78293 - nasso:master, r=GuillaumeGomez

Always store Rustdoc theme when it's changed

`switchTheme` (too) lazily updated the value of `rustdoc-theme` in `localStorage`, leading to an incorrect stored value when the system theme is the same as the default (`light`) theme.

Fixes #78273

3 years agoRollup merge of #78292 - bugadani:recursion, r=nagisa
Jonas Schievink [Sat, 24 Oct 2020 12:12:15 +0000 (14:12 +0200)]
Rollup merge of #78292 - bugadani:recursion, r=nagisa

Loop instead of recursion

I saw the comment `// FIXME: consider not using recursion to lower this.` and considered not using recursion :)

3 years agoRollup merge of #78278 - lcnr:predicate-visit, r=matthewjasper
Jonas Schievink [Sat, 24 Oct 2020 12:12:13 +0000 (14:12 +0200)]
Rollup merge of #78278 - lcnr:predicate-visit, r=matthewjasper

move `visit_predicate` into `TypeVisitor`

Seems easier than dealing with `PredicateVisitor` for me which I needed for object safety checks for `PredicateAtom::ConstEvaluatable`. Is there a reason I am missing for this split?

r? @matthewjasper

3 years agoRollup merge of #78274 - Enet4:patch-1, r=jonas-schievink
Jonas Schievink [Sat, 24 Oct 2020 12:12:11 +0000 (14:12 +0200)]
Rollup merge of #78274 - Enet4:patch-1, r=jonas-schievink

Update description of Empty Enum for accuracy

An empty enum is similar to the never type `!`, rather than the unit type `()`.

3 years agoRollup merge of #78264 - JohnTitor:macro-test, r=petrochenkov
Jonas Schievink [Sat, 24 Oct 2020 12:12:10 +0000 (14:12 +0200)]
Rollup merge of #78264 - JohnTitor:macro-test, r=petrochenkov

Add regression test for issue-77475

Closes #77475

3 years agoRollup merge of #78250 - camelid:document-inline-const, r=spastorino
Jonas Schievink [Sat, 24 Oct 2020 12:12:08 +0000 (14:12 +0200)]
Rollup merge of #78250 - camelid:document-inline-const, r=spastorino

Document inline-const

Part of #76001.

r? @spastorino

3 years agoRollup merge of #78249 - lcnr:ct-infer-origin, r=varkor
Jonas Schievink [Sat, 24 Oct 2020 12:12:06 +0000 (14:12 +0200)]
Rollup merge of #78249 - lcnr:ct-infer-origin, r=varkor

improve const infer error

For type inference we probably have to be careful about subtyping and stuff but considering that subtyping shouldn't be relevant for constants I don't really see a reason why we may not want to reuse the const origin here.

r? `@varkor`

3 years agoRollup merge of #78243 - njasm:patch_test_args_description, r=jyn514
Jonas Schievink [Sat, 24 Oct 2020 12:12:05 +0000 (14:12 +0200)]
Rollup merge of #78243 - njasm:patch_test_args_description, r=jyn514

--test-args flag description

tiny enhancement/clarification for the help description of the `--test-args` option from `x.py test` subcommand.

Edit: ...as discussed in zulip [here](https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/x.2Epy.20run.20single.20unit.20test.3F/near/214107842)

3 years agoRollup merge of #78198 - tmiasko:assert, r=davidtwco
Jonas Schievink [Sat, 24 Oct 2020 12:12:03 +0000 (14:12 +0200)]
Rollup merge of #78198 - tmiasko:assert, r=davidtwco

Simplify assert terminator only if condition evaluates to expected value

3 years agoRollup merge of #78109 - cuviper:exhausted-rangeinc, r=dtolnay
Jonas Schievink [Sat, 24 Oct 2020 12:12:01 +0000 (14:12 +0200)]
Rollup merge of #78109 - cuviper:exhausted-rangeinc, r=dtolnay

Check for exhaustion in RangeInclusive::contains and slicing

When a range has finished iteration, `is_empty` returns true, so it
should also be the case that `contains` returns false.

Fixes #77941.

3 years agoRollup merge of #77716 - francesca64:revert-ios-dynamic-linking, r=jonas-schievink
Jonas Schievink [Sat, 24 Oct 2020 12:11:59 +0000 (14:11 +0200)]
Rollup merge of #77716 - francesca64:revert-ios-dynamic-linking, r=jonas-schievink

Revert "Allow dynamic linking for iOS/tvOS targets."

This reverts PR #73516.

On macOS I compile static libs for iOS, automated using [cargo-mobile](https://github.com/BrainiumLLC/cargo-mobile), which has worked smoothly for the past 2 years. However, upon updating to Rust 1.46.0, I was no longer able to use Rust on iOS. I've bisected this to the PR referenced above.

For most projects tested, apps now immediately crash with a message like this:
```
dyld: Library not loaded: /Users/francesca/Projects/example/target/aarch64-apple-ios/debug/deps/libexample.dylib
  Referenced from: /private/var/containers/Bundle/Application/745912AF-A928-465C-B340-872BD1C9F368/example.app/example
  Reason: image not found
dyld: launch, loading dependent libraries
DYLD_LIBRARY_PATH=/usr/lib/system/introspection
DYLD_INSERT_LIBRARIES=/Developer/usr/lib/libBacktraceRecording.dylib:/Developer/usr/lib/libMainThreadChecker.dylib:/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib:/Developer/Library/PrivateFrameworks/GPUTools.framework/libglInterpose.dylib:/usr/lib/libMTLCapture.dylib
```

This can be reproduced by using cargo-mobile to generate a winit example project, and then attempting to run it on an iOS device (`cargo mobile init && cargo apple open`).

In our projects that depend on DisplayLink, the build instead fails with a linker error:
```
= note: Undefined symbols for architecture arm64:
            "_CACurrentMediaTime", referenced from:
                display_link::ios::run_callback_ios10::hda81197ff46aedbd in libapp-4f0abc1d7684103f.rlib(app-4f0abc1d7684103f.40d4iro0yz1iy487.rcgu.o)
                display_link::ios::run_callback_pre_ios10::h91f085da19374320 in libapp-4f0abc1d7684103f.rlib(app-4f0abc1d7684103f.40d4iro0yz1iy487.rcgu.o)
          ld: symbol(s) not found for architecture arm64
```

After reverting the change to enable dynamic linking on iOS, everything works the same as it did on Rust 1.45.2 for me.

In the future, would it be possible for me to be pinged when iOS-related PRs are made? I work for a company that intends on using Rust on iOS in production, so I'd gladly provide testing.

cc @aspenluxxxy

3 years agoRollup merge of #77392 - Canop:option_insert, r=m-ou-se
Jonas Schievink [Sat, 24 Oct 2020 12:11:57 +0000 (14:11 +0200)]
Rollup merge of #77392 - Canop:option_insert, r=m-ou-se

add `insert` to `Option`

This removes a cause of `unwrap` and code complexity.

This allows replacing

```
option_value = Some(build());
option_value.as_mut().unwrap()
```

with

```
option_value.insert(build())
```

It's also useful in contexts not requiring the mutability of the reference.

Here's a typical cache example:

```
let checked_cache = cache.as_ref().filter(|e| e.is_valid());
let content = match checked_cache {
Some(e) => &e.content,
None => {
    cache = Some(compute_cache_entry());
    // unwrap is OK because we just filled the option
    &cache.as_ref().unwrap().content
}
};
```

It can be changed into

```
let checked_cache = cache.as_ref().filter(|e| e.is_valid());
let content = match checked_cache {
Some(e) => &e.content,
None => &cache.insert(compute_cache_entry()).content,
};
```

*(edited: I removed `insert_with`)*

3 years agoRollup merge of #76649 - nicbn:arc-spin-loop-hint, r=m-ou-se
Jonas Schievink [Sat, 24 Oct 2020 12:11:56 +0000 (14:11 +0200)]
Rollup merge of #76649 - nicbn:arc-spin-loop-hint, r=m-ou-se

Add a spin loop hint for Arc::downgrade

Adds `hint::spin_loop()` to the case where `Arc::downgrade` spins.

3 years agoAuto merge of #78316 - fusion-engineering-forks:fix-musl-ci-build, r=pietroalbini
bors [Sat, 24 Oct 2020 09:18:54 +0000 (09:18 +0000)]
Auto merge of #78316 - fusion-engineering-forks:fix-musl-ci-build, r=pietroalbini

Use different mirror for sabotage linux in musl-toolchain CI script.

Should hopefully fix the CI failure of #78309

`musl-cross-make` Makefile for reference: https://github.com/richfelker/musl-cross-make/blob/a54eb56f33f255dfca60be045f12a5cfaf5a72a9/Makefile

r? `@pietroalbini`

3 years agoRollup merge of #78309
Mara Bos [Sat, 24 Oct 2020 09:17:02 +0000 (11:17 +0200)]
Rollup merge of #78309

3 years agoUse own mirror for linux headers in musl-toolchain CI script.
Mara Bos [Sat, 24 Oct 2020 08:48:36 +0000 (10:48 +0200)]
Use own mirror for linux headers in musl-toolchain CI script.

3 years agoLoop instead of recursion
Dániel Buga [Fri, 23 Oct 2020 16:11:52 +0000 (18:11 +0200)]
Loop instead of recursion

3 years agoUpdate compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs
Rich Kadel [Fri, 23 Oct 2020 21:58:08 +0000 (14:58 -0700)]
Update compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs

Co-authored-by: Wesley Wiser <wwiser@gmail.com>
3 years agoFix Ubuntu download URL
Jonas Schievink [Fri, 23 Oct 2020 21:52:06 +0000 (23:52 +0200)]
Fix Ubuntu download URL

3 years agoRevert "Set .llvmbc and .llvmcmd sections as allocatable"
Tyler Mandry [Fri, 23 Oct 2020 19:54:00 +0000 (12:54 -0700)]
Revert "Set .llvmbc and .llvmcmd sections as allocatable"

3 years agoAdd a spin loop hint for Arc::downgrade
Nicolas Nattis [Sat, 12 Sep 2020 16:53:30 +0000 (13:53 -0300)]
Add a spin loop hint for Arc::downgrade

3 years agox.py test --test-args flag description enhancement
Nelson J Morais [Thu, 22 Oct 2020 17:36:16 +0000 (18:36 +0100)]
x.py test --test-args flag description enhancement

3 years agoMake codegen coverage_context optional, and check
Rich Kadel [Fri, 23 Oct 2020 18:41:56 +0000 (11:41 -0700)]
Make codegen coverage_context optional, and check

Addresses Issue #78286

Libraries compiled with coverage and linked with out enabling coverage
would fail when attempting to add the library's coverage statements to
the codegen coverage context (None).

Now, if coverage statements are encountered while compiling / linking
with `-Z instrument-coverage` disabled, codegen will *not* attempt to
add code regions to a coverage map, and it will not inject the LLVM
instrprof_increment intrinsic calls.

3 years agoAuto merge of #77015 - davidtwco:check-attr-variant-closure-expr, r=lcnr
bors [Fri, 23 Oct 2020 17:32:04 +0000 (17:32 +0000)]
Auto merge of #77015 - davidtwco:check-attr-variant-closure-expr, r=lcnr

passes: `check_attr` on more targets

This PR modifies `check_attr` so that:

- Enum variants are now checked (some attributes would not have been prohibited on variants previously).
- `check_expr_attributes` and `check_stmt_attributes` are removed as `check_attributes` can perform the same checks. This means that codegen attribute errors aren't shown if there are other errors first (e.g. from other attributes, as shown in `src/test/ui/macros/issue-68060.rs` changes below).

3 years agoAlways store Rustdoc theme when it's changed
nasso [Fri, 23 Oct 2020 16:58:42 +0000 (18:58 +0200)]
Always store Rustdoc theme when it's changed

3 years agomove `visit_predicate` into `TypeVisitor`
Bastian Kauschke [Fri, 23 Oct 2020 11:58:32 +0000 (13:58 +0200)]
move `visit_predicate` into `TypeVisitor`

3 years agoUpdate description of Empty Enum for accuracy
Eduardo Pinho [Fri, 23 Oct 2020 11:13:07 +0000 (12:13 +0100)]
Update description of Empty Enum for accuracy

An empty enum is similar to the never type `!`, rather than the unit type `()`.

3 years agoadd tracking issue number to option_insert feature gate
Canop [Fri, 23 Oct 2020 09:44:58 +0000 (11:44 +0200)]
add tracking issue number to option_insert feature gate

3 years agoUpdate library/core/src/option.rs
Canop [Fri, 23 Oct 2020 09:09:15 +0000 (11:09 +0200)]
Update library/core/src/option.rs

Co-authored-by: Ivan Tham <pickfire@riseup.net>
3 years agoUpdate library/core/src/option.rs
Canop [Fri, 23 Oct 2020 09:08:09 +0000 (11:08 +0200)]
Update library/core/src/option.rs

Co-authored-by: Mara Bos <m-ou.se@m-ou.se>
3 years agofix naming unconsistency between function doc and prototype
Canop [Sat, 3 Oct 2020 08:29:11 +0000 (10:29 +0200)]
fix naming unconsistency between function doc and prototype

3 years agomore tests in option.insert, code cleaning in option
Canop [Thu, 1 Oct 2020 14:05:01 +0000 (16:05 +0200)]
more tests in option.insert, code cleaning in option

Code cleaning made according to suggestions in discussion
on PR ##77392 impacts insert, get_or_insert and get_or_insert_with.

3 years agoremove `option.insert_with`
Canop [Thu, 1 Oct 2020 11:24:33 +0000 (13:24 +0200)]
remove `option.insert_with`

`option.insert` covers both needs anyway, `insert_with` is
redundant.

3 years agoadd `insert` and `insert_with` to `Option`
Canop [Thu, 1 Oct 2020 09:13:38 +0000 (11:13 +0200)]
add `insert` and `insert_with` to `Option`

This removes a cause of `unwrap` and code complexity.

This allows replacing

```
option_value = Some(build());
option_value.as_mut().unwrap()
```

with

```
option_value.insert(build())
```

or

```
option_value.insert_with(build)
```

It's also useful in contexts not requiring the mutability of the reference.

Here's a typical cache example:

```
let checked_cache = cache.as_ref().filter(|e| e.is_valid());
let content = match checked_cache {
Some(e) => &e.content,
None => {
    cache = Some(compute_cache_entry());
    // unwrap is OK because we just filled the option
    &cache.as_ref().unwrap().content
}
};
```

It can be changed into

```
let checked_cache = cache.as_ref().filter(|e| e.is_valid());
let content = match checked_cache {
Some(e) => &e.content,
None => &cache.insert_with(compute_cache_entry).content,
};
```

3 years agoAuto merge of #78270 - JohnTitor:rollup-bldrjh5, r=JohnTitor
bors [Fri, 23 Oct 2020 09:31:44 +0000 (09:31 +0000)]
Auto merge of #78270 - JohnTitor:rollup-bldrjh5, r=JohnTitor

Rollup of 17 pull requests

Successful merges:

 - #77268 (Link to "Contributing to Rust" rather than "Getting Started".)
 - #77339 (Implement TryFrom between NonZero types.)
 - #77488 (Mark `repr128` as `incomplete_features`)
 - #77890 (Fixing escaping to ensure generation of welformed json.)
 - #77918 (Cleanup network tests)
 - #77920 (Avoid extraneous space between visibility kw and ident for statics)
 - #77969 (Doc formating consistency between slice sort and sort_unstable, and big O notation consistency)
 - #78098 (Clean up and improve some docs)
 - #78116 (Make inline const work in range patterns)
 - #78153 (Sync LLVM submodule if it has been initialized)
 - #78163 (Clean up lib docs)
 - #78169 (Update cargo)
 - #78231 (Make closures inherit the parent function's target features)
 - #78235 (Explain where the closure return type was inferred)
 - #78255 (Reduce diagram mess in 'match arms have incompatible types' error)
 - #78263 (Add regression test of issue-77668)
 - #78265 (Add some inference-related regression tests about incorrect diagnostics)

Failed merges:

r? `@ghost`

3 years agoRollup merge of #78265 - JohnTitor:type-iference-diag-test, r=lcnr
Yuki Okushi [Fri, 23 Oct 2020 09:26:44 +0000 (18:26 +0900)]
Rollup merge of #78265 - JohnTitor:type-iference-diag-test, r=lcnr

Add some inference-related regression tests about incorrect diagnostics

Closes #71732
Closes #72616

3 years agoRollup merge of #78263 - JohnTitor:mir-opt-ice-test, r=lcnr
Yuki Okushi [Fri, 23 Oct 2020 09:26:42 +0000 (18:26 +0900)]
Rollup merge of #78263 - JohnTitor:mir-opt-ice-test, r=lcnr

Add regression test of issue-77668

Closes #77668

3 years agoRollup merge of #78255 - dtolnay:match, r=lcnr
Yuki Okushi [Fri, 23 Oct 2020 09:26:40 +0000 (18:26 +0900)]
Rollup merge of #78255 - dtolnay:match, r=lcnr

Reduce diagram mess in 'match arms have incompatible types' error

I noticed this wild diagram in https://twitter.com/a_hoverbear/status/1318960787105353728 which I think does not benefit from the big outer vertical span.

This PR shrinks the outer span to cover just the `match` keyword and scrutinee expression *if* at least one of the highlighted match arms involved in the error is multiline.

**Before:**

<pre>
<b>error[E0308]: `match` arms have incompatible types</b>
   <b>--&gt;</b> src/topology/builder.rs:141:35
    <b>|</b>
<b>120 |</b>             let transform = match transform {
    <b>|    _________________________-</b>
<b>121 |   |</b>             Transform::Function(t) =&gt; {
    <b>|  _|_______________________________________-</b>
<b>122 | | |</b>                 filter_event_type(input_rx, input_type).compat().flat_map(|v| {
<b>123 | | |</b>                     futures::stream::iter(match v {
<b>124 | | |</b>                         Err(e) =&gt; {
<b>...   | |</b>
<b>139 | | |</b>                 .compat();
<b>140 | | |</b>             }
    <b>| |_|_____________- this is found to be of type `()`</b>
<b>141 |   |</b>             Transform::Task(t) =&gt; t
    <b>|  _|___________________________________^</b>
<b>142 | | |</b>                 .transform(filter_event_type(input_rx, input_type))
<b>143 | | |</b>                 .forward(output)
<b>144 | | |</b>                 .map(|_| debug!("Finished"))
<b>145 | | |</b>                 .compat(),
    <b>| |_|_________________________^ expected `()`, found struct `futures::compat::Compat01As03`</b>
<b>146 |   |</b>         };
    <b>|   |_________- `match` arms have incompatible types</b>
    <b>|</b>
    <b>= note:</b> expected type `<b>()</b>`
             found struct `<b>futures::compat::Compat01As03&lt;futures::Map&lt;futures::stream::Forward&lt;std::boxed::Box&lt;dyn futures::Stream&lt;Error = (), Item = event::Event&gt; + std::marker::Send&gt;, topology::fanout::Fanout&gt;, [closure@src/topology/builder.rs:144:22: 144:44]&gt;&gt;</b>`
</pre>

**After:**

<pre>
<b>error[E0308]: `match` arms have incompatible types</b>
   <b>--&gt;</b> src/topology/builder.rs:141:35
    <b>|</b>
<b>120 |</b>             let transform = match transform {
    <b>|                             --------------- `match` arms have incompatible types</b>
<b>121 |</b>                 Transform::Function(t) =&gt; {
    <b>|  _________________________________________-</b>
<b>122 | |</b>                   filter_event_type(input_rx, input_type).compat().flat_map(|v| {
<b>123 | |</b>                       futures::stream::iter(match v {
<b>124 | |</b>                           Err(e) =&gt; {
<b>...   |</b>
<b>139 | |</b>                   .compat();
<b>140 | |</b>               }
    <b>| |_______________- this is found to be of type `()`</b>
<b>141 |</b>                 Transform::Task(t) =&gt; t
    <b>|  _____________________________________^</b>
<b>142 | |</b>                   .transform(filter_event_type(input_rx, input_type))
<b>143 | |</b>                   .forward(output)
<b>144 | |</b>                   .map(|_| debug!("Finished"))
<b>145 | |</b>                   .compat(),
    <b>| |___________________________^ expected `()`, found struct `futures::compat::Compat01As03`</b>
    <b>|</b>
    <b>= note:</b> expected type `<b>()</b>`
             found struct `<b>futures::compat::Compat01As03&lt;futures::Map&lt;futures::stream::Forward&lt;std::boxed::Box&lt;dyn futures::Stream&lt;Error = (), Item = event::Event&gt; + std::marker::Send&gt;, topology::fanout::Fanout&gt;, [closure@src/topology/builder.rs:144:22: 144:44]&gt;&gt;</b>`
</pre>

FYI @Hoverbear

3 years agoRollup merge of #78235 - Aaron1011:closure-ret-infer, r=varkor
Yuki Okushi [Fri, 23 Oct 2020 09:26:39 +0000 (18:26 +0900)]
Rollup merge of #78235 - Aaron1011:closure-ret-infer, r=varkor

Explain where the closure return type was inferred

Fixes #78193

3 years agoRollup merge of #78231 - LeSeulArtichaut:closure-target_feature, r=nikomatsakis
Yuki Okushi [Fri, 23 Oct 2020 09:26:37 +0000 (18:26 +0900)]
Rollup merge of #78231 - LeSeulArtichaut:closure-target_feature, r=nikomatsakis

Make closures inherit the parent function's target features

r? @ghost
Closes #73631

3 years agoRollup merge of #78169 - ehuss:update-cargo, r=ehuss
Yuki Okushi [Fri, 23 Oct 2020 09:26:35 +0000 (18:26 +0900)]
Rollup merge of #78169 - ehuss:update-cargo, r=ehuss

Update cargo

3 commits in 79b397d72c557eb6444a2ba0dc00a211a226a35a..dd83ae55c871d94f060524656abab62ec40b4c40
2020-10-15 14:41:21 +0000 to 2020-10-20 19:31:26 +0000
- Support glob patterns for package/target selection (rust-lang/cargo#8752)
- Update env_logger requirement from 0.7.0 to 0.8.1 (rust-lang/cargo#8795)
- Fix man page links inside `option` blocks. (rust-lang/cargo#8793)

3 years agoRollup merge of #78163 - camelid:fixup-lib-docs, r=m-ou-se
Yuki Okushi [Fri, 23 Oct 2020 09:26:33 +0000 (18:26 +0900)]
Rollup merge of #78163 - camelid:fixup-lib-docs, r=m-ou-se

Clean up lib docs

Cherry-picked out of #78094.

3 years agoRollup merge of #78153 - est31:downloaded_llvm_maybe_sync, r=Mark-Simulacrum
Yuki Okushi [Fri, 23 Oct 2020 09:26:32 +0000 (18:26 +0900)]
Rollup merge of #78153 - est31:downloaded_llvm_maybe_sync, r=Mark-Simulacrum

Sync LLVM submodule if it has been initialized

Since having enabled the download-ci-llvm option,
and having rebased on top of #76864,
I've noticed that I had to update the llvm-project
submodule manually if it was checked out.
Orignally, the submodule update logic was
introduced to reduce the friction for contributors
to manage the submodules, or in other words, to prevent
getting PRs that have unwanted submodule rollbacks
because the contributors didn't run git submodule update.

This commit adds logic to ensure there is no inadvertent
LLVM submodule rollback in a PR if download-ci-llvm
(or llvm-config) is enabled. It will detect whether the
llvm-project submodule is initialized, and if so, update
it in any case. If it is not initialized, behaviour is
kept to not do any update/initialization.

An alternative to the chosen implementation would
be to not pass the --init command line arg to
`git submodule update` for the src/llvm-project
submodule. This would show a confusing error message
however on all builds with an uninitialized repo.
We could pass the --silent param, but we still want
it to print something if it is initialized and has
to update something.
So we just do a manual check for whether the
submodule is initialized.

3 years agoRollup merge of #78116 - spastorino:inline-const-in-range-pat, r=petrochenkov
Yuki Okushi [Fri, 23 Oct 2020 09:26:30 +0000 (18:26 +0900)]
Rollup merge of #78116 - spastorino:inline-const-in-range-pat, r=petrochenkov

Make inline const work in range patterns

Fixes #78108 which is a follow up of https://github.com/rust-lang/rust/pull/77124

r? @petrochenkov

3 years agoRollup merge of #78098 - camelid:fixup-docs, r=steveklabnik
Yuki Okushi [Fri, 23 Oct 2020 09:26:28 +0000 (18:26 +0900)]
Rollup merge of #78098 - camelid:fixup-docs, r=steveklabnik

Clean up and improve some docs

* compiler docs
  * Don't format list as part of a code block
  * Clean up some other formatting
* rustdoc book
  * Update CommonMark spec version to latest (0.28 -> 0.29)
  * Clean up some various wording and formatting

3 years agoRollup merge of #77969 - ryan-scott-dev:bigo-notation-consistency, r=m-ou-se
Yuki Okushi [Fri, 23 Oct 2020 09:26:26 +0000 (18:26 +0900)]
Rollup merge of #77969 - ryan-scott-dev:bigo-notation-consistency, r=m-ou-se

Doc formating consistency between slice sort and sort_unstable, and big O notation consistency

Updated documentation for slice sorting methods to be consistent between stable and unstable versions, which just ended up being minor formatting differences.

I also went through and updated any doc comments with big O notation to be consistent with #74010 by italicizing them rather than having them in a code block.

3 years agoRollup merge of #77920 - ayazhafiz:i/mut-ident-spacing, r=jyn514
Yuki Okushi [Fri, 23 Oct 2020 09:26:24 +0000 (18:26 +0900)]
Rollup merge of #77920 - ayazhafiz:i/mut-ident-spacing, r=jyn514

Avoid extraneous space between visibility kw and ident for statics

Today, given a static like `static mut FOO: usize = 1`, rustdoc would
emit `static mut  FOO: usize = 1`, as it emits both the mutability kw
with a space and reserves a space after the mutability kw. This patch
fixes that misformatting.

This patch also adds some tests for emit of other statics, as I could
not find an existing test devoted to statics.

3 years agoRollup merge of #77918 - wcampbell0x2a:cleanup-network-tests, r=m-ou-se
Yuki Okushi [Fri, 23 Oct 2020 09:26:22 +0000 (18:26 +0900)]
Rollup merge of #77918 - wcampbell0x2a:cleanup-network-tests, r=m-ou-se

Cleanup network tests

Some cleanup for network related tests

3 years agoRollup merge of #77890 - gilescope:welformed-json-output-from-libtest, r=KodrAus
Yuki Okushi [Fri, 23 Oct 2020 09:26:20 +0000 (18:26 +0900)]
Rollup merge of #77890 - gilescope:welformed-json-output-from-libtest, r=KodrAus

Fixing escaping to ensure generation of welformed json.

doc tests' json name have a filename in them. When json test output is asked for on windows currently produces invalid json.
Tracking issue for json test output: #49359

3 years agoRollup merge of #77488 - varkor:repr128-incomplete_features, r=jonas-schievink
Yuki Okushi [Fri, 23 Oct 2020 09:26:18 +0000 (18:26 +0900)]
Rollup merge of #77488 - varkor:repr128-incomplete_features, r=jonas-schievink

Mark `repr128` as `incomplete_features`

As mentioned in https://github.com/rust-lang/rust/issues/56071 and noticed in https://github.com/rust-lang/rust/issues/77457, `repr(u128)` and `repr(i128)` do not work properly due to lack of LLVM support. We should thus warn users trying to use the feature that they may encounter ICEs when using it.

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

3 years agoRollup merge of #77339 - fusion-engineering-forks:tryfrom-nonzero-to-nonzero, r=dtolnay
Yuki Okushi [Fri, 23 Oct 2020 09:26:16 +0000 (18:26 +0900)]
Rollup merge of #77339 - fusion-engineering-forks:tryfrom-nonzero-to-nonzero, r=dtolnay

Implement TryFrom between NonZero types.

This will instantly be stable, as trait implementations for stable types and traits can not be `#[unstable]`.

Closes #77258.

@rustbot modify labels: +T-libs

3 years agoRollup merge of #77268 - follower:patch-3, r=jyn514
Yuki Okushi [Fri, 23 Oct 2020 09:26:14 +0000 (18:26 +0900)]
Rollup merge of #77268 - follower:patch-3, r=jyn514

Link to "Contributing to Rust" rather than "Getting Started".

Change to link to "Contributing to Rust" chapter of `rustc` Dev Guide, primarily on the basis that:

 * The GitHub "first contribution" Issue "pop-up" says "Be sure to review the [contributing guidelines] and [code of conduct]" and links to this file.

 * The "Bug Report" section _seems_ to restrict itself to if "a compiler error message [told] you to come here".

 * The previous content of `CONTRIBUTING.md` now lives in the "Contributing to Rust" chapter.

When/if the guide/"Getting Started" section gets revised to not be `rustc`-specific, the choice of linked chapter could be updated.

In the meantime this prevents leading first time contributors into a confusing cul de sac.

_[I wasn't planning to make a PR for this until discussion in #77215 concluded but the discovery that the "first issue" pop-up also links to this document IMO makes it a higher priority to make the link useful sooner rather than later.]_

Related issues:

 * https://github.com/rust-lang/rust/issues/77215

 * https://github.com/rust-lang/rustc-dev-guide/issues/775#issuecomment-699063082

3 years agoreview
Bastian Kauschke [Fri, 23 Oct 2020 07:33:47 +0000 (09:33 +0200)]
review

3 years agoAdd regression test for issue-71732
Yuki Okushi [Fri, 23 Oct 2020 07:22:11 +0000 (16:22 +0900)]
Add regression test for issue-71732

3 years agoMake it regression test of issue-77668
Yuki Okushi [Fri, 23 Oct 2020 07:11:46 +0000 (16:11 +0900)]
Make it regression test of issue-77668

3 years agoAdd a regression test for issue-72616
Yuki Okushi [Fri, 23 Oct 2020 07:10:19 +0000 (16:10 +0900)]
Add a regression test for issue-72616

3 years agoAdd regression test for issue-77475
Yuki Okushi [Fri, 23 Oct 2020 07:09:17 +0000 (16:09 +0900)]
Add regression test for issue-77475

3 years agoDocument inline-const in the Unstable Book
Camelid [Thu, 22 Oct 2020 21:22:09 +0000 (14:22 -0700)]
Document inline-const in the Unstable Book

3 years agoReduce diagram mess in 'match arms have incompatible types' error
David Tolnay [Thu, 22 Oct 2020 21:20:02 +0000 (14:20 -0700)]
Reduce diagram mess in 'match arms have incompatible types' error

3 years agoAdd test of incompatible match arm types with multiline arm
David Tolnay [Thu, 22 Oct 2020 23:08:26 +0000 (16:08 -0700)]
Add test of incompatible match arm types with multiline arm

3 years agoimprove const infer error
Bastian Kauschke [Thu, 22 Oct 2020 21:07:48 +0000 (23:07 +0200)]
improve const infer error

3 years agoClean up lib docs
Camelid [Mon, 19 Oct 2020 01:17:49 +0000 (18:17 -0700)]
Clean up lib docs

3 years agoBless tests
Santiago Pastorino [Tue, 20 Oct 2020 22:59:22 +0000 (19:59 -0300)]
Bless tests

3 years agoAdd ..= const { .. } missing tests and sort them properly
Santiago Pastorino [Tue, 20 Oct 2020 21:53:13 +0000 (18:53 -0300)]
Add ..= const { .. } missing tests and sort them properly

3 years agoMake inline const work for half open ranges
Santiago Pastorino [Mon, 19 Oct 2020 21:44:37 +0000 (18:44 -0300)]
Make inline const work for half open ranges

3 years agoMake inline const work in range patterns
Santiago Pastorino [Mon, 19 Oct 2020 19:18:47 +0000 (16:18 -0300)]
Make inline const work in range patterns

3 years agoRename parse_const_expr to parse_const_block
Santiago Pastorino [Tue, 20 Oct 2020 22:14:17 +0000 (19:14 -0300)]
Rename parse_const_expr to parse_const_block

3 years agoExplain where the closure return type was inferred
Aaron Hill [Thu, 22 Oct 2020 13:47:23 +0000 (09:47 -0400)]
Explain where the closure return type was inferred

Fixes #78193

3 years agoAuto merge of #77720 - matthewjasper:fix-trait-ices, r=nikomatsakis
bors [Thu, 22 Oct 2020 14:40:20 +0000 (14:40 +0000)]
Auto merge of #77720 - matthewjasper:fix-trait-ices, r=nikomatsakis

Fix trait solving ICEs

- Selection candidates that are known to be applicable are preferred
  over candidates that are not.
- Don't ICE if a projection/object candidate is no longer applicable
  (this can happen due to cycles in normalization)
- Normalize supertraits when finding trait object candidates

Closes #77653
Closes #77656

r? `@nikomatsakis`

3 years agoFixup: add missing trailing newline
LeSeulArtichaut [Thu, 22 Oct 2020 12:37:42 +0000 (14:37 +0200)]
Fixup: add missing trailing newline

3 years agoAuto merge of #77871 - Julian-Wollersberger:less-query-context, r=oli-obk
bors [Thu, 22 Oct 2020 12:24:55 +0000 (12:24 +0000)]
Auto merge of #77871 - Julian-Wollersberger:less-query-context, r=oli-obk

Make fewer types generic over QueryContext

While trying to refactor `rustc_query_system::query::QueryContext` to make it dyn-safe, I noticed some smaller things:
* QueryConfig doesn't need to be generic over QueryContext
* ~~The `kind` field on QueryJobId is unused~~
* Some unnecessary where clauses
* Many types in `job.rs` where generic over `QueryContext` but only needed `QueryContext::Query`.
  If handle_cycle_error() could be refactored to not take `error: CycleError<CTX::Query>`, all those bounds could be removed as well.

Changing `find_cycle_in_stack()` in job.rs to not take a `tcx` argument is the only functional change here. Everything else is just updating type signatures. (aka compile-error driven development ^^)

~~Currently there is a weird bug where memory usage suddenly skyrockets when running UI tests. I'll investigate that tomorrow.
A perf run probably won't make sense before that is fixed.~~

EDIT: `kind` actually is used by `Eq`, and re-adding it fixed the memory issue.

3 years agoFix clippy tests
varkor [Thu, 22 Oct 2020 12:23:14 +0000 (13:23 +0100)]
Fix clippy tests

3 years agoMake closures inherit the parent function's target features
LeSeulArtichaut [Thu, 22 Oct 2020 11:55:19 +0000 (13:55 +0200)]
Make closures inherit the parent function's target features

3 years agoNormalize when finding trait object candidates
Matthew Jasper [Thu, 8 Oct 2020 20:52:40 +0000 (21:52 +0100)]
Normalize when finding trait object candidates

3 years agoAuto merge of #78134 - bugadani:arena-nodrop, r=lcnr
bors [Thu, 22 Oct 2020 07:05:21 +0000 (07:05 +0000)]
Auto merge of #78134 - bugadani:arena-nodrop, r=lcnr

Use `DroplessArena` where we know the type doesn't need drop

This PR uses a single `DroplessArena` in resolve instead of three separate `TypedArena`s.

`DroplessArena` checks that the type indeed doesn't need drop, so in case the types change, this will result in visible failures.

3 years agoAuto merge of #78131 - SimonSapin:ar, r=Mark-Simulacrum
bors [Thu, 22 Oct 2020 04:40:06 +0000 (04:40 +0000)]
Auto merge of #78131 - SimonSapin:ar, r=Mark-Simulacrum

Package more llvm-* tools in the rust-dev component, for run-make-fulldeps tests

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

3 years agoAuto merge of #78212 - JohnTitor:rollup-j5r6xuy, r=JohnTitor
bors [Thu, 22 Oct 2020 01:35:05 +0000 (01:35 +0000)]
Auto merge of #78212 - JohnTitor:rollup-j5r6xuy, r=JohnTitor

Rollup of 10 pull requests

Successful merges:

 - #77420 (Unify const-checking structured errors for `&mut` and `&raw mut`)
 - #77554 (Support signed integers and `char` in v0 mangling)
 - #77976 (Mark inout asm! operands as used in liveness pass)
 - #78009 (Haiku: explicitly set CMAKE_SYSTEM_NAME when cross-compiling)
 - #78084 (Greatly improve display for small mobile devices screens)
 - #78155 (Fix two small issues in compiler/rustc_lint/src/types.rs)
 - #78156 (Fixed build failure of `rustfmt`)
 - #78172 (Add test case for #77062)
 - #78188 (Add tracking issue number for pin_static_ref)
 - #78200 (Add `ControlFlow::is_{break,continue}` methods)

Failed merges:

r? `@ghost`

3 years agoClean up and improve some docs
Camelid [Mon, 19 Oct 2020 04:54:10 +0000 (21:54 -0700)]
Clean up and improve some docs

* compiler docs
  * Don't format list as part of a code block
  * Clean up some other formatting
* rustdoc book
  * Update CommonMark spec version to latest (0.28 -> 0.29)
  * Clean up some various wording and formatting

3 years agoRollup merge of #78200 - LeSeulArtichaut:controlflow-is-meth, r=scottmcm
Yuki Okushi [Thu, 22 Oct 2020 00:45:45 +0000 (09:45 +0900)]
Rollup merge of #78200 - LeSeulArtichaut:controlflow-is-meth, r=scottmcm

Add `ControlFlow::is_{break,continue}` methods

r? @scottmcm cc #75744

3 years agoRollup merge of #78188 - fusion-engineering-forks:static-ref-tracking-issue, r=withou...
Yuki Okushi [Thu, 22 Oct 2020 00:45:43 +0000 (09:45 +0900)]
Rollup merge of #78188 - fusion-engineering-forks:static-ref-tracking-issue, r=withoutboats

Add tracking issue number for pin_static_ref

Forgot to add a tracking issue in #77726. Opened #78186 as tracking issue.

3 years agoRollup merge of #78172 - wesleywiser:close_77062, r=oli-obk
Yuki Okushi [Thu, 22 Oct 2020 00:45:42 +0000 (09:45 +0900)]
Rollup merge of #78172 - wesleywiser:close_77062, r=oli-obk

Add test case for #77062

Closes #77062

3 years agoRollup merge of #78156 - bishtpawan:bugfix/rustfmt-no-longer-builds, r=lcnr
Yuki Okushi [Thu, 22 Oct 2020 00:45:40 +0000 (09:45 +0900)]
Rollup merge of #78156 - bishtpawan:bugfix/rustfmt-no-longer-builds, r=lcnr

Fixed build failure of `rustfmt`

Fixes #78079
r? @eddyb cc @bjorn3

3 years agoRollup merge of #78155 - est31:rustc_lint_types_refactor, r=davidtwco
Yuki Okushi [Thu, 22 Oct 2020 00:45:38 +0000 (09:45 +0900)]
Rollup merge of #78155 - est31:rustc_lint_types_refactor, r=davidtwco

Fix two small issues in compiler/rustc_lint/src/types.rs

Two small improvements of `compiler/rustc_lint/src/types.rs`

3 years agoRollup merge of #78084 - GuillaumeGomez:improve-mobile-display, r=jyn514,Nemo157
Yuki Okushi [Thu, 22 Oct 2020 00:45:37 +0000 (09:45 +0900)]
Rollup merge of #78084 - GuillaumeGomez:improve-mobile-display, r=jyn514,Nemo157

Greatly improve display for small mobile devices screens

Fixes #78014.

The biggest change being the "search bar". Instead of having everything on one line, I decided to move the search input on its own:

![Screenshot from 2020-10-18 21-54-26](https://user-images.githubusercontent.com/3050060/96378530-c863a800-118c-11eb-8e82-a43fce312b5b.png)

Another change is that now, we "break words" in the listing so that they don't grow too big:

![Screenshot from 2020-10-18 21-57-17](https://user-images.githubusercontent.com/3050060/96378555-ffd25480-118c-11eb-8a71-8f116c7edd93.png)

r? @jyn514

3 years agoRollup merge of #78009 - nielx:fix/CMAKE_SYSTEM_NAME, r=Mark-Simulacrum
Yuki Okushi [Thu, 22 Oct 2020 00:45:35 +0000 (09:45 +0900)]
Rollup merge of #78009 - nielx:fix/CMAKE_SYSTEM_NAME, r=Mark-Simulacrum

Haiku: explicitly set CMAKE_SYSTEM_NAME when cross-compiling

This resolves issues where the cross-build of LLVM fails because it tries to
link to the host's system libraries instead of the target's system libraries.

3 years agoRollup merge of #77976 - oliviacrain:issue-77915-fix, r=matthewjasper
Yuki Okushi [Thu, 22 Oct 2020 00:45:33 +0000 (09:45 +0900)]
Rollup merge of #77976 - oliviacrain:issue-77915-fix, r=matthewjasper

Mark inout asm! operands as used in liveness pass

Variables used in `inout` operands in inline assembly (that is, they're used as both input and output to some arbitrary assembly instruction) are being marked as read and written, but are not marked as being used in the RWU table during the liveness pass. This can result in such expressions triggering an unused variable lint warning. This is incorrect behavior- reads without uses are currently only used for compound assignments. We conservatively assume that an `inout` operand is being read and used in the context of the assembly instruction.

Closes #77915

3 years agoRollup merge of #77554 - varkor:mangle-int-char, r=eddyb
Yuki Okushi [Thu, 22 Oct 2020 00:45:31 +0000 (09:45 +0900)]
Rollup merge of #77554 - varkor:mangle-int-char, r=eddyb

Support signed integers and `char` in v0 mangling

Likely we want more tests, to check the output is correct too: however, I wasn't sure what kind of test we needed, so I just added one similar to that added in https://github.com/rust-lang/rust/pull/77452 for now.

r? @eddyb

3 years agoRollup merge of #77420 - ecstatic-morse:const-checking-raw-mut-ref, r=davidtwco
Yuki Okushi [Thu, 22 Oct 2020 00:45:25 +0000 (09:45 +0900)]
Rollup merge of #77420 - ecstatic-morse:const-checking-raw-mut-ref, r=davidtwco

Unify const-checking structured errors for `&mut` and `&raw mut`

Resolves #77414 as well as a FIXME.

3 years agoAuto merge of #78027 - lcnr:lift-by-value, r=varkor
bors [Wed, 21 Oct 2020 23:09:38 +0000 (23:09 +0000)]
Auto merge of #78027 - lcnr:lift-by-value, r=varkor

Lift: take self by value

seems small enough to not warrant an MCP :shrug:

3 years agoMark `repr128` as `incomplete_features`
varkor [Sat, 3 Oct 2020 13:47:28 +0000 (14:47 +0100)]
Mark `repr128` as `incomplete_features`

3 years agoreview
Bastian Kauschke [Wed, 21 Oct 2020 21:52:41 +0000 (23:52 +0200)]
review

3 years agoLift: take self by value
Bastian Kauschke [Fri, 16 Oct 2020 19:59:49 +0000 (21:59 +0200)]
Lift: take self by value

3 years agoAuto merge of #78077 - petrochenkov:qvis, r=davidtwco
bors [Wed, 21 Oct 2020 20:23:26 +0000 (20:23 +0000)]
Auto merge of #78077 - petrochenkov:qvis, r=davidtwco

Calculate visibilities once in resolve

Then use them through a query based on resolver outputs.

Item visibilities were previously calculated in three places - initially in `rustc_resolve`, then in `rustc_privacy` during type privacy checkin, and then in `rustc_metadata` during metadata encoding.
The visibility logic is not entirely trivial, especially for things like constructors or enum variants, and all of it was duplicated.

This PR deduplicates all the visibility calculations, visibilities are determined once during early name resolution and then stored in `ResolverOutputs` and are later available through `tcx` as a query `tcx.visibility(def_id)`.
(This query existed previously, but only worked for other crates.)

Some special cases (e.g. visibilities for closure types, which are needed for type privacy checking) are not processed in resolve, but deferred and performed directly in the query instead.

3 years agoUpdate to rustc-demangle 0.1.18
varkor [Wed, 21 Oct 2020 20:11:11 +0000 (21:11 +0100)]
Update to rustc-demangle 0.1.18

3 years agoAdd test for const generics demangling
varkor [Wed, 7 Oct 2020 20:17:07 +0000 (21:17 +0100)]
Add test for const generics demangling

3 years agoUpdate rustc-demangle
varkor [Wed, 7 Oct 2020 19:52:02 +0000 (20:52 +0100)]
Update rustc-demangle