summary refs log tree commit diff
path: root/src/librustc
AgeCommit message (Collapse)AuthorLines
2017-06-22Fix formattingJohn Kåre Alsaker-1/+3
2017-06-22Make the `next` variable mutable to allow for ref mut in for patterns.John Kåre Alsaker-7/+7
2017-06-22Fix formatting and add a test for destruction order of unbound valuesJohn Kåre Alsaker-4/+11
2017-06-22Change the for-loop desugar so the `break` does not affect type inference. ↵John Kåre Alsaker-10/+27
Fixes #42618
2017-06-22move `implied_bounds` into regionckNiko Matsakis-147/+1
2017-06-12rustc: T: 'empty always holds forall T.Eduard-Mihai Burtescu-0/+7
2017-06-04Auto merge of #42362 - estebank:type, r=arielb1bors-0/+16
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-04Show trait method signature when impl differsEsteban Küber-0/+16
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 #42406 - bjorn3:patch-1, r=eddybbors-53/+55
Some doc comments
2017-06-04Auto merge of #42265 - Zoxc:for-sugar, r=eddybbors-22/+60
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-03Module doc comment for librustc/dep_graph/safe.rsbjorn3-0/+2
2017-06-03Make some comments docs in librustc/dep_graph/dep_node.rsbjorn3-53/+53
2017-06-03Auto merge of #42396 - venkatagiri:remove_lifetime_extn, r=arielb1bors-88/+15
rustc: remove temporary lifetime extension by borrow hint closes #39283. Thanks to @nikomatsakis for mentoring on this one. r? @arielb1
2017-06-03Auto merge of #42332 - michaelwoerister:no-more-retracing, r=nikomatsakisbors-26/+103
incr.comp.: Use DefPathHash-based DepNodes in the serialized DepGraph and remove obsolete DefIdDirectory With this PR we don't store the dep-graph as a set of `DepNode<IndexIntoDefIdDirectory>` anymore but instead as a set of `DepNode<DefPathHash>`. Since a `DefPathHash` is a global identifier that is valid across compilation sessions, we don't need the `DefIdDirectory` anymore. Since a `DepNode<DefPathHash>` is bigger than a `DepNode<IndexIntoDefIdDirectory>` and our on-disk encoding of the dep-graph is inefficient, this PR will probably increase the amount of space the dep-graph takes up on disk. I'm in the process of gathering some performance data. The changes in here are a step towards implementing ICH-based `DepNodes` (#42294). r? @nikomatsakis
2017-06-02rustc: remove temporary lifetime extension by borrow hintVenkata Giri Reddy-88/+15
2017-06-02Auto merge of #42381 - Mark-Simulacrum:rollup, r=Mark-Simulacrumbors-20/+2
Rollup of 10 pull requests - Successful merges: #41981, #42225, #42310, #42319, #42335, #42343, #42355, #42360, #42370, #42372 - Failed merges:
2017-06-02Rollup merge of #42355 - bjorn3:patch-1, r=Mark-SimulacrumMark Simulacrum-1/+1
Syntax highlight rust code in librustc/dep_graph/README.md
2017-06-02Rollup merge of #42335 - jcowgill:fingerprint-be, r=michaelwoeristerMark Simulacrum-19/+1
Don't byteswap Fingerprints when encoding Byteswapping Fingerprints when encoding is unnessesary and breaks if the Fingerprint is later decoded on a machine with different endianness to the one it was encoded on. Fixes #42239 This PR fixes a regression caused by #42082. @michaelwoerister
2017-06-01pacify the mercilous tidyNiko Matsakis-26/+43
2017-06-01ergonomic improvements to the methods in infcxNiko Matsakis-244/+378
2017-06-01remove `layout_cache` and fix `-Z print-type-sizes`Niko Matsakis-7/+230
now we grow the type-sizes info during execution, rather than walking the cache after the fact
2017-06-01strip param-env from infcxNiko Matsakis-269/+495
2017-06-01rewrite layout to take a (param-env, ty) pair instead of infcxNiko Matsakis-164/+192
2017-06-01move projection mode into parameter environmentNiko Matsakis-66/+78
2017-06-01Syntax highlight rust code in librustc/dep_graph/README.mdbjorn3-1/+1
2017-06-01Change for-loop desugar to not borrow the iterator during the loopJohn Kåre Alsaker-22/+60
2017-06-01Auto merge of #42281 - eddyb:well-adjusted, r=nikomatsakisbors-742/+439
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-06-01Don't byteswap Fingerprints when encodingJames Cowgill-19/+1
Byteswapping Fingerprints when encoding is unnessesary and breaks if the Fingerprint is later decoded on a machine with different endianness to the one it was encoded on. Fix by removing the Encodable and Decodable implementations and use the ones derived from RustcEncodable and RustcDecodable. Fixes #42239
2017-06-01rustc: adjust the RHS of comparison operators instead of assuming autorefs.Eduard-Mihai Burtescu-87/+13
2017-06-01rustc: decompose Adjustment into a vector of adjustment steps.Eduard-Mihai Burtescu-226/+151
2017-06-01rustc: move autoref and unsize from Adjust::DerefRef to Adjustment.Eduard-Mihai Burtescu-130/+118
2017-06-01rustc: replace autoderefs' use of MethodCallee with OverloadedDeref.Eduard-Mihai Burtescu-34/+151
2017-06-01rustc: remove unused TypeFolder methods.Eduard-Mihai Burtescu-47/+0
2017-06-01rustc: replace method_map with Def::Method and node_substs entries.Eduard-Mihai Burtescu-29/+31
2017-06-01rustc: remove unnecessary ItemSubsts wrapper.Eduard-Mihai Burtescu-50/+6
2017-06-01rustc: avoid using MethodCallee's signature where possible.Eduard-Mihai Burtescu-131/+99
2017-06-01rustc: replace TyFnDef in MethodCallee with just the FnSig.Eduard-Mihai Burtescu-29/+17
2017-06-01rustc: keep overloaded autoderef MethodCallee's in Adjust.Eduard-Mihai Burtescu-228/+103
2017-06-01rustc: remove unused field of mc::Categorization::Deref.Eduard-Mihai Burtescu-28/+27
2017-06-01rustc: remove Copy from Adjustment and Adjust.Eduard-Mihai Burtescu-2/+2
2017-06-01Rollup merge of #42302 - GuillaumeGomez:new-error-codes-next, r=SusurrusCorey Farwell-9/+30
New error codes next Part #42229. To be merged after #42264. cc @Susurrus
2017-06-01Rollup merge of #42297 - tschottdorf:proj-ty, r=nikomatsakisCorey Farwell-38/+67
Upgrade ProjectionTy's Name to a DefId Part of #42171, in preparation for downgrading the contained `TraitRef` to only its `substs`. Some inline questions in the diff. Look for `FIXME(tschottdorf)`. These comments should be addressed before merging.
2017-06-01Rollup merge of #42275 - scottmcm:try-trait, r=nikomatsakisCorey Farwell-6/+6
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-58/+0
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-31Rollup merge of #42277 - citizen428:remove-crate-type-metadata, r=nikomatsakisMark Simulacrum-14/+4
Remove --crate-type=metadata deprecation warning Fixes #38640
2017-05-31Rollup merge of #42196 - tommyip:explain_closure_err, r=nikomatsakisMark Simulacrum-3/+9
Explain why a closure is `FnOnce` in closure errors. Issue: #42065 @nikomatsakis Am I going the right direction with this? ~~I am stuck in a few bits:~~ ~~1. How to trace the code to get the upvar instead of the original variable's span?~~ ~~2. How to find the node id of the upvar where the move occured?~~
2017-05-31Upgrade ProjectionTy's Name to a DefIdTobias Schottdorf-38/+67
Part of #42171, in preparation for downgrading the contained `TraitRef` to only its `substs`.
2017-05-31Don't print the whole crate disambiguator value in debug outputMichael Woerister-1/+3
2017-05-31Build DefPathHash->DefId table when incr.comp. is enabledMichael Woerister-2/+70
2017-05-31Make a newtype for DefPathHash so they are not confused with content hashesMichael Woerister-23/+30