Commit Graph

231010 Commits

Author SHA1 Message Date
Matthias Krüger
a902550233
Rollup merge of #114313 - ttsugriy:sm-insert, r=petrochenkov
[rustc_data_structures] Simplify SortedMap::insert.

It looks like current usage of `swap` is aimed at achieving what `std::mem::replace` does but more concisely and idiomatically.
2023-08-01 06:55:55 +02:00
Matthias Krüger
ff8b96f88b
Rollup merge of #114309 - rustbot:docs-update, r=ehuss
Update books

## rust-lang/reference

7 commits in 1ea0178266b3f3f613b0fabdaf16a83961c99cdb..9cd5c5a6ccbd4c07c65ab5c69a53286280308c95
2023-07-29 22:29:51 UTC to 2023-07-16 20:12:46 UTC

- Fix merge queue building twice. (rust-lang/reference#1383)
- Clarify UB around immutability & mutation (rust-lang/reference#1385)
- mention the extra const UB (rust-lang/reference#1273)
- Operator expressions: make the note about division by zero clearer. (rust-lang/reference#1384)
- Make unsafe keyword docs less confusing (rust-lang/reference#1379)
- Say that division by zero for primitive types panics (rust-lang/reference#1382)
- Add CI trigger for merge queues. (rust-lang/reference#1381)

## rust-lang/rust-by-example

3 commits in 8a87926a985ce32ca1fad1be4008ee161a0b91eb..07e0df2f006e59d171c6bf3cafa9d61dbeb520d8
2023-07-24 11:37:55 UTC to 2023-07-24 11:35:36 UTC

- Added attribute unused_labels - fixed warning. (rust-lang/rust-by-example#1729)
- more explanation about panic (rust-lang/rust-by-example#1728)
- chore: add the portuguese version of this project to `readme.md` (rust-lang/rust-by-example#1727)

## rust-lang/rustc-dev-guide

26 commits in b5a12d95e32ae53791cc6ab44417774667ed2ac6..24eebb6df96d037aad285e4f7793bd0393a66878
2023-07-30 11:23:23 UTC to 2023-07-11 06:02:34 UTC

- fix(name-resolution): remove unnecessary closing paranthesis (rust-lang/rustc-dev-guide#1760)
- fix(macro-expansion.md): fix the article `an` to `a` (rust-lang/rustc-dev-guide#1759)
- fix(serialization.md): fix the name of a derive macro (rust-lang/rustc-dev-guide#1756)
- fix(serialization.md): add a necessary plural suffix (rust-lang/rustc-dev-guide#1757)
- fix(salsa.md): add punctuation to prevent confusion (rust-lang/rustc-dev-guide#1754)
- fix(salsa.md): remove duplicate "To Be" verb (rust-lang/rustc-dev-guide#1755)
- feat(fuzzing.md): make `halfempty` word a link (rust-lang/rustc-dev-guide#1750)
- fix(about.md): use `a` instead of `an` (rust-lang/rustc-dev-guide#1751)
- refactor(git.md): make git-scm links clickable (rust-lang/rustc-dev-guide#1747)
- fix(walkthrough.md) add a comma operator to eliminate ambiguity (rust-lang/rustc-dev-guide#1749)
- fix(git.md): remove a confusing end of sentence character (rust-lang/rustc-dev-guide#1748)
- refactor(profiling/with_perf): remove a wrong to be verb (rust-lang/rustc-dev-guide#1746)
- refactor(tests/headers): remove duplicate list item (rust-lang/rustc-dev-guide#1745)
- refactor(test/headers.md): make the meaning more obvious (rust-lang/rustc-dev-guide#1744)
- refactor(tests/ui): remove unnecessary duplicate word (rust-lang/rustc-dev-guide#1743)
- refactor(compiletest): remove unnecessary duplicate word (rust-lang/rustc-dev-guide#1742)
- generic_arguments.md: substs -> GenericArgs (rust-lang/rustc-dev-guide#1741)
- fix(suggested): remove an unnecessary and confusing statement (rust-lang/rustc-dev-guide#1739)
- fix(how-to-build-and-run): fix a typo ("fromer" -> "former") (rust-lang/rustc-dev-guide#1736)
- fix(how-to-build-and-run): remove a wrong paragraph (rust-lang/rustc-dev-guide#1735)
- coverage code has moved (rust-lang/rustc-dev-guide#1728)
- linked issue is closed (rust-lang/rustc-dev-guide#1729)
- remove duplicate reference in about-this-guide.md (rust-lang/rustc-dev-guide#1734)
- Explain more in depth what early and late bound generic parameters are (rust-lang/rustc-dev-guide#1732)
- add section for normalization with the new solver (rust-lang/rustc-dev-guide#1731)
- Improve cleanup-crew.md with an example post (rust-lang/rustc-dev-guide#1730)
2023-08-01 06:55:55 +02:00
Matthias Krüger
2fac3972cd
Rollup merge of #114262 - ShapelessCat:fix-style-guide-md, r=joshtriplett
Improve the rust style guide doc

- Make the levels of headings consistent in this whole document.
   Before this change, the highest level of headings in some file is level 1, but in most of the files the that is level 2. Not consistent.

- Fix some headings

- Follow the markdown linter advices
  - Remove redundant empty lines
  - Surround each heading with empty lines
  - Use the same symbol for different levels of unordered list entries
2023-08-01 06:55:54 +02:00
Matthias Krüger
4e60d99a76
Rollup merge of #113743 - workingjubilee:link-more-platform-support-docs, r=joshtriplett
Directly link more target docs

Some platforms were not linked from platform-support.md

This fixes that, but errs towards extremely conservative, only directly linking platform docs if the docs actively mention the target, as otherwise I do not necessarily know if there was a reason for the omission.
2023-08-01 06:55:53 +02:00
Matthias Krüger
849f4f8845
Rollup merge of #113588 - RalfJung:llvm-merge-base, r=albertlarsan68
bootstrap: use git merge-base for LLVM CI download logic

Fixes https://github.com/rust-lang/rust/issues/101907
I tested this with a local branch that has extra merge commits due to Miri, and it worked fine there. But I am sure there are tons of other situations I did not think of...

r? `@jyn514`
2023-08-01 06:55:53 +02:00
Matthias Krüger
02426434e2
Rollup merge of #113394 - joshtriplett:style-edition-snapshot, r=calebcartwright
style-guide: Document style editions, start 2024 style edition

Link to a snapshot for the 2015/2018/2021 style edition.

This is a draft, because I'd like to wait for a few style guide fixes to merge
before snapshotting the 2015/2018/2021 style edition:

- https://github.com/rust-lang/rust/pull/113145
- https://github.com/rust-lang/rust/pull/113380
- https://github.com/rust-lang/rust/pull/113384
- https://github.com/rust-lang/rust/pull/113385
- https://github.com/rust-lang/rust/pull/113386
- https://github.com/rust-lang/rust/pull/113392

I'd like to wait for these for two reasons: to make it easier to see the
differences between the 2015/2018/2021 style edition and the 2024 style
edition (without the noise of guide-wide changes), and to minimize confusion so
that bugfixes to the style guide that we include in the previous edition don't
look like they're only part of the 2024 style edition.

I've used "Miscellaneous `rustfmt` bugfixes" as a starting point for the list
of 2024 changes, for now. We can update that when we add more 2024 changes.

The section added in this PR can then serve as a baseline for our drafts of
2024 style edition changes.

In the meantime, I'd like to get someone from `@rust-lang/style` to review and
approve the text here; I'll update it with a commit hash when the above PRs
have merged.
2023-08-01 06:55:52 +02:00
Matthias Krüger
14a5dc52c7
Rollup merge of #111081 - mattfbacon:master, r=workingjubilee
impl SliceIndex<str> for (Bound<usize>, Bound<usize>)

This impl is conspicuously missing.
2023-08-01 06:55:52 +02:00
Jubilee Young
467cb52cca Directly link more target docs
Some platforms were not linked from platform-support.md

This fixes that, but errs towards extremely conservative,
only directly linking platform docs if the docs actively
mention the target, as otherwise I do not necessarily
know if there was a reason for the omission.
2023-07-31 20:12:12 -07:00
bors
b484c87811 Auto merge of #114310 - flip1995:clippyup, r=Manishearth
Update Clippy

r? `@Manishearth`

This is a bit delayed, because I thought it is a difficult conflict resolution and didn't have time for that over the weekend. Turns out, I just used the wrong merge base and it was actually easy... Don't do syncs in the middle of the night (even though I broke this rule with this PR again).
2023-08-01 01:14:38 +00:00
Josh Triplett
6a0886cdba Link to the Rust edition guide for more information about editions 2023-07-31 17:11:47 -07:00
Josh Triplett
0217565e24 style-guide: Document style editions, start 2024 style edition
Link to a snapshot for the 2015/2018/2021 style edition.
2023-07-31 17:11:47 -07:00
Taras Tsugrii
9eae73a5de [rustc_data_structures] Simplify SortedMap::insert.
It looks like current usage of `swap` is aimed at achieving what
`std::mem::replace` does but more concisely and idiomatically.
2023-07-31 16:58:04 -07:00
bors
706a4d9a4e Auto merge of #114308 - matthiaskrgr:rollup-m64bkm7, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #109318 (Make `Debug` representations of `[Lazy, Once]*[Cell, Lock]` consistent with `Mutex` and `RwLock`)
 - #113701 (Re-export core::ffi::FromBytesUntilNulError in std::ffi)
 - #113804 (Resolve correct archive version name in `opt-dist`)
 - #114165 (Add missing rvalues to smir)
 - #114182 (clean up after 113312)
 - #114193 (Update lexer emoji diagnostics to Unicode 15.0)
 - #114200 (Detect trait upcasting through struct tail unsizing in new solver select)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-07-31 23:30:28 +00:00
Philipp Krones
53f09d95eb
Merge commit '5436dba826191964ac1d0dab534b7eb6d4c878f6' into clippyup 2023-07-31 23:53:53 +02:00
bors
db7ff98a72 Auto merge of #114307 - matthiaskrgr:rollup-8k5rq16, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #112858 (Update Android system definitions and add riscv-linux-android as tier 3 target)
 - #113717 (remove repetitive words)
 - #113725 (Move MinGW linker dist option to proper section)
 - #113740 (Update `.gitmodules` to use shallow submodule clones)
 - #113889 (Fix ice tests when librustc-driver is linked dynamically)
 - #113906 (etc: add `RUSTC_BOOTSTRAP` to rust-analyzer config)
 - #113920 (fix(resolve): report unresolved imports firstly)
 - #114111 (Improve test case for experimental API remove_matches)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-07-31 21:48:00 +00:00
rustbot
1216ae750f Update books 2023-07-31 17:03:30 -04:00
Matthias Krüger
c73e232d20
Rollup merge of #114200 - compiler-errors:detect-tail-unsize-then-upcast, r=lcnr
Detect trait upcasting through struct tail unsizing in new solver select

Oops, we were able to hide trait upcasting behind a parent unsize goal that evaluated to `Certainty::Yes`. Let's do rematching for `Certainty::Yes` unsize goals with `BuiltinImplSource::Misc` sources (corresponding to all of the other unsize rules) to make sure we end up selecting any nested goals which may be satisfied via `BuiltinImplSource::TraitUpcasting` or `::TupleUnsizing`.

r? ``@lcnr``
2023-07-31 22:51:16 +02:00
Matthias Krüger
57c57a555b
Rollup merge of #114193 - crlf0710:lexer_unicode15, r=Manishearth
Update lexer emoji diagnostics to Unicode 15.0

This replaces the `unic-emoji-char` dep tree (which hasn't been updated for a while) with `unicode-properties` crate which contains Unicode 15.0 data.

Improves diagnostics for added emoji characters in recent years. (See tests).

cc #101840

cc ``@Manishearth``
2023-07-31 22:51:15 +02:00
Matthias Krüger
7c6942a11b
Rollup merge of #114182 - Ddystopia:cleanup-after-113312, r=lcnr
clean up after 113312

Minor edits for #113312

cc ``@RalfJung``
r? ``@lcnr``
2023-07-31 22:51:14 +02:00
Matthias Krüger
35ba616850
Rollup merge of #114165 - ouz-a:smir1, r=spastorino
Add missing rvalues to smir

Added few missing rvalues to smir, not entirely confident about changes to `Aggregate`

cc https://github.com/rust-lang/project-stable-mir/issues/13

r? `@oli-obk`
2023-07-31 22:51:14 +02:00
Matthias Krüger
756da76814
Rollup merge of #113804 - Kobzol:opt-dist-version, r=Mark-Simulacrum
Resolve correct archive version name in `opt-dist`

Should resolve the master part of https://github.com/rust-lang/rust/issues/113784.

r? `@Mark-Simulacrum`
2023-07-31 22:51:13 +02:00
Matthias Krüger
efd68db768
Rollup merge of #113701 - aswild:std-ffi-frombytesuntilnul, r=dtolnay
Re-export core::ffi::FromBytesUntilNulError in std::ffi

Like the other CStr and CString error types, make a re-export for std::ffi::FromBytesUntilNulError.

This seems to have slipped through the cracks in the cstr_from_bytes_until_nul implementation and core_c_str migration.

Tracking Issue: #95027
2023-07-31 22:51:13 +02:00
Matthias Krüger
bcfa49f162
Rollup merge of #109318 - joboet:better_fmt_placeholder, r=dtolnay
Make `Debug` representations of `[Lazy, Once]*[Cell, Lock]` consistent with `Mutex` and `RwLock`

`Mutex` prints `<locked>` as a field value when its inner value cannot be accessed, but the lazy types print a fixed string like "`OnceCell(Uninit)`". This could cause confusion if the inner type is a unit type named `Uninit` and does not respect the pretty-printing flag. With this change, the format message is now "`OnceCell(<uninit>)`", consistent with `Mutex`.
2023-07-31 22:51:12 +02:00
Matthias Krüger
e981db05b5
Rollup merge of #114111 - allaboutevemirolive:add-test-case-string, r=Mark-Simulacrum
Improve test case for experimental API remove_matches

## Add Test Cases for `remove_matches` Function

### Motivation

After reading the discussion in [this GitHub thread](https://github.com/rust-lang/rust/pull/71780), I'm trying to redesign the current API to use less memory when working with `String` and to make it simpler. I've discovered that some test cases are very helpful in ensuring that the new API behaves as intended. I'm still in the process of redesigning the current API, and these test cases have proven to be very useful.

### Testing

The current test has been tested with the command `./x test --stage 0 library/alloc`.

### Overview

This pull request adds several new test cases for the `remove_matches` function to make sure it works correctly in different situations. The `remove_matches` function is used to get rid of all instances of a specific pattern from a given text. These test cases thoroughly check how the function behaves in various scenarios.

### Test Cases

1. **Single Pattern Occurrence** (`test_single_pattern_occurrence`):
   - Description: Tests the removal of a single pattern occurrence from the text.
   - Input: Text: "abc", Pattern: 'b'
   - Expected Output: "ac"

2. **Repeat Test Single Pattern Occurrence** (`repeat_test_single_pattern_occurrence`):
   - Description: Repeats the previous test case to ensure consecutive removal of the same pattern.
   - Input: Text: "ac", Pattern: 'b'
   - Expected Output: "ac"

3. **Single Character Pattern** (`test_single_character_pattern`):
   - Description: Tests the removal of a single character pattern.
   - Input: Text: "abcb", Pattern: 'b'
   - Expected Output: "ac"

4. **Pattern with Special Characters** (`test_pattern_with_special_characters`):
   - Description: Tests the removal of a pattern containing special characters.
   - Input: Text: "ศไทย中华Việt Nam; foobarศ", Pattern: 'ศ'
   - Expected Output: "ไทย中华Việt Nam; foobar"

5. **Pattern Empty Text and Pattern** (`test_pattern_empty_text_and_pattern`):
   - Description: Tests the removal of an empty pattern from an empty text.
   - Input: Text: "", Pattern: ""
   - Expected Output: ""

6. **Pattern Empty Text** (`test_pattern_empty_text`):
   - Description: Tests the removal of a pattern from an empty text.
   - Input: Text: "", Pattern: "something"
   - Expected Output: ""

7. **Empty Pattern** (`test_empty_pattern`):
   - Description: Tests the behavior of removing an empty pattern from the text.
   - Input: Text: "Testing with empty pattern.", Pattern: ""
   - Expected Output: "Testing with empty pattern."

8. **Multiple Consecutive Patterns 1** (`test_multiple_consecutive_patterns_1`):
   - Description: Tests the removal of multiple consecutive occurrences of a pattern.
   - Input: Text: "aaaaa", Pattern: 'a'
   - Expected Output: ""

9. **Multiple Consecutive Patterns 2** (`test_multiple_consecutive_patterns_2`):
   - Description: Tests the removal of a longer pattern that occurs consecutively.
   - Input: Text: "Hello **world****today!**", Pattern: "**"
   - Expected Output: "Hello worldtoday!"

10. **Case Insensitive Pattern** (`test_case_insensitive_pattern`):
    - Description: Tests the removal of a case-insensitive pattern from the text.
    - Input: Text: "CASE ** SeNsItIvE ** PaTtErN.", Pattern: "sEnSiTiVe"
    - Expected Output: "CASE ** SeNsItIvE ** PaTtErN."
2023-07-31 22:49:51 +02:00
Matthias Krüger
2de51cce90
Rollup merge of #113920 - bvanjoi:fix-81413, r=petrochenkov
fix(resolve): report unresolved imports firstly

Fixes #81413

An easy fix, r? ```@petrochenkov```
2023-07-31 22:49:50 +02:00
Matthias Krüger
82c50ce97f
Rollup merge of #113906 - notriddle:notriddle/cargo-extra-env, r=Mark-Simulacrum
etc: add `RUSTC_BOOTSTRAP` to rust-analyzer config

Fixes the problem reported in https://github.com/rust-lang/rust/issues/112391#issuecomment-1597224941
2023-07-31 22:49:50 +02:00
Matthias Krüger
93d65adb36
Rollup merge of #113889 - fortanix:raoul/fix_ice_tests_for_sgx_platform, r=Mark-Simulacrum
Fix ice tests when librustc-driver is linked dynamically

Running `dump-ice-to-disk`and `short-ice` tests on Linux targeting `x86_64-fortanix-unknown-sgx` platform results in:
```
jenkins@31cf43196355:~/workspace/rust-sgx-ci/Raoul/rust$ cat /home/jenkins/workspace/rust-sgx-ci/Raoul/rust/build/x86_64-unknown-linux-gnu/test/run-make/dump-ice-to-disk/dump-ice-to-disk/*
/home/jenkins/workspace/rust-sgx-ci/Raoul/rust/build/x86_64-unknown-linux-gnu/stage1/bin/rustc: error while loading shared libraries: librustc_driver-fa98927b935b2881.so: cannot open shared object file: No such file or directory
/home/jenkins/workspace/rust-sgx-ci/Raoul/rust/build/x86_64-unknown-linux-gnu/stage1/bin/rustc: error while loading shared libraries: librustc_driver-fa98927b935b2881.so: cannot open shared object file: No such file or directory
/home/jenkins/workspace/rust-sgx-ci/Raoul/rust/build/x86_64-unknown-linux-gnu/stage1/bin/rustc: error while loading shared libraries: librustc_driver-fa98927b935b2881.so: cannot open shared object file: No such file or directory
/home/jenkins/workspace/rust-sgx-ci/Raoul/rust/build/x86_64-unknown-linux-gnu/stage1/bin/rustc: error while loading shared libraries: librustc_driver-fa98927b935b2881.so: cannot open shared object file: No such file or directory
```
Setting the LD_LIBRARY_PATH explicitly to `$(HOST_RPATH_DIR)` in these tests Makefiles resolves the issue. The `thumb-none-qemu` and `thumb-none-cortex-m` run-make tests do something similar.

cc: ```@jethrogb``` ```@vn971``` ```@mkaynov```
2023-07-31 22:49:49 +02:00
Matthias Krüger
ba196c2ef5
Rollup merge of #113740 - tgross35:use-shallow-submodules, r=Mark-Simulacrum
Update `.gitmodules` to use shallow submodule clones

This change makes submodule checkouts shallow by default. This significantly reduces the time needed to do a recursive checkout when `--shallow-submodules` is not specified, such as when `x` is not being used.
2023-07-31 22:49:49 +02:00
Matthias Krüger
14e11c80ee
Rollup merge of #113725 - mati865:config-move-mingw-option-to-dist, r=Mark-Simulacrum
Move MinGW linker dist option to proper section

Using this option currently results in the error:
```
failed to parse TOML configuration 'config.toml': unknown field `include-mingw-linker`, expected one of `optimize`, `debug`, `codegen-units`, `codegen-units-std`, `debug-assertions`, `debug-assertions-std`, `overflow-checks`, `overflow-checks-std`, `debug-logging`, `debuginfo-level`, `debuginfo-level-rustc`, `debuginfo-level-std`, `debuginfo-level-tools`, `debuginfo-level-tests`, `split-debuginfo`, `run-dsymutil`, `backtrace`, `incremental`, `parallel-compiler`, `default-linker`, `channel`, `description`, `musl-root`, `rpath`, `verbose-tests`, `optimize-tests`, `codegen-tests`, `omit-git-hash`, `dist-src`, `save-toolstates`, `codegen-backends`, `lld`, `use-lld`, `llvm-tools`, `deny-warnings`, `backtrace-on-ice`, `verify-llvm-ir`, `thin-lto-import-instr-limit`, `remap-debuginfo`, `jemalloc`, `test-compare-mode`, `llvm-libunwind`, `control-flow-guard`, `new-symbol-mangling`, `profile-generate`, `profile-use`, `download-rustc`, `lto`, `validate-mir-opts` for key `rust`
```
That's because the option [belongs to `dist` section](bef6ff618f/src/bootstrap/config.rs (L861)).

cc #108581
2023-07-31 22:49:48 +02:00
Matthias Krüger
58f963fb65
Rollup merge of #113717 - cuishuang:master, r=Nilstrieb
remove repetitive words
2023-07-31 22:49:47 +02:00
Matthias Krüger
d0ae0b31a8
Rollup merge of #112858 - chriswailes:riscv64-android, r=Mark-Simulacrum
Update Android system definitions and add riscv-linux-android as tier 3 target

This PR includes the following:
* Corrected Android system definitions for some types
* Support for the riscv64-linux-android target

The authoritative types for the system definitions can be found here: https://cs.android.com/android/platform/superproject/+/master:bionic/libc/include/sys/stat.h

Fixes rust-lang/compiler-team#640
2023-07-31 22:49:46 +02:00
ouz-a
2a3da87c0e add missing rvalues to smir 2023-07-31 22:48:55 +03:00
Matt Fellenz
f189d00d40
Work around missing <*str>::len 2023-07-31 11:42:14 -07:00
Matt Fellenz
e12e7fcc50
impl SliceIndex<str> for (Bound<usize>, Bound<usize>) 2023-07-31 11:32:40 -07:00
Ralf Jung
314fe5dd01
apply nit
Co-authored-by: Albert Larsan <albertlarsan@unbon.cafe>
2023-07-31 18:39:41 +02:00
bors
b3df56a65f Auto merge of #114294 - matthiaskrgr:rollup-yk78pvd, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #114111 (Improve test case for experimental API remove_matches)
 - #114169 (refactor builtin unsize handling, extend comments)
 - #114182 (clean up after 113312)
 - #114193 (Update lexer emoji diagnostics to Unicode 15.0)
 - #114200 (Detect trait upcasting through struct tail unsizing in new solver select)
 - #114228 (Check lazy type aliases for well-formedness)
 - #114267 (Map RPITIT's opaque type bounds back from projections to opaques)
 - #114269 (Migrate GUI colors test to original CSS color format)
 - #114286 (Add missing feature gate in multiple_supertrait_upcastable doc)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-07-31 16:29:54 +00:00
Matthias Krüger
f59a5604f9
Rollup merge of #114286 - nbdd0121:upcast, r=compiler-errors
Add missing feature gate in multiple_supertrait_upcastable doc

Fix #112424
2023-07-31 16:57:56 +02:00
Matthias Krüger
81bb311b09
Rollup merge of #114269 - GuillaumeGomez:migrate-gui-test-color-24, 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-07-31 16:57:55 +02:00
Matthias Krüger
692d764e53
Rollup merge of #114267 - compiler-errors:rpitit-opaque-bounds, r=spastorino
Map RPITIT's opaque type bounds back from projections to opaques

An RPITIT in a program's AST is eventually translated into both a projection GAT and an opaque. The opaque is used for default trait methods, like:

```
trait Foo {
  fn bar() -> impl Sized { 0i32 }
}
```

The item bounds for both the projection and opaque are identical, and both have a *projection* self ty. This is mostly okay, since we can normalize this projection within the default trait method body to the opaque, but it does two things:
1. it leads to bugs in places where we don't normalize item bounds, like `deduce_future_output_from_obligations`
2. it leads to extra match arms that are both suspicious looking and also easy to miss

This PR maps the opaque type bounds of the RPITIT's *opaque* back to the opaque's self type to avoid this quirk. Then we can fix the UI test for #108304 (1.) and also remove a bunch of match arms (2.).

Fixes #108304

r? `@spastorino`
2023-07-31 16:57:55 +02:00
Matthias Krüger
95b7116d70
Rollup merge of #114228 - fmease:wf-lazy-ty-aliases, r=oli-obk
Check lazy type aliases for well-formedness

Previously we didn't check if `T: Mul` holds given lazy `type Alias<T> = <T as Mul>::Output;`.
Now we do. It only makes sense.

`@rustbot` label F-lazy_type_alias

r? `@oli-obk`
2023-07-31 16:57:54 +02:00
Matthias Krüger
b8f78fb47c
Rollup merge of #114169 - lcnr:unsize, r=compiler-errors
refactor builtin unsize handling, extend comments

r? `@compiler-errors`
2023-07-31 16:57:53 +02:00
bors
3114eb1fa5 Auto merge of #113592 - Kobzol:pgo-script-bolt, r=Mark-Simulacrum
Move BOLT from `bootstrap` to `opt-dist`

Currently, we use BOLT to optimize LLVM for x64 Linux. The BOLT instrumentation and optimization step is implemented in `bootstrap`, but it was always quite hacky, because BOLT works quite differently than PGO. Rather than building an instrumented artifact, it takes an already built artifact and instruments it in-place. This is not a good fit for the bootstrap caching mechanism, and it meant that we had to run BOLT "on-the-fly" when packaging LLVM artifacts into the created sysroot.

The BOLT code was also really only used by the PGO script (now called `opt-dist`) and nothing else, so it was quite hardcoded for this one single usage. And even if someone wanted to use the `--llvm-bolt-profile-[use/generate]` bootstrap flags outside of the PGO script, they would also need to implement profile gathering, as this is not performed by bootstrap anyway.

I think that it could be more practical to move the BOLT logic to the `opt-dist` tool instead. This simplifies bootstrap, removes unneeded implementation of BOLT caching (we will now do it exactly once - no need to check if it has been performed already when bootstrap copies `libLLVM.so` around multiple times) and removes two BOLT-specific bootstrap flags, and also one special case for building LLVM (instead I pass the linker flags with `--set llvm.ldflags` from `opt-dist` now).

There are also a few disadvantages to this new approach:
- We have to guess/find the path to the built `libLLVM.so` file (but currently this is quite easy, it's just in `stage2/lib`).
- We have to provide the BOLT profile externally to bootstrap, so that it is packaged into the reproducible artifacts archive. Doesn't seem like a big deal to me.
- We are depending on some inner behavior of boostrap in `opt-dist` (namely, that `libLLVM.so` is hardlinked). But we do that for many other things in the `opt-dist` tool anyway, it's tied quite closely to bootstrap.

I would like to go back to my attempts to also use BOLT for `librustc_driver.so`, and I think that it might be a bit simpler if I also do it from the `opt-dist` tool, so this is the first step towards that.

Anyway, let me know what you think about this. It's just a refactoring in a way, no big deal.

r? bootstrap
2023-07-31 14:36:09 +00:00
Gary Guo
e617faabe7 Add missing feature gate in multiple_supertrait_upcastable doc 2023-07-31 12:28:53 +01:00
bors
b321edd1b2 Auto merge of #114277 - weihanglo:update-cargo, r=weihanglo
Update cargo

14 commits in 7ac9416d82cd4fc5e707c9ec3574d22dff6466e5..c91a693e7977e33a1064b63a5daf5fb689f01651
2023-07-24 14:29:38 +0000 to 2023-07-31 00:26:46 +0000
- fix: align `cargo --help` text (rust-lang/cargo#12418)
- fix: normalize relative git submodule urls with `ssh://` (rust-lang/cargo#12411)
- test: relax help text assertion (rust-lang/cargo#12416)
- test: relax assertions of panic handler message format (rust-lang/cargo#12413)
- fix(package): Recognize and normalize `cargo.toml` (rust-lang/cargo#12399)
- Clarify `lto` setting passing `-Clinker-plugin-lto` (rust-lang/cargo#12407)
- doc: add missing reference to `CARGO_PROFILE_&lt;name&gt;_STRIP` in environment variables docs (rust-lang/cargo#12408)
- Update curl-sys to pull in curl 8.2.1 (rust-lang/cargo#12406)
- docs: raise awareness of resolver used inside workspace (rust-lang/cargo#12388)
- chore: update `home` to 0.5.7 (rust-lang/cargo#12401)
- Update curl-sys to pull in curl 8.2.0 (rust-lang/cargo#12400)
- test(cli): Track --help output (rust-lang/cargo#11912)
- refactor(test): Move cargo-config into a dir (rust-lang/cargo#12398)
- refactor(tests): Name init ui tests more consistently (rust-lang/cargo#12397)

r? `@ghost`
2023-07-31 10:13:09 +00:00
bors
5082281609 Auto merge of #113879 - nnethercote:codegen_ssa-cleanups, r=bjorn3
`codegen_ssa` cleanups

Some clarifications I made when reading this code closely.

r? `@tmiasko`
2023-07-31 08:18:19 +00:00
cui fliter
88c7b16e03 remove repetitive words
Signed-off-by: cui fliter <imcusg@gmail.com>
2023-07-31 16:13:02 +08:00
Weihang Lo
00a774774b
Update cargo 2023-07-31 09:09:20 +01:00
Jakub Beránek
142995f15f
Pass BOLT profile to bootstrap to be included in the reproducible artifacts archive 2023-07-31 08:54:47 +02:00
Jakub Beránek
78403f4e13
Remove BOLT from bootstrap 2023-07-31 08:54:47 +02:00
Jakub Beránek
a16925d5f3
Implement BOLT optimization in the opt-dist tool 2023-07-31 08:52:41 +02:00