Commit Graph

325 Commits

Author SHA1 Message Date
csmoe 64f61c7888 remove indexed_vec re-export from rustc_data_structures 2019-09-29 16:48:31 +00:00
Mazdak Farrokhzad 017944c5a7
Rollup merge of #64859 - Centril:const-def-here-new-var, r=estebank
check_match: improve diagnostics for `let A = 2;` with `const A: i32 = 3`

For example:

```
error[E0005]: refutable pattern in local binding: `std::i32::MIN..=1i32` and `3i32..=std::i32::MAX` not covered
  --> $DIR/const-pat-non-exaustive-let-new-var.rs:2:9
   |
LL |     let A = 3;
   |         ^
   |         |
   |         interpreted as a constant pattern, not a new variable
   |         help: introduce a variable instead: `a_var`
...
LL |     const A: i32 = 2;
   |     ----------------- constant defined here
```

r? @estebank
cc @matthiaskrgr @rpjohnst
2019-09-28 05:38:00 +02:00
Mazdak Farrokhzad aa03f1f5e3 Improve diagnostic for `let A = 0;`
where `A` is a constant, not a new variable.
2019-09-28 03:07:31 +02:00
Esteban Küber a284822e00 fix rebase 2019-09-27 09:47:37 -07:00
Esteban Küber e537d066f2 review comments 2019-09-27 09:34:51 -07:00
Esteban Küber 46a38dc183 Account for tail expressions when pointing at return type
When there's a type mismatch we make an effort to check if it was
caused by a function's return type. This logic now makes sure to
only point at the return type if the error happens in a tail
expression.
2019-09-27 09:34:51 -07:00
Esteban Küber faee8e1756 Turn `walk_parent_nodes` method into an iterator 2019-09-27 09:34:03 -07:00
varkor b474867961 Rename `ForeignItem.node` to `ForeignItem.kind` 2019-09-26 18:21:48 +01:00
varkor 7bc94cc3c2 Rename `Item.node` to `Item.kind` 2019-09-26 18:21:48 +01:00
varkor 21bf983acb Rename `Stmt.node` to `Stmt.kind` 2019-09-26 18:21:10 +01:00
varkor d4573c9c1e Rename `TraitItem.node` to `TraitItem.kind` 2019-09-26 18:21:09 +01:00
varkor ce6aabbaa1 Rename `ImplItem.node` to `ImplItem.kind` 2019-09-26 18:21:09 +01:00
varkor 8bd0382134 Rename `Pat.node` to `Pat.kind` 2019-09-26 18:21:09 +01:00
varkor 95f6d72a60 Rename `Expr.node` to `Expr.kind`
For both `ast::Expr` and `hir::Expr`.
2019-09-26 18:21:09 +01:00
Mazdak Farrokhzad c26f1296d2
Rollup merge of #62975 - ljedrz:kill_off_hir_to_node_id, r=Zoxc
Almost fully deprecate hir::map::Map.hir_to_node_id

- HirIdify `doctree::Module.id`
- HirIdify `hir::Crate.modules`
- introduce a `HirId` to `DefIndex` map in `map::Definitions`

The only last uses of `hir::map::Map.hir_to_node_id` in the compiler are:
- for the purposes of `driver::pretty` (in `map::nodes_matching_suffix`), but I don't know if we can remove `NodeId`s in there (I think when I attempted it previously there was some issue due to `HirId` not being representable with an integer)
- in `ty::query::on_disk_cache` (not sure about the purpose of this one)
- in `mir::transform::check_unsafety` (only important for error message order)

Any suggestions how to kill these off?

r? @Zoxc
2019-09-25 16:26:14 +02:00
Alexander Regueiro c1d29ee3c7 Aggregation of cosmetic changes made during work on REPL PRs: librustc 2019-09-07 16:27:19 +01:00
Kevin Per e0ce9f8c0a Cleanup: Consistently use `Param` instead of `Arg` #62426 2019-08-27 14:07:41 +02:00
ljedrz 9a6ca41371 HirIdify hir::Crate.modules 2019-08-25 11:57:36 +02:00
Esteban Küber 4971667f17 review comments 2019-08-21 16:11:01 -07:00
Esteban Küber 8c07d7814d When declaring a declarative macro in an item it's only accessible inside it 2019-08-21 15:41:51 -07:00
Mazdak Farrokhzad ad44d42750
Rollup merge of #63543 - c410-f3r:variant, r=c410-f3r
Merge Variant and Variant_

