summary refs log tree commit diff
path: root/src/test/ui
AgeCommit message (Collapse)AuthorLines
2017-11-14check_unsafety: fix unused unsafe block duplicationAriel Ben-Yehuda-8/+9
The duplicate error message is later removed by error message deduplication, but it still appears on beta and is still a bug
2017-11-14Backported merge of #45785 - arielb1:unsafe-fixes, r=eddybbors-8/+114
fixes to MIR effectck r? @eddyb beta-nominating because regression (MIR effectck is new)
2017-10-08Auto merge of #45020 - MaloJaffre:needs-test, r=alexcrichtonbors-0/+26
Fix some E-needstest issues. Also ignore `attr-on-trait` test on stage-1 to keep `./x.py test --stage 1` successful. Fixes #30355. Fixes #33241. Fixes #36400. Fixes #37887. Fixes #44578.
2017-10-06implement pattern-binding-modes RFCTobias Schottdorf-6/+381
See the [RFC] and [tracking issue]. [tracking issue]: https://github.com/rust-lang/rust/issues/42640 [RFC]: https://github.com/rust-lang/rfcs/blob/491e0af/text/2005-match-ergonomics.md
2017-10-04Fix some E-needstest issues.Malo Jaffré-0/+26
Also ignore `attr-on-trait` test on stage-1 to keep `./x.py test --stage 1` successful. Fixes #30355. Fixes #33241. Fixes #36400. Fixes #37887. Fixes #44578.
2017-10-02Auto merge of #44959 - arielb1:generic-errors, r=eddybbors-1/+75
handle nested generics in Generics::type_param/region_param Fixes #44952. r? @eddyb
2017-10-02fix handling of `Self`Ariel Ben-Yehuda-15/+46
2017-10-02Auto merge of #44942 - zackmdavis:lint_suggestions, r=estebankbors-1/+92
code suggestions for unused-mut, while-true, deprecated-attribute, and unused-parens lints ![lint_suggestions](https://user-images.githubusercontent.com/1076988/31044068-b2074de8-a57c-11e7-9319-6668508b6d1f.png) r? @estebank
2017-10-01correct unused-parens lint suggestion to strip exact pairZack M. Davis-0/+26
2017-10-01handle nested generics in Generics::type_param/region_paramAriel Ben-Yehuda-1/+44
Fixes #44952.
2017-09-30code suggestions for unused-mut, while-true lints; UI testZack M. Davis-1/+66
2017-09-29Rollup merge of #44124 - gaurikholkar:return_self, r=arielb1Mark Simulacrum-99/+35
adding E0623 for return types - both parameters are anonymous This is a fix for #44018 ``` error[E0621]: explicit lifetime required in the type of `self` --> $DIR/ex3-both-anon-regions-return-type-is-anon.rs:17:5 | 16 | fn foo<'a>(&self, x: &i32) -> &i32 { | ---- ---- | | | this parameter and the return type are declared with different lifetimes... 17 | x | ^ ...but data from `x` is returned here error: aborting due to previous error ``` It also works for the below case where we have self as anonymous ``` error[E0623]: lifetime mismatch --> src/test/ui/lifetime-errors/ex3-both-anon-regions-self-is-anon.rs:17:19 | 16 | fn foo<'a>(&self, x: &Foo) -> &Foo { | ---- ---- | | | this parameter and the return type are declared with different lifetimes... 17 | if true { x } else { self } | ^ ...but data from `x` is returned here error: aborting due to previous error ``` r? @nikomatsakis Currently, I have enabled E0621 where return type and self are anonymous, hence WIP.
2017-09-29Auto merge of #42526 - huntiep:try_opt, r=nikomatsakisbors-0/+47
Impl Try for Option This is part of #31436.
2017-09-29Auto merge of #44847 - estebank:unused-signature, r=nikomatsakisbors-8/+80
Point at signature on unused lint ``` warning: struct is never used: `Struct` --> $DIR/unused-warning-point-at-signature.rs:22:1 | 22 | struct Struct { | ^^^^^^^^^^^^^ ``` Fix #33961.
2017-09-27Auto merge of #44782 - estebank:issue-36700, r=GuillaumeGomezbors-0/+61
Point at parameter type on E0301 On "the parameter type `T` may not live long enough" error, point to the parameter type suggesting lifetime bindings: ``` error[E0310]: the parameter type `T` may not live long enough --> $DIR/lifetime-doesnt-live-long-enough.rs:28:5 | 27 | struct Foo<T> { | - help: consider adding an explicit lifetime bound `T: 'static`... 28 | foo: &'static T | ^^^^^^^^^^^^^^^ | note: ...so that the reference type `&'static T` does not outlive the data it points at --> $DIR/lifetime-doesnt-live-long-enough.rs:28:5 | 28 | foo: &'static T | ^^^^^^^^^^^^^^^ ``` Fix #36700.
2017-09-27Add UI testsHunter Praska-0/+47
2017-09-26fix test referenceNiko Matsakis-1/+1
2017-09-26remove random newlines from error messages, fix compile-fail testNiko Matsakis-10/+5
That kind of formatting seems like the job of other code.
2017-09-26use present tense consistently and update referencesNiko Matsakis-4/+4
2017-09-26modify message for return time having multiple lifetimesgaurikholkar-32/+25
2017-09-26merge fixes, addressing CR commentsgaurikholkar-76/+24
2017-09-26Auto merge of #44735 - tirr-c:issue-42143, r=arielb1bors-52/+160
Friendlier error message for closure argument type mismatch Rebased #42270. Fixes #42143. --- `test.rs`: ```rust fn main() { foo(|_: i32, _: usize| ()); } fn foo<F>(_: F) where F: Fn(&str, usize) {} ``` Before: ``` error[E0281]: type mismatch: `[closure@test.rs:2:9: 2:30]` implements the trait `std::ops::Fn<(i32, usize)>`, but the trait `for<'r> std::ops::Fn<(&'r str, usize)>` is required --> test.rs:2:5 | 2 | foo(|_: i32, _: usize| ()); | ^^^ --------------------- implements `std::ops::Fn<(i32, usize)>` | | | expected &str, found i32 | requires `for<'r> std::ops::Fn<(&'r str, usize)>` | = note: required by `foo` ``` After (early): ``` error[E0631]: type mismatch in closure arguments --> test.rs:2:5 | 2 | foo(|_: i32, _: usize| ()); | ^^^ --------------------- takes arguments of type `i32` and `usize` | | | expected arguments of type `&str` and `usize` | = note: required by `foo` ``` After (current): ``` error[E0631]: type mismatch in closure arguments --> test.rs:2:5 | 2 | foo(|_: i32, _: usize| ()); | ^^^ --------------------- found signature of `fn(i32, usize) -> _` | | | expected signature of `for<'r> fn(&'r str, usize) -> _` | = note: required by `foo` ``` ~~Compiler output has been changed, and a few tests are failing. Help me writing/fixing tests!~~ r? @nikomatsakis
2017-09-25Auto merge of #44297 - laumann:suggest-misspelt-methods, r=arielb1bors-0/+74
Add suggestions for misspelled method names Use the syntax::util::lev_distance module to provide suggestions when a named method cannot be found. Part of #30197
2017-09-25Point at signature on unused lintEsteban Küber-8/+80
2017-09-24Point at parameter type on E0301Esteban Küber-0/+61
On "the parameter type `T` may not live long enough" error, point to the parameter type suggesting lifetime bindings: ``` error[E0310]: the parameter type `T` may not live long enough --> $DIR/lifetime-doesnt-live-long-enough.rs:28:5 | 27 | struct Foo<T> { | - help: consider adding an explicit lifetime bound `T: 'static`... 28 | foo: &'static T | ^^^^^^^^^^^^^^^ | note: ...so that the reference type `&'static T` does not outlive the data it points at --> $DIR/lifetime-doesnt-live-long-enough.rs:28:5 | 28 | foo: &'static T | ^^^^^^^^^^^^^^^ ```
2017-09-24Change Levensthein-based method to a single suggestionThomas Jespersen-9/+9
The convention for suggesting close matches is to provide at most one match (the closest one). Change the suggestions for misspelt method names to obey that.
2017-09-24Rollup merge of #44103 - zackmdavis:cmp_op_must_use, r=arielb1Guillaume Gomez-10/+34
add comparison operators to must-use lint (under `fn_must_use` feature) Although RFC 1940 is about annotating functions with `#[must_use]`, a key part of the motivation was linting unused equality operators. (See https://github.com/rust-lang/rfcs/pull/1812#issuecomment-265695898—it seems to have not been clear to discussants at the time that marking the comparison methods as `must_use` would not give us the lints on comparison operators, at least in (what the present author understood as) the most straightforward implementation, as landed in #43728 (3645b062).) To rectify the situation, we here lint unused comparison operators as part of the unused-must-use lint (feature gated by the `fn_must_use` feature flag, which now arguably becomes a slight (tolerable in the opinion of the present author) misnomer). This is in the matter of #43302. cc @crumblingstatue
2017-09-24Auto merge of #44786 - thombles:tk/i41314, r=petrochenkovbors-0/+35
Improve diagnostics when attempting to match tuple enum variant with struct pattern Adds an extra note as below to explain that a tuple pattern was probably intended. ``` error[E0026]: variant `X::Y` does not have a field named `data` --> src/main.rs:18:16 | 18 | X::Y { data } => println!("The data is {}", data) | ^^^^ variant `X::Y` does not have field `data` error[E0027]: pattern does not mention field `0` --> src/main.rs:18:9 | 18 | X::Y { data } => println!("The data is {}", data) | ^^^^^^^^^^^^^ missing field `0` | = note: trying to match a tuple variant with a struct variant pattern ``` Fixes #41314.
2017-09-23update `fn_must_use` UI test to exercise nonprimitive comparisonsZack M. Davis-12/+31
2017-09-23Auto merge of #43870 - GuillaumeGomez:deref-suggestion, r=nikomatsakisbors-0/+93
Add deref suggestion Fixes #34562.
2017-09-23UI unit test for note when matching tuple enum with struct patternThomas Karpiniec-0/+35
2017-09-23Print fn signature when there is closure argument type mismatchWonwoo Choi-52/+160
Fixes #42143. E0281 is totally replaced by E0631. UI tests are updated accordingly.
2017-09-22add comparison operators to must-use lint (under `fn_must_use` feature)Zack M. Davis-5/+10
Although RFC 1940 is about annotating functions with `#[must_use]`, a key part of the motivation was linting unused equality operators. (See https://github.com/rust-lang/rfcs/pull/1812#issuecomment-265695898—it seems to have not been clear to discussants at the time that marking the comparison methods as `must_use` would not give us the lints on comparison operators, at least in (what the present author understood as) the most straightforward implementation, as landed in #43728 (3645b062).) To rectify the situation, we here lint unused comparison operators as part of the unused-must-use lint (feature gated by the `fn_must_use` feature flag, which now arguably becomes a slight (tolerable in the opinion of the present author) misnomer). This is in the matter of #43302.
2017-09-21suggest an outer attribute when `#![derive(...)]` (predictably) failsZack M. Davis-1/+1
2017-09-21only set non-ADT derive error once per attribute, not per traitZack M. Davis-0/+24
A slight eccentricity of this change is that now non-ADT-derive errors prevent derive-macro-not-found errors from surfacing (see changes to the gating-of-derive compile-fail tests). Resolves #43927.
2017-09-21Add deref suggestionGuillaume Gomez-0/+93
2017-09-21Auto merge of #44215 - oli-obk:import_sugg, r=nrcbors-13/+33
don't suggest placing `use` statements into expanded code r? @nrc fixes #44210 ```rust #[derive(Debug)] struct Foo; type X = Path; ``` will try to place `use std::path::Path;` between `#[derive(Debug)]` and `struct Foo;` I am not sure how to obtain a span before the first attribute, because derive attributes are removed during expansion. It would be trivial to detect this case and place the `use` after the item, but that would be somewhat weird I think.
2017-09-21Add suggestions for misspelled method namesThomas Jespersen-0/+74
Use the syntax::util::lev_distance module to provide suggestions when a named method cannot be found. Part of #30197
2017-09-20add proofs and fix postorder traversalAriel Ben-Yehuda-4/+4
I don't think the "quasi-postorder" travesal could cause any issues, but there's no reason for it to stay broken.
2017-09-20Only consider yields coming after the expressions when computing generator ↵John Kåre Alsaker-34/+0
interiors
2017-09-19Auto merge of #44620 - zackmdavis:rfc_1940_housekeeping, r=nikomatsakisbors-53/+100
RFC 1940 housekeeping * move test to own directory, as requested in https://github.com/rust-lang/rust/issues/43302#issuecomment-329579185 * exercise trait methods in test * unstable book section r? @nikomatsakis
2017-09-17Rollup merge of #44549 - gaurikholkar:master, r=arielb1Tim Neumann-0/+60
extend E0623 for earlybound and latebound for structs This fixes #44508 r? @nikomatsakis
2017-09-17Rollup merge of #44088 - bjorn3:better_trace_macros, r=jseyfriedTim Neumann-0/+106
Fix "new trace_macros doesn't work if there's an error during expansion" Fixes #43493
2017-09-16Auto merge of #43017 - durka:stabilize-const-invocation, r=eddybbors-3/+3
Individualize feature gates for const fn invocation This PR changes the meaning of `#![feature(const_fn)]` so it is only required to declare a const fn but not to call one. Based on discussion at #24111. I was hoping we could have an FCP here in order to move that conversation forward. This sets the stage for future stabilization of the constness of several functions in the standard library (listed below), so could someone please tag the lang team for review. - `std::cell` - `Cell::new` - `RefCell::new` - `UnsafeCell::new` - `std::mem` - `size_of` - `align_of` - `std::ptr` - `null` - `null_mut` - `std::sync` - `atomic` - `Atomic{Bool,Ptr,Isize,Usize}::new` - `once` - `Once::new` - primitives - `{integer}::min_value` - `{integer}::max_value` Some other functions are const but they are also unstable or hidden, e.g. `Unique::new` so they don't have to be considered at this time. After this stabilization, the following `*_INIT` constants in the standard library can be deprecated. I wasn't sure whether to include those deprecations in the current PR. - `std::sync` - `atomic` - `ATOMIC_{BOOL,ISIZE,USIZE}_INIT` - `once` - `ONCE_INIT`
2017-09-16change #![feature(const_fn)] to specific gatesAlex Burka-3/+3
2017-09-15RFC 1940 UI test in own directory, exercise must_use trait methodsZack M. Davis-53/+100
(It was put forward that all tests related to a feature being in their own directory makes stabilization decisionmaking more convenient.)
2017-09-14Rollup merge of #44569 - est31:master, r=estebankCorey Farwell-1/+1
"avoid" is a better word here than "disable" You don't "disable" the warning really, you just avoid it (as a conscious action).
2017-09-14"avoid" is a better word here than "disable"est31-1/+1
2017-09-14add ui tests for EBRgaurikholkar-0/+32
2017-09-14adding ui testsgaurikholkar-0/+28