summary refs log tree commit diff
path: root/src/librustc
AgeCommit message (Collapse)AuthorLines
2018-07-18use the adjusted type for cat_pattern in tuple patternsAriel Ben-Yehuda-1/+1
This looks like a typo introduced in #51686. Fixes #52213.
2018-07-03use `pat_ty_adjusted` from `expr_use_visitor` to type of argumentsNiko Matsakis-2/+3
2018-07-03rename `pat_ty` to `pat_ty_adjusted` for clarityNiko Matsakis-4/+4
2018-06-03change `PointerKind::Implicit` to a noteNiko Matsakis-53/+79
`PointerKind` is included in `LoanPath` and hence forms part of the equality check; this led to having two unequal paths that both represent `*x`, depending on whether the `*` was inserted automatically or explicitly. Bad mojo. The `note` field, in contrast, is intended more-or-less primarily for this purpose of adding extra data.
2018-06-03restore emplacement syntax (obsolete)Niko Matsakis-1/+4
2018-06-03[beta] Fix naming conventions for new lintsVadim Petrochenkov-14/+14
2018-05-21Stabilise inclusive_range_methodsvarkor-1/+0
2018-05-14rustc: don't trip an assertion for enums with present but uninhabited variants.Eduard-Mihai Burtescu-0/+5
2018-05-13rustc: leave space for fields of uninhabited types to allow partial ↵Eduard-Mihai Burtescu-23/+50
initialization.
2018-05-07Auto merge of #50454 - Manishearth:edition-preview-fixes, r=alexcrichtonbors-10/+11
Various edition preview fixes Implement a bunch of things discussed in the meeting.
2018-05-07Auto merge of #50000 - michaelwoerister:cross-lang-lto, r=alexcrichtonbors-0/+2
Add some groundwork for cross-language LTO. Implements part of #49879: - Adds a `-Z cross-lang-lto` flag to rustc - Makes sure that bitcode is embedded in object files if the flag is set. This should already allow for using cross language LTO for staticlibs (where one has to invoke the linker manually anyway). However, `rustc` will not try to enable LTO for its own linker invocations yet. r? @alexcrichton
2018-05-06issue-49938: Reference tagged unions discr(iminant) as tagSamuel Wilson-5/+5
Refer https://github.com/rust-lang/rust/issues/49938 Previously tagged unions' tag was refered to as a discr(iminant). Here the changes use tag instead which is the correct terminology when refering to the memory representation of tagged unions.
2018-05-05Auto merge of #50276 - Zoxc:build-cleanup, r=alexcrichtonbors-0/+11
Misc tweaks This: - ~~Add explicit dependencies on `getops`~~ - Fixes the libtest-json test when `RUST_BACKTRACE=1` is set - ~~Sets `opt-level` to `3`~~ - Removes the use of `staged_api` from `rustc_plugin` - ~~Enables the Windows Error Reporting dialog when running rustc during bootstrapping~~ - Disables Windows Error Reporting dialog when running compiletest tests - Enables backtraces when running rustc during bootstrapping - ~~Removes the `librustc` dependency on `libtest`~~ - Triggers JIT debugging on Windows if rustc panics during bootstrapping r? @alexcrichton
2018-05-05Misc tweaksJohn Kåre Alsaker-0/+11
2018-05-05Auto merge of #50370 - nikomatsakis:nll-alias-analysis-flat, r=pnkfelixbors-0/+7
introduce `-Znll-facts` to dump base-facts for the NLL analysis r? @pnkfelix
2018-05-05add `-Znll-facts` switch that dumps facts for new analysisNiko Matsakis-0/+2
2018-05-05add `Location::START` constNiko Matsakis-0/+5
2018-05-05Auto merge of #50418 - nnethercote:cmt, r=eddybbors-83/+82
Avoid many `cmt` allocations. `cmt` is a ref-counted wrapper around `cmt_` The use of refcounting keeps `cmt` handling simple, but a lot of `cmt` instances are very short-lived, and heap-allocating the short-lived ones takes up time. This patch changes things in the following ways. - Most of the functions that produced `cmt` instances now produce `cmt_` instances. The `Rc::new` calls that occurred within those functions now occur at their call sites (but only when necessary, which isn't that often). - Many of the functions that took `cmt` arguments now take `&cmt_` arguments. This includes all the methods in the `Delegate` trait. As a result, the vast majority of the heap allocations are avoided. In an extreme case, the number of calls to malloc in tuple-stress drops from 9.9M to 7.9M, a drop of 20%. And the compile times for many runs of coercions, deep-vector, and tuple-stress drop by 1--2%.
2018-05-04Mark lints with applicabilityManish Goregaokar-10/+11
2018-05-04Auto merge of #49870 - ↵bors-0/+8
pnkfelix:issue-27282-immut-borrow-all-pat-ids-in-guards, r=nikomatsakis Immutably and implicitly borrow all pattern ids for their guards (NLL only) This is an important piece of rust-lang/rust#27282. It applies only to NLL mode. It is a change to MIR codegen that is currently toggled on only when NLL is turned on. It thus affect MIR-borrowck but not the earlier static analyses (such as the type checker). This change makes it so that any pattern bindings of type T for a match arm will map to a `&T` within the context of the guard expression for that arm, but will continue to map to a `T` in the context of the arm body. To avoid surfacing this type distinction in the user source code (which would be a severe change to the language and would also require far more revision to the compiler internals), any occurrence of such an identifier in the guard expression will automatically get a deref op applied to it. So an input like: ```rust let place = (1, Foo::new()); match place { (1, foo) if inspect(foo) => feed(foo), ... } ``` will be treated as if it were really something like: ```rust let place = (1, Foo::new()); match place { (1, Foo { .. }) if { let tmp1 = &place.1; inspect(*tmp1) } => { let tmp2 = place.1; feed(tmp2) }, ... } ``` And an input like: ```rust let place = (2, Foo::new()); match place { (2, ref mut foo) if inspect(foo) => feed(foo), ... } ``` will be treated as if it were really something like: ```rust let place = (2, Foo::new()); match place { (2, Foo { .. }) if { let tmp1 = & &mut place.1; inspect(*tmp1) } => { let tmp2 = &mut place.1; feed(tmp2) }, ... } ``` In short, any pattern binding will always look like *some* kind of `&T` within the guard at least in terms of how the MIR-borrowck views it, and this will ensure that guard expressions cannot mutate their the match inputs via such bindings. (It also ensures that guard expressions can at most *copy* values from such bindings; non-Copy things cannot be moved via these pattern bindings in guard expressions, since one cannot move out of a `&T`.)
2018-05-04Auto merge of #50397 - sgrif:sg-smaller-universe-refactorings, r=nikomatsakisbors-151/+163
Refactorings in preparation for the removal of the leak check This contains all of the commits from #48407 that I was able to pull out on their own. This has most of the refactoring/ground work to unblock other work, but without the behavior changes that still need a crater run and NLL changes. r? @nikomatsakis
2018-05-03Auto merge of #50413 - kennytm:rollup, r=kennytmbors-8/+9
Rollup of 12 pull requests Successful merges: - #50302 (Add query search order check) - #50320 (Fix invalid path generation in rustdoc search) - #50349 (Rename "show type declaration" to "show declaration") - #50360 (Clarify wordings of the `unstable_name_collision` lint.) - #50365 (Use two vectors in nearest_common_ancestor.) - #50393 (Allow unaligned reads in constants) - #50401 (Revert "Implement FromStr for PathBuf") - #50406 (Forbid constructing empty identifiers from concat_idents) - #50407 (Always inline simple BytePos and CharPos methods.) - #50416 (check if the token is a lifetime before parsing) - #50417 (Update Cargo) - #50421 (Fix ICE when using a..=b in a closure.) Failed merges:
2018-05-04Rollup merge of #50421 - ↵kennytm-2/+2
kennytm:fix-50415-ice-when-returning-range-inclusive-from-closure, r=michaelwoerister Fix ICE when using a..=b in a closure. Fix #50415.
2018-05-04Rollup merge of #50365 - nnethercote:nearest_common_ancestor-two-vecs, ↵kennytm-5/+6
r=nikomatsakis Use two vectors in nearest_common_ancestor. When looking at any scope in scope chain A, we only need to look for matches among scopes previously seen in scope chain B, and vice versa. This halves the number of "seen before?" comparisons, speeding up some runs of style-servo, clap-rs, and syn by 1--2%. Thanks to @kirillkh for the suggestion. r? @nikomatsakis
2018-05-04Rollup merge of #50360 - kennytm:fix-50232-clarify-unstable-name-collision, ↵kennytm-1/+1
r=nikomatsakis Clarify wordings of the `unstable_name_collision` lint. Stabilizing an inherent method may cause change in behavior instead of inference error. Updated to use the wording from [varkor's comment]. Closes #50232. [varkor's comment]: https://github.com/rust-lang/rust/issues/50232#issuecomment-384678097
2018-05-03Fix issue #50415.kennytm-2/+2
2018-05-03Avoid many `cmt` allocations.Nicholas Nethercote-83/+82
`cmt` is a ref-counted wrapper around `cmt_` The use of refcounting keeps `cmt` handling simple, but a lot of `cmt` instances are very short-lived, and heap-allocating the short-lived ones takes up time. This patch changes things in the following ways. - Most of the functions that produced `cmt` instances now produce `cmt_` instances. The `Rc::new` calls that occurred within those functions now occur at their call sites (but only when necessary, which isn't that often). - Many of the functions that took `cmt` arguments now take `&cmt_` arguments. This includes all the methods in the `Delegate` trait. As a result, the vast majority of the heap allocations are avoided. In an extreme case, the number of calls to malloc in tuple-stress drops from 9.9M to 7.9M, a drop of 20%. And the compile times for many runs of coercions, deep-vector, and tuple-stress drop by 1--2%.
2018-05-03When using NLL, implicitly borrow match bindings for any guard,Felix S. Klock II-0/+8
deref'ing such borrows within that guard. Review feedback: Add comment noting a point where we may or may not need to add a cast when we finish the work on rust-lang/rust#27282. Review feedback: Pass a newtype'd `ArmHasGuard` rather than a raw boolean. Review feedback: toggle "ref binding in guards" semantics via specific method. (This should ease a follow-up PR that just unconditionally adopts the new semantics.)
2018-05-03Auto merge of #50030 - flip1995:rfc2103, r=petrochenkovbors-18/+22
Implement tool_attributes feature (RFC 2103) cc #44690 This is currently just a rebased and compiling (hopefully) version of #47773. Let's see if travis likes this. I will add the implementation for `tool_lints` this week.
2018-05-03Add -Z cross-lang-lto flag in order to support linker-based LTO.Michael Woerister-0/+2
2018-05-02Add a comment explaining unification w/ universesSean Griffin-0/+5
2018-05-02Fix rebase issuesSean Griffin-1/+1
2018-05-02Auto merge of #50354 - varkor:initial-field-alignment-c-int, r=eddybbors-2/+6
Correct initial field alignment for repr(C)/repr(int) Fixes #50098 following https://github.com/rust-lang/rust/issues/50098#issuecomment-385497333. (I wasn't sure which kind of test was best suited here — I picked run-pass simply because that was convenient, but if codegen is more appropriate, let me know and I'll change it.) r? @eddyb
2018-05-02track skol levels in the InferCtxt rather than via counterSean Griffin-87/+26
2018-05-02Wrap `InferCtxt::universe` in a cellSean Griffin-5/+9
We'll need this in order to start tracking skolemizatoins here, and it's easier to update all the field accesses now rather than later.
2018-05-02Fix rebase issuesSean Griffin-0/+2
2018-05-02give a universe to region variablesSean Griffin-6/+34
2018-05-02store RegionVariableInfo and not just RegionVariableOriginSean Griffin-30/+37
2018-05-02change skolemizations to use universe indexSean Griffin-29/+38
This is sort of confusing "side step". All it does is to change the representation of a skolemized region. but the source of that universe index is not the inference context, which is what we eventually want, but rather an internal counter in the region inference context. We'll patch that up later. But doing this now ought to help with confusing diffs later.
2018-05-02add universes to type inference variablesSean Griffin-7/+15
This gives each type inference variable a notion of universe but doesn't do anything with it. We can always get the "current universe" from infer_ctxt. This relies on the property of type variables that they can never interact with siblings.
2018-05-02introduce `UniverseIndex` into `InferCtxt`Sean Griffin-3/+13
Always using root environment for now.
2018-05-02make it compile againflip1995-6/+6
2018-05-02Remove Option from the return type of Attribute::name()Seiichi Uchida-9/+5
2018-05-02Allow Path for name of MetaItemSeiichi Uchida-4/+12
2018-05-02Auto merge of #50278 - eddyb:mir-succ-iter, r=nikomatsakisbors-74/+72
rustc: return iterators from Terminator(Kind)::successors(_mut). Minor cleanup (and potentially speedup) prompted by @nnethercote's `SmallVec` experiments. This PR assumes `.count()` and `.nth(i)` on `iter::Chain<option::IntoIter, slice::Iter(Mut)>` are `O(1)`, but otherwise all of the uses appear to immediately iterate through the successors. r? @nikomatsakis
2018-05-01Correct initial field alignment for repr(C)/repr(int)varkor-2/+6
2018-05-01Auto merge of #50198 - oli-obk:const_prop, r=eddybbors-184/+109
Remove some unused code
2018-05-01Use two vectors in nearest_common_ancestor.Nicholas Nethercote-5/+6
When looking at any scope in scope chain A, we only need to look for matches among scopes previously seen in scope chain B, and vice versa. This halves the number of "seen before?" comparisons, speeding up some runs of style-servo, clap-rs, and syn by 1--2%.
2018-05-01Merge adjacent write! invocationsOliver Schneider-4/+1
2018-05-01rustc: return impl Iterator from Terminator(Kind)::successors(_mut).Eduard-Mihai Burtescu-74/+72