summary refs log tree commit diff
path: root/compiler/rustc_middle/src/traits
AgeCommit message (Collapse)AuthorLines
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
2023-11-21Fix `clippy::needless_borrow` in the compilerNilstrieb-1/+1
`x clippy compiler -Aclippy::all -Wclippy::needless_borrow --fix`. Then I had to remove a few unnecessary parens and muts that were exposed now.
2023-11-20Document DefiningAnchor a bit moreMichael Goulet-4/+17
2023-11-17Auto merge of #117278 - lcnr:try-normalize-ty, r=compiler-errorsbors-0/+10
new solver normalization improvements cool beans At the core of this PR is a `try_normalize_ty` which stops for rigid aliases by using `commit_if_ok`. Reworks alias-relate to fully normalize both the lhs and rhs and then equate the resulting rigid (or inference) types. This fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/68 by avoiding the exponential blowup. Also supersedes #116369 by only defining opaque types if the hidden type is rigid. I removed the stability check in `EvalCtxt::evaluate_goal` due to https://github.com/rust-lang/trait-system-refactor-initiative/issues/75. While I personally have opinions on how to fix it, that still requires further t-types/`@nikomatsakis` buy-in, so I removed that for now. Once we've decided on our approach there, we can revert this commit. r? `@compiler-errors`
2023-11-09`try_normalize_ty` end with rigid alias on failurelcnr-0/+10
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