about summary refs log tree commit diff
path: root/src/librustc/mir
AgeCommit message (Collapse)AuthorLines
2018-11-05fix validation error on non-integer enum discriminantsRalf Jung-3/+12
2018-11-04rustc_target: pass contexts by reference, not value.Eduard-Mihai Burtescu-32/+32
2018-11-04Correct indentation on documentation comment.David Wood-10/+10
This commit adjusts the indentation of code within a documentation comment so that it is correctly highlighted as code by rustdoc.
2018-11-03If we encounter `_` ascribed to structural pattern like `(a, b)`, just skip ↵Felix S. Klock II-8/+11
relate_types.
2018-11-02Auto merge of #55087 - levex:e0669-improve-span, r=nagisabors-2/+3
rustc: improve E0669 span E0669 refers to an operand that cannot be coerced into a single LLVM value, unfortunately right now this uses the Span for the entire inline assembly statement, which is less than ideal. This commit preserves the Span from HIR, which lets us emit the error using the Span for the operand itself in MIR. r? @nagisa cc/ @parched
2018-11-02Auto merge of #55316 - RalfJung:retagging, r=oli-obkbors-77/+38
Add Retagging statements This adds a `Retag` statement kind to MIR, used to perform the retagging operation from [Stacked Borrows](https://www.ralfj.de/blog/2018/08/07/stacked-borrows.html). It also kills the old `Validate` statements that I added last year. NOTE: This includes https://github.com/rust-lang/rust/pull/55270. Only [these commits are new](https://github.com/RalfJung/rust/compare/stacked-borrows-ng...RalfJung:retagging).
2018-10-30Use vec![x; n] instead of iter::repeat(x).take(n).collect()ljedrz-4/+2
2018-10-29fix nitsRalf Jung-4/+8
2018-10-29all hail tidyRalf Jung-1/+2
2018-10-29make inliner remove the fn_entry flag on Retag statementsRalf Jung-7/+21
2018-10-29Remove validation test cases; add retagging test caseRalf Jung-1/+1
2018-10-29Emit Retag statements, kill Validate statementsRalf Jung-76/+18
Also "rename" -Zmir-emit-validate to -Zmir-emit-retag, which is just a boolean (yes or no).
2018-10-28Auto merge of #54487 - RalfJung:ctfe-backtrace, r=oli-obkbors-86/+67
Delayed CTFE backtraces This renames the env var that controls CTFE backtraces from `MIRI_BACKTRACE` to `RUST_CTFE_BACKTRACE` so that we can use `MIRI_BACKTRACE` in the miri tool to only show backtraces of the main miri execution. It also makes `RUST_CTFE_BACKTRACE` only show backtraces that actually get rendered as errors, instead of showing them eagerly when the `Err` happens. The current behavior is near useless in miri because it shows about one gazillion backtraces for errors that we later catch and do not care about. However, @oli-obk likes the current behavior for rustc CTFE work so it is still available via `RUST_CTFE_BACKTRACE=immediate`. NOTE: This is based on top of https://github.com/rust-lang/rust/pull/53821. Only [the last three commits](https://github.com/oli-obk/rust/compare/sanity_query...RalfJung:ctfe-backtrace) are new. Fixes https://github.com/rust-lang/rust/issues/53355
2018-10-28always print backtrace when CTFE_BACKTRACE is setRalf Jung-2/+2
No point in making the user also enable RUST_LOG
2018-10-28remove some unused CTFE error variantsRalf Jung-50/+1
2018-10-28rename env var to control ctfe backtraces, and make it usually show the ↵Ralf Jung-36/+66
backtrace delayed The env var is now RUST_CTFE_BACKTRACE. Similar to RUST_BACKTRACE, it usually only prints a backtrace when the error actually surfaces, not when it happens. This makes a difference when we catch errors. As per @oli-obk's request, one can set RUST_CTFE_BACKTRACE=immediate to get the backtrace shown immediately.
2018-10-28Rollup merge of #55244 - wesleywiser:issue-50411, r=nikomatsakiskennytm-0/+36
Don't rerun MIR passes when inlining Fixes #50411 r? @nikomatsakis I updated your commit message with additional details. Let me know if any of that is incorrect. I also added the appropriate `compile-flags` directive to the test. Thanks for you help on this! cc @RalfJung related to your PR #55086
2018-10-27Refactor and add `PlaceContext::AscribeUserTy`.David Wood-99/+191
This commit refactors `PlaceContext` to split it into four different smaller enums based on if the context represents a mutating use, non-mutating use, maybe-mutating use or a non-use (this is based on the recommendation from @oli-obk on Zulip[1]). This commit then introduces a `PlaceContext::AscribeUserTy` variant. `StatementKind::AscribeUserTy` is now correctly mapped to `PlaceContext::AscribeUserTy` instead of `PlaceContext::Validate`. `PlaceContext::AscribeUserTy` can also now be correctly categorized as a non-use which fixes an issue with constant promotion in statics after a cast introduces a `AscribeUserTy` statement. [1]: https://rust-lang.zulipchat.com/#narrow/stream/122657-wg-nll/subject/.2355288.20cast.20fails.20to.20promote.20to.20'static/near/136536949
2018-10-26Add intern table for `List<ProjectionElem<'tcx, (), ()>>`.Felix S. Klock II-0/+8
Also added alias `ProjectionKind<'tcx>` for `ProjectionElem<'tcx, (), ()>`.
2018-10-26Add the actual chain of projections to `UserTypeProjection`.Felix S. Klock II-8/+119
Update the existing NLL `patterns.rs` test accordingly. includes changes addressing review feedback: * Added example to docs for `UserTypeProjections` illustrating how we build up multiple projections when descending into a pattern with type ascriptions. * Adapted niko's suggested docs for `UserTypeProjection`. * Factored out `projection_ty` from more general `projection_ty_core` (as a drive-by, made its callback an `FnMut`, as I discovered later that I need that). * Add note to docs that `PlaceTy.field_ty(..)` does not normalize its result. * Normalize as we project out `field_ty`.
2018-10-26Checkpoint: Added abstraction over collection of projections into user type.Felix S. Klock II-4/+40
I did not think I would need this in the MIR, but in general local decls are going to need to support this. (That, or we need to be able define a least-upper-bound for a collection of types encountered via the pattern compilation.)
2018-10-26Added `mir::UserTypeProjection`, a stub for a structure that projects *into* ↵Felix S. Klock II-6/+34
a given UserTypeAnnotation. (That is, it will pull out some component type held or referenced by the type annotation.) Note: this still needs to actually do projection itself. That comes in a later commit
2018-10-26Remove `PlaceContext` from API of `mir::Visitor::visit_projection_elem`.Felix S. Klock II-4/+2
It is unused, and would not make sense to maintain in the commits later in this PR.
2018-10-26Auto merge of #55382 - kennytm:rollup, r=kennytmbors-13/+29
Rollup of 21 pull requests Successful merges: - #54816 (Don't try to promote already promoted out temporaries) - #54824 (Cleanup rustdoc tests with `@!has` and `@!matches`) - #54921 (Add line numbers option to rustdoc) - #55167 (Add a "cheap" mode for `compute_missing_ctors`.) - #55258 (Fix Rustdoc ICE when checking blanket impls) - #55264 (Compile the libstd we distribute with -Ccodegen-unit=1) - #55271 (Unimplement ExactSizeIterator for MIR traversing iterators) - #55292 (Macro diagnostics tweaks) - #55298 (Point at macro definition when no rules expect token) - #55301 (List allowed tokens after macro fragments) - #55302 (Extend the impl_stable_hash_for! macro for miri.) - #55325 (Fix link to macros chapter) - #55343 (rustbuild: fix remap-debuginfo when building a release) - #55346 (Shrink `Statement`.) - #55358 (Remove redundant clone (2)) - #55370 (Update mailmap for estebank) - #55375 (Typo fixes in configure_cmake comments) - #55378 (rustbuild: use configured linker to build boostrap) - #55379 (validity: assert that unions are non-empty) - #55383 (Use `SmallVec` for the queue in `coerce_unsized`.) - #55391 (bootstrap: clean up a few clippy findings)
2018-10-26Rollup merge of #55346 - nnethercote:shrink-StatementKind, r=nagisakennytm-1/+5
Shrink `Statement`. This commit reduces the size of `Statement` from 80 bytes to 56 bytes on 64-bit platforms, by boxing the `AscribeUserType` variant of `StatementKind`. This change reduces instruction counts on most benchmarks by 1--3%.
2018-10-26Rollup merge of #55271 - sinkuu:traversal_iter, r=matthewjasperkennytm-12/+24
Unimplement ExactSizeIterator for MIR traversing iterators If `root` is not `START_BLOCK`, `basic_blocks().len() - visited` does not represent their exact size.
2018-10-26Auto merge of #53821 - oli-obk:sanity_query, r=RalfJungbors-30/+50
Report const eval error inside the query Functional changes: We no longer warn about bad constants embedded in unused types. This relied on being able to report just a warning, not a hard error on that case, which we cannot do any more now that error reporting is consistently centralized. r? @RalfJung fixes #53561
2018-10-26Shrink `Statement`.Nicholas Nethercote-1/+5
This commit reduces the size of `Statement` from 80 bytes to 56 bytes on 64-bit platforms, by boxing the `AscribeUserType` variant of `StatementKind`. This change reduces instruction counts on most benchmarks by 1--3%.
2018-10-25preserve const eval error information through trait error systemRalf Jung-1/+1
2018-10-25for now, just use NULL ptr for unsized localsRalf Jung-5/+5
2018-10-25Layout errors can happen because something was too genericOliver Schneider-3/+4
2018-10-25Report const eval error inside the queryOliver Schneider-24/+43
2018-10-25Auto merge of #55347 - pietroalbini:rollup, r=pietroalbinibors-14/+5
Rollup of 22 pull requests Successful merges: - #53507 (Add doc for impl From for Waker) - #53931 (Gradually expanding libstd's keyword documentation) - #54965 (update tcp stream documentation) - #54977 (Accept `Option<Box<$t:ty>>` in macro argument) - #55138 (in which unused-parens suggestions heed what the user actually wrote) - #55173 (Suggest appropriate syntax on missing lifetime specifier in return type) - #55200 (Documents `From` implementations for `Stdio`) - #55245 (submodules: update clippy from 5afdf8b7 to b1d03437) - #55247 (Clarified code example in char primitive doc) - #55251 (Fix a typo in the documentation of RangeInclusive) - #55253 (only issue "variant of the expected type" suggestion for enums) - #55254 (Correct trailing ellipsis in name_from_pat) - #55269 (fix typos in various places) - #55282 (Remove redundant clone) - #55285 (Do some copy editing on the release notes) - #55291 (Update stdsimd submodule) - #55296 (Set RUST_BACKTRACE=0 for rustdoc-ui/failed-doctest-output.rs) - #55306 (Regression test for #54478.) - #55328 (Fix doc for new copysign functions) - #55340 (Operands no longer appear in places) - #55345 (Remove is_null) - #55348 (Update RELEASES.md after destabilization of non_modrs_mods) Failed merges: r? @ghost
2018-10-25Fix CR feedbackWesley Wiser-10/+5
2018-10-25Rollup merge of #55345 - RalfJung:no-null, r=oli-obkPietro Albini-9/+1
Remove is_null It was confusingly named (`is_zero` would have been better, as someone pointed out somewhere but I forgot who or where), and it didn't even reliably test for "is this value 0 at run-time" because out-of-bounds pointers *can* be 0. It's not used in rustc, and miri only really needs `is_null_ptr` and `to_bytes() == 0`, so let's just kill this method. r? @oli-obk
2018-10-25Rollup merge of #55340 - RalfJung:operand-docs, r=oli-obkPietro Albini-3/+2
Operands no longer appear in places Fix an outdated comment.
2018-10-25Remove is_nullRalf Jung-9/+1
It was confusingly named (`is_zero` would have been better), and it didn't even reliably test for "is this value 0 at run-time" because out-of-bounds pointers *can* be 0.
2018-10-25Operands no longer appear in placesRalf Jung-3/+2
2018-10-24introduce (but do not use) `ascribe_user_type` goalNiko Matsakis-0/+8
Lots of annoying boilerplate.
2018-10-23fix typos in various placesMatthias Krüger-2/+2
2018-10-22Remove the `suite_index` parameter of the `run_passes!()` macroWesley Wiser-0/+12
This can be obtained via the `$mir_phase` value.
2018-10-22Don't rerun Mir passes when inliningNiko Matsakis-0/+29
When inlining a function using the Mir inliner, we shouldn't rerun the various Mir passes on it because the Mir has already been lowered and that wil break various early Mir passes. The issue in #50411 is that we've inlined a function with promotions whose Mir has already been lowered. The promotions are then copied into the local function and we begin to run passes on their lowered Mir which causes the ICE. Fixes #50411
2018-10-23Unimplement ExactSizeIteratorShotaro Yamada-12/+24
If root is not START_BLOCK, `basic_blocks().len() - visited` does not represent their exact size.
2018-10-21Auto merge of #55069 - matthewjasper:explain-free-region-liveness, ↵bors-0/+2
r=nikomatsakis [NLL] Use new region infer errors when explaining borrows Use the new free region infer errors for explaining borrows This gives at least some explanation for why a borrow is expected to last for a certain free region. Also: * Reports E0373: "closure may outlive the current function" with NLL. * Special cases the case of returning a reference to (or value referencing) a local variable or temporary (E0515). * Special case assigning a reference to a local variable in a closure to a captured variable. (E0521) Closes #51026 - `regions-nested-fns-2.rs` isn't changed to that diagnostic, since that would not be the correct error here. Closes #51169 cc #53882 - The error is (IMO) better now, but it could be better when we trace lifetimes in these error messages. r? @nikomatsakis cc @pnkfelix
2018-10-21Auto merge of #55125 - RalfJung:stacked-borrows, r=oli-obkbors-2/+6
miri engine: Hooks for basic stacked borrows r? @oli-obk
2018-10-20Use more accurate `ConstraintCategory`sMatthew Jasper-0/+2
Adds UseAsConst and UseAsStatic to replace Return in consts/statics. Don't report the arguments to an overloaded operator as CallArguments. Also don't report "escaping data" in these items.
2018-10-20Auto merge of #55114 - oli-obk:fx#map, r=nikomatsakisbors-4/+4
Deprecate the `FxHashMap()` and `FxHashSet()` constructor function hack
2018-10-19Prefer `Default::default` over `FxHash*::default` in struct constructorsOliver Scherer-4/+4
2018-10-19Deprecate the `FxHashMap()` and `FxHashSet()` constructor function hackOliver Scherer-4/+4
2018-10-19replace `UserTypeAnnotation::AdtDef` with `TypeOf`Niko Matsakis-6/+0