Commit Graph

18281 Commits

Author SHA1 Message Date
Cameron Steffen
298253af98 Specialize ToString for Symbol 2022-10-28 16:42:47 -05:00
bors
0da281b606 Auto merge of #103623 - matthiaskrgr:rollup-318yc1t, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #103035 (Even nicer errors from assert_unsafe_precondition)
 - #103106 (Try to say that memory outside the AM is always exposed)
 - #103475 (Make param index generation a bit more robust)
 - #103525 (Move a wf-check into the site where the value is instantiated)
 - #103564 (library: allow some unused things in Miri)
 - #103586 (Process registered region obligation in `resolve_regions_with_wf_tys`)
 - #103592 (rustdoc: remove redundant CSS selector `.notable-traits .notable`)
 - #103593 (Remove an unused parser function (`Expr::returns`))
 - #103611 (Add test for issue 103574)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-10-27 10:05:16 +00:00
Matthias Krüger
0f0c044228
Rollup merge of #103593 - compiler-errors:nit-remove-returns, r=fee1-dead
Remove an unused parser function (`Expr::returns`)

I removed the only usage in #97474
2022-10-27 09:25:12 +02:00
Matthias Krüger
bf53e712c0
Rollup merge of #103586 - compiler-errors:issue-103573, r=jackh726
Process registered region obligation in `resolve_regions_with_wf_tys`

Fixes #103573
2022-10-27 09:25:11 +02:00
Matthias Krüger
2bd49c34e5
Rollup merge of #103525 - oli-obk:const_impl_on_non_const_trait, r=lcnr
Move a wf-check into the site where the value is instantiated

r? ``@lcnr``
2022-10-27 09:25:10 +02:00
Matthias Krüger
d7ad6ad9ad
Rollup merge of #103475 - oli-obk:generic_param_indices, r=lcnr
Make param index generation a bit more robust

r? ````@lcnr````

While not really necessary for closure and anon const ids, it's strictly more correct
2022-10-27 09:25:09 +02:00
bors
9dd3d29ec8 Auto merge of #103601 - compiler-errors:no-opaque-probe-in-nll-relate, r=oli-obk
Remove `commit_if_ok` probe from NLL type relation

It was not really necessary to add the `commit_if_ok` in #100092 -- I added it to protect us against weird inference error messages due to recursive RPIT calls, but we are always on the error path when this happens anyways, and I can't come up with an example that makes this manifest.

Fixes #103599

r? `@oli-obk` since you reviewed #100092, feel free to re-roll.

🅱️ 📢  beta-nominating this since it's on beta (which forks in ~a week~ two days 😨) -- worst case we could revert the original PR on beta and land this on nightly, to give it some extra soak time...
2022-10-27 07:24:39 +00:00
Yuki Okushi
132883e455
Rollup merge of #103598 - tshepang:token-kind-docs, r=jackh726
rustc_lexer::TokenKind improve docs
2022-10-27 08:30:59 +09:00
Yuki Okushi
6e1de0e9aa
Rollup merge of #103549 - maurer:llvm-main, r=cuviper
llvm-16: Don't initialize removed legacy passes

LLVM removed initialization for legacy passes:
https://reviews.llvm.org/D136615
2022-10-27 08:30:56 +09:00
Michael Goulet
901649eeb7 No need to probe when relating opaques in nll_relate 2022-10-26 22:10:12 +00:00
Tshepang Mbambo
b66f92197a rustc_lexer::TokenKind improve docs 2022-10-26 23:32:14 +02:00
Michael Goulet
d380d0387d remove unused parser fn 2022-10-26 19:19:44 +00:00
Michael Goulet
db3b01d2bf Process registered region obligation in resolve_regions_with_wf_tys 2022-10-26 16:06:54 +00:00
bors
0a6b941df3 Auto merge of #103572 - Dylan-DPC:rollup-a8bnxrw, r=Dylan-DPC
Rollup of 6 pull requests

Successful merges:

 - #95710 (Stabilize arbitrary_enum_discriminant, take 2)
 - #102706 (Support excluding the generation of the standalone docs)
 - #103428 (Removed verbose printing from the `PrettyPrinter` when printing constants)
 - #103543 (Update books)
 - #103546 (interpret: a bit of cast cleanup)
 - #103554 (rustdoc: add visible focus outline to rustdoc-toggle)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-10-26 14:12:16 +00:00
Dylan DPC
709462bfe1
Rollup merge of #103546 - RalfJung:cast, r=oli-obk
interpret: a bit of cast cleanup

