]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoRollup merge of #81730 - RustyYato:object-safe-allocator, r=Amanieu
Mara Bos [Fri, 5 Feb 2021 11:26:05 +0000 (12:26 +0100)]
Rollup merge of #81730 - RustyYato:object-safe-allocator, r=Amanieu

Make `Allocator` object-safe

This allows rust-lang/wg-allocators#83: polymorphic allocators

3 years agoRollup merge of #81682 - JulianKnodt:bit_set_iter_benchmarks, r=oli-obk
Mara Bos [Fri, 5 Feb 2021 11:26:03 +0000 (12:26 +0100)]
Rollup merge of #81682 - JulianKnodt:bit_set_iter_benchmarks, r=oli-obk

Add additional bitset benchmarks

Add additional benchmarks for operations in bitset, I realize that it was a bit lacking when I intended to optimize it earlier, so I was hoping to put some in so I can verify my work later.

3 years agoRollup merge of #81676 - jyn514:crate-not-found, r=oli-obk
Mara Bos [Fri, 5 Feb 2021 11:26:02 +0000 (12:26 +0100)]
Rollup merge of #81676 - jyn514:crate-not-found, r=oli-obk

Add more information to the error code for 'crate not found'

This comes up a lot when bootstrapping.

3 years agoRollup merge of #81542 - RReverser:wasi-symlink, r=alexcrichton
Mara Bos [Fri, 5 Feb 2021 11:26:00 +0000 (12:26 +0100)]
Rollup merge of #81542 - RReverser:wasi-symlink, r=alexcrichton

Expose correct symlink API on WASI

As described in https://github.com/rust-lang/rust/issues/68574, the currently exposed API for symlinks is, in fact, a thin wrapper around the corresponding syscall, and not suitable for public usage.

The reason is that the 2nd param in the call is expected to be a handle of a "preopened directory" (a WASI concept for exposing dirs), and the only way to retrieve such handle right now is by tinkering with a private `__wasilibc_find_relpath` API, which is an implementation detail and definitely not something we want users to call directly.

Making matters worse, the semantics of this param aren't obvious from its name (`fd`), and easy to misinterpret, resulting in people trying to pass a handle of the target file itself (as in https://github.com/vitiral/path_abs/pull/50), which doesn't work as expected.

I did a [codesearch among open-source repos](https://sourcegraph.com/search?q=std%3A%3Aos%3A%3Awasi%3A%3Afs%3A%3Asymlink&patternType=literal), and the usage above is so far the only usage of this API at all, but we should fix it before more people start using it incorrectly.

While this is technically a breaking API change, I believe it's a justified one, as 1) it's OS-specific and 2) there was strictly no way to correctly use the previous form of the API, and if someone does use it, they're likely doing it wrong like in the example above.

The new API does not lead to the same confusion, as it mirrors `std::os::unix::fs::symlink` and `std::os::windows::fs::symlink_{file,dir}` variants by accepting source/target paths.

Fixes #68574.

r? ``@alexcrichton``

3 years agoRollup merge of #81500 - CraftSpider:union-kind, r=jyn514
Mara Bos [Fri, 5 Feb 2021 11:25:59 +0000 (12:25 +0100)]
Rollup merge of #81500 - CraftSpider:union-kind, r=jyn514

Remove struct_type from union output

Also bumps the format number and adds a test

Rationale: It's illegal to have unions of the form `union Union(i32, f32);`, or `union Union;`. The struct_type field was recently removed from the rustdoc Union AST, at which time this field was changed to always just read "union". It makes sense to completely remove it, as it provides no information.

3 years agoRollup merge of #81497 - camelid:rustdoc-display_fn-remove-cell, r=jyn514
Mara Bos [Fri, 5 Feb 2021 11:25:58 +0000 (12:25 +0100)]
Rollup merge of #81497 - camelid:rustdoc-display_fn-remove-cell, r=jyn514

rustdoc: Move `display_fn` struct inside `display_fn`

This makes it clear that it's an implementation detail of `display_fn`
and shouldn't be used elsewhere, and it enforces in the compiler that no
one else can use it.

r? ````@GuillaumeGomez````

3 years agoRollup merge of #81456 - Amanieu:remote-test-server, r=Amanieu
Mara Bos [Fri, 5 Feb 2021 11:25:56 +0000 (12:25 +0100)]
Rollup merge of #81456 - Amanieu:remote-test-server, r=Amanieu

Make remote-test-server easier to use with new targets

While testing #81455 I encountered 2 issues with `remote-test-server`:
- It is built with the stage 0 toolchain, which does not support a newly added target.
- It overwrites `LD_LIBRARY_PATH` instead of appending to it, which prevents the use of a custom sysroot for target libraries.

3 years agoRollup merge of #81318 - CraftSpider:json-trait-fix, r=jyn514
Mara Bos [Fri, 5 Feb 2021 11:25:54 +0000 (12:25 +0100)]
Rollup merge of #81318 - CraftSpider:json-trait-fix, r=jyn514

rustdoc-json: Fix has_body

Previously, `has_body` was always true. Now propagate the type of the method to set it correctly. Relies on #81287, that will need to be merged first.

3 years agoRollup merge of #81307 - estebank:invalid-byte-str-span, r=petrochenkov
Mara Bos [Fri, 5 Feb 2021 11:25:53 +0000 (12:25 +0100)]
Rollup merge of #81307 - estebank:invalid-byte-str-span, r=petrochenkov

Handle `Span`s for byte and raw strings and add more detail

CC #81208.

3 years agoRollup merge of #80726 - lcnr:unsize-query, r=oli-obk
Mara Bos [Fri, 5 Feb 2021 11:25:52 +0000 (12:25 +0100)]
Rollup merge of #80726 - lcnr:unsize-query, r=oli-obk

relax adt unsizing requirements

Changes unsizing of structs in case the last struct field shares generic params with other adt fields which do not change.
This change is currently insta stable and changes the language, so it at least requires a lang fcp. I feel like the current state is fairly unintuitive.

