]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoRollup merge of #83803 - surechen:add_target_feature, r=petrochenkov
Yuki Okushi [Sat, 3 Apr 2021 15:19:39 +0000 (00:19 +0900)]
Rollup merge of #83803 - surechen:add_target_feature, r=petrochenkov

add fp-armv8 for ARM_ALLOWED_FEATURES

For fixing err in https://github.com/rust-lang/stdarch/pull/1105.

3 years agoRollup merge of #83787 - digama0:patch-1, r=bjorn3
Yuki Okushi [Sat, 3 Apr 2021 15:19:38 +0000 (00:19 +0900)]
Rollup merge of #83787 - digama0:patch-1, r=bjorn3

Monomorphization doc fix

Only public items are monomorphization roots. This can be confirmed by noting that this program compiles:
```rust
fn foo<T>() { if true { foo::<Option<T>>() } }
fn bar() { foo::<()>() }
```
See also the [zulip thread](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Why.20are.20non.20public.20items.20monomorphization.20roots.3F).

3 years agoRollup merge of #83780 - matklad:doc-error-message, r=JohnTitor
Yuki Okushi [Sat, 3 Apr 2021 15:19:37 +0000 (00:19 +0900)]
Rollup merge of #83780 - matklad:doc-error-message, r=JohnTitor

Document "standard" conventions for error messages

These are currently documented in the API guidelines:

https://rust-lang.github.io/api-guidelines/interoperability.html#error-types-are-meaningful-and-well-behaved-c-good-err

I think it makes sense to uplift this guideline (in a milder form) into
std docs. Printing and producing errors is something that even
non-expert users do frequently, so it is useful to give at least some
indication of what a typical error message looks like.

3 years agoRollup merge of #83756 - camelid:internal-rename-doc-spotlight, r=GuillaumeGomez
Yuki Okushi [Sat, 3 Apr 2021 15:19:36 +0000 (00:19 +0900)]
Rollup merge of #83756 - camelid:internal-rename-doc-spotlight, r=GuillaumeGomez

rustdoc: Rename internal uses of `spotlight`

I didn't make these renames in #80965 because I didn't want the PR to
conflict with #80914.

3 years agoRollup merge of #82487 - CDirkx:const-socketaddr, r=m-ou-se
Yuki Okushi [Sat, 3 Apr 2021 15:19:30 +0000 (00:19 +0900)]
Rollup merge of #82487 - CDirkx:const-socketaddr, r=m-ou-se

Constify methods of `std::net::SocketAddr`, `SocketAddrV4` and `SocketAddrV6`

