about summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
2018-10-14Auto merge of #55046 - wesleywiser:no_virtual_call_inlining, r=varkorbors-0/+31
[mir-inlining] Don't inline virtual calls
2018-10-14[mir-inlining] Don't inline virtual callsWesley Wiser-0/+31
Prior to this change, the test case would output `1` instead of `2` like it should.
2018-10-14Support underscore as constant nameDonato Sciarra-0/+83
Issue: 54912
2018-10-14Auto merge of #55018 - euclio:issue-24421, r=alexcrichtonbors-1/+20
add test for #24421 Fixes #24421. Also removes a README which points to a non-existent directory.
2018-10-13Auto merge of #55017 - memoryruins:add-tests, r=alexcrichtonbors-0/+49
Add tests for issues #54966 and #52240 Closes #54966 Closes #52240
2018-10-13Auto merge of #55003 - zackmdavis:must_use_assoc_fn, r=varkorbors-8/+22
`#[must_use]` for associated functions is supposed to actually work In the comments of (closed, defunct) pull request #54884, @Centril [noted that](https://github.com/rust-lang/rust/pull/54884#issuecomment-427626495) must-use annotations didn't work on an associated function (what other communities might call a "static method"). Subsequent logging revealed that in this case we have a `Def::Method`, whereas the lint pass was only matching on `Def::Fn`. (One could argue that those def-names are thereby misleading—must-use for `self`-ful methods have always worked—but documenting or reworking that can be left to another day.) r? @varkor
2018-10-13Auto merge of #54997 - davidtwco:issue-54896, r=nagisabors-3/+58
The #[panic_handler] attribute can be applied to non-functions Fixes #54896. This commit extends the existing lang items functionality to assert that the `#[lang_item]` attribute is only found on the appropriate item for any given lang item. That is, language items representing traits must only ever have their corresponding attribute placed on a trait, for example. r? @nagisa
2018-10-13Auto merge of #54955 - RalfJung:miri-validate2, r=oli-obkbors-1/+48
miri engine: Fix run-time validation This fixes all false positives that came up when actually enabling this in miri. r? @oli-obk
2018-10-13validation: accept pointers in integer arraysRalf Jung-1/+12
2018-10-13Fix and test upvar name printing for validityRalf Jung-0/+36
2018-10-13Auto merge of #54980 - zackmdavis:and_the_case_of_the_universal_call, r=oli-obkbors-72/+24
structured suggestion for E0223 ambiguous associated type (routine (and when are we going to be done finding these, anyway?) but something that stuck out to me while glancing at #54970) r? @estebank
2018-10-12`#[must_use]` for associated functions is supposed to actually workZack M. Davis-8/+22
In the comments of (closed, defunct) pull request #54884, Mazdak "Centril" Farrokhzad noted that must-use annotations didn't work on an associated function (what other communities might call a "static method"). Subsequent logging revealed that in this case we have a `Def::Method`, whereas the lint pass was only matching on `Def::Fn`. (One could argue that those def-names are thereby misleading—must-use for self-ful methods have always worked—but documenting or reworking that can be left to another day.)
2018-10-13Auto merge of #54945 - estebank:asm-span, r=petrochenkovbors-28/+28
Point to variable in `asm!` macro when failing borrowck Fix #34940.
2018-10-12Auto merge of #54942 - matthewjasper:wf-type-annotations, r=nikomatsakisbors-103/+289
[NLL] Check user types are well-formed Also contains a change of span for AscribeUserType. I'm not quite sure if this was what @nikomatsakis was thinking. Closes #54620 r? @nikomatsakis
2018-10-12Add nll stderr to #52240memoryruins-0/+9
2018-10-12Add test for issue #52240memoryruins-0/+25
Closes #52240
2018-10-12add test for #24421Andy Russell-1/+20
Fixes #24421.
2018-10-12Add test for issue #54966memoryruins-0/+15
Closes #54966
2018-10-12Auto merge of #55012 - kennytm:rollup, r=kennytmbors-12/+46
Rollup of 16 pull requests Successful merges: - #54755 (Documents reference equality by address (#54197)) - #54811 (During rustc bootstrap, make default for `optimize` independent of `debug`) - #54825 (NLL says "borrowed content" instead of more precise "dereference of raw pointer") - #54860 (Add doc comments about safest way to initialize a vector of zeros) - #54869 (Fix mobile docs) - #54891 (Fix tracking issue for Once::is_completed) - #54913 (doc fix: it's auto traits that make for automatic implementations) - #54920 (Fix handling of #[must_use] on unit and uninhabited types) - #54932 (A handful of random string-related improvements) - #54936 (impl Eq+Hash for TyLayout) - #54950 (std: Synchronize global allocator on wasm32) - #54956 ("(using ..." doesn't have the matching ")") - #54958 (add a macro for static (compile-time) assertions) - #54967 (Remove incorrect span for second label inner macro invocation) - #54983 (Fix slice's benchmarks) - #54989 (Fix spelling in the documentation to htmldocck.py) Failed merges: r? @ghost
2018-10-12Rollup merge of #54989 - Munksgaard:fix-htmldocck-typos, r=tmandrykennytm-3/+3
Fix spelling in the documentation to htmldocck.py I was reading through htmldocck.py, and decided to attempt to clean it up a little bit. Let me know if you disagree with my edits.
2018-10-12Rollup merge of #54967 - holmgr:master, r=estebankkennytm-3/+0
Remove incorrect span for second label inner macro invocation A fix for issue #54841
2018-10-12Rollup merge of #54920 - varkor:must_use-unit, r=estebankkennytm-0/+37
Fix handling of #[must_use] on unit and uninhabited types Fixes https://github.com/rust-lang/rust/issues/54828.
2018-10-12Rollup merge of #54825 - davidtwco:issue-52663-deref-raw-pointer, r=pnkfelixkennytm-6/+6
NLL says "borrowed content" instead of more precise "dereference of raw pointer" Part of #52663. Previously, move errors involving the dereference of a raw pointer would say "borrowed content". This commit changes it to say "dereference of raw pointer". r? @nikomatsakis cc @pnkfelix
2018-10-12Auto merge of #54715 - oli-obk:nll_deref_promotion, r=RalfJungbors-0/+37
Fix #54224 (const promotion regression) r? @eddyb
2018-10-12Auto merge of #53933 - GuillaumeGomez:codeblock-error-display, r=QuietMisdreavusbors-0/+27
Improve error display for codeblocks in rustdoc Part of #53919. r? @QuietMisdreavus
2018-10-11structured suggestion for E0223 ambiguous associated typeZack M. Davis-72/+24
It looks like we tend to use angle-brackets around the placeholder in the few other places we use `Applicability::HasPlaceholders`, but that would be confusing here, so ...
2018-10-11Auto merge of #54592 - GabrielMajeri:no-plt, r=nagisabors-5/+32
Support for disabling PLT for better function call performance This PR gives `rustc` the ability to skip the PLT when generating function calls into shared libraries. This can improve performance by reducing branch indirection. AFAIK, the only advantage of using the PLT is to allow for ELF lazy binding. However, since Rust already [enables full relro for security](https://github.com/rust-lang/rust/pull/43170), lazy binding was disabled anyway. This is a little known feature which is supported by [GCC](https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html) and [Clang](https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-fplt) as `-fno-plt` (some Linux distros [enable it by default](https://git.archlinux.org/svntogit/packages.git/tree/trunk/makepkg.conf?h=packages/pacman#n40) for all builds). Implementation inspired by [this patch](https://reviews.llvm.org/D39079#change-YvkpNDlMs_LT) which adds `-fno-plt` support to Clang. ## Performance I didn't run a lot of benchmarks, but these are the results on my machine for a `clap` [benchmark](https://github.com/clap-rs/clap/blob/master/benches/05_ripgrep.rs): ``` name control ns/iter no-plt ns/iter diff ns/iter diff % speedup build_app_long 11,097 10,733 -364 -3.28% x 1.03 build_app_short 11,089 10,742 -347 -3.13% x 1.03 build_help_long 186,835 182,713 -4,122 -2.21% x 1.02 build_help_short 80,949 78,455 -2,494 -3.08% x 1.03 parse_clean 12,385 12,044 -341 -2.75% x 1.03 parse_complex 19,438 19,017 -421 -2.17% x 1.02 parse_lots 431,493 421,421 -10,072 -2.33% x 1.02 ``` A small performance improvement across the board, with no downsides. It's likely binaries which make a lot of function calls into dynamic libraries could see even more improvements. [This comment](https://patchwork.ozlabs.org/patch/468993/#1028255) suggests that, in some cases, `-fno-plt` could improve PIC/PIE code performance by 10%. ## Security benefits **Bonus**: some of the speculative execution attacks rely on the PLT, by disabling it we reduce a big attack surface and reduce the need for [`retpoline`](https://reviews.llvm.org/D41723). ## Remaining PLT calls The compiled binaries still have plenty of PLT calls, coming from C/C++ libraries. Building dependencies with `CFLAGS=-fno-plt CXXFLAGS=-fno-plt` removes them.
2018-10-11Support for disabling the PLT on ELF targetsGabriel Majeri-5/+32
Disable the PLT where possible to improve performance for indirect calls into shared libraries. This optimization is enabled by default where possible. - Add the `NonLazyBind` attribute to `rustllvm`: This attribute informs LLVM to skip PLT calls in codegen. - Disable PLT unconditionally: Apply the `NonLazyBind` attribute on every function. - Only enable no-plt when full relro is enabled: Ensures we only enable it when we have linker support. - Add `-Z plt` as a compiler option
2018-10-11Extend lang items to assert correct target.David Wood-3/+58
This commit extends the existing lang items functionality to assert that the `#[lang_item]` attribute is only found on the appropriate item for any given lang item. That is, language items representing traits must only ever have their corresponding attribute placed on a trait, for example.
2018-10-11Include rustdoc tests that have been fixed by #33133Philip Munksgaard-3/+3
There was an issue (#33025) which caused these tests to not work. The issue has since been fixed in #33133, and so we can now include them.
2018-10-11Auto merge of #54850 - mcr431:fix-54707-trait-function-from-macro, ↵bors-0/+42
r=nikomatsakis Fix #54707 - parse_trait_item_ now handles interpolated blocks as function body decls Fix #54707 - parse_trait_item_ now handles interpolated blocks as function body decls Previously parsing trait items only handled opening brace token and semicolon, I added a branch to the match statement that will also handle interpolated blocks.
2018-10-11Auto merge of #54969 - Manishearth:rollup, r=Manishearthbors-73/+309
Rollup of 9 pull requests Successful merges: - #54747 (codegen_llvm: verify that inline assembly operands are scalars) - #54848 (Better Diagnostic for Trait Object Capture) - #54850 (Fix #54707 - parse_trait_item_ now handles interpolated blocks as function body decls) - #54858 (second round of refactorings for universes) - #54862 (Implement RFC 2539: cfg_attr with multiple attributes) - #54869 (Fix mobile docs) - #54870 (Stabilize tool lints) - #54893 (Fix internal compiler error on malformed match arm pattern.) - #54904 (Stabilize the `Option::replace` method) Failed merges: - #54909 ( Add chalk rules related to associated type defs) r? @ghost
2018-10-11Auto merge of #54848 - davidtwco:issue-52663-trait-object, r=nikomatsakisbors-1/+41
Better Diagnostic for Trait Object Capture Part of #52663. This commit enhances `LaterUseKind` detection to identify when a borrow is captured by a trait object which helps explain why there is a borrow error. r? @nikomatsakis cc @pnkfelix
2018-10-10Rollup merge of #54909 - scalexm:finish-rules, r=nikomatsakisManish Goregaokar-11/+21
Fixes #47311. r? @nrc
2018-10-10Rollup merge of #54893 - dsciarra:issue-54379, r=pnkfelixManish Goregaokar-0/+45
Fixes #47311. r? @nrc
2018-10-10Rollup merge of #54870 - flip1995:stabilize_tool_lints, r=ManishearthManish Goregaokar-55/+6
Fixes #47311. r? @nrc
2018-10-10Rollup merge of #54862 - Havvy:cfg_attr_multi, r=petrochenkovManish Goregaokar-28/+258
Fixes #47311. r? @nrc
2018-10-10Rollup merge of #54848 - davidtwco:issue-52663-trait-object, r=nikomatsakisManish Goregaokar-1/+41
Fixes #47311. r? @nrc
2018-10-10Auto merge of #54747 - levex:inline-asm-bad-operands, r=nagisabors-0/+90
codegen_llvm: verify that inline assembly operands are scalars Another set of inline assembly fixes. This time let's emit an error message when the operand value cannot be coerced into the operand constraint. Two questions: 1) Should I reuse `E0668` which was introduced in #54568 or just use `E0669` as it stands because they do mean different things, but maybe that's not too user-friendly. Just a thought. 2) The `try_fold` returns the operand which failed to be converted into a scalar value, any suggestions on how to use that in the error message? Thanks!
2018-10-10Remove incorrect span for second label inner macro invocationholmgr-3/+0
2018-10-10Check user types are well-formed in MIR borrow checkMatthew Jasper-70/+225
Also update some tests so that they don't have user types on `_` in unreachable code.
2018-10-10Auto merge of #54802 - davidtwco:issue-53040, r=pnkfelixbors-44/+63
[nll] better error message when returning refs to upvars Fixes #53040. r? @nikomatsakis
2018-10-10Use the span of the user type for `AscribeUserType`Matthew Jasper-33/+64
Also change the order of the fake read for let and the AscribeUserType, so that we use the better span and message from the fake read in errors.
2018-10-10Auto merge of #54831 - davidtwco:issue-52663-struct-field-suggestion, ↵bors-0/+6
r=nikomatsakis NLL is missing struct field suggestion Part of #52663. This commit adds suggestions to change the definitions of fields in struct definitions from immutable references to mutable references. r? @nikomatsakis cc @pnkfelix
2018-10-10Auto merge of #54764 - tromey:test-rust-lldb, r=alexcrichtonbors-672/+1334
Run debuginfo tests against rust-enabled lldb, when possible If the rust-enabled lldb was built, then use it when running the debuginfo tests. Updating the lldb submodule was necessary as this needed a way to differentiate the rust-enabled lldb, so I added a line to the --version output. This adds compiletest commands to differentiate between the rust-enabled and non-rust-enabled lldb, as is already done for gdb. A new "rust-lldb" header directive is also added, but not used in this patch; I plan to use it in #54004. This updates all the tests.
2018-10-09Remove feature-gate testsflip1995-49/+0
2018-10-09Remove `feature(tool_lints)` from testsflip1995-6/+6
2018-10-09Point to variable in `asm!` macro when failing borrowckEsteban Küber-28/+28
2018-10-09Auto merge of #54734 - pawroman:fix_range_borrowing_suggestion, r=varkorbors-0/+592
Fix range literals borrowing suggestions Fixes #54505. The compiler issued incorrect range borrowing suggestions (missing `()` around borrows of range literals). This was not correct syntax (see the issue for an example). With changes in this PR, this is fixed for all types of `Range` literals. Thanks again to @varkor and @estebank for their invaluable help and guidance. r? @varkor
2018-10-09Auto merge of #54762 - RalfJung:miri-validate, r=oli-obkbors-54/+183
Prepare miri engine for enforcing validity invariant during execution In particular, make recursive checking of references optional, and add a `const_mode` parameter that says whether `usize` is allowed to contain a pointer. Also refactor validation a bit to be type-driven at the "leafs" (primitive types), and separately validate scalar layout to catch `NonNull` violations (which it did not properly validate before). Fixes https://github.com/rust-lang/rust/issues/53826 Also fixes https://github.com/rust-lang/rust/issues/54751 r? @oli-obk