- /// Entry point of thread panic, for details, see std::macros
+ /// Entry point of thread panic. For details, see `std::macros`.
#[macro_export]
-#[allow_internal_unstable]
+#[cfg_attr(not(stage0), allow_internal_unstable(core_panic, __rust_unstable_column))]
+#[cfg_attr(stage0, allow_internal_unstable)]
#[stable(feature = "core", since = "1.6.0")]
macro_rules! panic {
() => (
//!
//! Hopefully useful general knowledge about codegen:
//!
- //! * There's no way to find out the Ty type of a Value. Doing so
- //! would be "trying to get the eggs out of an omelette" (credit:
- //! pcwalton). You can, instead, find out its llvm::Type by calling val_ty,
- //! but one llvm::Type corresponds to many `Ty`s; for instance, tup(int, int,
- //! int) and rec(x=int, y=int, z=int) will have the same llvm::Type.
+ //! * There's no way to find out the `Ty` type of a Value. Doing so
+ //! would be "trying to get the eggs out of an omelette" (credit:
+ //! pcwalton). You can, instead, find out its `llvm::Type` by calling `val_ty`,
+ //! but one `llvm::Type` corresponds to many `Ty`s; for instance, `tup(int, int,
+ //! int)` and `rec(x=int, y=int, z=int)` will have the same `llvm::Type`.
-use {ModuleCodegen, ModuleKind, CachedModuleCodegen};
+use crate::{ModuleCodegen, ModuleKind, CachedModuleCodegen};
use rustc::dep_graph::cgu_reuse_tracker::CguReuse;
use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
type V: Value<'a, 'mir, 'tcx, M>;
/// The visitor must have an `EvalContext` in it.
- fn ecx(&$($mutability)* self)
- -> &$($mutability)* EvalContext<'a, 'mir, 'tcx, M>;
+ fn ecx(&$($mutability)? self)
+ -> &$($mutability)? EvalContext<'a, 'mir, 'tcx, M>;
// Recursive actions, ready to be overloaded.
- /// Visit the given value, dispatching as appropriate to more specialized visitors.
+ /// Visits the given value, dispatching as appropriate to more specialized visitors.
#[inline(always)]
fn visit_value(&mut self, v: Self::V) -> EvalResult<'tcx>
{
//! *unsubstituted* type when deciding whether to auto-borrow, but the
//! *substituted* type when considering the bounds and so forth. But most
//! of our methods don't give access to the unsubstituted type, and
- //! rightly so because they'd be error-prone. So maybe the thing to do is
+ //! rightly so because they'd be error-prone. So maybe the thing to do is
//! to actually determine the kind of coercions that should occur
- //! separately and pass them in. Or maybe it's ok as is. Anyway, it's
- //! sort of a minor point so I've opted to leave it for later---after all
+ //! separately and pass them in. Or maybe it's ok as is. Anyway, it's
+ //! sort of a minor point so I've opted to leave it for later -- after all,
//! we may want to adjust precisely when coercions occur.
-use check::{FnCtxt, Needs};
+use crate::check::{FnCtxt, Needs};
use errors::DiagnosticBuilder;
use rustc::hir;
use rustc::hir::def_id::DefId;
pub name_len: usize,
/// The number of spaces to indent each successive line with, if line-wrapping is necessary.
pub indent: usize,
+ /// Whether the function is async or not.
+ pub asyncness: hir::IsAsync,
}
- /// Wrapper struct for emitting a where clause from Generics.
+ /// Wrapper struct for emitting a where-clause from Generics.
pub struct WhereClause<'a>{
- /// The Generics from which to emit a where clause.
+ /// The Generics from which to emit a where-clause.
pub gens: &'a clean::Generics,
/// The number of spaces to indent each line with.
pub indent: usize,
}
}
- /// Create an `AsJson` wrapper which can be used to print a value as JSON
+ /// Creates an `AsJson` wrapper which can be used to print a value as JSON
/// on-the-fly via `write!`
-pub fn as_json<T>(t: &T) -> AsJson<T> {
+pub fn as_json<T>(t: &T) -> AsJson<'_, T> {
AsJson { inner: t }
}
- /// Create an `AsPrettyJson` wrapper which can be used to print a value as JSON
+ /// Creates an `AsPrettyJson` wrapper which can be used to print a value as JSON
/// on-the-fly via `write!`
-pub fn as_pretty_json<T>(t: &T) -> AsPrettyJson<T> {
+pub fn as_pretty_json<T>(t: &T) -> AsPrettyJson<'_, T> {
AsPrettyJson { inner: t, indent: None }
}
true
}
- /// Returns true if the bottom-most elements of this stack are the same as
+ /// Returns `true` if the bottom-most elements of this stack are the same as
/// the ones passed as parameter.
- pub fn starts_with(&self, rhs: &[StackElement]) -> bool {
+ pub fn starts_with(&self, rhs: &[StackElement<'_>]) -> bool {
if self.stack.len() < rhs.len() { return false; }
for (i, r) in rhs.iter().enumerate() {
if self.get(i) != *r { return false; }
true
}
- /// Returns true if the top-most elements of this stack are the same as
+ /// Returns `true` if the top-most elements of this stack are the same as
/// the ones passed as parameter.
- pub fn ends_with(&self, rhs: &[StackElement]) -> bool {
+ pub fn ends_with(&self, rhs: &[StackElement<'_>]) -> bool {
if self.stack.len() < rhs.len() { return false; }
let offset = self.stack.len() - rhs.len();
for (i, r) in rhs.iter().enumerate() {
self.ctxt().outer().expn_info().map(source_callee)
}
- /// Check if a span is "internal" to a macro in which `#[unstable]`
+ /// Checks if a span is "internal" to a macro in which `#[unstable]`
/// items can be used (that is, a macro marked with
/// `#[allow_internal_unstable]`).
- pub fn allows_unstable(&self) -> bool {
+ pub fn allows_unstable(&self, feature: &str) -> bool {
match self.ctxt().outer().expn_info() {
- Some(info) => info.allow_internal_unstable,
+ Some(info) => info
+ .allow_internal_unstable
+ .map_or(false, |features| features.iter().any(|&f|
+ f == feature || f == "allow_internal_unstable_backcompat_hack"
+ )),
None => false,
}
}
}
impl Variables {
- /// Return a new zero-initialized Variables
+ /// Returns a new zero-initialized Variables
pub fn new() -> Variables {
Variables {
- sta: [Number(0), Number(0), Number(0), Number(0), Number(0), Number(0), Number(0),
- Number(0), Number(0), Number(0), Number(0), Number(0), Number(0), Number(0),
- Number(0), Number(0), Number(0), Number(0), Number(0), Number(0), Number(0),
- Number(0), Number(0), Number(0), Number(0), Number(0)],
- dyn: [Number(0), Number(0), Number(0), Number(0), Number(0), Number(0), Number(0),
- Number(0), Number(0), Number(0), Number(0), Number(0), Number(0), Number(0),
- Number(0), Number(0), Number(0), Number(0), Number(0), Number(0), Number(0),
- Number(0), Number(0), Number(0), Number(0), Number(0)],
+ sta_va: [
+ Number(0), Number(0), Number(0), Number(0), Number(0), Number(0), Number(0),
+ Number(0), Number(0), Number(0), Number(0), Number(0), Number(0), Number(0),
+ Number(0), Number(0), Number(0), Number(0), Number(0), Number(0), Number(0),
+ Number(0), Number(0), Number(0), Number(0), Number(0)
+ ],
+ dyn_va: [
+ Number(0), Number(0), Number(0), Number(0), Number(0), Number(0), Number(0),
+ Number(0), Number(0), Number(0), Number(0), Number(0), Number(0), Number(0),
+ Number(0), Number(0), Number(0), Number(0), Number(0), Number(0), Number(0),
+ Number(0), Number(0), Number(0), Number(0), Number(0)
+ ],
}
}
}
use std::io;
use std::io::prelude::*;
-use Attr;
-use color;
-use Terminal;
+use crate::Attr;
+use crate::color;
+use crate::Terminal;
- /// A Terminal implementation which uses the Win32 Console API.
+ /// A Terminal implementation that uses the Win32 Console API.
pub struct WinConsole<T> {
buf: T,
def_foreground: color::Color,