r? `@oli-obk`
2022-10-26 17:32:55 +05:30
Dylan DPC
ffde0f722e
Rollup merge of #103428 - SarthakSingh31:issue-94187, r=compiler-errors
Removed verbose printing from the `PrettyPrinter` when printing constants

Partially solves #94187 by completing the first step described in [this comment](https://github.com/rust-lang/rust/issues/94187#issuecomment-1282339909).
2022-10-26 17:32:54 +05:30
Dylan DPC
5b6455318a
Rollup merge of #95710 - fee1-dead-contrib:stabilize_arbitrary_enum_discriminant, r=joshtriplett
Stabilize arbitrary_enum_discriminant, take 2

Documentation has been updated in https://github.com/rust-lang/reference/pull/1055. cc #86860 for previous stabilization report.

Not yet marks https://github.com/rust-lang/rust/issues/60553 as done: need documentation in the rust reference.
2022-10-26 17:32:53 +05:30
bors
43dd3d514b Auto merge of #103284 - compiler-errors:const-sad, r=oli-obk
Revert "Unify tcx.constness and param env constness checks"

Too much of a perf regression https://github.com/rust-lang/rust/pull/102975#issuecomment-1282702513, and an attempt in #103263 didn't fix it except for just a tiny bit.

This change isn't really needed (see https://github.com/rust-lang/rust/pull/102830#issuecomment-1272514096), so this should be an easy revert.
2022-10-26 11:29:15 +00:00
bors
629a414d7b Auto merge of #103562 - Dylan-DPC:rollup-sheepp5, r=Dylan-DPC
Rollup of 10 pull requests

Successful merges:

 - #102951 (suggest type annotation for local statement initialed by ref expression)
 - #103209 (Diagnostic derives: allow specifying multiple alternative suggestions)
 - #103287 (Use a faster allocation size check in slice::from_raw_parts)
 - #103416 (Name the `impl Trait` in region bound suggestions)
 - #103430 (Workaround unstable stmt_expr_attributes for method receiver expressions)
 - #103444 (Remove extra type error after missing semicolon error)
 - #103520 (rustc_middle: Rearrange resolver outputs structures slightly)
 - #103533 (Use &self instead of &mut self for cast methods)
 - #103536 (Remove `rustc_driver::set_sigpipe_handler()`)
 - #103542 (Pinning tests for some `macro_rules!` errors discussed in the lang meeting)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-10-26 07:58:28 +00:00
Dylan DPC
d159124dbd
Rollup merge of #103536 - Enselic:remove-set_sigpipe_handler, r=tmiasko
Remove `rustc_driver::set_sigpipe_handler()`

Its usage was removed in https://github.com/rust-lang/rust/pull/102587 and https://github.com/rust-lang/rust/pull/103495, so we do not need to keep it around any longer. According to [preliminary input](https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/Find.20.60rustc_driver.60.20dependent.20projects.3F/near/304490764), we do not need to worry about any deprecation cycle for this explicitly unstable API, and can just straight up remove it.

PR that added `set_sigpipe_handler`: https://github.com/rust-lang/rust/pull/49606

Tracking issue for `unix_sigpipe`: #97889

Migration instructions for any remaining clients
---

Change from

```rust
#![feature(rustc_private)]

extern crate rustc_driver;

fn main() {
    rustc_driver::set_sigpipe_handler();
    // ...
```

to

```rust
#![feature(unix_sigpipe)]

#[unix_sigpipe = "sig_dfl"]
fn main() {
    // ...
```

``@rustbot`` labels +T-compiler
2022-10-26 11:29:57 +05:30
Dylan DPC
39e0e2cc24
Rollup merge of #103533 - jachris:cast-without-mut, r=oli-obk
Use &self instead of &mut self for cast methods

r? ``@oli-obk``
2022-10-26 11:29:56 +05:30
Dylan DPC
c956351f97
Rollup merge of #103520 - petrochenkov:resout, r=cjgillot
rustc_middle: Rearrange resolver outputs structures slightly

Addresses https://github.com/rust-lang/rust/pull/98106#discussion_r898427061.
I also haven't seen the motivation for moving `cstore` from its old place, so I moved it back in this PR.
r? ```@cjgillot```
2022-10-26 11:29:56 +05:30
Dylan DPC
742741f9c1
Rollup merge of #103444 - chenyukang:yukang/fix-103425-extra-diag, r=davidtwco
Remove extra type error after missing semicolon error

Fixes #103425
2022-10-26 11:29:55 +05:30
Dylan DPC
c9a04cddc0
Rollup merge of #103430 - cjgillot:receiver-attrs, r=petrochenkov
Workaround unstable stmt_expr_attributes for method receiver expressions

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

