about summary refs log tree commit diff
path: root/src/librustc_mir
AgeCommit message (Collapse)AuthorLines
2019-11-06Remove `promotion_candidates` from `Checker`Dylan MacKenzie-131/+12
Also removes any code used only to populate `promotion_candidates` during const checking.
2019-11-06Remove `valid_promotion_candidates`Dylan MacKenzie-73/+39
We no longer compare the results of `promote_consts::validate_candidates` with `checker.promotion_candidates`, and `promote_consts` becomes the canonical source for determining promotability.
2019-11-06safe_extern_static -> errorMazdak Farrokhzad-28/+15
2019-11-06improve a commentRalf Jung-1/+1
2019-11-06remvoe to_scalar_ptr and use ref_to_mplace everywhereRalf Jung-62/+30
2019-11-06miri cast: avoid unnecessary to_scalar_ptrRalf Jung-3/+5
2019-11-06Rollup merge of #66139 - euclio:pluralize, r=nagisaMazdak Farrokhzad-1/+1
use American spelling for `pluralize!`
2019-11-06Rollup merge of #66086 - RalfJung:smallvec, r=nagisaMazdak Farrokhzad-1/+1
bump smallvec to 1.0 This includes https://github.com/servo/rust-smallvec/pull/162, fixing an unsoundness in smallvec. See https://github.com/servo/rust-smallvec/pull/175 for the 1.0 release announcement. Cc @mbrubeck @emilio
2019-11-06Rollup merge of #65973 - eddyb:caller-location-panic, r=petrochenkovMazdak Farrokhzad-1/+2
caller_location: point to macro invocation sites, like file!/line!, and use in core::panic!. The main change here is to `core::panic!`, trying to fix this remaining regression: https://github.com/rust-lang/rust/pull/65927#issuecomment-547625147 However, in order for `caller_location` to be usable from macros the same way `file!()`/`line!()` are, it needs to have the same behavior (of extracting the macro invocation site `Span` and using that). Arguably we would've had to do this at some point anyway, if we want to use `#[track_caller]` to replace the `file!()`/`line!()` uses from macros, but I'm not sure the RFC mentions this at all. r? @petrochenkov cc @anp @nnethercote
2019-11-06Rollup merge of #65776 - nnethercote:rename-LocalInternedString-and-more, ↵Mazdak Farrokhzad-11/+11
r=estebank Rename `LocalInternedString` and more This PR renames `LocalInternedString` as `SymbolStr`, removes an unnecessary `impl` from it, improves comments, and cleans up some `SymbolStr` uses. r? @estebank
2019-11-06Rollup merge of #66081 - RalfJung:ptr-offset, r=zackmdavisMazdak Farrokhzad-6/+13
let caller of check_ptr_access_align control the error message This is needed for https://github.com/rust-lang/miri/pull/1031
2019-11-05Auto merge of #66121 - pietroalbini:rollup-8zrwe7l, r=pietroalbinibors-0/+2
Rollup of 8 pull requests Successful merges: - #65948 (Improve MaybeUninit::get_{ref,mut} documentation) - #65953 (Allow specifying LLVM's MCTargetOptions::ABIName in target specification files) - #66012 (De-querify `trivial_dropck_outlives`.) - #66025 (`Span` cannot represent `span.hi < span.lo`) - #66047 (Don't double-count `simd_shuffle` promotion candidates) - #66053 (when Miri tests are not passing, do not add Miri component) - #66082 (clean highlightSourceLines code) - #66091 (Implemented the home_dir for VxWorks) Failed merges: r? @ghost
2019-11-05use American spelling for `pluralize!`Andy Russell-1/+1
2019-11-05Use VarLenSlice consistently when splitting constructorsNadrieril-4/+19
The previous behaviour ignored slice lengths above a certain length because it could not do otherwise. We now have VarLenSlice however, that can represent the ignored lengths to make the algorithm more consistent. This does not change the correctness of the algorithm, but makes it easier to reason about. As a nice side-effect, exhaustiveness errors have improved: they now capture all missing lengths instead of only the shortest.
2019-11-05Inline max_slice_lengthNadrieril-106/+99
Note that where we previously ran `max_slice_len` with input having not only matrix.heads() but also v.head(). Now we run it on matrix.heads() only, but also take into account the currently processed constructor. This preserves behavior since `pat_constructors` returns only one constructor in the case that is of interest for us.
2019-11-05pat_constructors returns at most one constructorNadrieril-24/+16
I tracked the origins of `pat_constructors` returning a `Vec` to commit 9b3f9d94441340f0cdf6ec59aab739baef0f1ac0. It was indeed specifically for variable-length slice patterns.
2019-11-05Store both prefix and suffix length in VarLenSliceNadrieril-27/+45
2019-11-05Make exhaustiveness error message more consistent for slice patternsNadrieril-3/+11
This improves error messages by indicating when slices above a certain lengths have not been matched. Previously, we would only report examples of such lengths, but of course never all of them.
2019-11-05Don't use max_slice_length when subtracting from VarLenSliceNadrieril-12/+21
This alters error messages slightly, but that'll be improved later
2019-11-05Simpler code path for subtracting from FixedLenSliceNadrieril-1/+9
2019-11-05Add special variable-length slice constructorNadrieril-26/+72
2019-11-05Match on self first in subtract_constructorNadrieril-21/+33
2019-11-05Rollup merge of #66047 - ecstatic-morse:issue-66016, r=eddybPietro Albini-0/+2
Don't double-count `simd_shuffle` promotion candidates Resolves #66016. The `#[rustc_args_required_const]` attribute was added to `simd_shuffle*` in rust-lang/stdarch#825. This caused `promote_consts` to double-count its second argument when recording promotion candidates, which caused the promotion candidate compatibility check to fail. Once `stdarch` is updated in-tree to include rust-lang/stdarch#825, all special logic around `simd_shuffle` can and should be removed.
2019-11-05Auto merge of #66083 - RalfJung:miri-offset-from, r=oli-obkbors-3/+22
fix Miri offset_from This is needed to make https://github.com/rust-lang/miri/pull/1032 pass.
2019-11-05Rename Constructor::Slice to FixedLenSliceNadrieril-13/+15
2019-11-05expand comment explaining integer exceptionRalf Jung-2/+4
2019-11-04Auto merge of #65874 - Nadrieril:clarify-usefulness, r=varkorbors-798/+1047
Clarify pattern-matching usefulness algorithm This PR clarifies a bit the usefulness algorithm by emphasizing that each row of the matrix can be seen as a sort of stack from which we pop constructors. It also moves code around to increase separation of concerns. This is part of my splitting of https://github.com/rust-lang/rust/pull/65160 into smaller PRs.
2019-11-04bump smallvec to 1.0Ralf Jung-1/+1
2019-11-04Miri: ptr_offset_from: support offset_from with twice the same non-null integerRalf Jung-3/+20
2019-11-04Miri: offset_from: do int-to-ptr casts when neededRalf Jung-2/+2
2019-11-04let caller of check_ptr_access_align control the error messageRalf Jung-6/+13
2019-11-03Don't extend lifetime of temp in `Repeat` expressionsDylan MacKenzie-18/+11
2019-11-03Mark entire local as promoted even if only part is usedDylan MacKenzie-18/+16
2019-11-02Auto merge of #63810 - oli-obk:const_offset_from, r=RalfJung,nikicbors-1/+51
Make <*const/mut T>::offset_from `const fn` This reenables offset_of cc @mjbshaw after https://github.com/rust-lang/rust/pull/63075 broke it
2019-11-02Don't double-count `simd_shuffle` promotion candidatesDylan MacKenzie-0/+2
The proper attribute was added to `simd_shuffle*` in rust-lang/stdarch#825. This caused `promote_consts` to double-count its second argument when recording promotion candidates, which caused the promotion candidate compatibility check to fail.
2019-11-02Simplify various `Symbol` use points.Nicholas Nethercote-11/+11
Including removing a bunch of unnecessary `.as_str()` calls, and a bunch of unnecessary sigils.
2019-11-01Rollup merge of #65946 - ecstatic-morse:refactor-promotion2, r=eddybTyler Mandry-18/+27
Make `promote_consts` emit the errors when required promotion fails A very minimal version of #65942. This will cause a generic "argument X is required to be a constant" message for `simd_shuffle` LLVM intrinsics instead of the [custom one](https://github.com/rust-lang/rust/blob/caa1f8d7b3b021c86a70ff62d23a07d97acff4c4/src/librustc_mir/transform/qualify_consts.rs#L1616). It may be possible to remove this special-casing altogether after rust-lang/stdarch#825. r? @eddyb
2019-11-01Rollup merge of #65112 - jack-t:type-parens-lint, r=varkorTyler Mandry-1/+1
Add lint and tests for unnecessary parens around types This is my first contribution to the Rust project, so I apologize if I'm not doing things the right way. The PR fixes #64169. It adds a lint and tests for unnecessary parentheses around types. I've run `tidy` and `rustfmt` &mdash; I'm not totally sure it worked right, though &mdash; and I've tried to follow the instructions linked in the readme. I tried to think through all the variants of `ast::TyKind` to find exceptions to this lint, and I could only find the one mentioned in the original issue, which concerns types with `dyn`. I'm not a Rust expert, thought, so I may well be missing something. There's also a problem with getting this to build. The new lint catches several things in the, e.g., `core`. Because `x.py` seems to build with an equivalent of `-Werror`, what would have been warnings cause the build to break. I got it to build and the tests to pass with `--warnings warn` on my `x.py build` and `x.py test` commands.
2019-11-01Clarifications suggested by varkorNadrieril-15/+17
2019-11-01Factor out witness reconstructionNadrieril-89/+131
2019-11-01Factor out constructor subtractionNadrieril-27/+36
2019-11-01Define a MissingConstructors struct for cleanlinessNadrieril-41/+75
2019-11-01WordingNadrieril-4/+4
2019-11-01`specialize` conceptually operates on a single patternNadrieril-16/+14
2019-11-01Clarify some variable namesNadrieril-29/+36
2019-11-01Refactor "wild constructor" constructionNadrieril-40/+33
2019-11-01Extract constructor application as a Constructor methodNadrieril-42/+64
2019-11-01Remove duplicate logic in compute_missing_constructorsNadrieril-84/+35
This is equivalent to the previous code in terms of performance. The expensive path is clearly identical. The fast path is also the same, because in both cases we loop until we get a non-empty `refined_ctors`, and then stop there. So the new code doesn't compute anything more than the previous did.
2019-11-01Remove some redundancyNadrieril-40/+52
2019-11-01Factor out some pattern-stack related functionsNadrieril-12/+52