The following methods are made unstable const under the `const_socketaddr` feature (https://github.com/rust-lang/rust/issues/82485):

```rust
// std::net

impl SocketAddr {
    pub const fn ip(&self) -> IpAddr;
    pub const fn port(&self) -> u16;
    pub const fn is_ipv4(&self) -> bool;
    pub const fn is_ipv6(&self) -> bool;
}

impl SocketAddrV4 {
    pub const fn ip(&self) -> IpAddr;
    pub const fn port(&self) -> u16;
}

impl SocketAddrV6 {
    pub const fn ip(&self) -> IpAddr;
    pub const fn port(&self) -> u16;
    pub const fn flowinfo(&self) -> u32;
    pub const fn scope_id(&self) -> u32;
}
```

Note: `SocketAddrV4::ip` and `SocketAddrV6::ip` use pointer casting and depend on the unstable feature `const_raw_ptr_deref`

3 years agoAuto merge of #83738 - jyn514:only-load-some-crates, r=petrochenkov
bors [Sat, 3 Apr 2021 10:59:24 +0000 (10:59 +0000)]
Auto merge of #83738 - jyn514:only-load-some-crates, r=petrochenkov

rustdoc: Don't load all extern crates unconditionally

Instead, only load the crates that are linked to with intra-doc links.

This doesn't help very much with any of rustdoc's fundamental issues
with freezing the resolver, but it at least fixes a stable-to-stable
regression, and makes the crate loading model somewhat more consistent
with rustc's. I tested and it unfortunately does not help at all with https://github.com/rust-lang/rust/pull/82496.

Closes https://github.com/rust-lang/rust/issues/68427. Let me know if you want me to open a separate issue for not freezing the resolver.
r? `@petrochenkov` cc `@eddyb` `@ollie27`

3 years agoAuto merge of #83549 - sjakobi:no-tidy-line-length-1, r=Mark-Simulacrum
bors [Sat, 3 Apr 2021 08:46:03 +0000 (08:46 +0000)]
Auto merge of #83549 - sjakobi:no-tidy-line-length-1, r=Mark-Simulacrum

tidy: Add ignore-rules for the line length check

This is step 1 towards fixing https://github.com/rust-lang/rust/issues/77548.

This PR contains the `tidy` change from https://github.com/rust-lang/rust/pull/77675. The "ignoring file length unnecessarily" check is temporarily disabled to simplify landing the ignore-rules. This check will be re-enabled in a follow-up PR.

3 years agoadd fp-armv8 for ARM_ALLOWED_FEATURES
surechen [Sat, 3 Apr 2021 07:50:59 +0000 (15:50 +0800)]
add fp-armv8 for ARM_ALLOWED_FEATURES

3 years agotidy: Add ignore-rules for the line length check
Anthony Huang [Thu, 15 Oct 2020 04:29:47 +0000 (21:29 -0700)]
tidy: Add ignore-rules for the line length check

This is step 1 towards fixing #77548.

This commit includes the tidy change from #77675.
The "ignoring file length unnecessarily" check is temporarily
disabled to simplify landing the ignore-rules.
That check will be re-enabled in a follow-up PR.

3 years agoAuto merge of #83774 - richkadel:zero-based-counters, r=tmandry
bors [Sat, 3 Apr 2021 06:27:03 +0000 (06:27 +0000)]
Auto merge of #83774 - richkadel:zero-based-counters, r=tmandry

Translate counters from Rust 1-based to LLVM 0-based counter ids

A colleague contacted me and asked why Rust's counters start at 1, when
Clangs appear to start at 0. There is a reason why Rust's internal
counters start at 1 (see the docs), and I tried to keep them consistent
when codegenned to LLVM's coverage mapping format. LLVM should be
tolerant of missing counters, but as my colleague pointed out,
`llvm-cov` will silently fail to generate a coverage report for a
function based on LLVM's assumption that the counters are 0-based.

See:
https://github.com/llvm/llvm-project/blob/main/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp#L170

Apparently, if, for example, a function has no branches, it would have
exactly 1 counter. `CounterValues.size()` would be 1, and (with the
1-based index), the counter ID would be 1. This would fail the check
and abort reporting coverage for the function.

It turns out that by correcting for this during coverage map generation,
by subtracting 1 from the Rust Counter ID (both when generating the
counter increment intrinsic call, and when adding counters to the map),
some uncovered functions (including in tests) now appear covered! This
corrects the coverage for a few tests!

r? `@tmandry`
FYI: `@wesleywiser`

3 years agoAuto merge of #83599 - jyn514:unorderable, r=Aaron1011
bors [Sat, 3 Apr 2021 04:11:35 +0000 (04:11 +0000)]
Auto merge of #83599 - jyn514:unorderable, r=Aaron1011

Avoid sorting by DefId for `necessary_variants()`

Follow-up to https://github.com/rust-lang/rust/pull/83074. Originally I tried removing `impl Ord for DefId` but that hit *lots* of errors :sweat_smile: so I thought I would start with easy things.

I am not sure whether this could actually cause invalid query results, but this is used from `MarkSymbolVisitor::visit_arm` so it's at least feasible.

r? `@Aaron1011`

3 years agoAuto merge of #83506 - asomers:backtrace-0.3.56, r=Mark-Simulacrum
bors [Sat, 3 Apr 2021 01:52:36 +0000 (01:52 +0000)]
Auto merge of #83506 - asomers:backtrace-0.3.56, r=Mark-Simulacrum

Update backtrace to 0.3.56

Fixes #78184

3 years agoTranslate counters from Rust 1-based to LLVM 0-based counter ids
Rich Kadel [Fri, 2 Apr 2021 07:08:48 +0000 (00:08 -0700)]
Translate counters from Rust 1-based to LLVM 0-based counter ids

A colleague contacted me and asked why Rust's counters start at 1, when
Clangs appear to start at 0. There is a reason why Rust's internal
counters start at 1 (see the docs), and I tried to keep them consistent
when codegenned to LLVM's coverage mapping format. LLVM should be
tolerant of missing counters, but as my colleague pointed out,
`llvm-cov` will silently fail to generate a coverage report for a
function based on LLVM's assumption that the counters are 0-based.

See:
https://github.com/llvm/llvm-project/blob/main/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp#L170

Apparently, if, for example, a function has no branches, it would have
exactly 1 counter. `CounterValues.size()` would be 1, and (with the
1-based index), the counter ID would be 1. This would fail the check
and abort reporting coverage for the function.

It turns out that by correcting for this during coverage map generation,
by subtracting 1 from the Rust Counter ID (both when generating the
counter increment intrinsic call, and when adding counters to the map),
some uncovered functions (including in tests) now appear covered! This
corrects the coverage for a few tests!

3 years agoAuto merge of #81866 - nagisa:nagisa/sanitizer-support-target-prop, r=tmiasko
bors [Fri, 2 Apr 2021 23:33:01 +0000 (23:33 +0000)]
Auto merge of #81866 - nagisa:nagisa/sanitizer-support-target-prop, r=tmiasko

Maintain supported sanitizers as a target property

In an effort to remove a hard-coded allow-list for target-sanitizer support correspondence, this PR moves the configuration to the target options.

Perhaps the one notable change made in this PR is this doc-comment:

```rust
    /// The sanitizers supported by this target
    ///
    /// Note that the support here is at a codegen level. If the machine code with sanitizer
    /// enabled can generated on this target, but the necessary supporting libraries are not
    /// distributed with the target, the sanitizer should still appear in this list for the target.
```

Previously the target would typically be added to the allow-list at the same time as the supporting runtime libraries are shipped for the target. However whether we ship the runtime libraries or not needn't be baked into the compiler; and if we don't users will receive a significantly more directed error about library not being found.

Fixes #81802

3 years agorm target specific logic in link_sanitizer_runtime
Simonas Kazlauskas [Mon, 15 Feb 2021 01:17:50 +0000 (03:17 +0200)]
rm target specific logic in link_sanitizer_runtime

3 years ago(De-)serialize the supported_sanitizers
Simonas Kazlauskas [Sat, 13 Feb 2021 20:00:07 +0000 (22:00 +0200)]
(De-)serialize the supported_sanitizers

3 years agoMaintain supported sanitizers as a target property
Simonas Kazlauskas [Sun, 7 Feb 2021 22:49:00 +0000 (00:49 +0200)]
Maintain supported sanitizers as a target property

This commit adds an additional target property – `supported_sanitizers`,
and replaces the hardcoded allowlists in argument parsing to use this
new property.

Fixes #81802

3 years agoMove SanitizerSet to rustc_target
Simonas Kazlauskas [Sun, 7 Feb 2021 21:47:03 +0000 (23:47 +0200)]
Move SanitizerSet to rustc_target

3 years agoDon't load all extern crates unconditionally
Joshua Nelson [Thu, 1 Apr 2021 02:33:07 +0000 (22:33 -0400)]
Don't load all extern crates unconditionally

Instead, only load the crates that are linked to with intra-doc links.

This doesn't help very much with any of rustdoc's fundamental issues
with freezing the resolver, but it at least fixes a stable-to-stable
regression, and makes the crate loading model somewhat more consistent
with rustc's.

3 years agoAuto merge of #83790 - Dylan-DPC:rollup-p6ep8jo, r=Dylan-DPC
bors [Fri, 2 Apr 2021 20:06:11 +0000 (20:06 +0000)]
Auto merge of #83790 - Dylan-DPC:rollup-p6ep8jo, r=Dylan-DPC

Rollup of 7 pull requests

Successful merges:

 - #83065 (Rework `std::sys::windows::alloc`)
 - #83478 (rustdoc: Add unstable option to only emit shared/crate-specific files)
 - #83629 (Fix double-drop in `Vec::from_iter(vec.into_iter())` specialization when items drop during panic)
 - #83673 (give full path of constraint in suggest_constraining_type_param)
 - #83755 (Simplify coverage tests)
 - #83757 (2229: Support migration via rustfix)
 - #83771 (Fix stack overflow detection on FreeBSD 11.1+)

Failed merges:

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

3 years agorustdoc: Remove unused `spotlight` CSS
Camelid [Thu, 1 Apr 2021 20:31:55 +0000 (13:31 -0700)]
rustdoc: Remove unused `spotlight` CSS

I couldn't find any uses of this CSS. I think it was superseded by the
`.notable-traits` CSS class and other similarly-named CSS classes.

3 years agorustdoc: Rename internal uses of `spotlight`
Camelid [Thu, 1 Apr 2021 20:26:29 +0000 (13:26 -0700)]
rustdoc: Rename internal uses of `spotlight`

I didn't make these renames in #80965 because I didn't want the PR to
conflict with #80914.

3 years agoRollup merge of #83771 - asomers:stack_overflow_freebsd, r=dtolnay
Dylan DPC [Fri, 2 Apr 2021 17:57:35 +0000 (19:57 +0200)]
Rollup merge of #83771 - asomers:stack_overflow_freebsd, r=dtolnay

Fix stack overflow detection on FreeBSD 11.1+

Beginning with FreeBSD 10.4 and 11.1, there is one guard page by
default.  And the stack autoresizes, so if Rust allocates its own guard
page, then FreeBSD's will simply move up one page.  The best solution is
to just use the OS's guard page.

3 years agoRollup merge of #83757 - sexxi-goose:migrations_out, r=nikomatsakis
Dylan DPC [Fri, 2 Apr 2021 17:57:34 +0000 (19:57 +0200)]
Rollup merge of #83757 - sexxi-goose:migrations_out, r=nikomatsakis

2229: Support migration via rustfix

- Adds support of machine applicable suggestions for `disjoint_capture_drop_reorder`.
- Doesn't migrate in the case of pre-existing bugs in user code

r? ``@nikomatsakis``

3 years agoRollup merge of #83755 - richkadel:cov-test-simplify, r=tmandry
Dylan DPC [Fri, 2 Apr 2021 17:57:33 +0000 (19:57 +0200)]
Rollup merge of #83755 - richkadel:cov-test-simplify, r=tmandry

Simplify coverage tests

This change reduces the risk of impacting coverage tests on unrelated
changes (such as MIR and Span changes), and reduces the burden when
blessing coverage changes in case it is necessary.

* Remove all spanview tests. The spanview tests were useful during
  development, but they can be generated as needed, via compiler command
  line flags. They aren't critical to confirming coverage results. (The
  coverage report tests are sufficient.)

  When spanview regeneration was necessary, the diffs were way too hard
  to read to be useful anyway. So I'm removing them to reduce friction
  from a feature that is no longer useful.

