summary refs log tree commit diff
path: root/compiler/rustc_middle/src/ty
AgeCommit message (Collapse)AuthorLines
2022-10-29Add normalize hack backMichael Goulet-2/+13
2022-10-29Fix line numbers for MIR inlined codeWesley Wiser-1/+3
`should_collapse_debuginfo` detects if the specified span is part of a macro expansion however it does this by checking if the span is anything other than a normal (non-expanded) kind, then the span sequence is walked backwards to the root span. This doesn't work when the MIR inliner inlines code as it creates spans with expansion information set to `ExprKind::Inlined` and results in the line number being attributed to the inline callsite rather than the normal line number of the inlined code.
2022-10-06Revert "Auto merge of #101620 - cjgillot:compute_lint_levels_by_def, r=oli-obk"Camille GILLOT-5/+41
This reverts commit 2cb9a65684dba47c52de8fa938febf97a73e70a9, reversing changes made to 750bd1a7ff3e010611b97ee75d30b7cbf5f3a03c. (cherry picked from commit fc43df0333d5862a219f16d294ae38b14b9191d3)
2022-10-04Fix wrongly refactored Lift implOli Scherer-1/+4
(cherry picked from commit 3e6c9e5a194902ec6c8c26586fe6fa72dd624004)
2022-09-17Auto merge of #101857 - lcnr:make-dyn-again, r=jackh726bors-17/+13
change `FnMutDelegate` to trait objects cc #100016 as mentioned in the last t-compiler meeting r? `@jackh726`
2022-09-17Auto merge of #98588 - b-naber:valtrees-cleanup, r=lcnrbors-19/+29
Use only ty::Unevaluated<'tcx, ()> in type system r? `@lcnr`
2022-09-15Merge all `TypeVisitable for &List<T>` impls into one generic oneOli Scherer-27/+1
2022-09-15Replace more manual TypeFoldable and TypeVisitable impls with derivesOli Scherer-108/+14
2022-09-15change `FnMutDelegate` to trait objectslcnr-17/+13
2022-09-15Resolve a FIXMEOli Scherer-8/+4
2022-09-15derive various Lift impl instead of hand rolling themOli Scherer-355/+30
2022-09-15Auto merge of #101620 - cjgillot:compute_lint_levels_by_def, r=oli-obkbors-41/+5
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-14Auto merge of #101212 - eholk:dyn-star, r=compiler-errorsbors-20/+85
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-14Move some code and add comments.Camille GILLOT-39/+4
2022-09-14Compute `lint_levels` by definitionDeadbeef-14/+13
2022-09-14address review againb-naber-0/+11
2022-09-14Rollup merge of #101433 - jackh726:better-static-placeholder-error, ↵Dylan DPC-1/+15
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-14Auto merge of #101307 - jyn514:simplify-storage, r=cjgillotbors-2/+2
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-13Better errors for implied static boundJack Huey-1/+15
2022-09-13Address code review commentsEric Holk-6/+5
2022-09-13use ty::Unevaluated<'tcx, ()> in type systemb-naber-19/+18
2022-09-13Auto merge of #101615 - compiler-errors:rpitit-perf, r=oli-obkbors-1/+1
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-13Auto merge of #99556 - davidtwco:collapse-debuginfo, r=wesleywiserbors-1/+18
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-12Make dyn-trait-method workMichael Goulet-3/+16
2022-09-12Rename some variantsMichael Goulet-19/+13
2022-09-12Construct dyn* during const interpMichael Goulet-8/+2
2022-09-12Call destructors when dyn* object goes out of scopeEric Holk-3/+14
2022-09-12dyn* through more typechecking and MIREric Holk-2/+35
2022-09-12Typecheck dyn* coercionsEric Holk-2/+10
Also changes things to treat dyn* as a sized type, unlike dyn Trait.
2022-09-12Plumb dyn trait representation through ty::DynamicEric Holk-14/+27
2022-09-12Rollup merge of #100767 - kadiwa4:escape_ascii, r=jackh726Dylan DPC-8/+1
Remove manual <[u8]>::escape_ascii `@rustbot` label: +C-cleanup
2022-09-10Auto merge of #98559 - jackh726:remove-reempty, r=oli-obkbors-24/+3
Remove ReEmpty r? rust-lang/types
2022-09-10split compare_predicate_entailment and collect_trait_impl_trait_tys outMichael Goulet-1/+1
2022-09-09Make the `storage` query modifier less generalJoshua Nelson-2/+2
In practice, it was only ever used with `ArenaCacheSelector`. Change it to a single boolean `arena_cache` rather than allowing queries to specify an arbitrary type.
2022-09-09Rollup merge of #101573 - lcnr:param-kind-ord, r=BoxyUwUDylan DPC-2/+3
update `ParamKindOrd` https://github.com/rust-lang/rust/pull/90207#discussion_r767160854 :grin: writing comments "for future prs" sure works well :3 r? `@BoxyUwU`
2022-09-09Auto merge of #101603 - matthiaskrgr:rollup-8y6kf20, r=matthiaskrgrbors-3/+5
Rollup of 6 pull requests Successful merges: - #99207 (Enable eager checks for memory sanitizer) - #101253 (fix the suggestion of format for asm_sub_register) - #101450 (Add `const_extern_fn` to 1.62 release notes.) - #101556 (Tweak future opaque ty pretty printing) - #101563 (Link UEFI target documentation from target list) - #101593 (Cleanup themes (tooltip)) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-09-09Rollup merge of #101556 - compiler-errors:tweak-generator-print, r=jackh726Matthias Krüger-3/+5
Tweak future opaque ty pretty printing 1. The `Return` type of a generator doesn't need to be a lang item just for diagnostic printing of types 2. We shouldn't suppress the `Output = Ty` of a opaque future if the type is a int or float var.
2022-09-09Adjust pretty printing of RPITITsMichael Goulet-1/+7
2022-09-09Handle generic parameters.Camille GILLOT-1/+1
2022-09-09Deeply check that method signatures match, and allow for nested RPITITsMichael Goulet-0/+15
2022-09-09Lower RPITIT to ImplTraitPlaceholder itemMichael Goulet-3/+7
2022-09-08Remove ReEmptyJack Huey-16/+2
2022-09-08In ReverseMapper, don't fallback to ReEmpty, instead ReStaticJack Huey-8/+1
2022-09-08ptr: 43276834268743978Ellen-1/+14
2022-09-08Rollup merge of #101424 - compiler-errors:operator-err-sugg, r=TaKO8KiDylan DPC-1/+13
Adjust and slightly generalize operator error suggestion (in no particular order) * Stop passing around a whole extra `ProjectionPredicate` * Add spaces around `=` in `Trait<..., Output = Ty>` suggestion * Some code clean-ups, including * add `lang_item_for_op` to turn a `Op` into a `DefId` * avoid `SourceMap` because we don't really need to render an expr * Remove `TypeParamVisitor` in favor of just checking `ty.has_param_types_or_consts` -- this acts a bit differently, but shouldn't cause erroneous suggestions (actually might generalize them a bit) * We now suggest `Output = Ty` in the `where` clause suggestion when we fail to add `Struct<T>` and `T`. I can split this out into more PRs if needed, but they're all just miscellaneous generalizations, changes, and nitpicks I saw when messing with this operator code.
2022-09-08Rollup merge of #101041 - ↵Dylan DPC-1/+1
LuisCardosoOliveira:translation-rename-attr-warning-pt2, r=davidtwco translations(rustc_session): migrates rustc_session to use SessionDiagnostic - Pt. 2 # Description This is the second part of the `rustc_session` [migration](https://github.com/rust-lang/rust/issues/100717#issuecomment-1220279883). **Please only review this [commit](https://github.com/rust-lang/rust/pull/101041/commits/501858195734ec77f6b121ef753b03c40645df23) that belongs to the part 2. The other ones are from the PR [#100753](https://github.com/rust-lang/rust/pull/100753) that is not yet merged.** In this PR, we migrate the files `session.rs` and `config.rs`. Please not that we have to `allow` the lints rules in some functions from `session.rs` because they are (at least I believe) part of the diagnostic machinery.
2022-09-08Rollup merge of #98933 - oli-obk:opaque_type_late_bound_lifetimes, r=lcnrDylan DPC-1/+1
Opaque types' generic params do not imply anything about their hidden type's lifetimes fixes #97104 cc ```@aliemjay```
2022-09-08update `ParamKindOrd`lcnr-2/+3
2022-09-08Auto merge of #98900 - lcnr:region-stuff, r=jackh726bors-4/+1
const_generics: correctly deal with bound variables removes the hack in `resolve` which was needed because we evaluated constants without caring about their bound variables. Each commit should be fairly self-contained, even if they build on each other r? `@jackh726`
2022-09-08don't evaluate with escaping bound varslcnr-0/+1