1285 Commits

Author SHA1 Message Date
Eduard-Mihai Burtescu
fff08cb043 Run rustfmt --file-lines ... for changes from previous commits. 2019-06-12 13:38:28 +03:00
Eduard-Mihai Burtescu
17cdd356da rustc: replace TyCtxt<'tcx, 'gcx, 'tcx> with TyCtxt<'gcx, 'tcx>. 2019-06-12 13:38:27 +03:00
Eduard-Mihai Burtescu
2441253508 Fix fallout from deny(unused_lifetimes). 2019-06-12 13:38:27 +03:00
Eduard-Mihai Burtescu
37799a5552 rustc: replace TyCtxt<'a, 'gcx, 'tcx> with TyCtxt<'tcx, 'gcx, 'tcx>. 2019-06-12 13:38:27 +03:00
Eduard-Mihai Burtescu
d110d309b6 rustc_mir: deny(unused_lifetimes). 2019-06-11 14:11:58 +03:00
Jad Ghalayini
80ff07f30d Changed usages of mir in librustc::mir and librustc_mir to body 2019-06-09 16:05:05 -04:00
Mazdak Farrokhzad
9ab654c53e
Rollup merge of #61332 - kennethbgoodin:borrowck-remove-asterisk-suggestion, r=matthewjasper
Remove asterisk suggestion for move errors in borrowck

As per the decision in #54985 completely removes the suggestion to add an asterisk when checking move errors. I believe I've preserved the correct behavior with the "consider borrowing here" branch of the original match arm, but I'm not positive on that.

This is my first PR to rustc so any feedback is greatly appreciated. Thanks.
2019-06-07 16:48:02 +02:00
Matthew Jasper
6c9a018b60 Don't run MIR passes on constructor shims 2019-06-06 16:10:37 +01:00
bors
740668dbd9 Auto merge of #57428 - alexreg:associated_type_bounds, r=nikomatsakis,Centril
Implementation of RFC 2289 (associated_type_bounds)

