Skip to content

Commit b0424b5

Browse files
committed
Auto merge of #43611 - nrc:save-tidy, r=eddyb
Update RLS and deps This PR further moves towards configuring save-analysis using the rls-data Config struct. We remove completely the concept of api_crate. Updates the RLS so the client is expecting these changes and which pulls in a commit re-enabling all RLS tests (been disabled due to a span error for a while).
2 parents b75d1f0 + 2683ba6 commit b0424b5

File tree

6 files changed

+35
-22
lines changed

6 files changed

+35
-22
lines changed

src/Cargo.lock

Lines changed: 10 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/bootstrap/bin/rustc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ fn main() {
188188
cmd.arg("-Zsave-analysis");
189189
cmd.env("RUST_SAVE_ANALYSIS_CONFIG",
190190
"{\"output_file\": null,\"full_docs\": false,\"pub_only\": true,\
191-
\"signatures\": false,\"borrow_data\": false}");
191+
\"distro_crate\": true,\"signatures\": false,\"borrow_data\": false}");
192192
}
193193

194194
// Dealing with rpath here is a little special, so let's go into some

src/librustc_save_analysis/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ rustc_data_structures = { path = "../librustc_data_structures" }
1515
rustc_typeck = { path = "../librustc_typeck" }
1616
syntax = { path = "../libsyntax" }
1717
syntax_pos = { path = "../libsyntax_pos" }
18-
rls-data = "0.9"
18+
rls-data = "0.10"
1919
rls-span = "0.4"
2020
# FIXME(#40527) should move rustc serialize out of tree
2121
rustc-serialize = "0.3"

src/librustc_save_analysis/dump_visitor.rs

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -560,14 +560,21 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> {
560560
let (value, fields) =
561561
if let ast::ItemKind::Struct(ast::VariantData::Struct(ref fields, _), _) = item.node
562562
{
563-
let fields_str = fields.iter()
564-
.enumerate()
565-
.map(|(i, f)| f.ident.map(|i| i.to_string())
566-
.unwrap_or(i.to_string()))
567-
.collect::<Vec<_>>()
568-
.join(", ");
569-
(format!("{} {{ {} }}", name, fields_str),
570-
fields.iter().map(|f| ::id_from_node_id(f.id, &self.save_ctxt)).collect())
563+
let include_priv_fields = !self.save_ctxt.config.pub_only;
564+
let fields_str = fields
565+
.iter()
566+
.enumerate()
567+
.filter_map(|(i, f)| {
568+
if include_priv_fields || f.vis == ast::Visibility::Public {
569+
f.ident.map(|i| i.to_string()).or_else(|| Some(i.to_string()))
570+
} else {
571+
None
572+
}
573+
})
574+
.collect::<Vec<_>>()
575+
.join(", ");
576+
let value = format!("{} {{ {} }}", name, fields_str);
577+
(value, fields.iter().map(|f| ::id_from_node_id(f.id, &self.save_ctxt)).collect())
571578
} else {
572579
(String::new(), vec![])
573580
};

src/librustc_save_analysis/json_dumper.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,11 @@ impl<'b> DumpOutput for CallbackOutput<'b> {
5151

5252
impl<'b, W: Write> JsonDumper<WriteOutput<'b, W>> {
5353
pub fn new(writer: &'b mut W, config: Config) -> JsonDumper<WriteOutput<'b, W>> {
54-
JsonDumper { output: WriteOutput { output: writer }, config, result: Analysis::new() }
54+
JsonDumper {
55+
output: WriteOutput { output: writer },
56+
config: config.clone(),
57+
result: Analysis::new(config)
58+
}
5559
}
5660
}
5761

@@ -61,8 +65,8 @@ impl<'b> JsonDumper<CallbackOutput<'b>> {
6165
-> JsonDumper<CallbackOutput<'b>> {
6266
JsonDumper {
6367
output: CallbackOutput { callback: callback },
64-
config,
65-
result: Analysis::new(),
68+
config: config.clone(),
69+
result: Analysis::new(config),
6670
}
6771
}
6872
}

src/tools/rls

Submodule rls updated from 06b48d1 to cb8a590

0 commit comments

Comments
 (0)