Commit Graph

168272 Commits

Author SHA1 Message Date
Michael Goulet
b26580f214 better error for bad LHS in binop-assign 2022-05-17 20:21:54 -07:00
Michael Goulet
a5c4f4cc4b Suggest deref non-lvalue mutable reference 2022-05-17 20:21:54 -07:00
bors
4c5f6e6277 Auto merge of #92570 - jsha:rustdoc-search-refactor, r=GuillaumeGomez
Simplify rustdoc search test

Previously, rustdoc search attempted to parse search.js and extract out only certain methods and variables.

This change makes search.js and search-index.js loadable as [CommonJS modules](https://nodejs.org/api/modules.html#modules-commonjs-modules), so they can be loaded directly.

As part of that change, I had to separate execSearch from interacting with the DOM. This wound up being a nice cleanup that made more explicit what inputs it was taking.

I removed search.js' dependency on storage.js by moving hasOwnPropertyRustdoc directly into search.js, and replacing onEach with forEach in a path that is called by the tester.

r? `@GuillaumeGomez`

Demo: https://rustdoc.crud.net/jsha/rustdoc-search-refactor/std/?search=foo
2022-05-17 19:50:44 +00:00
Jacob Hoffman-Andrews
453979462a rustdoc: make search.js a module
Previously, search.js relied on the DOM and the `window` object. It can now be
loaded in the absence of the DOM, for instance by Node. The same is true of
search-index.js.

This allows removing a lot of code from src/tools/rustdoc-js/tester.js that
tried to parse search.js and extract specific functions that were needed for
testing.
2022-05-17 09:26:18 -07:00
bors
00755e4ca6 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
2022-05-17 15:04:50 +00:00
bors
3655175a75 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
2022-05-17 12:01:12 +00:00
Yuki Okushi
5fdc849bdc
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)
2022-05-17 19:01:35 +09:00
Yuki Okushi
519b6b4c77
Rollup merge of #97093 - pvdrz:migrate-maybe-recover-from-bad-type-plus, r=davidtwco
Migrate `maybe_recover_from_bad_type_plus` diagnostic

r? `@davidtwco`
2022-05-17 19:01:34 +09:00
Yuki Okushi
13ee094260
Rollup merge of #97080 - lcnr:relate-sus, r=oli-obk
remove the `RelateResultCompare` trait

it's unused
2022-05-17 19:01:33 +09:00
Yuki Okushi
70cd85f5e3
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
2022-05-17 19:01:32 +09:00
Yuki Okushi
aaa0c014e2
Rollup merge of #97075 - JohnTitor:issue-81804, r=compiler-errors
Add regression test for #81804

Closes #81804
r? ``@compiler-errors``
2022-05-17 19:01:31 +09:00
Yuki Okushi
17eebcd4c3
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.
2022-05-17 19:01:30 +09:00
Yuki Okushi
15aa2d6189
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``
2022-05-17 19:01:29 +09:00
bors
735efc0c70 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`
2022-05-17 09:39:26 +00:00
mbartlett21
cdc12edb4c Add a test for fn pointer calls in consts 2022-05-17 07:24:47 +00:00
bors
7355d971a9 Auto merge of #96825 - kckeiks:remove-item-like-visitor-trait, r=cjgillot
Retire `ItemLikeVisitor` trait

Issue #95004
cc `@cjgillot`
2022-05-17 06:51:45 +00:00
bors
1e8cd63d60 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
2022-05-17 04:37:47 +00:00
mbartlett21
56649bb844 Update function pointer call error message
It now uses the type of context. (issue 97082)
2022-05-17 04:13:20 +00:00
Christian Poveda
7cafefec4a
keep bounds where they were 2022-05-16 22:23:32 -05:00
bors
c1d65eaa45 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
2022-05-17 01:46:25 +00:00
SparrowLii
38bf1158bd Change Successors to impl Iterator<Item = BasicBlock> 2022-05-17 08:41:01 +08:00
bors
c1cfdd1fb2 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.
2022-05-16 23:01:28 +00:00
Christian Poveda
7e8517df61
migrate maybe_recover_from_bad_type_plus diagnostic 2022-05-16 17:16:27 -05:00
Vadim Petrochenkov
159b56f288 rustdoc: Resolve some more doc links early 2022-05-16 19:26:01 +03:00
bors
c52b9c10bf 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.
2022-05-16 13:53:40 +00:00
lcnr
0ea7301fa3 remove the RelateResultCompare trait 2022-05-16 15:41:05 +02:00
Oli Scherer
0cefa5fa18 Force inline InternedObligationCauseCode creation 2022-05-16 13:34:03 +00:00
Dan Gohman
4cc0cc7eb3 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.
2022-05-16 05:07:28 -07:00
Yuki Okushi
a3bc2e5293
Add regression test for #81804 2022-05-16 19:34:30 +09:00
Oli Scherer
0a6b69106e Add a query for checking whether a function is an intrinsic. 2022-05-16 07:07:44 +00:00
Raoul Strackx
3e252a7ffc Allow unused_macro_rules in path tests 2022-05-16 08:55:05 +02:00
bors
56d540e057 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:🆕:<[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`
2022-05-16 02:33:34 +00:00
bors
cdd74fc7b1 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.
2022-05-16 00:12:06 +00:00
gabriel-doriath-dohler
26265319c7 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.
2022-05-15 23:59:59 +00:00
bors
42e1761c70 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
2022-05-15 21:17:46 +00:00
bors
29e972dc60 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
2022-05-15 18:52:28 +00:00
Vadim Petrochenkov
b4019ded77 rustdoc: Remove doc link resolution fallback to all macro_rules in the crate 2022-05-15 21:08:32 +03:00
Dylan DPC
d56c59efdc
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`
2022-05-15 18:41:27 +02:00
Dylan DPC
ede4f0ef68
Rollup merge of #97042 - GuillaumeGomez:eslint-brace-style, r=notriddle
Add new eslint rule about brace style

It also prevents one liners.

r? `@notriddle`
2022-05-15 18:41:26 +02:00
Dylan DPC
e8e7555c34
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
2022-05-15 18:41:26 +02:00
Dylan DPC
f8832c23da
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
2022-05-15 18:41:25 +02:00
bors
0f202d22c5 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
2022-05-15 16:27:43 +00:00
bors
a170f2b3d2 Auto merge of #97056 - RalfJung:miri, r=RalfJung
update miri

Fixes https://github.com/rust-lang/rust/issues/96975
r? `@ghost`
2022-05-15 13:46:54 +00:00
bdbai
4f637ee30b fix use of SetHandleInformation on UWP 2022-05-15 21:15:45 +08:00
Guillaume Gomez
5d84c0c569 Add new eslint rule about brace style 2022-05-15 13:59:51 +02:00
Ralf Jung
cdc19b072a update miri 2022-05-15 13:37:04 +02:00
bors
10b3a0d209 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.
2022-05-15 11:19:27 +00:00
bjorn3
ecd8fa1a75 Merge commit '63734fcdd718cca089f84c42f3a42c0096cfd431' into sync_cg_clif-2022-05-15 2022-05-15 12:32:19 +02:00
bjorn3
63734fcdd7 Rustup to rustc 1.62.0-nightly (70b3681bf 2022-05-14) 2022-05-15 12:26:21 +02:00
bjorn3
e5ff9f1b6d Sync from rust e1ec3260d7 2022-05-15 12:25:32 +02:00