Commit Graph

17312 Commits

Author SHA1 Message Date
Matthias Krüger
bf167e0ae5
Rollup merge of #102088 - oli-obk:cleanups, r=bjorn3
Fix wrongly refactored Lift impl

see https://github.com/rust-lang/rust/pull/101858#issuecomment-1252713639

r? ``@bjorn3``
2022-09-24 14:29:53 +02:00
bors
bb5a016175 Auto merge of #102064 - cjgillot:revert, r=Mark-Simulacrum
Revert perf-regression 101620

Reverts #101862 #101620

r? `@Mark-Simulacrum`
2022-09-24 09:36:29 +00:00
Matthias Krüger
a842357d37
Rollup merge of #102152 - compiler-errors:issue-102140, r=fee1-dead
Calculate `ProjectionTy::trait_def_id` for return-position `impl Trait` in trait correctly

Fixes #102140
2022-09-24 07:38:56 +02:00
bors
e1c28e0c85 Auto merge of #102068 - cjgillot:erased-lifetime-print, r=eholk
Always print '_, even for erased lifetimes.

Explicit lifetime arguments are now the recommended syntax in rust 2018 and rust 2021.  This PR applies this discipline to rustc itself.
2022-09-24 01:23:17 +00:00
bors
4a14677239 Auto merge of #102192 - matthiaskrgr:rollup-0ctjzco, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #102094 (Add missing documentation for `bool::from_str`)
 - #102115 (Add examples to `bool::then` and `bool::then_some`)
 - #102134 (Detect panic strategy using `rustc --print cfg`)
 - #102137 (Don't convert valtree to constvalue during normalization)
 - #102148 (add regression test for miri issue 2433)
 - #102158 (rustdoc: clean up CSS/DOM for deprecation warnings)
 - #102177 (Fix a typo in `std`'s root docs)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-09-23 16:44:06 +00:00
Camille GILLOT
aac2c7ddd8 Always print '_, even for erased lifetimes. 2022-09-23 18:42:14 +02:00
Matthias Krüger
3a8bad98d7
Rollup merge of #102137 - b-naber:lazy-const-val-conversion, r=lcnr
Don't convert valtree to constvalue during normalization

r? ``@lcnr``
2022-09-23 15:40:22 +02:00
bors
9a963e3bad Auto merge of #102056 - b-naber:unevaluated, r=lcnr
Introduce mir::Unevaluated

Previously the distinction between unevaluated constants in the type-system and in mir was not explicit and a little confusing. Probably better to introduce its own type for that.

r? `@lcnr`
2022-09-23 13:39:11 +00:00
b-naber
a705e65605 rename Unevaluated to UnevaluatedConst 2022-09-23 14:27:34 +02:00
bors
4d44e09cb1 Auto merge of #102165 - matthiaskrgr:rollup-n5oquhe, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #100734 (Split out async_fn_in_trait into a separate feature)
 - #101664 (Note if mismatched types have a similar name)
 - #101815 (Migrated the rustc_passes annotation without effect diagnostic infrastructure)
 - #102042 (Distribute rust-docs-json via rustup.)
 - #102066 (rustdoc: remove unnecessary `max-width` on headers)
 - #102095 (Deduplicate two functions that would soon have been three)
 - #102104 (Set 'exec-env:RUST_BACKTRACE=0' in const-eval-select tests)
 - #102112 (Allow full relro on powerpc64-unknown-linux-gnu)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-09-23 09:33:23 +00:00
bors
bc4d574ff2 Auto merge of #102150 - matthiaskrgr:rollup-6xmd8f3, r=matthiaskrgr
Rollup of 10 pull requests

Successful merges:

 - #102113 (OpTy: fix a method taking self rather than &self)
 - #102118 (rustdoc: clean up line numbers on code examples)
 - #102123 (Add note to clippy::non_expressive_names doc)
 - #102125 (rustdoc: remove no-op CSS `.content .item-info { position: relative }`)
 - #102127 (Use appropriate variable names)
 - #102128 (Const unification is already infallible, remove the error handling logic)
 - #102133 (Use valtrees for comparison)
 - #102135 (Improve some AllTypes fields name)
 - #102144 (Extend const_convert with const {FormResidual, Try} for ControlFlow.)
 - #102147 (rustdoc: remove no-op CSS `.location:empty { border: none }`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-09-23 06:52:39 +00:00
bors
77e7e88567 Auto merge of #100488 - khyperia:invalid-calling-convention-help-message, r=nagisa,jyn514
Improve the help message for an invalid calling convention

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

I mostly followed the suggestions of `@nagisa` in that issue, ~~however, I wasn't sure how to check stability for the suggestion of "Do not suggest CCs that cannot be used due to them being unstable and feature not being enabled", so I did not implement that point.~~

