Skip to content

Commit 5516bcc

Browse files
committed
Auto merge of #41345 - frewsxcv:rollup, r=frewsxcv
Rollup of 3 pull requests - Successful merges: #41012, #41280, #41290 - Failed merges:
2 parents 011f240 + 07c6295 commit 5516bcc

24 files changed

+742
-43
lines changed

.gitmodules

+4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
[submodule "src/compiler-rt"]
66
path = src/compiler-rt
77
url = https://github.com/rust-lang/compiler-rt.git
8+
[submodule "src/rt/hoedown"]
9+
path = src/rt/hoedown
10+
url = https://github.com/rust-lang/hoedown.git
11+
branch = rust-2015-09-21-do-not-delete
812
[submodule "src/jemalloc"]
913
path = src/jemalloc
1014
url = https://github.com/rust-lang/jemalloc.git

COPYRIGHT

+22
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,28 @@ their own copyright notices and license terms:
197197
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
198198
OF SUCH DAMAGE.
199199

200+
* Hoedown, the markdown parser, under src/rt/hoedown, is
201+
licensed as follows.
202+
203+
Copyright (c) 2008, Natacha Porté
204+
Copyright (c) 2011, Vicent Martí
205+
Copyright (c) 2013, Devin Torres and the Hoedown authors
206+
207+
Permission to use, copy, modify, and distribute this
208+
software for any purpose with or without fee is hereby
209+
granted, provided that the above copyright notice and
210+
this permission notice appear in all copies.
211+
212+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR
213+
DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
214+
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
215+
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
216+
SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR
217+
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA
218+
OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
219+
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
220+
CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
221+
200222
* libbacktrace, under src/libbacktrace:
201223

202224
Copyright (C) 2012-2014 Free Software Foundation, Inc.

src/doc/unstable-book/src/SUMMARY.md

