about summary refs log tree commit diff
path: root/compiler/rustc_infer/src/traits
AgeCommit message (Collapse)AuthorLines
2023-12-23Give `DiagnosticBuilder` a default type.Nicholas Nethercote-3/+3
`IntoDiagnostic` defaults to `ErrorGuaranteed`, because errors are the most common diagnostic level. It makes sense to do likewise for the closely-related (and much more widely used) `DiagnosticBuilder` type, letting us write `DiagnosticBuilder<'a, ErrorGuaranteed>` as just `DiagnosticBuilder<'a>`. This cuts over 200 lines of code due to many multi-line things becoming single line things.
2023-12-14update use of feature flagslcnr-1/+1
2023-12-07add unused `NormalizesTo` predicatelcnr-44/+26
2023-11-26move comment about local traitRyan Mehri-1/+2
2023-11-26don't add redundant help for object safety violationsRyan Mehri-3/+9
2023-11-21Remove ClosureKind predicate kindMichael Goulet-3/+0
2023-11-19Make regionck care about placeholders in outlives componentsMichael Goulet-0/+5
2023-11-13rename `ReLateBound` to `ReBound`lcnr-2/+2
other changes: - `Region::new_late_bound` -> `Region::new_bound` - `Region::is_late_bound` -> `Region::is_bound`
2023-10-29On object safety error, mention new enum as alternativeEsteban Küber-1/+63
When we encounter a `dyn Trait` that isn't object safe, look for its implementors. If there's one, mention using it directly If there are less than 9, mention the possibility of creating a new enum and using that instead. Account for object unsafe `impl Trait on dyn Trait {}`. Make a distinction between public and sealed traits. Fix #80194.
2023-10-22use visibility to check unused imports and delete some stmtsbohan-1/+0
2023-10-18Make sure that non-pretty-printing usages are using the correct elaboratorMichael Goulet-2/+2
2023-10-18Simplify transitive_bounds_that_define_assoc_itemMichael Goulet-33/+28
2023-10-13Format all the let chains in compilerMichael Goulet-1/+3
2023-08-09Ignore `cause` and `recursion_depth` in `Obligation::{eq,hash}`.Nicholas Nethercote-1/+23
This gives massive (~7x) compile time and memory usage reductions for the trait system stress test in https://github.com/rust-lang/rustc-perf/pull/1680.
2023-08-02Remove constness from `TraitPredicate`Deadbeef-13/+2
2023-07-30inline format!() args up to and including rustc_codegen_llvmMatthias Krüger-12/+12
2023-07-27Remove `constness` from `ParamEnv`Deadbeef-9/+0
2023-07-19Document `PredicateSet::insert`Maybe Waffle-0/+7
I always forget what the `bool` means :/
2023-07-07Auto merge of #113308 - compiler-errors:poly-select, r=lcnrbors-3/+4
Split `SelectionContext::select` into fns that take a binder and don't *most* usages of `SelectionContext::select` don't need to use a binder, but wrap them in a dummy because of the signature. Let's split this out into `SelectionContext::{select,poly_select}` and limit the usages of the latter. Right now, we only have 3 places where we're calling `poly_select` -- fulfillment, internally within the old solver, and the auto-trait finder. r? `@lcnr`
2023-07-06Avoid calling item_name for RPITITSantiago Pastorino-3/+5
2023-07-06Separate select calls that don't need a binderMichael Goulet-0/+1
2023-07-06TraitObligation -> PolyTraitObligationMichael Goulet-3/+3
2023-07-05Move `TyCtxt::mk_x` to `Ty::new_x` where applicableBoxy-2/+2
2023-07-03remove TypeWellFormedFromEnvMichael Goulet-3/+0
2023-06-29Make the Elaboratable trait take clausesMichael Goulet-40/+42
2023-06-26TypeWellFormedInEnvMichael Goulet-1/+1
2023-06-26Migrate predicates_of and caller_bounds to ClauseMichael Goulet-2/+3
2023-06-22Expect clause moreMichael Goulet-4/+4
2023-06-22Migrate item_bounds to ty::ClauseMichael Goulet-0/+20
2023-06-19Fully fledged Clause typeMichael Goulet-0/+20
2023-06-19s/Clause/ClauseKindMichael Goulet-12/+12
2023-06-17Move ConstEvaluatable to ClauseMichael Goulet-1/+1
2023-06-17Move WF goal to clauseMichael Goulet-1/+1
2023-05-07Auto merge of #111161 - compiler-errors:rtn-super, r=cjgillotbors-4/+4
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-04Auto merge of #110806 - WaffleLapkin:unmkI, r=lcnrbors-1/+1
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-03Rename things to reflect that they're not item specificMichael Goulet-4/+4
2023-05-04Rollup merge of #110791 - compiler-errors:negative-bounds, r=oli-obkDylan DPC-0/+4
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-1/+1
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/+4
2023-04-26Remove unused `TypeFoldable`/`TypeVisitable` impls.Nicholas Nethercote-1/+1
2023-04-25Replace `tcx.mk_trait_ref` with `ty::TraitRef::new`Maybe Waffle-1/+1
2023-04-21Break up long function in trait selection error reportingBryan Garza-1/+1
- Move blocks of code into their own functions - Replace a few function argument types with their type aliases
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-16use matches! macro in more placesMatthias Krüger-4/+4
2023-04-13Rollup merge of #110220 - lcnr:regionzz, r=compiler-errorsMatthias Krüger-0/+2
cleanup our region error API - require `TypeErrCtxt` to always result in an error, closing #108810 - move `resolve_regions_and_report_errors` to the `ObligationCtxt` - call `process_registered_region_obligations` in `resolve_regions` - move `resolve_regions` into the `outlives` submodule - add `#[must_use]` to functions returning lists of errors r? types
2023-04-12Rollup merge of #110103 - compiler-errors:new-solver-overflows, r=lcnrMatthias Krüger-4/+9
Report overflows gracefully with new solver avoid reporting overflows as ambiguity errors, so that the error message is clearer. r? ```@lcnr```
2023-04-12`#[must_use]` for fns returning a list of errorslcnr-0/+2
2023-04-11Allow the elaborator to only filter to real supertraitsMichael Goulet-15/+26
2023-04-11Split implied and super predicate queriesMichael Goulet-1/+1
2023-04-11Split super_predicates_that_define_assoc_type query from super_predicates_ofMichael Goulet-4/+2