summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src
AgeCommit message (Collapse)AuthorLines
2021-10-04Auto merge of #89285 - jackh726:issue-88862, r=nikomatsakisbors-8/+8
Don't normalize opaque types with escaping late-bound regions Fixes #88862 Turns out, this has some really bad perf implications in large types (issue #88862). While we technically can handle them fine, it doesn't change test output either way. For now, revert with an added benchmark. Future attempts to change this back will have to consider perf. Needs a perf run once https://github.com/rust-lang/rustc-perf/pull/1033 is merged r? `@nikomatsakis`
2021-10-04Auto merge of #89125 - Aaron1011:remove-intercrate-cache, r=jackh726bors-6/+42
Don't use projection cache or candidate cache in intercrate mode Fixes #88969 It appears that *just* disabling the evaluation cache (in #88994) leads to other issues involving intercrate mode caching. I suspect that since we now always end up performing the full evaluation in intercrate mode, we end up 'polluting' the candidate and projection caches with results that depend on being in intercrate mode in some way. Previously, we might have hit a cached evaluation (stored during non-intercrate mode), and skipped doing this extra work in intercrate mode. The whole situation with intercrate mode caching is turning into a mess. Ideally, we would remove intercrate mode entirely - however, this might require waiting on Chalk.
2021-10-04Auto merge of #88994 - Aaron1011:intercrate-caching, r=jackh726bors-0/+16
Disable the evaluation cache when in intercrate mode It's possible to use the same `InferCtxt` with both an intercrate and non-intercrate `SelectionContext`. However, the local (inferctxt) evaluation cache is not aware of this distinction, so this kind of `InferCtxt` re-use will pollute the cache wth bad results. This commit avoids the issue by disabling the evaluation cache entirely during intercrate mode.
2021-09-03Auto merge of #88618 - m-ou-se:rollup-6tss5z6, r=m-ou-sebors-30/+5
Rollup of 7 pull requests Successful merges: - #88202 (Add an example for deriving PartialOrd on enums) - #88483 (Fix LLVM libunwind build for non-musl targets) - #88507 (Add test case for using `slice::fill` with MaybeUninit) - #88557 (small const generics cleanup) - #88579 (remove redundant / misplaced sentence from docs) - #88610 (Update outdated docs of array::IntoIter::new.) - #88613 (Update primitive docs for rust 2021.) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-09-03Rollup merge of #88557 - lcnr:const-generics-cleanup, r=BoxyUwUMara Bos-30/+5
small const generics cleanup
2021-09-03Auto merge of #86454 - tlyu:refactor-unsized-suggestions, r=davidtwcobors-67/+112
Refactor unsized suggestions `@rustbot` label +A-diagnostics +A-traits +A-typesystem +C-cleanup +T-compiler
2021-09-02Report cycle error using 'deepest' obligation in the cycleAaron Hill-1/+3
2021-09-02Preserve most sub-obligations in the projection cacheAaron Hill-49/+26
2021-09-01cleanup const generics FIXMElcnr-30/+5
2021-08-30Enforce diverging let...elseCameron Steffen-4/+5
2021-08-30rename const_evaluatable_checked to generic_const_exprsEllen-11/+11
:sparkles:
2021-08-27fmtDeadbeef-25/+30
2021-08-27Add `ty::BoundConstness`Deadbeef-22/+23
2021-08-27Auto merge of #88371 - Manishearth:rollup-pkkjsme, r=Manishearthbors-1/+5
Rollup of 11 pull requests Successful merges: - #87832 (Fix debugger stepping behavior with `match` expressions) - #88123 (Make spans for tuple patterns in E0023 more precise) - #88215 (Reland #83738: "rustdoc: Don't load all extern crates unconditionally") - #88216 (Don't stabilize creation of TryReserveError instances) - #88270 (Handle type ascription type ops in NLL HRTB diagnostics) - #88289 (Fixes for LLVM change 0f45c16f2caa7c035e5c3edd40af9e0d51ad6ba7) - #88320 (type_implements_trait consider obligation failure on overflow) - #88332 (Add argument types tait tests) - #88340 (Add `c_size_t` and `c_ssize_t` to `std::os::raw`.) - #88346 (Revert "Add type of a let tait test impl trait straight in let") - #88348 (Add field types tait tests) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-08-26Rollup merge of #88320 - sexxi-goose:issue-88103, r=nikomatsakisManish Goregaokar-1/+5
type_implements_trait consider obligation failure on overflow Fixes: #88103
2021-08-26rebaselcnr-4/+12
2021-08-26reviewlcnr-6/+6
2021-08-26shrink `ty::PredicateKind` againlcnr-7/+7
2021-08-26use `ty::Unevaluated` instead of def substs pairlcnr-47/+39
2021-08-26update `TypeFlags` to deal with missing ct substslcnr-12/+16
2021-08-26add `tcx` to `fn walk`lcnr-8/+9
2021-08-26make unevaluated const substs optionallcnr-20/+17
2021-08-26require a `tcx` for `TypeVisitor`lcnr-2/+16
2021-08-25trailing whitespaceNiko Matsakis-1/+1
2021-08-25update docs for `type_implements_trait`Niko Matsakis-0/+4
2021-08-25type_implements_trait consider obligation failure on overflowAman Arora-1/+1
2021-08-24Review commentsjackh726-39/+66
2021-08-24Normalize associated types with bound varsJack Huey-70/+115
2021-08-23Rollup merge of #88230 - steffahn:a_an, r=oli-obkMara Bos-10/+10
Fix typos “a”→“an” Fix typos in comments; found using a regex to find some easy instance of incorrect usage of a vs. an. While automation was used to find these, every change was checked manually. Changes in submodules get separate PRs: * https://github.com/rust-lang/stdarch/pull/1201 * https://github.com/rust-lang/cargo/pull/9821 * https://github.com/rust-lang/miri/pull/1874 * https://github.com/rust-lang/rls/pull/1746 * https://github.com/rust-analyzer/rust-analyzer/pull/9984 _folks @ rust-analyzer are fast at merging…_ * https://github.com/rust-analyzer/rust-analyzer/pull/9985 * https://github.com/rust-analyzer/rust-analyzer/pull/9987 * https://github.com/rust-analyzer/rust-analyzer/pull/9989 _For `clippy`, I don’t know if the changes should better better be moved to a PR to the original repo._ <hr> This has some overlap with #88226, but neither is a strict superset of the other. If you want multiple commits, I can split it up; in that case, make sure to suggest a criterion for splitting.
2021-08-22Auto merge of #88166 - BoxyUwU:const-equate-canon, r=lcnrbors-9/+2
canonicalize consts before calling try_unify_abstract_consts query Fixes #88022 Fixes #86953 Fixes #77708 Fixes #82034 Fixes #85031 these ICEs were all caused by calling the `try_unify_abstract_consts` query with inference vars in substs r? `@lcnr`
2021-08-22Fix typos “a”→“an”Frank Steffahn-10/+10
2021-08-22Auto merge of #88139 - lcnr:marker-trait-attr, r=nikomatsakisbors-3/+10
marker_traits: require `EvaluatedToOk` during winnowing closes #84955, while it doesn't really fix it in a way that makes me happy it should prevent the issue for now and this test can't be reproduced anyways, so it doesn't make much sense to keep it open. fixes #84917 as only one of the impls depends on regions, so we now drop the ambiguous one instead of the correct one. cc https://rust-lang.zulipchat.com/#narrow/stream/144729-wg-traits/topic/winnowing.20soundly/near/247899832 r? `@nikomatsakis`
2021-08-21Auto merge of #88135 - crlf0710:trait_upcasting_part_3, r=nikomatsakisbors-101/+205
Trait upcasting coercion (part 3) By using separate candidates for each possible choice, this fixes type-checking issues in previous commits. r? `@nikomatsakis`
2021-08-21Auto merge of #88149 - Mark-Simulacrum:prep-never-type, r=jackh726bors-0/+56
Refactor fallback code to prepare for never type This PR contains cherry-picks of some of `@nikomatsakis's` work from #79366, and shouldn't (AFAICT) represent any change in behavior. However, the refactoring is good regardless of the never type work being landed, and will reduce the size of those eventual PR(s) (and rebase pain). I am not personally an expert on this code, and the commits are essentially 100% `@nikomatsakis's,` but they do seem reasonable to me by my understanding. Happy to edit with review, of course. Commits are best reviewed in sequence rather than all together. r? `@jackh726` perhaps?
2021-08-20Require a box expression's type to be SizedAnton Golov-0/+3
2021-08-19introduce a Coerce predicateNiko Matsakis-0/+56
2021-08-19move code to `InferCtxt` methodEllen-16/+2
2021-08-19canonicalize const equate predicatesEllen-9/+16
2021-08-20Add assertion to ensure the query doesn't get called before type infererence ↵Charles Lew-2/+2
is done.
2021-08-18Auto merge of #86700 - lqd:matthews-nll-hrtb-errors, r=nikomatsakisbors-30/+38
Matthew's work on improving NLL's "higher-ranked subtype error"s This PR rebases `@matthewjasper's` [branch](https://github.com/matthewjasper/rust/tree/nll-hrtb-errors) which has great work to fix the obscure higher-ranked subtype errors that are tracked in #57374. These are a blocker to turning full NLLs on, and doing some internal cleanups to remove some of the old region code. The goal is so `@nikomatsakis` can take a look at this early, and I'll then do my best to help do the changes and followup work to land this work, and move closer to turning off the migration mode. I've only updated the branch and made it compile, removed a warning or two. r? `@nikomatsakis` (Here's the [zulip topic to discuss this](https://rust-lang.zulipchat.com/#narrow/stream/122657-t-compiler.2Fwg-nll/topic/.2357374.3A.20improving.20higher-ranked.20subtype.20errors.20via.20.2386700) that Niko wanted)
2021-08-18marker_traits: require `EvaluatedToOk`lcnr-3/+10
2021-08-18Fold `vtable_trait_upcasting_coercion_new_vptr_slot` logic into obligation ↵Charles Lew-45/+74
processing.
2021-08-18Properly generate multiple candidates for trait upcasting coercion.Charles Lew-63/+138
2021-08-17Auto merge of #87668 - estebank:tweak-bound-output, r=oli-obkbors-7/+8
Use note for pointing at bound introducing requirement Modify output for pointing where a trait bound obligation is introduced in an E0277 from using a span label to using a note in order to always preserve order of the output: Before: ``` error[E0277]: `<<Self as Case1>::A as Iterator>::Item` doesn't implement `Debug` --> $DIR/bounds-on-assoc-in-trait.rs:18:28 | LL | type A: Iterator<Item: Debug>; | ^^^^^ `<<Self as Case1>::A as Iterator>::Item` cannot be formatted using `{:?}` because it doesn't implement `Debug` | ::: $SRC_DIR/core/src/fmt/mod.rs:LL:COL | LL | pub trait Debug { | --------------- required by this bound in `Debug` | = help: the trait `Debug` is not implemented for `<<Self as Case1>::A as Iterator>::Item` ``` After: ``` error[E0277]: `<<Self as Case1>::A as Iterator>::Item` doesn't implement `Debug` --> $DIR/bounds-on-assoc-in-trait.rs:18:28 | LL | type A: Iterator<Item: Debug>; | ^^^^^ `<<Self as Case1>::A as Iterator>::Item` cannot be formatted using `{:?}` because it doesn't implement `Debug` | = help: the trait `Debug` is not implemented for `<<Self as Case1>::A as Iterator>::Item` note: required by a bound in `Debug` --> $SRC_DIR/core/src/fmt/mod.rs:LL:COL | LL | pub trait Debug { | ^^^^^^^^^^^^^^^ required by this bound in `Debug` ```
2021-08-16Use note to point at bound introducing requirementEsteban Küber-7/+8
2021-08-15Return the canonicalized query from type opsMatthew Jasper-30/+38
2021-08-14Assign FIXMEs to me and remove obsolete onesDeadbeef-1/+1
Also fixed capitalization of documentation
2021-08-13make check less conservative and add explanationDeadbeef-11/+24
2021-08-13Fix testsDeadbeef-2/+3
2021-08-13Fix assoc-type testDeadbeef-0/+9