Commit Graph

217382 Commits

Author SHA1 Message Date
Nikita Tomashevich 8fc5ba65e1 Port OutlivesContent, OutlivesBound, FUllfillReqLifetime, LfBoundNotSatisfied diagnostics 2023-02-14 18:31:45 +03:00
bors 9bb6e60d1f Auto merge of #103695 - LYF1999:yf/103563, r=lcnr
fix: Unexpected trait bound not satisfied in HRTB and Associated Type

fix https://github.com/rust-lang/rust/issues/103563
2023-02-14 10:01:19 +00:00
bors e9ab7872fd Auto merge of #107765 - petrochenkov:nomoclone, r=oli-obk
rustc/rustdoc: Perform name resolver cleanups enabled by #94857

Unblocks https://github.com/rust-lang/rust/pull/105462.
r? `@oli-obk`
2023-02-14 05:59:44 +00:00
bors c3c6d73b04 Auto merge of #107993 - weihanglo:update-cargo, r=weihanglo
Update cargo

10 commits in 82c3bb79e3a19a5164e33819ef81bfc2c984bc56..39c13e67a5962466cc7253d41bc1099bbcb224c3 2023-02-04 22:52:16 +0000 to 2023-02-12 02:01:08 +0000

- chore: Update to toml v0.6, toml_edit v0.18 (rust-lang/cargo#11618)
- doc: more doc comments and intra-doc links (rust-lang/cargo#11703)
- Deny warnings in CI, not locally (rust-lang/cargo#11699)
- add comment to lto.rs (rust-lang/cargo#11701)
- Re-export cargo_new::NewProjectKind as public (rust-lang/cargo#11700)
- Add '-C' flag for changing current dir before build (rust-lang/cargo#10952)
- `-Zrustdoc-scrape-example` must fail with bad build script (rust-lang/cargo#11694)
- Update CHANGELOG for 1.68 backports (rust-lang/cargo#11690)
- Update 1password to the version 2 CLI (rust-lang/cargo#11692)
- chore: autolabel more for `A-*` (rust-lang/cargo#11679)

r? `@ghost`
2023-02-14 02:55:06 +00:00
bors 5348a89a77 Auto merge of #108015 - matthiaskrgr:rollup-qerohjn, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #107902 (fix: improve the suggestion on future not awaited)
 - #107913 (Update broken link in cargo style guide)
 - #107942 (Tighter spans for bad inherent `impl` self types)
 - #107948 (Allow shortcuts to directories to be used for ./x.py fmt)
 - #107971 (Clearly document intentional UB in mir-opt tests)
 - #107985 (Added another error to be processed in fallback)
 - #108002 (Update books)
 - #108013 (rustdoc: use a string with one-character codes for search index types)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-02-13 23:20:03 +00:00
Matthias Krüger f1a349457f
Rollup merge of #108013 - notriddle:notriddle/search-index-itemtype, r=GuillaumeGomez
rustdoc: use a string with one-character codes for search index types

    $ wc -c search-index.old.js search-index.new.js
    3940530 search-index.old.js
    3843222 search-index.new.js

((3940530-3843222)/3940530)*100 = 2.47%

    $ wc -c search-index.old.js.gz search-index.new.js.gz
    380251 search-index.old.js.gz
    379434 search-index.new.js.gz

((380251-379434)/380251)*100 = 0.214%
2023-02-13 23:25:15 +01:00
Matthias Krüger 9bf807e7a1
Rollup merge of #108002 - rustbot:docs-update, r=ehuss
Update books

## rust-lang/book

2 commits in f2a78f64b668f63f581203c6bac509903f7c00ee..d94e03a18a2590ed3f1c67b859cb11528d2a2d5c
2023-02-10 16:01:09 UTC to 2023-02-10 15:55:43 UTC

- Update to Rust 1.67.1
- Update to Rust 1.66.1

## rust-embedded/book

1 commits in f1a4614aa41cc544b91b79760a709e113f3451d7..701d1551429da4cb609082c0ac99df569e336710
2023-01-31 12:32:49 UTC to 2023-01-31 12:32:49 UTC

- fix: Circled Image not visible on B&W E-Ink screen (rust-embedded/book#339)

## rust-lang/nomicon

2 commits in bd1829d235296952bf72ca55635e360584b8805e..79b53665a7c61d171fb8c5ad0b73b371f9ee6ba7
2023-02-13 08:40:24 UTC to 2023-02-07 09:43:03 UTC

- Fixes double bug in Send-Sync example (rust-lang/nomicon#401)
- Small language fix in subtyping.md (rust-lang/nomicon#399)

## rust-lang/reference

4 commits in 22882fb3f7b4d69fdc0d1731e8b9cfcb6910537d..e5adb99c04817b7fbe08f4ffce5b36702667345f
2023-02-08 18:09:03 UTC to 2023-02-01 03:49:46 UTC

- Eliminate 'half open' terminology from range pattern grammar (rust-lang/reference#1330)
- fix place expression context example (rust-lang/reference#1327)
- remove confusing words (rust-lang/reference#1324)
- Reword "expression for a match arm" (rust-lang/reference#1325)

## rust-lang/rust-by-example

5 commits in 134376872e8c387ef369507e0ee9b5a0e3272718..efe23c4fe12e06351b8dc8c3d18312c761455109
2023-02-06 11:32:23 UTC to 2023-01-31 16:38:03 UTC

- fix irrelevant comments (rust-lang/rust-by-example#1676)
- remove redudant code (rust-lang/rust-by-example#1675)
- Line comments: change 'inside' to 'after' (rust-lang/rust-by-example#1674)
- fix incorrect trait bound demonstration (rust-lang/rust-by-example#1673)
- fix "High Order Functions" typo (rust-lang/rust-by-example#1672)

## rust-lang/rustc-dev-guide

14 commits in e359ee27fc3da3356d71a732128c0a1abe02e53a..41a96ab971cb45e2a184df20619ad1829765c990
2023-02-11 06:41:56 UTC to 2023-01-31 18:42:30 UTC

- Add a citation file (rust-lang/rustc-dev-guide#1550)
- Improve git submodule help (rust-lang/rustc-dev-guide#1587)
- update examples for rustc 1.69.0-nightly (e1eaa2d5d 2023-02-06) (rust-lang/rustc-dev-guide#1590)
- Replace settings.json with x.py setup note (rust-lang/rustc-dev-guide#1588)
- Do not add accept header on linkcheck (rust-lang/rustc-dev-guide#1586)
- Fixed small grammar mistake in monomorph.md (rust-lang/rustc-dev-guide#1585)
- update bootstrap guide (rust-lang/rustc-dev-guide#1583)
- Use host symlink for custom rustup toolchain (rust-lang/rustc-dev-guide#1580)
- Fix broken links (rust-lang/rustc-dev-guide#1577)
- Add section on comparing types (rust-lang/rustc-dev-guide#1570)
- Update rustfmt path (rust-lang/rustc-dev-guide#1574)
- fix wrong heading level (rust-lang/rustc-dev-guide#1573)
- fix incorrect position of `Clarification of build command's stdout` (rust-lang/rustc-dev-guide#1572)
- extend bootstrap related documentations (rust-lang/rustc-dev-guide#1563)
2023-02-13 23:25:14 +01:00
Matthias Krüger 56193b0e60
Rollup merge of #107985 - alesito85:master, r=ChrisDenton
Added another error to be processed in fallback

This pull request addresses the problem of Rust not being able to read file/directory metadata because the current user doesn't have permission to read the file and are thus inaccessible.

One particular example is `System Volume Information`. But any example can be made by having a file/directory, which the current user can't access even though the system does allow to view the metadata, which is handled by the fallback.

The fallback exists to get the metadata but it was limited to one error type. Having added ERROR_ACCESS_DENIED per Chris Denton's suggestion, file/directory properties are now properly read.

Solution suggested by Chris Denton https://github.com/nushell/nushell/issues/6857#issuecomment-1426847135
2023-02-13 23:25:13 +01:00
Matthias Krüger 5915309645
Rollup merge of #107971 - saethlin:mir-opt-ub, r=cjgillot
Clearly document intentional UB in mir-opt tests

All of the changed mir-opt test input files did not pass Miri. Now they do.

r? `@cjgillot` because there's a CopyProp test in here that I do not fully understand
2023-02-13 23:25:13 +01:00
Matthias Krüger 7efb884b9c
Rollup merge of #107948 - jieyouxu:issue-107944, r=ozkanonur
Allow shortcuts to directories to be used for ./x.py fmt

Fixes #107944.

Maximum recursive search depth is 3 and only accepts shortcuts for directories. If there are no shortcut candidates, the previous behavior to panic is preserved. If there are multiple candidates, the shortcut candidates are ignored.

After this change, `./x.py fmt std` no longer panics and formats `library/std` instead.
2023-02-13 23:25:12 +01:00
Matthias Krüger 5f3d360844
Rollup merge of #107942 - compiler-errors:tighter-inherent-impl-bad-spans, r=Nilstrieb
Tighter spans for bad inherent `impl` self types

Self-explanatory
2023-02-13 23:25:12 +01:00
Matthias Krüger 5c94f4a112
Rollup merge of #107913 - base0x10:master, r=compiler-errors
Update broken link in cargo style guide

Toml now uses [toml.io](https://toml.io) for released specifications and the github repo for development. Also the old link was for the 0.4 specification, while cargo uses toml_edit, which uses toml 1.0 (reference:
https://github.com/toml-rs/toml/blob/main/crates/toml_edit/CHANGELOG.md#030---2021-09-13). Finally the discussion of "Bare keys" vs "Quoted keys" has moved from the `#table` section to `#keys`.
2023-02-13 23:25:11 +01:00
Matthias Krüger 73b022b8e1
Rollup merge of #107902 - vincenzopalazzo:macros/async_fn_suggestion, r=compiler-errors
fix: improve the suggestion on future not awaited

Considering the following code

```rust
fn foo() -> u8 {
    async fn async_fn() -> u8 {  22 }

    async_fn()
}

fn main() {}
```

the error generated before this commit from the compiler is

```
➜  rust git:(macros/async_fn_suggestion) ✗ rustc test.rs --edition 2021
error[E0308]: mismatched types
 --> test.rs:4:5
  |
1 | fn foo() -> u8 {
  |             -- expected `u8` because of return type
...
4 |     async_fn()
  |     ^^^^^^^^^^ expected `u8`, found opaque type
  |
  = note:     expected type `u8`
          found opaque type `impl Future<Output = u8>`
help: consider `await`ing on the `Future`
  |
4 |     async_fn().await
  |               ++++++

error: aborting due to previous error
```

In this case the error is nor perfect, and can confuse the user that do not know that the opaque type is the future.

So this commit will propose (and conclude the work start in https://github.com/rust-lang/rust/issues/80658)
to change the string `opaque type` to `future` when applicable and also remove the Expected vs Received note by adding a more specific one regarding the async function that return a future type.

So the new error emitted by the compiler is

```
error[E0308]: mismatched types
 --> test.rs:4:5
  |
1 | fn foo() -> u8 {
  |             -- expected `u8` because of return type
...
4 |     async_fn()
  |     ^^^^^^^^^^ expected `u8`, found future
  |
note: calling an async function returns a future
 --> test.rs:4:5
  |
4 |     async_fn()
  |     ^^^^^^^^^^
help: consider `await`ing on the `Future`
  |
4 |     async_fn().await
  |               ++++++

error: aborting due to previous error
```

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

It remains to rework the case described in the following issue https://github.com/rust-lang/rust/issues/107899 but I think this deserves its own PR after we discuss a little bit how to handle these kinds of cases.

r? `@eholk`

`@rustbot` label +I-async-nominated

Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2023-02-13 23:25:11 +01:00
Michael Howell a7b69ddea9 rustdoc: use a string with one-character codes for search index types
$ wc -c search-index.old.js search-index.new.js
    3940530 search-index.old.js
    3843222 search-index.new.js

((3940530-3843222)/3940530)*100 = 2.47%

    $ wc -c search-index.old.js.gz search-index.new.js.gz
    380251 search-index.old.js.gz
    379434 search-index.new.js.gz

((380251-379434)/380251)*100 = 0.214%
2023-02-13 14:27:00 -07:00
bors 065852def0 Auto merge of #107992 - lnicola:rust-analyzer-2023-02-13, r=lnicola
⬆️ `rust-analyzer`

r? `@ghost`
2023-02-13 20:22:52 +00:00
Ben Kimock 614df3fd5e Clearly document intentional UB in mir-opt tests
Co-authored-by: Jakob Degen <jakob.e.degen@gmail.com>
2023-02-13 13:50:50 -05:00
Michael Goulet e20f6ff1dc Tighter spans for bad inherent impl types 2023-02-13 18:41:18 +00:00
许杰友 Jieyou Xu (Joe) b10d744b87
Allow shortcuts to directories to be used for `./x.py fmt`
Fixes #107944.

Maximum recursive search depth is 3 and only accepts shortcuts for
directories (single component paths, such as `./x.py fmt std`). If
there are no shortcut candidates but single componenet path(s) are
given, it falls back to the previous behavior to panic with unable to
find directory. If there are multiple shortcut candidates for a given
single component path, the shortcut candidates are considered
ambiguous, are then ignored, and the single component path is accepted
as-is.

After this change, `./x.py fmt std` no longer panics and formats
`library/std` instead.
2023-02-14 01:47:12 +08:00
rustbot 9dcad5a340 Update books 2023-02-13 12:01:05 -05:00
bors a3c9eede5d Auto merge of #107924 - eggyal:move_fold_visit_traits_to_type_lib_with_trait_alias, r=oli-obk
Move folding & visiting traits into type library

This is a rework of #107712, following feedback on that PR.

In particular, this version uses trait aliases to reduce the API churn for trait consumers.  Doing so requires a workaround for #107747 until its fix in #107803 is merged into the stage0 compiler; this workaround, which uses conditional compilation based on the `bootstrap` configuration predicate, sits in dedicated commit b409329c for ease of reversion.

The possibility of the `rustc_middle` crate retaining its own distinct versions of each folding/visiting trait, blanket-implemented on all types that implement the respective trait in the type library, was also explored: however since this would necessitate making each `rustc_middle` trait a subtrait of the respective type library trait (so that such blanket implementations can delegate their generic methods), no benefit would be gained.

r? types
2023-02-13 16:50:33 +00:00
Vincenzo Palazzo 2bdc9a046a
fix: improve the suggestion on future not awaited
Considering the following code

```rust
fn foo() -> u8 {
    async fn async_fn() -> u8 {  22 }

    async_fn()
}

fn main() {}
```

the error generated before this commit from the compiler is

```
➜  rust git:(macros/async_fn_suggestion) ✗ rustc test.rs --edition 2021
error[E0308]: mismatched types
 --> test.rs:4:5
  |
1 | fn foo() -> u8 {
  |             -- expected `u8` because of return type
...
4 |     async_fn()
  |     ^^^^^^^^^^ expected `u8`, found opaque type
  |
  = note:     expected type `u8`
          found opaque type `impl Future<Output = u8>`
help: consider `await`ing on the `Future`
  |
4 |     async_fn().await
  |               ++++++

error: aborting due to previous error
```

In this case the error is nor perfect, and can confuse the user
that do not know that the opaque type is the future.

So this commit will propose (and conclude the work start in
https://github.com/rust-lang/rust/issues/80658)
to change the string `opaque type` to `future` when applicable
and also remove the Expected vs Received note by adding a more
specific one regarding the async function that return a future type.

So the new error emitted by the compiler is

```
error[E0308]: mismatched types
 --> test.rs:4:5
  |
1 | fn foo() -> u8 {
  |             -- expected `u8` because of return type
...
4 |     async_fn()
  |     ^^^^^^^^^^ expected `u8`, found future
  |
note: calling an async function returns a future
 --> test.rs:4:5
  |
4 |     async_fn()
  |     ^^^^^^^^^^
help: consider `await`ing on the `Future`
  |
4 |     async_fn().await
  |               ++++++

error: aborting due to previous error
```

Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2023-02-13 16:23:23 +01:00
bors 0b439b119b Auto merge of #107989 - matthiaskrgr:rollup-jklrd5g, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #107340 (rustdoc: merge doctest tooltip with notable traits tooltip)
 - #107838 (Introduce `-Zterminal-urls` to use OSC8 for error codes)
 - #107922 (Print disk usage in PGO CI script)
 - #107931 (Intern span when length is MAX_LEN with parent.)
 - #107935 (rustc_ast: Merge impls and reorder methods for attributes and meta items)
 - #107986 (layout: deal with placeholders, ICE on bound types)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-02-13 13:37:22 +00:00
Weihang Lo 4c4b4c0561
Update cargo
10 commits in 82c3bb79e3a19a5164e33819ef81bfc2c984bc56..39c13e67a5962466cc7253d41bc1099bbcb224c3
2023-02-04 22:52:16 +0000 to 2023-02-12 02:01:08 +0000

- chore: Update to toml v0.6, toml_edit v0.18 (rust-lang/cargo#11618)
- doc: more doc comments and intra-doc links (rust-lang/cargo#11703)
- Deny warnings in CI, not locally (rust-lang/cargo#11699)
- add comment to lto.rs (rust-lang/cargo#11701)
- Re-export cargo_new::NewProjectKind as public (rust-lang/cargo#11700)
- Add '-C' flag for changing current dir before build (rust-lang/cargo#10952)
- `-Zrustdoc-scrape-example` must fail with bad build script (rust-lang/cargo#11694)
- Update CHANGELOG for 1.68 backports (rust-lang/cargo#11690)
- Update 1password to the version 2 CLI (rust-lang/cargo#11692)
- chore: autolabel more for `A-*` (rust-lang/cargo#11679)
2023-02-13 12:04:19 +00:00
Laurențiu Nicola c4a2f06585 ⬆️ rust-analyzer 2023-02-13 13:55:14 +02:00
yifei d164448038 fix: Unexpected trait bound not satisfied in HRTB 2023-02-13 19:39:44 +08:00
bors c97aae38f2 Auto merge of #14138 - lowr:fix/rename-raw-ident-mod, r=Veykril
fix: don't include `r#` prefix in filesystem changes

Fixes #14131

In addition to fix for #14131, this PR adds raw ident validity checks in rename functionality that we've been missing.
2023-02-13 11:38:32 +00:00
bors 23871f9dd1 Auto merge of #14140 - Veykril:proc-macro-srv-fix, r=Veykril
fix: Fix proc-macro-server incorrectly stripping delimiters

🙄
2023-02-13 11:08:23 +00:00
Lukas Wirth 1c2292e5c6 fix: Fix proc-macro-server incorrectly stripping delimiters 2023-02-13 12:07:31 +01:00
alesito85 f72eb4704a Add another error to Windows file open fallback
Added another error to be processed in fallback

Solution suggested by Chris Denton https://github.com/nushell/nushell/issues/6857#issuecomment-1426847135
2023-02-13 11:50:25 +01:00
Matthias Krüger 8701e80722
Rollup merge of #107986 - lcnr:layout-placeholder, r=petrochenkov
layout: deal with placeholders, ICE on bound types

A placeholder type is the same as a param as they represent "this could be any type". A bound type represents a type inside of a `for<T>` or `exists<T>`. When entering a forall or exists `T` should be instantiated as a existential (inference var) or universal (placeholder). You should never observe a bound variable without its binder.
2023-02-13 11:34:59 +01:00
Matthias Krüger 99d36b137d
Rollup merge of #107935 - petrochenkov:attreorder, r=michaelwoerister
rustc_ast: Merge impls and reorder methods for attributes and meta items

Merge `impl` blocks for the same types, change order of methods to be more predictable and consistent between impls.
No functional changes.
Follow up to https://github.com/rust-lang/rust/pull/107569.
2023-02-13 11:34:58 +01:00
Matthias Krüger 3e5c11b855
Rollup merge of #107931 - cjgillot:issue-107353, r=WaffleLapkin
Intern span when length is MAX_LEN with parent.

Fixes https://github.com/rust-lang/rust/issues/107353
2023-02-13 11:34:58 +01:00
Matthias Krüger 8674adc25c
Rollup merge of #107922 - Kobzol:ci-print-disk-size, r=Mark-Simulacrum
Print disk usage in PGO CI script

To diagnose issues like https://github.com/rust-lang/rust/pull/94857#issuecomment-1426648675.
2023-02-13 11:34:57 +01:00
Matthias Krüger 780beae7bd
Rollup merge of #107838 - estebank:terminal_hyperlinks, r=nagisa
Introduce `-Zterminal-urls` to use OSC8 for error codes

Terminals supporting the OSC8 Hyperlink Extension can support inline anchors where the text is user defineable but clicking on it opens a browser to a specified URLs, just like `<a href="URL">` does in HTML.

https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda
2023-02-13 11:34:57 +01:00
Matthias Krüger 3054759fa8
Rollup merge of #107340 - notriddle:notriddle/simplify-doctest-tooltip, r=GuillaumeGomez
rustdoc: merge doctest tooltip with notable traits tooltip

Fixes https://discord.com/channels/442252698964721669/443150878111694848/1066420140167680000

<details><summary>a user report where the tooltip arrow overlaps the text</summary>

![](https://cdn.discordapp.com/attachments/443150878111694848/1066420139530145812/this-example-is-not-tested-busted-rendering.png)

</details>

Fixes #91100

Preview: <https://notriddle.com/notriddle-rustdoc-demos/simplify-doctest-tooltip/std/vec/struct.Vec.html#indexing>

Screenshot:

![image](https://user-images.githubusercontent.com/1593513/214975516-72667632-4609-49fa-8c37-e8d2ba1ba7dc.png)
2023-02-13 11:34:56 +01:00
Alan Egerton 63ad5d0522
Rename folder traits' `tcx` method to `interner` 2023-02-13 10:24:51 +00:00
Alan Egerton 459e142413
Move folding and visiting traits into type library 2023-02-13 10:24:50 +00:00
Alan Egerton 9fa6bb2aa0
Make atomic structural impls generic over Interner 2023-02-13 10:24:50 +00:00
Alan Egerton 9783fcc13b
Make folding traits generic over the Interner 2023-02-13 10:24:49 +00:00
Alan Egerton dea342d861
Make visiting traits generic over the Interner 2023-02-13 10:24:49 +00:00
Alan Egerton 0b7dda9afd
Constrain Interners to be Sized 2023-02-13 10:24:48 +00:00
Alan Egerton 38c522c693
Project Binder and Predicate from Interner trait 2023-02-13 10:24:48 +00:00
Alan Egerton e8d152d2f4
Move TypeVisitableExt from ir module 2023-02-13 10:24:47 +00:00
Alan Egerton b409329c62
Workaround issue #107747
Only required until fix #107803 is merged into stage0 compiler, expected
when beta 1.69.0 is released on 2023-03-09, then this commit can be
reverted.
2023-02-13 10:24:47 +00:00
Alan Egerton 36d09e3906
Split TypeVisitableExt from TypeVisitable 2023-02-13 10:24:47 +00:00
Alan Egerton ba55a453eb
Alias folding/visiting traits instead of re-export 2023-02-13 10:24:46 +00:00
Alan Egerton 62846d7c99
Move folding & visiting traits to ir submodules 2023-02-13 10:24:45 +00:00
bors 2d91939bb7 Auto merge of #107634 - scottmcm:array-drain, r=thomcc
Improve the `array::map` codegen

The `map` method on arrays [is documented as sometimes performing poorly](https://doc.rust-lang.org/std/primitive.array.html#note-on-performance-and-stack-usage), and after [a question on URLO](https://users.rust-lang.org/t/try-trait-residual-o-trait-and-try-collect-into-array/88510?u=scottmcm) prompted me to take another look at the core [`try_collect_into_array`](7c46fb2111/library/core/src/array/mod.rs (L865-L912)) function, I had some ideas that ended up working better than I'd expected.

There's three main ideas in here, split over three commits:
1. Don't use `array::IntoIter` when we can avoid it, since that seems to not get SRoA'd, meaning that every step writes things like loop counters into the stack unnecessarily
2. Don't return arrays in `Result`s unnecessarily, as that doesn't seem to optimize away even with `unwrap_unchecked` (perhaps because it needs to get moved into a new LLVM type to account for the discriminant)
3. Don't distract LLVM with all the `Option` dances when we know for sure we have enough items (like in `map` and `zip`).  This one's a larger commit as to do it I ended up adding a new `pub(crate)` trait, but hopefully those changes are still straight-forward.

(No libs-api changes; everything should be completely implementation-detail-internal.)

It's still not completely fixed -- I think it needs pcwalton's `memcpy` optimizations still (#103830) to get further -- but this seems to go much better than before.  And the remaining `memcpy`s are just `transmute`-equivalent (`[T; N] -> ManuallyDrop<[T; N]>` and `[MaybeUninit<T>; N] -> [T; N]`), so hopefully those will be easier to remove with LLVM16 than the previous subobject copies 🤞

r? `@thomcc`

As a simple example, this test
```rust
pub fn long_integer_map(x: [u32; 64]) -> [u32; 64] {
    x.map(|x| 13 * x + 7)
}
```
On nightly <https://rust.godbolt.org/z/xK7548TGj> takes `sub rsp, 808`
```llvm
start:
  %array.i.i.i.i = alloca [64 x i32], align 4
  %_3.sroa.5.i.i.i = alloca [65 x i32], align 4
  %_5.i = alloca %"core::iter::adapters::map::Map<core::array::iter::IntoIter<u32, 64>, [closure@/app/example.rs:2:11: 2:14]>", align 8
```
(and yes, that's a 6**5**-element array `alloca` despite 6**4**-element input and output)

But with this PR it's only `sub rsp, 520`
```llvm
start:
  %array.i.i.i.i.i.i = alloca [64 x i32], align 4
  %array1.i.i.i = alloca %"core::mem::manually_drop::ManuallyDrop<[u32; 64]>", align 4
```

Similarly, the loop it emits on nightly is scalar-only and horrifying
```nasm
.LBB0_1:
        mov     esi, 64
        mov     edi, 0
        cmp     rdx, 64
        je      .LBB0_3
        lea     rsi, [rdx + 1]
        mov     qword ptr [rsp + 784], rsi
        mov     r8d, dword ptr [rsp + 4*rdx + 528]
        mov     edi, 1
        lea     edx, [r8 + 2*r8]
        lea     r8d, [r8 + 4*rdx]
        add     r8d, 7
.LBB0_3:
        test    edi, edi
        je      .LBB0_11
        mov     dword ptr [rsp + 4*rcx + 272], r8d
        cmp     rsi, 64
        jne     .LBB0_6
        xor     r8d, r8d
        mov     edx, 64
        test    r8d, r8d
        jne     .LBB0_8
        jmp     .LBB0_11
.LBB0_6:
        lea     rdx, [rsi + 1]
        mov     qword ptr [rsp + 784], rdx
        mov     edi, dword ptr [rsp + 4*rsi + 528]
        mov     r8d, 1
        lea     esi, [rdi + 2*rdi]
        lea     edi, [rdi + 4*rsi]
        add     edi, 7
        test    r8d, r8d
        je      .LBB0_11
.LBB0_8:
        mov     dword ptr [rsp + 4*rcx + 276], edi
        add     rcx, 2
        cmp     rcx, 64
        jne     .LBB0_1
```

whereas with this PR it's unrolled and vectorized
```nasm
	vpmulld	ymm1, ymm0, ymmword ptr [rsp + 64]
	vpaddd	ymm1, ymm1, ymm2
	vmovdqu	ymmword ptr [rsp + 328], ymm1
	vpmulld	ymm1, ymm0, ymmword ptr [rsp + 96]
	vpaddd	ymm1, ymm1, ymm2
	vmovdqu	ymmword ptr [rsp + 360], ymm1
```
(though sadly still stack-to-stack)
2023-02-13 10:18:48 +00:00
lcnr 9e84b00d44 layout: deal with placeholders, ICE on bound types
a placeholder type is the same as a param as they
represent "this could be any type". A bound type
represents a type inside of a `for<T>` or `exists<T>`.
When entering a forall or exists `T` should be
instantiated as a existential (inference var) or universal
(placeholder). You should never observe a bound variable
without its binder.
2023-02-13 10:47:12 +01:00
Ryo Yoshida 57f0e9c100
Disallow invalid raw ident names 2023-02-13 18:45:19 +09:00