Skip to content
This repository has been archived by the owner on Mar 1, 2019. It is now read-only.

Commit

Permalink
Prepare for #45468, update TupleVariant test
Browse files Browse the repository at this point in the history
  • Loading branch information
Xanewok committed Oct 29, 2017
1 parent 0dd939c commit d87417e
Show file tree
Hide file tree
Showing 67 changed files with 66 additions and 41 deletions.
28 changes: 14 additions & 14 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ categories = ["development-tools"]
[dependencies]
rustc-serialize = "0.3"
log = "0.3"
rls-data = { git = "https://github.com/Xanewok/rls-data", branch = "crate-source" }
rls-data = "0.12"
rls-span = "0.4"
derive-new = "0.5"

Expand Down
3 changes: 2 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,8 @@ impl<L: AnalysisLoader> AnalysisHost<L> {
match def.parent {
Some(p) => {
analysis.with_defs(p, |parent| match def.kind {
DefKind::Field | DefKind::Method | DefKind::Tuple => {
DefKind::Field | DefKind::Method | DefKind::Tuple |
DefKind::TupleVariant | DefKind::StructVariant => {
let ns = name_space_for_def_kind(def.kind);
let mut res = AnalysisHost::<L>::mk_doc_url(parent, analysis)
.unwrap_or_else(|| "".into());
Expand Down
2 changes: 1 addition & 1 deletion src/lowering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ where
let time = t_start.elapsed();
info!(
"Lowering {} in {:.2}s",
format!("{}-{}", id.name, id.disambiguator),
format!("{} ({:?})", id.name, id.disambiguator),
time.as_secs() as f64 + time.subsec_nanos() as f64 / 1_000_000_000.0
);
info!(" defs: {}", per_crate.defs.len());
Expand Down
4 changes: 2 additions & 2 deletions src/raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,6 @@ fn read_crate_data(path: &Path) -> Option<Analysis> {
pub fn name_space_for_def_kind(dk: DefKind) -> char {
match dk {
DefKind::Enum |
DefKind::TupleVariant |
DefKind::StructVariant |
DefKind::Struct |
DefKind::Union |
DefKind::Type |
Expand All @@ -144,6 +142,8 @@ pub fn name_space_for_def_kind(dk: DefKind) -> char {
DefKind::Static |
DefKind::Const |
DefKind::Tuple |
DefKind::TupleVariant |
DefKind::StructVariant |
DefKind::Field => 'v',
DefKind::Macro => 'm',
}
Expand Down
5 changes: 2 additions & 3 deletions src/test/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,6 @@ fn test_types() {
assert_type(&host, "TestTrait", DefKind::Trait, &[25]);
assert_type(&host, "test_method", DefKind::Method, &[26]);
assert_type(&host, "FooEnum", DefKind::Enum, &[29]);
// TODO: TupleVariant and StructVariant DefKind when rustc uses rls-data 0.11
assert_type(&host, "TupleVariant", DefKind::Tuple, &[30]);
assert_type(&host, "StructVariant", DefKind::Struct, &[31]);
assert_type(&host, "TupleVariant", DefKind::TupleVariant, &[30]);
assert_type(&host, "StructVariant", DefKind::StructVariant, &[31]);
}
2 changes: 1 addition & 1 deletion test_data/hello/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions test_data/hello/save-analysis/hello-6f06c058533ed76d.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"config":{"output_file":null,"full_docs":false,"pub_only":false,"distro_crate":false,"signatures":false,"borrow_data":false},"prelude":{"crate_name":"hello","crate_root":"src","external_crates":[{"name":"panic_unwind","num":11,"file_name":"/home/xanewok/repos/rls-analysis/test_data/hello/src/main.rs"},{"name":"unwind","num":8,"file_name":"/home/xanewok/repos/rls-analysis/test_data/hello/src/main.rs"},{"name":"std_unicode","num":5,"file_name":"/home/xanewok/repos/rls-analysis/test_data/hello/src/main.rs"},{"name":"core","num":2,"file_name":"/home/xanewok/repos/rls-analysis/test_data/hello/src/main.rs"},{"name":"alloc_jemalloc","num":10,"file_name":"/home/xanewok/repos/rls-analysis/test_data/hello/src/main.rs"},{"name":"libc","num":7,"file_name":"/home/xanewok/repos/rls-analysis/test_data/hello/src/main.rs"},{"name":"alloc","num":4,"file_name":"/home/xanewok/repos/rls-analysis/test_data/hello/src/main.rs"},{"name":"std","num":1,"file_name":"/home/xanewok/repos/rls-analysis/test_data/hello/src/main.rs"},{"name":"compiler_builtins","num":9,"file_name":"/home/xanewok/repos/rls-analysis/test_data/hello/src/main.rs"},{"name":"alloc_system","num":6,"file_name":"/home/xanewok/repos/rls-analysis/test_data/hello/src/main.rs"},{"name":"rand","num":3,"file_name":"/home/xanewok/repos/rls-analysis/test_data/hello/src/main.rs"}],"span":{"file_name":[115,114,99,47,109,97,105,110,46,114,115],"byte_start":0,"byte_end":112,"line_start":1,"line_end":8,"column_start":1,"column_end":2}},"imports":[],"defs":[{"kind":"Mod","id":{"krate":0,"index":0},"span":{"file_name":[115,114,99,47,109,97,105,110,46,114,115],"byte_start":0,"byte_end":112,"line_start":1,"line_end":8,"column_start":1,"column_end":2},"name":"","qualname":"::","value":"src/main.rs","parent":null,"children":[{"krate":0,"index":1},{"krate":0,"index":2},{"krate":0,"index":3},{"krate":0,"index":4}],"decl_id":null,"docs":"","sig":null,"attributes":[]},{"kind":"Function","id":{"krate":0,"index":3},"span":{"file_name":[115,114,99,47,109,97,105,110,46,114,115],"byte_start":3,"byte_end":14,"line_start":1,"line_end":1,"column_start":4,"column_end":15},"name":"print_hello","qualname":"::print_hello","value":"fn () -> ()","parent":null,"children":[],"decl_id":null,"docs":"","sig":null,"attributes":[]},{"kind":"Local","id":{"krate":0,"index":4294967287},"span":{"file_name":[115,114,99,47,109,97,105,110,46,114,115],"byte_start":27,"byte_end":31,"line_start":2,"line_end":2,"column_start":9,"column_end":13},"name":"name","qualname":"name$8","value":"&str","parent":null,"children":[],"decl_id":null,"docs":"","sig":null,"attributes":[]},{"kind":"Function","id":{"krate":0,"index":4},"span":{"file_name":[115,114,99,47,109,97,105,110,46,114,115],"byte_start":83,"byte_end":87,"line_start":6,"line_end":6,"column_start":4,"column_end":8},"name":"main","qualname":"::main","value":"fn () -> ()","parent":null,"children":[],"decl_id":null,"docs":"","sig":null,"attributes":[]}],"impls":[],"refs":[{"kind":"Mod","span":{"file_name":[115,114,99,47,109,97,105,110,46,114,115],"byte_start":0,"byte_end":0,"line_start":1,"line_end":1,"column_start":1,"column_end":1},"ref_id":{"krate":4294967295,"index":4294967295}},{"kind":"Mod","span":{"file_name":[115,114,99,47,109,97,105,110,46,114,115],"byte_start":0,"byte_end":0,"line_start":1,"line_end":1,"column_start":1,"column_end":1},"ref_id":{"krate":4294967295,"index":4294967295}},{"kind":"Mod","span":{"file_name":[115,114,99,47,109,97,105,110,46,114,115],"byte_start":0,"byte_end":0,"line_start":1,"line_end":1,"column_start":1,"column_end":1},"ref_id":{"krate":4294967295,"index":4294967295}},{"kind":"Variable","span":{"file_name":[115,114,99,47,109,97,105,110,46,114,115],"byte_start":70,"byte_end":74,"line_start":3,"line_end":3,"column_start":28,"column_end":32},"ref_id":{"krate":0,"index":4294967287}},{"kind":"Variable","span":{"file_name":[115,114,99,47,109,97,105,110,46,114,115],"byte_start":70,"byte_end":74,"line_start":3,"line_end":3,"column_start":28,"column_end":32},"ref_id":{"krate":0,"index":4294967269}},{"kind":"Function","span":{"file_name":[115,114,99,47,109,97,105,110,46,114,115],"byte_start":70,"byte_end":74,"line_start":3,"line_end":3,"column_start":28,"column_end":32},"ref_id":{"krate":2,"index":3443}},{"kind":"Type","span":{"file_name":[115,114,99,47,109,97,105,110,46,114,115],"byte_start":70,"byte_end":74,"line_start":3,"line_end":3,"column_start":28,"column_end":32},"ref_id":{"krate":4294967295,"index":4294967295}},{"kind":"Mod","span":{"file_name":[115,114,99,47,109,97,105,110,46,114,115],"byte_start":70,"byte_end":74,"line_start":3,"line_end":3,"column_start":28,"column_end":32},"ref_id":{"krate":4294967295,"index":4294967295}},{"kind":"Mod","span":{"file_name":[115,114,99,47,109,97,105,110,46,114,115],"byte_start":70,"byte_end":74,"line_start":3,"line_end":3,"column_start":28,"column_end":32},"ref_id":{"krate":4294967295,"index":4294967295}},{"kind":"Function","span":{"file_name":[115,114,99,47,109,97,105,110,46,114,115],"byte_start":96,"byte_end":107,"line_start":7,"line_end":7,"column_start":5,"column_end":16},"ref_id":{"krate":0,"index":3}}],"macro_refs":[{"span":{"file_name":[115,114,99,47,109,97,105,110,46,114,115],"byte_start":47,"byte_end":76,"line_start":3,"line_end":3,"column_start":5,"column_end":34},"qualname":"println","callee_span":{"file_name":[47,99,104,101,99,107,111,117,116,47,115,114,99,47,108,105,98,115,116,100,47,109,97,99,114,111,115,46,114,115],"byte_start":25155,"byte_end":25328,"line_start":150,"line_end":154,"column_start":1,"column_end":2}}],"relations":[]}
1 change: 1 addition & 0 deletions test_data/hello/save-analysis/hello-93359d916dd24c17.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"config":{"output_file":null,"full_docs":false,"pub_only":false,"distro_crate":false,"signatures":false,"borrow_data":false},"prelude":{"crate_id":{"name":"hello","disambiguator":[4972498070786205651,10752139000545052689]},"crate_root":"src","external_crates":[{"file_name":"/home/xanewok/repos/rls-analysis/test_data/hello/src/main.rs","num":11,"id":{"name":"panic_unwind","disambiguator":[14724309074517047858,14081363051482221763]}},{"file_name":"/home/xanewok/repos/rls-analysis/test_data/hello/src/main.rs","num":8,"id":{"name":"unwind","disambiguator":[16962421678491010609,14144564669002769638]}},{"file_name":"/home/xanewok/repos/rls-analysis/test_data/hello/src/main.rs","num":5,"id":{"name":"std_unicode","disambiguator":[7825379778752978812,3737998437093158016]}},{"file_name":"/home/xanewok/repos/rls-analysis/test_data/hello/src/main.rs","num":2,"id":{"name":"core","disambiguator":[2034893687031163843,15475795989519470532]}},{"file_name":"/home/xanewok/repos/rls-analysis/test_data/hello/src/main.rs","num":10,"id":{"name":"alloc_jemalloc","disambiguator":[16728898169015843293,537719064825112735]}},{"file_name":"/home/xanewok/repos/rls-analysis/test_data/hello/src/main.rs","num":7,"id":{"name":"libc","disambiguator":[10024553366994624393,7659320522938082018]}},{"file_name":"/home/xanewok/repos/rls-analysis/test_data/hello/src/main.rs","num":4,"id":{"name":"alloc","disambiguator":[6987473938317122452,6651568688483122068]}},{"file_name":"/home/xanewok/repos/rls-analysis/test_data/hello/src/main.rs","num":1,"id":{"name":"std","disambiguator":[16894929902530602639,5439452766102853002]}},{"file_name":"/home/xanewok/repos/rls-analysis/test_data/hello/src/main.rs","num":9,"id":{"name":"compiler_builtins","disambiguator":[15243808009585947056,16380432114833907945]}},{"file_name":"/home/xanewok/repos/rls-analysis/test_data/hello/src/main.rs","num":6,"id":{"name":"alloc_system","disambiguator":[9386991845804871092,6259921119180170237]}},{"file_name":"/home/xanewok/repos/rls-analysis/test_data/hello/src/main.rs","num":3,"id":{"name":"rand","disambiguator":[17798033069558174552,12679496062386314490]}}],"span":{"file_name":[115,114,99,47,109,97,105,110,46,114,115],"byte_start":0,"byte_end":112,"line_start":1,"line_end":8,"column_start":1,"column_end":2}},"imports":[],"defs":[{"kind":"Mod","id":{"krate":0,"index":0},"span":{"file_name":[115,114,99,47,109,97,105,110,46,114,115],"byte_start":0,"byte_end":112,"line_start":1,"line_end":8,"column_start":1,"column_end":2},"name":"","qualname":"::","value":"src/main.rs","parent":null,"children":[{"krate":0,"index":1},{"krate":0,"index":2},{"krate":0,"index":3},{"krate":0,"index":4}],"decl_id":null,"docs":"","sig":null,"attributes":[]},{"kind":"Function","id":{"krate":0,"index":3},"span":{"file_name":[115,114,99,47,109,97,105,110,46,114,115],"byte_start":3,"byte_end":14,"line_start":1,"line_end":1,"column_start":4,"column_end":15},"name":"print_hello","qualname":"::print_hello","value":"fn () -> ()","parent":null,"children":[],"decl_id":null,"docs":"","sig":null,"attributes":[]},{"kind":"Local","id":{"krate":0,"index":4294967287},"span":{"file_name":[115,114,99,47,109,97,105,110,46,114,115],"byte_start":27,"byte_end":31,"line_start":2,"line_end":2,"column_start":9,"column_end":13},"name":"name","qualname":"name$8","value":"&str","parent":null,"children":[],"decl_id":null,"docs":"","sig":null,"attributes":[]},{"kind":"Function","id":{"krate":0,"index":4},"span":{"file_name":[115,114,99,47,109,97,105,110,46,114,115],"byte_start":83,"byte_end":87,"line_start":6,"line_end":6,"column_start":4,"column_end":8},"name":"main","qualname":"::main","value":"fn () -> ()","parent":null,"children":[],"decl_id":null,"docs":"","sig":null,"attributes":[]}],"impls":[],"refs":[{"kind":"Mod","span":{"file_name":[115,114,99,47,109,97,105,110,46,114,115],"byte_start":0,"byte_end":0,"line_start":1,"line_end":1,"column_start":1,"column_end":1},"ref_id":{"krate":4294967295,"index":4294967295}},{"kind":"Mod","span":{"file_name":[115,114,99,47,109,97,105,110,46,114,115],"byte_start":0,"byte_end":0,"line_start":1,"line_end":1,"column_start":1,"column_end":1},"ref_id":{"krate":4294967295,"index":4294967295}},{"kind":"Mod","span":{"file_name":[115,114,99,47,109,97,105,110,46,114,115],"byte_start":0,"byte_end":0,"line_start":1,"line_end":1,"column_start":1,"column_end":1},"ref_id":{"krate":4294967295,"index":4294967295}},{"kind":"Variable","span":{"file_name":[115,114,99,47,109,97,105,110,46,114,115],"byte_start":70,"byte_end":74,"line_start":3,"line_end":3,"column_start":28,"column_end":32},"ref_id":{"krate":0,"index":4294967287}},{"kind":"Variable","span":{"file_name":[115,114,99,47,109,97,105,110,46,114,115],"byte_start":70,"byte_end":74,"line_start":3,"line_end":3,"column_start":28,"column_end":32},"ref_id":{"krate":0,"index":4294967269}},{"kind":"Function","span":{"file_name":[115,114,99,47,109,97,105,110,46,114,115],"byte_start":70,"byte_end":74,"line_start":3,"line_end":3,"column_start":28,"column_end":32},"ref_id":{"krate":2,"index":3443}},{"kind":"Type","span":{"file_name":[115,114,99,47,109,97,105,110,46,114,115],"byte_start":70,"byte_end":74,"line_start":3,"line_end":3,"column_start":28,"column_end":32},"ref_id":{"krate":4294967295,"index":4294967295}},{"kind":"Mod","span":{"file_name":[115,114,99,47,109,97,105,110,46,114,115],"byte_start":70,"byte_end":74,"line_start":3,"line_end":3,"column_start":28,"column_end":32},"ref_id":{"krate":4294967295,"index":4294967295}},{"kind":"Mod","span":{"file_name":[115,114,99,47,109,97,105,110,46,114,115],"byte_start":70,"byte_end":74,"line_start":3,"line_end":3,"column_start":28,"column_end":32},"ref_id":{"krate":4294967295,"index":4294967295}},{"kind":"Function","span":{"file_name":[115,114,99,47,109,97,105,110,46,114,115],"byte_start":96,"byte_end":107,"line_start":7,"line_end":7,"column_start":5,"column_end":16},"ref_id":{"krate":0,"index":3}}],"macro_refs":[{"span":{"file_name":[115,114,99,47,109,97,105,110,46,114,115],"byte_start":47,"byte_end":76,"line_start":3,"line_end":3,"column_start":5,"column_end":34},"qualname":"println","callee_span":{"file_name":[47,104,111,109,101,47,120,97,110,101,119,111,107,47,114,101,112,111,115,47,114,117,115,116,47,115,114,99,47,108,105,98,115,116,100,47,109,97,99,114,111,115,46,114,115],"byte_start":25155,"byte_end":25328,"line_start":150,"line_end":154,"column_start":1,"column_end":2}}],"relations":[]}
Loading

0 comments on commit d87417e

Please sign in to comment.