summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis/src/astconv
AgeCommit message (Collapse)AuthorLines
2023-05-26print const and type errors in braces not square bracketsBoxy-1/+1
2023-05-24Use `Option::is_some_and` and `Result::is_ok_and` in the compilerMaybe Waffle-3/+3
2023-05-18Rollup merge of #111633 - nnethercote:avoid-ref-format, r=WaffleLapkinDylan DPC-2/+2
Avoid `&format("...")` calls in error message code. Some error message cleanups. Best reviewed one commit at a time. r? `@davidtwco`
2023-05-17Rollup merge of #111588 - MU001999:diag/improve-e0782, r=fee1-deadDylan DPC-4/+3
Emits E0599 when meeting `MyTrait::missing_method` Fixes #111312
2023-05-17Emits E0599 when meeting MyTrait::missing_methodmu001999-4/+3
2023-05-16Avoid `&format("...")` calls in error message code.Nicholas Nethercote-2/+2
Error message all end up passing into a function as an `impl Into<{D,Subd}iagnosticMessage>`. If an error message is creatd as `&format("...")` that means we allocate a string (in the `format!` call), then take a reference, and then clone (allocating again) the reference to produce the `{D,Subd}iagnosticMessage`, which is silly. This commit removes the leading `&` from a lot of these cases. This means the original `String` is moved into the `{D,Subd}iagnosticMessage`, avoiding the double allocations. This requires changing some function argument types from `&str` to `String` (when all arguments are `String`) or `impl Into<{D,Subd}iagnosticMessage>` (when some arguments are `String` and some are `&str`).
2023-05-14Rename const error methods for consistencyMichael Goulet-4/+4
2023-05-08Rollup merge of #109410 - fmease:iat-alias-kind-inherent, r=compiler-errorsMichael Goulet-26/+35
Introduce `AliasKind::Inherent` for inherent associated types Allows us to check (possibly generic) inherent associated types for well-formedness. Type inference now also works properly. Follow-up to #105961. Supersedes #108430. Fixes #106722. Fixes #108957. Fixes #109768. Fixes #109789. Fixes #109790. ~Not to be merged before #108860 (`AliasKind::Weak`).~ CC `@jackh726` r? `@compiler-errors` `@rustbot` label T-types F-inherent_associated_types
2023-05-07Auto merge of #111161 - compiler-errors:rtn-super, r=cjgillotbors-8/+49
Support return-type bounds on associated methods from supertraits Support `T: Trait<method(): Bound>` when `method` comes from a supertrait, aligning it with the behavior of associated type bounds (both equality and trait bounds). The only wrinkle is that I have to extend `super_predicates_that_define_assoc_type` to look for *all* items, not just `AssocKind::Ty`. This will also be needed to support `feature(associated_const_equality)` as well, which is subtly broken when it comes to supertraits, though this PR does not fix those yet. There's a slight chance there's a perf regression here, in which case I guess I could split it out into a separate query.
2023-05-04IAT: Introduce AliasKind::InherentLeón Orell Valerian Liehr-26/+35
2023-05-04Auto merge of #110806 - WaffleLapkin:unmkI, r=lcnrbors-2/+2
Replace `tcx.mk_trait_ref` with `TraitRef::new` First step in implementing https://github.com/rust-lang/compiler-team/issues/616 r? `@lcnr`
2023-05-03Error message for ambiguous RTN from super boundsMichael Goulet-2/+10
2023-05-03Rename things to reflect that they're not item specificMichael Goulet-3/+3
2023-05-03Support RTN on associated methods from supertraitsMichael Goulet-5/+38
2023-05-04Rollup merge of #110791 - compiler-errors:negative-bounds, r=oli-obkDylan DPC-5/+29
Implement negative bounds for internal testing purposes Implements partial support the `!` negative polarity on trait bounds. This is incomplete, but should allow us to at least be able to play with the feature. Not even gonna consider them as a public-facing feature, but I'm implementing them because would've been nice to have in UI tests, for example in #110671.
2023-05-03Restrict `From<S>` for `{D,Subd}iagnosticMessage`.Nicholas Nethercote-40/+40
Currently a `{D,Subd}iagnosticMessage` can be created from any type that impls `Into<String>`. That includes `&str`, `String`, and `Cow<'static, str>`, which are reasonable. It also includes `&String`, which is pretty weird, and results in many places making unnecessary allocations for patterns like this: ``` self.fatal(&format!(...)) ``` This creates a string with `format!`, takes a reference, passes the reference to `fatal`, which does an `into()`, which clones the reference, doing a second allocation. Two allocations for a single string, bleh. This commit changes the `From` impls so that you can only create a `{D,Subd}iagnosticMessage` from `&str`, `String`, or `Cow<'static, str>`. This requires changing all the places that currently create one from a `&String`. Most of these are of the `&format!(...)` form described above; each one removes an unnecessary static `&`, plus an allocation when executed. There are also a few places where the existing use of `&String` was more reasonable; these now just use `clone()` at the call site. As well as making the code nicer and more efficient, this is a step towards possibly using `Cow<'static, str>` in `{D,Subd}iagnosticMessage::{Str,Eager}`. That would require changing the `From<&'a str>` impls to `From<&'static str>`, which is doable, but I'm not yet sure if it's worthwhile.
2023-05-02Make negative trait bounds work with the old trait solverMichael Goulet-0/+10
2023-05-02Disallow associated type constraints on negative boundsMichael Goulet-2/+0
2023-05-02Implement negative boundsMichael Goulet-5/+21
2023-05-01Do not consider associated type bounds for ↵Michael Goulet-5/+52
super_predicates_that_define_assoc_type
2023-05-01Simplify type_parameter_bounds_in_genericsMichael Goulet-11/+6
2023-04-27rename `needs_subst` to `has_param`Boxy-1/+1
2023-04-27rename `needs_infer` to `has_infer`Boxy-2/+2
2023-04-25Replace `tcx.mk_trait_ref` with `ty::TraitRef::new`Maybe Waffle-2/+2
2023-04-20Feed type_of query instead of using WithOptconstParam.Camille GILLOT-8/+3
2023-04-17Spelling - compilerJosh Soref-1/+1
* account * achieved * advising * always * ambiguous * analysis * annotations * appropriate * build * candidates * cascading * category * character * clarification * compound * conceptually * constituent * consts * convenience * corresponds * debruijn * debug * debugable * debuggable * deterministic * discriminant * display * documentation * doesn't * ellipsis * erroneous * evaluability * evaluate * evaluation * explicitly * fallible * fulfill * getting * has * highlighting * illustrative * imported * incompatible * infringing * initialized * into * intrinsic * introduced * javascript * liveness * metadata * monomorphization * nonexistent * nontrivial * obligation * obligations * offset * opaque * opportunities * opt-in * outlive * overlapping * paragraph * parentheses * poisson * precisely * predecessors * predicates * preexisting * propagated * really * reentrant * referent * responsibility * rustonomicon * shortcircuit * simplifiable * simplifications * specify * stabilized * structurally * suggestibility * translatable * transmuting * two * unclosed * uninhabited * visibility * volatile * workaround Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-04-13Rollup merge of #110195 - compiler-errors:issue-110052, r=aliemjayMatthias Krüger-14/+6
Erase lifetimes above `ty::INNERMOST` when probing ambiguous types Turns out that `TyCtxt::replace_escaping_bound_vars_uncached` only erases bound vars exactly at `ty::INNERMOST`, and not everything above. This regresses the suggestions for non-lifetime binders, but oh well, I don't really care about those. Fixes #110052
2023-04-11Allow the elaborator to only filter to real supertraitsMichael Goulet-31/+37
2023-04-11Erase lifetimes above ty::INNERMOST when probing ambiguous typesMichael Goulet-14/+6
2023-04-10rustc_metadata: Filter encoded data more aggressively using `DefKind`Vadim Petrochenkov-1/+1
2023-04-09Auto merge of #110031 - compiler-errors:generic-elaboration, r=b-naberbors-3/+3
Make elaboration generic over input Combines all the `elaborate_*` family of functions into just one, which is an iterator over the same type that you pass in (e.g. elaborating `Predicate` gives `Predicate`s, elaborating `Obligation`s gives `Obligation`s, etc.)
2023-04-06Use BoundTy and BoundRegion instead of kind of PlaceholderTy and ↵Jack Huey-4/+4
PlaceholderRegion
2023-04-06Get rid of elaborate_trait_ref{s} tooMichael Goulet-3/+3
2023-04-01fix clippy::iter_kv_mapMatthias Krüger-2/+2
2023-03-28Add `(..)` syntax for RTNMichael Goulet-8/+16
2023-03-28Add tests and error messagesMichael Goulet-9/+19
2023-03-28Compute bound vars correctlyMichael Goulet-16/+55
2023-03-28RTNMichael Goulet-50/+103
2023-03-26Don't elaborate non-obligations into obligationsMichael Goulet-6/+3
2023-03-23Auto merge of #109517 - matthiaskrgr:rollup-m3orqzd, r=matthiaskrgrbors-1/+1
Rollup of 7 pull requests Successful merges: - #108541 (Suppress `opaque_hidden_inferred_bound` for nested RPITs) - #109137 (resolve: Querify most cstore access methods (subset 2)) - #109380 (add `known-bug` test for unsoundness issue) - #109462 (Make alias-eq have a relation direction (and rename it to alias-relate)) - #109475 (Simpler checked shifts in MIR building) - #109504 (Stabilize `arc_into_inner` and `rc_into_inner`.) - #109506 (make param bound vars visibly bound vars with -Zverbose) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-03-23Rename AliasEq -> AliasRelateMichael Goulet-1/+1
2023-03-22Rollup merge of #109423 - fmease:iat-selection-erase-regions-in-self-ty, ↵Matthias Krüger-31/+51
r=compiler-errors Use region-erased self type during IAT selection Split off from #109410 as discussed. Fixes #109299. Re UI test: I use a reproducer of #109299 that contains a name resolution error instead of reproducer [`regionck-2.rs`](https://github.com/rust-lang/rust/blob/fc7ed4af165c27ab5914b93251194f826920cc65/tests/ui/associated-inherent-types/regionck-2.rs) (as found in the `AliasKind::Inherent` PR) since it would (incorrectly) pass typeck in this PR due to the lack of regionck and I'd rather not make *that* a regression test (with or without `known-bug`). ``@rustbot`` label F-inherent_associated_types r? ``@compiler-errors``
2023-03-21iat selection: erase regions in self typeLeón Orell Valerian Liehr-31/+51
2023-03-21Use LocalDefId in ItemCtxtMichael Goulet-4/+3
2023-03-20Rollup merge of #109277 - spastorino:new-rpitit-14, r=compiler-errorsMatthias Krüger-2/+6
Fix generics_of for impl's RPITIT synthesized associated type The only useful commit is the last one. This makes `generics_of` for the impl side RPITIT copy from the trait's associated type and avoid the fn on the impl side which was previously wrongly used. This solution is better but we still need to fix resolution of the generated generics. r? ``@compiler-errors``
2023-03-20Update some names and commentsMichael Goulet-1/+1
2023-03-18Rollup merge of #107416 - czzrr:issue-80618, r=GuillaumeGomezMatthias Krüger-1/+1
Error code E0794 for late-bound lifetime parameter error. This PR addresses [#80618](https://github.com/rust-lang/rust/issues/80618).
2023-03-18Rollup merge of #109200 - compiler-errors:issue-109191, r=WaffleLapkinMatthias Krüger-3/+6
Fix index out of bounds in `suggest_trait_fn_ty_for_impl_fn_infer` Fixes #109191
2023-03-17Fix impl_trait_ty_to_ty substsSantiago Pastorino-2/+6
2023-03-17Erase escaping late-bound regions when probing for ambiguous associated typesMichael Goulet-3/+14