mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-05 05:04:24 +00:00
Merge pull request #2238 from topecongiro/issue-1209
Format a macro in the type position
This commit is contained in:
commit
c4c3f5ba1e
@ -23,6 +23,7 @@ use expr::{rewrite_pair, rewrite_tuple, rewrite_unary_prefix, wrap_args_with_par
|
||||
use items::{format_generics_item_list, generics_shape_from_config};
|
||||
use lists::{definitive_tactic, itemize_list, write_list, ListFormatting, ListTactic, Separator,
|
||||
SeparatorPlace, SeparatorTactic};
|
||||
use macros::{rewrite_macro, MacroPosition};
|
||||
use rewrite::{Rewrite, RewriteContext};
|
||||
use shape::Shape;
|
||||
use utils::{colon_spaces, extra_offset, first_line_width, format_abi, format_mutability,
|
||||
@ -726,7 +727,9 @@ impl Rewrite for ast::Ty {
|
||||
}
|
||||
ast::TyKind::BareFn(ref bare_fn) => rewrite_bare_fn(bare_fn, self.span, context, shape),
|
||||
ast::TyKind::Never => Some(String::from("!")),
|
||||
ast::TyKind::Mac(..) => None,
|
||||
ast::TyKind::Mac(ref mac) => {
|
||||
rewrite_macro(mac, None, context, shape, MacroPosition::Expression)
|
||||
}
|
||||
ast::TyKind::ImplicitSelf => Some(String::from("")),
|
||||
ast::TyKind::ImplTrait(ref it) => it.rewrite(context, shape)
|
||||
.map(|it_str| format!("impl {}", it_str)),
|
||||
|
@ -224,3 +224,9 @@ fn special_case_macros() {
|
||||
// assert!
|
||||
assert!(result, "Arr! While plunderin' the hold, we got '{}' when given '{}' (we expected '{}')", result, input, expected);
|
||||
}
|
||||
|
||||
// #1209
|
||||
impl Foo {
|
||||
/// foo
|
||||
pub fn foo(&self) -> Bar<foo!( )> {}
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ fn main() {
|
||||
20, 21, 22);
|
||||
|
||||
// #1092
|
||||
chain!(input, a:take!(max_size), || []);
|
||||
chain!(input, a: take!(max_size), || []);
|
||||
}
|
||||
|
||||
impl X {
|
||||
@ -284,3 +284,9 @@ fn special_case_macros() {
|
||||
result, input, expected
|
||||
);
|
||||
}
|
||||
|
||||
// #1209
|
||||
impl Foo {
|
||||
/// foo
|
||||
pub fn foo(&self) -> Bar<foo!()> {}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user