about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/traits
AgeCommit message (Collapse)AuthorLines
2022-03-02rename ErrorReported -> ErrorGuaranteedmark-3/+3
2022-02-26suggest a float literal when dividing a floating-point type by {integer}Takayuki Maeda-0/+5
fix a message implement a rustfix-applicable suggestion implement `suggest_floating_point_literal` add `ObligationCauseCode::BinOp` remove duplicate code fix function names in uitests use `Diagnostic` instead of `DiagnosticBuilder`
2022-02-23Replace `&mut DiagnosticBuilder`, in signatures, with `&mut Diagnostic`.Eduard-Mihai Burtescu-2/+2
2022-02-17Suggest copying trait associated type bounds on lifetime errorJack Huey-0/+6
2022-02-09Ensure that queries only return Copy types.Camille GILLOT-5/+4
2022-01-31Do not store overlap_mode, just pass it down on insertSantiago Pastorino-13/+1
2022-01-31Move overlap_mode into trait level attribute + feature flagSantiago Pastorino-1/+49
2022-01-26Improve selection errors for `~const` trait boundsDeadbeef-4/+4
2022-01-18Check const Drop impls considering ConstIfConst boundsMichael Goulet-13/+20
2022-01-07Add query to avoid name comparison in `leaf_def`Matthew Jasper-29/+16
2021-12-23Auto merge of #92167 - pierwill:chalk-update, r=jackh726bors-30/+31
Update chalk to 0.75.0 - Compute flags in `intern_ty` - Remove `tracing-serde` from `PERMITTED_DEPENDENCIES` - Bump `tracing-tree` to 0.2.0 - Bump `tracing-subscriber` to 0.3.3
2021-12-22Update chalk to 0.75.0pierwill-30/+31
- Compute flags in `intern_ty` - Remove tracing-serde from PERMITTED_DEPENDENCIES - Disable `tracing-full` feature in `chalk-solve` - Bump tracing-tree to 0.2.0
2021-12-20Eliminate `ObligationCauseData`.Nicholas Nethercote-42/+40
This makes `Obligation` two words bigger, but avoids allocating a lot of the time. I previously tried this in #73983 and it didn't help much, but local timings look more promising now.
2021-12-15Remove `in_band_lifetimes` from `rustc_middle`Aaron Hill-3/+3
See #91867 This was mostly straightforward. In several places, I take advantage of the fact that lifetimes are non-hygenic: a macro declares the 'tcx' lifetime, which is then used in types passed in as macro arguments.
2021-12-13Keep info on pre-desugaring expression for better "incorrect `.await`" ↵Esteban Kuber-1/+1
suggestion Keep the `HirId` of `.await`ed expressions so in the case of a `fn` call on on a sync `fn`, we can suggest maybe turning it into an `async fn`.
2021-12-13Reduce verbosity for `?` on non-`Try` expressionsEsteban Kuber-0/+2
2021-12-13Reduce verbosity when calling `for`-loop on non-`Iterator` expressionEsteban Kuber-0/+2
2021-12-13When `.await` is called on a non-`Future` expression, suggest removalEsteban Kuber-0/+2
Keep track of the origin of a `T: Future` obligation when caused by an `.await` expression. Address #66731.
2021-12-12Revert "Auto merge of #91491 - spastorino:revert-91354, r=oli-obk"Deadbeef-8/+6
This reverts commit ff2439b7b9bafcfdff86b7847128014699df8442, reversing changes made to 2a9e0831d6603d87220cedd1b1293e2eb82ef55c.
2021-12-09Remove redundant [..]sest31-9/+9
2021-12-03Revert "Auto merge of #91354 - fee1-dead:const_env, r=spastorino"Santiago Pastorino-6/+8
This reverts commit 18bb8c61a975fff6424cda831ace5b0404277145, reversing changes made to d9baa361902b172be716f96619b909f340802dea.
2021-11-29Fix toolsDeadbeef-2/+2
2021-11-29Avoid storing the ImplPolarity and Constness next to a TraitRef and use ↵Oli Scherer-1/+1
TraitPredicate instead
2021-11-29Replace `ConstnessAnd<TraitRef>` with `TraitPredicate` which conveys the ↵Oli Scherer-4/+2
same information
2021-11-29Prefer TraitPredicate over ConstnessAnd<TraitRef>Oli Scherer-1/+1
2021-11-23Add supertraits method to rustc_middleMichael Goulet-0/+50
2021-11-14Simplify ObligationCauseData hash to skip ObligationCauseCodeThe8472-1/+10
selection deduplicates obligations through a hashset at some point, computing the hashes for ObligationCauseCode appears to dominate the hashing cost. bodyid + span + discriminant hash hopefully will sufficiently unique unique enough.
2021-11-07Remove some fields from `ObligationCauseCode`Matthew Jasper-2/+0
2021-10-24Point at overlapping impls when type annotations are neededEsteban Kuber-0/+12
2021-10-20Make EvaluationCache consider polarity as cache's keySantiago Pastorino-2/+4
2021-10-20Consider negative polarity on overlap checkSantiago Pastorino-2/+2
2021-10-10Fix spelling: Cannonical -> CanonicalJohn Kugelman-2/+2
2021-10-05Issue 89275 fix and testTom Farmer-4/+11
Issue 89275 fix and test Fix librustdoc OverflowError usage rust tidy run Issue 89275 fix and test
2021-10-03Remove re-export.Camille GILLOT-1/+1
2021-10-01Rollup merge of #88963 - fee1-dead:const-iterator, r=oli-obkManish Goregaokar-1/+3
Coerce const FnDefs to implement const Fn traits You can now pass a FnDef to a function expecting `F` where `F: ~const FnTrait`. r? ``@oli-obk`` ``@rustbot`` label T-compiler F-const_trait_impl
2021-09-21use indexmap instead of hashmaplcnr-13/+3
2021-09-21renamelcnr-4/+4
2021-09-18Auto merge of #89000 - Mark-Simulacrum:no-new-lrc, r=petrochenkovbors-1/+1
Reuse existing shared Lrc for MatchImpl parent This is a small performance win for the hot path, which helps to address this regression: https://github.com/rust-lang/rust/pull/87244#issuecomment-883635813.
2021-09-16Auto merge of #88719 - estebank:point-at-arg-for-obligation, r=nagisabors-4/+14
Point at argument instead of call for their obligations When an obligation is introduced by a specific `fn` argument, point at the argument instead of the `fn` call if the obligation fails to be fulfilled. Move the information about pointing at the call argument expression in an unmet obligation span from the `FulfillmentError` to a new `ObligationCauseCode`. When giving an error about an obligation introduced by a function call that an argument doesn't fulfill, and that argument is a block, add a span_label pointing at the innermost tail expression. Current output: ``` error[E0425]: cannot find value `x` in this scope --> f10.rs:4:14 | 4 | Some(x * 2) | ^ not found in this scope error[E0277]: expected a `FnOnce<({integer},)>` closure, found `Option<_>` --> f10.rs:2:31 | 2 | let p = Some(45).and_then({ | ______________________--------_^ | | | | | required by a bound introduced by this call 3 | | |x| println!("doubling {}", x); 4 | | Some(x * 2) | | ----------- 5 | | }); | |_____^ expected an `FnOnce<({integer},)>` closure, found `Option<_>` | = help: the trait `FnOnce<({integer},)>` is not implemented for `Option<_>` ``` Previous output: ``` error[E0425]: cannot find value `x` in this scope --> f10.rs:4:14 | 4 | Some(x * 2) | ^ not found in this scope error[E0277]: expected a `FnOnce<({integer},)>` closure, found `Option<_>` --> f10.rs:2:22 | 2 | let p = Some(45).and_then({ | ^^^^^^^^ expected an `FnOnce<({integer},)>` closure, found `Option<_>` | = help: the trait `FnOnce<({integer},)>` is not implemented for `Option<_>` ``` Partially address #27300. Will require rebasing on top of #88546.
2021-09-16Refactor `FulfillmentError` to track less dataEsteban Kuber-4/+14
Move the information about pointing at the call argument expression in an unmet obligation span from the `FulfillmentError` to a new `ObligationCauseCode`.
2021-09-15Reuse existing shared Lrc for MatchImpl parentMark Rousskov-1/+1
This is hopefully a small performance win for the hot path.
2021-09-15Move object safety suggestions to the end of the errorEsteban Kuber-2/+2
2021-09-15Coerce const FnDefs to implement const Fn traitsDeadbeef-1/+3
2021-09-15Auto merge of #88558 - fee1-dead:const-drop, r=oli-obkbors-2/+19
Const drop The changes are pretty primitive at this point. But at least it works. ^-^ Problems with the current change that I can think of now: - [x] `~const Drop` shouldn't change anything in the non-const world. - [x] types that do not have drop glues shouldn't fail to satisfy `~const Drop` in const contexts. `struct S { a: u8, b: u16 }` This might not fail for `needs_non_const_drop`, but it will fail in `rustc_trait_selection`. - [x] The current change accepts types that have `const Drop` impls but have non-const `Drop` glue. Fixes #88424. Significant Changes: - `~const Drop` is no longer treated as a normal trait bound. In non-const contexts, this bound has no effect, but in const contexts, this restricts the input type and all of its transitive fields to either a) have a `const Drop` impl or b) can be trivially dropped (i.e. no drop glue) - `T: ~const Drop` will not be linted like `T: Drop`. - Instead of recursing and iterating through the type in `rustc_mir::transform::check_consts`, we use the trait system to special case `~const Drop`. See [`rustc_trait_selection::...::candidate_assembly#assemble_const_drop_candidates`](https://github.com/fee1-dead/rust/blob/const-drop/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs#L817) and others. Changes not related to `const Drop`ping and/or changes that are insignificant: - `Node.constness_for_typeck` no longer returns `hir::Constness::Const` for type aliases in traits. This was previously used to hack how we determine default bound constness for items. But because we now use an explicit opt-in, it is no longer needed. - Removed `is_const_impl_raw` query. We have `impl_constness`, and the only existing use of that query uses `HirId`, which means we can just operate it with hir. - `ty::Destructor` now has a field `constness`, which represents the constness of the destructor. r? `@oli-obk`
2021-09-09fmtDeadbeef-1/+1
2021-09-09Const drop selection candidatesDeadbeef-2/+19
2021-09-09rename mir -> thir around abstract constsEllen-1/+1
2021-08-30Enforce diverging let...elseCameron Steffen-0/+3
2021-08-27Add `ty::BoundConstness`Deadbeef-2/+1
2021-08-22Fix typos “a”→“an”Frank Steffahn-2/+2