summary refs log tree commit diff
path: root/compiler/rustc_middle/src/traits
AgeCommit message (Collapse)AuthorLines
2022-10-04Add AscribeUserTypeProvePredicateJack Huey-0/+5
(cherry picked from commit 9929c0ac76bbbe2b3b8a0c28df91310067ae57fa)
2022-10-04Add to_constraint_category to ObligationCause and SubregionOriginJack Huey-0/+8
(cherry picked from commit 67653292beccfd3b88d13d9060d4e84c4a261f63)
2022-09-16Revert "Better errors for implied static bound"Jack Huey-13/+0
This reverts commit c75817b0a75d4b6b01ee10900ba5d01d4915e6a8.
2022-09-13Better errors for implied static boundJack Huey-0/+13
2022-09-12Rollup merge of #101681 - compiler-errors:rpitit-obj-safety, r=lcnrDylan DPC-0/+9
Deny return-position `impl Trait` in traits for object safety Fixes #101667
2022-09-12Auto merge of #100251 - compiler-errors:tuple-trait-2, r=jackh726bors-2/+14
Implement `std::marker::Tuple` Split out from #99943 (https://github.com/rust-lang/rust/pull/99943#pullrequestreview-1064459183). Implements part of rust-lang/compiler-team#537 r? `@jackh726`
2022-09-11Deny RPITIT for object safetyMichael Goulet-0/+9
2022-09-09rename `codegen_fulfill_obligation`lcnr-1/+1
2022-09-08Add associated item binding to non-param-ty where clause suggestionsMichael Goulet-2/+2
2022-09-05fix comment111-2/+1
2022-09-01Migrate DropCheckOverflow111-10/+3
2022-08-31Fix a bunch of typoDezhi Wu-1/+1
This PR will fix some typos detected by [typos]. I only picked the ones I was sure were spelling errors to fix, mostly in the comments. [typos]: https://github.com/crate-ci/typos
2022-08-24Note binding obligation causes for const equate errorsMichael Goulet-0/+7
2022-08-21More docsMichael Goulet-5/+11
2022-08-21Rework point-at-argMichael Goulet-0/+4
2022-08-07Built-in implementation of Tuple traitMichael Goulet-2/+14
2022-08-02Auto merge of #92268 - jswrenn:transmute, r=oli-obkbors-0/+4
Initial implementation of transmutability trait. *T'was the night before Christmas and all through the codebase, not a miri was stirring — no hint of `unsafe`!* This PR provides an initial, **incomplete** implementation of *[MCP 411: Lang Item for Transmutability](https://github.com/rust-lang/compiler-team/issues/411)*. The `core::mem::BikeshedIntrinsicFrom` trait provided by this PR is implemented on-the-fly by the compiler for types `Src` and `Dst` when the bits of all possible values of type `Src` are safely reinterpretable as a value of type `Dst`. What this PR provides is: - [x] [support for transmutations involving primitives](https://github.com/jswrenn/rust/tree/transmute/src/test/ui/transmutability/primitives) - [x] [support for transmutations involving arrays](https://github.com/jswrenn/rust/tree/transmute/src/test/ui/transmutability/arrays) - [x] [support for transmutations involving structs](https://github.com/jswrenn/rust/tree/transmute/src/test/ui/transmutability/structs) - [x] [support for transmutations involving enums](https://github.com/jswrenn/rust/tree/transmute/src/test/ui/transmutability/enums) - [x] [support for transmutations involving unions](https://github.com/jswrenn/rust/tree/transmute/src/test/ui/transmutability/unions) - [x] [support for weaker validity checks](https://github.com/jswrenn/rust/blob/transmute/src/test/ui/transmutability/unions/should_permit_intersecting_if_validity_is_assumed.rs) (i.e., `Assume::VALIDITY`) - [x] visibility checking What isn't yet implemented: - [ ] transmutability options passed using the `Assume` struct - [ ] [support for references](https://github.com/jswrenn/rust/blob/transmute/src/test/ui/transmutability/references.rs) - [ ] smarter error messages These features will be implemented in future PRs.
2022-08-01Store associated item defaultness in impl_defaultness.Camille GILLOT-1/+1
2022-07-29remove some manual hash stable implslcnr-25/+1
2022-07-27Initial (incomplete) implementation of transmutability trait.Jack Wrenn-0/+4
This initial implementation handles transmutations between types with specified layouts, except when references are involved. Co-authored-by: Igor null <m1el.2027@gmail.com>
2022-07-24Combine redundant obligation cause codesMichael Goulet-10/+2
2022-07-21And for patterns tooMichael Goulet-2/+5
2022-07-21Do if-expression obligation stuff less eagerlyMichael Goulet-8/+9
2022-07-20Remove unused StableMap and StableSet types from rustc_data_structuresMichael Woerister-1/+1
2022-07-16Rollup merge of #99290 - compiler-errors:revert-98794, r=lcnrMatthias Krüger-9/+1
Revert "Highlight conflicting param-env candidates" This reverts #98794, commit 08135254dcf22be0d5661ea8f75e703b29a83514. Seems to have caused an incremental compilation bug. The root cause of the incr comp bug is somewhat unrelated but is triggered by this PR, so I don't feel comfortable with having this PR in the codebase until it can be investigated further. Fixes #99233.
2022-07-15Propagate Expectation around binop typeck code to construct more precise ↵Will Crichton-1/+2
trait obligations for binops.
2022-07-15Revert "Highlight conflicting param-env candidates"Michael Goulet-9/+1
This reverts commit 08135254dcf22be0d5661ea8f75e703b29a83514.
2022-07-15remove tcx from ObligationCauseCode::spanMichael Goulet-1/+1
2022-07-15Remove some more usages of guess_head_spanMichael Goulet-6/+1
2022-07-12Move abstract const to rustc_middle::tykadmin-1/+1
2022-07-08Auto merge of #98614 - oli-obk:take_unsound_opaque_types, r=wesleywiserbors-4/+14
don't succeed `evaluate_obligation` query if new opaque types were registered fixes #98608 fixes #98604 The root cause of all this is that in type flag computation we entirely ignore nongeneric things like struct fields and the signature of function items. So if a flag had to be set for a struct if it is set for a field, that will only happen if the field is generic, as only the generic parameters are checked. I now believe we cannot use type flags to handle opaque types. They seem like the wrong tool for this. Instead, this PR replaces the previous logic by adding a new variant of `EvaluatedToOk`: `EvaluatedToOkModuloOpaqueTypes`, which says that there were some opaque types that got hidden types bound, but that binding may not have been legal (because we don't know if the opaque type was in its defining scope or not).
2022-07-08Highlight conflicting param-env candidatesMichael Goulet-1/+9
2022-07-07not knowing about opaque types is worse than not knowing about regions, make ↵Oli Scherer-2/+2
sure we don't accidentally mark something as ok-modulo-regions if there are opaque types involved
2022-07-06Update TypeVisitor pathsAlan Egerton-1/+1
2022-07-05impl TypeVisitable in type traversal macrosAlan Egerton-2/+2
2022-07-05Add #[derive(TypeVisitable)]Alan Egerton-22/+38
2022-06-30Make `evaluate_obligation` not succeed unconditionally if it registered new ↵Oli Scherer-4/+14
hidden types for opaque types
2022-06-28Fix trait object reborrow suggestionMichael Goulet-1/+1
2022-06-27Rollup merge of #98506 - compiler-errors:object-safety-suggestions, r=oli-obkMatthias Krüger-38/+29
Fix span issues in object safety suggestions Fixes #98500
2022-06-27Rollup merge of #97780 - compiler-errors:field-wfcheck-before-sized, r=jackh726Matthias Krüger-1/+1
Check ADT field is well-formed before checking it is sized Fixes #96810. There is one diagnostics regression, in [`src/test/ui/generic-associated-types/bugs/issue-80626.stderr`](https://github.com/rust-lang/rust/pull/97780/files#diff-53795946378e78a0af23a10277c628ff79091c18090fdc385801ee70c1ba6963). I am not super concerned about it, since it's GAT related. We _could_ fix it, possibly by using the `FieldSized` obligation cause code instead of `BuiltinDerivedObligation`. But that would require changing `Sized` trait confirmation and the `adt_sized_constraint` query.
2022-06-25Fix span issues in object safety suggestionsMichael Goulet-38/+29
2022-06-21Point at return expression for RPIT-related errorMichael Goulet-0/+3
2022-06-14implement valtrees as the type-system representation for constant valuesb-naber-2/+1
2022-06-13remove unnecessary `to_string` and `String::new`Takayuki Maeda-2/+2
2022-06-05Do wfcheck on ADT field before Sized checkMichael Goulet-1/+1
2022-05-22Lifetime variance fixes for rustcMichael Goulet-5/+7
2022-05-18Rollup merge of #95979 - lcnr:coherence-docs, r=compiler-errorsDylan DPC-0/+3
update coherence docs, fix generator + opaque type ICE the world is confusing, this makes it slightly less so
2022-05-17Auto merge of #96892 - oli-obk:🐌_obligation_cause_code_🐌, r=estebankbors-35/+75
Clean up derived obligation creation r? `@estebank` working on fixing the perf regression from https://github.com/rust-lang/rust/pull/91030#issuecomment-1083360210
2022-05-16Force inline InternedObligationCauseCode creationOli Scherer-4/+4
2022-05-13Avoid invoking the full `eq` infrastructure when all we want is to check a ↵Oli Scherer-1/+3
discriminant