An example for what's now allowed would be https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=6dd331d23f5c9ffc8c978175aae2e967
```rust
struct A<T, U: ?Sized>(T, B<T, U>); // previously ERR
// struct A<T, U: ?Sized>(T, B<[u32; 1], U>); // ok
struct B<T, U: ?Sized>(T, U);

fn main() {
    let x = A([0; 1], B([0; 1], [0; 1]));
    let y: &A<[u32; 1], [u32]> = &x;
    assert_eq!(y.1.1.len(), 1);
}
```

3 years agoRollup merge of #79554 - b-naber:generic-associated-types-in-trait-paths, r=jackh726
Mara Bos [Fri, 5 Feb 2021 11:25:50 +0000 (12:25 +0100)]
Rollup merge of #79554 - b-naber:generic-associated-types-in-trait-paths, r=jackh726

Generic associated types in trait paths

This is the second part of https://github.com/rust-lang/rust/pull/78978

This should fix:

Fixes #67510
Fixes #68648
Fixes #68649
Fixes #68650
Fixes #68652
Fixes #74684
Fixes #76535
Fixes #79422
Fixes #80433

and implement the remaining functionality needed for https://github.com/rust-lang/rust/issues/44265

r? ``@matthewjasper``

3 years agoAuto merge of #81688 - pnkfelix:fix-llvm-version-check-in-run-make-tests, r=simulacrum
bors [Fri, 5 Feb 2021 06:12:26 +0000 (06:12 +0000)]
Auto merge of #81688 - pnkfelix:fix-llvm-version-check-in-run-make-tests, r=simulacrum

Use `# min-llvm-version: 11.0` to force a minimum LLVM version

Use `# min-llvm-version: 11.0` to force a minimum LLVM version, rather than ad-hoc internal solution.

In particular: the specific code to define LLVM_VERSION_11_PLUS here was, for some reason, using `$(shell ...)` with bash-specific variable replacement code. On non-bash platforms like dash, that `shell` invocation would fail, and the
LLVM_VERSION_11_PLUS check would always fail, the test would always be ignored, and thus be treated as a "success" (in the sense that `--bless` would never do anything).

 * Note in particular that GNU Make treats the SHELL variable as a very special case: it does not inherit the value of SHELL from the user's environment. Except on Windows. See more explanation in the [GNU Make docs](https://www.gnu.org/software/make/manual/html_node/Choosing-the-Shell.html).
 * The effect of this is that these tests end up using `/bin/sh` (except on Windows) for their `$(shell ...)` invocations, and thus we see differing behaviors depending on whether your `/bin/sh` links to `/bin/dash` or to `/bin/bash`.

This was causing me a lot of pain.

3 years agoAuto merge of #81756 - ehuss:update-cargo, r=ehuss
bors [Fri, 5 Feb 2021 02:13:59 +0000 (02:13 +0000)]
Auto merge of #81756 - ehuss:update-cargo, r=ehuss

Update cargo

