about summary refs log tree commit diff
path: root/src/librustc/ty
AgeCommit message (Collapse)AuthorLines
2019-03-31Rollup merge of #59580 - taiki-e:coerce-closure, r=oli-obkMazdak Farrokhzad-7/+12
Allow closure to unsafe fn coercion Closes #57883
2019-03-31Rollup merge of #59519 - eddyb:layout-variants-refactor, r=oli-obkMazdak Farrokhzad-23/+34
rustc_target: factor out common fields of non-Single Variants. @tmandry and I were discussing ways to generalize the current variants/discriminant layout to allow more fields in the "`enum`" (or another multi-variant types, such as potentially generator state, in the future), shared by all variants, than just the tag/niche discriminant. This refactor should make it easier to extend multi-variant layouts, as nothing is duplicating anymore between "tagged enums" and "niche-filling enums". r? @oli-obk
2019-04-01Allow closure to unsafe fn coercionTaiki Endo-7/+12
2019-03-30Remove redundant importsFabian Drinck-1/+0
2019-03-30Move query definitions over to the proc macroJohn Kåre Alsaker-1806/+17
2019-03-30Rollup merge of #59343 - eddyb:rm-def-symbol-name, r=michaelwoeristerMazdak Farrokhzad-7/+2
rustc(codegen): uncache `def_symbol_name` prefix from `symbol_name`. The `def_symbol_name` query was an optimization to avoid recomputing the common part of a symbol name, as only the hash needs to be added to it for each symbol. However, #57967 will add a new mangling scheme, which doesn't readily support this kind of reuse - while it's plausible, it requires a lot more effort, since you'd have to "symbolically evaluate" mangling, and keep it in a form where the backreference positions can be computed correctly in the final step. So I want to see how much time we're actually saving with this `def_symbol_name` optimization, nowadays. cc @michaelwoerister
2019-03-30Rollup merge of #59376 - davidtwco:finally-rfc-2008-variants, ↵Mazdak Farrokhzad-2/+12
r=petrochenkov,QuietMisdreavus RFC 2008: Enum Variants Part of #44109. See [Zulip topic](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/rfc-2008/near/132663140) for previous discussion. r? @petrochenkov cc @nikomatsakis
2019-03-29rustc_target: factor out common fields of non-Single Variants.Eduard-Mihai Burtescu-23/+34
2019-03-29rustc(codegen): uncache `def_symbol_name` prefix from `symbol_name`.Eduard-Mihai Burtescu-7/+2
2019-03-28Implement `#[non_exhaustive]` on variants.David Wood-2/+7
This commit removes the check that disallows the `#[non_exhaustive]` attribute from being placed on enum variants and removes the associated tests. Further, this commit lowers the visibility of enum variant constructors when the variant is marked as non-exhaustive.
2019-03-28Rollup merge of #59216 - stepnivlk:type_dependent_defs-wrappers, r=oli-obkMazdak Farrokhzad-0/+9
Type dependent defs wrappers First of all, forgive me if something would seem lame to you or I offend some rule (although I tried to read through docs), this is my first PR. Issue: https://github.com/rust-lang/rust/issues/59094 This PR adds 3 helper methods to `TypeckTables`: * `opt_type_dependent_def` * `opt_type_dependent_def_id` * `type_dependent_def_id` I didn't add `type_dependent_def` as was proposed in the issue simply because it wasn't used anywhere in the code. Only non-option wrapped`type_dependent_defs()[]` accesses were found in clippy which always called `def_id()` on result. Speaking of clippy, should I open separate PR in its own repo, given it's used as submodule here? Sry it took me so long, as I said I'm new here and I had tough week :).
2019-03-28Rollup merge of #59091 - Zoxc:eval_always, r=michaelwoeristerMazdak Farrokhzad-3/+7
Combine input and eval_always query types Hardcoding `Krate` as a dependency of `eval_always` queries doesn't really make sense if we want to use the query system before HIR lowering / hashing. Without that hardcoding they become pretty much identical to `input` queries, so I combined them to a single type. This will regress the `clean` incremental scenario, but that isn't terribly common. r? @michaelwoerister
2019-03-27Rollup merge of #57293 - Zoxc:incr-passes3, r=michaelwoeristerJosh Stone-0/+3
Make some lints incremental Blocked on https://github.com/rust-lang/rust/pull/57253 r? @michaelwoerister
2019-03-27Add comments for new `AdtDef` functions.David Wood-0/+5
2019-03-26Combine input and eval_always query typesJohn Kåre Alsaker-3/+7
2019-03-26Rollup merge of #59315 - Zoxc:move-query, r=oli-obkMazdak Farrokhzad-139/+4
Add no_hash to query macro and move some queries over r? @oli-obk
2019-03-25Make some lints incrementalJohn Kåre Alsaker-0/+3
2019-03-24Re-order fields in `Def::Ctor`.David Wood-3/+3
This commit moves the `DefId` field of `Def::Ctor` to be the first field.
2019-03-24Move `CtorOf` into `hir::def`.David Wood-3/+3
This commit moves the definition of `CtorOf` from `rustc::hir` to `rustc::hir::def` and adds imports wherever it is used.
2019-03-24Merge `DefPathData::VariantCtor` and `DefPathData::StructCtor`Vadim Petrochenkov-12/+10
2019-03-24Slightly more uniform treatment of struct and variant constructorsVadim Petrochenkov-2/+2
2019-03-24Remove `VariantDef::parent_did`Vadim Petrochenkov-134/+27
2019-03-24Separate variant id and variant constructor id.David Wood-78/+192
This commit makes two changes - separating the `NodeId` that identifies an enum variant from the `NodeId` that identifies the variant's constructor; and no longer creating a `NodeId` for `Struct`-style enum variants and structs. Separation of the variant id and variant constructor id will allow the rest of RFC 2008 to be implemented by lowering the visibility of the variant's constructor without lowering the visbility of the variant itself. No longer creating a `NodeId` for `Struct`-style enum variants and structs mostly simplifies logic as previously this `NodeId` wasn't used. There were various cases where the `NodeId` wouldn't be used unless there was an unit or tuple struct or enum variant but not all uses of this `NodeId` had that condition, by removing this `NodeId`, this must be explicitly dealt with. This change mostly applied cleanly, but there were one or two cases in name resolution and one case in type check where the existing logic required a id for `Struct`-style enum variants and structs.
2019-03-24Auto merge of #59199 - estebank:untrack-errors, r=eddybbors-3/+2
Remove `track_errors` from `check_match`, `typeck_item_bodies` and `register_plugins` In the spirit of continuing through errors in type checking (#39275), remove `track_errors` from a couple of locations in the codebase.
2019-03-23Auto merge of #59068 - ljedrz:kill_off_NodeId_stragglers, r=Zoxcbors-2/+2
HirIdification: kill off NodeId stragglers The final stages of HirIdification (#57578). This PR, along with https://github.com/rust-lang/rust/pull/59042, should finalize the HirIdification process (at least the more straightforward bits). - replace `NodeId` with `HirId` in `trait_impls` - remove all `NodeId`s from `borrowck` - remove all `NodeId`s from `typeck` - remove all `NodeId`s from `mir` - remove `trait_auto_impl` (unused) I would be cool to also remove `NodeId` from `hir::def::Def`, `middle::privacy::AccessLevel` and `hir::ItemId`, but I don't know if this is feasible. I'll be happy to do more if I've missed anything.
2019-03-22address review commentsEsteban Küber-3/+2
2019-03-22Rollup merge of #59266 - estebank:struct-parse-recovery, r=petrochenkovMazdak Farrokhzad-12/+16
Do not complain about non-existing fields after parse recovery When failing to parse struct-like enum variants, the ADT gets recorded as having no fields. Record that we have actually recovered during parsing of this variant to avoid complaing about non-existing fields when actually using it. Fix #57361.
2019-03-20Add eval_always to query macro and move a query overJohn Kåre Alsaker-12/+0
2019-03-20Add anon to query macro and move a query overJohn Kåre Alsaker-16/+0
2019-03-20Add no_force to query macro and move some queries overJohn Kåre Alsaker-49/+2
2019-03-20Add no_hash to query macro and move some queries overJohn Kåre Alsaker-62/+2
2019-03-20Add a -Z time option which prints only passes which runs onceJohn Kåre Alsaker-15/+14
2019-03-18Add load_cached query modifier and keep dep node names consistent with query ↵John Kåre Alsaker-41/+3
names
2019-03-18Define queries using a proc macroJohn Kåre Alsaker-37/+28
2019-03-17Do not complain about non-existing fields after parse recoveryEsteban Küber-12/+16
When failing to parse struct-like enum variants, the ADT gets recorded as having no fields. Record that we have actually recovered during parsing of this variant to avoid complaing about non-existing fields when actually using it.
2019-03-16Revert the `LazyConst` PROliver Scherer-261/+130
2019-03-16Rollup merge of #59201 - lambda:remove-repr-simd-isize-usize-restriction, ↵kennytm-1/+0
r=alexcrichton Remove restriction on isize/usize in repr(simd) As discussed in #55078, there's no known reason for this restriction. It's unlikely that repr(simd) will be stabilized in its current form, but might as well remove some restrictions on it. This removes the branch in `is_machine` which returns false for these types. `is_machine` is only used for the repr(simd) type validation check.
2019-03-16Add def getting methods to librustc/ty/contextTomas Koutsky-0/+9
2019-03-15Remove restriction on isize/usize in repr(simd)Brian Campbell-1/+0
As discussed in #55078, there's no known reason for this restriction. It's unlikely that repr(simd) will be stabilized in its current form, but might as well remove some restrictions on it. This removes the branch in `is_machine` which returns false for these types. `is_machine` is only used for the repr(simd) type validation check.
2019-03-15Fix rebase fallout and address some review comments.Eduard-Mihai Burtescu-1/+9
2019-03-15rustc: print ExistentialProjection with spaces around `=`, e.g. `dyn Foo<A = ↵Eduard-Mihai Burtescu-1/+1
X>`.
2019-03-15rustc: provide DisambiguatedDefPathData in ty::print.Eduard-Mihai Burtescu-33/+67
2019-03-15rustc: slice substs in ty::print instead of passing the full ones.Eduard-Mihai Burtescu-80/+71
2019-03-15rustc: let ty::print::pretty's p! macro call arbitrary methods.Eduard-Mihai Burtescu-35/+32
2019-03-15rustc: remove PrintCx from ty::Print and rely on printers carrying TyCtxt.Eduard-Mihai Burtescu-751/+687
2019-03-15rustc: remove the ability for pretty-printers to override nesting.Eduard-Mihai Burtescu-66/+55
2019-03-15rustc: don't thread existential projections through path_generic_args.Eduard-Mihai Burtescu-138/+183
2019-03-15rustc: make `pretty_path_generic_args`' task as simple as possible.Eduard-Mihai Burtescu-78/+57
2019-03-15rustc: print elided regions as '_ instead of nothing, and use a separate ↵Eduard-Mihai Burtescu-30/+28
check when optional.
2019-03-15rustc: always hide defaulted generic args, even in verbose mode.Eduard-Mihai Burtescu-25/+28