aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src/goto_definition.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-12-06 20:59:51 +0000
committerGitHub <[email protected]>2019-12-06 20:59:51 +0000
commit431836f4a01dda39d10f6275915f9c8e99a28028 (patch)
tree0cb8ceaa2e07b30da2f841d792e505df6b460d41 /crates/ra_ide/src/goto_definition.rs
parentf18b7e18c479144325ec150be00837aae3329ae2 (diff)
parentb2c01f446edcbc12b5dd870064cbfc6c1a47eb8b (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_ide/src/goto_definition.rs')
-rw-r--r--crates/ra_ide/src/goto_definition.rs30
1 files changed, 30 insertions, 0 deletions
diff --git a/crates/ra_ide/src/goto_definition.rs b/crates/ra_ide/src/goto_definition.rs
index 76a741207..d3c198813 100644
--- a/crates/ra_ide/src/goto_definition.rs
+++ b/crates/ra_ide/src/goto_definition.rs
@@ -689,8 +689,38 @@ mod tests {
689 fo<|>o(); 689 fo<|>o();
690 } 690 }
691 } 691 }
692 mod confuse_index { fn foo(); }
692 ", 693 ",
693 "foo FN_DEF FileId(1) [52; 63) [55; 58)", 694 "foo FN_DEF FileId(1) [52; 63) [55; 58)",
694 ); 695 );
695 } 696 }
697
698 #[should_panic] // currently failing because of expr mapping problems
699 #[test]
700 fn goto_through_format() {
701 check_goto(
702 "
703 //- /lib.rs
704 #[macro_export]
705 macro_rules! format {
706 ($($arg:tt)*) => ($crate::fmt::format($crate::__export::format_args!($($arg)*)))
707 }
708 #[rustc_builtin_macro]
709 #[macro_export]
710 macro_rules! format_args {
711 ($fmt:expr) => ({ /* compiler built-in */ });
712 ($fmt:expr, $($args:tt)*) => ({ /* compiler built-in */ })
713 }
714 pub mod __export {
715 pub use crate::format_args;
716 fn foo() {} // for index confusion
717 }
718 fn foo() -> i8 {}
719 fn test() {
720 format!(\"{}\", fo<|>o())
721 }
722 ",
723 "foo FN_DEF FileId(1) [359; 376) [362; 365)",
724 );
725 }
696} 726}