Auto merge of #49753 - kennytm:rollup, r=kennytm

Rollup of 9 pull requests

Successful merges:

 - #49510 (Fix anchor position on fields)
 - #49652 (Fix anchors issue when everything is collapsed)
 - #49702 (std: Inline some Termination-related methods)
 - #49728 (add emit_debug_gdb_scripts target option and ..)
 - #49731 (add THUMB targets to rustup manifest)
 - #49742 (Using X headings instead of 0.X #49739)
 - #49748 (proc_macro: Improve Debug representations)
 - #49750 (bootstrap: Remove the fast path)
 - #49503 (Inject the `compiler_builtins` crate whenever the `core` crate is injected)

Failed merges:
This commit is contained in:
bors 2018-04-07 09:30:10 +00:00
commit 04fef17143
36 changed files with 188 additions and 80 deletions

14
src/Cargo.lock generated
View File

@ -10,6 +10,7 @@ dependencies = [
name = "alloc"
version = "0.0.0"
dependencies = [
"compiler_builtins 0.0.0",
"core 0.0.0",
"rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"std_unicode 0.0.0",
@ -23,6 +24,7 @@ dependencies = [
"alloc_system 0.0.0",
"build_helper 0.1.0",
"cc 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
"compiler_builtins 0.0.0",
"core 0.0.0",
"libc 0.0.0",
]
@ -32,6 +34,7 @@ name = "alloc_system"
version = "0.0.0"
dependencies = [
"alloc 0.0.0",
"compiler_builtins 0.0.0",
"core 0.0.0",
"dlmalloc 0.0.0",
"libc 0.0.0",
@ -541,6 +544,7 @@ name = "dlmalloc"
version = "0.0.0"
dependencies = [
"alloc 0.0.0",
"compiler_builtins 0.0.0",
"core 0.0.0",
]
@ -976,6 +980,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
name = "libc"
version = "0.0.0"
dependencies = [
"compiler_builtins 0.0.0",
"core 0.0.0",
]
@ -1254,6 +1259,7 @@ dependencies = [
name = "panic_abort"
version = "0.0.0"
dependencies = [
"compiler_builtins 0.0.0",
"core 0.0.0",
"libc 0.0.0",
]
@ -1263,6 +1269,7 @@ name = "panic_unwind"
version = "0.0.0"
dependencies = [
"alloc 0.0.0",
"compiler_builtins 0.0.0",
"core 0.0.0",
"libc 0.0.0",
"unwind 0.0.0",
@ -1401,6 +1408,7 @@ name = "profiler_builtins"
version = "0.0.0"
dependencies = [
"cc 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
"compiler_builtins 0.0.0",
"core 0.0.0",
]
@ -1797,6 +1805,7 @@ dependencies = [
"alloc_system 0.0.0",
"build_helper 0.1.0",
"cmake 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)",
"compiler_builtins 0.0.0",
"core 0.0.0",
]
@ -1942,6 +1951,7 @@ dependencies = [
"alloc_system 0.0.0",
"build_helper 0.1.0",
"cmake 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)",
"compiler_builtins 0.0.0",
"core 0.0.0",
]
@ -1991,6 +2001,7 @@ dependencies = [
"alloc_system 0.0.0",
"build_helper 0.1.0",
"cmake 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)",
"compiler_builtins 0.0.0",
"core 0.0.0",
]
@ -2130,6 +2141,7 @@ dependencies = [
"alloc_system 0.0.0",
"build_helper 0.1.0",
"cmake 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)",
"compiler_builtins 0.0.0",
"core 0.0.0",
]
@ -2343,6 +2355,7 @@ dependencies = [
name = "std_unicode"
version = "0.0.0"
dependencies = [
"compiler_builtins 0.0.0",
"core 0.0.0",
]
@ -2725,6 +2738,7 @@ dependencies = [
name = "unwind"
version = "0.0.0"
dependencies = [
"compiler_builtins 0.0.0",
"core 0.0.0",
"libc 0.0.0",
]

View File

@ -770,10 +770,7 @@ def bootstrap(help_triggered):
if 'dev' in data:
build.set_dev_environment()
# No help text depends on submodules. This check saves ~1 minute of git commands, even if
# all the submodules are present and downloaded!
if not help_triggered:
build.update_submodules()
build.update_submodules()
# Fetch/build the bootstrap
build.build = args.build or build.build_triple()

View File

@ -13,65 +13,65 @@ unofficial documentation resources as well!
Many of these resources take the form of "books"; we collectively call these
"The Rust Bookshelf." Some are large, some are small.
## Learn Rust
# Learn Rust
If you'd like to learn Rust, this is the spot for you! All of these resources
assume that you have programmed before, but not in any specific language:
### The Rust Programming Language
## The Rust Programming Language
Affectionately nicknamed "the book," [The Rust Programming
Language](book/index.html) will give you an overview of the language from
first principles. You'll build a few projects along the way, and by the end,
you'll have a solid grasp of the language.
### Rust By Example
## Rust By Example
If reading multiple hundreds of pages about a language isn't your style, then
[Rust By Example](rust-by-example/index.html) has you covered. While the book talks about code with
a lot of words, RBE shows off a bunch of code, and keeps the talking to a
minimum. It also includes exercises!
## Use Rust
# Use Rust
Once you've gotten familliar with the language, these resources can help you
when you're actually using it day-to-day.
### The Standard Library
## The Standard Library
Rust's standard library has [extensive API documentation](std/index.html),
with explanations of how to use various things, as well as example code for
accomplishing various tasks.
### The Cargo Book
## The Cargo Book
[The Cargo Book](cargo/index.html) is a guide to Cargo, Rust's build tool and dependency manager.
### The Rustdoc Book
## The Rustdoc Book
[The Rustdoc Book](rustdoc/index.html) describes our documentation tool, `rustdoc`.
### Extended Error Listing
## Extended Error Listing
Many of Rust's errors come with error codes, and you can request extended
diagnostics from the compiler on those errors. You can also [read them
here](error-index.html), if you prefer to read them that way.
## Master Rust
# Master Rust
Once you're quite familiar with the language, you may find these advanced
resources useful.
### The Reference
## The Reference
[The Reference](reference/index.html) is not a formal spec, but is more detailed and
comprehensive than the book.
### The Rustonomicon
## The Rustonomicon
[The Rustonomicon](nomicon/index.html) is your guidebook to the dark arts of unsafe
Rust. It's also sometimes called "the 'nomicon."
### The Unstable Book
## The Unstable Book
[The Unstable Book](unstable-book/index.html) has documentation for unstable features.

View File

@ -10,6 +10,7 @@ path = "lib.rs"
[dependencies]
core = { path = "../libcore" }
std_unicode = { path = "../libstd_unicode" }
compiler_builtins = { path = "../rustc/compiler_builtins_shim" }
[dev-dependencies]
rand = "0.4"

View File

@ -16,6 +16,7 @@ alloc = { path = "../liballoc" }
alloc_system = { path = "../liballoc_system" }
core = { path = "../libcore" }
libc = { path = "../rustc/libc_shim" }
compiler_builtins = { path = "../rustc/compiler_builtins_shim" }
[build-dependencies]
build_helper = { path = "../build_helper" }

View File

@ -13,6 +13,7 @@ doc = false
alloc = { path = "../liballoc" }
core = { path = "../libcore" }
libc = { path = "../rustc/libc_shim" }
compiler_builtins = { path = "../rustc/compiler_builtins_shim" }
# See comments in the source for what this dependency is
[target.'cfg(all(target_arch = "wasm32", not(target_os = "emscripten")))'.dependencies]

View File

@ -12,3 +12,4 @@ doc = false
[dependencies]
core = { path = "../libcore" }
libc = { path = "../rustc/libc_shim" }
compiler_builtins = { path = "../rustc/compiler_builtins_shim" }

View File

@ -14,3 +14,4 @@ alloc = { path = "../liballoc" }
core = { path = "../libcore" }
libc = { path = "../rustc/libc_shim" }
unwind = { path = "../libunwind" }
compiler_builtins = { path = "../rustc/compiler_builtins_shim" }

View File

@ -127,7 +127,8 @@ impl fmt::Display for TokenStream {
#[stable(feature = "proc_macro_lib", since = "1.15.0")]
impl fmt::Debug for TokenStream {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
self.0.fmt(f)
f.write_str("TokenStream ")?;
f.debug_list().entries(self.clone()).finish()
}
}
@ -222,7 +223,7 @@ pub fn quote_span(span: Span) -> TokenStream {
/// A region of source code, along with macro expansion information.
#[unstable(feature = "proc_macro", issue = "38356")]
#[derive(Copy, Clone, Debug)]
#[derive(Copy, Clone)]
pub struct Span(syntax_pos::Span);
macro_rules! diagnostic_method {
@ -334,6 +335,16 @@ impl Span {
diagnostic_method!(help, Level::Help);
}
#[unstable(feature = "proc_macro", issue = "38356")]
impl fmt::Debug for Span {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{:?} bytes({}..{})",
self.0.ctxt(),
self.0.lo().0,
self.0.hi().0)
}
}
/// A line-column pair representing the start or end of a `Span`.
#[unstable(feature = "proc_macro", issue = "38356")]
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
@ -422,7 +433,7 @@ impl PartialEq<FileName> for SourceFile {
/// A single token or a delimited sequence of token trees (e.g. `[1, (), ..]`).
#[unstable(feature = "proc_macro", issue = "38356")]
#[derive(Clone, Debug)]
#[derive(Clone)]
pub enum TokenTree {
/// A delimited tokenstream
Group(Group),
@ -463,6 +474,20 @@ impl TokenTree {
}
}
#[unstable(feature = "proc_macro", issue = "38356")]
impl fmt::Debug for TokenTree {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
// Each of these has the name in the struct type in the derived debug,
// so don't bother with an extra layer of indirection
match *self {
TokenTree::Group(ref tt) => tt.fmt(f),
TokenTree::Term(ref tt) => tt.fmt(f),
TokenTree::Op(ref tt) => tt.fmt(f),
TokenTree::Literal(ref tt) => tt.fmt(f),
}
}
}
#[unstable(feature = "proc_macro", issue = "38356")]
impl From<Group> for TokenTree {
fn from(g: Group) -> TokenTree {
@ -717,7 +742,8 @@ impl fmt::Display for Term {
#[derive(Clone, Debug)]
#[unstable(feature = "proc_macro", issue = "38356")]
pub struct Literal {
token: token::Token,
lit: token::Lit,
suffix: Option<ast::Name>,
span: Span,
}
@ -734,10 +760,9 @@ macro_rules! suffixed_int_literals {
/// below.
#[unstable(feature = "proc_macro", issue = "38356")]
pub fn $name(n: $kind) -> Literal {
let lit = token::Lit::Integer(Symbol::intern(&n.to_string()));
let ty = Some(Symbol::intern(stringify!($kind)));
Literal {
token: token::Literal(lit, ty),
lit: token::Lit::Integer(Symbol::intern(&n.to_string())),
suffix: Some(Symbol::intern(stringify!($kind))),
span: Span::call_site(),
}
}
@ -759,9 +784,9 @@ macro_rules! unsuffixed_int_literals {
/// below.
#[unstable(feature = "proc_macro", issue = "38356")]
pub fn $name(n: $kind) -> Literal {
let lit = token::Lit::Integer(Symbol::intern(&n.to_string()));
Literal {
token: token::Literal(lit, None),
lit: token::Lit::Integer(Symbol::intern(&n.to_string())),
suffix: None,
span: Span::call_site(),
}
}
@ -814,9 +839,9 @@ impl Literal {
if !n.is_finite() {
panic!("Invalid float literal {}", n);
}
let lit = token::Lit::Float(Symbol::intern(&n.to_string()));
Literal {
token: token::Literal(lit, None),
lit: token::Lit::Float(Symbol::intern(&n.to_string())),
suffix: None,
span: Span::call_site(),
}
}
@ -837,9 +862,9 @@ impl Literal {
if !n.is_finite() {
panic!("Invalid float literal {}", n);
}
let lit = token::Lit::Float(Symbol::intern(&n.to_string()));
Literal {
token: token::Literal(lit, Some(Symbol::intern("f32"))),
lit: token::Lit::Float(Symbol::intern(&n.to_string())),
suffix: Some(Symbol::intern("f32")),
span: Span::call_site(),
}
}
@ -859,9 +884,9 @@ impl Literal {
if !n.is_finite() {
panic!("Invalid float literal {}", n);
}
let lit = token::Lit::Float(Symbol::intern(&n.to_string()));
Literal {
token: token::Literal(lit, None),
lit: token::Lit::Float(Symbol::intern(&n.to_string())),
suffix: None,
span: Span::call_site(),
}
}
@ -882,9 +907,9 @@ impl Literal {
if !n.is_finite() {
panic!("Invalid float literal {}", n);
}
let lit = token::Lit::Float(Symbol::intern(&n.to_string()));
Literal {
token: token::Literal(lit, Some(Symbol::intern("f64"))),
lit: token::Lit::Float(Symbol::intern(&n.to_string())),
suffix: Some(Symbol::intern("f64")),
span: Span::call_site(),
}
}
@ -897,7 +922,8 @@ impl Literal {
escaped.extend(ch.escape_debug());
}
Literal {
token: token::Literal(token::Lit::Str_(Symbol::intern(&escaped)), None),
lit: token::Lit::Str_(Symbol::intern(&escaped)),
suffix: None,
span: Span::call_site(),
}
}
@ -908,7 +934,8 @@ impl Literal {
let mut escaped = String::new();
escaped.extend(ch.escape_unicode());
Literal {
token: token::Literal(token::Lit::Char(Symbol::intern(&escaped)), None),
lit: token::Lit::Char(Symbol::intern(&escaped)),
suffix: None,
span: Span::call_site(),
}
}
@ -919,7 +946,8 @@ impl Literal {
let string = bytes.iter().cloned().flat_map(ascii::escape_default)
.map(Into::<char>::into).collect::<String>();
Literal {
token: token::Literal(token::Lit::ByteStr(Symbol::intern(&string)), None),
lit: token::Lit::ByteStr(Symbol::intern(&string)),
suffix: None,
span: Span::call_site(),
}
}
@ -1055,7 +1083,7 @@ impl TokenTree {
Ident(ident, true) => {
tt!(Term::new(&format!("r#{}", ident), Span(span)))
}
Literal(..) => tt!(self::Literal { token, span: Span(span) }),
Literal(lit, suffix) => tt!(self::Literal { lit, suffix, span: Span(span) }),
DocComment(c) => {
let style = comments::doc_comment_style(&c.as_str());
let stripped = comments::strip_doc_comment_decoration(&c.as_str());
@ -1111,33 +1139,36 @@ impl TokenTree {
return TokenTree::Token(tt.span.0, token).into();
}
self::TokenTree::Literal(self::Literal {
token: Literal(Lit::Integer(ref a), b),
lit: Lit::Integer(ref a),
suffix,
span,
})
if a.as_str().starts_with("-") =>
{
let minus = BinOp(BinOpToken::Minus);
let integer = Symbol::intern(&a.as_str()[1..]);
let integer = Literal(Lit::Integer(integer), b);
let integer = Literal(Lit::Integer(integer), suffix);
let a = TokenTree::Token(span.0, minus);
let b = TokenTree::Token(span.0, integer);
return vec![a, b].into_iter().collect()
}
self::TokenTree::Literal(self::Literal {
token: Literal(Lit::Float(ref a), b),
lit: Lit::Float(ref a),
suffix,
span,
})
if a.as_str().starts_with("-") =>
{
let minus = BinOp(BinOpToken::Minus);
let float = Symbol::intern(&a.as_str()[1..]);
let float = Literal(Lit::Float(float), b);
let float = Literal(Lit::Float(float), suffix);
let a = TokenTree::Token(span.0, minus);
let b = TokenTree::Token(span.0, float);
return vec![a, b].into_iter().collect()
}
self::TokenTree::Literal(tt) => {
return TokenTree::Token(tt.span.0, tt.token).into()
let token = Literal(tt.lit, tt.suffix);
return TokenTree::Token(tt.span.0, token).into()
}
};

View File

@ -208,13 +208,15 @@ macro_rules! literals {
match self {
$(LiteralKind::$i => {
Literal {
token: token::Literal(token::Lit::$i(sym), suffix),
lit: token::Lit::$i(sym),
suffix,
span: contents.span,
}
})*
$(LiteralKind::$raw(n) => {
Literal {
token: token::Literal(token::Lit::$raw(sym, n), suffix),
lit: token::Lit::$raw(sym, n),
suffix,
span: contents.span,
}
})*
@ -224,16 +226,11 @@ macro_rules! literals {
impl Literal {
fn kind_contents_and_suffix(self) -> (LiteralKind, Term, Option<Term>) {
let (lit, suffix) = match self.token {
token::Literal(lit, suffix) => (lit, suffix),
_ => panic!("unsupported literal {:?}", self.token),
};
let (kind, contents) = match lit {
let (kind, contents) = match self.lit {
$(token::Lit::$i(contents) => (LiteralKind::$i, contents),)*
$(token::Lit::$raw(contents, n) => (LiteralKind::$raw(n), contents),)*
};
let suffix = suffix.map(|sym| Term::new(&sym.as_str(), self.span()));
let suffix = self.suffix.map(|sym| Term::new(&sym.as_str(), self.span()));
(kind, Term::new(&contents.as_str(), self.span()), suffix)
}
}

View File

@ -13,6 +13,7 @@ doc = false
[dependencies]
core = { path = "../libcore" }
compiler_builtins = { path = "../rustc/compiler_builtins_shim" }
[build-dependencies]
cc = "1.0.1"

View File

@ -17,3 +17,4 @@ cmake = "0.1.18"
alloc = { path = "../liballoc" }
alloc_system = { path = "../liballoc_system" }
core = { path = "../libcore" }
compiler_builtins = { path = "../rustc/compiler_builtins_shim" }

View File

@ -47,6 +47,7 @@ pub fn opts() -> TargetOptions {
exe_allocation_crate: super::maybe_jemalloc(),
has_elf_tls: version >= (10, 7),
abi_return_struct_as_int: true,
emit_debug_gdb_scripts: false,
.. Default::default()
}
}

View File

@ -478,6 +478,9 @@ pub struct TargetOptions {
/// Whether or not bitcode is embedded in object files
pub embed_bitcode: bool,
/// Whether a .debug_gdb_scripts section will be added to the output object file
pub emit_debug_gdb_scripts: bool,
}
impl Default for TargetOptions {
@ -550,6 +553,7 @@ impl Default for TargetOptions {
codegen_backend: "llvm".to_string(),
default_hidden_visibility: false,
embed_bitcode: false,
emit_debug_gdb_scripts: true,
}
}
}
@ -799,6 +803,7 @@ impl Target {
key!(codegen_backend);
key!(default_hidden_visibility, bool);
key!(embed_bitcode, bool);
key!(emit_debug_gdb_scripts, bool);
if let Some(array) = obj.find("abi-blacklist").and_then(Json::as_array) {
for name in array.iter().filter_map(|abi| abi.as_string()) {
@ -1002,6 +1007,7 @@ impl ToJson for Target {
target_option_val!(codegen_backend);
target_option_val!(default_hidden_visibility);
target_option_val!(embed_bitcode);
target_option_val!(emit_debug_gdb_scripts);
if default.abi_blacklist != self.options.abi_blacklist {
d.insert("abi-blacklist".to_string(), self.options.abi_blacklist.iter()

View File

@ -59,6 +59,9 @@ pub fn target() -> TargetResult {
// too much overhead for such small target.
trap_unreachable: false,
// See the thumb_base.rs file for an explanation of this value
emit_debug_gdb_scripts: false,
.. Default::default( )
}
})

View File

@ -53,6 +53,13 @@ pub fn opts() -> TargetOptions {
// costs it involves.
relocation_model: "static".to_string(),
abi_blacklist: super::arm_base::abi_blacklist(),
// When this section is added a volatile load to its start address is also generated. This
// volatile load is a footgun as it can end up loading an invalid memory address, depending
// on how the user set up their linker scripts. This section adds pretty printer for stuff
// like std::Vec, which is not that used in no-std context, so it's best to left it out
// until we figure a way to add the pretty printers without requiring a volatile load cf.
// rust-lang/rust#44993.
emit_debug_gdb_scripts: false,
.. Default::default()
}
}

View File

@ -102,6 +102,7 @@ pub fn opts() -> TargetOptions {
],
custom_unwind_resume: true,
abi_return_struct_as_int: true,
emit_debug_gdb_scripts: false,
.. Default::default()
}

View File

@ -34,6 +34,7 @@ pub fn opts() -> TargetOptions {
crt_static_allows_dylibs: true,
crt_static_respected: true,
abi_return_struct_as_int: true,
emit_debug_gdb_scripts: false,
.. Default::default()
}

View File

@ -17,3 +17,4 @@ cmake = "0.1.18"
alloc = { path = "../liballoc" }
alloc_system = { path = "../liballoc_system" }
core = { path = "../libcore" }
compiler_builtins = { path = "../rustc/compiler_builtins_shim" }

View File

@ -17,3 +17,4 @@ cmake = "0.1.18"
alloc = { path = "../liballoc" }
alloc_system = { path = "../liballoc_system" }
core = { path = "../libcore" }
compiler_builtins = { path = "../rustc/compiler_builtins_shim" }

View File

@ -83,7 +83,6 @@ pub fn needs_gdb_debug_scripts_section(cx: &CodegenCx) -> bool {
"omit_gdb_pretty_printer_section");
!omit_gdb_pretty_printer_section &&
!cx.sess().target.target.options.is_like_osx &&
!cx.sess().target.target.options.is_like_windows &&
cx.sess().opts.debuginfo != NoDebugInfo
cx.sess().opts.debuginfo != NoDebugInfo &&
cx.sess().target.target.options.emit_debug_gdb_scripts
}

View File

@ -17,3 +17,4 @@ cmake = "0.1.18"
alloc = { path = "../liballoc" }
alloc_system = { path = "../liballoc_system" }
core = { path = "../libcore" }
compiler_builtins = { path = "../rustc/compiler_builtins_shim" }

View File

@ -56,6 +56,14 @@
};
}
function getPageId() {
var id = document.location.href.split('#')[1];
if (id) {
return id.split('?')[0].split('&')[0];
}
return null;
}
function hasClass(elem, className) {
if (elem && className && elem.className) {
var elemClass = elem.className;
@ -1643,7 +1651,7 @@
}
}
function toggleAllDocs() {
function toggleAllDocs(pageId) {
var toggle = document.getElementById("toggle-all-docs");
if (hasClass(toggle, "will-expand")) {
updateLocalStorage("rustdoc-collapse", "false");
@ -1664,12 +1672,12 @@
toggle.title = "expand all docs";
onEach(document.getElementsByClassName("collapse-toggle"), function(e) {
collapseDocs(e, "hide");
collapseDocs(e, "hide", pageId);
});
}
}
function collapseDocs(toggle, mode) {
function collapseDocs(toggle, mode, pageId) {
if (!toggle || !toggle.parentNode) {
return;
}
@ -1745,14 +1753,18 @@
}
}
var relatedDoc = toggle.parentNode;
var parentElem = toggle.parentNode;
var relatedDoc = parentElem;
var docblock = relatedDoc.nextElementSibling;
while (!hasClass(relatedDoc, "impl-items")) {
relatedDoc = relatedDoc.nextElementSibling;
}
if (!relatedDoc && !hasClass(docblock, "docblock")) {
if ((!relatedDoc && !hasClass(docblock, "docblock")) ||
(pageId && onEach(relatedDoc.childNodes, function(e) {
return e.id === pageId;
}) === true)) {
return;
}
@ -1782,7 +1794,7 @@
}
}
function autoCollapseAllImpls() {
function autoCollapseAllImpls(pageId) {
// Automatically minimize all non-inherent impls
onEach(document.getElementsByClassName('impl'), function(n) {
// inherent impl ids are like 'impl' or impl-<number>'
@ -1790,7 +1802,7 @@
if (!inherent) {
onEach(n.childNodes, function(m) {
if (hasClass(m, "collapse-toggle")) {
collapseDocs(m, "hide");
collapseDocs(m, "hide", pageId);
}
});
}
@ -1900,7 +1912,7 @@
}
})
autoCollapseAllImpls();
autoCollapseAllImpls(getPageId());
function createToggleWrapper() {
var span = document.createElement('span');
@ -2030,7 +2042,7 @@
};
if (getCurrentValue("rustdoc-collapse") === "true") {
toggleAllDocs();
toggleAllDocs(getPageId());
}
}());

View File

@ -533,6 +533,9 @@ a {
left: -5px;
}
.small-section-header > .anchor {
left: -20px;
}
.small-section-header > .anchor:not(.field) {
left: -28px;
}
.anchor:before {

View File

@ -19,10 +19,11 @@ function onEach(arr, func) {
if (arr && arr.length > 0 && func) {
for (var i = 0; i < arr.length; i++) {
if (func(arr[i]) === true) {
break;
return true;
}
}
}
return false;
}
function updateLocalStorage(name, value) {

View File

@ -373,6 +373,7 @@ extern crate unwind;
// compiler-rt intrinsics
#[doc(masked)]
#[cfg(stage0)]
extern crate compiler_builtins;
// During testing, this crate is not actually the "real" std library, but rather

View File

@ -1452,6 +1452,7 @@ pub trait Termination {
#[unstable(feature = "termination_trait_lib", issue = "43301")]
impl Termination for () {
#[inline]
fn report(self) -> i32 { ExitCode::SUCCESS.report() }
}
@ -1481,6 +1482,7 @@ impl<E: fmt::Debug> Termination for Result<!, E> {
#[unstable(feature = "termination_trait_lib", issue = "43301")]
impl Termination for ExitCode {
#[inline]
fn report(self) -> i32 {
self.0.as_i32()
}

View File

@ -404,6 +404,7 @@ impl ExitCode {
pub const SUCCESS: ExitCode = ExitCode(EXIT_SUCCESS as _);
pub const FAILURE: ExitCode = ExitCode(EXIT_FAILURE as _);
#[inline]
pub fn as_i32(&self) -> i32 {
self.0 as i32
}

View File

@ -414,6 +414,7 @@ impl ExitCode {
pub const SUCCESS: ExitCode = ExitCode(EXIT_SUCCESS as _);
pub const FAILURE: ExitCode = ExitCode(EXIT_FAILURE as _);
#[inline]
pub fn as_i32(&self) -> i32 {
self.0 as i32
}

View File

@ -15,3 +15,4 @@ path = "tests/lib.rs"
[dependencies]
core = { path = "../libcore" }
compiler_builtins = { path = "../rustc/compiler_builtins_shim" }

View File

@ -94,7 +94,7 @@ pub fn print_crate<'a>(cm: &'a CodeMap,
is_expanded: bool) -> io::Result<()> {
let mut s = State::new_from_input(cm, sess, filename, input, out, ann, is_expanded);
if is_expanded && !std_inject::injected_crate_name().is_none() {
if is_expanded && std_inject::injected_crate_name().is_some() {
// We need to print `#![no_std]` (and its feature gate) so that
// compiling pretty-printed source won't inject libstd again.
// However we don't want these attributes in the AST because

View File

@ -44,27 +44,38 @@ thread_local! {
}
pub fn maybe_inject_crates_ref(mut krate: ast::Crate, alt_std_name: Option<&str>) -> ast::Crate {
let name = if attr::contains_name(&krate.attrs, "no_core") {
// the first name in this list is the crate name of the crate with the prelude
let names: &[&str] = if attr::contains_name(&krate.attrs, "no_core") {
return krate;
} else if attr::contains_name(&krate.attrs, "no_std") {
"core"
if attr::contains_name(&krate.attrs, "compiler_builtins") {
&["core"]
} else {
&["core", "compiler_builtins"]
}
} else {
"std"
&["std"]
};
INJECTED_CRATE_NAME.with(|opt_name| opt_name.set(Some(name)));
for name in names {
krate.module.items.insert(0, P(ast::Item {
attrs: vec![attr::mk_attr_outer(DUMMY_SP,
attr::mk_attr_id(),
attr::mk_word_item(ast::Ident::from_str("macro_use")))],
vis: dummy_spanned(ast::VisibilityKind::Inherited),
node: ast::ItemKind::ExternCrate(alt_std_name.map(Symbol::intern)),
ident: ast::Ident::from_str(name),
id: ast::DUMMY_NODE_ID,
span: DUMMY_SP,
tokens: None,
}));
}
krate.module.items.insert(0, P(ast::Item {
attrs: vec![attr::mk_attr_outer(DUMMY_SP,
attr::mk_attr_id(),
attr::mk_word_item(ast::Ident::from_str("macro_use")))],
vis: dummy_spanned(ast::VisibilityKind::Inherited),
node: ast::ItemKind::ExternCrate(alt_std_name.map(Symbol::intern)),
ident: ast::Ident::from_str(name),
id: ast::DUMMY_NODE_ID,
span: DUMMY_SP,
tokens: None,
}));
// the crates have been injected, the assumption is that the first one is the one with
// the prelude.
let name = names[0];
INJECTED_CRATE_NAME.with(|opt_name| opt_name.set(Some(name)));
let span = ignored_span(DUMMY_SP);
krate.module.items.insert(0, P(ast::Item {

View File

@ -14,3 +14,4 @@ doc = false
[dependencies]
core = { path = "../libcore" }
libc = { path = "../rustc/libc_shim" }
compiler_builtins = { path = "../rustc/compiler_builtins_shim" }

View File

@ -11,4 +11,5 @@ doc = false
[dependencies]
core = { path = "../../libcore" }
compiler_builtins = { path = "../../rustc/compiler_builtins_shim" }
alloc = { path = "../../liballoc" }

View File

@ -29,6 +29,8 @@ doc = false
#
# See https://github.com/rust-lang/rfcs/pull/1133.
core = { path = "../../libcore" }
compiler_builtins = { path = "../compiler_builtins_shim" }
[features]
# Certain parts of libc are conditionally compiled differently than when used

View File

@ -90,6 +90,10 @@ static TARGETS: &'static [&'static str] = &[
"sparc-unknown-linux-gnu",
"sparc64-unknown-linux-gnu",
"sparcv9-sun-solaris",
"thumbv6m-none-eabi",
"thumbv7em-none-eabi",
"thumbv7em-none-eabihf",
"thumbv7m-none-eabi",
"wasm32-unknown-emscripten",
"wasm32-unknown-unknown",
"x86_64-apple-darwin",