]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agorustdoc: avoid including impl blocks with filled-in generics
Michael Howell [Wed, 18 May 2022 00:27:14 +0000 (17:27 -0700)]
rustdoc: avoid including impl blocks with filled-in generics

Fixes #94937

2 years agoAuto merge of #96959 - nbdd0121:unwind, r=Amanieu
bors [Tue, 17 May 2022 15:04:50 +0000 (15:04 +0000)]
Auto merge of #96959 - nbdd0121:unwind, r=Amanieu

Prevent unwinding when `-C panic=abort` is used regardless declared ABI

Ensures that Rust code will abort with `-C panic=abort` regardless ABI used.
```rust
extern "C-unwind" {
    fn may_unwind();
}

// Will be nounwind with `-C panic=abort`, despite `C-unwind` ABI.
pub unsafe extern "C-unwind" fn rust_item_that_can_unwind() {
    may_unwind();
}
```

Current behaviour is that unwind will propagate through. While the current behaviour won't cause unsoundness it is inconsistent with the text reading of [RFC2945](https://rust-lang.github.io/rfcs/2945-c-unwind-abi.html).

I tweaked `fn_can_unwind` instead of tweaking `AbortUnwindingCalls` because this approach would allow Rust (non-direct) callers to also see that this function is nounwind, so it can prevent excessive landing pads generation.

For more discussions: https://rust-lang.zulipchat.com/#narrow/stream/210922-project-ffi-unwind/topic/soundness.20in.20mixed.20panic.20mode.

cc `@alexcrichton,` `@BatmanAoD`
r? `@Amanieu`

`@rustbot` label: T-compiler T-lang F-c_unwind

2 years agoAuto merge of #97111 - JohnTitor:rollup-x3vjf6u, r=JohnTitor
bors [Tue, 17 May 2022 12:01:12 +0000 (12:01 +0000)]
Auto merge of #97111 - JohnTitor:rollup-x3vjf6u, r=JohnTitor

Rollup of 7 pull requests

Successful merges:

 - #96329 (Add a couple tests for #90887 fixes)
 - #97009 (Allow `unused_macro_rules` in path tests)
 - #97075 (Add regression test for #81804)
 - #97079 (Change `Successors` to `impl Iterator<Item = BasicBlock>`)
 - #97080 (remove the `RelateResultCompare` trait)
 - #97093 (Migrate `maybe_recover_from_bad_type_plus` diagnostic)
 - #97102 (Update function pointer call error message)

Failed merges:

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

2 years agoRollup merge of #97102 - mbartlett21:fn-pointer-error, r=lcnr
Yuki Okushi [Tue, 17 May 2022 10:01:35 +0000 (19:01 +0900)]
Rollup merge of #97102 - mbartlett21:fn-pointer-error, r=lcnr

Update function pointer call error message

