about summary refs log tree commit diff
path: root/src/test/compile-fail
AgeCommit message (Collapse)AuthorLines
2017-05-17Add better error message when == operator is badly usedGuillaume Gomez-23/+30
2017-05-17Stabilize the loop_break_value featurePietro Albini-16/+0
2017-05-16Auto merge of #41907 - est31:macro_unused, r=jseyfriedbors-0/+68
Add lint for unused macros Addresses parts of #34938, to add a lint for unused macros. We now output warnings by default when we encounter a macro that we didn't use for expansion. Issues to be resolved before this PR is ready for merge: - [x] fix the NodeId issue described above - [x] remove all unused macros from rustc and the libraries or set `#[allow(unused_macros)]` next to them if they should be kept for some reason. This is needed for successful boostrap and bors to accept the PR. -> #41934 - [x] ~~implement the full extent of #34938, that means the macro match arm checking as well.~~ *let's not do this for now*
2017-05-16Add test cases for cyclic specialization graph constructionMichael Woerister-0/+34
2017-05-16Fix a test to recognize newly introduced errors.Masaki Hara-1/+4
2017-05-15Fix regression on `include!(line!())`.Jeffrey Seyfried-0/+13
2017-05-15Prohibit parenthesized params in bounds etc.Masaki Hara-0/+41
2017-05-14Make unsatisfied trait bounds note multilineEsteban Küber-18/+0
Make diagnostic note for existing method with unsatisfied trait bounds multiline for cleaner output. ``` = note: the method `count` exists but the following trait bounds were not satisfied: `[closure@../../src/test/compile-fail/issue-36053-2.rs:17:39: 17:53] : std::ops::FnMut<(&_,)>` `std::iter::Filter<std::iter::Fuse<std::iter::Once<&str>> [closure@../../src/test/compile-fail/issue-36053-2.rs:17:39: 17:53]> : std::iter::Iterator` Before: ``` = note: the method `count` exists but the following trait bounds were not satisfied: `[closure@../../src/test/compile-fail/issue-36053-2.rs:17:39: 17:53] : std::ops::FnMut<(&_,)>`, `std::iter::Filter<std::iter::Fuse<std::iter::Once<&str>>, [closure@../../src/test/compile-fail/issue-36053-2.rs:17:39: 17:53]> : std::iter::Iterator` ```
2017-05-13Rollup merge of #41939 - eddyb:trait-assoc-const-default, r=petrochenkovMark Simulacrum-15/+38
rustc_resolve: don't deny outer type parameters in embedded constants. This solves a problem noted at https://github.com/rust-lang/rust/issues/29646#issuecomment-300929548, where an associated const default in a trait couldn't refer to `Self` or type parameters, due to inaccuracies in lexical scoping. I've also allowed "embedded expressions" (`[T; expr]`, `[x; expr]`, `typeof expr`) to refer to type parameters in scope. *However*, the typesystem still doesn't handle #34344. Fully resolving that issue requires breaking cycles more aggressively (e.g. lazy evaluation), *even* in when the expression doesn't depend on type parameters, to type-check it at all, and then also type-level "constant projections" (in the vein of `{expr}` from const generics).
2017-05-13rustc_resolve: don't deny outer type parameters in embedded constants.Eduard-Mihai Burtescu-15/+38
2017-05-13rustc: treat ReEarlyBound as free without replacing it with ReFree.Eduard-Mihai Burtescu-4/+6
2017-05-13rustc: use DefId instead of CodeExtent for FreeRegion's scope.Eduard-Mihai Burtescu-2/+2
2017-05-13Add test, and fix the other testsest31-0/+68
2017-05-12Rollup merge of #41876 - oli-obk:diagnosing_diagnostics, r=nagisaMark Simulacrum-3/+3
Refactor suggestion diagnostic API to allow for multiple suggestions r? @jonathandturner cc @nrc @petrochenkov
2017-05-12Auto merge of #41757 - alexcrichton:stabilize-crt-static, r=japaricbors-14/+0
rustc: Stabilize `-C target-feature=+crt-static` This commit stabilizes the `crt-static` feature accepted by the compiler. Note that this does not stabilize the `#[cfg]` attribute for `crt-static` as that's going to be covered by #29717. This only stabilizes a few small pieces: * The `crt-static` feature as accepted by the `-C target-feature` flag, and its connection with the platform-specific definition of `crt-static`. * The semantics of `--print cfg` printing out activated `crt-static` feature, if available. This should be enough to get the benefits of `crt-static` on stable Rust with MSVC and with musl, but sidsteps the issue of stabilizing #29717 first. Closes #37406
2017-05-11correct various error messages that changedNiko Matsakis-10/+9
The new messages seem universally better. I think these result because we recognize that we are in an invariant context more often.
2017-05-10Update a compile-fail testOliver Schneider-3/+3
2017-05-09Prohibit parenthesized params in more types.Masaki Hara-0/+25
2017-05-08Rollup merge of #41838 - z1mvader:fix_fn_args_coerce_closure, r=nikomatsakisCorey Farwell-8/+37
Fixed argument inference for closures when coercing into 'fn' This fixes https://github.com/rust-lang/rust/issues/41755. The tests `compile-fail/closure-no-fn.rs` and `compile-fail/issue-40000.rs` were modified. A new test `run-pass/closure_to_fn_coercion-expected-types.rs` was added r? @nikomatsakis
2017-05-08Rollup merge of #41828 - arielb1:lvalue-ops, r=eddybCorey Farwell-0/+78
try to fix lvalue ops for real Hopefully this is the last PR needed. Fixes #41726. Fixes #41742. Fixes #41774.
2017-05-08Rollup merge of #41293 - est31:floating_literal_match, r=nikomatsakisCorey Farwell-0/+56
Implement the illegal_floating_point_literal_pattern compat lint Adds a future-compatibility lint for the [breaking-change] introduced by issue #41620 . cc issue #41255 .
2017-05-08first part of issue-40000.rs is now passingChristian Poveda-2/+1
2017-05-08dividied closure-no-fn.rs into three different testsChristian Poveda-6/+36
2017-05-08try to fix lvalue ops for realAriel Ben-Yehuda-0/+78
Hopefully this is the last PR needed. Fixes #41726. Fixes #41742. Fixes #41774.
2017-05-07Auto merge of #40857 - estebank:recursive, r=arielb1bors-6/+18
Point at fields that make the type recursive On recursive types of infinite size, point at all the fields that make the type recursive. ```rust struct Foo { bar: Bar, } struct Bar { foo: Foo, } ``` outputs ``` error[E0072]: recursive type `Foo` has infinite size --> file.rs:1:1 1 | struct Foo { | ^^^^^^^^^^ recursive type has infinite size 2 | bar: Bar, | -------- recursive here | = help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `Foo` representable error[E0072]: recursive type `Bar` has infinite size --> file.rs:5:1 | 5 | struct Bar { | ^^^^^^^^^^ recursive type has infinite size 6 | foo: Foo, | -------- recursive here | = help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `Bar` representable ```
2017-05-05Move logic to `is_representable` instead of climbing HIREsteban Küber-5/+14
2017-05-05Rollup merge of #41734 - nikomatsakis:incr-comp-refactor-variance, r=pnkfelixCorey Farwell-14/+46
Refactor variance and remove last `[pub]` map This PR refactors variance to work in a more red-green friendly way. Because red-green doesn't exist yet, it has to be a bit hacky. The basic idea is this: - We compute a big map with the variance for all items in the crate; when you request variances for a particular item, we read it from the crate - We now hard-code that traits are invariant (which they are, for deep reasons, not gonna' change) - When building constraints, we compute the transitive closure of all things within the crate that depend on what using `TransitiveRelation` - this lets us gin up the correct dependencies when requesting variance of a single item Ah damn, just remembered, one TODO: - [x] Update the variance README -- ah, I guess the README updates I did are sufficient r? @michaelwoerister
2017-05-04Only point at the fields that cause infinite sizeEsteban Küber-1/+4
* clean up code * point only fields that cause the type to be of infinite size * fix unittests
2017-05-04rustc: Stabilize `-C target-feature=+crt-static`Alex Crichton-14/+0
This commit stabilizes the `crt-static` feature accepted by the compiler. Note that this does not stabilize the `#[cfg]` attribute for `crt-static` as that's going to be covered by #29717. This only stabilizes a few small pieces: * The `crt-static` feature as accepted by the `-C target-feature` flag, and its connection with the platform-specific definition of `crt-static`. * The semantics of `--print cfg` printing out activated `crt-static` feature, if available. This should be enough to get the benefits of `crt-static` on stable Rust with MSVC and with musl, but sidsteps the issue of stabilizing #29717 first. Closes #37406
2017-05-03correct the new graphs resulting from various testsNiko Matsakis-5/+13
(Now that variances are not part of signature.)
2017-05-03add back variance testing mechanismNiko Matsakis-9/+1
make it work for traits etc uniformly
2017-05-03factor variances into a proper queryNiko Matsakis-0/+32
There are now two queries: crate and item. The crate one computes the variance of all items in the crate; it is sort of an implementation detail, and not meant to be used. The item one reads from the crate one, synthesizing correct deps in lieu of the red-green algorithm. At the same time, remove the `variance_computed` flag, which was a horrible hack used to force invariance early on (e.g. when type-checking constants). This is only needed because of trait applications, and traits are always invariant anyway. Therefore, we now change to take advantage of the query system: - When asked to compute variances for a trait, just return a vector saying 'all invariant'. - Remove the corresponding "inferreds" from traits, and tweak the constraint generation code to understand that traits are always inferred.
2017-05-03Auto merge of #41711 - sirideain:add-static-methods-test, r=aturonbors-0/+23
Add test for Inherent static methods Fixes #28848
2017-05-03Auto merge of #41624 - RalfJung:mutexguard-sync, r=alexcrichtonbors-0/+22
MutexGuard<T> may be Sync only if T is Sync Fixes #41622 This is a breaking change. Does that imply any further process? I am not sure whether I wrote that "compilation must fail"-test correctly, but at least it is passing here with the patch applied. Same for the `since = "1.18.0"`, I just picked it because I had to pick something.
2017-05-02Fix testest31-0/+4
2017-05-02Fix non exhaustive match testest31-0/+1
2017-05-02Add illegal_floating_point_literal_pattern compat lintest31-0/+51
Adds a compatibility lint to disallow floating point literals in patterns like in match. See the tracking issue #41620.
2017-05-02Add test for Inherent static methods can be called with a non-well-formed ↵Charlie Sheridan-0/+23
Self-type.
2017-05-02Rollup merge of #41692 - est31:anon_params, r=eddybCorey Farwell-0/+25
Add a lint to disallow anonymous parameters Adds a (allow by default) lint to disallow anonymous parameters, like it was decided in RFC 1685 (rust-lang/rfcs#1685). cc tracking issue #41686
2017-05-02Auto merge of #41488 - estebank:closure-args, r=arielb1bors-91/+0
Clean up callable type mismatch errors ```rust error[E0593]: closure takes 1 argument but 2 arguments are required here --> ../../src/test/ui/mismatched_types/closure-arg-count.rs:13:15 | 13 | [1, 2, 3].sort_by(|(tuple, tuple2)| panic!()); | ^^^^^^^ -------------------------- takes 1 argument | | | expected closure that takes 2 arguments ``` instead of ```rust error[E0281]: type mismatch: the type `[closure@../../src/test/ui/mismatched_types/closure-arg-count.rs:13:23: 13:49]` implements the trait `for<'r> std::ops::FnMut<(&'r {integer},)>`, but the trait `for<'r, 'r> std::ops::FnMut<(&'r {integer}, &'r {integer})>` is required (expected a tuple with 2 elements, found one with 1 elements) --> ../../src/test/ui/mismatched_types/closure-arg-count.rs:13:15 | 13 | [1, 2, 3].sort_by(|(tuple, tuple2)| panic!()); | ^^^^^^^ ``` Fix #21857, re #24680.
2017-05-02Add a lint to disallow anonymous parametersest31-0/+25
2017-05-02Auto merge of #40851 - oli-obk:multisugg, r=jonathandturnerbors-51/+1
Minimize single span suggestions into a label changes ``` 14 | println!("☃{}", tup[0]); | ^^^^^^ | help: to access tuple elements, use tuple indexing syntax as shown | println!("☃{}", tup.0); ``` into ``` 14 | println!("☃{}", tup[0]); | ^^^^^^ to access tuple elements, use `tup.0` ``` Also makes suggestions explicit in the backend in preparation of adding multiple suggestions to a single diagnostic. Currently that's already possible, but results in a full help message + modified code snippet per suggestion, and has no rate limit (might show 100+ suggestions).
2017-05-01Auto merge of #41629 - Mark-Simulacrum:re-enable-tests, r=nikomatsakisbors-5/+4
Unignore tests which work fine now. As far as I can tell, these tests will now work fine. #13745 tracks the remaining tests which are ignored for various reasons.
2017-05-01Add profiling support, through the rustc -Z profile flag.whitequark-0/+13
When -Z profile is passed, the GCDAProfiling LLVM pass is added to the pipeline, which uses debug information to instrument the IR. After compiling with -Z profile, the $(OUT_DIR)/$(CRATE_NAME).gcno file is created, containing initial profiling information. After running the program built, the $(OUT_DIR)/$(CRATE_NAME).gcda file is created, containing branch counters. The created *.gcno and *.gcda files can be processed using the "llvm-cov gcov" and "lcov" tools. The profiling data LLVM generates does not faithfully follow the GCC's format for *.gcno and *.gcda files, and so it will probably not work with other tools (such as gcov itself) that consume these files.
2017-04-30Add test for issue #16994.Mark Simulacrum-0/+20
2017-04-29MutexGuard<T> may be Sync only if T is SyncRalf Jung-0/+22
Also remove some unnecessary unsafe impl from the tests.
2017-04-29Auto merge of #41564 - gaurikholkar:master, r=nikomatsakisbors-3/+0
Disable ref hint for pattern in let and adding ui tests #40402 A fix to #40402 The `to prevent move, use ref e or ref mut e ` has been disabled. ``` fn main() { let v = vec![String::from("oh no")]; let e = v[0]; } ``` now gives ``` error[E0507]: cannot move out of indexed content --> example.rs:4:13 | 4 | let e = v[0]; | ^^^^ cannot move out of indexed content error: aborting due to previous error ``` I have added ui tests for the same and also modified a compile-fail test.
2017-04-28Unignore tests which work fine now.Mark Simulacrum-5/+4
2017-04-28Auto merge of #41542 - petrochenkov:objpars2, r=nikomatsakisbors-0/+54
syntax: Parse trait object types starting with a lifetime bound Fixes https://github.com/rust-lang/rust/issues/39085 This was originally implemented in https://github.com/rust-lang/rust/pull/40043, then reverted, then there was some [agreement](https://github.com/rust-lang/rust/issues/39318#issuecomment-289108720) that it should be supported. (This is hopefully the last PR related to bound parsing.)
2017-04-28Disable ref hint for pattern in let and adding ui-tests.gaurikholkar-3/+0