about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection
AgeCommit message (Collapse)AuthorLines
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
2020-11-02Only separate notes if span is multilineYuki Okushi-5/+14
2020-11-02Add "this has type `{}` which {}" noteYuki Okushi-0/+4
2020-11-02Address some code reviewsYuki Okushi-94/+85
2020-11-02Separate complex multispan into some notesYuki Okushi-29/+114
2020-10-30Remove implicit `Continue` typeLeSeulArtichaut-11/+11
2020-10-30Use `ControlFlow::is{break,continue}`LeSeulArtichaut-3/+4
2020-10-30TypeVisitor: use `ControlFlow` in rustc_{infer,lint,trait_selection}LeSeulArtichaut-68/+78
2020-10-29Rollup merge of #78422 - estebank:fix-78372, r=pnkfelixJonas Schievink-7/+13
Do not ICE on invalid input Fix #78372.
2020-10-28Rollup merge of #78365 - lcnr:const-eval-obj-safety, r=oli-obkDylan DPC-47/+99
check object safety of generic constants As `Self` can only be effectively used in constants with `const_evaluatable_checked` this should not matter outside of it. Implements the first item of #72219 > Object safety interactions with constants r? @oli-obk for now cc @nikomatsakis
2020-10-27Add unsized_fn_params featureSantiago Pastorino-2/+2
2020-10-26Do not ICE on invalid inputEsteban Küber-7/+13
2020-10-26debug log `AbstractConst::new`Bastian Kauschke-0/+1
2020-10-26Rollup merge of #78214 - estebank:match-semicolon, r=oli-obkDylan DPC-5/+5
Tweak match arm semicolon removal suggestion to account for futures * Tweak and extend "use `.await`" suggestions * Suggest removal of semicolon on prior match arm * Account for `impl Future` when suggesting semicolon removal * Silence some errors when encountering `await foo()?` as can't be certain what the intent was *Thanks to https://twitter.com/a_hoverbear/status/1318960787105353728 for pointing this out!*
2020-10-25check for object safety violations in constantsBastian Kauschke-47/+98
2020-10-24Rollup merge of #78272 - lcnr:abstract-const-unused-node, r=oli-obkJonas Schievink-21/+64
const_evaluatable_checked: deal with unused nodes + div r? @oli-obk
2020-10-23review commentsEsteban Küber-14/+10
2020-10-23Do not ICE with TraitPredicates containing [type error]Esteban Küber-6/+13
Fix #77919.
2020-10-23Tweak "use `.await`" suggestionEsteban Küber-5/+5
2020-10-23reviewBastian Kauschke-32/+36
2020-10-23const_eval_checked: deal with unused nodes + divBastian Kauschke-12/+51
2020-10-22Normalize when finding trait object candidatesMatthew Jasper-65/+66
2020-10-21Fix ICE from projection cycleMatthew Jasper-20/+9
Cycles in normalization can cause evaluations to change from Unknown to Err. This means that some selection that were applicable no longer are. To avoid this: * Selection candidates that are known to be applicable are prefered over candidates that are not. * We don't ICE if a candidate is no longer applicable.
2020-10-21Rollup merge of #78002 - estebank:issue-77598, r=oli-obkYuki Okushi-48/+63
Tweak "object unsafe" errors CC #77598.
2020-10-20Rollup merge of #78076 - est31:orphan_mod, r=Mark-SimulacrumGuillaume Gomez-0/+0
Move orphan module-name/mod.rs files into module-name.rs files
2020-10-20review commentsEsteban Küber-45/+46