245 Commits

Author SHA1 Message Date
Dylan MacKenzie
f33a75c20c Remove control_flow_destroyed and properly lower && and || 2020-06-28 10:08:09 -07:00
Ralf Jung
1c74ab4226 Make is_freeze and is_copy_modulo_regions take TyCtxtAt 2020-06-21 11:47:19 +02:00
Manish Goregaokar
fe4b4858ca
Rollup merge of #73359 - jonas-schievink:do-the-shimmy, r=matthewjasper
shim.rs: avoid creating `Call` terminators calling `Self`

Also contains some cleanup and doc comment additions so I could make sense of the code.

Fixes https://github.com/rust-lang/rust/issues/73109
Closes https://github.com/rust-lang/rust/pull/73175

r? @matthewjasper
2020-06-19 19:42:57 -07:00
Ralf Jung
046165a807 rename location field of Drop terminators to place 2020-06-16 11:23:25 +02:00
Jonas Schievink
af97a117e5 shim.rs: call FnPtr, not Self
The `Call` terminator only works with `FnDef` and `FnPtr` types.
It happened to work with `Self` so far because it was always
substituted with the real type before being used.
2020-06-14 23:46:15 +02:00
Jonas Schievink
58062e1913 shim.rs: improve docs a bit 2020-06-14 23:46:15 +02:00
Jonas Schievink
26e17ae889 Remove Adjustment::DerefMove
It does the same thing as `Deref` now
2020-06-14 23:46:15 +02:00
Aaron Hill
28946b3486
Track span of function in method calls, and use this in #[track_caller]
Fixes #69977

When we parse a chain of method calls like `foo.a().b().c()`, each
`MethodCallExpr` gets assigned a span that starts at the beginning of
the call chain (`foo`). While this is useful for diagnostics, it means
that `Location::caller` will return the same location for every call
in a call chain.

This PR makes us separately record the span of the function name and
arguments for a method call (e.g. `b()` in `foo.a().b().c()`). This
`Span` is passed through HIR lowering and MIR building to
`TerminatorKind::Call`, where it is used in preference to
`Terminator.source_info.span` when determining `Location::caller`.

This new span is also useful for diagnostics where we want to emphasize
a particular method call - for an example, see
https://github.com/rust-lang/rust/pull/72389#discussion_r436035990
2020-06-10 17:30:11 -04:00
Jonas Schievink
4ca626258a Avoid Operand::Copy with &mut T 2020-05-25 21:44:36 +02:00
Jonas Schievink
1e4b663005 Improve documentation for drop elaboration 2020-05-16 23:00:56 +02:00
Bastian Kauschke
5f93bc774b use require_lang_item over unwrap. 2020-05-13 14:47:17 +02:00
Nicholas Nethercote
afd8a4e7ec Improve LocalDecl creation.
This commit adds some new `LocalDecl` methods:
- `with_source_info`, a most general constructor.
- `new`, a variant of `with_source_info` which represents the most
  common use case.
- `internal` a modifying method (like the already present `immutable`).

It removes some old `LocalDecl` methods:
- `new_internal` and `new_local`, because they're subsumed by the new
  methods.
- `new_return_place`, because it was identical to `new_temp`.

Finally, it cleans up all the use sites.
2020-05-06 12:15:26 +10:00
Nicholas Nethercote
a17234ca54 Add SourceInfo::outermost. 2020-05-06 12:15:26 +10:00
Camille GILLOT
e56c400432 Use the query system to allocate. 2020-04-28 11:34:17 +02:00
Wesley Wiser
f4dfb99235 Don't run various MIR optimizations at mir-opt-level=0
Add missing checks for mir-opt-level to non-essential MIR passes.
2020-04-24 06:10:38 -04:00
Dylan MacKenzie
8287842eb4 Use Body everywhere 2020-04-22 09:57:43 -07:00
Josh Stone
7b005c5fcb Dogfood more or_patterns in the compiler 2020-04-19 07:33:58 -07:00
Matthias Krüger
3837df2992 don't clone types that are copy (clippy::clone_on_copy) 2020-04-16 00:17:38 +02:00
Rustin-Liu
b07e7fe047 Rename AssocKind::Method to AssocKind::Fn
Rename fn_has_self_argument to fn_has_self_parameter

Rename AssocItemKind::Method to AssocItemKind::Fn

Refine has_no_input_arg

Refine has_no_input_arg

Revert has_no_input_arg

Refine suggestion_descr

Move as_def_kind into AssocKind

Signed-off-by: Rustin-Liu <rustin.liu@gmail.com>

Fix tidy check issue

