diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-12-06 20:59:51 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2019-12-06 20:59:51 +0000 |
commit | 431836f4a01dda39d10f6275915f9c8e99a28028 (patch) | |
tree | 0cb8ceaa2e07b30da2f841d792e505df6b460d41 /crates/ra_hir | |
parent | f18b7e18c479144325ec150be00837aae3329ae2 (diff) | |
parent | b2c01f446edcbc12b5dd870064cbfc6c1a47eb8b (diff) |
Merge #2489
2489: Implement `format_args` r=flodiebold a=flodiebold
This fixes a huge amount of type mismatches (because every format call was a type mismatch so far); I also hoped to get go to def working within `format!` etc., and the test says it should, but in practice it still doesn't seem to...
Also remove the `len` parameter from `Name::new_inline_ascii`, which I'm assuming was only there because of `const fn` limitations?
cc @edwin0cheng
Co-authored-by: Florian Diebold <[email protected]>
Diffstat (limited to 'crates/ra_hir')
-rw-r--r-- | crates/ra_hir/src/source_binder.rs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/crates/ra_hir/src/source_binder.rs b/crates/ra_hir/src/source_binder.rs index 42c392513..0e136b904 100644 --- a/crates/ra_hir/src/source_binder.rs +++ b/crates/ra_hir/src/source_binder.rs | |||
@@ -76,12 +76,13 @@ fn def_with_body_from_child_node( | |||
76 | db: &impl HirDatabase, | 76 | db: &impl HirDatabase, |
77 | child: InFile<&SyntaxNode>, | 77 | child: InFile<&SyntaxNode>, |
78 | ) -> Option<DefWithBody> { | 78 | ) -> Option<DefWithBody> { |
79 | child.value.ancestors().find_map(|node| { | 79 | child.cloned().ancestors_with_macros(db).find_map(|node| { |
80 | let n = &node.value; | ||
80 | match_ast! { | 81 | match_ast! { |
81 | match node { | 82 | match n { |
82 | ast::FnDef(def) => { return Function::from_source(db, child.with_value(def)).map(DefWithBody::from); }, | 83 | ast::FnDef(def) => { return Function::from_source(db, node.with_value(def)).map(DefWithBody::from); }, |
83 | ast::ConstDef(def) => { return Const::from_source(db, child.with_value(def)).map(DefWithBody::from); }, | 84 | ast::ConstDef(def) => { return Const::from_source(db, node.with_value(def)).map(DefWithBody::from); }, |
84 | ast::StaticDef(def) => { return Static::from_source(db, child.with_value(def)).map(DefWithBody::from); }, | 85 | ast::StaticDef(def) => { return Static::from_source(db, node.with_value(def)).map(DefWithBody::from); }, |
85 | _ => { None }, | 86 | _ => { None }, |
86 | } | 87 | } |
87 | } | 88 | } |
@@ -135,6 +136,7 @@ pub struct ReferenceDescriptor { | |||
135 | pub name: String, | 136 | pub name: String, |
136 | } | 137 | } |
137 | 138 | ||
139 | #[derive(Debug)] | ||
138 | pub struct Expansion { | 140 | pub struct Expansion { |
139 | macro_file_kind: MacroFileKind, | 141 | macro_file_kind: MacroFileKind, |
140 | macro_call_id: MacroCallId, | 142 | macro_call_id: MacroCallId, |