about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection
AgeCommit message (Collapse)AuthorLines
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-29Remove from compiler/ cratesreez12g-1/+0
2022-09-28update fixmelcnr-5/+5
2022-09-28Rollup merge of #102378 - compiler-errors:issue-102289, r=jackh726Yuki Okushi-1/+2
Use already resolved `self_ty` in `confirm_fn_pointer_candidate` Fixes #102289
2022-09-28Rollup merge of #102348 - nnethercote:tweak-FulfillProcessor, r=jackh726Yuki Okushi-12/+12
Tweak `FulfillProcessor`. Avoids some unnecessary references and lifetimes. r? `@jackh726`
2022-09-27Use already resolved self_ty in confirm_fn_pointer_candidateMichael Goulet-1/+2
2022-09-27Tweak `FulfillProcessor`.Nicholas Nethercote-12/+12
Avoids some unnecessary references and lifetimes.
2022-09-26remove outdated coherence hacklcnr-33/+0
2022-09-26remove cfg(bootstrap)Pietro Albini-2/+0
2022-09-25Rollup merge of #102016 - lcnr:given-OutlivesEnvironment, r=jackh726Matthias Krüger-1/+2
implied_bounds: deal with inference vars fixes #101951 while computing implied bounds for `<<T as ConstructionFirm>::Builder as BuilderFn<'_>>::Output` normalization replaces a projection with an inference var (adding a `Projection` obligation). Until we prove that obligation, this inference var remains unknown, which caused us to miss an implied bound necessary to prove that the unnormalized projection from the trait method signature is wf. r? types
2022-09-24Auto merge of #102040 - TaKO8Ki:separate-definitions-and-hir-owners, r=cjgillotbors-3/+5
Separate definitions and HIR owners in the type system Fixes #83158 r? `@cjgillot`
2022-09-24separate definitions and `HIR` ownersTakayuki Maeda-3/+5
fix a ui test use `into` fix clippy ui test fix a run-make-fulldeps test implement `IntoQueryParam<DefId>` for `OwnerId` use `OwnerId` for more queries change the type of `ParentOwnerIterator::Item` to `(OwnerId, OwnerNode)`
2022-09-24Rollup merge of #102204 - fee1-dead-contrib:manually-drop-trivially-drop, ↵Matthias Krüger-0/+3
r=oli-obk Make `ManuallyDrop` satisfy `~const Destruct`
2022-09-23Make `ManuallyDrop` satisfy `~const Destruct`Deadbeef-0/+3
2022-09-23Auto merge of #102192 - matthiaskrgr:rollup-0ctjzco, r=matthiaskrgrbors-19/+1
Rollup of 7 pull requests Successful merges: - #102094 (Add missing documentation for `bool::from_str`) - #102115 (Add examples to `bool::then` and `bool::then_some`) - #102134 (Detect panic strategy using `rustc --print cfg`) - #102137 (Don't convert valtree to constvalue during normalization) - #102148 (add regression test for miri issue 2433) - #102158 (rustdoc: clean up CSS/DOM for deprecation warnings) - #102177 (Fix a typo in `std`'s root docs) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-09-23Rollup merge of #102137 - b-naber:lazy-const-val-conversion, r=lcnrMatthias Krüger-19/+1
Don't convert valtree to constvalue during normalization r? ``@lcnr``
2022-09-23Auto merge of #102056 - b-naber:unevaluated, r=lcnrbors-8/+11
Introduce mir::Unevaluated Previously the distinction between unevaluated constants in the type-system and in mir was not explicit and a little confusing. Probably better to introduce its own type for that. r? `@lcnr`
2022-09-23rename Unevaluated to UnevaluatedConstb-naber-6/+6
2022-09-22Auto merge of #102139 - Dylan-DPC:rollup-ljlipt8, r=Dylan-DPCbors-18/+21
Rollup of 8 pull requests Successful merges: - #101598 (Update rustc's information on Android's sanitizers) - #102036 (Remove use of `io::ErrorKind::Other` in std) - #102037 (Make cycle errors recoverable) - #102069 (Skip `Equate` relation in `handle_opaque_type`) - #102076 (rustc_transmute: fix big-endian discriminants) - #102107 (Add missing space between notable trait tooltip and where clause) - #102119 (Fix a typo “pararmeter” in error message) - #102131 (Added which number is computed in compute_float.) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-09-22Rollup merge of #102037 - jyn514:normalize-docs, r=lcnrDylan DPC-18/+21
Make cycle errors recoverable In particular, this allows rustdoc to recover from cycle errors when normalizing associated types for documentation. In the past, ```@jackh726``` has said we need to be careful about overflow errors: https://github.com/rust-lang/rust/pull/91430#issuecomment-983997013 > Off the top of my head, we definitely should be careful about treating overflow errors the same as "not implemented for some reason" errors. Otherwise, you could end up with behavior that is different depending on recursion depth. But, that might be context-dependent. But cycle errors should be safe to unconditionally report; they don't depend on the recursion depth, they will always be an error whenever they're encountered. Helps with https://github.com/rust-lang/rust/issues/81091. r? ```@lcnr``` cc ```@matthewjasper```
2022-09-22Auto merge of #100980 - compiler-errors:normalize-opaque-w-bound-vars, r=lcnrbors-2/+2
Normalize opaques w/ bound vars First, we reenable normalization of opaque types with escaping late bound regions to fix rust-lang/miri#2433. This essentially reverts #89285. Second, we mitigate the perf regression found in #88862 by simplifying the way that we relate (sub and eq) GeneratorWitness types. This relies on the fact that we construct these GeneratorWitness types somewhat particularly (with all free regions found in the witness types replaced with late bound regions) -- but those bound regions really should be treated as existential regions, not universal ones. Those two facts leads me to believe that we do not need to use the full `higher_ranked_sub` machinery to relate two generator witnesses. I'm pretty confident that this is correct, but I'm glad to discuss this further.
2022-09-22don't convert valtree to constvalue during normalizationb-naber-19/+1
2022-09-22introduce mir::Unevaluatedb-naber-5/+8
2022-09-22Auto merge of #100982 - fee1-dead-contrib:const-impl-requires-const-trait, ↵bors-2/+3
r=oli-obk Require `#[const_trait]` on `Trait` for `impl const Trait` r? `@oli-obk`
2022-09-22Normalize opaques with escaping bound varsMichael Goulet-2/+2
2022-09-21FIX - adopt new Diagnostic naming in newly migrated modulesJhonny Bill Mena-1/+1
FIX - ambiguous Diagnostic link in docs UPDATE - rename diagnostic_items to IntoDiagnostic and AddToDiagnostic [Gardening] FIX - formatting via `x fmt` FIX - rebase conflicts. NOTE: Confirm wheather or not we want to handle TargetDataLayoutErrorsWrapper this way DELETE - unneeded allow attributes in Handler method FIX - broken test FIX - Rebase conflict UPDATE - rename residual _SessionDiagnostic and fix LintDiag link
2022-09-21UPDATE - rename DiagnosticHandler macro to DiagnosticJhonny Bill Mena-7/+7
2022-09-21UPDATE - rename DiagnosticHandler trait to IntoDiagnosticJhonny Bill Mena-9/+9
2022-09-21UPDATE - move SessionDiagnostic from rustc_session to rustc_errorsJhonny Bill Mena-2/+2
2022-09-21Auto merge of #100096 - compiler-errors:fn-return-must-be-sized, r=jackh726bors-1/+30
a fn pointer doesn't implement `Fn`/`FnMut`/`FnOnce` if its return type isn't sized I stumbled upon #83915 which hasn't received much attention recently, and I wanted to revive it since this is one existing soundness hole that seems pretty easy to fix. I'm not actually sure that the [alternative approach described here](https://github.com/rust-lang/rust/pull/83915#issuecomment-823643322) is sufficient, given the `src/test/ui/function-pointer/unsized-ret.rs` example I provided below. Rebasing the branch mentioned in that comment and testing that UI test, it seems that we actually end up only observing that `str: !Sized` during monomorphization, whereupon we ICE. Even if we were to fix that ICE, ideally we'd be raising an error that a fn pointer is being used badly during _typecheck_ instead of monomorphization, hence adapting the original approach in #83915. I am happy to close this if people would prefer we rebase the original PR and land that -- I am partly opening to be annoying and get people thinking about this unsoundness again :heart: :smile_cat: cc: `@estebank` and `@nikomatsakis` r? types Here's a link to the thread: https://rust-lang.zulipchat.com/#narrow/stream/144729-t-types/topic/PR.20.2383915/near/235421351 for more context.