Commit graph

212130 commits

Author SHA1 Message Date
Daniil Belov
a9cf163c08 fix: remove hack from link.rs (moved to libc) 2022-12-07 13:13:58 +03:00
bors
ec28f5338b Auto merge of #105395 - sunfishcode:sunfishcode/update-wasi, r=pietroalbini
Update the wasi toolchain.

Update the WASI build to LLVM 15.0 and the wasi-libc version from [wasi-sdk-17].

This will require a ci-mirrors.rust-lang.org file load. Specifically, we need [this LLVM release tarball] uploaded to be downloadable from [this URL].

The biggest change in wasi-sdk-17 is that user exports no longer automatically run constructor functions. More details at: https://github.com/WebAssembly/WASI/issues/493.

[this LLVM release tarball]: https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.6/clang+llvm-15.0.6-x86_64-linux-gnu-ubuntu-18.04.tar.xz
[this URL]: https://ci-mirrors.rust-lang.org/rustc/2022-12-06-clang%2Bllvm-15.0.6-x86_64-linux-gnu-ubuntu-18.04.tar.xz
[wasi-sdk-17]: https://github.com/WebAssembly/wasi-sdk/releases/tag/wasi-sdk-17
2022-12-07 06:16:19 +00:00
bors
e491d2b24d Auto merge of #105291 - nnethercote:remove-LintPassObjects, r=cjgillot
Remove `{Early,Late}LintPassObjects`.

`EarlyContextAndPass` wraps a single early lint pass. We aggregate multiple passes into that single pass by using `EarlyLintPassObjects`.

This commit removes `EarlyLintPassObjects` by changing `EarlyContextAndPass` into `EarlyContextAndPasses`. I.e. it just removes a level of indirection. This makes the code simpler and slightly faster.

The commit does likewise for late lints.

r? `@cjgillot`
2022-12-07 03:52:19 +00:00
bors
d43674e2c9 Auto merge of #105397 - matthiaskrgr:rollup-xv5imz8, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #105298 (llvm-wrapper: adapt for an LLVM API change)
 - #105358 (Add a test for #104260)
 - #105380 (add const generics ping files things for me)
 - #105382 (remove an excess `this`)
 - #105388 (rustdoc: remove redundant CSS `.import-item .stab { font-size }`)
 - #105390 (unstable-book: Add `ignore` to `abi_efiapi` example code)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-12-07 00:32:57 +00:00
Matthias Krüger
62d5beed0f
Rollup merge of #105390 - nicholasbishop:bishop-example-ignore, r=ehuss
unstable-book: Add `ignore` to `abi_efiapi` example code

This example doesn't compile on targets that don't support UEFI, as reported here:
https://github.com/rust-lang/rust/pull/104793#issuecomment-1339783727
2022-12-06 23:13:52 +01:00
Matthias Krüger
2ee1573fa5
Rollup merge of #105388 - notriddle:notriddle/item-stab-font-size, r=GuillaumeGomez
rustdoc: remove redundant CSS `.import-item .stab { font-size }`

This sets the exact same font size that `.stab` has by default anyway. It used to be slightly different, but dd5ff428ed made it identical.
2022-12-06 23:13:51 +01:00
Matthias Krüger
280501d6bc
Rollup merge of #105382 - BoxyUwU:fixme_typo_sadface, r=lcnr
remove an excess `this`
2022-12-06 23:13:51 +01:00
Matthias Krüger
b3a69bf34e
Rollup merge of #105380 - BoxyUwU:triagebot_ping_pls, r=lcnr
add const generics ping files things for me

r? `@lcnr`
2022-12-06 23:13:50 +01:00
Matthias Krüger
001bd5128b
Rollup merge of #105358 - TaKO8Ki:fix-104260, r=estebank
Add a test for #104260

Fixes #104260
2022-12-06 23:13:50 +01:00
Matthias Krüger
e434f613fd
Rollup merge of #105298 - krasimirgg:llvm-16-dec-1, r=cuviper
llvm-wrapper: adapt for an LLVM API change

Adapts llvm-wrapper for 8c7c20f033.
No functional changes intended.

