summary refs log tree commit diff
path: root/src/librustc
AgeCommit message (Collapse)AuthorLines
2017-04-02keep the AST node-id when lowering ExprKind::RangeAriel Ben-Yehuda-59/+36
When the Range expression is the root of a constant, its node-id is used for the def-id of the body, so it has to be preserved in the AST -> HIR lowering. Fixes #40749.
2017-04-01store a copy of the Issue32230 info within TypeErrorAriel Ben-Yehuda-36/+48
The data can't be looked up from the region variable directly, because the region variable might have been destroyed at the end of a snapshot. Fixes #40000. Fixes #40743.
2017-03-12Auto merge of #40446 - arielb1:rollup, r=alexcrichtonbors-62/+87
Rollup of 12 pull requests - Successful merges: #40146, #40299, #40315, #40319, #40344, #40345, #40372, #40373, #40400, #40404, #40419, #40431 - Failed merges:
2017-03-11Auto merge of #40220 - jseyfried:ast_macro_def, r=nrcbors-29/+30
syntax: add `ast::ItemKind::MacroDef`, simplify hygiene info This PR - adds a new variant `MacroDef` to `ast::ItemKind` for `macro_rules!` and eventually `macro` items, - [breaking-change] forbids macro defs without a name (`macro_rules! { () => {} }` compiles today), - removes `ast::MacroDef`, and - no longer uses `Mark` and `Invocation` to identify and characterize macro definitions. - We used to apply (at least) two `Mark`s to an expanded identifier's `SyntaxContext` -- the definition mark(s) and the expansion mark(s). We now only apply the latter. r? @nrc
2017-03-11Rollup merge of #40404 - cengizIO:master, r=nikomatsakisAriel Ben-Yehuda-8/+13
fix #40294 obligation cause.body_id is not always a NodeExpr Hello! This fixes #40294 and moves tests related to #38812 to a much more sensible directory. Thanks to @nikomatsakis and @eddyb
2017-03-11Rollup merge of #40319 - eddyb:it's-"unsize"-not-"unsound", r=nikomatsakisAriel Ben-Yehuda-3/+3
Disallow subtyping between T and U in T: Unsize<U>. Because `&mut T` can be coerced to `&mut U`, `T` and `U` must be unified invariantly. Fixes #40288. E.g. coercing `&mut [&'a X; N]` to `&mut [&'b X]` must require `'a` be equal to `'b`, otherwise you can convert between `&'a X` and `&'b X` (in either direction), potentially unsoundly lengthening lifetimes. Subtyping here was introduced with `Unsize` in #24619 (landed in 1.1, original PR is #23785).
2017-03-11Rollup merge of #40315 - oli-obk:lint_body, r=eddybAriel Ben-Yehuda-0/+8
Allow lints to check Bodys directly r? @eddyb babysteps towards fixing https://github.com/Manishearth/rust-clippy/issues/1580 (disable certain lints in const environments, since they make no sense there (yet))
2017-03-11Rollup merge of #40146 - bjorn3:few-infer-changes, r=pnkfelixAriel Ben-Yehuda-51/+63
Better docs of rusty parts of typeck
2017-03-11Auto merge of #40308 - nikomatsakis:incr-comp-isolate-task, r=mwbors-3/+97
first pass at isolating dep-graph tasks This intentionally leaves `DepGraph::in_task()`, the more common form, alone. Eventually all uses of `DepGraph::in_task()` should be ported to `with_task()`, but I wanted to start with a smaller subset. I also used `AssertDepGraphSafe` on the closures that are found in trans. This is because the types there are non-trivial and I wanted to lay down the mechanism and come back to the more subtle cases. The current approach taken in this PR has a downside: it is necessary to manually "reify" fn types into fn pointers when starting a task, like so: dep_graph.with_task(..., task_fn as fn(_)) this is because `with_task` takes some type `T` that implements `DepGraphTask` rather than taking a `fn()` type directly. *This* is so that we can accept closure and also so that we can accept fns with multiple arities. I am not sure this is the right approach. Originally I wanted to use closures bound by an auto trait, but that approach has some limitations: - the trait cannot have a `read()` method; since the current method is unused, that may not be a problem. - more importantly, we would want the auto trait to be "undefined" for all types *by default* -- that is, this use case doesn't really fit the typical auto trait scenario. For example, imagine that there is a `u32` loaded out of a `hir::Node` -- we don't really want to be passing that `u32` into the task!
2017-03-10Allow lints to check Bodys directlyOliver Schneider-0/+8
2017-03-10add comments and remove unused code pathsNiko Matsakis-33/+49
2017-03-10isolate dep-graph tasksNiko Matsakis-3/+81
A task function is now given as a `fn` pointer to ensure that it carries no state. Each fn can take two arguments, because that worked out to be convenient -- these two arguments must be of some type that is `DepGraphSafe`, a new trait that is intended to prevent "leaking" information into the task that was derived from tracked state. This intentionally leaves `DepGraph::in_task()`, the more common form, alone. Eventually all uses of `DepGraph::in_task()` should be ported to `with_task()`, but I wanted to start with a smaller subset. Originally I wanted to use closures bound by an auto trait, but that approach has some limitations: - the trait cannot have a `read()` method; since the current method is unused, that may not be a problem. - more importantly, we would want the auto trait to be "undefined" for all types *by default* -- that is, this use case doesn't really fit the typical auto trait scenario. For example, imagine that there is a `u32` loaded out of a `hir::Node` -- we don't really want to be passing that `u32` into the task!
2017-03-10Avoid using `Mark` and `Invocation` for macro defs.Jeffrey Seyfried-1/+1
2017-03-10Refactor out `ast::ItemKind::MacroDef`.Jeffrey Seyfried-29/+30
2017-03-10Initial implementation of inlining for MIRJames Miller-2/+360
Fairly basic implementation of inlining for MIR. Uses conservative heuristics for inlining.
2017-03-10Fix recursion depth counting in `layout`James Miller-2/+3
2017-03-10Add extra methods to IndexVec and implement TypeFoldable for itJames Miller-0/+11
Adds `get`/`get_mut` accessors and `drain`/`drain_enumerated` iterators to IndexVec. Implements TypeFoldable for IndexVec.
2017-03-10fix #40294 obligation cause.body_id is not always a NodeExprCengiz Can-8/+13
2017-03-08Disallow subtyping between T and U in T: Unsize<U>.Eduard-Mihai Burtescu-3/+3
2017-03-07Fix a typo in the docsOliver Schneider-1/+1
2017-03-05Fix const expression macro invocations.Jeffrey Seyfried-11/+11
2017-03-04Auto merge of #40202 - jseyfried:integrate_tokenstream, r=nrcbors-2/+2
syntax: integrate `TokenStream` Use `TokenStream` instead of `Vec<TokenTree>` in `TokenTree::Delimited` and elsewhere. r? @nrc
2017-03-04Auto merge of #40163 - arielb1:normalization-1702, r=nikomatsakisbors-8/+34
More through normalization, Feb/Mar 2017 edition Fix a few normalization bugs. Fixes #27901. Fixes #28828. Fixes #38135. Fixes #39363. Fixes #39367.
2017-03-03Auto merge of #40178 - arielb1:provide-destructors, r=eddybbors-82/+67
convert AdtDef::destructor to on-demand This removes the `Cell` from `AdtDef`. Also, moving destructor validity checking to on-demand (forced during item-type checking) ensures that invalid destructors can't cause ICEs. Fixes #38868. Fixes #40132. r? @eddyb
2017-03-03Integrate `TokenStream`.Jeffrey Seyfried-2/+2
2017-03-03Auto merge of #39927 - nikomatsakis:incr-comp-skip-borrowck-2, r=eddybbors-55/+93
transition borrowck to visit all **bodies** and not item-likes This is a better structure for incremental compilation and also more compatible with the eventual borrowck mir. It also fixes #38520 as a drive-by fix. r? @eddyb
2017-03-02Auto merge of #40216 - frewsxcv:rollup, r=frewsxcvbors-64/+27
Rollup of 7 pull requests - Successful merges: #39832, #40104, #40110, #40117, #40129, #40139, #40166 - Failed merges:
2017-03-02Rollup merge of #40104 - nagisa:mir-the-shiny, r=eddybCorey Farwell-64/+27
[MIR] Rvalue::ty infallible + remove TypedConstVal Feel free to r+ whenever there aren't any big bit-rot sensitive PRs in the queue. r? @eddyb
2017-03-02Auto merge of #39655 - durka:recursion-limit-suggestion, r=nikomatsakisbors-1/+1
suggest doubling recursion limit in more situations Fixes #38852. r? @bluss
2017-03-02note -> helpAlex Burka-1/+1
2017-03-01fix tests to handle the Typeof bodiesNiko Matsakis-3/+9
2017-03-01inhibit enum layout optimizations under `#[repr(C)]` or `#[repr(u8)]`Niko Matsakis-2/+10
Fixes #40029
2017-03-01convert AdtDef::destructor to on-demandAriel Ben-Yehuda-82/+67
This removes the Cell from AdtDef. Also, moving destructor validity checking to on-demand (forced during item-type checking) ensures that invalid destructors can't cause ICEs. Fixes #38868. Fixes #40132.
2017-03-01store the normalized types of statics in MIR LvaluesAriel Ben-Yehuda-8/+34
The types of statics, like all other items, are stored in the tcx unnormalized. This is necessarily so, because a) Item types other than statics have generics, which can't be normalized. b) Eager normalization causes undesirable on-demand dependencies. Keeping with the principle that MIR lvalues require no normalization in order to interpret, this patch stores the normalized type of the statics in the Lvalue and reads it to get the lvalue type. Fixes #39367.
2017-03-01Auto merge of #34198 - eddyb:you're-a-bad-transmute-and-you-should-feel-bad, ↵bors-16/+101
r=nikomatsakis Make transmuting from fn item types to pointer-sized types a hard error. Closes #19925 by removing the future compatibility lint and the associated workarounds. This is a `[breaking-change]` if you `transmute` from a function item without casting first. For more information on how to fix your code, see https://github.com/rust-lang/rust/issues/19925.
2017-02-28Rollup merge of #40128 - cengizIO:master, r=nikomatsakisCorey Farwell-467/+445
Move two large error_reporting fn's to a separate file Hello! I tried to make `librustc/infer/error_reporting,rs` more readable by modularizing it and moving its two largest functions to a separate file. If you have any suggestions, please send it right away! 🚀 Thanks goes to @nikomatsakis for supporting.
2017-02-28Add warning cycle.Jeffrey Seyfried-0/+7
2017-02-28Make transmuting from fn item types to pointer-sized types a hard error.Eduard Burtescu-16/+101
2017-02-28convert MIR to iterate over the bodies vectorNiko Matsakis-0/+2
2017-02-28Remove the TypedConstValSimonas Kazlauskas-37/+4
Replace it with ConstUsize instead, which is more appropriate; we are not using the rest of the TypedConstVal anyway
2017-02-28Make Rvalue::ty infallibleSimonas Kazlauskas-27/+23
2017-02-28rewrite typeck bodies to iterate over the bodies vectorNiko Matsakis-0/+2
2017-02-28store the visit order in the CrateNiko Matsakis-25/+19
2017-02-28switch bodies to a btreemapNiko Matsakis-6/+5
2017-02-28walk the bodies "in order" by traversing the crateNiko Matsakis-15/+42
Otherwise the errors from borrowck come out in an unpredictable order.
2017-02-28use `visit_all_bodies_in_krate` for borrowck instead of item-likesNiko Matsakis-0/+2
2017-02-28remove special-case code for statics and just use `borrowck_fn`Niko Matsakis-15/+7
Fixes #38520
2017-02-28add `visit_all_bodies_in_krate` helperNiko Matsakis-0/+22
2017-02-28move the `FreeRegionMap` into `TypeckTables`Niko Matsakis-19/+11
2017-02-28Rollup merge of #39977 - frewsxcv:error-reporting-cleanup, r=eddybCorey Farwell-279/+235
librustc error_reporting.rs cleanup. Read some code in librustc, mainly in error_reporting.rs, and cleaned up some things along the way. I recommend looking at each commit individually or looking at the [whitespace insensitive diff](https://github.com/rust-lang/rust/pull/39977/files?w=1).