]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoThis should address issue 81294.
Felix S. Klock II [Mon, 25 Jan 2021 19:37:27 +0000 (14:37 -0500)]
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.)

3 years agoAuto merge of #81380 - pietroalbini:cargo-pgo-lockfile, r=Mark-Simulacrum
bors [Mon, 25 Jan 2021 12:38:03 +0000 (12:38 +0000)]
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`

3 years agoci: use the monorepo's lockfile when building cargo for pgo profiling
Pietro Albini [Mon, 25 Jan 2021 12:33:24 +0000 (13:33 +0100)]
ci: use the monorepo's lockfile when building cargo for pgo profiling

3 years agoAuto merge of #81355 - jonas-schievink:rollup-vpaadij, r=jonas-schievink
bors [Sun, 24 Jan 2021 23:04:15 +0000 (23:04 +0000)]
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

3 years agoRollup merge of #81338 - bugadani:dominator-cleanup, r=davidtwco
Jonas Schievink [Sun, 24 Jan 2021 21:10:10 +0000 (22:10 +0100)]
Rollup merge of #81338 - bugadani:dominator-cleanup, r=davidtwco

Clean up `dominators_given_rpo`

3 years agoRollup merge of #81320 - CraftSpider:jsondoc-errors, r=jyn514
Jonas Schievink [Sun, 24 Jan 2021 21:10:08 +0000 (22:10 +0100)]
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.

3 years agoRollup merge of #81310 - tmiasko:in-pattern, r=petrochenkov
Jonas Schievink [Sun, 24 Jan 2021 21:10:06 +0000 (22:10 +0100)]
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.

3 years agoRollup merge of #81302 - LeSeulArtichaut:80777-trait-render, r=jyn514
Jonas Schievink [Sun, 24 Jan 2021 21:10:04 +0000 (22:10 +0100)]
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`

3 years agoRollup merge of #81297 - bjorn3:no_extern_backend_optimization_level_query_provider...
Jonas Schievink [Sun, 24 Jan 2021 21:10:02 +0000 (22:10 +0100)]
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

3 years agoRollup merge of #81279 - bugadani:iter, r=davidtwco
Jonas Schievink [Sun, 24 Jan 2021 21:10:01 +0000 (22:10 +0100)]
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

3 years agoRollup merge of #81264 - Swatinem:doctest-run-directory, r=jyn514
Jonas Schievink [Sun, 24 Jan 2021 21:09:59 +0000 (22:09 +0100)]
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`

3 years agoRollup merge of #81259 - est31:cfg_version, r=petrochenkov
Jonas Schievink [Sun, 24 Jan 2021 21:09:57 +0000 (22:09 +0100)]
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`

3 years agoRollup merge of #80933 - rcvalle:fix-sysroot-option, r=nagisa
Jonas Schievink [Sun, 24 Jan 2021 21:09:55 +0000 (22:09 +0100)]
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.)

3 years agoRollup merge of #80855 - m-ou-se:assert-2021, r=petrochenkov
Jonas Schievink [Sun, 24 Jan 2021 21:09:53 +0000 (22:09 +0100)]
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.

3 years agoRollup merge of #79884 - Digital-Chaos:replace-magic, r=m-ou-se
Jonas Schievink [Sun, 24 Jan 2021 21:09:51 +0000 (22:09 +0100)]
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.

3 years agoRollup merge of #79174 - taiki-e:std-future, r=Mark-Simulacrum
Jonas Schievink [Sun, 24 Jan 2021 21:09:49 +0000 (22:09 +0100)]
Rollup merge of #79174 - taiki-e:std-future, r=Mark-Simulacrum

Make std::future a re-export of core::future

After 1a764a7ef59b9cb2eb31658625a6a7dacc3d819b, there are no `std::future`-specific items (except for `cfg(bootstrap)` items removed in 93eed402adbe9e7a532995500d50716d52eefee9). So, instead of defining `std` own module, we can re-export the `core::future` directly.

3 years agoRollup merge of #78578 - oli-obk:const_mut_refs, r=RalfJung
Jonas Schievink [Sun, 24 Jan 2021 21:09:48 +0000 (22:09 +0100)]
Rollup merge of #78578 - oli-obk:const_mut_refs, r=RalfJung

Permit mutable references in all const contexts

fixes #71212

cc `@rust-lang/wg-const-eval` `@christianpoveda`

3 years agoRollup merge of #75180 - KodrAus:feat/error-by-ref, r=m-ou-se
Jonas Schievink [Sun, 24 Jan 2021 21:09:45 +0000 (22:09 +0100)]
Rollup merge of #75180 - KodrAus:feat/error-by-ref, r=m-ou-se

