| Age | Commit message (Collapse) | Author | Lines |
|
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.
|
|
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.
|
|
Rollup of 12 pull requests
- Successful merges: #40146, #40299, #40315, #40319, #40344, #40345, #40372, #40373, #40400, #40404, #40419, #40431
- Failed merges:
|
|
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
|
|
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
|
|
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).
|
|
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))
|
|
Better docs of rusty parts of typeck
|
|
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!
|
|
|
|
|
|
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!
|
|
|
|
|
|
Fairly basic implementation of inlining for MIR. Uses conservative
heuristics for inlining.
|
|
|
|
Adds `get`/`get_mut` accessors and `drain`/`drain_enumerated` iterators
to IndexVec.
Implements TypeFoldable for IndexVec.
|
|
|
|
|
|
|
|
|
|
syntax: integrate `TokenStream`
Use `TokenStream` instead of `Vec<TokenTree>` in `TokenTree::Delimited` and elsewhere.
r? @nrc
|
|
More through normalization, Feb/Mar 2017 edition
Fix a few normalization bugs.
Fixes #27901.
Fixes #28828.
Fixes #38135.
Fixes #39363.
Fixes #39367.
|
|
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
|
|
|
|
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
|
|
Rollup of 7 pull requests
- Successful merges: #39832, #40104, #40110, #40117, #40129, #40139, #40166
- Failed merges:
|
|
[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
|
|
suggest doubling recursion limit in more situations
Fixes #38852.
r? @bluss
|
|
|
|
|
|
Fixes #40029
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
|
|
|
|
|
|
Replace it with ConstUsize instead, which is more appropriate; we are not using the rest of the
TypedConstVal anyway
|
|
|
|
|
|
|
|
|
|
Otherwise the errors from borrowck come out in an unpredictable
order.
|
|
|
|
Fixes #38520
|
|
|
|
|
|
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).
|