about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/traits
AgeCommit message (Collapse)AuthorLines
2023-11-08Rollup merge of #113925 - clubby789:const-ctor-repeat, r=estebankMatthias Krüger-3/+23
Improve diagnostic for const ctors in array repeat expressions Fixes #113912
2023-11-03Auto merge of #117507 - nnethercote:rustc_span, r=Nilstriebbors-1/+1
`rustc_span` cleanups Just some things I found while looking over this crate. r? `@oli-obk`
2023-11-02use global cache when computing proof treeslcnr-25/+41
2023-11-02Minimize `pub` usage in `source_map.rs`.Nicholas Nethercote-1/+1
Most notably, this commit changes the `pub use crate::*;` in that file to `use crate::*;`. This requires a lot of `use` items in other crates to be adjusted, because everything defined within `rustc_span::*` was also available via `rustc_span::source_map::*`, which is bizarre. The commit also removes `SourceMap::span_to_relative_line_string`, which is unused.
2023-10-27Make `gen` blocks implement the `Iterator` traitOli Scherer-0/+4
2023-10-21Rollup merge of #106601 - estebank:match-semi, r=cjgillotMatthias Krüger-0/+1
Suggest `;` after bare `match` expression E0308 Fix #72634.
2023-10-20s/generator/coroutine/Oli Scherer-3/+3
2023-10-20s/Generator/Coroutine/Oli Scherer-3/+3
2023-10-18Make sure that non-pretty-printing usages are using the correct elaboratorMichael Goulet-3/+4
2023-10-11Suggest `;` after bare `match` expression E0308Esteban Küber-0/+1
Fix #72634.
2023-09-23Check types live across yields in generators tooMichael Goulet-1/+3
2023-09-23Check that closure's by-value captures are sizedMichael Goulet-0/+2
2023-09-21Auto merge of #115897 - eduardosm:check-fn-sig, r=compiler-errorsbors-0/+3
rustc_hir_analysis: add a helper to check function the signature mismatches This function is now used to check `#[panic_handler]`, `start` lang item, `main`, `#[start]` and intrinsic functions. The diagnosis produced are now closer to the ones produced by trait/impl method signature mismatch. This is the first time I do anything with rustc_hir_analysis/rustc_hir_typeck, so comments and suggestions about things I did wrong or that could be improved will be appreciated.
2023-09-21proof trees: use for `intercrate_ambiguity_causes`lcnr-9/+59
2023-09-19rustc_hir_analysis: add a helper to check function the signature mismatchesEduardo Sánchez Muñoz-0/+3
This function is now used to check `#[panic_handler]`, `start` lang item, `main`, `#[start]` and intrinsic functions. The diagnosis produced are now closer to the ones produced by trait/impl method signature mismatch.
2023-09-18Rollup merge of #115838 - lcnr:added-goals, r=compiler-errorsMatthias Krüger-24/+43
inspect: closer to proof trees for coherence a continuation of #115751. Now explicitly store the added goals r? ```@compiler-errors```
2023-09-18Remove more unused `Lift` impls.Nicholas Nethercote-10/+3
2023-09-18Remove unused `Lift` derives.Nicholas Nethercote-25/+20
I found these by commenting out all `Lift` derives and then adding back the ones that were necessary to successfully compile.
2023-09-14differentiate root and nested goalslcnr-10/+19
2023-09-14inspect: explicitly store added goalslcnr-0/+2
2023-09-14order `added_goals_evaluation` and `nested_probes`lcnr-7/+12
2023-09-14`GoalCandidate` to `Probe`lcnr-11/+14
2023-09-11dedup `GoalEvaluationStep` and `GoalCandidate`lcnr-14/+19
also handle 2 panics when dumping proof trees for the whole test suite - need to actually tell the proof tree builder about overflow - need to handle a recursion_limit of 0 :<
2023-09-11inspect: strongly typed CandidateKindlcnr-18/+89
2023-09-11revision -> iteration for added_goals_evaluationlcnr-3/+3
2023-09-11split GoalEvaluation and CanonicalGoalEvaluationlcnr-50/+43
the unnormalized goal is in the callers inference context, while anything inside of the `CanonicalGoalEvaluation` is inside of a new one.
2023-08-14Move scrutinee `HirId` into `MatchSource::TryDesugar`Esteban Küber-2/+1
2023-08-14Point at return type when it influences non-first `match` armEsteban Küber-1/+1
When encountering code like ```rust fn foo() -> i32 { match 0 { 1 => return 0, 2 => "", _ => 1, } } ``` Point at the return type and not at the prior arm, as that arm has type `!` which isn't influencing the arm corresponding to arm `2`. Fix #78124.
2023-08-14Remove constness from `ImplSource::Param`Deadbeef-7/+8
2023-08-04Rollup merge of #114287 - lcnr:overflow, r=compiler-errorsMichael Goulet-2/+102
update overflow handling in the new trait solver implements https://hackmd.io/QY0dfEOgSNWwU4oiGnVRLw?view. I want to clean up this doc and add it to the rustc-dev-guide, but I think this PR is ready for merge as is, even without the dev-guide entry. r? `@compiler-errors`
2023-08-04Auto merge of #114036 - compiler-errors:upcast-to-fewer-assocs, r=lcnrbors-7/+13
Rework upcasting confirmation to support upcasting to fewer projections in target bounds This PR implements a modified trait upcasting algorithm that is resilient to changes in the number of associated types in the bounds of the source and target trait objects. It does this by equating each bound of the target trait ref individually against the bounds of the source trait ref, rather than doing them all together by constructing a new trait object. #### The new way we do trait upcasting confirmation 1. Equate the target trait object's principal trait ref with one of the supertraits of the source trait object's principal. https://github.com/rust-lang/rust/blob/fdcab310b2a57a4e9cc0b2629abd27afda49cd80/compiler/rustc_trait_selection/src/traits/select/mod.rs#L2509-L2525 2. Make sure that every auto trait in the *target* trait object is present in the source trait ref's bounds. https://github.com/rust-lang/rust/blob/fdcab310b2a57a4e9cc0b2629abd27afda49cd80/compiler/rustc_trait_selection/src/traits/select/mod.rs#L2559-L2562 3. For each projection in the *target* trait object, make sure there is exactly one projection that equates with it in the source trait ref's bound. If there is more than one, bail with ambiguity. https://github.com/rust-lang/rust/blob/fdcab310b2a57a4e9cc0b2629abd27afda49cd80/compiler/rustc_trait_selection/src/traits/select/mod.rs#L2526-L2557 * Since there may be more than one that applies, we probe first to check that there is exactly one, then we equate it outside of a probe once we know that it's unique. 4. Make sure the lifetime of the source trait object outlives the lifetime of the target. <details> <summary>Meanwhile, this is how we used to do upcasting:</summary> 1. For each supertrait of the source trait object, take that supertrait, append the source object's projection bounds, and the *target* trait object's auto trait bounds, and make this into a new object type: https://github.com/rust-lang/rust/blob/d12c6e947ceacf3b22c154caf9532b390d8dc88a/compiler/rustc_trait_selection/src/traits/select/confirmation.rs#L915-L929 2. Then equate it with the target trait object: https://github.com/rust-lang/rust/blob/d12c6e947ceacf3b22c154caf9532b390d8dc88a/compiler/rustc_trait_selection/src/traits/select/confirmation.rs#L936 This will be a type mismatch if the target trait object has fewer projection bounds, since we compare the bounds structurally in relate: https://github.com/rust-lang/rust/blob/d12c6e947ceacf3b22c154caf9532b390d8dc88a/compiler/rustc_middle/src/ty/relate.rs#L696-L698 </details> Fixes #114035 Also fixes #114113, because I added a normalize call in the old solver. r? types
2023-08-03resolve before canonicalization, ICE if unresolvedMichael Goulet-1/+1
2023-08-03Rework upcastingMichael Goulet-7/+13
2023-08-03rewrite stack dependent overflow handlinglcnr-2/+102
2023-07-31Rollup merge of #114169 - lcnr:unsize, r=compiler-errorsMatthias Krüger-1/+2
refactor builtin unsize handling, extend comments r? `@compiler-errors`
2023-07-30inline format!() args up to and including rustc_middleMatthias Krüger-26/+23
2023-07-28refactor builtin unsize handling, extend commentslcnr-1/+2
2023-07-25Make everything builtin!Michael Goulet-85/+35
2023-07-25Restore tuple unsizing feature gateMichael Goulet-3/+11
2023-07-25Normalize the RHS of an unsize goalMichael Goulet-1/+8
2023-07-24Improve diagnostic for const ctors in array repeat expressionsclubby789-3/+23
2023-07-23match on chars instead of &strs for .split() or .strip_prefix()Matthias Krüger-2/+2
2023-07-14refactor(rustc_middle): Substs -> GenericArgMahdi Dibaiee-9/+11
2023-07-13typolcnr-1/+1
2023-07-13refactor proof tree formattinglcnr-57/+63
2023-07-05Add some extra information to opaque type cycle errorsOli Scherer-0/+4
2023-07-03Remove chalk from the compilerMichael Goulet-401/+0
2023-06-28Rollup merge of #112867 - compiler-errors:more-impl-source-nits, r=lcnrDylan DPC-37/+2
More `ImplSource` nits Even more clean-ups, I'll put this up in parallel with the `select_in_new_trait_solver` PR. r? ``@lcnr``
2023-06-26Migrate predicates_of and caller_bounds to ClauseMichael Goulet-4/+2
2023-06-20yeet upcast_trait_def_id from ImplSourceObjectDataMichael Goulet-6/+2