summary refs log tree commit diff
path: root/src/librustc
AgeCommit message (Collapse)AuthorLines
2018-02-13Auto merge of #47804 - retep007:recursive-requirements, r=pnkfelixbors-9/+31
Optimized error reporting for recursive requirements #47720 Fixes #47720
2018-02-12Auto merge of #47843 - estebank:teach, r=nikomatsakisbors-0/+4
Add `-Zteach` documentation Add extra inline documentation to E0019, E0016, E0013, E0396, E0017, E0018, E0010, E0022, E0030, E0029, E0033, E0026 and E0027. Follow up to #47652.
2018-02-11Auto merge of #48092 - eddyb:discriminate-the-void, r=nikomatsakisbors-3/+2
rustc_mir: insert a dummy access to places being matched on, when building MIR. Fixes #47412 by adding a `_dummy = Discriminant(place)` before each `match place {...}`. r? @nikomatsakis
2018-02-10Rollup merge of #48086 - Zoxc:gen-fix, r=nikomatsakiskennytm-1/+1
Fix visitation order of calls so that it matches execution order. Fixes #48048 r? @nikomatsakis
2018-02-10Rollup merge of #48047 - ↵kennytm-44/+49
etaoins:fix-ice-for-mismatched-args-on-target-without-span, r=estebank Fix ICE for mismatched args on target without span Commit 7ed00caacc improved our error reporting by including the target function in our error messages when there is an argument count mismatch. A simple example from the UI tests is: ``` error[E0593]: function is expected to take a single 2-tuple as argument, but it takes 0 arguments --> $DIR/closure-arg-count.rs:32:53 | 32 | let _it = vec![1, 2, 3].into_iter().enumerate().map(foo); | ^^^ expected function that takes a single 2-tuple as argument ... 44 | fn foo() {} | -------- takes 0 arguments ``` However, this assumed the target span was always available. This does not hold true if the target function is in `std` or another crate. A simple example from #48046 is assigning `str::split` to a function type with a different number of arguments. Fix by omitting all of the labels and suggestions related to the target span when it's not found. Fixes #48046 r? @estebank
2018-02-09Auto merge of #47802 - bobtwinkles:loop_false_edge, r=nikomatsakisbors-7/+46
[NLL] Add false edges out of infinite loops Resolves #46036 by adding a `cleanup` member to the `FalseEdges` terminator kind. There's also a small doc fix to one of the other comments in `into.rs` which I can pull out in to another PR if desired =) This PR should pass CI but the test suite has been relatively unstable on my system so I'm not 100% sure. r? @nikomatsakis
2018-02-09Fix visitation order of calls so that it matches execution order. Fixes #48048John Kåre Alsaker-1/+1
2018-02-09Auto merge of #47489 - pnkfelix:limit-2pb-issue-46747, r=nikomatsakisbors-8/+72
NLL: Limit two-phase borrows to autoref-introduced borrows This imposes a restriction on two-phase borrows so that it only applies to autoref-introduced borrows. The goal is to ensure that our initial deployment of two-phase borrows is very conservative. We want it to still cover the `v.push(v.len());` example, but we do not want it to cover cases like `let imm = &v; let mu = &mut v; mu.push(imm.len());` (Why do we want it to be conservative? Because when you are not conservative, then the results you get, at least with the current analysis, are tightly coupled to details of the MIR construction that we would rather remain invisible to the end user.) Fix #46747 I decided, for this PR, to add a debug-flag `-Z two-phase-beyond-autoref`, to re-enable the more general approach. But my intention here is *not* that we would eventually turn on that debugflag by default; the main reason I added it was that I thought it was useful for writing tests to be able to write source that looks like desugared MIR.
2018-02-08rustc: don't ICE when using Rvalue::Discriminant on a non-ADT.Eduard-Mihai Burtescu-3/+2
2018-02-08Add `AutoBorrowMutability`; its like `hir::Mutability` but w/ two-phase ↵Felix S. Klock II-2/+31
borrow info too. Namely, the mutable borrows also carries a flag indicating whether they should support two-phase borrows. This allows us to thread down, from the point of the borrow's introduction, whether the particular adjustment that created it is one that yields two-phase mutable borrows.
2018-02-08Restrict two-phase borrows to solely borrows introduced via autoref.Felix S. Klock II-0/+11
Added `-Z two-phase-beyond-autoref` to bring back old behavior (mainly to allow demonstration of desugared examples). Updated tests to use aforementioned flag when necessary. (But in each case where I added the flag, I made sure to also include a revision without the flag so that one can readily see what the actual behavior we expect is for the initial deployment of NLL.)
2018-02-08Encode (in MIR) whether borrows are explicit in source or arise due to autoref.Felix S. Klock II-6/+30
This is foundation for issue 46747 (limit two-phase borrows to method-call autorefs).
2018-02-07Add `-Zteach` documentationEsteban Küber-0/+4
Add extra inline documentation to E0019, E0016, E0013, E0396, E0017, E0018, E0010, E0022, E0030, E0029, E0033, E0026 and E0027.
2018-02-07Rollup merge of #48014 - Manishearth:stealing-chickens-on-the-internet, ↵Manish Goregaokar-3/+50
r=nikomatsakis Implement RFC 2052 (Epochs) This adds -Zepochs and uses it for tyvar_behind_raw_pointer (#46906) When we move this to --epoch=XXX, we'll need to gate the 2018 epoch on nightly, but not the 2015 one. I can make these changes here itself though it's kinda pointless given that the entire flag is nightly-only. r? @nikomatsakis @aturon cc #44581 (epoch tracking) cc #46906 (tyvar_behind_raw_pointer)
2018-02-07Rollup merge of #47922 - ↵Manish Goregaokar-15/+52
zackmdavis:and_the_case_of_the_unused_field_pattern, r=estebank correct unused field pattern suggestions ![unused_field_pattern_local](https://user-images.githubusercontent.com/1076988/35662336-7a69488a-06cc-11e8-9901-8d22b5cf924f.png) r? @estebank
2018-02-07Rollup merge of #47613 - estebank:rustc_on_unimplemented, r=nikomatsakisManish Goregaokar-18/+53
Add filtering options to `rustc_on_unimplemented` - Add filtering options to `rustc_on_unimplemented` for local traits, filtering on `Self` and type arguments. - Add a way to provide custom notes. - Tweak binops text. - Add filter to detect wether `Self` is local or belongs to another crate. - Add filter to `Iterator` diagnostic for `&str`. Partly addresses #44755 with a different syntax, as a first approach. Fixes #46216, fixes #37522, CC #34297, #46806.
2018-02-07Fix ICE for mismatched args on target without spanRyan Cumming-44/+49
Commit 7ed00caacc improved our error reporting by including the target function in our error messages when there is an argument count mismatch. A simple example from the UI tests is: ``` error[E0593]: function is expected to take a single 2-tuple as argument, but it takes 0 arguments --> $DIR/closure-arg-count.rs:32:53 | 32 | let _it = vec![1, 2, 3].into_iter().enumerate().map(foo); | ^^^ expected function that takes a single 2-tuple as argument ... 44 | fn foo() {} | -------- takes 0 arguments ``` However, this assumed the target span was always available. This does not hold true if the target function is in `std` or another crate. A simple example from #48046 is assigning `str::split` to a function type with a different number of arguments. Fix by removing all of the labels and suggestions related to the target span when it's not found. Fixes #48046
2018-02-07Rollup merge of #48026 - Badel2:doc-assoc-const-object-safe, r=nikomatsakiskennytm-0/+22
Document that associated constants prevent a trait from being made into an object Fixes https://github.com/rust-lang/rust/issues/47952 Add a short mention of associated constants to E0038
2018-02-06Trait objects cannot contain associated constantsBadel2-0/+22
2018-02-06Auto merge of #47203 - varkor:output-filename-conflicts-with-directory, ↵bors-19/+0
r=estebank Warn when rustc output conflicts with existing directories When the compiled executable would conflict with a directory, display a rustc error instead of a verbose and potentially-confusing linker error. This is a usability improvement, and doesn’t actually change behaviour with regards to compilation success. This addresses the concern in #35887. Fixes #13098.
2018-02-05Add -ZepochManish Goregaokar-3/+50
2018-02-05mir: Add TerminatorKind::FalseUnwindbobtwinkles-7/+46
Sometimes a simple goto misses the cleanup/unwind edges. Specifically, in the case of infinite loops such as those introduced by a loop statement without any other out edges. Analogous to TerminatorKind::FalseEdges; this new terminator kind is used when we want borrowck to consider an unwind path, but real control flow should never actually take it.
2018-02-06Rollup merge of #47959 - Manishearth:rustdoc-ice, r=Mark-Simulacrumkennytm-5/+14
Fix rustdoc ICE on macros defined within functions fixes #47639
2018-02-05Auto merge of #47865 - Manishearth:cleanup-shim, r=nikomatsakisbors-2/+2
Cleanup the shim code - We now write directly to `RETURN_PLACE` instead of creating intermediates - `tuple_like_shim` takes an iterator (used by #47867) - `tuple_like_shim` no longer relies on it being the first thing to create blocks, and uses relative block indexing in a cleaner way (necessary for #47867) - All the shim builders take `dest, src` arguments instead of hardcoding RETURN_PLACE r? @eddyb
2018-02-04Remove 'the this' in doc comments.Jay Strict-1/+1
2018-02-04Auto merge of #47915 - eddyb:layout-of, r=nikomatsakisbors-73/+100
rustc: prefer ParamEnvAnd and LayoutCx over tuples for LayoutOf. This PR provides `tcx.layout_of(param_env.and(ty))` as the idiomatic replacement for the existing `(tcx, param_env).layout_of(ty)` and removes fragile (coherence-wise) layout-related tuple impls. r? @nikomatsakis
2018-02-03Auto merge of #47845 - Zoxc:gen-fixes, r=nikomatsakisbors-5/+26
Generator bugfixes r? @nikomatsakis
2018-02-03Auto merge of #46254 - Dylan-DPC:ellided-lifetime, r=nikomatsakisbors-4/+22
elided lifetime Closes #45992 Hey Having a problem with my config so decided to make a WIP PR nevertheless. Will add some more tests.
2018-02-03Auto merge of #47791 - estebank:mismatched-trait-impl, r=nikomatsakisbors-29/+65
Tweak presentation on lifetime trait mismatch - On trait/impl method discrepancy, add label pointing at trait signature. - Point only at method definition when referring to named lifetimes on lifetime mismatch. - When the sub and sup expectations are the same, tweak the output to avoid repeated spans. Fix #30790, CC #18759.
2018-02-02Fix rustdoc ICE on macros defined within functionsManish Goregaokar-5/+14
fixes #47639
2018-02-01Remove support for `Self` in attributesEsteban Küber-2/+0
2018-02-01Add filter to detect local crates for rustc_on_unimplementedEsteban Küber-2/+5
2018-02-01Add filtering options to `rustc_on_unimplemented`Esteban Küber-16/+50
- filter error on the evaluated value of `Self` - filter error on the evaluated value of the type arguments - add argument to include custom note in diagnostic - allow the parser to parse `Self` when processing attributes - add custom message to binops
2018-02-02add ellided lifetimedpc-4/+22
2018-02-01Auto merge of #47738 - nikomatsakis:issue-47139-master, r=arielb1bors-74/+118
remove intercrate ambiguity hints The scheme was causing overflows during coherence checking (e.g. #47139). This is sort of a temporary fix; the proper fix I think involves reworking trait selection in deeper ways. cc @sgrif -- this *should* fix diesel cc @qnighy -- I'd like to discuss you with alternative techniques for achieving the same end. =) Actually, it might be good to put some energy into refactoring traits first. r? @eddyb
2018-01-31concerning well-formed suggestions for unused shorthand field patternsZack M. Davis-14/+49
Previously, unused variables would get a note that the warning could be silenced by prefixing the variable with an underscore, but that doesn't work for field shorthand patterns, which the liveness analysis didn't know about. The "to avoid this warning" verbiage seemed unnecessary. Resolves #47390.
2018-02-01Auto merge of #47540 - Manishearth:suggestion, r=nrcbors-2/+6
Add approximate suggestions for rustfix This adds `span_approximate_suggestion()` that lets you emit a suggestion marked as "non-machine applicable" in the JSON output. UI users see no difference. This is for when rustc and clippy wish to emit suggestions which will make sense to the reader (e.g. they may have placeholders like `<type>`) but are not source-applicable, so that rustfix/etc can ignore these. fixes #39254
2018-01-31in which HirIdMap is introduced as an affordance for using HirIds moreZack M. Davis-1/+3
The glossaries in the draft rustc-guide book and librustc/README.md state that `NodeId` is being gradually phased out in favor of `HirId`; as such, the present author claims that we ought to have a typedef for efficient `HirId` maps and sets in the module for such, even if no use for them has been made as yet (compatibility constraints preventing the use of it in the author's present unit of work): it is important to create the psychological "affordance" (in James J. Gibson's sense) that `HirId`s are a thing that compiler developers can work with.
2018-02-01rustc: prefer ParamEnvAnd and LayoutCx over tuples for LayoutOf.Eduard-Mihai Burtescu-73/+100
2018-01-31Auto merge of #47900 - kennytm:rollup, r=kennytmbors-0/+12
Rollup of 16 pull requests - Successful merges: #47838, #47840, #47844, #47874, #47875, #47876, #47884, #47886, #47889, #47890, #47891, #47795, #47677, #47893, #47895, #47552 - Failed merges:
2018-01-31Rollup merge of #47795 - avborhanian:master, r=rkruppekennytm-0/+1
Adding ICH to the glossary. Fixes #47782.
2018-01-31Rollup merge of #47889 - alexcrichton:wasm-hidden-by-default, r=cramertjkennytm-0/+6
rustc: Add an option to default hidden visibility This commit adds a new option to target specifictions to specify that symbols should be "hidden" visibility by default in LLVM. While there are no existing targets that take advantage of this the `wasm32-unknown-unknown` target will soon start to use this visibility. The LLD linker currently interprets `hidden` as "don't export this from the wasm module" which is what we want for 90% of our functions. While the LLD linker does have a "export this symbol" argument which is what we use for other linkers, it was also somewhat easier to do this change instead which'll involve less arguments flying around. Additionally there's no need for non-`hidden` visibility for most of our symbols! This change should not immediately impact the wasm targets as-is, but rather this is laying the foundations for soon integrating LLD as a linker for wasm code.
2018-01-31Rollup merge of #47844 - CAD97:patch-1, r=estebankkennytm-0/+5
Fix regression: account for trait methods in arg count mismatch error Fixed #47706 (https://github.com/rust-lang/rust/issues/47706#issuecomment-361161495) Original PR #47747 missed methods on trait definitions. This edit was done in GitHub. I think I got the signature of the variant right, going by the ICE debug output and the other cases above.
2018-01-31Auto merge of #45752 - estebank:highlight-primary, r=nikomatsakisbors-8/+11
Highlight code on diagnostics when underlined Highlight the label's span with the respective color: <img width="692" alt="" src="https://user-images.githubusercontent.com/1606434/32411026-a1842482-c18d-11e7-9933-6510eefbad19.png"> Fix #42112.
2018-01-30rustc: Add an option to default hidden visibilityAlex Crichton-0/+6
This commit adds a new option to target specifictions to specify that symbols should be "hidden" visibility by default in LLVM. While there are no existing targets that take advantage of this the `wasm32-unknown-unknown` target will soon start to use this visibility. The LLD linker currently interprets `hidden` as "don't export this from the wasm module" which is what we want for 90% of our functions. While the LLD linker does have a "export this symbol" argument which is what we use for other linkers, it was also somewhat easier to do this change instead which'll involve less arguments flying around. Additionally there's no need for non-`hidden` visibility for most of our symbols! This change should not immediately impact the wasm targets as-is, but rather this is laying the foundations for soon integrating LLD as a linker for wasm code.
2018-01-30track intercrate ambiguity only when there is a coherence errorNiko Matsakis-49/+82
2018-01-30change `overlapping_impls` to take a tcx and create the infcxNiko Matsakis-42/+40
2018-01-30make `overlapping_impls` call closures instead of returningNiko Matsakis-33/+46
2018-01-30Document the index used in AggregateKind::AdtManish Goregaokar-2/+2
2018-01-30Allow access of the state field before the generator transform. Fixes ↵John Kåre Alsaker-3/+10
#47482, #46476