about summary refs log tree commit diff
path: root/src/librustc_mir
AgeCommit message (Collapse)AuthorLines
2020-06-11Use `fn_span` to point to the actual method callAaron Hill-3/+3
2020-06-12Rollup merge of #73033 - Amanieu:asm-tls, r=oli-obkDylan DPC-6/+16
Fix #[thread_local] statics as asm! sym operands The `asm!` RFC specifies that `#[thread_local]` statics may be used as `sym` operands for inline assembly. This also fixes a regression in the handling of `#[thread_local]` during monomorphization which caused link-time errors with multiple codegen units, most likely introduced by #71192. r? @oli-obk
2020-06-11Explain move errors that occur due to method calls involving `self`Aaron Hill-30/+207
2020-06-11Rollup merge of #73182 - Aaron1011:feature/call-fn-span, r=matthewjasperDylan DPC-12/+44
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-11Rollup merge of #73012 - Aaron1011:feature/span-debug-ctxt, r=matthewjasperDylan DPC-11/+28
Show `SyntaxContext` in formatted `Span` debug output This is only really useful in debug messages, so I've switched to calling `span_to_string` in any place that causes a `Span` to end up in user-visible output.
2020-06-11Check associated opaque types in check_opaque_typesMatthew Jasper-1/+7
2020-06-11Rollup merge of #73172 - matthiaskrgr:cl9ppy, r=Dylan-DPCDylan DPC-8/+6
Fix more clippy warnings Fixes more of: clippy::unused_unit clippy::op_ref clippy::useless_format clippy::needless_return clippy::useless_conversion clippy::bind_instead_of_map clippy::into_iter_on_ref clippy::redundant_clone clippy::nonminimal_bool clippy::redundant_closure clippy::option_as_ref_deref clippy::len_zero clippy::iter_cloned_collect clippy::filter_next r? @Dylan-DPC
2020-06-11Rollup merge of #72380 - lcnr:const_context, r=estebankDylan DPC-1/+1
Fix `is_const_context`, update `check_for_cast` A better version of #71477 Adds `fn enclosing_body_owner` and uses it in `is_const_context`. `is_const_context` now uses the same mechanism as `mir_const_qualif` as it was previously incorrect. Renames `is_const_context` to `is_inside_const_context`. I also updated `check_for_cast` in the second commit, so r? @estebank (I removed one lvl of indentation, so it might be easier to review by hiding whitespace changes)
2020-06-10Fix testAaron Hill-0/+2
2020-06-10Track span of function in method calls, and use this in #[track_caller]Aaron Hill-12/+42
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-10Rollup merge of #73133 - doctorn:unwind-mir-validation, r=jonas-schievinkDylan DPC-19/+48
Enforce unwind invariants I had a quick look at #72959. The failure message probably needs to be more detailed but I just wanted to check I got the right idea. I have no idea how to right a test for this either... r? @jonas-schievink Resolves #72959 (hypothetically)
2020-06-09Fix more clippy warningsMatthias Krüger-8/+6
Fixes more of: clippy::unused_unit clippy::op_ref clippy::useless_format clippy::needless_return clippy::useless_conversion clippy::bind_instead_of_map clippy::into_iter_on_ref clippy::redundant_clone clippy::nonminimal_bool clippy::redundant_closure clippy::option_as_ref_deref clippy::len_zero clippy::iter_cloned_collect clippy::filter_next
2020-06-09Stop allowing `Indirect(..)` values to be propagatedWesley Wiser-1/+0
Closes #72679 Closes #72372 Closes #72285
2020-06-09Address commentsNathan Corbyn-19/+26
2020-06-09Auto merge of #72114 - anyska:vtable-rename, r=nikomatsakisbors-5/+6
Rename traits::Vtable to ImplSource. Originally suggested by @eddyb. r? @nikomatsakis
2020-06-08Show `SyntaxContext` in formatted `Span` debug outputAaron Hill-11/+28
This is only really useful in debug messages, so I've switched to calling `span_to_string` in any place that causes a `Span` to end up in user-visible output.
2020-06-08Revert #71956Dylan MacKenzie-135/+370
2020-06-08Strengthen cleanup to cleanup checkNathan Corbyn-16/+16
2020-06-08Relax cleanup to cleanup checkNathan Corbyn-2/+2
2020-06-08Enforce unwind invariantsNathan Corbyn-19/+41
2020-06-07Don't intern memory in const prop.Oliver Scherer-14/+10
This isn't sound without validation. We don't want to report errors in case of failure to intern and validate, we just don't want to const prop. Interning and const prop is not built for this, let's not do it until we have a clearer picture on aggregate propagation.
2020-06-07Rollup merge of #72908 - RalfJung:false-edge, r=matthewjasperDylan DPC-19/+19
rename FalseEdges -> FalseEdge There's just a single false edge in this terminator, not multiple of them. r? @matthewjasper @jonas-schievink
2020-06-07Rollup merge of #72764 - jonas-schievink:mind-the-tyerr, r=estebankDylan DPC-26/+43
Be more careful around ty::Error in generators cc https://github.com/rust-lang/rust/issues/72685 (doesn't close it because it's missing a reproduction to use as a test case) r? @estebank
2020-06-07rename FalseEdges -> FalseEdgeRalf Jung-19/+19
2020-06-07Rollup merge of #72989 - pnkfelix:revert-pr-71840, r=matthewjasperDylan DPC-27/+45
Revert pr 71840 Revert7 PR #71840 to fix issue #72470 This will need a backport to beta if we do not want #72470 to hit stable.
2020-06-07Rollup merge of #72810 - RalfJung:mir-terminate-sanity, r=jonas-schievinkDylan DPC-16/+127
validate basic sanity for TerminatorKind r? @jonas-schievink This mainly checks that all `BasicBlock` actually exist. On top of that, it checks that `Call` actually calls something of `FnPtr`/`FnDef` type, and `Assert` has to work on a `bool`. Also `SwitchInt` cannot have an empty target list.
2020-06-07store `ObligationCause` on the heapBastian Kauschke-1/+1
2020-06-06Fix #[thread_local] statics as asm! sym operandsAmanieu d'Antras-6/+16
2020-06-06Fix link error with #[thread_local] introduced by #71192Amanieu d'Antras-0/+8
2020-06-06Auto merge of #72927 - petrochenkov:rustc, r=Mark-Simulacrumbors-4/+8
Rename all remaining compiler crates to use the `rustc_foo` pattern libarena -> librustc_arena libfmt_macros -> librustc_parse_format libgraphviz -> librustc_graphviz libserialize -> librustc_serialize Closes https://github.com/rust-lang/rust/issues/71177 in particular.
2020-06-05Rename traits::ImplSourceImpl to ImplSourceUserDefined.Ana-Maria Mihalache-3/+4
2020-06-05Rename traits::Vtable to ImplSource.Ana-Maria Mihalache-3/+3
2020-06-04placate tidy.Felix S. Klock II-1/+1
2020-06-04Revert "Defer creating drop trees in MIR lowering until leaving that scope"Felix S. Klock II-8/+3
This reverts commit 611988551fba1bcbb33ae2e1e0171cb8d2e70d5a.
2020-06-04Revert "Reduce the number of drop-flag assignments in unwind paths"Felix S. Klock II-12/+39
This reverts commit 54aa418a6082b364b90feee70b07381ea266c4d5.
2020-06-04Revert "Address review comments"Felix S. Klock II-6/+2
This reverts commit b998497bd41d6de71ec035433247dee856d1f3a5.
2020-06-03Auto merge of #70107 - lcnr:issue68977, r=eddybbors-3/+3
WF-check all ty::Const's, not just array lengths. fixes #68977 This PR removes the special case for array length in `wf::compute` and checks the well formedness of all consts. Changes `PredicateKind::WellFormed` to take a `GenericArg` and updates `wf::obligations`.
2020-06-03Rollup merge of #72820 - jonas-schievink:instcombine-uninit, r=oli-obkDylan DPC-10/+8
InstCombine: Don't optimize `&mut *x` into `x` Fixes https://github.com/rust-lang/rust/issues/72797
2020-06-02Rename the crates in source codeVadim Petrochenkov-1/+5
2020-06-02Make things build againVadim Petrochenkov-4/+4
2020-06-02change WellFormed predicate to GenericArgBastian Kauschke-5/+4
2020-06-02add WellFormedConst predicateBastian Kauschke-1/+2
2020-06-01test miri-unleash TLS accessesRalf Jung-10/+1
2020-06-01Auto merge of #71192 - oli-obk:eager_alloc_id_canonicalization, r=wesleywiserbors-6/+40
Make TLS accesses explicit in MIR r? @rust-lang/wg-mir-opt cc @RalfJung @vakaras for miri thread locals cc @bjorn3 for cranelift fixes #70685
2020-05-31InstCombine: Don't optimize `&mut *x` into `x`Jonas Schievink-10/+8
2020-05-31always print MIR Location when validator finds a problemRalf Jung-32/+36
2020-05-31more checks for SwitchIntRalf Jung-3/+7
2020-05-31replace DUMMY_SP by proper spanRalf Jung-5/+3
2020-05-31validate basic sanity for TerminatorKindRalf Jung-3/+108
2020-05-30Rollup merge of #72772 - RalfJung:valid-char, r=petrochenkovRalf Jung-1/+1
miri validation: clarify valid values of 'char' The old text said "expected a valid unicode codepoint", which is not actually correct -- it has to be a scalar value (which is a code point that is not part of a surrogate pair).