about summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
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-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-07-01Modified expected error messages in accordance with rebase.Alexander Regueiro-2/+7
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-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
2018-06-29update another cfail testJorge Aparicio-1/+1
2018-06-29improve the error message when `#[panic_implementation]` is missingJorge Aparicio-0/+18
closes #51341
2018-06-29Auto merge of #46720 - estebank:issue-46302, r=nikomatsakisbors-11/+34
Fix incorrect type mismatch label pointing at return type CC #46302.
2018-06-29use literal span for concrete type suggestionAndy Russell-0/+26
Fixes #51874.
2018-06-29Fix incorrect type mismatch label pointing at return typeEsteban Küber-11/+34
2018-06-29Auto merge of #51569 - SimonSapin:liballoc, r=sfacklerbors-1/+0
Make the public API of the alloc crate a subset of std This only affects **unstable** APIs. I plan to submit an RFC proposing to stabilize the crate. The reason it isn’t stable yet (https://github.com/rust-lang/rust/issues/27783) is in case we end up merging the standard library crates into one. However the `core` crate is already stable, so if that happens we’ll need to keep it working somehow (likely by making replacing its contents by `pub use` items). We can do the same for `alloc`. This PR will hopefully make this easier, but even if that doesn’t happen consistency with `std` seems good.
2018-06-29Auto merge of #51729 - matthewjasper:move-errors, r=nikomatsakisbors-229/+461
[NLL] Better move errors Make a number of changes to improve the quality of NLL cannot move errors. * Group errors that occur in the same `match` with the same cause. * Suggest `ref`, `&` or removing `*` to avoid the move. * Show the place being matched on. Differences from AST borrowck: * `&` is suggested over `ref` when matching on a place that can't be moved from. * Removing `*` is suggested instead of adding `&` when applicable. * Sub-pattern spans aren't used, this would probably need Spans on Places. Closes #45699 Closes #46627 Closes #51187 Closes #51189 r? @pnkfelix
2018-06-29Make raw_vec perma-unstable and hiddenSimon Sapin-1/+0
2018-06-29Add run-pass testGabriel Majeri-0/+18
2018-06-29Auto merge of #51592 - GuillaumeGomez:fix-macro-doc-search, r=GuillaumeGomezbors-0/+20
Fix macro missing from doc search Fixes #51095. r? @QuietMisdreavus
2018-06-28Rollup merge of #51839 - oli-obk:const_shift_overflow, r=nikomatsakisMark Rousskov-0/+28
Detect overflows of non u32 shifts
2018-06-28Rollup merge of #51822 - estebank:suggest-more, r=nikomatsakisMark Rousskov-1/+4
Provide existing ref suggestions for more E0308 errors
2018-06-28Rollup merge of #51636 - oli-obk:const_diagnostics, r=eddybMark Rousskov-194/+110
Refactor error reporting of constants cc @eddyb This PR should not change any behaviour. It solely simplifies the internal handling of the errors
2018-06-28Suggest correct comparison against negative literalEsteban Küber-0/+31
When parsing as emplacement syntax (`x<-1`), suggest the correct syntax for comparison against a negative value (`x< -1`).
2018-06-28Fix rebaseEsteban Küber-4/+4
2018-06-28Provide existing ref suggestions for more E0308 errorsEsteban Küber-1/+4
2018-06-28Also point to free named region on lifetime errorsEsteban Küber-52/+32
2018-06-28Extend support to `get_generics` for all `NodeItem`sEsteban Küber-86/+86
2018-06-28Point to lifetime in fn definition on lifetime error noteEsteban Küber-22/+37
2018-06-28Point at lifetimes instead of def span for E0195Esteban Küber-16/+30
2018-06-28Auto merge of #51687 - japaric:gh51671, r=alexcrichtonbors-0/+41
translate / export weak lang items see #51671 for details fixes #51671 fixes #51342 r? @michaelwoerister or @alexcrichton
2018-06-28Auto merge of #51630 - joshlf:map-split-perf, r=dtolnaybors-4/+4
Optimize RefCell refcount tracking Address the performance concern raised in https://github.com/rust-lang/rust/pull/51466#issuecomment-398255276 cc @dtolnay @nnethercote @rust-lang/wg-compiler-performance cc @RalfJung @jhjourdan for soundness concerns Can somebody kick off a perf run on this? I'm not sure how that's done, but I understand it has to be started manually. The idea of this change is to switch to representing mutable refcount as values below 0 to eliminate some branching that was required with the old algorithm.