]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoFix typo in variable name
LingMan [Mon, 10 May 2021 23:17:08 +0000 (01:17 +0200)]
Fix typo in variable name

All other sibling functions call this variable "slot", so "slote" was most likely a typo.

3 years agoAuto merge of #85156 - GuillaumeGomez:rollup-8u4h34g, r=GuillaumeGomez
bors [Mon, 10 May 2021 18:28:24 +0000 (18:28 +0000)]
Auto merge of #85156 - GuillaumeGomez:rollup-8u4h34g, r=GuillaumeGomez

Rollup of 4 pull requests

Successful merges:

 - #84465 (rustdoc: Implement `is_primitive` in terms of `primitive_type()`)
 - #85118 (Use an SVG image for clipboard instead of unicode character)
 - #85148 (Fix source code line number display and make it clickable again)
 - #85152 (Adjust target search algorithm for rustlib path)

Failed merges:

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

3 years agoRollup merge of #85152 - nagisa:target-search-rustlib, r=Mark-Simulacrum
Guillaume Gomez [Mon, 10 May 2021 18:05:27 +0000 (20:05 +0200)]
Rollup merge of #85152 - nagisa:target-search-rustlib, r=Mark-Simulacrum

Adjust target search algorithm for rustlib path

With this the concerns expressed in #83800 should be addressed.

r? `@Mark-Simulacrum`

3 years agoRollup merge of #85148 - GuillaumeGomez:source-code-line-number, r=jsha
Guillaume Gomez [Mon, 10 May 2021 18:05:26 +0000 (20:05 +0200)]
Rollup merge of #85148 - GuillaumeGomez:source-code-line-number, r=jsha

Fix source code line number display and make it clickable again

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

I used the same logic we're using for other codeblocks: putting the line number `<span>`s into the `example-wrap` directly and then add `display: inline-flex` on `example-wrap`.

r? `@jsha`

3 years agoRollup merge of #85118 - GuillaumeGomez:clipboard-svg, r=Nemo157
Guillaume Gomez [Mon, 10 May 2021 18:05:25 +0000 (20:05 +0200)]
Rollup merge of #85118 - GuillaumeGomez:clipboard-svg, r=Nemo157

Use an SVG image for clipboard instead of unicode character

Linked to https://github.com/rust-lang/docs.rs/pull/1394.

cc `@jsha`
r? `@Nemo157`

3 years agoRollup merge of #84465 - jyn514:primitive, r=GuillaumeGomez
Guillaume Gomez [Mon, 10 May 2021 18:05:24 +0000 (20:05 +0200)]
Rollup merge of #84465 - jyn514:primitive, r=GuillaumeGomez

rustdoc: Implement `is_primitive` in terms of `primitive_type()`

Previously, they disagreed about what types were primitives.

r? `@GuillaumeGomez`

3 years agoAdjust target search algorithm for rustlib path
Simonas Kazlauskas [Mon, 10 May 2021 16:15:19 +0000 (19:15 +0300)]
Adjust target search algorithm for rustlib path

With this the concerns expressed in #83800 should be addressed.

3 years agoAuto merge of #85150 - Dylan-DPC:rollup-q26gbx3, r=Dylan-DPC
bors [Mon, 10 May 2021 15:08:08 +0000 (15:08 +0000)]
Auto merge of #85150 - Dylan-DPC:rollup-q26gbx3, r=Dylan-DPC

Rollup of 6 pull requests

Successful merges:

 - #85050 (Fix suggestions for missing return type lifetime specifiers)
 - #85075 (Improve "panic message is not a string literal" warning)
 - #85096 (Make unchecked_{add,sub,mul} inherent methods unstably const)
 - #85112 (ensure failing promoteds in const/static bodies are handled correctly)
 - #85146 (Provide io::Seek::rewind)
 - #85147 (:arrow_up: rust-analyzer)

Failed merges:

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

3 years agoUse an SVG image for clipboard instead of unicode character
Guillaume Gomez [Sun, 9 May 2021 18:41:24 +0000 (20:41 +0200)]
Use an SVG image for clipboard instead of unicode character

3 years agoRollup merge of #85147 - lnicola:rust-analyzer-2021-05-10, r=jonas-schievink
Dylan DPC [Mon, 10 May 2021 14:15:06 +0000 (16:15 +0200)]
Rollup merge of #85147 - lnicola:rust-analyzer-2021-05-10, r=jonas-schievink

:arrow_up: rust-analyzer

3 years agoRollup merge of #85146 - ijackson:seek-rewind, r=m-ou-se
Dylan DPC [Mon, 10 May 2021 14:15:05 +0000 (16:15 +0200)]
Rollup merge of #85146 - ijackson:seek-rewind, r=m-ou-se

Provide io::Seek::rewind

Using `Seek::seek` is slightly clumsy because of the need to write (or import) `std::io::SeekFrom` to get at `SeekStart`.  C already has `rewind` (although with broken error handling); we should have it too.

I'm motivated to do this because I've just found myself copy-pasting my 5-line extension trait between projects.

That the example ends up using `OpenOptions` makes this look like a niche use case, but it is very common to rewind temporary files.  `tempfile` isn't available for use in this example or it would have looked shorter and more natural.

If this gets a positive reception I will open a tracking issue and update the feature gate.

3 years agoRollup merge of #85112 - RalfJung:promoted-errors, r=oli-obk
Dylan DPC [Mon, 10 May 2021 14:15:03 +0000 (16:15 +0200)]
Rollup merge of #85112 - RalfJung:promoted-errors, r=oli-obk

