]> git.lizzy.rs Git - rust.git/log
rust.git
19 months agoUse `as_deref` in compiler (but only where it makes sense)
Maybe Waffle [Wed, 16 Nov 2022 21:58:58 +0000 (21:58 +0000)]
Use `as_deref` in compiler (but only where it makes sense)

19 months agoAuto merge of #102935 - ajtribick:display-float-0.5-fixed-0, r=scottmcm
bors [Wed, 16 Nov 2022 07:20:30 +0000 (07:20 +0000)]
Auto merge of #102935 - ajtribick:display-float-0.5-fixed-0, r=scottmcm

Fix inconsistent rounding of 0.5 when formatted to 0 decimal places

As described in #70336, when displaying values to zero decimal places the value of 0.5 is rounded to 1, which is inconsistent with the display of other half-integer values which round to even.

From testing the flt2dec implementation, it looks like this comes down to the condition in the fixed-width Dragon implementation where an empty buffer is treated as a case to apply rounding up. I believe the change below fixes it and updates only the relevant tests.

Nevertheless I am aware this is very much a core piece of functionality, so please take a very careful look to make sure I haven't missed anything. I hope this change does not break anything in the wider ecosystem as having a consistent rounding behaviour in floating point formatting is in my opinion a useful feature to have.

Resolves #70336

19 months agoAuto merge of #104468 - weihanglo:update-cargo, r=weihanglo
bors [Wed, 16 Nov 2022 03:23:42 +0000 (03:23 +0000)]
Auto merge of #104468 - weihanglo:update-cargo, r=weihanglo

Update cargo