Extracted from #63468.
2019-08-14 22:56:29 +02:00
Caio 6a42b0b28d Merge Variant and Variant_ 2019-08-14 14:47:01 -03:00
Esteban Küber 939c1cb349 review comments 2019-08-13 11:24:08 -07:00
Esteban Küber fb2511c3c5 Suggest `Box::new` when appropriate
When encountering a boxed value as expected and a stack allocated value
that could be boxed to fulfill the expectation, like in the following
snippet, suggest `Box::new` wrapping.
2019-08-12 20:24:30 -07:00
Esteban Küber 52da091ee6 Differentiate between tuple structs and tuple variants 2019-08-09 07:18:05 -07:00
varkor 63659ca9f6 Rename `ItemImplKind::Type` to `ItemImplKind::TyAlias` 2019-08-04 20:16:41 +01:00
varkor 8aa45c65d8 Rename `ItemKind::Ty` to `ItemKind::TyAlias` 2019-08-04 20:13:37 +01:00
varkor b4fe555796 Replace `exist_ty` and `ExistTy` with `opaque_ty` and `OpaqueTy` 2019-08-02 02:44:36 +01:00
varkor c28ce3e4ca Replace "existential" by "opaque" 2019-08-02 02:44:36 +01:00
Caio 53fc7fbc96 Lint attributes on function arguments 2019-07-27 07:16:21 -03:00
Mazdak Farrokhzad 7697b2927f
Rollup merge of #62476 - petrochenkov:expref, r=matthewjasper
Continue refactoring macro expansion and resolution

This PR continues the work started in https://github.com/rust-lang/rust/pull/62042.
It contains a set of more or less related refactorings with the general goal of making things simpler and more orthogonal.
Along the way most of the issues uncovered in https://github.com/rust-lang/rust/pull/62086 are fixed.

The PR is better read in per-commit fashion with whitespace changes ignored.
I tried to leave some more detailed commit messages describing the motivation behind the individual changes.

Fixes https://github.com/rust-lang/rust/issues/44692
Fixes https://github.com/rust-lang/rust/issues/52363
Unblocks https://github.com/rust-lang/rust/pull/62086
r? @matthewjasper
2019-07-11 04:33:17 +02:00
Vadim Petrochenkov e272946066 def_collector: Simplify tracking of macro invocation parents
Avoid the tricky scheme with callbacks and keep the invocation parent data where it logically belongs - in `Definitions`.

This also allows to create `InvocationData` entries in resolve when the data is actually ready, and remove cells and "uninitialized" variants from it.
2019-07-11 00:12:08 +03:00
Mark Rousskov daf1b29f29 Properly case indent_unit constant 2019-07-10 07:13:22 -04:00
Mark Rousskov cab453250a Move pp::Printer helpers to direct impl 2019-07-10 07:13:20 -04:00
Mazdak Farrokhzad f8b32dfb27 Remove ExprKind::While from HIR. 2019-07-06 06:43:58 +02:00
Mazdak Farrokhzad 2e86c006f7
Rollup merge of #62168 - ljedrz:the_culmination_of_hiridification, r=Zoxc
The (almost) culmination of HirIdification

It's finally over.

This PR removes old `FIXME`s and renames some functions so that the `HirId` variant has the shorter name.
All that remains (and rightfully so) is stuff in `resolve`, `save_analysis` and (as far as I can tell) in a few places where we can't replace `NodeId` with `HirId`.
2019-07-05 20:26:56 +02:00
bors f119bf2761 Auto merge of #62099 - Mark-Simulacrum:syntax-print-clean-2, r=eddyb
Remove io::Result from syntax::print

Since we're now writing directly to the vector, there's no need to
thread results through the whole printing infrastructure
2019-07-05 06:55:48 +00:00
ljedrz c6131b23ae rename hir::map::opt_local_def_id* 2019-07-04 12:53:12 +02:00
ljedrz 37d7e1f22a rename hir::map::local_def_id_from_hir_id to local_def_id 2019-07-04 12:53:12 +02:00
ljedrz 4f7ba515c2 rename hir::map::local_def_id to local_def_id_from_node_id 2019-07-04 12:29:26 +02:00
ljedrz 7987719dbe remove FIXMEs for functions that won't go away 2019-07-04 12:29:26 +02:00
Jeremy Stucki 0477e07272
Remove needless lifetimes 2019-07-03 10:00:26 +02:00
Mark Rousskov da5c835c8b Remove io::Result from syntax::print
Since we're now writing directly to the vector, there's no need to
thread results through the whole printing infrastructure
2019-06-29 09:10:17 -04:00
ljedrz f05cbc98f8 HIR: rename find_by_hir_id to find 2019-06-24 09:58:49 +02:00
ljedrz 90de9edce5 HIR: remove the NodeId find 2019-06-24 09:55:11 +02:00
ljedrz d08bd72e97 HIR: rename get_parent_node_by_hir_id to get_parent_node 2019-06-24 09:46:38 +02:00
ljedrz c7e1f4dcb7 HIR: remove the NodeId get_parent_node, HirIdify is_argument 2019-06-24 09:41:29 +02:00
ljedrz 73cb9ab526 rename hir::map::get_by_hir_id to get 2019-06-20 12:50:06 +02:00
ljedrz a64456e48e remove hir::map::get 2019-06-20 12:47:26 +02:00
ljedrz fe044a8bc2 rename hir::map::expect_expr_by_hir_id to expect_expr 2019-06-20 12:47:26 +02:00