summary refs log tree commit diff
path: root/compiler/rustc_middle/src/ty
AgeCommit message (Collapse)AuthorLines
2023-01-21Encode whether foreign opaques are TAITs or notMichael Goulet-0/+1
2023-01-19Do not filter substs in `remap_generic_params_to_declaration_params`.Camille GILLOT-26/+1
The relevant filtering should have been performed by borrowck.
2022-12-08Rollup merge of #105423 - oli-obk:symbols, r=jackh726Matthias Krüger-2/+2
Use `Symbol` for the crate name instead of `String`/`str` It always got converted to a symbol anyway
2022-12-08Rollup merge of #104922 - estebank:fur-elize, r=oli-obkMatthias Krüger-11/+20
Detect long types in E0308 and write them to disk On type error with long types, print an abridged type and write the full type to disk. Print the widest possible short type while still fitting in the terminal.
2022-12-07Use `Symbol` for the crate name instead of `String`/`str`Oli Scherer-2/+2
2022-12-07Rollup merge of #105267 - compiler-errors:issue-104613, r=oli-obkMatthias Krüger-4/+8
Don't ICE in ExprUseVisitor on FRU for non-existent struct Fixes #104613 Fixes #105202
2022-12-06Rollup merge of #104898 - oli-obk:group_all_the_things, r=wesleywiserMatthias Krüger-167/+52
Put all cached values into a central struct instead of just the stable hash cc `@nnethercote` this allows re-use of the type for Predicate without duplicating all the logic for the non-hash cached fields
2022-12-06Rollup merge of #105342 - compiler-errors:note_cause_code-takes-predicate, ↵Matthias Krüger-9/+9
r=fee1-dead Make `note_obligation_cause_code` take a `impl ToPredicate` for predicate The only usecase that wasn't `impl ToPredicate` was noting overflow errors while revealing opaque types, which passed in an `Obligation<'tcx, Ty<'tcx>>`... Since this only happens in a `RevealAll` environment, which is after typeck (and probably primarily within `normalize_erasing_regions`) we're unlikely to display anything useful while noting this code, evidenced by the lack of UI test changes.
2022-12-06Rollup merge of #105287 - compiler-errors:issue-105275, r=eholkMatthias Krüger-2/+41
Synthesize substitutions for bad auto traits in dyn types Auto traits are stored as just `DefId`s inside a `dyn Trait`'s existential predicates list. This is usually fine, since auto traits are forbidden to have generics -- but this becomes a problem for an ill-formed auto trait. But since this will always result in an error, just synthesize some dummy (error) substitutions which are used at least to keep trait selection code happy about the number of substs in a trait ref. Fixes #104808
2022-12-06Add GenericParamDef::to_error and InternalSubsts::extend_with_errorMichael Goulet-13/+32
2022-12-06drive-by: Default param for ToPredicateMichael Goulet-9/+9
2022-12-05feed resolver_for_lowering instead of storing it in a fieldOli Scherer-13/+24
2022-12-05Allow arbitrary keys in feeding APIOli Scherer-12/+19
2022-12-05Synthesize generics for bad auto traits in dyn typesMichael Goulet-2/+22
2022-12-04drive-by: move field_index to typeck resultsMichael Goulet-4/+8
2022-12-01Fill in `def_span` when creating def ids.Oli Scherer-1/+7
This makes sure that ICEing because of def ids created outside of ast lowering will be able to produce a query backtrace and not cause a double panic because of trying to call the `def_span` query
2022-12-01Don't allow feeding a query cache entry twiceOli Scherer-4/+2
2022-12-01Auto merge of #105095 - matthiaskrgr:rollup-9pu7vrx, r=matthiaskrgrbors-0/+6
Rollup of 9 pull requests Successful merges: - #103065 (rustdoc-json: Document and Test that args can be patterns.) - #104865 (Don't overwrite local changes when updating submodules) - #104895 (Avoid Invalid code suggested when encountering unsatisfied trait bounds in derive macro code) - #105063 (Rustdoc Json Tests: Don't assume that core::fmt::Debug will always have one item.) - #105064 (rustdoc: add comment to confusing CSS `main { min-width: 0 }`) - #105074 (Add Nicholas Bishop to `.mailmap`) - #105081 (Add a regression test for #104322) - #105086 (rustdoc: clean up sidebar link CSS) - #105091 (add Tshepang Mbambo to .mailmap) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-11-30Rollup merge of #104895 - chenyukang:yukang/fix-104884-serde, r=TaKO8KiMatthias Krüger-0/+6
Avoid Invalid code suggested when encountering unsatisfied trait bounds in derive macro code Fixes #104884
2022-11-30Auto merge of #104940 - cjgillot:query-feed-simple, r=oli-obkbors-10/+86
Allow to feed a value in another query's cache Restricted version of https://github.com/rust-lang/rust/pull/96840 A query can create new definitions. If those definitions are created after HIR lowering, they do not appear in the initial HIR map, and information for them cannot be provided in the normal pull-based way. In order to make those definitions useful, we allow to feed values as query results for the newly created definition. The API is as follows: ```rust let feed = tcx.create_def(<parent def id>, <DefPathData>); // `feed` is a TyCtxtFeed<'tcx>. // Access the created definition. let def_id: LocalDefId = feed.def_id; // Assign `my_query(def_id) := my_value`. feed.my_query(my_value). ``` This PR keeps the consistency checks introduced by https://github.com/rust-lang/rust/pull/96840, even if they are not reachable. This allows to extend the behaviour later without forgetting them. cc `@oli-obk` `@spastorino`
2022-11-30Generalize some InternedInSet implsOli Scherer-36/+6
2022-11-30Remove PredicateS typeOli Scherer-51/+27
2022-11-30Update documentationOli Scherer-4/+4
2022-11-30Remove TySOli Scherer-94/+29
2022-11-30move WithCachedTypeInfo to rustc_type_irOli Scherer-3/+6
2022-11-30s/WithStableHash/WithCachedTypeInfo/Oli Scherer-32/+33
2022-11-30Auto merge of #105070 - matthiaskrgr:rollup-9b25khj, r=matthiaskrgrbors-2/+18
Rollup of 14 pull requests Successful merges: - #103876 (type alias impl trait: add tests showing that hidden type only outlives lifetimes that occur in bounds) - #104427 (Explain why `rematch_impl` fails to be infallible) - #104436 (Add slice to the stack allocated string comment) - #104523 (Don't use periods in target names) - #104627 (Print all features with --print target-features) - #104911 (Make inferred_outlives_crate return Clause) - #105002 (Add `PathBuf::as_mut_os_string` and `Path::as_mut_os_str`) - #105023 (Statics used in reachable function's inline asm are reachable) - #105045 (`rustc_ast_{passes,pretty}`: remove `ref` patterns) - #105049 (Hermit: Minor build fixes) - #105051 (Replace a macro with a function) - #105062 (rustdoc: use shorthand background for rustdoc toggle CSS) - #105066 (move `candidate_from_obligation` out of assembly) - #105068 (Run patchelf also on rust-analyzer-proc-macro-srv.) Failed merges: - #105050 (Remove useless borrows and derefs) r? `@ghost` `@rustbot` modify labels: rollup
2022-11-29Rollup merge of #104911 - spastorino:inferred_outlives_crate-return-clause, ↵Matthias Krüger-2/+18
r=oli-obk Make inferred_outlives_crate return Clause r? ``@oli-obk``
2022-11-29Auto merge of #94487 - oli-obk:stable_hash_ty, r=fee1-deadbors-27/+58
Also cache the stable hash of interned Predicates continuation of https://github.com/rust-lang/rust/pull/94299 This is a small perf improvement and shares more code between `Ty` and `Predicate`
2022-11-29Make TyCtxtFeed::def_id private.Camille GILLOT-5/+12
2022-11-29Feedable queries must allow hashing.Camille GILLOT-13/+1
2022-11-29Only allow feeding a value to newly created definitions.Camille GILLOT-27/+40
2022-11-29Allow to set a query's result as a side effect.Camille GILLOT-0/+68
2022-11-29Make inferred_outlives_crate return ClauseSantiago Pastorino-2/+18
2022-11-29Auto merge of #105012 - WaffleLapkin:into, r=oli-obkbors-46/+29
Make `tcx.mk_const` more permissive wrt `kind` argument (`impl Into`) r? `@oli-obk` you've asked for this >:)
2022-11-29fix #104884, Avoid Invalid code suggested when encountering unsatisfied ↵yukang-0/+6
trait bounds in derive macro code
2022-11-29Rollup merge of #104951 - Swatinem:async-kind, r=compiler-errorsMatthias Krüger-0/+5
Simplify checking for `GeneratorKind::Async` Adds a helper method around `generator_kind` that makes matching async constructs simpler.
2022-11-28Simplify checking for `GeneratorKind::Async`Arpad Borsos-0/+5
Adds a helper method around `generator_kind` that makes matching async constructs simpler.
2022-11-28Further tweak the type shortening logicEsteban Küber-2/+3
2022-11-28Detect long types in E0308 and write them to diskEsteban Küber-10/+18
On type error with long types, print an abridged type and write the full type to disk. Print the widest possible short type while still fitting in the terminal.
2022-11-28Remove `Const::from_scalar_int`Maybe Waffle-6/+4
2022-11-28Remove `Const::from_value`Maybe Waffle-12/+4
...it's just `mk_const` but without the sparcles
2022-11-28Simplify calls to `tcx.mk_const`Maybe Waffle-8/+5
`mk_const(ty::ConstKind::X(...), ty)` can now be simplified to `mk_cosnt(..., ty)`. I searched with the following regex: \mk_const\([\n\s]*(ty::)?ConstKind\ I've left `ty::ConstKind::{Bound, Error}` as-is, they seem clearer this way.
2022-11-28Remove `tcx.mk_const_var`Maybe Waffle-20/+8
... `tcx.mk_const` can now be used instead
2022-11-28Make `tcx.mk_const` more permissive wrt `kind` argumentMaybe Waffle-2/+10
- Accept `impl Into` - Implement `From<>` for `ConstKind` Note: this adds a dependency on `derive_more` (MIT license). It allows to derive a lot of traits (like `From` here) that would be otherwise tedious to implement.
2022-11-28Rollup merge of #104891 - fee1-dead-contrib:escaping_bound_vars_docs, ↵Matthias Krüger-1/+7
r=wesleywiser Add documentation for `has_escaping_bound_vars` Thanks to `@BoxyUwU` for explaining this to me. Adding docs with a helpful link if people get confused.
2022-11-28Rollup merge of #104804 - nnethercote:MetaItemLit, r=petrochenkovMatthias Krüger-2/+3
Rename `ast::Lit` as `ast::MetaItemLit`. And some other literal cleanups. r? `@petrochenkov`
2022-11-28Rollup merge of #104927 - compiler-errors:binder-shifting-logic, r=oli-obkDylan DPC-23/+24
Simplify some binder shifting logic Not sure if worth, but we'll see
2022-11-28Rollup merge of #104890 - lcnr:small-cleanup, r=fee1-deadDylan DPC-4/+1
small method code cleanup
2022-11-28Rollup merge of #104732 - WaffleLapkin:from_def_idn't, r=compiler-errorsDylan DPC-34/+16
Refactor `ty::ClosureKind` related stuff I've tried to fix all duplication and weirdness, but if I missed something do tell :p r? `@compiler-errors`