Merge pull request #3142 from topecongiro/issue-3139

Do not remove path disambiugator inside macro
This commit is contained in:
Nick Cameron 2018-10-29 11:08:38 +13:00 committed by GitHub
commit 42780f0b39
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 1 deletions

View file

@ -229,7 +229,9 @@ fn rewrite_segment(
.chain(data.bindings.iter().map(|x| SegmentParam::Binding(&*x)))
.collect::<Vec<_>>();
let separator = if path_context == PathContext::Expr {
let force_separator =
context.inside_macro() && context.snippet(data.span).starts_with("::");
let separator = if path_context == PathContext::Expr || force_separator {
"::"
} else {
""

View file

@ -121,3 +121,11 @@ fn issue3117() {
}
}
}
// #3139
fn issue3139() {
assert_eq!(
to_json_value(&None :: <i32>).unwrap(),
json!( { "test": None :: <i32> } )
);
}

View file

@ -120,3 +120,11 @@ fn issue3117() {
}
}
}
// #3139
fn issue3139() {
assert_eq!(
to_json_value(&None::<i32>).unwrap(),
json!({ "test": None::<i32> })
);
}