Commit Graph

137386 Commits

Author SHA1 Message Date
Giles Cope
328abfb943
Slight simplification of chars().count() 2021-01-26 11:14:57 +00:00
bjorn3
903c553f4a Wasm-bindgen abi compat using cast_to 2021-01-26 11:31:37 +01:00
Ömer Sinan Ağacan
8ddc1c83f2 Refine "remove semicolon" suggestion in trait selection
Don't suggest it if the last statement doesn't have a semicolon

Fixes #81098

See also #54771 for why this suggestion was added
2021-01-26 13:23:30 +03:00
bjorn3
ecbc661030 Revert "Fix abi for wasm-bindgen"
This reverts commit 4d2766e352.
2021-01-26 11:09:09 +01:00
bjorn3
36df9c55e5 Revert "Share wasm-bindgen compat abi selection code"
This reverts commit e7a056fe20.
2021-01-26 11:09:06 +01:00
bors
be0125bed4 Auto merge of #6469 - matthiaskrgr:clippy_dev_crater, r=flip1995
add "cargo dev crater" to run clippy on a fixed set of crates and diff the lint warnings

`cargo dev crater` now does the following:
build clippy in debug mode
for a fixed set of crates:
 download and extract the crate
 run compiled clippy on the crate
 dump the warnings into a file that is inside the repo

We can then do a "git diff" and see what effects our clippy changes had on a tiny fraction of the rust ecosystem and can see when an change unexpectedly added or silenced a lot of warnings.

Checking all the crates took less than 5 minutes on my system.

Should help with https://github.com/rust-lang/rust-clippy/issues/6429

---

*Please write a short comment explaining your change (or "none" for internal only changes)*
changelog: extend cargo dev to run clippy against a fixed set of crates and compare warnings
2021-01-26 06:58:04 +00:00
Ömer Sinan Ağacan
d035be8e6f typeck: Don't suggest converting LHS exprs
Converting LHS of an assignment does not work, so avoid suggesting that.

Fixes #81293
2021-01-26 09:09:15 +03:00
bors
a8f7075532 Auto merge of #80692 - Aaron1011:feature/query-result-debug, r=estebank
Enforce that query results implement Debug

Currently, we require that query keys implement `Debug`, but we do not do the same for query values. This can make incremental compilation bugs difficult to debug - there isn't a good place to print out the result loaded from disk.

This PR adds `Debug` bounds to several query-related functions, allowing us to debug-print the query value when an 'unstable fingerprint' error occurs. This required adding `#[derive(Debug)]` to a fairly large number of types - hopefully, this doesn't have much of an impact on compiler bootstrapping times.
2021-01-26 05:47:23 +00:00
bors
ff6ee2a702 Auto merge of #79113 - andjo403:raw_vec_ptr, r=m-ou-se
mark raw_vec::ptr with inline

when a lot of vectors is used in a enum as in the example in #66617 if this function is not inlined and multiple cgus is used this results in huge compile times. with this fix the compile time is 6s from minutes for the example in #66617. I did not have the patience to wait for it to compile for more then 3 min.
2021-01-26 02:56:37 +00:00
Eric Huss
fdd592acd0 Update books 2021-01-25 15:10:10 -08:00
bors
8d57cee9ca Auto merge of #6617 - Manishearth:exhaustive_enums, r=camsteffen
New lint: exhaustive_enums, exhaustive_structs

Fixes #6616