I haven't contributed to rustc much, please feel free to point out suggestions! For example, the `.map(|s| Symbol::intern(s)).collect::<Vec<_>>()` seems pretty gross performance-wise, but maybe that's OK in error reporting code.
2022-09-23 04:22:14 +00:00
Matthias Krüger
8e3b9bca65
Rollup merge of #102112 - cuviper:powerpc64-full-relro, r=eholk
Allow full relro on powerpc64-unknown-linux-gnu

This was previously limited to partial relro, citing issues on RHEL6,
but that's no longer a supported platform since #95026. We have long
been enabling full relro in RHEL7's own Rust builds for ppc64, without
trouble, so it should be fine to drop this workaround.
2022-09-23 04:29:20 +02:00
Matthias Krüger
dac0f6e821
Rollup merge of #102095 - oli-obk:simplify, r=TaKO8Ki
Deduplicate two functions that would soon have been three

https://github.com/rust-lang/rust/pull/101900 would have added another copy of this for effects
2022-09-23 04:29:19 +02:00
Matthias Krüger
695b708311
Rollup merge of #101815 - diegooliveira:master, r=davidtwco
Migrated the rustc_passes annotation without effect diagnostic infrastructure

Small change to move the validation for annotations to the new diagnostic infrastructure.
2022-09-23 04:29:16 +02:00
Matthias Krüger
c2d2535b84
Rollup merge of #101664 - mejrs:similarity, r=fee1-dead
Note if mismatched types have a similar name

If users get a type error between similarly named types, it will point out that these are actually different types, and where they were defined.
2022-09-23 04:29:16 +02:00
Matthias Krüger
5d7937de8c
Rollup merge of #100734 - ComputerDruid:afit_feature, r=compiler-errors
Split out async_fn_in_trait into a separate feature

PR #101224 added support for async fn in trait desuraging behind the `return_position_impl_trait_in_trait` feature.

Split this out so that it's behind its own feature gate, since async fn in trait doesn't need to follow the same stabilization schedule.
2022-09-23 04:29:15 +02:00
bors
9279c547c7 Auto merge of #101708 - compiler-errors:issue-101696, r=jackh726
Normalize closure signature after construction

Astconv can't normalize inputs or outputs with escaping bound vars ([see this](https://doc.rust-lang.org/nightly/nightly-rustc/src/rustc_typeck/check/fn_ctxt/mod.rs.html#294)), so normalize them after we've wrapped them in a binder.

Fixes #101696
2022-09-23 01:21:25 +00:00
khyperia
9a206a78eb Improve the help message for an invalid calling convention 2022-09-22 22:18:30 +02:00
Michael Goulet
79c665b2a3 Calculate ProjectionTy::trait_def_id correctly 2022-09-22 19:49:18 +00:00
Matthias Krüger
aa384834d7
Rollup merge of #102133 - b-naber:use-valtrees-in-fast-reject, r=lcnr
Use valtrees for comparison

r? `@lcnr`
2022-09-22 21:34:54 +02:00
Matthias Krüger
b93c9a7d37
Rollup merge of #102128 - oli-obk:const_unification, r=lcnr
Const unification is already infallible, remove the error handling logic

r? `@lcnr`

is this expected to be used in the future? Right now it is dead code.
2022-09-22 21:34:53 +02:00
Matthias Krüger
c5d223033b
Rollup merge of #102127 - TaKO8Ki:use-appropriate-variable-names, r=lcnr
Use appropriate variable names
2022-09-22 21:34:52 +02:00
Matthias Krüger
41ad726110
Rollup merge of #102113 - RalfJung:opty-assert-mem, r=oli-obk
OpTy: fix a method taking self rather than &self

r? `@oli-obk`
2022-09-22 21:34:49 +02:00
bors
e7119a0300 Auto merge of #98840 - cjgillot:span-inline-ctxt, r=wesleywiser
Inline SyntaxContext in both encoded span representation.

The current interned representation for spans does not use the `ctxt_or_zero: u16` field.  This PR proposes to use this field to store the `SyntaxContext` of the interned span instead.  When `ctxt_or_zero` and the interned span's `ctxt` don't match, the inlined one takes precedence.

This allows to implement `Span::ctxt` and `Span::with_ctxt` with much less probability to access the interner.  Those functions are used a lot for hygiene, so this may be worth it.
2022-09-22 17:59:27 +00:00
Camille GILLOT
fc43df0333 Revert "Auto merge of #101620 - cjgillot:compute_lint_levels_by_def, r=oli-obk"
This reverts commit 2cb9a65684, reversing
changes made to 750bd1a7ff.
2022-09-22 19:36:11 +02:00
Camille GILLOT
381bd2a836 Revert "Auto merge of #101862 - cjgillot:lint-regression, r=oli-obk"
This reverts commit bc7b17cfe3, reversing
changes made to 5253b0a0a1.
2022-09-22 19:34:01 +02:00
bors
89e4e1f1b3 Auto merge of #102139 - Dylan-DPC:rollup-ljlipt8, r=Dylan-DPC
Rollup of 8 pull requests