+1
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@
114114
- [lookup_host](lookup-host.md)
115115
- [loop_break_value](loop-break-value.md)
116116
- [macro_reexport](macro-reexport.md)
117+
- [macro_vis_matcher](macro-vis-matcher.md)
117118
- [main](main.md)
118119
- [manually_drop](manually-drop.md)
119120
- [map_entry_recover_keys](map-entry-recover-keys.md)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# `macro_vis_matcher`
2+
3+
The tracking issue for this feature is: [#41022]
4+
5+
With this feature gate enabled, the [list of fragment specifiers][frags] gains one more entry:
6+
7+
* `vis`: a visibility qualifier. Examples: nothing (default visibility); `pub`; `pub(crate)`.
8+
9+
A `vis` variable may be followed by a comma, ident, type, or path.
10+
11+
[#41022]: https://github.com/rust-lang/rust/issues/41022
12+
[frags]: ../book/first-edition/macros.html#syntactic-requirements
13+
14+
------------------------

src/librustc_resolve/build_reduced_graph.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,9 @@ impl<'a> Resolver<'a> {
521521
LoadedMacro::ProcMacro(ext) => return ext,
522522
};
523523

524-
let ext = Rc::new(macro_rules::compile(&self.session.parse_sess, &macro_def));
524+
let ext = Rc::new(macro_rules::compile(&self.session.parse_sess,
525+
&self.session.features,
526+
&macro_def));
525527
self.macro_map.insert(def_id, ext.clone());
526528
ext
527529
}

src/librustc_resolve/macros.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,9 @@ impl<'a> Resolver<'a> {
671671
}
672672

673673
let def_id = self.definitions.local_def_id(item.id);
674-
let ext = Rc::new(macro_rules::compile(&self.session.parse_sess, item));
674+
let ext = Rc::new(macro_rules::compile(&self.session.parse_sess,
675+
&self.session.features,
676+
item));
675677
self.macro_map.insert(def_id, ext);
676678
*legacy_scope = LegacyScope::Binding(self.arenas.alloc_legacy_binding(LegacyBinding {
677679
parent: Cell::new(*legacy_scope), name: ident.name, def_id: def_id, span: item.span,

src/librustdoc/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
authors = ["The Rust Project Developers"]
33
name = "rustdoc"
44
version = "0.0.0"
5+
build = "build.rs"
56

67
[lib]
78
name = "rustdoc"

src/librustdoc/build.rs

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
extern crate build_helper;
12+
extern crate gcc;
13+
14+
fn main() {
15+
let src_dir = std::path::Path::new("../rt/hoedown/src");
16+
build_helper::rerun_if_changed_anything_in_dir(src_dir);
17+
let mut cfg = gcc::Config::new();
18+
cfg.file("../rt/hoedown/src/autolink.c")
19+
.file("../rt/hoedown/src/buffer.c")
20+
.file("../rt/hoedown/src/document.c")
21+
.file("../rt/hoedown/src/escape.c")
22+
.file("../rt/hoedown/src/html.c")
23+
.file("../rt/hoedown/src/html_blocks.c")
24+
.file("../rt/hoedown/src/html_smartypants.c")
25+
.file("../rt/hoedown/src/stack.c")
26+
.file("../rt/hoedown/src/version.c")
27+
.include(src_dir)
28+
.compile("libhoedown.a");
29+
}
30+

src/librustdoc/clean/mod.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ impl Item {
292292
self.type_() == ItemType::Struct
293293
}
294294
pub fn is_enum(&self) -> bool {
295-
self.type_() == ItemType::Module
295+
self.type_() == ItemType::Enum
296296
}
297297
pub fn is_fn(&self) -> bool {
298298
self.type_() == ItemType::Function
@@ -312,6 +312,9 @@ impl Item {
312312
pub fn is_primitive(&self) -> bool {
313313
self.type_() == ItemType::Primitive
314314
}
315+
pub fn is_union(&self) -> bool {
316+
self.type_() == ItemType::Union
317+
}
315318
pub fn is_stripped(&self) -> bool {
316319
match self.inner { StrippedItem(..) => true, _ => false }
317320
}

src/librustdoc/html/markdown.rs

+191
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
2626
#![allow(non_camel_case_types)]
2727

28+
use libc;
29+
use std::slice;
30+
2831
use std::ascii::AsciiExt;
2932
use std::cell::RefCell;
3033
use std::collections::{HashMap, VecDeque};
@@ -357,6 +360,194 @@ impl<'a, I: Iterator<Item = Event<'a>>> Iterator for Footnotes<'a, I> {
357360
}
358361
}
359362

363+
const DEF_OUNIT: libc::size_t = 64;
364+
const HOEDOWN_EXT_NO_INTRA_EMPHASIS: libc::c_uint = 1 << 11;
365+
const HOEDOWN_EXT_TABLES: libc::c_uint = 1 << 0;
366+
const HOEDOWN_EXT_FENCED_CODE: libc::c_uint = 1 << 1;
367+
const HOEDOWN_EXT_AUTOLINK: libc::c_uint = 1 << 3;
368+
const HOEDOWN_EXT_STRIKETHROUGH: libc::c_uint = 1 << 4;
369+
const HOEDOWN_EXT_SUPERSCRIPT: libc::c_uint = 1 << 8;
370+
const HOEDOWN_EXT_FOOTNOTES: libc::c_uint = 1 << 2;
371+
372+
const HOEDOWN_EXTENSIONS: libc::c_uint =
373+
HOEDOWN_EXT_NO_INTRA_EMPHASIS | HOEDOWN_EXT_TABLES |
374+
HOEDOWN_EXT_FENCED_CODE | HOEDOWN_EXT_AUTOLINK |
375+
HOEDOWN_EXT_STRIKETHROUGH | HOEDOWN_EXT_SUPERSCRIPT |
376+
HOEDOWN_EXT_FOOTNOTES;
377+
378+
enum hoedown_document {}
379+
380+
type blockcodefn = extern "C" fn(*mut hoedown_buffer, *const hoedown_buffer,
381+
*const hoedown_buffer, *const hoedown_renderer_data,
382+
libc::size_t);
383+
384+
type blockquotefn = extern "C" fn(*mut hoedown_buffer, *const hoedown_buffer,
385+
*const hoedown_renderer_data, libc::size_t);
386+
387+
type headerfn = extern "C" fn(*mut hoedown_buffer, *const hoedown_buffer,
388+
libc::c_int, *const hoedown_renderer_data,
389+
libc::size_t);
390+
391+
type blockhtmlfn = extern "C" fn(*mut hoedown_buffer, *const hoedown_buffer,
392+
*const hoedown_renderer_data, libc::size_t);
393+
394+
type codespanfn = extern "C" fn(*mut hoedown_buffer, *const hoedown_buffer,
395+
*const hoedown_renderer_data, libc::size_t) -> libc::c_int;
396+
397+
type linkfn = extern "C" fn (*mut hoedown_buffer, *const hoedown_buffer,
398+
*const hoedown_buffer, *const hoedown_buffer,
399+
*const hoedown_renderer_data, libc::size_t) -> libc::c_int;
400+
401+
type entityfn = extern "C" fn (*mut hoedown_buffer, *const hoedown_buffer,
402+
*const hoedown_renderer_data, libc::size_t);
403+
404+
type normaltextfn = extern "C" fn(*mut hoedown_buffer, *const hoedown_buffer,
405+
*const hoedown_renderer_data, libc::size_t);
406+
407+
#[repr(C)]
408+
struct hoedown_renderer_data {
409+
opaque: *mut libc::c_void,
410+
}
411+
412+
#[repr(C)]
413+
struct hoedown_renderer {
414+
opaque: *mut libc::c_void,
415+
416+
blockcode: Option<blockcodefn>,
417+
blockquote: Option<blockquotefn>,
418+
header: Option<headerfn>,
419+
420+
other_block_level_callbacks: [libc::size_t; 11],
421+
422+
blockhtml: Option<blockhtmlfn>,
423+
424+
/* span level callbacks - NULL or return 0 prints the span verbatim */
425+
autolink: libc::size_t, // unused
426+
codespan: Option<codespanfn>,
427+
other_span_level_callbacks_1: [libc::size_t; 7],
428+
link: Option<linkfn>,
429+
other_span_level_callbacks_2: [libc::size_t; 6],
430+
431+
/* low level callbacks - NULL copies input directly into the output */
432+
entity: Option<entityfn>,
433+
normal_text: Option<normaltextfn>,
434+
435+
/* header and footer */
436+
other_callbacks: [libc::size_t; 2],
437+
}
438+
439+
#[repr(C)]
440+
struct hoedown_html_renderer_state {
441+
opaque: *mut libc::c_void,
442+
toc_data: html_toc_data,
443+
flags: libc::c_uint,
444+
link_attributes: Option<extern "C" fn(*mut hoedown_buffer,
445+
*const hoedown_buffer,
446+
*const hoedown_renderer_data)>,
447+
}
448+
449+
#[repr(C)]
450+
struct html_toc_data {
451+
header_count: libc::c_int,
452+
current_level: libc::c_int,
453+
level_offset: libc::c_int,
454+
nesting_level: libc::c_int,
455+
}
456+
457+
#[repr(C)]
458+
struct hoedown_buffer {
459+
data: *const u8,
460+
size: libc::size_t,
461+
asize: libc::size_t,
462+
unit: libc::size_t,
463+
}
464+
465+
extern {
466+
fn hoedown_html_renderer_new(render_flags: libc::c_uint,
467+
nesting_level: libc::c_int)
468+
-> *mut hoedown_renderer;
469+
fn hoedown_html_renderer_free(renderer: *mut hoedown_renderer);
470+
471+
fn hoedown_document_new(rndr: *const hoedown_renderer,
472+
extensions: libc::c_uint,
473+
max_nesting: libc::size_t) -> *mut hoedown_document;
474+
fn hoedown_document_render(doc: *mut hoedown_document,
475+
ob: *mut hoedown_buffer,
476+
document: *const u8,
477+
doc_size: libc::size_t);
478+
fn hoedown_document_free(md: *mut hoedown_document);
479+
480+
fn hoedown_buffer_new(unit: libc::size_t) -> *mut hoedown_buffer;
481+
fn hoedown_buffer_free(b: *mut hoedown_buffer);
482+
}
483+
484+
impl hoedown_buffer {
485+
fn as_bytes(&self) -> &[u8] {
486+
unsafe { slice::from_raw_parts(self.data, self.size as usize) }
487+
}
488+
}
489+
490+
pub fn old_find_testable_code(doc: &str, tests: &mut ::test::Collector, position: Span) {
491+
extern fn block(_ob: *mut hoedown_buffer,
492+
text: *const hoedown_buffer,
493+
lang: *const hoedown_buffer,
494+
data: *const hoedown_renderer_data,
495+
line: libc::size_t) {
496+
unsafe {
497+
if text.is_null() { return }
498+
let block_info = if lang.is_null() {
499+
LangString::all_false()
500+
} else {
501+
let lang = (*lang).as_bytes();
502+
let s = str::from_utf8(lang).unwrap();
503+
LangString::parse(s)
504+
};
505+
if !block_info.rust { return }
506+
let opaque = (*data).opaque as *mut hoedown_html_renderer_state;
507+
let tests = &mut *((*opaque).opaque as *mut ::test::Collector);
508+
let line = tests.get_line() + line;
509+
let filename = tests.get_filename();
510+
tests.add_old_test(line, filename);
511+
}
512+
}
513+
514+
extern fn header(_ob: *mut hoedown_buffer,
515+
text: *const hoedown_buffer,
516+
level: libc::c_int, data: *const hoedown_renderer_data,
517+
_: libc::size_t) {
518+
unsafe {
519+
let opaque = (*data).opaque as *mut hoedown_html_renderer_state;
520+
let tests = &mut *((*opaque).opaque as *mut ::test::Collector);
521+
if text.is_null() {
522+
tests.register_header("", level as u32);
523+
} else {
524+
let text = (*text).as_bytes();
525+
let text = str::from_utf8(text).unwrap();
526+
tests.register_header(text, level as u32);
527+
}
528+
}
529+
}
530+
531+
tests.set_position(position);
532+
533+
unsafe {
534+
let ob = hoedown_buffer_new(DEF_OUNIT);
535+
let renderer = hoedown_html_renderer_new(0, 0);
536+
(*renderer).blockcode = Some(block);
537+
(*renderer).header = Some(header);
538+
(*((*renderer).opaque as *mut hoedown_html_renderer_state)).opaque
539+
= tests as *mut _ as *mut libc::c_void;
540+
541+
let document = hoedown_document_new(renderer, HOEDOWN_EXTENSIONS, 16);
542+
hoedown_document_render(document, ob, doc.as_ptr(),
543+
doc.len() as libc::size_t);
544+
hoedown_document_free(document);
545+
546+
hoedown_html_renderer_free(renderer);
547+
hoedown_buffer_free(ob);
548+
}
549+
}
550+
360551
pub fn find_testable_code(doc: &str, tests: &mut ::test::Collector, position: Span) {
361552
tests.set_position(position);
362553

0 commit comments

Comments
 (0)