Skip to content

Commit 2a03443

Browse files
committed
Auto merge of #41972 - frewsxcv:rollup, r=frewsxcv
Rollup of 5 pull requests - Successful merges: #41826, #41919, #41946, #41967, #41969 - Failed merges: #41939
2 parents 77f1bec + 9d65556 commit 2a03443

File tree

18 files changed

+97
-27
lines changed

18 files changed

+97
-27
lines changed

src/Cargo.toml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,6 @@ exclude = [
2121
"tools/rls",
2222
]
2323

24-
# Curiously, compiletest will segfault if compiled with opt-level=3 on 64-bit
25-
# MSVC when running the compile-fail test suite when a should-fail test panics.
26-
# But hey if this is removed and it gets past the bots, sounds good to me.
27-
[profile.release]
28-
opt-level = 2
29-
[profile.bench]
30-
opt-level = 2
31-
3224
# These options are controlled from our rustc wrapper script, so turn them off
3325
# here and have them controlled elsewhere.
3426
[profile.dev]

src/librustc/lint/context.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1055,7 +1055,7 @@ impl<'a> ast_visit::Visitor<'a> for EarlyContext<'a> {
10551055
run_lints!(self, check_ident, early_passes, sp, id);
10561056
}
10571057

1058-
fn visit_mod(&mut self, m: &'a ast::Mod, s: Span, n: ast::NodeId) {
1058+
fn visit_mod(&mut self, m: &'a ast::Mod, s: Span, _a: &[ast::Attribute], n: ast::NodeId) {
10591059
run_lints!(self, check_mod, early_passes, m, s, n);
10601060
ast_visit::walk_mod(self, m);
10611061
run_lints!(self, check_mod_post, early_passes, m, s, n);

src/librustc_passes/hir_stats.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> {
252252

253253
impl<'v> ast_visit::Visitor<'v> for StatCollector<'v> {
254254

255-
fn visit_mod(&mut self, m: &'v ast::Mod, _s: Span, _n: NodeId) {
255+
fn visit_mod(&mut self, m: &'v ast::Mod, _s: Span, _a: &[ast::Attribute], _n: NodeId) {
256256
self.record("Mod", Id::None, m);
257257
ast_visit::walk_mod(self, m)
258258
}

src/librustc_save_analysis/data.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ pub struct ModData {
267267
pub items: Vec<NodeId>,
268268
pub visibility: Visibility,
269269
pub docs: String,
270-
pub sig: Signature,
270+
pub sig: Option<Signature>,
271271
pub attributes: Vec<Attribute>,
272272
}
273273

src/librustc_save_analysis/dump_visitor.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1211,6 +1211,31 @@ impl<'l, 'tcx: 'l, 'll, D: Dump + 'll> DumpVisitor<'l, 'tcx, 'll, D> {
12111211
}
12121212

12131213
impl<'l, 'tcx: 'l, 'll, D: Dump +'ll> Visitor<'l> for DumpVisitor<'l, 'tcx, 'll, D> {
1214+
fn visit_mod(&mut self, m: &'l ast::Mod, span: Span, attrs: &[ast::Attribute], id: NodeId) {
1215+
// Since we handle explicit modules ourselves in visit_item, this should
1216+
// only get called for the root module of a crate.
1217+
assert_eq!(id, ast::CRATE_NODE_ID);
1218+
1219+
let qualname = format!("::{}", self.tcx.node_path_str(id));
1220+
1221+
let cm = self.tcx.sess.codemap();
1222+
let filename = cm.span_to_filename(span);
1223+
self.dumper.mod_data(ModData {
1224+
id: id,
1225+
name: String::new(),
1226+
qualname: qualname,
1227+
span: span,
1228+
scope: id,
1229+
filename: filename,
1230+
items: m.items.iter().map(|i| i.id).collect(),
1231+
visibility: Visibility::Public,
1232+
docs: docs_for_attrs(attrs),
1233+
sig: None,
1234+
attributes: attrs.to_owned(),
1235+
}.lower(self.tcx));
1236+
self.nest_scope(id, |v| visit::walk_mod(v, m));
1237+
}
1238+
12141239
fn visit_item(&mut self, item: &'l ast::Item) {
12151240
use syntax::ast::ItemKind::*;
12161241
self.process_macro_use(item.span, item.id);

src/librustc_save_analysis/external_data.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ pub struct ModData {
392392
pub items: Vec<DefId>,
393393
pub visibility: Visibility,
394394
pub docs: String,
395-
pub sig: Signature,
395+
pub sig: Option<Signature>,
396396
pub attributes: Vec<Attribute>,
397397
}
398398

@@ -410,7 +410,7 @@ impl Lower for data::ModData {
410410
items: self.items.into_iter().map(|id| make_def_id(id, &tcx.hir)).collect(),
411411
visibility: self.visibility,
412412
docs: self.docs,
413-
sig: self.sig.lower(tcx),
413+
sig: self.sig.map(|s| s.lower(tcx)),
414414
attributes: self.attributes.lower(tcx),
415415
}
416416
}

src/librustc_save_analysis/json_api_dumper.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ impl Into<Option<Def>> for ModData {
293293
parent: None,
294294
decl_id: None,
295295
docs: self.docs,
296-
sig: Some(self.sig.into()),
296+
sig: self.sig.map(|s| s.into()),
297297
attributes: vec![],
298298
}),
299299
_ => None,

src/librustc_save_analysis/json_dumper.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ impl<'b, O: DumpOutput + 'b> Dump for JsonDumper<O> {
121121
children: data.items.into_iter().map(|id| id_from_def_id(id)).collect(),
122122
decl_id: None,
123123
docs: data.docs,
124-
sig: Some(data.sig.into()),
124+
sig: data.sig.map(|s| s.into()),
125125
attributes: data.attributes.into_iter().map(|a| a.into()).collect(),
126126
};
127127
if def.span.file_name.to_str().unwrap() != def.value {

src/librustc_save_analysis/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
258258
items: m.items.iter().map(|i| i.id).collect(),
259259
visibility: From::from(&item.vis),
260260
docs: docs_for_attrs(&item.attrs),
261-
sig: self.sig_base(item),
261+
sig: Some(self.sig_base(item)),
262262
attributes: item.attrs.clone(),
263263
}))
264264
}

