Commit Graph

17698 Commits

Author SHA1 Message Date
fee1-dead
b7d9de72ac
Rollup merge of #102194 - fee1-dead-contrib:improve-const-drop, r=oli-obk
Note the type when unable to drop values in compile time
2022-09-25 22:06:39 +08:00
fee1-dead
07467c5308
Rollup merge of #101997 - cuviper:drop-legacy-pm, r=nikic
Remove support for legacy PM

This removes support for optimizing with LLVM's legacy pass manager, as well as the unstable `-Znew-llvm-pass-manager` option. We have been defaulting to the new PM since LLVM 13 (except for s390x that waited for 14), and LLVM 15 removed support altogether. The only place we still use the legacy PM is for writing the output file, just like `llc` does.

cc #74705
r? ``@nikic``
2022-09-25 22:06:38 +08:00
fee1-dead
084029f39d
Rollup merge of #101431 - compiler-errors:move-place-ty-for-move-place-sugg, r=cjgillot
Look at move place's type when suggesting mutable reborrow

Not sure why we are looking at the use site's ty instead of the move site's ty in order to suggest reborrowing the move site, but it was suppressing a perfectly valid reborrow suggestion.

r? `@estebank` who i think touched this last in 520461f1fb, though that was quite a while ago so feel free to reassign.
2022-09-25 22:06:37 +08:00
bors
4652f5eb25 Auto merge of #100865 - compiler-errors:parent-substs-still, r=cjgillot
Don't drop parent substs when we have no generic parameters in `create_substs_for_ast_path`

This bug is being shadowed by an explicit check for `generics.params.is_empty()` in the only parent caller that could trigger it (`create_substs_for_associated_item`). I triggered it on another branch where I'm messing around with astconv stuff.

Also, the second commit simplifies `create_substs_for_associated_item`. Removing that explicit check I mentioned above^ and also the special case call to `Astconv::prohibit_generics` causes the UI test `src/test/ui/structs/struct-path-associated-type.stderr` to change, but I think that it's clearer now. The suggestion to remove the generics is actually useful.
2022-09-25 12:00:37 +00:00
Camille GILLOT
73c52bc4dc Fix scoping for let-else. 2022-09-25 11:30:49 +02:00
Matthias Krüger
11b4510202
Rollup merge of #102161 - compiler-errors:issue-102138, r=tmandry
Resolve async fn signature even without body (e.g., in trait)

Fixes #102138

This "bail if no body" behavior was introduced in #69539 to fix #69401, but that ICE does not reproduce any more. The error message changes a bit, but that's all, and I don't think it's a particularly diagnostic bad regression.
2022-09-25 09:32:08 +02:00
Matthias Krüger
16de1fddee
Rollup merge of #102016 - lcnr:given-OutlivesEnvironment, r=jackh726
implied_bounds: deal with inference vars

fixes #101951

while computing implied bounds for `<<T as ConstructionFirm>::Builder as BuilderFn<'_>>::Output` normalization replaces a projection with an inference var (adding a `Projection` obligation). Until we prove that obligation, this inference var remains unknown, which caused us to miss an implied bound necessary to prove that the unnormalized projection from the trait method signature is wf.

r? types
2022-09-25 09:32:07 +02:00
bors
d0ece44cfa Auto merge of #102040 - TaKO8Ki:separate-definitions-and-hir-owners, r=cjgillot
Separate definitions and HIR owners in the type system

Fixes #83158

r? `@cjgillot`
2022-09-24 22:42:07 +00:00
Ellis Hoag
d7bee58105 remove comment 2022-09-24 15:03:14 -07:00
Deadbeef
2ce1cd511f Note the type when unable to drop values in compile time 2022-09-24 20:32:51 +00:00
Michael Goulet
3d7e9a7b27 Only record extra lifetime params for async trait fn with no body 2022-09-24 19:26:54 +00:00
Michael Goulet
59c4a92baf Resolve async fn signature even without body (in trait) 2022-09-24 19:26:54 +00:00
Ellis Hoag
ac97487645 fix lifetime error 2022-09-24 11:36:16 -07:00
Ellis Hoag
5c7e629b63 rebase and update trait names 2022-09-24 11:06:05 -07:00
Ellis Hoag
6e22c0a8e1 impl SessionDiagnostic for LayoutError and Spanned<T> 2022-09-24 10:25:19 -07:00
Ellis Hoag
249e46bfba Add monomorphization errors 2022-09-24 10:24:48 -07:00
Ellis Hoag
6fdfcb3547 lint type 2022-09-24 10:24:48 -07:00
Ellis Hoag
e906ea80fe Add wrapper type for ExitCode for use in RanlibFailure 2022-09-24 10:24:48 -07:00
Ellis Hoag
fb488ad366 remove IntoDiagnosticArg impl for Option 2022-09-24 10:24:48 -07:00
Ellis Hoag
1ce482adda Lint against untranslatable diagnostics in rustc_codegen_gcc 2022-09-24 10:24:48 -07:00
Ellis Hoag
5e0c53a679 Add LayoutSizeOverflow 2022-09-24 10:24:48 -07:00
Ellis Hoag
d0b7e71918 Add LTONotSupported 2022-09-24 10:24:48 -07:00
Ellis Hoag
d9aa635969 Add UnwindingInlineAsm 2022-09-24 10:24:48 -07:00
Ellis Hoag
7e00a48305 Add LinkageConstOrMutType 2022-09-24 10:24:48 -07:00
Ellis Hoag
9363f0fda5 Add RanlibFailure 2022-09-24 10:24:48 -07:00
Takayuki Maeda
8fe936099a separate definitions and HIR owners
fix a ui test

use `into`

fix clippy ui test

fix a run-make-fulldeps test

implement `IntoQueryParam<DefId>` for `OwnerId`

use `OwnerId` for more queries

change the type of `ParentOwnerIterator::Item` to `(OwnerId, OwnerNode)`
2022-09-24 23:21:19 +09:00
Matthias Krüger
81eb35f18a
Rollup merge of #102210 - notriddle:notriddle/did-you-mean, r=cjgillot
diagnostics: avoid syntactically invalid suggestion in if conditionals

Fixes #101065
2022-09-24 14:29:56 +02:00
Matthias Krüger
5fb41a6031
Rollup merge of #102204 - fee1-dead-contrib:manually-drop-trivially-drop, r=oli-obk
Make `ManuallyDrop` satisfy `~const Destruct`
2022-09-24 14:29:55 +02:00
Matthias Krüger
eb628e8670
Rollup merge of #102109 - petrochenkov:addids, r=oli-obk
resolve: Set effective visibilities for imports more precisely

Instead of setting them for all primary and additional IDs of the import, only set them for the binding's true ID.
2022-09-24 14:29:53 +02:00
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
Deadbeef
a480ab6839 Allow specializing on const trait bounds 2022-09-24 06:22:59 +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
Michael Howell
ac06d9cca3 diagnostics: avoid syntactically invalid suggestion in if conditionals
Fixes #101065
2022-09-23 14:27:44 -07:00
León Orell Valerian Liehr
28e0c5aec8
Allow more !Copy impls 2022-09-23 21:51:40 +02:00
Nilstrieb
aa35ab81ea Stabilize const BTree{Map,Set}::new
Since `len` and `is_empty` are not const stable yet, this also
creates a new feature for them since they previously used the same
`const_btree_new` feature.
2022-09-23 20:55:37 +02:00
Deadbeef
a74eba4ad5 Make ManuallyDrop satisfy ~const Destruct 2022-09-23 18:07:36 +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
Oli Scherer
59e285ff34 Report diagnostics at the actually actionable site 2022-09-23 08:00:02 +00:00
Oli Scherer
e237aaef25 Some test cleanups 2022-09-23 07:18:33 +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
Michael Goulet
2fa31d3e78 Serialize RPITIT values in libs 2022-09-23 00:56:55 +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
Rageking8
a1062b9bdc
recover from struct nested in struct 2022-09-22 23:41:38 +08:00
Xiretza
336a72a8da Unify subdiagnostic attribute parsing 2022-09-22 17:25:50 +02:00
Xiretza
ae56d2a118 Add missing code="" attributes to suggestion subdiagnostics 2022-09-22 17:25:50 +02:00
Xiretza
57679fb1c5 Better error recovery in Subdiagnostic derive 2022-09-22 17:25:50 +02:00
Xiretza
e7251cc441 Extract subdiagnostic attribute parsing 2022-09-22 17:25:50 +02:00
Xiretza
d4a1a6f698 Make SetOnce nicer to use 2022-09-22 17:25:50 +02:00
Xiretza
efb20bc855 Point to previous applicability when declared multiple times 2022-09-22 17:25:50 +02:00
Xiretza
ec85a1b263 Ensure #[suggestion] is only applied to correct tuple types 2022-09-22 17:25:50 +02:00
Xiretza
2e72387fd0 Ensure code= in #[suggestion(...)] is only set once 2022-09-22 17:25:50 +02:00
Xiretza
adcc55d622 Cleanups in SessionDiagnostic derive 2022-09-22 17:25:50 +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
Vadim Petrochenkov
4ddff03917 resolve: Set effective visibilities for imports more precisely
Instead of setting them for all primary and additional IDs of the import, only set them for the binding's true ID.
2022-09-22 15:00:24 +03: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
Josh Stone
5d8083360a 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-21 11:53:50 -07:00
bors
db4b4d3bec Auto merge of #102097 - Dylan-DPC:rollup-gc75oh4, r=Dylan-DPC
Rollup of 7 pull requests

Successful merges:

 - #89891 (`alloc`: add unstable cfg features `no_rc` and `no_sync`)
 - #101995 (Add another example for `uN::carrying_mul`)
 - #102031 (Adding ignore fuchsia tests for Backtrace, ErrorKind cases)
 - #102041 (Improve `-Zmeta-stats` some more)
 - #102045 (fix ConstProp handling of written_only_inside_own_block_locals)
 - #102058 (Clarify Path::extension() semantics in docs abstract)
 - #102059 (Use rebind instead of dummy binder in `SameTypeModuloInfer` relation)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-09-21 17:17:25 +00:00
Jhonny Bill Mena
e52e2344dc FIX - adopt new Diagnostic naming in newly migrated modules
FIX - ambiguous Diagnostic link in docs

UPDATE - rename diagnostic_items to IntoDiagnostic and AddToDiagnostic

[Gardening] FIX - formatting via `x fmt`

FIX - rebase conflicts. NOTE: Confirm wheather or not we want to handle TargetDataLayoutErrorsWrapper this way

DELETE - unneeded allow attributes in Handler method

FIX - broken test

FIX - Rebase conflict

UPDATE - rename residual _SessionDiagnostic and fix LintDiag link
2022-09-21 11:43:22 -04:00
Jhonny Bill Mena
5f91719f75 UPDATE - rename SessionSubdiagnostic macro to Subdiagnostic
Also renames:
- sym::AddSubdiagnostic to sym:: Subdiagnostic
- rustc_diagnostic_item = "AddSubdiagnostic" to rustc_diagnostic_item = "Subdiagnostic"
2022-09-21 11:39:53 -04:00
Jhonny Bill Mena
a3396b2070 UPDATE - rename DiagnosticHandler macro to Diagnostic 2022-09-21 11:39:53 -04:00
Jhonny Bill Mena
191fac6826 UPDATE - rename AddSubdiagnostic trait to AddToDiagnostic 2022-09-21 11:39:53 -04:00
Jhonny Bill Mena
19b348fed4 UPDATE - rename DiagnosticHandler trait to IntoDiagnostic 2022-09-21 11:39:52 -04:00
Jhonny Bill Mena
5b8152807c UPDATE - move SessionDiagnostic from rustc_session to rustc_errors 2022-09-21 11:39:52 -04:00
yukang
7adfb44b95 add trivial comments 2022-09-21 23:21:41 +08:00
Deadbeef
898c76cd82 Make error messages great again (and fix clippy and add test) 2022-09-21 15:02:15 +00:00
Dylan DPC
39bb2a7988
Rollup merge of #102059 - compiler-errors:issue-101984, r=jackh726
Use rebind instead of dummy binder in `SameTypeModuloInfer` relation

Lazy binder usage (sorry, my fault) + assertion in `Binder::dummy`

Fixes #101984
2022-09-21 19:01:09 +05:30
Dylan DPC
7d7f55599a
Rollup merge of #102045 - RalfJung:const-prop-regression-fix, r=oli-obk
fix ConstProp handling of written_only_inside_own_block_locals

Fixes a regression introduced by https://github.com/rust-lang/rust/pull/100239, which adds an early return and thus skips some code in `visit_terminator` that must be run for soundness.

Fixes https://github.com/rust-lang/rust/issues/101973
2022-09-21 19:01:08 +05:30
Dylan DPC
4b7c596b3a
Rollup merge of #102041 - nnethercote:improve-meta-stats, r=bjorn3
Improve `-Zmeta-stats` some more

A follow-up to #97384.