This PR implements the [`asociated_type_bounds` feature](https://github.com/rust-lang/rfcs/blob/master/text/2289-associated-type-bounds.md).

Associated type bounds are implemented in:
   - function/method arguments and return types
   - structs, enums, unions
   - associated items in traits
   - type aliases
   - type parameter defaults
   - trait objects
   - let bindings

CC @nikomatsakis @centril
2019-06-06 03:56:22 +00:00
Alexander Regueiro
35585c499f Aggregation of drive-by cosmetic changes. 2019-06-05 21:09:26 +01:00
varkor
4dcc49c685 Refactor TypeVariableOrigin into TypeVariableOrigin and TypeVariableOriginKind 2019-06-05 16:45:16 +01:00
Pietro Albini
d5643be9b4
Rollup merge of #61488 - matthewjasper:fix-nll-typeck-ices, r=pnkfelix
Fix NLL typeck ICEs

* Don't ICE when a type containing a region is constrained by nothing
* Don't ICE trying to normalize a type in a `ParamEnv` containing global bounds.

To explain what was happening in the `issue-61311-normalize.rs` case:

* When borrow checking the `the_fn` in the last `impl` we would try to normalize `Self::Proj` (`<Unit as HasProjFn>::Proj`).
* We would find the `impl` that we're checking and and check its `where` clause.
* This would need us to check `<Box<dyn Obj + 'static> as HasProj>::Proj: Bound`
* We find two possible implementations, the blanket impl and the bound in our `ParamEnv`.
* The bound in our `ParamEnv` was canonicalized, so we don't see it as a global bound. As such we prefer it to the `impl`.
* This means that we cannot normalize `<Box<dyn Obj + 'static> as HasProj>::Proj` to `Unit`.
* The `<Box<dyn Obj + 'static> as HasProj>::Proj: Bound` bound, which looks like it should be in our `ParamEnv` has been normalized to `Unit: Bound`.
* We fail to prove `<Box<dyn Obj + 'static> as HasProj>::Proj: Bound`.
* We ICE, since we believe typeck have errored.

Closes #61311
Closes #61315
Closes #61320

r? @pnkfelix
cc @nikomatsakis
2019-06-04 22:39:38 +02:00
Kenny Goodin
de677b993f Remove asterisk suggestion for move errors in borrowck
As per issue #54985 removes the not useful suggestion to remove asterisk in
move errors. Includes minor changes to tests in the `ui` suite to account
for the removed suggestion.
2019-06-04 13:31:40 -04:00
bors
021a503309 Auto merge of #61136 - matthewjasper:cannot-move-errors, r=pnkfelix
Make cannot move errors more consistent with other borrowck errors

* Note the type of the place being moved in all cases.
* Note the place being moved from.
* Simplify the search for overloaded place operators
* Extend the note for move from overloaded deref apply to all types.
* Add a note for moves from overloaded index.
* Special case moves for closure captures.

r? @pnkfelix
2019-06-04 08:31:53 +00:00
Mazdak Farrokhzad
f8a236394c
Rollup merge of #61446 - czipperz:nll-unused_mut, r=matthewjasper
On TerminatorKind::DropAndReplace still handle unused_mut correctly

Closes #61424

- [x] Todo add regression test
2019-06-04 04:48:21 +02:00
Matthew Jasper
9336b3d3d0 Use UseSpans in cannot move errors 2019-06-03 14:55:29 +01:00
Matthew Jasper
f7e86a5a49 Improve cannot move errors
* Show the place and type being moved
* Give a special error for variables in match guard
* Simplify search for overloaded deref
* Search for overloaded index
2019-06-03 14:55:29 +01:00
Matthew Jasper
2751b867a7 Don't try to lower ReEmpty in NLL 2019-06-03 13:46:38 +01:00
Matthew Jasper
f309f917c2 Add method to note types don't implement Copy 2019-06-03 12:59:08 +01:00
Matthew Jasper
5cfa70f760 Add is_ref_for_guard method 2019-06-03 12:59:08 +01:00
bors
d461555e44 Auto merge of #61460 - Centril:rollup-8txhjx4, r=Centril
Rollup of 6 pull requests

Successful merges:

 - #61380 (Fix some issues with `unwrap_usize` instead of `assert_usize`)
 - #61423 (codegen: change `$6d$` to `$u6d$`)
 - #61438 (Point at individual type args on arg count mismatch)
 - #61441 (Tweak wording when encountering `fn` call in pattern)
 - #61451 (Fix missing semicolon in doc)
 - #61458 (Fix typo in AsRef doc)

Failed merges:

r? @ghost
2019-06-02 14:42:11 +00:00
Mazdak Farrokhzad
c748c7b3fe
Rollup merge of #61380 - varkor:expected-usize-got-param, r=eddyb
Fix some issues with `unwrap_usize` instead of `assert_usize`

Fixes https://github.com/rust-lang/rust/issues/61337.
Fixes https://github.com/rust-lang/rust/issues/61341.
Fixes https://github.com/rust-lang/rust/issues/61422.

r? @eddyb
2019-06-02 15:23:46 +02:00
varkor
21551359a5 Use assert_usize instead of unwrap_usize in several places 2019-06-02 01:55:44 +01:00
Chris Gregory
2a3b29ef97 Add anonymous lifetime to Place parameter 2019-06-01 19:06:22 -05:00
Chris Gregory
0a6a5c81ac Move debug statement into statement visitor 2019-06-01 19:05:18 -05:00
Chris Gregory
a39fffea22 Add self parameter 2019-06-01 19:05:08 -05:00
Chris Gregory
c25b3df3e5
Elide lifetimes not used
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2019-06-01 16:50:15 -07:00
Chris Gregory
911d205b1f On TerminatorKind::DropAndReplace still handle unused_mut correctly 2019-06-01 18:42:59 -05:00
Eduard-Mihai Burtescu
961fe5479f rustc: use indexmap instead of a plain vector for upvars. 2019-06-01 19:17:22 +03:00
Eduard-Mihai Burtescu
26e61dd826 rustc: replace Res in hir::Upvar with only Local/Upvar data. 2019-06-01 19:01:09 +03:00
Yuki Okushi
8f34a50cc5 Remove ty::BrFresh and new_bound 2019-05-31 15:09:04 +09:00
Oliver Scherer
20f462d9fc
Rollup merge of #61261 - spastorino:is-union-return-ty, r=oli-obk
is_union returns ty to avoid computing it twice

r? @oli-obk
2019-05-29 14:41:06 +02:00
Mazdak Farrokhzad
dcfc15b23c
Rollup merge of #61249 - spastorino:local-or-deref-local, r=oli-obk,Centril
Rename Place::local to Place::local_or_deref_local

r? @oli-obk
2019-05-29 08:15:59 +02:00
Mazdak Farrokhzad
ee08261c8c
Rollup merge of #60928 - TheSirC:fix/60229, r=eddyb
Changes the type `mir::Mir` into `mir::Body`

Fixes part 1 of #60229 (previously attempted in #60242).

I stumbled upon the issue and it seems that the previous attempt at solving it was not merged. This is a second try more up-to-date.

The commit should have changed comments as well.
At the time of writting, it passes the tidy and check tool.
2019-05-29 00:19:55 +02:00
varkor
c94ba6382d Rename OpportunisticTypeResolver to OpportunisticVarResolver 2019-05-28 21:34:42 +01:00
Claude-Alban RANÉLY-VERGÉ-DÉPRÉ
6e5e0daff2 Changes the type mir::Mir into mir::Body
The commit should have changed comments as well.
At the time of writting, it passes the tidy and check tool.

Revisions asked by eddyb :
- Renamed of all the occurences of {visit/super}_mir
- Renamed test structures `CachedMir` to `Cached`

Fixing the missing import on `AggregateKind`
2019-05-28 19:17:51 +02:00
Santiago Pastorino
5e4d83e972 Rename Place::local to Place::local_or_deref_local 2019-05-28 18:50:55 +02:00
Santiago Pastorino
bb94fc0069 Use closure to avoid self.describe_place(...).unwrap_or_else(...) repetition 2019-05-28 18:30:27 +02:00
Santiago Pastorino
1b86bd73cd is_union returns ty to avoid computing it twice 2019-05-28 18:29:40 +02:00
bors
ed2a5115da Auto merge of #61147 - estebank:suggest-as-ref, r=oli-obk
When encountering move error on an `Option`, suggest using `as_ref`

Fix #61109, cc #15457.
2019-05-27 01:10:22 +00:00
Mazdak Farrokhzad
b4a3d44a87
Rollup merge of #61144 - estebank:issue-61108, r=matthewjasper
Suggest borrowing for loop head on move error

Fix #61108.
2019-05-26 02:13:27 +02:00
Esteban Küber
1cc42ea675 Add support for suggesting as_ref to Result accesses 2019-05-25 11:12:41 -07:00
bors
02f5786a32 Auto merge of #61151 - Centril:rollup-5rpyhfo, r=Centril
Rollup of 6 pull requests

Successful merges:

 - #61092 (Make sanitize_place iterate instead of recurse)
 - #61093 (Make borrow_of_local_data iterate instead of recurse)
 - #61094 (Make find_local iterate instead of recurse)
 - #61099 (Make ignore_borrow iterate instead of recurse)
 - #61103 (Make find iterate instead of recurse)
 - #61104 (Make eval_place_to_op iterate instead of recurse)

Failed merges:

r? @ghost
2019-05-25 09:30:02 +00:00
Mazdak Farrokhzad
e30300d6e8
Rollup merge of #61099 - spastorino:ignore-borrow-iterate, r=oli-obk
Make ignore_borrow iterate instead of recurse

r? @oli-obk
2019-05-25 04:57:36 +02:00
Mazdak Farrokhzad
b4f6e5baeb
Rollup merge of #61093 - spastorino:borrow-of-local-data-iterate, r=oli-obk
Make borrow_of_local_data iterate instead of recurse

r? @oli-obk
2019-05-25 04:57:33 +02:00
Mazdak Farrokhzad
1ce0288e2f
Rollup merge of #61092 - spastorino:sanitize-place-iterative, r=oli-obk
Make sanitize_place iterate instead of recurse

r? @oli-obk
2019-05-25 04:57:32 +02:00
Esteban Küber
4b0963653e When encountering move error on an Option, suggest using as_ref 2019-05-24 19:10:00 -07:00
Esteban Küber
274b7e49e0 Suggest borrowing for loop head on move error 2019-05-24 18:23:43 -07:00
Santiago Pastorino
10fe26962c Make ignore_borrow iterate instead of recurse 2019-05-24 19:43:42 +02:00
Santiago Pastorino
9613779855 Make borrow_of_local_data iterate instead of recurse 2019-05-24 18:42:04 +02:00