about summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
2018-03-02Rollup merge of #48641 - alexcrichton:no-hash-l-paths, r=michaelwoeristerManish Goregaokar-10/+68
Fixes #47311. r? @nrc
2018-03-02Rollup merge of #48338 - estebank:match-missing-comma, r=petrochenkovManish Goregaokar-6/+68
Fixes #47311. r? @nrc
2018-03-02Replace Rc with Lrc for shared dataJohn Kåre Alsaker-3/+4
2018-03-01rustc: More stable hashes of command line argumentsAlex Crichton-10/+68
Currently rustc isn't always the best at producing deterministic builds of a crate when the source directory of a crate is changed. This is happening due to what appears two different sources: * First the `-L` paths passed to rustc are hashed into the crate hash. These paths through Cargo are typically absolute paths that can vary if the build directory changes. * Next the paths passed to `--extern` are also hashed which like `-L` can change if the build directory changes. This commit fixes these two sources of nondeterminism by ensuring that avoiding tracking the hashes of these arguments on the command line. For `-L` paths they're either related to loading crates (whose hashes are tracked elsewhere) or native librarise used in the linking phase (which isn't incremental). The `--extern` paths are similar in that they're related to crate resolution which is already tracked independently of the command line arguments. Closes #48019
2018-03-01Rollup merge of #48610 - ishitatsuyuki:ishitatsuyuki-patch-1, r=nikomatsakisManish Goregaokar-0/+43
Add regression test for #48551 [Issue link](https://github.com/rust-lang/rust/issues/48551)
2018-03-01Rollup merge of #48585 - stjepang:stabilize-localkey-try_with, r=alexcrichtonManish Goregaokar-7/+5
Stabilize LocalKey::try_with The `LocalKey::try_with` method is now stabilized. `LocalKey::state` and `LocalKeyState` marked as deprecated. Although, is there any reason to keep them - should we perhaps remove them completely? Closes #27716 r? @alexcrichton
2018-03-01Rollup merge of #48572 - alexcrichton:noexcept-msvc2, r=eddybManish Goregaokar-0/+73
rustc: Tweak funclet cleanups of ffi functions This commit is targeted at addressing #48251 by specifically fixing a case where a longjmp over Rust frames on MSVC runs cleanups, accidentally running the "abort the program" cleanup as well. Added in #46833 `extern` ABI functions in Rust will abort the process if Rust panics, and currently this is modeled as a normal cleanup like all other destructors. Unfortunately it turns out that `longjmp` on MSVC is implemented with SEH, the same mechanism used to implement panics in Rust. This means that `longjmp` over Rust frames will run Rust cleanups (even though we don't necessarily want it to). Notably this means that if you `longjmp` over a Rust stack frame then that probably means you'll abort the program because one of the cleanups will abort the process. After some discussion on IRC it turns out that `longjmp` doesn't run cleanups for *caught* exceptions, it only runs cleanups for cleanup pads. Using this information this commit tweaks the codegen for an `extern` function to a catch-all clause for exceptions instead of a cleanup block. This catch-all is equivalent to the C++ code: try { foo(); } catch (...) { bar(); } and in fact our codegen here is designed to match exactly what clang emits for that C++ code! With this tweak a longjmp over Rust code will no longer abort the process. A longjmp will continue to "accidentally" run Rust cleanups (destructors) on MSVC. Other non-MSVC platforms will not rust destructors with a longjmp, so we'll probably still recommend "don't have destructors on the stack", but in any case this is a more surgical fix than #48567 and should help us stick to standard personality functions a bit longer.
2018-03-01Rollup merge of #48522 - ↵Manish Goregaokar-0/+44
etaoins:fix-find-width-of-character-at-span-bounds-check, r=estebank Fix find_width_of_character_at_span bounds check Commit 0bd96671f0 added bounds checking of our current target byte position to prevent infinite loops. Unfortunately it was comparing the file-relative `target` versus the global `file_start_pos` and `file_end_pos`. The result is failing to detect multibyte characters unless their file-relative offset fit within their global offset. This causes other parts of the compiler to generate spans pointing to the middle of a multibyte character which will ultimately panic in `bytepos_to_file_charpos`. Fix by comparing the `target` to the total file size when moving forward and doing checked subtraction when moving backwards. This should preserve the intent of the bounds check while removing the offset confusion. cc @davidtwco Fixes #48508
2018-03-01Rollup merge of #48500 - petrochenkov:parpat, r=nikomatsakisManish Goregaokar-3/+29
Support parentheses in patterns under feature gate This is a prerequisite for any other extensions to pattern syntax - `|` with multiple patterns, type ascription, `..PAT` in slice patterns. Closes https://github.com/rust-lang/rfcs/issues/554
2018-03-01Rollup merge of #48446 - mark-i-m:e0245, r=mark-i-mManish Goregaokar-2/+9
Remove E0245; improve E0404 Fix #36337 Somehow this is currently breaking --explain, but I don't understand how. r? @estebank
2018-03-01Auto merge of #46785 - leodasvacas:type-check-defaults-at-declaration, ↵bors-0/+143
r=nikomatsakis [Underspecified semantics] Type check defaults at declaration. Fixes #46669. See the test for code that compiles on stable but will no longer compile. This falls under a "Underspecified language semantics" fix. **Needs crater**. On type and trait declarations, we currently allow anything that name checks as a type parameter default. That allows the user to write a default that can never be applied, or even a default that may conditionally be applied depending on the type of another parameter. Mostly this just defers the error to use sites, but also allows clever hacks such as `Foo<T, U = <T as Iterator>::Item>` where `U` will be able to apply it's default only when `T: Iterator`. Maybe that means this bug is a feature, but it's a fiddly behaviour that seems undesirable. This PR validates defaults at declaration sites by ensuring all predicates on the parameter are valid for the default. With the exception of `Self: Sized` which we don't want to check to allow things like `trait Add<RHS = Self>`.
2018-03-01Add ignore-pretty for issue-48506.rsRyan Cumming-0/+1
The out-of-line module #37195
2018-02-28Rollup merge of #48461 - Manishearth:epoch-dyn-trait, r=nmatsakisManish Goregaokar-0/+1
Fixes #47311. r? @nrc
2018-02-28Rollup merge of #48380 - nikomatsakis:issue-48251-master, r=acrichtoManish Goregaokar-1/+4
Fixes #47311. r? @nrc
2018-02-28Rollup merge of #48359 - jsgf:remap-path-prefix, r=sanxiynManish Goregaokar-3/+3
Fixes #47311. r? @nrc
2018-02-28Rollup merge of #48355 - mikhail-m1:subslice_pattern_array_drop2, r=nikomatsakisManish Goregaokar-0/+25
Fixes #47311. r? @nrc
2018-03-01Support parentheses in patterns under feature gateVadim Petrochenkov-3/+29
Improve recovery for trailing comma after `..`
2018-02-28rustc: Tweak funclet cleanups of ffi functionsAlex Crichton-0/+73
This commit is targeted at addressing #48251 by specifically fixing a case where a longjmp over Rust frames on MSVC runs cleanups, accidentally running the "abort the program" cleanup as well. Added in #46833 `extern` ABI functions in Rust will abort the process if Rust panics, and currently this is modeled as a normal cleanup like all other destructors. Unfortunately it turns out that `longjmp` on MSVC is implemented with SEH, the same mechanism used to implement panics in Rust. This means that `longjmp` over Rust frames will run Rust cleanups (even though we don't necessarily want it to). Notably this means that if you `longjmp` over a Rust stack frame then that probably means you'll abort the program because one of the cleanups will abort the process. After some discussion on IRC it turns out that `longjmp` doesn't run cleanups for *caught* exceptions, it only runs cleanups for cleanup pads. Using this information this commit tweaks the codegen for an `extern` function to a catch-all clause for exceptions instead of a cleanup block. This catch-all is equivalent to the C++ code: try { foo(); } catch (...) { bar(); } and in fact our codegen here is designed to match exactly what clang emits for that C++ code! With this tweak a longjmp over Rust code will no longer abort the process. A longjmp will continue to "accidentally" run Rust cleanups (destructors) on MSVC. Other non-MSVC platforms will not rust destructors with a longjmp, so we'll probably still recommend "don't have destructors on the stack", but in any case this is a more surgical fix than #48567 and should help us stick to standard personality functions a bit longer.
2018-02-28Fix a few run-pass testsStjepan Glavina-8/+5
2018-02-28fix rebaseEsteban Küber-4/+4
2018-02-28Remove E0245; improve E0404 explanationMark Mansi-2/+9
2018-02-28Update issue-48551.rsNiko Matsakis-0/+3
2018-02-28Update UI testleonardo.yvens-10/+11
2018-02-28Check only concrete defaults for well formednessleonardo.yvens-26/+15
2018-02-28Check only predicates with a single param with a concrete default.leonardo.yvens-60/+18
This is the most conservative possible and should be always correct.
2018-02-28Add tests for dependent defaults.leonardo.yvens-1/+16
2018-02-28Check WF of predicates with defaults only if all params have defaultsleonardo.yvens-19/+35
2018-02-28Check WF of predicate with defaults only if all in LHS have defaultleonardo.yvens-51/+31
Given a trait predicate, if all params appearing in the LHS have defaults then it should be a backwards compatible predicate. We verify that by checking the WF of predicate with all defaults substituted simultaneously.
2018-02-28Expand comments, address nits.leonardo.yvens-5/+38
2018-02-28Go back to checking only the LHS of trait predicates.leonardo.yvens-19/+42
2018-02-28default WF: Substitute defaults individually in the clauses.leonardo.yvens-1/+25
2018-02-28Check WF of defaults even when there are no bounds.leonardo.yvens-15/+25
2018-02-28Type check defaults.leonardo.yvens-0/+94
And refactor duplicated code.
2018-02-28Add regression test for #48551Tatsuyuki Ishi-0/+40
2018-02-28Stabilize LocalKey::try_withStjepan Glavina-0/+1
2018-02-28Rollup merge of #48548 - alexcrichton:msvc-linker-utf16, r=alexcrichtonkennytm-9/+37
Encode linker arguments as UTF-16 on MSVC platforms This is a forward-port of #48455 to the master branch
2018-02-28Rollup merge of #48541 - varkor:inlined-main, r=michaelwoeristerkennytm-0/+12
Ensure main() always has external linkage This ensures that the entry function is never elided due to inlining, even with `inline(always)`. Fixes #47783. There were a couple of possible ways of addressing this issue; I simply picked the one that seemed most direct. A warning could be appropriate, but considering using inlining hints in other places it doesn't apply also throws no warnings, and it seems like an edge case anyway, I haven't added one for now.
2018-02-28Rollup merge of #48497 - scottmcm:more-restricted-termination, r=nikomatsakiskennytm-2/+5
Restrict the Termination impls to simplify stabilization Make a minimal commitment in preparation for stabilization. More impls, or broader ones, are likely in future, but are not necessary at this time and are more controversial. cc https://github.com/rust-lang/rust/issues/48453#issuecomment-368155082 r? @nikomatsakis
2018-02-28Rollup merge of #48484 - glaubitz:powerpcspe-linux, r=alexcrichtonkennytm-0/+2
Add support for powerpc-unknown-linux-gnuspe This PR adds support for the embedded PowerPC variant "e500". On Linux, this architecture is usually called "powerpcspe", it is a 32-bit PowerPC architecture. The main difference between normal 32-bit PowerPC and PowerPCSPE is the lack of Altivec instructions and the additional SPE instruction set. This architecture is supported in Debian through an unofficial port.
2018-02-28Rollup merge of #48473 - GuillaumeGomez:rustdoc-auto-trait-impl-fix, ↵kennytm-0/+26
r=QuietMisdreavus Fix auto trait impl rustdoc ice Fixes #48463. r? @QuietMisdreavus
2018-02-28Auto merge of #48056 - ExpHP:macro-commas, r=dtolnaybors-0/+589
Comprehensively support trailing commas in std/core macros I carefully organized the changes into four commits: * Test cases * Fixes for `macro_rules!` macros * Fixes for builtin macros * Docs for builtins **I can easily scale this back to just the first two commits for now if such is desired.** ### Breaking (?) changes * This fixes #48042, which is a breaking change that I hope people can agree is just a bugfix for an extremely dark corner case. * To fix five of the builtins, this changes `syntax::ext::base::get_single_str_from_tts` to accept a trailing comma, and revises the documentation so that this aspect is not surprising. **I made this change under the (hopefully correct) understanding that `libsyntax` is private rustc implementation detail.** After reviewing all call sites (which were, you guessed it, *precisely those five macros*), I believe the revised semantics are closer to the intended spirit of the function. ### Changes which may require concensus Up until now, it could be argued that some or all the following macros did not conceptually take a comma-separated list, because they only took one argument: * **`cfg(unix,)`** (most notable since cfg! is unique in taking a meta tag) * **`include{,_bytes,_str}("file.rs",)`** (in item form this might be written as "`include!{"file.rs",}`" which is even slightly more odd) * **`compile_error("message",);`** * **`option_env!("PATH",)`** * **`try!(Ok(()),)`** So I think these particular changes may require some sort of consensus. **All of the fixes for builtins are included this list, so if we want to defer these decisions to later then I can scale this PR back to just the first two commits.** ### Other notes/general requests for comment * Do we have a big checklist somewhere of "things to do when adding macros?" My hope is for `run-pass/macro-comma-support.rs` to remain comprehensive. * Originally I wanted the tests to also comprehensively forbid double trailing commas. However, this didn't work out too well: [see this gist and the giant FIXME in it](https://gist.github.com/ExpHP/6fc40e82f3d73267c4e590a9a94966f1#file-compile-fail_macro-comma-support-rs-L33-L50) * I did not touch `select!`. It appears to me to be a complete mess, and its trailing comma mishaps are only the tip of the iceberg. * There are [some compile-fail test cases](https://github.com/ExpHP/rust/blob/5fa97c35da2f0ee/src/test/compile-fail/macro-comma-behavior.rs#L49-L52) that didn't seem to work (rustc emits errors, but compile-fail doesn't acknowledge them), so they are disabled. Any clues? (Possibly related: These happen to be precisely the set of errors which are tagged by rustc as "this error originates in a macro outside of the current crate".) --- Fixes #48042 Closes #46241
2018-02-27Diagnostic tweaks (review)Esteban Küber-5/+4
2018-02-27Add label to primary span in some parse errorsEsteban Küber-4/+4
2018-02-27Detect missing `if` blocksEsteban Küber-2/+33
When unnecessarily using a fat arrow after an if condition, suggest the removal of it. When finding an if statement with no block, point at the `if` keyword to provide more context.
2018-02-27Provide missing comma in match arm suggestionEsteban Küber-0/+32
When finding: ```rust match &Some(3) { &None => 1 &Some(2) => { 3 } _ => 2 } ``` provide the following diagnostic: ``` error: expected one of `,`, `.`, `?`, `}`, or an operator, found `=>` --> $DIR/missing-comma-in-match.rs:15:18 | X | &None => 1 | -- - help: missing comma | | | while parsing the match arm starting here X | &Some(2) => { 3 } | ^^ expected one of `,`, `.`, `?`, `}`, or an operator here ```
2018-02-26Fix rebaseVadim Petrochenkov-233/+234
2018-02-26Update UI testsVadim Petrochenkov-365/+365
2018-02-26Implement opt-out from UI testing normalizationVadim Petrochenkov-0/+124
2018-02-26Update UI testsVadim Petrochenkov-6168/+6168
2018-02-26Encode linker arguments as UTF-16 on MSVC platformsMark Simulacrum-9/+37