diff options
| author | Nick Cameron <ncameron@mozilla.com> | 2016-05-28 21:50:25 +0100 |
|---|---|---|
| committer | Nick Cameron <ncameron@mozilla.com> | 2016-05-29 09:32:48 +0100 |
| commit | bbb6038b92aa1ce17eebad96a904543e867f18b2 (patch) | |
| tree | 2ed3eaa253cdc221a00fd030126489f4f6421d8e /tests | |
| parent | 6e01fac285169c24db8e8c64d3bea0d368197650 (diff) | |
Treat chains with just expr? specially.
Fixes #1004
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/source/chains.rs | 15 | ||||
| -rw-r--r-- | tests/target/chains.rs | 13 |
2 files changed, 28 insertions, 0 deletions
diff --git a/tests/source/chains.rs b/tests/source/chains.rs index 66c982082e7..deed8f6d8d8 100644 --- a/tests/source/chains.rs +++ b/tests/source/chains.rs @@ -133,3 +133,18 @@ fn try_shorthand() { |tcx| tcx.lookup_item_type(def_id).generics)?; fooooooooooooooooooooooooooo()?.bar()?.baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaz()?; } + +fn issue_1004() { + match *self { + ty::ImplOrTraitItem::MethodTraitItem(ref i) => write!(f, "{:?}", i), + ty::ImplOrTraitItem::ConstTraitItem(ref i) => write!(f, "{:?}", i), + ty::ImplOrTraitItem::TypeTraitItem(ref i) => write!(f, "{:?}", i), + } + ?; + + ty::tls::with(|tcx| { + let tap = ty::Binder(TraitAndProjections(principal, projections)); + in_binder(f, tcx, &ty::Binder(""), Some(tap)) + }) + ?; +} diff --git a/tests/target/chains.rs b/tests/target/chains.rs index 3004946fb56..bdcb9fbd60e 100644 --- a/tests/target/chains.rs +++ b/tests/target/chains.rs @@ -162,3 +162,16 @@ fn try_shorthand() { .bar()? .baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaz()?; } + +fn issue_1004() { + match *self { + ty::ImplOrTraitItem::MethodTraitItem(ref i) => write!(f, "{:?}", i), + ty::ImplOrTraitItem::ConstTraitItem(ref i) => write!(f, "{:?}", i), + ty::ImplOrTraitItem::TypeTraitItem(ref i) => write!(f, "{:?}", i), + }?; + + ty::tls::with(|tcx| { + let tap = ty::Binder(TraitAndProjections(principal, projections)); + in_binder(f, tcx, &ty::Binder(""), Some(tap)) + })?; +} |