Successful merges:

 - #101598 (Update rustc's information on Android's sanitizers)
 - #102036 (Remove use of `io::ErrorKind::Other` in std)
 - #102037 (Make cycle errors recoverable)
 - #102069 (Skip `Equate` relation in `handle_opaque_type`)
 - #102076 (rustc_transmute: fix big-endian discriminants)
 - #102107 (Add missing space between notable trait tooltip and where clause)
 - #102119 (Fix a typo “pararmeter” in error message)
 - #102131 (Added which number is computed in compute_float.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-09-22 15:18:35 +00:00
Dylan DPC
53e08f36be
Rollup merge of #102119 - steffahn:fix-pararmeter, r=dtolnay
Fix a typo “pararmeter” in error message

Issue reported on IRLO: https://internals.rust-lang.org/t/fixing-a-typo/17427
2022-09-22 18:25:56 +05:30
Dylan DPC
7cac18e1be
Rollup merge of #102076 - cuviper:transmute-discr-endian, r=jackh726
rustc_transmute: fix big-endian discriminants

I noticed that some new tests were failing in Fedora on s390x only, which usually means there's a problem with big-endian, and sure enough there's a FIXME(``@jswrenn)`` for that in `rustc_transmute`. This patch implements the appropriate consideration for target endianness, rather than using native (host) endian.
2022-09-22 18:25:54 +05:30
Dylan DPC
8bf533593d
Rollup merge of #102069 - compiler-errors:no-eq-in-register-opaque, r=oli-obk
Skip `Equate` relation in `handle_opaque_type`

r? ``@oli-obk``
2022-09-22 18:25:54 +05:30
Dylan DPC
d5ae6737bf
Rollup merge of #102037 - jyn514:normalize-docs, r=lcnr
Make cycle errors recoverable

In particular, this allows rustdoc to recover from cycle errors when normalizing associated types for documentation.

In the past, ```@jackh726``` has said we need to be careful about overflow errors: https://github.com/rust-lang/rust/pull/91430#issuecomment-983997013

> Off the top of my head, we definitely should be careful about treating overflow errors the same as
"not implemented for some reason" errors. Otherwise, you could end up with behavior that is
different depending on recursion depth. But, that might be context-dependent.

But cycle errors should be safe to unconditionally report; they don't depend on the recursion depth, they will always be an error whenever they're encountered.

Helps with https://github.com/rust-lang/rust/issues/81091.

r? ```@lcnr``` cc ```@matthewjasper```
2022-09-22 18:25:53 +05:30
Dylan DPC
b36a10af7e
Rollup merge of #101598 - chriswailes:sanitizers, r=nagisa,eholk
Update rustc's information on Android's sanitizers

This patch updates sanitizer support definitions for Android inside the compiler.  It also adjusts the logic to make sure no pre-built sanitizer runtime libraries are emitted as these are instead provided dynamically on Android targets.
2022-09-22 18:25:51 +05:30
bors
8ab71ab59f Auto merge of #100980 - compiler-errors:normalize-opaque-w-bound-vars, r=lcnr
Normalize opaques w/ bound vars

First, we reenable normalization of opaque types with escaping late bound regions to fix rust-lang/miri#2433. This essentially reverts #89285.

Second, we mitigate the perf regression found in #88862 by simplifying the way that we relate (sub and eq) GeneratorWitness types.

This relies on the fact that we construct these GeneratorWitness types somewhat particularly (with all free regions found in the witness types replaced with late bound regions) -- but those bound regions really should be treated as existential regions, not universal ones. Those two facts leads me to believe that we do not need to use the full `higher_ranked_sub` machinery to relate two generator witnesses. I'm pretty confident that this is correct, but I'm glad to discuss this further.
2022-09-22 12:47:31 +00:00
b-naber
a9e657dbfc don't convert valtree to constvalue during normalization 2022-09-22 14:46:14 +02:00
b-naber
e8594257f6 use valtrees for comparison 2022-09-22 13:10:53 +02:00
b-naber
efb908991b address review 2022-09-22 12:35:29 +02:00
b-naber
9f3784df89 introduce mir::Unevaluated 2022-09-22 12:35:28 +02:00
Oli Scherer
13438ee29c Const unification is already infallible, remove the error handling logic 2022-09-22 08:20:13 +00:00
Takayuki Maeda
2d7f987715 use appropriate variable names 2022-09-22 16:11:51 +09:00
bors
3e50038a2d Auto merge of #101999 - the8472:source-lines-partition-point, r=davidtwco
use partition_point instead of binary_search when looking up source lines

