about summary refs log tree commit diff
path: root/src/librustc_trait_selection/traits
AgeCommit message (Collapse)AuthorLines
2020-05-17merge lazy_normalization_consts into const_genericsBastian Kauschke-1/+1
2020-05-17explicitly handle errors in `select`Bastian Kauschke-13/+19
2020-05-17explicitly handle errors in fulfillBastian Kauschke-11/+12
2020-05-17initial cleanupBastian Kauschke-3/+6
2020-05-17Put lazy normalization behind a feature gateBen Lewis-0/+14
2020-05-17Assume unevaluated consts are equal to the other consts and add ConstEquate ↵Ben Lewis-52/+178
obligation. This delays the need to evaluate consts eagerly and therefore gets around const eval query cycles.
2020-05-17Rollup merge of #72282 - jonas-schievink:issue-typo, r=Dylan-DPCDylan DPC-1/+1
Fix issue number typo in note
2020-05-17Rollup merge of #72281 - estebank:fix-ws-sugg, r=Dylan-DPCDylan DPC-1/+1
Fix whitespace in `?Sized` structured suggestion
2020-05-16Fix issue number typo in noteJonas Schievink-1/+1
2020-05-16Fix whitespace in `?Sized` structured suggestionEsteban Küber-1/+1
2020-05-16Rollup merge of #72216 - doctorn:require-lang-item, r=lcnrDylan DPC-2/+3
Remove `lang_items\(\).*\.unwrap\(\)` Follows up #72170 to remove the remaining uses of `lang_items\(\).*\.unwrap\(\)` (avoids a bunch of potential ICEs when working in `#![no_core]`). Resolves #72195
2020-05-16Rollup merge of #71948 - csmoe:issue-61076, r=oli-obkDylan DPC-1/+143
Suggest to await future before ? operator Closes https://github.com/rust-lang/rust/issues/71811 cc #61076
2020-05-15Remove lang_items\(\).*\.unwrap\(\)Nathan Corbyn-2/+3
2020-05-15implement type_implments_trait querycsmoe-19/+60
2020-05-14Rollup merge of #72194 - doctorn:dispatch-from-dyn-ice, r=estebankDylan DPC-6/+23
Don't ICE on missing `Unsize` impl Previously code of the form ```rust #![feature(unsize, dispatch_from_dyn)] use std::marker::Unsize; use std::ops::DispatchFromDyn; pub struct Foo<'a, T: ?Sized> { _inner: &'a &'a T, } impl<'a, T: ?Sized + Unsize<U>, U: ?Sized> DispatchFromDyn<Foo<'a, U>> for Foo<'a, T> {} ``` would generate an ICE due to the missing `Unsize` impl being run through the `suggest_change_mut` suggestion. This PR adds an early exit and a pointer to the appropriate docs regarding `Unsize` instead: ``` error[E0277]: the trait bound `&'a T: std::marker::Unsize<&'a U>` is not satisfied --> src/test/ui/issues/issue-71036.rs:11:1 | 11 | impl<'a, T: ?Sized + Unsize<U>, U: ?Sized> DispatchFromDyn<Foo<'a, U>> for Foo<'a, T> {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Unsize<&'a U>` is not implemented for `&'a T` | = note: all implementations of `Unsize` are provided automatically by the compiler, see <https://doc.rust-lang.org/stable/std/marker/trait.Unsize.html> for more information = note: required because of the requirements on the impl of `std::ops::DispatchFromDyn<&'a &'a U>` for `&'a &'a T` error: aborting due to previous error For more information about this error, try `rustc --explain E0277`. ``` r? @estebank Resolves #71036
2020-05-14Rollup merge of #72170 - lcnr:lang_item, r=oli-obkDylan DPC-2/+3
use `require_lang_item` over `unwrap`. Does not yet replace all uses of `lang_items\(\)\.*\.unwrap\(\)`, as there are more than I expected :sweat_smile: Fixes #72099 r? @RalfJung *edit: The goal of this this PR is to change ICE from missing lang items to a fatal error.*
2020-05-14Don't ICE on missing `Unsize` implNathan Corbyn-6/+23
2020-05-14Rollup merge of #72150 - jackh726:unnorm_projection, r=nikomatsakisRalf Jung-15/+6
Remove UnnormalizedProjection This was only used for the old chalk integration with chalk-engine r? @nikomatsakis
2020-05-13use `require_lang_item` over `unwrap`.Bastian Kauschke-2/+3
2020-05-12review commentsEsteban Küber-2/+9
2020-05-12Increase verbosity of bound restriction suggestionsEsteban Küber-4/+8
- Make the bound restriction suggestion `span_suggestion_verbose`. - Fix whitespace typo.
2020-05-12Suggest adding super trait constraintsEsteban Küber-4/+41
2020-05-12Remove ty::UnnormalizedProjectionJack Huey-15/+6
2020-05-11Rollup merge of #72109 - matthiaskrgr:cl8ppy, r=Dylan-DPCDylan DPC-5/+5
Fix clippy warnings Fixes clippy::{cone_on_copy, filter_next, redundant_closure, single_char_pattern, len_zero,redundant_field_names, useless_format, identity_conversion, map_clone, into_iter_on_ref, needless_return, option_as_ref_deref, unused_unit, unnecessary_mut_passed} r? @Dylan-DPC
2020-05-11Rollup merge of #72019 - matthewjasper:dont-skip-binder, r=davidtwcoDylan DPC-0/+9
Fix debug assertion in error code Closes #70813
2020-05-11Fix clippy warningsMatthias Krüger-5/+5
Fixes clippy::{cone_on_copy, filter_next, redundant_closure, single_char_pattern, len_zero,redundant_field_names, useless_format, identity_conversion, map_clone, into_iter_on_ref, needless_return, option_as_ref_deref, unused_unit, unnecessary_mut_passed}
2020-05-11bless ui testscsmoe-3/+19
2020-05-10remove try_trait lang itemcsmoe-32/+26
2020-05-10suggest await before try when performing trait selectioncsmoe-0/+91
2020-05-09add regression tests + improve method nameBastian Kauschke-4/+4
2020-05-09Rollup merge of #71555 - cjgillot:nameless, r=matthewjasperRalf Jung-2/+1
Remove ast::{Ident, Name} reexports. The reexport of `Symbol` into `Name` confused me.
2020-05-09Rollup merge of #69406 - jackh726:chalk-upgrade, r=nikomatsakisRalf Jung-14/+296
upgrade chalk and use chalk-solve/chalk-ir/chalk-rust-ir Reintegrate chalk into rustc. r? @nikomatsakis cc. @rust-lang/wg-traits
2020-05-09Rollup merge of #72018 - mark-i-m:canon-chalk, r=mark-i-mDylan DPC-1/+1
Fix canonicalization links
2020-05-08Fix debug assertion in error codeMatthew Jasper-0/+9
2020-05-08fix canonicalization linksmark-1/+1
2020-05-08Remove ast::{Ident, Name} reexports.Camille GILLOT-2/+1
2020-05-08checking on either interior or upvarcsmoe-119/+132
2020-05-07Reintegrate chalk using chalk-solveJack Huey-14/+296
2020-05-07perf: Revert accidental inclusion of a part of #69218Markus Westerlind-12/+6
This was accidentally included in #69494 after a rebase and given how much `inflate` and `keccak` stresses the obligation forest seems like a likely culprit to the regression in those benchmarks. (It is necessary in #69218 as obligation forest needs to accurately track the root variables or unifications will get lost)
2020-05-07Rollup merge of #71960 - estebank:fix-E0284, r=davidtwcoDylan DPC-3/+17
Fix E0284 to not use incorrect wording Fix #71584, fix #69683.
2020-05-07Fix E0284 to not use incorrect wordingEsteban Küber-3/+17
Fix #71584, fix #69683.
2020-05-07Auto merge of #55617 - oli-obk:stacker, r=nagisa,oli-obkbors-88/+108
Prevent compiler stack overflow for deeply recursive code I was unable to write a test that 1. runs in under 1s 2. overflows on my machine without this patch The following reproduces the issue, but I don't think it's sensible to include a test that takes 30s to compile. We can now easily squash newly appearing overflows by the strategic insertion of calls to `ensure_sufficient_stack`. ```rust // compile-pass #![recursion_limit="1000000"] macro_rules! chain { (EE $e:expr) => {$e.sin()}; (RECURSE $i:ident $e:expr) => {chain!($i chain!($i chain!($i chain!($i $e))))}; (Z $e:expr) => {chain!(RECURSE EE $e)}; (Y $e:expr) => {chain!(RECURSE Z $e)}; (X $e:expr) => {chain!(RECURSE Y $e)}; (A $e:expr) => {chain!(RECURSE X $e)}; (B $e:expr) => {chain!(RECURSE A $e)}; (C $e:expr) => {chain!(RECURSE B $e)}; // causes overflow on x86_64 linux // less than 1 second until overflow on test machine // after overflow has been fixed, takes 30s to compile :/ (D $e:expr) => {chain!(RECURSE C $e)}; (E $e:expr) => {chain!(RECURSE D $e)}; (F $e:expr) => {chain!(RECURSE E $e)}; // more than 10 seconds (G $e:expr) => {chain!(RECURSE F $e)}; (H $e:expr) => {chain!(RECURSE G $e)}; (I $e:expr) => {chain!(RECURSE H $e)}; (J $e:expr) => {chain!(RECURSE I $e)}; (K $e:expr) => {chain!(RECURSE J $e)}; (L $e:expr) => {chain!(RECURSE L $e)}; } fn main() { let x = chain!(D 42.0_f32); } ``` fixes #55471 fixes #41884 fixes #40161 fixes #34844 fixes #32594 cc @alexcrichton @rust-lang/compiler I looked at all code that checks the recursion limit and inserted stack growth calls where appropriate.
2020-05-06Rollup merge of #70908 - estebank:suggest-add, r=nikomatsakisDylan DPC-184/+6
Provide suggestions for type parameters missing bounds for associated types When implementing the binary operator traits it is easy to forget to restrict the `Output` associated type. `rustc` now accounts for different cases to lead users in the right direction to add the necessary restrictions. The structured suggestions in the following output are new: ``` error: equality constraints are not yet supported in `where` clauses --> $DIR/missing-bounds.rs:37:33 | LL | impl<B: Add> Add for E<B> where <B as Add>::Output = B { | ^^^^^^^^^^^^^^^^^^^^^^ not supported | = note: see issue #20041 <https://github.com/rust-lang/rust/issues/20041> for more information help: if `Output` is an associated type you're trying to set, use the associated type binding syntax | LL | impl<B: Add> Add for E<B> where B: Add<Output = B> { | ^^^^^^^^^^^^^^^^^ error[E0308]: mismatched types --> $DIR/missing-bounds.rs:11:11 | 7 | impl<B> Add for A<B> where B: Add { | - this type parameter ... 11 | A(self.0 + rhs.0) | ^^^^^^^^^^^^^^ expected type parameter `B`, found associated type | = note: expected type parameter `B` found associated type `<B as std::ops::Add>::Output` help: consider further restricting this bound | 7 | impl<B> Add for A<B> where B: Add + std::ops::Add<Output = B> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0369]: cannot add `B` to `B` --> $DIR/missing-bounds.rs:31:21 | 31 | Self(self.0 + rhs.0) | ------ ^ ----- B | | | B | help: consider restricting type parameter `B` | 27 | impl<B: std::ops::Add<Output = B>> Add for D<B> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ``` That output is given for the following cases: ```rust struct A<B>(B); impl<B> Add for A<B> where B: Add { type Output = Self; fn add(self, rhs: Self) -> Self { A(self.0 + rhs.0) //~ ERROR mismatched types } } struct D<B>(B); impl<B> Add for D<B> { type Output = Self; fn add(self, rhs: Self) -> Self { Self(self.0 + rhs.0) //~ ERROR cannot add `B` to `B` } } struct E<B>(B); impl<B: Add> Add for E<B> where <B as Add>::Output = B { type Output = Self; fn add(self, rhs: Self) -> Self { Self(self.0 + rhs.0) } } ```
2020-05-06bless issue-70818 test casecsmoe-10/+7
2020-05-06filter upvars that cause trait obligationcsmoe-120/+134
2020-05-05record upvar into GeneratorInteriorTypeCausecsmoe-17/+18
2020-05-05make yield span optionalcsmoe-7/+9
2020-05-05Rebase and use ena 0.14Markus Westerlind-15/+23
2020-05-05perf: Merge region_obligations snapshotting into the undo logMarkus Westerlind-1/+1
2020-05-05Move projection_cache into the combined undo logMarkus Westerlind-1/+1