changelog: Added restriction lint: `exhaustive_enums`, `exhaustive_structs`
2021-01-25 23:06:39 +00:00
Manish Goregaokar
3e3dff7135 Add test with attrs 2021-01-25 14:39:03 -08:00
Manish Goregaokar
e0ae980fab Better suggestion span 2021-01-25 14:35:57 -08:00
Eric Huss
6f22f512ec tidy: Remove unnecessary trailing semicolon.
This will cause a failure due to the warning after the next beta branch
as https://github.com/rust-lang/rust/pull/79812 will hit beta.
2021-01-25 12:43:17 -08:00
Eric Huss
d9807154d6 tidy: Remove edition filter exceptions.
These exceptions are no longer necessary.
2021-01-25 12:40:22 -08:00
Eric Huss
3eebf9bb80 tidy: Remove cargo check.
The cargo check was checking that every dependency had an `extern crate`.
The compiler has not used `extern crate` in a long time (edition 2018).
The test was broken (the call to `!super::filter_dirs(path)` was backwards).
This just removes it since it is no longer valid.
2021-01-25 12:39:46 -08:00
bjorn3
e7a056fe20 Share wasm-bindgen compat abi selection code 2021-01-25 21:32:57 +01:00
Anders Kaseorg
b05788e859 libtest: Store pending timeouts in a deque
This reduces the total complexity of checking timeouts from quadratic
to linear, and should also fix an unwrap of None on completion of an
already timed-out test.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2021-01-25 12:21:33 -08:00
Felix S. Klock II
4c5ede7c6a This should address issue 81294.
(No test added. The relevant test *is* ui/panic-handler/weak-lang-item.rs, and this change should make it less flaky.)
2021-01-25 14:37:27 -05:00
bors
f4eb5d9f71 Auto merge of #68828 - oli-obk:inline_cycle, r=wesleywiser
Prevent query cycles in the MIR inliner

r? `@eddyb` `@wesleywiser`

cc `@rust-lang/wg-mir-opt`

The general design is that we have a new query that is run on the `validated_mir` instead of on the `optimized_mir`. That query is forced before going into the optimization pipeline, so as to not try to read from a stolen MIR.

The query should not be cached cross crate, as you should never call it for items from other crates. By its very design calls into other crates can never cause query cycles.

This is a pessimistic approach to inlining, since we strictly have more calls in the `validated_mir` than we have in `optimized_mir`, but that's not a problem imo.
2021-01-25 19:03:37 +00:00
Eric Huss
1c0a52d304 rustdoc: Document CommonMark extensions. 2021-01-25 11:03:15 -08:00
bjorn3
4d2766e352 Fix abi for wasm-bindgen 2021-01-25 18:48:49 +01:00
bors
7fba12bb1d Auto merge of #81375 - RalfJung:miri, r=RalfJung
update Miri

Fixes https://github.com/rust-lang/rust/issues/81341
Cc `@rust-lang/miri` r? `@ghost`
2021-01-25 15:33:17 +00:00
Miguel Ojeda
01250fcec6 Add tracking issue
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2021-01-25 14:58:09 +01:00
Guillaume Gomez
09518db73e Improve URL handling when clicking on a menu link while being on the search results and overall 2021-01-25 14:57:40 +01:00
Miguel Ojeda
0140dacabb Link the reference about undefined behavior
Suggested-by: Mara Bos <m-ou.se@m-ou.se>
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2021-01-25 14:53:19 +01:00
bors
84864bfea9 Auto merge of #81380 - pietroalbini:cargo-pgo-lockfile, r=Mark-Simulacrum
Use the monorepo's lockfile when building cargo for PGO profiling

Fixes https://github.com/rust-lang/rust/issues/81378. The description of the problem and the reasoning for the fix is in the source code comments.

r? `@Mark-Simulacrum`
2021-01-25 12:38:03 +00:00
Pietro Albini
b2e6f333e9
ci: use the monorepo's lockfile when building cargo for pgo profiling 2021-01-25 13:33:24 +01:00
Guillaume Gomez
ef3127dcdf Completely remove search query parameter when clearing search input 2021-01-25 12:54:25 +01:00
Ralf Jung
26e67ad35b update Miri 2021-01-25 11:42:38 +01:00
oli
d38553ca82 Ignore a test on wasm, because that changes landing pads 2021-01-25 09:34:33 +00:00
Guillaume Gomez
042facb935 Fix some bugs reported by eslint 2021-01-25 10:32:58 +01:00
Esteban Küber
088c89d9ff Account for generics when suggesting bound
Fix #81175.
2021-01-24 23:16:50 -08:00
1000teslas
26b4baf46e Point to span of upvar making closure FnMut
Add expected error

Add comment

Tweak comment wording

Fix after rebase to updated master

Fix after rebase to updated master

Distinguish mutation in normal and move closures

Tweak error message

Fix error message for nested closures

Refactor code showing mutated upvar in closure

Remove debug assert