5 commits in e099df243bb2495b9b197f79c19f124032b1e778..34170fcd6e0947808a1ac63ac85ffc0da7dace2f
2021-02-01 16:24:34 +0000 to 2021-02-04 15:52:52 +0000
- Fix permission issue with `cargo vendor`. (rust-lang/cargo#9131)
- Add split-debuginfo profile option (rust-lang/cargo#9112)
- Add RegistryBuilder for tests, and update crates-io error handling. (rust-lang/cargo#9126)
- Add some documentation for index and registry stuff. (rust-lang/cargo#9125)
- Fix env/cfg set for `cargo test` and `cargo run`. (rust-lang/cargo#9122)

3 years agoAuto merge of #81761 - m-ou-se:rollup-xp7v07n, r=m-ou-se
bors [Thu, 4 Feb 2021 23:16:08 +0000 (23:16 +0000)]
Auto merge of #81761 - m-ou-se:rollup-xp7v07n, r=m-ou-se

Rollup of 9 pull requests

Successful merges:

 - #74304 (Stabilize the Wake trait)
 - #79805 (Rename Iterator::fold_first to reduce and stabilize it)
 - #81556 (introduce future-compatibility warning for forbidden lint groups)
 - #81645 (Add lint for `panic!(123)` which is not accepted in Rust 2021.)
 - #81710 (OsStr eq_ignore_ascii_case takes arg by value)
 - #81711 (add #[inline] to all the public IpAddr functions)
 - #81725 (Move test to be with the others)
 - #81727 (Revert stabilizing integer::BITS.)
 - #81745 (Stabilize poison API of Once, rename poisoned())

Failed merges:

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

3 years agoadd tests
b-naber [Mon, 30 Nov 2020 08:30:14 +0000 (09:30 +0100)]
add tests

3 years agoremove subst_supertrait call
b-naber [Mon, 30 Nov 2020 08:28:16 +0000 (09:28 +0100)]
remove subst_supertrait call

3 years agouse generic arguments of associated item in trait_ref method
b-naber [Mon, 30 Nov 2020 08:27:23 +0000 (09:27 +0100)]
use generic arguments of associated item in trait_ref method

3 years agoAuto merge of #81762 - pietroalbini:fix-install-msys2, r=m-ou-se
bors [Thu, 4 Feb 2021 20:30:11 +0000 (20:30 +0000)]
Auto merge of #81762 - pietroalbini:fix-install-msys2, r=m-ou-se

CI: only copy python.exe to python3.exe if the latter does not exist

We're copying the binary to make sure we can call `python3.exe` around, but it seems like the base image of GitHub Actions changed, copying the file before we do so. This PR changes the CI script to only copy the file if it doesn't already exist.

r? `@m-ou-se`
cc `@Mark-Simulacrum`

3 years agoci: only copy python.exe to python3.exe if the latter does not exist
Pietro Albini [Thu, 4 Feb 2021 20:24:41 +0000 (21:24 +0100)]
ci: only copy python.exe to python3.exe if the latter does not exist

We're copying the binary to make sure we can call python3.exe around,
but it seems like the base image of GitHub Actions changed, copying the
file before we do so.

This commit changes the CI script to only copy the file if it doesn't
already exist.

3 years agoRollup merge of #81745 - Kixunil:stabilize_once_poison, r=m-ou-se
Mara Bos [Thu, 4 Feb 2021 20:10:44 +0000 (21:10 +0100)]
Rollup merge of #81745 - Kixunil:stabilize_once_poison, r=m-ou-se

Stabilize poison API of Once, rename poisoned()

This stabilizes:

* `OnceState`
* `OnceState::is_poisoned()` (previously named `poisoned()`)
* `Once::call_once_force()`

`poisoned()` was renamed because the new name is more clear as a few
people agreed and nobody objected.

Closes #33577

Notes:

* I'm not entirely sure it's supposed to be 1.51, LMK if I did it wrong
* I failed to run tests locally, so we will have to leave it to bors or someone else can try

3 years agoRollup merge of #81727 - m-ou-se:unstabilize-bits, r=Mark-Simulacrum
Mara Bos [Thu, 4 Feb 2021 20:10:42 +0000 (21:10 +0100)]
Rollup merge of #81727 - m-ou-se:unstabilize-bits, r=Mark-Simulacrum

Revert stabilizing integer::BITS.

We agreed in the libs meeting just now to revert stablization, since the [breakage](https://github.com/rust-lang/rust/issues/81654) is significant throughout the ecosystem, through `lexical-core`.

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

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

3 years agoRollup merge of #81725 - mark-i-m:mv-test, r=Mark-Simulacrum
Mara Bos [Thu, 4 Feb 2021 20:10:40 +0000 (21:10 +0100)]
Rollup merge of #81725 - mark-i-m:mv-test, r=Mark-Simulacrum

Move test to be with the others

No functional changes. I just created this test in the wrong place in a past PR. All of the other or-pattern tests are in the `or-patterns` directory.

3 years agoRollup merge of #81711 - saethlin:ipaddr-inline, r=m-ou-se
Mara Bos [Thu, 4 Feb 2021 20:10:39 +0000 (21:10 +0100)]
Rollup merge of #81711 - saethlin:ipaddr-inline, r=m-ou-se

add #[inline] to all the public IpAddr functions

3 years agoRollup merge of #81710 - TyPR124:patch-2, r=m-ou-se
Mara Bos [Thu, 4 Feb 2021 20:10:37 +0000 (21:10 +0100)]
Rollup merge of #81710 - TyPR124:patch-2, r=m-ou-se

OsStr eq_ignore_ascii_case takes arg by value

Per a comment on #70516 this changes `eq_ignore_ascii_case` to take the generic parameter `S: AsRef<OsStr>` by value instead of by reference.

This is technically a breaking change to an unstable method. I think the only way it would break is if you called this method with an explicit type parameter, ie `my_os_str.eq_ignore_ascii_case::<str>("foo")` becomes `my_os_str.eq_ignore_ascii_case::<&str>("foo")`.

Besides that, I believe it is overall more flexible since it can now take an owned `OsString` for example.

If this change should be made in some other PR (like #80193) then please just close this.

3 years agoRollup merge of #81645 - m-ou-se:panic-lint, r=estebank,flip1995
Mara Bos [Thu, 4 Feb 2021 20:10:36 +0000 (21:10 +0100)]
Rollup merge of #81645 - m-ou-se:panic-lint, r=estebank,flip1995

Add lint for `panic!(123)` which is not accepted in Rust 2021.

This extends the `panic_fmt` lint to warn for all cases where the first argument cannot be interpreted as a format string, as will happen in Rust 2021.

It suggests to add `"{}",` to format the message as a string. In the case of `std::panic!()`, it also suggests the recently stabilized
`std::panic::panic_any()` function as an alternative.

It renames the lint to `non_fmt_panic` to match the lint naming guidelines.

![image](https://user-images.githubusercontent.com/783247/106520928-675ea680-64d5-11eb-81f7-d8fa48b93a0b.png)

This is part of #80162.

r? ```@estebank```

3 years agoRollup merge of #81556 - nikomatsakis:forbidden-lint-groups-lint, r=pnkfelix
Mara Bos [Thu, 4 Feb 2021 20:10:34 +0000 (21:10 +0100)]
Rollup merge of #81556 - nikomatsakis:forbidden-lint-groups-lint, r=pnkfelix

introduce future-compatibility warning for forbidden lint groups

We used to ignore `forbid(group)` scenarios completely. This changed in #78864, but that led to a number of regressions (#80988, #81218).

This PR introduces a future compatibility warning for the case where a group is forbidden but then an individual lint within that group is allowed. We now issue a FCW when we see the "allow", but permit it to take effect.

r? ``@Mark-Simulacrum``

3 years agoRollup merge of #79805 - m-ou-se:iterator-reduce, r=KodrAus
Mara Bos [Thu, 4 Feb 2021 20:10:33 +0000 (21:10 +0100)]
Rollup merge of #79805 - m-ou-se:iterator-reduce, r=KodrAus

Rename Iterator::fold_first to reduce and stabilize it

This stabilizes `#![feature(iterator_fold_self)]`.

The name for this function (originally `fold_first`) was still an open question, but the discussion on [the tracking issue](https://github.com/rust-lang/rust/issues/68125) seems to have converged to `reduce`.

3 years agoRollup merge of #74304 - yoshuawuyts:stabilize-wake, r=KodrAus
Mara Bos [Thu, 4 Feb 2021 20:10:31 +0000 (21:10 +0100)]
Rollup merge of #74304 - yoshuawuyts:stabilize-wake, r=KodrAus

Stabilize the Wake trait

This PR proposes stabilizing the `wake_trait` feature, tracking issue https://github.com/rust-lang/rust/issues/69912.

## Motivation

The surface area this trait introduces is small, and it has been on nightly for 4 months without any reported issues. Given the surface area of this trait is small and only serves to provide a safe interface around the already stable [`std::task::RawWakerVTable`](https://doc.rust-lang.org/std/task/struct.RawWaker.html) it seems unlikely this trait will require any further changes. So I'm proposing we stabilize this.

Personally I would love to have this available on stable, since it would enable cleaning up some runtime internals by removing the tedious pointer required to construct a [`RawWakerVTable`](https://doc.rust-lang.org/std/task/struct.RawWakerVTable.html). I believe the intent was always to introduce a `Wake` counterpart to `RawWaker` in order to safely construct `Waker` instances. And the `Wake` trait feels like it does that job as intended.

## Implementation notes

This PR itself fixes a link in the docs, and introduces an example of how to use the trait: a minimal `block_on` example that runs a future to completion on the current thread. It doesn't include fancier features such as support for nesting, but is intended to serve as a teaching device for both `task::Wake` and futures alike.

3 years agoUpdate cargo
Eric Huss [Thu, 4 Feb 2021 18:08:54 +0000 (10:08 -0800)]
Update cargo

3 years agoAuto merge of #81743 - RalfJung:miri, r=RalfJung
bors [Thu, 4 Feb 2021 16:46:38 +0000 (16:46 +0000)]
Auto merge of #81743 - RalfJung:miri, r=RalfJung

update Miri

Fixes https://github.com/rust-lang/rust/issues/81726
Cc `@rust-lang/miri` r? `@ghost`

3 years agosubstitutions in trait predicates
b-naber [Mon, 30 Nov 2020 08:26:22 +0000 (09:26 +0100)]
substitutions in trait predicates

3 years agolowering of generic args in AssocTyConstraint
b-naber [Mon, 30 Nov 2020 08:24:54 +0000 (09:24 +0100)]
lowering of generic args in AssocTyConstraint

3 years agohir pretty printing
b-naber [Mon, 30 Nov 2020 08:23:59 +0000 (09:23 +0100)]
hir pretty printing

3 years agoadd generic args to hir::TypeBinding
b-naber [Mon, 30 Nov 2020 08:23:00 +0000 (09:23 +0100)]
add generic args to hir::TypeBinding

3 years agoStabilize poison API of Once, rename poisoned()
Martin Habovstiak [Thu, 4 Feb 2021 10:13:03 +0000 (11:13 +0100)]
Stabilize poison API of Once, rename poisoned()

This stabilizes:

* `OnceState`
* `OnceState::is_poisoned()` (previously named `poisoned()`)
* `Once::call_once_force()`

`poisoned()` was renamed because the new name is more clear as a few
people agreed and nobody objected.

Closes #33577

3 years agoStabilize feature(iterator_fold_self): Iterator::reduce
Mara Bos [Mon, 7 Dec 2020 20:24:07 +0000 (21:24 +0100)]
Stabilize feature(iterator_fold_self): Iterator::reduce

3 years agoImprove documentation of Iterator::{fold, reduce}.
Mara Bos [Mon, 7 Dec 2020 20:23:50 +0000 (21:23 +0100)]
Improve documentation of Iterator::{fold, reduce}.

3 years agoRename Iterator::fold_first to reduce.
Mara Bos [Mon, 7 Dec 2020 20:23:29 +0000 (21:23 +0100)]
Rename Iterator::fold_first to reduce.

3 years agoupdate Miri
Ralf Jung [Thu, 4 Feb 2021 09:35:51 +0000 (10:35 +0100)]
update Miri

3 years agomake Allocator object-safe
RustyYato [Wed, 3 Feb 2021 21:59:28 +0000 (16:59 -0500)]
make Allocator object-safe

add test to ensure object-safety
This allows for runtime polymorphic allocators

3 years agoadd `relaxed_struct_unsize` feature gate
Bastian Kauschke [Wed, 3 Feb 2021 22:56:47 +0000 (23:56 +0100)]
add `relaxed_struct_unsize` feature gate

3 years agorelax adt unsizing requirements
Bastian Kauschke [Tue, 5 Jan 2021 15:33:10 +0000 (16:33 +0100)]
relax adt unsizing requirements

3 years agoSuggest panic!("{}", ..) instead of panic!(..) clippy::expect_fun_call.
Mara Bos [Wed, 3 Feb 2021 09:55:33 +0000 (10:55 +0100)]
Suggest panic!("{}", ..) instead of panic!(..) clippy::expect_fun_call.

3 years agoFix/allow non_fmt_panic in clippy tests.
Mara Bos [Tue, 2 Feb 2021 19:24:42 +0000 (20:24 +0100)]
Fix/allow non_fmt_panic in clippy tests.

3 years agoUpdate panic!() documentation about non-string panics.
Mara Bos [Tue, 2 Feb 2021 09:30:50 +0000 (10:30 +0100)]
Update panic!() documentation about non-string panics.

3 years agoAllow/fix non_fmt_panic in tests.
Mara Bos [Mon, 1 Feb 2021 23:40:17 +0000 (00:40 +0100)]
Allow/fix non_fmt_panic in tests.

3 years agoMake panic/assert calls in rustc compatible with Rust 2021.
Mara Bos [Mon, 1 Feb 2021 23:17:51 +0000 (00:17 +0100)]
Make panic/assert calls in rustc compatible with Rust 2021.

3 years agoAdd lint for `panic!(123)` which is not accepted in Rust 2021.
Mara Bos [Mon, 1 Feb 2021 21:30:09 +0000 (22:30 +0100)]
Add lint for `panic!(123)` which is not accepted in Rust 2021.

This extends the `panic_fmt` lint to warn for all cases where the first
argument cannot be interpreted as a format string, as will happen in
Rust 2021.

It suggests to add `"{}", ` to format the message as a string. In the
case of `std::panic!()`, it also suggests the recently stabilized
`std::panic::panic_any()` function as an alternative.

It renames the lint to `non_fmt_panic` to match the lint naming
guidelines.

3 years agoHandle `Span`s for byte and raw strings and add more detail
Esteban Küber [Sat, 23 Jan 2021 20:48:31 +0000 (12:48 -0800)]
Handle `Span`s for byte and raw strings and add more detail

3 years agoRevert stabilizing integer::BITS.
Mara Bos [Wed, 3 Feb 2021 21:23:58 +0000 (22:23 +0100)]
Revert stabilizing integer::BITS.

3 years agoIgnore broken test.
Felix S. Klock II [Wed, 3 Feb 2021 21:02:41 +0000 (16:02 -0500)]
Ignore broken test.

(Test was silently ignored on Linux CI prior to parent commit that switched to
using `# min-llvm-version`. But the switch made the ignoring stop, exposing
other brokenness in the form of bash-dependent syntax in the `$(shell ...)`
invocations.)

3 years agoAuto merge of #81717 - Aaron1011:fix/closure-diag, r=estebank
bors [Wed, 3 Feb 2021 20:53:08 +0000 (20:53 +0000)]
Auto merge of #81717 - Aaron1011:fix/closure-diag, r=estebank

Fix panic when emitting diagnostic for closure mutable binding error

Fixes #81700

The upvar borrow kind may be `ty::BorrowKind::UniqueImmBorrow`, which is
still a mutable borrow for the purposes of this diagnostic code.

3 years agomove test to be with the others
mark [Wed, 3 Feb 2021 20:38:34 +0000 (14:38 -0600)]
move test to be with the others

3 years agoAuto merge of #81718 - m-ou-se:rollup-3ftbymt, r=m-ou-se
bors [Wed, 3 Feb 2021 18:01:37 +0000 (18:01 +0000)]
Auto merge of #81718 - m-ou-se:rollup-3ftbymt, r=m-ou-se

Rollup of 5 pull requests

Successful merges:

 - #80394 (make const_err a future incompat lint)
 - #81532 (Remove incorrect `delay_span_bug`)
 - #81692 (Update clippy)
 - #81715 (Reduce tab formatting assertions to debug only)
 - #81716 (Fix non-existent-field ICE for generic fields.)

Failed merges:

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

3 years agoRollup merge of #81716 - m-ou-se:fix-ice, r=eddyb
Mara Bos [Wed, 3 Feb 2021 17:51:18 +0000 (18:51 +0100)]
Rollup merge of #81716 - m-ou-se:fix-ice, r=eddyb

Fix non-existent-field ICE for generic fields.

I mentioned this ICE in a chat and it took about 3 milliseconds before `@eddyb` found the problem and said this change would fix it. :)

This also changes one the field types in the related test to one that triggered the ICE.

Fixes #81627.
Fixes #81672.
Fixes #81709.

Cc https://github.com/rust-lang/rust/pull/81480 `@b-naber` `@estebank.`

3 years agoRollup merge of #81715 - jryans:tab-handling-ice-81614, r=estebank
Mara Bos [Wed, 3 Feb 2021 17:51:17 +0000 (18:51 +0100)]
Rollup merge of #81715 - jryans:tab-handling-ice-81614, r=estebank

Reduce tab formatting assertions to debug only

The tab replacement for diagnostics added in #79757 included a few assertions to ensure all tab characters are handled appropriately. We've started getting reports of these assertions firing (#81614). Since it's only a cosmetic issue, this downgrades the assertions to debug only, so we at least continue compiling even if the diagnostics might be a tad wonky.

Minimizes the impact of #81614

3 years agoRollup merge of #81692 - Manishearth:clippyup, r=tmandry
Mara Bos [Wed, 3 Feb 2021 17:51:15 +0000 (18:51 +0100)]
Rollup merge of #81692 - Manishearth:clippyup, r=tmandry

Update clippy

r? `@flip1995`

3 years agoRollup merge of #81532 - estebank:ice-ice-baby, r=pnkfelix
Mara Bos [Wed, 3 Feb 2021 17:51:14 +0000 (18:51 +0100)]
Rollup merge of #81532 - estebank:ice-ice-baby, r=pnkfelix

Remove incorrect `delay_span_bug`

The following code is supposed to compile

```rust
use std::ops::BitOr;

pub trait IntWrapper {
    type InternalStorage;
}

impl<T> BitOr for dyn IntWrapper<InternalStorage = T>
where
    Self: Sized,
    T: BitOr + BitOr<Output = T>,
{
    type Output = Self;
    fn bitor(self, _other: Self) -> Self {
        todo!()
    }
}
```

Before this change it would ICE. In #70998 the removed logic was added
to provide better suggestions, and the `delay_span_bug` guard was added
to  protect against a potential logic error when returning traits. As it
happens, there are cases, like the one above, where traits can indeed be
returned, so valid code was being rejected.

Fix (but not close) #80207.

3 years agoRollup merge of #80394 - RalfJung:const-err-future, r=oli-obk
Mara Bos [Wed, 3 Feb 2021 17:51:12 +0000 (18:51 +0100)]
Rollup merge of #80394 - RalfJung:const-err-future, r=oli-obk

make const_err a future incompat lint

This is the first step for https://github.com/rust-lang/rust/issues/71800: make const_err a future-incompat lint. I also rewrote the const_err lint description as the old one seemed wrong.

This has the unfortunate side-effect of making const-eval error even more verbose by making the const_err message longer without fixing the redundancy caused by additionally emitting an error on each use site of the constant. We cannot fix that redundancy until const_err is a *hard* error (at that point the error-on-use-site can be turned into a `delay_span_bug!` for uses of monomorphic consts, and into a nicely rendered error for [lazily / post-monomorhization evaluated] associated consts).

~~The one annoying effect of this PR is that `let _x = &(1/(1-1));` now also shows the future-incompat warning, even though of course we will *not* make this a hard error. We'll instead (hopefully) stop promoting it -- see https://github.com/rust-lang/rfcs/pull/3027. The only way I see to avoid the future-incompat warning is to use a different lint for "failure to evaluate promoted".~~

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

3 years agoFix non-existent-field ICE for generic fields.
Mara Bos [Wed, 3 Feb 2021 17:36:48 +0000 (18:36 +0100)]
Fix non-existent-field ICE for generic fields.

Co-authored-by: eddyb <eddyb@lyken.rs>
3 years agoFix panic when emitting diagnostic for closure mutable binding error
Aaron Hill [Wed, 3 Feb 2021 17:33:27 +0000 (12:33 -0500)]
Fix panic when emitting diagnostic for closure mutable binding error

Fixes #81700

The upvar borrow kind may be `ty::BorrowKind::UniqueImmBorrow`, which is
still a mutable borrow for the purposes of this diagnostic code.

3 years agoReduce tab formatting assertions to debug only
J. Ryan Stinnett [Wed, 3 Feb 2021 17:17:15 +0000 (17:17 +0000)]
Reduce tab formatting assertions to debug only

The tab replacement for diagnostics added in #79757 included a few assertions to
ensure all tab characters are handled appropriately. We've started getting
reports of these assertions firing (#81614). Since it's only a cosmetic issue,
this downgrades the assertions to debug only, so we at least continue compiling
even if the diagnostics might be a tad wonky.

Fixes #81614

3 years agoRemove incorrect `delay_span_bug`
Esteban Küber [Fri, 29 Jan 2021 19:47:47 +0000 (11:47 -0800)]
Remove incorrect `delay_span_bug`

The following code is supposed to compile

```rust
use std::ops::BitOr;

pub trait IntWrapper {
    type InternalStorage;
}

impl<T> BitOr for dyn IntWrapper<InternalStorage = T>
where
    Self: Sized,
    T: BitOr + BitOr<Output = T>,
{
    type Output = Self;
    fn bitor(self, _other: Self) -> Self {
        todo!()
    }
}
```

Before this change it would ICE. In #70998 the removed logic was added
to provide better suggestions, and the `delay_span_bug` guard was added
to  protect against a potential logic error when returning traits. As it
happens, there are cases, like the one above, where traits can indeed be
returned, so valid code was being rejected.

Fix #80207.

3 years agoAdd more information to the error code for 'crate not found'
Joshua Nelson [Tue, 2 Feb 2021 20:48:50 +0000 (15:48 -0500)]
Add more information to the error code for 'crate not found'

This comes up a lot when bootstrapping.

3 years agoStabilize the Wake trait
Yoshua Wuyts [Fri, 22 Jan 2021 17:06:26 +0000 (18:06 +0100)]
Stabilize the Wake trait

Co-Authored-By: Ashley Mannix <kodraus@hey.com>
3 years agoadd #[inline] to all the public IpAddr functions
Ben Kimock [Wed, 3 Feb 2021 15:53:25 +0000 (10:53 -0500)]
add #[inline] to all the public IpAddr functions

3 years agoRestore comment as it was
Ingvar Stepanyan [Wed, 3 Feb 2021 15:46:57 +0000 (15:46 +0000)]
Restore comment as it was

3 years agoKeep old symlink; expose new symlink_path
Ingvar Stepanyan [Wed, 3 Feb 2021 15:45:30 +0000 (15:45 +0000)]
Keep old symlink; expose new symlink_path

3 years agoOsStr eq_ignore_ascii_case takes arg by value
Tyler Ruckinger [Wed, 3 Feb 2021 15:28:51 +0000 (10:28 -0500)]
OsStr eq_ignore_ascii_case takes arg by value

Per a comment on #70516 this changes `eq_ignore_ascii_case` to take the generic parameter `S: AsRef<OsStr>` by value instead of by reference.

This is technically a breaking change to an unstable method. I think the only way it would break is if you called this method with an explicit type parameter, ie `my_os_str.eq_ignore_ascii_case::<str>("foo")` becomes `my_os_str.eq_ignore_ascii_case::<&str>("foo")`.

Besides that, I believe it is overall more flexible since it can now take an owned `OsString` for example.

If this change should be made in some other PR (like #80193) then please just close this.

3 years agoAuto merge of #81294 - pnkfelix:issue-81211-use-ufcs-in-derive-debug, r=oli-obk
bors [Wed, 3 Feb 2021 15:12:19 +0000 (15:12 +0000)]
Auto merge of #81294 - pnkfelix:issue-81211-use-ufcs-in-derive-debug, r=oli-obk

Use ufcs in derive(Debug)

Cc #81211.

(Arguably this *is* the fix for it.)

3 years agomake const_err a future incompat lint
Ralf Jung [Sat, 30 Jan 2021 13:49:22 +0000 (14:49 +0100)]
make const_err a future incompat lint

3 years agoAuto merge of #81699 - jethrogb:fix-81531, r=petrochenkov
bors [Wed, 3 Feb 2021 11:42:09 +0000 (11:42 +0000)]
Auto merge of #81699 - jethrogb:fix-81531, r=petrochenkov

Really fix early lints inside an async desugaring

Fixes #81531

cc `@Aaron1011`

r? `@petrochenkov`

3 years agoReally fix early lints inside an async desugaring
Jethro Beekman [Wed, 3 Feb 2021 08:40:59 +0000 (09:40 +0100)]
Really fix early lints inside an async desugaring

3 years agoAuto merge of #81694 - GuillaumeGomez:rollup-odg6xqi, r=GuillaumeGomez
bors [Wed, 3 Feb 2021 08:59:27 +0000 (08:59 +0000)]
Auto merge of #81694 - GuillaumeGomez:rollup-odg6xqi, r=GuillaumeGomez

Rollup of 4 pull requests

Successful merges:

 - #81144 (Fixed formatting typo in map_while docs)
 - #81573 (Add some links to the cell docs.)
 - #81679 (Bind all clean::Type variants and remove FIXME)
 - #81681 (Better styling of "Switch result tab" shortcut)

Failed merges:

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

3 years agoRollup merge of #81681 - Smittyvb:rustdoc-shortcuts-styling, r=GuillaumeGomez
Guillaume Gomez [Wed, 3 Feb 2021 07:41:28 +0000 (08:41 +0100)]
Rollup merge of #81681 - Smittyvb:rustdoc-shortcuts-styling, r=GuillaumeGomez

Better styling of "Switch result tab" shortcut

Before:
![](https://user-images.githubusercontent.com/10530973/106663877-544de400-6572-11eb-98a4-77b6b3d9cd42.png)
![image](https://user-images.githubusercontent.com/10530973/106664790-8d3a8880-6573-11eb-811f-29c4ade31848.png)

After:
![](https://user-images.githubusercontent.com/10530973/106663945-6b8cd180-6572-11eb-911a-12c69d935ee5.png)
![](https://user-images.githubusercontent.com/10530973/106664403-05547e80-6573-11eb-84bf-fdd0dfc7dac8.png)

3 years agoRollup merge of #81679 - GuillaumeGomez:clean-fixme-match-bind, r=poliorcetics,CraftS...
Guillaume Gomez [Wed, 3 Feb 2021 07:41:26 +0000 (08:41 +0100)]
Rollup merge of #81679 - GuillaumeGomez:clean-fixme-match-bind, r=poliorcetics,CraftSpider

Bind all clean::Type variants and remove FIXME

This is simply a little cleanup.

cc `@CraftSpider`
r? `@poliorcetics`

3 years agoRollup merge of #81573 - ehuss:cell-links, r=jackh726
Guillaume Gomez [Wed, 3 Feb 2021 07:41:24 +0000 (08:41 +0100)]
Rollup merge of #81573 - ehuss:cell-links, r=jackh726

Add some links to the cell docs.

This adds a few links to the cell module docs to make it a little easier to navigate to the types and functions it references.

3 years agoRollup merge of #81144 - nhwn:typo-map-while, r=jackh726
Guillaume Gomez [Wed, 3 Feb 2021 07:41:22 +0000 (08:41 +0100)]
Rollup merge of #81144 - nhwn:typo-map-while, r=jackh726

Fixed formatting typo in map_while docs

changes `` ` None` `` to ``[`None`]`` for consistency

3 years agoAuto merge of #81346 - hug-dev:nonsecure-call-abi, r=jonas-schievink
bors [Wed, 3 Feb 2021 06:00:43 +0000 (06:00 +0000)]
Auto merge of #81346 - hug-dev:nonsecure-call-abi, r=jonas-schievink

Add a new ABI to support cmse_nonsecure_call

This adds support for the `cmse_nonsecure_call` feature to be able to perform non-secure function call.

See the discussion on Zulip [here](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Support.20for.20callsite.20attributes/near/223054928).

This is a followup to #75810 which added `cmse_nonsecure_entry`. As for that PR, I assume that the changes are small enough to not have to go through a RFC but I don't mind doing one if needed 😃
I did not yet create a tracking issue, but if most of it is fine, I can create one and update the various files accordingly (they refer to the other tracking issue now).

On the Zulip chat, I believe `@jonas-schievink` volunteered to be a reviewer 💯

3 years agoMerge commit '3e4179766bcecd712824da04356621b8df012ea4' into sync-from-clippy
Manish Goregaokar [Wed, 3 Feb 2021 04:43:30 +0000 (20:43 -0800)]
Merge commit '3e4179766bcecd712824da04356621b8df012ea4' into sync-from-clippy

3 years agoAuto merge of #6667 - Manishearth:rustup, r=Manishearth
bors [Wed, 3 Feb 2021 04:09:03 +0000 (04:09 +0000)]
Auto merge of #6667 - Manishearth:rustup, r=Manishearth

Rustup

Pulling in AST changes

changelog: none

3 years agoMerge branch 'sync-from-rust3' into rustup
Manish Goregaokar [Wed, 3 Feb 2021 03:57:31 +0000 (19:57 -0800)]
Merge branch 'sync-from-rust3' into rustup

3 years agoRun rustfmt
Manish Goregaokar [Wed, 3 Feb 2021 03:57:08 +0000 (19:57 -0800)]
Run rustfmt

3 years agoRustup
Manish Goregaokar [Wed, 3 Feb 2021 01:35:39 +0000 (17:35 -0800)]
Rustup

3 years agobless the coverage-spanview output. Cc #81688.
Felix S. Klock II [Wed, 3 Feb 2021 03:22:35 +0000 (22:22 -0500)]
bless the coverage-spanview output. Cc #81688.

3 years agoAuto merge of #81535 - nikic:update-test-various, r=sanxiyn
bors [Wed, 3 Feb 2021 03:03:08 +0000 (03:03 +0000)]
Auto merge of #81535 - nikic:update-test-various, r=sanxiyn

Update test-various to Ubuntu 20.04

The test command-setgroups.rs is adjusted to skip on musl, where `sysconf(_SC_NGROUPS_MAX)` always returns a dummy value of 32, even though the actual value is 65536. I'm not sure why this only became a problem now, as the information I found indicates that this value changed in kernel version 2.6.4, which is ages ago.

I'm a bit unsure whether this one will go through, because I locally also saw a failure in std-backtrace.rs which went away on subsequent runs, and also had port assignment failures, but I think those might be on my side. I'm kind of curious how the code in https://github.com/rust-lang/rust/blob/b122908617436af187252572ed5db96850551380/library/std/src/net/test.rs#L43-L56 is supposed to work, as the directory names it checks don't seem to appear anywhere else.

r? `@Mark-Simulacrum`

3 years agoUse `# min-llvm-version: 11.0` to force a minimum LLVM version, rather than ad-hoc...
Felix S. Klock II [Wed, 3 Feb 2021 02:53:30 +0000 (21:53 -0500)]
Use `# min-llvm-version: 11.0` to force a minimum LLVM version, rather than ad-hoc internal solution.

In particular: the specific code to define LLVM_VERSION_11_PLUS here was, for
some reason, using `$(shell ...)` with bash-specific variable replacement code.
On non-bash platforms like dash, that `shell` invocation would fail, and the
LLVM_VERSION_11_PLUS check would always fail, the test would always be ignored,
and thus be treated as a "success" (in the sense that `--bless` would never do
anything).

This was causing me a lot of pain.

3 years agoMerge remote-tracking branch 'origin/master' into rustup
Manish Goregaokar [Wed, 3 Feb 2021 00:46:12 +0000 (16:46 -0800)]
Merge remote-tracking branch 'origin/master' into rustup

3 years agoAdd additional benchmarks to bit_set
kadmin [Tue, 2 Feb 2021 21:44:32 +0000 (21:44 +0000)]
Add additional benchmarks to bit_set

3 years agointroduce future-compatibility warning for forbidden lint groups
Niko Matsakis [Sat, 30 Jan 2021 00:06:00 +0000 (19:06 -0500)]
introduce future-compatibility warning for forbidden lint groups

We used to ignore `forbid(group)` scenarios completely. This changed
in #78864, but that led to a number of regressions (#80988, #81218).

This PR introduces a future compatibility warning for the case where
a group is forbidden but then an individual lint within that group
is allowed. We now issue a FCW when we see the "allow", but permit
it to take effect.

3 years agoAuto merge of #81678 - jackh726:rollup-3nerni4, r=jackh726
bors [Tue, 2 Feb 2021 23:15:22 +0000 (23:15 +0000)]
Auto merge of #81678 - jackh726:rollup-3nerni4, r=jackh726

Rollup of 14 pull requests

Successful merges:

 - #80593 (Upgrade Chalk)
 - #81260 (Add .editorconfig)
 - #81455 (Add AArch64 big-endian and ILP32 targets)
 - #81517 (Remove remnants of the santizer runtime crates from bootstrap)
 - #81530 (sys: use `process::abort()` instead of `arch::wasm32::unreachable()`)
 - #81544 (Add better diagnostic for unbounded Abst. Const)
 - #81588 (Add doc aliases for "delete")
 - #81603 (rustbuild: Don't build compiler twice for error-index-generator.)
 - #81634 (Add long explanation e0521)
 - #81636 (Directly use `Option<&[T]>` instead of converting from `Option<&Vec<T>>` later on)
 - #81647 (Fix bug with assert!() calling the wrong edition of panic!().)
 - #81655 (Improve wording of suggestion about accessing field)
 - #81665 (Fix out of date `Scalar` documentation)
 - #81671 (Add more associated type tests)

Failed merges:

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

3 years agoBetter styling of "Switch result tab" shortcut
Smitty [Tue, 2 Feb 2021 21:15:57 +0000 (16:15 -0500)]
Better styling of "Switch result tab" shortcut

3 years agoBind all clean::Type variants and remove FIXME
Guillaume Gomez [Tue, 2 Feb 2021 21:07:23 +0000 (22:07 +0100)]
Bind all clean::Type variants and remove FIXME

3 years agoRollup merge of #81671 - jackh726:atb-tests, r=estebank
Jack Huey [Tue, 2 Feb 2021 21:01:50 +0000 (16:01 -0500)]
Rollup merge of #81671 - jackh726:atb-tests, r=estebank

Add more associated type tests

Closes #24159
Closes #37808
Closes #39532
Closes #37883

r? ``@estebank``

3 years agoRollup merge of #81665 - jacob-hughes:mir_doc_fix, r=estebank
Jack Huey [Tue, 2 Feb 2021 21:01:49 +0000 (16:01 -0500)]
Rollup merge of #81665 - jacob-hughes:mir_doc_fix, r=estebank

Fix out of date `Scalar` documentation

Scalars can represent integers up to `u128`, but the docs state otherwise.

3 years agoRollup merge of #81655 - matsujika:suggest-accessing-field-rewording, r=estebank
Jack Huey [Tue, 2 Feb 2021 21:01:48 +0000 (16:01 -0500)]
Rollup merge of #81655 - matsujika:suggest-accessing-field-rewording, r=estebank

Improve wording of suggestion about accessing field

Follow-up to #81504

The compiler at this moment suggests "you might have meant to use field `b` of type `B`", sounding like it's type `B` which has the field `b`.
r? ```@estebank```

3 years agoRollup merge of #81647 - m-ou-se:assert-2021-fix, r=petrochenkov
Jack Huey [Tue, 2 Feb 2021 21:01:46 +0000 (16:01 -0500)]
Rollup merge of #81647 - m-ou-se:assert-2021-fix, r=petrochenkov

Fix bug with assert!() calling the wrong edition of panic!().

The span of `panic!` produced by the `assert` macro did not carry the right edition. This changes `assert` to call the right version.

Also adds tests for the 2021 edition of panic and assert, that would've caught this.

3 years agoRollup merge of #81636 - LingMan:slice_not_vec, r=petrochenkov
Jack Huey [Tue, 2 Feb 2021 21:01:45 +0000 (16:01 -0500)]
Rollup merge of #81636 - LingMan:slice_not_vec, r=petrochenkov

Directly use `Option<&[T]>` instead of converting from `Option<&Vec<T>>` later on

```@rustbot``` modify labels +C-cleanup +T-compiler

3 years agoRollup merge of #81634 - jesusprubio:jesusprubio/add-long-explanation-e0521, r=Guilla...
Jack Huey [Tue, 2 Feb 2021 21:01:44 +0000 (16:01 -0500)]
Rollup merge of #81634 - jesusprubio:jesusprubio/add-long-explanation-e0521, r=GuillaumeGomez

Add long explanation e0521

Helps with #61137

3 years agoRollup merge of #81603 - ehuss:error-index-build, r=Mark-Simulacrum
Jack Huey [Tue, 2 Feb 2021 21:01:42 +0000 (16:01 -0500)]
Rollup merge of #81603 - ehuss:error-index-build, r=Mark-Simulacrum

rustbuild: Don't build compiler twice for error-index-generator.

When using `--stage=1`, the error-index-generator was forcing the compiler to be built twice.  This isn't necessary; the error-index-generator just needs the same unusual logic that rustdoc uses to build with stage minus one.

`--stage=0` and `--stage=2` should be unaffected by this change.

cc #76371