r? ```@bjorn3```
2022-09-21 19:01:08 +05:30
Oli Scherer
86f1ca812b Improve diagnostic for adding more bounds to opaque types 2022-09-21 13:15:24 +00:00
Oli Scherer
36cb01deb3 Try out a perf optimization 2022-09-21 13:15:24 +00:00
Oli Scherer
20d962cfa5 Simplify insert_outlives_predicate opaque type logic 2022-09-21 13:15:24 +00:00
Oli Scherer
615c9e8647 Inline substitution logic into declared_region_bounds 2022-09-21 13:11:54 +00:00
Oli Scherer
90b6744af7 Also collect bounds from the ParamEnv for opaque types 2022-09-21 13:11:54 +00:00
Oli Scherer
37928f5986 Neither require nor imply lifetime bounds on opaque type for well formedness 2022-09-21 13:11:54 +00:00
Oli Scherer
c8ecf09a25 Generalize projection_must_outlive 2022-09-21 12:51:33 +00:00
Oli Scherer
4d4cc4fe53 Generalize a helper to be useful for types other than projections 2022-09-21 12:51:33 +00:00
Oli Scherer
96b819a456 Inline a trivial function 2022-09-21 12:51:33 +00:00
bors
b79b7d8b4e Auto merge of #101846 - chenyukang:fix-101793, r=davidtwco
Fix the wording of help msg for bitwise not

Fixes #101793
2022-09-21 12:32:54 +00:00
Oli Scherer
e0a2e2d892 Deduplicate two functions that would soon have been three 2022-09-21 12:31:48 +00:00
Oli Scherer
759c04a00b Some tracing instrumentation cleanups 2022-09-21 11:31:55 +00:00
Oli Scherer
3d69d23a25 Split match out into a helper function 2022-09-21 11:31:55 +00:00
bors
cba4a389b3 Auto merge of #101329 - QuinnPainter:armv5te-targets, r=nagisa
Add armv5te-none-eabi and thumbv5te-none-eabi targets

Creates two new Tier 3 targets, `armv5te-none-eabi` and `thumbv5te-none-eabi`. They are for the same target architecture (armv5te), but one defaults to the A32 instruction set and the other defaults to T32. Based on the existing `armv4t-none-eabi` and `thumbv4t-none-eabi` targets.

My particular use case for these targets is Nintendo DS homebrew, but they should be usable for any armv5te system.

Going through the Tier 3 target policy:

> A tier 3 target must have a designated developer or developers (the "target maintainers") on record to be CCed when issues arise regarding the target. (The mechanism to track and CC such developers may evolve over time.)

That will be me.

> Targets must use naming consistent with any existing targets.

Naming is consistent with previous targets.

>> Target names should not introduce undue confusion or ambiguity unless absolutely necessary to maintain ecosystem compatibility.

No ambiguity here.

> Tier 3 targets may have unusual requirements to build or use, but must not create legal issues or impose onerous legal terms for the Rust project or for Rust developers or users.

Doesn't create any legal issues.

>> The target must not introduce license incompatibilities.

This doesn't introduce any new licenses.

>> Anything added to the Rust repository must be under the standard Rust license (MIT OR Apache-2.0).

Yep.

>> The target must not cause the Rust tools or libraries built for any other host (even when supporting cross-compilation to the target) to depend on any new dependency less permissive than the Rust licensing policy. This applies whether the dependency is a Rust crate that would require adding new license exceptions (as specified by the tidy tool in the rust-lang/rust repository), or whether the dependency is a native library or binary. In other words, the introduction of the target must not cause a user installing or running a version of Rust or the Rust tools to be subject to any new license requirements.

No new license requirements.

>> Compiling, linking, and emitting functional binaries, libraries, or other code for the target (whether hosted on the target itself or cross-compiling from another target) must not depend on proprietary (non-FOSS) libraries.

Everything this uses is FOSS, no proprietary required.

> Neither this policy nor any decisions made regarding targets shall create any binding agreement or estoppel by any party. If any member of an approving Rust team serves as one of the maintainers of a target, or has any legal or employment requirement (explicit or implicit) that might affect their decisions regarding a target, they must recuse themselves from any approval decisions regarding the target's tier status, though they may otherwise participate in discussions.

OK.

>> This requirement does not prevent part or all of this policy from being cited in an explicit contract or work agreement (e.g. to implement or maintain support for a target). This requirement exists to ensure that a developer or team responsible for reviewing and approving a target does not face any legal threats or obligations that would prevent them from freely exercising their judgment in such approval, even if such judgment involves subjective matters or goes beyond the letter of these requirements.

OK.

> Tier 3 targets should attempt to implement as much of the standard libraries as possible and appropriate (core for most targets, alloc for targets that can support dynamic memory allocation, std for targets with an operating system or equivalent layer of system-provided functionality), but may leave some code unimplemented (either unavailable or stubbed out as appropriate), whether because the target makes it impossible to implement or challenging to implement. The authors of pull requests are not obligated to avoid calling any portions of the standard library on the basis of a tier 3 target not implementing those portions.

This is a bare-metal target with only support for `core` (and `alloc`, if the user provides an allocator).

> The target must provide documentation for the Rust community explaining how to build for the target, using cross-compilation if possible. If the target supports running binaries, or running tests (even if they do not pass), the documentation must explain how to run such binaries or tests for the target, using emulation if possible or dedicated hardware if necessary.

Documentation has been added.