5 commits in a3dfea71ca0c888a88111086898aa833c291d497..16b097879b6f117c8ae698aab054c87f26ff325e 2022-11-11 03:50:47 +0000 to 2022-11-14 23:28:16 +0000
- improve error message for cargo add/remove (rust-lang/cargo#11375)
- Bump crate versions of `cargo-util` and `crates-io` (rust-lang/cargo#11369)
- doc(changelog): suggestions of cargo fix are nightly only (rust-lang/cargo#11373)
- Add warning when PATH env separator is in project path (rust-lang/cargo#11318)
- Fix git2 safe-directory disable (rust-lang/cargo#11366)

r? `@ghost`

19 months agoUpdate cargo
Weihang Lo [Wed, 16 Nov 2022 00:10:54 +0000 (00:10 +0000)]
Update cargo

5 commits in a3dfea71ca0c888a88111086898aa833c291d497..16b097879b6f117c8ae698aab054c87f26ff325e
2022-11-11 03:50:47 +0000 to 2022-11-14 23:28:16 +0000
- improve error message for cargo add/remove (rust-lang/cargo#11375)
- Bump crate versions of `cargo-util` and `crates-io` (rust-lang/cargo#11369)
- doc(changelog): suggestions of cargo fix are nightly only (rust-lang/cargo#11373)
- Add warning when PATH env separator is in project path (rust-lang/cargo#11318)
- Fix git2 safe-directory disable (rust-lang/cargo#11366)

19 months agoAuto merge of #102570 - cjgillot:deagg-debuginfo, r=oli-obk
bors [Tue, 15 Nov 2022 23:52:22 +0000 (23:52 +0000)]
Auto merge of #102570 - cjgillot:deagg-debuginfo, r=oli-obk

Perform simple scalar replacement of aggregates (SROA) MIR opt

This is a re-open of https://github.com/rust-lang/rust/pull/85796

I copied the debuginfo implementation (first commit) from `@eddyb's` own SROA PR.

This pass replaces plain field accesses by simple locals when possible.
To be eligible, the replaced locals:
- must not be enums or unions;
- must not be used whole;
- must not have their address taken.

The storage and deinit statements are duplicated on each created local.

cc `@tmiasko` who reviewed the former version of this PR.

20 months agoMark test as panic=abort.
Camille GILLOT [Tue, 15 Nov 2022 18:06:45 +0000 (18:06 +0000)]
Mark test as panic=abort.

20 months agoEnable SROA by at mir-opt level 3.
Camille GILLOT [Tue, 8 Nov 2022 17:38:21 +0000 (17:38 +0000)]
Enable SROA by at mir-opt level 3.

20 months agoFlatten aggregates into locals.
Camille GILLOT [Mon, 23 May 2022 07:27:44 +0000 (09:27 +0200)]
Flatten aggregates into locals.

20 months agoIntroduce composite debuginfo.
Camille GILLOT [Sat, 1 Oct 2022 21:10:36 +0000 (23:10 +0200)]
Introduce composite debuginfo.

20 months agoAuto merge of #104054 - RalfJung:byte-provenance, r=oli-obk
bors [Tue, 15 Nov 2022 17:37:15 +0000 (17:37 +0000)]
Auto merge of #104054 - RalfJung:byte-provenance, r=oli-obk

interpret: support for per-byte provenance

Also factors the provenance map into its own module.

The third commit does the same for the init mask. I can move it in a separate PR if you prefer.

Fixes https://github.com/rust-lang/miri/issues/2181

r? `@oli-obk`

20 months agoAuto merge of #104437 - matthiaskrgr:rollup-n5jdg9v, r=matthiaskrgr
bors [Tue, 15 Nov 2022 12:35:57 +0000 (12:35 +0000)]
Auto merge of #104437 - matthiaskrgr:rollup-n5jdg9v, r=matthiaskrgr

Rollup of 9 pull requests

Successful merges:

 - #103439 (Show note where the macro failed to match)
 - #103734 (Adjust stabilization version to 1.65.0 for wasi fds)
 - #104148 (Visit attributes of trait impl items during AST validation)
 - #104241 (Move most of unwind's build script to lib.rs)
 - #104258 (Deduce closure signature from a type alias `impl Trait`'s supertraits)
 - #104296 (Walk types more carefully in `ProhibitOpaqueTypes` visitor)
 - #104309 (Slightly improve error message for invalid identifier)
 - #104316 (Simplify suggestions for errors in generators.)
 - #104339 (Add `rustc_deny_explicit_impl`)

Failed merges:

 - #103484 (Add `rust` to `let_underscore_lock` example)

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

20 months agoRollup merge of #104339 - compiler-errors:rustc_deny_explicit_impl, r=cjgillot
Matthias Krüger [Tue, 15 Nov 2022 09:44:12 +0000 (10:44 +0100)]
Rollup merge of #104339 - compiler-errors:rustc_deny_explicit_impl, r=cjgillot

Add `rustc_deny_explicit_impl`

Also adjust `E0322` error message to be more general, since it's used for `DiscriminantKind` and `Pointee` as well.

Also add `rustc_deny_explicit_impl` on the `Tuple` and `Destruct` marker traits.

20 months agoRollup merge of #104316 - cjgillot:simplify-async-suggestion, r=estebank
Matthias Krüger [Tue, 15 Nov 2022 09:44:11 +0000 (10:44 +0100)]
Rollup merge of #104316 - cjgillot:simplify-async-suggestion, r=estebank

Simplify suggestions for errors in generators.

Split from https://github.com/rust-lang/rust/pull/101692/

20 months agoRollup merge of #104309 - chenyukang:yukang/fix-104088-identifier-error, r=davidtwco
Matthias Krüger [Tue, 15 Nov 2022 09:44:11 +0000 (10:44 +0100)]
Rollup merge of #104309 - chenyukang:yukang/fix-104088-identifier-error, r=davidtwco

Slightly improve error message for invalid identifier

fixes #104088

20 months agoRollup merge of #104296 - compiler-errors:opaque-ty-ffi-normalization-cycle, r=lcnr
Matthias Krüger [Tue, 15 Nov 2022 09:44:10 +0000 (10:44 +0100)]
Rollup merge of #104296 - compiler-errors:opaque-ty-ffi-normalization-cycle, r=lcnr

Walk types more carefully in `ProhibitOpaqueTypes` visitor

The visitor didn't account for the case where you could have `<TAIT as Trait>::Assoc` normalize to itself, in the case of a `type TAIT = impl Trait` with an unconstrained associated type. That causes the visitor to loop on the same type over and over.

Fixes #104291

20 months agoRollup merge of #104258 - compiler-errors:tait-closure-deduce, r=oli-obk
Matthias Krüger [Tue, 15 Nov 2022 09:44:10 +0000 (10:44 +0100)]
Rollup merge of #104258 - compiler-errors:tait-closure-deduce, r=oli-obk

Deduce closure signature from a type alias `impl Trait`'s supertraits

r? `@oli-obk`

Basically pass the TAIT's bounds through the same method that we're using to deduce a signature from infer var closure bounds.

Does this need a new FCP? I see it as a logical extension of #101834, but happy to rfcbot a new one if it does.

20 months agoRollup merge of #104241 - bjorn3:smaller_unwind_build_script, r=Mark-Simulacrum
Matthias Krüger [Tue, 15 Nov 2022 09:44:09 +0000 (10:44 +0100)]
Rollup merge of #104241 - bjorn3:smaller_unwind_build_script, r=Mark-Simulacrum

Move most of unwind's build script to lib.rs

Only the android libunwind detection remains in the build script

* Reduces dependence on build scripts for building the standard library
* Reduces dependence on exact target names in favor of using semantic cfg(target_*) usage.
* Keeps almost all code related to linking of the unwinder in one file

20 months agoRollup merge of #104148 - fmease:fix-104140, r=petrochenkov
Matthias Krüger [Tue, 15 Nov 2022 09:44:09 +0000 (10:44 +0100)]
Rollup merge of #104148 - fmease:fix-104140, r=petrochenkov

Visit attributes of trait impl items during AST validation

Fixes #104140.

This fix might not be backward compatible (in practice) since we now validate more attributes than before.
Should I write more tests?

`@rustbot` label A-attributes

20 months agoRollup merge of #103734 - Mark-Simulacrum:fix-version-stabilized, r=JohnTitor
Matthias Krüger [Tue, 15 Nov 2022 09:44:08 +0000 (10:44 +0100)]
Rollup merge of #103734 - Mark-Simulacrum:fix-version-stabilized, r=JohnTitor

Adjust stabilization version to 1.65.0 for wasi fds

See https://github.com/rust-lang/rust/pull/103308#issuecomment-1292277645 for this ask.

Backport of that PR to beta (1.65.0) will include a similar patch.

20 months agoRollup merge of #103439 - Nilstrieb:help-me-with-my-macro, r=estebank
Matthias Krüger [Tue, 15 Nov 2022 09:44:07 +0000 (10:44 +0100)]
Rollup merge of #103439 - Nilstrieb:help-me-with-my-macro, r=estebank

Show note where the macro failed to match

When feeding the wrong tokens, it used to fail with a very generic error that wasn't very helpful. This change tries to help by noting where specifically the matching went wrong.

```rust
macro_rules! uwu {
    (a a a b) => {};
}
uwu! { a a a c }
```

```diff
error: no rules expected the token `c`
 --> macros.rs:5:14
  |
1 | macro_rules! uwu {
  | ---------------- when calling this macro
...
4 | uwu! { a a a c }
  |              ^ no rules expected this token in macro call
  |
+note: while trying to match `b`
+ --> macros.rs:2:12
+  |
+2 |     (a a a b) => {};
+  |            ^
```

20 months agoAuto merge of #101168 - jachris:dataflow-const-prop, r=oli-obk
bors [Tue, 15 Nov 2022 09:38:05 +0000 (09:38 +0000)]
Auto merge of #101168 - jachris:dataflow-const-prop, r=oli-obk

Add new MIR constant propagation based on dataflow analysis

The current constant propagation in `rustc_mir_transform/src/const_prop.rs` fails to handle many cases that would be expected from a constant propagation optimization. For example:
```rust
let x = if true { 0 } else { 0 };
```
This pull request adds a new constant propagation MIR optimization pass based on the existing dataflow analysis framework. Since most of the analysis is not unique to constant propagation, a generic framework has been extracted. It works on top of the existing framework and could be reused for other optimzations.

Closes #80038. Closes #81605.

## Todo
### Essential
- [x] [Writes to inactive enum variants](https://github.com/rust-lang/rust/pull/101168#pullrequestreview-1089493974). Resolved by rejecting the registration of places with downcast projections for now. Could be improved by flooding other variants if mutable access to a variant is observed.
- [X] Handle [`StatementKind::CopyNonOverlapping`](https://github.com/rust-lang/rust/pull/101168#discussion_r957774914). Resolved by flooding the destination.
- [x] Handle `UnsafeCell` / `!Freeze` correctly.
- [X] Overflow propagation of `CheckedBinaryOp`: Decided to not propagate if overflow flag is `true` (`false` will still be propagated)
- [x] More documentation in general.
- [x] Arguments for correctness, documentation of necessary assumptions.
- [x] Better performance, or alternatively, require `-Zmir-opt-level=3` for now.

### Extra
- [x]  Add explicit unreachability, i.e. upgrading the lattice from $\mathbb{P} \to \mathbb{V}$ to $\set{\bot} \cup (\mathbb{P} \to \mathbb{V})$.
- [x] Use storage statements to improve precision.
- [ ] Consider opening issue for duplicate diagnostics: https://github.com/rust-lang/rust/pull/101168#issuecomment-1276609950
- [ ] Flood moved-from places with $\bot$ (requires some changes for places with tracked projections).
- [ ] Add downcast projections back in.
- [ ] [Algebraic simplifications](https://github.com/rust-lang/rust/pull/101168#discussion_r957967878) (possibly with a shared API; done by old const prop).
- [ ] Propagation through slices / arrays.
- [ ] Find other optimizations that are done by old `const_prop.rs`, but not by this one.

20 months agoAuto merge of #104428 - matthiaskrgr:rollup-jo3078i, r=matthiaskrgr
bors [Tue, 15 Nov 2022 06:43:28 +0000 (06:43 +0000)]
Auto merge of #104428 - matthiaskrgr:rollup-jo3078i, r=matthiaskrgr

Rollup of 13 pull requests

Successful merges:

 - #103842 (Adding Fuchsia compiler testing script, docs)
 - #104354 (Remove leading newlines from `NonZero*` doc examples)
 - #104372 (Update compiler-builtins)
 - #104380 (rustdoc: remove unused CSS `code { opacity: 1 }`)
 - #104381 (Remove dead NoneError diagnostic handling)
 - #104383 (Remove unused symbols and diagnostic items)
 - #104391 (Deriving cleanups)
 - #104403 (Specify language of code comment to generate document)
 - #104404 (Fix missing minification for static files)
 - #104413 ([llvm-wrapper] adapt for LLVM API change)
 - #104415 (rustdoc: fix corner case in search keyboard commands)
 - #104422 (Fix suggest associated call syntax)
 - #104426 (Add test for #102154)

Failed merges:

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

20 months agoNormalize types before looking for opaques
Michael Goulet [Tue, 15 Nov 2022 03:44:45 +0000 (03:44 +0000)]
Normalize types before looking for opaques

20 months agoAuto merge of #104418 - matthiaskrgr:rollup-y4i6xjc, r=matthiaskrgr
bors [Tue, 15 Nov 2022 03:37:07 +0000 (03:37 +0000)]
Auto merge of #104418 - matthiaskrgr:rollup-y4i6xjc, r=matthiaskrgr

Rollup of 11 pull requests

Successful merges:

 - #101967 (Move `unix_socket_abstract` feature API to `SocketAddrExt`.)
 - #102470 (Stabilize const char convert)
 - #104223 (Recover from function pointer types with generic parameter list)
 - #104229 (Don't print full paths in overlap errors)
 - #104294 (Don't ICE with inline const errors during MIR build)
 - #104332 (Fixed some `_i32` notation in `maybe_uninit`’s doc)
 - #104349 (fix some typos in comments)
 - #104350 (Fix x finding Python on Windows)
 - #104356 (interpret: make check_mplace public)
 - #104364 (rustdoc: Resolve doc links in external traits having local impls)
 - #104378 (Bump chalk to v0.87)

Failed merges:

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

20 months agomove testcase for tidy
yukang [Tue, 15 Nov 2022 01:00:27 +0000 (09:00 +0800)]
move testcase for tidy

20 months agocomment feedback
yukang [Mon, 14 Nov 2022 14:13:49 +0000 (22:13 +0800)]
comment feedback

20 months agofix #104088, Slightly improve error message for invalid identifier
yukang [Fri, 11 Nov 2022 20:22:47 +0000 (04:22 +0800)]
fix #104088, Slightly improve error message for invalid identifier

20 months agoRollup merge of #104426 - aDotInTheVoid:test-102154, r=compiler-errors
Matthias Krüger [Tue, 15 Nov 2022 00:40:47 +0000 (01:40 +0100)]
Rollup merge of #104426 - aDotInTheVoid:test-102154, r=compiler-errors

Add test for #102154

Closes #102154

20 months agoRollup merge of #104422 - compiler-errors:fix-suggest_associated_call_syntax, r=BoxyUwU
Matthias Krüger [Tue, 15 Nov 2022 00:40:47 +0000 (01:40 +0100)]
Rollup merge of #104422 - compiler-errors:fix-suggest_associated_call_syntax, r=BoxyUwU

Fix suggest associated call syntax

Fixes #104412

20 months agoRollup merge of #104415 - notriddle:notriddle/search-keyboard-commands, r=GuillaumeGomez
Matthias Krüger [Tue, 15 Nov 2022 00:40:46 +0000 (01:40 +0100)]
Rollup merge of #104415 - notriddle:notriddle/search-keyboard-commands, r=GuillaumeGomez

rustdoc: fix corner case in search keyboard commands

This fixes a bug when that shows up in nightly and in stable where:

* Search something
* Press down: first result is highlighted
* Press down: second result is highlighted
* Press down: third result is highlighted
* Press right: first result of second tab is highlighted
* Press left: third result of first tab is highlighted
* Press up: second result is highlighted
* Press up: first result is highlighted
* Press up: Search box is highlighted
* Press down: **third result** is highlighted, where it ought to highlight the first result

20 months agoRollup merge of #104413 - krasimirgg:llvm-16-mref, r=nikic
Matthias Krüger [Tue, 15 Nov 2022 00:40:46 +0000 (01:40 +0100)]
Rollup merge of #104413 - krasimirgg:llvm-16-mref, r=nikic

[llvm-wrapper] adapt for LLVM API change

for https://github.com/llvm/llvm-project/commit/feda983ff89b7be27a9bfabbabce7d2b59869eba.

20 months agoRollup merge of #104404 - GuillaumeGomez:fix-missing-minification, r=notriddle
Matthias Krüger [Tue, 15 Nov 2022 00:40:45 +0000 (01:40 +0100)]
Rollup merge of #104404 - GuillaumeGomez:fix-missing-minification, r=notriddle

Fix missing minification for static files

It's a fix for https://github.com/rust-lang/rust/pull/101702.

The problem was that `Path::ends_with` doesn't do what we thought it does: it checks if the entire item is the last path part, no just if the "path string" ends with the given argument. So instead, I just used the `extension()` method to get the information we want.

cc `@jsha`
r? `@notriddle`

PS: Is it worth it to add a CI test to ensure that the minification was performed on JS and CSS files or not?

20 months agoRollup merge of #104403 - koka831:lint-doc, r=Dylan-DPC
Matthias Krüger [Tue, 15 Nov 2022 00:40:45 +0000 (01:40 +0100)]
Rollup merge of #104403 - koka831:lint-doc, r=Dylan-DPC

Specify language of code comment to generate document

Fix `let_underscore_drop` comment
https://doc.rust-lang.org/rustc/lints/listing/allowed-by-default.html#example-7

20 months agoRollup merge of #104391 - nnethercote:deriving-cleanups, r=jackh726
Matthias Krüger [Tue, 15 Nov 2022 00:40:44 +0000 (01:40 +0100)]
Rollup merge of #104391 - nnethercote:deriving-cleanups, r=jackh726

Deriving cleanups

Fixing some minor problems `@RalfJung` found in #99046.

r? `@RalfJung`

20 months agoRollup merge of #104383 - WaffleLapkin:rustc_undiagnostic_item, r=compiler-errors
Matthias Krüger [Tue, 15 Nov 2022 00:40:44 +0000 (01:40 +0100)]
Rollup merge of #104383 - WaffleLapkin:rustc_undiagnostic_item, r=compiler-errors

Remove unused symbols and diagnostic items

As the title suggests, this removes unused symbols from `sym::` and `#[rustc_diagnostic_item]` annotations that weren't mentioned anywhere.

Originally I tried to use grep, to find symbols and item names that are never mentioned via `sym::name`, however this produced a lot of false positives (?), for example clippy matching on `Symbol::as_str` or macros "implicitly" adding `sym::`. I ended up fixing all these false positives (?) by hand, but tbh I'm not sure if it was worth it...

20 months agoRollup merge of #104381 - mejrs:none_error, r=compiler-errors
Matthias Krüger [Tue, 15 Nov 2022 00:40:44 +0000 (01:40 +0100)]
Rollup merge of #104381 - mejrs:none_error, r=compiler-errors

Remove dead NoneError diagnostic handling

`NoneError` was removed some time ago, so this was dead code.

20 months agoRollup merge of #104380 - rust-lang:notriddle/code-opacity, r=GuillaumeGomez
Matthias Krüger [Tue, 15 Nov 2022 00:40:43 +0000 (01:40 +0100)]
Rollup merge of #104380 - rust-lang:notriddle/code-opacity, r=GuillaumeGomez

rustdoc: remove unused CSS `code { opacity: 1 }`

According to https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/CSS.20cleanup this style was added for declarations that no longer use opacity.

20 months agoRollup merge of #104372 - Ayush1325:compiler-builtins, r=JohnTitor
Matthias Krüger [Tue, 15 Nov 2022 00:40:43 +0000 (01:40 +0100)]
Rollup merge of #104372 - Ayush1325:compiler-builtins, r=JohnTitor

Update compiler-builtins

This was originally a part of https://github.com/rust-lang/rust/pull/100316. However, extracting it to a seperate PR should help with any extra testing that might be needed.

Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
20 months agoRollup merge of #104354 - lukas-code:blank-lines-2, r=JohnTitor
Matthias Krüger [Tue, 15 Nov 2022 00:40:42 +0000 (01:40 +0100)]
Rollup merge of #104354 - lukas-code:blank-lines-2, r=JohnTitor

Remove leading newlines from `NonZero*` doc examples

Like https://github.com/rust-lang/rust/pull/103045, but for `NonZero*`.

`@rustbot` label A-docs

20 months agoRollup merge of #103842 - andrewpollack:add-fuchsia-test-script, r=tmandry
Matthias Krüger [Tue, 15 Nov 2022 00:40:42 +0000 (01:40 +0100)]
Rollup merge of #103842 - andrewpollack:add-fuchsia-test-script, r=tmandry

Adding Fuchsia compiler testing script, docs

Adding Fuchsia compiler testing script and related docs updates

r? `@tmandry`

cc. `@djkoloski`

20 months agoAuto merge of #104091 - BelovDV:issue-103044, r=petrochenkov
bors [Tue, 15 Nov 2022 00:38:08 +0000 (00:38 +0000)]
Auto merge of #104091 - BelovDV:issue-103044, r=petrochenkov

Wrap bundled static libraries into object files

Fixes #103044 (not sure, couldn't test locally)

Bundled static libraries should be wrapped into object files as it's done for metadata file.

r? `@petrochenkov`

20 months agoAdd test for #102154
Nixon Enraght-Moony [Mon, 14 Nov 2022 22:42:57 +0000 (22:42 +0000)]
Add test for #102154

20 months agorustdoc: fix corner case in search keyboard commands
Michael Howell [Mon, 14 Nov 2022 17:41:07 +0000 (10:41 -0700)]
rustdoc: fix corner case in search keyboard commands

20 months agoAdd regression test
Michael Goulet [Mon, 14 Nov 2022 19:29:17 +0000 (19:29 +0000)]
Add regression test

20 months agoDo autoderef to match impl against rcvr
Michael Goulet [Mon, 14 Nov 2022 19:18:38 +0000 (19:18 +0000)]
Do autoderef to match impl against rcvr

20 months agoMove logic into method
Michael Goulet [Mon, 14 Nov 2022 18:40:20 +0000 (18:40 +0000)]
Move logic into method

20 months agoDrive-by: actual -> rcvr_ty
Michael Goulet [Mon, 14 Nov 2022 17:25:37 +0000 (17:25 +0000)]
Drive-by: actual -> rcvr_ty
20 months agoShow a note where a macro failed to match
Nilstrieb [Sat, 12 Nov 2022 22:18:32 +0000 (23:18 +0100)]
Show a note where a macro failed to match

This shows a small note on what the macro matcher was currently
processing to aid with "no rules expected the token X" errors.

20 months agoRollup merge of #104378 - compiler-errors:chalk-up, r=jackh726
Matthias Krüger [Mon, 14 Nov 2022 18:26:19 +0000 (19:26 +0100)]
Rollup merge of #104378 - compiler-errors:chalk-up, r=jackh726

Bump chalk to v0.87

1. Removes `ReEmpty` from chalk
2. Adds support for the `std::marker::Tuple` trait

20 months agoRollup merge of #104364 - petrochenkov:docice2, r=GuillaumeGomez
Matthias Krüger [Mon, 14 Nov 2022 18:26:19 +0000 (19:26 +0100)]
Rollup merge of #104364 - petrochenkov:docice2, r=GuillaumeGomez

rustdoc: Resolve doc links in external traits having local impls

For external impls it was done in https://github.com/rust-lang/rust/pull/103192 right away, but the local impl case was forgotten.

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

20 months agoRollup merge of #104356 - RalfJung:interpret-check-mplace, r=oli-obk
Matthias Krüger [Mon, 14 Nov 2022 18:26:18 +0000 (19:26 +0100)]
Rollup merge of #104356 - RalfJung:interpret-check-mplace, r=oli-obk

interpret: make check_mplace public

This helps avoid code duplication in https://github.com/rust-lang/miri/pull/2661.

20 months agoRollup merge of #104350 - SparkyPotato:fix-x-wrapper, r=jyn514
Matthias Krüger [Mon, 14 Nov 2022 18:26:18 +0000 (19:26 +0100)]
Rollup merge of #104350 - SparkyPotato:fix-x-wrapper, r=jyn514

Fix x finding Python on Windows

`x` searches through the path for `{dir}/python{2|3}?`, but this fails on Windows because the appropriate path is `{dir}/python.exe`.

This PR adds the expected `.exe` extension on Windows while searching.

20 months agoRollup merge of #104349 - rustaceanclub:master, r=oli-obk
Matthias Krüger [Mon, 14 Nov 2022 18:26:18 +0000 (19:26 +0100)]
Rollup merge of #104349 - rustaceanclub:master, r=oli-obk

fix some typos in comments

20 months agoRollup merge of #104332 - Elarcis:maybe_uninit_doc_fix, r=m-ou-se
Matthias Krüger [Mon, 14 Nov 2022 18:26:17 +0000 (19:26 +0100)]
Rollup merge of #104332 - Elarcis:maybe_uninit_doc_fix, r=m-ou-se

Fixed some `_i32` notation in `maybe_uninit`’s doc

This PR just changed two lines in the documentation for `MaybeUninit`:

```rs
let val = 0x12345678i32;
```
was changed to:
```rs
let val = 0x12345678_i32;
```
in two doctests, making the values a tad easier to read.

It does not seem like there are other literals needing this change in the file.

20 months agoRollup merge of #104294 - compiler-errors:inline-ct-err-in-mir-build, r=davidtwco
Matthias Krüger [Mon, 14 Nov 2022 18:26:17 +0000 (19:26 +0100)]
Rollup merge of #104294 - compiler-errors:inline-ct-err-in-mir-build, r=davidtwco

Don't ICE with inline const errors during MIR build

Fixes #104277

20 months agoRollup merge of #104229 - compiler-errors:overlap-full-path, r=davidtwco
Matthias Krüger [Mon, 14 Nov 2022 18:26:16 +0000 (19:26 +0100)]
Rollup merge of #104229 - compiler-errors:overlap-full-path, r=davidtwco

Don't print full paths in overlap errors

We don't print the full path in other diagnostics -- I don't think it particularly helps with the error message. I also delayed the printing until actually needing to render the error message.

r? diagnostics

20 months agoRollup merge of #104223 - fmease:recover-fn-ptr-with-generics, r=estebank
Matthias Krüger [Mon, 14 Nov 2022 18:26:16 +0000 (19:26 +0100)]
Rollup merge of #104223 - fmease:recover-fn-ptr-with-generics, r=estebank

Recover from function pointer types with generic parameter list

Give a more helpful error when encountering function pointer types with a generic parameter list like `fn<'a>(&'a str) -> bool` or `fn<T>(T) -> T` and suggest moving lifetime parameters to a `for<>` parameter list.

I've added a bunch of extra code to properly handle (unlikely?) corner cases like `for<'a> fn<'b>()` (where there already exists a `for<>` parameter list) correctly suggesting `for<'a, 'b> fn()` (merging the lists). If you deem this useless, I can simplify the code by suggesting nothing at all in this case.

I am quite open to suggestions regarding the wording of the diagnostic messages.

Fixes #103487.
``@rustbot`` label A-diagnostics
r? diagnostics

20 months agoRollup merge of #102470 - est31:stabilize_const_char_convert, r=joshtriplett
Matthias Krüger [Mon, 14 Nov 2022 18:26:15 +0000 (19:26 +0100)]
Rollup merge of #102470 - est31:stabilize_const_char_convert, r=joshtriplett

Stabilize const char convert

Split out `const_char_from_u32_unchecked` from `const_char_convert` and stabilize the rest, i.e. stabilize the following functions:

```Rust
impl char {
    pub const fn from_u32(self, i: u32) -> Option<char>;
    pub const fn from_digit(self, num: u32, radix: u32) -> Option<char>;
    pub const fn to_digit(self, radix: u32) -> Option<u32>;
}

// Available through core::char and std::char
mod char {
    pub const fn from_u32(i: u32) -> Option<char>;
    pub const fn from_digit(num: u32, radix: u32) -> Option<char>;
}
```

And put the following under the `from_u32_unchecked` const stability gate as it needs `Option::unwrap` which isn't const-stable (yet):

```Rust
impl char {
    pub const unsafe fn from_u32_unchecked(i: u32) -> char;
}

// Available through core::char and std::char
mod char {
    pub const unsafe fn from_u32_unchecked(i: u32) -> char;
}
```

cc the tracking issue #89259 (which I'd like to keep open for `const_char_from_u32_unchecked`).

20 months agoRollup merge of #101967 - jmillikin:linux-abstract-socket-addr, r=joshtriplett
Matthias Krüger [Mon, 14 Nov 2022 18:26:14 +0000 (19:26 +0100)]
Rollup merge of #101967 - jmillikin:linux-abstract-socket-addr, r=joshtriplett

Move `unix_socket_abstract` feature API to `SocketAddrExt`.

The pre-stabilized API for abstract socket addresses exposes methods on `SocketAddr` that are only enabled for `cfg(any(target_os = "android", target_os = "linux"))`. Per discussion in <https://github.com/rust-lang/rust/issues/85410>, moving these methods to an OS-specific extension trait is required before stabilization can be considered.

This PR makes four changes:
1. The internal module `std::os::net` contains logic for the unstable feature `tcp_quickack` (https://github.com/rust-lang/rust/issues/96256). I moved that code into `linux_ext/tcp.rs` and tried to adjust the module tree so it could accommodate a second unstable feature there.
2. Moves the public API out of `impl SocketAddr`, into `impl SocketAddrExt for SocketAddr` (the headline change).
3. The existing function names and docs for `unix_socket_abstract` refer to addresses as being created from abstract namespaces, but a more accurate description is that they create sockets in *the* abstract namespace. I adjusted the function signatures correspondingly and tried to update the docs to be clearer.
4. I also tweaked `from_abstract_name` so it takes an `AsRef<[u8]>` instead of `&[u8]`, allowing `b""` literals to be passed directly.

Issues:
1. The public module `std::os::linux::net` is marked as part of `tcp_quickack`. I couldn't figure out how to mark a module as being part of two unstable features, so I just left the existing attributes in place. My hope is that this will be fixed as a side-effect of stabilizing either feature.

20 months agoassert that we are (de)seiralizing ProvenanceMap correctly
Ralf Jung [Mon, 14 Nov 2022 12:37:08 +0000 (13:37 +0100)]
assert that we are (de)seiralizing ProvenanceMap correctly

20 months ago[llvm-wrapper] adapt for LLVM API change
Krasimir Georgiev [Mon, 14 Nov 2022 14:59:32 +0000 (14:59 +0000)]
[llvm-wrapper] adapt for LLVM API change

20 months agoMove most of unwind's build script to lib.rs
bjorn3 [Thu, 10 Nov 2022 12:17:31 +0000 (12:17 +0000)]
Move most of unwind's build script to lib.rs

Only the android libunwind detection remains in the build script

* Reduces dependence on build scripts for building the standard library
* Reduces dependence on exact target names in favor of using semantic
  cfg(target_*) usage.
* Keeps almost all code related to linking of the unwinder in one file

20 months agoFix missing minification for static files
Guillaume Gomez [Mon, 14 Nov 2022 14:14:54 +0000 (15:14 +0100)]
Fix missing minification for static files

20 months agoBless graphviz tests
Jannis Christopher Köhl [Mon, 14 Nov 2022 14:11:30 +0000 (15:11 +0100)]
Bless graphviz tests

20 months agoRemove redundant graphviz escaping
Jannis Christopher Köhl [Mon, 14 Nov 2022 14:11:18 +0000 (15:11 +0100)]
Remove redundant graphviz escaping

20 months agoSpecify language of code comment to generate document
koka [Mon, 14 Nov 2022 13:55:50 +0000 (22:55 +0900)]
Specify language of code comment to generate document

20 months agoManually implement `Encodable` for ProvenanceMap to avoid serializing an always-none...
Oli Scherer [Mon, 14 Nov 2022 09:49:32 +0000 (09:49 +0000)]
Manually implement `Encodable` for ProvenanceMap to avoid serializing an always-none option

20 months agoWrap bundlen static libraries into object files
Daniil Belov [Sun, 16 Oct 2022 14:05:53 +0000 (17:05 +0300)]
Wrap bundlen static libraries into object files

20 months agoAuto merge of #104387 - Manishearth:rollup-9e551p5, r=Manishearth
bors [Mon, 14 Nov 2022 06:30:18 +0000 (06:30 +0000)]
Auto merge of #104387 - Manishearth:rollup-9e551p5, r=Manishearth

Rollup of 9 pull requests

Successful merges:

 - #103709 (ci: Upgrade dist-x86_64-netbsd to NetBSD 9.0)
 - #103744 (Upgrade cc for working is_flag_supported on cross-compiles)
 - #104105 (llvm: dwo only emitted when object code emitted)
 - #104158 (Return .efi extension for EFI executable)
 - #104181 (Add a few known-bug tests)
 - #104266 (Regression test for coercion of mut-ref to dyn-star)
 - #104300 (Document `Path::parent` behavior around relative paths)
 - #104304 (Enable profiler in dist-s390x-linux)
 - #104362 (Add `delay_span_bug` to `AttrWrapper::take_for_recovery`)

Failed merges:

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

20 months agoRemove TraitDef::generics.
Nicholas Nethercote [Mon, 14 Nov 2022 04:43:10 +0000 (15:43 +1100)]
Remove TraitDef::generics.

Because it's always empty.

20 months agoAdd rustc_deny_explicit_impl
Michael Goulet [Sat, 12 Nov 2022 23:37:52 +0000 (23:37 +0000)]
Add rustc_deny_explicit_impl

20 months agoAuto merge of #104188 - jyn514:download-config-only, r=Mark-Simulacrum
bors [Mon, 14 Nov 2022 03:15:03 +0000 (03:15 +0000)]
Auto merge of #104188 - jyn514:download-config-only, r=Mark-Simulacrum

Make all download functions need only Config, not Builder

This also adds a new `mod download` instead of scattering the download code across `config.rs` and `native.rs`.

This is the simplest and also most bit-rotty part of https://github.com/rust-lang/rust/pull/102282. Opening it earlier so it's not mixed in with behavior changes and to avoid rebase hell.

cc https://github.com/rust-lang/rust/issues/94829 (which nows has the hackmd linked).

r? `@Mark-Simulacrum`

20 months agoRemove `addr_of` argument from `create_struct_pattern_fields`.
Nicholas Nethercote [Mon, 14 Nov 2022 02:59:54 +0000 (13:59 +1100)]
Remove `addr_of` argument from `create_struct_pattern_fields`.

Because it's always false.

20 months agoMake all download functions need only Config, not Builder
Joshua Nelson [Sun, 30 Oct 2022 22:29:51 +0000 (17:29 -0500)]
Make all download functions need only Config, not Builder

This also adds a new `mod download` instead of scattering the download code
across `config.rs` and `native.rs`.

20 months agoRollup merge of #104362 - WaffleLapkin:span_bug_won't_come_on_time_today, r=Aaron1011
Manish Goregaokar [Mon, 14 Nov 2022 02:49:27 +0000 (21:49 -0500)]
Rollup merge of #104362 - WaffleLapkin:span_bug_won't_come_on_time_today, r=Aaron1011

Add `delay_span_bug` to `AttrWrapper::take_for_recovery`

`take_for_recovery` should only be used for recovery (when we should already have an error), so using `delay_span_bug` seems appropriate.

cc `@Aaron1011` (you've added the `FIXME` that this pr fixes)

20 months agoRollup merge of #104304 - uweigand:s390x-profiler, r=Mark-Simulacrum
Manish Goregaokar [Mon, 14 Nov 2022 02:49:27 +0000 (21:49 -0500)]
Rollup merge of #104304 - uweigand:s390x-profiler, r=Mark-Simulacrum

Enable profiler in dist-s390x-linux

Build the profiler runtime to allow using -C profile-generate and -C instrument-coverage on s390x-linux.

I've verified in a local build that the runtime builds and the profiler is working fine on the platform.

20 months agoRollup merge of #104300 - tbu-:pr_path_parent_caveats, r=Mark-Simulacrum
Manish Goregaokar [Mon, 14 Nov 2022 02:49:27 +0000 (21:49 -0500)]
Rollup merge of #104300 - tbu-:pr_path_parent_caveats, r=Mark-Simulacrum

Document `Path::parent` behavior around relative paths

A relative path with just one component will return `Some("")` as its parent, which wasn't clear to me from the documentation.

The parent of `""` is `None`, which was missing from the documentation as well.

20 months agoRollup merge of #104266 - compiler-errors:issue-102430, r=Mark-Simulacrum
Manish Goregaokar [Mon, 14 Nov 2022 02:49:26 +0000 (21:49 -0500)]
Rollup merge of #104266 - compiler-errors:issue-102430, r=Mark-Simulacrum

Regression test for coercion of mut-ref to dyn-star

Closes #102430

20 months agoRollup merge of #104181 - jackh726:known-bug-tests, r=Mark-Simulacrum
Manish Goregaokar [Mon, 14 Nov 2022 02:49:26 +0000 (21:49 -0500)]
Rollup merge of #104181 - jackh726:known-bug-tests, r=Mark-Simulacrum

Add a few known-bug tests

The labels of these tests should be changed from `S-bug-has-mcve` to `S-bug-has-test` once this is merged.

cc:
#101518
#99492
#90950
#89196
#104034
#101350
#103705
#103899

I couldn't reproduce the failures in #101962 and #100772 (so either these have started passing, or I didn't repro properly), so leaving those out for now.

#102065 was a bit more complicated, since it uses `rustc_private` and I didn't want to mess with that.

20 months agoRollup merge of #104158 - Ayush1325:executable, r=Mark-Simulacrum
Manish Goregaokar [Mon, 14 Nov 2022 02:49:25 +0000 (21:49 -0500)]
Rollup merge of #104158 - Ayush1325:executable, r=Mark-Simulacrum

Return .efi extension for EFI executable

Originally part of https://github.com/rust-lang/rust/pull/100316

Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
20 months agoRollup merge of #104105 - davidtwco:split-dwarf-lto, r=michaelwoerister
Manish Goregaokar [Mon, 14 Nov 2022 02:49:25 +0000 (21:49 -0500)]
Rollup merge of #104105 - davidtwco:split-dwarf-lto, r=michaelwoerister

llvm: dwo only emitted when object code emitted

Fixes #103932.

`CompiledModule` should not think a DWARF object was emitted when a bitcode-only compilation has happened, this can confuse archive file creation (which expects to create an archive containing non-existent dwo files).

r? ``````@michaelwoerister``````

20 months agoRollup merge of #103744 - palfrey:unwind-upgrade-cc, r=Mark-Simulacrum
Manish Goregaokar [Mon, 14 Nov 2022 02:49:24 +0000 (21:49 -0500)]
Rollup merge of #103744 - palfrey:unwind-upgrade-cc, r=Mark-Simulacrum

Upgrade cc for working is_flag_supported on cross-compiles

https://github.com/rust-lang/rust/pull/85806 fixed unwind v.s gcc support on later Android ndks using `is_flag_supported`. However, due to https://github.com/rust-lang/cc-rs/issues/675, this didn't work properly on cross-compiles. https://github.com/rust-lang/cc-rs/commit/3eeb50b391a7543a6fed96276ee9388b5430a50d fixes this, and was released in cc 1.0.74, hence the upgrade

20 months agoRollup merge of #103709 - cuviper:netbsd-9, r=pietroalbini
Manish Goregaokar [Mon, 14 Nov 2022 02:49:24 +0000 (21:49 -0500)]
Rollup merge of #103709 - cuviper:netbsd-9, r=pietroalbini

ci: Upgrade dist-x86_64-netbsd to NetBSD 9.0

This is another step in toolchain upgrades for LLVM 16, which will need at least GCC 7.1.

Our previous NetBSD 8.0 cross-toolchain used its system GCC 5.5. While there are newer versions available in pkgsrc, I could not get those working for cross-compilation. Upgrading to NetBSD 9.0 gets us GCC 7.4, which is sufficient for now.

This will affect the compatibility of the build we ship for `x86_64-unknown-netbsd`, but others may still build their own from source if that is needed. It is expected that NetBSD 8 will reach EOL soon anyway, approximately one month after 10 is released, but there is no firm date for that.

20 months agoClarify `expand_struct_method_body`.
Nicholas Nethercote [Mon, 14 Nov 2022 02:49:08 +0000 (13:49 +1100)]
Clarify `expand_struct_method_body`.

Spotted by @RalfJung. This causes no behavioural changes.

20 months agoAuto merge of #103858 - Mark-Simulacrum:bump-bootstrap, r=pietroalbini
bors [Mon, 14 Nov 2022 00:07:19 +0000 (00:07 +0000)]
Auto merge of #103858 - Mark-Simulacrum:bump-bootstrap, r=pietroalbini

Bump bootstrap compiler to 1.66

This PR:

- Bumps version placeholders to release
- Bumps to latest beta
- cfg-steps code

r? `@pietroalbini`

20 months agoAdd a few known-bug tests
Jack Huey [Wed, 9 Nov 2022 03:15:02 +0000 (22:15 -0500)]
Add a few known-bug tests

20 months agoFix clippy and rustdoc
Maybe Waffle [Sun, 13 Nov 2022 22:58:20 +0000 (22:58 +0000)]
Fix clippy and rustdoc

please, please, don't match on `Symbol::as_str`s, every time you do,
somewhere in the world another waffle becomes sad...

20 months agorustdoc: remove unused CSS `code { opacity: 1 }`
Michael Howell [Sun, 13 Nov 2022 21:56:22 +0000 (14:56 -0700)]
rustdoc: remove unused CSS `code { opacity: 1 }`

According to https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/CSS.20cleanup
this style was added for declarations that no longer use opacity.

20 months agoRemove dead NoneError error handling
mejrs [Sun, 13 Nov 2022 21:48:27 +0000 (22:48 +0100)]
Remove dead NoneError error handling

20 months agoAuto merge of #103894 - mati865:gnullvm-libunwind-changes, r=thomcc
bors [Sun, 13 Nov 2022 21:12:48 +0000 (21:12 +0000)]
Auto merge of #103894 - mati865:gnullvm-libunwind-changes, r=thomcc

Change the way libunwind is linked for *-windows-gnullvm targets

I have no idea why previous way works for `x86_64-fortanix-unknown-sgx` (assuming it actually works...) but not for `gnullvm`. It fails when linking libtest during Rust build (unless somebody adds `RUSTFLAGS='-Clinkarg=-lunwind'`).
Also fixes exception handling on AArch64.

20 months agoRemove unused symbols
Maybe Waffle [Sun, 13 Nov 2022 20:05:32 +0000 (20:05 +0000)]
Remove unused symbols

20 months agoMake rustc build with new chalk
Michael Goulet [Sun, 13 Nov 2022 19:53:35 +0000 (19:53 +0000)]
Make rustc build with new chalk

20 months agoBump chalk to v0.87
Michael Goulet [Sun, 13 Nov 2022 19:29:38 +0000 (19:29 +0000)]
Bump chalk to v0.87

20 months agoRemove unused diagnostic items
Maybe Waffle [Sun, 13 Nov 2022 18:49:21 +0000 (18:49 +0000)]
Remove unused diagnostic items

20 months agoAuto merge of #104370 - matthiaskrgr:rollup-c3b38sm, r=matthiaskrgr
bors [Sun, 13 Nov 2022 18:13:08 +0000 (18:13 +0000)]
Auto merge of #104370 - matthiaskrgr:rollup-c3b38sm, r=matthiaskrgr

Rollup of 5 pull requests

Successful merges:

 - #103996 (Add small clarification around using pointers derived from references)
 - #104315 (Improve spans with `use crate::{self}`)
 - #104320 (Use `derive_const` and rm manual StructuralEq impl)
 - #104357 (add is_sized method on Abi and Layout, and use it)
 - #104365 (Add x tool to triagebot)

Failed merges:

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

20 months agoUpdate compiler-builtins
Ayush Singh [Sun, 13 Nov 2022 16:50:54 +0000 (22:20 +0530)]
Update compiler-builtins

This was originally a part of https://github.com/rust-lang/rust/pull/100316.
However, extracting it to a seperate PR should help with any extra
testing that might be needed.

Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
20 months agoRollup merge of #104365 - albertlarsan68:add-x-tool-to-triagebot, r=Mark-Simulacrum
Matthias Krüger [Sun, 13 Nov 2022 16:37:38 +0000 (17:37 +0100)]
Rollup merge of #104365 - albertlarsan68:add-x-tool-to-triagebot, r=Mark-Simulacrum

Add x tool to triagebot

Assign the A-bootstrap label when a pr modifies the x tool.

Happened in #104350.

20 months agoRollup merge of #104357 - RalfJung:is-sized, r=cjgillot
Matthias Krüger [Sun, 13 Nov 2022 16:37:38 +0000 (17:37 +0100)]
Rollup merge of #104357 - RalfJung:is-sized, r=cjgillot

add is_sized method on Abi and Layout, and use it

This avoids the double negation of `!is_unsized()` that we have quite a lot.

20 months agoRollup merge of #104320 - fee1-dead-contrib:use-derive-const-in-std, r=oli-obk
Matthias Krüger [Sun, 13 Nov 2022 16:37:37 +0000 (17:37 +0100)]
Rollup merge of #104320 - fee1-dead-contrib:use-derive-const-in-std, r=oli-obk

Use `derive_const` and rm manual StructuralEq impl

This does not change any semantics of the impl except for the const stability. It should be fine because trait methods and const bounds can never be used in stable without enabling `const_trait_impl`.

cc `@oli-obk`

20 months agoRollup merge of #104315 - SparkyPotato:fix-104276, r=cjgillot
Matthias Krüger [Sun, 13 Nov 2022 16:37:37 +0000 (17:37 +0100)]
Rollup merge of #104315 - SparkyPotato:fix-104276, r=cjgillot

Improve spans with `use crate::{self}`

Fixes #104276.

The error becomes:
```
error: crate root imports need to be explicitly named: `use crate as name;`
 --> src/lib.rs.rs:1:13
  |
1 | use crate::{self};
  |             ^^^^

warning: unused import: `self`
 --> src/lib.rs:1:13
  |
1 | use crate::{self};
  |             ^^^^
  |
  = note: `#[warn(unused_imports)]` on by default
```