Commit Graph

224630 Commits

Author SHA1 Message Date
Dylan DPC df8b0dfc27
Rollup merge of #111612 - ChayimFriedman2:collect-into-slice-ref, r=petrochenkov
Give better error when collecting into `&[T]`

The detection of slice reference of `{integral}` in `rustc_on_unimplemented` is hacky, but a proper solution requires changing `FmtPrinter` to add a parameter to print integers as `{integral}` and I didn't want to change it just for `rustc_on_unimplemented`. I can do that if requested, though.

I'm open to better wording; this is the best I could come up with.
2023-05-23 00:32:18 +05:30
Dylan DPC 47fe1a3e1f
Rollup merge of #111609 - LegionMammal978:internal-unsafe, r=thomcc
Mark internal functions and traits unsafe to reflect preconditions

No semantics are changed in this PR; I only mark some functions and and a trait `unsafe` which already had implicit preconditions. Although it seems somewhat redundant for `numfmt::Part::Copy` to contain a `&[u8]` instead of a `&str`, given that all of its current consumers ultimately expect valid UTF-8. Is the type also intended to work for byte-slice formatting in the future?
2023-05-23 00:32:18 +05:30
Dylan DPC df86200965
Rollup merge of #111501 - WaffleLapkin:drivebycleanupuwu, r=oli-obk
MIR drive-by cleanups

Some random drive-by cleanups I did while working with MIR/THIR.
2023-05-23 00:32:17 +05:30
bors 2fe47b966a Auto merge of #111634 - marc0246:arc-new-uninit-bloat, r=thomcc
Fix duplicate `arcinner_layout_for_value_layout` calls when using the uninit `Arc` constructors

What this fixes is the duplicate calls to `arcinner_layout_for_value_layout` seen here: https://godbolt.org/z/jr5Gxozhj

The issue was discovered alongside #111603 but is otherwise unrelated to the duplicate `alloca`s, which remain unsolved. Everything I tried to solve said main issue has failed.

As for the duplicate layout calculations, I also tried slapping `#[inline]` and `#[inline(always)]` on everything in sight but the only thing that worked in the end is to dedup the calls by hand.
2023-05-22 15:06:32 +00:00
bors 03761a50a3 Auto merge of #111775 - compiler-errors:triple-check, r=Nilstrieb
Add extra debug assertions for equality for Adt/Variant/FieldDef

Would've made it easier to both catch and test https://github.com/rust-lang/rust/pull/111494. Maybe not worth it, since it does mean that the compiler is doing extra work when debug-assertions are enabled, but also that's what debug assertions are for :^)

This is a revival of #111523 because I think I pushed an empty branch and bors got a bit too excited it closed the PR.
2023-05-22 12:19:16 +00:00
bors 48ec50ae39 Auto merge of #111711 - Jules-Bertholet:document-pin-layout, r=thomcc
Document `Pin` memory layout

The fact that `Pin` is `#[repr(transparent)]` technically isn't documented anywhere currently. I don't see any reason why `Pin`'s layout would ever change, so this PR codifies it.

`@rustbot` label +T-libs-api -T-libs +A-docs +A-layout +A-pin
2023-05-22 09:35:51 +00:00
bors 2d66e5a729 Auto merge of #111835 - matthiaskrgr:rollup-qd4b2vu, r=matthiaskrgr
Rollup of 2 pull requests

Successful merges:

 - #111810 (Don't use inner macro in `marker_impls`)
 - #111826 (Render test messages from bootstrap)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-05-22 06:38:20 +00:00
Matthias Krüger e2362d7e1a
Rollup merge of #111826 - ehuss:bootstrap-test-render-message, r=clubby789
Render test messages from bootstrap

Bootstrap was not rendering messages from the test harness when a test failed. This can include messages like "test did not panic as expected". This fixes it by making sure those messages are printed on failure.

Fixes #111825
2023-05-22 06:54:17 +02:00
Matthias Krüger b0415dbec7
Rollup merge of #111810 - compiler-errors:less-macro, r=thomcc
Don't use inner macro in `marker_impls`

