about summary refs log tree commit diff
path: root/compiler/rustc_hir/src
AgeCommit message (Collapse)AuthorLines
2021-02-15name async generators something more human friendly in type error diagnosticsGus Wynn-2/+21
2021-02-15Add `ptr::Pointee` trait (for all types) and `ptr::metadata` functionSimon Sapin-0/+4
RFC: https://github.com/rust-lang/rfcs/pull/2580
2021-02-14Rollup merge of #80920 - rylev:check_attr-refactor, r=davidtwcoDylan DPC-0/+2
Visit more targets when validating attributes This begins to address #80048, allowing for additional validation of attributes. There are more refactorings that can be done, though I think they should be tackled in additional PRs: * ICE when a builtin attribute is encountered that is not checked * Move some of the attr checking done `ast_validation` into `rustc_passes` * note that this requires a bit of additional refactoring, especially of extern items which currently parse attributes (and thus are a part of the AST) but do not possess attributes in their HIR representation. * Rename `Target` to `AttributeTarget` * Refactor attribute validation completely to go through `Visitor::visit_attribute`. * This would require at a minimum passing `Target` into this method which might be too big of a refactoring to be worth it. * It's also likely not possible to do all the validation this way as some validation requires knowing what other attributes a target has. r? `@davidtwco`
2021-02-13Remove ProjectionTy::from_ref_and_nameMatthew Jasper-0/+1
2021-02-09Visit more targets when checking attrsRyan Levick-0/+2
2021-02-09Rename HIR UnOp variantsÖmer Sinan Ağacan-8/+8
This renames the variants in HIR UnOp from enum UnOp { UnDeref, UnNot, UnNeg, } to enum UnOp { Deref, Not, Neg, } Motivations: - This is more consistent with the rest of the code base where most enum variants don't have a prefix. - These variants are never used without the `UnOp` prefix so the extra `Un` prefix doesn't help with readability. E.g. we don't have any `UnDeref`s in the code, we only have `UnOp::UnDeref`. - MIR `UnOp` type variants don't have a prefix so this is more consistent with MIR types. - "un" prefix reads like "inverse" or "reverse", so as a beginner in rustc code base when I see "UnDeref" what comes to my mind is something like "&*" instead of just "*".
2021-02-06Rollup merge of #81680 - camsteffen:primty, r=oli-obkJonas Schievink-0/+49
Refactor `PrimitiveTypeTable` for Clippy I removed `PrimitiveTypeTable` and added `PrimTy::ALL` and `PrimTy::from_name` in its place. This allows Clippy to use `PrimTy::from_name` for the `builtin_type_shadow` lint, and a `const` list of primitive types is deleted from Clippy code (the goal). All changes should be a little faster, if anything.
2021-02-05Rollup merge of #79554 - b-naber:generic-associated-types-in-trait-paths, ↵Mara Bos-0/+2
r=jackh726 Generic associated types in trait paths This is the second part of https://github.com/rust-lang/rust/pull/78978 This should fix: Fixes #67510 Fixes #68648 Fixes #68649 Fixes #68650 Fixes #68652 Fixes #74684 Fixes #76535 Fixes #79422 Fixes #80433 and implement the remaining functionality needed for https://github.com/rust-lang/rust/issues/44265 r? ``@matthewjasper``
2021-02-04Add unit test to ensure that both parts of a DefPathHash depend on the ↵Michael Woerister-3/+48
defining crate's ID.
2021-02-04add generic args to hir::TypeBindingb-naber-0/+2
2021-02-04Stabilize feature(iterator_fold_self): Iterator::reduceMara Bos-1/+0
2021-02-04Rename Iterator::fold_first to reduce.Mara Bos-1/+1
2021-02-04Add more explanation to local DefPathHash collision case.Michael Woerister-1/+8
2021-02-03Refactor out PrimitiveTypeTableCameron Steffen-0/+49
2021-02-02Let a portion of DefPathHash uniquely identify the DefPath's crate.Michael Woerister-20/+41
This allows to directly map from a DefPathHash to the crate it originates from, without constructing side tables to do that mapping. It also allows to reliably and cheaply check for DefPathHash collisions.
2021-02-02Bump rustfmt versionMark Rousskov-4/+4
Also switches on formatting of the mir build module
2021-02-01Fixed #[inline] to be warned in fields, arms, macro defsDanuel-0/+6
Add visitors for checking #[inline] Add visitors for checking #[inline] with struct field Fix test for #[inline] Add visitors for checking #[inline] with #[macro_export] macro Add visitors for checking #[inline] without #[macro_export] macro Add use alias with Visitor Fix lint error Reduce unnecessary variable Co-authored-by: LingMan <LingMan@users.noreply.github.com> Change error to warning Add warning for checking field, arm with #[allow_internal_unstable] Add name resolver Formatting Formatting Fix error fixture Add checking field, arm, macro def
2021-01-31Rollup merge of #80470 - SimonSapin:array-intoiter-type, r=m-ou-seJonas Schievink-1/+0
Stabilize by-value `[T; N]` iterator `core::array::IntoIter` Tracking issue: https://github.com/rust-lang/rust/issues/65798 This is unblocked now that `min_const_generics` has been stabilized in https://github.com/rust-lang/rust/pull/79135. This PR does *not* include the corresponding `IntoIterator` impl, which is https://github.com/rust-lang/rust/pull/65819. Instead, an iterator can be constructed through the `new` method. `new` would become unnecessary when `IntoIterator` is implemented and might be deprecated then, although it will stay stable.
2021-01-27Auto merge of #81393 - ↵bors-3/+3
pnkfelix:issue-81296-make-weak-item-traversal-deterministic, r=estebank Make weak item traversal deterministic Fix #81296. (No test added. The relevant test *is* ui/panic-handler/weak-lang-item.rs, and this change should make it less flaky.)
2021-01-26Auto merge of #80692 - Aaron1011:feature/query-result-debug, r=estebankbors-1/+1
Enforce that query results implement Debug Currently, we require that query keys implement `Debug`, but we do not do the same for query values. This can make incremental compilation bugs difficult to debug - there isn't a good place to print out the result loaded from disk. This PR adds `Debug` bounds to several query-related functions, allowing us to debug-print the query value when an 'unstable fingerprint' error occurs. This required adding `#[derive(Debug)]` to a fairly large number of types - hopefully, this doesn't have much of an impact on compiler bootstrapping times.
2021-01-25This should address issue 81294.Felix S. Klock II-3/+3
(No test added. The relevant test *is* ui/panic-handler/weak-lang-item.rs, and this change should make it less flaky.)
2021-01-24Auto merge of #80919 - cjgillot:defkey-span, r=oli-obkbors-0/+4
Generate metadata by iterating on DefId instead of traversing the HIR tree 1/N Sample from #80347.
2021-01-23Iterate DefId to encode spans.Camille GILLOT-0/+4
2021-01-21Add loop head span to hirEsteban Küber-2/+4
2021-01-16Enforce that query results implement DebugAaron Hill-1/+1
2021-01-17resolve: Reject ambiguity built-in attr vs different built-in attrVadim Petrochenkov-3/+4
2021-01-14Use Option::map_or instead of `.map(..).unwrap_or(..)`LingMan-1/+1
2021-01-14Auto merge of #79328 - c410-f3r:hir-if, r=matthewjasperbors-3/+12
Reintroduce hir::ExprKind::If Basically copied and paste #59288/https://github.com/rust-lang/rust-clippy/pull/4080 with some modifications. The vast majority of tests were fixed and now there are only a few remaining. Since I am still unable to figure out the missing pieces, any help with the following list is welcome. - [ ] **Unnecessary `typeck` exception**: [Cheated on this one to make CI green.](https://github.com/rust-lang/rust/pull/79328/files#diff-3faee9ba23fc54a12b7c43364ba81f8c5660045c7e1d7989a02a0cee1c5b2051) - [x] **Incorrect span**: [Span should reference `then` and `else` separately.](https://github.com/rust-lang/rust/pull/79328/files#diff-cf2c46e82222ee4b1037a68fff8a1af3c4f1de7a6b3fd798aacbf3c0475abe3d) - [x] **New note regarding `assert!`**: [Modified but not "wrong". Maybe can be a good thing?](https://github.com/rust-lang/rust/pull/79328/files#diff-9e0d7c89ed0224e2b62060c957177c27db43c30dfe3c2974cb6b5091cda9cfb5) - [x] **Inverted report location**: [Modified but not "wrong". Locations were inverted.](https://github.com/rust-lang/rust/pull/79328/files#diff-f637ce7c1f68d523a165aa9651765df05e36c4d7d279194b1a6b28b48a323691) - [x] **`src/test/ui/point-to-type-err-cause-on-impl-trait-return.rs` has weird errors**: [Not sure why this is happening.](https://github.com/rust-lang/rust/pull/79328/files#diff-c823c09660f5b112f95e97e8ff71f1797b6c7f37dbb3d16f8e98bbaea8072e95) - [x] **Missing diagnostic**: [???](https://github.com/rust-lang/rust/pull/79328/files#diff-6b8ab09360d725ba4513933827f9796b42ff9522b0690f80b76de067143af2fc)
2021-01-13Auto merge of #77524 - Patryk27:fixes/66228, r=estebankbors-12/+46
Rework diagnostics for wrong number of generic args (fixes #66228 and #71924) This PR reworks the `wrong number of {} arguments` message, so that it provides more details and contextual hints.
2021-01-12Separate out a `hir::Impl` structJoshua Nelson-19/+22
This makes it possible to pass the `Impl` directly to functions, instead of having to pass each of the many fields one at a time. It also simplifies matches in many cases.
2021-01-10Rework diagnostics for wrong number of generic argsPatryk Wychowaniec-12/+46
2021-01-07Reintroduce hir::ExprKind::IfCaio-3/+12
2021-01-05Rollup merge of #80538 - JulianKnodt:err_usize, r=lcnrYuki Okushi-0/+8
Add check for `[T;N]`/`usize` mismatch in astconv Helps clarify the issue in #80506 by adding a specific check for mismatches between [T;N] and usize. r? `@lcnr`
2021-01-04Add check for array/usize mismatch in astconvkadmin-0/+8
2021-01-02reduce borrowing and (de)referencing around match patterns ↵Matthias Krüger-10/+10
(clippy::match_ref_pats)
2021-01-01first pass at default values for const genericsJulian Knodt-1/+8
- Adds optional default values to const generic parameters in the AST and HIR - Parses these optional default values - Adds a `const_generics_defaults` feature gate
2020-12-31Rollup merge of #80551 - lcnr:const-arg-wildcard, r=varkorDylan DPC-5/+5
support pattern as const parents in type_of nice to know that there's still stuff about rust i didn't know about :laughing: fixes #80531 r? `@varkor`
2020-12-31support pattern as const parents in type_ofBastian Kauschke-5/+5
2020-12-30Rollup merge of #80495 - jyn514:rename-empty, r=petrochenkovMara Bos-1/+1
Rename kw::Invalid -> kw::Empty See https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/Is.20there.20a.20symbol.20for.20the.20empty.20string.3F/near/220054471 for context. r? `@petrochenkov`
2020-12-30Rename kw::Invalid -> kw::EmptyJoshua Nelson-1/+1
See https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/Is.20there.20a.20symbol.20for.20the.20empty.20string.3F/near/220054471 for context.
2020-12-29Remove `compile-fail` test suiteVadim Petrochenkov-1/+1
2020-12-29Stabilize by-value `[T; N]` iterator `core::array::IntoIter`Simon Sapin-1/+0
Tracking issue: https://github.com/rust-lang/rust/issues/65798 This is unblocked now that `min_const_generics` has been stabilized in https://github.com/rust-lang/rust/pull/79135. This PR does *not* include the corresponding `IntoIterator` impl, which is https://github.com/rust-lang/rust/pull/65819. Instead, an iterator can be constructed through the `new` method. `new` would become unnecessary when `IntoIterator` is implemented and might be deprecated then, although it will stay stable.
2020-12-19Auto merge of #79073 - davidtwco:issue-78957-const-param-attrs, r=lcnrbors-0/+23
passes: prohibit invalid attrs on generic params Fixes #78957. This PR modifies the `check_attr` pass so that attribute placement on generic parameters is checked for validity. r? `@lcnr`
2020-12-17Rollup merge of #79051 - LeSeulArtichaut:if-let-guard, r=matthewjasperYuki Okushi-1/+8
Implement if-let match guards Implements rust-lang/rfcs#2294 (tracking issue: #51114). I probably should do a few more things before this can be merged: - [x] Add tests (added basic tests, more advanced tests could be done in the future?) - [x] Add lint for exhaustive if-let guard (comparable to normal if-let statements) - [x] Fix clippy However since this is a nightly feature maybe it's fine to land this and do those steps in follow-up PRs. Thanks a lot `@matthewjasper` :heart: for helping me with lowering to MIR! Would you be interested in reviewing this? r? `@ghost` for now
2020-12-06Retain assembly operands span when lowering AST to HIRTomasz Miąsko-3/+3
2020-12-06Implement lowering of if-let guards to MIRLeSeulArtichaut-1/+3
2020-12-06Introduce if-let guards in the HIRLeSeulArtichaut-0/+5
2020-12-03Fix some clippy lintsJoshua Nelson-1/+1
2020-11-29passes: prohibit attrs on generic paramsDavid Wood-0/+23
This commit modifies the `check_attr` pass so that attribute placement on generic parameters is checked for validity. Signed-off-by: David Wood <david@davidtw.co>
2020-11-26Formatting.Camille GILLOT-6/+6