about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src
AgeCommit message (Collapse)AuthorLines
2022-10-14more dupe word typosRageking8-3/+3
2022-10-14check if the self type is `ty::Float` before getting second substsTakayuki Maeda-13/+9
2022-10-13Make overlapping_impls non-genericCameron Steffen-41/+29
This improves perf
2022-10-13Sort elaborated existential predicates in object_ty_for_traitMichael Goulet-11/+18
2022-10-12Auto merge of #101679 - compiler-errors:rpitit-default-body, r=nikomatsakisbors-3/+45
Support default-body trait functions with return-position `impl Trait` in traits Introduce a new `Trait` candidate kind for the `ImplTraitInTrait` projection candidate, which just projects an RPITIT down to its opaque type form. This is a hack until we lower RPITITs to regular associated types, after which we will need to rework how these default bodies are type-checked, so comments are left in a few places for us to clean up later. Fixes #101665
2022-10-12Do not register placeholder region outlives when considering_regions is falseMichael Goulet-1/+1
2022-10-11Auto merge of #102896 - matthiaskrgr:rollup-jg5xawz, r=matthiaskrgrbors-0/+68
Rollup of 6 pull requests Successful merges: - #101360 (Point out incompatible closure bounds) - #101789 (`let`'s not needed in struct field definitions) - #102846 (update to syn-1.0.102) - #102871 (rustdoc: clean up overly complex `.trait-impl` CSS selectors) - #102876 (suggest candidates for unresolved import) - #102888 (Improve rustdoc-gui search-color test) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-10-10Rollup merge of #101360 - compiler-errors:multiple-closure-bounds, ↵Matthias Krüger-0/+68
r=petrochenkov Point out incompatible closure bounds Fixes #100295
2022-10-10Fix compiler docsGuillaume Gomez-7/+8
2022-10-10Rollup merge of #102786 - compiler-errors:no-tuple-candidate, r=lcnrDylan DPC-12/+6
Remove tuple candidate, nothing special about it r? `@lcnr` you mentioned this during the talk you gave i think
2022-10-10Point out incompatible closure boundsMichael Goulet-0/+68
2022-10-10Rollup merge of #102845 - cjgillot:gat-object, r=fee1-deadYuki Okushi-29/+15
Elaborate trait ref to compute object safety. instead of building them manually from supertraits and associated items. This allows to have the correct substs for GATs. Fixes https://github.com/rust-lang/rust/issues/102751
2022-10-10Rollup merge of #102829 - compiler-errors:rename-impl-item-kind, r=TaKO8KiYuki Okushi-2/+2
rename `ImplItemKind::TyAlias` to `ImplItemKind::Type` The naming of this variant seems inconsistent given that this is not really a "type alias", and the associated type variant for `TraitItemKind` is just called `Type`.
2022-10-09Elaborate trait ref to compute object safety.Camille GILLOT-29/+15
2022-10-09ImplItemKind::TyAlias => ImplItemKind::TypeMichael Goulet-2/+2
2022-10-08Auto merge of #102809 - matthiaskrgr:rollup-qq62vuv, r=matthiaskrgrbors-19/+18
Rollup of 8 pull requests Successful merges: - #101520 (Allow transmutes between the same types after erasing lifetimes) - #102675 (Remove `mir::CastKind::Misc`) - #102778 (Fix MIR inlining of asm_unwind) - #102785 (Remove `DefId` from some `SelectionCandidate` variants) - #102788 (Update rustc-dev-guide) - #102789 (Update browser UI test version) - #102797 (rustdoc: remove no-op CSS `.rightside { position: initial }`) - #102798 (rustdoc: add main-heading and example-wrap link CSS to big selector) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-10-08Rollup merge of #102785 - fee1-dead-contrib:rm_autoimpl_defid, r=compiler-errorsMatthias Krüger-19/+18
Remove `DefId` from some `SelectionCandidate` variants They are both from `obligation.predicate.def_id()`, which do not need to be on the `SelectionCandidate`. cc ````@lcnr```` ````@compiler-errors````
2022-10-08Auto merge of #100720 - camsteffen:representable, r=cjgillotbors-76/+0
Rewrite representability * Improve placement of `Box` in the suggestion * Multiple items in a cycle emit 1 error instead of an error for each item in the cycle * Introduce `representability` query to avoid traversing an item every time it is used. * Also introduce `params_in_repr` query to avoid traversing generic items every time it is used.
2022-10-07Auto merge of #102787 - Dylan-DPC:rollup-fvbb4t9, r=Dylan-DPCbors-13/+15
Rollup of 6 pull requests Successful merges: - #102300 (Use a macro to not have to copy-paste `ConstFnMutClosure::new(&mut fold, NeverShortCircuit::wrap_mut_2_imp)).0` everywhere) - #102475 (unsafe keyword: trait examples and unsafe_op_in_unsafe_fn update) - #102760 (Avoid repeated re-initialization of the BufReader buffer) - #102764 (Check `WhereClauseReferencesSelf` after all other object safety checks) - #102779 (Fix `type_of` ICE) - #102780 (run Miri CI when std::sys changes) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-10-07Remove tuple candidate, nothing special about itMichael Goulet-12/+6
2022-10-07Remove `DefId` from some `SelectionCandidate` variantsDeadbeef-19/+18
2022-10-07Rewrite representabilityCameron Steffen-76/+0
2022-10-07Change InferCtxtBuilder from enter to buildCameron Steffen-378/+308
2022-10-07Remove TypeckResults from InferCtxtCameron Steffen-78/+72
2022-10-07Introduce TypeErrCtxtCameron Steffen-322/+316
TypeErrCtxt optionally has a TypeckResults so that InferCtxt doesn't need to.
2022-10-07Check WhereClauseReferencesSelf after all other object safety checksMichael Goulet-13/+15
2022-10-05Validate opaques in default trait bodies, don't normalize unless a body is ↵Michael Goulet-1/+2
provided
2022-10-05Fix test for default body with implMichael Goulet-2/+3
2022-10-04Rollup merge of #102670 - lyming2007:issue-101866-fix, r=compiler-errorsMichael Howell-1/+1
follow-up fix about 101866 to print the self type. modified: compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs modified: src/test/ui/error-codes/E0283.stderr modified: src/test/ui/error-codes/E0790.stderr modified: src/test/ui/traits/static-method-generic-inference.stderr modified: src/test/ui/type/issue-101866.stderr
2022-10-05Support default-body trait functions with RPITITMichael Goulet-3/+43
2022-10-04follow-up fix about 101866 to print the self type.Yiming Lei-1/+1
modified: compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs modified: src/test/ui/error-codes/E0283.stderr modified: src/test/ui/error-codes/E0790.stderr modified: src/test/ui/traits/static-method-generic-inference.stderr modified: src/test/ui/type/issue-101866.stderr
2022-10-04Rollup merge of #102651 - oli-obk:non_region_things, r=lcnrMatthias Krüger-20/+20
It's not about types or consts, but the lack of regions pulled out of https://github.com/rust-lang/rust/pull/101900 which adds a fourth kind of non-lifetime generic parameter, and the naming of these methods would get ridiculous.
2022-10-04Rollup merge of #102647 - oli-obk:tilde_const_bounds, r=fee1-deadMatthias Krüger-0/+26
Only allow ~const bounds for traits with #[const_trait] r? `@fee1-dead`
2022-10-04Rollup merge of #102488 - compiler-errors:gat-compatibility, r=oli-obkMatthias Krüger-2/+40
Check generic argument compatibility when projecting assoc ty Fixes #102114
2022-10-04It's not about types or consts, but the lack of regionsOli Scherer-20/+20
2022-10-04Merge the `~const` and `impl const` checks and add some explanatory notesOli Scherer-2/+24
2022-10-04Only allow ~const bounds for traits with #[const_trait]Oli Scherer-0/+4
2022-10-03Rollup merge of #102613 - TaKO8Ki:fix-part-of-101739, r=compiler-errorsMatthias Krüger-5/+8
Fix ICE #101739 Fixes a part of #101739 This cannot cover the following case. It causes `too many args provided` error and obligation does not have references error. I want your advice to solve the following cases as well in this pull request or a follow-up. ```rust #![crate_type = "lib"] #![feature(transmutability)] #![allow(dead_code, incomplete_features, non_camel_case_types)] mod assert { use std::mem::BikeshedIntrinsicFrom; pub fn is_transmutable< Src, Dst, Context, const ASSUME_ALIGNMENT: bool, const ASSUME_LIFETIMES: bool, const ASSUME_VALIDITY: bool, const ASSUME_VISIBILITY: bool, >() where Dst: BikeshedIntrinsicFrom< Src, Context, ASSUME_ALIGNMENT, ASSUME_LIFETIMES, ASSUME_VALIDITY, ASSUME_VISIBILITY, >, {} } fn via_const() { struct Context; #[repr(C)] struct Src; #[repr(C)] struct Dst; const FALSE: bool = false; assert::is_transmutable::<Src, Dst, Context, FALSE, FALSE, FALSE, FALSE>(); } ```
2022-10-03check if const is ADT or notTakayuki Maeda-9/+8
2022-10-03return when obligation has references_errorTakayuki Maeda-0/+4
2022-10-01Auto merge of #101986 - WaffleLapkin:move_lint_note_to_the_bottom, r=estebankbors-93/+93
Move lint level source explanation to the bottom So, uhhhhh r? `@estebank` ## User-facing change "note: `#[warn(...)]` on by default" and such are moved to the bottom of the diagnostic: ```diff - = note: `#[warn(unsupported_calling_conventions)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #87678 <https://github.com/rust-lang/rust/issues/87678> + = note: `#[warn(unsupported_calling_conventions)]` on by default ``` Why warning is enabled is the least important thing, so it shouldn't be the first note the user reads, IMO. ## Developer-facing change `struct_span_lint` and similar methods have a different signature. Before: `..., impl for<'a> FnOnce(LintDiagnosticBuilder<'a, ()>)` After: `..., impl Into<DiagnosticMessage>, impl for<'a, 'b> FnOnce(&'b mut DiagnosticBuilder<'a, ()>) -> &'b mut DiagnosticBuilder<'a, ()>` The reason for this is that `struct_span_lint` needs to edit the diagnostic _after_ `decorate` closure is called. This also makes lint code a little bit nicer in my opinion. Another option is to use `impl for<'a> FnOnce(LintDiagnosticBuilder<'a, ()>) -> DiagnosticBuilder<'a, ()>` altough I don't _really_ see reasons to do `let lint = lint.build(message)` everywhere. ## Subtle problem By moving the message outside of the closure (that may not be called if the lint is disabled) `format!(...)` is executed earlier, possibly formatting `Ty` which may call a query that trims paths that crashes the compiler if there were no warnings... I don't think it's that big of a deal, considering that we move from `format!(...)` to `fluent` (which is lazy by-default) anyway, however this required adding a workaround which is unfortunate. ## P.S. I'm sorry, I do not how to make this PR smaller/easier to review. Changes to the lint API affect SO MUCH 😢
2022-10-01Refactor rustc lint APIMaybe Waffle-93/+93
2022-09-30Rollup merge of #102506 - TaKO8Ki:specify-dyn-kind, r=lcnrMatthias Krüger-1/+1
Specify `DynKind::Dyn` ref: https://github.com/rust-lang/rust/pull/101212#discussion_r958861297
2022-09-30Rollup merge of #102421 - lyming2007:issue-101866, r=lcnrMatthias Krüger-5/+14
remove the unused :: between trait and type to give user correct diag… …nostic information modified: compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs new file: src/test/ui/type/issue-101866.rs new file: src/test/ui/type/issue-101866.stderr
2022-09-30specify `DynKind::Dyn`Takayuki Maeda-1/+1
2022-09-30Auto merge of #102304 - lcnr:coherence-cleanup, r=compiler-errorsbors-33/+0
remove outdated coherence hack we have a more precise detection for downstream conflicts in candidate assembly: the `is_knowable` check in `candidate_from_obligation_no_cache`. r? types cc `@nikomatsakis`
2022-09-29remove the unused :: between trait and type to give user correct diagnostic ↵Yiming Lei-5/+14
information modified: compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs new file: src/test/ui/type/issue-101866.rs new file: src/test/ui/type/issue-101866.stderr
2022-09-29Check generic argument compatibility when projecting assoc tyMichael Goulet-2/+40
2022-09-29only allow `ConstEquate` with `feature(gce)`lcnr-23/+26
2022-09-28update fixmelcnr-5/+5