about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis/src/collect
AgeCommit message (Collapse)AuthorLines
2023-05-22Check opaques for mismatch during writebackMichael Goulet-4/+5
2023-05-16Avoid `&format("...")` calls in error message code.Nicholas Nethercote-6/+6
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-15Move expansion of query macros in rustc_middle to rustc_middle::queryJohn Kåre Alsaker-2/+3
2023-05-12Require `impl Trait` in associated types to appear in method signaturesOli Scherer-7/+12
2023-05-09Rollup merge of #111215 - BoxyUwU:resolve_anon_consts_differently, r=cjgillotMatthias Krüger-14/+17
Various changes to name resolution of anon consts Sorry this PR is kind of all over the place ^^' Fixes #111012 - Rewrites anon const nameres to all go through `fn resolve_anon_const` explicitly instead of `visit_anon_const` to ensure that we do not accidentally resolve anon consts as if they are allowed to use generics when they aren't. Also means that we dont have bits of code for resolving anon consts that will get out of sync (i.e. legacy const generics and resolving path consts that were parsed as type arguments) - Renames two of the `LifetimeRibKind`, `AnonConst -> ConcreteAnonConst` and `ConstGeneric -> ConstParamTy` - Noticed while doing this that under `generic_const_exprs` all lifetimes currently get resolved to errors without any error being emitted which was causing a bunch of tests to pass without their bugs having been fixed, incidentally fixed that in this PR and marked those tests as `// known-bug:`. I'm fine to break those since `generic_const_exprs` is a very unstable incomplete feature and this PR _does_ make generic_const_exprs "less broken" as a whole, also I can't be assed to figure out what the underlying causes of all of them are. This PR reopens #77357 #83993 - Changed `generics_of` to stop providing generics and predicates to enum variant discriminant anon consts since those are not allowed to use generic parameters - Updated the error for non 'static lifetime in const arguments and the error for non 'static lifetime in const param tys to use `derive(Diagnostic)` I have a vague idea why const-arg-in-const-arg.rs, in-closure.rs and simple.rs have started failing which is unfortunate since these were deliberately made to work, I think lifetime resolution being broken just means this regressed at some point and nobody noticed because the tests were not testing anything :( I'm fine breaking these too for the same reason as the tests for #77357 #83993. I couldn't get `// known-bug` to work for these ICEs and just kept getting different stderr between CI and local `--bless` so I just removed them and will create an issue to track re-adding (and fixing) the bugs if this PR lands. r? `@cjgillot` cc `@compiler-errors`
2023-05-08Rollup merge of #109410 - fmease:iat-alias-kind-inherent, r=compiler-errorsMichael Goulet-2/+2
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-08Rollup merge of #111211 - compiler-errors:negative-bounds-super, r=TaKO8KiYuki Okushi-5/+6
Don't compute trait super bounds unless they're positive Fixes #111207 The comment is modified to explain the rationale for why we even have this recursive call to supertraits in the first place, which doesn't apply to negative bounds since they don't elaborate at all.
2023-05-08Auto merge of #106621 - ozkanonur:enable-elided-lifetimes-for-doctests, ↵bors-1/+1
r=Mark-Simulacrum enable `rust_2018_idioms` lint group for doctests With this change, `rust_2018_idioms` lint group will be enabled for compiler/libstd doctests. Resolves #106086 Resolves #99144 Signed-off-by: ozkanonur <work@onurozkan.dev>
2023-05-07enable `rust_2018_idioms` for doctestsozkanonur-1/+1
Signed-off-by: ozkanonur <work@onurozkan.dev>
2023-05-05misc nameres changes for anon constsBoxy-14/+17
2023-05-04Don't compute trait super bounds unless they're positiveMichael Goulet-5/+6
2023-05-04IAT: Introduce AliasKind::InherentLeón Orell Valerian Liehr-2/+2
2023-05-03Rename things to reflect that they're not item specificMichael Goulet-6/+6
2023-05-03Support RTN on associated methods from supertraitsMichael Goulet-21/+31
2023-05-03Restrict `From<S>` for `{D,Subd}iagnosticMessage`.Nicholas Nethercote-5/+5
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-01Don't use implied trait predicates in gather_explicit_predicates_ofMichael Goulet-6/+11
2023-05-01Do not consider associated type bounds for ↵Michael Goulet-10/+14
super_predicates_that_define_assoc_type
2023-05-01Simplify type_parameter_bounds_in_genericsMichael Goulet-42/+28
2023-04-26Rollup merge of #108760 - clubby789:autolintstuff, r=wesleywiserMatthias Krüger-7/+3
Add lint to deny diagnostics composed of static strings r? ghost I'm hoping to have a lint that semi-automatically converts simple diagnostics such as `struct_span_err(span, "msg").help("msg").span_note(span2, "msg").emit()` to typed session diagnostics. It's quite hacky and not entirely working because of problems with `x fix` but should hopefully help reduce some of the work. I'm going to start trying to apply what I can from this, but opening this as a draft in case anyone wants to develop on it. cc #100717
2023-04-25Rollup merge of #110556 - kylematsuda:earlybinder-explicit-item-bounds, ↵Matthias Krüger-10/+12
r=compiler-errors Switch to `EarlyBinder` for `explicit_item_bounds` Part of the work to finish https://github.com/rust-lang/rust/issues/105779. This PR adds `EarlyBinder` to the return type of the `explicit_item_bounds` query and removes `bound_explicit_item_bounds`. r? `@compiler-errors` (hope it's okay to request you, since you reviewed #110299 and #110498 :smiley:)
2023-04-25Fix static string lintsclubby789-7/+3
2023-04-20add EarlyBinder to output of explicit_item_bounds; replace ↵Kyle Matsuda-6/+7
bound_explicit_item_bounds usages; remove bound_explicit_item_bounds query
2023-04-20change usages of explicit_item_bounds to bound_explicit_item_boundsKyle Matsuda-5/+6
2023-04-20Remove opt_const_param_of.Camille GILLOT-158/+94
2023-04-20Remove WithOptconstParam.Camille GILLOT-1/+0
2023-04-19Rollup merge of #110498 - kylematsuda:earlybinder-rpitit-tys, r=compiler-errorsMatthias Krüger-1/+1
Switch to `EarlyBinder` for `collect_return_position_impl_trait_in_trait_tys` Part of the work to finish https://github.com/rust-lang/rust/issues/105779. This PR adds `EarlyBinder` to the return type of the `collect_return_position_impl_trait_in_trait_tys` query and removes `bound_return_position_impl_trait_in_trait_tys`. r? `@lcnr`
2023-04-18add EarlyBinder to return type of ↵Kyle Matsuda-1/+1
collect_return_position_impl_trait_in_trait_tys query; remove bound_X version
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-15fix clippy::{clone_on_copy, useless_conversion}Matthias Krüger-3/+2
2023-04-13Remove some unused type folders.Nicholas Nethercote-26/+1
I'm surprised the compiler doesn't warn about these. It appears having an `impl` on a struct is enough to avoid a warning about it never being constructed.
2023-04-11Split implied and super predicate queriesMichael Goulet-32/+81
2023-04-11Split super_predicates_that_define_assoc_type query from super_predicates_ofMichael Goulet-2/+1
2023-04-06Make elaborator genericMichael Goulet-1/+1
2023-03-28Add `(..)` syntax for RTNMichael Goulet-2/+2
2023-03-28Compute bound vars correctlyMichael Goulet-1/+53
2023-03-26Don't elaborate non-obligations into obligationsMichael Goulet-7/+4
2023-03-23Rollup merge of #109280 - compiler-errors:no-vec-map, r=Mark-SimulacrumDylan DPC-1/+1
Remove `VecMap` Not sure what the use of this data structure is over just using `FxIndexMap` or a `Vec`. r? ```@ghost```
2023-03-21IdentitySubsts::identity_for_item takes Into<DefId>Michael Goulet-11/+11
2023-03-21Use LocalDefId in ItemCtxtMichael Goulet-73/+76
2023-03-21Use local key in providersMichael Goulet-36/+41
2023-03-21Rollup merge of #109385 - lcnr:typo, r=Dylan-DPCnils-1/+1
fix typo
2023-03-20fix typolcnr-1/+1
2023-03-19Reformat type_ofMichael Goulet-23/+30
2023-03-19Only expect a GAT const argMichael Goulet-5/+10
2023-03-17Remove VecMapMichael Goulet-1/+1
2023-03-16Install projection from RPITIT to default trait method opaque correctlyMichael Goulet-14/+22
2023-03-13Don't ICE for late-bound consts across AnonConstBoundaryMichael Goulet-7/+7
2023-03-12Auto merge of #108700 - spastorino:new-rpitit-impl-side-2, r=compiler-errorsbors-12/+43
Make RPITITs simple cases work when using lower_impl_trait_in_trait_to_assoc_ty r? `@compiler-errors` It's probably best reviewed commit by commit.
2023-03-06Implement type_of for RPITITs assoc typeSantiago Pastorino-1/+20
2023-03-06Properly implement explicit_item_bounds for RPITITs trait assoc tySantiago Pastorino-11/+23