Signed-off-by: Rustin-Liu <rustin.liu@gmail.com>
2020-04-14 07:12:07 +08:00
Mazdak Farrokhzad
124144704f nix rustc_target::abi::* reexport in ty::layout 2020-04-02 13:40:43 +02:00
Santiago Pastorino
25528c1e28
Use Place directly, it's Copy more use cases 2020-03-31 14:44:01 -03:00
Mazdak Farrokhzad
1ccb0b4a02 rustc -> rustc_middle part 3 (rustfmt) 2020-03-30 07:19:55 +02:00
Mazdak Farrokhzad
0cb9e36090 rustc -> rustc_middle part 2 2020-03-30 07:16:56 +02:00
Eduard-Mihai Burtescu
10f08abd2e rustc: keep upvars tupled in {Closure,Generator}Substs. 2020-03-21 14:23:50 +02:00
Eduard-Mihai Burtescu
51ea260ee7 rustc: don't resolve Instances which would produce malformed shims. 2020-03-15 23:13:40 +02:00
Dylan MacKenzie
7f3ec5e50b Make lookup of associated item by name O(log n) 2020-02-19 10:51:40 -08: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
Matthias Krüger
ec61761e46 don't clone types that are copy, round two. 2020-01-27 01:18:18 +01:00
Eduard-Mihai Burtescu
19d8527890 rustc_mir: don't require a self argument for ReifyShim. 2020-01-19 14:26:28 -08:00
Mazdak Farrokhzad
ebfd8673a7 Remove rustc_hir reexports in rustc::hir. 2020-01-05 12:49:22 +01:00
Vadim Petrochenkov
70f1d57048 Rename syntax_pos to rustc_span in source code 2020-01-01 09:15:18 +03:00
Mark Rousskov
a06baa56b9 Format the world 2019-12-22 17:42:47 -05:00
Mazdak Farrokhzad
a7aec3f207 1. ast::Mutability::{Mutable -> Mut, Immutable -> Not}.
2. mir::Mutability -> ast::Mutability.
2019-12-20 22:22:44 +01:00
Paul Daniel Faria
9a21f6ea8d rustc_mir: Fix tidy line lengths 2019-12-05 22:58:41 -05:00
Paul Daniel Faria
756aa1e46c rustc: Apply clearer naming to BodyAndCache, fix Deref impl, remove unneeded Index impl, remove body fn
rustc_codegen_ssa: Fix BodyAndCache reborrow to Body and change instances of body() call to derefence
rustc_mir: Fix BodyAndCache reborrow to Body and change intances of body() call to derefence
2019-12-05 22:58:41 -05:00
Eduard-Mihai Burtescu
39e50e2f28 rustc: use ReifyShim for reifying Virtual call instances. 2019-12-03 15:41:56 +02:00
Eduard-Mihai Burtescu
4810cf1d1b rustc_mir: don't hardcode InstanceDef::VtableShim behavior to Adjustment::DerefMove. 2019-12-03 12:54:47 +02:00
Paul Daniel Faria
6123478f2a Fix issues caused during rebasing 2019-12-02 08:43:01 -05:00
Paul Daniel Faria
b2fe254c98 Remove HasLocalDecls impl from BodyCache's, properly reborrow to Body, rename all body_cache back to body 2019-12-02 08:40:56 -05:00
Paul Daniel Faria
595d161d36 Remove BodyCache.body and rely on Deref as much as possible for ReadOnlyBodyCache 2019-12-02 08:38:16 -05:00
Paul Daniel Faria
67b7a78231 Fix tidy errors 2019-12-02 08:38:16 -05:00
Paul Daniel Faria
4de31b26d1 Fix remaining compilation issues 2019-12-02 08:37:04 -05:00
Paul Daniel Faria
fc6b58d0a8 Simplify BodyCache impl and fix all remaining type errors in librustc_mir (lifetime errors still exist) 2019-12-02 08:35:08 -05:00
Paul Daniel Faria
38c0887c76 Fix remaining Body -> (ReadOnly)BodyCache type errors in librustc_mir outside of librustc_mir/transform 2019-12-02 08:31:35 -05:00
Paul Daniel Faria
649c73f96d Simplify Cache wrapper to single type, impl Deref on it, fix all compilation errors in librustc_codegen_ssa 2019-12-02 08:30:30 -05:00
Paul Daniel Faria
ad734680af Move predecessors cache invalidation back to basic_blocks_mut, add a couple more ensure_predecessors to prevent panics 2019-12-02 08:30:30 -05:00
Paul Daniel Faria
8e8c97e5fd Ensure predecessors are recomputed at critical points, fixes panics 2019-12-02 08:30:30 -05:00
Eduard-Mihai Burtescu
a9976d89ed rustc: move mir::SourceScopeLocalData to a field of SourceScopeData. 2019-11-30 01:37:42 +02:00