about summary refs log tree commit diff
path: root/src/test/compile-fail
AgeCommit message (Collapse)AuthorLines
2017-08-27Move unused-extern-crate to late passTatsuyuki Ishi-4/+15
2017-08-26Rollup merge of #43776 - zackmdavis:feature_gate_fn_must_use, r=alexcrichtonCorey Farwell-0/+32
feature-gate #[must_use] for functions as `fn_must_use` @eddyb I [was](https://github.com/rust-lang/rust/pull/43728#issuecomment-320854120) [dithering](https://github.com/rust-lang/rust/pull/43728#issuecomment-320856407) on this, but [your comment](https://github.com/rust-lang/rust/issues/43302#issuecomment-321174989) makes it sound like we do want a feature gate for this? Please advise. r? @eddyb
2017-08-25Merge remote-tracking branch 'origin/master' into genAlex Crichton-8/+114
2017-08-25Auto merge of #43786 - scalexm:issue-43784, r=nikomatsakisbors-0/+43
Elaborate trait obligations when typechecking impls When typechecking trait impl declarations, we only checked that bounds explictly written on the trait declaration hold. We now also check that bounds which would have been implied by the trait reference do hold. Fixes #43784.
2017-08-24Auto merge of #43532 - petrochenkov:pgargs, r=nikomatsakisbors-2/+27
Desugar parenthesized generic arguments in HIR Fixes ICE in https://github.com/rust-lang/rust/issues/43431 and maybe some other similar issues. r? @eddyb
2017-08-22fn_must_use soft feature-gate warning on methods too, not only functionsZack M. Davis-0/+7
This continues to be in the matter of #43302.
2017-08-22"soft" (warn instead of error) feature-gate for #[must_use] on functionsZack M. Davis-3/+13
Before `#[must_use]` for functions was implemented, a `#[must_use]` attribute on a function was a no-op. To avoid a breaking change in this behavior, we add an option for "this-and-such feature is experimental" feature-gate messages to be a mere warning rather than a compilation-halting failure (so old code that used to have a useless no-op `#[must_use]` attribute now warns rather than breaking). When we're on stable, we add a help note to clarify that the feature isn't "on." This is in support of #43302.
2017-08-22hard feature-gate for #[must_use] on functionsZack M. Davis-0/+15
We'll actually want a new "soft" warning-only gate to maintain backwards-compatibility, but it's cleaner to start out with the established, well-understood gate before implementing the alternative warn-only behavior in a later commit. This is in the matter of #43302.
2017-08-22Ensure that generic arguments don't end up in attribute paths.Jeffrey Seyfried-0/+22
2017-08-22Auto merge of #44033 - GuillaumeGomez:rollup, r=GuillaumeGomezbors-6/+6
Rollup of 5 pull requests - Successful merges: #43993, #44001, #44010, #44014, #44029 - Failed merges:
2017-08-22Rollup merge of #43993 - tamird:better-wording-error, r=arielb1Guillaume Gomez-6/+6
borrowck: name the correct type in error message Closes #36407. r? @Mark-Simulacrum
2017-08-22Auto merge of #44008 - RalfJung:staged1, r=alexcrichtonbors-0/+16
Make sure crates not opting in to staged_api don't use staged_api This also fixes the problem that with `-Zforce-unstable-if-unmarked` set, crates could not use `#[deprecated]`. If you prefer, I can instead submit another version which just fixes this problem, but still allows the staged API attributes for all crates when `-Zforce-unstable-if-unmarked` is set. I have prepared that at <https://github.com/RalfJung/rust/tree/staged2>. As yet another alternative, @alexcrichton suggested to turn this error into a lint, but that seems to be much more work, so is it worth it? Cc @alexcrichton #43975
2017-08-21Merge remote-tracking branch 'origin/master' into genAlex Crichton-13/+51
2017-08-21Auto merge of #43540 - petrochenkov:pathrelax, r=nikomatsakisbors-13/+51
syntax: Relax path grammar TLDR: Accept the disambiguator `::` in "type" paths (`Type::<Args>`), accept the disambiguator `::` before parenthesized generic arguments (`Fn::(Args)`). The "turbofish" disambiguator `::<>` in expression paths is a necessary evil required for path parsing to be both simple and to give reasonable results. Since paths in expressions usually refer to values (but not necessarily, e.g. `Struct::<u8> { field: 0 }` is disambiguated, but refers to a type), people often consider `::<>` to be inherent to *values*, and not *expressions* and want to write disambiguated paths for values even in contexts where disambiguation is not strictly necessary, for example when a path is passed to a macro `m!(Vec::<i32>::new)`. The problem is that currently, if the disambiguator is not *required*, then it's *prohibited*. This results in confusion - see https://github.com/rust-lang/rust/issues/41740, https://internals.rust-lang.org/t/macro-path-uses-novel-syntax/5561. This PR makes the disambiguator *optional* instead of prohibited in contexts where it's not strictly required, so people can pass paths to macros in whatever form they consider natural (e.g. disambiguated form for value paths). This PR also accepts the disambiguator in paths with parenthesized arguments (`Fn::(Args)`) for consistency and to simplify testing of stuff like https://github.com/rust-lang/rust/pull/41856#issuecomment-301219194. Closes https://github.com/rust-lang/rust/issues/41740 cc @rust-lang/lang r? @nikomatsakis
2017-08-20borrowck: name the correct type in error messageTamir Duberstein-6/+6
Closes #36407.
2017-08-20Test staging attributes when -Zforce-unstable-if-unmarked is setRalf Jung-0/+16
Both new tests currently fail
2017-08-19Desugar parenthesized generic arguments in HIRVadim Petrochenkov-2/+27
2017-08-17Merge remote-tracking branch 'origin/master' into genAlex Crichton-30/+36
2017-08-16Stabilize rvalue promotion to 'static.Eduard-Mihai Burtescu-30/+36
2017-08-16Merge remote-tracking branch 'origin/master' into genAlex Crichton-0/+16
2017-08-16Auto merge of #43651 - petrochenkov:foreign-life, r=eddybbors-0/+16
Fix ICE with elided lifetimes in return type of foreign functions cc https://github.com/rust-lang/rust/issues/43567 This is for a preliminary crater/cargobomb run. Lifetime elision in foreign functions now works exactly like in other functions or function-like entities. If the breakage is significant, I'll have to partially revert https://github.com/rust-lang/rust/pull/43543 (all the stuff that was required for dealing with late bound lifetimes in this position). r? @eddyb
2017-08-14Merge remote-tracking branch 'origin/master' into genAlex Crichton-0/+205
2017-08-13ast_validation: forbid "nonstandard" literal patternsAriel Ben-Yehuda-0/+23
Since #42886, macros can create "nonstandard" PatKind::Lit patterns, that contain path expressions instead of the usual literal expr. These can cause trouble, including ICEs. We *could* map these nonstandard patterns to PatKind::Path patterns during HIR lowering, but that would be much effort for little gain, and I think is too risky for beta. So let's just forbid them during AST validation. Fixes #43250.
2017-08-13Auto merge of #43348 - kennytm:fix-24658-doc-every-platform, r=alexcrichtonbors-0/+12
Expose all OS-specific modules in libstd doc. 1. Uses the special `--cfg dox` configuration passed by rustbuild when running `rustdoc`. Changes the `#[cfg(platform)]` into `#[cfg(any(dox, platform))]` so that platform-specific API are visible to rustdoc. 2. Since platform-specific implementations often won't compile correctly on other platforms, `rustdoc` is changed to apply `everybody_loops` to the functions during documentation and doc-test harness. 3. Since platform-specific code are documented on all platforms now, it could confuse users who found a useful API but is non-portable. Also, their examples will be doc-tested, so must be excluded when not testing on the native platform. An undocumented attribute `#[doc(cfg(...))]` is introduced to serve the above purposed. Fixes #24658 (Does _not_ fully implement #1998).
2017-08-12Check #[thread_local] statics correctly in the compiler.Eduard-Mihai Burtescu-0/+143
2017-08-12syntax: #[allow_internal_unsafe] bypasses the unsafe_code lint in macros.Eduard-Mihai Burtescu-0/+27
2017-08-11Merge remote-tracking branch 'origin/master' into genAlex Crichton-0/+17
2017-08-11Auto merge of #43745 - kennytm:fix-43162, r=aturonbors-0/+17
Type-check `break value;` even outside of `loop {}`. Fix #43162, fix #43727.
2017-08-11Issue warnings for unnecessary path disambiguatorsVadim Petrochenkov-2/+13
2017-08-11syntax: Relax path grammarVadim Petrochenkov-12/+39
2017-08-10Merge remote-tracking branch 'origin/master' into genAlex Crichton-149/+214
2017-08-10Add testsscalexm-0/+43
2017-08-10Auto merge of #43522 - alexcrichton:rewrite-lints, r=michaelwoeristerbors-142/+175
rustc: Rearchitect lints to be emitted more eagerly In preparation for incremental compilation this commit refactors the lint handling infrastructure in the compiler to be more "eager" and overall more incremental-friendly. Many passes of the compiler can emit lints at various points but before this commit all lints were buffered in a table to be emitted at the very end of compilation. This commit changes these lints to be emitted immediately during compilation using pre-calculated lint level-related data structures. Linting today is split into two phases, one set of "early" lints run on the `syntax::ast` and a "late" set of lints run on the HIR. This commit moves the "early" lints to running as late as possible in compilation, just before HIR lowering. This notably means that we're catching resolve-related lints just before HIR lowering. The early linting remains a pass very similar to how it was before, maintaining context of the current lint level as it walks the tree. Post-HIR, however, linting is structured as a method on the `TyCtxt` which transitively executes a query to calculate lint levels. Each request to lint on a `TyCtxt` will query the entire crate's 'lint level data structure' and then go from there about whether the lint should be emitted or not. The query depends on the entire HIR crate but should be very quick to calculate (just a quick walk of the HIR) and the red-green system should notice that the lint level data structure rarely changes, and should hopefully preserve incrementality. Overall this resulted in a pretty big change to the test suite now that lints are emitted much earlier in compilation (on-demand vs only at the end). This in turn necessitated the addition of many `#![allow(warnings)]` directives throughout the compile-fail test suite and a number of updates to the UI test suite. Closes https://github.com/rust-lang/rust/issues/42511
2017-08-10Auto merge of #43582 - ivanbakel:unused_mut_ref, r=arielb1bors-0/+20
Fixed mutable vars being marked used when they weren't #### NB : bootstrapping is slow on my machine, even with `keep-stage` - fixes for occurances in the current codebase are <s>in the pipeline</s> done. This PR is being put up for review of the fix of the issue. Fixes #43526, Fixes #30280, Fixes #25049 ### Issue Whenever the compiler detected a mutable deref being used mutably, it marked an associated value as being used mutably as well. In the case of derefencing local variables which were mutable references, this incorrectly marked the reference itself being used mutably, instead of its contents - with the consequence of making the following code emit no warnings ``` fn do_thing<T>(mut arg : &mut T) { ... // don't touch arg - just deref it to access the T } ``` ### Fix Make dereferences not be counted as a mutable use, but only when they're on borrows on local variables. #### Why not on things other than local variables? * Whenever you capture a variable in a closure, it gets turned into a hidden reference - when you use it in the closure, it gets dereferenced. If the closure uses the variable mutably, that is actually a mutable use of the thing being dereffed to, so it has to be counted. * If you deref a mutable `Box` to access the contents mutably, you are using the `Box` mutably - so it has to be counted.
2017-08-10Implemented #[doc(cfg(...))].kennytm-0/+12
This attribute has two effects: 1. Items with this attribute and their children will have the "This is supported on **** only" message attached in the documentation. 2. The items' doc tests will be skipped if the configuration does not match.
2017-08-10Auto merge of #43735 - est31:master, r=alexcrichtonbors-0/+14
Avoid calling the column!() macro in panic Closes #43057 This "fix" adds a new macro called `__rust_unstable_column` and to use it instead of the `column` macro inside panic. The new macro can be shadowed as well as `column` can, but its very likely that there is no code that does this in practice. There is no real way to make "unstable" macros that are usable by stable macros, so we do the next best thing and prefix the macro with `__rust_unstable` to make sure people recognize it is unstable. r? @alexcrichton
2017-08-10Add a feature gateest31-0/+14
@alexcrichton figured out a way how to do it :)
2017-08-09Initial pass review commentsAlex Crichton-120/+0
2017-08-09Auto merge of #43484 - estebank:point-to-return, r=arielb1bors-7/+5
Point at return type always when type mismatch against it 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-08-09Merge remote-tracking branch 'origin/master' into genAlex Crichton-119/+182
2017-08-09rustc: Rearchitect lints to be emitted more eagerlyAlex Crichton-142/+175
In preparation for incremental compilation this commit refactors the lint handling infrastructure in the compiler to be more "eager" and overall more incremental-friendly. Many passes of the compiler can emit lints at various points but before this commit all lints were buffered in a table to be emitted at the very end of compilation. This commit changes these lints to be emitted immediately during compilation using pre-calculated lint level-related data structures. Linting today is split into two phases, one set of "early" lints run on the `syntax::ast` and a "late" set of lints run on the HIR. This commit moves the "early" lints to running as late as possible in compilation, just before HIR lowering. This notably means that we're catching resolve-related lints just before HIR lowering. The early linting remains a pass very similar to how it was before, maintaining context of the current lint level as it walks the tree. Post-HIR, however, linting is structured as a method on the `TyCtxt` which transitively executes a query to calculate lint levels. Each request to lint on a `TyCtxt` will query the entire crate's 'lint level data structure' and then go from there about whether the lint should be emitted or not. The query depends on the entire HIR crate but should be very quick to calculate (just a quick walk of the HIR) and the red-green system should notice that the lint level data structure rarely changes, and should hopefully preserve incrementality. Overall this resulted in a pretty big change to the test suite now that lints are emitted much earlier in compilation (on-demand vs only at the end). This in turn necessitated the addition of many `#![allow(warnings)]` directives throughout the compile-fail test suite and a number of updates to the UI test suite.
2017-08-09Type-check `break value;` even outside of `loop {}`.kennytm-0/+17
Fix #43162, fix #43727.
2017-08-06Add missing error code for private methodGuillaume Gomez-0/+22
2017-08-06Added closure test case.Isaac van Bakel-0/+6
2017-08-05Use usual lifetime elision rules for foreign functionsVadim Petrochenkov-0/+16
2017-08-04Auto merge of #43442 - ↵bors-4/+11
zackmdavis:note_available_field_names_if_levenshtein_fails, r=nikomatsakis field does not exist error: note fields if Levenshtein suggestion fails 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 within a Levenshtein distance of name.len()). The present author claims that this suffices to resolve #42599.
2017-08-04Auto merge of #43634 - dhduvall:solaris-test-fixes, r=sanxiynbors-0/+6
Fix a number of failing tests on Solaris and SPARC
2017-08-03Recognize SPARC in more tests where architecture matters.Danek Duvall-0/+6
2017-08-03Auto merge of #43609 - dsprenkels:issue-40510, r=Mark-Simulacrumbors-0/+96
Add regression test for #40510 This pull request adds a test case for issue #40510. Fixes #40510.
2017-08-03Add more regression tests for #40510Daan Sprenkels-0/+73