Found via our experimental rust + llvm @ HEAD bot: https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/15404#0184d95d-5a68-4db6-ad32-51ddbc3ab543/202-571
2022-12-06 23:13:49 +01:00
bors
023b5136b5 Auto merge of #105271 - eduardosm:inline-always-int-conv, r=scottmcm
Make integer-to-integer `From` impls `#[inline(always)]`

Splited from https://github.com/rust-lang/rust/pull/105262
2022-12-06 21:41:04 +00:00
Dan Gohman
3e671fee5f Update the wasi toolchain.
Update the WASI build to LLVM 15.0 and the wasi-libc version from [wasi-sdk-17].

This will require a ci-mirrors.rust-lang.org file load. Specifically, we
need [this LLVM release tarball] uploaded to be downloadable from
[this URL].

[this LLVM release tarball]: https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.6/clang+llvm-15.0.6-x86_64-linux-gnu-ubuntu-18.04.tar.xz
[this URL]: https://ci-mirrors.rust-lang.org/rustc/2022-12-06-clang%2Bllvm-15.0.6-x86_64-linux-gnu-ubuntu-18.04.tar.xz
[wasi-sdk-17]: https://github.com/WebAssembly/wasi-sdk/releases/tag/wasi-sdk-17
2022-12-06 13:13:11 -08:00
Nicholas Bishop
bc38c2ae67 unstable-book: Add ignore to abi_efiapi example code
This example doesn't compile on targets that don't support UEFI, as
reported here:
https://github.com/rust-lang/rust/pull/104793#issuecomment-1339783727
2022-12-06 14:45:38 -05:00
Michael Howell
958a1ae0f7 rustdoc: remove redundant CSS .import-item .stab { font-size }
This sets the exact same font size that `.stab` has by default anyway.
It used to be slightly different, but
dd5ff428ed made it identical.
2022-12-06 11:56:22 -07:00
bors
b28d30e1e3 Auto merge of #105378 - matthiaskrgr:rollup-fjeorw5, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #104898 (Put all cached values into a central struct instead of just the stable hash)
 - #105004 (Fix `emit_unused_delims_expr` ICE)
 - #105174 (Suggest removing struct field from destructive binding only in shorthand scenario)
 - #105250 (Replace usage of `ResumeTy` in async lowering with `Context`)
 - #105286 (Add -Z maximal-hir-to-mir-coverage flag)
 - #105320 (rustdoc: simplify CSS selectors on top-doc and non-exhaustive toggles)
 - #105349 (Point at args in associated const fn pointers)
 - #105362 (Cleanup macro-expanded code in `rustc_type_ir`)
 - #105370 (Remove outdated syntax from trait alias pretty printing)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-12-06 18:51:14 +00:00
