summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
2017-07-13Stabilize Command::envsSteven Fackler-2/+0
Closes #38526
2017-06-22Make the `next` variable mutable to allow for ref mut in for patterns.John Kåre Alsaker-0/+15
2017-06-22remove trailing whitespaceNiko Matsakis-1/+1
2017-06-22Create for-loop-unconstrained-element-type-i32-fallback.rsNiko Matsakis-0/+4
2017-06-22document purpose of testNiko Matsakis-0/+5
2017-06-22explain purpose of testNiko Matsakis-0/+6
2017-06-22Added more testsJohn Kåre Alsaker-1/+30
2017-06-22Fix test formattingJohn Kåre Alsaker-4/+14
2017-06-22Fix formatting and add a test for destruction order of unbound valuesJohn Kåre Alsaker-0/+28
2017-06-22register the obligations from `wf::implied_bounds`Niko Matsakis-0/+40
Fixes #42552. Fixes #42545.
2017-06-22collector: apply param substs to closures cast to fn itemsAriel Ben-Yehuda-0/+7
Fixes #42718.
2017-06-12rustc_typeck: do not overlap a borrow of TypeckTables with method lookup.Eduard-Mihai Burtescu-0/+41
2017-06-12rustc: T: 'empty always holds forall T.Eduard-Mihai Burtescu-0/+32
2017-06-05Auto merge of #42383 - estebank:candidate-newline, r=arielb1bors-140/+398
Use multiline note for trait suggestion
2017-06-04Auto merge of #42362 - estebank:type, r=arielb1bors-0/+65
Show trait method signature when impl differs When the trait's span is available, it is already being used, add a `note` for the cases where the span isn't available: <pre> error[E0053]: <b>method `fmt` has an incompatible type for trait</b> --> $DIR/trait_type.rs:17:4 | 17 | fn fmt(&self, x: &str) -> () { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ in mutability | = note: expected type `<b>fn(&MyType, &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error></b>` found type `<b>fn(&MyType, &str)</b>` error[E0050]: <b>method `fmt` has 1 parameter but the declaration in trait `std::fmt::Display::fmt` has 2</b> --> $DIR/trait_type.rs:21:11 | 21 | fn fmt(&self) -> () { } | ^^^^^ expected 2 parameters, found 1 | = note: `fmt` from trait: `<b>fn(&Self, &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error></b>` error[E0186]: <b>method `fmt` has a `&self` declaration in the trait, but not in the impl</b> --> $DIR/trait_type.rs:25:4 | 25 | fn fmt() -> () { } | ^^^^^^^^^^^^^^^^^^ expected `&self` in impl | = note: `fmt` from trait: `<b>fn(&Self, &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error></b>` error[E0046]: <b>not all trait items implemented, missing: `fmt`</b> --> $DIR/trait_type.rs:28:1 | 28 | impl std::fmt::Display for MyType4 {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `fmt` in implementation | = note: `fmt` from trait: `<b>fn(&Self, &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error></b>` </code></pre> Fix #28011.
2017-06-04Separate suggestion in a `help` and a `note`Esteban Küber-22/+45
2017-06-04Show trait method signature when impl differsEsteban Küber-0/+65
When the trait's span is available, it is already being used, add a `note` for the cases where the span isn't available: ``` error[E0053]: method `fmt` has an incompatible type for trait --> $DIR/trait_type.rs:17:4 | 17 | fn fmt(&self, x: &str) -> () { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ in mutability | = note: expected type `fn(&MyType, &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error>` found type `fn(&MyType, &str)` error[E0050]: method `fmt` has 1 parameter but the declaration in trait `std::fmt::Display::fmt` has 2 --> $DIR/trait_type.rs:21:11 | 21 | fn fmt(&self) -> () { } | ^^^^^ expected 2 parameters, found 1 | = note: `fmt` from trait: `fn(&Self, &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error>` error[E0186]: method `fmt` has a `&self` declaration in the trait, but not in the impl --> $DIR/trait_type.rs:25:4 | 25 | fn fmt() -> () { } | ^^^^^^^^^^^^^^^^^^ expected `&self` in impl | = note: `fmt` from trait: `fn(&Self, &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error>` error[E0046]: not all trait items implemented, missing: `fmt` --> $DIR/trait_type.rs:28:1 | 28 | impl std::fmt::Display for MyType4 {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `fmt` in implementation | = note: `fmt` from trait: `fn(&Self, &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error>` ```
2017-06-04Auto merge of #42265 - Zoxc:for-sugar, r=eddybbors-1/+39
Change for-loop desugar to not borrow the iterator during the loop This is enables the use of suspend points inside for-loops in movable generators. This is illegal in the current desugaring as `iter` is borrowed across the body.
2017-06-04Auto merge of #41968 - kennytm:fix-unreadable-json-test-output-36516, ↵bors-3/+195
r=nikomatsakis Introduce 'run-pass' header to 'ui' tests in compiletest. Fix issue #36516. <del>`ui-run` test is a combination of `ui` test and `run-pass` test. It is used to test lint output.</del> Added support of `// run-pass` header to `ui` tests. The compiler message of each test must match the corresponding `*.stderr` file like the traditional `ui` tests. Additionally, the compiled output must be executed successfully like the `run-pass` test. 12 `run-pass`/`run-pass-fulldeps` tests are moved to `ui`/`ui-fulldeps` plus the headers. After this move, no `run-pass`/`run-pass-fulldeps` tests should rely on the compiler's JSON message. This allows us to stop passing `--error-format json` in run-pass tests, thus fixing #36516.
2017-06-03Auto merge of #42391 - photoszzt:master, r=Manishearthbors-15/+18
Better suggestion for unknown method r? @Manishearth fixes #42386
2017-06-03Auto merge of #42387 - GuillaumeGomez:error-codes-next, r=Susurrusbors-5/+22
Add E0603 error code Part of #42229. cc @Susurrus
2017-06-03Auto merge of #42334 - est31:master, r=jseyfriedbors-14/+52
Extend the unused macro lint to macros 2.0 Extends the unused macro lint (added in PR #41907) to macros 2.0 (added in PR #40847). r? @jseyfried
2017-06-03Auto merge of #42396 - venkatagiri:remove_lifetime_extn, r=arielb1bors-3/+1
rustc: remove temporary lifetime extension by borrow hint closes #39283. Thanks to @nikomatsakis for mentoring on this one. r? @arielb1
2017-06-03Rollup merge of #42368 - estebank:call-site, r=nikomatsakisCorey Farwell-0/+19
Use callsite's span for macro calls on suggestion When suggesting an appropriate mutability for a macro call, use the call span instead of the expanded macro's span. ``` error[E0308]: mismatched types --> $DIR/coerce-suggestions.rs:48:9 | 48 | s = format!("foo"); | ^^^^^^^^^^^^^^ expected mutable reference, found struct `std::string::String` | = note: expected type `&mut std::string::String` found type `std::string::String` = help: try with `&mut format!("foo")` = note: this error originates in a macro outside of the current crate ``` Fix #41858.
2017-06-02Better suggestion for unknown methodzzhu-15/+18
Fixes #42386
2017-06-02rustc: remove temporary lifetime extension by borrow hintVenkata Giri Reddy-3/+1
2017-06-02Auto merge of #42381 - Mark-Simulacrum:rollup, r=Mark-Simulacrumbors-1/+1
Rollup of 10 pull requests - Successful merges: #41981, #42225, #42310, #42319, #42335, #42343, #42355, #42360, #42370, #42372 - Failed merges:
2017-06-02Add E0603 error codeGuillaume Gomez-5/+22
2017-06-02Auto merge of #42189 - nikomatsakis:chalk-trait-env-param-env, r=eddybbors-0/+9
querify layout and move param env out of the infcx The main goal of this PR is to move the parameter environment *out* of the inference context. This is because the inference environment will soon be changing over the course of inference --- for example, when we enter into a `for<'a> fn(...)` type, we will push a new environment with an increasing universe index, rather than skolemizing the `'a` references. Similarly, each obligation will soon be able to have a distinct parameter environment, and therefore the `Obligation` struct is extended to carry a `ParamEnv<'tcx>`. (I debated about putting it into the cause; seems plausible, but also weird.) Along the way, I also reworked how layout works, moving the layout cache into a proper query along the lines of needs-drop and friends. Finally, tweaks the inference context API. It seemed to be accumulating parameters at an alarming rate. The main way to e.g. make a subtype or equality relationship is to do the following: infcx.at(cause, param_env).sub(a, b) infcx.at(cause, param_env).eq(a, b) In both cases, `a` is considered the "expected" type (this used to be specified by a boolean). I tried hard to preserve the existing notion of what was "expected", although in some cases I'm not convinced it was being set on purpose one way or the other. This is why in some cases you will see me do `sup(b, a)`, which is otherwise equivalent to `sub(a, b)`, but sets the "expected type" differently. r? @eddyb cc @arielb1
2017-06-02Use multiline note for trait suggestionEsteban Küber-138/+373
2017-06-02compiletest: Force directive to be first complete word in header comment.kennytm-2/+3
Refactored some related code to take advantage of this change.
2017-06-02Introduce 'run-pass' header to 'ui' tests in compiletest. Fix issue #36516.kennytm-1/+192
The 'run-pass' header cause a 'ui' test to execute the result. It is used to test the lint output, at the same time ensure those lints won't cause the source code to become compile-fail. 12 run-pass/run-pass-fulldeps tests gained the header and are moved to ui/ui-fulldeps. After this move, no run-pass/run-pass-fulldeps tests should rely on the compiler's JSON message. This allows us to stop passing `--error-format json` in run-pass tests, thus fixing #36516.
2017-06-02Rollup merge of #42319 - Manishearth:const-extern, r=nikomatsakisMark Simulacrum-1/+1
Improve error message for const extern fn It's currently ``error: unmatched visibility `pub` ``, which is a nonsensical error in this context.
2017-06-02Auto merge of #41418 - hirschenberger:prefetch-intrinsic, r=nagisabors-0/+75
Adding support for the llvm `prefetch` intrinsic Optimize `slice::binary_search` by using prefetching.
2017-06-01fix ui referenceNiko Matsakis-1/+1
2017-06-01remove `layout_cache` and fix `-Z print-type-sizes`Niko Matsakis-0/+9
now we grow the type-sizes info during execution, rather than walking the cache after the fact
2017-06-01Change for-loop desugar to not borrow the iterator during the loopJohn Kåre Alsaker-1/+39
2017-06-01Auto merge of #42281 - eddyb:well-adjusted, r=nikomatsakisbors-24/+19
Decompose Adjustment into smaller steps and remove the method map. The method map held method callee information for: * actual method calls (`x.f(...)`) * overloaded unary, binary, indexing and call operators * *every overloaded deref adjustment* (many can exist for each expression) That last one was a historical ~~accident~~ hack, and part of the motivation for this PR, along with: * a desire to compose adjustments more freely * containing the autoderef logic better to avoid mutation within an inference snapshot * not creating `TyFnDef` types which are incompatible with the original one * i.e. we used to take a`TyFnDef`'s `for<'a> &'a T -> &'a U` signature and instantiate `'a` using a region inference variable, *then* package the resulting `&'b T -> &'b U` signature in another `TyFnDef`, while keeping *the same* `DefId` and `Substs` * to fix #3548 by explicitly writing autorefs for the RHS of comparison operators Individual commits tell their own story, of "atomic" changes avoiding breaking semantics. Future work based on this PR could include: * removing the signature from `TyFnDef`, now that it's always "canonical" * some questions of variance remain, as subtyping *still* treats the signature differently * moving part of the typeck logic for methods, autoderef and coercion into `rustc::traits` * allowing LUB coercions (joining multiple expressions) to "stack up" many adjustments * transitive coercions (e.g. reify or unsize after multiple steps of autoderef) r? @nikomatsakis
2017-05-31Use callsite's span for macro calls on suggestionEsteban Küber-0/+19
When suggesting an appropriate mutability for a macro call, use the call span instead of the expanded macro's span.
2017-06-01Adding support for the llvm `prefetch` intrinsicFalco Hirschenberger-0/+75
Related to #37251
2017-06-01tests: fix fallout from changing the span of binop errors.Eduard-Mihai Burtescu-24/+19
2017-06-01Rollup merge of #42324 - seanmonstar:41323-compare_const_impl, r=nikomatsakisCorey Farwell-0/+57
associated_consts: check trait obligations and regionck for associated consts Closes #41323 r? @nikomatsakis
2017-06-01Rollup merge of #42302 - GuillaumeGomez:new-error-codes-next, r=SusurrusCorey Farwell-7/+7
New error codes next Part #42229. To be merged after #42264. cc @Susurrus
2017-06-01Rollup merge of #42286 - ollie27:rustdoc_assoc_const, r=GuillaumeGomezCorey Farwell-0/+18
rustdoc: Cleanup associated const value rendering Rather than (ab)using Debug for outputting the type in plain text use the alternate format parameter which already does exactly that. This fixes type parameters for example which would output raw HTML. Also cleans up adding parens around references to trait objects.
2017-06-01Rollup merge of #42275 - scottmcm:try-trait, r=nikomatsakisCorey Farwell-10/+8
Lower `?` to `Try` instead of `Carrier` The easy parts of https://github.com/rust-lang/rfcs/pull/1859, whose FCP completed without further comments. Just the trait and the lowering -- neither the error message improvements nor the insta-stable impl for Option nor exhaustive docs. Based on a [github search](https://github.com/search?l=rust&p=1&q=question_mark_carrier&type=Code&utf8=%E2%9C%93), this will break the following: - https://github.com/pfpacket/rust-9p/blob/00206e34c680198a0ac7c2f066cc2954187d4fac/src/serialize.rs#L38 - https://github.com/peterdelevoryas/bufparse/blob/b1325898f4fc2c67658049196c12da82548af350/src/result.rs#L50 The other results appear to be files from libcore or its tests. I could also leave Carrier around after stage0 and `impl<T:Carrier> Try for T` if that would be better. r? @nikomatsakis Edit: Oh, and it might accidentally improve perf, based on https://github.com/rust-lang/rust/issues/37939#issuecomment-265803670, since `Try::into_result` for `Result` is an obvious no-op, unlike `Carrier::translate`.
2017-06-01Rollup merge of #42136 - petrochenkov:oldhard, r=nikomatsakisCorey Farwell-64/+52
Turn sufficiently old compatibility lints into hard errors It's been almost 7 months since https://github.com/rust-lang/rust/pull/36894 was merged, so it's time to take the next step. [breaking-change], needs crater run. PRs/issues submitted to affected crates: https://github.com/alexcrichton/ctest/pull/17 https://github.com/Sean1708/rusty-cheddar/pull/55 https://github.com/m-r-r/helianto/pull/3 https://github.com/azdle/virgil/pull/1 https://github.com/rust-locale/rust-locale/issues/24 https://github.com/mneumann/acyclic-network-rs/pull/1 https://github.com/reem/rust-typemap/pull/38 cc https://internals.rust-lang.org/t/moving-forward-on-forward-compatibility-lints/4204 cc https://github.com/rust-lang/rust/issues/34537 https://github.com/rust-lang/rust/issues/36887 Closes https://github.com/rust-lang/rust/issues/36886 Closes https://github.com/rust-lang/rust/issues/36888 Closes https://github.com/rust-lang/rust/issues/36890 Closes https://github.com/rust-lang/rust/issues/36891 Closes https://github.com/rust-lang/rust/issues/36892 r? @nikomatsakis
2017-05-31Fix a test and address review commentest31-0/+2
2017-05-31rustdoc: Cleanup associated const value renderingOliver Middleton-0/+18
Rather than (ab)using Debug for outputting the type in plain text use the alternate format parameter which already does exactly that. This fixes type parameters for example which would output raw HTML. Also cleans up adding parens around references to trait objects.
2017-05-31Improve error message for const extern fnManish Goregaokar-1/+1
2017-05-31Rollup merge of #42330 - qnighy:macro-named-default, r=petrochenkovMark Simulacrum-0/+27
Parse macros named "default" correctly. Fixes #42292.