Implement Error for &(impl Error)

Opening this up just to see what it breaks. It's unfortunate that `&(impl Error)` doesn't actually implement `Error`. If this direct approach doesn't work out then I'll try something different, like an `Error::by_ref` method.

**EDIT:** This is a super low-priority experiment so feel free to cancel it for more important crater runs! 🙂

-----

# Stabilization Report

## Why?

We've been working for the last few years to try "fix" the `Error` trait, which is probably one of the most fundamental in the whole standard library. One of its issues is that we commonly expect you to work with abstract errors through `dyn Trait`, but references and smart pointers over `dyn Trait` don't actually implement the `Error` trait. If you have a `&dyn Error` or a `Box<dyn Error>` you simply can't pass it to a method that wants a `impl Error`.

## What does this do?

This stabilizes the following trait impl:

```rust
impl<'a, T: Error + ?Sized + 'static> Error for &'a T;
```

This means that `&dyn Error` will now satisfy a `impl Error` bound.

It doesn't do anything with `Box<dyn Error>` directly. We discussed how we could do `Box<dyn Error>` in the thread here (and elsewhere in the past), but it seems like we need something like lattice-based specialization or a sprinkling of snowflake compiler magic to make that work. Having said that, with this new impl you _can_ now get a `impl Error` from a `Box<dyn Error>`  by dereferencing it.

## What breaks?

A crater run revealed a few crates broke with something like the following:

```rust
// where e: &'short &'long dyn Error
err.source()
```

