1
Fork 0

default binding modes: add pat_binding_modes

This PR kicks off the implementation of the [default binding modes RFC][1] by
introducing the `pat_binding_modes` typeck table mentioned in the [mentoring
instructions][2].

`pat_binding_modes` is populated in `librustc_typeck/check/_match.rs` and
used wherever the HIR would be scraped prior to this PR. Unfortunately, one
blemish, namely a two callers to `contains_explicit_ref_binding`, remains.
This will likely have to be removed when the second part of [1], the
`pat_adjustments` table, is tackled. Appropriate comments have been added.

See #42640.

[1]: https://github.com/rust-lang/rfcs/pull/2005
[2]: https://github.com/rust-lang/rust/issues/42640#issuecomment-313535089
This commit is contained in:
Tobias Schottdorf 2017-07-21 19:29:43 -04:00
parent 5c71e4ef90
commit 851c77088d
22 changed files with 268 additions and 106 deletions

View file

@ -867,13 +867,14 @@ mod tests {
pat: P(ast::Pat {
id: ast::DUMMY_NODE_ID,
node: PatKind::Ident(
ast::BindingMode::ByValue(ast::Mutability::Immutable),
Spanned{
span: sp(6,7),
node: Ident::from_str("b")},
None
),
span: sp(6,7)
ast::BindingMode::ByValue(
ast::Mutability::Immutable),
Spanned{
span: sp(6,7),
node: Ident::from_str("b")},
None
),
span: sp(6,7)
}),
id: ast::DUMMY_NODE_ID
}],