Just recurse instead of having to define an inner macro to avoid the problem with expansion binders being misnumbered between the `$meta` and `$T` variables.

cc `@Veykril` this should fix rust-lang/rust-analyzer#14862 since we've gotten rid of the inner macro.
2023-05-22 06:54:16 +02:00
bors 7ca94f241f Auto merge of #111781 - the8472:filter-map-chunk, r=thomcc
optimize next_chunk impls for Filter and FilterMap

```
OLD:

benchmarks:
    iter::bench_next_chunk_filter_even                 104.00ns/iter  +/- 1.00ns
    iter::bench_next_chunk_filter_map_even             101.00ns/iter  +/- 1.00ns
    iter::bench_next_chunk_filter_map_mostly_false       1.99µs/iter +/- 10.00ns
    iter::bench_next_chunk_filter_map_predictably_true  56.00ns/iter  +/- 0.00ns
    iter::bench_next_chunk_filter_mostly_false           1.15µs/iter  +/- 6.00ns
    iter::bench_next_chunk_filter_predictably_true      65.00ns/iter  +/- 1.00ns

NEW:

benchmarks:
    iter::bench_next_chunk_filter_even                  42.00ns/iter  +/- 0.00ns
    iter::bench_next_chunk_filter_map_even              49.00ns/iter  +/- 1.00ns
    iter::bench_next_chunk_filter_map_mostly_false     501.00ns/iter  +/- 3.00ns
    iter::bench_next_chunk_filter_map_predictably_true  31.00ns/iter  +/- 0.00ns
    iter::bench_next_chunk_filter_mostly_false         534.00ns/iter +/- 13.00ns
    iter::bench_next_chunk_filter_predictably_true      28.00ns/iter  +/- 1.00ns
```
2023-05-22 03:37:20 +00:00
bors 3869b7b12d Auto merge of #111824 - lukas-code:strike, r=notriddle
rustdoc: include strikethrough in item summary

Fixes https://github.com/rust-lang/rust/issues/111822. Since **bold** and *italic* are included, I don't see why ~~strikethrough~~ shouldn't be.
2023-05-22 00:56:50 +00:00
bors 2440ccabc8 Auto merge of #111808 - Zoxc:query-structs-trim, r=cjgillot
Replace `QueryStruct` with arrays local to `rustc_query_impl`

This removes `QueryStruct` and instead uses constant arrays of function pointers for `try_collect_active_jobs`, `alloc_self_profile_query_strings` and `encode_query_results`. This further decouples `rustc_query_impl` from `rustc_middle`.

r? `@cjgillot`
2023-05-21 22:18:01 +00:00
bors 9d871b0617 Auto merge of #111731 - MU001999:fix/issue-111727, r=cjgillot
Keep only the trait when emitting the error for `MyTrait + 'a`

Fixes #111727
2023-05-21 19:19:49 +00:00
Eric Huss 59dff762bc Render test messages from bootstrap 2023-05-21 10:25:03 -07:00
Lukas Markeffsky f4ce0458e9 rustdoc: include strikethrough in item summary 2023-05-21 18:00:11 +02:00
bors 965cf5c1f5 Auto merge of #111820 - matthiaskrgr:rollup-9sb2lw9, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #111745 (Fix overflow in error emitter)
 - #111770 (Read beta version from the version file if building from a source tarball)
 - #111797 (Migrate GUI colors test to original CSS color format)
 - #111809 (Unset MIRI_BLESS for mir-opt-level 4 miri tests)
 - #111817 (Migrate GUI colors test to original CSS color format)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-05-21 14:14:29 +00:00
Matthias Krüger 7358166882
Rollup merge of #111817 - GuillaumeGomez:migrate-gui-test-color-3, r=notriddle
Migrate GUI colors test to original CSS color format

Follow-up of https://github.com/rust-lang/rust/pull/111459.