* Remove the requirement for `llvm-cov show --debug` when blessing
  tests. The `--debug` flag is, unfortunately, only available if LLVM is
  built with `optimize = false` (in Rust's config.toml). This adds
  significant time and resource burdens to the contributor's build. As
  it turns out, for other reasons in the past, I wasn't actually using
  the debug output (counter info) to validate coverage anymore either,
  so it was required for no reason, I now realize.

3 years agoRollup merge of #83673 - hi-rustin:rustin-patch-suggestion, r=estebank
Dylan DPC [Fri, 2 Apr 2021 17:57:32 +0000 (19:57 +0200)]
Rollup merge of #83673 - hi-rustin:rustin-patch-suggestion, r=estebank

give full path of constraint in suggest_constraining_type_param

close https://github.com/rust-lang/rust/issues/83513

3 years agoRollup merge of #83629 - the8472:fix-inplace-panic-on-drop, r=m-ou-se
Dylan DPC [Fri, 2 Apr 2021 17:57:31 +0000 (19:57 +0200)]
Rollup merge of #83629 - the8472:fix-inplace-panic-on-drop, r=m-ou-se

Fix double-drop in `Vec::from_iter(vec.into_iter())` specialization when items drop during panic

This fixes the double-drop but it leaves a behavioral difference compared to the default implementation intact: In the default implementation the source and the destination vec are separate objects, so they get dropped separately. Here they share an allocation and the latter only exists as a pointer into the former. So if dropping the former panics then this fix will leak more items than the default implementation would. Is this acceptable or should the specialization also mimic the default implementation's drops-during-panic behavior?

Fixes #83618

`@rustbot` label T-libs-impl

3 years agoRollup merge of #83478 - jyn514:fine-grained-files, r=Mark-Simulacrum
Dylan DPC [Fri, 2 Apr 2021 17:57:30 +0000 (19:57 +0200)]
Rollup merge of #83478 - jyn514:fine-grained-files, r=Mark-Simulacrum

rustdoc: Add unstable option to only emit shared/crate-specific files

The intended use case is for docs.rs, which can now copy exactly the
files it cares about, rather than having to guess based on whether they
have a resource suffix or not. In particular, some files have a resource
suffix but cannot be shared between crates: https://github.com/rust-lang/docs.rs/pull/1312#issuecomment-798783688

The end goal is to fix rust-lang/docs.rs#1327 by reverting rust-lang/docs.rs#1324.

This obsoletes `--print=unversioned-files`, which I plan to remove as
soon as docs.rs stops using it.

I recommend reviewing this one commit at a time.

r? ``@GuillaumeGomez`` cc ``@Nemo157`` ``@pietroalbini``

3 years agoRollup merge of #83065 - CDirkx:win-alloc, r=dtolnay
Dylan DPC [Fri, 2 Apr 2021 17:57:28 +0000 (19:57 +0200)]
Rollup merge of #83065 - CDirkx:win-alloc, r=dtolnay

Rework `std::sys::windows::alloc`

I came across https://github.com/rust-lang/rust/pull/76676#discussion_r488729990, which points out that there was unsound code in the Windows alloc code, creating a &mut to possibly uninitialized memory. I reworked the code so that that particular issue does not occur anymore, and started adding more documentation and safety comments.

Full list of changes:
 - moved and documented the relevant Windows Heap API functions
 - refactor `allocate_with_flags` to `allocate` (and remove the other helper functions), which now takes just a `bool` if the memory should be zeroed
 - add checks for if `GetProcessHeap` returned null
 - add a test that checks if the size and alignment of a `Header` are indeed <= `MIN_ALIGN`
 - add `#![deny(unsafe_op_in_unsafe_fn)]` and the necessary unsafe blocks with safety comments

I feel like I may have overdone the documenting, the unsoundness fix is the most important part; I could spit this PR up in separate parts.

3 years agoAuto merge of #76881 - hameerabbasi:issue-53325, r=oli-obk
bors [Fri, 2 Apr 2021 17:38:57 +0000 (17:38 +0000)]
Auto merge of #76881 - hameerabbasi:issue-53325, r=oli-obk

Add allocation information to undefined behaviour errors.

So far I'm looking on information on whether the error messages are suitable.

Fixes #53325.

3 years agofix
Mario Carneiro [Fri, 2 Apr 2021 17:21:23 +0000 (10:21 -0700)]
fix

3 years agoclarify wording
Mario Carneiro [Fri, 2 Apr 2021 16:55:23 +0000 (09:55 -0700)]
clarify wording

3 years agoMonomorphization doc fix
Mario Carneiro [Fri, 2 Apr 2021 16:33:34 +0000 (09:33 -0700)]
Monomorphization doc fix

Only public items are monomorphization roots. This can be confirmed by noting that this program compiles:
```rust
fn foo<T>() { if true { foo::<Option<T>>() } }
fn bar() { foo::<()>() }
```

3 years agoRemove `debug_assert`
Christiaan Dirkx [Fri, 2 Apr 2021 15:50:23 +0000 (17:50 +0200)]
Remove `debug_assert`

3 years agoIntroduce `get_process_heap` and fix atomic ordering.
Christiaan Dirkx [Fri, 2 Apr 2021 15:37:52 +0000 (17:37 +0200)]
Introduce `get_process_heap` and fix atomic ordering.

3 years agoAuto merge of #83468 - hi-rustin:rustin-patch-lint, r=nikomatsakis
bors [Fri, 2 Apr 2021 15:14:48 +0000 (15:14 +0000)]
Auto merge of #83468 - hi-rustin:rustin-patch-lint, r=nikomatsakis

add OR_PATTERNS_BACK_COMPAT lint

close https://github.com/rust-lang/rust/issues/83318

3 years agoAuto merge of #83781 - JohnTitor:rollup-1vm3dxo, r=JohnTitor
bors [Fri, 2 Apr 2021 12:51:41 +0000 (12:51 +0000)]
Auto merge of #83781 - JohnTitor:rollup-1vm3dxo, r=JohnTitor

Rollup of 5 pull requests

Successful merges:

 - #83535 (Break when there is a mismatch in the type count)
 - #83721 (Add a button to copy the "use statement")
 - #83740 (Fix comment typo in once.rs)
 - #83745 (Add my new email address to .mailmap)
 - #83754 (Add test to ensure search tabs behaviour)

Failed merges:

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

3 years agoRollup merge of #83754 - GuillaumeGomez:search-tab-behaviour, r=jyn514
Yuki Okushi [Fri, 2 Apr 2021 12:28:25 +0000 (21:28 +0900)]
Rollup merge of #83754 - GuillaumeGomez:search-tab-behaviour, r=jyn514

Add test to ensure search tabs behaviour

It adds a GUI test for https://github.com/rust-lang/rust/pull/80382.

r? ```@jyn514```

3 years agoRollup merge of #83745 - JohnTitor:jtitor-mailmap, r=Mark-Simulacrum
Yuki Okushi [Fri, 2 Apr 2021 12:28:24 +0000 (21:28 +0900)]
Rollup merge of #83745 - JohnTitor:jtitor-mailmap, r=Mark-Simulacrum

Add my new email address to .mailmap

3 years agoRollup merge of #83740 - obi1kenobi:patch-1, r=joshtriplett
Yuki Okushi [Fri, 2 Apr 2021 12:28:23 +0000 (21:28 +0900)]
Rollup merge of #83740 - obi1kenobi:patch-1, r=joshtriplett

Fix comment typo in once.rs

I believe I came across a minor typo in a comment. I am not particularly familiar with this part of the codebase, but I have read the surrounding code as well as the referenced `park` and `unpark` functions, and I believe my proposed change is true to the intended meaning of the comment.

I intentionally tried to keep the change as minimal as possible. If I have the maintainers' permission, I'd also love to add a comma to improve readability as follows: `Luckily ``park`` comes with the guarantee that if it got an ``unpark`` just before on an unparked thread, it does not park.`

3 years agoRollup merge of #83721 - GuillaumeGomez:copy-use, r=Nemo157
Yuki Okushi [Fri, 2 Apr 2021 12:28:21 +0000 (21:28 +0900)]
Rollup merge of #83721 - GuillaumeGomez:copy-use, r=Nemo157

Add a button to copy the "use statement"

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

When clicking on the button, it'll add the elements prepended by "use " and will end with a ";". So in the images below, I now have in my clipboard `use std::fs::OpenOptions;`.

A screenshot of the newly added button:

![Screenshot from 2021-03-31 22-12-12](https://user-images.githubusercontent.com/3050060/113205430-90e64500-926e-11eb-8538-529829f611ec.png)

A screenshot after it was clicked:

![Screenshot from 2021-03-31 22-15-31](https://user-images.githubusercontent.com/3050060/113205532-ad827d00-926e-11eb-893d-35f2f8f92696.png)

r? `@Nemo157`

3 years agoRollup merge of #83535 - MidasLamb:mir-type-count-mismatch, r=nikomatsakis
Yuki Okushi [Fri, 2 Apr 2021 12:28:20 +0000 (21:28 +0900)]
Rollup merge of #83535 - MidasLamb:mir-type-count-mismatch, r=nikomatsakis

Break when there is a mismatch in the type count

When other errors are generated, there can be a mismatch between the
amount of input types in MIR, and the amount in the function itself.
Break from the comparative loop if this is the case to prevent
out-of-bounds.
Fixes #83499

3 years agoDocument "standard" conventions for error messages
Aleksey Kladov [Fri, 2 Apr 2021 12:11:49 +0000 (15:11 +0300)]
Document "standard" conventions for error messages

These are currently documented in the API guidelines:

https://rust-lang.github.io/api-guidelines/interoperability.html#error-types-are-meaningful-and-well-behaved-c-good-err

I think it makes sense to uplift this guideline (in a milder form) into
std docs. Printing and producing errors is something that even
non-expert users do frequently, so it is useful to give at least some
indication of what a typical error message looks like.

3 years agoAuto merge of #83207 - oli-obk:valtree2, r=lcnr
bors [Fri, 2 Apr 2021 10:28:12 +0000 (10:28 +0000)]
Auto merge of #83207 - oli-obk:valtree2, r=lcnr

normalize mir::Constant differently from ty::Const in preparation for valtrees

Valtrees are unable to represent many kind of constant values (this is on purpose). For constants that are used at runtime, we do not need a valtree representation and can thus use a different form of evaluation. In order to make this explicit and less fragile, I added a `fold_constant` method to `TypeFolder` and implemented it for normalization. Normalization can now, when it wants to eagerly evaluate a constant, normalize `mir::Constant` directly into a `mir::ConstantKind::Val` instead of relying on the `ty::Const` evaluation.

In the future we can get rid of the `ty::Const` in there entirely and add our own `Unevaluated` variant to `mir::ConstantKind`. This would allow us to remove the `promoted` field from `ty::ConstKind::Unevaluated`, as promoteds can never occur in the type system.

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

r? `@lcnr`

3 years agoSimplify coverage tests
Rich Kadel [Thu, 1 Apr 2021 19:25:45 +0000 (12:25 -0700)]
Simplify coverage tests

This change reduces the risk of impacting coverage tests on unrelated
changes (such as MIR and Span changes), and reduces the burden when
blessing coverage changes in case it is necessary.

* Remove all spanview tests. The spanview tests were useful during
  development, but they can be generated as needed, via compiler command
  line flags. They aren't critical to confirming coverage results. (The
  coverage report tests are sufficient.)

  When spanview regeneration was necessary, the diffs were way too hard
  to read to be useful anyway. So I'm removing them to reduce friction
  from a feature that is no longer useful.

* Remove the requirement for `llvm-cov show --debug` when blessing
  tests. The `--debug` flag is, unfortunately, only available if LLVM is
  built with `optimize = false` (in Rust's config.toml). This adds
  significant time and resource burdens to the contributor's build. As
  it turns out, for other reasons in the past, I wasn't actually using
  the debug output (counter info) to validate coverage anymore either,
  so it was required for no reason, I now realize.

3 years agoAuto merge of #80965 - camelid:rename-doc-spotlight, r=jyn514
bors [Fri, 2 Apr 2021 07:04:58 +0000 (07:04 +0000)]
Auto merge of #80965 - camelid:rename-doc-spotlight, r=jyn514

Rename `#[doc(spotlight)]` to `#[doc(notable_trait)]`

Fixes #80936.

"spotlight" is not a very specific or self-explaining name.
Additionally, the dialog that it triggers is called "Notable traits".
So, "notable trait" is a better name.

* Rename `#[doc(spotlight)]` to `#[doc(notable_trait)]`
* Rename `#![feature(doc_spotlight)]` to `#![feature(doc_notable_trait)]`
* Update documentation
* Improve documentation

r? `@Manishearth`

3 years agoFix stack overflow detection on FreeBSD 11.1+
Alan Somers [Sat, 27 Mar 2021 17:12:38 +0000 (11:12 -0600)]
Fix stack overflow detection on FreeBSD 11.1+

Beginning with FreeBSD 10.4 and 11.1, there is one guard page by
default.  And the stack autoresizes, so if Rust allocates its own guard
page, then FreeBSD's will simply move up one page.  The best solution is
to just use the OS's guard page.

3 years agoAuto merge of #80828 - SNCPlay42:opaque-projections, r=estebank
bors [Fri, 2 Apr 2021 03:39:32 +0000 (03:39 +0000)]
Auto merge of #80828 - SNCPlay42:opaque-projections, r=estebank

Fix expected/found order on impl trait projection mismatch error

fixes #68561

This PR adds a new `ObligationCauseCode` used when checking the concrete type of an impl trait satisfies its bounds, and checks for that cause code in the existing test to see if a projection's normalized type should be the "expected" or "found" type.

The second commit adds a `peel_derives` to that test, which appears to be necessary in some cases (see projection-mismatch-in-impl-where-clause.rs, which would still give expected/found in the wrong order otherwise). This caused some other changes in diagnostics not involving impl trait, but they look correct to me.

3 years agoMake the diagnostic message more readable
Aman Arora [Fri, 2 Apr 2021 01:33:11 +0000 (21:33 -0400)]
Make the diagnostic message more readable

3 years agoDon't introduce a block if a block exists
Aman Arora [Fri, 2 Apr 2021 01:08:04 +0000 (21:08 -0400)]
Don't introduce a block if a block exists

3 years agoAuto merge of #83663 - AngelicosPhosphoros:simplify_binary_and_to_get_better_asm...
bors [Fri, 2 Apr 2021 00:48:31 +0000 (00:48 +0000)]
Auto merge of #83663 - AngelicosPhosphoros:simplify_binary_and_to_get_better_asm, r=nagisa

Simplify logical operations CFG

This is basically same commit as e38e954a0d249f88d0a55504f70d6055e865a931 which was reverted later in 676953fde9120cda62e4ef2f75a804af7481d6af
In both cases, this changes weren't benchmarked.
e38e954a0d249f88d0a55504f70d6055e865a931 leads to missed optimization described in [this issue](https://github.com/rust-lang/rust/issues/62993)
676953fde9120cda62e4ef2f75a804af7481d6af leads to missed optimization described in [this issue](https://github.com/rust-lang/rust/issues/83623)

3 years agoaddress comments
hi-rustin [Fri, 2 Apr 2021 00:08:02 +0000 (08:08 +0800)]
address comments

3 years agoUpdate test cases
Aman Arora [Thu, 1 Apr 2021 20:32:25 +0000 (16:32 -0400)]
Update test cases

3 years agoUpdate lint message
Aman Arora [Thu, 1 Apr 2021 20:49:05 +0000 (16:49 -0400)]
Update lint message

3 years agoAdd test to ensure search tabs behaviour
Guillaume Gomez [Thu, 1 Apr 2021 19:55:06 +0000 (21:55 +0200)]
Add test to ensure search tabs behaviour

3 years agoAdd a test that triggers the out-of-bounds ICE.
Midas Lambrichts [Thu, 1 Apr 2021 18:54:57 +0000 (20:54 +0200)]
Add a test that triggers the out-of-bounds ICE.

Add a test that has the right input to trigger an out-of-bounds
error when in MIR the local_decls and the normalized_input_tys don't
match in amount.

3 years agoAuto merge of #82780 - cjgillot:dep-stream, r=michaelwoerister
bors [Thu, 1 Apr 2021 16:29:33 +0000 (16:29 +0000)]
Auto merge of #82780 - cjgillot:dep-stream, r=michaelwoerister

Stream the dep-graph to a file instead of storing it in-memory.

This is a reimplementation of #60035.

Instead of storing the dep-graph in-memory, the nodes are encoded as they come
into the a temporary file as they come. At the end of a successful the compilation,
this file is renamed to be the persistent dep-graph, to be decoded during the next
compilation session.

This two-files scheme avoids overwriting the dep-graph on unsuccessful or crashing compilations.

The structure of the file is modified to be the sequence of `(DepNode, Fingerprint, EdgesVec)`.
The deserialization is responsible for going to the more compressed representation.
The `node_count` and `edge_count` are stored in the last 16 bytes of the file,
in order to accurately reserve capacity for the vectors.

At the end of the compilation, the encoder is flushed and dropped.
The graph is not usable after this point: any creation of a node will ICE.

I had to retrofit the debugging options, which is not really pretty.

3 years agoSimplify logical operations CFG
AngelicosPhosphoros [Mon, 29 Mar 2021 21:19:10 +0000 (00:19 +0300)]
Simplify logical operations CFG

This is basically same commit as e38e954a0d249f88d0a55504f70d6055e865a931 which was reverted later in 676953fde9120cda62e4ef2f75a804af7481d6af
In both cases, this changes weren't benchmarked.
e38e954a0d249f88d0a55504f70d6055e865a931 leads to missed optimization described in [this issue](https://github.com/rust-lang/rust/issues/62993)
676953fde9120cda62e4ef2f75a804af7481d6af leads to missed optimization described in [this issue](https://github.com/rust-lang/rust/issues/83623)

Also it changes some src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump* files automatically.

3 years agoadd OR_PATTERNS_BACK_COMPAT lint
hi-rustin [Thu, 25 Mar 2021 13:42:21 +0000 (21:42 +0800)]
add OR_PATTERNS_BACK_COMPAT lint

test: add more cases

test: add comments

refine msg

3 years agoAdd my new email address to .mailmap
Yuki Okushi [Thu, 1 Apr 2021 11:43:44 +0000 (20:43 +0900)]
Add my new email address to .mailmap

3 years agoSome more fine-grained forced inlining
Oli Scherer [Thu, 1 Apr 2021 10:40:50 +0000 (10:40 +0000)]
Some more fine-grained forced inlining

3 years agoLimit the problematic tests to x86_64.
Hameer Abbasi [Thu, 1 Apr 2021 09:24:01 +0000 (09:24 +0000)]
Limit the problematic tests to x86_64.

3 years agoInline some functions that suddenly show up more in traces
Oli Scherer [Wed, 31 Mar 2021 15:38:11 +0000 (15:38 +0000)]
Inline some functions that suddenly show up more in traces

3 years agoAuto merge of #83726 - the8472:large-trustedlen-fail-fast, r=kennytm
bors [Thu, 1 Apr 2021 07:55:00 +0000 (07:55 +0000)]
Auto merge of #83726 - the8472:large-trustedlen-fail-fast, r=kennytm

panic early when `TrustedLen` indicates a `length > usize::MAX`

Changes `TrustedLen` specializations to immediately panic when `size_hint().1 == None`.

As far as I can tell this is ~not a change~ a minimal change in observable behavior for anything except ZSTs because the fallback path would go through `extend_desugared()` which tries to `reserve(lower_bound)` which already is `usize::MAX` and that would also lead to a panic. Before it might have popped somewhere between zero and a few elements from the iterator before panicking while it now panics immediately.

Overall this should reduce codegen by eliminating the fallback paths.

While looking into the `with_capacity()` behavior I also noticed that its documentation didn't have a *Panics* section, so I added that.

3 years agoAuto merge of #83736 - JohnTitor:fix-unsafe_block_in_unsafe_fn-stabilized-version...
bors [Thu, 1 Apr 2021 05:34:54 +0000 (05:34 +0000)]
Auto merge of #83736 - JohnTitor:fix-unsafe_block_in_unsafe_fn-stabilized-version, r=jyn514

Fix the `unsafe_block_in_unsafe_fn`s stabilized version

Fixes #83735

3 years agoFix minor typo in once.rs
Predrag Gruevski [Thu, 1 Apr 2021 04:52:02 +0000 (00:52 -0400)]
Fix minor typo in once.rs

3 years agoAuto merge of #83732 - ehuss:update-cargo, r=ehuss
bors [Thu, 1 Apr 2021 03:13:39 +0000 (03:13 +0000)]
Auto merge of #83732 - ehuss:update-cargo, r=ehuss

Update cargo

5 commits in 1e8703890f285befb5e32627ad4e0a0454dde1fb..3c44c3c4b7900b8b13c85ead25ccaa8abb7d8989
2021-03-26 16:59:39 +0000 to 2021-03-31 21:21:15 +0000
- Fix semver docs for 1.51. (rust-lang/cargo#9316)
- Add `cargo config` subcommand. (rust-lang/cargo#9302)
- Give one more example for the --featuers CLI (rust-lang/cargo#9313)
- Bump to 0.54.0, update changelog (rust-lang/cargo#9308)
- Make the URL to the tracking issue for `--out-dir` into a link (rust-lang/cargo#9309)

3 years agoFix the `unsafe_block_in_unsafe_fn`s stabilized version
Yuki Okushi [Thu, 1 Apr 2021 01:56:51 +0000 (10:56 +0900)]
Fix the `unsafe_block_in_unsafe_fn`s stabilized version

3 years agoUpdate cargo
Eric Huss [Thu, 1 Apr 2021 00:45:03 +0000 (17:45 -0700)]
Update cargo

3 years agoAuto merge of #83731 - Dylan-DPC:rollup-v2z3gkt, r=Dylan-DPC
bors [Thu, 1 Apr 2021 00:42:50 +0000 (00:42 +0000)]
Auto merge of #83731 - Dylan-DPC:rollup-v2z3gkt, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #83015 (Add regression tests for #79825 and #81555)
 - #83699 (Add a regression test for issue-68830)
 - #83700 (Fix documentation of conversion from String to OsString)
 - #83711 (Clarify `--print target-list` is a rustc's option)
 - #83712 (Update LLVM with another wasm simd fix)

Failed merges:

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

3 years agoRollup merge of #83712 - alexcrichton:more-wasm-simd-llvm-updates, r=nikic
Dylan DPC [Thu, 1 Apr 2021 00:41:48 +0000 (02:41 +0200)]
Rollup merge of #83712 - alexcrichton:more-wasm-simd-llvm-updates, r=nikic

Update LLVM with another wasm simd fix

Just a small bug fix for opcode numberings, not too major.

3 years agoRollup merge of #83711 - JohnTitor:more-friendly-unknown-target-error, r=davidtwco
Dylan DPC [Thu, 1 Apr 2021 00:41:47 +0000 (02:41 +0200)]
Rollup merge of #83711 - JohnTitor:more-friendly-unknown-target-error, r=davidtwco

Clarify `--print target-list` is a rustc's option

Fixes #68238

3 years agoRollup merge of #83700 - steffahn:string_to_pathbuf_conversion_documentation, r=JohnTitor
Dylan DPC [Thu, 1 Apr 2021 00:41:46 +0000 (02:41 +0200)]
Rollup merge of #83700 - steffahn:string_to_pathbuf_conversion_documentation, r=JohnTitor

Fix documentation of conversion from String to OsString

From [this question on URLO](https://users.rust-lang.org/t/does-converting-a-string-into-a-pathbuf-allocate-new-buffer/57678), I noticed that the documentation of `From<String> for OsString` incorrectly claims to be copying data.

````@rustbot```` modify labels: T-doc, T-libs

3 years agoRollup merge of #83699 - JohnTitor:issue-68830, r=Dylan-DPC
Dylan DPC [Thu, 1 Apr 2021 00:41:45 +0000 (02:41 +0200)]
Rollup merge of #83699 - JohnTitor:issue-68830, r=Dylan-DPC

Add a regression test for issue-68830

Closes #68830

3 years agoRollup merge of #83015 - hyd-dev:test-79825-81555, r=Aaron1011
Dylan DPC [Thu, 1 Apr 2021 00:41:44 +0000 (02:41 +0200)]
Rollup merge of #83015 - hyd-dev:test-79825-81555, r=Aaron1011

Add regression tests for #79825 and #81555

Closes #79825.
Closes #81555.

`@rustbot` label A-proc-macros T-compiler

3 years agoFix `--external-css` to be invocation-specific and note main.js should be invocation...
Joshua Nelson [Wed, 31 Mar 2021 21:23:32 +0000 (17:23 -0400)]
Fix `--external-css` to be invocation-specific and note main.js should be invocation specific

3 years agopanic early when TrustedLen indicates a length > usize::MAX
The8472 [Wed, 31 Mar 2021 21:09:28 +0000 (23:09 +0200)]
panic early when TrustedLen indicates a length > usize::MAX

3 years agoAdd a button to copy the "use statement"
Guillaume Gomez [Wed, 31 Mar 2021 20:13:47 +0000 (22:13 +0200)]
Add a button to copy the "use statement"

3 years agoAuto merge of #76814 - jackh726:binder-refactor, r=nikomatsakis
bors [Wed, 31 Mar 2021 18:06:06 +0000 (18:06 +0000)]
Auto merge of #76814 - jackh726:binder-refactor, r=nikomatsakis

Refactor `Binder` to track bound vars

c.c. `@rust-lang/wg-traits`

This is super early (and might just get closed at some point), but want to get at least an initial idea of the perf impact.

r? `@ghost`

3 years agoUpdate LLVM with another wasm simd fix
Alex Crichton [Wed, 31 Mar 2021 17:24:41 +0000 (10:24 -0700)]
Update LLVM with another wasm simd fix

Just a small bug fix for opcode numberings, not too major.

3 years agoClarify `--print target-list` is a rustc's option
JohnTitor [Wed, 31 Mar 2021 16:59:50 +0000 (01:59 +0900)]
Clarify `--print target-list` is a rustc's option

3 years agoRename CrateSpecific -> InvocationSpecific
Joshua Nelson [Wed, 31 Mar 2021 15:35:57 +0000 (11:35 -0400)]
Rename CrateSpecific -> InvocationSpecific

3 years agoEnforce that Toolchain files are static and Crate files are dynamic
Joshua Nelson [Wed, 31 Mar 2021 15:13:51 +0000 (11:13 -0400)]
Enforce that Toolchain files are static and Crate files are dynamic

This also changes custom themes from Toolchain to Crate files.

3 years agoFix compiletest to use correct bitwidth stderr files.
Hameer Abbasi [Wed, 31 Mar 2021 15:30:07 +0000 (15:30 +0000)]
Fix compiletest to use correct bitwidth stderr files.

3 years agoEnable debugging the dep-graph without debug-assertions.
Camille GILLOT [Wed, 31 Mar 2021 15:12:03 +0000 (17:12 +0200)]
Enable debugging the dep-graph without debug-assertions.

It may also be useful in these cases,
and some CI configurations test without debug assertions.

3 years agoCleanups and comments
Jack Huey [Fri, 26 Mar 2021 21:40:15 +0000 (17:40 -0400)]
Cleanups and comments

3 years agoFix tests and AstConv -> dyn AstConv
Jack Huey [Thu, 25 Mar 2021 16:15:45 +0000 (12:15 -0400)]
Fix tests and AstConv -> dyn AstConv

3 years agoFmt and test revert
Jack Huey [Fri, 12 Mar 2021 02:49:41 +0000 (21:49 -0500)]
Fmt and test revert

3 years agoFix new problem from rebase and a little cleanup
Jack Huey [Fri, 12 Mar 2021 02:08:49 +0000 (21:08 -0500)]
Fix new problem from rebase and a little cleanup

3 years agoAdd var to BoundRegion. Add query to get bound vars for applicable items.
Jack Huey [Mon, 26 Oct 2020 18:18:31 +0000 (14:18 -0400)]
Add var to BoundRegion. Add query to get bound vars for applicable items.

3 years agoMake late and late_anon regions track the bound var position
Jack Huey [Sun, 15 Nov 2020 22:06:58 +0000 (17:06 -0500)]
Make late and late_anon regions track the bound var position

3 years agoRevert explicit lifetimes
Jack Huey [Thu, 17 Dec 2020 00:14:21 +0000 (19:14 -0500)]
Revert explicit lifetimes

3 years agoTrack bound vars
Jack Huey [Tue, 6 Oct 2020 00:41:46 +0000 (20:41 -0400)]
Track bound vars

3 years agoAdd tcx lifetime to Binder
Jack Huey [Mon, 5 Oct 2020 20:51:33 +0000 (16:51 -0400)]
Add tcx lifetime to Binder

3 years agocount bound vars
Jack Huey [Tue, 2 Jun 2020 21:10:22 +0000 (17:10 -0400)]
count bound vars

3 years agoApply suggestions from code review
Frank Steffahn [Wed, 31 Mar 2021 14:08:20 +0000 (16:08 +0200)]
Apply suggestions from code review

More links, one more occurrence of “a OsString”

Co-authored-by: Yuki Okushi <huyuumi.dev@gmail.com>
3 years agoAdd u32 for bound variables to Binder
Jack Huey [Mon, 1 Jun 2020 23:23:23 +0000 (19:23 -0400)]
Add u32 for bound variables to Binder

3 years agoSome rebinds and dummys
Jack Huey [Thu, 7 Jan 2021 05:41:55 +0000 (00:41 -0500)]
Some rebinds and dummys

3 years agoAdd a few missing links, fix a typo
Frank Steffahn [Wed, 31 Mar 2021 10:24:37 +0000 (12:24 +0200)]
Add a few missing links, fix a typo

3 years agoFix documentation of conversion from String to OsString
Frank Steffahn [Wed, 31 Mar 2021 10:11:24 +0000 (12:11 +0200)]
Fix documentation of conversion from String to OsString