about summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
2018-07-23Auto merge of #52571 - oli-obk:promotion_abort, r=nagisabors-0/+38
Abort if a promoted fails to be const evaluable and its runtime checks didn't trigger r? @eddyb cc @RalfJung @nagisa cc https://github.com/rust-lang/rust/issues/49760
2018-07-23Auto merge of #52568 - oli-obk:span_bug_error, r=varkorbors-0/+91
Fix loop label resolution around constants And make `delay_span_bug` a little more helpful r? @varkor fixes #52442 fixes #52443
2018-07-22Auto merge of #52564 - pnkfelix:issue-52126-lhs-of-assign-op-is-invariant, ↵bors-1/+89
r=eddyb LHS of assign op is invariant This addresses a bug injected by #45435. That PR changed the way we type-check `LHS <op> RHS` to coerce the LHS to the expected supertype in much the same way that we coerce the RHS. The problem is that when we have a case of `LHS <op>= RHS`, we do not want to coerce to a supertype; we need the type to remain invariant. Otherwise we risk leaking a value with short-lifetimes into a expression context that needs to satisfy a long lifetime. Fix #52126
2018-07-22Auto merge of #52069 - ↵bors-33/+250
zackmdavis:elided_states_of_america—and_to_the_re-pub-lic, r=nikomatsakis add structured suggestions and fix false-positive for elided-lifetimes-in-paths lint This adds structured suggestions to the elided-lifetimes-in-paths lint (introduced in Nov. 2017's #46254), prevents it from emitting a false-positive on anonymous (underscore) lifetimes (!), and adds it to the idioms-2018 group (#52041). ~~As an aside, "elided-lifetimes-in-paths" seems like an unfortunate name, because it's not clear exactly what "elided" means. The motivation for this lint (see original issue #45992, and [RFC 2115](https://github.com/rust-lang/rfcs/blob/e978a8d3017a01d632f916140c98802505cd1324/text/2115-argument-lifetimes.md#motivation)) seems to be specifically about not supplying angle-bracketed lifetime arguments to non-`&` types, but (1) the phrase "lifetime elision" has historically also referred to the ability to not supply a lifetime name to `&` references, and (2) an `is_elided` method in the HIR returns true for anoymous/underscore lifetimes, which is _not_ what we're trying to lint here. (That naming confusion is almost certainly what led to the false positive addressed here.) Given that the lint is relatively new and is allow-by-default, is it too late to rename it ... um, _again_ (#50879)?~~ ~~This does _not_ address a couple of other false positives discovered in https://github.com/rust-lang/rust/issues/52041#issuecomment-402547901.~~ ![elided_states](https://user-images.githubusercontent.com/1076988/42302137-2bf9479c-7fce-11e8-8bd0-f29aefc802b6.png) r? @nikomatsakis cc @nrc @petrochenkov
2018-07-22Auto merge of #52616 - kennytm:rollup, r=kennytmbors-16/+43
Rollup of 11 pull requests Successful merges: - #51807 (Deprecation of str::slice_unchecked(_mut)) - #52051 (mem::swap the obvious way for types smaller than the SIMD optimization's block size) - #52465 (Add CI test harness for `thumb*` targets. [IRR-2018-embedded]) - #52507 (Reword when `_` couldn't be inferred) - #52508 (Document that Unique::empty() and NonNull::dangling() aren't sentinel values) - #52521 (Fix links in rustdoc book.) - #52581 (Avoid using `#[macro_export]` for documenting builtin macros) - #52582 (Typo) - #52587 (Add missing backtick in UniversalRegions doc comment) - #52594 (Run the error index tool against the sysroot libdir) - #52615 (Added new lines to .gitignore.)
2018-07-23Rollup merge of #52051 - scottmcm:swap-directly, r=alexcrichtonkennytm-0/+27
mem::swap the obvious way for types smaller than the SIMD optimization's block size LLVM isn't able to remove the alloca for the unaligned block in the post-SIMD tail in some cases, so doing this helps SRoA work in cases where it currently doesn't. Found in the `replace_with` RFC discussion. Examples of the improvements: <details> <summary>swapping `[u16; 3]` takes 1/3 fewer instructions and no stackalloc</summary> ```rust type Demo = [u16; 3]; pub fn swap_demo(x: &mut Demo, y: &mut Demo) { std::mem::swap(x, y); } ``` nightly: ```asm _ZN4blah9swap_demo17ha1732a9b71393a7eE: .seh_proc _ZN4blah9swap_demo17ha1732a9b71393a7eE sub rsp, 32 .seh_stackalloc 32 .seh_endprologue movzx eax, word ptr [rcx + 4] mov word ptr [rsp + 4], ax mov eax, dword ptr [rcx] mov dword ptr [rsp], eax movzx eax, word ptr [rdx + 4] mov word ptr [rcx + 4], ax mov eax, dword ptr [rdx] mov dword ptr [rcx], eax movzx eax, word ptr [rsp + 4] mov word ptr [rdx + 4], ax mov eax, dword ptr [rsp] mov dword ptr [rdx], eax add rsp, 32 ret .seh_handlerdata .section .text,"xr",one_only,_ZN4blah9swap_demo17ha1732a9b71393a7eE .seh_endproc ``` this PR: ```asm _ZN4blah9swap_demo17ha1732a9b71393a7eE: mov r8d, dword ptr [rcx] movzx r9d, word ptr [rcx + 4] movzx eax, word ptr [rdx + 4] mov word ptr [rcx + 4], ax mov eax, dword ptr [rdx] mov dword ptr [rcx], eax mov word ptr [rdx + 4], r9w mov dword ptr [rdx], r8d ret ``` </details> <details> <summary>`replace_with` optimizes down much better</summary> Inspired by https://github.com/rust-lang/rfcs/pull/2490, ```rust fn replace_with<T, F>(x: &mut Option<T>, f: F) where F: FnOnce(Option<T>) -> Option<T> { *x = f(x.take()); } pub fn inc_opt(mut x: &mut Option<i32>) { replace_with(&mut x, |i| i.map(|j| j + 1)); } ``` Rust 1.26.0: ```asm _ZN4blah7inc_opt17heb0acb64c51777cfE: mov rax, qword ptr [rcx] movabs r8, 4294967296 add r8, rax shl rax, 32 movabs rdx, -4294967296 and rdx, r8 xor r8d, r8d test rax, rax cmove rdx, rax setne r8b or rdx, r8 mov qword ptr [rcx], rdx ret ``` Nightly (better thanks to ScalarPair, maybe?): ```asm _ZN4blah7inc_opt17h66df690be0b5899dE: mov r8, qword ptr [rcx] mov rdx, r8 shr rdx, 32 xor eax, eax test r8d, r8d setne al add edx, 1 mov dword ptr [rcx], eax mov dword ptr [rcx + 4], edx ret ``` This PR: ```asm _ZN4blah7inc_opt17h1426dc215ecbdb19E: xor eax, eax cmp dword ptr [rcx], 0 setne al mov dword ptr [rcx], eax add dword ptr [rcx + 4], 1 ret ``` Where that add is beautiful -- using an addressing mode to not even need to explicitly go through a register -- and the remaining imperfection is well-known (https://github.com/rust-lang/rust/pull/49420#issuecomment-376805721). </details>
2018-07-22Auto merge of #52572 - davidtwco:issue-51027, r=nikomatsakisbors-50/+59
NLL diagnostics replaced nice closure errors w/ indecipherable free region errors Fixes #51027. r? @nikomatsakis
2018-07-22in which the elided-lifetimes-in-paths lint undergoes a revolutionZack M. Davis-33/+250
The existing elided-lifetimes-in-paths lint (introduced in Nov. 2017's accd997b5 / #46254) lacked stuctured suggestions and—much more alarmingly—produced false positives on associated functions (like `Ref::clone`) and on anonymous '_ lifetimes (!!—yes, the very anonymous lifetimes that we meant to suggest "instead"). That this went apparently unnoticed for so long maybe tells you something about how many people actually bother to flip on allow-by-default lints. After many hours of good old-fashioned American elbow grease—and a little help from expert reviewers—it turns out that getting the right answer is a lot easier if we fire the lint while lowering the Higher Intermediate Representation. The lint is promoted to the idioms-2018 group. Also, in the matter of test filenames, "elided" only has one 'l' (see, e.g., https://en.wiktionary.org/wiki/elide). Resolves #52041.
2018-07-22Rollup merge of #52507 - estebank:infer-type, r=nikomatsakiskennytm-16/+16
Reword when `_` couldn't be inferred r? @nikomatsakis
2018-07-22Use correct exclusion commentOliver Schneider-1/+2
2018-07-22Fallback to general error handling in ICE cases.David Wood-22/+31
2018-07-22Improved closure errors.David Wood-28/+28
2018-07-22Classify aggregate rvalues as assignments.David Wood-7/+7
2018-07-22Auto merge of #52368 - ↵bors-0/+39
GuillaumeGomez:intra_doc_link_resolution_failure-documented, r=QuietMisdreavus Add "self" intra-link support Fixes #49583. r? @QuietMisdreavus
2018-07-22Auto merge of #52359 - matthewjasper:combine-move-error-reporting, r=pnkfelixbors-35/+36
[NLL] Small move error reporting improvements * Use a MirBorrowckContext when reporting errors to be more uniform with other error reporting * Add a special message for the case of trying to move from capture variables in `Fn` and `FnMut` closures. part of #51028
2018-07-22Auto merge of #52394 - estebank:println, r=oli-obkbors-78/+201
Improve suggestion for missing fmt str in println Avoid using `concat!(fmt, "\n")` to improve the diagnostics being emitted when the first `println!()` argument isn't a formatting string literal. Fix #52347.
2018-07-21Only run the test on x86_64Scott McMurray-0/+1
Smaller platforms don't merge the loads the same way.
2018-07-21Don't use SIMD in mem::swap for types smaller than the block sizeScott McMurray-0/+26
LLVM isn't able to remove the alloca for the unaligned block in the SIMD tail in some cases, so doing this helps SRoA work in cases where it currently doesn't. Found in the `replace_with` RFC discussion.
2018-07-21Fix tidy by adding new feature gate testEsteban Küber-0/+24
2018-07-21fix logic bugEsteban Küber-0/+0
2018-07-22Add "self" intra-link supportGuillaume Gomez-0/+39
2018-07-21Auto merge of #52115 - Dylan-DPC:feature/nll-liveness-regions, r=nikomatsakisbors-244/+0
only compute liveness for variables whose types include regions Closes #52034 r? @nikomatsakis
2018-07-21don't spawn processes on wasmOliver Schneider-0/+2
2018-07-21Suggest space separated format str literalEsteban Küber-2/+2
2018-07-21Auto merge of #51959 - tmandry:make-implied-outlives-query, r=nikomatsakisbors-4/+106
Turn implied_outlives_bounds into a query Right now all this does is remove the error reporting in `implied_outlives_bounds`, which seems to work. Farming out full tests to Travis. For #51649. That issue is deferred so not sure what's next. r? @nikomatsakis
2018-07-21update testsMatthew Jasper-11/+28
2018-07-21Add specific message when moving from upvars in a non-FnOnce closureMatthew Jasper-24/+8
2018-07-21Auto merge of #52405 - matthewjasper:mutability-errors, r=pnkfelixbors-88/+1128
[NLL] Mutability errors cc #51028 cc #51170 cc #46559 Closes #46629 * Better explain why the place is immutable ("immutable item" is gone) * Distinguish &T and *const T * Use better spans when a mutable borrow is for a closure capture r? @pnkfelix
2018-07-21delete testsdylan_DPC-110/+0
2018-07-21we now get 2 extra mismatched type errorsNiko Matsakis-4/+69
These new errors actually seem a *tad* clearer than the old one, so that's good, but now there are 3. Maybe call it a wash?
2018-07-21add regression test for #52078Niko Matsakis-0/+37
Fixes #52078
2018-07-21Auto merge of #52555 - petrochenkov:mresfact, r=alexcrichtonbors-0/+93
resolve: Some renaming, refactoring and comments Commits are self-descriptive. The only functional change is https://github.com/rust-lang/rust/commit/34bf2f572e33d4df1459413b5014ca98fc9fa4e0 that tightens shadowing rules for macro paths (makes the second and third cases in `test/ui/imports/glob-shadowing.rs` an error).
2018-07-21Auto merge of #52535 - alexcrichton:update-stdsimd, r=Mark-Simulacrumbors-1/+0
Update stdsimd to undo an accidental stabilization Closes #52403
2018-07-21remove unwanted tests and a reference to it in commentsdylan_DPC-134/+0
2018-07-20Update stdsimd to undo an accidental stabilizationAlex Crichton-1/+0
Closes #52403
2018-07-21Auto merge of #52536 - alexcrichton:attr-spans, r=nikomatsakisbors-0/+88
proc_macro: Preserve spans of attributes on functions This commit updates the tokenization of items which are subsequently passed to `proc_macro` to ensure that span information is preserved on attributes as much as possible. Previously this area of the code suffered from #43081 where we haven't actually implemented converting an attribute to to a token tree yet, but a local fix was possible here. Closes #47941
2018-07-20fix grep test looking for newlineEsteban Küber-1/+1
2018-07-21Rollup merge of #52539 - alexcrichton:two-attrs, r=petrochenkovkennytm-0/+46
rustc: Fix two custom attributes with custom derive This commit fixes an issue where multiple custom attributes could not be fed into a custom derive in some situations with the `use_extern_macros` feature enabled. The problem was that the macro expander didn't consider that it was making progress when we were deducing that attributes should be lumped in with custom derive invocations. The fix applied here was to track in the expander if our attribute is changing (getting stashed away elsewhere and replaced with a new invocation). If it is swapped then it's considered progress, otherwise behavior should remain the same. Closes #52525
2018-07-21Rollup merge of #52527 - ljedrz:cleanup_13973, r=oli-obkkennytm-10/+0
Remove duplicate E0396 tests Resolves FIXME #13973 (erroneously marked as #13972). A test for E0396 already exists in `test/ui/const-deref-ptr.rs`.
2018-07-21Rollup merge of #52526 - ljedrz:cleanup_18800, r=alexcrichtonkennytm-1/+0
Enable run-pass/sepcomp-lib-lto.rs on Android #18800 is fixed, so it should be safe to restore this test.
2018-07-20Update tests for new NLL mutability errorsMatthew Jasper-88/+1128
2018-07-20Add trailing newlineOliver Schneider-1/+1
2018-07-20Add testOliver Schneider-0/+35
2018-07-20Fix new testEsteban Küber-2/+2
2018-07-20Reword when `_` couldn't be inferredEsteban Küber-14/+14
2018-07-20Properly scope label resolutionOliver Schneider-0/+91
2018-07-20Auto merge of #52498 - oli-obk:const_prop, r=nikomatsakisbors-1/+27
Const propagate casts fixes #49760 So... This fixes the original issue about the missing warnings. But our test suite contains fun things like ```rust fn foo() {} assert_eq!(foo as i16, foo as usize as i16); ``` Which, will result in > a raw memory access tried to access part of a pointer value as raw bytes on both sides of the assertion. Because well... that's exactly what's going on! We're ripping out 16 bits of a pointer.
2018-07-20For some reason, on my linux box, using `-Zverbose` here is causing a linker ↵Felix S. Klock II-1/+1
failure. Rather than try to work out what was happening, I just removed the flag because I see no reason for it to be on this test.
2018-07-20Regression test for issue.Felix S. Klock II-0/+88
2018-07-20resolve: Fully prohibit shadowing of in-scope names by globs in macro pathsVadim Petrochenkov-0/+93