previously we'd auto-deref that `&'short &'long dyn Error` to return a `Option<&'long dyn Error>` from `source`, but now will call directly on `&'short impl Error`, so will return a `Option<&'short dyn Error>`. The fix is to manually deref:

```rust
// where e: &'short &'long dyn Error
(*err).source()
```

In the recent Libs meeting we considered this acceptable breakage.

3 years agoAuto merge of #81337 - petrochenkov:kvcollect, r=Aaron1011
bors [Sun, 24 Jan 2021 20:09:18 +0000 (20:09 +0000)]
Auto merge of #81337 - petrochenkov:kvcollect, r=Aaron1011

parser: Collect tokens for values in key-value attributes

Fixes #81208 which happens when we parse the attribute value for the second time with an overridden span to synthesize tokens.

It also may be faster to collect tokens instead of re-synthesizing them.

3 years agoparser: Collect tokens for values in key-value attributes
Vadim Petrochenkov [Sun, 24 Jan 2021 13:41:12 +0000 (16:41 +0300)]
parser: Collect tokens for values in key-value attributes

3 years agoOnly call span.rust_2021() when necessary.
Mara Bos [Sun, 24 Jan 2021 13:15:15 +0000 (14:15 +0100)]
Only call span.rust_2021() when necessary.

3 years agoAuto merge of #81250 - sivadeilra:remove_xp_compat, r=joshtriplett,m-ou-se
bors [Sun, 24 Jan 2021 12:34:08 +0000 (12:34 +0000)]
Auto merge of #81250 - sivadeilra:remove_xp_compat, r=joshtriplett,m-ou-se

Remove delay-binding for Win XP and Vista

The minimum supported Windows version is now Windows 7. Windows XP
and Windows Vista are no longer supported; both are already broken, and
require extra steps to use.

This commit removes the delayed-binding support for Windows API
functions that are present on all supported Windows targets. This has
several benefits: Removes needless complexity. Removes a load and
dynamic call on hot paths in mutex acquire / release. This may have
performance benefits.

* "Drop official support for Windows XP"
  https://github.com/rust-lang/compiler-team/issues/378

* "Firefox has ended support for Windows XP and Vista"
  https://support.mozilla.org/en-US/kb/end-support-windows-xp-and-vista

3 years agoClean up dominators_given_rpo
Dániel Buga [Sun, 24 Jan 2021 12:32:18 +0000 (13:32 +0100)]
Clean up dominators_given_rpo

3 years agoAuto merge of #80838 - nagisa:nagisa/stack-probe-type, r=cuviper
bors [Sun, 24 Jan 2021 09:44:42 +0000 (09:44 +0000)]
Auto merge of #80838 - nagisa:nagisa/stack-probe-type, r=cuviper

Target stack-probe support configurable finely

This adds capability to configure the target's stack probe support in a
more precise manner than just on/off. In particular now we allow
choosing between always inline-asm, always call or either one of those
depending on the LLVM version.

Note that this removes the ability to turn off the generation of the
stack-probe attribute. This is valid to replace it with inline-asm for all targets because
`probe-stack="inline-asm"` will not generate any machine code on targets
that do not currently support stack probes. This makes support for stack
probes on targets that don't have any right now automatic with LLVM
upgrades in the future.

(This is valid to do based on the fact that clang unconditionally sets
this attribute when `-fstack-clash-protection` is used, AFAICT)

cc #77885
r? `@cuviper`

3 years agoAuto merge of #80919 - cjgillot:defkey-span, r=oli-obk
bors [Sun, 24 Jan 2021 06:51:17 +0000 (06:51 +0000)]
Auto merge of #80919 - cjgillot:defkey-span, r=oli-obk

Generate metadata by iterating on DefId instead of traversing the HIR tree 1/N

Sample from #80347.

3 years agofmt
Rune Tynan [Sun, 24 Jan 2021 04:17:31 +0000 (23:17 -0500)]
fmt

3 years agoMake bad shlex parsing a pretty error
Rune Tynan [Sun, 24 Jan 2021 04:03:01 +0000 (23:03 -0500)]
Make bad shlex parsing a pretty error

3 years agoAuto merge of #80594 - bjorn3:abi_refactor3, r=petrochenkov
bors [Sun, 24 Jan 2021 02:59:14 +0000 (02:59 +0000)]
Auto merge of #80594 - bjorn3:abi_refactor3, r=petrochenkov

Various ABI refactorings

This includes changes to the rust abi and various refactorings that will hopefully make it easier to use the abi handling infrastructure of rustc in cg_clif. There are several refactorings that I haven't done. I am opening this draft PR to check that I haven't broken any non x86_64 architectures.

r? `@ghost`

3 years agoReplace version_check dependency with own version parsing code
est31 [Fri, 22 Jan 2021 05:57:33 +0000 (06:57 +0100)]
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.

3 years agoAuto merge of #79811 - Aaron1011:expn-data-disambig, r=petrochenkov
bors [Sun, 24 Jan 2021 00:10:20 +0000 (00:10 +0000)]
Auto merge of #79811 - Aaron1011:expn-data-disambig, r=petrochenkov

Add disambiugator to ExpnData

I still need to write a bunch of comments. Opening to see how bad the perf impact is.

cc https://github.com/rust-lang/rust/issues/79560

3 years agoAuto merge of #81304 - jonas-schievink:rollup-d9kuugm, r=jonas-schievink
bors [Sat, 23 Jan 2021 21:13:14 +0000 (21:13 +0000)]
Auto merge of #81304 - jonas-schievink:rollup-d9kuugm, r=jonas-schievink

Rollup of 15 pull requests

Successful merges:

 - #79841 (More clear documentation for NonNull<T>)
 - #81072 (PlaceRef::ty: use method call syntax)
 - #81130 (Edit rustc_middle::dep_graph module documentation)
 - #81170 (Avoid hash_slice in VecDeque's Hash implementation)
 - #81243 (mir: Improve size_of handling when arg is unsized)
 - #81245 (Update cargo)
 - #81249 (Lower closure prototype after its body.)
 - #81252 (Add more self-profile info to rustc_resolve)
 - #81275 (Fix <unknown> queries and add more timing info to render_html)
 - #81281 (Inline methods of Path and OsString)
 - #81283 (Note library tracking issue template in tracking issue template.)
 - #81285 (Remove special casing of rustdoc in rustc_lint)
 - #81288 (rustdoc: Fix visibility of trait and impl items)
 - #81298 (replace RefCell with Cell in FnCtxt)
 - #81301 (Fix small typo)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

3 years agoFix rendering of stabilization version for trait implementors
LeSeulArtichaut [Sat, 23 Jan 2021 17:41:04 +0000 (18:41 +0100)]
Fix rendering of stabilization version for trait implementors

3 years agoAdd disambiugator to ExpnData
Aaron Hill [Mon, 7 Dec 2020 22:44:40 +0000 (17:44 -0500)]
Add disambiugator to ExpnData

Due to macro expansion, its possible to end up with two distinct
`ExpnId`s that have the same `ExpnData` contents. This violates the
contract of `HashStable`, since two unequal `ExpnId`s will end up with
equal `Fingerprint`s.

This commit adds a `disambiguator` field to `ExpnData`, which is used to
force two otherwise-equivalent `ExpnData`s to be distinct.

3 years agoRollup merge of #81301 - davidgu:patch-1, r=jonas-schievink
Jonas Schievink [Sat, 23 Jan 2021 19:16:19 +0000 (20:16 +0100)]
Rollup merge of #81301 - davidgu:patch-1, r=jonas-schievink

Fix small typo

Fractional part of `12.34e56` seems to be incorrectly stated as '45' and not '34'

3 years agoRollup merge of #81298 - lcnr:big-money-big-prices, r=oli-obk
Jonas Schievink [Sat, 23 Jan 2021 19:16:17 +0000 (20:16 +0100)]
Rollup merge of #81298 - lcnr:big-money-big-prices, r=oli-obk

replace RefCell with Cell in FnCtxt

small cleanup

3 years agoRollup merge of #81288 - camelid:fix-trait-item-vis, r=jyn514
Jonas Schievink [Sat, 23 Jan 2021 19:16:16 +0000 (20:16 +0100)]
Rollup merge of #81288 - camelid:fix-trait-item-vis, r=jyn514

rustdoc: Fix visibility of trait and impl items

Fixes #81274.

r? `@jyn514`

3 years agoRollup merge of #81283 - m-ou-se:tracking-issue-note, r=Mark-Simulacrum
Jonas Schievink [Sat, 23 Jan 2021 19:16:14 +0000 (20:16 +0100)]
Rollup merge of #81283 - m-ou-se:tracking-issue-note, r=Mark-Simulacrum

Note library tracking issue template in tracking issue template.

3 years agoRollup merge of #81281 - a1phyr:inline_path, r=dtolnay
Jonas Schievink [Sat, 23 Jan 2021 19:16:12 +0000 (20:16 +0100)]
Rollup merge of #81281 - a1phyr:inline_path, r=dtolnay

Inline methods of Path and OsString

These methods are not generic, and therefore aren't candidates for cross-crate inlining without an `#[inline]` attribute.