> Tier 3 targets must not impose burden on the authors of pull requests, or other developers in the community, to maintain the target. In particular, do not post comments (automated or manual) on a PR that derail or suggest a block on the PR based on a tier 3 target. Do not send automated messages or notifications (via any medium, including via `@)` to a PR author or others involved with a PR regarding a tier 3 target, unless they have opted into such messages.

OK.

> Backlinks such as those generated by the issue/PR tracker when linking to an issue or PR are not considered a violation of this policy, within reason. However, such messages (even on a separate repository) must not generate notifications to anyone involved with a PR who has not requested such notifications.

OK.

> Patches adding or updating tier 3 targets must not break any existing tier 2 or tier 1 target, and must not knowingly break another tier 3 target without approval of either the compiler team or the maintainers of the other tier 3 target.

This doesn't break any other targets.

>> In particular, this may come up when working on closely related targets, such as variations of the same architecture with different features. Avoid introducing unconditional uses of features that another variation of the target may not have; use conditional compilation or runtime detection, as appropriate, to let each target run code supported by that target.

No unnecessary unconditional features here.
2022-09-21 09:36:21 +00:00
Oli Scherer
3e6c9e5a19 Fix wrongly refactored Lift impl 2022-09-21 08:29:19 +00:00
bors
1de00d1ac5 Auto merge of #100096 - compiler-errors:fn-return-must-be-sized, r=jackh726
a fn pointer doesn't implement `Fn`/`FnMut`/`FnOnce` if its return type isn't sized

I stumbled upon #83915 which hasn't received much attention recently, and I wanted to revive it since this is one existing soundness hole that seems pretty easy to fix.

I'm not actually sure that the [alternative approach described here](https://github.com/rust-lang/rust/pull/83915#issuecomment-823643322) is sufficient, given the `src/test/ui/function-pointer/unsized-ret.rs` example I provided below. Rebasing the branch mentioned in that comment and testing that UI test, it seems that we actually end up only observing that `str: !Sized` during monomorphization, whereupon we ICE. Even if we were to fix that ICE, ideally we'd be raising an error that a fn pointer is being used badly during _typecheck_ instead of monomorphization, hence adapting the original approach in #83915.

I am happy to close this if people would prefer we rebase the original PR and land that -- I am partly opening to be annoying and get people thinking about this unsoundness again ❤️ 😸

cc: `@estebank` and `@nikomatsakis`
r? types

Here's a link to the thread: https://rust-lang.zulipchat.com/#narrow/stream/144729-t-types/topic/PR.20.2383915/near/235421351 for more context.
2022-09-21 04:35:20 +00:00
yukang
f9ef7e2835 code refactoring smart_resolve_report_errors 2022-09-21 12:17:59 +08:00
Nicholas Nethercote
a7b35b5618 Overhaul -Zmeta-stats output.
It's now much more like the `-Zhir-stats` output.
- Each line is preceded with `meta-stats`, which makes the provenance
  clearer and allows filtering of the output.
- Sections are now sorted in reverse order of size.
- Column headings avoid the need to repeat the word "bytes" on every line.
- Long numbers now have `_` separators for easier reading.
- Consistent use of '-' within section labels, rather than a mix of '-',
  '_', and ' '.

The code itself is shorter and easier to read thanks to:
- the `stat` macro, which encapsulates each section's encoding, avoids
  some boilerplate, and removes the need for some low-value comments;
- the `stats` vector, which replaces dozens of local variables.
2022-09-21 11:22:31 +10:00
Nicholas Nethercote
b7dc9341b5 Wrap some long comment lines. 2022-09-21 08:06:06 +10:00
Chris Wailes
3d5a41724b Update rustc's information on Android's sanitizers
This patch updates sanitizier 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-20 14:16:57 -07:00
Michael Goulet
5b96e5e71a Skip Equate relation in handle_opaque_type 2022-09-20 20:57:02 +00:00
Josh Stone
a72666ed56 rustc_transmute: fix big-endian discriminants 2022-09-20 13:03:43 -07:00
bors
432abd86f2 Auto merge of #102061 - notriddle:rollup-kwu9vp8, r=notriddle
Rollup of 12 pull requests

Successful merges:

 - #100250 (Manually cleanup token stream when macro expansion aborts.)
 - #101014 (Fix -Zmeta-stats ICE by giving `FileEncoder` file read permissions)
 - #101958 (Improve error for when query is unsupported by crate)
 - #101976 (MirPhase: clarify that linting is not a semantic change)
 - #102001 (Use LLVM C-API to build atomic cmpxchg and fence)
 - #102008 (Add GUI test for notable traits element position)
 - #102013 (Simplify rpitit handling on lower_fn_decl)
 - #102021 (some post-valtree cleanup)
 - #102027 (rustdoc: remove `docblock` class from `item-decl`)
 - #102034 (rustdoc: remove no-op CSS `h1-6 { border-bottom-color }`)
 - #102038 (Make the `normalize-overflow` rustdoc test actually do something)
 - #102053 (⬆️ rust-analyzer)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-09-20 19:10:11 +00:00
Michael Howell
b149c48186
Rollup merge of #102021 - lcnr:tyConst-fun, r=b-naber,BoxyUwU
some post-valtree cleanup

r? project-const-generics cc ```@b-naber```
2022-09-20 10:13:01 -07:00
Michael Howell
08b369a501
Rollup merge of #102013 - spastorino:rpitit-lower-fn-decl, r=compiler-errors
Simplify rpitit handling on lower_fn_decl

r? `````@compiler-errors`````
2022-09-20 10:13:00 -07:00
Michael Howell
2c57a5b166
Rollup merge of #102001 - cuviper:build-atomic-capi, r=nikic
Use LLVM C-API to build atomic cmpxchg and fence

We don't need C++ wrappers because the LLVM C API can build these.
2022-09-20 10:12:59 -07:00
Michael Howell
0d2e57cb04
Rollup merge of #101976 - RalfJung:mir-semantic-phases, r=oli-obk
MirPhase: clarify that linting is not a semantic change

r? ```@JakobDegen```
2022-09-20 10:12:58 -07:00
Michael Howell
2c893737a6
Rollup merge of #101958 - hanar3:101666/enhance-error-message, r=oli-obk
Improve error for when query is unsupported by crate

This is an improvement to the error message mentioned on #101666.  It seems like a good idea to also add [this link to the rustc-dev-guide](https://rustc-dev-guide.rust-lang.org/query.html), if explaining the query system in detail is a concern here, but I'm unsure if there is any restrictions on adding links to error messages.
2022-09-20 10:12:58 -07:00
Michael Howell
3f377d3f96
Rollup merge of #101014 - isikkema:fix-zmeta-stats-file-encoder-no-read-perms, r=isikkema
Fix -Zmeta-stats ICE by giving `FileEncoder` file read permissions

Fixes #101001

As far as I can tell, #101001 is caused because the file is being created with write-only permissions here: https://github.com/rust-lang/rust/blob/master/compiler/rustc_serialize/src/opaque.rs#L196

but it is trying to be read here: https://github.com/rust-lang/rust/blob/master/compiler/rustc_metadata/src/rmeta/encoder.rs#L780

This PR attempts to fix this by creating/opening the file with the same permissions as `File::create()` with the addition of read.
2022-09-20 10:12:57 -07:00
Michael Howell
14b27cfd11
Rollup merge of #100250 - cjgillot:recover-token-stream, r=Aaron1011
Manually cleanup token stream when macro expansion aborts.

In case of syntax error in macro expansion, the expansion code can decide to stop processing anything. In that case, the token stream is malformed. This makes downstream users, like derive macros, ICE.

In this case, this PR manually cleans up the token stream by closing all currently open delimiters.

Fixes https://github.com/rust-lang/rust/issues/96818.
Fixes https://github.com/rust-lang/rust/issues/80447.
Fixes https://github.com/rust-lang/rust/issues/81920.
Fixes https://github.com/rust-lang/rust/issues/91023.
2022-09-20 10:12:56 -07:00
Michael Goulet
83e6128b57 Better binder treatment 2022-09-20 16:39:39 +00:00
bors
cd8cc91045 Auto merge of #101989 - fee1-dead-contrib:const_trait_impl-assoc-caller-bounds, r=oli-obk
make projection bounds with const bounds satisfy const

Fixes #101982.
2022-09-20 16:24:36 +00:00
Sikkema, Isaac
a2cb8a4949 add comment explaining read permissions 2022-09-20 10:06:50 -04:00
bors
4136b59b7d Auto merge of #99806 - oli-obk:unconstrained_opaque_type, r=estebank
Allow patterns to constrain the hidden type of opaque types

fixes #96572

reverts a revert as original PR was a perf regression that was fixed by reverting it: https://github.com/rust-lang/rust/pull/99368#issuecomment-1186587864)

TODO:

* check if https://github.com/rust-lang/rust/issues/99685 is avoided
2022-09-20 12:09:52 +00:00
Ralf Jung
7373788c37 fix ConstProp handling of written_only_inside_own_block_locals 2022-09-20 12:49:32 +02:00
Oli Scherer
f841f1b443 Retry with inlining attributes 2022-09-20 09:30:07 +00:00
bors
8fd6d03e22 Auto merge of #101806 - BelovDV:issue-fix-fn-find_library, r=petrochenkov
fix verbatim with upstream dependencies

https://github.com/rust-lang/rust/issues/99425#issuecomment-1207224161

r? `@petrochenkov`
2022-09-20 07:10:18 +00:00
bors
a38a082afb fix verbatim with upstream dependencies
https://github.com/rust-lang/rust/issues/99425#issuecomment-1207224161

r? `@petrochenkov`
2022-09-20 07:10:17 +00:00
Joshua Nelson
1512ce5925 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:

> 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.
2022-09-19 22:14:40 -05:00
Joshua Nelson
749dec6451 Make OUT an associated type instead of a generic parameter
This avoids toil when changing other functions in `ObligationForest` to take an `OUT` parameter.
2022-09-19 22:14:39 -05:00
Joshua Nelson
5922d6cf60 slightly cleanup building SelectionContext 2022-09-19 22:14:39 -05:00
bors
acb8934fd5 Auto merge of #102022 - matthiaskrgr:rollup-emwfjd1, r=matthiaskrgr
Rollup of 11 pull requests

Successful merges:

 - #101389 (Tone down explanation on RefCell::get_mut)
 - #101798 (Make `from_waker`, `waker` and `from_raw` unstably `const`)
 - #101881 (Remove an unused struct field `late_bound`)
 - #101904 (Add help for invalid inline argument)
 - #101966 (Add unit test for identifier Unicode emoji diagnostics)
 - #101979 (Update release notes for 1.64)
 - #101985 (interpret: expose generate_stacktrace without full InterpCx)
 - #102004 (Try to clarify what's new in 1.64.0 ffi types)
 - #102005 (rustdoc: remove unused CSS `td.summary-column`)
 - #102017 (Add all submodules to the list of directories tidy skips)
 - #102019 (Remove backed off PRs from relnotes)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-09-20 02:20:15 +00:00
Josh Stone
00bb9fc2be Rename LLVM optimize functions 2022-09-19 11:10:12 -07:00
bors
2019147c56 Auto merge of #101894 - dingxiangfei2009:let-else-avoid-duplicate-storage-live, r=oli-obk
Avoid duplicating StorageLive in let-else

cc `@est31`

Fix #101867
Fix #101932

#101410 introduced directives to activate storages of bindings in let-else earlier. However, since it is using the machinery of `match` and friends for pattern matching and binding, those storages are activated for the second time. This PR adjusts this behavior and avoid the duplicated activation for let-else statements.
2022-09-19 17:27:30 +00:00
Matthias Krüger
8c0f8a285f
Rollup merge of #101985 - RalfJung:generate_stacktrace, r=oli-obk
interpret: expose generate_stacktrace without full InterpCx

In Miri we sometimes want to emit diagnostics without having a full `&InterpCx` available. To avoid duplicating code, this adds a way to get a stacktrace from an arbitrary slice of interpreter frames, that Miri can use with access to just a thread manager.
2022-09-19 17:55:21 +02:00
Matthias Krüger
9f073b0de0
Rollup merge of #101904 - Rageking8:fix-101712, r=oli-obk
Add help for invalid inline argument

Fixes #101712

Removed 1 part of the test as its identical with another one. Do let me know if this is undesirable, so I can revert those changes.
2022-09-19 17:55:20 +02:00
Matthias Krüger
7697a244cc
Rollup merge of #101881 - TaKO8Ki:remove-unused-struct-field, r=sanxiyn
Remove an unused struct field `late_bound`
2022-09-19 17:55:19 +02:00
Oli Scherer
1905f8c441 Document projection condition 2022-09-19 15:33:36 +00:00
mejrs
c65866000e Incorporate feedback 2022-09-19 17:19:45 +02:00
lcnr
c54c5a3c77 DestructuredConst split mir and ty 2022-09-19 17:00:38 +02:00
lcnr
526856768d ctfe, const_to_op only for mir constants 2022-09-19 16:17:33 +02:00
lcnr
638b612154 remove ty::Const::from_inline_const 2022-09-19 16:10:18 +02:00
lcnr
7207b4dc66 remove FnCtxt::to_const 2022-09-19 16:08:40 +02:00
Oli Scherer
18ab705073 Actually visit/fold the types inside CanonicalVarInfos 2022-09-19 14:00:34 +00:00
lcnr
71f8fd5c58 improve infer var handling for implied bounds 2022-09-19 15:13:34 +02:00
Santiago Pastorino
550bd0945f
Simplify rpitit handling on lower_fn_decl 2022-09-19 09:30:39 -03:00
bors
11bb80a92b Auto merge of #101901 - lcnr:early-binder-type-foldable, r=compiler-errors
`EarlyBinder` prevent misuse

folding a type before substituting is pretty much always wrong and could happen by accident, e.g. see https://github.com/rust-lang/rust/pull/99798#discussion_r968666538

this PR removes the `TypeFoldable` and `TypeVisitable` impl from `EarlyBinder`.

r? types cc `@jackh726`
2022-09-19 10:35:09 +00:00
lcnr
0c3e01d8f6 extend polymorphization hack comment. 2022-09-19 11:44:29 +02:00
lcnr
647052fc04 remove the Subst trait, always use EarlyBinder 2022-09-19 11:37:27 +02:00
lcnr
d398b54de6 do not implement type traversal for EarlyBinder 2022-09-19 11:28:32 +02:00
bors
503e19d01e Auto merge of #101629 - compiler-errors:issue-101623, r=sanxiyn
Be careful about `expr_ty_adjusted` when noting block tail type

Fixes #101623
2022-09-19 07:41:54 +00:00
bors
efa717bc2d Auto merge of #101924 - jackh726:revert-static-hrtb-error, r=compiler-errors
Re-add HRTB implied static bug note

r? `@compiler-errors` since you reviewed it previously

I deleted a `normalize` call and forgot about it. Whoops.
2022-09-19 04:56:14 +00:00
Josh Stone
fac12e25dd Use LLVM C-API to build atomic cmpxchg and fence 2022-09-18 16:01:57 -07:00
The 8472
40b37268eb 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-19 00:48:14 +02:00
Josh Stone
04a318e13e Use the helper for internalizing with new PM 2022-09-18 13:26:03 -07:00
Josh Stone
d6318de13a Never use legacy PM for writing bitcode 2022-09-18 13:26:03 -07:00
Josh Stone
38e0e8f7bb Remove -Znew-llvm-pass-manager 2022-09-18 13:26:03 -07:00
Josh Stone
2860f77a0d Remove support for LLVM's legacy pass manager 2022-09-18 13:25:49 -07:00
Ralf Jung
9fa3171015 interpret: expose generate_stacktrace without full InterpCx 2022-09-18 20:51:04 +02:00
Deadbeef
ee96ae0a32 make projection bounds with const bounds satisfy const 2022-09-18 18:05:30 +00:00
Ralf Jung
eed6fdb0eb clarify that linting is not a semantic change 2022-09-18 14:14:42 +02:00
Ding Xiang Fei
48c1c1d190
avoid duplicating StorageLive in let-else 2022-09-18 12:10:53 +08:00
bors
65c16dc3a8 Auto merge of #101960 - matthiaskrgr:rollup-1l5v7ip, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #101151 (Document x86_64-fortanix-unknown-sgx platform)
 - #101912 (Update `unicode-rs` crates to Unicode 15)
 - #101923 (Don't add rustdoc's CSS to other doc pages)
 - #101953 (Fix tooltip display for error codes)
 - #101954 (rustdoc: remove redundant `.location a { font-weight: 500 }`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-09-18 03:40:01 +00:00
mejrs
14e9893023 Print out the proper crate path 2022-09-18 02:59:32 +02:00
Matthias Krüger
46ebe7cf41
Rollup merge of #101912 - crlf0710:compiler_update_unicode_15, r=Manishearth
Update `unicode-rs` crates to Unicode 15

r? `@Manishearth`
2022-09-18 02:55:29 +02:00
bors
bc7b17cfe3 Auto merge of #101862 - cjgillot:lint-regression, r=oli-obk
Do not fetch HIR node when iterating to find lint.

Addresses the regression in https://github.com/rust-lang/rust/pull/101620
2022-09-18 00:46:14 +00:00
mejrs
3699c2497b Address feedback 2022-09-18 02:44:44 +02:00
mejrs
8477b9b707 Note if mismatched types have a similar name 2022-09-18 02:43:42 +02:00
hanar3
0405a5d4e9 improve error message for when a query isn't supported 2022-09-17 20:25:37 -03:00
bors
5253b0a0a1 Auto merge of #101949 - matthiaskrgr:rollup-xu5cqnd, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #101093 (Initial version of 1.64 release notes)
 - #101713 (change AccessLevels representation)
 - #101821 (Bump Unicode to version 15.0.0, regenerate tables)
 - #101826 (Enforce "joined()" and "joined_with_noop()" test)
 - #101835 (Allow using vendoring when running bootstrap from outside the source root)
 - #101942 (Revert "Copy stage0 binaries into stage0-sysroot")
 - #101943 (rustdoc: remove unused CSS `.non-exhaustive { margin-bottom }`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-09-17 22:04:28 +00:00
Matthias Krüger
a6b34cd928
Rollup merge of #101713 - Bryanskiy:AccessLevels, r=petrochenkov
change AccessLevels representation

Part of RFC (https://github.com/rust-lang/rust/issues/48054). This patch implements effective visibility table with basic methods and change AccessLevels table representation according to it.

r? ``@petrochenkov``
2022-09-17 23:30:49 +02:00
Matthias Krüger
4757d2d57e
Rollup merge of #101801 - SparrowLii:query_depth_note, r=estebank
add note for `layout_of` when query depth overflows

Fixes #101747
Added `try_find_layout_root` function to add a note for `layout_of` when query depth overflows. This would make the error in #101747 look like this:
```
error: queries overflow the depth limit!
   |
note: Query depth increased by 66 when computing layout of `core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<alloc::boxed::Box<alloc::string::String>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`!
  --> D:\rust-backup\parallel_rust\query_depth.rs:40:1
   |
40 | fn main() {
   | ^^^^^^^^^

error: aborting due to previous error
```

cc ``@semicoleon``
2022-09-17 19:27:06 +02:00
Jack Huey
e7ca6e1b47 Use Predicate ConstraintCategory when normalizing 2022-09-17 11:46:05 -04:00
Jack Huey
1eb71f0893 Add back in normalize call 2022-09-17 11:46:04 -04:00
bors
48de123d7a Auto merge of #101857 - lcnr:make-dyn-again, r=jackh726
change `FnMutDelegate` to trait objects

cc #100016 as mentioned in the last t-compiler meeting

r? `@jackh726`
2022-09-17 13:37:48 +00:00
Dylan DPC
7c55c992ab
Rollup merge of #101807 - jackh726:no-gat-defaults, r=lcnr
Disallow defaults on type GATs

Fixes #99205
2022-09-17 15:31:08 +05:30
Dylan DPC
4c64c14420
Rollup merge of #101790 - TaKO8Ki:do-not-suggest-placeholder-to-const-and-static-without-type, r=compiler-errors
Do not suggest a placeholder to const and static without a type

Fixes #101755
2022-09-17 15:31:08 +05:30
Dylan DPC
cbd561d41f
Rollup merge of #98441 - calebzulawski:simd_as, r=oli-obk
Implement simd_as for pointers

Expands `simd_as` (and `simd_cast`) to handle pointer-to-pointer, pointer-to-integer, and integer-to-pointer conversions.

cc ``@programmerjake`` ``@thomcc``
2022-09-17 15:31:07 +05:30
Dylan DPC
3ad81e0dd8
Rollup merge of #93628 - est31:stabilize_let_else, r=joshtriplett
Stabilize `let else`

🎉  **Stabilizes the `let else` feature, added by [RFC 3137](https://github.com/rust-lang/rfcs/pull/3137).** 🎉

Reference PR: https://github.com/rust-lang/reference/pull/1156

closes #87335 (`let else` tracking issue)

FCP: https://github.com/rust-lang/rust/pull/93628#issuecomment-1029383585

----------

## Stabilization report

### Summary

The feature allows refutable patterns in `let` statements if the expression is
followed by a diverging `else`:

```Rust
fn get_count_item(s: &str) -> (u64, &str) {
    let mut it = s.split(' ');
    let (Some(count_str), Some(item)) = (it.next(), it.next()) else {
        panic!("Can't segment count item pair: '{s}'");
    };
    let Ok(count) = u64::from_str(count_str) else {
        panic!("Can't parse integer: '{count_str}'");
    };
    (count, item)
}
assert_eq!(get_count_item("3 chairs"), (3, "chairs"));
```

### Differences from the RFC / Desugaring

Outside of desugaring I'm not aware of any differences between the implementation and the RFC. The chosen desugaring has been changed from the RFC's [original](https://rust-lang.github.io/rfcs/3137-let-else.html#reference-level-explanations). You can read a detailed discussion of the implementation history of it in `@cormacrelf` 's [summary](https://github.com/rust-lang/rust/pull/93628#issuecomment-1041143670) in this thread, as well as the [followup](https://github.com/rust-lang/rust/pull/93628#issuecomment-1046598419). Since that followup, further changes have happened to the desugaring, in #98574, #99518, #99954. The later changes were mostly about the drop order: On match, temporaries drop in the same order as they would for a `let` declaration. On mismatch, temporaries drop before the `else` block.

### Test cases

In chronological order as they were merged.

Added by df9a2e0687 (#87688):

* [`ui/pattern/usefulness/top-level-alternation.rs`](https://github.com/rust-lang/rust/blob/1.58.1/src/test/ui/pattern/usefulness/top-level-alternation.rs) to ensure the unreachable pattern lint visits patterns inside `let else`.

Added by 5b95df4bdc (#87688):

* [`ui/let-else/let-else-bool-binop-init.rs`](https://github.com/rust-lang/rust/blob/1.58.1/src/test/ui/let-else/let-else-bool-binop-init.rs) to ensure that no lazy boolean expressions (using `&&` or `||`) are allowed in the expression, as the RFC mandates.
* [`ui/let-else/let-else-brace-before-else.rs`](https://github.com/rust-lang/rust/blob/1.58.1/src/test/ui/let-else/let-else-brace-before-else.rs) to ensure that no `}` directly preceding the `else` is allowed in the expression, as the RFC mandates.
* [`ui/let-else/let-else-check.rs`](https://github.com/rust-lang/rust/blob/1.58.1/src/test/ui/let-else/let-else-check.rs) to ensure that `#[allow(...)]` attributes added to the entire `let` statement apply for the `else` block.
* [`ui/let-else/let-else-irrefutable.rs`](https://github.com/rust-lang/rust/blob/1.58.1/src/test/ui/let-else/let-else-irrefutable.rs) to ensure that the `irrefutable_let_patterns` lint fires.
* [`ui/let-else/let-else-missing-semicolon.rs`](https://github.com/rust-lang/rust/blob/1.58.1/src/test/ui/let-else/let-else-missing-semicolon.rs) to ensure the presence of semicolons at the end of the `let` statement.
* [`ui/let-else/let-else-non-diverging.rs`](https://github.com/rust-lang/rust/blob/1.58.1/src/test/ui/let-else/let-else-non-diverging.rs) to ensure the `else` block diverges.
* [`ui/let-else/let-else-run-pass.rs`](https://github.com/rust-lang/rust/blob/1.58.1/src/test/ui/let-else/let-else-run-pass.rs) to ensure the feature works in some simple test case settings.
* [`ui/let-else/let-else-scope.rs`](https://github.com/rust-lang/rust/blob/1.58.1/src/test/ui/let-else/let-else-scope.rs) to ensure the bindings created by the outer `let` expression are not available in the `else` block of it.

Added by bf7c32a447 (#89965):

* [`ui/let-else/issue-89960.rs`](https://github.com/rust-lang/rust/blob/1.58.1/src/test/ui/let-else/issue-89960.rs) as a regression test for the ICE-on-error bug #89960 . Later in 102b9125e1 this got removed in favour of more comprehensive tests.

Added by 856541963c (#89974):

* [`ui/let-else/let-else-if.rs`](https://github.com/rust-lang/rust/blob/1.58.1/src/test/ui/let-else/let-else-if.rs) to test for the improved error message that points out that `let else if` is not possible.

Added by 9b45713b6c:

* [`ui/let-else/let-else-allow-unused.rs`](https://github.com/rust-lang/rust/blob/1.61.0/src/test/ui/let-else/let-else-allow-unused.rs) as a regression test for #89807, to ensure that `#[allow(...)]` attributes added to the entire `let` statement apply for bindings created by the `let else` pattern.

Added by 61bcd8d307 (#89841):

* [`ui/let-else/let-else-non-copy.rs`](https://github.com/rust-lang/rust/blob/1.61.0/src/test/ui/let-else/let-else-non-copy.rs) to ensure that a copy is performed out of non-copy wrapper types. This mirrors `if let` behaviour. The test case bases on rustc internal changes originally meant for #89933 but then removed from the PR due to the error prior to the improvements of #89841.
* [`ui/let-else/let-else-source-expr-nomove-pass.rs `](https://github.com/rust-lang/rust/blob/1.61.0/src/test/ui/let-else/let-else-source-expr-nomove-pass.rs) to ensure that while there is a move of the binding in the successful case, the `else` case can still access the non-matching value. This mirrors `if let` behaviour.

Added by 102b9125e1 (#89841):

* [`ui/let-else/let-else-ref-bindings.rs`](https://github.com/rust-lang/rust/blob/1.61.0/src/test/ui/let-else/let-else-ref-bindings.rs) and [`ui/let-else/let-else-ref-bindings-pass.rs `](https://github.com/rust-lang/rust/blob/1.61.0/src/test/ui/let-else/let-else-ref-bindings-pass.rs) to check `ref` and `ref mut` keywords in the pattern work correctly and error when needed.

Added by 2715c5f984 (#89841):

* Match ergonomic tests adapted from the `rfc2005` test suite.

Added by fec8a507a2 (#89841):

* [`ui/let-else/let-else-deref-coercion-annotated.rs`](https://github.com/rust-lang/rust/blob/1.61.0/src/test/ui/let-else/let-else-deref-coercion-annotated.rs) and [`ui/let-else/let-else-deref-coercion.rs`](https://github.com/rust-lang/rust/blob/1.61.0/src/test/ui/let-else/let-else-deref-coercion.rs) to check deref coercions.

#### Added since this stabilization report was originally written (2022-02-09)

Added by 76ea566677 (#94211):

* [`ui/let-else/let-else-destructuring.rs`](https://github.com/rust-lang/rust/blob/1.63.0/src/test/ui/let-else/let-else-destructuring.rs) to give a nice error message if an user tries to do an assignment with a (possibly refutable) pattern and an `else` block, like asked for in #93995.

Added by e7730dcb7e (#94208):

* [`ui/let-else/let-else-allow-in-expr.rs`](https://github.com/rust-lang/rust/blob/1.61.0/src/test/ui/let-else/let-else-allow-in-expr.rs) to test whether `#[allow(unused_variables)]` works in the expr, as well as its non presence, as well as putting it on the entire `let else` *affects* the expr, too. This was adding a missing test as pointed out by the stabilization report.
* Expansion of `ui/let-else/let-else-allow-unused.rs` and `ui/let-else/let-else-check.rs` to ensure that non-presence of `#[allow(unused)]` does issue the unused lint. This was adding a missing test case as pointed out by the stabilization report.

Added by 5bd71063b3 (#94208):

* [`ui/let-else/let-else-slicing-error.rs`](https://github.com/rust-lang/rust/blob/1.61.0/src/test/ui/let-else/let-else-slicing-error.rs), a regression test for #92069, which got fixed without addition of a regression test. This resolves a missing test as pointed out by the stabilization report.

Added by 5374688e1d (#98574):

* [`src/test/ui/async-await/async-await-let-else.rs`](https://github.com/rust-lang/rust/blob/master/src/test/ui/async-await/async-await-let-else.rs) to test the interaction of async/await with `let else`

Added by 6c529ded86 (#98574):

* [`src/test/ui/let-else/let-else-temporary-lifetime.rs`](https://github.com/rust-lang/rust/blob/master/src/test/ui/let-else/let-else-temporary-lifetime.rs) as a (partial) regression test for #98672

Added by 9b56640106 (#99518):

* [`src/test/ui/let-else/let-else-temp-borrowck.rs`](https://github.com/rust-lang/rust/blob/master/src/test/ui/let-else/let-else-temporary-lifetime.rs) as a regression test for #93951
* Extension of `src/test/ui/let-else/let-else-temporary-lifetime.rs` to include a partial regression test for #98672 (especially regarding `else` drop order)

Added by baf9a7cb57 (#99518):

* Extension of `src/test/ui/let-else/let-else-temporary-lifetime.rs` to include a partial regression test for #93951, similar to `let-else-temp-borrowck.rs`

Added by 60be2de8b7 (#99518):

* Extension of `src/test/ui/let-else/let-else-temporary-lifetime.rs` to include a program that can now be compiled thanks to borrow checker implications of #99518

Added by 47a7a91c96 (#100132):

* [`src/test/ui/let-else/issue-100103.rs`](https://github.com/rust-lang/rust/blob/master/src/test/ui/let-else/issue-100103.rs), as a regression test for #100103, to ensure that there is no ICE when doing `Err(...)?` inside else blocks.

Added by e3c5bd617d (#100443):

* [`src/test/ui/let-else/let-else-then-diverge.rs`](https://github.com/rust-lang/rust/blob/master/src/test/ui/let-else/let-else-then-diverge.rs), to verify that there is no unreachable code error with the current desugaring.

Added by 981852677c (#100443):

* [`src/test/ui/let-else/issue-94176.rs`](https://github.com/rust-lang/rust/blob/master/src/test/ui/let-else/issue-94176.rs), to make sure that a correct span is emitted for a missing trailing expression error. Regression test for #94176.

Added by e182d12a84 (#100434):

* [src/test/ui/unpretty/pretty-let-else.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/unpretty/pretty-let-else.rs), as a regression test to ensure pretty printing works for `let else` (this bug surfaced in many different ways)

Added by e26285603c (#99954):

* [`src/test/ui/let-else/let-else-temporary-lifetime.rs`](https://github.com/rust-lang/rust/blob/master/src/test/ui/let-else/let-else-temporary-lifetime.rs) extended to contain & borrows as well, as this was identified as an earlier issue with the desugaring: https://github.com/rust-lang/rust/issues/98672#issuecomment-1200196921

Added by 2d8460ef43 (#99291):

* [`src/test/ui/let-else/let-else-drop-order.rs`](https://github.com/rust-lang/rust/blob/master/src/test/ui/let-else/let-else-drop-order.rs) a matrix based test for various drop order behaviour of `let else`. Especially, it verifies equality of `let` and `let else` drop orders, [resolving](https://github.com/rust-lang/rust/pull/93628#issuecomment-1238498468) a [stabilization blocker](https://github.com/rust-lang/rust/pull/93628#issuecomment-1055738523).

Added by 1b87ce0d40 (#101410):

* Edit to `src/test/ui/let-else/let-else-temporary-lifetime.rs` to add the `-Zvalidate-mir` flag, as a regression test for #99228

Added by af591ebe4d (#101410):

* [`src/test/ui/let-else/issue-99975.rs`](https://github.com/rust-lang/rust/blob/master/src/test/ui/let-else/issue-99975.rs) as a regression test for the ICE #99975.

Added by this PR:

* `ui/let-else/let-else.rs`, a simple run-pass check, similar to `ui/let-else/let-else-run-pass.rs`.

### Things not currently tested

* ~~The `#[allow(...)]` tests check whether allow works, but they don't check whether the non-presence of allow causes a lint to fire.~~ → *test added by e7730dcb7eb29a10ee73f269f4dc6e9d606db0da*
* ~~There is no `#[allow(...)]` test for the expression, as there are tests for the pattern and the else block.~~ → *test added by e7730dcb7eb29a10ee73f269f4dc6e9d606db0da*
* ~~`let-else-brace-before-else.rs` forbids the `let ... = {} else {}` pattern and there is a rustfix to obtain `let ... = ({}) else {}`. I'm not sure whether the `.fixed` files are checked by the tooling that they compile. But if there is no such check, it would be neat to make sure that `let ... = ({}) else {}` compiles.~~ → *test added by e7730dcb7eb29a10ee73f269f4dc6e9d606db0da*
* ~~#92069 got closed as fixed, but no regression test was added. Not sure it's worth to add one.~~ → *test added by 5bd71063b3810d977aa376d1e6dd7cec359330cc*
* ~~consistency between `let else` and `if let` regarding lifetimes and drop order: https://github.com/rust-lang/rust/pull/93628#issuecomment-1055738523~~ → *test added by 2d8460ef43d902f34ba2133fe38f66ee8d2fdafc*

Edit: they are all tested now.

### Possible future work / Refutable destructuring assignments

[RFC 2909](https://rust-lang.github.io/rfcs/2909-destructuring-assignment.html) specifies destructuring assignment, allowing statements like `FooBar { a, b, c } = foo();`.
As it was stabilized, destructuring assignment only allows *irrefutable* patterns, which before the advent of `let else` were the only patterns that `let` supported.
So the combination of `let else` and destructuring assignments gives reason to think about extensions of the destructuring assignments feature that allow refutable patterns, discussed in #93995.

A naive mapping of `let else` to destructuring assignments in the form of `Some(v) = foo() else { ... };` might not be the ideal way. `let else` needs a diverging `else` clause as it introduces new bindings, while assignments have a default behaviour to fall back to if the pattern does not match, in the form of not performing the assignment. Thus, there is no good case to require divergence, or even an `else` clause at all, beyond the need for having *some* introducer syntax so that it is clear to readers that the assignment is not a given (enums and structs look similar). There are better candidates for introducer syntax however than an empty `else {}` clause, like `maybe` which could be added as a keyword on an edition boundary:

```Rust
let mut v = 0;
maybe Some(v) = foo(&v);
maybe Some(v) = foo(&v) else { bar() };
```

Further design discussion is left to an RFC, or the linked issue.
2022-09-17 15:31:06 +05:30
bors
4a12d10bcc Auto merge of #101928 - notriddle:rollup-pexhhxe, r=notriddle
Rollup of 8 pull requests

Successful merges:

 - #101340 (Adding Fuchsia zxdb debugging walkthrough to docs)
 - #101741 (Adding needs-unwind arg to applicable compiler ui tests)
 - #101782 (Update `symbol_mangling` diagnostics migration)
 - #101878 (More simple formatting)
 - #101898 (Remove some unused CSS rules)
 - #101911 (rustdoc: remove no-op CSS on `.source .content`)
 - #101914 (rustdoc-json-types: Document that ResolvedPath can also be a union)
 - #101921 (Pass --cfg=bootstrap for rustdoc for proc_macro crates)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-09-17 05:45:28 +00:00
Michael Howell
8b88370ee5
Rollup merge of #101878 - Rageking8:More-simple-formatting, r=lcnr
More simple formatting
2022-09-16 20:37:16 -07:00
Michael Howell
d6534317c7
Rollup merge of #101782 - JhonnyBillM:refactor-symbol-mangling-diags-migration, r=davidtwco
Update `symbol_mangling` diagnostics migration

Addresses comments raised in #100831.

r? `@eddyb` `@davidtwco`
2022-09-16 20:37:15 -07:00
bors
c524c7dd25 Auto merge of #98588 - b-naber:valtrees-cleanup, r=lcnr
Use only ty::Unevaluated<'tcx, ()> in type system

r? `@lcnr`
2022-09-17 03:04:22 +00:00
Jack Huey
e09242d5b8 Final bits 2022-09-16 17:47:53 -04:00
Jack Huey
f1767dbb42 Add ExtraConstraintInfo 2022-09-16 17:33:12 -04:00
Jack Huey
9929c0ac76 Add AscribeUserTypeProvePredicate 2022-09-16 17:20:11 -04:00
Jack Huey
ec17be2656 Add outlives_constraint to BlameConstraint 2022-09-16 17:08:35 -04:00
Jack Huey
67653292be Add to_constraint_category to ObligationCause and SubregionOrigin 2022-09-16 17:00:11 -04:00
Jack Huey
6075877c89 Pass ConstraintCategory thorough a few more places 2022-09-16 16:44:18 -04:00
Jack Huey
a46376e247 Make QueryOutlivesConstraint contain a ConstraintCategory 2022-09-16 16:15:41 -04:00
bors
95a992a686 Auto merge of #97800 - pnkfelix:issue-97463-fix-aarch64-call-abi-does-not-zeroext, r=wesleywiser
Aarch64 call abi does not zeroext (and one cannot assume it does so)

Fix #97463
2022-09-16 20:08:05 +00:00
Charles Lew
a76dcd8b3b Update unicode-rs crates to Unicode 15 2022-09-17 01:55:56 +08:00
bors
4d4e51e428 Auto merge of #101902 - jackh726:revert-static-hrtb-error, r=nikomatsakis
Partially revert #101433

reverts #101433 to fix #101844

We should get this into the beta cut, since the ICE is getting hit quite a bit.
2022-09-16 16:46:14 +00:00
Rageking8
b248a6faf9 add help for invalid inline argument 2022-09-16 23:57:08 +08:00
Jack Huey
92b759f517 Revert "Better errors for implied static bound"
This reverts commit c75817b0a7.
2022-09-16 09:47:07 -04:00
Jack Huey
bba514b7b4 Revert "Use Predicate ConstraintCategory when normalizing"
This reverts commit aae37f8763.
2022-09-16 09:01:28 -04:00
bors
54f20bbb8a Auto merge of #101895 - GuillaumeGomez:rollup-ured85q, r=GuillaumeGomez
Rollup of 7 pull requests

Successful merges:

 - #101494 (rustdoc mobile: move notable traits to return type)
 - #101813 (Extend CSS check to CSS variables)
 - #101825 (Fix back RPIT changes)
 - #101843 (Suggest associated const for incorrect use of let in traits)
 - #101859 (Slight vertical formatting)
 - #101868 (rustdoc: use more precise URLs for jump-to-definition links)
 - #101877 (rustdoc: remove no-op CSS `.block { padding: 0 }`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-09-16 12:43:22 +00:00
Oli Scherer
dab1074b91 Only generate OpaqueCast for opaque types 2022-09-16 11:37:50 +00:00
Oli Scherer
40e2de8c41 Revert "Revert "Rollup merge of #98582 - oli-obk:unconstrained_opaque_type, r=estebank""
This reverts commit 4a742a691e.
2022-09-16 11:36:39 +00:00
Oli Scherer
5d664f7a8f Merge two arguments into one 2022-09-16 11:36:09 +00:00
Rageking8
d433efa649 more simple formatting 2022-09-16 19:07:42 +08:00
Guillaume Gomez
9a72ded562
Rollup merge of #101859 - Rageking8:slight-vertical-formatting, r=compiler-errors
Slight vertical formatting
2022-09-16 13:07:18 +02:00
Guillaume Gomez
72d9e0821e
Rollup merge of #101843 - chenyukang:fix-101797, r=oli-obk
Suggest associated const for incorrect use of let in traits

Fixes #101797
2022-09-16 13:07:18 +02:00
Guillaume Gomez
8ba133fa7b
Rollup merge of #101825 - spastorino:fix-rpit-changes, r=oli-obk
Fix back RPIT changes

r? `@oli-obk`

cc `@compiler-errors`
2022-09-16 13:07:17 +02:00
Oli Scherer
cf6366baba Revert TypeVisitor changes 2022-09-16 11:02:11 +00:00
bors
2d1aa57d1e Auto merge of #101860 - oli-obk:information_throwing, r=compiler-errors
Don't throw away information just to recompute it again

also allows making some functions private.
2022-09-16 09:57:32 +00:00
yukang
484b612909 use subdiagnostic for logical negation, bitwise not 2022-09-16 14:41:42 +08:00
Dylan DPC
28b4c62382
Rollup merge of #101787 - compiler-errors:cache-rpitit, r=petrochenkov
cache `collect_trait_impl_trait_tys`

Micro-optimization for RPITITs
2022-09-16 11:17:01 +05:30
Dylan DPC
edf9e5eb63
Rollup merge of #101753 - oli-obk:tait_closure_args, r=compiler-errors
Prefer explict closure sig types over expected ones

fixes #100800

Previously we only checked that given closure arguments are equal to expected closure arguments, but now we choose the given closure arguments for the signature that is used when type checking the closure body, and keep the other signature for the type of the closure as seen outside of it.
2022-09-16 11:17:01 +05:30
Dylan DPC
61126d3611
Rollup merge of #101738 - dpaoliello:linkname, r=petrochenkov
Fix `#[link kind="raw-dylib"]` to respect `#[link_name]`

Issue Details:
When using `#[link kind="raw-dylib"]` (#58713), the Rust compiler ignored any `#[link_name]` attributes when generating the import library and so the resulting binary would fail to link due to missing symbols.

Fix Details:
Use the name from `#[link_name]` if present when generating the `raw-dylib` import library, otherwise default back to the actual symbol name.
2022-09-16 11:17:00 +05:30
Takayuki Maeda
7510a1b15e remove an unused struct field 2022-09-16 14:34:05 +09:00
Deadbeef
5ead742e18 remap ParamEnv with obligation 2022-09-16 12:08:46 +08:00
Deadbeef
08aeb1aa9b unconditionally remap to nonconst in borrowck 2022-09-16 12:08:46 +08:00
Deadbeef
f8813cf10e do const trait method bounds check later in rustc_const_eval 2022-09-16 11:48:43 +08:00
Deadbeef
77b0c47b82 Normalize param_env for trait assoc consts in typeck 2022-09-16 11:48:43 +08:00
Deadbeef
07608bd60e fix const_trait unstable message 2022-09-16 11:48:43 +08:00
Deadbeef
4231661789 Do not require const predicates to hold when checking if a projection type is wf 2022-09-16 11:48:42 +08:00
Deadbeef
81b1810cd7 Require #[const_trait] for const impls 2022-09-16 11:48:42 +08:00
Takayuki Maeda
527292a1a6 do not suggest a placeholder to const and static without a type 2022-09-16 11:24:14 +09:00
bors
cf9ed0dd58 Auto merge of #101831 - compiler-errors:issue-75899, r=jackh726
Normalize struct field types in `confirm_builtin_unsize_candidate`

Fixes #75899

---

edited to move the normalization into `confirm_builtin_unsize_candidate` instead of the coercion code.
2022-09-15 21:06:36 +00:00
b-naber
d77248e6d2 nits 2022-09-15 22:27:41 +02:00
est31
173eb6f407 Only enable the let_else feature on bootstrap
On later stages, the feature is already stable.

Result of running:

rg -l "feature.let_else" compiler/ src/librustdoc/ library/ | xargs sed -s -i "s#\\[feature.let_else#\\[cfg_attr\\(bootstrap, feature\\(let_else\\)#"
2022-09-15 21:06:45 +02:00
est31
5633e863bd Remove feature gate from let else suggestion
The let else suggestion added by 0d92752b8a
does not need a feature gate any more.
2022-09-15 21:06:45 +02:00
est31
bca3cf7e86 Stabilize the let_else feature 2022-09-15 21:06:45 +02:00
bors
df34db9b03 Auto merge of #101858 - oli-obk:lift_derive, r=lcnr
derive various impls instead of hand-rolling them

r? `@lcnr`

This may not have been what you asked for in 964b97e845 (r84051418) but I got carried away while following the compiler team meeting today.
2022-09-15 18:14:29 +00:00
yukang
4bf7d2ca91 tweak suggestion 2022-09-16 01:09:26 +08:00
Camille GILLOT
c9c6c507b7 Do not fetch HIR node when iterating to find lint. 2022-09-15 18:40:03 +02:00
Oli Scherer
8aed75bee0 Don't throw away information just to recompute it again 2022-09-15 16:23:10 +00:00
Rageking8
6d7beafc87 slight vertical formatting 2022-09-15 23:51:43 +08:00
Oli Scherer
c6fcb1c6a3 Merge all TypeVisitable for &List<T> impls into one generic one 2022-09-15 15:33:46 +00:00
bors
35a0407814 Auto merge of #101410 - dingxiangfei2009:fix-let-else-scoping, r=jackh726
Reorder nesting scopes and declare bindings without drop schedule

Fix #99228
Fix #99975

Storages are previously not declared before entering the `else` block of a `let .. else` statement. However, when breaking out of the pattern matching into the `else` block, those storages are recorded as scheduled for drops. This is not expected.

This MR fixes this issue by not scheduling the drops for those storages.

cc `@est31`
2022-09-15 15:19:40 +00:00
Oli Scherer
9d9306828c Replace more manual TypeFoldable and TypeVisitable impls with derives 2022-09-15 15:05:03 +00:00
lcnr
5669ce1a28 change FnMutDelegate to trait objects 2022-09-15 16:59:58 +02:00
Oli Scherer
a5ab8da1e2 derive TypeVisitable and TypeFoldable for mir types 2022-09-15 14:42:43 +00:00
yukang
f43562b95b more tweak on diagnostic messages 2022-09-15 22:39:16 +08:00
Oli Scherer
d376012a43 Derive TypeFoldable and TypeVisitable for mir::PlaceElement 2022-09-15 13:43:44 +00:00
Oli Scherer
10c0560cd2 Resolve a FIXME 2022-09-15 13:37:34 +00:00
Oli Scherer
d4e986c1f0 derive various Lift impl instead of hand rolling them 2022-09-15 13:32:43 +00:00
bors
294f0eef73 Auto merge of #101173 - jyn514:simplify-macro-arguments, r=cjgillot
Further simplify the macros generated by `rustc_queries`

This doesn't actually move anything outside the macros, but it makes them simpler to read.

- Add a new `rustc_query_names` macro. This allows a much simpler syntax for the matchers in the macros passed to it as a callback.
- Convert `define_dep_nodes` and `alloc_once` to use `rustc_query_names`. This is possible because they only use the names
  (despite the quite complicated matchers in `define_dep_nodes`, none of the other arguments are used).
- Get rid of `rustc_dep_node_append`.

r? `@cjgillot`
2022-09-15 11:54:03 +00:00
yukang
2194fc957a fix 101793, fix the wording of help msg for bitwise not 2022-09-15 17:33:28 +08:00
yukang
98e20c097c fix #101797: Suggest associated const for incorrect use of let in traits 2022-09-15 16:15:38 +08:00
SparrowLii
89fd6ae458 correct span, add help message and add UI test when query depth overflows 2022-09-15 16:05:44 +08:00
SparrowLii
44506f38e0 add note for layout_of when query depth overflows 2022-09-15 16:05:00 +08:00
Matthias Krüger
ad154e41a1
Rollup merge of #100415 - WorksButNotTested:be8, r=wesleywiser
Add BE8 support

Built using the following `/config.toml`
```
changelog-seen = 2

[llvm]
download-ci-llvm = false
skip-rebuild = true
optimize = true
ninja = true
targets = "ARM;X86"
clang = false

[build]
target = ["x86_64-unknown-linux-gnu", "armeb-linux-gnueabi"]
docs = false
docs-minification = false
compiler-docs = false
[install]
prefix = "/home/user/x-tools/rust/"

[rust]
debug-logging=true
backtrace = true
incremental = true

[target.x86_64-unknown-linux-gnu]

[dist]

[target.armeb-linux-gnueabi]
cc = "/home/user/x-tools/armeb-linux-gnueabi/bin/armeb-linux-gnueabi-gcc"
cxx = "/home/user/x-tools/armeb-linux-gnueabi/bin/armeb-linux-gnueabi-g++"
ar = "/home/user/x-tools/armeb-linux-gnueabi/bin/armeb-linux-gnueabi-ar"
ranlib = "/home/user/x-tools/armeb-linux-gnueabi/bin/armeb-linux-gnueabi-ranlib"
linker = "/home/user/x-tools/armeb-linux-gnueabi/bin/armeb-linux-gnueabi-gcc"
llvm-config = "/home/user/x-tools/clang/bin/llvm-config"
llvm-filecheck = "/home/user/x-tools/clang/bin/FileCheck"
```

The following `.cargo/config` is needed inside any project directory:
```
[build]
target = "armeb-linux-gnueabi"

[target.armeb-linux-gnueabi]
linker = "armeb-linux-gnueabi-gcc"
```
2022-09-15 08:00:11 +02:00
Ding Xiang Fei
4a5d2a561c
add diagram to explain the MIR structure 2022-09-15 10:08:14 +08:00
Ding Xiang Fei
c7d1c9b66f
add explanatory note 2022-09-15 10:08:13 +08:00
Ding Xiang Fei
635b57c2ed
enclose else block in terminating scope 2022-09-15 10:08:12 +08:00
Ding Xiang Fei
34f0c4502f
supplement for the missing or incomplete comments 2022-09-15 10:08:11 +08:00
Ding Xiang Fei
1b87ce0d40
reorder nesting scopes and declare bindings without drop schedule 2022-09-15 10:07:54 +08:00
Michael Goulet
7893ca74e5 Normalize struct types in confirm_builtin_unsize_candidate 2022-09-15 01:20:36 +00:00
bors
2cb9a65684 Auto merge of #101620 - cjgillot:compute_lint_levels_by_def, r=oli-obk
Compute lint levels by definition

Lint levels are currently computed once for the whole crate. Any code that wants to emit a lint depends on this single `lint_levels(())` query. This query contains the `Span` for each attribute that participates in the lint level tree, so any code that wants to emit a lint basically depends on the spans in all files in the crate.

Contrary to hard errors, we do not clear the incremental session on lints, so this implicit world dependency pessimizes incremental reuse. (And is furthermore invisible for allowed lints.)

This PR completes https://github.com/rust-lang/rust/pull/99634 (thanks for the initial work `@fee1-dead)` and includes it in the dependency graph.

The design is based on 2 queries:
1. `lint_levels_on(HirId) -> FxHashMap<LintId, LevelAndSource>` which accesses the attributes at the given `HirId` and processes them into lint levels.  The `TyCtxt` is responsible for probing the HIR tree to find the user-visible level.
2. `lint_expectations(())` which lists all the `#[expect]` attributes in the crate.

This PR also introduces the ability to reconstruct a `HirId` from a `DepNode` by encoding the local part of the `DefPathHash` and the `ItemLocalId` in the two `u64` of the fingerprint.  This allows for the dep-graph to directly recompute `lint_levels_on` directly, without having to force the calling query.

Closes https://github.com/rust-lang/rust/issues/95094.
Supersedes https://github.com/rust-lang/rust/pull/99634.
2022-09-15 00:01:17 +00:00
bors
750bd1a7ff Auto merge of #101313 - SparrowLii:mk_attr_id, r=cjgillot
make `mk_attr_id` part of `ParseSess`

Updates #48685

The current `mk_attr_id` uses the `AtomicU32` type, which is not very efficient and adds a lot of lock contention in a parallel environment.

This PR refers to the task list in #48685, uses `mk_attr_id` as a method of the `AttrIdGenerator` struct, and adds a new field `attr_id_generator` to `ParseSess`.

`AttrIdGenerator` uses the `WorkerLocal`, which has two advantages: 1. `Cell` is more efficient than `AtomicU32`, and does not increase any lock contention. 2. We put the index of the work thread in the first few bits of the generated `AttrId`, so that the `AttrId` generated in different threads can be easily guaranteed to be unique.

cc `@cjgillot`
2022-09-14 20:52:18 +00:00
Michael Goulet
4cdf264e6f cache collect_trait_impl_trait_tys 2022-09-14 20:50:52 +00:00
Santiago Pastorino
45d8049387
Get rid of 'b lifetime in lower_param_bounds_mut 2022-09-14 17:40:51 -03:00
Santiago Pastorino
861055094c
Pass ImplTraitContext as &, there's no need for that to be &mut 2022-09-14 17:39:52 -03:00
Santiago Pastorino
669f2d4550
Revert "Rollup merge of #101496 - spastorino:lower_lifetime_binder_api_changes, r=oli-obk"
This reverts commit 953a6b3da7, reversing
changes made to b5ffbd32d4.
2022-09-14 17:26:37 -03:00
bors
6153d3cbe6 Auto merge of #101212 - eholk:dyn-star, r=compiler-errors
Initial implementation of dyn*

This PR adds extremely basic and incomplete support for [dyn*](https://smallcultfollowing.com/babysteps//blog/2022/03/29/dyn-can-we-make-dyn-sized/). The goal is to get something in tree behind a flag to make collaboration easier, and also to make sure the implementation so far is not unreasonable. This PR does quite a few things:

* Introduce `dyn_star` feature flag
* Adds parsing for `dyn* Trait` types
* Defines `dyn* Trait` as a sized type
* Adds support for explicit casts, like `42usize as dyn* Debug`
  * Including const evaluation of such casts
* Adds codegen for drop glue so things are cleaned up properly when a `dyn* Trait` object goes out of scope
* Adds codegen for method calls, at least for methods that take `&self`

Quite a bit is still missing, but this gives us a starting point. Note that this is never intended to become stable surface syntax for Rust, but rather `dyn*` is planned to be used as an implementation detail for async functions in dyn traits.

Joint work with `@nikomatsakis` and `@compiler-errors.`

r? `@bjorn3`
2022-09-14 18:10:51 +00:00
Diego de Oliveira
6a47326a04 Migrated the rustc_passes lint for annotations without effect to the new diagnostic infrastructure 2022-09-14 15:05:59 -03:00
Your Name
73d6dd5098 Changes to rename target and update docs 2022-09-14 18:38:01 +01:00
Camille Gillot
cb2949e642
Update compiler/rustc_macros/src/query.rs 2022-09-14 19:11:53 +02:00
Camille GILLOT
42a92eb54b Correct Key impl for HirId. 2022-09-14 19:06:48 +02:00
Camille GILLOT
1fcc440391 Add FIXME. 2022-09-14 19:06:39 +02:00
Camille GILLOT
fca0d8a10e Comment LintLevelSets. 2022-09-14 19:06:30 +02:00
Camille GILLOT
bb61842048 Remove unused tool_name. 2022-09-14 19:06:09 +02:00
Camille GILLOT
ad09abc194 Move some code and add comments. 2022-09-14 19:06:05 +02:00
Camille GILLOT
bd45139cb0 Allow query system to recover a HirId. 2022-09-14 19:04:13 +02:00
Jack Huey
d657d1f4a1 Disallow defaults on type GATs 2022-09-14 13:03:01 -04:00
Deadbeef
eb19a8a620 Compute lint_levels by definition 2022-09-14 19:02:44 +02:00
b-naber
6af8fb7936 address review again 2022-09-14 17:30:25 +02:00
hanar3
dddfb7db24 Improve error message for unsupported crate 2022-09-14 12:19:42 -03:00
Bryanskiy
d7b9221405 change AccessLevels representation 2022-09-14 18:11:00 +03:00
Dylan DPC
94bc08d94f
Rollup merge of #101772 - est31:replace_placeholder_diagnostics, r=jackh726
Also replace the placeholder for the stable_features lint

Follow up of  #101215 and #100591 .

Fixes #101766
2022-09-14 19:26:21 +05:30
Dylan DPC
430123164f
Rollup merge of #101433 - jackh726:better-static-placeholder-error, r=compiler-errors
Emit a note that static bounds from HRTBs are a bug

This note isn't perfect, but opening this to either 1) land as is or 2) get some feedback on how to improve it

Let r? `@compiler-errors` and cc. `@nikomatsakis`
2022-09-14 19:26:18 +05:30
Oli Scherer
7794ea5854 Prefer explict closure sig types over expected ones 2022-09-14 10:44:56 +00:00
bors
c97922dca5 Auto merge of #99443 - jam1garner:mips-virt-feature, r=nagisa
Add support for MIPS VZ ISA extension

[Link to relevant LLVM line where virt extension is specified](83fab8cee9/llvm/lib/Target/Mips/Mips.td (L172-L173))

This has been tested on mips-unknown-linux-musl with a target-cpu that is >= MIPS32 5 and `target-features=+virt`. The example was checked in a disassembler to ensure the correct assembly sequence was being generated using the virtualization instructions.

Needed additional work:

* MIPS is missing from [the Rust reference CPU feature lists](https://doc.rust-lang.org/reference/attributes/codegen.html#available-features)

Example docs for later:

```md
#### `mips` or `mips64`

This platform requires that `#[target_feature]` is only applied to [`unsafe`
functions][unsafe function]. This target's feature support is currently unstable
and must be enabled by `#![feature(mips_target_feature)]` ([Issue #44839])

[Issue #44839]: https://github.com/rust-lang/rust/issues/44839

Further documentation on these features can be found in the [MIPS Instruction Set
Reference Manual], or elsewhere on [mips.com].

[MIPS Instruction Set Reference Manual]: https://s3-eu-west-1.amazonaws.com/downloads-mips/documents/MD00086-2B-MIPS32BIS-AFP-6.06.pdf
[developer.arm.com]: https://www.mips.com/products/architectures/ase/

Feature        | Implicitly Enables | Description
---------------|--------------------|-------------------
`fp64`         |                    | 64-bit Floating Point
`msa`          |                    | "MIPS SIMD Architecture"
`virt`         |                    | Virtualization instructions (VZ ASE)
```

If the above is good I can also submit a PR for that if there's interest in documenting it while it's still unstable. Otherwise that can be dropped, I just wrote it before realizing it was possibly not a good idea.

Relevant to #44839
2022-09-14 08:21:25 +00:00
bors
a0d1df4a5d Auto merge of #101709 - nnethercote:simplify-visitors-more, r=cjgillot
Simplify visitors more

A successor to #100392.

r? `@cjgillot`
2022-09-14 05:21:14 +00:00
bors
a5b58addae Auto merge of #101307 - jyn514:simplify-storage, r=cjgillot
Simplify caching and storage for queries

I highly recommend reviewing commit-by-commit; each individual commit is quite small but it can be hard to see looking at the overall diff that the behavior is the same. Each commit depends on the previous.

r? `@cjgillot`
2022-09-14 02:39:51 +00:00
est31
3a38d566bd Also replace the placeholder for the stable_features lint 2022-09-14 03:28:54 +02:00
SparrowLii
bfc4f2e189 add debug assertion for max attr_id 2022-09-14 08:49:12 +08:00
SparrowLii
1a3ecbdb6a make mk_attr_id part of ParseSess 2022-09-14 08:49:10 +08:00
Jack Huey
aae37f8763 Use Predicate ConstraintCategory when normalizing 2022-09-13 20:18:49 -04:00
Jack Huey
c75817b0a7 Better errors for implied static bound 2022-09-13 20:18:04 -04:00
Jack Huey
ff623ffc39 Cleanup retrieve_closure_constraint_info 2022-09-13 19:58:53 -04:00
Jack Huey
2be6301857 Remove unused body args 2022-09-13 19:58:53 -04:00
Eric Holk
cf04547b0b Address code review comments 2022-09-13 14:50:12 -07:00
bors
17cbdfd071 Auto merge of #101777 - matthiaskrgr:rollup-x2dyaa2, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #101266 (translations(rustc_session): migrates rustc_session to use SessionDiagnostic - Final)
 - #101737 (rustdoc: remove no-op CSS `.search-results .result-name > span`)
 - #101752 (Improve Attribute doc methods)
 - #101754 (Fix doc of log function)
 - #101759 (⬆️ rust-analyzer)
 - #101765 (Add documentation for TyCtxt::visibility)
 - #101770 (Rustdoc-Json: Don't loose subitems of foreign traits.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-09-13 21:05:21 +00:00
Matthias Krüger
68dc6396a5
Rollup merge of #101765 - GuillaumeGomez:tyctxt-visibility-doc, r=jyn514
Add documentation for TyCtxt::visibility

We encountered this issue while working on https://github.com/rust-lang/rust/pull/98450.

cc ``@lqd``
r? ``@cjgillot``
2022-09-13 22:25:38 +02:00
Matthias Krüger
8fa8021451
Rollup merge of #101752 - GuillaumeGomez:improve-attr-docs, r=lqd
Improve Attribute doc methods

r? `@lqd`
2022-09-13 22:25:35 +02:00
Matthias Krüger
bc8ec5e5fa
Rollup merge of #101266 - LuisCardosoOliveira:translation-rustcsession-pt3, r=davidtwco
translations(rustc_session): migrates rustc_session to use SessionDiagnostic - Final

# Description
This is the final part of the rustc_session https://github.com/rust-lang/rust/issues/100717#issuecomment-1220279883.

Please only review this [commit](a545347037). The other ones are from the PR https://github.com/rust-lang/rust/pull/101041# that is not yet merged.

In this PR, we migrate the file `output.rs`
2022-09-13 22:25:34 +02:00
Jhonny Bill Mena
c846ba6e53 UPDATE - merge and avoid translations for symbol mangling test output 2022-09-13 16:19:32 -04:00
b-naber
ba00189d8e rebase 2022-09-13 21:51:35 +02:00
bors
c84083b08e Auto merge of #101086 - cjgillot:thir-param, r=oli-obk
Compute information about function parameters on THIR

This avoids some manipulation of typeck results while building MIR.
2022-09-13 18:15:06 +00:00
Camille GILLOT
cb5ea8d0b6 Emit an error instead of reconstructing token stream. 2022-09-13 19:47:50 +02:00
Camille GILLOT
8823634db8 Manually cleanup token stream when macro expansion aborts. 2022-09-13 19:46:01 +02:00
Camille GILLOT
494af379c4 Use def_span for external requirements. 2022-09-13 19:18:24 +02:00
Camille GILLOT
f3a37ed574 Shrink some visibilities. 2022-09-13 19:18:24 +02:00
Camille GILLOT
af128b0144 Also compute implicit params in THIR. 2022-09-13 19:18:24 +02:00
Camille GILLOT
445841cda3 Compute explicit MIR params on THIR. 2022-09-13 19:18:23 +02:00
Camille GILLOT
f76594a0bc Simplify MIR building entry. 2022-09-13 19:18:23 +02:00
Camille GILLOT
1f370d9437 Use tcx.hir() utils for spans in MIR building.
This corrects the `span_with_body` in the case of closures, which was
incorrectly shortened to the `def_span`.
2022-09-13 19:18:23 +02:00
Camille GILLOT
ffe20d61d6 Only keep one version of ImplicitSelfKind. 2022-09-13 19:18:23 +02:00
b-naber
29c0364c37 rebase 2022-09-13 17:48:05 +02:00
b-naber
bea0a6dc84 address review 2022-09-13 17:44:53 +02:00
b-naber
372c4fd67f remove visit_const from mir visitors 2022-09-13 17:44:52 +02:00
b-naber
0726265442 cranelift changes 2022-09-13 17:44:49 +02:00
b-naber
a7735cd329 fixes/working version 2022-09-13 17:41:02 +02:00
b-naber
2554fa1c8e renumber regions in mir constants correctly 2022-09-13 17:41:02 +02:00
b-naber
a4bbb8db5c use ty::Unevaluated<'tcx, ()> in type system 2022-09-13 17:40:59 +02:00
bors
1ce51982b8 Auto merge of #101615 - compiler-errors:rpitit-perf, r=oli-obk
Make `compare_predicate_entailment` no longer a query

Make `compare_predicate_entailment` so it's no longer a query (again), and splits out the new logic (that equates the return types to infer RPITITs) into its own query. This means that this new query (now called `collect_trait_impl_trait_tys`) is no longer executed for non-RPITIT cases.

This should improve perf (https://github.com/rust-lang/rust/pull/101224#issuecomment-1241682203), though in practice we see that these some crates remain from the primary regressions list on the original report... They are all <= 0.43% regression and seemingly only on the incr-full scenario for all of them.

I am at a loss for what might be causing this regression other than what I fixed here, since we don't introduce much new non-RPITIT logic except for some `def_kind` query calls in some places, for example, like projection. Maybe that's it?

----

Originally this PR was opened to test enabling `cache_on_disk` (62164aaaa11) but that didn't turn out to be very useful (https://github.com/rust-lang/rust/pull/101615#issuecomment-1242403205), so that led me to just split the query (and rename the PR).
2022-09-13 15:33:06 +00:00
Guillaume Gomez
de184a63a6 Add documentation for TyCtxt::visibility 2022-09-13 17:27:56 +02:00
bors
5338f5f1d4 Auto merge of #101757 - Dylan-DPC:rollup-wkt6oe9, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #101602 (Streamline `AttrAnnotatedTokenStream`)
 - #101690 (Avoid `Iterator::last`)
 - #101700 (A `SubstitutionPart` is not considered a deletion if it replaces nothing with nothing)
 - #101745 (Fix typo in concat_bytes documentation)
 - #101748 (rustdoc: remove redundant CSS `#source-sidebar, #sidebar-toggle`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-09-13 12:35:55 +00:00
Dylan DPC
adcd1fbf2e
Rollup merge of #101700 - compiler-errors:deletion-span, r=davidtwco
A `SubstitutionPart` is not considered a deletion if it replaces nothing with nothing

Fixes #101689
2022-09-13 16:51:31 +05:30
Dylan DPC
d5b86d5ee9
Rollup merge of #101690 - kadiwa4:avoid_iterator_last, r=oli-obk
Avoid `Iterator::last`

Adapters like `Filter` and `Map` use the default implementation of `Iterator::last` which is not short-circuiting (and so does `core::str::Split`). The predicate function will be run for every single item of the underlying iterator. I hope that removing those calls to `last` results in slight performance improvements.
2022-09-13 16:51:31 +05:30
Dylan DPC
db75d7e14b
Rollup merge of #101602 - nnethercote:AttrTokenStream, r=petrochenkov
Streamline `AttrAnnotatedTokenStream`

r? ```@petrochenkov```
2022-09-13 16:51:31 +05:30
bors
7098c181f8 Auto merge of #96709 - jackh726:gats-stabilization, r=compiler-errors
Stabilize generic associated types

Closes #44265

r? `@nikomatsakis`

#  Status of the discussion 

* [x] There have been several serious concerns raised, [summarized here](https://github.com/rust-lang/rust/pull/96709#issuecomment-1129311660).
* [x] There has also been a [deep-dive comment](https://github.com/rust-lang/rust/pull/96709#issuecomment-1167220240) explaining some of the "patterns of code" that are enabled by GATs, based on use-cases posted to this thread or on the tracking issue.
* [x] We have modeled some aspects of GATs in [a-mir-formality](https://github.com/nikomatsakis/a-mir-formality) to give better confidence in how they will be resolved in the future. [You can read a write-up here](https://github.com/rust-lang/types-team/blob/master/minutes/2022-07-08-implied-bounds-and-wf-checking.md).
* [x] The major points of the discussion have been [summarized on the GAT initiative repository](https://rust-lang.github.io/generic-associated-types-initiative/mvp.html).
* [x] [FCP has been proposed](https://github.com/rust-lang/rust/pull/96709#issuecomment-1129311660) and we are awaiting final decisions and discussion amidst the relevant team members.

# Stabilization proposal

This PR proposes the stabilization of `#![feature(generic_associated_types)]`. While there a number of future additions to be made and bugs to be fixed (both discussed below), properly doing these will require significant language design and will ultimately likely be backwards-compatible. Given the overwhelming desire to have some form of generic associated types (GATs) available on stable and the stability of the "simple" uses, stabilizing the current subset of GAT features is almost certainly the correct next step.

Tracking issue: #44265
Initiative: https://rust-lang.github.io/generic-associated-types-initiative/
RFC: https://github.com/rust-lang/rfcs/blob/master/text/1598-generic_associated_types.md
Version: 1.65 (2022-08-22 => beta, 2022-11-03 => stable).

## Motivation

There are a myriad of potential use cases for GATs. Stabilization unblocks probable future language features (e.g. async functions in traits), potential future standard library features (e.g. a `LendingIterator` or some form of `Iterator` with a lifetime generic), and a plethora of user use cases (some of which can be seen just by scrolling through the tracking issue and looking at all the issues linking to it).

There are a myriad of potential use cases for GATs. First, there are many users that have chosen to not use GATs primarily because they are not stable (some of which can be seen just by scrolling through the tracking issue and looking at all the issues linking to it). Second, while language feature desugaring isn't *blocked* on stabilization, it gives more confidence on using the feature. Likewise, library features like `LendingIterator` are not necessarily blocked on stabilization to be implemented unstably; however few, if any, public-facing APIs actually use unstable features.

This feature has a long history of design, discussion, and developement - the RFC was first introduced roughly 6 years ago. While there are still a number of features left to implement and bugs left to fix, it's clear that it's unlikely those will have backwards-incompatibility concerns. Additionally, the bugs that do exist do not strongly impede the most-common use cases.

## What is stabilized

The primary language feature stabilized here is the ability to have generics on associated types, as so. Additionally, where clauses on associated types will now be accepted, regardless if the associated type is generic or not.

```rust
trait ATraitWithGATs {
    type Assoc<'a, T> where T: 'a;
}

trait ATraitWithoutGATs<'a, T> {
    type Assoc where T: 'a;
}
```

When adding an impl for a trait with generic associated types, the generics for the associated type are copied as well. Note that where clauses are allowed both after the specified type and before the equals sign; however, the latter is a warn-by-default deprecation.

```rust
struct X;
struct Y;

impl ATraitWithGATs for X {
    type Assoc<'a, T> = &'a T
      where T: 'a;
}
impl ATraitWithGATs for Y {
    type Assoc<'a, T>
      where T: 'a
    = &'a T;
}
```

To use a GAT in a function, generics are specified on the associated type, as if it was a struct or enum. GATs can also be specified in trait bounds:

```rust
fn accepts_gat<'a, T>(t: &'a T) -> T::Assoc<'a, T>
  where for<'x> T: ATraitWithGATs<Assoc<'a, T> = &'a T> {
    ...
}
```

GATs can also appear in trait methods. However, depending on how they are used, they may confer where clauses on the associated type definition. More information can be found [here](https://github.com/rust-lang/rust/issues/87479). Briefly, where clauses are required when those bounds can be proven in the methods that *construct* the GAT or other associated types that use the GAT in the trait. This allows impls to have maximum flexibility in the types defined for the associated type.

To take a relatively simple example:

```rust
trait Iterable {
    type Item<'a>;
    type Iterator<'a>: Iterator<Item = Self::Item<'a>>;

    fn iter<'x>(&'x self) -> Self::Iterator<'x>;
    //^ We know that `Self: 'a` for `Iterator<'a>`, so we require that bound on `Iterator`
    //  `Iterator` uses `Self::Item`, so we also require a `Self: 'a` on `Item` too
}
```

A couple well-explained examples are available in a previous [blog post](https://blog.rust-lang.org/2021/08/03/GATs-stabilization-push.html).

## What isn't stabilized/implemented

### Universal type/const quantification

Currently, you can write a bound like `X: for<'a> Trait<Assoc<'a> = &'a ()>`. However, you cannot currently write `for<T> X: Trait<Assoc<T> = T>` or `for<const N> X: Trait<Assoc<N> = [usize; N]>`.

Here is an example where this is needed:

```rust
trait Foo {}

trait Trait {
    type Assoc<F: Foo>;
}

trait Trait2: Sized {
    fn foo<F: Foo, T: Trait<Assoc<F> = F>>(_t: T);
}
```

In the above example, the *caller* must specify `F`, which is likely not what is desired.

### Object-safe GATs

Unlike non-generic associated types, traits with GATs are not currently object-safe. In other words the following are not allowed:

```rust
trait Trait {
    type Assoc<'a>;
}

fn foo(t: &dyn for<'a> Trait<Assoc<'a> = &'a ()>) {}
         //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not allowed

let ty: Box<dyn for<'a> Trait<Assoc<'a> = &'a ()>>;
          //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not allowed
```

### Higher-kinded types

You cannot write currently (and there are no current plans to implement this):

```rust
struct Struct<'a> {}

fn foo(s: for<'a> Struct<'a>) {}
```

## Tests

There are many tests covering GATs that can be found in  `src/test/ui/generic-associated-types`. Here, I'll list (in alphanumeric order) tests highlight some important behavior or contain important patterns.

- `./parse/*`: Parsing of GATs in traits and impls, and the trait path with GATs
- `./collections-project-default.rs`: Interaction with associated type defaults
- `./collections.rs`: The `Collection` pattern
- `./const-generics-gat-in-trait-return-type-*.rs`: Const parameters
- `./constraint-assoc-type-suggestion.rs`: Emit correct syntax in suggestion
- `./cross-crate-bounds.rs`: Ensure we handles bounds across crates the same
- `./elided-in-expr-position.rs`: Disallow lifetime elision in return position
- `./gat-in-trait-path-undeclared-lifetime.rs`: Ensure we error on undeclared lifetime in trait path
- `./gat-in-trait-path.rs`: Base trait path case
- `./gat-trait-path-generic-type-arg.rs`: Don't allow shadowing of parameters
- `./gat-trait-path-parenthesised-args.rs`: Don't allow paranthesized args in trait path
- `./generic-associated-types-where.rs`: Ensure that we require where clauses from trait to be met on impl
- `./impl_bounds.rs`: Check that the bounds on GATs in an impl are checked
- `./issue-76826.rs`: `Windows` pattern
- `./issue-78113-lifetime-mismatch-dyn-trait-box.rs`: Implicit 'static diagnostics
- `./issue-84931.rs`: Ensure that we have a where clause on GAT to ensure trait parameter lives long enough
- `./issue-87258_a.rs`: Unconstrained opaque type with TAITs
- `./issue-87429-2.rs`: Ensure we can use bound vars in the bounds
- `./issue-87429-associated-type-default.rs`: Ensure bounds hold with associated type defaults, for both trait and impl
- `./issue-87429-specialization.rs`: Check that bounds hold under specialization
- `./issue-88595.rs`: Under the outlives lint, we require a bound for both trait and GAT lifetime when trait lifetime is used in function
- `./issue-90014.rs`: Lifetime bounds are checked with TAITs
- `./issue-91139.rs`: Under migrate mode, but not NLL, we don't capture implied bounds from HRTB lifetimes used in a function and GATs
- `./issue-91762.rs`: We used to too eagerly pick param env candidates when normalizing with GATs. We now require explicit parameters specified.
- `./issue-95305.rs`: Disallow lifetime elision in trait paths
- `./iterable.rs`: `Iterable` pattern
- `./method-unsatified-assoc-type-predicate.rs`: Print predicates with GATs correctly in method resolve error
- `./missing_lifetime_const.rs`: Ensure we must specify lifetime args (not elidable)
- `./missing-where-clause-on-trait.rs`: Ensure we don't allow stricter bounds on impl than trait
- `./parameter_number_and_kind_impl.rs`: Ensure paramters on GAT in impl match GAT in trait
- `./pointer_family.rs`: `PointerFamily` pattern
- `./projection-bound-cycle.rs`: Don't allow invalid cycles to prove bounds
- `./self-outlives-lint.rs`: Ensures that an e.g. `Self: 'a` is written on the traits GAT if that bound can be implied from the GAT usage in the trait
- `./shadowing.rs`: Don't allow lifetime shadowing in params
- `./streaming_iterator.rs`: `StreamingIterator`(`LendingIterator`) pattern
- `./trait-objects.rs`: Disallow trait objects for traits with GATs
- `./variance_constraints.rs`: Require that GAT substs be invariant

## Remaining bugs and open issues

A full list of remaining open issues can be found at: https://github.com/rust-lang/rust/labels/F-generic_associated_types

There are some `known-bug` tests in-tree at `src/test/ui/generic-associated-types/bugs`.

Here I'll categorize most of those that GAT bugs (or involve a pattern found more with GATs), but not those that include GATs but not a GAT issue in and of itself. (I also won't include issues directly for things listed elsewhere here.)

Using the concrete type of a GAT instead of the projection type can give errors, since lifetimes are chosen to be early-bound vs late-bound.
- #85533
- #87803

In certain cases, we can run into cycle or overflow errors. This is more generally a problem with associated types.
- #87755
- #87758

Bounds on an associatd type need to be proven by an impl, but where clauses need to be proven by the usage. This can lead to confusion when users write one when they mean the other.
- #87831
- #90573

We sometimes can't normalize closure signatures fully. Really an asociated types issue, but might happen a bit more frequently with GATs, since more obvious place for HRTB lifetimes.
- #88382

When calling a function, we assign types to parameters "too late", after we already try (and fail) to normalize projections. Another associated types issue that might pop up more with GATs.
- #88460
- #96230

We don't fully have implied bounds for lifetimes appearing in GAT trait paths, which can lead to unconstrained type errors.
- #88526

Suggestion for adding lifetime bounds can suggest unhelpful fixes (`T: 'a` instead of `Self: 'a`), but the next compiler error after making the suggested change is helpful.
- #90816
- #92096
- #95268

We can end up requiring that `for<'a> I: 'a` when we really want `for<'a where I: 'a> I: 'a`. This can leave unhelpful errors than effectively can't be satisfied unless `I: 'static`. Requires bigger changes and not only GATs.
- #91693

Unlike with non-generic associated types, we don't eagerly normalize with param env candidates. This is intended behavior (for now), to avoid accidentaly stabilizing picking arbitrary impls.
- #91762

Some Iterator adapter patterns (namely `filter`) require Polonius or unsafe to work.
- #92985

## Potential Future work

### Universal type/const quantification

No work has been done to implement this. There are also some questions around implied bounds.

###  Object-safe GATs

The intention is to make traits with GATs object-safe. There are some design work to be done around well-formedness rules and general implementation.

### GATified std lib types

It would be helpful to either introduce new std lib traits (like `LendingIterator`) or to modify existing ones (adding a `'a` generic to `Iterator::Item`). There also a number of other candidates, like `Index`/`IndexMut` and `Fn`/`FnMut`/`FnOnce`.

### Reduce the need for `for<'a>`

Seen [here](https://github.com/rust-lang/rfcs/pull/1598#issuecomment-2611378730). One possible syntax:

```rust
trait Iterable {
    type Iter<'a>: Iterator<Item = Self::Item<'a>>;
}

fn foo<T>() where T: Iterable, T::Item<let 'a>: Display { } //note the `let`!
```

### Better implied bounds on higher-ranked things

Currently if we have a `type Item<'a> where self: 'a`, and a `for<'a> T: Iterator<Item<'a> = &'a ()`, this requires `for<'a> Self: 'a`. Really, we want `for<'a where T: 'a> ...`

There was some mentions of this all the back in the RFC thread [here](https://github.com/rust-lang/rfcs/pull/1598#issuecomment-264340514).

## Alternatives

### Make generics on associated type in bounds a binder

Imagine the bound `for<'a> T: Trait<Item<'a>= &'a ()>`. It might be that `for<'a>` is "too large" and it should instead be `T: Trait<for<'a> Item<'a>= &'a ()>`. Brought up in RFC thread [here](https://github.com/rust-lang/rfcs/pull/1598#issuecomment-229443863) and in a few places since.

Another related question: Is `for<'a>` the right syntax? Maybe `where<'a>`? Also originally found in RFC thread [here](https://github.com/rust-lang/rfcs/pull/1598#issuecomment-261639969).

### Stabilize lifetime GATs first

This has been brought up a few times. The idea is to only allow GATs with lifetime parameters to in initial stabilization. This was probably most useful prior to actual implementation. At this point, lifetimes, types, and consts are all implemented and work. It feels like an arbitrary split without strong reason.

## History

* On 2016-04-30, [RFC opened](https://github.com/rust-lang/rfcs/pull/1598)
* On 2017-09-02, RFC merged and [tracking issue opened](https://github.com/rust-lang/rust/issues/44265)
* On 2017-10-23, [Move Generics from MethodSig to TraitItem and ImplItem](https://github.com/rust-lang/rust/pull/44766)
* On 2017-12-01, [Generic Associated Types Parsing & Name Resolution](https://github.com/rust-lang/rust/pull/45904)
* On 2017-12-15, [https://github.com/rust-lang/rust/pull/46706](https://github.com/rust-lang/rust/pull/46706)
* On 2018-04-23, [Feature gate where clauses on associated types](https://github.com/rust-lang/rust/pull/49368)
* On 2018-05-10, [Extend tests for RFC1598 (GAT)](https://github.com/rust-lang/rust/pull/49423)
* On 2018-05-24, [Finish implementing GATs (Chalk)](https://github.com/rust-lang/chalk/pull/134)
* On 2019-12-21, [Make GATs less ICE-prone](https://github.com/rust-lang/rust/pull/67160)
* On 2020-02-13, [fix lifetime shadowing check in GATs](https://github.com/rust-lang/rust/pull/68938)
* On 2020-06-20, [Projection bound validation](https://github.com/rust-lang/rust/pull/72788)
* On 2020-10-06, [Separate projection bounds and predicates](https://github.com/rust-lang/rust/pull/73905)
* On 2021-02-05, [Generic associated types in trait paths](https://github.com/rust-lang/rust/pull/79554)
* On 2021-02-06, [Trait objects do not work with generic associated types](https://github.com/rust-lang/rust/issues/81823)
* On 2021-04-28, [Make traits with GATs not object safe](https://github.com/rust-lang/rust/pull/84622)
* On 2021-05-11, [Improve diagnostics for GATs](https://github.com/rust-lang/rust/pull/82272)
* On 2021-07-16, [Make GATs no longer an incomplete feature](https://github.com/rust-lang/rust/pull/84623)
* On 2021-07-16, [Replace associated item bound vars with placeholders when projecting](https://github.com/rust-lang/rust/pull/86993)
* On 2021-07-26, [GATs: Decide whether to have defaults for `where Self: 'a`](https://github.com/rust-lang/rust/issues/87479)
* On 2021-08-25, [Normalize projections under binders](https://github.com/rust-lang/rust/pull/85499)
* On 2021-08-03, [The push for GATs stabilization](https://blog.rust-lang.org/2021/08/03/GATs-stabilization-push.html)
* On 2021-08-12, [Detect stricter constraints on gats where clauses in impls vs trait](https://github.com/rust-lang/rust/pull/88336)
* On 2021-09-20, [Proposal: Change syntax of where clauses on type aliases](https://github.com/rust-lang/rust/issues/89122)
* On 2021-11-06, [Implementation of GATs outlives lint](https://github.com/rust-lang/rust/pull/89970)
* On 2021-12-29. [Parse and suggest moving where clauses after equals for type aliases](https://github.com/rust-lang/rust/pull/92118)
* On 2022-01-15, [Ignore static lifetimes for GATs outlives lint](https://github.com/rust-lang/rust/pull/92865)
* On 2022-02-08, [Don't constrain projection predicates with inference vars in GAT substs](https://github.com/rust-lang/rust/pull/92917)
* On 2022-02-15, [Rework GAT where clause check](https://github.com/rust-lang/rust/pull/93820)
* On 2022-02-19, [Only mark projection as ambiguous if GAT substs are constrained](https://github.com/rust-lang/rust/pull/93892)
* On 2022-03-03, [Support GATs in Rustdoc](https://github.com/rust-lang/rust/pull/94009)
* On 2022-03-06, [Change location of where clause on GATs](https://github.com/rust-lang/rust/pull/90076)
* On 2022-05-04, [A shiny future with GATs blog post](https://jackh726.github.io/rust/2022/05/04/a-shiny-future-with-gats.html)
* On 2022-05-04, [Stabilization PR](https://github.com/rust-lang/rust/pull/96709)
2022-09-13 09:39:41 +00:00
Your Name
9025ab7a1f Add BE8 support 2022-09-13 08:27:48 +01:00
bors
c81575657c Auto merge of #100640 - reitermarkus:socket-display-buffer, r=thomcc
Use `DisplayBuffer` for socket addresses.

Continuation of https://github.com/rust-lang/rust/pull/100625 for socket addresses.

Renames `net::addr` to `net::addr::socket`, `net::ip` to `net::addr::ip` and `net::ip::display_buffer::IpDisplayBuffer` to `net::addr::display_buffer::DisplayBuffer`.
2022-09-13 06:41:37 +00:00
bors
9da4644d56 Auto merge of #100101 - BelovDV:issue-99429, r=petrochenkov
change rlib format to distinguish native dependencies

Another one method to solve problem mentioned in #99429.

Changed .rlib format, it contains all bundled native libraries as archieves.
At link time rlib is unpacked and native dependencies linked separately.
New behavior hidden under separate_native_rlib_dependencies flag.
2022-09-13 04:00:24 +00:00
Michael Goulet
cd962e66cf Don't render inline suggestions of only spaces 2022-09-13 03:52:43 +00:00
bors
0df1ddc185 Auto merge of #99556 - davidtwco:collapse-debuginfo, r=wesleywiser
ssa: implement `#[collapse_debuginfo]`

cc #39153 rust-lang/compiler-team#386

Debuginfo line information for macro invocations are collapsed by default - line information are replaced by the line of the outermost expansion site. Using `-Zdebug-macros` disables this behaviour.

When the `collapse_debuginfo` feature is enabled, the default behaviour is reversed so that debuginfo is not collapsed by default. In addition, the `#[collapse_debuginfo]` attribute is available and can be applied to macro definitions which will then have their line information collapsed.

r? rust-lang/wg-debugging
2022-09-13 01:19:05 +00:00
Eric Holk
3c2d20ef0b Make x.py check work 2022-09-12 17:29:11 -07:00
Michael Goulet
03148ff735 Make dyn-trait-method work 2022-09-12 16:56:00 -07:00
Michael Goulet
b2ed2dcaae Rename some variants 2022-09-12 16:55:59 -07:00
Michael Goulet
12ec2f0e34 Construct dyn* during const interp 2022-09-12 16:55:59 -07:00
Michael Goulet
12353c11ca Use principal of cast target as dyn-star trait ref in codegen 2022-09-12 16:55:58 -07:00
Eric Holk
c5441acf67 Call destructors when dyn* object goes out of scope 2022-09-12 16:55:57 -07:00
Eric Holk
549c105bb3 dyn* through more typechecking and MIR 2022-09-12 16:55:56 -07:00
Eric Holk
7fccac3ea0 Typecheck dyn* coercions
Also changes things to treat dyn* as a sized type, unlike dyn Trait.
2022-09-12 16:55:56 -07:00
Eric Holk
6c01273a15 Plumb dyn trait representation through ty::Dynamic 2022-09-12 16:55:55 -07:00