Commit Graph

17270 Commits

Author SHA1 Message Date
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
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
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
Eric Holk
eff35e59c6 Introduce dyn_star feature flag
The primary purpose of this commit is to introduce the
dyn_star flag so we can begin experimenting with implementation.

In order to have something to do in the feature gate test, we also add
parser support for `dyn* Trait` objects. These are currently treated
just like `dyn Trait` objects, but this will change in the future.

Note that for now `dyn* Trait` is experimental syntax to enable
implementing some of the machinery needed for async fn in dyn traits
without fully supporting the feature.
2022-09-12 16:55:55 -07:00
Michael Goulet
c2cff68d84 Don't trim substitution if it's only whitespace 2022-09-12 22:08:30 +00:00
Michael Goulet
370c816a71 A SubstitutionPart is not a deletion if it replaces nothing with nothing 2022-09-12 22:08:30 +00:00
Daniel Paoliello
3c184db386 Fix raw-dylib with link_name 2022-09-12 14:03:19 -07:00
Guillaume Gomez
ac92cc861c
Rollup merge of #101732 - Nemo157:gate-rustdoc-missing-examples, r=GuillaumeGomez
Feature gate the `rustdoc::missing_doc_code_examples` lint

Moves the lint from being implicitly active on nightly `rustdoc` to requiring a feature to activate, like other unstable lints.

Uses the new tracking issue https://github.com/rust-lang/rust/issues/101730
2022-09-12 22:47:18 +02:00
Guillaume Gomez
8dc4b26b60
Rollup merge of #101723 - lukas-code:await-diag, r=compiler-errors
Impove diagnostic for `.await`ing non-futures

Strip leading whitespace from the span and use a non-verbose suggestion.
fixes #101715
2022-09-12 22:47:15 +02:00
Guillaume Gomez
b7504d6f4f
Rollup merge of #100185 - compiler-errors:issue-100183, r=wesleywiser
Fix `ReErased` leaking into typeck due to `typeof(...)` recovery

Fixes #100183
2022-09-12 22:47:13 +02:00
Wim Looman
72cf46aa72
Feature gate the rustdoc::missing_doc_code_examples lint 2022-09-12 21:20:24 +02:00
Guillaume Gomez
c4559ebfde
Improve Attribute doc methods 2022-09-12 21:18:59 +02:00
Wim Looman
fd1a399c4f
Allow tool-lints to specify a feature-gate too 2022-09-12 20:08:58 +02:00
Markus Reiter
14230a7f8e
Simplify clippy fix. 2022-09-12 19:46:51 +02:00