about summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
2018-07-04Tests for tool_lintsflip1995-0/+103
2018-07-03Auto merge of #51926 - matthewjasper:Initialization-span, r=nikomatsakisbors-11/+10
[NLL] Use better span for initializing a variable twice Closes #51217 When assigning to a (projection from a) local immutable local which starts initialised (everything except `let PATTERN;`): * Point to the declaration of that local * Make the error message refer to the local, rather than the projection. r? @nikomatsakis
2018-07-03Auto merge of #51450 - estebank:inner-fn-test, r=@pnkfelixbors-0/+45
Add lint warning for inner function marked as `#[test]` Fix #36629.
2018-07-03Auto merge of #52014 - pietroalbini:rollup, r=pietroalbinibors-0/+74
Rollup of 13 pull requests Successful merges: - #51548 (Initialize LLVM's AMDGPU target machine, if available.) - #51809 (Add read_exact_at and write_all_at methods to FileExt on unix) - #51914 (add outlives annotations to `BTreeMap`) - #51958 (Show known meta items in unknown meta items error) - #51973 (Make Stdio handle UnwindSafe) - #51977 (bootstrap: tests should use rustc from config.toml) - #51978 (Do not suggest changes to str literal if it isn't one) - #51979 (Get rid of `TyImplTraitExistential`) - #51980 (Emit column info in debuginfo for non msvc like targets) - #51982 (incr.comp.: Take names of children into account when computing the ICH of a module's HIR.) - #51997 (add entry for cargo-metadata feature to RELEASES) - #52004 (toolstate: Fixed detection of changed submodule, and other fixes.) - #52006 ( Change --keep-stage to apply more often) Failed merges: r? @ghost
2018-07-03Rollup merge of #51978 - estebank:issue-48364, r=oli-obkPietro Albini-0/+28
Do not suggest changes to str literal if it isn't one Fix #48364.
2018-07-03Rollup merge of #51958 - euclio:attr-refactor, r=petrochenkovPietro Albini-0/+46
Show known meta items in unknown meta items error This PR adds a label to E0541. It also factors built-in attribute parsing into a submodule of `attr` for ease of future refactoring. Fixes #51469.
2018-07-03Auto merge of #51889 - spastorino:make-causal-tracking-lazy, r=nikomatsakisbors-49/+14
Make causal tracking lazy Closes #51710 r? @nikomatsakis
2018-07-02Auto merge of #51944 - MajorBreakfast:generic-future-obj, r=cramertjbors-4/+6
Make custom trait object for `Future` generic - `TaskObj` -> `FutureObj<'static, ()>` - The `impl From<...> for FutureObj<'a, T>` impls are impossible because of the type parameter `T`. The impl has to live in libstd, but `FutureObj<'a, T>` is from libcore. Therefore `Into<FutureObj<'a, T>>` was implemented instead. Edit: This didn‘t compile without warnings. I am now using non-generic Form impls. See https://github.com/rust-lang-nursery/futures-rs/issues/1058 r? @cramertj Edit: Added lifetime
2018-07-02Auto merge of #51896 - nikomatsakis:nll-liveness-dirty-list, r=Zoxcbors-5/+7
introduce dirty list to liveness, eliminate `ins` vector At least in my measurements, this seems to knock much of the liveness computation off the profile. r? @Zoxc cc @nnethercote
2018-07-02Add lifetime to `FutureObj`Josef Reinhard Brandl-4/+6
2018-07-02Make custom trait object for `Future` genericJosef Reinhard Brandl-4/+4
2018-07-02Auto merge of #51866 - zackmdavis:hir_making_each_day_of_the_year, ↵bors-36/+154
r=petrochenkov add modifier keyword spans to hir::Visibility; improve unreachable-pub, private-no-mangle lint suggestions #50455 pointed out that the unreachable-pub suggestion for brace-grouped `use`s was bogus; #50476 partially ameliorated this by marking the suggestion as `Applicability::MaybeIncorrect`, but this is the actual fix. Meanwhile, another application of having spans available in `hir::Visibility` is found in the private-no-mangle lints, where we can now issue a suggestion to use `pub` if the item has a more restricted visibility marker (this seems much less likely to come up in practice than not having any visibility keyword at all, but thoroughness is a virtue). While we're there, we can also add a helpful note if the item does have a `pub` (but triggered the lint presumably because enclosing modules were private). ![hir_vis](https://user-images.githubusercontent.com/1076988/42018064-ca830290-7a65-11e8-9c4c-48bc846f861f.png) r? @nrc cc @Manishearth
2018-07-01Do not suggest changes to str literal if it isn't oneEsteban Küber-0/+28
2018-07-01Make causal tracking lazySantiago Pastorino-49/+14
2018-07-01Auto merge of #51110 - alexreg:new-static-eval-rules, r=eddybbors-68/+79
Loosened rules involving statics mentioning other statics Before this PR, trying to mention a static in any way other than taking a reference to it caused a compile-time error. So, while ```rust static A: u32 = 42; static B: &u32 = &A; ``` compiles successfully, ```rust static A: u32 = 42; static B: u32 = A; // error ``` and ```rust static A: u32 = 42; static B: u32 = *&A; // error ``` are not possible to express in Rust. On the other hand, introducing an intermediate `const fn` can presently allow one to do just that: ```rust static A: u32 = 42; static B: u32 = foo(&A); // success! const fn foo(a: &u32) -> u32 { *a } ``` Preventing `const fn` from allowing to work around the ban on reading from statics would cripple `const fn` almost into uselessness. Additionally, the limitation for reading from statics comes from the old const evaluator(s) and is not shared by `miri`. This PR loosens the rules around use of statics to allow statics to evaluate other statics by value, allowing all of the above examples to compile and run successfully. Reads from extern (foreign) statics are however still disallowed by miri, because there is no compile-time value to be read. ```rust extern static A: u32; static B: u32 = A; // error ``` This opens up a new avenue of potential issues, as a static can now not just refer to other statics or read from other statics, but even contain references that point into itself. While it might seem like this could cause subtle bugs like allowing a static to be initialized by its own value, this is inherently impossible in miri. Reading from a static causes the `const_eval` query for that static to be invoked. Calling the `const_eval` query for a static while already inside the `const_eval` query of said static will cause cycle errors. It is not possible to accidentally create a bug in miri that would enable initializing a static with itself, because the memory of the static *does not exist* while being initialized. The memory is not uninitialized, it is not there. Thus any change that would accidentally allow reading from a not yet initialized static would cause ICEs. Tests have been modified according to the new rules, and new tests have been added for writing to `static mut`s within definitions of statics (which needs to fail), and incremental compilation with complex/interlinking static definitions. Note that incremental compilation did not need to be adjusted, because all of this was already possible before with workarounds (like intermediate `const fn`s) and the encoding/decoding already supports all the possible cases. r? @eddyb
2018-07-01Auto merge of #51969 - pietroalbini:rollup, r=pietroalbinibors-1/+45
Rollup of 7 pull requests Successful merges: - #51511 (Stabilize Iterator::flatten in 1.29, fixes #48213.) - #51853 (Fix some doc links) - #51890 (Fix inconsequential typo in GlobalAlloc doc example) - #51920 (use literal span for concrete type suggestion) - #51921 (improve the error message when `#[panic_implementation]` is missing) - #51922 (rename the llvm-tools component to llvm-tools-preview and tweak its image) - #51961 (Fix typo in /src/librustc_resolve/lib.rs) Failed merges: r? @ghost
2018-07-01Rollup merge of #51921 - japaric:panic-impl-error, r=nagisaPietro Albini-1/+19
improve the error message when `#[panic_implementation]` is missing closes #51341 r? @nagisa cc @phil-opp
2018-07-01Rollup merge of #51920 - euclio:concrete-type-suggestion, r=estebankPietro Albini-0/+26
use literal span for concrete type suggestion Fixes #51874. r? @estebank
2018-07-01Auto merge of #51833 - wesleywiser:faster_large_constant_arrays, r=oli-obkbors-0/+43
Speed up compilation of large constant arrays This is a different approach to #51672 as suggested by @oli-obk. Rather than write each repeated value one-by-one, we write the first one and then copy its value directly into the remaining memory. With this change, the [toy program](https://github.com/rust-lang/rust/blob/c2f4744d2db4e162df824d0bd0b093ba4b351545/src/test/run-pass/mir_heavy_promoted.rs) goes from 63 seconds to 19 seconds on my machine. Edit: Inlining `Size::bytes()` saves an additional 6 seconds dropping the total time to 13 seconds on my machine. Edit2: Now down to 2.8 seconds. r? @oli-obk cc @nnethercote @eddyb
2018-07-01Auto merge of #51536 - ↵bors-74/+68
davidtwco:nll-dyn-trait-underscore-error-improvements, r=nikomatsakis NLL: bad error message when converting anonymous lifetime to `'static` Contributes to #46983. This PR doesn't introduce fantastic errors, but it should hopefully lay some groundwork for diagnostic improvements. r? @nikomatsakis
2018-07-01Updated affected tests after rebase.David Wood-7/+7
2018-07-01Ensure that changed errors are lower case.David Wood-40/+40
2018-07-01Updated affected tests.David Wood-71/+65
2018-07-01Add two regression tests for const evalWesley Wiser-0/+43
2018-07-01update mir-opt testsNiko Matsakis-5/+7
2018-07-01Auto merge of #51883 - estebank:placement-suggestion, r=varkorbors-0/+31
Suggest correct comparison against negative literal When parsing as emplacement syntax (`x<-1`), suggest the correct syntax for comparison against a negative value (`x< -1`). Fix #45651.
2018-06-30in which the private/restricted-in-public error messaging gets specificZack M. Davis-0/+71
April 2016's Issue #33174 called out the E0446 diagnostics as confusing. While adding the name of the restricted type to the message (548e681f) clarified matters somewhat, Esteban Küber pointed out that we could stand to place a secondary span on the restricted type. Here, we differentiate between crate-visible, truly private, and otherwise restricted types, and place a secondary span specifically on the visibility modifier of the restricted type's declaration (which we can do now that HIR visibilities have spans!). At long last, this resolves #33174.
2018-06-30private no-mangle lints: help hint note if visibility modifier is `pub`Zack M. Davis-28/+47
If the item is `pub`, one imagines users being confused as to why it's not reachable/exported; a code suggestion is beyond our local knowledge here, but we can at least offer a prose hint. (Thanks to Vadim Petrochenkov for shooting down the present author's original bad idea for the note text.) While we're here, use proper HELP expectations instead of ad hoc comments to communicate (and now, enforce) the expected suggestions in test/ui/lint/suggestions.rs.
2018-06-30private no-mangle lints: issue suggestion for restricted visibilityZack M. Davis-6/+28
This is probably quite a lot less likely to come up in practice than the "inherited" (no visibility keyword) case, but now that we have visibility spans in the HIR, we can do this, and it presumably doesn't hurt to be exhaustive. (Who can say but that the attention to detail just might knock someone's socks off, someday, somewhere?) This is inspired by #47383.
2018-06-30unreachable_pub lint: grab `pub` span from HIR rather than inferring itZack M. Davis-10/+16
This is a true fix for #50455, superior to the mere bandage offered in #50476.
2018-06-30add label to unknown meta item errorAndy Russell-1/+1
2018-07-01Modified expected error messages in accordance with rebase.Alexander Regueiro-2/+7
2018-06-30move deprecation-sanity test to uiAndy Russell-0/+46
2018-06-30Minor refactoring.Alexander Regueiro-1/+1
2018-06-30Added incremental test for interlinking static references.Alexander Regueiro-0/+25
2018-06-30Added tests fo referring to statics by value in other statics.Alexander Regueiro-0/+30
2018-06-30Added tests for writing to static mut's in statics.Alexander Regueiro-0/+22
2018-06-30Fixed bug with miri const evaluation where allocation is recursively borrowed.Alexander Regueiro-6/+1
2018-06-30Added miri error for evaluating foreign statics.Alexander Regueiro-21/+17
Updated tests accordingly.
2018-06-30Loosened rules involving statics mentioning other statics.Alexander Regueiro-63/+1
Updated tests accordingly.
2018-06-30Auto merge of #51862 - estebank:lifetime-spans, r=nikomatsakisbors-154/+163
Point to lifetime spans on lifetime errors
2018-06-30Auto merge of #51828 - kennytm:no-simd-swap-for-mac, r=alexcrichtonbors-0/+55
Do not allow LLVM to increase a TLS's alignment on macOS. This addresses the various TLS segfault on macOS 10.10. Fix #51794. Fix #51758. Fix #50867. Fix #48866. Fix #46355. Fix #44056.
2018-06-30Do not allow LLVM to increase a TLS's alignment on macOS.kennytm-0/+55
2018-06-30Improve error messages when assigning to a local that starts initializedMatthew Jasper-11/+10
2018-06-30Auto merge of #51762 - petrochenkov:oh-hi-mark, r=oli-obkbors-1/+241
hygiene: Implement transparent marks and use them for call-site hygiene in proc-macros Fixes https://github.com/rust-lang/rust/issues/50050
2018-06-30Auto merge of #51806 - oli-obk:lowering_cleanups1, r=cramertjbors-2/+4
Lowering cleanups [1/N]
2018-06-30Auto merge of #51178 - GabrielMajeri:os-str-compare, r=SimonSapinbors-0/+18
Implement PartialEq between &str and OsString This fixes #49854. It allows equality comparison between `OsString` values and `str` references, such as `os_string == "something"`.
2018-06-30Restore the old behavior of `$crate` in nested `macro_rules`Vadim Petrochenkov-4/+46
`$crate` is not resolved at def-site of a macro, but rather at "transitive def-site"
2018-06-30proc-macro: Use transparent marks for call-site hygieneVadim Petrochenkov-1/+61
2018-06-30hygiene: Implement transparent marksVadim Petrochenkov-0/+138