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",
"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",
]
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",
version = "0.0.0"
dependencies = [
"alloc 0.0.0",
+ "compiler_builtins 0.0.0",
"core 0.0.0",
]
name = "libc"
version = "0.0.0"
dependencies = [
+ "compiler_builtins 0.0.0",
"core 0.0.0",
]
name = "panic_abort"
version = "0.0.0"
dependencies = [
+ "compiler_builtins 0.0.0",
"core 0.0.0",
"libc 0.0.0",
]
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",
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",
]
"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",
]
"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",
]
"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",
]
"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",
]
name = "std_unicode"
version = "0.0.0"
dependencies = [
+ "compiler_builtins 0.0.0",
"core 0.0.0",
]
name = "unwind"
version = "0.0.0"
dependencies = [
+ "compiler_builtins 0.0.0",
"core 0.0.0",
"libc 0.0.0",
]
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()
//! also check out the `src/bootstrap/README.md` file for more information.
#![deny(warnings)]
-#![feature(conservative_impl_trait, fs_read_write, core_intrinsics)]
-#![feature(slice_concat_ext)]
+#![feature(core_intrinsics)]
#[macro_use]
extern crate build_helper;
fn read(&self, path: &Path) -> String {
if self.config.dry_run { return String::new(); }
- t!(fs::read_string(path))
+ t!(fs::read_to_string(path))
}
fn create_dir(&self, dir: &Path) {
use std::env;
use std::path::PathBuf;
use std::process::{Command, exit};
-use std::slice::SliceConcatExt;
use Mode;
use Compiler;
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.
[dependencies]
core = { path = "../libcore" }
std_unicode = { path = "../libstd_unicode" }
+compiler_builtins = { path = "../rustc/compiler_builtins_shim" }
[dev-dependencies]
rand = "0.4"
#![deny(warnings)]
-#![cfg_attr(stage0, feature(i128_type))]
#![feature(rand)]
#![feature(repr_simd)]
#![feature(slice_sort_by_cached_key)]
#![feature(fmt_internals)]
#![feature(from_ref)]
#![feature(fundamental)]
-#![cfg_attr(stage0, feature(generic_param_attrs))]
-#![cfg_attr(stage0, feature(i128_type))]
#![feature(lang_items)]
#![feature(needs_allocator)]
#![feature(nonzero)]
#![feature(exact_chunks)]
#![feature(pointer_methods)]
#![feature(inclusive_range_fields)]
+#![cfg_attr(stage0, feature(generic_param_attrs))]
#![cfg_attr(not(test), feature(fn_traits, swap_with_slice, i128))]
#![cfg_attr(test, feature(test))]
#![feature(alloc_system)]
#![feature(attr_literals)]
#![feature(box_syntax)]
-#![cfg_attr(stage0, feature(inclusive_range_syntax))]
#![feature(const_fn)]
#![feature(drain_filter)]
#![feature(exact_size_is_empty)]
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" }
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]
/// }
/// }
/// ```
-#[cfg_attr(not(stage0), lang = "ord")]
+#[lang = "ord"]
#[stable(feature = "rust1", since = "1.0.0")]
pub trait Ord: Eq + PartialOrd<Self> {
/// This method returns an `Ordering` between `self` and `other`.
/// assert_eq!(x < y, true);
/// assert_eq!(x.lt(&y), true);
/// ```
-#[cfg_attr(stage0, lang = "ord")]
-#[cfg_attr(not(stage0), lang = "partial_ord")]
+#[lang = "partial_ord"]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_on_unimplemented = "can't compare `{Self}` with `{Rhs}`"]
pub trait PartialOrd<Rhs: ?Sized = Self>: PartialEq<Rhs> {
pub fn bswap<T>(x: T) -> T;
/// Reverses the bits in an integer type `T`.
- #[cfg(not(stage0))]
pub fn bitreverse<T>(x: T) -> T;
/// Performs checked integer addition.
/// Performs an exact division, resulting in undefined behavior where
/// `x % y != 0` or `y == 0` or `x == T::min_value() && y == -1`
- #[cfg(not(stage0))]
pub fn exact_div<T>(x: T, y: T) -> T;
/// Performs an unchecked division, resulting in undefined behavior
/// Probably will never become stable.
pub fn nontemporal_store<T>(ptr: *mut T, val: T);
}
-
-#[cfg(stage0)]
-pub unsafe fn exact_div<T>(a: T, b: T) -> T {
- unchecked_div(a, b)
-}
#![feature(doc_spotlight)]
#![feature(fn_must_use)]
#![feature(fundamental)]
-#![cfg_attr(stage0, feature(i128_type))]
-#![cfg_attr(stage0, feature(inclusive_range_syntax))]
#![feature(intrinsics)]
#![feature(iterator_flatten)]
#![feature(iterator_repeat_with)]
#![feature(untagged_unions)]
#![feature(unwind_attributes)]
-#![cfg_attr(stage0, allow(unused_attributes))]
-#![cfg_attr(stage0, feature(never_type))]
-
#[prelude_import]
#[allow(unused)]
use prelude::v1::*;
});
}
-/// Ensure that a boolean expression is `true` at runtime.
-///
-/// This will invoke the [`panic!`] macro if the provided expression cannot be
-/// evaluated to `true` at runtime.
-///
-/// # Uses
-///
-/// Assertions are always checked in both debug and release builds, and cannot
-/// be disabled. See [`debug_assert!`] for assertions that are not enabled in
-/// release builds by default.
-///
-/// Unsafe code relies on `assert!` to enforce run-time invariants that, if
-/// violated could lead to unsafety.
-///
-/// Other use-cases of `assert!` include [testing] and enforcing run-time
-/// invariants in safe code (whose violation cannot result in unsafety).
-///
-/// # Custom Messages
-///
-/// This macro has a second form, where a custom panic message can
-/// be provided with or without arguments for formatting. See [`std::fmt`]
-/// for syntax for this form.
-///
-/// [`panic!`]: macro.panic.html
-/// [`debug_assert!`]: macro.debug_assert.html
-/// [testing]: ../book/second-edition/ch11-01-writing-tests.html#checking-results-with-the-assert-macro
-/// [`std::fmt`]: ../std/fmt/index.html
-///
-/// # Examples
-///
-/// ```
-/// // the panic message for these assertions is the stringified value of the
-/// // expression given.
-/// assert!(true);
-///
-/// fn some_computation() -> bool { true } // a very simple function
-///
-/// assert!(some_computation());
-///
-/// // assert with a custom message
-/// let x = true;
-/// assert!(x, "x wasn't true!");
-///
-/// let a = 3; let b = 27;
-/// assert!(a + b == 30, "a = {}, b = {}", a, b);
-/// ```
-#[macro_export]
-#[stable(feature = "rust1", since = "1.0.0")]
-#[cfg(stage0)]
-macro_rules! assert {
- ($cond:expr) => (
- if !$cond {
- panic!(concat!("assertion failed: ", stringify!($cond)))
- }
- );
- ($cond:expr,) => (
- assert!($cond)
- );
- ($cond:expr, $($arg:tt)+) => (
- if !$cond {
- panic!($($arg)+)
- }
- );
-}
-
/// Asserts that two expressions are equal to each other (using [`PartialEq`]).
///
/// On panic, this macro will print the values of the expressions with their
#[allow(improper_ctypes)]
extern {
#[lang = "panic_fmt"]
- #[cfg_attr(stage0, unwind)]
- #[cfg_attr(not(stage0), unwind(allowed))]
+ #[unwind(allowed)]
fn panic_impl(fmt: fmt::Arguments, file: &'static str, line: u32, col: u32) -> !;
}
let (file, line, col) = *file_line_col;
#![feature(fmt_internals)]
#![feature(hashmap_internals)]
#![feature(iterator_step_by)]
-#![cfg_attr(stage0, feature(i128_type))]
-#![cfg_attr(stage0, feature(inclusive_range_syntax))]
#![feature(iterator_flatten)]
-#![cfg_attr(stage0, feature(conservative_impl_trait))]
#![feature(iterator_repeat_with)]
#![feature(nonzero)]
#![feature(pattern)]
[dependencies]
core = { path = "../libcore" }
libc = { path = "../rustc/libc_shim" }
+compiler_builtins = { path = "../rustc/compiler_builtins_shim" }
core = { path = "../libcore" }
libc = { path = "../rustc/libc_shim" }
unwind = { path = "../libunwind" }
+compiler_builtins = { path = "../rustc/compiler_builtins_shim" }
// See docs in the `unwind` module.
#[cfg(all(target_os="windows", target_arch = "x86", target_env="gnu"))]
#[lang = "eh_unwind_resume"]
-#[cfg_attr(stage0, unwind)]
-#[cfg_attr(not(stage0), unwind(allowed))]
+#[unwind(allowed)]
unsafe extern "C" fn rust_eh_unwind_resume(panic_ctx: *mut u8) -> ! {
uw::_Unwind_Resume(panic_ctx as *mut uw::_Unwind_Exception);
}
// Entry point for raising an exception, just delegates to the platform-specific
// implementation.
#[no_mangle]
-#[cfg_attr(stage0, unwind)]
-#[cfg_attr(not(stage0), unwind(allowed))]
+#[unwind(allowed)]
pub unsafe extern "C" fn __rust_start_panic(data: usize, vtable: usize) -> u32 {
imp::panic(mem::transmute(raw::TraitObject {
data: data as *mut (),
}
#[lang = "eh_unwind_resume"]
-#[cfg_attr(stage0, unwind)]
-#[cfg_attr(not(stage0), unwind(allowed))]
+#[unwind(allowed)]
unsafe extern "C" fn rust_eh_unwind_resume(panic_ctx: c::LPVOID) -> ! {
let params = [panic_ctx as c::ULONG_PTR];
c::RaiseException(RUST_PANIC,
pub use self::EXCEPTION_DISPOSITION::*;
extern "system" {
- #[cfg_attr(stage0, unwind)]
- #[cfg_attr(not(stage0), unwind(allowed))]
+ #[unwind(allowed)]
pub fn RaiseException(dwExceptionCode: DWORD,
dwExceptionFlags: DWORD,
nNumberOfArguments: DWORD,
lpArguments: *const ULONG_PTR);
- #[cfg_attr(stage0, unwind)]
- #[cfg_attr(not(stage0), unwind(allowed))]
+ #[unwind(allowed)]
pub fn RtlUnwindEx(TargetFrame: LPVOID,
TargetIp: LPVOID,
ExceptionRecord: *const EXCEPTION_RECORD,
ReturnValue: LPVOID,
OriginalContext: *const CONTEXT,
HistoryTable: *const UNWIND_HISTORY_TABLE);
- #[cfg_attr(stage0, unwind)]
- #[cfg_attr(not(stage0), unwind(allowed))]
+ #[unwind(allowed)]
pub fn _CxxThrowException(pExceptionObject: *mut c_void, pThrowInfo: *mut u8);
}
test(no_crate_inject, attr(deny(warnings))),
test(attr(allow(dead_code, deprecated, unused_variables, unused_mut))))]
-#![cfg_attr(stage0, feature(i128_type))]
#![feature(rustc_private)]
#![feature(staged_api)]
#![feature(lang_items)]
#[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()
}
}
/// 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 {
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)]
/// 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),
}
}
+#[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 {
#[derive(Clone, Debug)]
#[unstable(feature = "proc_macro", issue = "38356")]
pub struct Literal {
- token: token::Token,
+ lit: token::Lit,
+ suffix: Option<ast::Name>,
span: Span,
}
/// 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(),
}
}
/// 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(),
}
}
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(),
}
}
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(),
}
}
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(),
}
}
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(),
}
}
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(),
}
}
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(),
}
}
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(),
}
}
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());
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()
}
};
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,
}
})*
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)
}
}
[dependencies]
core = { path = "../libcore" }
+compiler_builtins = { path = "../rustc/compiler_builtins_shim" }
[build-dependencies]
cc = "1.0.1"
let tcx = tcx.expect("can't hash AllocIds during hir lowering");
if let Some(alloc) = tcx.interpret_interner.get_alloc(*self) {
AllocDiscriminant::Alloc.hash_stable(hcx, hasher);
- if !hcx.alloc_id_recursion_tracker.insert(*self) {
+ if hcx.alloc_id_recursion_tracker.insert(*self) {
tcx
.interpret_interner
.get_corresponding_static_def_id(*self)
#![feature(box_patterns)]
#![feature(box_syntax)]
-#![cfg_attr(stage0, feature(conservative_impl_trait))]
#![feature(const_fn)]
-#![cfg_attr(stage0, feature(copy_closures, clone_closures))]
#![feature(core_intrinsics)]
#![feature(drain_filter)]
#![feature(dyn_trait)]
#![feature(entry_or_default)]
#![feature(from_ref)]
#![feature(fs_read_write)]
-#![cfg_attr(stage0, feature(i128_type, i128))]
-#![cfg_attr(stage0, feature(inclusive_range_syntax))]
#![cfg_attr(windows, feature(libc))]
-#![cfg_attr(stage0, feature(match_default_bindings))]
#![feature(macro_lifetime_matcher)]
#![feature(macro_vis_matcher)]
#![feature(exhaustive_patterns)]
#![feature(slice_patterns)]
#![feature(specialization)]
#![feature(unboxed_closures)]
-#![cfg_attr(stage0, feature(underscore_lifetimes))]
-#![cfg_attr(stage0, feature(universal_impl_trait))]
#![feature(trace_macros)]
#![feature(trusted_len)]
#![feature(catch_expr)]
self.resolve_type_vars_or_error(expr.hir_id, self.tables.expr_ty_adjusted_opt(expr))
}
+ /// Returns the type of value that this pattern matches against.
+ /// Some non-obvious cases:
+ ///
+ /// - a `ref x` binding matches against a value of type `T` and gives
+ /// `x` the type `&T`; we return `T`.
+ /// - a pattern with implicit derefs (thanks to default binding
+ /// modes #42640) may look like `Some(x)` but in fact have
+ /// implicit deref patterns attached (e.g., it is really
+ /// `&Some(x)`). In that case, we return the "outermost" type
+ /// (e.g., `&Option<T>).
fn pat_ty(&self, pat: &hir::Pat) -> McResult<Ty<'tcx>> {
+ // Check for implicit `&` types wrapping the pattern; note
+ // that these are never attached to binding patterns, so
+ // actually this is somewhat "disjoint" from the code below
+ // that aims to account for `ref x`.
+ if let Some(vec) = self.tables.pat_adjustments().get(pat.hir_id) {
+ if let Some(first_ty) = vec.first() {
+ debug!("pat_ty(pat={:?}) found adjusted ty `{:?}`", pat, first_ty);
+ return Ok(first_ty);
+ }
+ }
+
+ self.pat_ty_unadjusted(pat)
+ }
+
+
+ /// Like `pat_ty`, but ignores implicit `&` patterns.
+ fn pat_ty_unadjusted(&self, pat: &hir::Pat) -> McResult<Ty<'tcx>> {
let base_ty = self.node_ty(pat.hir_id)?;
+ debug!("pat_ty(pat={:?}) base_ty={:?}", pat, base_ty);
+
// This code detects whether we are looking at a `ref x`,
// and if so, figures out what the type *being borrowed* is.
let ret_ty = match pat.node {
}
_ => base_ty,
};
- debug!("pat_ty(pat={:?}) base_ty={:?} ret_ty={:?}",
- pat, base_ty, ret_ty);
+ debug!("pat_ty(pat={:?}) ret_ty={:?}", pat, ret_ty);
+
Ok(ret_ty)
}
self.tcx.adt_def(enum_def).variant_with_id(def_id).fields.len())
}
Def::StructCtor(_, CtorKind::Fn) => {
- match self.pat_ty(&pat)?.sty {
+ match self.pat_ty_unadjusted(&pat)?.sty {
ty::TyAdt(adt_def, _) => {
(cmt, adt_def.non_enum_variant().fields.len())
}
PatKind::Tuple(ref subpats, ddpos) => {
// (p1, ..., pN)
- let expected_len = match self.pat_ty(&pat)?.sty {
+ let expected_len = match self.pat_ty_unadjusted(&pat)?.sty {
ty::TyTuple(ref tys) => tys.len(),
ref ty => span_bug!(pat.span, "tuple pattern unexpected type {:?}", ty),
};
})
}
+/// Returns whether the specified `lang_item` doesn't actually need to be
+/// present for this compilation.
+///
+/// Not all lang items are always required for each compilation, particularly in
+/// the case of panic=abort. In these situations some lang items are injected by
+/// crates and don't actually need to be defined in libstd.
+pub fn whitelisted(tcx: TyCtxt, lang_item: lang_items::LangItem) -> bool {
+ // If we're not compiling with unwinding, we won't actually need these
+ // symbols. Other panic runtimes ensure that the relevant symbols are
+ // available to link things together, but they're never exercised.
+ if tcx.sess.panic_strategy() != PanicStrategy::Unwind {
+ return lang_item == lang_items::EhPersonalityLangItem ||
+ lang_item == lang_items::EhUnwindResumeLangItem
+ }
+
+ false
+}
+
fn verify<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
items: &lang_items::LanguageItems) {
// We only need to check for the presence of weak lang items if we're
}
}
- // If we're not compiling with unwinding, we won't actually need these
- // symbols. Other panic runtimes ensure that the relevant symbols are
- // available to link things together, but they're never exercised.
- let mut whitelisted = HashSet::new();
- if tcx.sess.panic_strategy() != PanicStrategy::Unwind {
- whitelisted.insert(lang_items::EhPersonalityLangItem);
- whitelisted.insert(lang_items::EhUnwindResumeLangItem);
- }
-
$(
if missing.contains(&lang_items::$item) &&
- !whitelisted.contains(&lang_items::$item) &&
+ !whitelisted(tcx, lang_items::$item) &&
items.$name().is_none() {
tcx.sess.err(&format!("language item required, but not found: `{}`",
stringify!($name)));
if self.can_use_global_caches(param_env) {
let mut cache = self.tcx().evaluation_cache.hashmap.borrow_mut();
if let Some(trait_ref) = self.tcx().lift_to_global(&trait_ref) {
+ debug!(
+ "insert_evaluation_cache(trait_ref={:?}, candidate={:?}) global",
+ trait_ref,
+ result,
+ );
cache.insert(trait_ref, WithDepNode::new(dep_node, result));
return;
}
}
+ debug!(
+ "insert_evaluation_cache(trait_ref={:?}, candidate={:?})",
+ trait_ref,
+ result,
+ );
self.infcx.evaluation_cache.hashmap
.borrow_mut()
.insert(trait_ref, WithDepNode::new(dep_node, result));
if self.intercrate_ambiguity_causes.is_some() {
debug!("evaluate_stack: intercrate_ambiguity_causes is some");
// Heuristics: show the diagnostics when there are no candidates in crate.
- let candidate_set = self.assemble_candidates(stack)?;
- if !candidate_set.ambiguous && candidate_set.vec.iter().all(|c| {
- !self.evaluate_candidate(stack, &c).may_apply()
- }) {
- let trait_ref = stack.obligation.predicate.skip_binder().trait_ref;
- let self_ty = trait_ref.self_ty();
- let trait_desc = trait_ref.to_string();
- let self_desc = if self_ty.has_concrete_skeleton() {
- Some(self_ty.to_string())
- } else {
- None
- };
- let cause = if let Conflict::Upstream = conflict {
- IntercrateAmbiguityCause::UpstreamCrateUpdate { trait_desc, self_desc }
- } else {
- IntercrateAmbiguityCause::DownstreamCrate { trait_desc, self_desc }
- };
- debug!("evaluate_stack: pushing cause = {:?}", cause);
- self.intercrate_ambiguity_causes.as_mut().unwrap().push(cause);
+ if let Ok(candidate_set) = self.assemble_candidates(stack) {
+ if !candidate_set.ambiguous && candidate_set.vec.iter().all(|c| {
+ !self.evaluate_candidate(stack, &c).may_apply()
+ }) {
+ let trait_ref = stack.obligation.predicate.skip_binder().trait_ref;
+ let self_ty = trait_ref.self_ty();
+ let trait_desc = trait_ref.to_string();
+ let self_desc = if self_ty.has_concrete_skeleton() {
+ Some(self_ty.to_string())
+ } else {
+ None
+ };
+ let cause = if let Conflict::Upstream = conflict {
+ IntercrateAmbiguityCause::UpstreamCrateUpdate {
+ trait_desc,
+ self_desc,
+ }
+ } else {
+ IntercrateAmbiguityCause::DownstreamCrate { trait_desc, self_desc }
+ };
+ debug!("evaluate_stack: pushing cause = {:?}", cause);
+ self.intercrate_ambiguity_causes.as_mut().unwrap().push(cause);
+ }
}
}
return Ok(None);
let mut cache = tcx.selection_cache.hashmap.borrow_mut();
if let Some(trait_ref) = tcx.lift_to_global(&trait_ref) {
if let Some(candidate) = tcx.lift_to_global(&candidate) {
+ debug!(
+ "insert_candidate_cache(trait_ref={:?}, candidate={:?}) global",
+ trait_ref,
+ candidate,
+ );
cache.insert(trait_ref, WithDepNode::new(dep_node, candidate));
return;
}
}
}
+ debug!(
+ "insert_candidate_cache(trait_ref={:?}, candidate={:?}) local",
+ trait_ref,
+ candidate,
+ );
self.infcx.selection_cache.hashmap
.borrow_mut()
.insert(trait_ref, WithDepNode::new(dep_node, candidate));
#![deny(warnings)]
#![forbid(unsafe_code)]
-#![cfg_attr(stage0, feature(slice_patterns))]
-#![cfg_attr(stage0, feature(i128_type))]
-#![cfg_attr(stage0, feature(try_from))]
-
// See librustc_cratesio_shim/Cargo.toml for a comment explaining this.
#[allow(unused_extern_crates)]
extern crate rustc_cratesio_shim;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#![cfg_attr(stage0, feature(i128_type))]
-
#[macro_use]
extern crate rustc_apfloat;
alloc = { path = "../liballoc" }
alloc_system = { path = "../liballoc_system" }
core = { path = "../libcore" }
+compiler_builtins = { path = "../rustc/compiler_builtins_shim" }
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()
}
}
/// 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 {
codegen_backend: "llvm".to_string(),
default_hidden_visibility: false,
embed_bitcode: false,
+ emit_debug_gdb_scripts: true,
}
}
}
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()) {
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()
// 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( )
}
})
// 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()
}
}
],
custom_unwind_resume: true,
abi_return_struct_as_int: true,
+ emit_debug_gdb_scripts: false,
.. Default::default()
}
crt_static_allows_dylibs: true,
crt_static_respected: true,
abi_return_struct_as_int: true,
+ emit_debug_gdb_scripts: false,
.. Default::default()
}
#![allow(non_camel_case_types)]
#![feature(from_ref)]
-#![cfg_attr(stage0, feature(match_default_bindings))]
#![feature(quote)]
#[macro_use] extern crate log;
html_root_url = "https://doc.rust-lang.org/nightly/")]
#![deny(warnings)]
-#![cfg_attr(stage0, feature(i128_type, i128))]
-
extern crate rustc_apfloat;
extern crate syntax;
#![feature(unboxed_closures)]
#![feature(fn_traits)]
#![feature(unsize)]
-#![cfg_attr(stage0, feature(conservative_impl_trait))]
-#![cfg_attr(stage0, feature(i128_type, i128))]
#![feature(specialization)]
#![feature(optin_builtin_traits)]
-#![cfg_attr(stage0, feature(underscore_lifetimes))]
#![feature(macro_vis_matcher)]
#![feature(allow_internal_unstable)]
-#![cfg_attr(stage0, feature(universal_impl_trait))]
#![cfg_attr(unix, feature(libc))]
#![cfg_attr(test, feature(test))]
#![allow(unused_attributes)]
#![feature(range_contains)]
#![cfg_attr(unix, feature(libc))]
-#![cfg_attr(stage0, feature(conservative_impl_trait))]
-#![cfg_attr(stage0, feature(i128_type))]
#![feature(optin_builtin_traits)]
extern crate atty;
html_root_url = "https://doc.rust-lang.org/nightly/")]
#![deny(warnings)]
-#![cfg_attr(stage0, feature(conservative_impl_trait))]
#![feature(fs_read_write)]
-#![cfg_attr(stage0, feature(i128_type))]
-#![cfg_attr(stage0, feature(inclusive_range_syntax))]
#![feature(specialization)]
extern crate graphviz;
#![cfg_attr(test, feature(test))]
#![feature(box_patterns)]
#![feature(box_syntax)]
-#![cfg_attr(stage0, feature(i128_type))]
#![feature(macro_vis_matcher)]
#![feature(quote)]
#![feature(rustc_diagnostic_macros)]
-#![cfg_attr(stage0, feature(never_type))]
#[macro_use]
extern crate syntax;
alloc = { path = "../liballoc" }
alloc_system = { path = "../liballoc_system" }
core = { path = "../libcore" }
+compiler_builtins = { path = "../rustc/compiler_builtins_shim" }
#![deny(warnings)]
#![feature(box_patterns)]
-#![cfg_attr(stage0, feature(conservative_impl_trait))]
#![feature(fs_read_write)]
-#![cfg_attr(stage0, feature(i128_type))]
#![feature(libc)]
#![feature(macro_lifetime_matcher)]
#![feature(proc_macro_internals)]
assigned_map: FxHashMap<Place<'tcx>, FxHashSet<BorrowIndex>>,
/// Locations which activate borrows.
- /// NOTE: A given location may activate more than one borrow in the future
- /// when more general two-phase borrow support is introduced, but for now we
- /// only need to store one borrow index
- activation_map: FxHashMap<Location, BorrowIndex>,
+ activation_map: FxHashMap<Location, FxHashSet<BorrowIndex>>,
/// Every borrow has a region; this maps each such regions back to
/// its borrow-indexes.
idx_vec: IndexVec<BorrowIndex, BorrowData<'tcx>>,
location_map: FxHashMap<Location, BorrowIndex>,
assigned_map: FxHashMap<Place<'tcx>, FxHashSet<BorrowIndex>>,
- activation_map: FxHashMap<Location, BorrowIndex>,
+ activation_map: FxHashMap<Location, FxHashSet<BorrowIndex>>,
region_map: FxHashMap<Region<'tcx>, FxHashSet<BorrowIndex>>,
local_map: FxHashMap<mir::Local, FxHashSet<BorrowIndex>>,
region_span_map: FxHashMap<RegionKind, Span>,
let idx = self.idx_vec.push(borrow);
self.location_map.insert(location, idx);
- // This assert is a good sanity check until more general 2-phase borrow
- // support is introduced. See NOTE on the activation_map field for more
- assert!(!self.activation_map.contains_key(&activate_location),
- "More than one activation introduced at the same location.");
- self.activation_map.insert(activate_location, idx);
-
+ insert(&mut self.activation_map, &activate_location, idx);
insert(&mut self.assigned_map, assigned_place, idx);
insert(&mut self.region_map, ®ion, idx);
if let Some(local) = root_local(borrowed_place) {
location: Location) {
// Handle activations
match self.activation_map.get(&location) {
- Some(&activated) => {
- debug!("activating borrow {:?}", activated);
- sets.gen(&ReserveOrActivateIndex::active(activated))
+ Some(activations) => {
+ for activated in activations {
+ debug!("activating borrow {:?}", activated);
+ sets.gen(&ReserveOrActivateIndex::active(*activated))
+ }
}
None => {}
}
#![feature(box_patterns)]
#![feature(box_syntax)]
#![feature(catch_expr)]
-#![cfg_attr(stage0, feature(conservative_impl_trait))]
#![feature(const_fn)]
#![feature(core_intrinsics)]
#![feature(decl_macro)]
#![feature(dyn_trait)]
#![feature(fs_read_write)]
-#![cfg_attr(stage0, feature(i128_type))]
-#![cfg_attr(stage0, feature(inclusive_range_syntax))]
#![feature(macro_vis_matcher)]
-#![cfg_attr(stage0, feature(match_default_bindings))]
#![feature(exhaustive_patterns)]
#![feature(range_contains)]
#![feature(rustc_diagnostic_macros)]
#![feature(nonzero)]
-#![cfg_attr(stage0, feature(underscore_lifetimes))]
-#![cfg_attr(stage0, feature(never_type))]
#![feature(inclusive_range_fields)]
extern crate arena;
use rustc_data_structures::bitvec::BitVector;
-use std::iter;
-
#[derive(PartialEq, Eq, Hash, Clone, Copy, Debug)]
pub enum MonoItemCollectionMode {
Eager,
// late-bound regions, since late-bound
// regions must appear in the argument
// listing.
- let main_ret_ty = main_ret_ty.no_late_bound_regions().unwrap();
+ let main_ret_ty = self.tcx.erase_regions(
+ &main_ret_ty.no_late_bound_regions().unwrap(),
+ );
let start_instance = Instance::resolve(
self.tcx,
ty::ParamEnv::reveal_all(),
start_def_id,
- self.tcx.mk_substs(iter::once(Kind::from(main_ret_ty)))
+ self.tcx.intern_substs(&[Kind::from(main_ret_ty)])
).unwrap();
self.output.push(create_fn_mono_item(start_instance));
alloc = { path = "../liballoc" }
alloc_system = { path = "../liballoc_system" }
core = { path = "../libcore" }
+compiler_builtins = { path = "../rustc/compiler_builtins_shim" }
#![deny(warnings)]
#![feature(crate_visibility_modifier)]
-#![cfg_attr(stage0, feature(match_default_bindings))]
-#![cfg_attr(stage0, feature(underscore_lifetimes))]
#[macro_use]
extern crate log;
use metadata;
use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
use rustc::middle::lang_items::StartFnLangItem;
+use rustc::middle::weak_lang_items;
use rustc::mir::mono::{Linkage, Visibility, Stats};
use rustc::middle::cstore::{EncodedMetadata};
use rustc::ty::{self, Ty, TyCtxt};
use std::sync::Arc;
use std::time::{Instant, Duration};
use std::{i32, usize};
-use std::iter;
use std::sync::mpsc;
use syntax_pos::Span;
use syntax_pos::symbol::InternedString;
// late-bound regions, since late-bound
// regions must appear in the argument
// listing.
- let main_ret_ty = main_ret_ty.no_late_bound_regions().unwrap();
+ let main_ret_ty = cx.tcx.erase_regions(
+ &main_ret_ty.no_late_bound_regions().unwrap(),
+ );
if declare::get_defined_value(cx, "main").is_some() {
// FIXME: We should be smart and show a better diagnostic here.
let (start_fn, args) = if use_start_lang_item {
let start_def_id = cx.tcx.require_lang_item(StartFnLangItem);
- let start_fn = callee::resolve_and_get_fn(cx, start_def_id, cx.tcx.mk_substs(
- iter::once(Kind::from(main_ret_ty))));
+ let start_fn = callee::resolve_and_get_fn(
+ cx,
+ start_def_id,
+ cx.tcx.intern_substs(&[Kind::from(main_ret_ty)]),
+ );
(start_fn, vec![bx.pointercast(rust_main, Type::i8p(cx).ptr_to()),
arg_argc, arg_argv])
} else {
info.lang_item_to_crate.insert(item, id.krate);
}
}
+
+ // No need to look for lang items that are whitelisted and don't
+ // actually need to exist.
+ let missing = missing.iter()
+ .cloned()
+ .filter(|&l| !weak_lang_items::whitelisted(tcx, l))
+ .collect();
info.missing_lang_items.insert(cnum, missing);
}
"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
}
#![feature(custom_attribute)]
#![feature(fs_read_write)]
#![allow(unused_attributes)]
-#![cfg_attr(stage0, feature(i128_type, i128))]
-#![cfg_attr(stage0, feature(inclusive_range_syntax))]
#![feature(libc)]
#![feature(quote)]
#![feature(rustc_diagnostic_macros)]
-#![cfg_attr(stage0, feature(slice_patterns))]
-#![cfg_attr(stage0, feature(conservative_impl_trait))]
#![feature(optin_builtin_traits)]
#![feature(inclusive_range_fields)]
#![feature(underscore_lifetimes)]
wasm_custom_sections: BTreeMap<String, Vec<u8>>,
wasm_imports: FxHashMap<String, String>,
lang_item_to_crate: FxHashMap<LangItem, CrateNum>,
- missing_lang_items: FxHashMap<CrateNum, Lrc<Vec<LangItem>>>,
+ missing_lang_items: FxHashMap<CrateNum, Vec<LangItem>>,
}
__build_diagnostic_array! { librustc_trans, DIAGNOSTICS }
#![feature(box_syntax)]
#![feature(custom_attribute)]
#![allow(unused_attributes)]
-#![cfg_attr(stage0, feature(i128_type))]
#![feature(quote)]
#![feature(rustc_diagnostic_macros)]
-#![cfg_attr(stage0, feature(conservative_impl_trait))]
extern crate ar;
extern crate flate2;
alloc = { path = "../liballoc" }
alloc_system = { path = "../liballoc_system" }
core = { path = "../libcore" }
+compiler_builtins = { path = "../rustc/compiler_builtins_shim" }
_ => t.super_visit_with(self)
}
}
+
+ fn visit_region(&mut self, _: ty::Region<'tcx>) -> bool {
+ true
+ }
}
let mut param_count = CountParams { params: FxHashSet() };
- pred.visit_with(&mut param_count);
+ let has_region = pred.visit_with(&mut param_count);
let substituted_pred = pred.subst(fcx.tcx, substs);
- // Don't check non-defaulted params, dependent defaults or preds with multiple params.
- if substituted_pred.references_error() || param_count.params.len() > 1 {
+ // Don't check non-defaulted params, dependent defaults (including lifetimes)
+ // or preds with multiple params.
+ if substituted_pred.references_error() || param_count.params.len() > 1
+ || has_region {
continue;
}
// Avoid duplication of predicates that contain no parameters, for example.
#![allow(non_camel_case_types)]
-#![cfg_attr(stage0, feature(advanced_slice_patterns))]
#![feature(box_patterns)]
#![feature(box_syntax)]
-#![cfg_attr(stage0, feature(conservative_impl_trait))]
-#![cfg_attr(stage0, feature(copy_closures, clone_closures))]
#![feature(crate_visibility_modifier)]
#![feature(from_ref)]
-#![cfg_attr(stage0, feature(match_default_bindings))]
#![feature(exhaustive_patterns)]
#![feature(option_filter)]
#![feature(quote)]
#![feature(refcell_replace_swap)]
#![feature(rustc_diagnostic_macros)]
#![feature(slice_patterns)]
-#![cfg_attr(stage0, feature(i128_type))]
-#![cfg_attr(stage0, feature(never_type))]
#![feature(dyn_trait)]
#[macro_use] extern crate log;
};
}
+ 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;
}
}
- function toggleAllDocs() {
+ function toggleAllDocs(pageId) {
var toggle = document.getElementById("toggle-all-docs");
if (hasClass(toggle, "will-expand")) {
updateLocalStorage("rustdoc-collapse", "false");
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;
}
}
}
- 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;
}
}
}
- 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>'
if (!inherent) {
onEach(n.childNodes, function(m) {
if (hasClass(m, "collapse-toggle")) {
- collapseDocs(m, "hide");
+ collapseDocs(m, "hide", pageId);
}
});
}
}
})
- autoCollapseAllImpls();
+ autoCollapseAllImpls(getPageId());
function createToggleWrapper() {
var span = document.createElement('span');
};
if (getCurrentValue("rustdoc-collapse") === "true") {
- toggleAllDocs();
+ toggleAllDocs(getPageId());
}
}());
left: -5px;
}
.small-section-header > .anchor {
+ left: -20px;
+}
+.small-section-header > .anchor:not(.field) {
left: -28px;
}
.anchor:before {
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) {
#![feature(box_syntax)]
#![feature(fs_read_write)]
#![feature(set_stdio)]
-#![cfg_attr(stage0, feature(slice_patterns))]
#![feature(test)]
#![feature(unicode)]
#![feature(vec_remove_item)]
#![feature(box_syntax)]
#![feature(core_intrinsics)]
-#![cfg_attr(stage0, feature(i128_type))]
#![feature(specialization)]
#![cfg_attr(test, feature(test))]
#![cfg_attr(stage0, feature(generic_param_attrs))]
#![feature(hashmap_internals)]
#![feature(heap_api)]
-#![cfg_attr(stage0, feature(i128_type, i128))]
#![feature(int_error_internals)]
#![feature(integer_atomics)]
#![feature(into_cow)]
#![feature(doc_spotlight)]
#![cfg_attr(test, feature(update_panic_count))]
#![cfg_attr(windows, feature(used))]
-#![cfg_attr(stage0, feature(never_type))]
-#![cfg_attr(stage0, feature(termination_trait))]
#![default_lib_allocator]
// add a new crate name so we can attach the re-exports to it.
#[macro_reexport(assert_eq, assert_ne, debug_assert, debug_assert_eq,
debug_assert_ne, unreachable, unimplemented, write, writeln, try)]
-#[cfg_attr(stage0, macro_reexport(assert))]
extern crate core as __core;
#[macro_use]
// compiler-rt intrinsics
#[doc(masked)]
+#[cfg(stage0)]
extern crate compiler_builtins;
// During testing, this crate is not actually the "real" std library, but rather
data: *mut u8,
data_ptr: *mut usize,
vtable_ptr: *mut usize) -> u32;
- #[cfg_attr(stage0, unwind)]
- #[cfg_attr(not(stage0), unwind(allowed))]
+ #[unwind(allowed)]
fn __rust_start_panic(data: usize, vtable: usize) -> u32;
}
/// Entry point of panic from the libcore crate.
#[cfg(not(test))]
#[lang = "panic_fmt"]
-#[cfg_attr(stage0, unwind)]
-#[cfg_attr(not(stage0), unwind(allowed))]
+#[unwind(allowed)]
pub extern fn rust_begin_panic(msg: fmt::Arguments,
file: &'static str,
line: u32,
#[unstable(feature = "termination_trait_lib", issue = "43301")]
impl Termination for () {
+ #[inline]
fn report(self) -> i32 { ExitCode::SUCCESS.report() }
}
#[unstable(feature = "termination_trait_lib", issue = "43301")]
impl Termination for ExitCode {
+ #[inline]
fn report(self) -> i32 {
self.0.as_i32()
}
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
}
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
}
[dependencies]
core = { path = "../libcore" }
+compiler_builtins = { path = "../rustc/compiler_builtins_shim" }
#![feature(unicode)]
#![feature(rustc_diagnostic_macros)]
-#![cfg_attr(stage0, feature(match_default_bindings))]
#![feature(non_exhaustive)]
-#![cfg_attr(stage0, feature(i128_type))]
#![feature(const_atomic_usize_new)]
#![feature(rustc_attrs)]
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
}
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 {
#![feature(const_fn)]
#![feature(custom_attribute)]
-#![cfg_attr(stage0, feature(i128_type))]
#![feature(optin_builtin_traits)]
#![allow(unused_attributes)]
#![feature(specialization)]
[dependencies]
core = { path = "../libcore" }
libc = { path = "../rustc/libc_shim" }
+compiler_builtins = { path = "../rustc/compiler_builtins_shim" }
pub type _Unwind_Exception_Cleanup_Fn = extern "C" fn(unwind_code: _Unwind_Reason_Code,
exception: *mut _Unwind_Exception);
extern "C" {
- #[cfg_attr(stage0, unwind)]
- #[cfg_attr(not(stage0), unwind(allowed))]
+ #[unwind(allowed)]
pub fn _Unwind_Resume(exception: *mut _Unwind_Exception) -> !;
pub fn _Unwind_DeleteException(exception: *mut _Unwind_Exception);
pub fn _Unwind_GetLanguageSpecificData(ctx: *mut _Unwind_Context) -> *mut c_void;
if #[cfg(not(all(target_os = "ios", target_arch = "arm")))] {
// Not 32-bit iOS
extern "C" {
- #[cfg_attr(stage0, unwind)]
- #[cfg_attr(not(stage0), unwind(allowed))]
+ #[unwind(allowed)]
pub fn _Unwind_RaiseException(exception: *mut _Unwind_Exception) -> _Unwind_Reason_Code;
pub fn _Unwind_Backtrace(trace: _Unwind_Trace_Fn,
trace_argument: *mut c_void)
} else {
// 32-bit iOS uses SjLj and does not provide _Unwind_Backtrace()
extern "C" {
- #[cfg_attr(stage0, unwind)]
- #[cfg_attr(not(stage0), unwind(allowed))]
+ #[unwind(allowed)]
pub fn _Unwind_SjLj_RaiseException(e: *mut _Unwind_Exception) -> _Unwind_Reason_Code;
}
[dependencies]
core = { path = "../../libcore" }
+compiler_builtins = { path = "../../rustc/compiler_builtins_shim" }
alloc = { path = "../../liballoc" }
#
# 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
# source tarball for a stable release you'll likely see `1.x.0` for rustc and
# `0.x.0` for Cargo where they were released on `date`.
-date: 2018-03-18
+date: 2018-04-04
rustc: beta
cargo: beta
--- /dev/null
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+pub const A: &str = "hello";
--- /dev/null
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+pub const A: &str = "xxxxx";
--- /dev/null
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// revisions:cfail1 cfail2 cfail3
+// compile-flags: -Z query-dep-graph --test
+// must-compile-successfully
+
+#![feature(rustc_attrs)]
+#![crate_type = "rlib"]
+
+#![rustc_partition_translated(module="issue_49595-tests", cfg="cfail2")]
+#![rustc_partition_translated(module="issue_49595-lit_test", cfg="cfail3")]
+
+mod tests {
+ #[cfg_attr(not(cfail1), ignore)]
+ #[test]
+ fn test() {
+ }
+}
+
+
+// Checks that changing a string literal without changing its span
+// takes effect.
+
+// replacing a module to have a stable span
+#[cfg_attr(not(cfail3), path = "auxiliary/lit_a.rs")]
+#[cfg_attr(cfail3, path = "auxiliary/lit_b.rs")]
+mod lit;
+
+pub mod lit_test {
+ #[test]
+ fn lit_test() {
+ println!("{}", ::lit::A);
+ }
+}
--- /dev/null
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// must-compile-successfully
+// failure-status: 1
+
+#![feature(dyn_trait)]
+
+use std::error::Error;
+use std::io;
+
+fn main() -> Result<(), Box<dyn Error>> {
+ Err(Box::new(io::Error::new(io::ErrorKind::Other, "returned Box<dyn Error> from main()")))
+}
--- /dev/null
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// error-pattern: An error message for you
+// failure-status: 1
+
+fn main() -> Result<(), &'static str> {
+ Err("An error message for you")
+}
all:
$(RUSTC) bar.rs
$(RUSTC) foo.rs $(FLAGS)
+ $(RUSTC) foo.rs $(FLAGS) -C panic=abort
// Not even for well-formedness.
struct WellFormedProjection<A, T=<A as Iterator>::Item>(A, T);
+// Issue #49344, predicates with lifetimes should not be checked.
+trait Scope<'a> {}
+struct Request<'a, S: Scope<'a> = i32>(S, &'a ());
+
fn main() {}
--- /dev/null
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(dyn_trait)]
+
+use std::error::Error;
+
+fn main() -> Result<(), Box<dyn Error>> {
+ Ok(())
+}
--- /dev/null
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() -> Result<(), &'static str> {
+ Ok(())
+}
--- /dev/null
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(nll)]
+
+struct Foo {
+}
+
+impl Foo {
+ fn method(&mut self, foo: &mut Foo) {
+ }
+}
+
+fn main() {
+ let mut foo = Foo { };
+ foo.method(&mut foo);
+ //~^ cannot borrow `foo` as mutable more than once at a time
+ //~^^ cannot borrow `foo` as mutable more than once at a time
+}
--- /dev/null
+error[E0499]: cannot borrow `foo` as mutable more than once at a time
+ --> $DIR/two-phase-multi-mut.rs:23:16
+ |
+LL | foo.method(&mut foo);
+ | -----------^^^^^^^^-
+ | | |
+ | | second mutable borrow occurs here
+ | first mutable borrow occurs here
+ | borrow later used here
+
+error[E0499]: cannot borrow `foo` as mutable more than once at a time
+ --> $DIR/two-phase-multi-mut.rs:23:5
+ |
+LL | foo.method(&mut foo);
+ | ^^^^^^^^^^^--------^
+ | | |
+ | | first mutable borrow occurs here
+ | second mutable borrow occurs here
+ | borrow later used here
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0499`.
--- /dev/null
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// revisions: lxl nll
+//[lxl]compile-flags: -Z borrowck=mir -Z two-phase-borrows
+//[nll]compile-flags: -Z borrowck=mir -Z two-phase-borrows -Z nll
+
+// run-pass
+
+use std::io::Result;
+
+struct Foo {}
+
+pub trait FakeRead {
+ fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize>;
+}
+
+impl FakeRead for Foo {
+ fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize> {
+ Ok(4)
+ }
+}
+
+fn main() {
+ let mut a = Foo {};
+ let mut v = Vec::new();
+ a.read_to_end(&mut v);
+}
--- /dev/null
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Regression test for #48728, an ICE that occurred computing
+// coherence "help" information.
+
+#[derive(Clone)] //~ ERROR conflicting implementations of trait `std::clone::Clone`
+struct Node<T: ?Sized>(Box<T>);
+
+impl<T: Clone + ?Sized> Clone for Node<[T]> {
+ fn clone(&self) -> Self {
+ Node(Box::clone(&self.0))
+ }
+}
+
+fn main() {}
--- /dev/null
+error[E0119]: conflicting implementations of trait `std::clone::Clone` for type `Node<[_]>`:
+ --> $DIR/issue-48728.rs:14:10
+ |
+LL | #[derive(Clone)] //~ ERROR conflicting implementations of trait `std::clone::Clone`
+ | ^^^^^ conflicting implementation for `Node<[_]>`
+...
+LL | impl<T: Clone + ?Sized> Clone for Node<[T]> {
+ | ------------------------------------------- first implementation here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0119`.
--- /dev/null
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#[derive(Copy, Clone, Debug, Eq, PartialEq)]
+pub struct Foo {
+}
+
+impl Foo {
+ fn get(&self) -> Option<&Result<String, String>> {
+ None
+ }
+
+ fn mutate(&mut self) { }
+}
+
+fn main() {
+ let mut foo = Foo { };
+
+ // foo.get() returns type Option<&Result<String, String>>, so
+ // using `string` keeps borrow of `foo` alive. Hence calling
+ // `foo.mutate()` should be an error.
+ while let Some(Ok(string)) = foo.get() {
+ foo.mutate();
+ //~^ ERROR cannot borrow `foo` as mutable
+ println!("foo={:?}", *string);
+ }
+}
--- /dev/null
+error[E0502]: cannot borrow `foo` as mutable because it is also borrowed as immutable
+ --> $DIR/borrowck-issue-49631.rs:30:9
+ |
+LL | while let Some(Ok(string)) = foo.get() {
+ | --- - immutable borrow ends here
+ | |
+ | immutable borrow occurs here
+LL | foo.mutate();
+ | ^^^ mutable borrow occurs here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0502`.
"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",