In local benchmarks this results in 0.4% fewer cycles in a critical sequential section when compiling libcore.
2022-09-22 07:03:42 +00:00
bors
7a8636c843 Auto merge of #100982 - fee1-dead-contrib:const-impl-requires-const-trait, r=oli-obk
Require `#[const_trait]` on `Trait` for `impl const Trait`

r? `@oli-obk`
2022-09-22 04:22:24 +00:00
Dan Johnson
d0a07495be Split out async_fn_in_trait into a separate feature
PR #101224 added support for async fn in trait desuraging behind the
return_position_impl_trait_in_trait feature.

Split this out so that it's behind its own feature gate, since async fn
in trait doesn't need to follow the same stabilization schedule.
2022-09-21 19:26:23 -07:00
Michael Goulet
3fc328dfd3 Normalize generator interior type before erasing 2022-09-22 02:17:39 +00:00
Michael Goulet
02ad984d74 Comment, and bail early if bound vars list differs 2022-09-22 02:17:39 +00:00
Michael Goulet
d018144761 Optimize subtyping and equation of GeneratorWitness 2022-09-22 02:17:39 +00:00
Michael Goulet
43119d6438 Normalize opaques with escaping bound vars 2022-09-22 02:17:39 +00:00
Frank Steffahn
696472a586 Fix a typo in error message 2022-09-22 01:28:45 +02:00
Ralf Jung
0f4d7b6de8 OpTy: fix a method taking self rather than &self 2022-09-21 22:20:40 +02:00
bors
9062b780b3 Auto merge of #101558 - JhonnyBillM:session-diagnostic-to-diagnostic-handler-refactor, r=davidtwco
Move and rename `SessionDiagnostic` & `SessionSubdiagnostic` traits and macros

After PR #101434, we want to:
- [x] Move `SessionDiagnostic` to `rustc_errors`.
- [x] Add `emit_` methods that accept `impl SessionDiagnostic` to `Handler`.
- [x] _(optional)_ Rename trait `SessionDiagnostic` to `DiagnosticHandler`.
- [x] _(optional)_ Rename macro `SessionDiagnostic` to `DiagnosticHandler`.
- [x] Update Rustc Dev Guide and Docs to reflect these changes. https://github.com/rust-lang/rustc-dev-guide/pull/1460

Now I am having build issues getting the compiler to build when trying to rename the macro.

<details>
  <summary>See diagnostics errors and context when building.</summary>

```
error: diagnostics should only be created in `SessionDiagnostic`/`AddSubdiagnostic` impls
  --> compiler/rustc_attr/src/session_diagnostics.rs:13:10
   |
13 |   #[derive(DiagnosticHandler)]
   |            ^^^^^^^^^^^^^^^^^ in this derive macro expansion
   |
  ::: /Users/jhonny/.cargo/registry/src/github.com-1ecc6299db9ec823/synstructure-0.12.6/src/macros.rs:94:9
   |
94 | /         pub fn $derives(
95 | |             i: $crate::macros::TokenStream
96 | |         ) -> $crate::macros::TokenStream {
   | |________________________________________- in this expansion of `#[derive(DiagnosticHandler)]`
   |
note: the lint level is defined here
  --> compiler/rustc_attr/src/lib.rs:10:9
   |
10 | #![deny(rustc::diagnostic_outside_of_impl)]
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

```

And also this one:

```
error: diagnostics should only be created in `SessionDiagnostic`/`AddSubdiagnostic` impls
   --> compiler/rustc_attr/src/session_diagnostics.rs:213:32
    |
213 |         let mut diag = handler.struct_span_err_with_code(
    |                                ^^^^^^^^^^^^^^^^^^^^^^^^^
```

> **Note**
> Can't find where this message is coming from, because you can see in [this experimental branch](https://github.com/JhonnyBillM/rust/tree/experimental/trying-to-rename-session-diagnostic-macro)  that I updated all errors and diags to say:
> error: diagnostics should only be created in **`DiagnosticHandler`**/`AddSubdiagnostic` impls
> and not:
> error: diagnostics should only be created in **`SessionDiagnostic`**/`AddSubdiagnostic` impls

</details>

I tried building the compiler in different ways (playing with the stages etc), but nothing worked.

## Question

**Do we need to build or do something different when renaming a macro and identifiers?**

For context, see experimental commit f2193a98b4 where the macro and symbols are renamed, but it doesn't compile.
2022-09-21 19:58:39 +00:00