about summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
2019-11-06Rollup merge of #66068 - euclio:null-emitter, r=estebankMazdak Farrokhzad-64/+0
use silent emitter for rustdoc highlighting pass Partially addresses #63284.
2019-11-06Rollup merge of #66054 - petrochenkov:delspan, r=estebankMazdak Farrokhzad-9/+29
syntax: Avoid span arithmetic for delimiter tokens The +/-1 logic is from the time where the whole group had a single span and the delimiter spans had to be calculated from it. Now the delimiters have their own spans which are constructed by lexer or proc macro API and can be used directly. If those spans are not perfect, then it should be fixed by tweaking the corresponding lexer logic rather than by trying to add or substract `1` from the span boundaries. Fixes https://github.com/rust-lang/rust/issues/62524 r? @estebank
2019-11-06Rollup merge of #66014 - dkadashev:47319-type-param-def-location, r=estebankMazdak Farrokhzad-40/+114
Show type parameter name and definition in type mismatch error messages Fixes #47319 r? estebank
2019-11-05Auto merge of #66083 - RalfJung:miri-offset-from, r=oli-obkbors-8/+63
fix Miri offset_from This is needed to make https://github.com/rust-lang/miri/pull/1032 pass.
2019-11-05Rollup merge of #66096 - ecstatic-morse:const-loop-test, r=CentrilPietro Albini-0/+118
Add a failing UI test for multiple loops of all kinds in a `const` This simply demonstrates the current behavior and ensures we don't allow anything by accident. The new const checker will be able to improve the diagnostics here. While working on it, I didn't see very many tests with non-`while` loops in a `const`, and there were no tests with multiple loops.
2019-11-05Rollup merge of #66042 - ↵Pietro Albini-3/+25
ohadravid:suggest-correct-code-when-ref-current-trait, r=estebank Suggest correct code when encountering an incorrect trait bound referencing the current trait Fixes #65985 and also improves the suggestion for code like this: ``` trait Grab { type Value; fn grab(&self) -> Grab::Value; } ``` To suggest `<Self as Grab>::Value`. I wasn't sure which of the syntax versions is better (`<Self as ..>::` vs `Self::`), so I used the former simply because it was less change to the existing code. r? @estebank
2019-11-04Add tests for loop constructs in constsDylan MacKenzie-0/+118
These errors are suboptimal, but they will be fixed by the new `check_consts` pass.
2019-11-04also test different integersRalf Jung-1/+27
2019-11-04test offset_from with two integersRalf Jung-8/+37
2019-11-04expand: Feature gate out-of-line modules in proc macro inputVadim Petrochenkov-0/+132
2019-11-03use silent emitter for rustdoc highlighting passAndy Russell-64/+0
2019-11-04Auto merge of #65838 - estebank:resilient-recovery, r=Centrilbors-103/+188
Reduce amount of errors given unclosed delimiter When in a file with a non-terminated item, catch the error and consume the block instead of trying to recover it on a more granular way in order to reduce the amount of unrelated errors that would be fixed after adding the missing closing brace. Also point out the possible location of the missing closing brace. Fix #63690.
2019-11-03Auto merge of #65646 - Amanieu:foreign-exceptions, r=nikomatsakisbors-2/+161
Allow foreign exceptions to unwind through Rust code and Rust panics to unwind through FFI This PR fixes interactions between Rust panics and foreign (mainly C++) exceptions. C++ exceptions (and other FFI exceptions) can now safely unwind through Rust code: - The FFI function causing the unwind must be marked with `#[unwind(allowed)]`. If this is not the case then LLVM may optimize landing pads away with the assumption that they are unreachable. - Drop code will be executed as the exception unwinds through the stack, as with a Rust panic. - `catch_unwind` will *not* catch the exception, instead the exception will silently continue unwinding past it. Rust panics can now safely unwind through C++ code: - C++ destructors will be called as the stack unwinds. - The Rust panic can only be caught with `catch (...)`, after which it can be either rethrown or discarded. - C++ cannot name the type of the Rust exception object used for unwinding, which means that it can't be caught explicitly or have its contents inspected. Tests have been added to ensure all of the above works correctly. Some notes about non-C++ exceptions: - `pthread_cancel` and `pthread_exit` use unwinding on glibc. This has the same behavior as a C++ exception: destructors are run but it cannot be caught by `catch_unwind`. - `longjmp` on Windows is implemented using unwinding. Destructors are run on MSVC, but not on MinGW. In both cases the unwind cannot be caught by `catch_unwind`. - As with C++ exceptions, you need to mark the relevant FFI functions with `#[unwind(allowed)]`, otherwise LLVM will optimize out the destructors since they seem unreachable. I haven't updated any of the documentation, so officially unwinding through FFI is still UB. However this is a step towards making it well-defined. Fixes #65441 cc @gnzlbg r? @alexcrichton
2019-11-03Auto merge of #65759 - tmiasko:ui, r=petrochenkovbors-260/+272
Validate error patterns and error annotation in ui tests when present Previously, when compilation succeeded, neither error patterns nor error annotation would be validated. Additionally, when compilation failed, only error patterns would be validated if both error patterns and error annotation were present. Now both error patterns and error annotation are validated when present, regardless of compilation status. Furthermore, for test that should run, the error patterns are matched against executable output, which is what some of tests already expect to happen, and when #65506 is merged even more ui tests will. Fixes #56277
2019-11-03Fix macOS testsAmanieu d'Antras-0/+2
2019-11-03Make SEH exceptions use a rust_panic type instead of unsigned __int64*Amanieu d'Antras-1/+2
2019-11-03Hack to make C++ exceptions test work on i686-pc-windows-gnuAmanieu d'Antras-2/+25
2019-11-03Allow foreign exceptions to unwind through Rust codeAmanieu d'Antras-0/+132
2019-11-03Enable C++ exceptions on MSVC when building C++ testsAmanieu d'Antras-1/+1
2019-11-03Add -lstdc++ for run-make-fulldeps tests on MinGWAmanieu d'Antras-0/+1
2019-11-03syntax: Avoid span arithmetics for delimiter tokensVadim Petrochenkov-9/+29
2019-11-03Use check-pass for never type testsTomasz Miąsko-10/+5
2019-11-03Avoid matching type in huge-struct test error annotationTomasz Miąsko-1/+1
The concrete type that will be too big is target dependent. Avoid matching it in error annotation to make test work correctly across different targets.
2019-11-03Update error annotations in ui-fulldeps tests that successfully compileTomasz Miąsko-2/+2
2019-11-03Update error annotations positionsTomasz Miąsko-9/+13
Since 8ec9d7242c3352fbc617d907bec3632215811356, in the case of a local macro expansion, the errors are now matched to macro definition location. Update test cases accordingly.
2019-11-03Avoid mixing error patterns with error annotationsTomasz Miąsko-8/+6
When both error patterns and error annotations are present in an ui test, only error patterns are validated against the output. Replace the error pattern with an error annotation to avoid silently ignoring the other error annotation.
2019-11-02Auto merge of #63810 - oli-obk:const_offset_from, r=RalfJung,nikicbors-0/+160
Make <*const/mut T>::offset_from `const fn` This reenables offset_of cc @mjbshaw after https://github.com/rust-lang/rust/pull/63075 broke it
2019-11-02adjust for missing spans on x86 test runnerRalf Jung-8/+7
2019-11-02Suggest more likely code when encountering an incorrect assoc item ↵Ohad Ravid-4/+13
referencing the current trait
2019-11-02Auto merge of #66004 - eddyb:revert-early-gate, r=petrochenkovbors-149/+50
Partially revert the early feature-gatings added in #65742. The intent here is to address #65860 ASAP (in time for beta, ideally), while leaving as much of #65742 around as possible, to make it easier to re-enable later. Therefore, I've only kept the parts of the revert that re-add the old (i.e. non-early) feature-gating checks that were removed in #65742, and the test reverts. I've disabled the new early feature-gating checks from #65742 entirely for now, but it would be easy to put them behind a `-Z` flag, or turn them into warnings, which would allow us to keep tests for both the early and late versions of the checks - assuming that's desirable. cc @nikomatsakis @Mark-Simulacrum @Centril
2019-11-02Update error annotations in tests that successfully compileTomasz Miąsko-229/+245
Those annotation are silently ignored rather than begin validated against compiler output. Update them before validation is enabled, to avoid test failures.
2019-11-02Remove erroneous error-pattern from run-pass testTomasz Miąsko-1/+0
2019-11-02Suggest correct code when encountering an incorrect trait bound referencing ↵Ohad Ravid-2/+15
the current trait
2019-11-02Prettify mismatched types error message in a special caseDmitry Kadashev-4/+2
Type parameters are referenced in the error message after the previous few commits (using span label). But when the main error message already references the very same type parameter it becomes clumsy. Do not show the additional label in this case as per code review comment by @estebank. Also this contains a small style fix.
2019-11-02Update testsDmitry Kadashev-40/+116
Update the tests to reflect changes to how type mismatch errors are reported (two previous commits).
2019-11-01Rollup merge of #66018 - pnkfelix:issue-64872-revert-64324, r=alexcrichtonTyler Mandry-55/+63
Revert PR 64324: dylibs export generics again (for now) As discussed on PR #65781, this is a targeted attempt to undo the main semantic change from PR #64324, by putting `dylib` back in the set of crate types that export generic symbols. The main reason to do this is that PR #64324 had unanticipated side-effects that caused bugs like #64872, and in the opinion of @alexcrichton and myself, the impact of #64872 is worse than #64319. In other words, it is better for us, in the short term, to reopen #64319 as currently unfixed for now than to introduce new bugs like #64872. Fix #64872 Reopen #64319
2019-11-01Rollup merge of #65995 - GuillaumeGomez:add-err-code-E0743, r=estebankTyler Mandry-3/+6
Add error code E0743 for "C-variadic has been used on a non-foreign function" Fixes https://github.com/rust-lang/rust/issues/65967
2019-11-01Rollup merge of #65977 - ↵Tyler Mandry-46/+46
ohadravid:fix-incorrect-diagnostics-with-an-associated-type, r=estebank Fix incorrect diagnostics for expected type in E0271 with an associated type With code like the following code: ```rust #[derive(Debug)] struct Data {} fn do_stuff<'a>(iterator: impl Iterator<Item = &'a Data>) { for item in iterator { println!("{:?}", item) } } fn main() { let v = vec![Data {}]; do_stuff(v.into_iter()); } ``` the diagnostic (in nightly & stable) wrongly complains about the expected type: ``` error[E0271]: type mismatch resolving `<std::vec::IntoIter<Data> as std::iter::Iterator>::Item == &Data` --> src/main.rs:15:5 | 5 | fn do_stuff<'a>(iterator: impl Iterator<Item = &'a Data>) { | -------- --------------- required by this bound in `do_stuff` ... 15 | do_stuff(v.into_iter()); | ^^^^^^^^ expected struct `Data`, found &Data | = note: expected type `Data` found type `&Data` ``` This PR fixes this issue by flipping the expected/actual values where appropriate, so it looks like this: ``` error[E0271]: type mismatch resolving `<std::vec::IntoIter<Data> as std::iter::Iterator>::Item == &Data` --> main.rs:15:5 | 5 | fn do_stuff<'a>(iterator: impl Iterator<Item = &'a Data>) { | -------- --------------- required by this bound in `do_stuff` ... 15 | do_stuff(v.into_iter()); | ^^^^^^^^ expected &Data, found struct `Data` | = note: expected type `&Data` found type `Data` ``` This improves the output of a lot of existing tests (check out `associated-types-binding-to-type-defined-in-supertrait`!). The only change which I wasn't too sure about is in the test `associated-types-overridden-binding-2`, but I think it's an improvement and the underlying problem is with handling of `trait_alias`. Fix #57226, fix #64760, fix #58092.
2019-11-01Rollup merge of #65914 - estebank:type-alias-bounds-sugg, r=davidtwcoTyler Mandry-24/+96
Use structured suggestion for unnecessary bounds in type aliases
2019-11-01Rollup merge of #65902 - gilescope:issue62570, r=estebankTyler Mandry-0/+96
Make ItemContext available for better diagnositcs Fix #62570
2019-11-01Rollup merge of #65857 - kinnison:kinnison/issue-55364, ↵Tyler Mandry-0/+88
r=Manisheart,GuillaumeGomez rustdoc: Resolve module-level doc references more locally Module level docs should resolve intra-doc links as locally as possible. As such, this commit alters the heuristic for finding intra-doc links such that we attempt to resolve names mentioned in *inner* documentation comments within the (sub-)module rather that from the context of its parent. I'm hoping that this fixes #55364 though right now I'm not sure it's the right fix. r? @GuillaumeGomez
2019-11-01Rollup merge of #65471 - GuillaumeGomez:long-err-explanation-E0578, r=Dylan-DPCTyler Mandry-0/+1
Add long error explanation for E0578 Part of #61137 r? @kinnison
2019-11-01Rollup merge of #65112 - jack-t:type-parens-lint, r=varkorTyler Mandry-18/+37
Add lint and tests for unnecessary parens around types This is my first contribution to the Rust project, so I apologize if I'm not doing things the right way. The PR fixes #64169. It adds a lint and tests for unnecessary parentheses around types. I've run `tidy` and `rustfmt` &mdash; I'm not totally sure it worked right, though &mdash; and I've tried to follow the instructions linked in the readme. I tried to think through all the variants of `ast::TyKind` to find exceptions to this lint, and I could only find the one mentioned in the original issue, which concerns types with `dyn`. I'm not a Rust expert, thought, so I may well be missing something. There's also a problem with getting this to build. The new lint catches several things in the, e.g., `core`. Because `x.py` seems to build with an equivalent of `-Werror`, what would have been warnings cause the build to break. I got it to build and the tests to pass with `--warnings warn` on my `x.py build` and `x.py test` commands.
2019-11-01ui test formulation of regression test for issue 64872.Felix S. Klock II-0/+61
(Many thanks to alex for 1. making this even smaller than what I had originally minimized, and 2. pointing out that there is precedent for having ui tests with crate dependency chains of length > 2, thus allowing me to avoid encoding this as a run-make test.)
2019-11-01targeted revert of PR rust-lang/rust#64324 (just undo change to dylib ↵Felix S. Klock II-55/+2
generics export). Includes the anticipated fallout to run-make-fulldeps test suite from this change. (We need to reopen issue 64319 as part of landing this.)
2019-11-01Auto merge of #65718 - eddyb:codegen-var-debuginfo, r=nikomatsakisbors-86/+99
rustc_codegen_ssa: introduce MIR VarDebugInfo, but only for codegen. These are all the codegen changes necessary for #56231. The refactors were performed locally to codegen, and in several steps, to ease reviewing and avoid introducing changes in behavior (as I'm not sure our debuginfo tests cover enough). r? @michaelwoerister cc @nagisa @rkruppe @oli-obk
2019-11-01Auto merge of #65459 - ecstatic-morse:graphviz-subgraph, r=estebankbors-7/+4
Fix `-Zunpretty=mir-cfg` to render multiple items `-Zunpretty=mir-cfg` outputs DOT to stdout for all items being compiled. However, it puts all of these items in separate `digraph`s, which means the result of redirecting that output to a file is not valid. Most dot renderers (I have tried `dot` and `xdot`) cannot render the output. This PR checks to see if `write_mir_graphviz` will process multiple items, and writes them each as a `subgraph` in a single, top-level `digraph`. As a result, DOT can be viewed without manually editing the output file. The output is unchanged when printing a single item (e.g.`-Zunpretty=mir-cfg=item_name`). Here's the output of `xdot` for a rust file containing three items: ![three-items](https://user-images.githubusercontent.com/29463364/66889712-4bf62200-ef98-11e9-83b5-60faa2a300dd.png) The borders are a result of the nonstandard–but well-supported–[`cluster` prefix](https://graphviz.gitlab.io/_pages/doc/info/lang.html) (search for "Subgraphs and Clusters"). They will not appear if your renderer does not support this extension, but the graph will still render properly.
2019-10-31rustc_codegen_ssa: move all set_var_name calls to mir::debuginfo.Eduard-Mihai Burtescu-86/+99
2019-10-31Revert "pre-expansion gate trait_alias."Eduard-Mihai Burtescu-19/+1
This reverts commit 2d182b82ce5ecfe8090ba3d4e78f1cd72c072ef1.
2019-10-31Revert "pre-expansion gate associated_type_bounds"Eduard-Mihai Burtescu-14/+1
This reverts commit c17a1fd7d0ef0f1f546445d0c8bdb11be55e4be7.