cc ``@Mark-Simulacrum`` ``@ehuss``
2022-10-26 11:29:55 +05:30
Dylan DPC
785828744c
Rollup merge of #103416 - compiler-errors:rpit-named, r=cjgillot
Name the `impl Trait` in region bound suggestions

Slightly more descriptive message
2022-10-26 11:29:54 +05:30
Dylan DPC
f2c2e582bd
Rollup merge of #103209 - Xiretza:multiple-suggestions, r=davidtwco
Diagnostic derives: allow specifying multiple alternative suggestions

This allows porting `span_suggestions()` to diagnostic structs.

Doesn't work for `multipart_suggestions()` because the rank would be reversed - the struct would specify multiple spans, each of which has multiple possible replacements, while `multipart_suggestions()` creates multiple possible replacements, each with multiple spans.
2022-10-26 11:29:53 +05:30
Dylan DPC
bf6bfcddf6
Rollup merge of #102951 - SparrowLii:type_annotation, r=estebank
suggest type annotation for local statement initialed by ref expression

In a local statement with a type declaration, if a ref expression is used on the right side and not used on the left side, in addition to removing the `&` and `&mut` on the right side, we can add them on the left side alternatively
Fixes #102892
2022-10-26 11:29:53 +05:30
bors
d49e7e7fa1 Auto merge of #103279 - compiler-errors:normalize-hack-back, r=lcnr
Add eval hack in `super_relate_consts` back

Partially reverts 01adb7e98d.

This extra eval call *still* needs to happen, for example, in `normalize_param_env_or_error` when a param-env predicate has an unnormalized constant, since the param-env candidates never get normalized during candidate assembly (everywhere else we can assume that they are normalized fully).

r? `@lcnr,` though I feel like I've assigned quite a few PRs to you in the last few days, so feel free to reassign to someone else familiar with this code if you're busy!

cc #103243 (fixes the issue, but don't want to auto-close that until a backport is performed).
2022-10-26 05:17:46 +00:00
bors
a5406feb1c Auto merge of #103158 - Bryanskiy:resolve_perf, r=petrochenkov
Perf improvements for effective visibility calculating

related to https://github.com/rust-lang/rust/pull/102026
r? `@petrochenkov`
2022-10-26 02:30:18 +00:00
bors
6365e5ad9f Auto merge of #102903 - compiler-errors:region-var-leak, r=jackh726
Assert if inference vars are leaking from `InferCtxt::fully_resolve`

`InferCtxt::fully_resolve` shouldn't return unresolved inference vars without us at least being aware of it, so make it an assertion now. This should only happen in cases where we used to be returning `ReEmpty`...

cc `@jackh726`
2022-10-25 23:24:36 +00:00
Matthew Maurer
6ea75aea56 llvm-16: Don't initialize removed legacy passes
LLVM removed initialization for legacy passes:
https://reviews.llvm.org/D136615
2022-10-25 15:03:21 -07:00
Ralf Jung
52fda858dd interpret: a bit of cast cleanup 2022-10-25 22:09:35 +02:00
Oli Scherer
1c26a278f3 Split diagnostic details out into a separate function and fluent files 2022-10-25 18:28:04 +00:00
Martin Nordholts
43e17454e2 Remove rustc_driver::set_sigpipe_handler()
Its usage was removed in 5e624bf4ba and 093b075d32, so we do not need to
keep it around any longer. According to [preliminary
input](https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/Find.20.60rustc_driver.60.20dependent.20projects.3F/near/304490764),
we do not need to worry about any deprecation cycle for this API and can
just straight up remove it.

Migration instructions for remaining clients
--------------------------------------------

Change from

```rust

extern crate rustc_driver;

fn main() {
    rustc_driver::set_sigpipe_handler();
    // ...
```

to

```rust

fn main() {
    // ...
```
2022-10-25 19:13:23 +02:00
Michael Goulet
726bf18d2d Name impl trait in region bound suggestion 2022-10-25 16:37:11 +00:00
Jannis Christopher Köhl
5378c82d80 Use &self instead of &mut self for cast methods 2022-10-25 18:31:11 +02:00
bors
bed4ad65bf Auto merge of #102340 - JakobDegen:pass-manager-simplification, r=oli-obk
Split phase change from `MirPass`

The main goal here is to simplify the pass manager logic. `MirPass` no longer contains the `phase_change` method, and `run_passes` instead accepts an `Option<PhaseChange>`. The hope is that this addresses the comments (and maybe perf regression) from #99102 .

