diff --git a/src/ci/docker/dist-various-1/Dockerfile b/src/ci/docker/dist-various-1/Dockerfile index 5ab4be328a9f7..2a81de75a69b9 100644 --- a/src/ci/docker/dist-various-1/Dockerfile +++ b/src/ci/docker/dist-various-1/Dockerfile @@ -112,6 +112,7 @@ ENV TARGETS=$TARGETS,thumbv7em-none-eabihf ENV TARGETS=$TARGETS,thumbv8m.base-none-eabi ENV TARGETS=$TARGETS,thumbv8m.main-none-eabi ENV TARGETS=$TARGETS,thumbv8m.main-none-eabihf +ENV TARGETS=$TARGETS,riscv32i-unknown-none-elf ENV TARGETS=$TARGETS,riscv32imc-unknown-none-elf ENV TARGETS=$TARGETS,riscv32imac-unknown-none-elf ENV TARGETS=$TARGETS,riscv64imac-unknown-none-elf diff --git a/src/doc/rustc/src/lints/index.md b/src/doc/rustc/src/lints/index.md index 49c0026ce1a9b..9010d436eb5cf 100644 --- a/src/doc/rustc/src/lints/index.md +++ b/src/doc/rustc/src/lints/index.md @@ -19,7 +19,7 @@ warning: unused variable: `x` 2 | let x = 5; | ^ | - = note: #[warn(unused_variables)] on by default + = note: `#[warn(unused_variables)]` on by default = note: to avoid this warning, consider using `_x` instead ``` diff --git a/src/doc/rustc/src/lints/levels.md b/src/doc/rustc/src/lints/levels.md index d315e0f8ca9e5..834a4a79727ab 100644 --- a/src/doc/rustc/src/lints/levels.md +++ b/src/doc/rustc/src/lints/levels.md @@ -53,7 +53,7 @@ warning: unused variable: `x` 2 | let x = 5; | ^ | - = note: #[warn(unused_variables)] on by default + = note: `#[warn(unused_variables)]` on by default = note: to avoid this warning, consider using `_x` instead ``` @@ -76,7 +76,7 @@ error: bitshift exceeds the type's number of bits 2 | 100u8 << 10; | ^^^^^^^^^^^ | - = note: #[deny(exceeding_bitshifts)] on by default + = note: `#[deny(exceeding_bitshifts)]` on by default ``` What's the difference between an error from a lint and a regular old error? @@ -236,7 +236,7 @@ warning: bitshift exceeds the type's number of bits 2 | 100u8 << 10; | ^^^^^^^^^^^ | - = note: #[warn(exceeding_bitshifts)] on by default + = note: `#[warn(exceeding_bitshifts)]` on by default warning: this expression will panic at run-time --> lib.rs:2:5 diff --git a/src/doc/rustc/src/lints/listing/allowed-by-default.md b/src/doc/rustc/src/lints/listing/allowed-by-default.md index 7768b41f85ee4..a6e4e166d7bc6 100644 --- a/src/doc/rustc/src/lints/listing/allowed-by-default.md +++ b/src/doc/rustc/src/lints/listing/allowed-by-default.md @@ -165,7 +165,7 @@ pub struct Foo; When set to 'deny', this will produce: ```text -error: type does not implement `fmt::Debug`; consider adding #[derive(Debug)] or a manual implementation +error: type does not implement `fmt::Debug`; consider adding `#[derive(Debug)]` or a manual implementation --> src/main.rs:3:1 | 3 | pub struct Foo; diff --git a/src/doc/rustc/src/lints/listing/deny-by-default.md b/src/doc/rustc/src/lints/listing/deny-by-default.md index c1740f272ed26..6574267f18511 100644 --- a/src/doc/rustc/src/lints/listing/deny-by-default.md +++ b/src/doc/rustc/src/lints/listing/deny-by-default.md @@ -40,7 +40,7 @@ error: defaults for type parameters are only allowed in `struct`, `enum`, `type` 4 | fn foo(t: T) {} | ^ | - = note: #[deny(invalid_type_param_default)] on by default + = note: `#[deny(invalid_type_param_default)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #36887 ``` @@ -74,7 +74,7 @@ error: private struct constructors are not usable through re-exports in outer mo 5 | ::S; | ^^^ | - = note: #[deny(legacy_constructor_visibility)] on by default + = note: `#[deny(legacy_constructor_visibility)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #39207 ``` @@ -84,9 +84,9 @@ error: private struct constructors are not usable through re-exports in outer mo The legacy_directory_ownership warning is issued when -* There is a non-inline module with a #[path] attribute (e.g. #[path = "foo.rs"] mod bar;), +* There is a non-inline module with a `#[path]` attribute (e.g. `#[path = "foo.rs"] mod bar;`), * The module's file ("foo.rs" in the above example) is not named "mod.rs", and -* The module's file contains a non-inline child module without a #[path] attribute. +* The module's file contains a non-inline child module without a `#[path]` attribute. The warning can be fixed by renaming the parent module to "mod.rs" and moving it into its own directory if appropriate. @@ -139,7 +139,7 @@ const FOO: i32 = 5; This will produce: ```text -error: const items should never be #[no_mangle] +error: const items should never be `#[no_mangle]` --> src/main.rs:3:1 | 3 | const FOO: i32 = 5; @@ -187,7 +187,7 @@ error: parenthesized parameters may only be used with a trait 2 | let x = 5 as usize(); | ^^ | - = note: #[deny(parenthesized_params_in_types_and_modules)] on by default + = note: `#[deny(parenthesized_params_in_types_and_modules)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #42238 ``` diff --git a/src/doc/rustc/src/lints/listing/warn-by-default.md b/src/doc/rustc/src/lints/listing/warn-by-default.md index 6d4aa024c75b4..e486240fda896 100644 --- a/src/doc/rustc/src/lints/listing/warn-by-default.md +++ b/src/doc/rustc/src/lints/listing/warn-by-default.md @@ -90,7 +90,7 @@ warning: floating-point literals cannot be used in patterns 4 | 5.0 => {}, | ^^^ | - = note: #[warn(illegal_floating_point_literal_pattern)] on by default + = note: `#[warn(illegal_floating_point_literal_pattern)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #41620 ``` @@ -109,7 +109,7 @@ extern "C" { This will produce: ```text -warning: found struct without foreign-function-safe representation annotation in foreign module, consider adding a #[repr(C)] attribute to the type +warning: found struct without foreign-function-safe representation annotation in foreign module, consider adding a `#[repr(C)]` attribute to the type --> src/main.rs:2:20 | 2 | static STATIC: String; @@ -146,7 +146,7 @@ warning: cannot specify lifetime arguments explicitly if late bound lifetime par 8 | S.late::<'static>(&0, &0); | ^^^^^^^ | - = note: #[warn(late_bound_lifetime_arguments)] on by default + = note: `#[warn(late_bound_lifetime_arguments)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #42868 ``` @@ -327,7 +327,7 @@ warning: patterns aren't allowed in methods without bodies 2 | fn foo(mut arg: u8); | ^^^^^^^ | - = note: #[warn(patterns_in_fns_without_body)] on by default + = note: `#[warn(patterns_in_fns_without_body)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #35203 ``` @@ -406,7 +406,7 @@ fn foo() {} This will produce: ```text -warning: function is marked #[no_mangle], but not exported +warning: function is marked `#[no_mangle]`, but not exported --> src/main.rs:2:1 | 2 | fn foo() {} @@ -433,7 +433,7 @@ static X: i32 = 4; This will produce: ```text -warning: static is marked #[no_mangle], but not exported +warning: static is marked `#[no_mangle]`, but not exported --> src/main.rs:2:1 | 2 | static X: i32 = 4; @@ -496,7 +496,7 @@ warning: borrow of packed field requires unsafe function or block (error E0133) 11 | let y = &x.data.0; | ^^^^^^^^^ | - = note: #[warn(safe_packed_borrows)] on by default + = note: `#[warn(safe_packed_borrows)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #46043 ``` @@ -542,7 +542,7 @@ warning: bounds on generic parameters are not enforced in type aliases 2 | type SendVec = Vec; | ^^^^ | - = note: #[warn(type_alias_bounds)] on by default + = note: `#[warn(type_alias_bounds)]` on by default = help: the bound will not be checked when the type alias is used, and should be removed ``` @@ -567,7 +567,7 @@ warning: type annotations needed 4 | if data.is_null() {} | ^^^^^^^ | - = note: #[warn(tyvar_behind_raw_pointer)] on by default + = note: `#[warn(tyvar_behind_raw_pointer)]` on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition! = note: for more information, see issue #46906 ``` @@ -787,7 +787,7 @@ warning: doc comment not used by rustdoc ## unused-features -This lint detects unused or unknown features found in crate-level #[feature] directives. +This lint detects unused or unknown features found in crate-level `#[feature]` directives. To fix this, simply remove the feature flag. ## unused-imports @@ -839,7 +839,7 @@ warning: unused macro definition ## unused-must-use -This lint detects unused result of a type flagged as #[must_use]. Some +This lint detects unused result of a type flagged as `#[must_use]`. Some example code that triggers this lint: ```rust diff --git a/src/liballoc/slice.rs b/src/liballoc/slice.rs index bc4ae16798478..881d499c0745b 100644 --- a/src/liballoc/slice.rs +++ b/src/liballoc/slice.rs @@ -494,10 +494,10 @@ impl [T] { /// assert_eq!([[1, 2], [3, 4]].concat(), [1, 2, 3, 4]); /// ``` #[stable(feature = "rust1", since = "1.0.0")] - pub fn concat(&self) -> T::Output - where T: SliceConcat + pub fn concat(&self) -> >::Output + where Self: Concat { - SliceConcat::concat(self) + Concat::concat(self) } /// Flattens a slice of `T` into a single value `Self::Output`, placing a @@ -508,12 +508,13 @@ impl [T] { /// ``` /// assert_eq!(["hello", "world"].join(" "), "hello world"); /// assert_eq!([[1, 2], [3, 4]].join(&0), [1, 2, 0, 3, 4]); + /// assert_eq!([[1, 2], [3, 4]].join(&[0, 0][..]), [1, 2, 0, 0, 3, 4]); /// ``` #[stable(feature = "rename_connect_to_join", since = "1.3.0")] - pub fn join(&self, sep: &Separator) -> T::Output - where T: SliceConcat + pub fn join(&self, sep: Separator) -> >::Output + where Self: Join { - SliceConcat::join(self, sep) + Join::join(self, sep) } /// Flattens a slice of `T` into a single value `Self::Output`, placing a @@ -528,10 +529,10 @@ impl [T] { /// ``` #[stable(feature = "rust1", since = "1.0.0")] #[rustc_deprecated(since = "1.3.0", reason = "renamed to join")] - pub fn connect(&self, sep: &Separator) -> T::Output - where T: SliceConcat + pub fn connect(&self, sep: Separator) -> >::Output + where Self: Join { - SliceConcat::join(self, sep) + Join::join(self, sep) } } @@ -578,30 +579,63 @@ impl [u8] { // Extension traits for slices over specific kinds of data //////////////////////////////////////////////////////////////////////////////// -/// Helper trait for [`[T]::concat`](../../std/primitive.slice.html#method.concat) -/// and [`[T]::join`](../../std/primitive.slice.html#method.join) +/// Helper trait for [`[T]::concat`](../../std/primitive.slice.html#method.concat). +/// +/// Note: the `Item` type parameter is not used in this trait, +/// but it allows impls to be more generic. +/// Without it, we get this error: +/// +/// ```error +/// error[E0207]: the type parameter `T` is not constrained by the impl trait, self type, or predica +/// --> src/liballoc/slice.rs:608:6 +/// | +/// 608 | impl> Concat for [V] { +/// | ^ unconstrained type parameter +/// ``` +/// +/// This is because there could exist `V` types with multiple `Borrow<[_]>` impls, +/// such that multiple `T` types would apply: +/// +/// ``` +/// # #[allow(dead_code)] +/// pub struct Foo(Vec, Vec); +/// +/// impl std::borrow::Borrow<[u32]> for Foo { +/// fn borrow(&self) -> &[u32] { &self.0 } +/// } +/// +/// impl std::borrow::Borrow<[String]> for Foo { +/// fn borrow(&self) -> &[String] { &self.1 } +/// } +/// ``` #[unstable(feature = "slice_concat_trait", issue = "27747")] -pub trait SliceConcat: Sized { +pub trait Concat { #[unstable(feature = "slice_concat_trait", issue = "27747")] /// The resulting type after concatenation type Output; /// Implementation of [`[T]::concat`](../../std/primitive.slice.html#method.concat) #[unstable(feature = "slice_concat_trait", issue = "27747")] - fn concat(slice: &[Self]) -> Self::Output; + fn concat(slice: &Self) -> Self::Output; +} + +/// Helper trait for [`[T]::join`](../../std/primitive.slice.html#method.join) +#[unstable(feature = "slice_concat_trait", issue = "27747")] +pub trait Join { + #[unstable(feature = "slice_concat_trait", issue = "27747")] + /// The resulting type after concatenation + type Output; /// Implementation of [`[T]::join`](../../std/primitive.slice.html#method.join) #[unstable(feature = "slice_concat_trait", issue = "27747")] - fn join(slice: &[Self], sep: &Separator) -> Self::Output; + fn join(slice: &Self, sep: Separator) -> Self::Output; } -#[unstable(feature = "slice_concat_ext", - reason = "trait should not have to exist", - issue = "27747")] -impl> SliceConcat for V { +#[unstable(feature = "slice_concat_ext", issue = "27747")] +impl> Concat for [V] { type Output = Vec; - fn concat(slice: &[Self]) -> Vec { + fn concat(slice: &Self) -> Vec { let size = slice.iter().map(|slice| slice.borrow().len()).sum(); let mut result = Vec::with_capacity(size); for v in slice { @@ -609,14 +643,19 @@ impl> SliceConcat for V { } result } +} + +#[unstable(feature = "slice_concat_ext", issue = "27747")] +impl> Join<&T> for [V] { + type Output = Vec; - fn join(slice: &[Self], sep: &T) -> Vec { + fn join(slice: &Self, sep: &T) -> Vec { let mut iter = slice.iter(); let first = match iter.next() { Some(first) => first, None => return vec![], }; - let size = slice.iter().map(|slice| slice.borrow().len()).sum::() + slice.len() - 1; + let size = slice.iter().map(|v| v.borrow().len()).sum::() + slice.len() - 1; let mut result = Vec::with_capacity(size); result.extend_from_slice(first.borrow()); @@ -628,6 +667,29 @@ impl> SliceConcat for V { } } +#[unstable(feature = "slice_concat_ext", issue = "27747")] +impl> Join<&[T]> for [V] { + type Output = Vec; + + fn join(slice: &Self, sep: &[T]) -> Vec { + let mut iter = slice.iter(); + let first = match iter.next() { + Some(first) => first, + None => return vec![], + }; + let size = slice.iter().map(|v| v.borrow().len()).sum::() + + sep.len() * (slice.len() - 1); + let mut result = Vec::with_capacity(size); + result.extend_from_slice(first.borrow()); + + for v in iter { + result.extend_from_slice(sep); + result.extend_from_slice(v.borrow()) + } + result + } +} + //////////////////////////////////////////////////////////////////////////////// // Standard trait implementations for slices //////////////////////////////////////////////////////////////////////////////// diff --git a/src/liballoc/str.rs b/src/liballoc/str.rs index 37a1046d0942d..9a1342c30d502 100644 --- a/src/liballoc/str.rs +++ b/src/liballoc/str.rs @@ -37,7 +37,7 @@ use core::unicode::conversions; use crate::borrow::ToOwned; use crate::boxed::Box; -use crate::slice::{SliceConcat, SliceIndex}; +use crate::slice::{Concat, Join, SliceIndex}; use crate::string::String; use crate::vec::Vec; @@ -71,17 +71,22 @@ pub use core::str::SplitAsciiWhitespace; #[stable(feature = "str_escape", since = "1.34.0")] pub use core::str::{EscapeDebug, EscapeDefault, EscapeUnicode}; -#[unstable(feature = "slice_concat_ext", - reason = "trait should not have to exist", - issue = "27747")] -impl> SliceConcat for S { +/// Note: `str` in `Concat` is not meaningful here. +/// This type parameter of the trait only exists to enable another impl. +#[unstable(feature = "slice_concat_ext", issue = "27747")] +impl> Concat for [S] { type Output = String; - fn concat(slice: &[Self]) -> String { - Self::join(slice, "") + fn concat(slice: &Self) -> String { + Join::join(slice, "") } +} + +#[unstable(feature = "slice_concat_ext", issue = "27747")] +impl> Join<&str> for [S] { + type Output = String; - fn join(slice: &[Self], sep: &str) -> String { + fn join(slice: &Self, sep: &str) -> String { unsafe { String::from_utf8_unchecked( join_generic_copy(slice, sep.as_bytes()) ) } diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs index fe149d634e223..2b3bad8894e60 100644 --- a/src/libcore/lib.rs +++ b/src/libcore/lib.rs @@ -120,6 +120,7 @@ #![feature(cmpxchg16b_target_feature)] #![feature(rtm_target_feature)] #![feature(f16c_target_feature)] +#![feature(hexagon_target_feature)] #![feature(const_slice_len)] #![feature(const_str_as_bytes)] #![feature(const_str_len)] diff --git a/src/libpanic_unwind/gcc.rs b/src/libpanic_unwind/gcc.rs index e2b743b379704..236ed15050571 100644 --- a/src/libpanic_unwind/gcc.rs +++ b/src/libpanic_unwind/gcc.rs @@ -126,6 +126,9 @@ const UNWIND_DATA_REG: (i32, i32) = (6, 7); // R6, R7 #[cfg(target_arch = "sparc64")] const UNWIND_DATA_REG: (i32, i32) = (24, 25); // I0, I1 +#[cfg(target_arch = "hexagon")] +const UNWIND_DATA_REG: (i32, i32) = (0, 1); // R0, R1 + // The following code is based on GCC's C and C++ personality routines. For reference, see: // https://github.com/gcc-mirror/gcc/blob/master/libstdc++-v3/libsupc++/eh_personality.cc // https://github.com/gcc-mirror/gcc/blob/trunk/libgcc/unwind-c.c diff --git a/src/librustc/Cargo.toml b/src/librustc/Cargo.toml index 1677ef4b6079f..0222a3dde7ab9 100644 --- a/src/librustc/Cargo.toml +++ b/src/librustc/Cargo.toml @@ -27,7 +27,7 @@ rustc_target = { path = "../librustc_target" } rustc_macros = { path = "../librustc_macros" } rustc_data_structures = { path = "../librustc_data_structures" } errors = { path = "../librustc_errors", package = "rustc_errors" } -serialize = { path = "../libserialize" } +rustc_serialize = { path = "../libserialize", package = "serialize" } syntax = { path = "../libsyntax" } syntax_pos = { path = "../libsyntax_pos" } backtrace = "0.3.3" diff --git a/src/librustc/error_codes.rs b/src/librustc/error_codes.rs index 65821d8dd8379..655028324e157 100644 --- a/src/librustc/error_codes.rs +++ b/src/librustc/error_codes.rs @@ -485,7 +485,7 @@ Erroneous code example: fn foo() {} #[main] -fn f() {} // error: multiple functions with a #[main] attribute +fn f() {} // error: multiple functions with a `#[main]` attribute ``` This error indicates that the compiler found multiple functions with the diff --git a/src/librustc/hir/def_id.rs b/src/librustc/hir/def_id.rs index 057d878a0ab8d..f3edb5f862117 100644 --- a/src/librustc/hir/def_id.rs +++ b/src/librustc/hir/def_id.rs @@ -1,7 +1,6 @@ use crate::ty::{self, TyCtxt}; use crate::hir::map::definitions::FIRST_FREE_DEF_INDEX; use rustc_data_structures::indexed_vec::Idx; -use serialize; use std::fmt; use std::u32; @@ -93,8 +92,8 @@ impl fmt::Display for CrateNum { } } -impl serialize::UseSpecializedEncodable for CrateNum {} -impl serialize::UseSpecializedDecodable for CrateNum {} +impl rustc_serialize::UseSpecializedEncodable for CrateNum {} +impl rustc_serialize::UseSpecializedDecodable for CrateNum {} newtype_index! { /// A DefIndex is an index into the hir-map for a crate, identifying a @@ -134,8 +133,8 @@ impl DefIndex { } } -impl serialize::UseSpecializedEncodable for DefIndex {} -impl serialize::UseSpecializedDecodable for DefIndex {} +impl rustc_serialize::UseSpecializedEncodable for DefIndex {} +impl rustc_serialize::UseSpecializedDecodable for DefIndex {} /// A `DefId` identifies a particular *definition*, by combining a crate /// index and a def index. @@ -186,8 +185,8 @@ impl DefId { } } -impl serialize::UseSpecializedEncodable for DefId {} -impl serialize::UseSpecializedDecodable for DefId {} +impl rustc_serialize::UseSpecializedEncodable for DefId {} +impl rustc_serialize::UseSpecializedDecodable for DefId {} /// A LocalDefId is equivalent to a DefId with `krate == LOCAL_CRATE`. Since /// we encode this information in the type, we can ensure at compile time that @@ -220,5 +219,5 @@ impl fmt::Debug for LocalDefId { } } -impl serialize::UseSpecializedEncodable for LocalDefId {} -impl serialize::UseSpecializedDecodable for LocalDefId {} +impl rustc_serialize::UseSpecializedEncodable for LocalDefId {} +impl rustc_serialize::UseSpecializedDecodable for LocalDefId {} diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs index e7b37d40b4b2f..3708a905a4b03 100644 --- a/src/librustc/hir/mod.rs +++ b/src/librustc/hir/mod.rs @@ -34,7 +34,7 @@ use rustc_data_structures::sync::{par_for_each_in, Send, Sync}; use rustc_data_structures::thin_vec::ThinVec; use rustc_macros::HashStable; -use serialize::{self, Encoder, Encodable, Decoder, Decodable}; +use rustc_serialize::{self, Encoder, Encodable, Decoder, Decodable}; use std::collections::{BTreeSet, BTreeMap}; use std::fmt; use smallvec::SmallVec; @@ -92,7 +92,7 @@ impl HirId { } } -impl serialize::UseSpecializedEncodable for HirId { +impl rustc_serialize::UseSpecializedEncodable for HirId { fn default_encode(&self, s: &mut S) -> Result<(), S::Error> { let HirId { owner, @@ -104,7 +104,7 @@ impl serialize::UseSpecializedEncodable for HirId { } } -impl serialize::UseSpecializedDecodable for HirId { +impl rustc_serialize::UseSpecializedDecodable for HirId { fn default_decode(d: &mut D) -> Result { let owner = DefIndex::decode(d)?; let local_id = ItemLocalId::decode(d)?; diff --git a/src/librustc/hir/ptr.rs b/src/librustc/hir/ptr.rs index 3a87b36a1b434..1976b4c9e54ff 100644 --- a/src/librustc/hir/ptr.rs +++ b/src/librustc/hir/ptr.rs @@ -7,7 +7,7 @@ use std::iter::FromIterator; use std::ops::Deref; use std::{slice, vec}; -use serialize::{Encodable, Decodable, Encoder, Decoder}; +use rustc_serialize::{Encodable, Decodable, Encoder, Decoder}; use rustc_data_structures::stable_hasher::{StableHasher, StableHasherResult, HashStable}; diff --git a/src/librustc/infer/canonical/mod.rs b/src/librustc/infer/canonical/mod.rs index b508f91e01ebb..6840611d4be79 100644 --- a/src/librustc/infer/canonical/mod.rs +++ b/src/librustc/infer/canonical/mod.rs @@ -27,7 +27,7 @@ use crate::infer::region_constraints::MemberConstraint; use crate::mir::interpret::ConstValue; use rustc_data_structures::indexed_vec::IndexVec; use rustc_macros::HashStable; -use serialize::UseSpecializedDecodable; +use rustc_serialize::UseSpecializedDecodable; use smallvec::SmallVec; use std::ops::Index; use syntax::source_map::Span; diff --git a/src/librustc/infer/lexical_region_resolve/mod.rs b/src/librustc/infer/lexical_region_resolve/mod.rs index 4bfe953e45c0b..6282fde59cad4 100644 --- a/src/librustc/infer/lexical_region_resolve/mod.rs +++ b/src/librustc/infer/lexical_region_resolve/mod.rs @@ -874,7 +874,7 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> { constraints.retain(|constraint| { let (edge_changed, retain) = body(constraint); if edge_changed { - debug!("Updated due to constraint {:?}", constraint); + debug!("updated due to constraint {:?}", constraint); changed = true; } retain diff --git a/src/librustc/infer/region_constraints/leak_check.rs b/src/librustc/infer/region_constraints/leak_check.rs index 30f6137289abf..0c83bbc1e5394 100644 --- a/src/librustc/infer/region_constraints/leak_check.rs +++ b/src/librustc/infer/region_constraints/leak_check.rs @@ -78,10 +78,10 @@ impl<'tcx> RegionConstraintCollector<'tcx> { } return Err(if overly_polymorphic { - debug!("Overly polymorphic!"); + debug!("overly polymorphic!"); TypeError::RegionsOverlyPolymorphic(placeholder.name, tainted_region) } else { - debug!("Not as polymorphic!"); + debug!("not as polymorphic!"); TypeError::RegionsInsufficientlyPolymorphic(placeholder.name, tainted_region) }); } diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs index 63e0107a4d882..c7d4fa3aec654 100644 --- a/src/librustc/lib.rs +++ b/src/librustc/lib.rs @@ -75,16 +75,8 @@ extern crate getopts; extern crate libc; #[macro_use] extern crate rustc_macros; #[macro_use] extern crate rustc_data_structures; - #[macro_use] extern crate log; #[macro_use] extern crate syntax; - -// FIXME: This import is used by deriving `RustcDecodable` and `RustcEncodable`. Removing this -// results in a bunch of "failed to resolve" errors. Hopefully, the compiler moves to serde or -// something, and we can get rid of this. -#[allow(rust_2018_idioms)] -extern crate serialize as rustc_serialize; - #[macro_use] extern crate smallvec; // Use the test crate here so we depend on getopts through it. This allow tools to link to both diff --git a/src/librustc/lint/context.rs b/src/librustc/lint/context.rs index 2930f7690dd8e..859bc86d3a07d 100644 --- a/src/librustc/lint/context.rs +++ b/src/librustc/lint/context.rs @@ -23,7 +23,7 @@ use crate::lint::{LintArray, Level, Lint, LintId, LintPass, LintBuffer}; use crate::lint::builtin::BuiltinLintDiagnostics; use crate::lint::levels::{LintLevelSets, LintLevelsBuilder}; use crate::middle::privacy::AccessLevels; -use crate::rustc_serialize::{Decoder, Decodable, Encoder, Encodable}; +use rustc_serialize::{Decoder, Decodable, Encoder, Encodable}; use crate::session::{config, early_error, Session}; use crate::ty::{self, print::Printer, subst::Kind, TyCtxt, Ty}; use crate::ty::layout::{LayoutError, LayoutOf, TyLayout}; diff --git a/src/librustc/middle/entry.rs b/src/librustc/middle/entry.rs index cba4d0f1598c4..53c099c0b4339 100644 --- a/src/librustc/middle/entry.rs +++ b/src/librustc/middle/entry.rs @@ -120,9 +120,9 @@ fn find_item(item: &Item, ctxt: &mut EntryContext<'_, '_>, at_root: bool) { ctxt.attr_main_fn = Some((item.hir_id, item.span)); } else { struct_span_err!(ctxt.session, item.span, E0137, - "multiple functions with a #[main] attribute") - .span_label(item.span, "additional #[main] function") - .span_label(ctxt.attr_main_fn.unwrap().1, "first #[main] function") + "multiple functions with a `#[main]` attribute") + .span_label(item.span, "additional `#[main]` function") + .span_label(ctxt.attr_main_fn.unwrap().1, "first `#[main]` function") .emit(); } }, diff --git a/src/librustc/middle/mem_categorization.rs b/src/librustc/middle/mem_categorization.rs index ddad276f8a7c8..524d5ddf92900 100644 --- a/src/librustc/middle/mem_categorization.rs +++ b/src/librustc/middle/mem_categorization.rs @@ -994,7 +994,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> { let deref_ty = match base_cmt_ty.builtin_deref(true) { Some(mt) => mt.ty, None => { - debug!("Explicit deref of non-derefable type: {:?}", base_cmt_ty); + debug!("explicit deref of non-derefable type: {:?}", base_cmt_ty); return Err(()); } }; @@ -1317,7 +1317,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> { let element_ty = match cmt.ty.builtin_index() { Some(ty) => ty, None => { - debug!("Explicit index of non-indexable type {:?}", cmt); + debug!("explicit index of non-indexable type {:?}", cmt); return Err(()); } }; diff --git a/src/librustc/middle/resolve_lifetime.rs b/src/librustc/middle/resolve_lifetime.rs index beb8061842dd3..abb896a7c9beb 100644 --- a/src/librustc/middle/resolve_lifetime.rs +++ b/src/librustc/middle/resolve_lifetime.rs @@ -1645,7 +1645,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { } } Some(LifetimeUseSet::Many) => { - debug!("Not one use lifetime"); + debug!("not one use lifetime"); } None => { let hir_id = self.tcx.hir().as_local_hir_id(def_id).unwrap(); diff --git a/src/librustc/mir/cache.rs b/src/librustc/mir/cache.rs index d2cabb7e10bbf..3d33e249536c7 100644 --- a/src/librustc/mir/cache.rs +++ b/src/librustc/mir/cache.rs @@ -1,27 +1,25 @@ use rustc_data_structures::indexed_vec::IndexVec; use rustc_data_structures::sync::{RwLock, MappedReadGuard, ReadGuard}; -use rustc_data_structures::stable_hasher::{HashStable, StableHasher, - StableHasherResult}; +use rustc_data_structures::stable_hasher::{HashStable, StableHasher, StableHasherResult}; +use rustc_serialize::{Encodable, Encoder, Decodable, Decoder}; use crate::ich::StableHashingContext; use crate::mir::{Body, BasicBlock}; -use crate::rustc_serialize as serialize; - #[derive(Clone, Debug)] pub struct Cache { predecessors: RwLock>>> } -impl serialize::Encodable for Cache { - fn encode(&self, s: &mut S) -> Result<(), S::Error> { - serialize::Encodable::encode(&(), s) +impl rustc_serialize::Encodable for Cache { + fn encode(&self, s: &mut S) -> Result<(), S::Error> { + Encodable::encode(&(), s) } } -impl serialize::Decodable for Cache { - fn decode(d: &mut D) -> Result { - serialize::Decodable::decode(d).map(|_v: ()| Self::new()) +impl rustc_serialize::Decodable for Cache { + fn decode(d: &mut D) -> Result { + Decodable::decode(d).map(|_v: ()| Self::new()) } } diff --git a/src/librustc/mir/interpret/allocation.rs b/src/librustc/mir/interpret/allocation.rs index c8bf250d02b36..51b2d0272a597 100644 --- a/src/librustc/mir/interpret/allocation.rs +++ b/src/librustc/mir/interpret/allocation.rs @@ -113,7 +113,7 @@ impl Allocation { } } -impl<'tcx> ::serialize::UseSpecializedDecodable for &'tcx Allocation {} +impl<'tcx> rustc_serialize::UseSpecializedDecodable for &'tcx Allocation {} /// Byte accessors impl<'tcx, Tag: Copy, Extra: AllocationExtra> Allocation { diff --git a/src/librustc/mir/interpret/mod.rs b/src/librustc/mir/interpret/mod.rs index 5bec64d39fa62..121b6ac0ac88c 100644 --- a/src/librustc/mir/interpret/mod.rs +++ b/src/librustc/mir/interpret/mod.rs @@ -27,7 +27,7 @@ use crate::hir::def_id::DefId; use crate::ty::{self, TyCtxt, Instance, subst::UnpackedKind}; use crate::ty::layout::{self, Size}; use std::io; -use crate::rustc_serialize::{Encoder, Decodable, Encodable}; +use rustc_serialize::{Encoder, Decodable, Encodable}; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::sync::{Lock as Mutex, HashMapExt}; use rustc_data_structures::tiny_list::TinyList; @@ -51,8 +51,8 @@ pub struct GlobalId<'tcx> { #[derive(Copy, Clone, Eq, Hash, Ord, PartialEq, PartialOrd, Debug)] pub struct AllocId(pub u64); -impl crate::rustc_serialize::UseSpecializedEncodable for AllocId {} -impl crate::rustc_serialize::UseSpecializedDecodable for AllocId {} +impl rustc_serialize::UseSpecializedEncodable for AllocId {} +impl rustc_serialize::UseSpecializedDecodable for AllocId {} #[derive(RustcDecodable, RustcEncodable)] enum AllocDiscriminant { diff --git a/src/librustc/mir/mod.rs b/src/librustc/mir/mod.rs index b1b6be4ae17f8..36061e182ebdc 100644 --- a/src/librustc/mir/mod.rs +++ b/src/librustc/mir/mod.rs @@ -9,7 +9,6 @@ use crate::hir::def_id::DefId; use crate::hir::{self, InlineAsm as HirInlineAsm}; use crate::mir::interpret::{ConstValue, PanicMessage, InterpError::Panic, Scalar}; use crate::mir::visit::MirVisitable; -use crate::rustc_serialize as serialize; use crate::ty::adjustment::PointerCast; use crate::ty::fold::{TypeFoldable, TypeFolder, TypeVisitor}; use crate::ty::layout::VariantIdx; @@ -28,6 +27,7 @@ use rustc_data_structures::indexed_vec::{Idx, IndexVec}; use rustc_data_structures::sync::Lrc; use rustc_data_structures::sync::MappedReadGuard; use rustc_macros::HashStable; +use rustc_serialize::{Encodable, Decodable}; use smallvec::SmallVec; use std::borrow::Cow; use std::fmt::{self, Debug, Display, Formatter, Write}; @@ -463,8 +463,8 @@ impl ClearCrossCrate { } } -impl serialize::UseSpecializedEncodable for ClearCrossCrate {} -impl serialize::UseSpecializedDecodable for ClearCrossCrate {} +impl rustc_serialize::UseSpecializedEncodable for ClearCrossCrate {} +impl rustc_serialize::UseSpecializedDecodable for ClearCrossCrate {} /// Grouped information about the source code origin of a MIR entity. /// Intended to be inspected by diagnostics and debuginfo. diff --git a/src/librustc/query/mod.rs b/src/librustc/query/mod.rs index fba3e22ab1b54..67fc3520745dd 100644 --- a/src/librustc/query/mod.rs +++ b/src/librustc/query/mod.rs @@ -643,11 +643,11 @@ rustc_queries! { } query is_sanitizer_runtime(_: CrateNum) -> bool { fatal_cycle - desc { "query a crate is #![sanitizer_runtime]" } + desc { "query a crate is `#![sanitizer_runtime]`" } } query is_profiler_runtime(_: CrateNum) -> bool { fatal_cycle - desc { "query a crate is #![profiler_runtime]" } + desc { "query a crate is `#![profiler_runtime]`" } } query panic_strategy(_: CrateNum) -> PanicStrategy { fatal_cycle @@ -655,7 +655,7 @@ rustc_queries! { } query is_no_builtins(_: CrateNum) -> bool { fatal_cycle - desc { "test whether a crate has #![no_builtins]" } + desc { "test whether a crate has `#![no_builtins]`" } } query symbol_mangling_version(_: CrateNum) -> SymbolManglingVersion { fatal_cycle diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs index db8e2f64e3066..470a08fad23b5 100644 --- a/src/librustc/session/config.rs +++ b/src/librustc/session/config.rs @@ -1144,9 +1144,9 @@ options! {CodegenOptions, CodegenSetter, basic_codegen_options, lto: LtoCli = (LtoCli::Unspecified, parse_lto, [TRACKED], "perform LLVM link-time optimizations"), target_cpu: Option = (None, parse_opt_string, [TRACKED], - "select target processor (rustc --print target-cpus for details)"), + "select target processor (`rustc --print target-cpus` for details)"), target_feature: String = (String::new(), parse_string, [TRACKED], - "target specific attributes (rustc --print target-features for details)"), + "target specific attributes (`rustc --print target-features` for details)"), passes: Vec = (Vec::new(), parse_list, [TRACKED], "a list of extra LLVM passes to run (space separated)"), llvm_args: Vec = (Vec::new(), parse_list, [TRACKED], @@ -1172,9 +1172,9 @@ options! {CodegenOptions, CodegenSetter, basic_codegen_options, no_redzone: Option = (None, parse_opt_bool, [TRACKED], "disable the use of the redzone"), relocation_model: Option = (None, parse_opt_string, [TRACKED], - "choose the relocation model to use (rustc --print relocation-models for details)"), + "choose the relocation model to use (`rustc --print relocation-models` for details)"), code_model: Option = (None, parse_opt_string, [TRACKED], - "choose the code model to use (rustc --print code-models for details)"), + "choose the code model to use (`rustc --print code-models` for details)"), metadata: Vec = (Vec::new(), parse_list, [TRACKED], "metadata to mangle symbol names with"), extra_filename: String = (String::new(), parse_string, [UNTRACKED], @@ -1184,7 +1184,7 @@ options! {CodegenOptions, CodegenSetter, basic_codegen_options, remark: Passes = (Passes::Some(Vec::new()), parse_passes, [UNTRACKED], "print remarks for these optimization passes (space separated, or \"all\")"), no_stack_check: bool = (false, parse_bool, [UNTRACKED], - "the --no-stack-check flag is deprecated and does nothing"), + "the `--no-stack-check` flag is deprecated and does nothing"), debuginfo: Option = (None, parse_opt_uint, [TRACKED], "debug info emission level, 0 = no debug info, 1 = line tables only, \ 2 = full debug info with variable and type information"), @@ -1400,9 +1400,9 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options, thinlto: Option = (None, parse_opt_bool, [TRACKED], "enable ThinLTO when possible"), inline_in_all_cgus: Option = (None, parse_opt_bool, [TRACKED], - "control whether #[inline] functions are in all cgus"), + "control whether `#[inline]` functions are in all CGUs"), tls_model: Option = (None, parse_opt_string, [TRACKED], - "choose the TLS model to use (rustc --print tls-models for details)"), + "choose the TLS model to use (`rustc --print tls-models` for details)"), saturating_float_casts: bool = (false, parse_bool, [TRACKED], "make float->int casts UB-free: numbers outside the integer type's range are clipped to \ the max/min integer respectively, and NaN is mapped to 0"), diff --git a/src/librustc/traits/error_reporting.rs b/src/librustc/traits/error_reporting.rs index 352d318ba7931..14a288f5af1a0 100644 --- a/src/librustc/traits/error_reporting.rs +++ b/src/librustc/traits/error_reporting.rs @@ -1656,7 +1656,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { ObligationCauseCode::TrivialBound => { err.help("see issue #48214"); if tcx.sess.opts.unstable_features.is_nightly_build() { - err.help("add #![feature(trivial_bounds)] to the \ + err.help("add `#![feature(trivial_bounds)]` to the \ crate attributes to enable", ); } diff --git a/src/librustc/ty/codec.rs b/src/librustc/ty/codec.rs index 26e7cc9004d4e..e3c6eca02d554 100644 --- a/src/librustc/ty/codec.rs +++ b/src/librustc/ty/codec.rs @@ -10,7 +10,7 @@ use crate::arena::ArenaAllocatable; use crate::hir::def_id::{DefId, CrateNum}; use crate::infer::canonical::{CanonicalVarInfo, CanonicalVarInfos}; use rustc_data_structures::fx::FxHashMap; -use crate::rustc_serialize::{Decodable, Decoder, Encoder, Encodable, opaque}; +use rustc_serialize::{Decodable, Decoder, Encoder, Encodable, opaque}; use std::hash::Hash; use std::intrinsics; use crate::ty::{self, Ty, TyCtxt}; @@ -333,7 +333,7 @@ macro_rules! implement_ty_decoder { use $crate::ty::codec::*; use $crate::ty::subst::SubstsRef; use $crate::hir::def_id::{CrateNum}; - use crate::rustc_serialize::{Decoder, SpecializedDecoder}; + use rustc_serialize::{Decoder, SpecializedDecoder}; use std::borrow::Cow; impl<$($typaram ),*> Decoder for $DecoderName<$($typaram),*> { diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs index 538afa6054ff9..44897c8e90376 100644 --- a/src/librustc/ty/mod.rs +++ b/src/librustc/ty/mod.rs @@ -32,7 +32,7 @@ use crate::util::nodemap::{NodeSet, DefIdMap, FxHashMap}; use arena::SyncDroplessArena; use crate::session::DataTypeKind; -use serialize::{self, Encodable, Encoder}; +use rustc_serialize::{self, Encodable, Encoder}; use std::cell::RefCell; use std::cmp::{self, Ordering}; use std::fmt; @@ -588,8 +588,8 @@ impl<'a, 'tcx> HashStable> for ty::TyS<'tcx> { pub type Ty<'tcx> = &'tcx TyS<'tcx>; -impl<'tcx> serialize::UseSpecializedEncodable for Ty<'tcx> {} -impl<'tcx> serialize::UseSpecializedDecodable for Ty<'tcx> {} +impl<'tcx> rustc_serialize::UseSpecializedEncodable for Ty<'tcx> {} +impl<'tcx> rustc_serialize::UseSpecializedDecodable for Ty<'tcx> {} pub type CanonicalTy<'tcx> = Canonical<'tcx, Ty<'tcx>>; @@ -708,7 +708,7 @@ impl<'a, T> IntoIterator for &'a List { } } -impl<'tcx> serialize::UseSpecializedDecodable for &'tcx List> {} +impl<'tcx> rustc_serialize::UseSpecializedDecodable for &'tcx List> {} impl List { #[inline(always)] @@ -1009,8 +1009,8 @@ pub struct GenericPredicates<'tcx> { pub predicates: Vec<(Predicate<'tcx>, Span)>, } -impl<'tcx> serialize::UseSpecializedEncodable for GenericPredicates<'tcx> {} -impl<'tcx> serialize::UseSpecializedDecodable for GenericPredicates<'tcx> {} +impl<'tcx> rustc_serialize::UseSpecializedEncodable for GenericPredicates<'tcx> {} +impl<'tcx> rustc_serialize::UseSpecializedDecodable for GenericPredicates<'tcx> {} impl<'tcx> GenericPredicates<'tcx> { pub fn instantiate( @@ -1985,13 +1985,13 @@ impl Hash for AdtDef { } } -impl<'tcx> serialize::UseSpecializedEncodable for &'tcx AdtDef { +impl<'tcx> rustc_serialize::UseSpecializedEncodable for &'tcx AdtDef { fn default_encode(&self, s: &mut S) -> Result<(), S::Error> { self.did.encode(s) } } -impl<'tcx> serialize::UseSpecializedDecodable for &'tcx AdtDef {} +impl<'tcx> rustc_serialize::UseSpecializedDecodable for &'tcx AdtDef {} impl<'a> HashStable> for AdtDef { diff --git a/src/librustc/ty/query/on_disk_cache.rs b/src/librustc/ty/query/on_disk_cache.rs index a25c1e34cf154..211a28fe9315f 100644 --- a/src/librustc/ty/query/on_disk_cache.rs +++ b/src/librustc/ty/query/on_disk_cache.rs @@ -5,7 +5,7 @@ use crate::hir::map::definitions::DefPathHash; use crate::ich::{CachingSourceMapView, Fingerprint}; use crate::mir::{self, interpret}; use crate::mir::interpret::{AllocDecodingSession, AllocDecodingState}; -use crate::rustc_serialize::{Decodable, Decoder, Encodable, Encoder, opaque, +use rustc_serialize::{Decodable, Decoder, Encodable, Encoder, opaque, SpecializedDecoder, SpecializedEncoder, UseSpecializedDecodable, UseSpecializedEncodable}; use crate::session::{CrateDisambiguator, Session}; diff --git a/src/librustc/ty/sty.rs b/src/librustc/ty/sty.rs index 5d17080a9b2bc..37b5e475facd4 100644 --- a/src/librustc/ty/sty.rs +++ b/src/librustc/ty/sty.rs @@ -26,7 +26,6 @@ use rustc_target::spec::abi; use syntax::ast::{self, Ident}; use syntax::symbol::{kw, InternedString}; -use serialize; use self::InferTy::*; use self::TyKind::*; @@ -640,7 +639,7 @@ impl<'tcx> Binder> { } } -impl<'tcx> serialize::UseSpecializedDecodable for &'tcx List> {} +impl<'tcx> rustc_serialize::UseSpecializedDecodable for &'tcx List> {} impl<'tcx> List> { /// Returns the "principal def id" of this set of existential predicates. @@ -1324,7 +1323,7 @@ pub enum RegionKind { ReClosureBound(RegionVid), } -impl<'tcx> serialize::UseSpecializedDecodable for Region<'tcx> {} +impl<'tcx> rustc_serialize::UseSpecializedDecodable for Region<'tcx> {} #[derive(Copy, Clone, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable, Debug, PartialOrd, Ord)] pub struct EarlyBoundRegion { @@ -1704,22 +1703,21 @@ impl<'tcx> TyS<'tcx> { /// will be `Abi::Uninhabited`. (Note that uninhabited types may have nonzero /// size, to account for partial initialisation. See #49298 for details.) pub fn conservative_is_privately_uninhabited(&self, tcx: TyCtxt<'tcx>) -> bool { - // FIXME(varkor): we can make this less conversative by substituting concrete - // type arguments. match self.sty { ty::Never => true, ty::Adt(def, _) if def.is_union() => { // For now, `union`s are never considered uninhabited. false } - ty::Adt(def, _) => { + ty::Adt(def, substs) => { // Any ADT is uninhabited if either: // (a) It has no variants (i.e. an empty `enum`); // (b) Each of its variants (a single one in the case of a `struct`) has at least // one uninhabited field. def.variants.iter().all(|var| { var.fields.iter().any(|field| { - tcx.type_of(field.did).conservative_is_privately_uninhabited(tcx) + tcx.type_of(field.did).subst(tcx, substs) + .conservative_is_privately_uninhabited(tcx) }) }) } @@ -2333,7 +2331,7 @@ impl<'tcx> Const<'tcx> { } } -impl<'tcx> serialize::UseSpecializedDecodable for &'tcx Const<'tcx> {} +impl<'tcx> rustc_serialize::UseSpecializedDecodable for &'tcx Const<'tcx> {} /// An inference variable for a const, for use in const generics. #[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, diff --git a/src/librustc/ty/subst.rs b/src/librustc/ty/subst.rs index 79dcd327f52d4..ea829da783e9b 100644 --- a/src/librustc/ty/subst.rs +++ b/src/librustc/ty/subst.rs @@ -6,7 +6,7 @@ use crate::ty::{self, Lift, List, Ty, TyCtxt, InferConst, ParamConst}; use crate::ty::fold::{TypeFoldable, TypeFolder, TypeVisitor}; use crate::mir::interpret::ConstValue; -use serialize::{self, Encodable, Encoder, Decodable, Decoder}; +use rustc_serialize::{self, Encodable, Encoder, Decodable, Decoder}; use syntax_pos::{Span, DUMMY_SP}; use smallvec::SmallVec; use rustc_macros::HashStable; @@ -399,7 +399,7 @@ impl<'tcx> TypeFoldable<'tcx> for SubstsRef<'tcx> { } } -impl<'tcx> serialize::UseSpecializedDecodable for SubstsRef<'tcx> {} +impl<'tcx> rustc_serialize::UseSpecializedDecodable for SubstsRef<'tcx> {} /////////////////////////////////////////////////////////////////////////// // Public trait `Subst` diff --git a/src/librustc_codegen_llvm/llvm_util.rs b/src/librustc_codegen_llvm/llvm_util.rs index 274c89659628d..541d3d98b79bd 100644 --- a/src/librustc_codegen_llvm/llvm_util.rs +++ b/src/librustc_codegen_llvm/llvm_util.rs @@ -174,7 +174,7 @@ const X86_WHITELIST: &[(&str, Option)] = &[ const HEXAGON_WHITELIST: &[(&str, Option)] = &[ ("hvx", Some(sym::hexagon_target_feature)), - ("hvx-double", Some(sym::hexagon_target_feature)), + ("hvx-length128b", Some(sym::hexagon_target_feature)), ]; const POWERPC_WHITELIST: &[(&str, Option)] = &[ diff --git a/src/librustc_codegen_ssa/Cargo.toml b/src/librustc_codegen_ssa/Cargo.toml index e7ee06df7e12d..90d7320987c95 100644 --- a/src/librustc_codegen_ssa/Cargo.toml +++ b/src/librustc_codegen_ssa/Cargo.toml @@ -20,7 +20,7 @@ jobserver = "0.1.11" parking_lot = "0.7" tempfile = "3.0.5" -serialize = { path = "../libserialize" } +rustc_serialize = { path = "../libserialize", package = "serialize" } syntax = { path = "../libsyntax" } syntax_pos = { path = "../libsyntax_pos" } rustc = { path = "../librustc" } diff --git a/src/librustc_codegen_ssa/back/linker.rs b/src/librustc_codegen_ssa/back/linker.rs index 32696d46cd577..882963f9174ec 100644 --- a/src/librustc_codegen_ssa/back/linker.rs +++ b/src/librustc_codegen_ssa/back/linker.rs @@ -16,7 +16,7 @@ use rustc::session::config::{self, CrateType, OptLevel, DebugInfo, LinkerPluginLto, Lto}; use rustc::ty::TyCtxt; use rustc_target::spec::{LinkerFlavor, LldFlavor}; -use serialize::{json, Encoder}; +use rustc_serialize::{json, Encoder}; /// For all the linkers we support, and information they might /// need out of the shared crate context before we get rid of it. diff --git a/src/librustc_codegen_ssa/back/wasm.rs b/src/librustc_codegen_ssa/back/wasm.rs index f90bb89fbe87d..2a9e81a788e52 100644 --- a/src/librustc_codegen_ssa/back/wasm.rs +++ b/src/librustc_codegen_ssa/back/wasm.rs @@ -2,7 +2,7 @@ use std::fs; use std::path::Path; use std::str; -use serialize::leb128; +use rustc_serialize::leb128; // https://webassembly.github.io/spec/core/binary/modules.html#binary-importsec const WASM_CUSTOM_SECTION_ID: u8 = 0; diff --git a/src/librustc_data_structures/Cargo.toml b/src/librustc_data_structures/Cargo.toml index 79cbe26e73e83..288676ce3ff67 100644 --- a/src/librustc_data_structures/Cargo.toml +++ b/src/librustc_data_structures/Cargo.toml @@ -15,7 +15,7 @@ indexmap = "1" log = "0.4" jobserver_crate = { version = "0.1.13", package = "jobserver" } lazy_static = "1" -serialize = { path = "../libserialize" } +rustc_serialize = { path = "../libserialize", package = "serialize" } graphviz = { path = "../libgraphviz" } cfg-if = "0.1.2" crossbeam-utils = { version = "0.6.5", features = ["nightly"] } diff --git a/src/librustc_data_structures/fingerprint.rs b/src/librustc_data_structures/fingerprint.rs index 3bea965ef3041..c8012bb942461 100644 --- a/src/librustc_data_structures/fingerprint.rs +++ b/src/librustc_data_structures/fingerprint.rs @@ -1,7 +1,6 @@ use crate::stable_hasher; use std::mem; -use serialize; -use serialize::opaque::{EncodeResult, Encoder, Decoder}; +use rustc_serialize::opaque::{EncodeResult, Encoder, Decoder}; #[derive(Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Clone, Copy)] pub struct Fingerprint(u64, u64); @@ -85,17 +84,17 @@ impl stable_hasher::StableHasherResult for Fingerprint { impl_stable_hash_via_hash!(Fingerprint); -impl serialize::UseSpecializedEncodable for Fingerprint { } +impl rustc_serialize::UseSpecializedEncodable for Fingerprint { } -impl serialize::UseSpecializedDecodable for Fingerprint { } +impl rustc_serialize::UseSpecializedDecodable for Fingerprint { } -impl serialize::SpecializedEncoder for serialize::opaque::Encoder { +impl rustc_serialize::SpecializedEncoder for Encoder { fn specialized_encode(&mut self, f: &Fingerprint) -> Result<(), Self::Error> { f.encode_opaque(self) } } -impl<'a> serialize::SpecializedDecoder for serialize::opaque::Decoder<'a> { +impl<'a> rustc_serialize::SpecializedDecoder for Decoder<'a> { fn specialized_decode(&mut self) -> Result { Fingerprint::decode_opaque(self) } diff --git a/src/librustc_data_structures/flock.rs b/src/librustc_data_structures/flock.rs index b63701dbc0967..b0bd137f2cc4a 100644 --- a/src/librustc_data_structures/flock.rs +++ b/src/librustc_data_structures/flock.rs @@ -238,14 +238,14 @@ cfg_if! { .write(true); } - debug!("Attempting to open lock file `{}`", p.display()); + debug!("attempting to open lock file `{}`", p.display()); let file = match open_options.open(p) { Ok(file) => { - debug!("Lock file opened successfully"); + debug!("lock file opened successfully"); file } Err(err) => { - debug!("Error opening lock file: {}", err); + debug!("error opening lock file: {}", err); return Err(err) } }; @@ -262,7 +262,7 @@ cfg_if! { dwFlags |= LOCKFILE_EXCLUSIVE_LOCK; } - debug!("Attempting to acquire lock on lock file `{}`", + debug!("attempting to acquire lock on lock file `{}`", p.display()); LockFileEx(file.as_raw_handle(), dwFlags, @@ -273,10 +273,10 @@ cfg_if! { }; if ret == 0 { let err = io::Error::last_os_error(); - debug!("Failed acquiring file lock: {}", err); + debug!("failed acquiring file lock: {}", err); Err(err) } else { - debug!("Successfully acquired lock."); + debug!("successfully acquired lock"); Ok(Lock { _file: file }) } } diff --git a/src/librustc_data_structures/indexed_vec.rs b/src/librustc_data_structures/indexed_vec.rs index c3c76e8160615..6f40d059be27f 100644 --- a/src/librustc_data_structures/indexed_vec.rs +++ b/src/librustc_data_structures/indexed_vec.rs @@ -1,3 +1,5 @@ +use rustc_serialize::{Encodable, Decodable, Encoder, Decoder}; + use std::fmt::Debug; use std::iter::{self, FromIterator}; use std::slice; @@ -8,8 +10,6 @@ use std::hash::Hash; use std::vec; use std::u32; -use rustc_serialize as serialize; - /// Represents some newtyped `usize` wrapper. /// /// Purpose: avoid mixing indexes for different bitvector domains. @@ -398,17 +398,9 @@ macro_rules! newtype_index { ); (@decodable $type:ident) => ( - impl $type { - fn __decodable__impl__hack() { - mod __more_hacks_because__self_doesnt_work_in_functions { - extern crate serialize; - use self::serialize::{Decodable, Decoder}; - impl Decodable for super::$type { - fn decode(d: &mut D) -> Result { - d.read_u32().map(Self::from) - } - } - } + impl ::rustc_serialize::Decodable for $type { + fn decode(d: &mut D) -> Result { + d.read_u32().map(Self::from) } } ); @@ -521,15 +513,15 @@ pub struct IndexVec { // not the phantom data. unsafe impl Send for IndexVec where T: Send {} -impl serialize::Encodable for IndexVec { - fn encode(&self, s: &mut S) -> Result<(), S::Error> { - serialize::Encodable::encode(&self.raw, s) +impl Encodable for IndexVec { + fn encode(&self, s: &mut S) -> Result<(), S::Error> { + Encodable::encode(&self.raw, s) } } -impl serialize::Decodable for IndexVec { - fn decode(d: &mut D) -> Result { - serialize::Decodable::decode(d).map(|v| { +impl Decodable for IndexVec { + fn decode(d: &mut D) -> Result { + Decodable::decode(d).map(|v| { IndexVec { raw: v, _marker: PhantomData } }) } diff --git a/src/librustc_data_structures/lib.rs b/src/librustc_data_structures/lib.rs index a2407681e6d3f..3047119029abc 100644 --- a/src/librustc_data_structures/lib.rs +++ b/src/librustc_data_structures/lib.rs @@ -31,8 +31,6 @@ #[macro_use] extern crate log; -#[allow(unused_extern_crates)] -extern crate serialize as rustc_serialize; // used by deriving #[cfg(unix)] extern crate libc; #[macro_use] diff --git a/src/librustc_data_structures/svh.rs b/src/librustc_data_structures/svh.rs index df4f61768375e..3123c182b0f4c 100644 --- a/src/librustc_data_structures/svh.rs +++ b/src/librustc_data_structures/svh.rs @@ -7,7 +7,7 @@ use std::fmt; use std::hash::{Hash, Hasher}; -use serialize::{Encodable, Decodable, Encoder, Decoder}; +use rustc_serialize::{Encodable, Decodable, Encoder, Decoder}; use crate::stable_hasher; diff --git a/src/librustc_driver/Cargo.toml b/src/librustc_driver/Cargo.toml index d4c30dc6c4507..3162af5086d80 100644 --- a/src/librustc_driver/Cargo.toml +++ b/src/librustc_driver/Cargo.toml @@ -34,7 +34,7 @@ rustc_traits = { path = "../librustc_traits" } rustc_codegen_utils = { path = "../librustc_codegen_utils" } rustc_typeck = { path = "../librustc_typeck" } rustc_interface = { path = "../librustc_interface" } -serialize = { path = "../libserialize" } +rustc_serialize = { path = "../libserialize", package = "serialize" } syntax = { path = "../libsyntax" } smallvec = { version = "0.6.7", features = ["union", "may_dangle"] } syntax_ext = { path = "../libsyntax_ext" } diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs index 2bc79e5080f3a..c139be07aa1d3 100644 --- a/src/librustc_driver/lib.rs +++ b/src/librustc_driver/lib.rs @@ -46,7 +46,7 @@ use rustc_interface::interface; use rustc_interface::util::get_codegen_sysroot; use rustc_data_structures::sync::SeqCst; -use serialize::json::ToJson; +use rustc_serialize::json::ToJson; use std::borrow::Cow; use std::cmp::max; diff --git a/src/librustc_driver/pretty.rs b/src/librustc_driver/pretty.rs index af00037604430..cb17401f6247b 100644 --- a/src/librustc_driver/pretty.rs +++ b/src/librustc_driver/pretty.rs @@ -892,7 +892,7 @@ fn print_with_analysis( suffix (b::c::d)"); let hir_id = tcx.hir().node_to_hir_id(nodeid); let node = tcx.hir().find(hir_id).unwrap_or_else(|| { - tcx.sess.fatal(&format!("--pretty flowgraph couldn't find id: {}", nodeid)) + tcx.sess.fatal(&format!("`--pretty=flowgraph` couldn't find ID: {}", nodeid)) }); match blocks::Code::from_node(&tcx.hir(), hir_id) { @@ -904,7 +904,7 @@ fn print_with_analysis( print_flowgraph(variants, tcx, code, mode, out) } None => { - let message = format!("--pretty=flowgraph needs block, fn, or method; \ + let message = format!("`--pretty=flowgraph` needs block, fn, or method; \ got {:?}", node); diff --git a/src/librustc_errors/Cargo.toml b/src/librustc_errors/Cargo.toml index 4df9632cce26b..5a192e472aa85 100644 --- a/src/librustc_errors/Cargo.toml +++ b/src/librustc_errors/Cargo.toml @@ -11,7 +11,7 @@ doctest = false [dependencies] log = "0.4" -serialize = { path = "../libserialize" } +rustc_serialize = { path = "../libserialize", package = "serialize" } syntax_pos = { path = "../libsyntax_pos" } rustc_data_structures = { path = "../librustc_data_structures" } unicode-width = "0.1.4" diff --git a/src/librustc_errors/lib.rs b/src/librustc_errors/lib.rs index 3269b85d0dd13..0a6c02c0ca68f 100644 --- a/src/librustc_errors/lib.rs +++ b/src/librustc_errors/lib.rs @@ -12,9 +12,6 @@ #![deny(rust_2018_idioms)] #![deny(unused_lifetimes)] -#[allow(unused_extern_crates)] -extern crate serialize as rustc_serialize; // used by deriving - pub use emitter::ColorConfig; use Level::*; diff --git a/src/librustc_incremental/Cargo.toml b/src/librustc_incremental/Cargo.toml index 9678cb4f65545..a931ad3b66e21 100644 --- a/src/librustc_incremental/Cargo.toml +++ b/src/librustc_incremental/Cargo.toml @@ -15,7 +15,7 @@ log = "0.4" rand = "0.6" rustc = { path = "../librustc" } rustc_data_structures = { path = "../librustc_data_structures" } -serialize = { path = "../libserialize" } +rustc_serialize = { path = "../libserialize", package = "serialize" } syntax = { path = "../libsyntax" } syntax_pos = { path = "../libsyntax_pos" } rustc_fs_util = { path = "../librustc_fs_util" } diff --git a/src/librustc_incremental/lib.rs b/src/librustc_incremental/lib.rs index 569aa78c9d4b3..55aba7caa9d42 100644 --- a/src/librustc_incremental/lib.rs +++ b/src/librustc_incremental/lib.rs @@ -12,9 +12,6 @@ #![deny(unused_lifetimes)] #[macro_use] extern crate rustc; -#[allow(unused_extern_crates)] -extern crate serialize as rustc_serialize; // used by deriving - #[macro_use] extern crate log; mod assert_dep_graph; diff --git a/src/librustc_interface/Cargo.toml b/src/librustc_interface/Cargo.toml index a0efec5ee7a7f..a90254e7e185f 100644 --- a/src/librustc_interface/Cargo.toml +++ b/src/librustc_interface/Cargo.toml @@ -16,7 +16,7 @@ smallvec = { version = "0.6.7", features = ["union", "may_dangle"] } syntax = { path = "../libsyntax" } syntax_ext = { path = "../libsyntax_ext" } syntax_pos = { path = "../libsyntax_pos" } -serialize = { path = "../libserialize" } +rustc_serialize = { path = "../libserialize", package = "serialize" } rustc = { path = "../librustc" } rustc_allocator = { path = "../librustc_allocator" } rustc_ast_borrowck = { path = "../librustc_ast_borrowck" } diff --git a/src/librustc_interface/passes.rs b/src/librustc_interface/passes.rs index 6bf56bf851553..5298f99d54803 100644 --- a/src/librustc_interface/passes.rs +++ b/src/librustc_interface/passes.rs @@ -51,7 +51,7 @@ use syntax::feature_gate::AttributeType; use syntax_pos::{FileName, edition::Edition, hygiene}; use syntax_ext; -use serialize::json; +use rustc_serialize::json; use tempfile::Builder as TempFileBuilder; use std::any::Any; diff --git a/src/librustc_interface/queries.rs b/src/librustc_interface/queries.rs index 570509ffb2b8c..9b79dc6350ca6 100644 --- a/src/librustc_interface/queries.rs +++ b/src/librustc_interface/queries.rs @@ -15,7 +15,7 @@ use rustc::ty::steal::Steal; use rustc::dep_graph::DepGraph; use rustc_passes::hir_stats; use rustc_plugin::registry::Registry; -use serialize::json; +use rustc_serialize::json; use std::cell::{Ref, RefMut, RefCell}; use std::ops::Deref; use std::rc::Rc; diff --git a/src/librustc_metadata/Cargo.toml b/src/librustc_metadata/Cargo.toml index e5c9f1bf2057b..a9f054d5e8be8 100644 --- a/src/librustc_metadata/Cargo.toml +++ b/src/librustc_metadata/Cargo.toml @@ -18,7 +18,7 @@ rustc = { path = "../librustc" } rustc_data_structures = { path = "../librustc_data_structures" } errors = { path = "../librustc_errors", package = "rustc_errors" } rustc_target = { path = "../librustc_target" } -serialize = { path = "../libserialize" } +rustc_serialize = { path = "../libserialize", package = "serialize" } stable_deref_trait = "1.0.0" syntax = { path = "../libsyntax" } syntax_ext = { path = "../libsyntax_ext" } diff --git a/src/librustc_metadata/lib.rs b/src/librustc_metadata/lib.rs index 826349362db25..b0fe06039f4e2 100644 --- a/src/librustc_metadata/lib.rs +++ b/src/librustc_metadata/lib.rs @@ -18,8 +18,6 @@ #![deny(unused_lifetimes)] extern crate libc; -#[allow(unused_extern_crates)] -extern crate serialize as rustc_serialize; // used by deriving extern crate proc_macro; #[macro_use] diff --git a/src/librustc_metadata/schema.rs b/src/librustc_metadata/schema.rs index 8d1de4fd6c392..b7dd1d03e44ae 100644 --- a/src/librustc_metadata/schema.rs +++ b/src/librustc_metadata/schema.rs @@ -13,7 +13,6 @@ use rustc::ty::{self, Ty, ReprOptions}; use rustc_target::spec::{PanicStrategy, TargetTriple}; use rustc_data_structures::svh::Svh; -use rustc_serialize as serialize; use syntax::{ast, attr}; use syntax::edition::Edition; use syntax::symbol::Symbol; @@ -85,8 +84,8 @@ impl Clone for Lazy { } } -impl serialize::UseSpecializedEncodable for Lazy {} -impl serialize::UseSpecializedDecodable for Lazy {} +impl rustc_serialize::UseSpecializedEncodable for Lazy {} +impl rustc_serialize::UseSpecializedDecodable for Lazy {} /// A sequence of type T referred to by its absolute position /// in the metadata and length, and which can be decoded lazily. @@ -133,8 +132,8 @@ impl Clone for LazySeq { } } -impl serialize::UseSpecializedEncodable for LazySeq {} -impl serialize::UseSpecializedDecodable for LazySeq {} +impl rustc_serialize::UseSpecializedEncodable for LazySeq {} +impl rustc_serialize::UseSpecializedDecodable for LazySeq {} /// Encoding / decoding state for `Lazy` and `LazySeq`. #[derive(Copy, Clone, PartialEq, Eq, Debug)] diff --git a/src/librustc_mir/Cargo.toml b/src/librustc_mir/Cargo.toml index 2adbd03b24ff1..21008c737289f 100644 --- a/src/librustc_mir/Cargo.toml +++ b/src/librustc_mir/Cargo.toml @@ -20,7 +20,7 @@ rustc = { path = "../librustc" } rustc_target = { path = "../librustc_target" } rustc_data_structures = { path = "../librustc_data_structures" } rustc_errors = { path = "../librustc_errors" } -serialize = { path = "../libserialize" } +rustc_serialize = { path = "../libserialize", package = "serialize" } syntax = { path = "../libsyntax" } syntax_pos = { path = "../libsyntax_pos" } byteorder = { version = "1.1", features = ["i128"] } diff --git a/src/librustc_mir/lib.rs b/src/librustc_mir/lib.rs index f5e4661afa6b1..964f04d79b960 100644 --- a/src/librustc_mir/lib.rs +++ b/src/librustc_mir/lib.rs @@ -30,13 +30,9 @@ Rust MIR: a lowered representation of Rust. Also: an experiment! #![deny(unused_lifetimes)] #[macro_use] extern crate log; -#[macro_use] -extern crate rustc; +#[macro_use] extern crate rustc; #[macro_use] extern crate rustc_data_structures; -#[allow(unused_extern_crates)] -extern crate serialize as rustc_serialize; // used by deriving -#[macro_use] -extern crate syntax; +#[macro_use] extern crate syntax; mod error_codes; diff --git a/src/librustc_passes/rvalue_promotion.rs b/src/librustc_passes/rvalue_promotion.rs index 8ba3a25e3947c..f2461f7016131 100644 --- a/src/librustc_passes/rvalue_promotion.rs +++ b/src/librustc_passes/rvalue_promotion.rs @@ -311,7 +311,7 @@ fn check_expr_kind<'a, 'tcx>( } hir::ExprKind::Cast(ref from, _) => { let expr_promotability = v.check_expr(from); - debug!("Checking const cast(id={})", from.hir_id); + debug!("checking const cast(id={})", from.hir_id); let cast_in = CastTy::from_ty(v.tables.expr_ty(from)); let cast_out = CastTy::from_ty(v.tables.expr_ty(e)); match (cast_in, cast_out) { @@ -338,15 +338,15 @@ fn check_expr_kind<'a, 'tcx>( if v.in_static { for attr in &v.tcx.get_attrs(did)[..] { if attr.check_name(sym::thread_local) { - debug!("Reference to Static(id={:?}) is unpromotable \ - due to a #[thread_local] attribute", did); + debug!("reference to `Static(id={:?})` is unpromotable \ + due to a `#[thread_local]` attribute", did); return NotPromotable; } } Promotable } else { - debug!("Reference to Static(id={:?}) is unpromotable as it is not \ - referenced from a static", did); + debug!("reference to `Static(id={:?})` is unpromotable as it is not \ + referenced from a static", did); NotPromotable } } diff --git a/src/librustc_resolve/build_reduced_graph.rs b/src/librustc_resolve/build_reduced_graph.rs index ee11228654b6f..cfba42580fcef 100644 --- a/src/librustc_resolve/build_reduced_graph.rs +++ b/src/librustc_resolve/build_reduced_graph.rs @@ -898,7 +898,7 @@ impl<'a> Resolver<'a> { let msg = "macro_escape is a deprecated synonym for macro_use"; let mut err = self.session.struct_span_warn(attr.span, msg); if let ast::AttrStyle::Inner = attr.style { - err.help("consider an outer attribute, #[macro_use] mod ...").emit(); + err.help("consider an outer attribute, `#[macro_use]` mod ...").emit(); } else { err.emit(); } diff --git a/src/librustc_save_analysis/lib.rs b/src/librustc_save_analysis/lib.rs index 2c8f7a44f5a27..c987a46b56737 100644 --- a/src/librustc_save_analysis/lib.rs +++ b/src/librustc_save_analysis/lib.rs @@ -111,7 +111,7 @@ impl<'l, 'tcx> SaveContext<'l, 'tcx> { let span = match self.tcx.extern_crate(n.as_def_id()) { Some(&ExternCrate { span, .. }) => span, None => { - debug!("Skipping crate {}, no data", n); + debug!("skipping crate {}, no data", n); continue; } }; @@ -469,7 +469,7 @@ impl<'l, 'tcx> SaveContext<'l, 'tcx> { ) } None => { - debug!("Could not find container for method {} at {:?}", id, span); + debug!("could not find container for method {} at {:?}", id, span); // This is not necessarily a bug, if there was a compilation error, // the tables we need might not exist. return None; @@ -550,7 +550,7 @@ impl<'l, 'tcx> SaveContext<'l, 'tcx> { } ty::Tuple(..) => None, _ => { - debug!("Expected struct or union type, found {:?}", ty); + debug!("expected struct or union type, found {:?}", ty); None } } @@ -580,7 +580,7 @@ impl<'l, 'tcx> SaveContext<'l, 'tcx> { let method_id = match self.tables.type_dependent_def_id(expr_hir_id) { Some(id) => id, None => { - debug!("Could not resolve method id for {:?}", expr); + debug!("could not resolve method id for {:?}", expr); return None; } }; diff --git a/src/librustc_target/Cargo.toml b/src/librustc_target/Cargo.toml index f1b21365e4bd4..cab1e0e01371d 100644 --- a/src/librustc_target/Cargo.toml +++ b/src/librustc_target/Cargo.toml @@ -12,5 +12,5 @@ path = "lib.rs" bitflags = "1.0" log = "0.4" rustc_data_structures = { path = "../librustc_data_structures" } -serialize = { path = "../libserialize" } +rustc_serialize = { path = "../libserialize", package = "serialize" } syntax_pos = { path = "../libsyntax_pos" } diff --git a/src/librustc_target/lib.rs b/src/librustc_target/lib.rs index dcd1eb5acdc85..a14bc66cc3833 100644 --- a/src/librustc_target/lib.rs +++ b/src/librustc_target/lib.rs @@ -18,8 +18,5 @@ #[macro_use] extern crate log; -#[allow(unused_extern_crates)] -extern crate serialize as rustc_serialize; // used by deriving - pub mod abi; pub mod spec; diff --git a/src/librustc_target/spec/hexagon_unknown_linux_musl.rs b/src/librustc_target/spec/hexagon_unknown_linux_musl.rs new file mode 100644 index 0000000000000..1d3b13d488366 --- /dev/null +++ b/src/librustc_target/spec/hexagon_unknown_linux_musl.rs @@ -0,0 +1,36 @@ +use crate::spec::{LinkerFlavor, Target, TargetResult, LinkArgs}; + +pub fn target() -> TargetResult { + let mut base = super::linux_musl_base::opts(); + base.cpu = "hexagonv60".to_string(); + base.max_atomic_width = Some(32); + // FIXME: HVX length defaults are per-CPU + base.features = "-small-data,+hvx-length128b".to_string(); + + base.crt_static_default = false; + base.atomic_cas = true; + base.has_rpath = true; + base.linker_is_gnu = false; + base.dynamic_linking = true; + base.executables = true; + + base.pre_link_args = LinkArgs::new(); + base.post_link_args = LinkArgs::new(); + + Ok(Target { + llvm_target: "hexagon-unknown-linux-musl".to_string(), + target_endian: "little".to_string(), + target_pointer_width: "32".to_string(), + target_c_int_width: "32".to_string(), + data_layout: concat!("e-m:e-p:32:32:32-a:0-n16:32-i64:64:64-i32:32", + ":32-i16:16:16-i1:8:8-f32:32:32-f64:64:64-v32", + ":32:32-v64:64:64-v512:512:512-v1024:1024:1024-v2048", + ":2048:2048").to_string(), + arch: "hexagon".to_string(), + target_os: "linux".to_string(), + target_env: "musl".to_string(), + target_vendor: "unknown".to_string(), + linker_flavor: LinkerFlavor::Gcc, + options: base, + }) +} diff --git a/src/librustc_target/spec/mod.rs b/src/librustc_target/spec/mod.rs index 1fdc9b015ba39..34b580acbd5c0 100644 --- a/src/librustc_target/spec/mod.rs +++ b/src/librustc_target/spec/mod.rs @@ -34,7 +34,7 @@ //! the target's settings, though `target-feature` and `link-args` will *add* //! to the list specified by the target, rather than replace. -use serialize::json::{Json, ToJson}; +use rustc_serialize::json::{Json, ToJson}; use std::collections::BTreeMap; use std::default::Default; use std::{fmt, io}; @@ -287,7 +287,7 @@ macro_rules! supported_targets { // run-time that the parser works correctly t = Target::from_json(t.to_json()) .map_err(LoadTargetError::Other)?; - debug!("Got builtin target: {:?}", t); + debug!("got builtin target: {:?}", t); Ok(t) }, )+ @@ -306,7 +306,7 @@ macro_rules! supported_targets { #[cfg(test)] mod test_json_encode_decode { - use serialize::json::ToJson; + use rustc_serialize::json::ToJson; use super::Target; $(use super::$module;)+ @@ -368,6 +368,7 @@ supported_targets! { ("i586-unknown-linux-musl", i586_unknown_linux_musl), ("mips-unknown-linux-musl", mips_unknown_linux_musl), ("mipsel-unknown-linux-musl", mipsel_unknown_linux_musl), + ("hexagon-unknown-linux-musl", hexagon_unknown_linux_musl), ("mips-unknown-linux-uclibc", mips_unknown_linux_uclibc), ("mipsel-unknown-linux-uclibc", mipsel_unknown_linux_uclibc), @@ -464,6 +465,7 @@ supported_targets! { ("aarch64-unknown-hermit", aarch64_unknown_hermit), ("x86_64-unknown-hermit", x86_64_unknown_hermit), + ("riscv32i-unknown-none-elf", riscv32i_unknown_none_elf), ("riscv32imc-unknown-none-elf", riscv32imc_unknown_none_elf), ("riscv32imac-unknown-none-elf", riscv32imac_unknown_none_elf), ("riscv64imac-unknown-none-elf", riscv64imac_unknown_none_elf), @@ -1198,7 +1200,7 @@ impl Target { pub fn search(target_triple: &TargetTriple) -> Result { use std::env; use std::fs; - use serialize::json; + use rustc_serialize::json; fn load_file(path: &Path) -> Result { let contents = fs::read(path).map_err(|e| e.to_string())?; diff --git a/src/librustc_target/spec/riscv32i_unknown_none_elf.rs b/src/librustc_target/spec/riscv32i_unknown_none_elf.rs new file mode 100644 index 0000000000000..314778408f7e5 --- /dev/null +++ b/src/librustc_target/spec/riscv32i_unknown_none_elf.rs @@ -0,0 +1,32 @@ +use crate::spec::{LinkerFlavor, LldFlavor, PanicStrategy, + Target, TargetOptions, TargetResult}; + +pub fn target() -> TargetResult { + Ok(Target { + data_layout: "e-m:e-p:32:32-i64:64-n32-S128".to_string(), + llvm_target: "riscv32".to_string(), + target_endian: "little".to_string(), + target_pointer_width: "32".to_string(), + target_c_int_width: "32".to_string(), + target_os: "none".to_string(), + target_env: String::new(), + target_vendor: "unknown".to_string(), + arch: "riscv32".to_string(), + linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld), + + options: TargetOptions { + linker: Some("rust-lld".to_string()), + cpu: "generic-rv32".to_string(), + max_atomic_width: None, + atomic_cas: false, + features: String::new(), + executables: true, + panic_strategy: PanicStrategy::Abort, + relocation_model: "static".to_string(), + emit_debug_gdb_scripts: false, + abi_blacklist: super::riscv_base::abi_blacklist(), + eliminate_frame_pointer: false, + .. Default::default() + }, + }) +} diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 72e6614dc0652..30419d3d3c650 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -1319,7 +1319,7 @@ impl Clean> for ty::RegionKind { ty::ReEmpty | ty::ReClosureBound(_) | ty::ReErased => { - debug!("Cannot clean region {:?}", self); + debug!("cannot clean region {:?}", self); None } } @@ -4082,7 +4082,7 @@ impl ToSource for syntax_pos::Span { fn name_from_pat(p: &hir::Pat) -> String { use rustc::hir::*; - debug!("Trying to get a name from pattern: {:?}", p); + debug!("trying to get a name from pattern: {:?}", p); match p.node { PatKind::Wild => "_".to_string(), diff --git a/src/librustdoc/config.rs b/src/librustdoc/config.rs index 9fae246155e06..ab7b5b2a85370 100644 --- a/src/librustdoc/config.rs +++ b/src/librustdoc/config.rs @@ -250,7 +250,7 @@ impl Options { None => ColorConfig::Auto, Some(arg) => { early_error(ErrorOutputType::default(), - &format!("argument for --color must be `auto`, `always` or `never` \ + &format!("argument for `--color` must be `auto`, `always` or `never` \ (instead was `{}`)", arg)); } }; @@ -269,7 +269,7 @@ impl Options { Some("short") => ErrorOutputType::HumanReadable(HumanReadableErrorType::Short(color)), Some(arg) => { early_error(ErrorOutputType::default(), - &format!("argument for --error-format must be `human`, `json` or \ + &format!("argument for `--error-format` must be `human`, `json` or \ `short` (instead was `{}`)", arg)); } }; diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index c391baabee06b..cc79f4ab09a51 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -432,7 +432,7 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt }, sym::plugins => { report_deprecated_attr("plugins = \"...\"", diag); - eprintln!("WARNING: #![doc(plugins = \"...\")] no longer functions; \ + eprintln!("WARNING: `#![doc(plugins = \"...\")]` no longer functions; \ see CVE-2018-1000622"); continue }, diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs index 63545ab45bf64..462e21b8f6b55 100644 --- a/src/librustdoc/test.rs +++ b/src/librustdoc/test.rs @@ -730,7 +730,7 @@ impl Tester for Collector { let edition = config.edition.unwrap_or(self.edition); let persist_doctests = self.persist_doctests.clone(); - debug!("Creating test {}: {}", name, test); + debug!("creating test {}: {}", name, test); self.tests.push(testing::TestDescAndFn { desc: testing::TestDesc { name: testing::DynTestName(name), diff --git a/src/librustdoc/visit_ast.rs b/src/librustdoc/visit_ast.rs index 009d681ed8353..4a3743bdf7c28 100644 --- a/src/librustdoc/visit_ast.rs +++ b/src/librustdoc/visit_ast.rs @@ -96,7 +96,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> { pub fn visit_variant_data(&mut self, item: &'tcx hir::Item, name: ast::Name, sd: &'tcx hir::VariantData, generics: &'tcx hir::Generics) -> Struct<'tcx> { - debug!("Visiting struct"); + debug!("visiting struct"); let struct_type = struct_type_from_def(&*sd); Struct { id: item.hir_id, @@ -115,7 +115,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> { pub fn visit_union_data(&mut self, item: &'tcx hir::Item, name: ast::Name, sd: &'tcx hir::VariantData, generics: &'tcx hir::Generics) -> Union<'tcx> { - debug!("Visiting union"); + debug!("visiting union"); let struct_type = struct_type_from_def(&*sd); Union { id: item.hir_id, @@ -134,7 +134,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> { pub fn visit_enum_def(&mut self, it: &'tcx hir::Item, name: ast::Name, def: &'tcx hir::EnumDef, generics: &'tcx hir::Generics) -> Enum<'tcx> { - debug!("Visiting enum"); + debug!("visiting enum"); Enum { name, variants: def.variants.iter().map(|v| Variant { @@ -161,7 +161,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> { header: hir::FnHeader, generics: &'tcx hir::Generics, body: hir::BodyId) { - debug!("Visiting fn"); + debug!("visiting fn"); let macro_kind = item.attrs.iter().filter_map(|a| { if a.check_name(sym::proc_macro) { Some(MacroKind::Bang) @@ -371,7 +371,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> { pub fn visit_item(&mut self, item: &'tcx hir::Item, renamed: Option, om: &mut Module<'tcx>) { - debug!("Visiting item {:?}", item); + debug!("visiting item {:?}", item); let ident = renamed.unwrap_or(item.ident); if item.vis.node.is_pub() { diff --git a/src/libserialize/tests/json.rs b/src/libserialize/tests/json.rs index 0fe3d4cfd6297..3fb6bda679bc1 100644 --- a/src/libserialize/tests/json.rs +++ b/src/libserialize/tests/json.rs @@ -1,4 +1,3 @@ -#[allow(unused_extern_crates)] extern crate serialize as rustc_serialize; use rustc_serialize::{Encodable, Decodable}; diff --git a/src/libserialize/tests/opaque.rs b/src/libserialize/tests/opaque.rs index 62a8f25124439..fff6fc69e7842 100644 --- a/src/libserialize/tests/opaque.rs +++ b/src/libserialize/tests/opaque.rs @@ -1,4 +1,3 @@ -#[allow(unused_extern_crates)] extern crate serialize as rustc_serialize; use rustc_serialize::{Encodable, Decodable}; diff --git a/src/libstd/env.rs b/src/libstd/env.rs index 00e840a53e9c0..1f5de25b65c90 100644 --- a/src/libstd/env.rs +++ b/src/libstd/env.rs @@ -975,6 +975,11 @@ mod arch { pub const ARCH: &str = "wasm32"; } +#[cfg(target_arch = "hexagon")] +mod arch { + pub const ARCH: &'static str = "hexagon"; +} + #[cfg(test)] mod tests { use super::*; diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 49fb4be39b451..fbc68c610ee39 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -273,6 +273,7 @@ #![feature(link_args)] #![feature(linkage)] #![feature(maybe_uninit_ref)] +#![feature(maybe_uninit_slice)] #![feature(mem_take)] #![feature(needs_panic_runtime)] #![feature(never_type)] diff --git a/src/libstd/os/linux/raw.rs b/src/libstd/os/linux/raw.rs index 77eeacb4b477c..21e1cf8a22b4b 100644 --- a/src/libstd/os/linux/raw.rs +++ b/src/libstd/os/linux/raw.rs @@ -147,6 +147,62 @@ mod arch { } } +#[cfg(target_arch = "hexagon")] +mod arch { + use crate::os::raw::{c_long, c_int, c_longlong, culonglong}; + + #[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = c_longlong; + #[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = c_long; + #[stable(feature = "raw_ext", since = "1.1.0")] pub type ino_t = c_ulonglong; + #[stable(feature = "raw_ext", since = "1.1.0")] pub type nlink_t = c_uint; + #[stable(feature = "raw_ext", since = "1.1.0")] pub type off_t = c_longlong; + #[stable(feature = "raw_ext", since = "1.1.0")] pub type time_t = c_long; + + #[repr(C)] + #[derive(Clone)] + #[stable(feature = "raw_ext", since = "1.1.0")] + pub struct stat { + #[stable(feature = "raw_ext", since = "1.1.0")] + pub st_dev: ::dev_t, + #[stable(feature = "raw_ext", since = "1.1.0")] + pub st_ino: ::c_ulonglong, + #[stable(feature = "raw_ext", since = "1.1.0")] + pub st_mode: ::c_uint, + #[stable(feature = "raw_ext", since = "1.1.0")] + pub st_nlink: ::c_uint, + #[stable(feature = "raw_ext", since = "1.1.0")] + pub st_uid: ::c_uint, + #[stable(feature = "raw_ext", since = "1.1.0")] + pub st_gid: ::c_uint, + #[stable(feature = "raw_ext", since = "1.1.0")] + pub st_rdev: ::c_ulonglong, + #[stable(feature = "raw_ext", since = "1.1.0")] + pub __pad1: ::c_ulong, + #[stable(feature = "raw_ext", since = "1.1.0")] + pub st_size: ::c_longlong, + #[stable(feature = "raw_ext", since = "1.1.0")] + pub st_blksize: ::blksize_t, + #[stable(feature = "raw_ext", since = "1.1.0")] + pub __pad2: ::c_int, + #[stable(feature = "raw_ext", since = "1.1.0")] + pub st_blocks: ::blkcnt_t, + #[stable(feature = "raw_ext", since = "1.1.0")] + pub st_atime: ::time_t, + #[stable(feature = "raw_ext", since = "1.1.0")] + pub st_atime_nsec: ::c_long, + #[stable(feature = "raw_ext", since = "1.1.0")] + pub st_mtime: ::time_t, + #[stable(feature = "raw_ext", since = "1.1.0")] + pub st_mtime_nsec: ::c_long, + #[stable(feature = "raw_ext", since = "1.1.0")] + pub st_ctime: ::time_t, + #[stable(feature = "raw_ext", since = "1.1.0")] + pub st_ctime_nsec: ::c_long, + #[stable(feature = "raw_ext", since = "1.1.0")] + pub __pad3: [::c_int;2], + } +} + #[cfg(any(target_arch = "mips64", target_arch = "s390x", target_arch = "sparc64"))] diff --git a/src/libstd/os/raw/mod.rs b/src/libstd/os/raw/mod.rs index c0b0b6d40d891..cf8be393a4049 100644 --- a/src/libstd/os/raw/mod.rs +++ b/src/libstd/os/raw/mod.rs @@ -11,6 +11,7 @@ #[doc(include = "os/raw/char.md")] #[cfg(any(all(target_os = "linux", any(target_arch = "aarch64", target_arch = "arm", + target_arch = "hexagon", target_arch = "powerpc", target_arch = "powerpc64", target_arch = "s390x")), @@ -34,6 +35,7 @@ #[doc(include = "os/raw/char.md")] #[cfg(not(any(all(target_os = "linux", any(target_arch = "aarch64", target_arch = "arm", + target_arch = "hexagon", target_arch = "powerpc", target_arch = "powerpc64", target_arch = "s390x")), diff --git a/src/libstd/primitive_docs.rs b/src/libstd/primitive_docs.rs index 65fd8c83e1ce5..d9a3da66a6786 100644 --- a/src/libstd/primitive_docs.rs +++ b/src/libstd/primitive_docs.rs @@ -362,8 +362,13 @@ mod prim_unit { } /// /// *[See also the `std::ptr` module](ptr/index.html).* /// -/// Working with raw pointers in Rust is uncommon, -/// typically limited to a few patterns. +/// Working with raw pointers in Rust is uncommon, typically limited to a few patterns. +/// Raw pointers can be unaligned or [`null`]. However, when a raw pointer is +/// dereferenced (using the `*` operator), it must be non-null and aligned. +/// +/// Storing through a raw pointer using `*ptr = data` calls `drop` on the old value, so +/// [`write`] must be used if the type has drop glue and memory is not already +/// initialized - otherwise `drop` would be called on the uninitialized memory. /// /// Use the [`null`] and [`null_mut`] functions to create null pointers, and the /// [`is_null`] method of the `*const T` and `*mut T` types to check for null. @@ -442,6 +447,7 @@ mod prim_unit { } /// [`offset`]: ../std/primitive.pointer.html#method.offset /// [`into_raw`]: ../std/boxed/struct.Box.html#method.into_raw /// [`drop`]: ../std/mem/fn.drop.html +/// [`write`]: ../std/ptr/fn.write.html #[stable(feature = "rust1", since = "1.0.0")] mod prim_pointer { } @@ -891,9 +897,13 @@ mod prim_usize { } /// A reference represents a borrow of some owned value. You can get one by using the `&` or `&mut` /// operators on a value, or by using a `ref` or `ref mut` pattern. /// -/// For those familiar with pointers, a reference is just a pointer that is assumed to not be null. -/// In fact, `Option<&T>` has the same memory representation as a nullable pointer, and can be -/// passed across FFI boundaries as such. +/// For those familiar with pointers, a reference is just a pointer that is assumed to be +/// aligned, not null, and pointing to memory containing a valid value of `T` - for example, +/// `&bool` can only point to an allocation containing the integer values `1` (`true`) or `0` +/// (`false`), but creating a `&bool` that points to an allocation containing +/// the value `3` causes undefined behaviour. +/// In fact, `Option<&T>` has the same memory representation as a +/// nullable but aligned pointer, and can be passed across FFI boundaries as such. /// /// In most cases, references can be used much like the original value. Field access, method /// calling, and indexing work the same (save for mutability rules, of course). In addition, the @@ -1036,6 +1046,11 @@ mod prim_ref { } /// [`FnMut`]: ops/trait.FnMut.html /// [`FnOnce`]: ops/trait.FnOnce.html /// +/// Function pointers are pointers that point to *code*, not data. They can be called +/// just like functions. Like references, function pointers are, among other things, assumed to +/// not be null, so if you want to pass a function pointer over FFI and be able to accommodate null +/// pointers, make your type `Option` with your required signature. +/// /// Plain function pointers are obtained by casting either plain functions, or closures that don't /// capture an environment: /// @@ -1091,10 +1106,6 @@ mod prim_ref { } /// /// These markers can be combined, so `unsafe extern "stdcall" fn()` is a valid type. /// -/// Like references in rust, function pointers are assumed to not be null, so if you want to pass a -/// function pointer over FFI and be able to accommodate null pointers, make your type -/// `Option` with your required signature. -/// /// Function pointers implement the following traits: /// /// * [`Clone`] diff --git a/src/libstd/sys/cloudabi/abi/cloudabi.rs b/src/libstd/sys/cloudabi/abi/cloudabi.rs index 2307e2167c5c1..9addba8b6118e 100644 --- a/src/libstd/sys/cloudabi/abi/cloudabi.rs +++ b/src/libstd/sys/cloudabi/abi/cloudabi.rs @@ -1884,7 +1884,7 @@ pub unsafe fn clock_res_get(clock_id_: clockid, resolution_: &mut timestamp) -> /// **time**: /// The time value of the clock. #[inline] -pub unsafe fn clock_time_get(clock_id_: clockid, precision_: timestamp, time_: &mut timestamp) -> errno { +pub unsafe fn clock_time_get(clock_id_: clockid, precision_: timestamp, time_: *mut timestamp) -> errno { cloudabi_sys_clock_time_get(clock_id_, precision_, time_) } @@ -2643,7 +2643,7 @@ pub unsafe fn mem_unmap(mapping_: &mut [u8]) -> errno { /// **nevents**: /// The number of events stored. #[inline] -pub unsafe fn poll(in_: *const subscription, out_: *mut event, nsubscriptions_: usize, nevents_: &mut usize) -> errno { +pub unsafe fn poll(in_: *const subscription, out_: *mut event, nsubscriptions_: usize, nevents_: *mut usize) -> errno { cloudabi_sys_poll(in_, out_, nsubscriptions_, nevents_) } diff --git a/src/libstd/sys/cloudabi/condvar.rs b/src/libstd/sys/cloudabi/condvar.rs index 7aa0b0b6f4912..ec1fca7805a17 100644 --- a/src/libstd/sys/cloudabi/condvar.rs +++ b/src/libstd/sys/cloudabi/condvar.rs @@ -79,16 +79,21 @@ impl Condvar { }, ..mem::zeroed() }; - let mut event: abi::event = mem::uninitialized(); - let mut nevents: usize = mem::uninitialized(); - let ret = abi::poll(&subscription, &mut event, 1, &mut nevents); + let mut event: mem::MaybeUninit = mem::MaybeUninit::uninit(); + let mut nevents: mem::MaybeUninit = mem::MaybeUninit::uninit(); + let ret = abi::poll( + &subscription, + event.as_mut_ptr(), + 1, + nevents.as_mut_ptr() + ); assert_eq!( ret, abi::errno::SUCCESS, "Failed to wait on condition variable" ); assert_eq!( - event.error, + event.assume_init().error, abi::errno::SUCCESS, "Failed to wait on condition variable" ); @@ -131,21 +136,27 @@ impl Condvar { ..mem::zeroed() }, ]; - let mut events: [abi::event; 2] = mem::uninitialized(); - let mut nevents: usize = mem::uninitialized(); - let ret = abi::poll(subscriptions.as_ptr(), events.as_mut_ptr(), 2, &mut nevents); + let mut events: [mem::MaybeUninit; 2] = [mem::MaybeUninit::uninit(); 2]; + let mut nevents: mem::MaybeUninit = mem::MaybeUninit::uninit(); + let ret = abi::poll( + subscriptions.as_ptr(), + mem::MaybeUninit::first_ptr_mut(&mut events), + 2, + nevents.as_mut_ptr() + ); assert_eq!( ret, abi::errno::SUCCESS, "Failed to wait on condition variable" ); + let nevents = nevents.assume_init(); for i in 0..nevents { assert_eq!( - events[i].error, + events[i].assume_init().error, abi::errno::SUCCESS, "Failed to wait on condition variable" ); - if events[i].type_ == abi::eventtype::CONDVAR { + if events[i].assume_init().type_ == abi::eventtype::CONDVAR { return true; } } diff --git a/src/libstd/sys/cloudabi/mod.rs b/src/libstd/sys/cloudabi/mod.rs index 77a52a8743d95..6e147612eb4b7 100644 --- a/src/libstd/sys/cloudabi/mod.rs +++ b/src/libstd/sys/cloudabi/mod.rs @@ -61,8 +61,11 @@ pub use libc::strlen; pub fn hashmap_random_keys() -> (u64, u64) { unsafe { - let mut v = mem::uninitialized(); - libc::arc4random_buf(&mut v as *mut _ as *mut libc::c_void, mem::size_of_val(&v)); - v + let mut v: mem::MaybeUninit<(u64, u64)> = mem::MaybeUninit::uninit(); + libc::arc4random_buf( + v.as_mut_ptr() as *mut libc::c_void, + mem::size_of_val(&v) + ); + v.assume_init() } } diff --git a/src/libstd/sys/cloudabi/mutex.rs b/src/libstd/sys/cloudabi/mutex.rs index 5e191e31d5fc4..d3ff0077b20e5 100644 --- a/src/libstd/sys/cloudabi/mutex.rs +++ b/src/libstd/sys/cloudabi/mutex.rs @@ -1,5 +1,6 @@ use crate::cell::UnsafeCell; use crate::mem; +use crate::mem::MaybeUninit; use crate::sync::atomic::{AtomicU32, Ordering}; use crate::sys::cloudabi::abi; use crate::sys::rwlock::{self, RWLock}; @@ -47,24 +48,27 @@ impl Mutex { } pub struct ReentrantMutex { - lock: UnsafeCell, - recursion: UnsafeCell, + lock: UnsafeCell>, + recursion: UnsafeCell>, } impl ReentrantMutex { pub unsafe fn uninitialized() -> ReentrantMutex { - mem::uninitialized() + ReentrantMutex { + lock: UnsafeCell::new(MaybeUninit::uninit()), + recursion: UnsafeCell::new(MaybeUninit::uninit()) + } } pub unsafe fn init(&mut self) { - self.lock = UnsafeCell::new(AtomicU32::new(abi::LOCK_UNLOCKED.0)); - self.recursion = UnsafeCell::new(0); + self.lock = UnsafeCell::new(MaybeUninit::new(AtomicU32::new(abi::LOCK_UNLOCKED.0))); + self.recursion = UnsafeCell::new(MaybeUninit::new(0)); } pub unsafe fn try_lock(&self) -> bool { // Attempt to acquire the lock. - let lock = self.lock.get(); - let recursion = self.recursion.get(); + let lock = (*self.lock.get()).as_mut_ptr(); + let recursion = (*self.recursion.get()).as_mut_ptr(); if let Err(old) = (*lock).compare_exchange( abi::LOCK_UNLOCKED.0, __pthread_thread_id.0 | abi::LOCK_WRLOCKED.0, @@ -109,8 +113,8 @@ impl ReentrantMutex { } pub unsafe fn unlock(&self) { - let lock = self.lock.get(); - let recursion = self.recursion.get(); + let lock = (*self.lock.get()).as_mut_ptr(); + let recursion = (*self.recursion.get()).as_mut_ptr(); assert_eq!( (*lock).load(Ordering::Relaxed) & !abi::LOCK_KERNEL_MANAGED.0, __pthread_thread_id.0 | abi::LOCK_WRLOCKED.0, @@ -136,8 +140,8 @@ impl ReentrantMutex { } pub unsafe fn destroy(&self) { - let lock = self.lock.get(); - let recursion = self.recursion.get(); + let lock = (*self.lock.get()).as_mut_ptr(); + let recursion = (*self.recursion.get()).as_mut_ptr(); assert_eq!( (*lock).load(Ordering::Relaxed), abi::LOCK_UNLOCKED.0, diff --git a/src/libstd/sys/cloudabi/time.rs b/src/libstd/sys/cloudabi/time.rs index 49a234e115804..5e502dcb2ba50 100644 --- a/src/libstd/sys/cloudabi/time.rs +++ b/src/libstd/sys/cloudabi/time.rs @@ -18,10 +18,10 @@ pub fn checked_dur2intervals(dur: &Duration) -> Option { impl Instant { pub fn now() -> Instant { unsafe { - let mut t = mem::uninitialized(); - let ret = abi::clock_time_get(abi::clockid::MONOTONIC, 0, &mut t); + let mut t: mem::MaybeUninit = mem::MaybeUninit::uninit(); + let ret = abi::clock_time_get(abi::clockid::MONOTONIC, 0, t.as_mut_ptr()); assert_eq!(ret, abi::errno::SUCCESS); - Instant { t } + Instant { t: t.assume_init() } } } @@ -59,10 +59,10 @@ pub struct SystemTime { impl SystemTime { pub fn now() -> SystemTime { unsafe { - let mut t = mem::uninitialized(); - let ret = abi::clock_time_get(abi::clockid::REALTIME, 0, &mut t); + let mut t: mem::MaybeUninit = mem::MaybeUninit::uninit(); + let ret = abi::clock_time_get(abi::clockid::REALTIME, 0, t.as_mut_ptr()); assert_eq!(ret, abi::errno::SUCCESS); - SystemTime { t } + SystemTime { t: t.assume_init() } } } diff --git a/src/libstd/sys_common/alloc.rs b/src/libstd/sys_common/alloc.rs index 978a70bee0983..1cfc7ed17f2e4 100644 --- a/src/libstd/sys_common/alloc.rs +++ b/src/libstd/sys_common/alloc.rs @@ -12,7 +12,8 @@ use crate::ptr; target_arch = "powerpc", target_arch = "powerpc64", target_arch = "asmjs", - target_arch = "wasm32")))] + target_arch = "wasm32", + target_arch = "hexagon")))] pub const MIN_ALIGN: usize = 8; #[cfg(all(any(target_arch = "x86_64", target_arch = "aarch64", diff --git a/src/libsyntax/Cargo.toml b/src/libsyntax/Cargo.toml index 15c685b3b7b50..d4a9acc1569b4 100644 --- a/src/libsyntax/Cargo.toml +++ b/src/libsyntax/Cargo.toml @@ -11,7 +11,7 @@ doctest = false [dependencies] bitflags = "1.0" -serialize = { path = "../libserialize" } +rustc_serialize = { path = "../libserialize", package = "serialize" } log = "0.4" scoped-tls = "1.0" lazy_static = "1.0.0" diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index b9b43c89346c7..dbfad3ef7f4de 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -22,7 +22,7 @@ use syntax_pos::{Span, DUMMY_SP}; use rustc_data_structures::fx::FxHashSet; use rustc_data_structures::sync::Lrc; -use serialize::{self, Decoder, Encoder}; +use rustc_serialize::{self, Decoder, Encoder}; use std::fmt; pub use rustc_target::abi::FloatTy; @@ -266,13 +266,13 @@ impl fmt::Display for NodeId { } } -impl serialize::UseSpecializedEncodable for NodeId { +impl rustc_serialize::UseSpecializedEncodable for NodeId { fn default_encode(&self, s: &mut S) -> Result<(), S::Error> { s.emit_u32(self.as_u32()) } } -impl serialize::UseSpecializedDecodable for NodeId { +impl rustc_serialize::UseSpecializedDecodable for NodeId { fn default_decode(d: &mut D) -> Result { d.read_u32().map(NodeId::from_u32) } @@ -2414,12 +2414,11 @@ impl ForeignItemKind { #[cfg(test)] mod tests { use super::*; - use serialize; // Are ASTs encodable? #[test] fn check_asts_encodable() { - fn assert_encodable() {} + fn assert_encodable() {} assert_encodable::(); } } diff --git a/src/libsyntax/attr/mod.rs b/src/libsyntax/attr/mod.rs index a9f2429560ad2..7be21ff9029a5 100644 --- a/src/libsyntax/attr/mod.rs +++ b/src/libsyntax/attr/mod.rs @@ -30,7 +30,7 @@ use std::iter; use std::ops::DerefMut; pub fn mark_used(attr: &Attribute) { - debug!("Marking {:?} as used.", attr); + debug!("marking {:?} as used", attr); GLOBALS.with(|globals| { globals.used_attrs.lock().insert(attr.id); }); @@ -43,7 +43,7 @@ pub fn is_used(attr: &Attribute) -> bool { } pub fn mark_known(attr: &Attribute) { - debug!("Marking {:?} as known.", attr); + debug!("marking {:?} as known", attr); GLOBALS.with(|globals| { globals.known_attrs.lock().insert(attr.id); }); diff --git a/src/libsyntax/error_codes.rs b/src/libsyntax/error_codes.rs index e2d212eb721ff..029ce73498c68 100644 --- a/src/libsyntax/error_codes.rs +++ b/src/libsyntax/error_codes.rs @@ -182,7 +182,7 @@ beta compilers will not comply. Example of erroneous code (on a stable compiler): ```ignore (depends on release channel) -#![feature(non_ascii_idents)] // error: #![feature] may not be used on the +#![feature(non_ascii_idents)] // error: `#![feature]` may not be used on the // stable release channel ``` diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index ae72f1fd108ed..14d573d07d0af 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -602,7 +602,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> { None => return TokenStream::empty(), } self.cx.span_err(span, "custom attribute invocations must be \ - of the form #[foo] or #[foo(..)], the macro name must only be \ + of the form `#[foo]` or `#[foo(..)]`, the macro name must only be \ followed by a delimiter token"); TokenStream::empty() } diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs index 3dea1977c4dac..0507a322a5fb2 100644 --- a/src/libsyntax/lib.rs +++ b/src/libsyntax/lib.rs @@ -24,9 +24,6 @@ #![recursion_limit="256"] -#[allow(unused_extern_crates)] -extern crate serialize as rustc_serialize; // used by deriving - pub use errors; use rustc_data_structures::sync::Lock; use rustc_data_structures::bit_set::GrowableBitSet; diff --git a/src/libsyntax/ptr.rs b/src/libsyntax/ptr.rs index be580dc2e6a7e..b5eb8ca94c07a 100644 --- a/src/libsyntax/ptr.rs +++ b/src/libsyntax/ptr.rs @@ -31,7 +31,7 @@ use std::iter::FromIterator; use std::ops::{Deref, DerefMut}; use std::{slice, vec}; -use serialize::{Encodable, Decodable, Encoder, Decoder}; +use rustc_serialize::{Encodable, Decodable, Encoder, Decoder}; use rustc_data_structures::stable_hasher::{StableHasher, StableHasherResult, HashStable}; diff --git a/src/libsyntax/test.rs b/src/libsyntax/test.rs index d82cdce2ce92b..2ada710484347 100644 --- a/src/libsyntax/test.rs +++ b/src/libsyntax/test.rs @@ -414,7 +414,7 @@ fn get_test_runner(sd: &errors::Handler, krate: &ast::Crate) -> Option meta_item.path.clone(), diff --git a/src/libsyntax/tokenstream.rs b/src/libsyntax/tokenstream.rs index 88142344d79e0..34e68944926df 100644 --- a/src/libsyntax/tokenstream.rs +++ b/src/libsyntax/tokenstream.rs @@ -23,7 +23,7 @@ use syntax_pos::{BytePos, ExpnId, Span, DUMMY_SP}; #[cfg(target_arch = "x86_64")] use rustc_data_structures::static_assert_size; use rustc_data_structures::sync::Lrc; -use serialize::{Decoder, Decodable, Encoder, Encodable}; +use rustc_serialize::{Decoder, Decodable, Encoder, Encodable}; use smallvec::{SmallVec, smallvec}; use std::borrow::Cow; diff --git a/src/libsyntax_pos/Cargo.toml b/src/libsyntax_pos/Cargo.toml index eebd25d1fafd8..bc13d2a161132 100644 --- a/src/libsyntax_pos/Cargo.toml +++ b/src/libsyntax_pos/Cargo.toml @@ -10,7 +10,7 @@ path = "lib.rs" doctest = false [dependencies] -serialize = { path = "../libserialize" } +rustc_serialize = { path = "../libserialize", package = "serialize" } rustc_macros = { path = "../librustc_macros" } rustc_data_structures = { path = "../librustc_data_structures" } arena = { path = "../libarena" } diff --git a/src/libsyntax_pos/hygiene.rs b/src/libsyntax_pos/hygiene.rs index 944b1da36d038..a96e5ef2323ee 100644 --- a/src/libsyntax_pos/hygiene.rs +++ b/src/libsyntax_pos/hygiene.rs @@ -30,7 +30,7 @@ use crate::{Span, DUMMY_SP}; use crate::edition::Edition; use crate::symbol::{kw, Symbol}; -use serialize::{Encodable, Decodable, Encoder, Decoder}; +use rustc_serialize::{Encodable, Decodable, Encoder, Decoder}; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::sync::Lrc; use std::fmt; diff --git a/src/libsyntax_pos/lib.rs b/src/libsyntax_pos/lib.rs index b9a062c0765f0..e5f0892b37be8 100644 --- a/src/libsyntax_pos/lib.rs +++ b/src/libsyntax_pos/lib.rs @@ -19,10 +19,7 @@ #![feature(specialization)] #![feature(step_trait)] -use serialize::{Encodable, Decodable, Encoder, Decoder}; - -#[allow(unused_extern_crates)] -extern crate serialize as rustc_serialize; // used by deriving +use rustc_serialize::{Encodable, Decodable, Encoder, Decoder}; pub mod edition; use edition::Edition; @@ -594,7 +591,7 @@ impl Default for Span { } } -impl serialize::UseSpecializedEncodable for Span { +impl rustc_serialize::UseSpecializedEncodable for Span { fn default_encode(&self, s: &mut S) -> Result<(), S::Error> { let span = self.data(); s.emit_struct("Span", 2, |s| { @@ -609,7 +606,7 @@ impl serialize::UseSpecializedEncodable for Span { } } -impl serialize::UseSpecializedDecodable for Span { +impl rustc_serialize::UseSpecializedDecodable for Span { fn default_decode(d: &mut D) -> Result { d.read_struct("Span", 2, |d| { let lo = d.read_struct_field("lo", 0, Decodable::decode)?; diff --git a/src/libsyntax_pos/symbol.rs b/src/libsyntax_pos/symbol.rs index f23ed7371c6dc..308f7d5d4e3fb 100644 --- a/src/libsyntax_pos/symbol.rs +++ b/src/libsyntax_pos/symbol.rs @@ -7,7 +7,7 @@ use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::indexed_vec::Idx; use rustc_data_structures::newtype_index; use rustc_macros::symbols; -use serialize::{Decodable, Decoder, Encodable, Encoder}; +use rustc_serialize::{Decodable, Decoder, Encodable, Encoder}; use std::cmp::{PartialEq, Ordering, PartialOrd, Ord}; use std::fmt; diff --git a/src/libunwind/libunwind.rs b/src/libunwind/libunwind.rs index 30897970fa220..aacbfc547d472 100644 --- a/src/libunwind/libunwind.rs +++ b/src/libunwind/libunwind.rs @@ -56,6 +56,9 @@ pub const unwinder_private_data_size: usize = 2; #[cfg(target_os = "emscripten")] pub const unwinder_private_data_size: usize = 20; +#[cfg(all(target_arch = "hexagon", target_os = "linux"))] +pub const unwinder_private_data_size: usize = 35; + #[repr(C)] pub struct _Unwind_Exception { pub exception_class: _Unwind_Exception_Class, diff --git a/src/test/ui/cross/cross-fn-cache-hole.stderr b/src/test/ui/cross/cross-fn-cache-hole.stderr index 3bedd0dac23b4..0d325bb7ec102 100644 --- a/src/test/ui/cross/cross-fn-cache-hole.stderr +++ b/src/test/ui/cross/cross-fn-cache-hole.stderr @@ -11,7 +11,7 @@ LL | | } | |_^ the trait `Bar` is not implemented for `i32` | = help: see issue #48214 - = help: add #![feature(trivial_bounds)] to the crate attributes to enable + = help: add `#![feature(trivial_bounds)]` to the crate attributes to enable error: aborting due to previous error diff --git a/src/test/ui/deprecation/deprecated-macro_escape-inner.stderr b/src/test/ui/deprecation/deprecated-macro_escape-inner.stderr index a2cd196b21f8b..1b69270d624f4 100644 --- a/src/test/ui/deprecation/deprecated-macro_escape-inner.stderr +++ b/src/test/ui/deprecation/deprecated-macro_escape-inner.stderr @@ -4,5 +4,5 @@ warning: macro_escape is a deprecated synonym for macro_use LL | #![macro_escape] | ^^^^^^^^^^^^^^^^ | - = help: consider an outer attribute, #[macro_use] mod ... + = help: consider an outer attribute, `#[macro_use]` mod ... diff --git a/src/test/ui/error-codes/E0137.stderr b/src/test/ui/error-codes/E0137.stderr index a5f05d33a0815..f4d5e10369ac7 100644 --- a/src/test/ui/error-codes/E0137.stderr +++ b/src/test/ui/error-codes/E0137.stderr @@ -1,11 +1,11 @@ -error[E0137]: multiple functions with a #[main] attribute +error[E0137]: multiple functions with a `#[main]` attribute --> $DIR/E0137.rs:7:1 | LL | fn foo() {} - | ----------- first #[main] function + | ----------- first `#[main]` function ... LL | fn f() {} - | ^^^^^^^^^ additional #[main] function + | ^^^^^^^^^ additional `#[main]` function error: aborting due to previous error diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr index 94757c5a35af2..a0b770e971134 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr +++ b/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr @@ -184,7 +184,7 @@ warning: macro_escape is a deprecated synonym for macro_use LL | mod inner { #![macro_escape] } | ^^^^^^^^^^^^^^^^ | - = help: consider an outer attribute, #[macro_use] mod ... + = help: consider an outer attribute, `#[macro_use]` mod ... warning: the feature `rust1` has been stable since 1.0.0 and no longer requires an attribute to enable --> $DIR/issue-43106-gating-of-builtin-attrs.rs:89:12 diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-macro_escape.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-macro_escape.stderr index 9fb9633d9a86a..8575c1660c5a1 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-macro_escape.stderr +++ b/src/test/ui/feature-gate/issue-43106-gating-of-macro_escape.stderr @@ -4,5 +4,5 @@ warning: macro_escape is a deprecated synonym for macro_use LL | #![macro_escape] | ^^^^^^^^^^^^^^^^ | - = help: consider an outer attribute, #[macro_use] mod ... + = help: consider an outer attribute, `#[macro_use]` mod ... diff --git a/src/test/ui/feature-gates/feature-gate-trivial_bounds.stderr b/src/test/ui/feature-gates/feature-gate-trivial_bounds.stderr index 1d346fd42ffa4..b4d4c992c9086 100644 --- a/src/test/ui/feature-gates/feature-gate-trivial_bounds.stderr +++ b/src/test/ui/feature-gates/feature-gate-trivial_bounds.stderr @@ -5,7 +5,7 @@ LL | enum E where i32: Foo { V } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `i32` | = help: see issue #48214 - = help: add #![feature(trivial_bounds)] to the crate attributes to enable + = help: add `#![feature(trivial_bounds)]` to the crate attributes to enable error[E0277]: the trait bound `i32: Foo` is not satisfied --> $DIR/feature-gate-trivial_bounds.rs:12:1 @@ -14,7 +14,7 @@ LL | struct S where i32: Foo; | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `i32` | = help: see issue #48214 - = help: add #![feature(trivial_bounds)] to the crate attributes to enable + = help: add `#![feature(trivial_bounds)]` to the crate attributes to enable error[E0277]: the trait bound `i32: Foo` is not satisfied --> $DIR/feature-gate-trivial_bounds.rs:14:1 @@ -23,7 +23,7 @@ LL | trait T where i32: Foo {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `i32` | = help: see issue #48214 - = help: add #![feature(trivial_bounds)] to the crate attributes to enable + = help: add `#![feature(trivial_bounds)]` to the crate attributes to enable error[E0277]: the trait bound `i32: Foo` is not satisfied --> $DIR/feature-gate-trivial_bounds.rs:16:1 @@ -32,7 +32,7 @@ LL | union U where i32: Foo { f: i32 } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `i32` | = help: see issue #48214 - = help: add #![feature(trivial_bounds)] to the crate attributes to enable + = help: add `#![feature(trivial_bounds)]` to the crate attributes to enable error[E0277]: the trait bound `i32: Foo` is not satisfied --> $DIR/feature-gate-trivial_bounds.rs:20:1 @@ -47,7 +47,7 @@ LL | | } | |_^ the trait `Foo` is not implemented for `i32` | = help: see issue #48214 - = help: add #![feature(trivial_bounds)] to the crate attributes to enable + = help: add `#![feature(trivial_bounds)]` to the crate attributes to enable error[E0277]: the trait bound `i32: Foo` is not satisfied --> $DIR/feature-gate-trivial_bounds.rs:28:1 @@ -62,7 +62,7 @@ LL | | } | |_^ the trait `Foo` is not implemented for `i32` | = help: see issue #48214 - = help: add #![feature(trivial_bounds)] to the crate attributes to enable + = help: add `#![feature(trivial_bounds)]` to the crate attributes to enable error[E0277]: the trait bound `std::string::String: std::ops::Neg` is not satisfied --> $DIR/feature-gate-trivial_bounds.rs:36:1 @@ -73,7 +73,7 @@ LL | | } | |_^ the trait `std::ops::Neg` is not implemented for `std::string::String` | = help: see issue #48214 - = help: add #![feature(trivial_bounds)] to the crate attributes to enable + = help: add `#![feature(trivial_bounds)]` to the crate attributes to enable error[E0277]: `i32` is not an iterator --> $DIR/feature-gate-trivial_bounds.rs:40:1 @@ -86,7 +86,7 @@ LL | | } = help: the trait `std::iter::Iterator` is not implemented for `i32` = note: if you want to iterate between `start` until a value `end`, use the exclusive range syntax `start..end` or the inclusive range syntax `start..=end` = help: see issue #48214 - = help: add #![feature(trivial_bounds)] to the crate attributes to enable + = help: add `#![feature(trivial_bounds)]` to the crate attributes to enable error[E0277]: the size for values of type `str` cannot be known at compilation time --> $DIR/feature-gate-trivial_bounds.rs:52:1 @@ -97,7 +97,7 @@ LL | struct TwoStrs(str, str) where str: Sized; = help: the trait `std::marker::Sized` is not implemented for `str` = note: to learn more, visit = help: see issue #48214 - = help: add #![feature(trivial_bounds)] to the crate attributes to enable + = help: add `#![feature(trivial_bounds)]` to the crate attributes to enable error[E0277]: the size for values of type `(dyn A + 'static)` cannot be known at compilation time --> $DIR/feature-gate-trivial_bounds.rs:55:1 @@ -111,7 +111,7 @@ LL | | } = note: to learn more, visit = note: required because it appears within the type `Dst<(dyn A + 'static)>` = help: see issue #48214 - = help: add #![feature(trivial_bounds)] to the crate attributes to enable + = help: add `#![feature(trivial_bounds)]` to the crate attributes to enable error[E0277]: the size for values of type `str` cannot be known at compilation time --> $DIR/feature-gate-trivial_bounds.rs:59:1 @@ -124,7 +124,7 @@ LL | | } = help: the trait `std::marker::Sized` is not implemented for `str` = note: to learn more, visit = help: see issue #48214 - = help: add #![feature(trivial_bounds)] to the crate attributes to enable + = help: add `#![feature(trivial_bounds)]` to the crate attributes to enable error: aborting due to 11 previous errors diff --git a/src/test/ui/multiple-main-2.rs b/src/test/ui/multiple-main-2.rs index 6bae664ab7405..e4685b1e00456 100644 --- a/src/test/ui/multiple-main-2.rs +++ b/src/test/ui/multiple-main-2.rs @@ -5,5 +5,5 @@ fn bar() { } #[main] -fn foo() { //~ ERROR multiple functions with a #[main] attribute +fn foo() { //~ ERROR multiple functions with a `#[main]` attribute } diff --git a/src/test/ui/multiple-main-2.stderr b/src/test/ui/multiple-main-2.stderr index ae33e01cd26eb..24bc9a8878b08 100644 --- a/src/test/ui/multiple-main-2.stderr +++ b/src/test/ui/multiple-main-2.stderr @@ -1,13 +1,13 @@ -error[E0137]: multiple functions with a #[main] attribute +error[E0137]: multiple functions with a `#[main]` attribute --> $DIR/multiple-main-2.rs:8:1 | LL | / fn bar() { LL | | } - | |_- first #[main] function + | |_- first `#[main]` function ... LL | / fn foo() { LL | | } - | |_^ additional #[main] function + | |_^ additional `#[main]` function error: aborting due to previous error diff --git a/src/test/ui/multiple-main-3.rs b/src/test/ui/multiple-main-3.rs index dbcf1ef4896b2..d1b5ae9a83315 100644 --- a/src/test/ui/multiple-main-3.rs +++ b/src/test/ui/multiple-main-3.rs @@ -6,6 +6,6 @@ fn main1() { mod foo { #[main] - fn main2() { //~ ERROR multiple functions with a #[main] attribute + fn main2() { //~ ERROR multiple functions with a `#[main]` attribute } } diff --git a/src/test/ui/multiple-main-3.stderr b/src/test/ui/multiple-main-3.stderr index b85637b8a56e2..ec171b76a284a 100644 --- a/src/test/ui/multiple-main-3.stderr +++ b/src/test/ui/multiple-main-3.stderr @@ -1,13 +1,13 @@ -error[E0137]: multiple functions with a #[main] attribute +error[E0137]: multiple functions with a `#[main]` attribute --> $DIR/multiple-main-3.rs:9:5 | LL | / fn main1() { LL | | } - | |_- first #[main] function + | |_- first `#[main]` function ... LL | / fn main2() { LL | | } - | |_____^ additional #[main] function + | |_____^ additional `#[main]` function error: aborting due to previous error diff --git a/src/test/ui/proc-macro/proc-macro-gates.stderr b/src/test/ui/proc-macro/proc-macro-gates.stderr index 8197bbd71fb2a..8462b564ec1d7 100644 --- a/src/test/ui/proc-macro/proc-macro-gates.stderr +++ b/src/test/ui/proc-macro/proc-macro-gates.stderr @@ -34,7 +34,7 @@ LL | #![empty_attr] = note: for more information, see https://github.com/rust-lang/rust/issues/54727 = help: add `#![feature(proc_macro_hygiene)]` to the crate attributes to enable -error: custom attribute invocations must be of the form #[foo] or #[foo(..)], the macro name must only be followed by a delimiter token +error: custom attribute invocations must be of the form `#[foo]` or `#[foo(..)]`, the macro name must only be followed by a delimiter token --> $DIR/proc-macro-gates.rs:21:1 | LL | #[empty_attr = "y"] diff --git a/src/tools/build-manifest/src/main.rs b/src/tools/build-manifest/src/main.rs index b6e087c3844fa..20176557bcbeb 100644 --- a/src/tools/build-manifest/src/main.rs +++ b/src/tools/build-manifest/src/main.rs @@ -92,6 +92,7 @@ static TARGETS: &[&str] = &[ "powerpc-unknown-linux-gnu", "powerpc64-unknown-linux-gnu", "powerpc64le-unknown-linux-gnu", + "riscv32i-unknown-none-elf", "riscv32imc-unknown-none-elf", "riscv32imac-unknown-none-elf", "riscv64imac-unknown-none-elf", diff --git a/src/tools/tidy/src/features.rs b/src/tools/tidy/src/features.rs index 1841beb1fd116..6a728b02f92f2 100644 --- a/src/tools/tidy/src/features.rs +++ b/src/tools/tidy/src/features.rs @@ -143,7 +143,7 @@ pub fn check(path: &Path, bad: &mut bool, verbose: bool) -> CollectedFeatures { println!("Expected a gate test for the feature '{}'.", name); println!("Hint: create a failing test file named 'feature-gate-{}.rs'\ \n in the 'ui' test suite, with its failures due to\ - \n missing usage of #![feature({})].", name, name); + \n missing usage of `#![feature({})]`.", name, name); println!("Hint: If you already have such a test and don't want to rename it,\ \n you can also add a // gate-test-{} line to the test file.", name); diff --git a/src/tools/tidy/src/libcoretest.rs b/src/tools/tidy/src/libcoretest.rs index 58c6aa12dc48d..579a20e1142be 100644 --- a/src/tools/tidy/src/libcoretest.rs +++ b/src/tools/tidy/src/libcoretest.rs @@ -17,7 +17,7 @@ pub fn check(path: &Path, bad: &mut bool) { if !contents.starts_with("//") && contents.contains("#[test]") { tidy_error!( bad, - "{} contains #[test]; libcore tests must be placed inside \ + "`{}` contains `#[test]`; libcore tests must be placed inside \ `src/libcore/tests/`", subpath.display() );