about summary refs log tree commit diff
path: root/src/librustc/util
AgeCommit message (Collapse)AuthorLines
2017-07-11Downgrade ProjectionTy's TraitRef to its substsTobias Schottdorf-3/+8
Addresses the second part of #42171 by removing the `TraitRef` from `ProjectionTy`, and directly storing its `Substs`. Closes #42171.
2017-06-27rustc: move the PolyFnSig out of TyFnDef.Eduard-Mihai Burtescu-2/+8
2017-06-19Auto merge of #39409 - pnkfelix:mir-borrowck2, r=nikomatsakisbors-1/+28
MIR EndRegion Statements (was MIR dataflow for Borrows) This PR adds an `EndRegion` statement to MIR (where the `EndRegion` statement is what terminates a borrow). An earlier version of the PR implemented a dataflow analysis on borrow expressions, but I am now factoring that into a follow-up PR so that reviewing this one is easier. (And also because there are some revisions I want to make to that dataflow code, but I want this PR to get out of WIP status...) This is a baby step towards MIR borrowck. I just want to get the review process going while I independently work on the remaining steps.
2017-06-12`-Z identify_regions` toggles rendering of (previously hidden) unnamed regions.Felix S. Klock II-0/+23
Unlike `-Z verbose`, it is succinct. It uniquely identifies regions when displaying them, and distinguishes code extents from user-specified lifetimes in the output by leveraging a syntactic restriction: you cannot write a lifetime that starts with a numeric character. For example, it prints '<num>ce for the more verbose `ReScope(CodeExtent(<num>))`.
2017-06-12Add `-Z span_free_rvalues`.Felix S. Klock II-1/+5
This is solely a hack to make comparing test output plausible; it makes closures print as [closure@node_id] instead of [closure@span-with-host-path] in debug printouts.
2017-06-09incr.comp.: Uniformly represent DepNodes as (Kind, StableHash) pairs.Michael Woerister-2/+4
2017-06-01Auto merge of #42281 - eddyb:well-adjusted, r=nikomatsakisbors-6/+0
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-01rustc: remove unnecessary ItemSubsts wrapper.Eduard-Mihai Burtescu-6/+0
2017-05-31Upgrade ProjectionTy's Name to a DefIdTobias Schottdorf-4/+7
Part of #42171, in preparation for downgrading the contained `TraitRef` to only its `substs`.
2017-05-22centralize the caching for is-copy, is-sized, and is-freezeNiko Matsakis-7/+1
Use the trait-environment+type as the key. Note that these are only invoked on types that live for the entire compilation (no inference artifacts). We no longer need the various special-case bits and caches that were in place before.
2017-05-16Auto merge of #41907 - est31:macro_unused, r=jseyfriedbors-0/+1
Add lint for unused macros Addresses parts of #34938, to add a lint for unused macros. We now output warnings by default when we encounter a macro that we didn't use for expansion. Issues to be resolved before this PR is ready for merge: - [x] fix the NodeId issue described above - [x] remove all unused macros from rustc and the libraries or set `#[allow(unused_macros)]` next to them if they should be kept for some reason. This is needed for successful boostrap and bors to accept the PR. -> #41934 - [x] ~~implement the full extent of #34938, that means the macro match arm checking as well.~~ *let's not do this for now*
2017-05-16put option_try macro def under #[cfg(unix)]est31-0/+1
2017-05-13rustc: stop interning CodeExtent, it's small enough.Eduard-Mihai Burtescu-2/+2
2017-05-13rustc: treat ReEarlyBound as free without replacing it with ReFree.Eduard-Mihai Burtescu-5/+1
2017-05-13rustc: use DefId instead of CodeExtent for FreeRegion's scope.Eduard-Mihai Burtescu-3/+1
2017-04-30intern CodeExtentsNiko Matsakis-8/+8
Make a `CodeExtent<'tcx>` be something allocated in an arena instead of an index into the `RegionMaps`.
2017-04-24rustc: rename some of the queries to match tcx methods.Eduard-Mihai Burtescu-5/+5
2017-04-11add Subtype predicateNiko Matsakis-0/+14
2017-03-17Fix race condition in fs::create_dir_allDavid Roundy-20/+0
It is more robust to not fail if any directory in a path was created concurrently. This change lifts rustc internal `create_dir_racy` that was created to handle such conditions to be new `create_dir_all` implementation.
2017-03-13some style fixesTshepang Lekhonkhobe-4/+5
2017-02-25rustc_typeck: move the leaves (generics, trait_def, adt_def) to on-demand.Eduard-Mihai Burtescu-10/+1
2017-02-25rustc: combine BareFnTy and ClosureTy into FnSig.Eduard-Mihai Burtescu-27/+10
2017-02-25rustc: introduce a query system for type information in ty::maps.Eduard Burtescu-1/+1
2017-02-25rustc: consolidate dep-tracked hashmaps in tcx.maps.Eduard-Mihai Burtescu-1/+1
2017-02-25rustc: store type parameter defaults outside of ty::Generics.Eduard-Mihai Burtescu-3/+6
2017-02-05Auto merge of #38897 - nikomatsakis:issue-32330-followup, r=arielb1bors-7/+6
make lifetimes that only appear in return type early-bound This is the full and proper fix for #32330. This also makes some effort to give a nice error message (as evidenced by the `ui` test), sending users over to the tracking issue for a fuller explanation and offering a `--explain` message in some cases. This needs a crater run before we land. r? @arielb1
2017-02-05make lifetimes that only appear in return type early-boundNiko Matsakis-7/+6
This is the full and proper fix for #32330. This also makes some effort to give a nice error message (as evidenced by the `ui` test), sending users over to the tracking issue for a full explanation.
2017-02-05Rollup merge of #39439 - king6cong:move, r=alexcrichtonCorey Farwell-5/+32
rename other than copy/remove
2017-02-04run rustfmt for librustc/util/fs.rsking6cong-10/+12
2017-02-03Add warning for () to ! switchAndrew Cann-2/+2
2017-02-03add and use rename_or_copy_remove fn that fallback to copy & removeking6cong-0/+25
2017-02-02Rollup merge of #39373 - Mark-Simulacrum:remove-toprimitive, r=aturonGuillaume Gomez-98/+0
Remove ToPrimitive trait. It is no longer used.
2017-01-30Merge ty::TyBox into ty::TyAdtVadim Petrochenkov-2/+1
2017-01-28Remove ToPrimitive trait.Mark Simulacrum-98/+0
It is no longer used.
2017-01-28rustc: remove unused `bounds` field from `RegionParameterDef`.Eduard-Mihai Burtescu-4/+3
2017-01-28rustc: move object default lifetimes to resolve_lifetimes.Eduard-Mihai Burtescu-10/+0
2017-01-26rustc: rename TyCtxt's `map` field to `hir`.Eduard-Mihai Burtescu-4/+4
2016-12-27propagate TIME_DEPTH to the helper threads for -Z time-passesNiko Matsakis-3/+17
2016-12-05Refactor FnSig to contain a Slice for its inputs and outputs.Mark-Simulacrum-2/+2
2016-12-05Refactor ty::FnSig to privatize all fieldsMark-Simulacrum-2/+2
2016-12-02Auto merge of #38053 - eddyb:lazy-9, r=nikomatsakisbors-4/+5
[9/n] rustc: move type information out of AdtDef and TraitDef. _This is part of a series ([prev](https://github.com/rust-lang/rust/pull/37688) | [next]()) of patches designed to rework rustc into an out-of-order on-demand pipeline model for both better feature support (e.g. [MIR-based](https://github.com/solson/miri) early constant evaluation) and incremental execution of compiler passes (e.g. type-checking), with beneficial consequences to IDE support as well. If any motivation is unclear, please ask for additional PR description clarifications or code comments._ <hr> Both `AdtDef` and `TraitDef` contained type information (field types, generics and predicates) which was required to create them, preventing their use before that type information exists, or in the case of field types, *mutation* was required, leading to a variance-magicking implementation of `ivar`s. This PR takes that information out and the resulting cleaner setup could even eventually end up merged with HIR, because, just like `AssociatedItem` before it, there's no dependency on types anymore. (With one exception, variant discriminants should probably be moved into their own map later.)
2016-11-29rustc: simplify AdtDef by removing the field types and ty::ivar.Eduard-Mihai Burtescu-1/+1
2016-11-29rustc: remove type information from TraitDef.Eduard-Mihai Burtescu-3/+4
2016-11-28Refactor TyTrait to contain a interned ExistentialPredicate slice.Mark-Simulacrum-98/+27
Renames TyTrait to TyDynamic.
2016-11-28Remove BuiltinBound and BuiltinBounds.Mark-Simulacrum-13/+0
2016-11-28Refactor BuiltinBounds to Vec<DefId> on TraitObject.Mark-Simulacrum-10/+16
2016-11-28Privatize TraitObject.principal and add a method accessor, returning Option.Mark-Simulacrum-2/+2
2016-11-21Implement the `loop_break_value` feature.Geoffry Song-55/+0
This implements RFC 1624, tracking issue #37339. - `FnCtxt` (in typeck) gets a stack of `LoopCtxt`s, which store the currently deduced type of that loop, the desired type, and a list of break expressions currently seen. `loop` loops get a fresh type variable as their initial type (this logic is stolen from that for arrays). `while` loops get `()`. - `break {expr}` looks up the broken loop, and unifies the type of `expr` with the type of the loop. - `break` with no expr unifies the loop's type with `()`. - When building MIR, `loop` loops no longer construct a `()` value at termination of the loop; rather, the `break` expression assigns the result of the loop. `while` loops are unchanged. - `break` respects contexts in which expressions may not end with braced blocks. That is, `while break { break-value } { while-body }` is illegal; this preserves backwards compatibility. - The RFC did not make it clear, but I chose to make `break ()` inside of a `while` loop illegal, just in case we wanted to do anything with that design space in the future. This is my first time dealing with this part of rustc so I'm sure there's plenty of problems to pick on here ^_^
2016-11-20Move `syntax::util::interner` -> `syntax::symbol`, cleanup.Jeffrey Seyfried-2/+2
2016-11-12rustc: move closure upvar types to the closure substsAriel Ben-Yehuda-2/+3
This moves closures to the (DefId, Substs) scheme like all other items, and saves a word from the size of TyS now that Substs is 2 words.