3 years agoRollup merge of #81275 - jyn514:time-render, r=wesleywiser
Jonas Schievink [Sat, 23 Jan 2021 19:16:10 +0000 (20:16 +0100)]
Rollup merge of #81275 - jyn514:time-render, r=wesleywiser

Fix <unknown> queries and add more timing info to render_html

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

##  Fix `<unknown>` queries

This happened because `alloc_query_strings` was never called.

##  Add more timing info to render_html

This still has some issues I'm not sure how to work out:

- `create_renderer` and `renderer_after_krate` aren't shown by default.
  I want something like `verbose_generic_activity_with_arg`, but it doesn't exist.

I'm also not sure how to show activities that aren't on by default - I
tried `-Z self-profile -Z self-profile-args=all`, but it didn't show up.

r? `@wesleywiser`

3 years agoRollup merge of #81252 - jyn514:resolve-timing, r=petrochenkov
Jonas Schievink [Sat, 23 Jan 2021 19:16:09 +0000 (20:16 +0100)]
Rollup merge of #81252 - jyn514:resolve-timing, r=petrochenkov

Add more self-profile info to rustc_resolve

The idea is to help me find out where the time is being spent in compiling the docs for `windows-rs`: https://github.com/microsoft/windows-rs/issues/420#issuecomment-764991646

3 years agoRollup merge of #81249 - cjgillot:issue-79537, r=oli-obk
Jonas Schievink [Sat, 23 Jan 2021 19:16:07 +0000 (20:16 +0100)]
Rollup merge of #81249 - cjgillot:issue-79537, r=oli-obk

Lower closure prototype after its body.

Fixes #79537.

r? `@Mark-Simulacrum`

3 years agoRollup merge of #81245 - ehuss:update-cargo, r=ehuss
Jonas Schievink [Sat, 23 Jan 2021 19:16:05 +0000 (20:16 +0100)]
Rollup merge of #81245 - ehuss:update-cargo, r=ehuss

Update cargo

