about summary refs log tree commit diff
path: root/src/test/compile-fail
AgeCommit message (Collapse)AuthorLines
2017-08-02Add regression test for #40510Daan Sprenkels-0/+23
2017-08-01Added tests for bugs fixed.Isaac van Bakel-0/+14
2017-08-01Auto merge of #43552 - petrochenkov:instab, r=jseyfriedbors-67/+0
resolve: Try to fix instability in import suggestions cc https://github.com/rust-lang/rust/pull/42033 `lookup_import_candidates` walks module graph in DFS order and skips modules that were already visited (which is correct because there can be cycles). However it means that if we visited `std::prelude::v1::Result::Ok` first, we will never visit `std::result::Result::Ok` because `Result` will be skipped as already visited (note: enums are also modules here), and otherwise, if we visited `std::result::Result::Ok` first, we will never get to `std::prelude::v1::Result::Ok`. What child module of `std` (`prelude` or `result`) we will visit first, depends on randomized hashing, so we have instability in diagnostics. With this patch modules' children are visited in stable order in `lookup_import_candidates`, this should fix the issue, but let's see what Travis will say. r? @oli-obk
2017-07-31limit and delimit available fields in noteZack M. Davis-7/+7
Also, don't show the note if no fields are available (usually due to privacy).
2017-07-30Auto merge of #43543 - petrochenkov:32330, r=nikomatsakisbors-43/+30
Cleanup some remains of `hr_lifetime_in_assoc_type` compatibility lint r? @nikomatsakis
2017-07-30resolve: Fix instability in import suggestionsVadim Petrochenkov-67/+0
2017-07-29Auto merge of #43009 - GuillaumeGomez:unused-doc-comments, r=nrcbors-6/+18
Throw errors when doc comments are added where they're unused #42617
2017-07-29Cleanup some remains of `hr_lifetime_in_assoc_type` compatibility lintVadim Petrochenkov-43/+30
2017-07-28Fix testsJohn Kåre Alsaker-4/+2
2017-07-28change how we report `err_out_of_scope` borrowck errorsNiko Matsakis-188/+0
Also, remove the explicit code detecting borrows over a yield. It turns out not to be necessary -- any such borrow winds up with a lifetime that is part of the generator type, and therefore which will outlive the generator expression itself, which yields an `err_out_of_scope`. So instead we intercept those errors and display them in a nicer way.
2017-07-28Convert to spacesJohn Kåre Alsaker-8/+8
2017-07-28Remove support for `gen arg`Alex Crichton-12/+5
2017-07-28fix yields-in-args test and add a reverse oneNiko Matsakis-4/+28
2017-07-28add some tests of yielding with outstanding borrowsNiko Matsakis-0/+144
No doubt there are more tests one might write, but it's a start.
2017-07-28Convert tabs to spacesAlex Crichton-4/+4
2017-07-28Add a testJohn Kåre Alsaker-0/+20
2017-07-28Use FIXME instead of TODOJohn Kåre Alsaker-1/+1
2017-07-28Ensure upvars are dropped when generators have never been resumedJohn Kåre Alsaker-1/+1
2017-07-28Make yield and gen arg outside generator literals an error and update testsJohn Kåre Alsaker-8/+30
2017-07-28Add some generator pass/fail testsAlex Crichton-0/+66
2017-07-28Added some testsJohn Kåre Alsaker-15/+14
2017-07-28Fix tidy warningsAlex Crichton-9/+9
2017-07-28Generator literal supportJohn Kåre Alsaker-0/+55
2017-07-27Auto merge of #43438 - petrochenkov:path, r=jseyfriedbors-50/+6
syntax: Simplify parsing of paths Discern between `Path` and `Path<>` in AST (but not in HIR). Give span to angle bracketed generic arguments (`::<'a, T>` in `path::segment::<'a, T>`). This is a refactoring in preparation for https://internals.rust-lang.org/t/macro-path-uses-novel-syntax/5561/3, but it doesn't add anything to the grammar yet. r? @jseyfried
2017-07-27Give span to angle bracketed generic argumentsVadim Petrochenkov-73/+0
2017-07-27Discern between `Path` and `Path<>` in ASTVadim Petrochenkov-4/+32
2017-07-27Simplify parsing of pathsVadim Petrochenkov-4/+5
2017-07-27Auto merge of #43443 - bitshifter:issue-43317, r=nikomatsakisbors-6/+67
Improve checking of conflicting packed and align representation hints on structs and unions. Fixes #43317 and improves #33626.
2017-07-27Update testsGuillaume Gomez-22/+4
2017-07-27Make a lint insteadGuillaume Gomez-59/+16
2017-07-27Throw errors when doc comments are added where they're unusedGuillaume Gomez-1/+74
2017-07-26Auto merge of #43373 - alexcrichton:stabilize-1.20.0, r=aturonbors-15/+0
Stabilize more APIs for the 1.20.0 release In addition to the few stabilizations that have already landed, this cleans up the remaining APIs that are in `final-comment-period` right now to be stable by the 1.20.0 release
2017-07-26Rollup merge of #43465 - topecongiro:needs-test, r=Mark-SimulacrumMark Simulacrum-0/+43
Add tests for issues with the E-needstest label Fixes #19181. Fixes #29516. Fixes #29798. Fixes #33504. Fixes #34780. Fixes #39211. Fixes #39467. Fixes #39720.
2017-07-26Rollup merge of #43447 - estebank:import-span, r=nikomatsakisMark Simulacrum-25/+22
Point at path segment on module not found Point at the correct path segment on a import statement where a module doesn't exist. New output: ```rust error[E0432]: unresolved import `std::bar` --> <anon>:1:10 | 1 | use std::bar::{foo1, foo2}; | ^^^ Could not find `bar` in `std` ``` instead of: ```rust error[E0432]: unresolved import `std::bar::foo1` --> <anon>:1:16 | 1 | use std::bar::{foo1, foo2}; | ^^^^ Could not find `bar` in `std` error[E0432]: unresolved import `std::bar::foo2` --> <anon>:1:22 | 1 | use std::bar::{foo1, foo2}; | ^^^^ Could not find `bar` in `std` ``` Fix #43040.
2017-07-25Point at return type always when type mismatch against itEsteban Küber-7/+5
Before this, the diagnostic errors would only point at the return type when changing it would be a possible solution to a type error. Add a label to the return type without a suggestion to change in order to make the source of the expected type obvious. Follow up to #42850, fixes #25133, fixes #41897.
2017-07-25Point at path segment on module not foundEsteban Küber-25/+22
Point at the correct path segment on a import statement where a module doesn't exist. New output: ```rust error[E0432]: unresolved import `std::bar` --> <anon>:1:10 | 1 | use std::bar::{foo1, foo2}; | ^^^ Could not find `bar` in `std` ``` instead of: ```rust error[E0432]: unresolved import `std::bar::foo1` --> <anon>:1:16 | 1 | use std::bar::{foo1, foo2}; | ^^^^ Could not find `bar` in `std` error[E0432]: unresolved import `std::bar::foo2` --> <anon>:1:22 | 1 | use std::bar::{foo1, foo2}; | ^^^^ Could not find `bar` in `std` ```
2017-07-25Stabilize the `compile_error_macro` featureAlex Crichton-15/+0
Stabilizes: * `compile_error!` as a macro defined by rustc Closes #40872
2017-07-25Auto merge of #43325 - ollie27:overflowing_literals, r=arielb1bors-2/+2
Fix overflowing_literals lint for large f32s Float literals need to be parsed as the correct type so they can be rounded correctly.
2017-07-25Add tests for issues with the E-needstest labeltopecongiro-0/+43
2017-07-24Apply packed and align restrictions to unions.Cameron Hart-7/+60
2017-07-23field does not exist error: note fields if Levenshtein suggestion failsZack M. Davis-4/+11
When trying to access or initialize a nonexistent field, if we can't infer what field was meant (by virtue of the purported field in the source being a small Levenshtein distance away from an actual field, suggestive of a typo), issue a note listing all the available fields. To reduce terminal clutter, we don't issue the note when we have a `find_best_match_for_name` Levenshtein suggestion: the suggestion is probably right. The third argument of the call to `find_best_match_for_name` is changed to `None`, accepting the default maximum Levenshtein distance of one-third of the identifier supplied for correction. The previous value of `Some(name.len())` was overzealous, inappropriately very Levenshtein-distant suggestions when the attempted field access could not plausibly be a mere typo. For example, if a struct has fields `mule` and `phone`, but I type `.donkey`, I'd rather the error have a note listing that the available fields are, in fact, `mule` and `phone` (which is the behavior induced by this patch) rather than the error asking "did you mean `phone`?" (which is the behavior on master). The "only find fits with at least one matching letter" comment was accurate when it was first introduced in 09d992471 (January 2015), but is a vicious lie in its present context before a call to `find_best_match_for_name` and must be destroyed (replacing every letter is a Levenshtein distance of name.len()). The present author claims that this suffices to resolve #42599.
2017-07-23Better detection of repr packed and alignCameron Hart-2/+10
Fixes issue #43317.
2017-07-20Auto merge of #43270 - petrochenkov:fixstab, r=alexcrichtonbors-1/+20
Fix checking for missing stability annotations This was a regression from https://github.com/rust-lang/rust/pull/37676 causing "unmarked API" ICEs like https://github.com/rust-lang/rust/issues/43027. r? @alexcrichton
2017-07-19Auto merge of #42859 - eddyb:const-size-and-align-of, r=nikomatsakisbors-0/+18
Implement const fn {size,align}_of. Fixes #34078. r? @nikomatsakis
2017-07-19Implement const fn {size,align}_of.Eduard-Mihai Burtescu-0/+18
2017-07-19Auto merge of #43168 - pnkfelix:check-attr-gating, r=aturonbors-0/+1291
Slew of builtin-attribute gating tests Slew of builtin-attribute "gating" tests for issue #43106. Some stray observations: * I don't know if its a good thing that so many attributes allow inputs which are silently discarded. (I made heavy use of that in writing my tests, but that was more out of curiosity than necessity.) * The difference between crate-level and non-crate-level behavior is quite significant in some cases. Definitely worth making sure one has tests for both cases. (Not as clear whether it was worthwhile trying the various other AST forms like `fn f()` vs `struct S;`) * `#[no_builtins]` and `#[no_mangle]` occur twice on the `BUILTIN_ATTRIBUTES` list. Thats almost certainly a bug. (Filed as #43148) * We are maximally liberal in what we allow for `#[test]` and `#[bench]` when one compiles without `--test`. * We allow `#[no_mangle]` on arbitrary AST nodes, but only warn about potential misuse on `fn` * We allow `#[cold]`, `#[must_use]`, `#[windows_subsystem]`, and `#[no_builtins]` on arbitrary AST nodes. I don't know off-hand what the semantics are for e.g. a `#[cold] type T = ...;` * We allow crate-level `#![inline]`. That's probably a bug since its otherwise restricted to `fn` items
2017-07-19Fix overflowing_literals lint for large f32sOliver Middleton-2/+2
Float literals need to be parsed as the correct type so they can be rounded correctly.
2017-07-18Make `late_bound_lifetime_arguments` lint warn-by-defaultVadim Petrochenkov-0/+1
2017-07-18Fix incorrect subst indexVadim Petrochenkov-11/+45
Fix treatment of lifetimes defined in nested types during detection of late bound regions in signatures. Do not replace substs with inference variables when "cannot specify lifetime arguments explicitly..." is reported as a lint.
2017-07-18Detect implicitly defined late bound lifetime parameters as wellVadim Petrochenkov-29/+83