r? `@notriddle`
2023-05-21 16:03:01 +02:00
Matthias Krüger b4752cfbc7
Rollup merge of #111809 - DrMeepster:patch-1, r=jyn514
Unset MIRI_BLESS for mir-opt-level 4 miri tests

When running `x.py test src/tools/miri --bless`, the 2nd test run (with mir-opt-level 4) crashes because it disables ui checking, which is incompatible with blessing. This PR fixes that by not trying to bless that run.
2023-05-21 16:03:01 +02:00
Matthias Krüger 0afa79b53d
Rollup merge of #111797 - GuillaumeGomez:migrate-gui-test-color-2, r=notriddle
Migrate GUI colors test to original CSS color format

Follow-up of https://github.com/rust-lang/rust/pull/111459.

r? ``@notriddle``
2023-05-21 16:03:00 +02:00
Matthias Krüger 6ccc3de998
Rollup merge of #111770 - liushuyu:ubuntu/beta-rev-no-git, r=ozkanonur
Read beta version from the version file if building from a source tarball

This pull request changes the `bootstrap` behaviour so that when building `rustc` from a source tarball, the beta revision number is correctly read from the `version` file instead of erroring out by invoking `git`.

The `version` file is observed to only exist in the official source tarball and has the following format:

```
1.70.0-beta.4 (2013813b6 2023-05-07)
```
2023-05-21 16:03:00 +02:00
Matthias Krüger cb5dd1d598
Rollup merge of #111745 - Badel2:emitter-add-overflow, r=compiler-errors
Fix overflow in error emitter

Fix #109854
Close #94171 (was already fixed before but missing test)

This bug happens when a multipart suggestion spans more than one line.

The fix is to update the `acc` variable, which didn't handle the case when the text to remove spans multiple lines but the text to add spans only one line.

Also, use `usize::try_from` instead of  `as usize` to detect overflows earlier in the future, and point to the source of the overflow (the original issue points to a different place where this value is used, not where the overflow had happened).

And finally add an `if start != end` check to avoid doing any extra work in case of empty ranges.

Long explanation:

Given this test case:

```rust
fn generate_setter() {
    String::with_capacity(
    //~^ ERROR this function takes 1 argument but 3 arguments were supplied
    generate_setter,
    r#"
pub(crate) struct Person<T: Clone> {}
"#,
     r#""#,
    );
}
```

The compiler will try to convert that code into the following:

```rust
fn generate_setter() {
    String::with_capacity(
    //~^ ERROR this function takes 1 argument but 3 arguments were supplied
    /* usize */,
    );
}
```

So it creates a suggestion with 3 separate parts:

```
// Replace "generate_setter" with "/* usize */"
SubstitutionPart { span: fuzz_input.rs:4:5: 4:20 (#0), snippet: "/* usize */" }
// Remove second arg (multiline string)
SubstitutionPart { span: fuzz_input.rs:4:20: 7:3 (#0), snippet: "" }
// Remove third arg (r#""#)
SubstitutionPart { span: fuzz_input.rs:7:3: 8:11 (#0), snippet: "" }
```

Each of this parts gets a separate `SubstitutionHighlight` (this marks the relevant text green in a terminal, the values are 0-indexed so `start: 4` means column 5):

```
SubstitutionHighlight { start: 4, end: 15 }
SubstitutionHighlight { start: 15, end: 15 }
SubstitutionHighlight { start: 18446744073709551614, end: 18446744073709551614 }
```

The 2nd and 3rd suggestion are empty (start = end) because they only remove text, so there are no additions to highlight. But the 3rd span has overflowed because the compiler assumes that the 3rd suggestion is on the same line as the first suggestion. The 2nd span starts at column 20 and the highlight starts at column 16 (15+1), so that suggestion is good. But since the 3rd span starts at column 3, the result is `3 - 4`, or column -1, which turns into -2 with 0-indexed, and that's equivalent to `18446744073709551614 as isize`.

With this fix, the resulting `SubstitutionHighlight` are:

```
SubstitutionHighlight { start: 4, end: 15 }
SubstitutionHighlight { start: 15, end: 15 }
SubstitutionHighlight { start: 15, end: 15 }
```

As expected. I guess ideally we shouldn't emit empty highlights when removing text, but I am too scared to change that.
2023-05-21 16:02:59 +02:00
bors 06345574d9 Auto merge of #111424 - JakobDegen:inline-unsized, r=tmiasko
Don't inline functions with unsized args

Fixes #111355 .

I have some ideas for how we can get this back in the future, out of scope for this PR though.

r? `@cjgillot`
2023-05-21 11:23:26 +00:00
Guillaume Gomez 3c9964f003 Migrate GUI colors test to original CSS color format 2023-05-21 13:10:03 +02:00
John Kåre Alsaker aa5d43647b Add comment 2023-05-21 11:25:07 +02:00
bors d77014a608 Auto merge of #111697 - rcvalle:rust-cfi-fix-111510, r=bjorn3
CFI: Fix encode_ty: unexpected Param(B/#1)

Fixes #111510 and complements #106547 by adding support for encoding type parameters and also by transforming trait objects' traits into their identities before emitting type checks.
2023-05-21 06:42:05 +00:00
Michael Goulet e9a5a9d7d5 Don't use inner macro in marker_impls 2023-05-21 04:16:24 +00:00
DrMeepster a287d1b89c
unset MIRI_BLESS for mir-opt-level 4 miri tests 2023-05-20 21:14:08 -07:00
bors a11235d1bf Auto merge of #111696 - lukas-code:offset-of-erase-regions-harder, r=compiler-errors
don't skip inference for type in `offset_of!`

Fixes https://github.com/rust-lang/rust/issues/111678 by no longer skipping inference on the type in `offset_of!`. Simply erasing the regions the during writeback isn't enough and can cause ICEs. A test case for this is included.

This reverts https://github.com/rust-lang/rust/pull/111661, because it becomes redundant, since inference already erases the regions.
2023-05-21 04:02:46 +00:00
John Kåre Alsaker 9c978b955e Replace `QueryStruct` with arrays local to `rustc_query_impl` 2023-05-21 03:12:56 +02:00
bors 1b67f8b013 Auto merge of #111675 - Urgau:fix-local-libs-for-native-static-libs, r=bjorn3
Fix local libs not included when printing native static libs

This PR fixes https://github.com/rust-lang/rust/issues/111643 by adding the local used libs to the printed `--print=native-static-libs` output.

It seems that `--print=native-static-libs` doesn't have any test, so I added one. It's very simple and doesn't even tries to compile the result to a binary as I don't know how to handle external library linking in CI. (Note that https://github.com/rust-lang/rust/blob/master/tests/run-make/staticlib-dylib-linkage/Makefile does compile to a binary)

r? `@bjorn3`
2023-05-21 01:12:45 +00:00
Jakob Degen 60cc72cf7b Don't inline functions with unsized args 2023-05-20 17:45:50 -07:00
liushuyu 343a0bf5c2
bootstrap: add test cases for beta revision extraction 2023-05-20 18:33:17 -06:00
liushuyu 50e38e928e Read beta version from the version file ...
... if building from a source tarball
2023-05-20 17:43:18 -06:00
bors fe76e14955 Auto merge of #111646 - Voultapher:restore-branchless-code-gen-for-merge, r=cuviper
Use code with reliable branchless code-gen for slice::sort merge

The recent LLVM 16 update changes code-gen to be not branchless anymore, in the slice::sort implementation merge function. This improves performance by 30% for random patterns, restoring the performance to the state with LLVM 15.

Fixes #111559
2023-05-20 21:52:10 +00:00
bors 77f4f828a2 Auto merge of #111799 - flip1995:clippyup, r=Manishearth
Update Clippy

r? `@Manishearth`
2023-05-20 18:56:52 +00:00
bors 6bacf5a544 Auto merge of #111798 - GuillaumeGomez:rollup-t3bus8o, r=GuillaumeGomez
Rollup of 5 pull requests

Successful merges:

 - #111450 (Use `OpaqueTypeKey` in query response)
 - #111726 (Migrate GUI colors test to original CSS color format)
 - #111746 (Merge some query impl modules into one)
 - #111765 (Migrate GUI colors test to original CSS color format)
 - #111771 (add `--remote-time` flag to curl for bootstrap)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-05-20 16:07:54 +00:00
Philipp Krones d780efc460
Update Cargo.lock 2023-05-20 15:39:35 +02:00
Philipp Krones 12cbb6ced8
Merge commit '435a8ad86c7a33bd7ffb91c59039943408d3b6aa' into clippyup 2023-05-20 15:39:26 +02:00
Guillaume Gomez a6ebaf8425
Rollup merge of #111771 - liushuyu:ubuntu/rep-stage0, r=ozkanonur
add `--remote-time` flag to curl for bootstrap

This pull request sets the timestamp of the downloaded stage0 binary according to the server-reported timestamp (if possible).
This allows make_orig-dl_tarball.sh to be more reproducible on the filesystem.
2023-05-20 15:37:25 +02:00
Guillaume Gomez 0d8a2e58a3
Rollup merge of #111765 - GuillaumeGomez:migrate-gui-test-color, r=notriddle
Migrate GUI colors test to original CSS color format

Follow-up of https://github.com/rust-lang/rust/pull/111459.

r? `@notriddle`
2023-05-20 15:37:24 +02:00
Guillaume Gomez 3f9a7e7c81
Rollup merge of #111746 - Zoxc:query-impl-mod, r=cjgillot
Merge some query impl modules into one

This merges some modules in `rustc_query_impl` into one per query, analogous to https://github.com/rust-lang/rust/pull/111703.

r? `@cjgillot`
2023-05-20 15:37:24 +02:00
Guillaume Gomez 7597d572ed
Rollup merge of #111726 - GuillaumeGomez:gui-test-migrate-color, r=notriddle
Migrate GUI colors test to original CSS color format

Follow-up of https://github.com/rust-lang/rust/pull/111459.

r? ```@notriddle```
2023-05-20 15:37:23 +02:00
Guillaume Gomez de074242eb
Rollup merge of #111450 - compiler-errors:opaque-ty-key, r=oli-obk
Use `OpaqueTypeKey` in query response

Makes it a bit clearer that at least one of the types being returned from a canonical query is an opaque.
2023-05-20 15:37:23 +02:00
Guillaume Gomez 8b7c8e1f82 Migrate GUI colors test to original CSS color format 2023-05-20 15:35:52 +02:00
bors 435a8ad86c Auto merge of #10802 - flip1995:rustup, r=flip1995
Rustup

r? `@ghost`

changelog: none
2023-05-20 13:33:20 +00:00
Philipp Krones 2e95a4fd4c
Bump nightly version -> 2023-05-20 2023-05-20 15:32:32 +02:00
Philipp Krones 96b32b1cb8
Merge remote-tracking branch 'upstream/master' into rustup 2023-05-20 15:32:20 +02:00
Lukas Markeffsky 7cdb23b98a don't skip inference for type in `offset_of!` 2023-05-20 15:20:27 +02:00
bors 4eb5225cdf Auto merge of #111413 - workingjubilee:bump-object-0-31-1, r=MarkSimulacrum
Bump object and thorin-dwp

Required to fix watchOS breakage.
2023-05-20 13:19:37 +00:00
bors 28dddc7257 Auto merge of #10795 - adrianEffe:fix/TyKind-enum, r=flip1995
Update URLs in Type Checking chapter

Updated links to `Adt`, `pat_ty` and `Tykind` in the "Type Checking" chapter of the book.

### Notes:
- For discussion about the whole project, please use the tracking issue for the project #10597  (It also contains a timeline, discussions, and more information).

changelog: Fix broken links in "Type Checking" chapter of the book
2023-05-20 13:00:53 +00:00