src/librustdoc/externalfiles.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ use std::io::prelude::*;
1313
use std::io;
1414
use std::path::Path;
1515
use std::str;
16+
use html::markdown::{Markdown, RenderType};
1617

1718
#[derive(Clone)]
1819
pub struct ExternalHtml{
@@ -28,17 +29,26 @@ pub struct ExternalHtml{
2829
}
2930

3031
impl ExternalHtml {
31-
pub fn load(in_header: &[String], before_content: &[String], after_content: &[String])
32+
pub fn load(in_header: &[String], before_content: &[String], after_content: &[String],
33+
md_before_content: &[String], md_after_content: &[String], render: RenderType)
3234
-> Option<ExternalHtml> {
3335
load_external_files(in_header)
3436
.and_then(|ih|
3537
load_external_files(before_content)
3638
.map(|bc| (ih, bc))
3739
)
40+
.and_then(|(ih, bc)|
41+
load_external_files(md_before_content)
42+
.map(|m_bc| (ih, format!("{}{}", bc, Markdown(&m_bc, render))))
43+
)
3844
.and_then(|(ih, bc)|
3945
load_external_files(after_content)
4046
.map(|ac| (ih, bc, ac))
4147
)
48+
.and_then(|(ih, bc, ac)|
49+
load_external_files(md_after_content)
50+
.map(|m_ac| (ih, bc, format!("{}{}", ac, Markdown(&m_ac, render))))
51+
)
4252
.map(|(ih, bc, ac)|
4353
ExternalHtml {
4454
in_header: ih,

0 commit comments

Comments
 (0)