Krasimir Georgiev
75aec4703d llvm-wrapper: adapt for and LLVM API change 2022-12-06 18:25:33 +00:00
Boxy
3ca5c821c2
CONSISTENCY
Co-authored-by: lcnr <rust@lcnr.de>
2022-12-06 16:45:11 +00:00
Boxy
0070fae2dc typo :( 2022-12-06 16:40:57 +00:00
Boxy
50f090002a add cg ping files things 2022-12-06 16:33:19 +00:00
Matthias Krüger
97008a23fc
Rollup merge of #105370 - WaffleLapkin:pp, r=oli-obk
Remove outdated syntax from trait alias pretty printing

Given the following program:
```rust
#![feature(trait_alias)]
trait A = ?Sized;

fn main() {}
```
Old output of `rustc +nightly ./t.rs -Zunpretty=normal`:
```rust
#![feature(trait_alias)]
trait A for ? Sized ;

fn main() {}
```
New output of `rustc +a ./t.rs -Zunpretty=normal`:
```rust
#![feature(trait_alias)]
trait A = ?Sized;

fn main() {}
```

cc `@durka` (you've written the `FIXME` in #45047, see https://github.com/rust-lang/rust/pull/45047#discussion_r144960751)
2022-12-06 16:54:57 +01:00
Matthias Krüger
4f527a55de
Rollup merge of #105362 - WaffleLapkin:🙅, r=oli-obk
Cleanup macro-expanded code in `rustc_type_ir`

We could of course just leave this as-is, but every time I go-to-def to this file it's painful to see all this `(&A(ref __self_1_0),)` stuff.
2022-12-06 16:54:56 +01:00
Matthias Krüger
4f919e4628
Rollup merge of #105349 - compiler-errors:point-at-assoc-ct-fn-ptr-arg, r=cjgillot
Point at args in associated const fn pointers

Tiny follow-up to #105201, not so sure it's worth it but 🤷

The UI test example is a bit more compelling when it's `GlUniformScalar::FACTORY`

r? `@cjgillot`
2022-12-06 16:54:56 +01:00
Matthias Krüger
dc07e1bbdd
Rollup merge of #105320 - notriddle:notriddle/rustdoc-toggle-hideme-2, r=GuillaumeGomez
rustdoc: simplify CSS selectors on top-doc and non-exhaustive toggles

This code uses a special `hideme` class anyway, so just style that.
2022-12-06 16:54:55 +01:00
Matthias Krüger
c699b05306
Rollup merge of #105286 - willcrichton:maximal-hir-to-mir-coverage, r=cjgillot
Add -Z maximal-hir-to-mir-coverage flag

This PR adds a new unstable flag `-Z maximal-hir-to-mir-coverage` that changes the behavior of `maybe_lint_level_root_bounded`, pursuant to [a discussion on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Mapping.20MIR.20to.20HIR). When enabled, this function will not search upwards for a lint root, but rather immediately return the provided HIR node ID. This change increases the granularity of the mapping between MIR locations and HIR nodes inside the `SourceScopeLocalData` data structures. This increase in granularity is useful for rustc consumers like [Flowistry](https://github.com/willcrichton/flowistry) that rely on getting source-mapping information about the MIR CFG that is as precise as possible.

A test `maximal_mir_to_hir_coverage.rs` has been added to verify that this flag does not break anything.

r? `@cjgillot`

cc `@gavinleroy`
2022-12-06 16:54:55 +01:00
Matthias Krüger
967085ecdf
Rollup merge of #105250 - Swatinem:async-rm-resumety, r=oli-obk
Replace usage of `ResumeTy` in async lowering with `Context`

Replaces using `ResumeTy` / `get_context` in favor of using `&'static mut Context<'_>`.

Usage of the `'static` lifetime here is technically "cheating", and replaces the raw pointer in `ResumeTy` and the `get_context` fn that pulls the correct lifetimes out of thin air.

fixes https://github.com/rust-lang/rust/issues/104828 and https://github.com/rust-lang/rust/pull/104321#issuecomment-1336363077

r? `@oli-obk`
2022-12-06 16:54:54 +01:00
Matthias Krüger
90d84ce3a2
Rollup merge of #105174 - chenyukang:yukang/fix-105028-unused, r=eholk
Suggest removing struct field from destructive binding only in shorthand scenario

Fixes #105028
2022-12-06 16:54:53 +01:00
Matthias Krüger
b29a4f9bac
Rollup merge of #105004 - TaKO8Ki:fix-104897, r=wesleywiser
Fix `emit_unused_delims_expr` ICE

Fixes #104897

This is also related to #104433.
2022-12-06 16:54:53 +01:00
Matthias Krüger
db416ea195
Rollup merge of #104898 - oli-obk:group_all_the_things, r=wesleywiser
Put all cached values into a central struct instead of just the stable hash

cc `@nnethercote`

this allows re-use of the type for Predicate without duplicating all the logic for the non-hash cached fields
2022-12-06 16:54:52 +01:00
bors
e60fbaf4ce Auto merge of #105229 - saethlin:zst-writes-to-unions, r=oli-obk
Re-enable removal of ZST writes to unions

This was previously disabled because Miri was lazily allocating unsized locals. But we aren't doing that anymore since  https://github.com/rust-lang/rust/pull/98831, so we can have this optimization back.
2022-12-06 15:35:55 +00:00
Maybe Waffle
12ce0c2a89 Remove outdated syntax from trait alias pretty printing 2022-12-06 13:45:11 +00:00
Maybe Waffle
e12d22239a Add debug asserts to hand-implemented Ord/Eq impls 2022-12-06 13:38:50 +00:00
bors
b6852428a8 Auto merge of #105365 - matthiaskrgr:rollup-g0mrrt7, r=matthiaskrgr
Rollup of 11 pull requests

Successful merges:

 - #104439 (Add prototype to generate `COPYRIGHT` from REUSE metadata)
 - #105005 (On E0195 point at where clause lifetime bounds)
 - #105098 (propagate the error from parsing enum variant to the parser and emit out)
 - #105243 (remove no-op 'let _ = ')
 - #105254 (Recurse into nested impl-trait when computing variance.)
 - #105287 (Synthesize substitutions for bad auto traits in dyn types)
 - #105310 (Be more careful about unresolved exprs in suggestion)
 - #105318 (Make `get_impl_future_output_ty` work with AFIT)
 - #105339 (support `ConstKind::Expr` in `is_const_evaluatable` and `WfPredicates::compute`)
 - #105340 (Avoid ICE by accounting for missing type)
 - #105342 (Make `note_obligation_cause_code`  take a `impl ToPredicate` for predicate)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-12-06 12:29:38 +00:00
Matthias Krüger
a9ffe7c738
Rollup merge of #105342 - compiler-errors:note_cause_code-takes-predicate, r=fee1-dead
Make `note_obligation_cause_code`  take a `impl ToPredicate` for predicate

The only usecase that wasn't `impl ToPredicate` was noting overflow errors while revealing opaque types, which passed in an `Obligation<'tcx, Ty<'tcx>>`... Since this only happens in a `RevealAll` environment, which is after typeck (and probably primarily within `normalize_erasing_regions`) we're unlikely to display anything useful while noting this code, evidenced by the lack of UI test changes.
2022-12-06 13:27:45 +01:00
Matthias Krüger
07fd8089a4
Rollup merge of #105340 - estebank:ice-ice-baby, r=compiler-errors
Avoid ICE by accounting for missing type

Fix #105330
2022-12-06 13:27:45 +01:00
Matthias Krüger
762d2545f4
Rollup merge of #105339 - BoxyUwU:wf_ct_kind_expr, r=TaKO8Ki
support `ConstKind::Expr` in `is_const_evaluatable` and `WfPredicates::compute`

Fixes #105205

Currently we haven't implemented a way to evaluate `ConstKind::Expr(Expr::Binop(Add, 1, 2))` so I just left that with a `FIXME` and a `delay_span_bug` since I have no idea how to do that and it would make this a much larger (and more complicated) PR :P
2022-12-06 13:27:44 +01:00
Matthias Krüger
e29a510ff0
Rollup merge of #105318 - compiler-errors:issue-105304, r=jackh726
Make `get_impl_future_output_ty` work with AFIT

Fixes #105304
2022-12-06 13:27:44 +01:00
Matthias Krüger
61189b6ae3
Rollup merge of #105310 - compiler-errors:issue-105288, r=eholk
Be more careful about unresolved exprs in suggestion

Fixes #105288
2022-12-06 13:27:43 +01:00
Matthias Krüger
0a07ffe4ad
Rollup merge of #105287 - compiler-errors:issue-105275, r=eholk
Synthesize substitutions for bad auto traits in dyn types

Auto traits are stored as just `DefId`s inside a `dyn Trait`'s existential predicates list. This is usually fine, since auto traits are forbidden to have generics -- but this becomes a problem for an ill-formed auto trait.

But since this will always result in an error, just synthesize some dummy (error) substitutions which are used at least to keep trait selection code happy about the number of substs in a trait ref.

Fixes #104808
2022-12-06 13:27:43 +01:00
Matthias Krüger
ddb98e0aac
Rollup merge of #105254 - cjgillot:issue-105251, r=oli-obk
Recurse into nested impl-trait when computing variance.

Fixes https://github.com/rust-lang/rust/issues/105251
2022-12-06 13:27:42 +01:00
Matthias Krüger
7d8e329194
Rollup merge of #105243 - RalfJung:no-op-let, r=Mark-Simulacrum
remove no-op 'let _ = '

Also see the discussion at https://github.com/rust-lang/rust/pull/93563#discussion_r1034057555.

I don't know why these `Drop` implementations exist to begin with, given that their body does literally nothing, but did not want to change that. (It might affect dropck.)

Cc `````@ibraheemdev````` `````@Amanieu`````
2022-12-06 13:27:42 +01:00
Matthias Krüger
48172ff64b
Rollup merge of #105098 - lyming2007:issue-103869-fix, r=eholk
propagate the error from parsing enum variant to the parser and emit out

While parsing enum variant, the error message always disappear
Because the error message that emit out is from main error of parser
The information of enum variant disappears while parsing enum variant with error
We only check the syntax of expecting token, i.e, in case https://github.com/rust-lang/rust/issues/103869
It will error it without telling the message that this error is from pasring enum variant.
Propagate the sub-error from parsing enum variant to the main error of parser by chaining it with map_err
Check the sub-error before emitting the main error of parser and attach it.
Fix https://github.com/rust-lang/rust/issues/103869
2022-12-06 13:27:41 +01:00
Matthias Krüger
be3ad5d6b0
Rollup merge of #105005 - estebank:where-clause-lts, r=compiler-errors
On E0195 point at where clause lifetime bounds

Fix #104733
2022-12-06 13:27:41 +01:00
Matthias Krüger
e5a01b97ee
Rollup merge of #104439 - ferrocene:pa-generate-copyright, r=pnkfelix
Add prototype to generate `COPYRIGHT` from REUSE metadata

This PR adds a prototype to generate the `COPYRIGHT` file from the metadata gathered with REUSE. There are two new tools:

* `src/tools/collect-license-metadata` invokes REUSE, parses its output and stores a concise JSON representation of the metadata in `src/etc/license-metadata.json`.
* `src/tools/generate-copyright` parses the metadata generated above, (in the future will) gather crate dependencies metadata, and renders the `COPYRIGHT.md` file.

Note that since the contents of those files are currently incorrect, rather than outputting in the paths above, the files will be stored in `build/` and not committed. This will be changed once we're confident about the metadata.

Eventually, `src/etc/license-metadata.json` will be committed into the repository and verified to be up to date by CI (similar to our GitHub Actions configuration), to avoid having people install REUSE on their local machine in most cases.

You can see the (incorrect) generated files in https://gist.github.com/pietroalbini/3f3f22b6f9cc8533abf7494b6a50cf97.

r? `@pnkfelix`
2022-12-06 13:27:40 +01:00
Maybe Waffle
07fbb1b372 Cleanup macro-expanded code in rustc_type_ir 2022-12-06 11:17:49 +00:00
bors
9db224fc90 Auto merge of #105175 - michaelwoerister:add-stable-ord-trait, r=nagisa
Add StableOrd trait as proposed in MCP 533.

The `StableOrd` trait can be used to mark types as having a stable sort order across compilation sessions. Collections that sort their items in a stable way can safely implement HashStable by hashing items in sort order.

See https://github.com/rust-lang/compiler-team/issues/533 for more information.
2022-12-06 09:21:49 +00:00
Arpad Borsos
cf031a3355
Replace usage of ResumeTy in async lowering with Context
Replaces using `ResumeTy` / `get_context` in favor of using `&'static mut Context<'_>`.

Usage of the `'static` lifetime here is technically "cheating", and replaces
the raw pointer in `ResumeTy` and the `get_context` fn that pulls the
correct lifetimes out of thin air.
2022-12-06 10:16:23 +01:00
Takayuki Maeda
d15ca0974e add a test for #104260 2022-12-06 17:49:24 +09:00
bors
c5351ad4dc Auto merge of #105348 - JohnTitor:rollup-q9bichr, r=JohnTitor
Rollup of 10 pull requests

Successful merges:

 - #104967 (Fix UI issues with Rustdoc scrape-examples feature.)
 - #105207 (interpret: clobber return place when calling function)
 - #105246 (Fix --pass in compiletest)
 - #105256 (Add small comment explaining what `method-margins.goml` test is about)
 - #105289 (Fix dupe word typos)
 - #105309 (rustdoc: remove no-op mobile CSS `.sidebar { margin: 0; padding: 0 }`)
 - #105313 (Update books)
 - #105315 (Normalize inherent associated types after substitution)
 - #105324 (Point at GAT `where` clause when an obligation is unsatisfied)
 - #105338 (Tweak "the following other types implement trait")

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-12-06 06:34:13 +00:00
Esteban Küber
9ffd086865 review comment: add test case 2022-12-05 20:43:41 -08:00
Esteban Küber
e802165dfe On E0195 point at where clause lifetime bounds
Fix #104733
2022-12-05 20:43:41 -08:00