about summary refs log tree commit diff
path: root/compiler/rustc_traits/src
AgeCommit message (Collapse)AuthorLines
2021-08-15De-dupe NLL HRTB diagnostics' use of `type_op_prove_predicate`Rémy Rakic-6/+22
2021-08-14Assign FIXMEs to me and remove obsolete onesDeadbeef-13/+2
Also fixed capitalization of documentation
2021-08-13Try to fix problemDeadbeef-2/+14
2021-08-13move Constness into TraitPredicateDeadbeef-4/+4
2021-07-25clippy:: append_instead_of_extendMatthias Krüger-2/+2
2021-07-16Add initial implementation of HIR-based WF checking for diagnosticsAaron Hill-2/+1
During well-formed checking, we walk through all types 'nested' in generic arguments. For example, WF-checking `Option<MyStruct<u8>>` will cause us to check `MyStruct<u8>` and `u8`. However, this is done on a `rustc_middle::ty::Ty`, which has no span information. As a result, any errors that occur will have a very general span (e.g. the definintion of an associated item). This becomes a problem when macros are involved. In general, an associated type like `type MyType = Option<MyStruct<u8>>;` may have completely different spans for each nested type in the HIR. Using the span of the entire associated item might end up pointing to a macro invocation, even though a user-provided span is available in one of the nested types. This PR adds a framework for HIR-based well formed checking. This check is only run during error reporting, and is used to obtain a more precise span for an existing error. This is accomplished by individually checking each 'nested' type in the HIR for the type, allowing us to find the most-specific type (and span) that produces a given error. The majority of the changes are to the error-reporting code. However, some of the general trait code is modified to pass through more information. Since this has no soundness implications, I've implemented a minimal version to begin with, which can be extended over time. In particular, this only works for HIR items with a corresponding `DefId` (e.g. it will not work for WF-checking performed within function bodies).
2021-07-04Combine individual limit queries into single `limits` queryAaron Hill-1/+1
2021-07-04Query-ify global limit attribute handlingAaron Hill-1/+1
2021-06-23Use HTTPS links where possibleSmitty-1/+1
2021-05-23Stabilize ops::ControlFlow (just the type)Scott McMurray-1/+0
2021-04-02Auto merge of #83207 - oli-obk:valtree2, r=lcnrbors-8/+19
normalize mir::Constant differently from ty::Const in preparation for valtrees Valtrees are unable to represent many kind of constant values (this is on purpose). For constants that are used at runtime, we do not need a valtree representation and can thus use a different form of evaluation. In order to make this explicit and less fragile, I added a `fold_constant` method to `TypeFolder` and implemented it for normalization. Normalization can now, when it wants to eagerly evaluate a constant, normalize `mir::Constant` directly into a `mir::ConstantKind::Val` instead of relying on the `ty::Const` evaluation. In the future we can get rid of the `ty::Const` in there entirely and add our own `Unevaluated` variant to `mir::ConstantKind`. This would allow us to remove the `promoted` field from `ty::ConstKind::Unevaluated`, as promoteds can never occur in the type system. cc `@rust-lang/wg-const-eval` r? `@lcnr`
2021-03-31Add var to BoundRegion. Add query to get bound vars for applicable items.Jack Huey-17/+21
2021-03-31Add tcx lifetime to BinderJack Huey-6/+11
2021-03-31Add a new normalization query just for mir constantsOli Scherer-8/+19
2021-03-23Add has_default to GenericParamDefKind::Constkadmin-1/+1
This currently creates a field which is always false on GenericParamDefKind for future use when consts are permitted to have defaults Update const_generics:default locations Previously just ignored them, now actually do something about them. Fix using type check instead of value Add parsing This adds all the necessary changes to lower const-generics defaults from parsing. Change P<Expr> to AnonConst This matches the arguments passed to instantiations of const generics, and makes it specific to just anonymous constants. Attempt to fix lowering bugs
2021-03-18Fix use of bare trait objects everywhereVadim Petrochenkov-1/+1
2021-03-03Fix testsRyan Levick-1/+1
2021-02-18Rollup merge of #82066 - matthewjasper:trait-ref-fix, r=jackh726Dylan DPC-5/+2
Ensure valid TraitRefs are created for GATs This fixes `ProjectionTy::trait_ref` to use the correct substs. Places that need all of the substs have been updated to not use `trait_ref`. r? ````@jackh726````
2021-02-13Make ProjectionTy::trait_ref truncate substs againMatthew Jasper-5/+2
Also make sure that type arguments of associated types are printed in some error messages.
2021-02-13Use debug log level for developer oriented logsTomasz Miąsko-1/+1
The information logged here is of limited general interest, while at the same times makes it impractical to simply enable logging and share the resulting logs due to the amount of the output produced. Reduce log level from info to debug for developer oriented information. For example, when building cargo, this reduces the amount of logs generated by `RUSTC_LOG=info cargo build` from 265 MB to 79 MB. Continuation of changes from 81350.
2021-02-02Update ChalkJack Huey-3/+2
2021-02-01Upgrade ChalkJack Huey-15/+120
2021-01-18Use ty::{IntTy,UintTy,FloatTy} in rustcLeSeulArtichaut-44/+42
2021-01-16Review changesJack Huey-75/+75
2021-01-16Use no_bound_varsJack Huey-6/+4
2021-01-16CleanupJack Huey-20/+8
2021-01-16CleanupJack Huey-1/+1
2021-01-16Remove PredicateKindJack Huey-1/+1
2021-01-16Intermediate formatting and suchJack Huey-8/+6
2021-01-16Remove PredicateKind::AtomJack Huey-2/+6
2020-12-27fix: small typo error in chalk/mod.rs0xflotus-1/+1
2020-12-18Make BoundRegion have a kind of BoungRegionKindJack Huey-45/+35
2020-12-11Move binder for dyn to each list itemJack Huey-29/+34
2020-11-18Don't run `resolve_vars_if_possible` in `normalize_erasing_regions`Joshua Nelson-3/+9
NOTE: `needs_infer()` needs to come after ignoring generic parameters
2020-11-17Auto merge of #78779 - LeSeulArtichaut:ty-visitor-return, r=oli-obkbors-5/+5
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-16compiler: fold by valueBastian Kauschke-22/+22
2020-11-14Introduce `TypeVisitor::BreakTy`LeSeulArtichaut-5/+5
2020-11-09Rollup merge of #78502 - matthewjasper:chalkup, r=nikomatsakisDylan DPC-292/+304
Update Chalk to 0.36.0 This PR updates Chalk and fixes a number of bugs in the chalk integration code. cc `@rust-lang/wg-traits` r? `@nikomatsakis`
2020-10-30Auto merge of #78182 - LeSeulArtichaut:ty-visitor-contolflow, r=lcnr,oli-obkbors-5/+7
TypeVisitor: use `std::ops::ControlFlow` instead of `bool` Implements MCP rust-lang/compiler-team#374. Blocked on FCP in rust-lang/compiler-team#374. r? `@lcnr` cc `@jonas-schievink`
2020-10-30Address review comment and update chalk to 0.36.0Matthew Jasper-29/+29
2020-10-30Fix various Chalk lowering bugsMatthew Jasper-42/+128
- Add more well-known traits - Use the correct binders when lowering trait objects - Use correct substs when lowering trait objects - Use the correct binders for opaque_ty_data - Lower negative impls with the correct polarity - Supply associated type values - Use `predicates_defined_on` for where clauses
2020-10-30Update chalk 0.32.0 -> 0.35.0Matthew Jasper-250/+176
2020-10-30Fix some more clippy warningsJoshua Nelson-21/+21
2020-10-30Remove implicit `Continue` typeLeSeulArtichaut-5/+5
2020-10-30TypeVisitor: use `ControlFlow` in rustc_{mir,privacy,traits,typeck}LeSeulArtichaut-5/+7
2020-10-16Review commentsJack Huey-8/+20
2020-10-16Use map_bound(_ref) instead of Binder::bind when possibleJack Huey-21/+13
2020-10-14Address commentsRoxane-0/+9
2020-10-11Replace tuple of infer vars for upvar_tys with single infer varRoxane-5/+19
This commit allows us to decide the number of captures required after completing capture ananysis, which is required as part of implementing RFC-2229. Co-authored-by: Aman Arora <me@aman-arora.com> Co-authored-by: Jenny Wills <wills.jenniferg@gmail.com>
2020-10-06Update to chalk 0.31. Implement some unimplemented. Ignore some tests in ↵Jack Huey-36/+53
compare mode chalk don't finish.