about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src
AgeCommit message (Collapse)AuthorLines
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
2021-08-13Pass constness to SelectionContextDeadbeef-20/+71
2021-08-13Make selection and evaluation caches use constnessDeadbeef-30/+57
2021-08-13fmtDeadbeef-1/+2
2021-08-13fmtDeadbeef-2/+3
2021-08-13Filter non-const impls when we expect a const oneDeadbeef-6/+23
2021-08-13move Constness into TraitPredicateDeadbeef-30/+24
2021-08-11Auto merge of #87587 - oli-obk:lazy_tait, r=spastorinobors-149/+85
Various refactorings of the TAIT infrastructure Before this PR we used to store the opaque type knowledge outside the `InferCtxt`, so it got recomputed on every opaque type instantiation. I also removed a feature gate check that makes no sense in the planned lazy TAIT resolution scheme Each commit passes all tests, so this PR is best reviewed commit by commit. r? `@spastorino`
2021-08-10Don't collect into a `Vec` that is immediately being iterated on again.Oli Scherer-3/+2
2021-08-09Do not ICE on HIR based WF check when involving lifetimesEsteban Küber-3/+4
Fix #87549.
2021-08-06Point to the value instead of the TAIT declaration for obligation failuresOli Scherer-12/+9
2021-08-06Store the `DefId` of the currently typechecked item in `InferCtxt`Oli Scherer-16/+7
This allows opaque type inference to check for defining uses without having to pass down that def id via function arguments to every method that could possibly cause an opaque type to be compared with a concrete type
2021-08-06Immediately register new opaque types in the global list.Oli Scherer-11/+14
Previously each opaque type instantiation would create new inference vars, even for the same opaque type/substs combination. Now there is a global map in InferCtxt that gets filled whenever we encounter an opaque type.
2021-08-06Split fold_opaque_tyOli Scherer-3/+14
2021-08-06Move some code around in preparation of splitting a functionOli Scherer-15/+15
2021-08-06Remove a field that is computed later anywayOli Scherer-22/+30
2021-08-06Move opaque type cache into `InferCtxt`Oli Scherer-78/+5
2021-08-03Auto merge of #86400 - FabianWolff:issue-85735, r=estebankbors-0/+1
Remove invalid suggestion involving `Fn` trait bound This pull request closes #85735. The actual issue is a duplicate of #21974, but #85735 contains a further problem, which is an invalid suggestion if `Fn`/`FnMut`/`FnOnce` trait bounds are involved: The suggestion code checks whether the trait bound ends with `>` to determine whether it has any generic arguments, but the `Fn*` traits have a special syntax for generic arguments that doesn't involve angle brackets. The example given in #85735: ```rust trait Foo {} impl<'a, 'b, T> Foo for T where T: FnMut(&'a ()), T: FnMut(&'b ()), { } ``` currently produces: ``` error[E0283]: type annotations needed --> src/lib.rs:4:8 | 4 | T: FnMut(&'a ()), | ^^^^^^^^^^^^^ cannot infer type for type parameter `T` | = note: cannot satisfy `T: FnMut<(&'a (),)>` help: consider specifying the type arguments in the function call | 4 | T: FnMut(&'a ())::<Self, Args>, | ^^^^^^^^^^^^^^ error: aborting due to previous error ``` which is incorrect, because there is no function call, and applying the suggestion would lead to a parse error. With my changes, I get: ``` error[E0283]: type annotations needed --> test.rs:4:8 | 4 | T: FnMut(&'a ()), | ^^^^^^^^^^^^^ cannot infer type for type parameter `T` | ::: [...]/library/core/src/ops/function.rs:147:1 | 147 | pub trait FnMut<Args>: FnOnce<Args> { | ----------------------------------- required by this bound in `FnMut` | = note: cannot satisfy `T: FnMut<(&'a (),)>` error: aborting due to previous error ``` i.e. I have added a check to prevent the invalid suggestion from being issued for `Fn*` bounds, while the underlying issue #21974 remains for now.
2021-08-03Remove invalid suggestion involving Fn trait boundFabian Wolff-0/+1