Commit graph

132095 commits

Author SHA1 Message Date
chansuke d413bb6f57 #[deny(unsafe_op_in_unsafe_fn)] in sys/wasm 2020-10-24 11:50:09 +09:00
Dániel Buga f88d6e8437 Loop instead of recursion 2020-10-24 01:24:58 +02:00
Rich Kadel f75a236fe0
Update compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs
Co-authored-by: Wesley Wiser <wwiser@gmail.com>
2020-10-23 14:58:08 -07:00
Jonas Schievink f3265fec7a Fix Ubuntu download URL 2020-10-23 23:52:06 +02:00
Eduardo Broto ca11eeb563 Update Cargo.lock 2020-10-23 23:47:58 +02:00
Eduardo Broto e407cc5212 Remove duplicate import of Target 2020-10-23 23:45:37 +02:00
Tim Diekmann 693a2bf18b Rename Box::alloc to Box::alloc_ref 2020-10-23 22:45:15 +02:00
Eduardo Broto 9323443bdd Merge commit 'bf1c6f9871f430e284b17aa44059e0d0395e28a6' into clippyup 2020-10-23 22:16:59 +02:00
Tyler Mandry 6640a62e0e
Revert "Set .llvmbc and .llvmcmd sections as allocatable" 2020-10-23 12:54:00 -07:00
Esteban Küber f71e9ed7f1 review comments 2020-10-23 12:51:06 -07:00
Esteban Küber b334eef162 Do not ICE with TraitPredicates containing [type error]
Fix #77919.
2020-10-23 12:21:47 -07:00
Nicolas Nattis 929f80ece9 Add a spin loop hint for Arc::downgrade 2020-10-23 16:10:56 -03:00
Nelson J Morais c3cbaf64d3 x.py test --test-args flag description enhancement 2020-10-23 20:06:37 +01:00
Rich Kadel a7bc1a2edf 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.
2020-10-23 12:00:30 -07:00
Aaron Hill 5923218761
Add test for bad NLL higher-ranked subtype
Fixes #57642
2020-10-23 14:13:37 -04:00
bors 7bade6ef73 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).
2020-10-23 17:32:04 +00:00
nasso a0ce1e095e Always store Rustdoc theme when it's changed 2020-10-23 18:58:42 +02:00
bors bf1c6f9871 Auto merge of #6206 - ebroto:rustup, r=ebroto
Rustup

changelog: none

r? `@ghost`
2020-10-23 16:58:39 +00:00
Florian Warzecha ac2c599f23
fix validation for rustc_allow_const_fn_unstable targets
The validation was introduced in 3a63bf0299
without strict validation of functions, e. g. all function types were
allowed.
Now the validation only allows `const fn`s.
2020-10-23 17:54:48 +02:00
Florian Warzecha 13b481b247
rename allow_internal_unstable() to rustc_allow_const_fn_unstable() in rustc_mir
Followup rename from 05f4a9a42a,
which introduced `#[rustc_allow_const_fn_unstable]` for `const fn`s.
2020-10-23 17:14:57 +02:00
Esteban Küber f5d7443a6b Suggest semicolon removal and boxing when appropriate 2020-10-23 08:06:41 -07:00
Esteban Küber c5485115dc Add more .await suggestions on E0308 2020-10-23 08:06:41 -07:00
Esteban Küber 1829b4a887 Add test case for different impl Futures 2020-10-23 08:06:41 -07:00
Esteban Küber 3a0227bc49 Silence unnecessary await foo? knock-down error 2020-10-23 08:06:41 -07:00
Esteban Küber 62ba365195 Review comments: use newtype instead of bool 2020-10-23 08:06:41 -07:00
Esteban Küber 671d7c4afb Account for possible boxable impl Future in semicolon removal suggestions 2020-10-23 08:06:13 -07:00
Esteban Küber a4ee3ca1e4 Suggest semicolon removal on prior match arm 2020-10-23 08:02:58 -07:00
Esteban Küber 86df9039b2 Tweak "use .await" suggestion 2020-10-23 08:02:57 -07:00
Florian Warzecha 83fbdddc99
ignore #[rustc_allow_const_fn_unstable] for macro expansion
Recognition for `rustc_allow_const_fn_unstable` attribute was errorneously
added in 05f4a9a42a.
2020-10-23 16:54:25 +02:00
Bastian Kauschke 47cb871f14 review 2020-10-23 15:04:12 +02:00
Eduardo Broto d17edaa152 Merge remote-tracking branch 'upstream/master' into rustup 2020-10-23 14:37:17 +02:00
Bastian Kauschke 972d9e886c move visit_predicate into TypeVisitor 2020-10-23 13:58:32 +02:00
Tim 7d30c53656
Bump backtrace-rs to enable Mach-O support on iOS. 2020-10-23 13:47:09 +02:00
Eduardo Pinho efedcb2344
Update description of Empty Enum for accuracy
An empty enum is similar to the never type `!`, rather than the unit type `()`.
2020-10-23 12:13:07 +01:00
Bastian Kauschke 6ad140ca19 const_eval_checked: deal with unused nodes + div 2020-10-23 12:16:58 +02:00
Canop 216d0fe364 add tracking issue number to option_insert feature gate 2020-10-23 11:44:58 +02:00
Canop 415a8e526d Update library/core/src/option.rs
Co-authored-by: Ivan Tham <pickfire@riseup.net>
2020-10-23 11:41:19 +02:00
Canop 39557799c7 Update library/core/src/option.rs
Co-authored-by: Mara Bos <m-ou.se@m-ou.se>
2020-10-23 11:41:19 +02:00
Canop cc8b77a7cf fix naming unconsistency between function doc and prototype 2020-10-23 11:41:19 +02:00
Canop 60a96cae33 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.
2020-10-23 11:41:19 +02:00
Canop e8df2a4269 remove option.insert_with
`option.insert` covers both needs anyway, `insert_with` is
redundant.
2020-10-23 11:41:19 +02:00
Canop 9b90e1762e 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,
};
```
2020-10-23 11:41:19 +02:00
bors 07a63e6d1f 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`
2020-10-23 09:31:44 +00:00
Yuki Okushi b5d2ff0fd8
Rollup merge of #78265 - JohnTitor:type-iference-diag-test, r=lcnr
Add some inference-related regression tests about incorrect diagnostics

Closes #71732
Closes #72616
2020-10-23 18:26:44 +09:00
Yuki Okushi 6884632be1
Rollup merge of #78263 - JohnTitor:mir-opt-ice-test, r=lcnr
Add regression test of issue-77668

Closes #77668
2020-10-23 18:26:42 +09:00
Yuki Okushi 7ba519ec50
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
2020-10-23 18:26:40 +09:00
Yuki Okushi 3f462c22b5
Rollup merge of #78235 - Aaron1011:closure-ret-infer, r=varkor
Explain where the closure return type was inferred

Fixes #78193
2020-10-23 18:26:39 +09:00
Yuki Okushi 00c4dcdbb4
Rollup merge of #78231 - LeSeulArtichaut:closure-target_feature, r=nikomatsakis
Make closures inherit the parent function's target features

r? @ghost
Closes #73631
2020-10-23 18:26:37 +09:00
Yuki Okushi 29461c1668
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)
2020-10-23 18:26:35 +09:00
Yuki Okushi dfb0d09bae
Rollup merge of #78163 - camelid:fixup-lib-docs, r=m-ou-se
Clean up lib docs

Cherry-picked out of #78094.
2020-10-23 18:26:33 +09:00