ensure failing promoteds in const/static bodies are handled correctly

`const`/`static` bodies are the one case where we still promote code that might fail to evaluate. Ensure that this is handled correctly; in particular, it must not fail compilation.

`src/test/ui/consts/const-eval/erroneous-const.rs` ensures that when a non-promoted fails to evaluate, we *do* show an error.

r? `@oli-obk`

3 years agoRollup merge of #85096 - clarfonthey:const_unchecked, r=oli-obk
Dylan DPC [Mon, 10 May 2021 14:15:02 +0000 (16:15 +0200)]
Rollup merge of #85096 - clarfonthey:const_unchecked, r=oli-obk

Make unchecked_{add,sub,mul} inherent methods unstably const

The intrinsics are marked as being stably const (even though they're not stable by nature of being intrinsics), but the currently-unstable inherent versions are not marked as const. This fixes this inconsistency. Split out of #85017,

r? `@oli-obk`

3 years agoRollup merge of #85075 - ptrojahn:panic_warning, r=jackh726
Dylan DPC [Mon, 10 May 2021 14:15:01 +0000 (16:15 +0200)]
Rollup merge of #85075 - ptrojahn:panic_warning, r=jackh726

Improve "panic message is not a string literal" warning

This warning always referenced panic! even in case of an
assert. Related to #84656

3 years agoRollup merge of #85050 - FabianWolff:issue-84592, r=jackh726
Dylan DPC [Mon, 10 May 2021 14:15:00 +0000 (16:15 +0200)]
Rollup merge of #85050 - FabianWolff:issue-84592, r=jackh726

Fix suggestions for missing return type lifetime specifiers

This pull request aims to fix #84592. The issue is that the current code seems to assume that there is only a single relevant span pointing to the missing lifetime, and only looks at the first one:
https://github.com/rust-lang/rust/blob/e5f83d24aee866a14753a7cedbb4e301dfe5bef5/compiler/rustc_resolve/src/late/lifetimes.rs#L2959

This is incorrect, though, and leads to incorrect error messages and invalid suggestions. For instance, the example from #84592:
```rust
struct TwoLifetimes<'x, 'y> {
    x: &'x (),
    y: &'y (),
}

fn two_lifetimes_needed(a: &(), b: &()) -> TwoLifetimes<'_, '_> {
    TwoLifetimes { x: &(), y: &() }
}
```
currently leads to:
```
error[E0106]: missing lifetime specifiers
 --> src/main.rs:6:57
  |
6 | fn two_lifetimes_needed(a: &(), b: &()) -> TwoLifetimes<'_, '_> {
  |                            ---     ---                  ^^ expected 2 lifetime parameters
  |
  = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `a` or `b`
help: consider introducing a named lifetime parameter
  |
6 | fn two_lifetimes_needed<'a>(a: &'a (), b: &'a ()) -> TwoLifetimes<'_<'a, 'a>, '_> {
  |                        ^^^^    ^^^^^^     ^^^^^^                  ^^^^^^^^^^
```
There are two problems:
- The error message is wrong. There is only _one_ lifetime parameter expected at the location pointed to by the error message (and another one at a separate location).
- The suggestion is incorrect and will not lead to correct code.

With the changes in this PR, I get the following output:
```
error[E0106]: missing lifetime specifiers
 --> p.rs:6:57
  |
6 | fn two_lifetimes_needed(a: &(), b: &()) -> TwoLifetimes<'_, '_> {
  |                            ---     ---                  ^^  ^^ expected named lifetime parameter
  |                                                         |
  |                                                         expected named lifetime parameter
  |
  = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `a` or `b`
help: consider introducing a named lifetime parameter
  |
6 | fn two_lifetimes_needed<'a>(a: &'a (), b: &'a ()) -> TwoLifetimes<'a, 'a> {
  |                        ^^^^    ^^^^^^     ^^^^^^                  ^^  ^^

error: aborting due to previous error

For more information about this error, try `rustc --explain E0106`.
```
Mainly, I changed `add_missing_lifetime_specifiers_label()` to receive a _vector_ of spans (and counts) instead of just one, and adjusted its body accordingly.

3 years agoMore minor fixes suggested by @jackh726
Fabian Wolff [Mon, 10 May 2021 12:59:54 +0000 (14:59 +0200)]
More minor fixes suggested by @jackh726

3 years agoio::Seek::rewind: Set tracking issue
Ian Jackson [Mon, 10 May 2021 12:55:13 +0000 (13:55 +0100)]
io::Seek::rewind: Set tracking issue

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoFix typo in doc
Ian Jackson [Mon, 10 May 2021 12:50:56 +0000 (13:50 +0100)]
Fix typo in doc

Co-authored-by: Mara Bos <m-ou.se@m-ou.se>
3 years agoAuto merge of #85079 - petrochenkov:sessclean, r=davidtwco
bors [Mon, 10 May 2021 12:26:46 +0000 (12:26 +0000)]
Auto merge of #85079 - petrochenkov:sessclean, r=davidtwco

rustc_session: Move more option building code from the `options!` macro

The moved code doesn't need to be generated by a macro, it can use a regular (generic) function and type aliases instead.

(The refactoring is salvaged from a branch with different now abandoned work.)

3 years agoAdd test for source code clickable line number
Guillaume Gomez [Mon, 10 May 2021 12:12:00 +0000 (14:12 +0200)]
Add test for source code clickable line number

3 years agoFix line number not being clickable on source pages
Guillaume Gomez [Mon, 10 May 2021 09:39:53 +0000 (11:39 +0200)]
Fix line number not being clickable on source pages

3 years ago:arrow_up: rust-analyzer
Laurențiu Nicola [Mon, 10 May 2021 12:11:01 +0000 (15:11 +0300)]
:arrow_up: rust-analyzer

3 years agoio::Seek: Provide rewind()
Ian Jackson [Mon, 10 May 2021 11:58:03 +0000 (12:58 +0100)]
io::Seek: Provide rewind()

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agoio::Seek: Mention that seeking can fail due to buffer flush fail
Ian Jackson [Mon, 10 May 2021 11:56:35 +0000 (12:56 +0100)]
io::Seek: Mention that seeking can fail due to buffer flush fail

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
3 years agorustc_session: Use `Iterator::find` instead of manual search
Vadim Petrochenkov [Mon, 10 May 2021 11:52:31 +0000 (14:52 +0300)]
rustc_session: Use `Iterator::find` instead of manual search

3 years agorustc_session: Move more option building code from the `options!` macro
Vadim Petrochenkov [Fri, 7 May 2021 12:18:19 +0000 (15:18 +0300)]
rustc_session: Move more option building code from the `options!` macro

3 years agoAuto merge of #85053 - camsteffen:duplicate-lint, r=davidtwco
bors [Mon, 10 May 2021 09:45:28 +0000 (09:45 +0000)]
Auto merge of #85053 - camsteffen:duplicate-lint, r=davidtwco

Fix duplicate unknown lint errors

Fixes rust-lang/rust-clippy#6602

3 years agoAuto merge of #85104 - hi-rustin:rustin-patch-typo, r=jonas-schievink
bors [Mon, 10 May 2021 07:15:23 +0000 (07:15 +0000)]
Auto merge of #85104 - hi-rustin:rustin-patch-typo, r=jonas-schievink

Fix typo

3 years agoAuto merge of #85074 - GuillaumeGomez:end-toggle-migration, r=jsha
bors [Mon, 10 May 2021 04:05:55 +0000 (04:05 +0000)]
Auto merge of #85074 - GuillaumeGomez:end-toggle-migration, r=jsha

Migrate top doc and non-exhaustive toggles to details tag

Fixes #83332.

r? `@jsha`

3 years agoAuto merge of #84507 - crlf0710:codegen_nonlocal_main_wrapper, r=nagisa
bors [Mon, 10 May 2021 00:42:31 +0000 (00:42 +0000)]
Auto merge of #84507 - crlf0710:codegen_nonlocal_main_wrapper, r=nagisa

Add primary marker on codegen unit and generate main wrapper on primary codegen.

This is the codegen part of changes extracted from #84062.

This add a marker called `primary` on each codegen units, where exactly one codegen unit will be `primary = true` at a time. This specific codegen unit will take charge of generating `main` wrapper when `main` is imported from a foreign crate after the implementation of RFC 1260.

cc #28937

I'm not sure who should i ask for review for codegen changes, so feel free to reassign.
r? `@nagisa`

3 years agoUpdate rustdoc test
Guillaume Gomez [Sat, 8 May 2021 18:20:37 +0000 (20:20 +0200)]
Update rustdoc test

3 years agoEnd toggle migration
Guillaume Gomez [Sat, 8 May 2021 12:21:57 +0000 (14:21 +0200)]
End toggle migration

3 years agoAuto merge of #83800 - xobs:impl-16351-nightly, r=nagisa
bors [Sun, 9 May 2021 22:01:26 +0000 (22:01 +0000)]
Auto merge of #83800 - xobs:impl-16351-nightly, r=nagisa

Add default search path to `Target::search()`

The function `Target::search()` accepts a target triple and returns a `Target` struct defining the requested target.

There is a `// FIXME 16351: add a sane default search path?` comment that indicates it is desirable to include some sort of default. This was raised in https://github.com/rust-lang/rust/issues/16351 which was closed without any resolution.

https://github.com/rust-lang/rust/pull/31117 was proposed, however that has platform-specific logic that is unsuitable for systems without `/etc/`.

This patch implements the suggestion raised in https://github.com/rust-lang/rust/issues/16351#issuecomment-180878193 where a `target.json` file may be placed in `$(rustc --print sysroot)/lib/rustlib/<target-triple>/target.json`. This allows shipping a toolchain distribution as a single file that gets extracted to the sysroot.

3 years agoFix `Step` feature flag, make tidy lint more useful to find things like this
ltdk [Sun, 9 May 2021 21:13:22 +0000 (17:13 -0400)]
Fix `Step` feature flag, make tidy lint more useful to find things like this

3 years agoImplement @jackh726's suggestions
Fabian Wolff [Sun, 9 May 2021 20:31:49 +0000 (22:31 +0200)]
Implement @jackh726's suggestions

3 years agoMake unchecked_{add,sub,mul} inherent methods unstably const
ltdk [Sun, 9 May 2021 00:18:44 +0000 (20:18 -0400)]
Make unchecked_{add,sub,mul} inherent methods unstably const

3 years agoAuto merge of #85065 - Mark-Simulacrum:preds-no-alloc, r=jackh726
bors [Sun, 9 May 2021 19:01:05 +0000 (19:01 +0000)]
Auto merge of #85065 - Mark-Simulacrum:preds-no-alloc, r=jackh726

Avoid predecessors having Drop impls

Should be a simple win - but let's make sure with perf.

3 years agoAuto merge of #83894 - nikic:newpm, r=nagisa
bors [Sun, 9 May 2021 16:19:21 +0000 (16:19 +0000)]
Auto merge of #83894 - nikic:newpm, r=nagisa

Improve support for NewPM

This adds various missing bits of support for NewPM and allows us to successfully run stage 2 tests with NewPM enabled.

This does not yet enable NewPM by default, as there are still known issue on LLVM 12 (such as a weak fat LTO pipeline). The plan is to make the switch after we update to LLVM 13.

3 years agoImprove "panic message is not a string literal" warning
Paul Trojahn [Fri, 7 May 2021 17:09:15 +0000 (19:09 +0200)]
Improve "panic message is not a string literal" warning

This warning always referenced panic! even in case of an
assert. Related to #84656

3 years agomore erroneous-const tests
Ralf Jung [Sun, 9 May 2021 14:07:00 +0000 (16:07 +0200)]
more erroneous-const tests

3 years agoAuto merge of #83596 - jyn514:session-dead-code, r=oli-obk
bors [Sun, 9 May 2021 13:38:17 +0000 (13:38 +0000)]
Auto merge of #83596 - jyn514:session-dead-code, r=oli-obk

Remove dead or useless code from Session

This is a more principled follow-up to https://github.com/rust-lang/rust/pull/83185#discussion_r601753839.

- Rename `Parser::span_fatal_err` -> `Parser::span_err`
- Remove some unnecessary uses of `struct_span_fatal`
- Make `Diagnostic::span_fatal` unconditionally raise an error
- Add `impl Deref<Target = Handler>` for Session and remove all functions that are exactly the same as their Handler counterparts
- Note why `Handler::fatal` is different from `Sesssion::fatal`
- Remove unused `opt_span_warn` function

r? `@oli-obk` or `@estebank`

3 years agoensure failing promoteds in const/static bodies are handled correctly
Ralf Jung [Sun, 9 May 2021 12:56:19 +0000 (14:56 +0200)]
ensure failing promoteds in const/static bodies are handled correctly

3 years agoAuto merge of #85093 - camelid:remove-fake-expect_local, r=GuillaumeGomez
bors [Sun, 9 May 2021 11:17:17 +0000 (11:17 +0000)]
Auto merge of #85093 - camelid:remove-fake-expect_local, r=GuillaumeGomez

Remove `FakeDefId::expect_local()`

This function returned a fake `DefIndex`, with no indication that it was
fake, when it was provided with a `FakeDefId::Fake`. Every use of the
function uses the returned `DefIndex` in a call to
`tcx.local_def_id_to_hir_id()`, which I'm pretty sure would panic if it
were given a fake `DefIndex`.

I removed the function and replaced all calls to it with a call to
`expect_real()` followed by `DefId::expect_local()` (that's a function
on the *real* `DefId`).

3 years agoFix typo
hi-rustin [Sun, 9 May 2021 04:24:58 +0000 (12:24 +0800)]
Fix typo

3 years agoRemove unused `opt_span_warn` function
Joshua Nelson [Sun, 28 Mar 2021 03:00:34 +0000 (23:00 -0400)]
Remove unused `opt_span_warn` function

3 years agoNote why `Handler::fatal` is different from `Sesssion::fatal`
Joshua Nelson [Sun, 28 Mar 2021 02:58:25 +0000 (22:58 -0400)]
Note why `Handler::fatal` is different from `Sesssion::fatal`

3 years agoMake `Diagnostic::span_fatal` unconditionally raise an error
Joshua Nelson [Sun, 28 Mar 2021 02:45:01 +0000 (22:45 -0400)]
Make `Diagnostic::span_fatal` unconditionally raise an error

It had no callers which didn't immediately call `raise()`, and this
unifies the behavior with `Session`.

3 years agoRemove some unnecessary uses of `struct_span_fatal`
Joshua Nelson [Sun, 28 Mar 2021 02:48:21 +0000 (22:48 -0400)]
Remove some unnecessary uses of `struct_span_fatal`

All of them immediately called `emit()` then `raise()`, so they could
just call `span_fatal` directly.

3 years agoRename `Parser::span_fatal_err` -> `Parser::span_err`
Joshua Nelson [Sun, 28 Mar 2021 02:46:50 +0000 (22:46 -0400)]
Rename `Parser::span_fatal_err` -> `Parser::span_err`

The name was misleading, it wasn't actually a fatal error.

3 years agoAdd primary marker on codegen unit to take charge of main_wrapper for non-local cases.
Charles Lew [Sat, 24 Apr 2021 05:16:34 +0000 (13:16 +0800)]
Add primary marker on codegen unit to take charge of main_wrapper for non-local cases.

3 years agoAuto merge of #83089 - Aaron1011:bootstrap-semi, r=Mark-Simulacrum
bors [Sat, 8 May 2021 23:11:45 +0000 (23:11 +0000)]
Auto merge of #83089 - Aaron1011:bootstrap-semi, r=Mark-Simulacrum

Enable `-W semicolon_in_expressions_from_macros` in bootstrap

Now that stdarch has been updated, we can do this without breaking the
build.

3 years agoAdd `#[track_caller]` to `FakeDefId::expect_real()`
Camelid [Sat, 8 May 2021 22:14:21 +0000 (15:14 -0700)]
Add `#[track_caller]` to `FakeDefId::expect_real()`

Now, in the case that the function is not inlined, the panic location
will be the caller's location, which is more helpful since the panic is
not `expect_real()`'s fault.

3 years agoRemove `FakeDefId::expect_local()`
Camelid [Sat, 8 May 2021 22:03:15 +0000 (15:03 -0700)]
Remove `FakeDefId::expect_local()`

This function returned a fake `DefIndex`, with no indication that it was
fake, when it was provided with a `FakeDefId::Fake`. Every use of the
function uses the returned `DefIndex` in a call to
`tcx.local_def_id_to_hir_id()`, which I'm pretty sure would panic if it
were given a fake `DefIndex`.

I removed the function and replaced all calls to it with a call to
`expect_real()` followed by `DefId::expect_local()` (that's a function
on the *real* `DefId`).

3 years agoEnable `-W semicolon_in_expressions_from_macros` in bootstrap
Aaron Hill [Sat, 13 Mar 2021 17:46:33 +0000 (12:46 -0500)]
Enable `-W semicolon_in_expressions_from_macros` in bootstrap

Now that stdarch has been updated, we can do this without breaking the
build.

3 years agoAuto merge of #83278 - Amanieu:bump_stdarch, r=Mark-Simulacrum
bors [Sat, 8 May 2021 18:41:16 +0000 (18:41 +0000)]
Auto merge of #83278 - Amanieu:bump_stdarch, r=Mark-Simulacrum

Bump stdarch submodule

Major changes:
- More AVX-512 intrinsics.
- More ARM & AArch64 NEON intrinsics.
- Updated unstable WASM intrinsics to latest draft standards.
- Intrinsics that previously used `#[rustc_args_required_const]` now use const generics. See #83167 for more details.
- `std_detect` is now a separate crate instead of a submodule of `std`.

3 years agoBump stdarch submodule
Amanieu d'Antras [Tue, 13 Apr 2021 03:32:11 +0000 (04:32 +0100)]
Bump stdarch submodule

3 years agoAuto merge of #85072 - hyd-dev:miri, r=RalfJung
bors [Sat, 8 May 2021 12:11:01 +0000 (12:11 +0000)]
Auto merge of #85072 - hyd-dev:miri, r=RalfJung

Update Miri

Fixes #85027

r? `@RalfJung`

3 years agoUpdate Miri
hyd-dev [Sat, 8 May 2021 11:53:15 +0000 (19:53 +0800)]
Update Miri

3 years agoAuto merge of #84470 - jyn514:lints, r=GuillaumeGomez
bors [Sat, 8 May 2021 09:46:18 +0000 (09:46 +0000)]
Auto merge of #84470 - jyn514:lints, r=GuillaumeGomez

rustdoc: Stop special casing `broken_intra_doc_links` unnecessarily

3 years agoUpdate LLVM submodule
Nikita Popov [Sat, 8 May 2021 09:01:09 +0000 (11:01 +0200)]
Update LLVM submodule

This updates the LLVM submodule with recent LLVM 12.x fixes. In
particular, it resolves an assertion failure when targeting
AArch64 at O0.

3 years agoSupport -C passes in NewPM
Nikita Popov [Mon, 5 Apr 2021 13:37:11 +0000 (15:37 +0200)]
Support -C passes in NewPM

And report an error if parsing the additional pass pipeline fails.
Threading through the error accounts for most of the changes here.

3 years agoDon't force -O1 with ThinLTO
Nikita Popov [Mon, 5 Apr 2021 09:12:45 +0000 (11:12 +0200)]
Don't force -O1 with ThinLTO

This doesn't seem to be necessary anymore, although I don't know
at which point or why that changed.

Forcing -O1 makes some tests fail under NewPM, because NewPM also
performs inlining at -O1, so it ends up performing much more
optimization in practice than before.

3 years agoDrop -opt-bisect-limit=0 flag from test
Nikita Popov [Sun, 4 Apr 2021 19:57:03 +0000 (21:57 +0200)]
Drop -opt-bisect-limit=0 flag from test

This causes an assertion failure under NewPM, because it also ends
up disabling the NameAnonGlobals pass.

Instead pass -Copt-level=0 to disable optimizations. If that should
be insufficient, we can use -C no-prepopulate-passes.

3 years agoExplicitly register GCOV profiling pass as well
Nikita Popov [Mon, 5 Apr 2021 09:26:48 +0000 (11:26 +0200)]
Explicitly register GCOV profiling pass as well

3 years agoExplicitly register instrprof pass
Nikita Popov [Mon, 5 Apr 2021 08:45:04 +0000 (10:45 +0200)]
Explicitly register instrprof pass

Don't use "passes" for this purpose, explicitly insert it into
the correct place in the pipeline instead.

3 years agoMake -Z new-llvm-pass-manager an Option<bool>
Nikita Popov [Sun, 4 Apr 2021 19:38:34 +0000 (21:38 +0200)]
Make -Z new-llvm-pass-manager an Option<bool>

To allow it to have an LLVM version dependent default.

3 years agoAuto merge of #85059 - ehuss:update-cargo, r=ehuss
bors [Sat, 8 May 2021 05:50:00 +0000 (05:50 +0000)]
Auto merge of #85059 - ehuss:update-cargo, r=ehuss

Update cargo

7 commits in f3e13226d6d17a2bc5f325303494b43a45f53b7f..e51522ab3db23b0d8f1de54eb1f0113924896331
2021-04-30 21:50:27 +0000 to 2021-05-07 21:29:52 +0000
- Add CARGO_TARGET_TMPDIR env var for integration tests & benches (rust-lang/cargo#9375)
- Bump to 0.55.0, update changelog (rust-lang/cargo#9464)
- Some updates to the unstable documentation (rust-lang/cargo#9457)
- Add CARGO_PROFILE_&lt;name&gt;_SPLIT_DEBUGINFO to env docs. (rust-lang/cargo#9456)
- Add `report` subcommand. (rust-lang/cargo#9438)
- Respect Cargo.toml `[package.exclude]` even not in a git repo. (rust-lang/cargo#9186)
- Document the other crates in the codebase in the contrib guide. (rust-lang/cargo#9439)

3 years agoAuto merge of #85058 - Xanewok:update-rls, r=Xanewok
bors [Sat, 8 May 2021 02:57:40 +0000 (02:57 +0000)]
Auto merge of #85058 - Xanewok:update-rls, r=Xanewok

Update RLS

This mostly just includes https://github.com/rust-lang/rls/commit/e33f4e68496b296dedb100e297dc4451f169b2b3 so that this fixes #85055 (clippy-related breakage).

3 years agoAvoid predecessors having Drop impls
Mark Rousskov [Sat, 8 May 2021 01:00:03 +0000 (21:00 -0400)]
Avoid predecessors having Drop impls

3 years agoAuto merge of #85057 - Dylan-DPC:rollup-efaseq2, r=Dylan-DPC
bors [Sat, 8 May 2021 00:37:38 +0000 (00:37 +0000)]
Auto merge of #85057 - Dylan-DPC:rollup-efaseq2, r=Dylan-DPC

Rollup of 6 pull requests

Successful merges:

 - #76808 (Improve diagnostics for functions in `struct` definitions)
 - #84887 (Remove SpanInterner::get)
 - #85034 (fix null pointer error messages)
 - #85038 (Don't stop running rustdoc-gui tests at first failure)
 - #85044 (Use `path.exists()` instead of `fs::metadata(path).is_ok()`)
 - #85052 (rustdoc: Link to the docs on namespaces when an unknown disambiguator is found)

Failed merges:

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

3 years agoUpdate cargo
Eric Huss [Fri, 7 May 2021 23:51:52 +0000 (16:51 -0700)]
Update cargo

3 years agoUpdate RLS
Igor Matuszewski [Fri, 7 May 2021 23:10:51 +0000 (01:10 +0200)]
Update RLS

3 years agoRollup merge of #85052 - jyn514:disambiguator, r=camelid
Dylan DPC [Fri, 7 May 2021 23:06:27 +0000 (01:06 +0200)]
Rollup merge of #85052 - jyn514:disambiguator, r=camelid

rustdoc: Link to the docs on namespaces when an unknown disambiguator is found

This was reverted in https://github.com/rust-lang/rust/pull/84950; this re-lands the changes, but without different behavior depending on the channel.

r? `@camelid` cc `@pietroalbini`

3 years agoRollup merge of #85044 - ChrisDenton:file-exists, r=jackh726
Dylan DPC [Fri, 7 May 2021 23:06:26 +0000 (01:06 +0200)]
Rollup merge of #85044 - ChrisDenton:file-exists, r=jackh726

Use `path.exists()` instead of `fs::metadata(path).is_ok()`

It's more explicit and potentially allows platforms to optimize the existence check.

3 years agoRollup merge of #85038 - GuillaumeGomez:dont-stop-first-rustdoc-gui-failure, r=Mark...
Dylan DPC [Fri, 7 May 2021 23:06:25 +0000 (01:06 +0200)]
Rollup merge of #85038 - GuillaumeGomez:dont-stop-first-rustdoc-gui-failure, r=Mark-Simulacrum

Don't stop running rustdoc-gui tests at first failure

I just realized that before this PR, the rustdoc-gui test suite was stopping at the first failure, which isn't very convenient. All tests are now running and if one failed, it returns an error at the end once all tests have run.

r? `@Mark-Simulacrum`

3 years agoRollup merge of #85034 - RalfJung:null-ptr, r=oli-obk
Dylan DPC [Fri, 7 May 2021 23:06:24 +0000 (01:06 +0200)]
Rollup merge of #85034 - RalfJung:null-ptr, r=oli-obk

fix null pointer error messages

I got the `match` in https://github.com/rust-lang/rust/pull/84972 wrong, this fixes that.
Also avoid redundant "inbounds test failed:" prefix.

Should fix https://github.com/rust-lang/rust/issues/85027

r? `@oli-obk`

3 years agoRollup merge of #84887 - jyn514:index-span, r=Xanewok
Dylan DPC [Fri, 7 May 2021 23:06:23 +0000 (01:06 +0200)]
Rollup merge of #84887 - jyn514:index-span, r=Xanewok

Remove SpanInterner::get

- It's used exactly once, so it's trivial to replace
- It doesn't match the normal convention for containers: normally
`get()` returns an option and indexing panics. Instead `SpanInterner::get()` panics
  and there's no indexing operation available.

3 years agoRollup merge of #76808 - LeSeulArtichaut:diagnose-functions-struct, r=jackh726
Dylan DPC [Fri, 7 May 2021 23:06:22 +0000 (01:06 +0200)]
Rollup merge of #76808 - LeSeulArtichaut:diagnose-functions-struct, r=jackh726

Improve diagnostics for functions in `struct` definitions

Tries to implement #76421.
This is probably going to need unit tests, but I wanted to hear from review all the cases tests should cover.

I'd like to follow up with the "mechanically applicable suggestion here that adds an impl block" step, but I'd need guidance. My idea for now would be to try to parse a function, and if that succeeds, create a dummy `ast::Item` impl block to then format it using `pprust`. Would that be a viable approach? Is there a better alternative?

r? `@matklad` cc `@estebank`

3 years agoFix duplicate unknown lint errors
Cameron Steffen [Fri, 7 May 2021 19:53:02 +0000 (14:53 -0500)]
Fix duplicate unknown lint errors

3 years agoAuto merge of #83901 - cjgillot:hash-attr, r=wesleywiser
bors [Fri, 7 May 2021 21:56:31 +0000 (21:56 +0000)]
Auto merge of #83901 - cjgillot:hash-attr, r=wesleywiser

Integrate attributes as part of the crate hash

r? `@Aaron1011`

3 years agorustdoc: Link to the docs on namespaces when an unknown disambiguator is found
Joshua Nelson [Mon, 5 Apr 2021 00:02:32 +0000 (20:02 -0400)]
rustdoc: Link to the docs on namespaces when an unknown disambiguator is found

3 years agoAlso take unions and enums into account
LeSeulArtichaut [Fri, 7 May 2021 20:49:47 +0000 (22:49 +0200)]
Also take unions and enums into account

3 years agoAdd basic test
LeSeulArtichaut [Thu, 17 Sep 2020 16:44:09 +0000 (18:44 +0200)]
Add basic test

3 years agoImprove diagnostics for functions in `struct` definitions
LeSeulArtichaut [Wed, 16 Sep 2020 21:10:05 +0000 (23:10 +0200)]
Improve diagnostics for functions in `struct` definitions

3 years agoHash attributes as part of the crate hash.
Camille GILLOT [Mon, 5 Apr 2021 20:09:49 +0000 (22:09 +0200)]
Hash attributes as part of the crate hash.

3 years agoAuto merge of #84980 - flip1995:clippyup, r=Manishearth
bors [Fri, 7 May 2021 19:28:03 +0000 (19:28 +0000)]
Auto merge of #84980 - flip1995:clippyup, r=Manishearth

Update Clippy

Bi-weekly Clippy update.

r? `@Manishearth`

3 years agoFix suggestions for missing return type lifetime parameters
Fabian Wolff [Fri, 7 May 2021 17:44:32 +0000 (19:44 +0200)]
Fix suggestions for missing return type lifetime parameters

3 years agoUse `path.exists()` instead of `fs::metadata(path).is_ok()`
Chris Denton [Fri, 7 May 2021 16:32:40 +0000 (17:32 +0100)]
Use `path.exists()` instead of `fs::metadata(path).is_ok()`

It's more explicit and allows platforms to optimize the existence check.

3 years agoAuto merge of #85036 - Dylan-DPC:rollup-4qfabo3, r=Dylan-DPC
bors [Fri, 7 May 2021 16:24:46 +0000 (16:24 +0000)]
Auto merge of #85036 - Dylan-DPC:rollup-4qfabo3, r=Dylan-DPC

Rollup of 9 pull requests

Successful merges:

 - #84254 (illumos should put libc last in library search order)
 - #84442 (Unify rustc and rustdoc parsing of `cfg()`)
 - #84655 (Cleanup of `wasm`)
 - #84866 (linker: Avoid library duplication with `/WHOLEARCHIVE`)
 - #84930 (rename LLVM target for RustyHermit)
 - #84991 (rustc: Support Rust-specific features in -Ctarget-feature)
 - #85029 (SGX mutex is movable)
 - #85030 (Rearrange SGX split module files)
 - #85033 (some further small cleanups)

Failed merges:

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

3 years agobless 32bit
Ralf Jung [Fri, 7 May 2021 15:24:50 +0000 (17:24 +0200)]
bless 32bit

3 years agoDon't stop running rustdoc-gui tests at first failure
Guillaume Gomez [Fri, 7 May 2021 14:51:00 +0000 (16:51 +0200)]
Don't stop running rustdoc-gui tests at first failure

3 years agoRollup merge of #85033 - lcnr:nits2, r=jackh726
Dylan DPC [Fri, 7 May 2021 14:19:25 +0000 (16:19 +0200)]
Rollup merge of #85033 - lcnr:nits2, r=jackh726

some further small cleanups

3 years agoRollup merge of #85030 - jethrogb:jb/sgx-rearrange-files, r=nagisa
Dylan DPC [Fri, 7 May 2021 14:19:24 +0000 (16:19 +0200)]
Rollup merge of #85030 - jethrogb:jb/sgx-rearrange-files, r=nagisa

Rearrange SGX split module files

In #75979 several inlined modules were split out into multiple files.
This PR keeps the multiple files but moves a few things around to
organize things in a coherent way.

3 years agoRollup merge of #85029 - jethrogb:jb/sgx-movable-mutex, r=m-ou-se
Dylan DPC [Fri, 7 May 2021 14:19:23 +0000 (16:19 +0200)]
Rollup merge of #85029 - jethrogb:jb/sgx-movable-mutex, r=m-ou-se

SGX mutex is movable

r? ``@m-ou-se``

3 years agoRollup merge of #84991 - alexcrichton:target-feature-remap, r=nagisa
Dylan DPC [Fri, 7 May 2021 14:19:22 +0000 (16:19 +0200)]
Rollup merge of #84991 - alexcrichton:target-feature-remap, r=nagisa

rustc: Support Rust-specific features in -Ctarget-feature

Since the beginning of time the `-Ctarget-feature` flag on the command
line has largely been passed unmodified to LLVM. Afterwards, though, the
`#[target_feature]` attribute was stabilized and some of the names in
this attribute do not match the corresponding LLVM name. This is because
Rust doesn't always want to stabilize the exact feature name in LLVM for
the equivalent functionality in Rust. This creates a situation, however,
where in Rust you'd write:

    #[target_feature(enable = "pclmulqdq")]
    unsafe fn foo() {
        // ...
    }

but on the command line you would write:

    RUSTFLAGS="-Ctarget-feature=+pclmul" cargo build --release

This difference is somewhat odd to deal with if you're a newcomer and
the situation may be made worse with upcoming features like [WebAssembly
SIMD](https://github.com/rust-lang/rust/issues/74372) which may be more
prevalent.

This commit implements a mapping to translate requests via
`-Ctarget-feature` through the same name-mapping functionality that's
present for attributes in Rust going to LLVM. This means that
`+pclmulqdq` will work on x86 targets where as previously it did not.

I've attempted to keep this backwards-compatible where the compiler will
just opportunistically attempt to remap features found in
`-Ctarget-feature`, but if there's something it doesn't understand it
gets passed unmodified to LLVM just as it was before.

3 years agoRollup merge of #84930 - hermitcore:target, r=nagisa
Dylan DPC [Fri, 7 May 2021 14:19:21 +0000 (16:19 +0200)]
Rollup merge of #84930 - hermitcore:target, r=nagisa

rename LLVM target for RustyHermit

- RustyHermit is a library operating system, where the user-
  and the kernel-space use the same target
- by a mistake a previous patch changes the target to an incorect value
- this merge request revert the previous changes

3 years agoRollup merge of #84866 - petrochenkov:wholesome, r=Mark-Simulacrum
Dylan DPC [Fri, 7 May 2021 14:19:20 +0000 (16:19 +0200)]
Rollup merge of #84866 - petrochenkov:wholesome, r=Mark-Simulacrum

linker: Avoid library duplication with `/WHOLEARCHIVE`

Looks like in #72785 I misinterpreted how the `link.exe`'s `/WHOLEARCHIVE` flag works.

It's not necessary to write `mylib /WHOLEARCHIVE:mylib` to mark `mylib` as whole archive, `/WHOLEARCHIVE:mylib` alone is enough.

https://docs.microsoft.com/en-us/cpp/build/reference/wholearchive-include-all-library-object-files?view=msvc-160

3 years agoRollup merge of #84655 - CDirkx:wasm, r=m-ou-se
Dylan DPC [Fri, 7 May 2021 14:19:20 +0000 (16:19 +0200)]
Rollup merge of #84655 - CDirkx:wasm, r=m-ou-se

Cleanup of `wasm`

Some more cleanup of `sys`, this time `wasm`

- Reuse `unsupported::args` (functionally equivalent implementation, just an empty iterator).
- Split out `atomics` implementation of `wasm::thread`, the non-`atomics` implementation is reused from `unsupported`.
- Move all of the `atomics` code to a separate directory `wasm/atomics`.

````@rustbot```` label: +T-libs-impl
r? ````@m-ou-se````

3 years agoRollup merge of #84442 - jyn514:doc-cfg, r=petrochenkov
Dylan DPC [Fri, 7 May 2021 14:19:19 +0000 (16:19 +0200)]
Rollup merge of #84442 - jyn514:doc-cfg, r=petrochenkov

Unify rustc and rustdoc parsing of `cfg()`

This extracts a new `parse_cfg` function that's used between both.

- Treat `#[doc(cfg(x), cfg(y))]` the same as `#[doc(cfg(x)]
  #[doc(cfg(y))]`. Previously it would be completely ignored.
- Treat `#[doc(inline, cfg(x))]` the same as `#[doc(inline)]
  #[doc(cfg(x))]`. Previously, the cfg would be ignored.
- Pass the cfg predicate through to rustc_expand to be validated

Technically this is a breaking change, but doc_cfg is still nightly so I don't think it matters.

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

r? `````````@petrochenkov`````````

3 years agoRollup merge of #84254 - jclulow:illumos-link-order, r=petrochenkov
Dylan DPC [Fri, 7 May 2021 14:19:18 +0000 (16:19 +0200)]
Rollup merge of #84254 - jclulow:illumos-link-order, r=petrochenkov

illumos should put libc last in library search order

Under some conditions, the toolchain will produce a sequence of linker
arguments that result in a NEEDED list that puts libc before libgcc_s;
e.g.,

    [0]  NEEDED            0x2046ba            libc.so.1
    [1]  NEEDED            0x204723            libm.so.2
    [2]  NEEDED            0x204736            libsocket.so.1
    [3]  NEEDED            0x20478b            libumem.so.1
    [4]  NEEDED            0x204763            libgcc_s.so.1

Both libc and libgcc_s provide an unwinder implementation, but libgcc_s
provides some extra symbols upon which Rust directly depends.  If libc
is first in the NEEDED list we will find some of those symbols in libc
but others in libgcc_s, resulting in undefined behaviour as the two
implementations do not use compatible interior data structures.

This solution is not perfect, but is the simplest way to produce correct
binaries on illumos for now.