summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src
AgeCommit message (Collapse)AuthorLines
2021-02-04Auto merge of #81055 - matthewjasper:non-fatal-overflow, r=nikomatsakisbors-12/+3
Make hitting the recursion limit in projection non-fatal This change was originally made in #80246 to avoid future (effectively) infinite loop bugs in projections, but wundergraph relies on rustc recovering here. cc #80953 r? `@nikomatsakis`
2020-12-31Prevent caching projections in the case of cyclesMatthew Jasper-6/+12
When normalizing a projection which results in a cycle, we would cache the result of `project_type` without the nested obligations (because they're not needed for inference). This would result in the nested obligations only being handled once in fulfill, which would avoid the cycle error. Fixes #79714, a regresion from #79305 caused by the removal of `get_paranoid_cache_value_obligation`.
2020-12-31Make recursion limit fatal in projectMatthew Jasper-1/+8
This avoid the hang/oom from #79714
2020-12-19Handle desugaring in impl trait bound suggestionWilliam Bain-12/+6
2020-12-19Auto merge of #80132 - matthewjasper:revert-eval-order, r=nikomatsakisbors-3/+3
Revert change to trait evaluation order This change breaks some code and doesn't appear to enable any new code. closes #79902 r? `@nikomatsakis`
2020-12-19More rebindsJack Huey-46/+47
2020-12-17Revert change to evaluation orderMatthew Jasper-3/+3
This change breaks some code and doesn't appear to enable any new code.
2020-12-17Auto merge of #79945 - jackh726:existential_trait_ref, r=nikomatsakisbors-44/+45
Move binder for dyn to each list item This essentially changes `ty::Binder<&'tcx List<ExistentialTraitRef>>` to `&'tcx List<ty::Binder<ExistentialTraitRef>>`. This is a first step in moving the `dyn Trait` representation closer to Chalk, which we've talked about in `@rust-lang/wg-traits.` r? `@nikomatsakis`
2020-12-11use if let Some(x) = .. instead of ...map(|x|) to conditionally run fns ↵Matthias Krüger-21/+20
that return () (clippy::option_map_unit_fn)
2020-12-11don't clone types that are copy (clippy::clone_on_copy)Matthias Krüger-2/+2
2020-12-11Move binder for dyn to each list itemJack Huey-44/+45
2020-12-05remove redundant clonesMatthias Krüger-1/+1
2020-12-03Auto merge of #79637 - spastorino:revert-trait-inheritance-self, ↵bors-2/+1
r=Mark-Simulacrum Revert "Auto merge of #79209 r? `@nikomatsakis` This has caused some issues (#79560) so better to revert and try to come up with a proper fix without rush.
2020-12-02Revert "Auto merge of #79209 - spastorino:trait-inheritance-self, ↵Santiago Pastorino-2/+1
r=nikomatsakis" This reverts commit 349b3b324dade7ca638091db93ba08bbc443c63d, reversing changes made to b776d1c3e3db8befabb123ebb1e46c3531eaed46.
2020-12-01Ignore trait implementations with negative polarity when suggesting trait ↵ThePuzzlemaker-1/+11
implementations in diagnostics
2020-11-29Remove extra call to upvar_tysAman Arora-10/+0
Fixes #78720
2020-11-29Auto merge of #79209 - spastorino:trait-inheritance-self, r=nikomatsakisbors-1/+2
Allow Trait inheritance with cycles on associated types Fixes #35237 r? `@nikomatsakis` cc `@estebank`
2020-11-29Rollup merge of #79516 - jyn514:cleanup-trait-solver, r=Aaron1011Dylan DPC-2/+1
Remove unnecessary `mut` binding Found while fiddling around with https://github.com/rust-lang/rust/issues/77459.
2020-11-28Remove unnecessary `mut` bindingJoshua Nelson-2/+1
2020-11-27Change comments on types to doc-commentsJoshua Nelson-6/+6
2020-11-27Allow to self reference associated types in where clausesSantiago Pastorino-1/+2
2020-11-23Rollup merge of #79325 - LingMan:try_op, r=jonas-schievinkJonas Schievink-7/+3
Reduce boilerplate with the `?` operator `@rustbot` modify labels to +C-cleanup.
2020-11-23Reduce boilerplate with the `?` operatorLingMan-7/+3
2020-11-22winnow: drop non-const cand. in favor of constJonas Schievink-1/+9
2020-11-22Thread `Constness` through selectionJonas Schievink-15/+17
2020-11-19Move `rustc_ty` -> `rustc_ty_utils`LeSeulArtichaut-1/+1
2020-11-19Rollup merge of #79110 - estebank:issue-58964, r=oli-obkDylan DPC-6/+40
Remove redundant notes in E0275 Fix #58964.
2020-11-18review commentEsteban Küber-3/+1
2020-11-18Account for indirect cyclic requirementsEsteban Küber-1/+13
2020-11-18Remove redundant notes in E0275Esteban Küber-6/+30
Fix #58964.
2020-11-18Rollup merge of #79158 - lcnr:lazy-norm-coerce, r=oli-obkMara Bos-0/+1
type is too big -> values of the type are too big strictly speaking, `[u8; usize::MAX]` or even `[[[u128; usize::MAX]; usize::MAX]; usize::MAX]` are absolutely fine types as long as you don't try to deal with any values of it. This error message seems to cause some confusion imo, for example in https://github.com/rust-lang/rust/pull/79135#issuecomment-729361380 so I would prefer us to be more precise here. See the added test case which uses one of these types without causing an error. r? ``@oli-obk``
2020-11-17Auto merge of #78779 - LeSeulArtichaut:ty-visitor-return, r=oli-obkbors-50/+34
Introduce `TypeVisitor::BreakTy` Implements MCP rust-lang/compiler-team#383. r? `@ghost` cc `@lcnr` `@oli-obk` ~~Blocked on FCP in rust-lang/compiler-team#383.~~
2020-11-16wordslcnr-15/+13
2020-11-16compiler: fold by valueBastian Kauschke-165/+158
2020-11-16instrument `QueryNormalizer::fold_ty`Bastian Kauschke-0/+1
2020-11-15Rollup merge of #77802 - jyn514:bootstrap-specific, r=nikomatsakisJonas Schievink-2/+1
Allow making `RUSTC_BOOTSTRAP` conditional on the crate name Motivation: This came up in the [Zulip stream](https://rust-lang.zulipchat.com/#narrow/stream/233931-t-compiler.2Fmajor-changes/topic/Require.20users.20to.20confirm.20they.20know.20RUSTC_.E2.80.A6.20compiler-team.23350/near/208403962) for https://github.com/rust-lang/compiler-team/issues/350. See also https://github.com/rust-lang/cargo/pull/6608#issuecomment-458546258; this implements https://github.com/rust-lang/cargo/issues/6627. The goal is for this to eventually allow prohibiting setting `RUSTC_BOOTSTRAP` in build.rs (https://github.com/rust-lang/cargo/issues/7088). ## User-facing changes - `RUSTC_BOOTSTRAP=1` still works; there is no current plan to remove this. - Things like `RUSTC_BOOTSTRAP=0` no longer activate nightly features. In practice this shouldn't be a big deal, since `RUSTC_BOOTSTRAP` is the opposite of stable and everyone uses `RUSTC_BOOTSTRAP=1` anyway. - `RUSTC_BOOTSTRAP=x` will enable nightly features only for crate `x`. - `RUSTC_BOOTSTRAP=x,y` will enable nightly features only for crates `x` and `y`. ## Implementation changes The main change is that `UnstableOptions::from_environment` now requires an (optional) crate name. If the crate name is unknown (`None`), then the new feature is not available and you still have to use `RUSTC_BOOTSTRAP=1`. In practice this means the feature is only available for `--crate-name`, not for `#![crate_name]`; I'm interested in supporting the second but I'm not sure how. Other major changes: - Added `Session::is_nightly_build()`, which uses the `crate_name` of the session - Added `nightly_options::match_is_nightly_build`, a convenience method for looking up `--crate-name` from CLI arguments. `Session::is_nightly_build()`should be preferred where possible, since it will take into account `#![crate_name]` (I think). - Added `unstable_features` to `rustdoc::RenderOptions` I'm not sure whether this counts as T-compiler or T-lang; _technically_ RUSTC_BOOTSTRAP is an implementation detail, but it's been used so much it seems like this counts as a language change too. r? `@joshtriplett` cc `@Mark-Simulacrum` `@hsivonen`
2020-11-14Set the default `BreakTy` to `!`LeSeulArtichaut-0/+2
2020-11-14Use `TypeVisitor::BreakTy` in `structural_match::Search`LeSeulArtichaut-36/+15
2020-11-14Introduce `TypeVisitor::BreakTy`LeSeulArtichaut-14/+17
2020-11-13Push to result vector instead of allocatingDániel Buga-4/+1
Co-authored-by: lcnr <bastian_kauschke@hotmail.de>
2020-11-11Rollup merge of #78832 - lcnr:const-evaluatable-unevaluated, r=oli-obkJonas Schievink-0/+17
look at assoc ct, check the type of nodes an example where types matter are function objects, see the added test which previously passed. Now does a shallow comparison of unevaluated constants. r? ```@oli-obk```
2020-11-10Changed unwrap_or to unwrap_or_else in some places.Nicholas-Baron-1/+1
The discussion seems to have resolved that this lint is a bit "noisy" in that applying it in all places would result in a reduction in readability. A few of the trivial functions (like `Path::new`) are fine to leave outside of closures. The general rule seems to be that anything that is obviously an allocation (`Box`, `Vec`, `vec![]`) should be in a closure, even if it is a 0-sized allocation.
2020-11-08Auto merge of #78410 - lcnr:revert75443, r=nikomatsakisbors-2/+2
revert #75443, update mir validator This PR reverts rust-lang#75443 to fix rust-lang#75992 and instead uses rust-lang#75419 to fix rust-lang#75313. Adapts rust-lang#75419 to correctly deal with unevaluated constants as otherwise some `feature(const_evaluatable_checked)` tests would ICE. Note that rust-lang#72793 was also fixed by rust-lang#75443, but as that issue only concerns `feature(type_alias_impl_trait)` I deleted that test case for now and would reopen that issue. rust-lang#75443 may have also allowed some other code to now successfully compile which would make this revert a breaking change after 2 stable versions, but I hope that this is a purely theoretical concern. See https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/generator.20upvars/near/214617274 for more reasoning about this. r? `@nikomatsakis` `@eddyb` `@RalfJung`
2020-11-07Allow making `RUSTC_BOOTSTRAP` conditional on the crate nameJoshua Nelson-2/+1
The main change is that `UnstableOptions::from_environment` now requires an (optional) crate name. If the crate name is unknown (`None`), then the new feature is not available and you still have to use `RUSTC_BOOTSTRAP=1`. In practice this means the feature is only available for `--crate-name`, not for `#![crate_name]`; I'm interested in supporting the second but I'm not sure how. Other major changes: - Added `Session::is_nightly_build()`, which uses the `crate_name` of the session - Added `nightly_options::match_is_nightly_build`, a convenience method for looking up `--crate-name` from CLI arguments. `Session::is_nightly_build()`should be preferred where possible, since it will take into account `#![crate_name]` (I think). - Added `unstable_features` to `rustdoc::RenderOptions` There is a user-facing change here: things like `RUSTC_BOOTSTRAP=0` no longer active nightly features. In practice this shouldn't be a big deal, since `RUSTC_BOOTSTRAP` is the opposite of stable and everyone uses `RUSTC_BOOTSTRAP=1` anyway. - Add tests Check against `Cheat`, not whether nightly features are allowed. Nightly features are always allowed on the nightly channel. - Only call `is_nightly_build()` once within a function - Use booleans consistently for rustc_incremental Sessions can't be passed through threads, so `read_file` couldn't take a session. To be consistent, also take a boolean in `write_file_header`.
2020-11-07look at assoc ct, check the type of nodesBastian Kauschke-0/+17
2020-11-06Auto merge of #77856 - GuillaumeGomez:automatic-links-lint, r=jyn514,ollie27bors-1/+1
Add non_autolinks lint Part of #77501. r? `@jyn514`
2020-11-05Fix even more URLsGuillaume Gomez-1/+1
2020-11-04fix a couple of clippy warnings:Matthias Krüger-6/+2
filter_next manual_strip redundant_static_lifetimes single_char_pattern unnecessary_cast unused_unit op_ref redundant_closure useless_conversion
2020-11-02revert #75443 update mir validatorBastian Kauschke-2/+2
2020-11-02Fix formatYuki Okushi-90/+95