r? `@oli-obk` cc `@RalfJung`
2022-10-25 15:55:39 +00:00
Oli Scherer
8286ea5a49 Move a wf-check into the site where the value is instantiated 2022-10-25 14:47:24 +00:00
Bryanskiy
a9447bb9d0 Perf improvements for effective visibility calculating 2022-10-25 15:15:18 +03:00
Vadim Petrochenkov
919673ea03 rustc_middle: Rearrange resolver outputs structures slightly 2022-10-25 15:42:29 +04:00
Dylan DPC
6aea54c082
Rollup merge of #103511 - nnethercote:bb-tweaks, r=bjorn3
Codegen tweaks

Best reviewed one commit at a time.

r? `@bjorn3`
2022-10-25 14:43:16 +05:30
Dylan DPC
8ba2a651fb
Rollup merge of #103122 - ouz-a:mir-technical-debt, r=oli-obk
Remove misc_cast and validate types when casting

Continuing our work in #102675

r? ````@oli-obk````
2022-10-25 14:43:14 +05:30
Dylan DPC
8a5ce1d615
Rollup merge of #102587 - Enselic:rustc-unix_sigpipe, r=jackh726
rustc: Use `unix_sigpipe` instead of `rustc_driver::set_sigpipe_handler`

This is the first (known) step towards starting to use `unix_sigpipe` in the wild. Eventually, `rustc_driver::set_sigpipe_handler` can be removed and all clients can use `unix_sigpipe` instead.

For now we just start using `unix_sigpipe` in one place: `rustc` itself.

It is easy to manually verify this change. If you remove `#[unix_sigpipe = "sig_dfl"]` and run `./x.py build` you will get an ICE when you do `./build/x86_64-unknown-linux-gnu/stage1/bin/rustc --help | false`. Add back `#[unix_sigpipe = "sig_dfl"]` and the ICE disappears again.

PR that added `set_sigpipe_handler`: https://github.com/rust-lang/rust/pull/49606

Tracking issue for `unix_sigpipe`: #97889

Not sure exactly how to label this PR. Going with T-libs for now since this is a T-libs feature.

````@rustdoc```` labels +T-libs
2022-10-25 14:43:14 +05:30
Sarthak Singh
5e46d8675c Added helper to prevent verbose printing from the PrettyPrinter when printing constants 2022-10-25 13:05:34 +05:30
bors
31d754a1df Auto merge of #102988 - dpaoliello:inlinerawdylib, r=dpaoliello
Support raw-dylib functions being used inside inlined functions

Fixes #102714

Issue Details:
When generating the import library for `raw-dylib` symbols, we currently only use the functions and variables declared within the current crate. This works fine if all crates are static libraries or `rlib`s as the generated import library will be contained in the static library or `rlib` itself, but if a dependency is a dynamic library AND the use of a `raw-dylib` function or variable is inlined or part of a generic instantiation then the current crate won't see its dependency's import library and so linking will fail.

Fix Details:
Instead, when we generate the import library for a `dylib` or `bin` crate, we will now generate it for the symbols both for the current crate and all upstream crates. We do this in two steps so that the import library for the current crate is passed into the linker first, thus it is preferred if there are any ambiguous symbols.
2022-10-25 04:57:51 +00:00
Nicholas Nethercote
6cd35ac203 Simplify cast_shift_expr_rhs.
It's only ever used with shift operators.
2022-10-25 14:39:20 +11:00
Nicholas Nethercote
8c02f4d05d Inline and remove cast_shift_rhs.
It has a single call site.
2022-10-25 13:51:52 +11:00
Nicholas Nethercote
03f350f5a5 Clarify some cleanup stuff.
- Rearrange the match in `llbb_with_landing_pad` so the `(Some,Some)`
  cases are together.
- Add assertions to indicate two MSVC-only paths.
2022-10-25 12:07:35 +11:00
Nicholas Nethercote
a5bd5da594 Rename two TerminatorCodegenHelper methods.
`TerminatorCodegenHelper` has three methods `llblock`, `llbb`, and
`lltarget`. They're all similar, but the names given no indication of
the differences.

This commit renames `lltarget` as `llbb_with_landing_pad`, and `llblock`
as `llbb_with_cleanup`. These aren't fantastic names, but at least it's
now clear that `llbb` is the lowest-level of the three and the other two
wrap it.
2022-10-25 12:07:26 +11:00
Nicholas Nethercote
4e4092f8cc rustc_codegen_ssa: use more consistent naming.
Ensure:
- builders always have a `bx` suffix;
- backend basic blocks always have an `llbb` suffix,
- paired builders and basic blocks have consistent prefixes.
2022-10-25 12:07:23 +11:00