diff --git a/src/liballoc/allocator.rs b/src/liballoc/allocator.rs index 42111301a9fe8..3ea7d349c9cd7 100644 --- a/src/liballoc/allocator.rs +++ b/src/liballoc/allocator.rs @@ -40,7 +40,7 @@ fn size_align() -> (usize, usize) { /// /// (Note however that layouts are *not* required to have positive /// size, even though many allocators require that all memory -/// requeusts have positive size. A caller to the `Alloc::alloc` +/// requests have positive size. A caller to the `Alloc::alloc` /// method must either ensure that conditions like this are met, or /// use specific allocators with looser requirements.) #[derive(Clone, Debug, PartialEq, Eq)] diff --git a/src/liballoc/arc.rs b/src/liballoc/arc.rs index 9e31425193417..daf556795fa6b 100644 --- a/src/liballoc/arc.rs +++ b/src/liballoc/arc.rs @@ -95,7 +95,7 @@ const MAX_REFCOUNT: usize = (isize::MAX) as usize; /// # Cloning references /// /// Creating a new reference from an existing reference counted pointer is done using the -/// `Clone` trait implemented for [`Arc`][`arc`] and [`Weak`][`weak`]. +/// `Clone` trait implemented for [`Arc`][arc] and [`Weak`][weak]. /// /// ``` /// use std::sync::Arc; diff --git a/src/liballoc/btree/node.rs b/src/liballoc/btree/node.rs index 8cea6c482c33d..0e61905131f6f 100644 --- a/src/liballoc/btree/node.rs +++ b/src/liballoc/btree/node.rs @@ -132,7 +132,7 @@ impl InternalNode { /// An owned pointer to a node. This basically is either `Box>` or /// `Box>`. However, it contains no information as to which of the two types -/// of nodes is acutally behind the box, and, partially due to this lack of information, has no +/// of nodes is actually behind the box, and, partially due to this lack of information, has no /// destructor. struct BoxedNode { ptr: Unique> @@ -264,7 +264,7 @@ impl Root { // correct variance. /// A reference to a node. /// -/// This type has a number of paramaters that controls how it acts: +/// This type has a number of parameters that controls how it acts: /// - `BorrowType`: This can be `Immut<'a>` or `Mut<'a>` for some `'a` or `Owned`. /// When this is `Immut<'a>`, the `NodeRef` acts roughly like `&'a Node`, /// when this is `Mut<'a>`, the `NodeRef` acts roughly like `&'a mut Node`, diff --git a/src/liballoc/string.rs b/src/liballoc/string.rs index 622cc68964bf7..322b137e99f0e 100644 --- a/src/liballoc/string.rs +++ b/src/liballoc/string.rs @@ -144,7 +144,7 @@ use boxed::Box; /// # Deref /// /// `String`s implement [`Deref`]``, and so inherit all of [`str`]'s -/// methods. In addition, this means that you can pass a `String` to any +/// methods. In addition, this means that you can pass a `String` to a /// function which takes a [`&str`] by using an ampersand (`&`): /// /// ``` @@ -160,8 +160,38 @@ use boxed::Box; /// /// This will create a [`&str`] from the `String` and pass it in. This /// conversion is very inexpensive, and so generally, functions will accept -/// [`&str`]s as arguments unless they need a `String` for some specific reason. +/// [`&str`]s as arguments unless they need a `String` for some specific +/// reason. /// +/// In certain cases Rust doesn't have enough information to make this +/// conversion, known as `Deref` coercion. In the following example a string +/// slice `&'a str` implements the trait `TraitExample`, and the function +/// `example_func` takes anything that implements the trait. In this case Rust +/// would need to make two implicit conversions, which Rust doesn't have the +/// means to do. For that reason, the following example will not compile. +/// +/// ```compile_fail,E0277 +/// trait TraitExample {} +/// +/// impl<'a> TraitExample for &'a str {} +/// +/// fn example_func(example_arg: A) {} +/// +/// fn main() { +/// let example_string = String::from("example_string"); +/// example_func(&example_string); +/// } +/// ``` +/// +/// There are two options that would work instead. The first would be to +/// change the line `example_func(&example_string);` to +/// `example_func(example_string.as_str());`, using the method `as_str()` +/// to explicitly extract the string slice containing the string. The second +/// way changes `example_func(&example_string);` to +/// `example_func(&*example_string);`. In this case we are dereferencing a +/// `String` to a `str`, then referencing the `str` back to `&str`. The +/// second way is more idiomatic, however both work to do the conversion +/// explicitly rather than relying on the implicit conversion. /// /// # Representation /// diff --git a/src/libcore/iter/mod.rs b/src/libcore/iter/mod.rs index 79e6b11beaca6..22b997a768e6d 100644 --- a/src/libcore/iter/mod.rs +++ b/src/libcore/iter/mod.rs @@ -1035,7 +1035,7 @@ unsafe impl TrustedLen for Zip /// Now consider this twist where we add a call to `rev`. This version will /// print `('c', 1), ('b', 2), ('a', 3)`. Note that the letters are reversed, /// but the values of the counter still go in order. This is because `map()` is -/// still being called lazilly on each item, but we are popping items off the +/// still being called lazily on each item, but we are popping items off the /// back of the vector now, instead of shifting them from the front. /// /// ```rust diff --git a/src/libcore/iter/traits.rs b/src/libcore/iter/traits.rs index ccfeb91aff147..19098f036acd2 100644 --- a/src/libcore/iter/traits.rs +++ b/src/libcore/iter/traits.rs @@ -345,7 +345,7 @@ pub trait Extend { /// In a similar fashion to the [`Iterator`] protocol, once a /// `DoubleEndedIterator` returns `None` from a `next_back()`, calling it again /// may or may not ever return `Some` again. `next()` and `next_back()` are -/// interchangable for this purpose. +/// interchangeable for this purpose. /// /// [`Iterator`]: trait.Iterator.html /// diff --git a/src/libcore/num/dec2flt/algorithm.rs b/src/libcore/num/dec2flt/algorithm.rs index 42bc46c0c683e..ccf3950c2ba39 100644 --- a/src/libcore/num/dec2flt/algorithm.rs +++ b/src/libcore/num/dec2flt/algorithm.rs @@ -336,7 +336,7 @@ pub fn algorithm_m(f: &Big, e: i16) -> T { round_by_remainder(v, rem, q, z) } -/// Skip over most AlgorithmM iterations by checking the bit length. +/// Skip over most Algorithm M iterations by checking the bit length. fn quick_start(u: &mut Big, v: &mut Big, k: &mut i16) { // The bit length is an estimate of the base two logarithm, and log(u / v) = log(u) - log(v). // The estimate is off by at most 1, but always an under-estimate, so the error on log(u) diff --git a/src/libcore/ops/unsize.rs b/src/libcore/ops/unsize.rs index 1914216e9f08a..58da290cfb694 100644 --- a/src/libcore/ops/unsize.rs +++ b/src/libcore/ops/unsize.rs @@ -24,7 +24,7 @@ use marker::Unsize; /// Such an impl can only be written if `Foo` has only a single non-phantomdata /// field involving `T`. If the type of that field is `Bar`, an implementation /// of `CoerceUnsized> for Bar` must exist. The coercion will work by -/// by coercing the `Bar` field into `Bar` and filling in the rest of the fields +/// coercing the `Bar` field into `Bar` and filling in the rest of the fields /// from `Foo` to create a `Foo`. This will effectively drill down to a pointer /// field and coerce that. /// diff --git a/src/libcore/tests/num/mod.rs b/src/libcore/tests/num/mod.rs index 046b81e19f70d..400d53ce51a08 100644 --- a/src/libcore/tests/num/mod.rs +++ b/src/libcore/tests/num/mod.rs @@ -566,7 +566,7 @@ assume_usize_width! { ); } -/// Conversinos where neither the min nor the max of $source can be represented by +/// Conversions where neither the min nor the max of $source can be represented by /// $target, but max/min of the target can be represented by the source. macro_rules! test_impl_try_from_signed_to_unsigned_err { ($fn_name:ident, $source:ty, $target:ty) => { diff --git a/src/libproc_macro/lib.rs b/src/libproc_macro/lib.rs index 1bffffd6c9e71..6a71e67676ae4 100644 --- a/src/libproc_macro/lib.rs +++ b/src/libproc_macro/lib.rs @@ -111,7 +111,7 @@ impl fmt::Display for TokenStream { /// `quote!(..)` accepts arbitrary tokens and expands into a `TokenStream` describing the input. /// For example, `quote!(a + b)` will produce a expression, that, when evaluated, constructs -/// constructs the `TokenStream` `[Word("a"), Op('+', Alone), Word("b")]`. +/// the `TokenStream` `[Word("a"), Op('+', Alone), Word("b")]`. /// /// Unquoting is done with `$`, and works by taking the single next ident as the unquoted term. /// To quote `$` itself, use `$$`. diff --git a/src/librustc/traits/specialize/specialization_graph.rs b/src/librustc/traits/specialize/specialization_graph.rs index f80caeec460fa..611137562a906 100644 --- a/src/librustc/traits/specialize/specialization_graph.rs +++ b/src/librustc/traits/specialize/specialization_graph.rs @@ -31,7 +31,7 @@ use util::nodemap::{DefIdMap, FxHashMap}; /// /// - Parent extraction. In particular, the graph can give you the *immediate* /// parents of a given specializing impl, which is needed for extracting -/// default items amongst other thigns. In the simple "chain" rule, every impl +/// default items amongst other things. In the simple "chain" rule, every impl /// has at most one parent. pub struct Graph { // all impls have a parent; the "root" impls have as their parent the def_id diff --git a/src/librustc/ty/adjustment.rs b/src/librustc/ty/adjustment.rs index 62d137475f90e..5143666077955 100644 --- a/src/librustc/ty/adjustment.rs +++ b/src/librustc/ty/adjustment.rs @@ -29,7 +29,7 @@ use ty::subst::Substs; /// by `autoref`, to either a raw or borrowed pointer. In these cases unsize is /// `false`. /// -/// 2. A thin-to-fat coercon involves unsizing the underlying data. We start +/// 2. A thin-to-fat coercion involves unsizing the underlying data. We start /// with a thin pointer, deref a number of times, unsize the underlying data, /// then autoref. The 'unsize' phase may change a fixed length array to a /// dynamically sized one, a concrete object to a trait object, or statically @@ -52,7 +52,7 @@ use ty::subst::Substs; /// that case, we have the pointer we need coming in, so there are no /// autoderefs, and no autoref. Instead we just do the `Unsize` transformation. /// At some point, of course, `Box` should move out of the compiler, in which -/// case this is analogous to transformating a struct. E.g., Box<[i32; 4]> -> +/// case this is analogous to transforming a struct. E.g., Box<[i32; 4]> -> /// Box<[i32]> is an `Adjust::Unsize` with the target `Box<[i32]>`. #[derive(Clone, RustcEncodable, RustcDecodable)] pub struct Adjustment<'tcx> { diff --git a/src/librustc/ty/layout.rs b/src/librustc/ty/layout.rs index e770f1d55dcfd..4ee9b2e65a782 100644 --- a/src/librustc/ty/layout.rs +++ b/src/librustc/ty/layout.rs @@ -2197,8 +2197,8 @@ impl<'a, 'tcx> TyLayout<'tcx> { let tcx = cx.tcx(); let ptr_field_type = |pointee: Ty<'tcx>| { + assert!(i < 2); let slice = |element: Ty<'tcx>| { - assert!(i < 2); if i == 0 { tcx.mk_mut_ptr(element) } else { diff --git a/src/librustc_data_structures/stable_hasher.rs b/src/librustc_data_structures/stable_hasher.rs index 5e291ea3c152b..6801aa455e11e 100644 --- a/src/librustc_data_structures/stable_hasher.rs +++ b/src/librustc_data_structures/stable_hasher.rs @@ -193,7 +193,7 @@ impl Hasher for StableHasher { /// Something that implements `HashStable` can be hashed in a way that is -/// stable across multiple compiliation sessions. +/// stable across multiple compilation sessions. pub trait HashStable { fn hash_stable(&self, hcx: &mut CTX, diff --git a/src/librustc_driver/driver.rs b/src/librustc_driver/driver.rs index c689b3d241c1f..23bae55c98e79 100644 --- a/src/librustc_driver/driver.rs +++ b/src/librustc_driver/driver.rs @@ -282,7 +282,7 @@ pub fn source_name(input: &Input) -> String { /// This is a somewhat higher level controller than a Session - the Session /// controls what happens in each phase, whereas the CompileController controls /// whether a phase is run at all and whether other code (from outside the -/// the compiler) is run between phases. +/// compiler) is run between phases. /// /// Note that if compilation is set to stop and a callback is provided for a /// given entry point, the callback is called before compilation is stopped. diff --git a/src/librustc_metadata/encoder.rs b/src/librustc_metadata/encoder.rs index c35d8407c9d3c..8a753a0ae4b57 100644 --- a/src/librustc_metadata/encoder.rs +++ b/src/librustc_metadata/encoder.rs @@ -563,7 +563,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> { Entry { kind: EntryKind::Mod(self.lazy(&data)), visibility: self.lazy(&ty::Visibility::from_hir(vis, id, tcx)), - span: self.lazy(&md.inner), + span: self.lazy(&tcx.def_span(def_id)), attributes: self.encode_attributes(attrs), children: self.lazy_seq(md.item_ids.iter().map(|item_id| { tcx.hir.local_def_id(item_id.id).index diff --git a/src/librustc_mir/dataflow/impls/mod.rs b/src/librustc_mir/dataflow/impls/mod.rs index d5bdc71a705c5..e05a5a7341fdb 100644 --- a/src/librustc_mir/dataflow/impls/mod.rs +++ b/src/librustc_mir/dataflow/impls/mod.rs @@ -212,7 +212,7 @@ impl<'a, 'tcx: 'a> HasMoveData<'tcx> for DefinitelyInitializedLvals<'a, 'tcx> { /// you if an l-value *might* be uninitialized at a given point in the /// control flow. But `MovingOutStatements` also includes the added /// data of *which* particular statement causing the deinitialization -/// that the borrow checker's error meessage may need to report. +/// that the borrow checker's error message may need to report. #[allow(dead_code)] pub struct MovingOutStatements<'a, 'tcx: 'a> { tcx: TyCtxt<'a, 'tcx, 'tcx>, diff --git a/src/librustc_mir/hair/mod.rs b/src/librustc_mir/hair/mod.rs index bb11cce748751..e32de6b9768a9 100644 --- a/src/librustc_mir/hair/mod.rs +++ b/src/librustc_mir/hair/mod.rs @@ -80,7 +80,7 @@ pub enum StmtKind<'tcx> { /// The Hair trait implementor translates their expressions (`&'tcx H::Expr`) /// into instances of this `Expr` enum. This translation can be done -/// basically as lazilly or as eagerly as desired: every recursive +/// basically as lazily or as eagerly as desired: every recursive /// reference to an expression in this enum is an `ExprRef<'tcx>`, which /// may in turn be another instance of this enum (boxed), or else an /// untranslated `&'tcx H::Expr`. Note that instances of `Expr` are very diff --git a/src/librustc_trans/base.rs b/src/librustc_trans/base.rs index 8cbc5155ddeb7..63df33913ca73 100644 --- a/src/librustc_trans/base.rs +++ b/src/librustc_trans/base.rs @@ -191,7 +191,7 @@ pub fn compare_simd_types<'a, 'tcx>( /// adjustment. /// /// The `old_info` argument is a bit funny. It is intended for use -/// in an upcast, where the new vtable for an object will be drived +/// in an upcast, where the new vtable for an object will be derived /// from the old one. pub fn unsized_info<'ccx, 'tcx>(ccx: &CrateContext<'ccx, 'tcx>, source: Ty<'tcx>, diff --git a/src/librustc_typeck/check/dropck.rs b/src/librustc_typeck/check/dropck.rs index ed22cd1333e9c..72ff9eb6f5b0d 100644 --- a/src/librustc_typeck/check/dropck.rs +++ b/src/librustc_typeck/check/dropck.rs @@ -22,7 +22,7 @@ use util::nodemap::FxHashSet; use syntax_pos::Span; -/// check_drop_impl confirms that the Drop implementation identfied by +/// check_drop_impl confirms that the Drop implementation identified by /// `drop_impl_did` is not any more specialized than the type it is /// attached to (Issue #8142). /// diff --git a/src/librustc_typeck/constrained_type_params.rs b/src/librustc_typeck/constrained_type_params.rs index 7742194dfe6e0..37cb1f9280b61 100644 --- a/src/librustc_typeck/constrained_type_params.rs +++ b/src/librustc_typeck/constrained_type_params.rs @@ -98,7 +98,7 @@ pub fn identify_constrained_type_params<'tcx>(tcx: ty::TyCtxt, /// Order the predicates in `predicates` such that each parameter is /// constrained before it is used, if that is possible, and add the -/// paramaters so constrained to `input_parameters`. For example, +/// parameters so constrained to `input_parameters`. For example, /// imagine the following impl: /// /// impl> Trait for U diff --git a/src/librustc_typeck/diagnostics.rs b/src/librustc_typeck/diagnostics.rs index 35ca19698e8cf..c74dc24ddc340 100644 --- a/src/librustc_typeck/diagnostics.rs +++ b/src/librustc_typeck/diagnostics.rs @@ -1525,9 +1525,9 @@ static BAR: _ = "test"; // error, explicitly write out the type instead "##, E0122: r##" -An attempt was made to add a generic constraint to a type alias. While Rust will -allow this with a warning, it will not currently enforce the constraint. -Consider the example below: +An attempt was made to add a generic constraint to a type alias. This constraint +is entirely ignored. For backwards compatibility, Rust still allows this with a +warning. Consider the example below: ``` trait Foo{} diff --git a/src/librustc_typeck/variance/constraints.rs b/src/librustc_typeck/variance/constraints.rs index 284c9c5cfc398..4b0db749964ca 100644 --- a/src/librustc_typeck/variance/constraints.rs +++ b/src/librustc_typeck/variance/constraints.rs @@ -51,7 +51,7 @@ pub struct Constraint<'a> { pub variance: &'a VarianceTerm<'a>, } -/// To build constriants, we visit one item (type, trait) at a time +/// To build constraints, we visit one item (type, trait) at a time /// and look at its contents. So e.g. if we have /// /// struct Foo { diff --git a/src/librustdoc/clean/inline.rs b/src/librustdoc/clean/inline.rs index fa5a999adf196..9b4c4e479d046 100644 --- a/src/librustdoc/clean/inline.rs +++ b/src/librustdoc/clean/inline.rs @@ -495,7 +495,7 @@ fn build_static(cx: &DocContext, did: DefId, mutable: bool) -> clean::Static { /// A trait's generics clause actually contains all of the predicates for all of /// its associated types as well. We specifically move these clauses to the -/// associated types instead when displaying, so when we're genering the +/// associated types instead when displaying, so when we're generating the /// generics for the trait itself we need to be sure to remove them. /// We also need to remove the implied "recursive" Self: Trait bound. /// diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index fc0adef70baa1..563c5618759b7 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -2141,8 +2141,8 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item, if !types.is_empty() { write!(w, " -

+ Associated Types

")?; @@ -2154,8 +2154,8 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item, if !consts.is_empty() { write!(w, " -

- Associated Constants +

+ Associated Constants

")?; @@ -2168,8 +2168,8 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item, // Output the documentation for each function individually if !required.is_empty() { write!(w, " -

- Required Methods +

+ Required Methods

")?; @@ -2180,8 +2180,8 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item, } if !provided.is_empty() { write!(w, " -

- Provided Methods +

+ Provided Methods

")?; @@ -2196,8 +2196,8 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item, let cache = cache(); write!(w, " -

- Implementors +

+ Implementors

    ")?; @@ -2436,8 +2436,8 @@ fn item_struct(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item, }).peekable(); if let doctree::Plain = s.struct_type { if fields.peek().is_some() { - write!(w, "

    - Fields

    ")?; + write!(w, "

    + Fields

    ")?; for (field, ty) in fields { let id = derive_id(format!("{}.{}", ItemType::StructField, @@ -2485,8 +2485,8 @@ fn item_union(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item, } }).peekable(); if fields.peek().is_some() { - write!(w, "

    - Fields

    ")?; + write!(w, "

    + Fields

    ")?; for (field, ty) in fields { write!(w, "{name}: {ty} ", @@ -2558,8 +2558,8 @@ fn item_enum(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item, document(w, cx, it)?; if !e.variants.is_empty() { - write!(w, "

    - Variants

    \n")?; + write!(w, "

    + Variants

    \n")?; for variant in &e.variants { let id = derive_id(format!("{}.{}", ItemType::Variant, @@ -2831,16 +2831,16 @@ fn render_assoc_items(w: &mut fmt::Formatter, let render_mode = match what { AssocItemRender::All => { write!(w, " -

    - Methods +

    + Methods

    ")?; RenderMode::Normal } AssocItemRender::DerefFor { trait_, type_, deref_mut_ } => { write!(w, " -

    - Methods from {}<Target = {}> +

    + Methods from {}<Target = {}>

    ", trait_, type_)?; RenderMode::ForDeref { mut_: deref_mut_ } @@ -2865,8 +2865,8 @@ fn render_assoc_items(w: &mut fmt::Formatter, render_deref_methods(w, cx, impl_, containing_item, has_deref_mut)?; } write!(w, " -

    - Trait Implementations +

    + Trait Implementations

    ")?; for i in &traits { diff --git a/src/librustdoc/html/static/rustdoc.css b/src/librustdoc/html/static/rustdoc.css index 51465bafc42e2..ee94f0baeb9a3 100644 --- a/src/librustdoc/html/static/rustdoc.css +++ b/src/librustdoc/html/static/rustdoc.css @@ -438,6 +438,16 @@ a { background: transparent; } +.small-section-header:hover > .anchor { + display: initial; +} +.anchor { + display: none; +} +.anchor:after { + content: '\2002\00a7\2002'; +} + .docblock a:hover, .docblock-short a:hover, .stability a { text-decoration: underline; } @@ -677,6 +687,10 @@ span.since { left: 0; } +.variant + .toggle-wrapper + .docblock > p { + margin-top: 5px; +} + .variant + .toggle-wrapper > a { margin-top: 5px; } @@ -695,7 +709,7 @@ span.since { margin-bottom: 25px; } -.enum .variant, .struct .structfield, .union .structfield { +#main > .variant, #main > .structfield { display: block; } diff --git a/src/libstd/fs.rs b/src/libstd/fs.rs index 38d3312b4e7dd..062186ef70866 100644 --- a/src/libstd/fs.rs +++ b/src/libstd/fs.rs @@ -28,7 +28,7 @@ use time::SystemTime; /// A reference to an open file on the filesystem. /// /// An instance of a `File` can be read and/or written depending on what options -/// it was opened with. Files also implement `Seek` to alter the logical cursor +/// it was opened with. Files also implement [`Seek`] to alter the logical cursor /// that the file contains internally. /// /// Files are automatically closed when they go out of scope. @@ -48,7 +48,7 @@ use time::SystemTime; /// # } /// ``` /// -/// Read the contents of a file into a `String`: +/// Read the contents of a file into a [`String`]: /// /// ```no_run /// use std::fs::File; @@ -81,6 +81,8 @@ use time::SystemTime; /// # } /// ``` /// +/// [`Seek`]: ../io/trait.Seek.html +/// [`String`]: ../string/struct.String.html /// [`Read`]: ../io/trait.Read.html /// [`BufReader`]: ../io/struct.BufReader.html #[stable(feature = "rust1", since = "1.0.0")] @@ -104,19 +106,19 @@ pub struct Metadata(fs_imp::FileAttr); /// Iterator over the entries in a directory. /// /// This iterator is returned from the [`read_dir`] function of this module and -/// will yield instances of `io::Result`. Through a [`DirEntry`] +/// will yield instances of [`io::Result`]`<`[`DirEntry`]`>`. Through a [`DirEntry`] /// information like the entry's path and possibly other metadata can be /// learned. /// -/// [`read_dir`]: fn.read_dir.html -/// [`DirEntry`]: struct.DirEntry.html -/// /// # Errors /// -/// This [`io::Result`] will be an `Err` if there's some sort of intermittent +/// This [`io::Result`] will be an [`Err`] if there's some sort of intermittent /// IO error during iteration. /// +/// [`read_dir`]: fn.read_dir.html +/// [`DirEntry`]: struct.DirEntry.html /// [`io::Result`]: ../io/type.Result.html +/// [`Err`]: ../result/enum.Result.html#variant.Err #[stable(feature = "rust1", since = "1.0.0")] #[derive(Debug)] pub struct ReadDir(fs_imp::ReadDir); diff --git a/src/libstd/io/error.rs b/src/libstd/io/error.rs index 0a5804a774411..68f55221a6c98 100644 --- a/src/libstd/io/error.rs +++ b/src/libstd/io/error.rs @@ -17,17 +17,21 @@ use convert::From; /// A specialized [`Result`](../result/enum.Result.html) type for I/O /// operations. /// -/// This type is broadly used across `std::io` for any operation which may +/// This type is broadly used across [`std::io`] for any operation which may /// produce an error. /// -/// This typedef is generally used to avoid writing out `io::Error` directly and -/// is otherwise a direct mapping to `Result`. +/// This typedef is generally used to avoid writing out [`io::Error`] directly and +/// is otherwise a direct mapping to [`Result`]. /// -/// While usual Rust style is to import types directly, aliases of `Result` -/// often are not, to make it easier to distinguish between them. `Result` is -/// generally assumed to be `std::result::Result`, and so users of this alias +/// While usual Rust style is to import types directly, aliases of [`Result`] +/// often are not, to make it easier to distinguish between them. [`Result`] is +/// generally assumed to be [`std::result::Result`][`Result`], and so users of this alias /// will generally use `io::Result` instead of shadowing the prelude's import -/// of `std::result::Result`. +/// of [`std::result::Result`][`Result`]. +/// +/// [`std::io`]: ../io/index.html +/// [`io::Error`]: ../io/struct.Error.html +/// [`Result`]: ../result/enum.Result.html /// /// # Examples /// @@ -47,13 +51,16 @@ use convert::From; #[stable(feature = "rust1", since = "1.0.0")] pub type Result = result::Result; -/// The error type for I/O operations of the `Read`, `Write`, `Seek`, and +/// The error type for I/O operations of the [`Read`], [`Write`], [`Seek`], and /// associated traits. /// /// Errors mostly originate from the underlying OS, but custom instances of /// `Error` can be created with crafted error messages and a particular value of /// [`ErrorKind`]. /// +/// [`Read`]: ../io/trait.Read.html +/// [`Write`]: ../io/trait.Write.html +/// [`Seek`]: ../io/trait.Seek.html /// [`ErrorKind`]: enum.ErrorKind.html #[derive(Debug)] #[stable(feature = "rust1", since = "1.0.0")] diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs index 9a3036f753ed3..f486493f98b4c 100644 --- a/src/libstd/io/mod.rs +++ b/src/libstd/io/mod.rs @@ -22,7 +22,7 @@ //! you'll see a few different types of I/O throughout the documentation in //! this module: [`File`]s, [`TcpStream`]s, and sometimes even [`Vec`]s. For //! example, [`Read`] adds a [`read`][`Read::read`] method, which we can use on -//! `File`s: +//! [`File`]s: //! //! ``` //! use std::io; @@ -146,9 +146,9 @@ //! # } //! ``` //! -//! Note that you cannot use the `?` operator in functions that do not return -//! a `Result` (e.g. `main`). Instead, you can call `.unwrap()` or `match` -//! on the return value to catch any possible errors: +//! Note that you cannot use the [`?` operator] in functions that do not return +//! a [`Result`][`Result`] (e.g. `main`). Instead, you can call [`.unwrap()`] +//! or `match` on the return value to catch any possible errors: //! //! ``` //! use std::io; @@ -265,6 +265,8 @@ //! [`io::Result`]: type.Result.html //! [`?` operator]: ../../book/first-edition/syntax-index.html //! [`Read::read`]: trait.Read.html#tymethod.read +//! [`Result`]: ../result/enum.Result.html +//! [`.unwrap()`]: ../result/enum.Result.html#method.unwrap #![stable(feature = "rust1", since = "1.0.0")] diff --git a/src/libstd/net/ip.rs b/src/libstd/net/ip.rs index 1e5368896af91..0abf8179cc971 100644 --- a/src/libstd/net/ip.rs +++ b/src/libstd/net/ip.rs @@ -466,7 +466,7 @@ impl Ipv4Addr { /// - test addresses used for documentation (192.0.2.0/24, 198.51.100.0/24 and 203.0.113.0/24) /// - the unspecified address (0.0.0.0) /// - /// [ipv4-sr]: http://goo.gl/RaZ7lg + /// [ipv4-sr]: https://www.iana.org/assignments/iana-ipv4-special-registry/iana-ipv4-special-registry.xhtml /// [`true`]: ../../std/primitive.bool.html /// /// # Examples diff --git a/src/libstd/panic.rs b/src/libstd/panic.rs index 58356bc43eebc..10b3209257efe 100644 --- a/src/libstd/panic.rs +++ b/src/libstd/panic.rs @@ -37,7 +37,7 @@ pub use panicking::{take_hook, set_hook, PanicInfo, Location}; /// In Rust a function can "return" early if it either panics or calls a /// function which transitively panics. This sort of control flow is not always /// anticipated, and has the possibility of causing subtle bugs through a -/// combination of two cricial components: +/// combination of two criticial components: /// /// 1. A data structure is in a temporarily invalid state when the thread /// panics. diff --git a/src/libstd/sys/redox/syscall/call.rs b/src/libstd/sys/redox/syscall/call.rs index ec9005c2cc3be..9fc809eb821d8 100644 --- a/src/libstd/sys/redox/syscall/call.rs +++ b/src/libstd/sys/redox/syscall/call.rs @@ -40,7 +40,7 @@ pub unsafe fn brk(addr: usize) -> Result { /// /// * `EACCES` - permission is denied for one of the components of `path`, or `path` /// * `EFAULT` - `path` does not point to the process's addressible memory -/// * `EIO` - an I/O error occured +/// * `EIO` - an I/O error occurred /// * `ENOENT` - `path` does not exit /// * `ENOTDIR` - `path` is not a directory pub fn chdir(path: &str) -> Result { @@ -290,7 +290,7 @@ pub fn waitpid(pid: usize, status: &mut usize, options: usize) -> Result /// * `EAGAIN` - the file descriptor was opened with `O_NONBLOCK` and writing would block /// * `EBADF` - the file descriptor is not valid or is not open for writing /// * `EFAULT` - `buf` does not point to the process's addressible memory -/// * `EIO` - an I/O error occured +/// * `EIO` - an I/O error occurred /// * `ENOSPC` - the device containing the file descriptor has no room for data /// * `EPIPE` - the file descriptor refers to a pipe or socket whose reading end is closed pub fn write(fd: usize, buf: &[u8]) -> Result { diff --git a/src/libstd/sys/unix/ext/net.rs b/src/libstd/sys/unix/ext/net.rs index 94b87a6bff490..7701ae25b418f 100644 --- a/src/libstd/sys/unix/ext/net.rs +++ b/src/libstd/sys/unix/ext/net.rs @@ -655,7 +655,7 @@ impl UnixListener { /// Accepts a new incoming connection to this listener. /// /// This function will block the calling thread until a new Unix connection - /// is established. When established, the corersponding [`UnixStream`] and + /// is established. When established, the corresponding [`UnixStream`] and /// the remote peer's address will be returned. /// /// [`UnixStream`]: ../../../../std/os/unix/net/struct.UnixStream.html diff --git a/src/libstd/thread/mod.rs b/src/libstd/thread/mod.rs index cbd019c2c0e64..80eb8ba93f754 100644 --- a/src/libstd/thread/mod.rs +++ b/src/libstd/thread/mod.rs @@ -531,7 +531,7 @@ pub fn current() -> Thread { /// /// However programmers will usually prefer to use, [`channel`]s, [`Condvar`]s, /// [`Mutex`]es or [`join`] for their synchronisation routines, as they avoid -/// thinking about thread schedulling. +/// thinking about thread scheduling. /// /// Note that [`channel`]s for example are implemented using this primitive. /// Indeed when you call `send` or `recv`, which are blocking, they will yield diff --git a/src/libsyntax/attr.rs b/src/libsyntax/attr.rs index a247fe7f8a56a..d5caf458fd762 100644 --- a/src/libsyntax/attr.rs +++ b/src/libsyntax/attr.rs @@ -435,7 +435,7 @@ pub fn mk_attr_inner(span: Span, id: AttrId, item: MetaItem) -> Attribute { mk_spanned_attr_inner(span, id, item) } -/// Returns an innter attribute with the given value and span. +/// Returns an inner attribute with the given value and span. pub fn mk_spanned_attr_inner(sp: Span, id: AttrId, item: MetaItem) -> Attribute { Attribute { id: id, diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index 7eeafa72c6829..194d30e25d410 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -pub use self::SyntaxExtension::{MultiDecorator, MultiModifier, NormalTT, IdentTT}; +pub use self::SyntaxExtension::*; use ast::{self, Attribute, Name, PatKind, MetaItem}; use attr::HasAttrs; diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index 16c264e0f9410..4843a66a750fa 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -294,7 +294,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> { let item = match self.cx.resolver.resolve_macro( Mark::root(), path, MacroKind::Derive, false) { Ok(ext) => match *ext { - SyntaxExtension::BuiltinDerive(..) => item_with_markers.clone(), + BuiltinDerive(..) => item_with_markers.clone(), _ => item.clone(), }, _ => item.clone(), @@ -427,7 +427,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> { items.push(item); kind.expect_from_annotatables(items) } - SyntaxExtension::AttrProcMacro(ref mac) => { + AttrProcMacro(ref mac) => { let item_tok = TokenTree::Token(DUMMY_SP, Token::interpolated(match item { Annotatable::Item(item) => token::NtItem(item), Annotatable::TraitItem(item) => token::NtTraitItem(item.unwrap()), @@ -436,7 +436,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> { let tok_result = mac.expand(self.cx, attr.span, attr.tokens, item_tok); self.parse_expansion(tok_result, kind, &attr.path, attr.span) } - SyntaxExtension::ProcMacroDerive(..) | SyntaxExtension::BuiltinDerive(..) => { + ProcMacroDerive(..) | BuiltinDerive(..) => { self.cx.span_err(attr.span, &format!("`{}` is a derive mode", attr.path)); kind.dummy(attr.span) } @@ -474,7 +474,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> { }; let opt_expanded = match *ext { - SyntaxExtension::DeclMacro(ref expand, def_span) => { + DeclMacro(ref expand, def_span) => { if let Err(msg) = validate_and_set_expn_info(def_span.map(|(_, s)| s), false) { self.cx.span_err(path.span, &msg); @@ -512,18 +512,18 @@ impl<'a, 'b> MacroExpander<'a, 'b> { kind.make_from(expander.expand(self.cx, span, ident, input)) } - MultiDecorator(..) | MultiModifier(..) | SyntaxExtension::AttrProcMacro(..) => { + MultiDecorator(..) | MultiModifier(..) | AttrProcMacro(..) => { self.cx.span_err(path.span, &format!("`{}` can only be used in attributes", path)); return kind.dummy(span); } - SyntaxExtension::ProcMacroDerive(..) | SyntaxExtension::BuiltinDerive(..) => { + ProcMacroDerive(..) | BuiltinDerive(..) => { self.cx.span_err(path.span, &format!("`{}` is a derive mode", path)); return kind.dummy(span); } - SyntaxExtension::ProcMacro(ref expandfun) => { + ProcMacro(ref expandfun) => { if ident.name != keywords::Invalid.name() { let msg = format!("macro {}! expects no ident argument, given '{}'", path, ident); @@ -582,7 +582,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> { }; match *ext { - SyntaxExtension::ProcMacroDerive(ref ext, _) => { + ProcMacroDerive(ref ext, _) => { invoc.expansion_data.mark.set_expn_info(expn_info); let span = Span { ctxt: self.cx.backtrace(), ..span }; let dummy = ast::MetaItem { // FIXME(jseyfried) avoid this @@ -592,7 +592,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> { }; kind.expect_from_annotatables(ext.expand(self.cx, span, &dummy, item)) } - SyntaxExtension::BuiltinDerive(func) => { + BuiltinDerive(func) => { expn_info.callee.allow_internal_unstable = true; invoc.expansion_data.mark.set_expn_info(expn_info); let span = Span { ctxt: self.cx.backtrace(), ..span }; diff --git a/src/libsyntax/parse/lexer/unicode_chars.rs b/src/libsyntax/parse/lexer/unicode_chars.rs index 85df4eee91344..c36fdef2d4c1d 100644 --- a/src/libsyntax/parse/lexer/unicode_chars.rs +++ b/src/libsyntax/parse/lexer/unicode_chars.rs @@ -82,7 +82,7 @@ const UNICODE_ARRAY: &'static [(char, &'static str, char)] = &[ ('։', "Armenian Full Stop", ':'), ('܃', "Syriac Supralinear Colon", ':'), ('܄', "Syriac Sublinear Colon", ':'), - ('᛬', "Runic Multiple Ponctuation", ':'), + ('᛬', "Runic Multiple Punctuation", ':'), ('︰', "Presentation Form For Vertical Two Dot Leader", ':'), ('᠃', "Mongolian Full Stop", ':'), ('᠉', "Mongolian Manchu Full Stop", ':'), @@ -264,7 +264,7 @@ const UNICODE_ARRAY: &'static [(char, &'static str, char)] = &[ ('ꝸ', "Latin Small Letter Um", '&'), ('&', "Fullwidth Ampersand", '&'), - ('᛭', "Runic Cros Punctuation", '+'), + ('᛭', "Runic Cross Punctuation", '+'), ('➕', "Heavy Plus Sign", '+'), ('𐊛', "Lycian Letter H", '+'), ('﬩', "Hebrew Letter Alternative Plus Sign", '+'), diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index 893bada2670df..957164bab79a7 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -124,7 +124,7 @@ pub fn parse_expr_from_source_str(name: String, source: String, sess: &ParseSess /// Parses an item. /// -/// Returns `Ok(Some(item))` when successful, `Ok(None)` when no item was found, and`Err` +/// Returns `Ok(Some(item))` when successful, `Ok(None)` when no item was found, and `Err` /// when a syntax error occurred. pub fn parse_item_from_source_str(name: String, source: String, sess: &ParseSess) -> PResult>> { diff --git a/src/test/compile-fail-fulldeps/proc-macro/attribute-with-error.rs b/src/test/compile-fail-fulldeps/proc-macro/attribute-with-error.rs index 65f4b6350c4ee..00a27818327f6 100644 --- a/src/test/compile-fail-fulldeps/proc-macro/attribute-with-error.rs +++ b/src/test/compile-fail-fulldeps/proc-macro/attribute-with-error.rs @@ -9,6 +9,7 @@ // except according to those terms. // aux-build:attribute-with-error.rs +// ignore-stage1 #![feature(proc_macro)] diff --git a/src/test/compile-fail-fulldeps/proc-macro/attributes-included.rs b/src/test/compile-fail-fulldeps/proc-macro/attributes-included.rs index f42d1006bf5c1..2adbee1d3fbd5 100644 --- a/src/test/compile-fail-fulldeps/proc-macro/attributes-included.rs +++ b/src/test/compile-fail-fulldeps/proc-macro/attributes-included.rs @@ -9,6 +9,7 @@ // except according to those terms. // aux-build:attributes-included.rs +// ignore-stage1 #![feature(proc_macro, rustc_attrs)] #![warn(unused)] diff --git a/src/test/compile-fail-fulldeps/proc-macro/derive-bad.rs b/src/test/compile-fail-fulldeps/proc-macro/derive-bad.rs index 42fad803bfa68..b03409c9c285e 100644 --- a/src/test/compile-fail-fulldeps/proc-macro/derive-bad.rs +++ b/src/test/compile-fail-fulldeps/proc-macro/derive-bad.rs @@ -9,6 +9,7 @@ // except according to those terms. // aux-build:derive-bad.rs +// ignore-stage1 #[macro_use] extern crate derive_bad; diff --git a/src/test/compile-fail-fulldeps/proc-macro/expand-to-unstable-2.rs b/src/test/compile-fail-fulldeps/proc-macro/expand-to-unstable-2.rs index e4fcbb117a505..6f254dcbdb11a 100644 --- a/src/test/compile-fail-fulldeps/proc-macro/expand-to-unstable-2.rs +++ b/src/test/compile-fail-fulldeps/proc-macro/expand-to-unstable-2.rs @@ -9,6 +9,7 @@ // except according to those terms. // aux-build:derive-unstable-2.rs +// ignore-stage1 #![allow(warnings)] diff --git a/src/test/compile-fail-fulldeps/proc-macro/expand-to-unstable.rs b/src/test/compile-fail-fulldeps/proc-macro/expand-to-unstable.rs index 836e336fc22f0..ca0f0e382ed0c 100644 --- a/src/test/compile-fail-fulldeps/proc-macro/expand-to-unstable.rs +++ b/src/test/compile-fail-fulldeps/proc-macro/expand-to-unstable.rs @@ -9,6 +9,7 @@ // except according to those terms. // aux-build:derive-unstable.rs +// ignore-stage1 #![allow(warnings)] diff --git a/src/test/compile-fail-fulldeps/proc-macro/issue-38586.rs b/src/test/compile-fail-fulldeps/proc-macro/issue-38586.rs index 42475e6de90c9..1d645a7ec510f 100644 --- a/src/test/compile-fail-fulldeps/proc-macro/issue-38586.rs +++ b/src/test/compile-fail-fulldeps/proc-macro/issue-38586.rs @@ -9,6 +9,7 @@ // except according to those terms. // aux-build:issue_38586.rs +// ignore-stage1 #![feature(proc_macro)] diff --git a/src/test/compile-fail-fulldeps/proc-macro/item-error.rs b/src/test/compile-fail-fulldeps/proc-macro/item-error.rs index 4133e75e3a62d..c0d4d71a6ec8b 100644 --- a/src/test/compile-fail-fulldeps/proc-macro/item-error.rs +++ b/src/test/compile-fail-fulldeps/proc-macro/item-error.rs @@ -9,6 +9,7 @@ // except according to those terms. // aux-build:derive-b.rs +// ignore-stage1 #![allow(warnings)] diff --git a/src/test/compile-fail-fulldeps/proc-macro/lints_in_proc_macros.rs b/src/test/compile-fail-fulldeps/proc-macro/lints_in_proc_macros.rs index 93dead1a15685..b1fb7d42d8683 100644 --- a/src/test/compile-fail-fulldeps/proc-macro/lints_in_proc_macros.rs +++ b/src/test/compile-fail-fulldeps/proc-macro/lints_in_proc_macros.rs @@ -9,6 +9,7 @@ // except according to those terms. // aux-build:bang_proc_macro2.rs +// ignore-stage1 #![feature(proc_macro)] #![allow(unused_macros)] diff --git a/src/test/compile-fail-fulldeps/proc-macro/proc-macro-attributes.rs b/src/test/compile-fail-fulldeps/proc-macro/proc-macro-attributes.rs index df881bedec1bb..153e4dd05717a 100644 --- a/src/test/compile-fail-fulldeps/proc-macro/proc-macro-attributes.rs +++ b/src/test/compile-fail-fulldeps/proc-macro/proc-macro-attributes.rs @@ -9,6 +9,7 @@ // except according to those terms. // aux-build:derive-b.rs +// ignore-stage1 #![allow(warnings)] diff --git a/src/test/mir-opt/validate_1.rs b/src/test/mir-opt/validate_1.rs index 9ac76a5f4ea61..677c92ea71b7a 100644 --- a/src/test/mir-opt/validate_1.rs +++ b/src/test/mir-opt/validate_1.rs @@ -9,7 +9,7 @@ // except according to those terms. // ignore-tidy-linelength -// compile-flags: -Z verbose -Z mir-emit-validate=1 +// compile-flags: -Z verbose -Z mir-emit-validate=1 -Z span_free_formats struct Test(i32); @@ -20,16 +20,13 @@ impl Test { fn main() { let mut x = 0; - Test(0).foo(&mut x); + Test(0).foo(&mut x); // just making sure we do not panic when there is a tuple struct ctor // Also test closures let c = |x: &mut i32| { let y = &*x; *y }; c(&mut x); } -// FIXME: Also test code generated inside the closure, make sure it has validation. Unfortunately, -// the interesting lines of code also contain name of the source file, so we cannot test for it. - // END RUST SOURCE // START rustc.node12.EraseRegions.after.mir // bb0: { @@ -57,3 +54,24 @@ fn main() { // } // } // END rustc.node23.EraseRegions.after.mir +// START rustc.node50.EraseRegions.after.mir +// fn main::{{closure}}(_1: &ReErased [closure@NodeId(50)], _2: &ReErased mut i32) -> i32 { +// bb0: { +// Validate(Acquire, [_1: &ReFree(DefId { krate: CrateNum(0), node: DefIndex(2147483663) => validate_1/8cd878b::main[0]::{{closure}}[0] }, "BrEnv") [closure@NodeId(50)], _2: &ReFree(DefId { krate: CrateNum(0), node: DefIndex(2147483663) => validate_1/8cd878b::main[0]::{{closure}}[0] }, BrAnon(1)) mut i32]); +// StorageLive(_3); +// _3 = _2; +// StorageLive(_4); +// Validate(Suspend(ReScope(Remainder(BlockRemainder { block: NodeId(41), first_statement_index: 0 }))), [(*_3): i32]); +// _4 = &ReErased (*_3); +// Validate(Acquire, [(*_4): i32/ReScope(Remainder(BlockRemainder { block: NodeId(41), first_statement_index: 0 })) (imm)]); +// StorageLive(_5); +// _5 = (*_4); +// _0 = _5; +// StorageDead(_5); +// StorageDead(_4); +// EndRegion(ReScope(Remainder(BlockRemainder { block: NodeId(41), first_statement_index: 0 }))); +// StorageDead(_3); +// return; +// } +// } +// END rustc.node50.EraseRegions.after.mir diff --git a/src/test/mir-opt/validate_4.rs b/src/test/mir-opt/validate_4.rs index 591de975740f9..2ee459d6809c5 100644 --- a/src/test/mir-opt/validate_4.rs +++ b/src/test/mir-opt/validate_4.rs @@ -9,7 +9,7 @@ // except according to those terms. // ignore-tidy-linelength -// compile-flags: -Z verbose -Z mir-emit-validate=1 +// compile-flags: -Z verbose -Z mir-emit-validate=1 -Z span_free_formats // Make sure unsafe fns and fns with an unsafe block only get restricted validation. @@ -45,6 +45,19 @@ fn main() { // } // } // END rustc.node4.EraseRegions.after.mir +// START rustc.node22.EraseRegions.after.mir +// fn write_42::{{closure}}(_1: &ReErased [closure@NodeId(22)], _2: *mut i32) -> () { +// bb0: { +// Validate(Acquire, [_1: &ReFree(DefId { krate: CrateNum(0), node: DefIndex(2147483659) => validate_4/8cd878b::write_42[0]::{{closure}}[0] }, "BrEnv") [closure@NodeId(22)], _2: *mut i32]); +// Validate(Release, [_1: &ReFree(DefId { krate: CrateNum(0), node: DefIndex(2147483659) => validate_4/8cd878b::write_42[0]::{{closure}}[0] }, "BrEnv") [closure@NodeId(22)], _2: *mut i32]); +// StorageLive(_3); +// _3 = _2; +// (*_3) = const 23i32; +// StorageDead(_3); +// return; +// } +// } +// END rustc.node22.EraseRegions.after.mir // START rustc.node31.EraseRegions.after.mir // fn test(_1: &ReErased mut i32) -> () { // bb0: { @@ -58,3 +71,13 @@ fn main() { // } // } // END rustc.node31.EraseRegions.after.mir +// START rustc.node60.EraseRegions.after.mir +// fn main::{{closure}}(_1: &ReErased [closure@NodeId(60)], _2: &ReErased mut i32) -> bool { +// bb0: { +// Validate(Acquire, [_1: &ReFree(DefId { krate: CrateNum(0), node: DefIndex(2147483663) => validate_4/8cd878b::main[0]::{{closure}}[0] }, "BrEnv") [closure@NodeId(60)], _2: &ReFree(DefId { krate: CrateNum(0), node: DefIndex(2147483663) => validate_4/8cd878b::main[0]::{{closure}}[0] }, BrAnon(1)) mut i32]); +// Validate(Release, [_1: &ReFree(DefId { krate: CrateNum(0), node: DefIndex(2147483663) => validate_4/8cd878b::main[0]::{{closure}}[0] }, "BrEnv") [closure@NodeId(60)], _2: &ReFree(DefId { krate: CrateNum(0), node: DefIndex(2147483663) => validate_4/8cd878b::main[0]::{{closure}}[0] }, BrAnon(1)) mut i32]); +// StorageLive(_3); +// _0 = const write_42(_4) -> bb1; +// } +// } +// END rustc.node60.EraseRegions.after.mir diff --git a/src/test/mir-opt/validate_5.rs b/src/test/mir-opt/validate_5.rs index e9919af9fd3a6..0182e6e296445 100644 --- a/src/test/mir-opt/validate_5.rs +++ b/src/test/mir-opt/validate_5.rs @@ -9,9 +9,9 @@ // except according to those terms. // ignore-tidy-linelength -// compile-flags: -Z verbose -Z mir-emit-validate=2 +// compile-flags: -Z verbose -Z mir-emit-validate=2 -Z span_free_formats -// Make sure unsafe fns and fns with an unsafe block only get full validation. +// Make sure unsafe fns and fns with an unsafe block still get full validation. unsafe fn write_42(x: *mut i32) -> bool { *x = 42; @@ -26,12 +26,12 @@ fn main() { test(&mut 0); let test_closure = unsafe { |x: &mut i32| write_42(x) }; + // Note that validation will fail if this is executed: The closure keeps the lock on + // x, so the write in write_42 fails. This test just checks code generation, + // so the UB doesn't matter. test_closure(&mut 0); } -// FIXME: Also test code generated inside the closure, make sure it has validation. Unfortunately, -// the interesting lines of code also contain name of the source file, so we cannot test for it. - // END RUST SOURCE // START rustc.node17.EraseRegions.after.mir // fn test(_1: &ReErased mut i32) -> () { @@ -42,3 +42,22 @@ fn main() { // } // } // END rustc.node17.EraseRegions.after.mir +// START rustc.node46.EraseRegions.after.mir +// fn main::{{closure}}(_1: &ReErased [closure@NodeId(46)], _2: &ReErased mut i32) -> bool { +// bb0: { +// Validate(Acquire, [_1: &ReFree(DefId { krate: CrateNum(0), node: DefIndex(2147483660) => validate_5/8cd878b::main[0]::{{closure}}[0] }, "BrEnv") [closure@NodeId(46)], _2: &ReFree(DefId { krate: CrateNum(0), node: DefIndex(2147483660) => validate_5/8cd878b::main[0]::{{closure}}[0] }, BrAnon(1)) mut i32]); +// StorageLive(_3); +// _3 = _2; +// StorageLive(_4); +// StorageLive(_5); +// Validate(Suspend(ReScope(Misc(NodeId(44)))), [(*_3): i32]); +// _5 = &ReErased mut (*_3); +// Validate(Acquire, [(*_5): i32/ReScope(Misc(NodeId(44)))]); +// _4 = _5 as *mut i32 (Misc); +// StorageDead(_5); +// EndRegion(ReScope(Misc(NodeId(44)))); +// Validate(Release, [_0: bool, _4: *mut i32]); +// _0 = const write_42(_4) -> bb1; +// } +// } +// END rustc.node46.EraseRegions.after.mir diff --git a/src/test/run-make/issue-37839/Makefile b/src/test/run-make/issue-37839/Makefile index f17ce537fb813..8b3355b96226a 100644 --- a/src/test/run-make/issue-37839/Makefile +++ b/src/test/run-make/issue-37839/Makefile @@ -1,6 +1,12 @@ -include ../tools.mk +ifeq ($(findstring stage1,$(RUST_BUILD_STAGE)),stage1) +# ignore stage1 +all: + +else all: $(RUSTC) a.rs && $(RUSTC) b.rs $(BARE_RUSTC) c.rs -L dependency=$(TMPDIR) --extern b=$(TMPDIR)/libb.rlib \ --out-dir=$(TMPDIR) +endif diff --git a/src/test/run-make/issue-37893/Makefile b/src/test/run-make/issue-37893/Makefile index 27b69baf97787..c7732cc2682b1 100644 --- a/src/test/run-make/issue-37893/Makefile +++ b/src/test/run-make/issue-37893/Makefile @@ -1,4 +1,10 @@ -include ../tools.mk +ifeq ($(findstring stage1,$(RUST_BUILD_STAGE)),stage1) +# ignore stage1 +all: + +else all: $(RUSTC) a.rs && $(RUSTC) b.rs && $(RUSTC) c.rs +endif diff --git a/src/test/run-make/issue-38237/Makefile b/src/test/run-make/issue-38237/Makefile index 0a681401b1afb..855d958b344a9 100644 --- a/src/test/run-make/issue-38237/Makefile +++ b/src/test/run-make/issue-38237/Makefile @@ -1,5 +1,11 @@ -include ../tools.mk +ifeq ($(findstring stage1,$(RUST_BUILD_STAGE)),stage1) +# ignore stage1 +all: + +else all: $(RUSTC) foo.rs; $(RUSTC) bar.rs $(RUSTDOC) baz.rs -L $(TMPDIR) -o $(TMPDIR) +endif diff --git a/src/test/run-make/llvm-pass/Makefile b/src/test/run-make/llvm-pass/Makefile index aab6e895f2260..0d31d2c823500 100644 --- a/src/test/run-make/llvm-pass/Makefile +++ b/src/test/run-make/llvm-pass/Makefile @@ -1,5 +1,10 @@ -include ../tools.mk +ifeq ($(findstring stage1,$(RUST_BUILD_STAGE)),stage1) +# ignore stage1 +all: + +else # Windows doesn't correctly handle include statements with escaping paths, # so this test will not get run on Windows. ifdef IS_WINDOWS @@ -15,3 +20,5 @@ $(TMPDIR)/libllvm-function-pass.o: $(TMPDIR)/libllvm-module-pass.o: $(CXX) $(CFLAGS) $(LLVM_CXXFLAGS) -c llvm-module-pass.so.cc -o $(TMPDIR)/libllvm-module-pass.o endif + +endif diff --git a/src/test/run-make/rustc-macro-dep-files/Makefile b/src/test/run-make/rustc-macro-dep-files/Makefile index e3a6776c8080b..1ab27397e3146 100644 --- a/src/test/run-make/rustc-macro-dep-files/Makefile +++ b/src/test/run-make/rustc-macro-dep-files/Makefile @@ -1,6 +1,12 @@ -include ../tools.mk +ifeq ($(findstring stage1,$(RUST_BUILD_STAGE)),stage1) +# ignore stage1 +all: + +else all: $(RUSTC) foo.rs $(RUSTC) bar.rs --emit dep-info grep "proc-macro source" $(TMPDIR)/bar.d && exit 1 || exit 0 +endif diff --git a/src/test/run-pass-fulldeps/issue-40663.rs b/src/test/run-pass-fulldeps/issue-40663.rs index d030eab64e564..8cb9dc4a1b6ec 100644 --- a/src/test/run-pass-fulldeps/issue-40663.rs +++ b/src/test/run-pass-fulldeps/issue-40663.rs @@ -9,6 +9,7 @@ // except according to those terms. // aux-build:custom_derive_plugin.rs +// ignore-stage1 #![feature(plugin, custom_derive)] #![plugin(custom_derive_plugin)] diff --git a/src/test/run-pass-fulldeps/proc-macro/add-impl.rs b/src/test/run-pass-fulldeps/proc-macro/add-impl.rs index 7ea7ceafc2876..5175fe174a9e7 100644 --- a/src/test/run-pass-fulldeps/proc-macro/add-impl.rs +++ b/src/test/run-pass-fulldeps/proc-macro/add-impl.rs @@ -9,6 +9,7 @@ // except according to those terms. // aux-build:add-impl.rs +// ignore-stage1 #[macro_use] extern crate add_impl; diff --git a/src/test/run-pass-fulldeps/proc-macro/append-impl.rs b/src/test/run-pass-fulldeps/proc-macro/append-impl.rs index 591f3331d28c0..37aef7ef1318c 100644 --- a/src/test/run-pass-fulldeps/proc-macro/append-impl.rs +++ b/src/test/run-pass-fulldeps/proc-macro/append-impl.rs @@ -9,6 +9,7 @@ // except according to those terms. // aux-build:append-impl.rs +// ignore-stage1 #![allow(warnings)] diff --git a/src/test/run-pass-fulldeps/proc-macro/attr-args.rs b/src/test/run-pass-fulldeps/proc-macro/attr-args.rs index 8a9fdd7536770..2968cc7871d7e 100644 --- a/src/test/run-pass-fulldeps/proc-macro/attr-args.rs +++ b/src/test/run-pass-fulldeps/proc-macro/attr-args.rs @@ -9,6 +9,7 @@ // except according to those terms. // aux-build:attr-args.rs +// ignore-stage1 #![allow(warnings)] #![feature(proc_macro)] diff --git a/src/test/run-pass-fulldeps/proc-macro/bang-macro.rs b/src/test/run-pass-fulldeps/proc-macro/bang-macro.rs index 531bd0dd3569d..ffa4731f1e637 100644 --- a/src/test/run-pass-fulldeps/proc-macro/bang-macro.rs +++ b/src/test/run-pass-fulldeps/proc-macro/bang-macro.rs @@ -9,6 +9,7 @@ // except according to those terms. // aux-build:bang-macro.rs +// ignore-stage1 #![feature(proc_macro)] diff --git a/src/test/run-pass-fulldeps/proc-macro/count_compound_ops.rs b/src/test/run-pass-fulldeps/proc-macro/count_compound_ops.rs index 1a2b144e4717b..00ad0e76ed014 100644 --- a/src/test/run-pass-fulldeps/proc-macro/count_compound_ops.rs +++ b/src/test/run-pass-fulldeps/proc-macro/count_compound_ops.rs @@ -9,6 +9,7 @@ // except according to those terms. // aux-build:count_compound_ops.rs +// ignore-stage1 #![feature(proc_macro)] diff --git a/src/test/run-pass-fulldeps/proc-macro/crate-var.rs b/src/test/run-pass-fulldeps/proc-macro/crate-var.rs index ba1417ecb56e4..b6acb0faab2a5 100644 --- a/src/test/run-pass-fulldeps/proc-macro/crate-var.rs +++ b/src/test/run-pass-fulldeps/proc-macro/crate-var.rs @@ -9,6 +9,7 @@ // except according to those terms. // aux-build:double.rs +// ignore-stage1 #![allow(unused)] diff --git a/src/test/run-pass-fulldeps/proc-macro/derive-same-struct.rs b/src/test/run-pass-fulldeps/proc-macro/derive-same-struct.rs index ce3ba60b0ecf4..ba5a639a759cb 100644 --- a/src/test/run-pass-fulldeps/proc-macro/derive-same-struct.rs +++ b/src/test/run-pass-fulldeps/proc-macro/derive-same-struct.rs @@ -9,6 +9,7 @@ // except according to those terms. // aux-build:derive-same-struct.rs +// ignore-stage1 #[macro_use] extern crate derive_same_struct; diff --git a/src/test/run-pass-fulldeps/proc-macro/hygiene_example.rs b/src/test/run-pass-fulldeps/proc-macro/hygiene_example.rs index 51198db5aa76d..4cac7d19b4de8 100644 --- a/src/test/run-pass-fulldeps/proc-macro/hygiene_example.rs +++ b/src/test/run-pass-fulldeps/proc-macro/hygiene_example.rs @@ -10,6 +10,7 @@ // aux-build:hygiene_example_codegen.rs // aux-build:hygiene_example.rs +// ignore-stage1 #![feature(proc_macro)] diff --git a/src/test/run-pass-fulldeps/proc-macro/issue-39889.rs b/src/test/run-pass-fulldeps/proc-macro/issue-39889.rs index 05610116ad6bf..87130242c0f04 100644 --- a/src/test/run-pass-fulldeps/proc-macro/issue-39889.rs +++ b/src/test/run-pass-fulldeps/proc-macro/issue-39889.rs @@ -9,6 +9,7 @@ // except according to those terms. // aux-build:issue-39889.rs +// ignore-stage1 #![feature(proc_macro)] #![allow(unused)] diff --git a/src/test/run-pass-fulldeps/proc-macro/issue-40001.rs b/src/test/run-pass-fulldeps/proc-macro/issue-40001.rs index 54e84b7f6189f..b7826edd8b4e5 100644 --- a/src/test/run-pass-fulldeps/proc-macro/issue-40001.rs +++ b/src/test/run-pass-fulldeps/proc-macro/issue-40001.rs @@ -9,6 +9,7 @@ // except according to those terms. // aux-build:issue-40001-plugin.rs +// ignore-stage1 #![feature(proc_macro, plugin)] #![plugin(issue_40001_plugin)] diff --git a/src/test/run-pass-fulldeps/proc-macro/load-two.rs b/src/test/run-pass-fulldeps/proc-macro/load-two.rs index d15a83a2cbe43..67c1237781470 100644 --- a/src/test/run-pass-fulldeps/proc-macro/load-two.rs +++ b/src/test/run-pass-fulldeps/proc-macro/load-two.rs @@ -10,6 +10,7 @@ // aux-build:derive-atob.rs // aux-build:derive-ctod.rs +// ignore-stage1 #[macro_use] extern crate derive_atob; diff --git a/src/test/run-pass-fulldeps/proc-macro/use-reexport.rs b/src/test/run-pass-fulldeps/proc-macro/use-reexport.rs index f0a1bfe652857..03dfeb1f5c9a5 100644 --- a/src/test/run-pass-fulldeps/proc-macro/use-reexport.rs +++ b/src/test/run-pass-fulldeps/proc-macro/use-reexport.rs @@ -10,6 +10,7 @@ // aux-build:derive-a.rs // aux-build:derive-reexport.rs +// ignore-stage1 #[macro_use] extern crate derive_reexport; diff --git a/src/test/run-pass/weird-exprs.rs b/src/test/run-pass/weird-exprs.rs index 20f58301d4524..64fd9e0a7721b 100644 --- a/src/test/run-pass/weird-exprs.rs +++ b/src/test/run-pass/weird-exprs.rs @@ -107,6 +107,10 @@ fn fishy() { String::<>::from::<>("><>").chars::<>().rev::<>().collect::()); } +fn union() { + union union<'union> { union: &'union union<'union>, } +} + pub fn main() { strange(); funny(); @@ -119,4 +123,5 @@ pub fn main() { dots(); you_eight(); fishy(); + union(); } diff --git a/src/tools/tidy/src/style.rs b/src/tools/tidy/src/style.rs index b42beb37821ce..a689d8a8be411 100644 --- a/src/tools/tidy/src/style.rs +++ b/src/tools/tidy/src/style.rs @@ -83,7 +83,7 @@ fn line_is_url(line: &str) -> bool { => state = EXP_END, (EXP_URL, w) - if w.starts_with("http://") || w.starts_with("https://") + if w.starts_with("http://") || w.starts_with("https://") || w.starts_with("../") => state = EXP_END, (_, _) => return false,

- Associated Types +