summary refs log tree commit diff
path: root/src/test/compile-fail
AgeCommit message (Collapse)AuthorLines
2015-05-11Fallout to compile-fail tests.Felix S. Klock II-1/+13
This change is worrisome to me, both because: 1. I thought the rules in RFC 599 imply that the `Box<Trait>` without `'static` in the first case would expand to the second case, but their behaviors here differ. And, 2. The explicit handling of `'static` should mean `dropck` has no application here and thus we should have seen no change to the expected error messages. Nonetheless, the error messages changed.
2015-05-11Regression tests for Issue 25199 (dropck and `Box<Trait + 'a>`).Felix S. Klock II-0/+214
2015-05-07lint: deny transmuting from immutable to mutable, since it's undefined behaviorSean McArthur-0/+20
[breaking-change] Technically breaking, since code that had been using these transmutes before will no longer compile. However, it was undefined behavior, so really, it's a good thing. Fixing your code would require some re-working to use an UnsafeCell instead. Closes #13146
2015-04-30tests for lint that warns about mixing #[repr(C)] with Drop.Felix S. Klock II-0/+59
THis includes tests for struct and enum. (I suspect the closure case is actually unreachable, but i see no harm in including it.)
2015-04-30regression test for Issue 24895.Felix S. Klock II-0/+38
2015-04-30Fix #20616York Xiang-0/+414
Conflicts: src/libsyntax/parse/parser.rs
2015-04-29Rather than storing the relations between free-regions in a globalNiko Matsakis-1/+81
table, introduce a `FreeRegionMap` data structure. regionck computes the `FreeRegionMap` for each fn and stores the result into the tcx so that borrowck can use it (this could perhaps be refactored to have borrowck recompute the map, but it's a bid tedious to recompute due to the interaction of closures and free fns). The main reason to do this is because of #22779 -- using a global table was incorrect because when validating impl method signatures, we want to use the free region relationships from the *trait*, not the impl. Fixes #22779. ---- This is cherry-pick of commit 6dfeda7 from PR #24553 Manually resolved conflicts in: src/librustc/lib.rs src/librustc/middle/infer/region_inference/mod.rs (both conflicts were related to changes to file structure.)
2015-04-23Augment the constrainted parameter check to ensure that all regionsNiko Matsakis-0/+59
which get mentioned in an associated type are constrained. Arguably we should just require that all regions are constrained, but that is more of a breaking change. Conflicts: src/librustc_typeck/collect.rs
2015-04-23Make stability attributes an error. #22830Brian Anderson-7/+3
Conflicts: src/librustc_data_structures/lib.rs
2015-04-23test: Fix fallout in testsAlex Crichton-152/+78
2015-04-23Fallout from this change.Felix S. Klock II-54/+177
2015-04-23Regression tests for issues that led me to revise typeck.Felix S. Klock II-0/+126
Close #23729 Close #23827 Close #24356
2015-04-22Tests for shadowing between lifetimes and loop labels within function bodies.Felix S. Klock II-3/+275
2015-04-16Auto merge of #24485 - brson:is, r=alexcrichtonbors-2/+16
It was an oversight that this was not done in the great int upheaval. [breaking-change]
2015-04-15Forbid is/us suffixes. Fixes #22496Brian Anderson-2/+16
It was an oversight that this was not done in the great int upheaval. [breaking-change]
2015-04-15Auto merge of #24330 - pnkfelix:issue-24267, r=nikomatsakisbors-0/+29
Extend rustc::middle::dataflow to allow filtering kills from flow-exits. Fix borrowck analysis so that it will not treat a break that pops through an assignment ```rust x = { ... break; ... } ``` as a kill of the "moved-out" bit for `x`. Fix #24267. [breaking-change], but really, its only breaking code that was already buggy.
2015-04-15Regression test.Felix S. Klock II-0/+29
2015-04-14rollup merge of #24399: brson/stabAlex Crichton-0/+18
2015-04-14rollup merge of #24380: arielb1/no-enum-suggestAlex Crichton-0/+29
Fixes #24365
2015-04-14test: Fixup many library unit testsAlex Crichton-6/+0
2015-04-14Reviewer commentsNick Cameron-1/+1
2015-04-14RebasedNick Cameron-2/+4
2015-04-14eddyb's refactoring of coercions/adjustmentsEduard Burtescu-4/+33
2015-04-13Make use of the stability attributes issue a deprecation warning. #22830Brian Anderson-0/+18
2015-04-13Don't try to suggest fields of an enumAriel Ben-Yehuda-0/+29
Fixes #24365
2015-04-12Auto merge of #24072 - ebfull:explain_closure_type_err, r=pnkfelixbors-0/+30
Also fixed bug calling .note() instead of .help() See #24036
2015-04-12Auto merge of #24003 - rprichard:span-fixes, r=huonwbors-0/+123
* In `noop_fold_expr`, call `new_span` in these cases: - `ExprMethodCall`'s identifier - `ExprField`'s identifier - `ExprTupField`'s integer Calling `new_span` for `ExprMethodCall`'s identifier is necessary to print an acceptable diagnostic for `write!(&2, "")`. We see this error: ``` <std macros>:2:20: 2:66 error: type `&mut _` does not implement any method in scope named `write_fmt` <std macros>:2 ( & mut * $ dst ) . write_fmt ( format_args ! ( $ ( $ arg ) * ) ) ) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` With this change, we also see a macro expansion backtrace leading to the `write!(&2, "")` call site. * After fully expanding a macro, we replace the expansion expression's span with the original span. Call `fld.new_span` to add a backtrace to this span. (Note that I'm call `new_span` after `bt.pop()`, so the macro just expanded isn't on the backtrace.) The motivating example for this change is `println!("{}")`. The format string literal is `concat!($fmt, "arg")` and is inside the libstd macro. We need to see the backtrace to find the `println!` call site. * Add a backtrace to the `format_args!` format expression span. r? alexcrichton Addresses #23459
2015-04-12Auto merge of #23011 - nagisa:the-war-of-symbol-and-symbol, r=pnkfelixbors-0/+151
We provide tools to tell what exact symbols to emit for any fn or static, but don’t quite check if that won’t cause any issues later on. Some of the issues include LLVM mangling our names again and our names pointing to wrong locations, us generating dumb foreign call wrappers, linker errors, extern functions resolving to different symbols altogether (`extern {fn fail();} fail();` in some cases calling `fail1()`), etc. Before the commit we had a function called `note_unique_llvm_symbol`, so it is clear somebody was aware of the issue at some point, but the function was barely used, mostly in irrelevant locations. Along with working on it I took liberty to start refactoring trans/base into a few smaller modules. The refactoring is incomplete and I hope I will find some motivation to carry on with it. This is possibly a [breaking-change] because it makes dumbly written code properly invalid. This fixes all those issues about incorrect use of #[no_mangle] being not reported/misreported/ICEd by the compiler. NB. This PR does not attempt to tackle the parallel codegen issue that was mentioned in https://github.com/rust-lang/rust/pull/22811, but I believe it should be very straightforward in a follow up PR by modifying `trans::declare::get_defined_value` to look at all the contexts. cc @alexcrichton @huonw @nrc because you commented on the original RFC issue. EDIT: wow, this became much bigger than I initially intended.
2015-04-11Add compile-file/macro-backtrace-{invalid-internals,nested,println} testsRyan Prichard-0/+115
2015-04-11Expand internal-unstable to handle named field accesses and method calls.Ryan Prichard-0/+8
2015-04-11Rollup merge of #24259 - lstat:needstest, r=alexcrichtonManish Goregaokar-0/+70
Closes #20772 Closes #20939 Closes #21950 Closes #22034
2015-04-11Rollup merge of #24245 - nikomatsakis:issue-24241-coherence-failure, r=pnkfelixManish Goregaokar-0/+28
Don't use skolemized parameters but rather fresh variables in coherence. Skolemized parameters wind up preventing unification. Surprised we had no test for this! Fixes #24241. r? @pnkfelix
2015-04-11Rollup merge of #24242 - nikomatsakis:escaping-closure-error-message, r=brsonManish Goregaokar-4/+54
Example showing sample inputs, old message, new message: https://gist.github.com/nikomatsakis/11126784ac678b7eb6ba Also adds infrastructure for reporting suggestions \"in situ\" and does some (minor) cleanups to `CodeMap`. r? @brson
2015-04-11Auto merge of #24155 - chris-chambers:stmt_macros, r=sfacklerbors-1/+2
Statement macros are now treated somewhat like item macros, in that a statement macro can now expand into a series of statements, rather than just a single statement. This allows statement macros to be nested inside other kinds of macros and expand properly, where previously the expansion would only work when no nesting was present. See: - `src/test/run-pass/macro-stmt_macro_in_expr_macro.rs` - `src/test/run-pass/macro-nested_stmt_macro.rs` This changes the interface of the MacResult trait. make_stmt has become make_stmts and now returns a vector, rather than a single item. Plugin writers who were implementing MacResult will have breakage, as well as anyone using MacEager::stmt. See: - `src/libsyntax/ext/base.rs` This also causes a minor difference in behavior to the diagnostics produced by certain malformed macros. See: - `src/test/compile-fail/macro-incomplete-parse.rs`
2015-04-10Improve error message where a closure escapes fn while trying to borrowNiko Matsakis-4/+54
from the current fn. Employ the new `span_suggestion` to show how you can use `move`.
2015-04-10Add tests for E-needstest issuesLuke Gallagher-0/+70
Closes #20772 Closes #20939 Closes #21950 Closes #22034
2015-04-09Don't use skolemized parameters but rather fresh variables inNiko Matsakis-0/+28
coherence. Skolemized parameters wind up preventing unification. Surprised we had no test for this! Fixes #24241.
2015-04-10Rollup merge of #24218 - lstat:remove-ignore-tidy, r=alexcrichtonManish Goregaokar-16/+0
This is a really minor issue. I noticed some tests no longer need the ignore tidy comment directive. A quick grep turned up the following files: src/test/compile-fail/bad-mid-path-type-params.rs src/test/compile-fail/bad-sized.rs src/test/compile-fail/coherence-default-trait-impl.rs src/test/compile-fail/coherence-orphan.rs src/test/compile-fail/issue-8767.rs src/test/compile-fail/lint-stability.rs src/test/compile-fail/lint-uppercase-variables.rs src/test/compile-fail/typeck-default-trait-impl-outside-crate.rs src/test/compile-fail/use-after-move-implicity-coerced-object.rs src/test/debuginfo/gdb-pretty-std.rs It didn't seem like it was worth opening an issue for this, but if that is not the case (i.e. it is required), I'll open one up. Thanks!
2015-04-10Rollup merge of #24193 - lstat:needstest, r=alexcrichtonManish Goregaokar-0/+49
Closes #22289 Closes #22370 Closes #22384
2015-04-10Rollup merge of #24191 - nikomatsakis:issue-20791, r=pnkfelixManish Goregaokar-0/+40
Modify the ExprUseVisitor to walk each part of an AutoRef, and in particular to treat an AutoUnsize as as kind of \"instantaneous\" borrow of the value being unsized. This prevents us from feeding uninitialized data. This caused a problem for the eager reborrow of comparison traits, because that wound up introducing a \"double AutoRef\", which was not being thoroughly checked before but turned out not to type check. Fortunately, we can just remove that \"eager reborrow\" as it is no longer needed now that `PartialEq` doesn't force both LHS and RHS to have the same type (and even if we did have this problem, the better way would be to lean on introducing a common supertype). Fixes #20791. r? @nrc
2015-04-09Auto merge of #24158 - sanxiyn:cast, r=nrcbors-2/+22
Fix #13993. Fix #17167.
2015-04-09Remove `ignore-tidy-linelength` from tests that no longer need itLuke Gallagher-16/+0
2015-04-08Modify the ExprUseVisitor to walk each part of an AutoRef, and inNiko Matsakis-0/+40
particular to treat an AutoUnsize as as kind of "instantaneous" borrow of the value being unsized. This prevents us from feeding uninitialized data. This caused a problem for the eager reborrow of comparison traits, because that wound up introducing a "double AutoRef", which was not being thoroughly checked before but turned out not to type check. Fortunately, we can just remove that "eager reborrow" as it is no longer needed now that `PartialEq` doesn't force both LHS and RHS to have the same type (and even if we did have this problem, the better way would be to lean on introducing a common supertype).
2015-04-08Add tests for #22289, #22370 and #22384Luke Gallagher-0/+49
Closes #22289 Closes #22370 Closes #22384
2015-04-08Auto merge of #24021 - pnkfelix:fn-params-outlive-body, r=nikomatsakisbors-0/+36
Encode more precise scoping rules for function params Function params outlive everything in the body (incl temporaries). Thus if we assign them their own `CodeExtent`, the region inference can properly show that it is sound to have temporaries with destructors that reference the parameters (because such temporaries will be dropped before the parameters are dropped). Fix #23338
2015-04-08Auto merge of #23998 - nrc:impl-self, r=nikomatsakisbors-4/+44
Closes #23909 r? @nikomatsakis (or anyone else, really)
2015-04-08Auto merge of #24120 - aturon:range-perf, r=alexcrichtonbors-0/+1
A recent change to the implementation of range iterators meant that, even when stepping by 1, the iterators *always* involved checked arithmetic. This commit reverts to the earlier behavior (while retaining the refactoring into traits). Fixes #24095 Closes #24119 cc #24014 r? @alexcrichton
2015-04-08Address review commentsSeo Sanghyeon-1/+6
2015-04-08Auto merge of #24078 - whipsch:extra-token-msg, r=huonwbors-3/+3
Addresses issue #22425. See `src/test/compile-fail/macro-incomplete-parse.rs` for a relevant test: macro-incomplete-parse.rs:15:9: 15:10 error: macro expansion ignores token `,` and any following macro-incomplete-parse.rs:15 , //~ ERROR macro expansion ignores token `,` ^ macro-incomplete-parse.rs:27:1: 27:17 note: caused by the macro expansion here; the usage of `ignored_item` is likely invalid in this context macro-incomplete-parse.rs:27 ignored_item!(); ^~~~~~~~~~~~~~~~ macro-incomplete-parse.rs:20:14: 20:15 error: macro expansion ignores token `,` and any following macro-incomplete-parse.rs:20 () => ( 1, 2 ) //~ ERROR macro expansion ignores token `,` ^ macro-incomplete-parse.rs:30:5: 30:21 note: caused by the macro expansion here; the usage of `ignored_expr` is likely invalid in this context macro-incomplete-parse.rs:30 ignored_expr!(); ^~~~~~~~~~~~~~~~ macro-incomplete-parse.rs:24:14: 24:15 error: macro expansion ignores token `,` and any following macro-incomplete-parse.rs:24 () => ( 1, 2 ) //~ ERROR macro expansion ignores token `,` ^ macro-incomplete-parse.rs:32:9: 32:23 note: caused by the macro expansion here; the usage of `ignored_pat` is likely invalid in this context macro-incomplete-parse.rs:32 ignored_pat!() => (), ^~~~~~~~~~~~~~ This does not address the case of improper expansion inside of an impl { } as seen in issue #21607. I'm not sure if the note text is ideal, but it can be refined if needed.
2015-04-07Fix range performance regressionAaron Turon-0/+1
A recent change to the implementation of range iterators meant that, even when stepping by 1, the iterators *always* involved checked arithmetic. This commit reverts to the earlier behavior (while retaining the refactoring into traits). Fixes #24095 cc #24014