about summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
2018-11-05the visitor can already load the value for visit_primitiveRalf Jung-1/+1
2018-11-05Also test for undef in enum discriminantRalf Jung-3/+16
The error message is sub-par, but fixing that requries moving ScalarMaybeUndef to librustc which would conflict badly with another PR that is in flight.
2018-11-05fix validation error on non-integer enum discriminantsRalf Jung-33/+42
2018-11-05reduce the amount of traversal/projection code that the visitor has to ↵Ralf Jung-2/+2
implement itself
2018-11-04Auto merge of #55569 - durka:must-use-external-macro, r=alexcrichtonbors-7/+38
enforce unused-must-use lint in macros Fixes #55516 by turning on the UNUSED_MUST_USE lint within macros.
2018-11-04Auto merge of #55432 - zackmdavis:single_life, r=nikomatsakisbors-24/+74
single life * structured ~~autofixable~~ (well, pending #53934 and rust-lang-nursery/rustfix#141) suggestions for the single-use-lifetimes lint in the case of function and method reference args * don't consider the anonymous lifetime `'_` as "single-use" (it's intended for exactly this sort of thing) ![single_life](https://user-images.githubusercontent.com/1076988/47613227-3b2b6400-da48-11e8-8efd-cb975ddf537d.png) r? @nikomatsakis
2018-11-04Auto merge of #55455 - estebank:expected-descr, r=michaelwoeristerbors-20/+40
Use token description in "expected/found" parse messages Fix #54309.
2018-11-03Auto merge of #55101 - alexreg:trait-aliases, r=nikomatsakisbors-157/+256
Implement trait aliases (RFC 1733) Extends groundwork done in https://github.com/rust-lang/rust/pull/45047, and fully implements https://github.com/rust-lang/rfcs/pull/1733. CC @durka @nikomatsakis
2018-11-03Rollup merge of #55568 - durka:rustdoc-big-enum, r=nikomatsakisGuillaume Gomez-0/+256
test that rustdoc doesn't overflow on a big enum Adds a test to close #25295. The test case depended on `enum_primitive` so I just basically pulled its source into an auxiliary file, is that the right way to do it?
2018-11-03Rollup merge of #55567 - durka:derive-debug-uninhabited, r=nikomatsakisGuillaume Gomez-0/+41
add test for deriving Debug on uninhabited enum Adds a test to close #38885.
2018-11-03Rollup merge of #54162 - GuillaumeGomez:hide-default-impls-items, ↵Guillaume Gomez-4/+4
r=QuietMisdreavus Hide default impls items Follow up of #51885. Fixes #54025. cc @Mark-Simulacrum r? @QuietMisdreavus And screenshots of course: <img width="1440" alt="screen shot 2018-09-12 at 23 30 35" src="https://user-images.githubusercontent.com/3050060/45454424-1ff8d500-b6e4-11e8-9257-030322495d58.png"> <img width="1440" alt="screen shot 2018-09-12 at 23 30 42" src="https://user-images.githubusercontent.com/3050060/45454431-2424f280-b6e4-11e8-8d65-db0d85ac18f0.png">
2018-11-03fix test falloutAlex Burka-7/+7
2018-11-03Fixed bug with Self type param coming before lifetimes.Alexander Regueiro-20/+33
2018-11-03Added WF checking for trait alias definitions.Alexander Regueiro-71/+61
2018-11-03Extended elaboration for trait aliases to include arbitrary bounds.Alexander Regueiro-5/+6
2018-11-03Add more tests.Alexander Regueiro-49/+142
2018-11-03Added tests.Alexander Regueiro-108/+82
2018-11-03Added support for trait aliases as object types.Alexander Regueiro-2/+8
2018-11-03Added support for trait aliases as bounds.Alexander Regueiro-0/+22
2018-11-03Auto merge of #54383 - mikeyhew:custom-receivers-object-safety, r=nikomatsakisbors-62/+254
Take 2: Implement object-safety and dynamic dispatch for arbitrary_self_types This replaces #50173. Over the months that that PR was open, we made a lot of changes to the way this was going to be implemented, and the long, meandering comment thread and commit history would have been confusing to people reading it in the future. So I decided to package everything up with new, straighforward commits and open a new PR. Here are the main points. Please read the commit messages for details. - To simplify codegen, we only support receivers that have the ABI of a pointer. That means they are builtin pointer types, or newtypes thereof. - We introduce a new trait: `DispatchFromDyn<T>`, similar to `CoerceUnsized<T>`. `DispatchFromDyn` has extra requirements that `CoerceUnsized` does not: when you implement `DispatchFromDyn` for a struct, there cannot be any extra fields besides the field being coerced and `PhantomData` fields. This ensures that the struct's ABI is the same as a pointer. - For a method's receiver (e.g. `self: Rc<Self>`) to be object-safe, it needs to have the following property: - let `DynReceiver` be the receiver when `Self = dyn Trait` - let `ConcreteReceiver` be the receiver when `Self = T`, where `T` is some unknown `Sized` type that implements `Trait`, and is the erased type of the trait object. - `ConcreteReceiver` must implement `DispatchFromDyn<DynReceiver>` In the case of `Rc<Self>`, this requires `Rc<T>: DispatchFromDyn<Rc<dyn Trait>>` These rules are explained more thoroughly in the doc comment on `receiver_is_dispatchable` in object_safety.rs. r? @nikomatsakis and @eddyb cc @arielb1 @cramertj @withoutboats Special thanks to @nikomatsakis for getting me un-stuck when implementing the object-safety checks, and @eddyb for helping with the codegen parts. EDIT 2018-11-01: updated because CoerceSized has been replaced with DispatchFromDyn
2018-11-02Don't show associated const items by defaultGuillaume Gomez-1/+1
2018-11-02Auto merge of #55087 - levex:e0669-improve-span, r=nagisabors-11/+32
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 #54543 - GuillaumeGomez:top-level-index, r=QuietMisdreavusbors-0/+18
Add index page argument @Mark-Simulacrum: I might need some help from you: in bootstrap, I want to add an argument (a new flag added into `rustdoc`) in order to generate the current index directly when `rustdoc` is documenting the `std` lib. However, my change in `bootstrap` didn't do it and I assume it must be moved inside the `Std` struct. But there, I don't see how to pass it to `rustdoc` through `cargo`. Did I miss anything? r? @QuietMisdreavus
2018-11-02Auto merge of #55316 - RalfJung:retagging, r=oli-obkbors-349/+151
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-11-02Auto merge of #55359 - alex:command-exec-uaf, r=alexcrichtonbors-0/+12
Fixes #46775 -- don't mutate the process's environment in Command::exec Instead, pass the environment to execvpe, so the kernel can apply it directly to the new process. This avoids a use-after-free in the case where exec'ing the new process fails for any reason, as well as a race condition if there are other threads alive during the exec. Fixes #46775
2018-11-02add test for deriving Debug on uninhabited enumAlex Burka-0/+41
2018-11-02Auto merge of #55305 - nikomatsakis:universes-refactor-3, r=scalexmbors-10/+6
universes refactor 3 Some more refactorings from my universe branch. These are getting a bit more "invasive" -- they start to plumb the universe information through the canonicalization process. As of yet though I don't **believe** this branch changes our behavior in any notable way, though I'm marking the branch as `WIP` to give myself a chance to verify this. r? @scalexm
2018-11-02Add test for index-pageGuillaume Gomez-0/+18
2018-11-01Add a check for reprs that could change the ABIMichael Hewson-1/+18
disallow `#[repr(C)] and `#[repr(packed)]` on structs implementing DispatchFromDyn because they will change the ABI from Scalar/ScalarPair to Aggregrate, resulting in an ICE during object-safety checks or codegen
2018-11-01Put backticks around field names, types and paths in error messagesMichael Hewson-3/+3
Added to `DispatchFromDyn` and `CoerceUnsized` error messages
2018-11-01Replace UncoeribleReceiver error message with UndispatchableReceiverMichael Hewson-2/+2
2018-11-01Replace CoerceSized trait with DispatchFromDynMichael Hewson-60/+46
Rename `CoerceSized` to `DispatchFromDyn`, and reverse the direction so that, for example, you write ``` impl<T: Unsize<U>, U> DispatchFromDyn<*const U> for *const T {} ``` instead of ``` impl<T: Unsize<U>, U> DispatchFromDyn<*const T> for *const U {} ``` this way the trait is really just a subset of `CoerceUnsized`. The checks in object_safety.rs are updated for the new trait, and some documentation and method names in there are updated for the new trait name — e.g. `receiver_is_coercible` is now called `receiver_is_dispatchable`. Since the trait now works in the opposite direction, some code had to updated here for that too. I did not update the error messages for invalid `CoerceSized` (now `DispatchFromDyn`) implementations, except to find/replace `CoerceSized` with `DispatchFromDyn`. Will ask for suggestions in the PR thread.
2018-11-01Add new tests and update existing for object-safe custom receiversMichael Hewson-18/+240
2018-11-01update tests that have changed outputMichael Hewson-42/+9
I’m not sure why these tests have different output now, but they do. In all cases, the error message that is missing looks like this: “the trait bound `dyn Trait: Trait` is not satisfied” My guess is that the error message is going away because object-safety now involves trait solving, and these extra error messages are no longer leaking out.
2018-11-01Rollup merge of #55561 - smaeul:test-fixes, r=alexcrichtonkennytm-10/+10
Fix double_check tests on big-endian targets Since the enums get optimized down to 1 byte long, the bits set in the `usize` member don't align with the `enum` values on big-endian machines. Avoid this issue by shrinking the integer member to the same size as the enums.
2018-11-01Rollup merge of #55575 - parched:trap, r=RalfJungPietro Albini-0/+1
Fix invalid_const_promotion test on some archs On at least AArch64 `llvm.trap` raises SIGTRAP. r? @RalfJung
2018-11-01Fixes #46775 -- don't mutate the process's environment in Command::execAlex Gaynor-0/+12
Instead, pass the environment to execvpe, so the kernel can apply it directly to the new process. This avoids a use-after-free in the case where exec'ing the new process fails for any reason, as well as a race condition if there are other threads alive during the exec.
2018-11-01Rollup merge of #55469 - pnkfelix:issue-54477-regression-tests, r=nikomatsakisPietro Albini-0/+25
Regression tests for issue #54477. At some point someone may want to revisit PR #53564 it would be really good to have regression tests for #54477 before that happens. :)
2018-11-01test that rustdoc doesn't overflow on a big enumAlex Burka-0/+256
2018-11-01enforce unused-must-use lint in macrosAlex Burka-0/+31
2018-11-01Fix double_check tests on big-endian targetsSamuel Holland-10/+10
Since the enums get optimized down to 1 byte long, the bits set in the usize member don't align with the enums on big-endian machines. Avoid this issue by shrinking the integer member to the same size as the enums.
2018-10-31Fix invalid_const_promotion test on some archsJames Duley-0/+1
On at least AArch64 `llvm.trap` raises SIGTRAP.
2018-10-31kill old-style-lub warningsNiko Matsakis-4/+0
2018-10-30Add a test for multiple cases of E0669Levente Kurusa-6/+27
Signed-off-by: Levente Kurusa <lkurusa@acm.org>
2018-10-30Add legacy debuginfo testsTom Tromey-0/+996
The enum debuginfo patch includes a legacy mode that is used when building against LLVM 5 and LLVM 6. The main enum debuginfo tests have been updated to rely on the new approach and a new-enough gdb. This patch makes a copy of these tests so that the fallback mode will continue to be tested. Note that nil-enum.rs is not copied; it seemed not to provide enough value to bother. A new header directive is added, "ignore-llvm-version". I will send a patch to update the rustc documentation once this lands.
2018-10-30Update enum debuginfo testsTom Tromey-111/+95
Bug #52452 notes some debuginfo test regressions when moving to gdb 8.1. This series will also cause versions of gdb before 8.2 to fail when a recent LLVM is used -- DW_TAG_variant_part support was not added until 8.2. This patch updates one of the builders to a later version of Ubuntu, which comes with gdb 8.2. It updates the relevant tests to require both a new-enough LLVM and a new-enough gdb; the subsequent patch arranges to continue testing the fallback mode. The "gdbg" results are removed from these tests because the tests now require a rust-enabled gdb. If you read closely, you'll see that some of the lldb results in this patch still look a bit strange. This will be addressed in a subsequent patch; I believe the fix is to disable the Python pretty-printers when lldb is rust-enabled.
2018-10-30Add more enum debug info testsTom Tromey-0/+75
Rename the previous enum debug info test, and add more tests to cover c-like enums and tagged (ordinary) enums.
2018-10-30Tighten enum-debug testTom Tromey-0/+2
Update the new enum-debug to ensure that field "D" does not have a discrimnant.
2018-10-30Fix DWARF generation for enumsTom Tromey-0/+40
The DWARF generated for Rust enums was always somewhat unusual. Rather than using DWARF constructs directly, it would emit magic field names like "RUST$ENCODED$ENUM$0$Name" and "RUST$ENUM$DISR". Since PR #45225, though, even this has not worked -- the ad hoc scheme was not updated to handle the wider variety of niche-filling layout optimizations now available. This patch changes the generated DWARF to use the standard tags meant for this purpose; namely, DW_TAG_variant and DW_TAG_variant_part. The patch to implement this went in to LLVM 7. In order to work with older versions of LLVM, and because LLVM doesn't do anything here for PDB, the existing code is kept as a fallback mode. Support for this DWARF is in the Rust lldb and in gdb 8.2. Closes #32920 Closes #32924 Closes #52762 Closes #53153
2018-10-30Rollup merge of #55494 - ↵kennytm-65/+242
pnkfelix:issue-55492-borrowck-migrate-must-look-at-parents-of-closures, r=davidtwco borrowck=migrate must look at parents of closures This fixes the NLL migration mode (which is the default with edition=2018) to inspect all parents of a closure in addition to the closure itself when looking to see if AST-borrowck issues an error for the given code. This should be a candidate for beta backport. Fix #55492