summary refs log tree commit diff
path: root/compiler/rustc_hir/src
AgeCommit message (Collapse)AuthorLines
2021-09-03Auto merge of #88572 - matthewjasper:if-let-scoping-fix, r=oli-obkbors-0/+1
Fix drop handling for `if let` expressions MIR lowering for `if let` expressions is now more complicated now that `if let` exists in HIR. This PR adds a scope for the variables bound in an `if let` expression and then uses an approach similar to how we handle loops to ensure that we reliably drop the correct variables. Closes #88307 cc `@flip1995` `@richkadel` `@c410-f3r`
2021-09-01Fix drop handling for `if let` expressionsMatthew Jasper-0/+1
MIR lowering for `if let` expressions is now more complicated now that `if let` exists in HIR. This PR adds a scope for the variables bound in an `if let` expression and then uses an approach similar to how we handle loops to ensure that we reliably drop the correct variables.
2021-09-01Compute proc_macros in resolutions.Camille GILLOT-3/+0
2021-09-01Compute all_traits_impls during resolution.Camille GILLOT-1/+0
2021-09-01Stop sorting bodies by span.Camille GILLOT-6/+0
The definition order is already close to the span order, and only differs in corner cases.
2021-08-31Rollup merge of #88486 - bjorn3:better_arena_macro, r=jackh726Mara Bos-2/+2
Remove unused arena macro args
2021-08-30Remove unused arena macro argsbjorn3-2/+2
2021-08-30remove lazy_normalization_constsEllen-1/+1
2021-08-28Remove obsolete `MacroDef` variant of `OwnerNode`inquisitivecrystal-27/+5
2021-08-28Treat macros as HIR itemsinquisitivecrystal-55/+10
2021-08-26Rollup merge of #88123 - camelid:tup-pat-precise-spans, r=estebankManish Goregaokar-2/+33
Make spans for tuple patterns in E0023 more precise As suggested in #86307. Closes #86307. r? ````@estebank````
2021-08-25Rollup merge of #88196 - asquared31415:named-asm-labels-refactor, r=AmanieuLéo Lanteri Thauvin-0/+1
Refactor `named_asm_labels` to a HIR lint As discussed on #88169, the `named_asm_labels` lint could be moved to a HIR lint. That allows future lints or custom plugins or clippy lints to more easily access the `asm!` macro's data and create better error messages with the lints.
2021-08-25Auto merge of #87875 - asquared31415:generic-lang-items, r=cjgillotbors-151/+163
Improve detection of generics on lang items Adds detection for the required generics for all lang items. Many lang items require an exact or minimum amount of generic arguments and if they don't exist, the compiler will ICE. This does not add any additional validation about bounds on generics or any other lang item restrictions. Fixes one of the ICEs in #87573 cc `@FabianWolff`
2021-08-24Move `named_asm_labels` to a HIR lintasquared31415-0/+1
2021-08-23Detect incorrect number of lang item genericsasquared31415-151/+163
2021-08-22Fix typos “an”→“a” and a few different ones that appeared in the ↵Frank Steffahn-1/+1
same search
2021-08-22Fix typos “a”→“an”Frank Steffahn-2/+2
2021-08-21Use an exhaustive match in `Node::ident()` and add docsNoah Lev-2/+33
This should cause a compiler error in the future if more variants are added without `Node::ident()` being updated.
2021-08-15Introduce hir::ExprKind::Let - Take 2Caio-15/+15
2021-08-13Make assoc types work with `?const `opt=outDeadbeef-2/+8
2021-08-13Fix call-generic-method-nonconst testDeadbeef-1/+5
2021-08-13move Constness into TraitPredicateDeadbeef-0/+9
2021-08-06Auto merge of #87462 - ibraheemdev:tidy-file-length-ignore-comment, ↵bors-1/+0
r=Mark-Simulacrum Ignore comments in tidy-filelength Ref https://github.com/rust-lang/rust/issues/60302#issuecomment-652402127
2021-08-01Auto merge of #87449 - matthiaskrgr:clippyy_v2, r=nagisabors-1/+1
more clippy::complexity fixes (also a couple of clippy::perf fixes)
2021-07-30Do not discard `?Sized` type params and suggest their removalEsteban Küber-0/+3
2021-07-28Make const panic!("..") work in Rust 2021.Mara Bos-0/+3
During const eval, this replaces calls to core::panicking::panic_fmt and std::panicking::being_panic_fmt with a call to a new const fn: core::panicking::const_panic_fmt. That function uses fmt::Arguments::as_str() to get the str and calls panic_str with that instead. panic!() invocations with formatting arguments are still not accepted, as the creation of such a fmt::Arguments cannot be done in constant functions right now.
2021-07-27Auto merge of #83484 - JulianKnodt:infer, r=oli-obk,lcnrbors-13/+65
Add hir::GenericArg::Infer In order to extend inference to consts, make an Infer type on hir::GenericArg.
2021-07-26Actually infer args in visitorskadmin-14/+35
2021-07-25ignore comments in tidy-filelengthibraheemdev-1/+0
2021-07-25Auto merge of #83723 - cjgillot:ownernode, r=petrochenkovbors-60/+220
Store all HIR owners in the same container This replaces the previous storage in a BTreeMap for each of Item/ImplItem/TraitItem/ForeignItem. This should allow for a more compact storage. Based on https://github.com/rust-lang/rust/pull/83114
2021-07-25clippy::filter_map_identityMatthias Krüger-1/+1
2021-07-25Introduce OwnerNode::Crate.Camille GILLOT-27/+44
2021-07-25Merge the BTreeMap in hir::Crate.Camille GILLOT-57/+200
2021-07-25Add inferred args to typeckkadmin-6/+1
2021-07-25Add generic arg inferkadmin-0/+36
2021-07-24Auto merge of #86580 - BoxyUwU:cgd-subst-ice, r=nikomatsakisbors-0/+3
dont provide fwd declared params to cg defaults Fixes #83938 ```rust #![feature(const_evaluatable_checked, const_generics, const_generics_defaults)] #![allow(incomplete_features)] pub struct Bar<const N: usize, const M: usize = { N + 1 }>; pub fn foo<const N1: usize>() -> Bar<N1> { loop {} } fn main() {} ``` This PR makes this code no longer ICE, it was ICE'ing previously because when building substs for `Bar<N1>` we would subst the anon ct: `ConstKind::Unevaluated({N + 1}, substs: [N, M])` with substs of `[N1]`. the anon const has forward declared params supplied though so we end up trying to substitute the provided `M` param which causes the ICE. This PR doesn't handle the predicates of the const so ```rust trait Foo<const N: usize> { const Assoc: usize; } pub struct Bar<const N: usize = { <()>::Assoc }> where (): Foo<N>; ``` Resolves to `<() as Foo<N>>::Assoc` which can allow for using fwd declared params indirectly. ```rust trait Foo<const N: usize> {} struct Bar<const N: usize = { 2 + 3 }> where (): Foo<N>; ``` This code also ICEs under this PR because instantiating the default's predicates causes an ICE as predicates_of contains predicates with fwd declared params PR was briefly discussed [in this zulip thread](https://rust-lang.zulipchat.com/#narrow/stream/260443-project-const-generics/topic/evil.20preds.20in.20param.20env.20.2386580)
2021-07-24change doc commentEllen-1/+1
2021-07-21Rollup merge of #87273 - fee1-dead:impl-const-impl-bounds, r=oli-obkGuillaume Gomez-0/+21
Recognize bounds on impls as const bounds r? ```@oli-obk```
2021-07-19Recognize bounds on impls as const boundsDeadbeef-0/+21
2021-07-18Use == to compare OpaqueTyOrigin valuesSantiago Pastorino-1/+1
2021-07-18Remove OpaqueTyOrigin::Misc, use TyAlias insteadSantiago Pastorino-2/+0
2021-07-17Remove OpaqueTyOrigin::BindingSantiago Pastorino-2/+0
2021-07-15Remove refs from pat slicesCameron Steffen-8/+8
2021-07-13Put checking if anonct is a default into a method on hir mapEllen-0/+3
2021-07-11Auto merge of #85941 - cjgillot:qresolve, r=Aaron1011bors-2/+2
Reduce the amount of untracked state in TyCtxt -- Take 2 Main part of #85153 The offending line (https://github.com/rust-lang/rust/pull/85153#discussion_r642866298) is replaced by a FIXME until the possible bug and the perf concern are both resolved. r? `@Aaron1011`
2021-07-08Rollup merge of #86726 - ↵Guillaume Gomez-3/+0
sexxi-goose:use-diagnostic-item-for-rfc2229-migration, r=nikomatsakis Use diagnostic items instead of lang items for rfc2229 migrations This PR removes the `Send`, `UnwindSafe` and `RefUnwindSafe` lang items introduced in https://github.com/rust-lang/rust/pull/84730, and uses diagnostic items instead to check for `Send`, `UnwindSafe` and `RefUnwindSafe` traits for RFC2229 migrations. r? ```@nikomatsakis```
2021-07-06Make resolutions a query.Camille GILLOT-2/+2
2021-07-06Auto merge of #86143 - bjorn3:revert_revert_merge_crate_disambiguator, ↵bors-11/+6
r=michaelwoerister Reland "Merge CrateDisambiguator into StableCrateId" Reverts https://github.com/rust-lang/rust/pull/85891 as this revert of #85804 made perf even worse. r? `@Mark-Simulacrum`
2021-07-06Revert "Revert "Fix test""bjorn3-8/+5
This reverts commit 6c5b6985fdce0921fe4ac0247fd026355953c1ea.
2021-07-06Revert "Revert "Merge CrateDisambiguator into StableCrateId""bjorn3-3/+1
This reverts commit 8176ab8bc18fdd7d3c2cf7f720c51166364c33a3.