about summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
2019-09-14Don't mark expression with attributes as not needing parenthesesMark Rousskov-19/+23
This is not perfectly correct as `#[attr] (5)` will still not lint, but it does seem good enough, in particular as the parentheses in that case are not unambiguously incorrect.
2019-09-14Rollup merge of #64439 - 12101111:fix-owned-box, r=CentrilMazdak Farrokhzad-0/+26
fix #64430, confusing `owned_box` error message in no_std build Fixes #64430
2019-09-14Rollup merge of #64435 - eddyb:arguments-against-arg, r=rkruppeMazdak Farrokhzad-58/+59
codegen: use "_N" (like for other locals) instead of "argN", for argument names. Based on #64408 (second commit is new), fixing something I mentioned in #64408 (which turned to be an immediate blocker for unifying relevant codepaths). Closes #64408 (by containing it). r? @rkruppe
2019-09-14Rollup merge of #64431 - pnkfelix:issue-63479-fnptr-is-structural-match, ↵Mazdak Farrokhzad-0/+171
r=varkor fn ptr is structural match Make fn ptr always structural match, regardless of whether the formal parameter types or return type are. Fix #63479.
2019-09-14Auto merge of #64080 - estebank:parse-format-comma, r=zackmdavisbors-6/+6
Be accurate on `format!` parse error expectations Fix https://github.com/rust-lang/rust/issues/57277.
2019-09-14add trailing newline12101111-1/+1
2019-09-14add ui test for #6443012101111-0/+26
2019-09-13codegen: use "_N" (like for other locals) instead of "argN", for argument names.Eduard-Mihai Burtescu-54/+54
2019-09-13Regression tests for fn ptr and `#[structural_match]` as discussed in #63479.Felix S. Klock II-0/+171
2019-09-12Auto merge of #64360 - varkor:foreign-items-diagnostic-const-generics, ↵bors-3/+40
r=cramertj Correct the polymorphic extern fn error for const parameters Before, any polymorphism on extern functions was assumed to be type polymorphism.
2019-09-12codegen: be more explicit about setting giving names to allocas.Eduard-Mihai Burtescu-4/+5
2019-09-12Auto merge of #64359 - varkor:opaque-ty-in-extern, r=estebankbors-104/+186
Forbid opaque types in `extern "C"` blocks Fixes #64338.
2019-09-11Auto merge of #64271 - Centril:non-exhaustive-peel-refs, r=estebankbors-33/+284
check_match: refactor + improve non-exhaustive diagnostics for default binding modes Refactor `check_match` a bit with more code-reuse and improve the diagnostics for a non-exhaustive pattern match by peeling off any references from the scrutinee type so that the "defined here" label is added in more cases. For example: ```rust error[E0004]: non-exhaustive patterns: `&mut &B` not covered --> foo.rs:4:11 | 1 | enum E { A, B } | --------------- | | | | | not covered | `E` defined here ... 4 | match x { | ^ pattern `&mut &B` not covered | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms ``` Moreover, wrt. "defined here", we give irrefutable pattern matching (i.e. in `let`, `for`, and `fn` parameters) a more consistent treatment in line with `match`. r? @estebank
2019-09-11Auto merge of #64154 - alexcrichton:std-backtrace, r=sfacklerbors-0/+75
std: Add a `backtrace` module This commit adds a `backtrace` module to the standard library, as designed in [RFC 2504]. The `Backtrace` type is intentionally very conservative, effectively only allowing capturing it and printing it. Additionally this commit also adds a `backtrace` method to the `Error` trait which defaults to returning `None`, as specified in [RFC 2504]. More information about the design here can be found in [RFC 2504] and in the [tracking issue]. Implementation-wise this is all based on the `backtrace` crate and very closely mirrors the `backtrace::Backtrace` type on crates.io. Otherwise it's pretty standard in how it handles everything internally. [RFC 2504]: https://github.com/rust-lang/rfcs/blob/master/text/2504-fix-error.md [tracking issue]: https://github.com/rust-lang/rust/issues/53487 cc #53487
2019-09-11Make wording less confusingvarkor-5/+5
2019-09-10Correct the polymorphic extern fn error for const parametersvarkor-0/+37
2019-09-10Refactor "not FFI-safe" diagnosticvarkor-105/+157
2019-09-10Surround `PhantomData` in backticksvarkor-6/+6
2019-09-10Forbid opaque types in extern blocksvarkor-0/+30
2019-09-10Rollup merge of #64292 - davidtwco:issue-63832-await-temporary-lifetimes, ↵Mazdak Farrokhzad-12/+43
r=matthewjasper lowering: extend temporary lifetimes around await Fixes #63832. r? @matthewjasper cc @nikomatsakis
2019-09-10Rollup merge of #64256 - smaeul:patch/powerpc64-tests, r=alexcrichtonMazdak Farrokhzad-11/+12
test/c-variadic: Fix patterns on powerpc64 On architectures such as powerpc64 that use extend_integer_width_to in their C ABI processing, integer parameters shorter than the native register width will be annotated with the ArgAttribute::SExt or ArgAttribute::ZExt attribute, and that attribute will be included in the generated LLVM IR. In this test, all relevant parameters are `i32`, which will get the `signext` annotation on the relevant 64-bit architectures. Match both the annotated and non-annotated case, but enforce that the annotation is applied consistently.
2019-09-10Rollup merge of #63786 - tspiteri:const-abs, r=alexcrichtonMazdak Farrokhzad-0/+22
Make `abs`, `wrapping_abs`, `overflowing_abs` const functions This makes `abs`, `wrapping_abs` and `overflowing_abs` const functions like #58044 makes `wrapping_neg` and `overflowing_neg` const functions. `abs` is made const by returning `(self ^ -1) - -1` = `!self + 1` = `-self` for negative numbers and `(self ^ 0) - 0` = `self` for non-negative numbers. The subexpression `self >> ($BITS - 1)` evaluates to `-1` for negative numbers and `0` otherwise. The subtraction overflows when `self` is `min_value()`, as we would be subtracting `max_value() - -1`; this is when `abs` should overflow. `wrapping_abs` and `overflowing_abs` make use of `wrapping_sub` and `overflowing_sub` instead of the subtraction operator.
2019-09-10lowering: extend temporary lifetimes around awaitDavid Wood-12/+43
This commit changes the HIR lowering around `await` so that temporary lifetimes are extended. Previously, await was lowered as: ```rust { let mut pinned = future; loop { match ::std::future::poll_with_tls_context(unsafe { <::std::pin::Pin>::new_unchecked(&mut pinned) }) { ::std::task::Poll::Ready(result) => break result, ::std::task::Poll::Pending => {} } yield (); } } ``` With this commit, await is lowered as: ```rust match future { mut pinned => loop { match ::std::future::poll_with_tls_context(unsafe { <::std::pin::Pin>::new_unchecked(&mut pinned) }) { ::std::task::Poll::Ready(result) => break result, ::std::task::Poll::Pending => {} } yield (); } } ``` However, this change has the following side-effects: - All temporaries in future will be considered to live across a yield for the purpose of auto-traits. - Borrowed temporaries in future are likely to be considered to be live across the yield for the purpose of the generator transform. Signed-off-by: David Wood <david@davidtw.co>
2019-09-09test/c-variadic: Fix patterns on powerpc64Samuel Holland-11/+12
On architectures such as powerpc64 that use extend_integer_width_to in their C ABI processing, integer parameters shorter than the native register width will be annotated with the ArgAttribute::SExt or ArgAttribute::ZExt attribute, and that attribute will be included in the generated LLVM IR. In this test, all relevant parameters are `i32`, which will get the `signext` annotation on the relevant 64-bit architectures. Match both the annotated and non-annotated case, but enforce that the annotation is applied consistently.
2019-09-09Rollup merge of #64054 - estebank:unused-import-is-to-eager, r=petrochenkovMazdak Farrokhzad-11/+41
Always emit unresolved import errors and hide unused import lint Fix https://github.com/rust-lang/rust/issues/63724. r? @petrochenkov
2019-09-09Auto merge of #64313 - Centril:rollup-7w8b67g, r=Centrilbors-420/+375
Rollup of 5 pull requests Successful merges: - #63468 (Resolve attributes in several places) - #64121 (Override `StepBy::{try_fold, try_rfold}`) - #64278 (check git in bootstrap.py) - #64306 (Fix typo in config.toml.example) - #64312 (Unify escape usage) Failed merges: r? @ghost
2019-09-09Rollup merge of #63468 - c410-f3r:attrs, r=petrochenkovMazdak Farrokhzad-420/+375
Resolve attributes in several places Resolve attributes for Arm, Field, FieldPat, GenericParam, Param, StructField and Variant. This PR is based on @petrochenkov work located at https://github.com/petrochenkov/rust/commit/83fdb8d598c1a871d40b21faed64ee698b74f814.
2019-09-09std: Add a `backtrace` moduleAlex Crichton-0/+75
This commit adds a `backtrace` module to the standard library, as designed in [RFC 2504]. The `Backtrace` type is intentionally very conservative, effectively only allowing capturing it and printing it. Additionally this commit also adds a `backtrace` method to the `Error` trait which defaults to returning `None`, as specified in [RFC 2504]. More information about the design here can be found in [RFC 2504] and in the [tracking issue]. Implementation-wise this is all based on the `backtrace` crate and very closely mirrors the `backtrace::Backtrace` type on crates.io. Otherwise it's pretty standard in how it handles everything internally. [RFC 2504]: https://github.com/rust-lang/rfcs/blob/master/text/2504-fix-error.md [tracking issue]: https://github.com/rust-lang/rust/issues/53487 cc #53487
2019-09-09pacify tidy.Mazdak Farrokhzad-1/+1
2019-09-09check_match: unify check_irrefutable & check_exhaustive more.Mazdak Farrokhzad-50/+82
2019-09-09check_match: refactor + improve non-exhaustive diag for default binding modes.Mazdak Farrokhzad-0/+219
2019-09-09Auto merge of #63118 - Centril:stabilize-bind-by-move, r=matthewjasperbors-248/+30
Stabilize `bind_by_move_pattern_guards` in Rust 1.39.0 Closes https://github.com/rust-lang/rust/issues/15287. After stabilizing `#![feature(bind_by_move_pattern_guards)]`, you can now use bind-by-move bindings in patterns and take references to those bindings in `if` guards of `match` expressions. For example, the following now becomes legal: ```rust fn main() { let array: Box<[u8; 4]> = Box::new([1, 2, 3, 4]); match array { nums // ---- `nums` is bound by move. if nums.iter().sum::<u8>() == 10 // ^------ `.iter()` implicitly takes a reference to `nums`. => { drop(nums); // --------- Legal as `nums` was bound by move and so we have ownership. } _ => unreachable!(), } } ``` r? @matthewjasper
2019-09-09Resolve attributes in several placesCaio-420/+375
Arm, Field, FieldPat, GenericParam, Param, StructField and Variant
2019-09-09Auto merge of #64237 - estebank:tweak-method-not-found, r=Centrilbors-98/+98
Give method not found a primary span label
2019-09-08Give method not found a primary span labelEsteban Küber-98/+98
2019-09-09Auto merge of #64108 - estebank:issue-36836, r=Centrilbors-0/+24
Do not complain about unconstrained params when Self is Ty Error Fix #36836.
2019-09-08Rollup merge of #64263 - crlf0710:improve_wording, r=petrochenkovMazdak Farrokhzad-14/+14
Replace "feature gated" wording with "unstable".
2019-09-08Rollup merge of #64078 - Mark-Simulacrum:compiletest-lint-unused, r=petrochenkovMazdak Farrokhzad-68/+121
compiletest: disable -Aunused for run-pass tests Disabled the flag, but that led to quite a bit of fall out -- I think most of it is benign but I've not investigated thoroughly. r? @petrochenkov
2019-09-08Always emit unresolved import errors and hide unused import lintEsteban Küber-11/+41
2019-09-08Update test stderr with results of enabling unused lintsMark Rousskov-68/+121
2019-09-08Rollup merge of #64267 - ehuss:rustdoc-fix-mixed-code-block, r=GuillaumeGomezMazdak Farrokhzad-0/+26
rustdoc: fix diagnostic with mixed code block styles This fixes a relatively obscure issue where the diagnostic (emitted [here](https://github.com/rust-lang/rust/blame/ef54f57c5b9d894a38179d09b00610c1b337b086/src/librustdoc/passes/check_code_block_syntax.rs#L69)) would get confused since the "is_fenced" flag wasn't reset properly.
2019-09-08Rollup merge of #64265 - petrochenkov:useerr, r=estebankMazdak Farrokhzad-11/+29
resolve: Mark more erroneous imports as used Fixes https://github.com/rust-lang/rust/issues/63724 r? @estebank
2019-09-08Improve wording.Charles Lew-14/+14
2019-09-08Tests: No longer emitting 0008, E0301, E0302.Mazdak Farrokhzad-36/+0
2019-09-08Update tests wrt. bind_by_by_move_pattern_guards stabilization.Mazdak Farrokhzad-217/+35
2019-09-08Rollup merge of #64229 - kawa-yoiko:unreachable-call-lint, r=estebankMazdak Farrokhzad-13/+11
Reduce span to function name in unreachable calls As title suggests, this might close #64103. Refer to the updated tests for expected output. There is potential to further improve usability. In particular, is it favourable that the exact diverging expression/statement be pointed out (not only in this case, but for all unreachable code)? Certainly that would deserve another issue, but I'm interested in the opinions.
2019-09-08Rollup merge of #64177 - petrochenkov:curmod, r=matthewjasperMazdak Farrokhzad-0/+14
resolve: Do not afraid to set current module to enums and traits After https://github.com/rust-lang/rust/pull/63535/commits/cfbb60bf6d83fbcfcca1f2919131aa39fb997b53 it's ok. This is likely required for https://github.com/rust-lang/rust/pull/63468 to work correctly, because that PR starts resolving attributes on enum variants. r? @matthewjasper @c410-f3r
2019-09-08Rollup merge of #64066 - petrochenkov:softstab, r=matthewjasperMazdak Farrokhzad-0/+17
Support "soft" feature-gating using a lint Use it for feature-gating `#[bench]`. Closes https://github.com/rust-lang/rust/issues/63798.
2019-09-08Rollup merge of #64052 - ranweiler:debuginfo-boxed-struct-64050, r=alexcrichtonMazdak Farrokhzad-8/+8
Rename test locals to work around LLDB bug LLDB's expression parser can't unambiguously resolve local variables in some cases, as described in #47938. Work around this by using names that don't shadow direct submodules of `core`. Closes #64050.
2019-09-07Turn `soft_unstable` into a future-compatibility lintVadim Petrochenkov-0/+3