B
2021-01-25 16:53:27 +11:00
Tyson Nottingham
59195a2772 rustc_codegen_ssa: use wall time for codegen_to_LLVM_IR time-passes entry
Use elapsed wall time spent on codegen_to_LLVM_IR for all CGUs as a
whole, rather than the sum for each CGU (the distinction matters for
parallel builds, where some CGUs are processed in parallel).
2021-01-24 21:27:41 -08:00
Camelid
2be1993233 Ignore test on 32-bit architectures 2021-01-24 20:04:35 -08:00
Anders Kaseorg
57c72ab846 libtest: Wait for test threads to exit after they report completion
Otherwise we can miss bugs where a test reports that it succeeded but
then panics within a TLS destructor.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2021-01-24 19:09:54 -08:00
bors
c56b32899f Auto merge of #6630 - xFrednet:0000-configuration-documentation, r=llogiq
Documentation for adding configuration to a lint and common abbreviations

This PR adds some commonly used abbreviations to the `basis.md` file and a guide on how to implement a configuration value for a lint.

* [Rendered `/doc/basics.md` (Abbreviation list)](https://github.com/xFrednet/rust-clippy/blob/0000-configuration-documentation/doc/basics.md#common-abbreviations)
* [Rendered `/doc/adding_lints.md` (Configuration value guide)](https://github.com/xFrednet/rust-clippy/blob/0000-configuration-documentation/doc/adding_lints.md#adding-configuration-to-a-lint)

I'm not sure if the guide is written in the best way. Style suggestions are appreciated. 🙃

 ---

Again a big **thank you** for everyone who helped to collect the abbreviation list over on [zulip]. I had a lot of fun, and it was also very informative. Keep up the good work 🙃

[zulip]: https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/Common.20abbreviations.20in.20basics.2Emd/near/223548065
---

changelog: none
2021-01-25 00:25:31 +00:00
bors
d3163e9655 Auto merge of #81355 - jonas-schievink:rollup-vpaadij, r=jonas-schievink
Rollup of 14 pull requests

Successful merges:

 - #75180 (Implement Error for &(impl Error))
 - #78578 (Permit mutable references in all const contexts)
 - #79174 (Make std::future a re-export of core::future)
 - #79884 (Replace magic numbers with existing constants)
 - #80855 (Expand assert!(expr, args..) to include $crate for hygiene on 2021.)
 - #80933 (Fix sysroot option not being honored across rustc)
 - #81259 (Replace version_check dependency with own version parsing code)
 - #81264 (Add unstable option to control doctest run directory)
 - #81279 (Small refactor in typeck)
 - #81297 (Don't provide backend_optimization_level query for extern crates)
 - #81302 (Fix rendering of stabilization version for trait implementors)
 - #81310 (Do not mark unit variants as used when in path pattern)
 - #81320 (Make bad shlex parsing a pretty error)
 - #81338 (Clean up `dominators_given_rpo`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-01-24 23:04:15 +00:00
Jonas Schievink
529f15f9b9
Rollup merge of #81338 - bugadani:dominator-cleanup, r=davidtwco
Clean up `dominators_given_rpo`
2021-01-24 22:10:10 +01:00
Jonas Schievink
558b87859b
Rollup merge of #81320 - CraftSpider:jsondoc-errors, r=jyn514
Make bad shlex parsing a pretty error

Closes #81319

Old Output:
<details><summary>Backtrace</summary>
<p>

```
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', src\too
ls\jsondocck\src\main.rs:152:81
stack backtrace:
   0:     0x7ff79a011405 - std::backtrace_rs::backtrace::dbghelp::trace
                               at /rustc/05b6023675d77979637b04a350c85903fbf5925
7\/library\std\src\..\..\backtrace\src\backtrace\dbghelp.rs:98
   1:     0x7ff79a011405 - std::backtrace_rs::backtrace::trace_unsynchronized
                               at /rustc/05b6023675d77979637b04a350c85903fbf5925
7\/library\std\src\..\..\backtrace\src\backtrace\mod.rs:66
   2:     0x7ff79a011405 - std::sys_common::backtrace::_print_fmt
                               at /rustc/05b6023675d77979637b04a350c85903fbf5925
7\/library\std\src\sys_common\backtrace.rs:67
   3:     0x7ff79a011405 - std::sys_common::backtrace::_print::{{impl}}::fmt
                               at /rustc/05b6023675d77979637b04a350c85903fbf5925
7\/library\std\src\sys_common\backtrace.rs:46
   4:     0x7ff79a026c7b - core::fmt::write
                               at /rustc/05b6023675d77979637b04a350c85903fbf5925
7\/library\core\src\fmt\mod.rs:1078
   5:     0x7ff79a00e74d - std::io::Write::write_fmt<std::sys::windows::stdio::S
tderr>
                               at /rustc/05b6023675d77979637b04a350c85903fbf5925
7\/library\std\src\io\mod.rs:1519
   6:     0x7ff79a01413d - std::sys_common::backtrace::_print
                               at /rustc/05b6023675d77979637b04a350c85903fbf5925
7\/library\std\src\sys_common\backtrace.rs:49
   7:     0x7ff79a01413d - std::sys_common::backtrace::print
                               at /rustc/05b6023675d77979637b04a350c85903fbf5925
7\/library\std\src\sys_common\backtrace.rs:36
   8:     0x7ff79a01413d - std::panicking::default_hook::{{closure}}
                               at /rustc/05b6023675d77979637b04a350c85903fbf5925
7\/library\std\src\panicking.rs:208
   9:     0x7ff79a013c4a - std::panicking::default_hook
                               at /rustc/05b6023675d77979637b04a350c85903fbf5925
7\/library\std\src\panicking.rs:225
  10:     0x7ff79a014a7e - std::panicking::rust_panic_with_hook
                               at /rustc/05b6023675d77979637b04a350c85903fbf5925
7\/library\std\src\panicking.rs:591
  11:     0x7ff79a014573 - std::panicking::begin_panic_handler::{{closure}}
                               at /rustc/05b6023675d77979637b04a350c85903fbf5925
7\/library\std\src\panicking.rs:495
  12:     0x7ff79a011ddf - std::sys_common::backtrace::__rust_end_short_backtrac
e<closure-0,!>
                               at /rustc/05b6023675d77979637b04a350c85903fbf5925
7\/library\std\src\sys_common\backtrace.rs:141
  13:     0x7ff79a0144f9 - std::panicking::begin_panic_handler
                               at /rustc/05b6023675d77979637b04a350c85903fbf5925
7\/library\std\src\panicking.rs:493
  14:     0x7ff79a025230 - core::panicking::panic_fmt
                               at /rustc/05b6023675d77979637b04a350c85903fbf5925
7\/library\core\src\panicking.rs:92
  15:     0x7ff79a02517c - core::panicking::panic
                               at /rustc/05b6023675d77979637b04a350c85903fbf5925
7\/library\core\src\panicking.rs:50
  16:     0x7ff799f5245f - indexmap::map::core::raw::<impl indexmap::map::core::
IndexMapCore<K,V>>::get_index_of::had34e726f99bd999
  17:     0x7ff799f48fea - std::sys_common::backtrace::__rust_begin_short_backtr
ace::h1ac92efa44350e74
  18:     0x7ff799f41015 - std::rt::lang_start::{{closure}}::hdfe733a6a1ad9a18
  19:     0x7ff79a014c34 - core::ops::function::impls::{{impl}}::call_once
                               at /rustc/05b6023675d77979637b04a350c85903fbf5925
7\library\core\src\ops\function.rs:280
  20:     0x7ff79a014c34 - std::panicking::try::do_call
                               at /rustc/05b6023675d77979637b04a350c85903fbf5925
7\/library\std\src\panicking.rs:379
  21:     0x7ff79a014c34 - std::panicking::try
                               at /rustc/05b6023675d77979637b04a350c85903fbf5925
7\/library\std\src\panicking.rs:343
  22:     0x7ff79a014c34 - std::panic::catch_unwind
                               at /rustc/05b6023675d77979637b04a350c85903fbf5925
7\/library\std\src\panic.rs:396
  23:     0x7ff79a014c34 - std::rt::lang_start_internal
                               at /rustc/05b6023675d77979637b04a350c85903fbf5925
7\/library\std\src\rt.rs:51
  24:     0x7ff799f536a7 - main
  25:     0x7ff79a02d788 - invoke_main
                               at d:\A01\_work\6\s\src\vctools\crt\vcstartup\src
\startup\exe_common.inl:78
  26:     0x7ff79a02d788 - __scrt_common_main_seh
                               at d:\A01\_work\6\s\src\vctools\crt\vcstartup\src
\startup\exe_common.inl:288
  27:     0x7ffe6bf47034 - BaseThreadInitThunk
  28:     0x7ffe6c89d241 - RtlUserThreadStart
```

</p>
</details>

New Output:
```
Invalid command: Invalid arguments to shlex::split: ` - "$foo` on line 26
```

I've hit this a couple times, makes debugging a little nicer.
2021-01-24 22:10:08 +01:00
Jonas Schievink
04ddf42218
Rollup merge of #81310 - tmiasko:in-pattern, r=petrochenkov
Do not mark unit variants as used when in path pattern

Record that we are processing a pattern so that code responsible for
handling path resolution can correctly decide whether to mark it as
used or not.

Closes #76788.
2021-01-24 22:10:06 +01:00
Jonas Schievink
ee4461a996
Rollup merge of #81302 - LeSeulArtichaut:80777-trait-render, r=jyn514
Fix rendering of stabilization version for trait implementors

Rustdoc compares an item's stabilization version with its parent's to not render it if they are the same. Here, the implementor was compared with itself, resulting in the stabilization version never getting shown.

This probably needs a test.

Fixes #80777.
r? `@jyn514`
2021-01-24 22:10:04 +01:00
Jonas Schievink
9089dd2248
Rollup merge of #81297 - bjorn3:no_extern_backend_optimization_level_query_provider, r=cjgillot
Don't provide backend_optimization_level query for extern crates

Fixes #71291
2021-01-24 22:10:02 +01:00
Jonas Schievink
70be327f2a
Rollup merge of #81279 - bugadani:iter, r=davidtwco
Small refactor in typeck

 - `check_impl_items_against_trait` only queries and walks through associated items once
 - extracted function that reports errors
 - don't check specialization validity when trait item does not match
 - small additional cleanups
2021-01-24 22:10:01 +01:00
Jonas Schievink
504d6de52d
Rollup merge of #81264 - Swatinem:doctest-run-directory, r=jyn514
Add unstable option to control doctest run directory

This option will allow splitting the compile-time from the run-time
directory of doctest invocations and is one step to solve
https://github.com/rust-lang/cargo/issues/8993#issuecomment-760088944

r? `@jyn514`
2021-01-24 22:09:59 +01:00
Jonas Schievink
22dc82fb9d
Rollup merge of #81259 - est31:cfg_version, r=petrochenkov
Replace version_check dependency with own version parsing code

This gives compiler maintainers a better degree of control
over how the version gets parsed and is a good way to ensure
that there are no changes of behaviour in the future.

Also, issue a warning if the version is invalid instead of erroring
so that we stay forwards compatible with possible future changes
of the versioning scheme.

Last, this improves the present test a little.

Fixes #79436

r? `@petrochenkov`
2021-01-24 22:09:57 +01:00
Jonas Schievink
27abbc208f
Rollup merge of #80933 - rcvalle:fix-sysroot-option, r=nagisa
Fix sysroot option not being honored across rustc

Change link_sanitizer_runtime() to check if the sanitizer library exists in the specified/session sysroot, and if it doesn't exist, use the default sysroot. (See #79253.)
2021-01-24 22:09:55 +01:00
Jonas Schievink
e8ef15d9d1
Rollup merge of #80855 - m-ou-se:assert-2021, r=petrochenkov
Expand assert!(expr, args..) to include $crate for hygiene on 2021.

This makes `assert!(expr, args..)` properly hygienic in Rust 2021.

This is part of rust-lang/rfcs#3007, see #80162.

Before edition 2021, this was a breaking change, as `std::panic` and `core::panic` are different. In edition 2021 they will be identical, making it possible to apply proper hygiene here.
2021-01-24 22:09:53 +01:00
Jonas Schievink
3ed8a3769a
Rollup merge of #79884 - Digital-Chaos:replace-magic, r=m-ou-se
Replace magic numbers with existing constants

Replaced magic numbers in `library/core/src/time.rs` with predefined constants.
2021-01-24 22:09:51 +01:00