summary refs log tree commit diff
path: root/compiler/rustc_middle/src/traits
AgeCommit message (Collapse)AuthorLines
2024-03-14eagerly instantiate binders to avoid relying on `sub`lcnr-0/+1
2024-03-11Eliminate `DefiningAnchor::Error`, it is indistinguishable from ↵Oli Scherer-4/+4
`DefiningAnchor::Bind` with an empty list
2024-03-11Make `DefiningAnchor::Bind` only store the opaque types that may be ↵Oli Scherer-6/+12
constrained, instead of the current infcx root item. This makes `Bind` almost always be empty, so we can start forwarding it to queries, allowing us to remove `Bubble` entirely
2024-03-08inspect formatter: add braceslcnr-17/+30
2024-03-05Convert `TypeVisitor` and `DefIdVisitor` to use `VisitorResult`Jason Newcomb-14/+6
2024-02-29distinguish recursion limit based overflow for diagnosticslcnr-10/+20
also change the number of allowed fixpoint steps to be fixed instead of using the `log` of the total recursion depth.
2024-02-28Rename `DiagnosticBuilder` as `Diag`.Nicholas Nethercote-2/+2
Much better! Note that this involves renaming (and updating the value of) `DIAGNOSTIC_BUILDER` in clippy.
2024-02-26always emit `AliasRelate` goals when relating aliaseslcnr-16/+1
Add `StructurallyRelateAliases` to allow instantiating infer vars with rigid aliases. Change `instantiate_query_response` to be infallible in the new solver. This requires canonicalization to not hide any information used by the query, so weaken universe compression. It also modifies `term_is_fully_unconstrained` to allow region inference variables in a higher universe.
2024-02-23remove repetitive wordscui fliter-1/+1
Signed-off-by: cui fliter <imcusg@gmail.com>
2024-02-20Rollup merge of #121344 - fmease:lta-constr-by-input, r=oli-obkMatthias Krüger-3/+3
Expand weak alias types before collecting constrained/referenced late bound regions + refactorings Fixes #114220. Follow-up to #120780. r? `@oli-obk`
2024-02-20Rename some normalization-related itemsLeón Orell Valerian Liehr-3/+3
2024-02-19Prefer `DiagnosticBuilder` over `Diagnostic` in diagnostic modifiers.Nicholas Nethercote-2/+2
There are lots of functions that modify a diagnostic. This can be via a `&mut Diagnostic` or a `&mut DiagnosticBuilder`, because the latter type wraps the former and impls `DerefMut`. This commit converts all the `&mut Diagnostic` occurrences to `&mut DiagnosticBuilder`. This is a step towards greatly simplifying `Diagnostic`. Some of the relevant function are made generic, because they deal with both errors and warnings. No function bodies are changed, because all the modifier methods are available on both `Diagnostic` and `DiagnosticBuilder`.
2024-02-15Remove a suggestion that is redundantMichael Goulet-1/+0
2024-02-15Only point out non-diverging arms for match suggestionsMichael Goulet-1/+1
2024-02-12Dejargnonize substShoyu Vanilla-3/+4
2024-02-07improve pretty printing for trait objectsLukas Markeffsky-20/+34
2024-02-06Bless tests, add commentsMichael Goulet-1/+3
2024-02-06Teach typeck/borrowck/solvers how to deal with async closuresMichael Goulet-0/+7
2024-01-24Deduplicate more sized errors on call exprsEsteban Küber-0/+2
Change the implicit `Sized` `Obligation` `Span` for call expressions to include the whole expression. This aids the existing deduplication machinery to reduce the number of errors caused by a single unsized expression.
2024-01-17Correctly handle normalization in implied boundsAli MJ Al-Nasrawy-1/+1
Special-case Bevy dependents to not error
2024-01-15Rollup merge of #119897 - compiler-errors:fulfillment-errors, r=lcnrMatthias Krüger-2/+2
`OutputTypeParameterMismatch` -> `SignatureMismatch` I'm probably missing something that made this rename more complicated. What did you end up getting stuck on when renaming this selection error, `@lcnr?` **also** I renamed the `FulfillmentErrorCode` variants. This is just churn but I wanted to do it forever. I can move it out of this PR if desired. r? lcnr
2024-01-12Remove unused ErrorReporting variant from overflow handlingMichael Goulet-5/+0
2024-01-12OutputTypeParameterMismatch -> SignatureMismatchMichael Goulet-2/+2
2024-01-12Auto merge of #119879 - matthiaskrgr:rollup-y710der, r=matthiaskrgrbors-10/+4
Rollup of 4 pull requests Successful merges: - #119781 (fix typo) - #119865 (Set `c_str_literals` stabilization version back to `CURRENT_RUSTC_VERSION`) - #119866 (Convert `effects` description to doc comment) - #119868 (Register even erroneous impls) r? `@ghost` `@rustbot` modify labels: rollup
2024-01-11`specialization_graph_of`'s `errored` field is used in the only call site, ↵Oli Scherer-10/+4
and used to immediately throw away the rest of the value. Let's use `Result` to statically signal that this is happening
2024-01-09readd the provisional cachelcnr-0/+4
2024-01-03Track `HirId` instead of `Span` in `ObligationCauseCode::SizedArgumentType`Esteban Küber-1/+1
This gets us more accurate suggestions.
2023-12-26Auto merge of #118431 - sjwang05:issue-44695, r=estebankbors-1/+18
Emit better suggestions for `&T == T` and `T == &T` Fixes #40660 Fixes #44695
2023-12-26Auto merge of #119129 - jyn514:verbose, r=compiler-errors,estebankbors-1/+1
rework `-Zverbose` implements the changes described in https://github.com/rust-lang/compiler-team/issues/706 the first commit is only a name change from `-Zverbose` to `-Zverbose-internals` and does not change behavior. the second commit changes diagnostics. possible follow up work: - `ty::pretty` could print more info with `--verbose` than it does currently. `-Z verbose-internals` shows too much info in a way that's not helpful to users. michael had ideas about this i didn't fully understand: https://rust-lang.zulipchat.com/#narrow/stream/233931-t-compiler.2Fmajor-changes/topic/uplift.20some.20-Zverbose.20calls.20and.20rename.20to.E2.80.A6.20compiler-team.23706/near/408984200 - `--verbose` should imply `-Z write-long-types-to-disk=no`. the code in `ty_string_with_limit` should take `--verbose` into account (apparently this affects `Ty::sort_string`, i'm not familiar with this code). writing a file to disk should suggest passing `--verbose`. r? `@compiler-errors` cc `@estebank`
2023-12-24Remove `Session` methods that duplicate `DiagCtxt` methods.Nicholas Nethercote-2/+2
Also add some `dcx` methods to types that wrap `TyCtxt`, for easier access.
2023-12-20Rollup merge of #119071 - lcnr:overflowo, r=compiler-errorsMatthias Krüger-4/+31
-Znext-solver: adapt overflow rules to avoid breakage Do not erase overflow constraints if they are from equating the impl header when normalizing[^1]. This should be the minimal change to not break crates depending on the old project behavior of "apply impl constraints while only lazily evaluating any nested goals". Fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/70, see https://hackmd.io/ATf4hN0NRY-w2LIVgeFsVg for the reasoning behind this. Only keeping constraints on overflow for `normalize-to` goals as that's the only thing needed for backcompat. It also allows us to not track the origin of root obligations. The issue with root goals would be something like the following: ```rust trait Foo {} trait Bar {} trait FooBar {} impl<T: Foo + Bar> FooBar for T {} // These two should behave the same, rn we can drop constraints for both, // but if we don't drop `Misc` goals we would only drop the constraints for // `FooBar` unless we track origins of root obligations. fn func1<T: Foo + Bar>() {} fn func2<T: FooBaz>() {} ``` [^1]: mostly, the actual rules are slightly different r? ``@compiler-errors``
2023-12-19rename to verbose-internalsjyn-1/+1
2023-12-18Check FnPtr/FnDef built-in fn traits correctly with effectsMichael Goulet-1/+1
2023-12-18dont discard overflow from normalizes-to goalslcnr-0/+3
2023-12-18track the source of nested goalslcnr-4/+28
2023-12-16Provide better suggestions for T == &T and &T == Tsjwang05-1/+18
2023-12-16Remove unnecessary constness from ProjectionCandidateMichael Goulet-4/+2
2023-12-14update use of feature flagslcnr-1/+1
2023-12-08Implement `async gen` blocksMichael Goulet-2/+6
2023-12-06EvaluatedToUnknown -> EvaluatedToAmbigStackDependent, EvaluatedToRecur -> ↵Michael Goulet-10/+10
EvaluatedToErrStackDependent
2023-11-27Auto merge of #117200 - rmehri01:repeated_help, r=WaffleLapkinbors-30/+65
Don't add redundant help for object safety violations Fixes #117186 r? WaffleLapkin
2023-11-26don't add redundant help for object safety violationsRyan Mehri-30/+65
2023-11-26rustc: `hir().local_def_id_to_hir_id()` -> `tcx.local_def_id_to_hir_id()` ↵Vadim Petrochenkov-1/+1
cleanup
2023-11-25Remove 3 more unused ObligationCauseCodesMichael Goulet-9/+0
2023-11-25Remove some more unused codepaths in (region) error reportingMichael Goulet-1/+2
2023-11-25Remove unused ObligationCauseCode::ProjectionWfMichael Goulet-3/+0
2023-11-25Rollup merge of #118199 - compiler-errors:qpath, r=lcnrGuillaume Gomez-1/+1
Remove `HirId` from `QPath::LangItem` Remove `HirId` from `QPath::LangItem`, since there was only *one* use-case (`ObligationCauseCode::AwaitableExpr`), which we can instead recover by walking the HIR tree.
2023-11-25Remove HirId from QPath::LangItemMichael Goulet-1/+1
2023-11-23remove unused pub fnklensy-11/+0
2023-11-22Auto merge of #118152 - matthiaskrgr:rollup-bqcck4w, r=matthiaskrgrbors-4/+17
Rollup of 5 pull requests Successful merges: - #117972 (Add VarDebugInfo to Stable MIR) - #118109 (rustdoc-search: simplify `checkPath` and `sortResults`) - #118110 (Document `DefiningAnchor` a bit more) - #118112 (Don't ICE when ambiguity is found when selecting `Index` implementation in typeck) - #118135 (Remove quotation from filename in stable_mir) Failed merges: - #118012 (Add support for global allocation in smir) r? `@ghost` `@rustbot` modify labels: rollup