5 commits in a73e5b7d567c3036b296fc6b33ed52c5edcd882e..783bc43c660bf39c1e562c8c429b32078ad3099b
2021-01-12 23:45:39 +0000 to 2021-01-20 19:02:26 +0000
- Fix some issues with `cargo doc` and the new feature resolver. (rust-lang/cargo#9077)
- Implement support for rust-version field in project metadata (rust-lang/cargo#8037)
- Fix a bug in Cargo's cyclic dep graph detection (rust-lang/cargo#9075)
- Typo correction: artifcats -&gt; artifacts (rust-lang/cargo#9081)
- Remove stray backtick from doc (rust-lang/cargo#9079)

3 years agoRollup merge of #81243 - osa1:fix_80742_2, r=RalfJung
Jonas Schievink [Sat, 23 Jan 2021 19:16:04 +0000 (20:16 +0100)]
Rollup merge of #81243 - osa1:fix_80742_2, r=RalfJung

mir: Improve size_of handling when arg is unsized

As discussed on Zulip with `@RalfJung.`

3 years agoRollup merge of #81170 - xfix:vecdeque-bug-fix, r=sfackler
Jonas Schievink [Sat, 23 Jan 2021 19:16:02 +0000 (20:16 +0100)]
Rollup merge of #81170 - xfix:vecdeque-bug-fix, r=sfackler

Avoid hash_slice in VecDeque's Hash implementation

Fixes #80303.

3 years agoRollup merge of #81130 - pierwill:edit-depnode, r=jyn514
Jonas Schievink [Sat, 23 Jan 2021 19:16:00 +0000 (20:16 +0100)]
Rollup merge of #81130 - pierwill:edit-depnode, r=jyn514

Edit rustc_middle::dep_graph module documentation

This is similar to work approved and then closed in https://github.com/rust-lang/rust/pull/80325 due to a bad rebase.

3 years agoRollup merge of #81072 - RalfJung:place-ref-ty, r=oli-obk
Jonas Schievink [Sat, 23 Jan 2021 19:15:59 +0000 (20:15 +0100)]
Rollup merge of #81072 - RalfJung:place-ref-ty, r=oli-obk

PlaceRef::ty: use method call syntax

3 years agoRollup merge of #79841 - fintelia:patch-6, r=kennytm
Jonas Schievink [Sat, 23 Jan 2021 19:15:54 +0000 (20:15 +0100)]
Rollup merge of #79841 - fintelia:patch-6, r=kennytm

More clear documentation for NonNull<T>

Rephrase and hopefully clarify the discussion of covariance in `NonNull<T>` documentation.

I'm very much not an expert so someone should definitely double check the correctness of what I'm saying. At the same time, the new language makes more sense to me, so hopefully it also is more logical to others whose knowledge of covariance basically begins and ends with the [Rustonomicon chapter](https://doc.rust-lang.org/nomicon/subtyping.html).

Related to #48929.

3 years agoAdd option to control doctest run directory
Arpad Borsos [Fri, 22 Jan 2021 09:54:53 +0000 (10:54 +0100)]
Add 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

3 years agoFix small typo
David [Sat, 23 Jan 2021 17:31:40 +0000 (12:31 -0500)]
Fix small typo

3 years agoCleanup `render_stability_since_raw` to remove code duplication
LeSeulArtichaut [Sat, 23 Jan 2021 17:05:59 +0000 (18:05 +0100)]
Cleanup `render_stability_since_raw` to remove code duplication

3 years agoFix review comments
bjorn3 [Sat, 23 Jan 2021 16:55:39 +0000 (17:55 +0100)]
Fix review comments

3 years agoCalculate self-profile strings in `Compiler::enter` instead in codegen
Joshua Nelson [Fri, 22 Jan 2021 18:46:52 +0000 (13:46 -0500)]
Calculate self-profile strings in `Compiler::enter` instead in codegen

This avoids each tool having to separately find and call
`self_profile_alloc_strings`.

- Don't compute the global context if it hasn't yet been computed

  This avoids giving extraneous errors about unresolved names if an error
  occurs during parsing.

3 years agoAdd more timing info to render_html
Joshua Nelson [Fri, 22 Jan 2021 15:38:30 +0000 (10:38 -0500)]
Add more timing info to render_html

- Show `create_renderer` and `renderer_after_crate` by default
- Don't rewrite `extra_verbose_generic_activity`

3 years agoAuto merge of #80579 - RalfJung:no-fallible-promotion, r=oli-obk
bors [Sat, 23 Jan 2021 13:19:04 +0000 (13:19 +0000)]
Auto merge of #80579 - RalfJung:no-fallible-promotion, r=oli-obk

avoid promoting division, modulo and indexing operations that could fail

For division, `x / y` will still be promoted if `y` is a non-zero integer literal; however, `1/(1+1)` will not be promoted any more.

While at it, also see if we can reject promoting floating-point arithmetic (which are [complicated](https://github.com/rust-lang/unsafe-code-guidelines/issues/237) so maybe we should not promote them).

This will need a crater run to see if there's code out there that relies on these things being promoted.

If we can land this, promoteds in `fn`/`const fn` cannot fail to evaluate any more, which should let us do some simplifications in codegen/Miri!

Cc https://github.com/rust-lang/rfcs/pull/3027
Fixes https://github.com/rust-lang/rust/issues/61821
r? `@oli-obk`

3 years agoAllow to query the HIR crate node.
Camille GILLOT [Mon, 18 Jan 2021 18:15:53 +0000 (19:15 +0100)]
Allow to query the HIR crate node.

3 years agoFix proc macro crate encoding.
Camille GILLOT [Sat, 16 Jan 2021 22:14:42 +0000 (23:14 +0100)]
Fix proc macro crate encoding.

3 years agoFilter stability.
Camille GILLOT [Sat, 16 Jan 2021 22:16:02 +0000 (23:16 +0100)]
Filter stability.

3 years agoIterate on deprecation.
Camille GILLOT [Sun, 6 Dec 2020 21:21:42 +0000 (22:21 +0100)]
Iterate on deprecation.

3 years agoIterate on const_stability.
Camille GILLOT [Sun, 6 Dec 2020 21:21:00 +0000 (22:21 +0100)]
Iterate on const_stability.

3 years agoIterate on stability.
Camille GILLOT [Sun, 6 Dec 2020 21:20:24 +0000 (22:20 +0100)]
Iterate on stability.

3 years agoIterate DefId to encode expn_that_defined.
Camille GILLOT [Sat, 28 Nov 2020 21:12:56 +0000 (22:12 +0100)]
Iterate DefId to encode expn_that_defined.

3 years agoIterate DefId to encode attributes.
Camille GILLOT [Sat, 28 Nov 2020 21:10:00 +0000 (22:10 +0100)]
Iterate DefId to encode attributes.

3 years agoIterate DefId to encode visibility.
Camille GILLOT [Sat, 28 Nov 2020 21:07:46 +0000 (22:07 +0100)]
Iterate DefId to encode visibility.

3 years agoIterate to encode def_kind.
Camille GILLOT [Sat, 16 Jan 2021 13:35:16 +0000 (14:35 +0100)]
Iterate to encode def_kind.

3 years agoIterate DefId to encode spans.
Camille GILLOT [Sat, 28 Nov 2020 21:07:00 +0000 (22:07 +0100)]
Iterate DefId to encode spans.

3 years agoEncode DefKind directly.
Camille GILLOT [Sun, 15 Nov 2020 17:02:00 +0000 (18:02 +0100)]
Encode DefKind directly.

3 years agoPut dynamic check tests into their own file
oli [Sat, 23 Jan 2021 12:35:45 +0000 (12:35 +0000)]
Put dynamic check tests into their own file

3 years agoInfallible version of def_span.
Camille GILLOT [Wed, 23 Dec 2020 09:32:00 +0000 (10:32 +0100)]
Infallible version of def_span.

3 years agoCover more cases in the test suite
oli [Sat, 23 Jan 2021 11:58:58 +0000 (11:58 +0000)]
Cover more cases in the test suite

3 years agoAdd some comments to PassMode
bjorn3 [Sat, 23 Jan 2021 11:57:35 +0000 (12:57 +0100)]
Add some comments to PassMode

3 years agoDo not allow arbitrary mutable references in `static mut`, just keep with the existin...
oli [Sat, 16 Jan 2021 18:06:12 +0000 (18:06 +0000)]
Do not allow arbitrary mutable references in `static mut`, just keep with the existing exceptions

3 years agoAdjust wording of a diagnostic
oli [Sat, 16 Jan 2021 18:05:51 +0000 (18:05 +0000)]
Adjust wording of a diagnostic

3 years agoFix a comment that only made sense in the context of a dataflow based mutability...
oli [Sat, 16 Jan 2021 17:31:22 +0000 (17:31 +0000)]
Fix a comment that only made sense in the context of a dataflow based mutability check

3 years agoRename tests to what their code actually does
oli [Sat, 16 Jan 2021 17:27:59 +0000 (17:27 +0000)]
Rename tests to what their code actually does

3 years agoPermit mutable references in all const contexts
oli [Sun, 3 Jan 2021 18:46:20 +0000 (18:46 +0000)]
Permit mutable references in all const contexts

3 years agoreplace RefCell with Cell in FnCtxt
Bastian Kauschke [Sat, 23 Jan 2021 10:47:38 +0000 (11:47 +0100)]
replace RefCell with Cell in FnCtxt

3 years agoDon't provide backend_optimization_level query for extern crates
bjorn3 [Sat, 23 Jan 2021 10:11:51 +0000 (11:11 +0100)]
Don't provide backend_optimization_level query for extern crates

3 years agoNever create an temporary PassMode::Direct when it is not a valid pass mode for a...
bjorn3 [Tue, 29 Dec 2020 19:00:57 +0000 (20:00 +0100)]
Never create an temporary PassMode::Direct when it is not a valid pass mode for a type

3 years agoMove some code around
bjorn3 [Mon, 28 Dec 2020 15:34:05 +0000 (16:34 +0100)]
Move some code around

3 years agoUse PassMode::Pair by default for Abi::ScalarPair for all abi's and in return position
bjorn3 [Sun, 27 Dec 2020 18:59:37 +0000 (19:59 +0100)]
Use PassMode::Pair by default for Abi::ScalarPair for all abi's and in return position

Abi::ScalarPair is only ever used for types that don't have a stable
layout anyway so this doesn't break any FFI. It does however reduce the
amount of special casing on the abi outside of the code responsible for
abi specific adjustments to the pass mode.

3 years agoRemove unused dependency
bjorn3 [Sun, 27 Dec 2020 17:41:19 +0000 (18:41 +0100)]
Remove unused dependency

3 years agoAuto merge of #80715 - JulianKnodt:skip_opt, r=nagisa
bors [Sat, 23 Jan 2021 09:25:11 +0000 (09:25 +0000)]
Auto merge of #80715 - JulianKnodt:skip_opt, r=nagisa

Change branching in `iter.skip()`

Optimize branching in `Skip`, which was brought up in #80416.
This assumes that if `next` is called, it's likely that there will be more calls to `next`, and the branch for skip will only be hit once thus it's unlikely to take that path. Even w/o the `unlikely` intrinsic, it compiles more efficiently, I believe because the path where `next` is called is always taken.

It should be noted there are very few places in the compiler where `Skip` is used, so probably won't have a noticeable perf impact.

[New impl](https://godbolt.org/z/85rdj4)
[Old impl](https://godbolt.org/z/Wc74rh)

[Some additional asm examples](https://godbolt.org/z/feKzoz) although they really don't have a ton of difference between them.

3 years agoAuto merge of #80065 - b-naber:parse-angle-arg-diagnostics, r=petrochenkov
bors [Sat, 23 Jan 2021 06:27:21 +0000 (06:27 +0000)]
Auto merge of #80065 - b-naber:parse-angle-arg-diagnostics, r=petrochenkov

Improve diagnostics when parsing angle args

https://github.com/rust-lang/rust/pull/79266 introduced parsing of generic arguments in associated type constraints, this however resulted in possibly very confusing error messages in cases in which closing angle brackets were missing such as in `Vec<(u32, _, _) = vec![]`, which outputs an incorrectly parsed equality constraint error, as noted by `@cynecx.`

This PR tries to provide better error messages in such cases.

r? `@petrochenkov`

3 years agoAuto merge of #76391 - danii:master, r=cuviper
bors [Sat, 23 Jan 2021 03:33:16 +0000 (03:33 +0000)]
Auto merge of #76391 - danii:master, r=cuviper

Split up core/test/iter.rs into multiple files

This PR removes the `// ignore-tidy-filelength` at the top of [iter.rs](https://github.com/rust-lang/rust/blob/04f44fb9232dc960d213d0df4a203c387215a5ff/library/core/tests/iter.rs) by splitting it into several sub files. I have split the file per test, based on what I felt the test was really trying to test.
Addresses issue #60302.
- [associated_util.rs](https://github.com/rust-lang/rust/blob/d29180a8ed2752c5dfa2bca1d28ca05dc9bf6bf1/library/core/tests/iter/associated_util.rs) - For testing the module level functions. (Maybe should be renamed?)
- [collection.rs](https://github.com/rust-lang/rust/blob/d29180a8ed2752c5dfa2bca1d28ca05dc9bf6bf1/library/core/tests/iter/collection.rs) - For testing methods that use the values of all the items in an iterator, and creates one value from them, whether it be a Vec of all the values, or a number that represents the sum.
- [mod.rs](https://github.com/rust-lang/rust/blob/d29180a8ed2752c5dfa2bca1d28ca05dc9bf6bf1/library/core/tests/iter/mod.rs) - For utility structs used in all tests, and other tests I didn't know where to place.
- [range.rs](https://github.com/rust-lang/rust/blob/d29180a8ed2752c5dfa2bca1d28ca05dc9bf6bf1/library/core/tests/iter/range.rs) - For testing ranges.
- [transformation.rs](https://github.com/rust-lang/rust/blob/d29180a8ed2752c5dfa2bca1d28ca05dc9bf6bf1/library/core/tests/iter/transformation.rs) - For testing methods that transform all the values in an iterator.
- [util.rs](https://github.com/rust-lang/rust/blob/d29180a8ed2752c5dfa2bca1d28ca05dc9bf6bf1/library/core/tests/iter/util.rs) - For testing methods that provide utility in more specific use cases.

"Programatically"
-----------------------
You may have noticed I "Programatically" split up the file. [This is how](https://gist.github.com/danii/a58b3bcafa9faf1c3e4b01ad7495baf4) I managed to do that. 😛 Hope that's fine.

3 years agorustdoc: Fix visibility of trait and impl items
Camelid [Fri, 22 Jan 2021 23:02:49 +0000 (15:02 -0800)]
rustdoc: Fix visibility of trait and impl items

3 years agoAuto merge of #81017 - Aaron1011:collect-trailing-token, r=petrochenkov
bors [Sat, 23 Jan 2021 00:42:37 +0000 (00:42 +0000)]
Auto merge of #81017 - Aaron1011:collect-trailing-token, r=petrochenkov

Refactor token collection to capture trailing token immediately

Split out from https://github.com/rust-lang/rust/pull/80689 - when we start capturing more information about attribute targets, we'll need to know in advance if we're capturing a trailing token or not.

r? `@ghost`

3 years agoFix <unknown> queries
Joshua Nelson [Fri, 22 Jan 2021 15:31:18 +0000 (10:31 -0500)]
Fix <unknown> queries

This happened because `alloc_query_strings` was never called.

3 years agoDo not mark unit variants as used when in path pattern
Tomasz Miąsko [Sat, 23 Jan 2021 00:00:00 +0000 (00:00 +0000)]
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.

3 years agoEdit rustc_middle::dep_graph module documentation
pierwill [Sun, 17 Jan 2021 19:16:17 +0000 (11:16 -0800)]
Edit rustc_middle::dep_graph module documentation

Co-authored-by: Joshua Nelson <joshua@yottadb.com>
Co-authored-by: Camelid <camelidcamel@gmail.com>
3 years agolibrary/core/tests/iter documentation and cleanup
Daniel Conley [Fri, 22 Jan 2021 22:39:17 +0000 (17:39 -0500)]
library/core/tests/iter documentation and cleanup

3 years agolibrary/core/tests/iter rearrange & add back missed doc comments
Daniel Conley [Fri, 22 Jan 2021 22:20:42 +0000 (17:20 -0500)]
library/core/tests/iter rearrange & add back missed doc comments

3 years agolibrary/core/test/iter add newlines between tests
Daniel Conley [Fri, 22 Jan 2021 21:58:21 +0000 (16:58 -0500)]
library/core/test/iter add newlines between tests

3 years agoAuto merge of #79233 - yoshuawuyts:alloc-doc-alias, r=GuillaumeGomez
bors [Fri, 22 Jan 2021 21:48:41 +0000 (21:48 +0000)]
Auto merge of #79233 - yoshuawuyts:alloc-doc-alias, r=GuillaumeGomez

Add doc aliases for memory allocations

This patch adds doc aliases for various C allocation functions, making it possible to search for the C-equivalent of a function and finding the (safe) Rust counterpart:

- `Vec::with_capacity` / `Box::new` / `vec!` -> alloc + malloc, allocates memory
- `Box::new_zeroed` -> calloc, allocates zeroed-out memory
- `Vec::{reserve,reserve_exact,try_reserve_exact,shrink_to_fit,shrink_to}` -> realloc, reallocates a previously allocated slice of memory

It's worth noting that `Vec::new` does not allocate, so we don't link to it. Instead people are probably looking for `Vec::with_capacity` or `vec!`. I hope this will allow people comfortable with the system allocation APIs to make it easier to find what they may be looking for.

Thanks!

3 years agoRemove special casing of rustdoc in rustc_lint
Joshua Nelson [Fri, 22 Jan 2021 19:50:21 +0000 (14:50 -0500)]
Remove special casing of rustdoc in rustc_lint

This is no longer necessary now that rustdoc doesn't run
everybody_loops.

3 years agoMore clear documentation for NonNull<T>
Jonathan Behrens [Tue, 8 Dec 2020 22:15:18 +0000 (17:15 -0500)]
More clear documentation for NonNull<T>

Rephrase and hopefully clarify the discussion of covariance in `NonNull<T>` documentation.

3 years agoAuto merge of #72160 - slo1:libstd-setgroups, r=KodrAus
bors [Fri, 22 Jan 2021 19:00:11 +0000 (19:00 +0000)]
Auto merge of #72160 - slo1:libstd-setgroups, r=KodrAus

Add setgroups to std::os::unix::process::CommandExt

Should fix #38527. I'm not sure groups is the greatest name though.

3 years agoNote library tracking issue template in tracking issue template.
Mara Bos [Fri, 22 Jan 2021 18:41:20 +0000 (19:41 +0100)]
Note library tracking issue template in tracking issue template.

3 years agoFix formatting
Dániel Buga [Fri, 22 Jan 2021 17:55:37 +0000 (18:55 +0100)]
Fix formatting

3 years agoInline methods of Path and OsString
Benoît du Garreau [Fri, 22 Jan 2021 17:46:00 +0000 (18:46 +0100)]
Inline methods of Path and OsString

3 years agoOnly query associated_items once
Dániel Buga [Fri, 22 Jan 2021 17:19:27 +0000 (18:19 +0100)]
Only query associated_items once