It now uses the type of context. (fixes #97082)

2 years agoRollup merge of #97093 - pvdrz:migrate-maybe-recover-from-bad-type-plus, r=davidtwco
Yuki Okushi [Tue, 17 May 2022 10:01:34 +0000 (19:01 +0900)]
Rollup merge of #97093 - pvdrz:migrate-maybe-recover-from-bad-type-plus, r=davidtwco

Migrate `maybe_recover_from_bad_type_plus` diagnostic

r? `@davidtwco`

2 years agoRollup merge of #97080 - lcnr:relate-sus, r=oli-obk
Yuki Okushi [Tue, 17 May 2022 10:01:33 +0000 (19:01 +0900)]
Rollup merge of #97080 - lcnr:relate-sus, r=oli-obk

remove the `RelateResultCompare` trait

it's unused

2 years agoRollup merge of #97079 - SparrowLii:successors, r=lcnr
Yuki Okushi [Tue, 17 May 2022 10:01:32 +0000 (19:01 +0900)]
Rollup merge of #97079 - SparrowLii:successors, r=lcnr

Change `Successors` to `impl Iterator<Item = BasicBlock>`

This PR fixes the FIXME in `compiler\rustc_middle\src\mir\mod.rs`.
This can omit several `&`, `*` or `cloned` operations on Successros' generated elements

2 years agoRollup merge of #97075 - JohnTitor:issue-81804, r=compiler-errors
Yuki Okushi [Tue, 17 May 2022 10:01:31 +0000 (19:01 +0900)]
Rollup merge of #97075 - JohnTitor:issue-81804, r=compiler-errors

Add regression test for #81804

Closes #81804
r? ``@compiler-errors``

2 years agoRollup merge of #97009 - fortanix:raoul/unused_macro_sgx, r=thomcc
Yuki Okushi [Tue, 17 May 2022 10:01:30 +0000 (19:01 +0900)]
Rollup merge of #97009 - fortanix:raoul/unused_macro_sgx, r=thomcc

Allow `unused_macro_rules` in path tests

PR #96150 adds a new lint to warn about unused macro rules (arms/matchers). This causes errors in `library/std/src/path/tests.rs` on the `x86_64-fortanix-unknown-sgx` platform. This PR fixes compilation errors on that platform by allowing unused macro rules.

2 years agoRollup merge of #96329 - aliemjay:fixed-by-90887, r=jackh726
Yuki Okushi [Tue, 17 May 2022 10:01:29 +0000 (19:01 +0900)]
Rollup merge of #96329 - aliemjay:fixed-by-90887, r=jackh726

Add a couple tests for #90887 fixes

closes #56556
closes #90875

These are confirmed fixes by #90887, so
r? ``@jackh726``

2 years agoAuto merge of #97012 - oli-obk:🦀_intrinsics, r=davidtwco
bors [Tue, 17 May 2022 09:39:26 +0000 (09:39 +0000)]
Auto merge of #97012 - oli-obk:🦀_intrinsics, r=davidtwco

Add a query for checking whether a function is an intrinsic.

work towards #93145

This will reduce churn when we add more ways to declare intrinsics

r? `@scottmcm`

2 years agoAdd a test for fn pointer calls in consts
mbartlett21 [Tue, 17 May 2022 07:24:47 +0000 (07:24 +0000)]
Add a test for fn pointer calls in consts

2 years agoAuto merge of #96825 - kckeiks:remove-item-like-visitor-trait, r=cjgillot
bors [Tue, 17 May 2022 06:51:45 +0000 (06:51 +0000)]
Auto merge of #96825 - kckeiks:remove-item-like-visitor-trait, r=cjgillot

 Retire `ItemLikeVisitor` trait

Issue #95004
cc `@cjgillot`

2 years agoAuto merge of #96907 - sunfishcode:sunfishcode/update-wasi, r=Mark-Simulacrum
bors [Tue, 17 May 2022 04:37:47 +0000 (04:37 +0000)]
Auto merge of #96907 - sunfishcode:sunfishcode/update-wasi, r=Mark-Simulacrum

Update the wasi toolchain.

Update the WASI build to LLVM 14.0 and the wasi-libc version from wasi-sdk-15.

This will require a ci-mirrors.rust-lang.org file load. Specifically, we
need [this LLVM release tarball] uploaded to be downloadable from
[this URL].

[this LLVM release tarball]: https://github.com/llvm/llvm-project/releases/download/llvmorg-14.0.0/clang+llvm-14.0.0-x86_64-linux-gnu-ubuntu-18.04.tar.xz
[this URL]: https://ci-mirrors.rust-lang.org/rustc/2022-05-10-clang%2Bllvm-14.0.0-x86_64-linux-gnu-ubuntu-18.04.tar.xz

2 years agoUpdate function pointer call error message
mbartlett21 [Tue, 17 May 2022 04:11:18 +0000 (04:11 +0000)]
Update function pointer call error message

It now uses the type of context. (issue 97082)

2 years agokeep bounds where they were
Christian Poveda [Tue, 17 May 2022 03:23:32 +0000 (22:23 -0500)]
keep bounds where they were

2 years agoAuto merge of #96892 - oli-obk:🐌_obligation_cause_code_🐌, r=estebank
bors [Tue, 17 May 2022 01:46:25 +0000 (01:46 +0000)]
Auto merge of #96892 - oli-obk:🐌_obligation_cause_code_🐌, r=estebank

Clean up derived obligation creation

r? `@estebank`

working on fixing the perf regression from https://github.com/rust-lang/rust/pull/91030#issuecomment-1083360210

2 years agoChange `Successors` to `impl Iterator<Item = BasicBlock>`
SparrowLii [Tue, 17 May 2022 00:41:01 +0000 (08:41 +0800)]
Change `Successors` to `impl Iterator<Item = BasicBlock>`

2 years agoAuto merge of #96713 - petrochenkov:doclink8, r=notriddle
bors [Mon, 16 May 2022 23:01:28 +0000 (23:01 +0000)]
Auto merge of #96713 - petrochenkov:doclink8, r=notriddle

rustdoc: Resolve some more doc links early 2

The subset of https://github.com/rust-lang/rust/pull/94857 that shouldn't be too expensive.

2 years agomigrate `maybe_recover_from_bad_type_plus` diagnostic
Christian Poveda [Mon, 16 May 2022 22:16:27 +0000 (17:16 -0500)]
migrate `maybe_recover_from_bad_type_plus` diagnostic

2 years agorustdoc: Resolve some more doc links early
Vadim Petrochenkov [Tue, 1 Feb 2022 12:30:32 +0000 (20:30 +0800)]
rustdoc: Resolve some more doc links early

2 years agoAuto merge of #96676 - petrochenkov:docrules, r=GuillaumeGomez
bors [Mon, 16 May 2022 13:53:40 +0000 (13:53 +0000)]
Auto merge of #96676 - petrochenkov:docrules, r=GuillaumeGomez

rustdoc: Remove doc link resolution fallback to all `macro_rules` in the crate

This is a deny-by-default lint detecting such fallback for crater run, as discussed in https://github.com/rust-lang/rust/pull/96521.

2 years agoremove the `RelateResultCompare` trait
lcnr [Mon, 16 May 2022 13:41:05 +0000 (15:41 +0200)]
remove the `RelateResultCompare` trait

2 years agoForce inline InternedObligationCauseCode creation
Oli Scherer [Mon, 16 May 2022 13:34:03 +0000 (13:34 +0000)]
Force inline InternedObligationCauseCode creation

2 years agoUpdate how CC etc. are set in the wasi-libc Makefile.
Dan Gohman [Mon, 16 May 2022 12:07:28 +0000 (05:07 -0700)]
Update how CC etc. are set in the wasi-libc Makefile.

wasi-libc's Makefile changed how it detects the compiler to use; update
Rust's script to set `CC` directly to the compiler it installs.

2 years agoAdd regression test for #81804
Yuki Okushi [Mon, 16 May 2022 10:34:30 +0000 (19:34 +0900)]
Add regression test for #81804

2 years agoAdd a query for checking whether a function is an intrinsic.
Oli Scherer [Fri, 13 May 2022 13:50:21 +0000 (13:50 +0000)]
Add a query for checking whether a function is an intrinsic.

2 years agoAllow `unused_macro_rules` in path tests
Raoul Strackx [Fri, 13 May 2022 12:08:32 +0000 (14:08 +0200)]
Allow `unused_macro_rules` in path tests

2 years agoAuto merge of #97053 - CAD97:realloc-clarification, r=dtolnay
bors [Mon, 16 May 2022 02:33:34 +0000 (02:33 +0000)]
Auto merge of #97053 - CAD97:realloc-clarification, r=dtolnay

Remove potentially misleading realloc parenthetical

This parenthetical is problematic, because it suggests that the following is sound:

```rust
let layout = Layout::new::<[u8; 32]>();
let p1 = alloc(layout);
let p2 = realloc(p1, layout, 32);
if p1 == p2 {
    p1.write([0; 32]);
    dealloc(p1, layout);
} else {
    dealloc(p2, layout);
}
```

At the very least, this isn't the case for [ANSI `realloc`](https://en.cppreference.com/w/c/memory/realloc)

> The original pointer `ptr` is invalidated and any access to it is undefined behavior (even if reallocation was in-place).

and [Windows `HeapReAlloc`](https://docs.microsoft.com/en-us/windows/win32/api/heapapi/nf-heapapi-heaprealloc) is unclear at best (`HEAP_REALLOC_IN_PLACE_ONLY`'s description may imply that the old pointer may be used if `HEAP_REALLOC_IN_PLACE_ONLY` is provided).

The conservative position is to just remove the parenthetical.

cc `@rust-lang/wg-unsafe-code-guidelines` `@rust-lang/wg-allocators`

2 years agoAuto merge of #97065 - gabriel-doriath-dohler:master, r=joshtriplett
bors [Mon, 16 May 2022 00:12:06 +0000 (00:12 +0000)]
Auto merge of #97065 - gabriel-doriath-dohler:master, r=joshtriplett

Rename `eq_ignore_case` to `starts_with_ignore_case`

The method doesn't test for equality. It tests if the object starts with
a given byte array, so its name is confusing.

2 years agoRename `eq_ignore_case` to `starts_with_ignore_case`
gabriel-doriath-dohler [Sun, 15 May 2022 23:59:59 +0000 (23:59 +0000)]
Rename `eq_ignore_case` to `starts_with_ignore_case`

The method doesn't test for equality. It tests if the object starts with
a given byte array, so its name is confusing.

2 years agoAuto merge of #97057 - bjorn3:sync_cg_clif-2022-05-15, r=bjorn3
bors [Sun, 15 May 2022 21:17:46 +0000 (21:17 +0000)]
Auto merge of #97057 - bjorn3:sync_cg_clif-2022-05-15, r=bjorn3

Sync rustc_codegen_cranelift

Since the last sync there have mostly been fixes of various sorts. I also changed cg_clif from using a custom driver to `-Zcodegen-backend` when built as separate project. When built as part of rust it was already using `-Zcodegen-backend`.

r? `@ghost`

`@rustbot` label +A-codegen +A-cranelift +T-compiler

2 years agoAuto merge of #97063 - Dylan-DPC:rollup-u5el7hb, r=Dylan-DPC
bors [Sun, 15 May 2022 18:52:28 +0000 (18:52 +0000)]
Auto merge of #97063 - Dylan-DPC:rollup-u5el7hb, r=Dylan-DPC

Rollup of 4 pull requests

Successful merges:

 - #96947 (Add rustc_nonnull_optimization_guaranteed to Owned/Borrowed Fd/Socket)
 - #97021 (Added note in documentation)
 - #97042 (Add new eslint rule about brace style)
 - #97060 (Fix use of SetHandleInformation on UWP)

Failed merges:

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

2 years agorustdoc: Remove doc link resolution fallback to all `macro_rules` in the crate
Vadim Petrochenkov [Sun, 15 May 2022 17:05:52 +0000 (20:05 +0300)]
rustdoc: Remove doc link resolution fallback to all `macro_rules` in the crate

2 years agoRollup merge of #97060 - bdbai:fix/uwphandle, r=ChrisDenton
Dylan DPC [Sun, 15 May 2022 16:41:27 +0000 (18:41 +0200)]
Rollup merge of #97060 - bdbai:fix/uwphandle, r=ChrisDenton

Fix use of SetHandleInformation on UWP

The use of `SetHandleInformation` (introduced in #96441 to make `HANDLE` inheritable) breaks UWP builds because it is not available for UWP targets.

Proposed workaround: duplicate the `HANDLE` with `inherit = true` and immediately close the old one. Traditional Windows Desktop programs are not affected.

cc `@ChrisDenton`

2 years agoRollup merge of #97042 - GuillaumeGomez:eslint-brace-style, r=notriddle
Dylan DPC [Sun, 15 May 2022 16:41:26 +0000 (18:41 +0200)]
Rollup merge of #97042 - GuillaumeGomez:eslint-brace-style, r=notriddle

Add new eslint rule about brace style

It also prevents one liners.

r? `@notriddle`

2 years agoRollup merge of #97021 - Volker-Weissmann:patch-1, r=Dylan-DPC
Dylan DPC [Sun, 15 May 2022 16:41:26 +0000 (18:41 +0200)]
Rollup merge of #97021 - Volker-Weissmann:patch-1, r=Dylan-DPC

Added note in documentation

I added this note, because if you forget the `--target` flags, you get a really ugly error message.
https://github.com/rust-lang/cargo/issues/10666

2 years agoRollup merge of #96947 - sunfishcode:sunfishcode/rustc-nonnull-optimization-guarantee...
Dylan DPC [Sun, 15 May 2022 16:41:25 +0000 (18:41 +0200)]
Rollup merge of #96947 - sunfishcode:sunfishcode/rustc-nonnull-optimization-guaranteed, r=joshtriplett

Add rustc_nonnull_optimization_guaranteed to Owned/Borrowed Fd/Socket

PR #94586 added support for using
`rustc_nonnull_optimization_guaranteed` on values where the "null" value
is the all-ones bitpattern.

Now that #94586 has made it to the stage0 compiler, add
`rustc_nonnull_optimization_guaranteed` to `OwnedFd`, `BorrowedFd`,
`OwnedSocket`, and `BorrowedSocket`, since these types all exclude
all-ones bitpatterns.

This allows `Option<OwnedFd>`, `Option<BorrowedFd>`, `Option<OwnedSocket>`,
and `Option<BorrowedSocket>` to be used in FFI declarations, as described
in the [I/O safety RFC].

[I/O safety RFC]: https://github.com/rust-lang/rfcs/blob/master/text/3128-io-safety.md#ownedfd-and-borrowedfdfd-1

2 years agoAuto merge of #96895 - SparrowLii:interval, r=Mark-Simulacrum
bors [Sun, 15 May 2022 16:27:43 +0000 (16:27 +0000)]
Auto merge of #96895 - SparrowLii:interval, r=Mark-Simulacrum

optimize `insert_range` method of `IntervalSet`

This PR fixes the FIXME in the `insert_range` method that avoids recurse calculations when overlaping

2 years agoAuto merge of #97056 - RalfJung:miri, r=RalfJung
bors [Sun, 15 May 2022 13:46:54 +0000 (13:46 +0000)]
Auto merge of #97056 - RalfJung:miri, r=RalfJung

update miri

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

2 years agofix use of SetHandleInformation on UWP
bdbai [Sun, 15 May 2022 13:15:45 +0000 (21:15 +0800)]
fix use of SetHandleInformation on UWP

2 years agoAdd new eslint rule about brace style
Guillaume Gomez [Sat, 14 May 2022 11:50:52 +0000 (13:50 +0200)]
Add new eslint rule about brace style

2 years agoupdate miri
Ralf Jung [Sun, 15 May 2022 11:37:04 +0000 (13:37 +0200)]
update miri

2 years agoAuto merge of #96885 - petrochenkov:linkstrict2, r=cjgillot,luqmana
bors [Sun, 15 May 2022 11:19:27 +0000 (11:19 +0000)]
Auto merge of #96885 - petrochenkov:linkstrict2, r=cjgillot,luqmana

rustc: Stricter checking for #[link] attributes

A subset of https://github.com/rust-lang/rust/pull/94962 that doesn't touch library renaming/reordering/deduplication.

`#[link]` attributes are checked for all kinds of unexpected arguments inside them.
I also tried to make wording for these errors more consistent, that's why some existing errors are changed, including errors for command line `-l` options.
Spans are also made more precise where possible.

2 years agoMerge commit '63734fcdd718cca089f84c42f3a42c0096cfd431' into sync_cg_clif-2022-05-15
bjorn3 [Sun, 15 May 2022 10:32:19 +0000 (12:32 +0200)]
Merge commit '63734fcdd718cca089f84c42f3a42c0096cfd431' into sync_cg_clif-2022-05-15

2 years agoRustup to rustc 1.62.0-nightly (70b3681bf 2022-05-14)
bjorn3 [Sun, 15 May 2022 10:22:00 +0000 (12:22 +0200)]
Rustup to rustc 1.62.0-nightly (70b3681bf 2022-05-14)

2 years agoSync from rust e1ec3260d79497080ca86540562d410ba67d2a95
bjorn3 [Sun, 15 May 2022 10:25:32 +0000 (12:25 +0200)]
Sync from rust e1ec3260d79497080ca86540562d410ba67d2a95

2 years agoAuto merge of #97055 - matthiaskrgr:rollup-1nqwfzx, r=matthiaskrgr
bors [Sun, 15 May 2022 07:32:58 +0000 (07:32 +0000)]
Auto merge of #97055 - matthiaskrgr:rollup-1nqwfzx, r=matthiaskrgr

Rollup of 3 pull requests

Successful merges:

 - #96958 (Improve settings menu display and remove theme menu)
 - #97032 (Allow the unused_macro_rules lint for now)
 - #97041 (Fix `download-ci-llvm` NixOS patching for `.so`s.)

Failed merges:

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

2 years agoRollup merge of #97041 - eddyb:nixos-llvm-ci-patchelf, r=Mark-Simulacrum
Matthias Krüger [Sun, 15 May 2022 06:10:44 +0000 (08:10 +0200)]
Rollup merge of #97041 - eddyb:nixos-llvm-ci-patchelf, r=Mark-Simulacrum

Fix `download-ci-llvm` NixOS patching for `.so`s.

See https://github.com/rust-lang/rust/pull/95170#discussion_r872960686 - in short, `Path::ends_with` doesn't do the same thing as `str::ends_with`, and can only be used to check for whole file names, not extensions.

With this PR, I get the full suite of:
```
extracting /home/eddy/Projects/rust-A/build/cache/llvm-ebb80ec4e90f8622440f3e33562db0d6e6c66555-true/rust-dev-nightly-x86_64-unknown-linux-gnu.tar.xz to /home/eddy/Projects/rust-A/build/x86_64-unknown-linux-gnu/ci-llvm
info: you seem to be using Nix. Attempting to patch /home/eddy/Projects/rust-A/build/x86_64-unknown-linux-gnu/ci-llvm/bin/llvm-config
/nix/store/r4bzq2xilvv8fmqjg626hzwi22ah3hf4-rust-stage0-dependencies
info: you seem to be using Nix. Attempting to patch /home/eddy/Projects/rust-A/build/x86_64-unknown-linux-gnu/ci-llvm/bin/FileCheck
info: you seem to be using Nix. Attempting to patch /home/eddy/Projects/rust-A/build/x86_64-unknown-linux-gnu/ci-llvm/lib/libLLVM-14-rust-1.62.0-nightly.so
```
(that `libLLVM-14-rust-1.62.0-nightly.so` at the end having been missing before)

r? `@Mark-Simulacrum` cc `@jyn514`

2 years agoRollup merge of #97032 - est31:unused_macro_rules, r=petrochenkov
Matthias Krüger [Sun, 15 May 2022 06:10:42 +0000 (08:10 +0200)]
Rollup merge of #97032 - est31:unused_macro_rules, r=petrochenkov

Allow the unused_macro_rules lint for now

It was newly added by #96150 with warn by default, which is great as it gave exposure to the community, and their feedback gave me ideas for improvements.

Allowing the lint is good for two reasons:

* It makes the transition easier as e.g. allow directives won't fire the unknown lint warning once it is turned to warn by default in the future. The [commit that allowed the lint in fuchsia](https://fuchsia.googlesource.com/fuchsia/+/9d8f96517c3963de2f0e25598fd36061914524cd%5E%21/) had to allow unknown lints for example.
This is especially important compared to other lints in the unused group,
because the _ prefix trick doesn't exist for macro rules, allowing is the
only option (either of unused_macro_rules, or of the entire unused group,
but that is not as informative to readers). Allowing the lint also makes it
possible to work on possible heuristics for disabling the macro in specific
cases.
* It gives time for implementing heuristics for when to suppress the lint, e.g.
when `compile_error!` is invoked by that arm (so it's only there to yield an error).

See: https://github.com/rust-lang/rust/pull/96150#issuecomment-1126599107

I would also like this to be backported to the 1.62 beta branch (cc #97016).

2 years agoRollup merge of #96958 - GuillaumeGomez:settings-menu-display, r=jsha
Matthias Krüger [Sun, 15 May 2022 06:10:42 +0000 (08:10 +0200)]
Rollup merge of #96958 - GuillaumeGomez:settings-menu-display, r=jsha

Improve settings menu display and remove theme menu

We talked about improving the settings menu and we mentioned that firefox pocket was a nice inspiration so I implemented it. The result looks like this:

![Screenshot from 2022-05-11 23-59-53](https://user-images.githubusercontent.com/3050060/167954743-438c0a06-4628-478c-bf0c-d20313c1fdfc.png)

You can test it [here](https://rustdoc.crud.net/imperio/settings-menu-display/doc/foo/index.html).

Only question I have is: should I re-assign the shortcut `T` to this setting menu now that the theme menu is gone? For now I simply removed it.

Important to be noted: the full settings page (at `settings.html`) is still rendered the same as currently.

r? ``@jsha``

2 years agoAuto merge of #96602 - TApplencourt:patch-1, r=Mark-Simulacrum
bors [Sun, 15 May 2022 04:52:16 +0000 (04:52 +0000)]
Auto merge of #96602 - TApplencourt:patch-1, r=Mark-Simulacrum

boostrap.py use curl by default

Fixes #61611

2 years agoRemove potentially misleading realloc parenthetical
CAD97 [Sun, 15 May 2022 03:30:14 +0000 (22:30 -0500)]
Remove potentially misleading realloc parenthetical

2 years agoAuto merge of #97016 - Mark-Simulacrum:bump-version, r=Mark-Simulacrum
bors [Sun, 15 May 2022 02:11:35 +0000 (02:11 +0000)]
Auto merge of #97016 - Mark-Simulacrum:bump-version, r=Mark-Simulacrum

Bump to 1.63

r? `@Mark-Simulacrum`

Posting this now, but will only approve later today / early tomorrow to give a little more time for not-yet-approved PRs to land on master (e.g., https://github.com/rust-lang/rust/pull/96970).

2 years agoAuto merge of #96883 - jackh726:early-binder-2, r=oli-obk
bors [Sat, 14 May 2022 23:53:11 +0000 (23:53 +0000)]
Auto merge of #96883 - jackh726:early-binder-2, r=oli-obk

Add EarlyBinder

Chalk has no concept of `Param` (https://github.com/rust-lang/chalk/blob/e0ade19d139bc784384acc6736cd960c91dd55a1/chalk-ir/src/lib.rs#L579) or `ReEarlyBound` (https://github.com/rust-lang/chalk/blob/e0ade19d139bc784384acc6736cd960c91dd55a1/chalk-ir/src/lib.rs#L1308). Everything  is just "bound" - the equivalent of rustc's late-bound. It's not completely clear yet whether to move everything to the same time of binder in rustc or add `Param` and `ReEarlyBound` in Chalk.

Either way, tracking when we have or haven't already substituted out these in rustc can be helpful.

As a first step, I'm just adding a `EarlyBinder` newtype that is required to call `subst`. I also add a couple "transparent" `bound_*` wrappers around a couple query that are often immediately substituted.

r? `@nikomatsakis`

2 years agorustc: Stricter checking for #[link] attributes
Vadim Petrochenkov [Mon, 14 Mar 2022 10:28:34 +0000 (13:28 +0300)]
rustc: Stricter checking for #[link] attributes

2 years agoAuto merge of #97044 - Urgau:check-cfg-fix-rustc-perf, r=Mark-Simulacrum
bors [Sat, 14 May 2022 20:43:45 +0000 (20:43 +0000)]
Auto merge of #97044 - Urgau:check-cfg-fix-rustc-perf, r=Mark-Simulacrum

Fix rustc-perf benchmarks

See https://github.com/rust-lang/rust/pull/96984#issuecomment-1126678773 and https://github.com/rust-lang/rust/pull/96984#issuecomment-1126719585

cc `@ehuss` `@lqd`

2 years agoallocate string only when error will be emitted
Miguel Guarniz [Sat, 14 May 2022 16:23:23 +0000 (12:23 -0400)]
allocate string only when error will be emitted

Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2 years agoAuto merge of #97039 - cjgillot:no-rpit-hrtb, r=jackh726
bors [Sat, 14 May 2022 15:47:22 +0000 (15:47 +0000)]
Auto merge of #97039 - cjgillot:no-rpit-hrtb, r=jackh726

Forbid nested opaque types to reference HRTB from opaque types.

Avoids https://github.com/rust-lang/rust/issues/96194
Alternative to https://github.com/rust-lang/rust/pull/96970

r? `@oli-obk`

2 years agoUpdate documentation about themes
Guillaume Gomez [Wed, 11 May 2022 21:18:46 +0000 (23:18 +0200)]
Update documentation about themes

2 years agoUpdate GUI tests
Guillaume Gomez [Wed, 11 May 2022 21:11:31 +0000 (23:11 +0200)]
Update GUI tests

2 years agoRemove theme picker button
Guillaume Gomez [Wed, 11 May 2022 21:11:18 +0000 (23:11 +0200)]
Remove theme picker button

2 years agoImprove settings menu display
Guillaume Gomez [Tue, 10 May 2022 14:09:41 +0000 (16:09 +0200)]
Improve settings menu display

2 years agouse opt_item_name to pattern match items with names
Miguel Guarniz [Thu, 12 May 2022 18:03:21 +0000 (14:03 -0400)]
use opt_item_name to pattern match items with names

Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2 years agoavoid fetching HIR when handling Impl assoc items
Miguel Guarniz [Thu, 12 May 2022 15:34:37 +0000 (11:34 -0400)]
avoid fetching HIR when handling Impl assoc items

Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2 years agoFix rustc-perf benchmarks
Urgau [Sat, 14 May 2022 14:12:13 +0000 (16:12 +0200)]
Fix rustc-perf benchmarks

2 years agoAdd rustc_on_unimplemented to Subst
Jack Huey [Wed, 11 May 2022 02:40:43 +0000 (22:40 -0400)]
Add rustc_on_unimplemented to Subst

2 years agoAdd bound_explicit_item_bounds and bound_item_bounds
Jack Huey [Wed, 11 May 2022 02:28:50 +0000 (22:28 -0400)]
Add bound_explicit_item_bounds and bound_item_bounds

2 years agoAuto merge of #96345 - petrochenkov:linclean, r=notriddle
bors [Sat, 14 May 2022 13:24:34 +0000 (13:24 +0000)]
Auto merge of #96345 - petrochenkov:linclean, r=notriddle

rustdoc: Cleanup doc link resolution

See individual commits for specific changes

2 years agoAdd a test with both passing and erroneous cases.
Camille GILLOT [Sat, 14 May 2022 12:07:46 +0000 (14:07 +0200)]
Add a test with both passing and erroneous cases.

2 years agoAuto merge of #95826 - carbotaniuman:miri-permissive-provenance, r=RalfJung
bors [Sat, 14 May 2022 10:36:47 +0000 (10:36 +0000)]
Auto merge of #95826 - carbotaniuman:miri-permissive-provenance, r=RalfJung

Initial work on Miri permissive-exposed-provenance

Rustc portion of the changes for portions of a permissive ptr-to-int model for Miri. The main changes here are changing `ptr_get_alloc` and `get_alloc_id` to return an Option, and also making ptr-to-int casts have an expose side effect.

2 years agoAllow the unused_macro_rules lint for now
est31 [Sat, 14 May 2022 01:41:06 +0000 (03:41 +0200)]
Allow the unused_macro_rules lint for now

This makes the transition easier as e.g. allow directives
won't fire the unknown lint warning once it is turned to
warn by default in the future. This is especially
important compared to other lints in the unused group
because the _ prefix trick doesn't exist for macro rules,
so allowing is the only option (either of unused_macro_rules,
or of the entire unused group, but that is not as informative
to readers). Allowing the lint also makes it possible to work
on possible heuristics for disabling the macro in specific
cases.

2 years agoFix `download-ci-llvm` NixOS patching for `.so`s.
Eduard-Mihai Burtescu [Sat, 14 May 2022 10:07:47 +0000 (10:07 +0000)]
Fix `download-ci-llvm` NixOS patching for `.so`s.

2 years agoForbid nested opaque types to reference HRTB from opaque types.
Camille GILLOT [Sat, 14 May 2022 09:25:53 +0000 (11:25 +0200)]
Forbid nested opaque types to reference HRTB from opaque types.

2 years agoAuto merge of #94872 - mati865:mingw-llvm-target, r=petrochenkov
bors [Sat, 14 May 2022 08:20:11 +0000 (08:20 +0000)]
Auto merge of #94872 - mati865:mingw-llvm-target, r=petrochenkov

Add MVP LLVM based mingw-w64 targets

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

Those are `rustc` side changes to create working x86_64 and AArch64 Rustc hosts and targets.
Apart from this PR changes to various crates are required which I'll do once this is accepted.

I'm expecting more changes on `rustc` side later on as I cannot even run full testsuite at this moment because passing JSON spec breaks paths in various tests.

Tier 3 policy:

> A tier 3 target must have a designated developer or developers (the "target maintainers") on record to be CCed when issues arise regarding the target. (The mechanism to track and CC such developers may evolve over time.)

I pledge to do my best maintaining it, MSYS2 is one of interested consumers so it should have enough testing (after the releases).

 > Targets must use naming consistent with any existing targets; for instance, a target for the same CPU or OS as an existing Rust target should use the same name for that CPU or OS. Targets should normally use the same names and naming conventions as used elsewhere in the broader ecosystem beyond Rust (such as in other toolchains), unless they have a very good reason to diverge. Changing the name of a target can be highly disruptive, especially once the target reaches a higher tier, so getting the name right is important even for a tier 3 target.

This triple name was discussed at [`t-compiler/LLVM+mingw-w64 Windows targets`](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/LLVM.2Bmingw-w64.20Windows.20targets)

> Target names should not introduce undue confusion or ambiguity unless absolutely necessary to maintain ecosystem compatibility. For example, if the name of the target makes people extremely likely to form incorrect beliefs about what it targets, the name should be changed or augmented to disambiguate it.

I think the explanation in platform support doc is enough to make this aspect clear.

> Tier 3 targets may have unusual requirements to build or use, but must not create legal issues or impose onerous legal terms for the Rust project or for Rust developers or users.

It's using open source tools only.

> The target must not introduce license incompatibilities.

It's even more liberal than already existing `*-pc-windows-gnu`.

> Anything added to the Rust repository must be under the standard Rust license (MIT OR Apache-2.0).

Understood.

> The target must not cause the Rust tools or libraries built for any other host (even when supporting cross-compilation to the target) to depend on any new dependency less permissive than the Rust licensing policy. This applies whether the dependency is a Rust crate that would require adding new license exceptions (as specified by the tidy tool in the rust-lang/rust repository), or whether the dependency is a native library or binary. In other words, the introduction of the target must not cause a user installing or running a version of Rust or the Rust tools to be subject to any new license requirements.

There are no new dependencies/features required.

> Compiling, linking, and emitting functional binaries, libraries, or other code for the target (whether hosted on the target itself or cross-compiling from another target) must not depend on proprietary (non-FOSS) libraries. Host tools built for the target itself may depend on the ordinary runtime libraries supplied by the platform and commonly used by other applications built for the target, but those libraries must not be required for code generation for the target; cross-compilation to the target must not require such libraries at all. For instance, rustc built for the target may depend on a common proprietary C runtime library or console output library, but must not depend on a proprietary code generation library or code optimization library. Rust's license permits such combinations, but the Rust project has no interest in maintaining such combinations within the scope of Rust itself, even at tier 3.

As previously said it's using open source tools only.

> "onerous" here is an intentionally subjective term. At a minimum, "onerous" legal/licensing terms include but are not limited to: non-disclosure requirements, non-compete requirements, contributor license agreements (CLAs) or equivalent, "non-commercial"/"research-only"/etc terms, requirements conditional on the employer or employment of any particular Rust developers, revocable terms, any requirements that create liability for the Rust project or its developers or users, or any requirements that adversely affect the livelihood or prospects of the Rust project or its developers or users.

There are no such terms present/

> Neither this policy nor any decisions made regarding targets shall create any binding agreement or estoppel by any party. If any member of an approving Rust team serves as one of the maintainers of a target, or has any legal or employment requirement (explicit or implicit) that might affect their decisions regarding a target, they must recuse themselves from any approval decisions regarding the target's tier status, though they may otherwise participate in discussions.

I'm not the reviewer here.

> This requirement does not prevent part or all of this policy from being cited in an explicit contract or work agreement (e.g. to implement or maintain support for a target). This requirement exists to ensure that a developer or team responsible for reviewing and approving a target does not face any legal threats or obligations that would prevent them from freely exercising their judgment in such approval, even if such judgment involves subjective matters or goes beyond the letter of these requirements.

Again I'm not the reviewer here.

> Tier 3 targets should attempt to implement as much of the standard libraries as possible and appropriate (core for most targets, alloc for targets that can support dynamic memory allocation, std for targets with an operating system or equivalent layer of system-provided functionality), but may leave some code unimplemented (either unavailable or stubbed out as appropriate), whether because the target makes it impossible to implement or challenging to implement. The authors of pull requests are not obligated to avoid calling any portions of the standard library on the basis of a tier 3 target not implementing those portions.

> The target must provide documentation for the Rust community explaining how to build for the target, using cross-compilation if possible. If the target supports running binaries, or running tests (even if they do not pass), the documentation must explain how to run such binaries or tests for the target, using emulation if possible or dedicated hardware if necessary.

Building is described in platform support doc, running tests doesn't work right now (without hacks) because Rust's build system doesn't seem to support testing targets built from `.json`.
Docs will be updated once this lands in beta allowing master branch to build and run tests without `.json` files.

> Tier 3 targets must not impose burden on the authors of pull requests, or other developers in the community, to maintain the target. In particular, do not post comments (automated or manual) on a PR that derail or suggest a block on the PR based on a tier 3 target. Do not send automated messages or notifications (via any medium, including via `@)` to a PR author or others involved with a PR regarding a tier 3 target, unless they have opted into such messages.

Understood.

> Backlinks such as those generated by the issue/PR tracker when linking to an issue or PR are not considered a violation of this policy, within reason. However, such messages (even on a separate repository) must not generate notifications to anyone involved with a PR who has not requested such notifications.

Understood.

 > Patches adding or updating tier 3 targets must not break any existing tier 2 or tier 1 target, and must not knowingly break another tier 3 target without approval of either the compiler team or the maintainers of the other tier 3 target.

I believe I didn't break any other target.

> In particular, this may come up when working on closely related targets, such as variations of the same architecture with different features. Avoid introducing unconditional uses of features that another variation of the target may not have; use conditional compilation or runtime detection, as appropriate, to let each target run code supported by that target.

I think there are no such problems in this PR.

2 years agoAuto merge of #97035 - JohnTitor:rollup-00ko07z, r=JohnTitor
bors [Sat, 14 May 2022 05:53:39 +0000 (05:53 +0000)]
Auto merge of #97035 - JohnTitor:rollup-00ko07z, r=JohnTitor

Rollup of 6 pull requests

Successful merges:

 - #95365 (Use default alloc_error_handler for hermit)
 - #96986 ([save-analysis] Reference the variant not enum at struct-literal cons…)
 - #96998 (rustdoc: remove weird, unused variable from source-files.js)
 - #97005 (Two small improvements of rustc_expand)
 - #97018 (Ensure that test fail if a JS error occurs)
 - #97031 (Drop tracking: handle invalid assignments better)

Failed merges:

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

2 years agoRollup merge of #97031 - eholk:drop-tracking-type-error, r=compiler-errors
Yuki Okushi [Sat, 14 May 2022 04:42:55 +0000 (13:42 +0900)]
Rollup merge of #97031 - eholk:drop-tracking-type-error, r=compiler-errors

Drop tracking: handle invalid assignments better

Previously this test case was crashing with an index out of bounds error deep in the call to `needs_drop`. We avoid this by detecting clearly invalid assignees in the `mutate` callback and ignoring these.

2 years agoRollup merge of #97018 - GuillaumeGomez:fail-on-js-error, r=notriddle
Yuki Okushi [Sat, 14 May 2022 04:42:54 +0000 (13:42 +0900)]
Rollup merge of #97018 - GuillaumeGomez:fail-on-js-error, r=notriddle

Ensure that test fail if a JS error occurs

Fixes #96902.

r? ``@notriddle``

2 years agoRollup merge of #97005 - est31:master, r=petrochenkov
Yuki Okushi [Sat, 14 May 2022 04:42:53 +0000 (13:42 +0900)]
Rollup merge of #97005 - est31:master, r=petrochenkov

Two small improvements of rustc_expand

I found them while doing #96150

r? ``@petrochenkov``

2 years agoRollup merge of #96998 - notriddle:notriddle/var-N, r=jsha
Yuki Okushi [Sat, 14 May 2022 04:42:52 +0000 (13:42 +0900)]
Rollup merge of #96998 - notriddle:notriddle/var-N, r=jsha

rustdoc: remove weird, unused variable from source-files.js

2 years agoRollup merge of #96986 - kdashg:save-an-enum-vars, r=oli-obk
Yuki Okushi [Sat, 14 May 2022 04:42:50 +0000 (13:42 +0900)]
Rollup merge of #96986 - kdashg:save-an-enum-vars, r=oli-obk

[save-analysis] Reference the variant not enum at struct-literal cons…

…truction.

Closes #96985

2 years agoRollup merge of #95365 - mkroening:hermit-alloc-error-handler, r=joshtriplett
Yuki Okushi [Sat, 14 May 2022 04:42:49 +0000 (13:42 +0900)]
Rollup merge of #95365 - mkroening:hermit-alloc-error-handler, r=joshtriplett

Use default alloc_error_handler for hermit

Hermit now properly separates kernel from userspace.
Applications for hermit can now use Rust's default `alloc_error_handler` instead of calling the kernel's `__rg_oom`.

CC: ``@stlankes``
2 years agoAuto merge of #95602 - scottmcm:faster-array-intoiter-fold, r=the8472
bors [Sat, 14 May 2022 03:12:53 +0000 (03:12 +0000)]
Auto merge of #95602 - scottmcm:faster-array-intoiter-fold, r=the8472

Fix `array::IntoIter::fold` to use the optimized `Range::fold`

It was using `Iterator::by_ref` in the implementation, which ended up pessimizing it enough that, for example, it didn't vectorize when we tried it in the <https://rust-lang.zulipchat.com/#narrow/stream/257879-project-portable-simd/topic/Reducing.20sum.20into.20wider.20types> conversation.

Demonstration that the codegen test doesn't pass on the current nightly: <https://rust.godbolt.org/z/Taxev5eMn>

2 years agoFix nit
Eric Holk [Sat, 14 May 2022 02:32:53 +0000 (19:32 -0700)]
Fix nit

2 years agoDrop tracking: handle invalid assignments better
Eric Holk [Fri, 13 May 2022 23:25:22 +0000 (16:25 -0700)]
Drop tracking: handle invalid assignments better

Previously this test case was crashing with an index out of bounds error
deep in the call to `needs_drop`. We avoid this by detecting clearly
invalid assignees in the `mutate` callback and ignoring these.

2 years agoAdd bound_impl_trait_ref
Jack Huey [Mon, 9 May 2022 00:53:36 +0000 (20:53 -0400)]
Add bound_impl_trait_ref

2 years agoAdd bound_fn_sig
Jack Huey [Sun, 8 May 2022 19:43:18 +0000 (15:43 -0400)]
Add bound_fn_sig

2 years agoAdd bound_type_of
Jack Huey [Sun, 8 May 2022 19:12:56 +0000 (15:12 -0400)]
Add bound_type_of

2 years agoAuto merge of #97013 - matthiaskrgr:rollup-c1pc6pc, r=matthiaskrgr
bors [Fri, 13 May 2022 20:26:04 +0000 (20:26 +0000)]
Auto merge of #97013 - matthiaskrgr:rollup-c1pc6pc, r=matthiaskrgr

Rollup of 5 pull requests

Successful merges:

 - #96154 (Expand core::hint::unreachable_unchecked() docs)
 - #96615 (Add a regression test for #54779)
 - #96982 (fix clippy expect_fun_call)
 - #97003 (Remove some unnecessary `rustc_allow_const_fn_unstable` attributes.)
 - #97011 (Add regression test for #28935)

Failed merges:

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

2 years agoresolve: Move collection of all `macro_rules` in the crate to rustdoc
Vadim Petrochenkov [Fri, 13 May 2022 18:36:36 +0000 (21:36 +0300)]
resolve: Move collection of all `macro_rules` in the crate to rustdoc

2 years agoAuto merge of #95356 - coolreader18:exitstatus-exit-method, r=<try>
bors [Fri, 13 May 2022 18:29:13 +0000 (18:29 +0000)]
Auto merge of #95356 - coolreader18:exitstatus-exit-method, r=<try>

ExitCode::exit_process() method

cc `@yaahc` / #93840

(eeek, hit ctrl-enter before I meant to and right after realizing the branch name was wrong. oh, well)

I feel like it makes sense to have the `exit(ExitCode)` function as a method or at least associated function on ExitCode, but maybe that would hurt discoverability? Probably not as much if it's at the top of the `process::exit()` documentation or something, but idk. Also very unsure about the name, I'd like something that communicates that you are exiting with *this* ExitCode, but with a method name being postfix it doesn't seem to flow. `code.exit_process_with()` ? `.exit_process_with_self()` ? Blech. Maybe it doesn't matter, since ideally just `code.exit()` or something would be clear simply by the name and single parameter but :shrug:

Also I'd like to touch up the `ExitCode` docs (which I did a bit here), but that would probably be good in a separate PR, right? Since I think the beta deadline is coming up.

2 years agoGuarantee less in docs
Noa [Thu, 12 May 2022 04:29:51 +0000 (23:29 -0500)]
Guarantee less in docs

2 years agoAdd ExitCode::exit_process example
Noa [Wed, 11 May 2022 02:56:20 +0000 (21:56 -0500)]
Add ExitCode::exit_process example

2 years agoDon't hardcode attribute id in codegen test
Gary Guo [Fri, 13 May 2022 18:18:02 +0000 (19:18 +0100)]
Don't hardcode attribute id in codegen test

2 years agoAdd LLVM based mingw-w64 targets
Mateusz Mikuła [Sun, 6 Mar 2022 14:12:50 +0000 (15:12 +0100)]
Add LLVM based mingw-w64 targets

2 years agoFix rebase
Vadim Petrochenkov [Mon, 2 May 2022 20:10:51 +0000 (23:10 +0300)]
Fix rebase

2 years agorustdoc: Use `Visibility::is_public` more
Vadim Petrochenkov [Sat, 23 Apr 2022 15:34:15 +0000 (18:34 +0300)]
rustdoc: Use `Visibility::is_public` more

2 years agorustdoc: Do not resolve associated item paths unnecessarily
Vadim Petrochenkov [Sat, 23 Apr 2022 10:56:40 +0000 (13:56 +0300)]
rustdoc: Do not resolve associated item paths unnecessarily

2 years agorustdoc: Do not create `UrlFragment`s until they are necessary
Vadim Petrochenkov [Sat, 23 Apr 2022 08:18:21 +0000 (11:18 +0300)]
rustdoc: Do not create `UrlFragment`s until they are necessary

This simplifies error types and allows to remove `fn resolve_inner` and `fn check_full_res`

`visited_links` caching is not touched for now

2 years agorustdoc: Remove `fn resolve_macro`
Vadim Petrochenkov [Fri, 22 Apr 2022 19:49:01 +0000 (22:49 +0300)]
rustdoc: Remove `fn resolve_macro`

and otherwise unify resolution in macro namespace and other namespaces