about summary refs log tree commit diff
path: root/src/librustc_passes
AgeCommit message (Collapse)AuthorLines
2017-07-10Store all generic arguments for method calls in ASTVadim Petrochenkov-0/+17
2017-07-02report the total number of errors on compilation failureAriel Ben-Yehuda-2/+5
Prior to this PR, when we aborted because a "critical pass" failed, we displayed the number of errors from that critical pass. While that's the number of errors that caused compilation to abort in *that place*, that's not what people really want to know. Instead, always report the total number of errors, and don't bother to track the number of errors from the last pass that failed. This changes the compiler driver API to handle errors more smoothly, and therefore is a compiler-api-[breaking-change]. Fixes #42793.
2017-06-27syntax: allow negative integer literal expression to be interpolated as patternAlex Burka-0/+26
2017-06-23Removed as many "```ignore" as possible.kennytm-4/+4
Replaced by adding extra imports, adding hidden code (`# ...`), modifying examples to be runnable (sorry Homura), specifying non-Rust code, and converting to should_panic, no_run, or compile_fail. Remaining "```ignore"s received an explanation why they are being ignored.
2017-06-19Bump version and stage0 compilerAlex Crichton-4/+0
2017-06-19Auto merge of #39409 - pnkfelix:mir-borrowck2, r=nikomatsakisbors-0/+1
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-13On-demand is_const_fnTaylor Cramer-1/+1
2017-06-12Add `EndRegion` statement kind to MIR.Felix S. Klock II-0/+1
* Emit `EndRegion` for every code-extent for which we observe a borrow. To do this, we needed to thread source info back through to `fn in_scope`, which makes this commit a bit more painful than one might have expected. * There is `end_region` emission in `Builder::pop_scope` and in `Builder::exit_scope`; the first handles falling out of a scope normally, the second handles e.g. `break`. * Remove `EndRegion` statements during the erase_regions mir transformation. * Preallocate the terminator block, and throw an `Unreachable` marker on it from the outset. Then overwrite that Terminator as necessary on demand. * Instead of marking the scope as needs_cleanup after seeing a borrow, just treat every scope in the chain as being part of the diverge_block (after any *one* of them has separately signalled that it needs cleanup, e.g. due to having a destructor to run). * Allow for resume terminators to be patched when looking up drop flags. (In particular, `MirPatch::new` has an explicit code path, presumably previously unreachable, that patches up such resume terminators.) * Make `Scope` implement `Debug` trait. * Expanded a stray comment: we do not emit StorageDead on diverging paths, but that end behavior might not be desirable.
2017-06-10rustc: make InferCtxt optional in MemCategorizationContext.Eduard-Mihai Burtescu-9/+8
2017-06-10rustc: do not depend on infcx.tables in MemCategorizationContext.Eduard-Mihai Burtescu-2/+3
2017-06-01strip param-env from infcxNiko Matsakis-2/+2
2017-06-01move projection mode into parameter environmentNiko Matsakis-2/+2
2017-06-01Auto merge of #42281 - eddyb:well-adjusted, r=nikomatsakisbors-18/+20
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: decompose Adjustment into a vector of adjustment steps.Eduard-Mihai Burtescu-11/+15
2017-06-01rustc: move autoref and unsize from Adjust::DerefRef to Adjustment.Eduard-Mihai Burtescu-1/+1
2017-06-01rustc: replace method_map with Def::Method and node_substs entries.Eduard-Mihai Burtescu-4/+4
2017-06-01rustc: keep overloaded autoderef MethodCallee's in Adjust.Eduard-Mihai Burtescu-6/+4
2017-06-01rustc: remove unused field of mc::Categorization::Deref.Eduard-Mihai Burtescu-1/+1
2017-06-01rustc: remove Copy from Adjustment and Adjust.Eduard-Mihai Burtescu-7/+7
2017-05-30Turn sufficiently old compatibility lints into hard errorsVadim Petrochenkov-18/+7
2017-05-28add NullOp::SizeOf and BinOp::OffsetAriel Ben-Yehuda-1/+1
2017-05-26Rollup merge of #42215 - callahad:remove-superfluous-semis, r=Mark-SimulacrumCorey Farwell-1/+1
Remove superfluous `;;` sequences Ran across a doubled `;;` in the docstring for `str::split`. Grep found a few more. :)
2017-05-25Hygienize lifetimes.Jeffrey Seyfried-2/+2
2017-05-24Remove superfluous `;;` sequencesDan Callahan-1/+1
2017-05-22rename `parameter_environment` to `param_env`Niko Matsakis-1/+1
2017-05-22use `ParamEnv` from `ty` rather than importingNiko Matsakis-2/+2
2017-05-22rename `ParameterEnvironment` to `ParamEnv`Niko Matsakis-3/+3
2017-05-22centralize the caching for is-copy, is-sized, and is-freezeNiko Matsakis-4/+4
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-13Auto merge of #41919 - nrc:save-crate, r=eddybbors-1/+1
Include the crate's root module in save-analysis r? @eddyb
2017-05-13Auto merge of #41847 - alexcrichton:less-unstable-annotations, r=eddybbors-3/+4
rustc: Add a new `-Z force-unstable-if-unmarked` flag This commit adds a new `-Z` flag to the compiler for use when bootstrapping the compiler itself. We want to be able to use crates.io crates, but we also want the usage of such crates to be as ergonomic as possible! To that end compiler crates are a little tricky in that the crates.io crates are not annotated as unstable, nor do they expect to pull in unstable dependencies. To cover all these situations it's intended that the compiler will forever now bootstrap with `-Z force-unstable-if-unmarked`. This flags serves a dual purpose of forcing crates.io crates to themselves be unstable while also allowing them to use other "unstable" crates.io crates. This should mean that adding a dependency to compiler no longer requires upstream modification with unstable/staged_api attributes for inclusion!
2017-05-11rustc: Remove #![unstable] annotationAlex Crichton-3/+4
These are now no longer necessary with `-Z force-unstable-if-unmarked`
2017-05-12box large variants in MIRAriel Ben-Yehuda-1/+1
Operand: 72 -> 24 B Statement: 192 -> 96 B Terminator: 256 -> 112 B librustc translation memory usage: 1795 -> 1669 MB next step would be interning lvalues, I suppose?
2017-05-12Pass crate attributes in visit.rsNick Cameron-1/+1
2017-05-08Remove need for &format!(...) or &&"" dances in `span_label` callsOliver Schneider-9/+9
2017-05-02rename from `item_mir` to `optimized_mir`Niko Matsakis-1/+1
2017-05-02introduce `mir_keys()`Niko Matsakis-4/+4
Each MIR key is a DefId that has MIR associated with it
2017-05-02Rollup merge of #41662 - nikomatsakis:on-demandify-region-mapping, r=eddybCorey Farwell-3/+5
On demandify region mapping This is an adaptation of @cramertj's PR. I am sort of tempted to keep simplifying it, but also tempted to land it so and we can refactor more in follow-up PRs. As is, it does the following things: - makes the region-maps an on-demand query, per function `tcx.region_maps(def_id)` - interns code extents instead of of having them be integers - remove the "root region extent" and (to some extent) item extents; instead we use `Option<CodeExtent<'tcx>>` in a few places (no space inefficiency since `CodeExtent<'tcx>` is now a pointer). I'm not entirely happy with the way I have it setup though. Here are some of the changes I was considering (I'm not sure if they would work out well): 1. Removing `item_extents` entirely -- they are rarely used now, because most of the relevant places now accept an `Option<Region<'tcx>>` or an `Option<CodeExtent<'tcx>>`, but I think still used in a few places. 2. Merging `RegionMaps` into the typeck tables, instead of having it be its own query. 3. Change `CodeExtent<'tcx>` to store the parent pointer. This would mean that fewer places in the code actually *need* a `RegionMaps` anyhow, since most of them just want to be able to walk "up the tree". On the other hand, you wouldn't be able to intern a `CodeExtent<'tcx>` for some random node-id, you'd need to look it up in the table (since there'd be more information). Most of this code is semi-temporary -- I expect it to largely go away as we move to NLL -- so I'm also not *that* concerned with making it perfect. r? @eddyb
2017-05-01Queryify const_is_rvalue_promotable_to_staticTaylor Cramer-1/+1
2017-04-30modify `ExprUseVisitor` and friends to take region-maps, not def-idNiko Matsakis-1/+2
2017-04-30introduce per-fn RegionMapsTaylor Cramer-2/+3
Instead of requesting the region maps for the entire crate, request for a given item etc. Several bits of code were modified to take `&RegionMaps` as input (e.g., the `resolve_regions_and_report_errors()` function). I am not totally happy with this setup -- I *think* I'd rather have the region maps be part of typeck tables -- but at least the `RegionMaps` works in a "parallel" way to `FreeRegionMap`, so it's not too bad. Given that I expect a lot of this code to go away with NLL, I didn't want to invest *too* much energy tweaking it.
2017-04-30intern CodeExtentsNiko Matsakis-1/+1
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-1/+1
2017-04-20rustc: combine type_needs_drop_given_env and may_drop into needs_drop.Eduard-Mihai Burtescu-1/+1
2017-04-20rustc: replace interior_unsafe with a Freeze trait.Eduard-Mihai Burtescu-2/+2
2017-04-18convert calls to `visit_all_item_likes_in_krate`Niko Matsakis-10/+8
We no longer need to track the tasks in these cases since these particular tasks have no outputs (except, potentially, errors...) and they always execute.
2017-04-16rustc_const_eval: move ConstEvalErr to the rustc crate.Eduard-Mihai Burtescu-4/+5
2017-04-12Rollup merge of #41232 - arielb1:mir-rvalues, r=eddybTim Neumann-137/+0
move rvalue checking to MIR
2017-04-11Move rvalue checking to MIRAriel Ben-Yehuda-137/+0
Fixes #41139.
2017-04-04kill `CheckStaticRecursion`Niko Matsakis-3/+0
2017-04-04kill the `CheckLoops` DepNodeNiko Matsakis-2/+0