Camille GILLOT
0e652c5507
Move resolve_instance to rustc_ty.
2020-02-13 18:53:21 +01:00
bors
a1912f2e89
Auto merge of #68679 - matthewjasper:needs-type-op, r=varkor
...
Improve `ty.needs_drop`
* Handle cycles in `needs_drop` correctly
* Normalize types when computing `needs_drop`
* Move queries from rustc to rustc_ty
* Avoid query in simple cases
reopens #65918
2020-02-12 19:31:49 +00:00
Camille GILLOT
fc73e196d9
Review comments.
2020-02-11 23:21:21 +01:00
Camille GILLOT
ff369236a3
Move lang_items definitions to librustc_lang_items.
2020-02-11 23:09:22 +01:00
Jonas Schievink
66fd4e6ed8
Make associated_items
query return a slice
2020-02-08 14:29:18 +01:00
Matthew Jasper
465b86253c
Use correct ParamEnv
in Instance::resolve
2020-02-02 21:46:29 +00:00
Michael Woerister
197cc1e43a
Add projection query for upstream drop-glue instances.
...
This reduces the amount of invalidated data when new types are
add to upstream crates.
2020-01-23 16:56:59 +01:00
Michael Woerister
29951edbdf
Clarify some methods around instance instantiation via comments and clearer names.
2020-01-23 13:15:14 +01:00
Adam Perry
0ee922123f
InstanceDef::requires_caller_location limited to items.
2020-01-19 14:26:28 -08:00
Camille GILLOT
787cd5493a
Make traits::util::* free functions.
2020-01-07 17:48:41 +01:00
bors
ebbb2bf37a
Auto merge of #67886 - Centril:rustc_hir_canon_imports, r=nagisa
...
Nix `rustc_hir` reexports in rustc::hir
r? @Zoxc cc @Mark-Simulacrum
2020-01-06 12:55:40 +00:00
Aaron Hill
db2c4f214f
Fix typo
2020-01-05 15:00:55 -05:00
Aaron Hill
33caf0b61f
Rename Instance.ty to Instance.monomorphic_ty
2020-01-05 14:59:40 -05:00
Aaron Hill
464b58ca11
s/projections/params/
2020-01-05 14:37:59 -05:00
Aaron Hill
71d163b53c
Run rustfmt
2020-01-05 14:37:59 -05:00
Aaron Hill
d41f9dd5dd
Change 'panic!' to 'bug!'
...
Co-Authored-By: Wesley Wiser <wwiser@gmail.com>
2020-01-05 14:37:59 -05:00
Aaron Hill
ee922d47f2
Fix ICE involving calling Instance.ty
during const evaluation
...
Fixes #67639
`Instance.ty` assumes that we are in a fully monomorphic context (e.g.
codegen), and can therefore use an empty `ParamEnv` when performing
normalization. Howver, the MIR constant evaluator code ends up calling
`Instance.ty` as a result of us attemptign to 'speculatively'
const-evaluate generic functions during const propagation.
As a result,
we may end up with projections involving type parameters
(e.g. <T as MyTrait>::Bar>) in the type we are trying to normalize.
Normalization expects us to have proper predicates in the `ParamEnv` for
such projections, and will ICE if we don't.
This commit adds a new method `Instance.ty_env`, which takes a
`ParamEnv` for use during normalization. The MIR const-evaluator code is
changed to use this method, passing in the proper `ParamEnv` for the
context at hand.
2020-01-05 14:37:59 -05:00
Mazdak Farrokhzad
ebfd8673a7
Remove rustc_hir reexports in rustc::hir.
2020-01-05 12:49:22 +01:00
Mazdak Farrokhzad
66f5bf1b8b
extract rustc::middle::codegen_fn_attrs
2020-01-04 18:43:06 +01:00
Wesley Wiser
25a8b5d58e
Fix Instance::resolve()
incorrectly returning specialized instances
...
We only want to return specializations when `Reveal::All` is passed, not
when `Reveal::UserFacing` is. Resolving this fixes several issues with
the `ConstProp`, `SimplifyBranches`, and `Inline` MIR optimization
passes.
Fixes #66901
2019-12-27 13:04:32 -05:00
Mark Rousskov
a06baa56b9
Format the world
2019-12-22 17:42:47 -05:00
Adam Perry
9ab065dcda
Implement #[track_caller] in const.
2019-12-05 20:50:26 -08:00
Eduard-Mihai Burtescu
c2f4c57296
rustc: add docs to FnAbi::{of_fn_ptr,of_instance} and InstanceDef::Virtual.
2019-12-03 15:55:21 +02:00
Eduard-Mihai Burtescu
9da14a82c6
rustc: move Instance::fn_sig to ty::layout and privatize it.
2019-12-03 15:55:21 +02:00
Eduard-Mihai Burtescu
39e50e2f28
rustc: use ReifyShim for reifying Virtual call instances.
2019-12-03 15:41:56 +02:00
Eduard-Mihai Burtescu
552ea447e4
rustc: combine Instance::fn_sig_noadjust and Instance::fn_sig.
2019-12-03 12:54:36 +02:00
Alexander Regueiro
51cb60cd3f
Aggregation of drive-by cosmetic changes.
2019-11-21 18:50:38 +00:00
Camille GILLOT
033d1df19b
Retire BraceStructLiftImpl.
2019-11-18 08:41:28 +01:00
Adam Perry
d92cef7473
resolve_for_fn_ptr checks that the instance is an Item before returning shim.
2019-10-11 07:44:01 -07:00
Adam Perry
407d1d5fd4
Instance::resolve_for_fn_ptr unconditionally resolves first.
...
Per review feedback.
2019-10-10 07:31:22 -07:00
Adam Perry
1cdd5d099d
Improve docs for InstanceDef::ReifyShim.
2019-10-10 07:25:54 -07:00
Adam Perry
8a097f2619
Clarify comment, dedupe match arms in shim.rs.
...
Also add a missing terminal newline to a test.
2019-10-09 21:02:54 -07:00
Adam Perry
b8414c13ab
Return ReifyShim from Instance::resolve_for_fn_ptr when track_caller present.
...
This ICEs in MIR currently, which I think is to be expected since none of the MIR plumbing is set up. I added a test which confirms that the shim is being used for reifying a track_caller function.
2019-10-09 20:19:09 -07:00
Adam Perry
0132738437
Reifying callers of Instance::resolve use resolve_for_fn_ptr.
2019-10-09 20:19:09 -07:00
Adam Perry
f5f67e78bb
Add Instance::resolve_for_fn_ptr
2019-10-09 20:19:09 -07:00
Adam Perry
012116f860
Add InstanceDef::ReifyShim for track_caller functions.
2019-10-09 20:19:09 -07:00
csmoe
ef9fe10280
remove GeneratorSubsts visitors
2019-10-04 20:47:43 +08:00
csmoe
fa7a87be63
generate GeneratorSubsts from SubstsRef
2019-10-04 20:47:43 +08:00
csmoe
9b91bef78b
generate ClosureSubsts from SubstsRef
2019-10-03 19:24:59 +08:00
csmoe
eab060f4da
clean ClosureSubsts in rustc::ty
2019-09-29 16:17:46 +00:00
Mark Rousskov
d540d44c71
Remove global_tcx from TyCtxt
...
The non-global context was removed; there's only one context now. This
is a noop method that only serves to confuse readers -- remove it.
2019-09-27 13:33:48 -04:00
varkor
e2e0f9af85
Rename sty
to kind
2019-09-25 15:50:04 +01:00
Yuki Okushi
82f2b37635
Add Option<Span> to require_lang_item
2019-08-28 07:11:12 +09:00
Matthew Jasper
2f6babbc6d
Remove is_self
and has_self_ty
methods
2019-08-11 15:00:42 +01:00
Eduard-Mihai Burtescu
f3f9d6dfd9
Unify all uses of 'gcx and 'tcx.
2019-06-14 18:58:23 +03:00
Eduard-Mihai Burtescu
fff08cb043
Run rustfmt --file-lines ...
for changes from previous commits.
2019-06-12 13:38:28 +03:00
Eduard-Mihai Burtescu
17cdd356da
rustc: replace TyCtxt<'tcx, 'gcx, 'tcx>
with TyCtxt<'gcx, 'tcx>
.
2019-06-12 13:38:27 +03:00
Eduard-Mihai Burtescu
2441253508
Fix fallout from deny(unused_lifetimes)
.
2019-06-12 13:38:27 +03:00
Eduard-Mihai Burtescu
37799a5552
rustc: replace TyCtxt<'a, 'gcx, 'tcx>
with TyCtxt<'tcx, 'gcx, 'tcx>
.
2019-06-12 13:38:27 +03:00
Eduard-Mihai Burtescu
1d720ec27c
Run rustfmt --file-lines ...
for changes from previous commits.
2019-06-11 14:11:59 +03:00