about summary refs log tree commit diff
path: root/src/librustc/middle
AgeCommit message (Collapse)AuthorLines
2019-02-08Use descriptive variant namevarkor-2/+2
2019-02-07Improve the error messages for missing stability attributesvarkor-10/+15
This makes the capitalisation consistent and provides more context (especially for missing top-level attributes).
2019-02-07Auto merge of #58010 - Zoxc:parallel-passes, r=michaelwoeristerbors-1/+0
Move privacy checking later in the pipeline and make some passes run in parallel r? @michaelwoerister
2019-02-07Rollup merge of #58193 - mark-i-m:rustc-2018, r=Centrilkennytm-153/+153
Move librustc to 2018 r? @Centril Part of #58099 It would be great to get this reviewed quickly to avoid merge conflicts...
2019-02-05rustc: partially HirIdifyljedrz-6/+6
2019-02-05move librustc to 2018Mark Mansi-153/+153
2019-02-04Fix #58101Tatsuyuki Ishi-1/+3
2019-02-04Auto merge of #58090 - ljedrz:HirIdification_phase_2, r=Zoxcbors-1/+1
HirIdification: add key HirId methods This is another PR in a series dedicated to `HirId`-ification, i.e. deprecating `ast::NodeId`s after the AST > HIR lowering process. The bigger proof of concept can be seen in #57578. **Phase 2**: add key `HirId` methods mirroring the `NodeId` ones. These should be counterparts of the most widely used `Hir` methods using `NodeId`s. Note that this expands `hir::map::Definitions` with an additional `hir_to_def_index` map (with the intention of later removing `node_to_def_index`). As a bonus there is also a small cleanup commit removing unnecessary calls to `node_to_hir_id` where `HirId` is already available. r? @Zoxc Cc @varkor
2019-02-03Auto merge of #57922 - davidtwco:issue-57410, r=petrochenkovbors-7/+12
Update visibility of intermediate use items. Fixes #57410 and fixes #53925 and fixes #47816. Currently, the target of a use statement will be updated with the visibility of the use statement itself (if the use statement was visible). This PR ensures that if the path to the target item is via another use statement then that intermediate use statement will also have the visibility updated like the target. This silences incorrect `unreachable_pub` lints with inactionable suggestions.
2019-02-03cleanup: don't use node_to_hir_id where unneededljedrz-1/+1
2019-02-02hir: add HirId to main Hir nodesljedrz-1/+1
2019-02-02Update visibility of intermediate use items.David Wood-7/+12
Currently, the target of a use statement will be updated with the visibility of the use statement itself (if the use statement was visible). This commit ensures that if the path to the target item is via another use statement then that intermediate use statement will also have the visibility updated like the target. This silences incorrect `unreachable_pub` lints with inactionable suggestions.
2019-02-01Auto merge of #57916 - Zoxc:incr-passes4, r=michaelwoeristerbors-6/+5
Misc performance tweaks r? @michaelwoerister
2019-01-30Move privacy checking later in the pipeline and make some passes run in parallelJohn Kåre Alsaker-1/+0
2019-01-30Add suggestions to deprecation lintsOliver Scherer-22/+40
2019-01-29Add an ensure() method to TyCtxt used to ensure queries are runJohn Kåre Alsaker-6/+5
2019-01-28Auto merge of #55704 - Nemo157:pinned-generators, r=Zoxcbors-0/+2
Use pinning for generators to make trait safe I'm unsure whether there needs to be any changes to the actual generator transform. Tests are passing so the fact that `Pin<&mut T>` is fundamentally the same as `&mut T` seems to allow it to still work, but maybe there's something subtle here that could go wrong. This is specified in [RFC 2349 § Immovable generators](https://github.com/rust-lang/rfcs/blob/master/text/2349-pin.md#immovable-generators) (although, since that RFC it has become safe to create an immovable generator, and instead it's unsafe to resume any generator; with these changes both are now safe and instead the unsafety is moved to creating a `Pin<&mut [static generator]>` which there are safe APIs for). CC #43122
2019-01-28Unused variable suggestions on all patterns.David Wood-34/+50
This commit extends existing suggestions to prefix unused variable bindings in match arms with an underscore so that it applies to all patterns in a match arm.
2019-01-27Update generator transform and generated function signatureWim Looman-0/+1
2019-01-27Mark static generators as !UnpinWim Looman-0/+1
2019-01-26remove `_with_applicability` from suggestion fnsAndy Russell-9/+13
2019-01-21Differentiate between closure and function bodiesOliver Scherer-2/+2
2019-01-19Rollup merge of #57689 - nnethercote:redo-hir-Stmt, r=petrochenkovMazdak Farrokhzad-61/+47
Redo `hir::Stmt` A couple of changes that make things simpler and more consistent. This should probably wait until after 1.32 lands to land, to avoid late breakage for tools.
2019-01-19Auto merge of #57752 - Centril:rollup, r=Centrilbors-32/+47
Rollup of 10 pull requests Successful merges: - #57268 (Add a target option "merge-functions", and a corresponding -Z flag (works around #57356)) - #57476 (Move glob map use to query and get rid of CrateAnalysis) - #57501 (High priority resolutions for associated variants) - #57573 (Querify `entry_fn`) - #57610 (Fix nested `?` matchers) - #57634 (Remove an unused function argument) - #57653 (Make the contribution doc reference the guide more) - #57666 (Generalize `huge-enum.rs` test and expected stderr for more cross platform cases) - #57698 (Fix typo bug in DepGraph::try_mark_green().) - #57746 (Update README.md) Failed merges: r? @ghost
2019-01-19Rollup merge of #57573 - Xanewok:querify-entry-fn, r=ZoxcMazdak Farrokhzad-32/+47
Querify `entry_fn` Analogous to https://github.com/rust-lang/rust/pull/57570 but this will also require few fixups in Miri so I decided to separate that (and it seems [CI doesn't let us break tools anymore](https://github.com/rust-lang/rust/pull/57392#issuecomment-453801540)? Or was that because it was a rollup PR?) r? @nikomatsakis
2019-01-19Auto merge of #57253 - Zoxc:incr-passes2, r=michaelwoeristerbors-5/+34
Make privacy checking, intrinsic checking and liveness checking incremental Blocked on https://github.com/rust-lang/rust/pull/51487 r? @michaelwoerister
2019-01-18Rollup merge of #57302 - sinkuu:unused_assignments_fp, r=estebankMazdak Farrokhzad-23/+6
Fix unused_assignments false positive Fixes #22630. In liveness analysis, make `continue` jump to the loop condition's `LiveNode` (`cond` as in comment) instead of the loop's one (`expr`). https://github.com/rust-lang/rust/blob/069b0c410808c1d1d33b495e048b1186e9f8d57f/src/librustc/middle/liveness.rs#L1358-L1370
2019-01-17Remove `hir::StmtKind::Decl`.Nicholas Nethercote-57/+43
It's a level of indirection that hurts far more than it helps. The code is simpler without it. (This commit cuts more than 120 lines of code.) In particular, this commit removes some unnecessary `Span`s within `DeclKind` that were always identical to those in the enclosing `Stmt`, and some unnecessary allocations via `P`.
2019-01-17Make `hir::Stmt` a separate struct.Nicholas Nethercote-6/+6
Benefits: - It lets us move the `NodeId` field out of every `hir::StmtKind` variant `NodeId` to a more sensible spot. - It eliminates sadness in `Stmt::fmt`. - It makes `hir::Stmt` match `ast::Stmt`.
2019-01-16Auto merge of #57321 - petrochenkov:atokens, r=nikomatsakisbors-10/+3
Implement basic input validation for built-in attributes Correct top-level shape (`#[attr]` vs `#[attr(...)]` vs `#[attr = ...]`) is enforced for built-in attributes, built-in attributes must also fit into the "meta-item" syntax (aka the "classic attribute syntax"). For some subset of attributes (found by crater run), errors are lowered to deprecation warnings. NOTE: This PR previously included https://github.com/rust-lang/rust/pull/57367 as well.
2019-01-15Querify entry_fnIgor Matuszewski-32/+47
2019-01-15Make privacy checking, intrinsic checking and liveness checking incrementalJohn Kåre Alsaker-5/+34
2019-01-14Rollup merge of #57572 - Centril:unaccept-extern-in-path, r=petrochenkovMazdak Farrokhzad-1/+1
Unaccept `extern_in_paths` Based on completed fcp-close in https://github.com/rust-lang/rust/issues/55600, this removes `extern_in_path` (e.g. `extern::foo::bar`) from the language. The changes are primarily reversing https://github.com/rust-lang/rust/commit/32db83b16e06cb5cca72d0e6a648a8008eda0fac. Closes https://github.com/rust-lang/rust/issues/55600 r? @petrochenkov
2019-01-13remove extern_in_paths.Mazdak Farrokhzad-1/+1
2019-01-13Implement basic input validation for built-in attributesVadim Petrochenkov-10/+3
2019-01-11Address commentsJohn Kåre Alsaker-2/+2
2019-01-11Make more passes incrementalJohn Kåre Alsaker-3/+17
2019-01-03CleanupShotaro Yamada-19/+1
`for` loops are no longer closures.
2019-01-03Fix unused_assignments false positiveShotaro Yamada-5/+6
Make `continue` jump to the loop condition's `LiveNode` instead of one of the loop body.
2019-01-02rename `type_moves_by_default` to `type_is_copy_modulo_regions`Niko Matsakis-8/+9
2018-12-31Auto merge of #57044 - varkor:E0512-equal-type, r=matthewjasperbors-7/+12
Add specific diagnostic when attempting to transmute between equal generic types Also clarifies the wording of E0512. Fixes https://github.com/rust-lang/rust/issues/49793.
2018-12-29Auto merge of #56225 - alexreg:type_alias_enum_variants, r=petrochenkovbors-4/+4
Implement RFC 2338, "Type alias enum variants" This PR implements [RFC 2338](https://github.com/rust-lang/rfcs/pull/2338), allowing one to write code like the following. ```rust #![feature(type_alias_enum_variants)] enum Foo { Bar(i32), Baz { i: i32 }, } type Alias = Foo; fn main() { let t = Alias::Bar(0); let t = Alias::Baz { i: 0 }; match t { Alias::Bar(_i) => {} Alias::Baz { i: _i } => {} } } ``` Since `Self` can be considered a type alias in this context, it also enables using `Self::Variant` as both a constructor and pattern. Fixes issues #56199 and #56611. N.B., after discussing the syntax for type arguments on enum variants with @petrochenkov and @eddyb (there are also a few comments on the [tracking issue](https://github.com/rust-lang/rust/issues/49683)), the consensus seems to be treat the syntax as follows, which ought to be backwards-compatible. ```rust Option::<u8>::None; // OK Option::None::<u8>; // OK, but lint in near future (hard error next edition?) Alias::<u8>::None; // OK Alias::None::<u8>; // Error ``` I do not know if this will need an FCP, but let's start one if so.
2018-12-28Add specific diagnostic for transmuting between equal associated typesvarkor-0/+4
2018-12-28Clarify wording of E0512varkor-7/+8
2018-12-27AST/HIR: Introduce `ExprKind::Err` for better error recovery in the front-endVadim Petrochenkov-4/+7
2018-12-26Store `Ident` rather than just `Name` in HIR types `Item` and `ForeignItem`.Alexander Regueiro-4/+4
2018-12-25Remove licensesMark Rousskov-220/+0
2018-12-23Rollup merge of #56953 - oli-obk:dead_const, r=petrochenkovMazdak Farrokhzad-42/+38
Mark tuple structs as live if their constructors are used fixes https://github.com/rust-lang/rust/issues/56281
2018-12-22Auto merge of #56805 - mikeyhew:stabilize-pin-as-receiver, r=nikomatsakisbors-0/+1
Stabilize `Rc`, `Arc` and `Pin` as method receivers Replaces #55880 Closes #55786 r? @nikomatsakis cc @withoutboats @cramertj This lets you write methods using `self: Rc<Self>`, `self: Arc<Self>`, `self: Pin<&mut Self>`, `self: Pin<Box<Self>`, and other combinations involving `Pin` and another stdlib receiver type, without needing the `arbitrary_self_types`. Other user-created receiver types can be used, but they still require the feature flag to use. This is implemented by introducing a new trait, `Receiver`, which the method receiver's type must implement if the `arbitrary_self_types` feature is not enabled. To keep composed receiver types such as `&Arc<Self>` unstable, the receiver type is also required to implement `Deref<Target=Self>` when the feature flag is not enabled. This lets you use `self: Rc<Self>` and `self: Arc<Self>` in stable Rust, which was not allowed previously. It was agreed that they would be stabilized in #55786. `self: Pin<&Self>` and other pinned receiver types do not require the `arbitrary_self_types` feature, but they cannot be used on stable because `Pin` still requires the `pin` feature.
2018-12-20Auto merge of #54125 - varkor:less-conservative-uninhabitedness-check, ↵bors-4/+4
r=nikomatsakis Less conservative uninhabitedness check Extends the uninhabitedness check to structs, non-empty enums, tuples and arrays. Pulled out of #47291 and #50262. Fixes https://github.com/rust-lang/rust/issues/54586. r? @nikomatsakis