diff --git a/src/bootstrap/bin/rustc.rs b/src/bootstrap/bin/rustc.rs index a0c75cd9e9476..ea48057d44b60 100644 --- a/src/bootstrap/bin/rustc.rs +++ b/src/bootstrap/bin/rustc.rs @@ -149,7 +149,7 @@ fn main() { // // `compiler_builtins` are unconditionally compiled with panic=abort to // workaround undefined references to `rust_eh_unwind_resume` generated - // otherwise, see issue https://github.com/rust-lang/rust/issues/43095. + // otherwise, see issue #43095. if crate_name == "panic_abort" || crate_name == "compiler_builtins" && stage != "0" { cmd.arg("-C").arg("panic=abort"); diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 117ff0e721474..f4997d2544505 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -794,12 +794,12 @@ impl<'a> Builder<'a> { } cargo.arg("-j").arg(self.jobs().to_string()); - // Remove make-related flags to ensure Cargo can correctly set things up + // Remove make-related flags to ensure Cargo can correctly set things up. cargo.env_remove("MAKEFLAGS"); cargo.env_remove("MFLAGS"); - // FIXME: Temporary fix for https://github.com/rust-lang/cargo/issues/3005 - // Force cargo to output binaries with disambiguating hashes in the name + // FIXME: temporary fix for Cargo issue #3005. + // Force cargo to output binaries with disambiguating hashes in the name. let metadata = if compiler.stage == 0 { // Treat stage0 like special channel, whether it's a normal prior- // release rustc or a local rebuild with the same version, so we @@ -901,7 +901,7 @@ impl<'a> Builder<'a> { if mode.is_tool() { // Tools like cargo and rls don't get debuginfo by default right now, but this can be - // enabled in the config. Adding debuginfo makes them several times larger. + // enabled in the config. Adding debuginfo makes them several times larger. if self.config.rust_debuginfo_tools { cargo.env("RUSTC_DEBUGINFO", self.config.rust_debuginfo.to_string()); cargo.env( @@ -1007,7 +1007,7 @@ impl<'a> Builder<'a> { // Build scripts use either the `cc` crate or `configure/make` so we pass // the options through environment variables that are fetched and understood by both. // - // FIXME: the guard against msvc shouldn't need to be here + // FIXME: the guard against `msvc` shouldn't need to be here. if target.contains("msvc") { if let Some(ref cl) = self.config.llvm_clang_cl { cargo.env("CC", cl).env("CXX", cl); @@ -1019,7 +1019,7 @@ impl<'a> Builder<'a> { Some(ref s) => s, None => return s.display().to_string(), }; - // FIXME: the cc-rs crate only recognizes the literal strings + // FIXME: the cc-rs crate only recognizes the literal strings. // `ccache` and `sccache` when doing caching compilations, so we // mirror that here. It should probably be fixed upstream to // accept a new env var or otherwise work with custom ccache @@ -1064,12 +1064,12 @@ impl<'a> Builder<'a> { cargo.env("RUSTC_SAVE_ANALYSIS", "api".to_string()); } - // For `cargo doc` invocations, make rustdoc print the Rust version into the docs + // For `cargo doc` invocations, make rustdoc print the Rust version into the docs. cargo.env("RUSTDOC_CRATE_VERSION", self.rust_version()); - // Environment variables *required* throughout the build + // Environment variables *required* throughout the build. // - // FIXME: should update code to not require this env var + // FIXME: should update code to not require this env var. cargo.env("CFG_COMPILER_HOST_TRIPLE", target); // Set this for all builds to make sure doc builds also get it. @@ -1460,7 +1460,7 @@ mod __test { #[test] fn dist_with_target_flag() { let mut config = configure(&["B"], &["C"]); - config.run_host_only = false; // as-if --target=C was passed + config.run_host_only = false; // as if `--target=C` were passed let build = Build::new(config); let mut builder = Builder::new(&build); builder.run_step_descriptions(&Builder::get_step_descriptions(Kind::Dist), &[]); diff --git a/src/bootstrap/cache.rs b/src/bootstrap/cache.rs index ea8bc657a57aa..e2a827403af91 100644 --- a/src/bootstrap/cache.rs +++ b/src/bootstrap/cache.rs @@ -176,7 +176,7 @@ impl Default for TyIntern { impl TyIntern { fn intern_borrow(&mut self, item: &B) -> Interned where - B: Eq + Hash + ToOwned + ?Sized, + B: Eq + Hash + ToOwned + ?Sized, T: Borrow, { if let Some(i) = self.set.get(&item) { diff --git a/src/bootstrap/clean.rs b/src/bootstrap/clean.rs index 74a2b7e4aa98b..b52e1a7b0e681 100644 --- a/src/bootstrap/clean.rs +++ b/src/bootstrap/clean.rs @@ -3,7 +3,7 @@ //! Responsible for cleaning out a build directory of all old and stale //! artifacts to prepare for a fresh build. Currently doesn't remove the //! `build/cache` directory (download cache) or the `build/$target/llvm` -//! directory unless the --all flag is present. +//! directory unless the `--all` flag is present. use std::fs; use std::io::{self, ErrorKind}; diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index 821bd002e95b3..06d72ecae584d 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -152,12 +152,12 @@ pub fn std_cargo(builder: &Builder, let features = builder.std_features(); if compiler.stage != 0 && builder.config.sanitizers { - // This variable is used by the sanitizer runtime crates, e.g. - // rustc_lsan, to build the sanitizer runtime from C code + // This variable is used by the sanitizer runtime crates, e.g., + // `rustc_lsan`, to build the sanitizer runtime from C code // When this variable is missing, those crates won't compile the C code, // so we don't set this variable during stage0 where llvm-config is // missing - // We also only build the runtimes when --enable-sanitizers (or its + // We also only build the runtimes when `--enable-sanitizers` (or its // config.toml equivalent) is used let llvm_config = builder.ensure(native::Llvm { target: builder.config.build, @@ -933,17 +933,17 @@ impl Step for Assemble { // produce some other architecture compiler we need to start from // `build` to get there. // - // FIXME: Perhaps we should download those libraries? + // FIXME: perhaps we should download those libraries? // It would make builds faster... // - // FIXME: It may be faster if we build just a stage 1 compiler and then + // FIXME: it may be faster if we build just a stage 1 compiler and then // use that to bootstrap this compiler forward. let build_compiler = builder.compiler(target_compiler.stage - 1, builder.config.build); // Build the libraries for this compiler to link to (i.e., the libraries // it uses at runtime). NOTE: Crates the target compiler compiles don't - // link to these. (FIXME: Is that correct? It seems to be correct most + // link to these. (FIXME: is that correct? It seems to be correct most // of the time but I think we do link to these for stage2/bin compilers // when not performing a full bootstrap). builder.ensure(Rustc { diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index 9f97e57b4562e..0b7af011a4525 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -2062,8 +2062,8 @@ impl Step for Lldb { } } - // The lldb scripts might be installed in lib/python$version - // or in lib64/python$version. If lib64 exists, use it; + // The lldb scripts might be installed in `lib/python$version` + // or in `lib64/python$version`. If lib64 exists, use it; // otherwise lib. let libdir = builder.llvm_out(target).join("lib64"); let (libdir, libdir_name) = if libdir.exists() { diff --git a/src/bootstrap/doc.rs b/src/bootstrap/doc.rs index eec193c21f5db..327decbc54552 100644 --- a/src/bootstrap/doc.rs +++ b/src/bootstrap/doc.rs @@ -486,7 +486,7 @@ impl Step for Std { .arg("-p").arg(package); // Create all crate output directories first to make sure rustdoc uses // relative links. - // FIXME: Cargo should probably do this itself. + // FIXME: cargo should probably do this itself. t!(fs::create_dir_all(out_dir.join(package))); cargo.arg("--") .arg("--markdown-css").arg("rust.css") @@ -711,7 +711,7 @@ impl Step for Rustc { for krate in &compiler_crates { // Create all crate output directories first to make sure rustdoc uses // relative links. - // FIXME: Cargo should probably do this itself. + // FIXME: cargo should probably do this itself. t!(fs::create_dir_all(out_dir.join(krate))); cargo.arg("-p").arg(krate); } diff --git a/src/bootstrap/flags.rs b/src/bootstrap/flags.rs index 0f9a4271ac062..3da9e588977eb 100644 --- a/src/bootstrap/flags.rs +++ b/src/bootstrap/flags.rs @@ -140,7 +140,7 @@ To learn more about a subcommand, run `./x.py -h`" // We can't use getopt to parse the options until we have completed specifying which // options are valid, but under the current implementation, some options are conditional on // the subcommand. Therefore we must manually identify the subcommand first, so that we can - // complete the definition of the options. Then we can use the getopt::Matches object from + // complete the definition of the options. Then we can use the `getopt::Matches` object from // there on out. let subcommand = args.iter().find(|&s| { (s == "build") diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index e460ef5a44e92..a3fefe8ee2edd 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -69,7 +69,7 @@ //! ## Copying stage0 {std,test,rustc} //! //! This copies the build output from Cargo into -//! `build/$HOST/stage0-sysroot/lib/rustlib/$ARCH/lib`. FIXME: This step's +//! `build/$HOST/stage0-sysroot/lib/rustlib/$ARCH/lib`. FIXME: this step's //! documentation should be expanded -- the information already here may be //! incorrect. //! @@ -606,7 +606,7 @@ impl Build { self.out.join(&*target).join("crate-docs") } - /// Returns true if no custom `llvm-config` is set for the specified target. + /// Returns whether no custom `llvm-config` is set for the specified target. /// /// If no custom `llvm-config` was specified then Rust's llvm will be used. fn is_rust_llvm(&self, target: Interned) -> bool { @@ -853,7 +853,7 @@ impl Build { .map(|p| &**p) } - /// Returns true if this is a no-std `target`, if defined + /// Returns whether this is a no-std `target`, if defined fn no_std(&self, target: Interned) -> Option { self.config.target_config.get(&target) .map(|t| t.no_std) diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs index c548d7f6948dc..20445375d187a 100644 --- a/src/bootstrap/native.rs +++ b/src/bootstrap/native.rs @@ -195,7 +195,7 @@ impl Step for Llvm { cfg.define("LLDB_CODESIGN_IDENTITY", ""); } else { // LLDB requires libxml2; but otherwise we want it to be disabled. - // See https://github.com/rust-lang/rust/pull/50104 + // See PR #50104. cfg.define("LLVM_ENABLE_LIBXML2", "OFF"); } diff --git a/src/bootstrap/sanity.rs b/src/bootstrap/sanity.rs index fe547a6b151c2..4139f63f6c7db 100644 --- a/src/bootstrap/sanity.rs +++ b/src/bootstrap/sanity.rs @@ -62,13 +62,13 @@ pub fn check(build: &mut Build) { // On Windows, quotes are invalid characters for filename paths, and if // one is present as part of the PATH then that can lead to the system // being unable to identify the files properly. See - // https://github.com/rust-lang/rust/issues/34959 for more details. + // issue #34959 for more details. if cfg!(windows) && path.to_string_lossy().contains('\"') { panic!("PATH contains invalid character '\"'"); } let mut cmd_finder = Finder::new(); - // If we've got a git directory we're gonna need git to update + // If we've got a Git directory we're gonna need git to update // submodules and learn about various other aspects. if build.rust_info.is_git() { cmd_finder.must_have("git"); @@ -122,7 +122,7 @@ pub fn check(build: &mut Build) { // We're gonna build some custom C code here and there, host triples // also build some C++ shims for LLVM so we need a C++ compiler. for target in &build.targets { - // On emscripten we don't actually need the C compiler to just + // On Emscripten we don't actually need the C compiler to just // build the target artifacts, only for testing. For the sake // of easier bot configuration, just skip detection. if target.contains("emscripten") { diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index 2edc78ebaa94f..4e9b1595e9ba5 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -517,8 +517,8 @@ impl Step for Clippy { } fn path_for_cargo(builder: &Builder, compiler: Compiler) -> OsString { - // Configure PATH to find the right rustc. NB. we have to use PATH - // and not RUSTC because the Cargo test suite has tests that will + // Configure `PATH` to find the right rustc. N.B., we have to use PATH + // and not `RUSTC` because the Cargo test suite has tests that will // fail if rustc is not spelled `rustc`. let path = builder.sysroot(compiler).join("bin"); let old_path = env::var_os("PATH").unwrap_or_default(); @@ -971,7 +971,7 @@ impl Step for Compiletest { } if suite.ends_with("fulldeps") || - // FIXME: Does pretty need librustc compiled? Note that there are + // FIXME: does pretty need librustc compiled? Note that there are // fulldeps test suites with mode = pretty as well. mode == "pretty" { @@ -1966,7 +1966,7 @@ impl Step for Bootstrap { const DEFAULT: bool = true; const ONLY_HOSTS: bool = true; - /// Test the build system itself + /// Test the build system itself. fn run(self, builder: &Builder) { let mut cmd = Command::new(&builder.initial_cargo); cmd.arg("test") @@ -1977,8 +1977,8 @@ impl Step for Bootstrap { .env("RUSTC", &builder.initial_rustc); if let Some(flags) = option_env!("RUSTFLAGS") { // Use the same rustc flags for testing as for "normal" compilation, - // so that Cargo doesn’t recompile the entire dependency graph every time: - // https://github.com/rust-lang/rust/issues/49215 + // so that Cargo doesn’t recompile the entire dependency graph every time + // (issue #49215). cmd.env("RUSTFLAGS", flags); } if !builder.fail_fast { diff --git a/src/liballoc/alloc.rs b/src/liballoc/alloc.rs index 096cb51e0d3ef..224437589c065 100644 --- a/src/liballoc/alloc.rs +++ b/src/liballoc/alloc.rs @@ -11,7 +11,7 @@ use core::usize; pub use core::alloc::*; extern "Rust" { - // These are the magic symbols to call the global allocator. rustc generates + // These are the magic symbols to call the global allocator. rustc generates // them from the `#[global_allocator]` attribute if there is one, or uses the // default implementations in libstd (`__rdl_alloc` etc in `src/libstd/alloc.rs`) // otherwise. diff --git a/src/liballoc/borrow.rs b/src/liballoc/borrow.rs index 603d73100a8b4..8eda676bb7859 100644 --- a/src/liballoc/borrow.rs +++ b/src/liballoc/borrow.rs @@ -137,11 +137,11 @@ impl ToOwned for T /// ``` /// use std::borrow::{Cow, ToOwned}; /// -/// struct Items<'a, X: 'a> where [X]: ToOwned> { +/// struct Items<'a, X: 'a> where [X]: ToOwned> { /// values: Cow<'a, [X]>, /// } /// -/// impl<'a, X: Clone + 'a> Items<'a, X> where [X]: ToOwned> { +/// impl<'a, X: Clone + 'a> Items<'a, X> where [X]: ToOwned> { /// fn new(v: Cow<'a, [X]>) -> Self { /// Items { values: v } /// } @@ -262,7 +262,7 @@ impl<'a, B: ?Sized> Cow<'a, B> /// ); /// ``` /// - /// Calling `into_owned` on a `Cow::Owned` is a no-op: + /// Calling `into_owned` on a `Cow::Owned` is a noop: /// /// ``` /// use std::borrow::Cow; diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index fbd0b948b82a0..11a0ef7316dde 100644 --- a/src/liballoc/boxed.rs +++ b/src/liballoc/boxed.rs @@ -262,7 +262,7 @@ impl Box { #[stable(feature = "rust1", since = "1.0.0")] unsafe impl<#[may_dangle] T: ?Sized> Drop for Box { fn drop(&mut self) { - // FIXME: Do nothing, drop is currently performed by compiler. + // FIXME: do nothing; drop is currently performed by compiler. } } @@ -457,7 +457,7 @@ impl From> for Pin> { /// This conversion does not allocate on the heap and happens in place. fn from(boxed: Box) -> Self { // It's not possible to move or replace the insides of a `Pin>` - // when `T: !Unpin`, so it's safe to pin it directly without any + // when `T: !Unpin`, so it's safe to pin it directly without any // additional requirements. unsafe { Pin::new_unchecked(boxed) } } diff --git a/src/liballoc/collections/btree/map.rs b/src/liballoc/collections/btree/map.rs index 717650aca9600..3b5e9f0151811 100644 --- a/src/liballoc/collections/btree/map.rs +++ b/src/liballoc/collections/btree/map.rs @@ -604,7 +604,7 @@ impl BTreeMap { } } - /// Returns `true` if the map contains a value for the specified key. + /// Returns whether the map contains a value for the specified key. /// /// The key may be any borrowed form of the map's key type, but the ordering /// on the borrowed form *must* match the ordering on the key type. @@ -892,7 +892,7 @@ impl BTreeMap { /// ``` #[stable(feature = "rust1", since = "1.0.0")] pub fn entry(&mut self, key: K) -> Entry { - // FIXME(@porglezomp) Avoid allocating if we don't insert + // FIXME(porglezomp): avoid allocating if we don't insert. self.ensure_root_is_owned(); match search::search_tree(self.root.as_mut(), &key) { Found(handle) => { @@ -1841,12 +1841,12 @@ fn range_search>( where Q: Ord, K: Borrow { match (range.start_bound(), range.end_bound()) { - (Excluded(s), Excluded(e)) if s==e => + (Excluded(s), Excluded(e)) if s == e => panic!("range start and end are equal and excluded in BTreeMap"), (Included(s), Included(e)) | (Included(s), Excluded(e)) | (Excluded(s), Included(e)) | - (Excluded(s), Excluded(e)) if s>e => + (Excluded(s), Excluded(e)) if s > e => panic!("range start is greater than range end in BTreeMap"), _ => {}, }; @@ -2072,7 +2072,7 @@ impl BTreeMap { self.length } - /// Returns `true` if the map contains no elements. + /// Returns whether the map contains no elements. /// /// # Examples /// diff --git a/src/liballoc/collections/btree/node.rs b/src/liballoc/collections/btree/node.rs index f9a21aa95db71..e4ae01a1f93e0 100644 --- a/src/liballoc/collections/btree/node.rs +++ b/src/liballoc/collections/btree/node.rs @@ -1,4 +1,4 @@ -// This is an attempt at an implementation following the ideal +// This is an attempt at an implementation of the following ideal: // // ``` // struct BTreeMap { @@ -250,7 +250,7 @@ impl Root { NodeRef { height: self.height, node: self.node.as_ptr(), - root: ptr::null_mut(), // FIXME: Is there anything better to do here? + root: ptr::null_mut(), // FIXME: is there anything better to do here? _marker: PhantomData, } } @@ -549,7 +549,7 @@ impl<'a, K, V, Type> NodeRef, K, V, Type> { /// `into_root_mut`) mess with the root of the tree, the result of `reborrow_mut` /// can easily be used to make the original mutable pointer dangling, or, in the case /// of a reborrowed handle, out of bounds. - // FIXME(@gereeter) consider adding yet another type parameter to `NodeRef` that restricts + // FIXME(gereeter): consider adding yet another type parameter to `NodeRef` that restricts // the use of `ascend` and `into_root_mut` on reborrowed pointers, preventing this unsafety. unsafe fn reborrow_mut(&mut self) -> NodeRef { NodeRef { @@ -578,12 +578,12 @@ impl<'a, K, V, Type> NodeRef, K, V, Type> { impl<'a, K: 'a, V: 'a, Type> NodeRef, K, V, Type> { fn into_key_slice(self) -> &'a [K] { // We have to be careful here because we might be pointing to the shared root. - // In that case, we must not create an `&LeafNode`. We could just return + // In that case, we must not create an `&LeafNode`. We could just return // an empty slice whenever the length is 0 (this includes the shared root), // but we want to avoid that run-time check. // Instead, we create a slice pointing into the node whenever possible. // We can sometimes do this even for the shared root, as the slice will be - // empty. We cannot *always* do this because if the type is too highly + // empty. We cannot *always* do this because if the type is too highly // aligned, the offset of `keys` in a "full node" might be outside the bounds // of the header! So we do an alignment check first, that will be // evaluated at compile-time, and only do any run-time check in the rare case @@ -596,7 +596,7 @@ impl<'a, K: 'a, V: 'a, Type> NodeRef, K, V, Type> { // (We might be one-past-the-end, but that is allowed by LLVM.) // Getting the pointer is tricky though. `NodeHeader` does not have a `keys` // field because we want its size to not depend on the alignment of `K` - // (needed becuase `as_header` should be safe). We cannot call `as_leaf` + // (needed becuase `as_header` should be safe). We cannot call `as_leaf` // because we might be the shared root. // For this reason, `NodeHeader` has this `K2` parameter (that's usually `()` // and hence just adds a size-0-align-1 field, not affecting layout). @@ -605,7 +605,7 @@ impl<'a, K: 'a, V: 'a, Type> NodeRef, K, V, Type> { // is not bigger than `NodeHeader`! Then we can use `NodeHeader` // to compute the pointer where the keys start. // This entire hack will become unnecessary once - // lands, then we can just take a raw + // RFC #2582 lands, then we can just take a raw // pointer to the `keys` field of `*const InternalNode`. // This is a non-debug-assert because it can be completely compile-time evaluated. @@ -948,7 +948,7 @@ impl<'a, K, V, NodeType, HandleType> /// `into_root_mut`) mess with the root of the tree, the result of `reborrow_mut` /// can easily be used to make the original mutable pointer dangling, or, in the case /// of a reborrowed handle, out of bounds. - // FIXME(@gereeter) consider adding yet another type parameter to `NodeRef` that restricts + // FIXME(gereeter): consider adding yet another type parameter to `NodeRef` that restricts // the use of `ascend` and `into_root_mut` on reborrowed pointers, preventing this unsafety. pub unsafe fn reborrow_mut(&mut self) -> Handle, HandleType> { diff --git a/src/liballoc/collections/btree/set.rs b/src/liballoc/collections/btree/set.rs index 71fec7da9a5ed..3c8bfa1c3a78f 100644 --- a/src/liballoc/collections/btree/set.rs +++ b/src/liballoc/collections/btree/set.rs @@ -376,7 +376,7 @@ impl BTreeSet { self.map.clear() } - /// Returns `true` if the set contains a value. + /// Returns whether the set contains a value. /// /// The value may be any borrowed form of the set's value type, /// but the ordering on the borrowed form *must* match the @@ -422,7 +422,7 @@ impl BTreeSet { Recover::get(&self.map, value) } - /// Returns `true` if `self` has no elements in common with `other`. + /// Returns whether `self` has no elements in common with `other`. /// This is equivalent to checking for an empty intersection. /// /// # Examples @@ -444,7 +444,7 @@ impl BTreeSet { self.intersection(other).next().is_none() } - /// Returns `true` if the set is a subset of another, + /// Returns whether the set is a subset of another, /// i.e., `other` contains at least all the values in `self`. /// /// # Examples @@ -487,7 +487,7 @@ impl BTreeSet { true } - /// Returns `true` if the set is a superset of another, + /// Returns whether the set is a superset of another, /// i.e., `self` contains at least all the values in `other`. /// /// # Examples @@ -557,7 +557,7 @@ impl BTreeSet { Recover::replace(&mut self.map, value) } - /// Removes a value from the set. Returns `true` if the value was + /// Removes a value from the set. Returns whether the value was /// present in the set. /// /// The value may be any borrowed form of the set's value type, @@ -724,7 +724,7 @@ impl BTreeSet { self.map.len() } - /// Returns `true` if the set contains no elements. + /// Returns whether the set contains no elements. /// /// # Examples /// diff --git a/src/liballoc/collections/linked_list.rs b/src/liballoc/collections/linked_list.rs index 804a2e9c8873b..663d0cbb9b13f 100644 --- a/src/liballoc/collections/linked_list.rs +++ b/src/liballoc/collections/linked_list.rs @@ -374,7 +374,7 @@ impl LinkedList { } } - /// Returns `true` if the `LinkedList` is empty. + /// Returns whether the `LinkedList` is empty. /// /// This operation should compute in O(1) time. /// @@ -447,7 +447,7 @@ impl LinkedList { *self = Self::new(); } - /// Returns `true` if the `LinkedList` contains an element equal to the + /// Returns whether the `LinkedList` contains an element equal to the /// given value. /// /// # Examples @@ -1383,7 +1383,7 @@ mod tests { // This caused the RHS's dtor to walk up into the LHS at drop and delete all of // its nodes. // - // https://github.com/rust-lang/rust/issues/26021 + // Issue #26021. let mut v1 = LinkedList::new(); v1.push_front(1); v1.push_front(1); diff --git a/src/liballoc/collections/vec_deque.rs b/src/liballoc/collections/vec_deque.rs index b3f7ef5fd6ecc..bacdc6051b563 100644 --- a/src/liballoc/collections/vec_deque.rs +++ b/src/liballoc/collections/vec_deque.rs @@ -127,7 +127,7 @@ impl VecDeque { ptr::write(self.ptr().add(off), value); } - /// Returns `true` if and only if the buffer is at full capacity. + /// Returns whether the buffer is at full capacity. #[inline] fn is_full(&self) -> bool { self.cap() - self.len() == 1 @@ -910,7 +910,7 @@ impl VecDeque { count(self.tail, self.head, self.cap()) } - /// Returns `true` if the `VecDeque` is empty. + /// Returns whether the `VecDeque` is empty. /// /// # Examples /// @@ -935,7 +935,7 @@ impl VecDeque { /// /// Note 2: It is unspecified how many elements are removed from the deque, /// if the `Drain` value is not dropped, but the borrow it holds expires - /// (eg. due to mem::forget). + /// (e.g., due to `mem::forget`). /// /// # Panics /// @@ -1017,7 +1017,7 @@ impl VecDeque { tail: drain_tail, head: drain_head, // Crucially, we only create shared references from `self` here and read from - // it. We do not write to `self` nor reborrow to a mutable reference. + // it. We do not write to `self` nor reborrow to a mutable reference. // Hence the raw pointer we created above, for `deque`, remains valid. ring: unsafe { self.buffer_as_slice() }, }, @@ -1042,7 +1042,7 @@ impl VecDeque { self.drain(..); } - /// Returns `true` if the `VecDeque` contains an element equal to the + /// Returns whether the `VecDeque` contains an element equal to the /// given value. /// /// # Examples diff --git a/src/liballoc/fmt.rs b/src/liballoc/fmt.rs index a1e7533449c69..aa35eeb580680 100644 --- a/src/liballoc/fmt.rs +++ b/src/liballoc/fmt.rs @@ -102,7 +102,7 @@ //! When requesting that an argument be formatted with a particular type, you //! are actually requesting that an argument ascribes to a particular trait. //! This allows multiple actual types to be formatted via `{:x}` (like [`i8`] as -//! well as [`isize`]). The current mapping of types to traits is: +//! well as [`isize`]). The current mapping of types to traits is: //! //! * *nothing* ⇒ [`Display`] //! * `?` ⇒ [`Debug`] @@ -427,7 +427,7 @@ //! 3. An asterisk `.*`: //! //! `.*` means that this `{...}` is associated with *two* format inputs rather than one: the -//! first input holds the `usize` precision, and the second holds the value to print. Note that +//! first input holds the `usize` precision, and the second holds the value to print. Note that //! in this case, if one uses the format string `{:.*}`, then the `` part refers //! to the *value* to print, and the `precision` must come in the input preceding ``. //! diff --git a/src/liballoc/macros.rs b/src/liballoc/macros.rs index db91b07fa71b4..cd0314f6a4d16 100644 --- a/src/liballoc/macros.rs +++ b/src/liballoc/macros.rs @@ -45,7 +45,7 @@ macro_rules! vec { ($($x:expr,)*) => (vec![$($x),*]) } -// HACK(japaric): with cfg(test) the inherent `[T]::into_vec` method, which is +// HACK(japaric): with `cfg(test)`, the inherent `[T]::into_vec` method, which is // required for this macro definition, is not available. Instead use the // `slice::into_vec` function which is only available with cfg(test) // NB see the slice::hack module in slice.rs for more information @@ -62,8 +62,8 @@ macro_rules! vec { /// Creates a `String` using interpolation of runtime expressions. /// -/// The first argument `format!` receives is a format string. This must be a string -/// literal. The power of the formatting string is in the `{}`s contained. +/// The first argument `format!` receives is a format string. This must be a string +/// literal. The power of the formatting string is in the `{}`s contained. /// /// Additional parameters passed to `format!` replace the `{}`s within the /// formatting string in the order given unless named or positional parameters diff --git a/src/liballoc/raw_vec.rs b/src/liballoc/raw_vec.rs index c05452bcf4d5d..70b06586b93b7 100644 --- a/src/liballoc/raw_vec.rs +++ b/src/liballoc/raw_vec.rs @@ -336,7 +336,7 @@ impl RawVec { /// enough to want to do that it's easiest to just have a dedicated method. Slightly /// more efficient logic can be provided for this than the general case. /// - /// Returns true if the reallocation attempt has succeeded, or false otherwise. + /// Returns whether the reallocation attempt has succeeded. /// /// # Panics /// @@ -505,7 +505,7 @@ impl RawVec { /// the requested space. This is not really unsafe, but the unsafe /// code *you* write that relies on the behavior of this function may break. /// - /// Returns true if the reallocation attempt has succeeded, or false otherwise. + /// Returns whether the reallocation attempt has succeeded. /// /// # Panics /// @@ -567,21 +567,21 @@ impl RawVec { pub fn shrink_to_fit(&mut self, amount: usize) { let elem_size = mem::size_of::(); - // Set the `cap` because they might be about to promote to a `Box<[T]>` + // Set the `cap` because they might be about to promote to a `Box<[T]>`. if elem_size == 0 { self.cap = amount; return; } - // This check is my waterloo; it's the only thing Vec wouldn't have to do. + // This check is my waterloo; it's the only thing `Vec` wouldn't have to do. assert!(self.cap >= amount, "Tried to shrink to a larger capacity"); if amount == 0 { // We want to create a new zero-length vector within the - // same allocator. We use ptr::write to avoid an + // same allocator. We use `ptr::write` to avoid an // erroneous attempt to drop the contents, and we use - // ptr::read to sidestep condition against destructuring - // types that implement Drop. + // `ptr::read` to sidestep condition against destructuring + // types that implement `Drop`. unsafe { let a = ptr::read(&self.a as *const A); diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs index d3a55c59ff69c..fc9701e461b58 100644 --- a/src/liballoc/rc.rs +++ b/src/liballoc/rc.rs @@ -494,7 +494,7 @@ impl Rc { this.strong() } - /// Returns true if there are no other `Rc` or [`Weak`][weak] pointers to + /// Returns whether there are no other `Rc` or [`Weak`][weak] pointers to /// this inner value. /// /// [weak]: struct.Weak.html @@ -543,7 +543,7 @@ impl Rc { #[inline] #[stable(feature = "ptr_eq", since = "1.17.0")] - /// Returns true if the two `Rc`s point to the same value (not + /// Returns whether the two `Rc`s point to the same value (not /// just values that compare as equal). /// /// # Examples @@ -1204,7 +1204,7 @@ pub struct Weak { // This is a `NonNull` to allow optimizing the size of this type in enums, // but it is not necessarily a valid pointer. // `Weak::new` sets this to `usize::MAX` so that it doesn’t need - // to allocate space on the heap. That's not a value a real pointer + // to allocate space on the heap. That's not a value a real pointer // will ever have because RcBox has alignment at least 2. ptr: NonNull>, } @@ -1297,7 +1297,7 @@ impl Weak { } } - /// Returns true if the two `Weak`s point to the same value (not just values + /// Returns whether the two `Weak`s point to the same value (not just values /// that compare as equal). /// /// # Notes diff --git a/src/liballoc/str.rs b/src/liballoc/str.rs index 60d9f1626138e..193a1bfa1b4fe 100644 --- a/src/liballoc/str.rs +++ b/src/liballoc/str.rs @@ -358,7 +358,7 @@ impl str { // This is the only conditional (contextual) but language-independent mapping // in `SpecialCasing.txt`, // so hard-code it rather than have a generic "condition" mechanism. - // See https://github.com/rust-lang/rust/issues/26035 + // See issue #26035. map_uppercase_sigma(self, i, &mut s) } else { match conversions::to_lower(c) { @@ -378,7 +378,7 @@ impl str { return s; fn map_uppercase_sigma(from: &str, i: usize, to: &mut String) { - // See http://www.unicode.org/versions/Unicode7.0.0/ch03.pdf#G33992 + // See . // for the definition of `Final_Sigma`. debug_assert!('Σ'.len_utf8() == 2); let is_word_final = case_ignoreable_then_cased(from[..i].chars().rev()) && diff --git a/src/liballoc/string.rs b/src/liballoc/string.rs index fa15e9ad9018e..35e22b6bed109 100644 --- a/src/liballoc/string.rs +++ b/src/liballoc/string.rs @@ -1378,7 +1378,7 @@ impl String { self.vec.len() } - /// Returns `true` if this `String` has a length of zero. + /// Returns whether this `String` has a length of zero. /// /// Returns `false` otherwise. /// diff --git a/src/liballoc/sync.rs b/src/liballoc/sync.rs index 390a079165054..b04afd0497a4a 100644 --- a/src/liballoc/sync.rs +++ b/src/liballoc/sync.rs @@ -234,7 +234,7 @@ pub struct Weak { // This is a `NonNull` to allow optimizing the size of this type in enums, // but it is not necessarily a valid pointer. // `Weak::new` sets this to `usize::MAX` so that it doesn’t need - // to allocate space on the heap. That's not a value a real pointer + // to allocate space on the heap. That's not a value a real pointer // will ever have because RcBox has alignment at least 2. ptr: NonNull>, } @@ -539,7 +539,7 @@ impl Arc { #[inline] #[stable(feature = "ptr_eq", since = "1.17.0")] - /// Returns true if the two `Arc`s point to the same value (not + /// Returns whether the two `Arc`s point to the same value (not /// just values that compare as equal). /// /// # Examples @@ -901,7 +901,7 @@ impl Arc { // // The acquire label here ensures a happens-before relationship with any // writes to `strong` (in particular in `Weak::upgrade`) prior to decrements - // of the `weak` count (via `Weak::drop`, which uses release). If the upgraded + // of the `weak` count (via `Weak::drop`, which uses release). If the upgraded // weak ref was never dropped, the CAS here will fail so we do not care to synchronize. if self.inner().weak.compare_exchange(1, usize::MAX, Acquire, Relaxed).is_ok() { // This needs to be an `Acquire` to synchronize with the decrement of the `strong` @@ -959,7 +959,7 @@ unsafe impl<#[may_dangle] T: ?Sized> Drop for Arc { } // This fence is needed to prevent reordering of use of the data and - // deletion of the data. Because it is marked `Release`, the decreasing + // deletion of the data. Because it is marked `Release`, the decreasing // of the reference count synchronizes with this `Acquire` fence. This // means that use of the data happens before decreasing the reference // count, which happens before this fence, which happens before the @@ -1128,7 +1128,7 @@ impl Weak { } } - /// Returns true if the two `Weak`s point to the same value (not just values + /// Returns whether the two `Weak`s point to the same value (not just values /// that compare as equal). /// /// # Notes @@ -1196,7 +1196,7 @@ impl Clone for Weak { } else { return Weak { ptr: self.ptr }; }; - // See comments in Arc::clone() for why this is relaxed. This can use a + // See comments in Arc::clone() for why this is relaxed. This can use a // fetch_add (ignoring the lock) because the weak count is only locked // where are *no other* weak pointers in existence. (So we can't be // running this code in that case). diff --git a/src/liballoc/tests/heap.rs b/src/liballoc/tests/heap.rs index 24eea1d294965..c225ebfa96b91 100644 --- a/src/liballoc/tests/heap.rs +++ b/src/liballoc/tests/heap.rs @@ -1,6 +1,6 @@ use std::alloc::{Global, Alloc, Layout, System}; -/// https://github.com/rust-lang/rust/issues/45955 +/// Issue #45955. #[test] fn alloc_system_overaligned_request() { check_overalign_requests(System) diff --git a/src/liballoc/tests/lib.rs b/src/liballoc/tests/lib.rs index a76fd87a1a92d..5030c9edb3f28 100644 --- a/src/liballoc/tests/lib.rs +++ b/src/liballoc/tests/lib.rs @@ -36,8 +36,8 @@ fn hash(t: &T) -> u64 { s.finish() } -// FIXME: Instantiated functions with i128 in the signature is not supported in Emscripten. -// See https://github.com/kripken/emscripten-fastcomp/issues/169 +// FIXME: instantiated functions with `i128` in the signature is not supported in Emscripten. +// See issue #169. #[cfg(not(target_os = "emscripten"))] #[test] fn test_boxed_hasher() { diff --git a/src/liballoc/tests/linked_list.rs b/src/liballoc/tests/linked_list.rs index 6e775f9650d12..a0be8b479d0b4 100644 --- a/src/liballoc/tests/linked_list.rs +++ b/src/liballoc/tests/linked_list.rs @@ -93,7 +93,7 @@ fn test_split_off() { } } - // no-op on the last index + // noop on the last index { let mut m = LinkedList::new(); m.push_back(1); diff --git a/src/liballoc/tests/slice.rs b/src/liballoc/tests/slice.rs index 8ecd17236c048..4e88f729fa400 100644 --- a/src/liballoc/tests/slice.rs +++ b/src/liballoc/tests/slice.rs @@ -508,7 +508,7 @@ fn test_rotate_left() { let expected: Vec<_> = (0..13).collect(); let mut v = Vec::new(); - // no-ops + // noops v.clone_from(&expected); v.rotate_left(0); assert_eq!(v, expected); @@ -543,7 +543,7 @@ fn test_rotate_right() { let expected: Vec<_> = (0..13).collect(); let mut v = Vec::new(); - // no-ops + // noops v.clone_from(&expected); v.rotate_right(0); assert_eq!(v, expected); diff --git a/src/liballoc/tests/str.rs b/src/liballoc/tests/str.rs index 66a1b947a7d3a..e028ac0a46d76 100644 --- a/src/liballoc/tests/str.rs +++ b/src/liballoc/tests/str.rs @@ -1531,7 +1531,7 @@ fn to_lowercase() { assert_eq!("".to_lowercase(), ""); assert_eq!("AÉDžaé ".to_lowercase(), "aédžaé "); - // https://github.com/rust-lang/rust/issues/26035 + // See issue #26035. assert_eq!("ΑΣ".to_lowercase(), "ας"); assert_eq!("Α'Σ".to_lowercase(), "α'ς"); assert_eq!("Α''Σ".to_lowercase(), "α''ς"); diff --git a/src/liballoc/vec.rs b/src/liballoc/vec.rs index b69c114ed4594..6e307a90b0b48 100644 --- a/src/liballoc/vec.rs +++ b/src/liballoc/vec.rs @@ -691,11 +691,10 @@ impl Vec { let mut ptr = self.as_mut_ptr().add(self.len); // Set the final length at the end, keeping in mind that // dropping an element might panic. Works around a missed - // optimization, as seen in the following issue: - // https://github.com/rust-lang/rust/issues/51802 + // optimization, as seen in issue #51802. let mut local_len = SetLenOnDrop::new(&mut self.len); - // drop any extra elements + // Drop any extra elements. for _ in len..current_len { local_len.decrement_len(1); ptr = ptr.offset(-1); @@ -1159,7 +1158,7 @@ impl Vec { self.len } - /// Returns `true` if the vector contains no elements. + /// Returns whether the vector contains no elements. /// /// # Examples /// @@ -1765,7 +1764,7 @@ trait SpecExtend { } impl SpecExtend for Vec - where I: Iterator, + where I: Iterator, { default fn from_iter(mut iterator: I) -> Self { // Unroll the first iteration, as the vector is going to be @@ -1795,7 +1794,7 @@ impl SpecExtend for Vec } impl SpecExtend for Vec - where I: TrustedLen, + where I: TrustedLen, { default fn from_iter(iterator: I) -> Self { let mut vector = Vec::new(); @@ -1858,7 +1857,7 @@ impl SpecExtend> for Vec { } impl<'a, T: 'a, I> SpecExtend<&'a T, I> for Vec - where I: Iterator, + where I: Iterator, T: Clone, { default fn from_iter(iterator: I) -> Self { @@ -1945,7 +1944,7 @@ impl Vec { #[inline] #[stable(feature = "vec_splice", since = "1.21.0")] pub fn splice(&mut self, range: R, replace_with: I) -> Splice - where R: RangeBounds, I: IntoIterator + where R: RangeBounds, I: IntoIterator { Splice { drain: self.drain(range), @@ -2173,7 +2172,7 @@ impl<'a, T: Clone> From<&'a mut [T]> for Vec { } #[stable(feature = "vec_from_cow_slice", since = "1.14.0")] -impl<'a, T> From> for Vec where [T]: ToOwned> { +impl<'a, T> From> for Vec where [T]: ToOwned> { fn from(s: Cow<'a, [T]>) -> Vec { s.into_owned() } @@ -2551,7 +2550,7 @@ impl<'a, I: Iterator> Drop for Splice<'a, I> { } // There may be more elements. Use the lower bound as an estimate. - // FIXME: Is the upper bound a better guess? Or something else? + // FIXME: is the upper bound a better guess? Or something else? let (lower_bound, _upper_bound) = self.replace_with.size_hint(); if lower_bound > 0 { self.drain.move_tail(lower_bound); @@ -2581,7 +2580,7 @@ impl<'a, T> Drain<'a, T> { /// that have been moved out. /// Fill that range as much as possible with new elements from the `replace_with` iterator. /// Return whether we filled the entire range. (`replace_with.next()` didn’t return `None`.) - unsafe fn fill>(&mut self, replace_with: &mut I) -> bool { + unsafe fn fill>(&mut self, replace_with: &mut I) -> bool { let vec = self.vec.as_mut(); let range_start = vec.len; let range_end = self.tail_start; diff --git a/src/libarena/lib.rs b/src/libarena/lib.rs index b40e905620de9..6f5f3e5211b24 100644 --- a/src/libarena/lib.rs +++ b/src/libarena/lib.rs @@ -410,7 +410,7 @@ impl DroplessArena { } #[derive(Default)] -// FIXME(@Zoxc): this type is entirely unused in rustc +// FIXME(Zoxc): this type is entirely unused in rustc. pub struct SyncTypedArena { lock: MTLock>, } @@ -418,7 +418,7 @@ pub struct SyncTypedArena { impl SyncTypedArena { #[inline(always)] pub fn alloc(&self, object: T) -> &mut T { - // Extend the lifetime of the result since it's limited to the lock guard + // Extend the lifetime of the result since it's limited to the lock guard. unsafe { &mut *(self.lock.lock().alloc(object) as *mut T) } } @@ -427,7 +427,7 @@ impl SyncTypedArena { where T: Copy, { - // Extend the lifetime of the result since it's limited to the lock guard + // Extend the lifetime of the result since it's limited to the lock guard. unsafe { &mut *(self.lock.lock().alloc_slice(slice) as *mut [T]) } } @@ -450,13 +450,13 @@ impl SyncDroplessArena { #[inline(always)] pub fn alloc_raw(&self, bytes: usize, align: usize) -> &mut [u8] { - // Extend the lifetime of the result since it's limited to the lock guard + // Extend the lifetime of the result since it's limited to the lock guard. unsafe { &mut *(self.lock.lock().alloc_raw(bytes, align) as *mut [u8]) } } #[inline(always)] pub fn alloc(&self, object: T) -> &mut T { - // Extend the lifetime of the result since it's limited to the lock guard + // Extend the lifetime of the result since it's limited to the lock guard. unsafe { &mut *(self.lock.lock().alloc(object) as *mut T) } } @@ -465,7 +465,7 @@ impl SyncDroplessArena { where T: Copy, { - // Extend the lifetime of the result since it's limited to the lock guard + // Extend the lifetime of the result since it's limited to the lock guard. unsafe { &mut *(self.lock.lock().alloc_slice(slice) as *mut [T]) } } } diff --git a/src/libcore/any.rs b/src/libcore/any.rs index 6a863ff369a87..96ff2992968ce 100644 --- a/src/libcore/any.rs +++ b/src/libcore/any.rs @@ -31,8 +31,8 @@ //! fn log(value: &T) { //! let value_any = value as &dyn Any; //! -//! // try to convert our value to a String. If successful, we want to -//! // output the String's length as well as its value. If not, it's a +//! // try to convert our value to a String. If successful, we want to +//! // output the String's length as well as its value. If not, it's a //! // different type: just print it out unadorned. //! match value_any.downcast_ref::() { //! Some(as_string) => { @@ -134,7 +134,7 @@ impl fmt::Debug for dyn Any + Send + Sync { } impl dyn Any { - /// Returns `true` if the boxed type is the same as `T`. + /// Returns whether the boxed type is the same as `T`. /// /// # Examples /// diff --git a/src/libcore/char/methods.rs b/src/libcore/char/methods.rs index fbc9a4a6b8efa..79141dd0c286a 100644 --- a/src/libcore/char/methods.rs +++ b/src/libcore/char/methods.rs @@ -172,12 +172,12 @@ impl char { pub fn escape_unicode(self) -> EscapeUnicode { let c = self as u32; - // or-ing 1 ensures that for c==0 the code computes that one + // Or-ing 1 ensures that for `c == 0` the code computes that one // digit should be printed and (which is the same) avoids the - // (31 - 32) underflow + // `31 - 32` underflow. let msb = 31 - (c | 1).leading_zeros(); - // the index of the most significant hex digit + // The index of the most significant hex digit. let ms_hex_digit = msb / 4; EscapeUnicode { c: self, @@ -524,7 +524,7 @@ impl char { } } - /// Returns true if this `char` is an alphabetic code point, and false if not. + /// Returns whether this `char` is an alphabetic code point, and false if not. /// /// # Examples /// @@ -548,7 +548,7 @@ impl char { } } - /// Returns true if this `char` satisfies the 'XID_Start' Unicode property, and false + /// Returns whether this `char` satisfies the 'XID_Start' Unicode property, and false /// otherwise. /// /// 'XID_Start' is a Unicode Derived Property specified in @@ -562,7 +562,7 @@ impl char { derived_property::XID_Start(self) } - /// Returns true if this `char` satisfies the 'XID_Continue' Unicode property, and false + /// Returns whether this `char` satisfies the 'XID_Continue' Unicode property, and false /// otherwise. /// /// 'XID_Continue' is a Unicode Derived Property specified in @@ -576,7 +576,7 @@ impl char { derived_property::XID_Continue(self) } - /// Returns true if this `char` is lowercase, and false otherwise. + /// Returns whether this `char` is lowercase. /// /// 'Lowercase' is defined according to the terms of the Unicode Derived Core /// Property `Lowercase`. @@ -604,7 +604,7 @@ impl char { } } - /// Returns true if this `char` is uppercase, and false otherwise. + /// Returns whether this `char` is uppercase. /// /// 'Uppercase' is defined according to the terms of the Unicode Derived Core /// Property `Uppercase`. @@ -632,7 +632,7 @@ impl char { } } - /// Returns true if this `char` is whitespace, and false otherwise. + /// Returns whether this `char` is whitespace. /// /// 'Whitespace' is defined according to the terms of the Unicode Derived Core /// Property `White_Space`. @@ -659,7 +659,7 @@ impl char { } } - /// Returns true if this `char` is alphanumeric, and false otherwise. + /// Returns whether this `char` is alphanumeric. /// /// 'Alphanumeric'-ness is defined in terms of the Unicode General Categories /// 'Nd', 'Nl', 'No' and the Derived Core Property 'Alphabetic'. @@ -684,7 +684,7 @@ impl char { self.is_alphabetic() || self.is_numeric() } - /// Returns true if this `char` is a control code point, and false otherwise. + /// Returns whether this `char` is a control code point. /// /// 'Control code point' is defined in terms of the Unicode General /// Category `Cc`. @@ -704,7 +704,7 @@ impl char { general_category::Cc(self) } - /// Returns true if this `char` is an extended grapheme character, and false otherwise. + /// Returns whether this `char` is an extended grapheme character. /// /// 'Extended grapheme character' is defined in terms of the Unicode Shaping and Rendering /// Category `Grapheme_Extend`. @@ -713,7 +713,7 @@ impl char { derived_property::Grapheme_Extend(self) } - /// Returns true if this `char` is numeric, and false otherwise. + /// Returns whether this `char` is numeric. /// /// 'Numeric'-ness is defined in terms of the Unicode General Categories /// 'Nd', 'Nl', 'No'. diff --git a/src/libcore/convert.rs b/src/libcore/convert.rs index 5bf5c858f865a..e9ddfbd89acd6 100644 --- a/src/libcore/convert.rs +++ b/src/libcore/convert.rs @@ -411,7 +411,7 @@ impl AsRef for &mut T where T: AsRef } } -// FIXME (#45742): replace the above impls for &/&mut with the following more general one: +// FIXME(#45742): replace the above impls for `&`/`&mut` with the following more general one: // // As lifts over Deref // impl AsRef for D where D::Target: AsRef { // fn as_ref(&self) -> &U { @@ -419,7 +419,7 @@ impl AsRef for &mut T where T: AsRef // } // } -// AsMut lifts over &mut +// `AsMut` lifts over `&mut`. #[stable(feature = "rust1", since = "1.0.0")] impl AsMut for &mut T where T: AsMut { @@ -428,7 +428,7 @@ impl AsMut for &mut T where T: AsMut } } -// FIXME (#45742): replace the above impl for &mut with the following more general one: +// FIXME(#45742): replace the above impl for &mut with the following more general one: // // AsMut lifts over DerefMut // impl AsMut for D where D::Target: AsMut { // fn as_mut(&mut self) -> &mut U { @@ -436,7 +436,7 @@ impl AsMut for &mut T where T: AsMut // } // } -// From implies Into +// `From` implies `Into`. #[stable(feature = "rust1", since = "1.0.0")] impl Into for T where U: From { @@ -445,14 +445,14 @@ impl Into for T where U: From } } -// From (and thus Into) is reflexive +// `From` (and thus `Into`) is reflexive. #[stable(feature = "rust1", since = "1.0.0")] impl From for T { fn from(t: T) -> T { t } } -// TryFrom implies TryInto +// `TryFrom` implies `TryInto`. #[unstable(feature = "try_from", issue = "33417")] impl TryInto for T where U: TryFrom { diff --git a/src/libcore/fmt/float.rs b/src/libcore/fmt/float.rs index 20c626cef1b16..78541b3378846 100644 --- a/src/libcore/fmt/float.rs +++ b/src/libcore/fmt/float.rs @@ -13,7 +13,7 @@ fn float_to_decimal_common_exact(fmt: &mut Formatter, num: &T, let mut buf = MaybeUninit::<[u8; 1024]>::uninitialized(); // enough for f32 and f64 let mut parts = MaybeUninit::<[flt2dec::Part; 4]>::uninitialized(); // FIXME(#53491): Technically, this is calling `get_mut` on an uninitialized - // `MaybeUninit` (here and elsewhere in this file). Revisit this once + // `MaybeUninit` (here and elsewhere in this file). Revisit this once // we decided whether that is valid or not. let formatted = flt2dec::to_exact_fixed_str(flt2dec::strategy::grisu::format_exact, *num, sign, precision, diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs index ec1aeb8a7d1e9..e60c7425db098 100644 --- a/src/libcore/fmt/mod.rs +++ b/src/libcore/fmt/mod.rs @@ -249,7 +249,7 @@ pub struct Formatter<'a> { args: &'a [ArgumentV1<'a>], } -// NB. Argument is essentially an optimized partially applied formatting function, +// N.B., argument is essentially an optimized partially applied formatting function, // equivalent to `exists T.(&T, fn(&T, &mut Formatter) -> Result`. struct Void { @@ -1690,8 +1690,7 @@ impl<'a> Formatter<'a> { self.flags & (1 << FlagV1::SignAwareZeroPad as u32) != 0 } - // FIXME: Decide what public API we want for these two flags. - // https://github.com/rust-lang/rust/issues/48584 + // FIXME: decide what public API we want for these two flags. See issue #48584. fn debug_lower_hex(&self) -> bool { self.flags & (1 << FlagV1::DebugLowerHex as u32) != 0 } fn debug_upper_hex(&self) -> bool { self.flags & (1 << FlagV1::DebugUpperHex as u32) != 0 } diff --git a/src/libcore/fmt/num.rs b/src/libcore/fmt/num.rs index c7c8fc50efaae..1245593dd493e 100644 --- a/src/libcore/fmt/num.rs +++ b/src/libcore/fmt/num.rs @@ -11,8 +11,8 @@ use ptr; use mem; #[doc(hidden)] -trait Int: PartialEq + PartialOrd + Div + Rem + - Sub + Copy { +trait Int: PartialEq + PartialOrd + Div + Rem + + Sub + Copy { fn zero() -> Self; fn from_u8(u: u8) -> Self; fn to_u8(&self) -> u8; diff --git a/src/libcore/future/future.rs b/src/libcore/future/future.rs index 0bc8a0fd26a04..ab2762d3e0d93 100644 --- a/src/libcore/future/future.rs +++ b/src/libcore/future/future.rs @@ -60,7 +60,7 @@ pub trait Future { /// progress, meaning that each time the current task is woken up, it should /// actively re-`poll` pending futures that it still has an interest in. /// - /// The `poll` function is not called repeatedly in a tight loop-- instead, + /// The `poll` function is not called repeatedly in a tight loop -- instead, /// it should only be called when the future indicates that it is ready to /// make progress (by calling `wake()`). If you're familiar with the /// `poll(2)` or `select(2)` syscalls on Unix it's worth noting that futures diff --git a/src/libcore/hash/sip.rs b/src/libcore/hash/sip.rs index 3377b831a9daa..09223ae3837cb 100644 --- a/src/libcore/hash/sip.rs +++ b/src/libcore/hash/sip.rs @@ -10,7 +10,7 @@ use mem; /// An implementation of SipHash 1-3. /// /// This is currently the default hashing function used by standard library -/// (eg. `collections::HashMap` uses it by default). +/// (e.g., `collections::HashMap` uses it by default). /// /// See: #[unstable(feature = "hashmap_internals", issue = "0")] diff --git a/src/libcore/intrinsics.rs b/src/libcore/intrinsics.rs index 7508257f7806f..c695888c820e1 100644 --- a/src/libcore/intrinsics.rs +++ b/src/libcore/intrinsics.rs @@ -921,7 +921,7 @@ extern "rust-intrinsic" { #[stable(feature = "rust1", since = "1.0.0")] pub fn transmute(e: T) -> U; - /// Returns `true` if the actual type given as `T` requires drop + /// Returns whether the actual type given as `T` requires drop /// glue; returns `false` if the actual type provided for `T` /// implements `Copy`. /// diff --git a/src/libcore/iter/iterator.rs b/src/libcore/iter/iterator.rs index 1ea500858ed16..e2b86903f3c6e 100644 --- a/src/libcore/iter/iterator.rs +++ b/src/libcore/iter/iterator.rs @@ -423,7 +423,7 @@ pub trait Iterator { #[inline] #[stable(feature = "rust1", since = "1.0.0")] fn chain(self, other: U) -> Chain where - Self: Sized, U: IntoIterator, + Self: Sized, U: IntoIterator, { Chain{a: self, b: other.into_iter(), state: ChainState::Both} } @@ -1568,7 +1568,7 @@ pub trait Iterator { #[inline] #[stable(feature = "iterator_try_fold", since = "1.27.0")] fn try_fold(&mut self, init: B, mut f: F) -> R where - Self: Sized, F: FnMut(B, Self::Item) -> R, R: Try + Self: Sized, F: FnMut(B, Self::Item) -> R, R: Try { let mut accum = init; while let Some(x) = self.next() { @@ -2278,7 +2278,7 @@ pub trait Iterator { /// ``` #[stable(feature = "rust1", since = "1.0.0")] fn cloned<'a, T: 'a>(self) -> Cloned - where Self: Sized + Iterator, T: Clone + where Self: Sized + Iterator, T: Clone { Cloned { it: self } } diff --git a/src/libcore/iter/mod.rs b/src/libcore/iter/mod.rs index 03369d6c8f3fd..898d0acdc5a4a 100644 --- a/src/libcore/iter/mod.rs +++ b/src/libcore/iter/mod.rs @@ -423,7 +423,7 @@ impl Iterator for Rev where I: DoubleEndedIterator { fn nth(&mut self, n: usize) -> Option<::Item> { self.iter.nth_back(n) } fn try_fold(&mut self, init: B, f: F) -> R where - Self: Sized, F: FnMut(B, Self::Item) -> R, R: Try + Self: Sized, F: FnMut(B, Self::Item) -> R, R: Try { self.iter.try_rfold(init, f) } @@ -458,7 +458,7 @@ impl DoubleEndedIterator for Rev where I: DoubleEndedIterator { fn nth_back(&mut self, n: usize) -> Option<::Item> { self.iter.nth(n) } fn try_rfold(&mut self, init: B, f: F) -> R where - Self: Sized, F: FnMut(B, Self::Item) -> R, R: Try + Self: Sized, F: FnMut(B, Self::Item) -> R, R: Try { self.iter.try_fold(init, f) } @@ -613,7 +613,7 @@ pub struct Cloned { #[stable(feature = "iter_cloned", since = "1.1.0")] impl<'a, I, T: 'a> Iterator for Cloned - where I: Iterator, T: Clone + where I: Iterator, T: Clone { type Item = T; @@ -626,7 +626,7 @@ impl<'a, I, T: 'a> Iterator for Cloned } fn try_fold(&mut self, init: B, mut f: F) -> R where - Self: Sized, F: FnMut(B, Self::Item) -> R, R: Try + Self: Sized, F: FnMut(B, Self::Item) -> R, R: Try { self.it.try_fold(init, move |acc, elt| f(acc, elt.clone())) } @@ -640,14 +640,14 @@ impl<'a, I, T: 'a> Iterator for Cloned #[stable(feature = "iter_cloned", since = "1.1.0")] impl<'a, I, T: 'a> DoubleEndedIterator for Cloned - where I: DoubleEndedIterator, T: Clone + where I: DoubleEndedIterator, T: Clone { fn next_back(&mut self) -> Option { self.it.next_back().cloned() } fn try_rfold(&mut self, init: B, mut f: F) -> R where - Self: Sized, F: FnMut(B, Self::Item) -> R, R: Try + Self: Sized, F: FnMut(B, Self::Item) -> R, R: Try { self.it.try_rfold(init, move |acc, elt| f(acc, elt.clone())) } @@ -661,7 +661,7 @@ impl<'a, I, T: 'a> DoubleEndedIterator for Cloned #[stable(feature = "iter_cloned", since = "1.1.0")] impl<'a, I, T: 'a> ExactSizeIterator for Cloned - where I: ExactSizeIterator, T: Clone + where I: ExactSizeIterator, T: Clone { fn len(&self) -> usize { self.it.len() @@ -674,12 +674,12 @@ impl<'a, I, T: 'a> ExactSizeIterator for Cloned #[stable(feature = "fused", since = "1.26.0")] impl<'a, I, T: 'a> FusedIterator for Cloned - where I: FusedIterator, T: Clone + where I: FusedIterator, T: Clone {} #[doc(hidden)] unsafe impl<'a, I, T: 'a> TrustedRandomAccess for Cloned - where I: TrustedRandomAccess, T: Clone + where I: TrustedRandomAccess, T: Clone { default unsafe fn get_unchecked(&mut self, i: usize) -> Self::Item { self.it.get_unchecked(i).clone() @@ -691,7 +691,7 @@ unsafe impl<'a, I, T: 'a> TrustedRandomAccess for Cloned #[doc(hidden)] unsafe impl<'a, I, T: 'a> TrustedRandomAccess for Cloned - where I: TrustedRandomAccess, T: Copy + where I: TrustedRandomAccess, T: Copy { unsafe fn get_unchecked(&mut self, i: usize) -> Self::Item { *self.it.get_unchecked(i) @@ -705,7 +705,7 @@ unsafe impl<'a, I, T: 'a> TrustedRandomAccess for Cloned #[unstable(feature = "trusted_len", issue = "37572")] unsafe impl<'a, I, T: 'a> TrustedLen for Cloned - where I: TrustedLen, + where I: TrustedLen, T: Clone {} @@ -913,7 +913,7 @@ impl Iterator for Chain where } fn try_fold(&mut self, init: Acc, mut f: F) -> R where - Self: Sized, F: FnMut(Acc, Self::Item) -> R, R: Try + Self: Sized, F: FnMut(Acc, Self::Item) -> R, R: Try { let mut accum = init; match self.state { @@ -1023,7 +1023,7 @@ impl Iterator for Chain where #[stable(feature = "rust1", since = "1.0.0")] impl DoubleEndedIterator for Chain where A: DoubleEndedIterator, - B: DoubleEndedIterator, + B: DoubleEndedIterator, { #[inline] fn next_back(&mut self) -> Option { @@ -1041,7 +1041,7 @@ impl DoubleEndedIterator for Chain where } fn try_rfold(&mut self, init: Acc, mut f: F) -> R where - Self: Sized, F: FnMut(Acc, Self::Item) -> R, R: Try + Self: Sized, F: FnMut(Acc, Self::Item) -> R, R: Try { let mut accum = init; match self.state { @@ -1084,12 +1084,12 @@ impl DoubleEndedIterator for Chain where #[stable(feature = "fused", since = "1.26.0")] impl FusedIterator for Chain where A: FusedIterator, - B: FusedIterator, + B: FusedIterator, {} #[unstable(feature = "trusted_len", issue = "37572")] unsafe impl TrustedLen for Chain - where A: TrustedLen, B: TrustedLen, + where A: TrustedLen, B: TrustedLen, {} /// An iterator that iterates two other iterators simultaneously. @@ -1432,7 +1432,7 @@ impl Iterator for Map where F: FnMut(I::Item) -> B { } fn try_fold(&mut self, init: Acc, mut g: G) -> R where - Self: Sized, G: FnMut(Acc, Self::Item) -> R, R: Try + Self: Sized, G: FnMut(Acc, Self::Item) -> R, R: Try { let f = &mut self.f; self.iter.try_fold(init, move |acc, elt| g(acc, f(elt))) @@ -1456,7 +1456,7 @@ impl DoubleEndedIterator for Map where } fn try_rfold(&mut self, init: Acc, mut g: G) -> R where - Self: Sized, G: FnMut(Acc, Self::Item) -> R, R: Try + Self: Sized, G: FnMut(Acc, Self::Item) -> R, R: Try { let f = &mut self.f; self.iter.try_rfold(init, move |acc, elt| g(acc, f(elt))) @@ -1570,7 +1570,7 @@ impl Iterator for Filter where P: FnMut(&I::Item) -> bool #[inline] fn try_fold(&mut self, init: Acc, mut fold: Fold) -> R where - Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try + Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try { let predicate = &mut self.predicate; self.iter.try_fold(init, move |acc, item| if predicate(&item) { @@ -1609,7 +1609,7 @@ impl DoubleEndedIterator for Filter #[inline] fn try_rfold(&mut self, init: Acc, mut fold: Fold) -> R where - Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try + Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try { let predicate = &mut self.predicate; self.iter.try_rfold(init, move |acc, item| if predicate(&item) { @@ -1684,7 +1684,7 @@ impl Iterator for FilterMap #[inline] fn try_fold(&mut self, init: Acc, mut fold: Fold) -> R where - Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try + Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try { let f = &mut self.f; self.iter.try_fold(init, move |acc, item| match f(item) { @@ -1721,7 +1721,7 @@ impl DoubleEndedIterator for FilterMap #[inline] fn try_rfold(&mut self, init: Acc, mut fold: Fold) -> R where - Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try + Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try { let f = &mut self.f; self.iter.try_rfold(init, move |acc, item| match f(item) { @@ -1808,7 +1808,7 @@ impl Iterator for Enumerate where I: Iterator { #[inline] #[rustc_inherit_overflow_checks] fn try_fold(&mut self, init: Acc, mut fold: Fold) -> R where - Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try + Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try { let count = &mut self.count; self.iter.try_fold(init, move |acc, item| { @@ -1848,7 +1848,7 @@ impl DoubleEndedIterator for Enumerate where #[inline] fn try_rfold(&mut self, init: Acc, mut fold: Fold) -> R where - Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try + Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try { // Can safely add and subtract the count, as `ExactSizeIterator` promises // that the number of elements fits into a `usize`. @@ -1984,7 +1984,7 @@ impl Iterator for Peekable { #[inline] fn try_fold(&mut self, init: B, mut f: F) -> R where - Self: Sized, F: FnMut(B, Self::Item) -> R, R: Try + Self: Sized, F: FnMut(B, Self::Item) -> R, R: Try { let acc = match self.peeked.take() { Some(None) => return Try::from_ok(init), @@ -2113,7 +2113,7 @@ impl Iterator for SkipWhile #[inline] fn try_fold(&mut self, mut init: Acc, mut fold: Fold) -> R where - Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try + Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try { if !self.flag { match self.next() { @@ -2202,7 +2202,7 @@ impl Iterator for TakeWhile #[inline] fn try_fold(&mut self, init: Acc, mut fold: Fold) -> R where - Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try + Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try { if self.flag { Try::from_ok(init) @@ -2303,7 +2303,7 @@ impl Iterator for Skip where I: Iterator { #[inline] fn try_fold(&mut self, init: Acc, fold: Fold) -> R where - Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try + Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try { let n = self.n; self.n = 0; @@ -2344,7 +2344,7 @@ impl DoubleEndedIterator for Skip where I: DoubleEndedIterator + ExactSize } fn try_rfold(&mut self, init: Acc, mut fold: Fold) -> R where - Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try + Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try { let mut n = self.len(); if n == 0 { @@ -2426,7 +2426,7 @@ impl Iterator for Take where I: Iterator{ #[inline] fn try_fold(&mut self, init: Acc, mut fold: Fold) -> R where - Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try + Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try { if self.n == 0 { Try::from_ok(init) @@ -2497,7 +2497,7 @@ impl Iterator for Scan where #[inline] fn try_fold(&mut self, init: Acc, mut fold: Fold) -> R where - Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try + Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try { let state = &mut self.state; let f = &mut self.f; @@ -2554,7 +2554,7 @@ impl Iterator for FlatMap #[inline] fn try_fold(&mut self, init: Acc, fold: Fold) -> R where - Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try + Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try { self.inner.try_fold(init, fold) } @@ -2578,7 +2578,7 @@ impl DoubleEndedIterator for FlatMap #[inline] fn try_rfold(&mut self, init: Acc, fold: Fold) -> R where - Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try + Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try { self.inner.try_rfold(init, fold) } @@ -2643,7 +2643,7 @@ impl Iterator for Flatten #[inline] fn try_fold(&mut self, init: Acc, fold: Fold) -> R where - Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try + Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try { self.inner.try_fold(init, fold) } @@ -2666,7 +2666,7 @@ impl DoubleEndedIterator for Flatten #[inline] fn try_rfold(&mut self, init: Acc, fold: Fold) -> R where - Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try + Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try { self.inner.try_rfold(init, fold) } @@ -2730,7 +2730,7 @@ impl Iterator for FlattenCompat #[inline] fn try_fold(&mut self, mut init: Acc, mut fold: Fold) -> R where - Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try + Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try { if let Some(ref mut front) = self.frontiter { init = front.try_fold(init, &mut fold)?; @@ -2786,7 +2786,7 @@ impl DoubleEndedIterator for FlattenCompat #[inline] fn try_rfold(&mut self, mut init: Acc, mut fold: Fold) -> R where - Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try + Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try { if let Some(ref mut back) = self.backiter { init = back.try_rfold(init, &mut fold)?; @@ -2897,7 +2897,7 @@ impl Iterator for Fuse where I: Iterator { #[inline] default fn try_fold(&mut self, init: Acc, fold: Fold) -> R where - Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try + Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try { if self.done { Try::from_ok(init) @@ -2935,7 +2935,7 @@ impl DoubleEndedIterator for Fuse where I: DoubleEndedIterator { #[inline] default fn try_rfold(&mut self, init: Acc, fold: Fold) -> R where - Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try + Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try { if self.done { Try::from_ok(init) @@ -2999,7 +2999,7 @@ impl Iterator for Fuse where I: FusedIterator { #[inline] fn try_fold(&mut self, init: Acc, fold: Fold) -> R where - Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try + Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try { self.iter.try_fold(init, fold) } @@ -3023,7 +3023,7 @@ impl DoubleEndedIterator for Fuse #[inline] fn try_rfold(&mut self, init: Acc, fold: Fold) -> R where - Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try + Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try { self.iter.try_rfold(init, fold) } @@ -3101,7 +3101,7 @@ impl Iterator for Inspect where F: FnMut(&I::Item) { #[inline] fn try_fold(&mut self, init: Acc, mut fold: Fold) -> R where - Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try + Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try { let f = &mut self.f; self.iter.try_fold(init, move |acc, item| { f(&item); fold(acc, item) }) @@ -3128,7 +3128,7 @@ impl DoubleEndedIterator for Inspect #[inline] fn try_rfold(&mut self, init: Acc, mut fold: Fold) -> R where - Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try + Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try { let f = &mut self.f; self.iter.try_rfold(init, move |acc, item| { f(&item); fold(acc, item) }) diff --git a/src/libcore/iter/sources.rs b/src/libcore/iter/sources.rs index 2a39089a8a229..00222a8095595 100644 --- a/src/libcore/iter/sources.rs +++ b/src/libcore/iter/sources.rs @@ -478,7 +478,7 @@ impl fmt::Debug for Unfold { pub fn successors(first: Option, succ: F) -> Successors where F: FnMut(&T) -> Option { - // If this function returned `impl Iterator` + // If this function returned `impl Iterator` // it could be based on `unfold` and not need a dedicated type. // However having a named `Successors` type allows it to be `Clone` when `T` and `F` are. Successors { diff --git a/src/libcore/iter/traits.rs b/src/libcore/iter/traits.rs index e8c6cd8b79c72..1d38ed174f536 100644 --- a/src/libcore/iter/traits.rs +++ b/src/libcore/iter/traits.rs @@ -121,7 +121,7 @@ pub trait FromIterator: Sized { /// assert_eq!(v, vec![5, 5, 5, 5, 5]); /// ``` #[stable(feature = "rust1", since = "1.0.0")] - fn from_iter>(iter: T) -> Self; + fn from_iter>(iter: T) -> Self; } /// Conversion into an `Iterator`. @@ -217,7 +217,7 @@ pub trait IntoIterator { /// Which kind of iterator are we turning this into? #[stable(feature = "rust1", since = "1.0.0")] - type IntoIter: Iterator; + type IntoIter: Iterator; /// Creates an iterator from a value. /// @@ -343,7 +343,7 @@ pub trait Extend { /// assert_eq!("abcdef", &message); /// ``` #[stable(feature = "rust1", since = "1.0.0")] - fn extend>(&mut self, iter: T); + fn extend>(&mut self, iter: T); } #[stable(feature = "extend_for_unit", since = "1.28.0")] @@ -512,7 +512,7 @@ pub trait DoubleEndedIterator: Iterator { where Self: Sized, F: FnMut(B, Self::Item) -> R, - R: Try + R: Try { let mut accum = init; while let Some(x) = self.next_back() { @@ -806,7 +806,7 @@ pub trait Sum: Sized { /// Method which takes an iterator and generates `Self` from the elements by /// "summing up" the items. #[stable(feature = "iter_arith_traits", since = "1.12.0")] - fn sum>(iter: I) -> Self; + fn sum>(iter: I) -> Self; } /// Trait to represent types that can be created by multiplying elements of an @@ -825,7 +825,7 @@ pub trait Product: Sized { /// Method which takes an iterator and generates `Self` from the elements by /// multiplying the items. #[stable(feature = "iter_arith_traits", since = "1.12.0")] - fn product>(iter: I) -> Self; + fn product>(iter: I) -> Self; } // N.B., explicitly use Add and Mul here to inherit overflow checks @@ -847,14 +847,14 @@ macro_rules! integer_sum_product { #[$attr] impl<'a> Sum<&'a $a> for $a { - fn sum>(iter: I) -> $a { + fn sum>(iter: I) -> $a { iter.fold($zero, Add::add) } } #[$attr] impl<'a> Product<&'a $a> for $a { - fn product>(iter: I) -> $a { + fn product>(iter: I) -> $a { iter.fold($one, Mul::mul) } } @@ -887,14 +887,14 @@ macro_rules! float_sum_product { #[stable(feature = "iter_arith_traits", since = "1.12.0")] impl<'a> Sum<&'a $a> for $a { - fn sum>(iter: I) -> $a { + fn sum>(iter: I) -> $a { iter.fold(0.0, |a, b| a + *b) } } #[stable(feature = "iter_arith_traits", since = "1.12.0")] impl<'a> Product<&'a $a> for $a { - fn product>(iter: I) -> $a { + fn product>(iter: I) -> $a { iter.fold(1.0, |a, b| a * *b) } } @@ -1023,7 +1023,7 @@ impl Product> for Result /// Note: In general, you should not use `FusedIterator` in generic bounds if /// you need a fused iterator. Instead, you should just call [`Iterator::fuse`] /// on the iterator. If the iterator is already fused, the additional [`Fuse`] -/// wrapper will be a no-op with no performance penalty. +/// wrapper will be a noop with no performance penalty. /// /// [`None`]: ../../std/option/enum.Option.html#variant.None /// [`Iterator::fuse`]: ../../std/iter/trait.Iterator.html#method.fuse diff --git a/src/libcore/iter_private.rs b/src/libcore/iter_private.rs index 890db47b19700..30d1567b89917 100644 --- a/src/libcore/iter_private.rs +++ b/src/libcore/iter_private.rs @@ -11,7 +11,7 @@ #[doc(hidden)] pub unsafe trait TrustedRandomAccess : ExactSizeIterator { unsafe fn get_unchecked(&mut self, i: usize) -> Self::Item; - /// Returns `true` if getting an iterator element may have + /// Returns whether getting an iterator element may have /// side effects. Remember to take inner iterators into account. fn may_have_side_effect() -> bool; } diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs index 5ea765d3585a2..257f26e60b16d 100644 --- a/src/libcore/lib.rs +++ b/src/libcore/lib.rs @@ -17,7 +17,7 @@ //! //! Please note that all of these details are currently not considered stable. //! -// FIXME: Fill me in with more detail when the interface settles +// FIXME: fill me in with more detail when the interface settles //! This library is built on the assumption of a few existing symbols: //! //! * `memcpy`, `memcmp`, `memset` - These are core memory routines which are diff --git a/src/libcore/macros.rs b/src/libcore/macros.rs index 2f350df2f5c18..2ac8af89ea91c 100644 --- a/src/libcore/macros.rs +++ b/src/libcore/macros.rs @@ -493,7 +493,7 @@ macro_rules! unreachable { /// A standardized placeholder for marking unfinished code. /// /// This can be useful if you are prototyping and are just looking to have your -/// code typecheck, or if you're implementing a trait that requires multiple +/// code type-check, or if you're implementing a trait that requires multiple /// methods, and you're only planning on using one of them. /// /// # Panics diff --git a/src/libcore/mem.rs b/src/libcore/mem.rs index c024868714cab..7ce8c7476498a 100644 --- a/src/libcore/mem.rs +++ b/src/libcore/mem.rs @@ -1150,7 +1150,7 @@ impl MaybeUninit { /// It is up to the caller to guarantee that the `MaybeUninit` really is in an initialized /// state, otherwise this will immediately cause undefined behavior. // FIXME(#53491): We currently rely on the above being incorrect, i.e., we have references - // to uninitialized data (e.g., in `libcore/fmt/float.rs`). We should make + // to uninitialized data (e.g., in `libcore/fmt/float.rs`). We should make // a final decision about the rules before stabilization. #[unstable(feature = "maybe_uninit", issue = "53491")] #[inline(always)] diff --git a/src/libcore/num/bignum.rs b/src/libcore/num/bignum.rs index 99a427ba15974..bba2715761104 100644 --- a/src/libcore/num/bignum.rs +++ b/src/libcore/num/bignum.rs @@ -48,7 +48,7 @@ macro_rules! impl_full_ops { impl FullOps for $ty { fn full_add(self, other: $ty, carry: bool) -> (bool, $ty) { // this cannot overflow, the output is between 0 and 2*2^nbits - 1 - // FIXME will LLVM optimize this into ADC or similar??? + // FIXME: will LLVM optimize this into ADC or similar??? let (v, carry1) = unsafe { intrinsics::add_with_overflow(self, other) }; let (v, carry2) = unsafe { intrinsics::add_with_overflow(v, if carry {1} else {0}) @@ -156,7 +156,7 @@ macro_rules! define_bignum { ((self.base[d] >> b) & 1) as u8 } - /// Returns `true` if the bignum is zero. + /// Returns whether the bignum is zero. pub fn is_zero(&self) -> bool { self.digits().iter().all(|&v| v == 0) } @@ -394,7 +394,7 @@ macro_rules! define_bignum { // Stupid slow base-2 long division taken from // https://en.wikipedia.org/wiki/Division_algorithm - // FIXME use a greater base ($ty) for the long division. + // FIXME: use a greater base ($ty) for the long division. assert!(!d.is_zero()); let digitbits = mem::size_of::<$ty>() * 8; for digit in &mut q.base[..] { @@ -476,7 +476,7 @@ macro_rules! define_bignum { /// The digit type for `Big32x40`. pub type Digit32 = u32; -define_bignum!(Big32x40: type=Digit32, n=40); +define_bignum!(Big32x40: type = Digit32, n=40); // this one is used for testing only. #[doc(hidden)] diff --git a/src/libcore/num/dec2flt/algorithm.rs b/src/libcore/num/dec2flt/algorithm.rs index d56fa9662a994..36f3b4c988a39 100644 --- a/src/libcore/num/dec2flt/algorithm.rs +++ b/src/libcore/num/dec2flt/algorithm.rs @@ -284,7 +284,7 @@ pub fn algorithm_m(f: &Big, e: i16) -> T { v = Big::from_small(1); v.mul_pow5(e_abs).mul_pow2(e_abs); } else { - // FIXME possible optimization: generalize big_to_fp so that we can do the equivalent of + // FIXME: possible optimization: generalize big_to_fp so that we can do the equivalent of // fp_to_float(big_to_fp(u)) here, only without the double rounding. u = f.clone(); u.mul_pow5(e_abs).mul_pow2(e_abs); @@ -301,7 +301,7 @@ pub fn algorithm_m(f: &Big, e: i16) -> T { // We have to stop at the minimum exponent, if we wait until `k < T::MIN_EXP_INT`, // then we'd be off by a factor of two. Unfortunately this means we have to special- // case normal numbers with the minimum exponent. - // FIXME find a more elegant formulation, but run the `tiny-pow10` test to make sure + // FIXME: find a more elegant formulation, but run the `tiny-pow10` test to make sure // that it's actually correct! if x >= min_sig && x <= max_sig { break; @@ -334,7 +334,7 @@ fn quick_start(u: &mut Big, v: &mut Big, k: &mut i16) { // for log(u / v) is at most one as well. // The target ratio is one where u/v is in an in-range significand. Thus our termination // condition is log2(u / v) being the significand bits, plus/minus one. - // FIXME Looking at the second bit could improve the estimate and avoid some more divisions. + // FIXME: Looking at the second bit could improve the estimate and avoid some more divisions. let target_ratio = T::SIG_BITS as i16; let log2_u = u.bit_length() as i16; let log2_v = v.bit_length() as i16; diff --git a/src/libcore/num/dec2flt/mod.rs b/src/libcore/num/dec2flt/mod.rs index 58b196a6eac3d..b03ccb314b648 100644 --- a/src/libcore/num/dec2flt/mod.rs +++ b/src/libcore/num/dec2flt/mod.rs @@ -54,7 +54,7 @@ //! operations as well, if you want 0.5 ULP accuracy you need to do *everything* in full precision //! and round *exactly once, at the end*, by considering all truncated bits at once. //! -//! FIXME Although some code duplication is necessary, perhaps parts of the code could be shuffled +//! FIXME: Although some code duplication is necessary, perhaps parts of the code could be shuffled //! around such that less code is duplicated. Large parts of the algorithms are independent of the //! float type to output, or only needs access to a few constants, which could be passed in as //! parameters. @@ -240,7 +240,7 @@ fn convert(mut decimal: Decimal) -> Result { // Now the exponent certainly fits in 16 bit, which is used throughout the main algorithms. let e = e as i16; - // FIXME These bounds are rather conservative. A more careful analysis of the failure modes + // FIXME: These bounds are rather conservative. A more careful analysis of the failure modes // of Bellerophon could allow using it in more cases for a massive speed up. let exponent_in_range = table::MIN_E <= e && e <= table::MAX_E; let value_in_range = upper_bound <= T::MAX_NORMAL_DIGITS as u64; diff --git a/src/libcore/num/dec2flt/num.rs b/src/libcore/num/dec2flt/num.rs index b76c58cc66e6b..5559b765c6fe4 100644 --- a/src/libcore/num/dec2flt/num.rs +++ b/src/libcore/num/dec2flt/num.rs @@ -1,6 +1,6 @@ //! Utility functions for bignums that don't make too much sense to turn into methods. -// FIXME This module's name is a bit unfortunate, since other modules also import `core::num`. +// FIXME: This module's name is a bit unfortunate, since other modules also import `core::num`. use cmp::Ordering::{self, Less, Equal, Greater}; @@ -36,7 +36,7 @@ pub fn compare_with_half_ulp(f: &Big, ones_place: usize) -> Ordering { /// 1. using `FromStr` on `&[u8]` requires `from_utf8_unchecked`, which is bad, and /// 2. piecing together the results of `integral.parse()` and `fractional.parse()` is /// more complicated than this entire function. -pub fn from_str_unchecked<'a, T>(bytes: T) -> u64 where T : IntoIterator { +pub fn from_str_unchecked<'a, T>(bytes: T) -> u64 where T : IntoIterator { let mut result = 0; for &c in bytes { result = result * 10 + (c - b'0') as u64; diff --git a/src/libcore/num/dec2flt/rawfp.rs b/src/libcore/num/dec2flt/rawfp.rs index 6976bd1a0eefd..afabfe3ed1bb5 100644 --- a/src/libcore/num/dec2flt/rawfp.rs +++ b/src/libcore/num/dec2flt/rawfp.rs @@ -48,9 +48,9 @@ pub trait RawFloat : Copy + Debug + LowerExp - + Mul - + Div - + Neg + + Mul + + Div + + Neg { const INFINITY: Self; const NAN: Self; diff --git a/src/libcore/num/f32.rs b/src/libcore/num/f32.rs index d1bd97552024d..83bd72fcceab7 100644 --- a/src/libcore/num/f32.rs +++ b/src/libcore/num/f32.rs @@ -144,7 +144,7 @@ pub mod consts { #[lang = "f32"] #[cfg(not(test))] impl f32 { - /// Returns `true` if this value is `NaN` and false otherwise. + /// Returns whether this value is `NaN`. /// /// ``` /// use std::f32; @@ -161,8 +161,7 @@ impl f32 { self != self } - /// Returns `true` if this value is positive infinity or negative infinity and - /// false otherwise. + /// Returns whether this value is positive infinity or negative infinity. /// /// ``` /// use std::f32; @@ -184,7 +183,7 @@ impl f32 { self == INFINITY || self == NEG_INFINITY } - /// Returns `true` if this number is neither infinite nor `NaN`. + /// Returns whether this number is neither infinite nor `NaN`. /// /// ``` /// use std::f32; @@ -206,7 +205,7 @@ impl f32 { !(self.is_nan() || self.is_infinite()) } - /// Returns `true` if the number is neither zero, infinite, + /// Returns whether the number is neither zero, infinite, /// [subnormal][subnormal], or `NaN`. /// /// ``` @@ -262,7 +261,7 @@ impl f32 { } } - /// Returns `true` if and only if `self` has a positive sign, including `+0.0`, `NaN`s with + /// Returns whether `self` has a positive sign, including `+0.0`, `NaN`s with /// positive sign bit and positive infinity. /// /// ``` @@ -278,7 +277,7 @@ impl f32 { !self.is_sign_negative() } - /// Returns `true` if and only if `self` has a negative sign, including `-0.0`, `NaN`s with + /// Returns whether `self` has a negative sign, including `-0.0`, `NaN`s with /// negative sign bit and negative infinity. /// /// ``` diff --git a/src/libcore/num/f64.rs b/src/libcore/num/f64.rs index 8ada5b6756c38..bd673a0cd7c20 100644 --- a/src/libcore/num/f64.rs +++ b/src/libcore/num/f64.rs @@ -144,7 +144,7 @@ pub mod consts { #[lang = "f64"] #[cfg(not(test))] impl f64 { - /// Returns `true` if this value is `NaN` and false otherwise. + /// Returns whether this value is `NaN`. /// /// ``` /// use std::f64; @@ -161,8 +161,7 @@ impl f64 { self != self } - /// Returns `true` if this value is positive infinity or negative infinity and - /// false otherwise. + /// Returns whether this value is positive infinity or negative infinity. /// /// ``` /// use std::f64; @@ -184,7 +183,7 @@ impl f64 { self == INFINITY || self == NEG_INFINITY } - /// Returns `true` if this number is neither infinite nor `NaN`. + /// Returns whether this number is neither infinite nor `NaN`. /// /// ``` /// use std::f64; @@ -206,7 +205,7 @@ impl f64 { !(self.is_nan() || self.is_infinite()) } - /// Returns `true` if the number is neither zero, infinite, + /// Returns whether the number is neither zero, infinite, /// [subnormal][subnormal], or `NaN`. /// /// ``` @@ -262,7 +261,7 @@ impl f64 { } } - /// Returns `true` if and only if `self` has a positive sign, including `+0.0`, `NaN`s with + /// Returns whether `self` has a positive sign, including `+0.0`, `NaN`s with /// positive sign bit and positive infinity. /// /// ``` @@ -286,7 +285,7 @@ impl f64 { self.is_sign_positive() } - /// Returns `true` if and only if `self` has a negative sign, including `-0.0`, `NaN`s with + /// Returns whether `self` has a negative sign, including `-0.0`, `NaN`s with /// negative sign bit and negative infinity. /// /// ``` diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index 97bf582df5a8c..c913afeed9e6b 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -437,7 +437,7 @@ assert_eq!(m, ", $reversed, "); doc_comment! { concat!("Converts an integer from big endian to the target's endianness. -On big endian this is a no-op. On little endian the bytes are swapped. +On big endian this is a noop. On little endian the bytes are swapped. # Examples @@ -471,7 +471,7 @@ $EndFeature, " doc_comment! { concat!("Converts an integer from little endian to the target's endianness. -On little endian this is a no-op. On big endian the bytes are swapped. +On little endian this is a noop. On big endian the bytes are swapped. # Examples @@ -505,7 +505,7 @@ $EndFeature, " doc_comment! { concat!("Converts `self` to big endian from the target's endianness. -On big endian this is a no-op. On little endian the bytes are swapped. +On big endian this is a noop. On little endian the bytes are swapped. # Examples @@ -539,7 +539,7 @@ $EndFeature, " doc_comment! { concat!("Converts `self` to little endian from the target's endianness. -On little endian this is a no-op. On big endian the bytes are swapped. +On little endian this is a noop. On big endian the bytes are swapped. # Examples @@ -1873,7 +1873,7 @@ $EndFeature, " } doc_comment! { - concat!("Returns `true` if `self` is positive and `false` if the number is zero or + concat!("Returns whether `self` is positive and `false` if the number is zero or negative. # Examples @@ -1892,7 +1892,7 @@ $EndFeature, " } doc_comment! { - concat!("Returns `true` if `self` is negative and `false` if the number is zero or + concat!("Returns whether `self` is negative and `false` if the number is zero or positive. # Examples @@ -2390,7 +2390,7 @@ assert_eq!(m, ", $reversed, "); doc_comment! { concat!("Converts an integer from big endian to the target's endianness. -On big endian this is a no-op. On little endian the bytes are +On big endian this is a noop. On little endian the bytes are swapped. # Examples @@ -2424,7 +2424,7 @@ if cfg!(target_endian = \"big\") { doc_comment! { concat!("Converts an integer from little endian to the target's endianness. -On little endian this is a no-op. On big endian the bytes are +On little endian this is a noop. On big endian the bytes are swapped. # Examples @@ -2458,7 +2458,7 @@ if cfg!(target_endian = \"little\") { doc_comment! { concat!("Converts `self` to big endian from the target's endianness. -On big endian this is a no-op. On little endian the bytes are +On big endian this is a noop. On little endian the bytes are swapped. # Examples @@ -2492,7 +2492,7 @@ if cfg!(target_endian = \"big\") { doc_comment! { concat!("Converts `self` to little endian from the target's endianness. -On little endian this is a no-op. On big endian the bytes are +On little endian this is a noop. On big endian the bytes are swapped. # Examples @@ -3564,7 +3564,7 @@ assert_eq!(7", stringify!($SelfT), ".rem_euclid(4), 3); // or any other integer } doc_comment! { - concat!("Returns `true` if and only if `self == 2^k` for some `k`. + concat!("Returns whether `self == 2^k` for some `k`. # Examples diff --git a/src/libcore/num/wrapping.rs b/src/libcore/num/wrapping.rs index 50e189c9e3640..9f03f2f39d524 100644 --- a/src/libcore/num/wrapping.rs +++ b/src/libcore/num/wrapping.rs @@ -95,7 +95,7 @@ macro_rules! sh_impl_unsigned { ) } -// FIXME (#23545): uncomment the remaining impls +// FIXME(#23545): uncomment the remaining impls macro_rules! sh_impl_all { ($($t:ident)*) => ($( //sh_impl_unsigned! { $t, u8 } @@ -529,7 +529,7 @@ assert_eq!(n.trailing_zeros(), 3); doc_comment! { concat!("Converts an integer from big endian to the target's endianness. -On big endian this is a no-op. On little endian the bytes are +On big endian this is a noop. On little endian the bytes are swapped. # Examples @@ -558,7 +558,7 @@ if cfg!(target_endian = \"big\") { doc_comment! { concat!("Converts an integer from little endian to the target's endianness. -On little endian this is a no-op. On big endian the bytes are +On little endian this is a noop. On big endian the bytes are swapped. # Examples @@ -587,7 +587,7 @@ if cfg!(target_endian = \"little\") { doc_comment! { concat!("Converts `self` to big endian from the target's endianness. -On big endian this is a no-op. On little endian the bytes are +On big endian this is a noop. On little endian the bytes are swapped. # Examples @@ -616,7 +616,7 @@ if cfg!(target_endian = \"big\") { doc_comment! { concat!("Converts `self` to little endian from the target's endianness. -On little endian this is a no-op. On big endian the bytes are +On little endian this is a noop. On big endian the bytes are swapped. # Examples @@ -758,7 +758,7 @@ assert_eq!(Wrapping(-10", stringify!($t), ").signum(), Wrapping(-1)); } doc_comment! { - concat!("Returns `true` if `self` is positive and `false` if the number is zero or + concat!("Returns whether `self` is positive and `false` if the number is zero or negative. # Examples @@ -780,7 +780,7 @@ assert!(!Wrapping(-10", stringify!($t), ").is_positive()); } doc_comment! { - concat!("Returns `true` if `self` is negative and `false` if the number is zero or + concat!("Returns whether `self` is negative and `false` if the number is zero or positive. # Examples @@ -832,7 +832,7 @@ assert_eq!(n.leading_zeros(), 2); } doc_comment! { - concat!("Returns `true` if and only if `self == 2^k` for some `k`. + concat!("Returns whether `self == 2^k` for some `k`. # Examples diff --git a/src/libcore/ops/arith.rs b/src/libcore/ops/arith.rs index 7d8bf18d33a01..42e0c3c20a52d 100644 --- a/src/libcore/ops/arith.rs +++ b/src/libcore/ops/arith.rs @@ -49,7 +49,7 @@ /// } /// /// // Notice that the implementation uses the associated type `Output`. -/// impl> Add for Point { +/// impl> Add for Point { /// type Output = Point; /// /// fn add(self, other: Point) -> Point { @@ -78,7 +78,7 @@ label="no implementation for `{Self} + {RHS}`", )] #[doc(alias = "+")] -pub trait Add { +pub trait Add { /// The resulting type after applying the `+` operator. #[stable(feature = "rust1", since = "1.0.0")] type Output; @@ -157,7 +157,7 @@ add_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 } /// } /// /// // Notice that the implementation uses the associated type `Output`. -/// impl> Sub for Point { +/// impl> Sub for Point { /// type Output = Point; /// /// fn sub(self, other: Point) -> Point { @@ -176,7 +176,7 @@ add_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 } #[rustc_on_unimplemented(message="cannot subtract `{RHS}` from `{Self}`", label="no implementation for `{Self} - {RHS}`")] #[doc(alias = "-")] -pub trait Sub { +pub trait Sub { /// The resulting type after applying the `-` operator. #[stable(feature = "rust1", since = "1.0.0")] type Output; @@ -296,7 +296,7 @@ sub_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 } #[rustc_on_unimplemented(message="cannot multiply `{RHS}` to `{Self}`", label="no implementation for `{Self} * {RHS}`")] #[doc(alias = "*")] -pub trait Mul { +pub trait Mul { /// The resulting type after applying the `*` operator. #[stable(feature = "rust1", since = "1.0.0")] type Output; @@ -420,7 +420,7 @@ mul_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 } #[rustc_on_unimplemented(message="cannot divide `{Self}` by `{RHS}`", label="no implementation for `{Self} / {RHS}`")] #[doc(alias = "/")] -pub trait Div { +pub trait Div { /// The resulting type after applying the `/` operator. #[stable(feature = "rust1", since = "1.0.0")] type Output; @@ -505,7 +505,7 @@ div_impl_float! { f32 f64 } #[rustc_on_unimplemented(message="cannot mod `{Self}` by `{RHS}`", label="no implementation for `{Self} % {RHS}`")] #[doc(alias = "%")] -pub trait Rem { +pub trait Rem { /// The resulting type after applying the `%` operator. #[stable(feature = "rust1", since = "1.0.0")] type Output = Self; @@ -668,7 +668,7 @@ neg_impl_numeric! { isize i8 i16 i32 i64 i128 f32 f64 } label="no implementation for `{Self} += {Rhs}`")] #[doc(alias = "+")] #[doc(alias = "+=")] -pub trait AddAssign { +pub trait AddAssign { /// Performs the `+=` operation. #[stable(feature = "op_assign_traits", since = "1.8.0")] fn add_assign(&mut self, rhs: Rhs); @@ -724,7 +724,7 @@ add_assign_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 } label="no implementation for `{Self} -= {Rhs}`")] #[doc(alias = "-")] #[doc(alias = "-=")] -pub trait SubAssign { +pub trait SubAssign { /// Performs the `-=` operation. #[stable(feature = "op_assign_traits", since = "1.8.0")] fn sub_assign(&mut self, rhs: Rhs); @@ -771,7 +771,7 @@ sub_assign_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 } label="no implementation for `{Self} *= {Rhs}`")] #[doc(alias = "*")] #[doc(alias = "*=")] -pub trait MulAssign { +pub trait MulAssign { /// Performs the `*=` operation. #[stable(feature = "op_assign_traits", since = "1.8.0")] fn mul_assign(&mut self, rhs: Rhs); @@ -818,7 +818,7 @@ mul_assign_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 } label="no implementation for `{Self} /= {Rhs}`")] #[doc(alias = "/")] #[doc(alias = "/=")] -pub trait DivAssign { +pub trait DivAssign { /// Performs the `/=` operation. #[stable(feature = "op_assign_traits", since = "1.8.0")] fn div_assign(&mut self, rhs: Rhs); @@ -868,7 +868,7 @@ div_assign_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 } label="no implementation for `{Self} %= {Rhs}`")] #[doc(alias = "%")] #[doc(alias = "%=")] -pub trait RemAssign { +pub trait RemAssign { /// Performs the `%=` operation. #[stable(feature = "op_assign_traits", since = "1.8.0")] fn rem_assign(&mut self, rhs: Rhs); diff --git a/src/libcore/ops/bit.rs b/src/libcore/ops/bit.rs index 2c9bf248633c4..8274b4fcd2b1f 100644 --- a/src/libcore/ops/bit.rs +++ b/src/libcore/ops/bit.rs @@ -114,7 +114,7 @@ not_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 } #[stable(feature = "rust1", since = "1.0.0")] #[rustc_on_unimplemented(message="no implementation for `{Self} & {RHS}`", label="no implementation for `{Self} & {RHS}`")] -pub trait BitAnd { +pub trait BitAnd { /// The resulting type after applying the `&` operator. #[stable(feature = "rust1", since = "1.0.0")] type Output; @@ -198,7 +198,7 @@ bitand_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 } #[stable(feature = "rust1", since = "1.0.0")] #[rustc_on_unimplemented(message="no implementation for `{Self} | {RHS}`", label="no implementation for `{Self} | {RHS}`")] -pub trait BitOr { +pub trait BitOr { /// The resulting type after applying the `|` operator. #[stable(feature = "rust1", since = "1.0.0")] type Output; @@ -285,7 +285,7 @@ bitor_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 } #[stable(feature = "rust1", since = "1.0.0")] #[rustc_on_unimplemented(message="no implementation for `{Self} ^ {RHS}`", label="no implementation for `{Self} ^ {RHS}`")] -pub trait BitXor { +pub trait BitXor { /// The resulting type after applying the `^` operator. #[stable(feature = "rust1", since = "1.0.0")] type Output; @@ -373,7 +373,7 @@ bitxor_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 } #[stable(feature = "rust1", since = "1.0.0")] #[rustc_on_unimplemented(message="no implementation for `{Self} << {RHS}`", label="no implementation for `{Self} << {RHS}`")] -pub trait Shl { +pub trait Shl { /// The resulting type after applying the `<<` operator. #[stable(feature = "rust1", since = "1.0.0")] type Output; @@ -482,7 +482,7 @@ shl_impl_all! { u8 u16 u32 u64 u128 usize i8 i16 i32 i64 isize i128 } #[stable(feature = "rust1", since = "1.0.0")] #[rustc_on_unimplemented(message="no implementation for `{Self} >> {RHS}`", label="no implementation for `{Self} >> {RHS}`")] -pub trait Shr { +pub trait Shr { /// The resulting type after applying the `>>` operator. #[stable(feature = "rust1", since = "1.0.0")] type Output; @@ -598,7 +598,7 @@ shr_impl_all! { u8 u16 u32 u64 u128 usize i8 i16 i32 i64 i128 isize } #[stable(feature = "op_assign_traits", since = "1.8.0")] #[rustc_on_unimplemented(message="no implementation for `{Self} &= {Rhs}`", label="no implementation for `{Self} &= {Rhs}`")] -pub trait BitAndAssign { +pub trait BitAndAssign { /// Performs the `&=` operation. #[stable(feature = "op_assign_traits", since = "1.8.0")] fn bitand_assign(&mut self, rhs: Rhs); @@ -647,7 +647,7 @@ bitand_assign_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 } #[stable(feature = "op_assign_traits", since = "1.8.0")] #[rustc_on_unimplemented(message="no implementation for `{Self} |= {Rhs}`", label="no implementation for `{Self} |= {Rhs}`")] -pub trait BitOrAssign { +pub trait BitOrAssign { /// Performs the `|=` operation. #[stable(feature = "op_assign_traits", since = "1.8.0")] fn bitor_assign(&mut self, rhs: Rhs); @@ -696,7 +696,7 @@ bitor_assign_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 } #[stable(feature = "op_assign_traits", since = "1.8.0")] #[rustc_on_unimplemented(message="no implementation for `{Self} ^= {Rhs}`", label="no implementation for `{Self} ^= {Rhs}`")] -pub trait BitXorAssign { +pub trait BitXorAssign { /// Performs the `^=` operation. #[stable(feature = "op_assign_traits", since = "1.8.0")] fn bitxor_assign(&mut self, rhs: Rhs); @@ -743,7 +743,7 @@ bitxor_assign_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 } #[stable(feature = "op_assign_traits", since = "1.8.0")] #[rustc_on_unimplemented(message="no implementation for `{Self} <<= {Rhs}`", label="no implementation for `{Self} <<= {Rhs}`")] -pub trait ShlAssign { +pub trait ShlAssign { /// Performs the `<<=` operation. #[stable(feature = "op_assign_traits", since = "1.8.0")] fn shl_assign(&mut self, rhs: Rhs); @@ -811,7 +811,7 @@ shl_assign_impl_all! { u8 u16 u32 u64 u128 usize i8 i16 i32 i64 i128 isize } #[stable(feature = "op_assign_traits", since = "1.8.0")] #[rustc_on_unimplemented(message="no implementation for `{Self} >>= {Rhs}`", label="no implementation for `{Self} >>= {Rhs}`")] -pub trait ShrAssign { +pub trait ShrAssign { /// Performs the `>>=` operation. #[stable(feature = "op_assign_traits", since = "1.8.0")] fn shr_assign(&mut self, rhs: Rhs); diff --git a/src/libcore/ops/range.rs b/src/libcore/ops/range.rs index 815a4cfeed88e..ac8e8daa2a38f 100644 --- a/src/libcore/ops/range.rs +++ b/src/libcore/ops/range.rs @@ -86,7 +86,7 @@ impl fmt::Debug for Range { } impl> Range { - /// Returns `true` if `item` is contained in the range. + /// Returns whether `item` is contained in the range. /// /// # Examples /// @@ -117,7 +117,7 @@ impl> Range { >::contains(self, item) } - /// Returns `true` if the range contains no items. + /// Returns whether the range contains no items. /// /// # Examples /// @@ -185,7 +185,7 @@ impl fmt::Debug for RangeFrom { } impl> RangeFrom { - /// Returns `true` if `item` is contained in the range. + /// Returns whether `item` is contained in the range. /// /// # Examples /// @@ -267,7 +267,7 @@ impl fmt::Debug for RangeTo { } impl> RangeTo { - /// Returns `true` if `item` is contained in the range. + /// Returns whether `item` is contained in the range. /// /// # Examples /// @@ -459,7 +459,7 @@ impl fmt::Debug for RangeInclusive { } impl> RangeInclusive { - /// Returns `true` if `item` is contained in the range. + /// Returns whether `item` is contained in the range. /// /// # Examples /// @@ -491,7 +491,7 @@ impl> RangeInclusive { >::contains(self, item) } - /// Returns `true` if the range contains no items. + /// Returns whether the range contains no items. /// /// # Examples /// @@ -593,7 +593,7 @@ impl fmt::Debug for RangeToInclusive { #[unstable(feature = "range_contains", reason = "recently added as per RFC", issue = "32311")] impl> RangeToInclusive { - /// Returns `true` if `item` is contained in the range. + /// Returns whether `item` is contained in the range. /// /// # Examples /// @@ -713,7 +713,7 @@ pub trait RangeBounds { fn end_bound(&self) -> Bound<&T>; - /// Returns `true` if `item` is contained in the range. + /// Returns whether `item` is contained in the range. /// /// # Examples /// diff --git a/src/libcore/option.rs b/src/libcore/option.rs index 6d4f4be1a1782..ac860f4b53661 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -41,7 +41,7 @@ //! ``` //! // -// FIXME: Show how `Option` is used in practice, with lots of methods +// FIXME: show how `Option` is used in practice, with lots of methods // //! # Options and pointers ("nullable" pointers) //! @@ -165,7 +165,7 @@ impl Option { // Querying the contained values ///////////////////////////////////////////////////////////////////////// - /// Returns `true` if the option is a [`Some`] value. + /// Returns whether the option is a [`Some`] value. /// /// # Examples /// @@ -187,7 +187,7 @@ impl Option { } } - /// Returns `true` if the option is a [`None`] value. + /// Returns whether the option is a [`None`] value. /// /// # Examples /// @@ -1323,7 +1323,7 @@ impl> FromIterator> for Option { /// /// [`Iterator`]: ../iter/trait.Iterator.html #[inline] - fn from_iter>>(iter: I) -> Option { + fn from_iter>>(iter: I) -> Option { // FIXME(#11084): This could be replaced with Iterator::scan when this // performance bug is closed. @@ -1332,7 +1332,7 @@ impl> FromIterator> for Option { found_none: bool, } - impl>> Iterator for Adapter { + impl>> Iterator for Adapter { type Item = T; #[inline] diff --git a/src/libcore/pin.rs b/src/libcore/pin.rs index e31ac691e3a3c..c1250562fdd8c 100644 --- a/src/libcore/pin.rs +++ b/src/libcore/pin.rs @@ -323,8 +323,8 @@ impl fmt::Pointer for Pin

{ } // Note: this means that any impl of `CoerceUnsized` that allows coercing from -// a type that impls `Deref` to a type that impls -// `Deref` is unsound. Any such impl would probably be unsound +// a type that impls `Deref` to a type that impls +// `Deref` is unsound. Any such impl would probably be unsound // for other reasons, though, so we just need to take care not to allow such // impls to land in std. #[stable(feature = "pin", since = "1.33.0")] diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index 55a72d7a9a94d..4d313fd058ad5 100644 --- a/src/libcore/ptr.rs +++ b/src/libcore/ptr.rs @@ -135,7 +135,7 @@ pub use intrinsics::write_bytes; /// unsafe { /// // Get a raw pointer to the last element in `v`. /// let ptr = &mut v[1] as *mut _; -/// // Shorten `v` to prevent the last item from being dropped. We do that first, +/// // Shorten `v` to prevent the last item from being dropped. We do that first, /// // to prevent issues if the `drop_in_place` below panics. /// v.set_len(1); /// // Without a call `drop_in_place`, the last item would never be dropped, @@ -185,7 +185,7 @@ pub unsafe fn drop_in_place(to_drop: *mut T) { // The real `drop_in_place` -- the one that gets called implicitly when variables go // out of scope -- should have a safe reference and not a raw pointer as argument -// type. When we drop a local variable, we access it with a pointer that behaves +// type. When we drop a local variable, we access it with a pointer that behaves // like a safe reference; transmuting that to a raw pointer does not mean we can // actually access it with raw pointers. #[lang = "drop_in_place"] @@ -366,13 +366,13 @@ pub(crate) unsafe fn swap_nonoverlapping_one(x: *mut T, y: *mut T) { #[inline] unsafe fn swap_nonoverlapping_bytes(x: *mut u8, y: *mut u8, len: usize) { - // The approach here is to utilize simd to swap x & y efficiently. Testing reveals + // The approach here is to utilize simd to swap `x` and `y` efficiently. Testing reveals // that swapping either 32 bytes or 64 bytes at a time is most efficient for Intel // Haswell E processors. LLVM is more able to optimize if we give a struct a - // #[repr(simd)], even if we don't actually use this struct directly. + // `#[repr(simd)]`, even if we don't actually use this struct directly. // - // FIXME repr(simd) broken on emscripten and redox - // It's also broken on big-endian powerpc64 and s390x. #42778 + // FIXME: `repr(simd)` broken on emscripten and redox + // It's also broken on big-endian powerpc64 and s390x (see issue #42778). #[cfg_attr(not(any(target_os = "emscripten", target_os = "redox", target_endian = "big")), repr(simd))] @@ -825,7 +825,7 @@ pub unsafe fn write_unaligned(dst: *mut T, src: T) { /// /// The compiler shouldn't change the relative order or number of volatile /// memory operations. However, volatile memory operations on zero-sized types -/// (e.g., if a zero-sized type is passed to `read_volatile`) are no-ops +/// (e.g., if a zero-sized type is passed to `read_volatile`) are noops /// and may be ignored. /// /// [c11]: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf @@ -902,7 +902,7 @@ pub unsafe fn read_volatile(src: *const T) -> T { /// /// The compiler shouldn't change the relative order or number of volatile /// memory operations. However, volatile memory operations on zero-sized types -/// (e.g., if a zero-sized type is passed to `write_volatile`) are no-ops +/// (e.g., if a zero-sized type is passed to `write_volatile`) are noops /// and may be ignored. /// /// [c11]: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf @@ -947,7 +947,7 @@ pub unsafe fn write_volatile(dst: *mut T, src: T) { #[lang = "const_ptr"] impl *const T { - /// Returns `true` if the pointer is null. + /// Returns whether the pointer is null. /// /// Note that unsized types have many possible null pointers, as only the /// raw data pointer is considered, not their length, vtable, etc. @@ -1567,7 +1567,7 @@ impl *const T { #[lang = "mut_ptr"] impl *mut T { - /// Returns `true` if the pointer is null. + /// Returns whether the pointer is null. /// /// Note that unsized types have many possible null pointers, as only the /// raw data pointer is considered, not their length, vtable, etc. diff --git a/src/libcore/result.rs b/src/libcore/result.rs index b10d767efb24e..8632b4d863b17 100644 --- a/src/libcore/result.rs +++ b/src/libcore/result.rs @@ -262,7 +262,7 @@ impl Result { // Querying the contained values ///////////////////////////////////////////////////////////////////////// - /// Returns `true` if the result is [`Ok`]. + /// Returns whether the result is [`Ok`]. /// /// [`Ok`]: enum.Result.html#variant.Ok /// @@ -286,7 +286,7 @@ impl Result { } } - /// Returns `true` if the result is [`Err`]. + /// Returns whether the result is [`Err`]. /// /// [`Err`]: enum.Result.html#variant.Err /// @@ -1205,7 +1205,7 @@ impl> FromIterator> for Result { /// assert!(res == Ok(vec![2, 3])); /// ``` #[inline] - fn from_iter>>(iter: I) -> Result { + fn from_iter>>(iter: I) -> Result { // FIXME(#11084): This could be replaced with Iterator::scan when this // performance bug is closed. @@ -1214,7 +1214,7 @@ impl> FromIterator> for Result { err: Option, } - impl>> Iterator for Adapter { + impl>> Iterator for Adapter { type Item = T; #[inline] diff --git a/src/libcore/slice/mod.rs b/src/libcore/slice/mod.rs index 7fdc2acb8cc92..98b7fb4bc9e25 100644 --- a/src/libcore/slice/mod.rs +++ b/src/libcore/slice/mod.rs @@ -81,7 +81,7 @@ impl [T] { } } - /// Returns `true` if the slice has a length of 0. + /// Returns whether the slice has a length of 0. /// /// # Examples /// @@ -452,13 +452,13 @@ impl [T] { let ln = self.len(); // For very small types, all the individual reads in the normal - // path perform poorly. We can do better, given efficient unaligned + // path perform poorly. We can do better, given efficient unaligned // load/store, by loading a larger chunk and reversing a register. // Ideally LLVM would do this for us, as it knows better than we do // whether unaligned reads are efficient (since that changes between // different ARM versions, for example) and what the best chunk size - // would be. Unfortunately, as of LLVM 4.0 (2017-05) it only unrolls + // would be. Unfortunately, as of LLVM 4.0 (2017-05) it only unrolls // the loop, so we need to do this ourselves. (Hypothesis: reverse // is troublesome because the sides can be aligned differently -- // will be, when the length is odd -- so there's no way of emitting @@ -1260,7 +1260,7 @@ impl [T] { } } - /// Returns `true` if the slice contains an element with the given value. + /// Returns whether the slice contains an element with the given value. /// /// # Examples /// @@ -1276,7 +1276,7 @@ impl [T] { x.slice_contains(self) } - /// Returns `true` if `needle` is a prefix of the slice. + /// Returns whether `needle` is a prefix of the slice. /// /// # Examples /// @@ -1304,7 +1304,7 @@ impl [T] { self.len() >= n && needle == &self[..n] } - /// Returns `true` if `needle` is a suffix of the slice. + /// Returns whether `needle` is a suffix of the slice. /// /// # Examples /// @@ -1648,7 +1648,7 @@ impl [T] { // over all the elements, swapping as we go so that at the end // the elements we wish to keep are in the front, and those we // wish to reject are at the back. We can then split the slice. - // This operation is still O(n). + // This operation is still `O(n)`. // // Example: We start in this state, where `r` represents "next // read" and `w` represents "next_write`. @@ -1659,9 +1659,9 @@ impl [T] { // +---+---+---+---+---+---+ // w // - // Comparing self[r] against self[w-1], this is not a duplicate, so - // we swap self[r] and self[w] (no effect as r==w) and then increment both - // r and w, leaving us with: + // Comparing `self[r]` against `self[w - 1]`, this is not a duplicate, so + // we swap `self[r]` and `self[w]` (no effect as `r == w`) and then increment both + // `r` and `w`, leaving us with: // // r // +---+---+---+---+---+---+ @@ -1669,7 +1669,7 @@ impl [T] { // +---+---+---+---+---+---+ // w // - // Comparing self[r] against self[w-1], this value is a duplicate, + // Comparing `self[r]` against `self[w - 1]`, this value is a duplicate, // so we increment `r` but leave everything else unchanged: // // r @@ -1678,8 +1678,8 @@ impl [T] { // +---+---+---+---+---+---+ // w // - // Comparing self[r] against self[w-1], this is not a duplicate, - // so swap self[r] and self[w] and advance r and w: + // Comparing `self[r]` against `self[w - 1]`, this is not a duplicate, + // so swap `self[r]` and `self[w]` and advance `r` and `w`: // // r // +---+---+---+---+---+---+ @@ -1695,7 +1695,7 @@ impl [T] { // +---+---+---+---+---+---+ // w // - // Duplicate, advance r. End of slice. Split at w. + // Duplicate, advance `r`. End of slice. Split at `w`. let len = self.len(); if len <= 1 { @@ -1762,7 +1762,7 @@ impl [T] { /// # Panics /// /// This function will panic if `mid` is greater than the length of the - /// slice. Note that `mid == self.len()` does _not_ panic and is a no-op + /// slice. Note that `mid == self.len()` does _not_ panic and is a noop /// rotation. /// /// # Complexity @@ -1803,7 +1803,7 @@ impl [T] { /// # Panics /// /// This function will panic if `k` is greater than the length of the - /// slice. Note that `k == self.len()` does _not_ panic and is a no-op + /// slice. Note that `k == self.len()` does _not_ panic and is a noop /// rotation. /// /// # Complexity @@ -2884,7 +2884,7 @@ macro_rules! iterator { #[inline] fn try_fold(&mut self, init: B, mut f: F) -> R where - Self: Sized, F: FnMut(B, Self::Item) -> R, R: Try + Self: Sized, F: FnMut(B, Self::Item) -> R, R: Try { // manual unrolling is needed when there are conditional exits from the loop let mut accum = init; @@ -2972,7 +2972,7 @@ macro_rules! iterator { #[inline] fn try_rfold(&mut self, init: B, mut f: F) -> R where - Self: Sized, F: FnMut(B, Self::Item) -> R, R: Try + Self: Sized, F: FnMut(B, Self::Item) -> R, R: Try { // manual unrolling is needed when there are conditional exits from the loop let mut accum = init; @@ -3036,7 +3036,7 @@ macro_rules! iterator { #[stable(feature = "rust1", since = "1.0.0")] pub struct Iter<'a, T: 'a> { ptr: *const T, - end: *const T, // If T is a ZST, this is actually ptr+len. This encoding is picked so that + end: *const T, // If T is a ZST, this is actually ptr+len. This encoding is picked so that // ptr == end is a quick test for the Iterator being empty, that works // for both ZST and non-ZST. _marker: marker::PhantomData<&'a T>, @@ -3128,7 +3128,7 @@ impl AsRef<[T]> for Iter<'_, T> { #[stable(feature = "rust1", since = "1.0.0")] pub struct IterMut<'a, T: 'a> { ptr: *mut T, - end: *mut T, // If T is a ZST, this is actually ptr+len. This encoding is picked so that + end: *mut T, // If T is a ZST, this is actually ptr+len. This encoding is picked so that // ptr == end is a quick test for the Iterator being empty, that works // for both ZST and non-ZST. _marker: marker::PhantomData<&'a mut T>, @@ -3512,7 +3512,7 @@ struct GenericSplitN { count: usize, } -impl> Iterator for GenericSplitN { +impl> Iterator for GenericSplitN { type Item = T; #[inline] diff --git a/src/libcore/slice/sort.rs b/src/libcore/slice/sort.rs index dd9b49fb7a002..10a397fa581ef 100644 --- a/src/libcore/slice/sort.rs +++ b/src/libcore/slice/sort.rs @@ -88,7 +88,7 @@ fn shift_tail(v: &mut [T], is_less: &mut F) /// Partially sorts a slice by shifting several out-of-order elements around. /// -/// Returns `true` if the slice is sorted at the end. This function is `O(n)` worst-case. +/// Returns whether the slice is sorted at the end. This function is `O(n)` worst-case. #[cold] fn partial_insertion_sort(v: &mut [T], is_less: &mut F) -> bool where F: FnMut(&T, &T) -> bool @@ -225,7 +225,7 @@ fn partition_in_blocks(v: &mut [T], pivot: &T, is_less: &mut F) -> usize let mut end_r = ptr::null_mut(); let mut offsets_r = MaybeUninit::<[u8; BLOCK]>::uninitialized(); - // FIXME: When we get VLAs, try creating one array of length `min(v.len(), 2 * BLOCK)` rather + // FIXME: when we get VLAs, try creating one array of length `min(v.len(), 2 * BLOCK)` rather // than two fixed-size arrays of length `BLOCK`. VLAs might be more cache-efficient. // Returns the number of elements between pointers `l` (inclusive) and `r` (exclusive). diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs index 689d456d41246..eb44ef1896443 100644 --- a/src/libcore/str/mod.rs +++ b/src/libcore/str/mod.rs @@ -1407,7 +1407,7 @@ Section: UTF-8 validation // use truncation to fit u64 into usize const NONASCII_MASK: usize = 0x80808080_80808080u64 as usize; -/// Returns `true` if any byte in the word `x` is nonascii (>= 128). +/// Returns whether any byte in the word `x` is nonascii (>= 128). #[inline] fn contains_nonascii(x: usize) -> bool { (x & NONASCII_MASK) != 0 @@ -2125,7 +2125,7 @@ impl str { self.as_bytes().len() } - /// Returns `true` if `self` has a length of zero bytes. + /// Returns whether `self` has a length of zero bytes. /// /// # Examples /// @@ -2858,7 +2858,7 @@ impl str { EncodeUtf16 { chars: self.chars(), extra: 0 } } - /// Returns `true` if the given pattern matches a sub-slice of + /// Returns whether the given pattern matches a sub-slice of /// this string slice. /// /// Returns `false` if it does not. @@ -2879,7 +2879,7 @@ impl str { pat.is_contained_in(self) } - /// Returns `true` if the given pattern matches a prefix of this + /// Returns whether the given pattern matches a prefix of this /// string slice. /// /// Returns `false` if it does not. @@ -2899,7 +2899,7 @@ impl str { pat.is_prefix_of(self) } - /// Returns `true` if the given pattern matches a suffix of this + /// Returns whether the given pattern matches a suffix of this /// string slice. /// /// Returns `false` if it does not. diff --git a/src/libcore/tests/hash/mod.rs b/src/libcore/tests/hash/mod.rs index 135f4dfcac7d5..789a5fc824f92 100644 --- a/src/libcore/tests/hash/mod.rs +++ b/src/libcore/tests/hash/mod.rs @@ -111,7 +111,7 @@ fn test_custom_state() { assert_eq!(hash(&Custom { hash: 5 }), 5); } -// FIXME: Instantiated functions with i128 in the signature is not supported in Emscripten. +// FIXME: instantiated functions with i128 in the signature is not supported in Emscripten. // See https://github.com/kripken/emscripten-fastcomp/issues/169 #[cfg(not(target_os = "emscripten"))] #[test] diff --git a/src/libcore/tests/num/dec2flt/mod.rs b/src/libcore/tests/num/dec2flt/mod.rs index 8f1cd32c3563c..2b582cf8a7fea 100644 --- a/src/libcore/tests/num/dec2flt/mod.rs +++ b/src/libcore/tests/num/dec2flt/mod.rs @@ -23,7 +23,7 @@ macro_rules! test_literal { }) } -#[cfg_attr(all(target_arch = "wasm32", target_os = "emscripten"), ignore)] // issue 42630 +#[cfg_attr(all(target_arch = "wasm32", target_os = "emscripten"), ignore)] // issue #42630 #[test] fn ordinary() { test_literal!(1.0); @@ -34,7 +34,7 @@ fn ordinary() { test_literal!(2.2250738585072014e-308); } -#[cfg_attr(all(target_arch = "wasm32", target_os = "emscripten"), ignore)] // issue 42630 +#[cfg_attr(all(target_arch = "wasm32", target_os = "emscripten"), ignore)] // issue #42630 #[test] fn special_code_paths() { test_literal!(36893488147419103229.0); // 2^65 - 3, triggers half-to-even with even significand diff --git a/src/libcore/tests/num/dec2flt/rawfp.rs b/src/libcore/tests/num/dec2flt/rawfp.rs index 747c1bfa3f9c2..002f8a22a41b4 100644 --- a/src/libcore/tests/num/dec2flt/rawfp.rs +++ b/src/libcore/tests/num/dec2flt/rawfp.rs @@ -76,7 +76,7 @@ fn rounding_overflow() { assert_eq!(rounded.k, adjusted_k + 1); } -#[cfg_attr(all(target_arch = "wasm32", target_os = "emscripten"), ignore)] // issue 42630 +#[cfg_attr(all(target_arch = "wasm32", target_os = "emscripten"), ignore)] // issue #42630 #[test] fn prev_float_monotonic() { let mut x = 1.0; @@ -112,7 +112,7 @@ fn next_float_inf() { assert_eq!(next_float(f64::INFINITY), f64::INFINITY); } -#[cfg_attr(all(target_arch = "wasm32", target_os = "emscripten"), ignore)] // issue 42630 +#[cfg_attr(all(target_arch = "wasm32", target_os = "emscripten"), ignore)] // issue #42630 #[test] fn next_prev_identity() { for &x in &SOME_FLOATS { @@ -123,7 +123,7 @@ fn next_prev_identity() { } } -#[cfg_attr(all(target_arch = "wasm32", target_os = "emscripten"), ignore)] // issue 42630 +#[cfg_attr(all(target_arch = "wasm32", target_os = "emscripten"), ignore)] // issue #42630 #[test] fn next_float_monotonic() { let mut x = 0.49999999999999; diff --git a/src/libcore/tests/num/flt2dec/strategy/dragon.rs b/src/libcore/tests/num/flt2dec/strategy/dragon.rs index 1803e39b46df3..0cec78d3f9274 100644 --- a/src/libcore/tests/num/flt2dec/strategy/dragon.rs +++ b/src/libcore/tests/num/flt2dec/strategy/dragon.rs @@ -14,7 +14,7 @@ fn test_mul_pow10() { } } -#[cfg_attr(all(target_arch = "wasm32", target_os = "emscripten"), ignore)] // issue 42630 +#[cfg_attr(all(target_arch = "wasm32", target_os = "emscripten"), ignore)] // issue #42630 #[test] fn shortest_sanity_test() { f64_shortest_sanity_test(format_shortest); diff --git a/src/libcore/tests/num/flt2dec/strategy/grisu.rs b/src/libcore/tests/num/flt2dec/strategy/grisu.rs index 53e9f12ae0f14..41815be28b716 100644 --- a/src/libcore/tests/num/flt2dec/strategy/grisu.rs +++ b/src/libcore/tests/num/flt2dec/strategy/grisu.rs @@ -27,7 +27,7 @@ fn test_max_pow10_no_more_than() { } -#[cfg_attr(all(target_arch = "wasm32", target_os = "emscripten"), ignore)] // issue 42630 +#[cfg_attr(all(target_arch = "wasm32", target_os = "emscripten"), ignore)] // issue #42630 #[test] fn shortest_sanity_test() { f64_shortest_sanity_test(format_shortest); diff --git a/src/libcore/tests/num/mod.rs b/src/libcore/tests/num/mod.rs index a17c094679ea8..36ac965490593 100644 --- a/src/libcore/tests/num/mod.rs +++ b/src/libcore/tests/num/mod.rs @@ -50,9 +50,9 @@ macro_rules! assume_usize_width { /// Helper function for testing numeric operations pub fn test_num(ten: T, two: T) where T: PartialEq - + Add + Sub - + Mul + Div - + Rem + Debug + + Add + Sub + + Mul + Div + + Rem + Debug + Copy { assert_eq!(ten.add(two), ten + two); diff --git a/src/libcore/tests/pattern.rs b/src/libcore/tests/pattern.rs index b78ed0210770f..f80d38172a69e 100644 --- a/src/libcore/tests/pattern.rs +++ b/src/libcore/tests/pattern.rs @@ -1,7 +1,6 @@ use std::str::pattern::*; -// This macro makes it easier to write -// tests that do a series of iterations +// This macro makes it easier to write tests that do a series of iterations. macro_rules! search_asserts { ($haystack:expr, $needle:expr, $testname:expr, [$($func:ident),*], $result:expr) => { let mut searcher = $needle.into_searcher($haystack); @@ -10,11 +9,10 @@ macro_rules! search_asserts { } } -/// Combined enum for the results of next() and next_match()/next_reject() +/// Combined enum for the results of `next()` and `next_match()`/`next_reject()`. #[derive(Debug, PartialEq, Eq)] enum Step { - // variant names purposely chosen to - // be the same length for easy alignment + // Variant names purposely chosen to be the same length for easy alignment. Matches(usize, usize), Rejects(usize, usize), InRange(usize, usize), @@ -44,11 +42,11 @@ impl From> for Step { // ignore-tidy-linelength -// FIXME(Manishearth) these tests focus on single-character searching (CharSearcher) -// and on next()/next_match(), not next_reject(). This is because -// the memchr changes make next_match() for single chars complex, but next_reject() -// continues to use next() under the hood. We should add more test cases for all -// of these, as well as tests for StrSearcher and higher level tests for str::find() (etc) +// FIXME(Manishearth): these tests focus on single-character searching (`CharSearcher`) +// and on `next()`/`next_match()`, not `next_reject()`. This is because +// the `memchr` changes make `next_match()` for single chars complex, but `next_reject()` +// continues to use `next()` under the hood. We should add more test cases for all +// of these, as well as tests for `StrSearcher` and higher-level tests for `str::find()`, etc. #[test] fn test_simple_iteration() { @@ -106,21 +104,21 @@ fn test_simple_search() { ); } -// Á, 각, ก, 😀 all end in 0x81 -// 🁀, ᘀ do not end in 0x81 but contain the byte -// ꁁ has 0x81 as its second and third bytes. +// `Á`, `각`, `ก`, `😀` all end in `0x81`. +// `🁀`, `ᘀ` do not end in `0x81`, but contain the byte. +// `ꁁ` has `0x81` as its second and third bytes. // -// The memchr-using implementation of next_match -// and next_match_back temporarily violate +// The `memchr`-using implementation of `next_match` +// and `next_match_back` temporarily violate // the property that the search is always on a unicode boundary, -// which is fine as long as this never reaches next() or next_back(). -// So we test if next() is correct after each next_match() as well. +// which is fine as long as this never reaches `next()` or `next_back()`. +// So we test if `next()` is correct after each `next_match()` as well. const STRESS: &str = "Áa🁀bÁꁁfg😁각กᘀ각aÁ각ꁁก😁a"; #[test] fn test_stress_indices() { - // this isn't really a test, more of documentation on the indices of each character in the stresstest string - + // This isn't really a test -- more of documentation on the indices of each character in the + // stress-test string. search_asserts!(STRESS, 'x', "Indices of characters in stress test", [next, next, next, next, next, next, next, next, next, next, next, next, next, next, next, next, next, next, next, next, next], [Rejects(0, 2), // Á @@ -255,8 +253,7 @@ fn test_reverse_search_shared_bytes() { #[test] fn double_ended_regression_test() { - // https://github.com/rust-lang/rust/issues/47175 - // Ensures that double ended searching comes to a convergence + // Issue #47175: ensure that double-ended searching comes to a convergence. search_asserts!("abcdeabcdeabcde", 'a', "alternating double ended search", [next_match, next_match_back, next_match, next_match_back], [InRange(0, 1), InRange(10, 11), InRange(5, 6), Done] diff --git a/src/libcore/tests/slice.rs b/src/libcore/tests/slice.rs index 2c96efbda7673..4bd4384a6d1fb 100644 --- a/src/libcore/tests/slice.rs +++ b/src/libcore/tests/slice.rs @@ -808,7 +808,7 @@ mod slice_index { // optional: // // one or more similar inputs for which data[input] succeeds, - // and the corresponding output as an array. This helps validate + // and the corresponding output as an array. This helps validate // "critical points" where an input range straddles the boundary // between valid and invalid. // (such as the input `len..len`, which is just barely valid) diff --git a/src/libcore/time.rs b/src/libcore/time.rs index b12ee0497d2c2..aa80317670a99 100644 --- a/src/libcore/time.rs +++ b/src/libcore/time.rs @@ -663,14 +663,14 @@ macro_rules! sum_durations { #[stable(feature = "duration_sum", since = "1.16.0")] impl Sum for Duration { - fn sum>(iter: I) -> Duration { + fn sum>(iter: I) -> Duration { sum_durations!(iter) } } #[stable(feature = "duration_sum", since = "1.16.0")] impl<'a> Sum<&'a Duration> for Duration { - fn sum>(iter: I) -> Duration { + fn sum>(iter: I) -> Duration { sum_durations!(iter) } } diff --git a/src/libgraphviz/lib.rs b/src/libgraphviz/lib.rs index 164dec97b8fdb..449ec6a72c3fa 100644 --- a/src/libgraphviz/lib.rs +++ b/src/libgraphviz/lib.rs @@ -613,7 +613,7 @@ pub fn default_options() -> Vec { pub fn render<'a,N,E,G,W>(g: &'a G, w: &mut W) -> io::Result<()> where N: Clone + 'a, E: Clone + 'a, - G: Labeller<'a, Node=N, Edge=E> + GraphWalk<'a, Node=N, Edge=E>, + G: Labeller<'a, Node = N, Edge = E> + GraphWalk<'a, Node = N, Edge = E>, W: Write { render_opts(g, w, &[]) @@ -627,7 +627,7 @@ pub fn render_opts<'a, N, E, G, W>(g: &'a G, -> io::Result<()> where N: Clone + 'a, E: Clone + 'a, - G: Labeller<'a, Node=N, Edge=E> + GraphWalk<'a, Node=N, Edge=E>, + G: Labeller<'a, Node = N, Edge = E> + GraphWalk<'a, Node = N, Edge = E>, W: Write { writeln!(w, "digraph {} {{", g.graph_id().as_slice())?; diff --git a/src/libpanic_unwind/dummy.rs b/src/libpanic_unwind/dummy.rs index b052f76e2a3a8..3a00d6376658c 100644 --- a/src/libpanic_unwind/dummy.rs +++ b/src/libpanic_unwind/dummy.rs @@ -1,6 +1,6 @@ -//! Unwinding for wasm32 +//! Unwinding for *wasm32* target. //! -//! Right now we don't support this, so this is just stubs +//! Right now we don't support this, so this is just stubs. use alloc::boxed::Box; use core::any::Any; diff --git a/src/libpanic_unwind/dwarf/eh.rs b/src/libpanic_unwind/dwarf/eh.rs index ce7fab8584a28..c3fcbfa3208fc 100644 --- a/src/libpanic_unwind/dwarf/eh.rs +++ b/src/libpanic_unwind/dwarf/eh.rs @@ -6,7 +6,7 @@ //! http://www.airs.com/blog/archives/464 //! //! A reference implementation may be found in the GCC source tree -//! (/libgcc/unwind-c.c as of this writing) +//! (`/libgcc/unwind-c.c` as of this writing). #![allow(non_upper_case_globals)] #![allow(unused)] @@ -100,7 +100,7 @@ pub unsafe fn find_eh_action(lsda: *const u8, context: &EHContext) } } } - // Ip is not present in the table. This should not happen... but it does: issue #35011. + // Ip is not present in the table. This should not happen... but it does: issue #35011. // So rather than returning EHAction::Terminate, we do this. Ok(EHAction::None) } else { diff --git a/src/libpanic_unwind/dwarf/mod.rs b/src/libpanic_unwind/dwarf/mod.rs index eb5fb81f61b83..0360696426dc9 100644 --- a/src/libpanic_unwind/dwarf/mod.rs +++ b/src/libpanic_unwind/dwarf/mod.rs @@ -1,5 +1,5 @@ //! Utilities for parsing DWARF-encoded data streams. -//! See http://www.dwarfstd.org, +//! See , //! DWARF-4 standard, Section 7 - "Data Representation" // This module is used only by x86_64-pc-windows-gnu for now, but we diff --git a/src/libpanic_unwind/emcc.rs b/src/libpanic_unwind/emcc.rs index 45c9244a46fcd..1f5ccfb0f1210 100644 --- a/src/libpanic_unwind/emcc.rs +++ b/src/libpanic_unwind/emcc.rs @@ -1,9 +1,9 @@ -//! Unwinding for emscripten +//! Unwinding for *emscripten* target. //! //! Whereas Rust's usual unwinding implementation for Unix platforms -//! calls into the libunwind APIs directly, on emscripten we instead +//! calls into the libunwind APIs directly, on Emscripten we instead //! call into the C++ unwinding APIs. This is just an expedience since -//! emscripten's runtime always implements those APIs and does not +//! Emscripten's runtime always implements those APIs and does not //! implement libunwind. #![allow(private_no_mangle_fns)] diff --git a/src/libpanic_unwind/gcc.rs b/src/libpanic_unwind/gcc.rs index 065403aba1b98..ae47710ec41ea 100644 --- a/src/libpanic_unwind/gcc.rs +++ b/src/libpanic_unwind/gcc.rs @@ -1,4 +1,4 @@ -//! Implementation of panics backed by libgcc/libunwind (in some form) +//! Implementation of panics backed by libgcc/libunwind (in some form). //! //! For background on exception handling and stack unwinding please see //! "Exception Handling in LLVM" (llvm.org/docs/ExceptionHandling.html) and @@ -23,14 +23,14 @@ //! //! In the search phase, the job of a personality routine is to examine //! exception object being thrown, and to decide whether it should be caught at -//! that stack frame. Once the handler frame has been identified, cleanup phase +//! that stack frame. Once the handler frame has been identified, cleanup phase //! begins. //! //! In the cleanup phase, the unwinder invokes each personality routine again. //! This time it decides which (if any) cleanup code needs to be run for -//! the current stack frame. If so, the control is transferred to a special +//! the current stack frame. If so, the control is transferred to a special //! branch in the function body, the "landing pad", which invokes destructors, -//! frees memory, etc. At the end of the landing pad, control is transferred +//! frees memory, etc. At the end of the landing pad, control is transferred //! back to the unwinder and unwinding resumes. //! //! Once stack has been unwound down to the handler frame level, unwinding stops @@ -39,7 +39,7 @@ //! ## `eh_personality` and `eh_unwind_resume` //! //! These language items are used by the compiler when generating unwind info. -//! The first one is the personality routine described above. The second one +//! The first one is the personality routine described above. The second one //! allows compilation target to customize the process of resuming unwind at the //! end of the landing pads. `eh_unwind_resume` is used only if //! `custom_unwind_resume` flag in the target options is set. @@ -91,7 +91,7 @@ pub unsafe fn cleanup(ptr: *mut u8) -> Box { cause.unwrap() } -// Rust's exception class identifier. This is used by personality routines to +// Rust's exception class identifier. This is used by personality routines to // determine whether the exception was thrown by their own runtime. fn rust_exception_class() -> uw::_Unwind_Exception_Class { // M O Z \0 R U S T -- vendor, language @@ -103,7 +103,7 @@ fn rust_exception_class() -> uw::_Unwind_Exception_Class { // and TargetLowering::getExceptionSelectorRegister() for each architecture, // then mapped to DWARF register numbers via register definition tables // (typically RegisterInfo.td, search for "DwarfRegNum"). -// See also http://llvm.org/docs/WritingAnLLVMBackend.html#defining-a-register. +// See also . #[cfg(target_arch = "x86")] const UNWIND_DATA_REG: (i32, i32) = (0, 2); // EAX, EDX @@ -126,12 +126,12 @@ const UNWIND_DATA_REG: (i32, i32) = (6, 7); // R6, R7 #[cfg(target_arch = "sparc64")] const UNWIND_DATA_REG: (i32, i32) = (24, 25); // I0, I1 -// The following code is based on GCC's C and C++ personality routines. For reference, see: +// 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 // The personality routine for most of our targets, except ARM, which has a slightly different ABI -// (however, iOS goes here as it uses SjLj unwinding). Also, the 64-bit Windows implementation +// (however, iOS goes here as it uses SjLj unwinding). Also, the 64-bit Windows implementation // lives in seh64_gnu.rs #[cfg(all(any(target_os = "ios", target_os = "netbsd", not(target_arch = "arm"))))] #[lang = "eh_personality"] @@ -281,12 +281,12 @@ unsafe extern "C" fn rust_eh_unwind_resume(panic_ctx: *mut u8) -> ! { uw::_Unwind_Resume(panic_ctx as *mut uw::_Unwind_Exception); } -// Frame unwind info registration +// Frame unwind info registration. // // Each module's image contains a frame unwind info section (usually -// ".eh_frame"). When a module is loaded/unloaded into the process, the +// ".eh_frame"). When a module is loaded/unloaded into the process, the // unwinder must be informed about the location of this section in memory. The -// methods of achieving that vary by the platform. On some (e.g., Linux), the +// methods of achieving that vary by the platform. On some (e.g., Linux), the // unwinder can discover unwind info sections on its own (by dynamically // enumerating currently loaded modules via the dl_iterate_phdr() API and // finding their ".eh_frame" sections); Others, like Windows, require modules diff --git a/src/libproc_macro/bridge/client.rs b/src/libproc_macro/bridge/client.rs index 3095c8041f2c1..bea2c9802fe99 100644 --- a/src/libproc_macro/bridge/client.rs +++ b/src/libproc_macro/bridge/client.rs @@ -288,7 +288,7 @@ impl BridgeState<'_> { impl Bridge<'_> { fn enter(self, f: impl FnOnce() -> R) -> R { // Hide the default panic output within `proc_macro` expansions. - // NB. the server can't do this because it may use a different libstd. + // N.B., the server can't do this because it may use a different libstd. static HIDE_PANICS_DURING_EXPANSION: Once = Once::new(); HIDE_PANICS_DURING_EXPANSION.call_once(|| { let prev = panic::take_hook(); diff --git a/src/libproc_macro/lib.rs b/src/libproc_macro/lib.rs index 868190d01057d..e169c86bd9634 100644 --- a/src/libproc_macro/lib.rs +++ b/src/libproc_macro/lib.rs @@ -384,7 +384,7 @@ impl SourceFile { PathBuf::from(self.0.path()) } - /// Returns `true` if this source file is a real source file, and not generated by an external + /// Returns whether this source file is a real source file, and not generated by an external /// macro's expansion. #[unstable(feature = "proc_macro_span", issue = "54725")] pub fn is_real(&self) -> bool { diff --git a/src/librustc/cfg/construct.rs b/src/librustc/cfg/construct.rs index 978d20ea94789..f257dd90dd622 100644 --- a/src/librustc/cfg/construct.rs +++ b/src/librustc/cfg/construct.rs @@ -160,7 +160,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> { } } - fn pats_all<'b, I: Iterator>>(&mut self, + fn pats_all<'b, I: Iterator>>(&mut self, pats: I, pred: CFGIndex) -> CFGIndex { //! Handles case where all of the patterns must match. @@ -399,7 +399,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> { } } - fn call<'b, I: Iterator>(&mut self, + fn call<'b, I: Iterator>(&mut self, call_expr: &hir::Expr, pred: CFGIndex, func_or_rcvr: &hir::Expr, @@ -414,7 +414,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> { } } - fn exprs<'b, I: Iterator>(&mut self, + fn exprs<'b, I: Iterator>(&mut self, exprs: I, pred: CFGIndex) -> CFGIndex { //! Constructs graph for `exprs` evaluated in order @@ -428,7 +428,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> { opt_expr.iter().fold(pred, |p, e| self.expr(&e, p)) } - fn straightline<'b, I: Iterator>(&mut self, + fn straightline<'b, I: Iterator>(&mut self, expr: &hir::Expr, pred: CFGIndex, subexprs: I) -> CFGIndex { @@ -485,7 +485,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> { // #47295: We used to have very special case code // here for when a pair of arms are both formed // solely from constants, and if so, not add these - // edges. But this was not actually sound without + // edges. But this was not actually sound without // other constraints that we stopped enforcing at // some point. while let Some(prev) = prev_guards.pop() { diff --git a/src/librustc/dep_graph/dep_node.rs b/src/librustc/dep_graph/dep_node.rs index 070551c0b7b0a..f488902966a3c 100644 --- a/src/librustc/dep_graph/dep_node.rs +++ b/src/librustc/dep_graph/dep_node.rs @@ -151,7 +151,7 @@ macro_rules! define_dep_nodes { } } - // FIXME: Make `is_anon`, `is_input`, `is_eval_always` and `has_params` properties + // FIXME: make `is_anon`, `is_input`, `is_eval_always` and `has_params` properties // of queries #[inline(always)] pub fn is_anon(&self) -> bool { @@ -428,23 +428,23 @@ define_dep_nodes!( <'tcx> [] Null, // Represents the `Krate` as a whole (the `hir::Krate` value) (as - // distinct from the krate module). This is basically a hash of + // distinct from the `krate` module). This is basically a hash of // the entire krate, so if you read from `Krate` (e.g., by calling // `tcx.hir().krate()`), we will have to assume that any change // means that you need to be recompiled. This is because the // `Krate` value gives you access to all other items. To avoid // this fate, do not call `tcx.hir().krate()`; instead, prefer - // wrappers like `tcx.visit_all_items_in_krate()`. If there is no + // wrappers like `tcx.visit_all_items_in_krate()`. If there is no // suitable wrapper, you can use `tcx.dep_graph.ignore()` to gain - // access to the krate, but you must remember to add suitable + // access to the crate, but you must remember to add suitable // edges yourself for the individual items that you read. [input] Krate, - // Represents the body of a function or method. The def-id is that of the + // Represents the body of a function or method. The def-ID is that of the // function/method. [input] HirBody(DefId), - // Represents the HIR node with the given node-id + // Represents the HIR node with the given node-ID [input] Hir(DefId), // Represents metadata from an extern crate. diff --git a/src/librustc/dep_graph/graph.rs b/src/librustc/dep_graph/graph.rs index 961638151a2a8..ed11d66fe2c96 100644 --- a/src/librustc/dep_graph/graph.rs +++ b/src/librustc/dep_graph/graph.rs @@ -673,11 +673,11 @@ impl DepGraph { if did_allocation { // Only the thread which did the allocation emits the error messages - // FIXME: Ensure that these are printed before returning for all threads. + // FIXME: ensure that these are printed before returning for all threads. // Currently threads where did_allocation = false can continue on // and emit other diagnostics before these diagnostics are emitted. // Such diagnostics should be emitted after these. - // See https://github.com/rust-lang/rust/issues/48685 + // See issue #48685. let diagnostics = tcx.queries.on_disk_cache .load_diagnostics(tcx, prev_dep_node_index); @@ -708,7 +708,7 @@ impl DepGraph { Some(dep_node_index) } - // Returns true if the given node has been marked as green during the + // Returns whether the given node has been marked as green during the // current compilation session. Used in various assertions pub fn is_green(&self, dep_node: &DepNode) -> bool { self.node_color(dep_node).map(|c| c.is_green()).unwrap_or(false) @@ -836,7 +836,7 @@ pub(super) struct CurrentDepGraph { // problem during red-green marking: The color of an anonymous node from // the current session might "shadow" the color of the node with the same // ID from the previous session. In order to side-step this problem, we make - // sure that anon-node IDs allocated in different sessions don't overlap. + // sure that anon-node-IDs allocated in different sessions don't overlap. // This is implemented by mixing a session-key into the ID fingerprint of // each anon node. The session-key is just a random number generated when // the DepGraph is created. diff --git a/src/librustc/diagnostics.rs b/src/librustc/diagnostics.rs index 4bc52e82f9be1..c41d16c9a8f23 100644 --- a/src/librustc/diagnostics.rs +++ b/src/librustc/diagnostics.rs @@ -642,7 +642,7 @@ attributes: #![no_std] ``` -See also https://doc.rust-lang.org/book/first-edition/no-stdlib.html +See also . "##, E0214: r##" diff --git a/src/librustc/hir/def.rs b/src/librustc/hir/def.rs index 20ec620a281fd..2b3868c721022 100644 --- a/src/librustc/hir/def.rs +++ b/src/librustc/hir/def.rs @@ -187,7 +187,7 @@ impl PerNS> { } /// Returns an iterator over the items which are `Some`. - pub fn present_items(self) -> impl Iterator { + pub fn present_items(self) -> impl Iterator { use std::iter::once; once(self.type_ns) diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs index 359bd37488241..713485f56811a 100644 --- a/src/librustc/hir/lowering.rs +++ b/src/librustc/hir/lowering.rs @@ -15,7 +15,7 @@ //! 'folding' an existing one), then you create a new id using `next_id()`. //! //! You must ensure that ids are unique. That means that you should only use the -//! id from an AST node in a single HIR node (you can assume that AST node ids +//! id from an AST node in a single HIR node (you can assume that AST node-IDs //! are unique). Every new node must have a unique id. Avoid cloning HIR nodes. //! If you do, you must then set the new node's id to a fresh one. //! @@ -139,7 +139,7 @@ pub trait Resolver { is_value: bool, ) -> hir::Path; - /// Obtain the resolution for a node-id. + /// Obtain the resolution for a node-ID. fn get_resolution(&mut self, id: NodeId) -> Option; /// Obtain the possible resolutions for the given `use` statement. @@ -266,10 +266,10 @@ enum ParenthesizedGenericArgs { } /// What to do when we encounter an **anonymous** lifetime -/// reference. Anonymous lifetime references come in two flavors. You +/// reference. Anonymous lifetime references come in two flavors. You /// have implicit, or fully elided, references to lifetimes, like the /// one in `&T` or `Ref`, and you have `'_` lifetimes, like `&'_ T` -/// or `Ref<'_, T>`. These often behave the same, but not always: +/// or `Ref<'_, T>`. These often behave the same, but not always: /// /// - certain usages of implicit references are deprecated, like /// `Ref`, and we sometimes just give hard errors in those cases @@ -600,7 +600,7 @@ impl<'a> LoweringContext<'a> { .resolver .definitions() .opt_def_index(owner) - .expect("You forgot to call `create_def_with_parent` or are lowering node ids \ + .expect("You forgot to call `create_def_with_parent` or are lowering node-IDs \ that do not belong to the current owner"); hir::HirId { @@ -3074,7 +3074,7 @@ impl<'a> LoweringContext<'a> { // // The first two are produced by recursively invoking // `lower_use_tree` (and indeed there may be things - // like `use foo::{a::{b, c}}` and so forth). They + // like `use foo::{a::{b, c}}` and so forth). They // wind up being directly added to // `self.items`. However, the structure of this // function also requires us to return one item, and @@ -3155,7 +3155,7 @@ impl<'a> LoweringContext<'a> { // because that affects rustdoc and also the lints // about `pub` items. But we can't *always* make it // private -- particularly not for restricted paths -- - // because it contains node-ids that would then be + // because it contains node-IDs that would then be // unused, failing the check that HirIds are "densely // assigned". match vis.node { @@ -3178,7 +3178,7 @@ impl<'a> LoweringContext<'a> { /// Paths like the visibility path in `pub(super) use foo::{bar, baz}` are repeated /// many times in the HIR tree; for each occurrence, we need to assign distinct - /// node-ids. (See e.g., #56128.) + /// node-IDs. (See e.g., #56128.) fn renumber_segment_ids(&mut self, path: &P) -> P { debug!("renumber_segment_ids(path = {:?})", path); let mut path = path.clone(); @@ -4890,7 +4890,7 @@ impl<'a> LoweringContext<'a> { }) } - /// Given suffix ["b","c","d"], returns path `::std::b::c::d` when + /// Given the suffix `["b", "c", "d"]`, returns the path `::std::b::c::d` when /// `fld.cx.use_std`, and `::core::b::c::d` otherwise. /// The path is also resolved according to `is_value`. fn std_path( @@ -4904,7 +4904,6 @@ impl<'a> LoweringContext<'a> { .resolve_str_path(span, self.crate_root, components, is_value); path.segments.last_mut().unwrap().args = params; - for seg in path.segments.iter_mut() { if let Some(id) = seg.id { seg.id = Some(self.lower_node_id(id).node_id); @@ -5031,7 +5030,7 @@ impl<'a> LoweringContext<'a> { /// `Box`. In those cases, `lower_lifetime` is invoked. fn elided_dyn_bound(&mut self, span: Span) -> hir::Lifetime { match self.anonymous_lifetime_mode { - // NB. We intentionally ignore the create-parameter mode here. + // N.B., we intentionally ignore the create-parameter mode here. // and instead "pass through" to resolve-lifetimes, which will apply // the object-lifetime-defaulting rules. Elided object lifetime defaults // do not act like other elided lifetimes. In other words, given this: diff --git a/src/librustc/hir/map/blocks.rs b/src/librustc/hir/map/blocks.rs index 837a20ac0f2f0..20f2749e9ec26 100644 --- a/src/librustc/hir/map/blocks.rs +++ b/src/librustc/hir/map/blocks.rs @@ -1,5 +1,5 @@ //! This module provides a simplified abstraction for working with -//! code blocks identified by their integer node-id. In particular, +//! code blocks identified by their integer node-ID. In particular, //! it captures a common set of attributes that all "function-like //! things" (represented by `FnLike` instances) share. For example, //! all `FnLike` instances have a type signature (be it explicit or diff --git a/src/librustc/hir/map/collector.rs b/src/librustc/hir/map/collector.rs index 78acea9f58814..f7a320da089d8 100644 --- a/src/librustc/hir/map/collector.rs +++ b/src/librustc/hir/map/collector.rs @@ -250,7 +250,7 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> { }; let forgot_str = if hir_id == ::hir::DUMMY_HIR_ID { - format!("\nMaybe you forgot to lower the node id {:?}?", id) + format!("\nMaybe you forgot to lower the node-ID {:?}?", id) } else { String::new() }; diff --git a/src/librustc/hir/map/def_collector.rs b/src/librustc/hir/map/def_collector.rs index bc0a64ae7c5d8..5827a29885337 100644 --- a/src/librustc/hir/map/def_collector.rs +++ b/src/librustc/hir/map/def_collector.rs @@ -12,7 +12,7 @@ use syntax_pos::Span; use hir::map::{ITEM_LIKE_SPACE, REGULAR_SPACE}; -/// Creates def ids for nodes in the AST. +/// Creates def-IDs for nodes in the AST. pub struct DefCollector<'a> { definitions: &'a mut Definitions, parent_def: Option, diff --git a/src/librustc/hir/map/definitions.rs b/src/librustc/hir/map/definitions.rs index 6b707dd2dcc80..8ab1984d8434c 100644 --- a/src/librustc/hir/map/definitions.rs +++ b/src/librustc/hir/map/definitions.rs @@ -1,5 +1,5 @@ -//! For each definition, we track the following data. A definition -//! here is defined somewhat circularly as "something with a def-id", +//! For each definition, we track the following data. A definition +//! here is defined somewhat circularly as "something with a def-ID", //! but it generally corresponds to things like structs, enums, etc. //! There are also some rather random cases (like const initializer //! expressions) that are mostly just leftovers. @@ -22,17 +22,17 @@ use syntax::symbol::{Symbol, InternedString}; use syntax_pos::{Span, DUMMY_SP}; use util::nodemap::NodeMap; -/// The DefPathTable maps DefIndexes to DefKeys and vice versa. -/// Internally the DefPathTable holds a tree of DefKeys, where each DefKey -/// stores the DefIndex of its parent. -/// There is one DefPathTable for each crate. +/// Maps `DefIndex`es to `DefKey`s and vice versa. +/// Internally, holds a tree of `DefKey`s, where each `DefKey` +/// stores the `DefIndex` of its parent. +/// There is one `DefPathTable` for each crate. #[derive(Default)] pub struct DefPathTable { index_to_key: [Vec; 2], def_path_hashes: [Vec; 2], } -// Unfortunately we have to provide a manual impl of Clone because of the +// Unfortunately we have to provide a manual impl of `Clone` because of the // fixed-sized array field. impl Clone for DefPathTable { fn clone(&self) -> Self { @@ -46,7 +46,6 @@ impl Clone for DefPathTable { } impl DefPathTable { - fn allocate(&mut self, key: DefKey, def_path_hash: DefPathHash, @@ -107,14 +106,13 @@ impl DefPathTable { } } - impl Encodable for DefPathTable { fn encode(&self, s: &mut S) -> Result<(), S::Error> { // Index to key self.index_to_key[DefIndexAddressSpace::Low.index()].encode(s)?; self.index_to_key[DefIndexAddressSpace::High.index()].encode(s)?; - // DefPath hashes + // `DefPath` hashes self.def_path_hashes[DefIndexAddressSpace::Low.index()].encode(s)?; self.def_path_hashes[DefIndexAddressSpace::High.index()].encode(s)?; @@ -163,10 +161,10 @@ pub struct Definitions { /// any) with a `DisambiguatedDefPathData`. #[derive(Clone, PartialEq, Debug, Hash, RustcEncodable, RustcDecodable)] pub struct DefKey { - /// Parent path. + /// The parent path. pub parent: Option, - /// Identifier of this node. + /// The identifier of this node. pub disambiguated_data: DisambiguatedDefPathData, } @@ -174,7 +172,7 @@ impl DefKey { fn compute_stable_hash(&self, parent_hash: DefPathHash) -> DefPathHash { let mut hasher = StableHasher::new(); - // We hash a 0u8 here to disambiguate between regular DefPath hashes, + // We hash a `0u8` here to disambiguate between regular `DefPath` hashes // and the special "root_parent" below. 0u8.hash(&mut hasher); parent_hash.hash(&mut hasher); @@ -198,8 +196,8 @@ impl DefKey { crate_disambiguator: CrateDisambiguator) -> DefPathHash { let mut hasher = StableHasher::new(); - // Disambiguate this from a regular DefPath hash, - // see compute_stable_hash() above. + // Disambiguate this from a regular `DefPath` hash; + // see `compute_stable_hash()` above. 1u8.hash(&mut hasher); crate_name.hash(&mut hasher); crate_disambiguator.hash(&mut hasher); @@ -207,12 +205,12 @@ impl DefKey { } } -/// Pair of `DefPathData` and an integer disambiguator. The integer is +/// A pair of `DefPathData` and an integer disambiguator. The integer is /// normally 0, but in the event that there are multiple defs with the /// same `parent` and `data`, we use this field to disambiguate /// between them. This introduces some artificial ordering dependency /// but means that if you have (e.g.) two impls for the same type in -/// the same module, they do get distinct def-ids. +/// the same module, they do get distinct def-IDs. #[derive(Clone, PartialEq, Debug, Hash, RustcEncodable, RustcDecodable)] pub struct DisambiguatedDefPathData { pub data: DefPathData, @@ -221,10 +219,10 @@ pub struct DisambiguatedDefPathData { #[derive(Clone, Debug, Hash, RustcEncodable, RustcDecodable)] pub struct DefPath { - /// the path leading from the crate root to the item + /// The path leading from the crate root to the item. pub data: Vec, - /// what krate root is this path relative to? + /// The crate root this path is relative to. pub krate: CrateNum, } @@ -260,9 +258,9 @@ impl DefPath { DefPath { data: data, krate: krate } } - /// Returns a string representation of the DefPath without + /// Returns a string representation of the `DefPath` without /// the crate-prefix. This method is useful if you don't have - /// a TyCtxt available. + /// a `TyCtxt` available. pub fn to_string_no_crate(&self) -> String { let mut s = String::with_capacity(self.data.len() * 16); @@ -277,7 +275,7 @@ impl DefPath { s } - /// Return filename friendly string of the DefPah with the + /// Returns a filename-friendly string for the `DefPath`, with the /// crate-prefix. pub fn to_string_friendly(&self, crate_imported_name: F) -> String where F: FnOnce(CrateNum) -> Symbol @@ -302,9 +300,9 @@ impl DefPath { s } - /// Return filename friendly string of the DefPah without + /// Returns a filename-friendly string of the `DefPath`, without /// the crate-prefix. This method is useful if you don't have - /// a TyCtxt available. + /// a `TyCtxt` available. pub fn to_filename_friendly_no_crate(&self) -> String { let mut s = String::with_capacity(self.data.len() * 16); @@ -330,48 +328,53 @@ impl DefPath { pub enum DefPathData { // Root: these should only be used for the root nodes, because // they are treated specially by the `def_path` function. - /// The crate root (marker) + + /// The crate root (marker). CrateRoot, - // Catch-all for random DefId things like DUMMY_NODE_ID + // Catch-all for random `DefId` things like `DUMMY_NODE_ID`. Misc, + // Different kinds of items and item-like things: - /// An impl + + /// An impl. Impl, - /// A trait + /// A trait. Trait(InternedString), - /// An associated type **declaration** (i.e., in a trait) + /// An associated type **declaration** (i.e., in a trait). AssocTypeInTrait(InternedString), - /// An associated type **value** (i.e., in an impl) + /// An associated type **value** (i.e., in an impl). AssocTypeInImpl(InternedString), - /// An existential associated type **value** (i.e., in an impl) + /// An existential associated type **value** (i.e., in an impl). AssocExistentialInImpl(InternedString), - /// Something in the type NS + /// Something in the type namespace. TypeNs(InternedString), - /// Something in the value NS + /// Something in the value namespace. ValueNs(InternedString), - /// A module declaration + /// A module declaration. Module(InternedString), - /// A macro rule + /// A macro rule. MacroDef(InternedString), - /// A closure expression + /// A closure expression. ClosureExpr, - // Subportions of items - /// A type parameter (generic parameter) + + // Subportions of items: + + /// A type parameter (generic parameter). TypeParam(InternedString), - /// A lifetime definition + /// A lifetime definition. LifetimeParam(InternedString), - /// A variant of a enum + /// A variant of a enum. EnumVariant(InternedString), - /// A struct field + /// A struct field. Field(InternedString), - /// Implicit ctor for a tuple-like struct + /// Implicit ctor for a tuple-like struct. StructCtor, - /// A constant expression (see {ast,hir}::AnonConst). + /// A constant expression (see `{ast,hir}::AnonConst`). AnonConst, - /// An `impl Trait` type node + /// An `impl Trait` type node. ImplTrait, - /// GlobalMetaData identifies a piece of crate metadata that is global to - /// a whole crate (as opposed to just one item). GlobalMetaData components + /// Identifies a piece of crate metadata that is global to + /// a whole crate (as opposed to just one item). These components /// are only supposed to show up right below the crate root. GlobalMetaData(InternedString) } @@ -392,13 +395,13 @@ impl Borrow for DefPathHash { impl Definitions { /// Create new empty definition map. /// - /// The DefIndex returned from a new Definitions are as follows: - /// 1. At DefIndexAddressSpace::Low, + /// The `DefIndex` returned from a new `Definitions` are as follows: + /// 1. At `DefIndexAddressSpace::Low`, /// CRATE_ROOT has index 0:0, and then new indexes are allocated in /// ascending order. - /// 2. At DefIndexAddressSpace::High, - /// the first FIRST_FREE_HIGH_DEF_INDEX indexes are reserved for - /// internal use, then 1:FIRST_FREE_HIGH_DEF_INDEX are allocated in + /// 2. At `DefIndexAddressSpace::High`, + /// the first `FIRST_FREE_HIGH_DEF_INDEX` indexes are reserved for + /// internal use, then `1:FIRST_FREE_HIGH_DEF_INDEX` are allocated in /// ascending order. /// /// FIXME: there is probably a better place to put this comment. @@ -479,7 +482,7 @@ impl Definitions { } /// Retrieve the span of the given `DefId` if `DefId` is in the local crate, the span exists and - /// it's not DUMMY_SP + /// it's not `DUMMY_SP`. #[inline] pub fn opt_span(&self, def_id: DefId) -> Option { if def_id.krate == LOCAL_CRATE { @@ -514,7 +517,7 @@ impl Definitions { self.def_index_to_node[address_space.index()].push(ast::CRATE_NODE_ID); self.node_to_def_index.insert(ast::CRATE_NODE_ID, root_index); - // Allocate some other DefIndices that always must exist. + // Allocate some other `DefIndex`es that always must exist. GlobalMetaDataKind::allocate_def_indices(self); root_index @@ -533,12 +536,12 @@ impl Definitions { parent, node_id, data); assert!(!self.node_to_def_index.contains_key(&node_id), - "adding a def'n for node-id {:?} and data {:?} but a previous def'n exists: {:?}", + "adding a def'n for node-ID {:?} and data {:?} but a previous def'n exists: {:?}", node_id, data, self.table.def_key(self.node_to_def_index[&node_id])); - // The root node must be created with create_root_def() + // The root node must be created with `create_root_def()`. assert!(data != DefPathData::CrateRoot); // Find the next free disambiguator for this key. @@ -567,9 +570,9 @@ impl Definitions { self.def_index_to_node[address_space.index()].len()); self.def_index_to_node[address_space.index()].push(node_id); - // Some things for which we allocate DefIndices don't correspond to - // anything in the AST, so they don't have a NodeId. For these cases - // we don't need a mapping from NodeId to DefIndex. + // Some things for which we allocate `DefIndex`es don't correspond to + // anything in the AST, so they don't have a `NodeId`. For these cases + // we don't need a mapping from NodeId to `DefIndex`. if node_id != ast::DUMMY_NODE_ID { debug!("create_def_with_parent: def_index_to_node[{:?} <-> {:?}", index, node_id); self.node_to_def_index.insert(node_id, index); @@ -579,7 +582,7 @@ impl Definitions { self.expansions_that_defined.insert(index, expansion); } - // The span is added if it isn't dummy + // The span is added if it isn't dummy. if !span.is_dummy() { self.def_index_to_span.insert(index, span); } @@ -587,7 +590,7 @@ impl Definitions { index } - /// Initialize the ast::NodeId to HirId mapping once it has been generated during + /// Initialize the `ast::NodeId` to `HirId` mapping once it has been generated during /// AST to HIR lowering. pub fn init_node_id_to_hir_id_mapping(&mut self, mapping: IndexVec) { @@ -655,7 +658,7 @@ impl DefPathData { GlobalMetaData(name) => { return name } - // note that this does not show up in user printouts + // Note that this does not show up in user printouts. CrateRoot => "{{root}}", Impl => "{{impl}}", Misc => "{{?}}", @@ -678,9 +681,9 @@ macro_rules! count { ( $x:tt $($xs:tt)* ) => (1usize + count!($($xs)*)); } -// We define the GlobalMetaDataKind enum with this macro because we want to +// We define the `GlobalMetaDataKind` enum with this macro because we want to // make sure that we exhaustively iterate over all variants when registering -// the corresponding DefIndices in the DefTable. +// the corresponding `DefIndex`es in the `DefTable`. macro_rules! define_global_metadata_kind { (pub enum GlobalMetaDataKind { $($variant:ident),* @@ -706,7 +709,7 @@ macro_rules! define_global_metadata_kind { DUMMY_SP ); - // Make sure calling def_index does not crash. + // Make sure that calling `def_index` does not crash. instance.def_index(&definitions.table); })* } @@ -720,7 +723,7 @@ macro_rules! define_global_metadata_kind { } }; - // These DefKeys are all right after the root, + // These `DefKey`s are all right after the root, // so a linear search is fine. let index = def_path_table.index_to_key[GLOBAL_MD_ADDRESS_SPACE.index()] .iter() diff --git a/src/librustc/hir/map/mod.rs b/src/librustc/hir/map/mod.rs index 188d487d64485..2629f46feaa2d 100644 --- a/src/librustc/hir/map/mod.rs +++ b/src/librustc/hir/map/mod.rs @@ -158,8 +158,8 @@ impl Forest { } } -/// Represents a mapping from Node IDs to AST elements and their parent -/// Node IDs +/// Represents a mapping from Node-IDs to AST elements and their parent +/// Node-IDs #[derive(Clone)] pub struct Map<'hir> { /// The backing storage for all the AST nodes. @@ -420,7 +420,7 @@ impl<'hir> Map<'hir> { self.local_def_id(self.body_owner(id)) } - /// Given a node id, returns the `BodyId` associated with it, + /// Given a node-ID, returns the `BodyId` associated with it, /// if the node is a body owner, otherwise returns `None`. pub fn maybe_body_owned_by(&self, id: NodeId) -> Option { if let Some(entry) = self.find_entry(id) { @@ -496,7 +496,7 @@ impl<'hir> Map<'hir> { self.trait_auto_impl(trait_did).is_some() } - /// Get the attributes on the krate. This is preferable to + /// Get the attributes on the crate. This is preferable to /// invoking `krate.attrs` because it registers a tighter /// dep-graph access. pub fn krate_attrs(&self) -> &'hir [ast::Attribute] { @@ -506,15 +506,16 @@ impl<'hir> Map<'hir> { &self.forest.krate.attrs } - /// Retrieve the Node corresponding to `id`, panicking if it cannot + /// Retrieve the `Node` corresponding to `id`, panicking if it cannot /// be found. pub fn get(&self, id: NodeId) -> Node<'hir> { - // read recorded by `find` - self.find(id).unwrap_or_else(|| bug!("couldn't find node id {} in the AST map", id)) + // Read is recorded by `find`. + self.find(id).unwrap_or_else(|| bug!("couldn't find node-ID {} in the AST map", id)) } pub fn get_if_local(&self, id: DefId) -> Option> { - self.as_local_node_id(id).map(|id| self.get(id)) // read recorded by `get` + // Read is recorded by `get`. + self.as_local_node_id(id).map(|id| self.get(id)) } pub fn get_generics(&self, id: DefId) -> Option<&'hir Generics> { @@ -544,7 +545,7 @@ impl<'hir> Map<'hir> { self.get_generics(id).map(|generics| generics.span).filter(|sp| *sp != DUMMY_SP) } - /// Retrieve the Node corresponding to `id`, returning None if + /// Retrieve the `Node` corresponding to `id`, returning `None` if /// cannot be found. pub fn find(&self, id: NodeId) -> Option> { let result = self.find_entry(id).and_then(|entry| { @@ -560,7 +561,7 @@ impl<'hir> Map<'hir> { result } - /// Similar to `get_parent`; returns the parent node-id, or own `id` if there is + /// Similar to `get_parent`; returns the parent node-ID, or own `id` if there is /// no parent. Note that the parent may be `CRATE_NODE_ID`, which is not itself /// present in the map -- so passing the return value of get_parent_node to /// get may actually panic. @@ -603,7 +604,7 @@ impl<'hir> Map<'hir> { /// If there is some error when walking the parents (e.g., a node does not /// have a parent in the map or a node can't be found), then we return the - /// last good node id we found. Note that reaching the crate root (`id == 0`), + /// last good node-ID we found. Note that reaching the crate root (`id == 0`), /// is not an error, since items in the crate module have the crate root as /// parent. fn walk_parent_nodes(&self, @@ -827,8 +828,8 @@ impl<'hir> Map<'hir> { } } - /// Given a node ID, get a list of attributes associated with the AST - /// corresponding to the Node ID + /// Given a node-ID, get a list of attributes associated with the AST + /// corresponding to the Node-ID pub fn attrs(&self, id: NodeId) -> &'hir [ast::Attribute] { self.read(id); // reveals attributes on the node let attrs = match self.find(id) { @@ -849,11 +850,11 @@ impl<'hir> Map<'hir> { attrs.unwrap_or(&[]) } - /// Returns an iterator that yields the node id's with paths that + /// Returns an iterator that yields the node-ID's with paths that /// match `parts`. (Requires `parts` is non-empty.) /// /// For example, if given `parts` equal to `["bar", "quux"]`, then - /// the iterator will produce node id's for items with paths + /// the iterator will produce node-ID's for items with paths /// such as `foo::bar::quux`, `bar::quux`, `other::bar::quux`, and /// any other such items it can find in the map. pub fn nodes_matching_suffix<'a>(&'a self, parts: &'a [String]) @@ -947,7 +948,7 @@ impl<'a, 'hir> NodesMatchingSuffix<'a, 'hir> { // that mod's name. // // If `id` itself is a mod named `m` with parent `p`, then - // returns `Some(id, m, p)`. If `id` has no mod in its parent + // returns `Some(id, m, p)`. If `id` has no mod in its parent // chain, then returns `None`. fn find_first_mod_parent<'a>(map: &'a Map<'_>, mut id: NodeId) -> Option<(NodeId, Name)> { loop { @@ -1256,7 +1257,7 @@ pub fn describe_def(tcx: TyCtxt<'_, '_, '_>, def_id: DefId) -> Option { if let Some(node_id) = tcx.hir().as_local_node_id(def_id) { tcx.hir().describe_def(node_id) } else { - bug!("Calling local describe_def query provider for upstream DefId: {:?}", + bug!("Calling local `describe_def` query provider for upstream `DefId`: {:?}", def_id) } } diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs index 7e87171a5edf7..f958a1d7da5bf 100644 --- a/src/librustc/hir/mod.rs +++ b/src/librustc/hir/mod.rs @@ -1,4 +1,4 @@ -// HIR datatypes. See the [rustc guide] for more info. +// HIR data-types. See the [rustc guide] for more info. //! //! [rustc guide]: https://rust-lang.github.io/rustc-guide/hir.html @@ -14,10 +14,11 @@ use hir::def::Def; use hir::def_id::{DefId, DefIndex, LocalDefId, CRATE_DEF_INDEX}; use util::nodemap::{NodeMap, FxHashSet}; use mir::mono::Linkage; - +use rustc_data_structures::sync::{ParallelIterator, par_iter, Send, Sync, scope}; +use rustc_data_structures::thin_vec::ThinVec; +use rustc_target::spec::abi::Abi; use syntax_pos::{Span, DUMMY_SP, symbol::InternedString}; use syntax::source_map::{self, Spanned}; -use rustc_target::spec::abi::Abi; use syntax::ast::{self, CrateSugar, Ident, Name, NodeId, DUMMY_NODE_ID, AsmDialect}; use syntax::ast::{Attribute, Lit, StrStyle, FloatTy, IntTy, UintTy}; use syntax::attr::InlineAttr; @@ -29,9 +30,6 @@ use syntax::util::parser::ExprPrecedence; use ty::AdtKind; use ty::query::Providers; -use rustc_data_structures::sync::{ParallelIterator, par_iter, Send, Sync, scope}; -use rustc_data_structures::thin_vec::ThinVec; - use serialize::{self, Encoder, Encodable, Decoder, Decodable}; use std::collections::BTreeMap; use std::fmt; @@ -61,14 +59,14 @@ pub mod map; pub mod pat_util; pub mod print; -/// A HirId uniquely identifies a node in the HIR of the current crate. It is -/// composed of the `owner`, which is the DefIndex of the directly enclosing -/// hir::Item, hir::TraitItem, or hir::ImplItem (i.e., the closest "item-like"), +/// Uniquely identifies a node in the HIR of the current crate. It is +/// composed of the `owner`, which is the `DefIndex` of the directly enclosing +/// `hir::Item`, `hir::TraitItem`, or `hir::ImplItem` (i.e., the closest "item-like"), /// and the `local_id` which is unique within the given owner. /// /// This two-level structure makes for more stable values: One can move an item /// around within the source code, or add or remove stuff before it, without -/// the local_id part of the HirId changing, which is a very useful property in +/// the `local_id` part of the `HirId` changing, which is a very useful property in /// incremental compilation where we have to persist things through changes to /// the code base. #[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)] @@ -111,7 +109,7 @@ impl serialize::UseSpecializedDecodable for HirId { } } -// hack to ensure that we don't try to access the private parts of `ItemLocalId` in this module +// HACK: ensure that we don't try to access the private parts of `ItemLocalId` in this module. mod item_local_id_inner { use rustc_data_structures::indexed_vec::Idx; /// An `ItemLocalId` uniquely identifies something within a given "item-like", @@ -129,7 +127,7 @@ mod item_local_id_inner { pub use self::item_local_id_inner::ItemLocalId; -/// The `HirId` corresponding to CRATE_NODE_ID and CRATE_DEF_INDEX +/// The `HirId` corresponding to `CRATE_NODE_ID` and `CRATE_DEF_INDEX`. pub const CRATE_HIR_ID: HirId = HirId { owner: CRATE_DEF_INDEX, local_id: ItemLocalId::from_u32_const(0) @@ -189,7 +187,7 @@ pub enum ParamName { /// Indicates an illegal name was given and an error has been /// repored (so we should squelch other derived errors). Occurs - /// when e.g., `'_` is used in the wrong place. + /// when, e.g., `'_` is used in the wrong place. Error, } @@ -214,17 +212,17 @@ pub enum LifetimeName { /// User-given names or fresh (synthetic) names. Param(ParamName), - /// User typed nothing. e.g., the lifetime in `&u32`. + /// User wrote nothing (e.g., the lifetime in `&u32`). Implicit, /// Indicates an error during lowering (usually `'_` in wrong place) /// that was already reported. Error, - /// User typed `'_`. + /// User wrote specifies `'_`. Underscore, - /// User wrote `'static` + /// User wrote `'static`. Static, } @@ -244,8 +242,8 @@ impl LifetimeName { LifetimeName::Implicit | LifetimeName::Underscore => true, // It might seem surprising that `Fresh(_)` counts as - // *not* elided -- but this is because, as far as the code - // in the compiler is concerned -- `Fresh(_)` variants act + // *not* elided, but this is because, as far as the code + // in the compiler is concerned, `Fresh(_)` variants act // equivalently to "some fresh name". They correspond to // early-bound regions on an impl, in other words. LifetimeName::Error | LifetimeName::Param(_) | LifetimeName::Static => false, @@ -289,7 +287,7 @@ impl Lifetime { } } -/// A "Path" is essentially Rust's notion of a name; for instance: +/// A `Path` is essentially Rust's notion of a name; for instance, /// `std::cmp::PartialEq`. It's represented as a sequence of identifiers, /// along with a bunch of supporting information. #[derive(Clone, RustcEncodable, RustcDecodable)] @@ -379,8 +377,8 @@ impl PathSegment { } } - // FIXME: hack required because you can't create a static - // `GenericArgs`, so you can't just return a `&GenericArgs`. + // HACK: required because you can't create a static `GenericArgs`, + // so you can't just return a `&GenericArgs`. pub fn with_generic_args(&self, f: F) -> R where F: FnOnce(&GenericArgs) -> R { @@ -600,14 +598,14 @@ impl Generics { } } -/// Synthetic Type Parameters are converted to an other form during lowering, this allows -/// to track the original form they had. Useful for error messages. +/// Synthetic type parameters are converted to another form during lowering; this allows +/// us to track the original form they had, and is useful for error messages. #[derive(Copy, Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub enum SyntheticTyParamKind { ImplTrait } -/// A `where` clause in a definition +/// A `where` clause in a definition. #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub struct WhereClause { pub id: NodeId, @@ -626,7 +624,7 @@ impl WhereClause { } } -/// A single predicate in a `where` clause +/// A single predicate in a `where` clause. #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub enum WherePredicate { /// A type binding (e.g., `for<'c> Foo: Send + Clone + 'c`). @@ -647,19 +645,19 @@ impl WherePredicate { } } -/// A type bound, eg `for<'c> Foo: Send+Clone+'c` +/// A type bound (e.g. `for<'c> Foo: Send + Clone + 'c`). #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub struct WhereBoundPredicate { pub span: Span, - /// Any generics from a `for` binding + /// Any generics from a `for` binding. pub bound_generic_params: HirVec, - /// The type being bounded + /// The type being bounded. pub bounded_ty: P, - /// Trait and lifetime bounds (`Clone+Send+'static`) + /// Trait and lifetime bounds (e.g., `Clone + Send + 'static`). pub bounds: GenericBounds, } -/// A lifetime predicate, e.g., `'a: 'b+'c` +/// A lifetime predicate (e.g., `'a: 'b + 'c`). #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub struct WhereRegionPredicate { pub span: Span, @@ -667,7 +665,7 @@ pub struct WhereRegionPredicate { pub bounds: GenericBounds, } -/// An equality predicate (unsupported), e.g., `T=int` +/// An equality predicate (e.g., `T = int`); currently unsupported. #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub struct WhereEqPredicate { pub id: NodeId, @@ -689,7 +687,7 @@ pub struct Crate { pub span: Span, pub exported_macros: HirVec, - // N.B., we use a BTreeMap here so that `visit_all_items` iterates + // N.B., we use a `BTreeMap` here so that `visit_all_items` iterates // over the ids in increasing order. In principle it should not // matter what order we visit things in, but in *practice* it // does, because it can affect the order in which errors are @@ -747,7 +745,7 @@ impl Crate { } } - /// A parallel version of visit_all_item_likes + /// A parallel version of `visit_all_item_likes`. pub fn par_visit_all_item_likes<'hir, V>(&'hir self, visitor: &V) where V: itemlikevisit::ParItemLikeVisitor<'hir> + Sync + Send { @@ -793,14 +791,14 @@ pub struct MacroDef { #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub struct Block { - /// Statements in a block + /// Statements in a block. pub stmts: HirVec, /// An expression at the end of the block - /// without a semicolon, if any + /// without a semicolon, if any. pub expr: Option>, pub id: NodeId, pub hir_id: HirId, - /// Distinguishes between `unsafe { ... }` and `{ ... }` + /// Distinguishes between `unsafe { ... }` and `{ ... }`. pub rules: BlockCheckMode, pub span: Span, /// If true, then there may exist `break 'a` values that aim to @@ -825,7 +823,7 @@ impl fmt::Debug for Pat { } impl Pat { - // FIXME(#19596) this is a workaround, but there should be a better way + // FIXME(#19596): this is a workaround, but there should be a better way. fn walk_(&self, it: &mut G) -> bool where G: FnMut(&Pat) -> bool { @@ -867,17 +865,17 @@ impl Pat { } } -/// A single field in a struct pattern +/// A single field in a struct pattern. /// /// Patterns like the fields of Foo `{ x, ref y, ref mut z }` /// are treated the same as` x: x, y: ref y, z: ref mut z`, -/// except is_shorthand is true +/// except `is_shorthand` is true. #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub struct FieldPat { pub id: NodeId, - /// The identifier for the field + /// The identifier for the field. pub ident: Ident, - /// The pattern the field is destructured to + /// The pattern the field is destructured to. pub pat: P, pub is_shorthand: bool, } @@ -914,41 +912,41 @@ pub enum RangeEnd { #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub enum PatKind { - /// Represents a wildcard pattern (`_`) + /// Represents a wildcard pattern (i.e., `_`). Wild, /// A fresh binding `ref mut binding @ OPT_SUBPATTERN`. /// The `NodeId` is the canonical ID for the variable being bound, - /// e.g., in `Ok(x) | Err(x)`, both `x` use the same canonical ID, + /// (e.g., in `Ok(x) | Err(x)`, both `x` use the same canonical ID), /// which is the pattern ID of the first `x`. Binding(BindingAnnotation, NodeId, Ident, Option>), - /// A struct or struct variant pattern, e.g., `Variant {x, y, ..}`. + /// A struct or struct variant pattern (e.g., `Variant {x, y, ..}`). /// The `bool` is `true` in the presence of a `..`. Struct(QPath, HirVec>, bool), /// A tuple struct/variant pattern `Variant(x, y, .., z)`. /// If the `..` pattern fragment is present, then `Option` denotes its position. - /// 0 <= position <= subpats.len() + /// `0 <= position <= subpats.len()` TupleStruct(QPath, HirVec>, Option), /// A path pattern for an unit struct/variant or a (maybe-associated) constant. Path(QPath), - /// A tuple pattern `(a, b)`. + /// A tuple pattern (e.g., `(a, b)`). /// If the `..` pattern fragment is present, then `Option` denotes its position. - /// 0 <= position <= subpats.len() + /// `0 <= position <= subpats.len()` Tuple(HirVec>, Option), - /// A `box` pattern + /// A `box` pattern. Box(P), - /// A reference pattern, e.g., `&mut (a, b)` + /// A reference pattern (e.g., `&mut (a, b)`). Ref(P, Mutability), - /// A literal + /// A literal. Lit(P), - /// A range pattern, e.g., `1...2` or `1..2` + /// A range pattern (e.g., `1...2` or `1..2`). Range(P, P, RangeEnd), /// `[a, b, ..i, y, z]` is represented as: - /// `PatKind::Slice(box [a, b], Some(i), box [y, z])` + /// `PatKind::Slice(box [a, b], Some(i), box [y, z])`. Slice(HirVec>, Option>, HirVec>), } @@ -959,7 +957,7 @@ pub enum Mutability { } impl Mutability { - /// Return MutMutable only if both arguments are mutable. + /// Returns `MutMutable` only if both arguments are mutable. pub fn and(self, other: Self) -> Self { match self { MutMutable => other, @@ -970,41 +968,41 @@ impl Mutability { #[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Debug, Copy, Hash)] pub enum BinOpKind { - /// The `+` operator (addition) + /// The `+` operator (addition). Add, - /// The `-` operator (subtraction) + /// The `-` operator (subtraction). Sub, - /// The `*` operator (multiplication) + /// The `*` operator (multiplication). Mul, - /// The `/` operator (division) + /// The `/` operator (division). Div, - /// The `%` operator (modulus) + /// The `%` operator (modulus). Rem, - /// The `&&` operator (logical and) + /// The `&&` operator (logical and). And, - /// The `||` operator (logical or) + /// The `||` operator (logical or). Or, - /// The `^` operator (bitwise xor) + /// The `^` operator (bitwise xor). BitXor, - /// The `&` operator (bitwise and) + /// The `&` operator (bitwise and). BitAnd, - /// The `|` operator (bitwise or) + /// The `|` operator (bitwise or). BitOr, - /// The `<<` operator (shift left) + /// The `<<` operator (shift left). Shl, - /// The `>>` operator (shift right) + /// The `>>` operator (shift right). Shr, - /// The `==` operator (equality) + /// The `==` operator (equality). Eq, - /// The `<` operator (less than) + /// The `<` operator (less than). Lt, - /// The `<=` operator (less than or equal to) + /// The `<=` operator (less than or equal to). Le, - /// The `!=` operator (not equal to) + /// The `!=` operator (not equal to). Ne, - /// The `>=` operator (greater than or equal to) + /// The `>=` operator (greater than or equal to). Ge, - /// The `>` operator (greater than) + /// The `>` operator (greater than). Gt, } @@ -1069,7 +1067,7 @@ impl BinOpKind { } } - /// Returns `true` if the binary operator takes its arguments by value + /// Returns whether the binary operator takes its arguments by value. pub fn is_by_value(self) -> bool { !self.is_comparison() } @@ -1104,11 +1102,11 @@ pub type BinOp = Spanned; #[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Debug, Copy, Hash)] pub enum UnOp { - /// The `*` operator for dereferencing + /// The `*` operator (deferencing). UnDeref, - /// The `!` operator for logical inversion + /// The `!` operator (logical negation). UnNot, - /// The `-` operator for negation + /// The `-` operator (negation). UnNeg, } @@ -1121,7 +1119,7 @@ impl UnOp { } } - /// Returns `true` if the unary operator takes its argument by value + /// Returns whether the unary operator takes its argument by value. pub fn is_by_value(self) -> bool { match self { UnNeg | UnNot => true, @@ -1130,7 +1128,7 @@ impl UnOp { } } -/// A statement +/// A statement. pub type Stmt = Spanned; impl fmt::Debug for StmtKind { @@ -1146,13 +1144,13 @@ impl fmt::Debug for StmtKind { #[derive(Clone, RustcEncodable, RustcDecodable)] pub enum StmtKind { - /// Could be an item or a local (let) binding: + /// A declaration; could be an item or a local (let) binding. Decl(P, NodeId), - /// Expr without trailing semi-colon (must have unit type): + /// An expression without a trailing semi-colon (must have unit type). Expr(P, NodeId), - /// Expr with trailing semi-colon (may have any type): + /// An expression with a trailing semi-colon (may have any type). Semi(P, NodeId), } @@ -1174,12 +1172,12 @@ impl StmtKind { } } -/// Local represents a `let` statement, e.g., `let : = ;` +/// Represents a `let` statement (i.e., `let : = ;`). #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub struct Local { pub pat: P, pub ty: Option>, - /// Initializer expression to set the value, if any + /// Initializer expression to set the value, if any. pub init: Option>, pub id: NodeId, pub hir_id: HirId, @@ -1192,9 +1190,9 @@ pub type Decl = Spanned; #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub enum DeclKind { - /// A local (let) binding: + /// A local (let) binding. Local(P), - /// An item binding: + /// An item binding. Item(ItemId), } @@ -1214,7 +1212,7 @@ impl DeclKind { } } -/// represents one arm of a 'match' +/// Represents one arm of a `match` expression. #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub struct Arm { pub attrs: HirVec, @@ -1427,16 +1425,16 @@ impl fmt::Debug for Expr { pub enum ExprKind { /// A `box x` expression. Box(P), - /// An array (`[a, b, c, d]`) + /// An array (e.g. `[a, b, c, d]`). Array(HirVec), - /// A function call + /// A function call. /// /// The first field resolves to the function itself (usually an `ExprKind::Path`), /// and the second field is the list of arguments. /// This also represents calling the constructor of /// tuple-like ADTs such as tuple structs and enum variants. Call(P, HirVec), - /// A method call (`x.foo::<'static, Bar, Baz>(a, b, c, d)`) + /// A method call (e.g., `x.foo::<'static, Bar, Baz>(a, b, c, d)`). /// /// The `PathSegment`/`Span` represent the method name and its generic arguments /// (within the angle brackets). @@ -1446,63 +1444,63 @@ pub enum ExprKind { /// Thus, `x.foo::(a, b, c, d)` is represented as /// `ExprKind::MethodCall(PathSegment { foo, [Bar, Baz] }, [x, a, b, c, d])`. MethodCall(PathSegment, Span, HirVec), - /// A tuple (`(a, b, c ,d)`) + /// A tuple (e.g., `(a, b, c ,d)`). Tup(HirVec), - /// A binary operation (For example: `a + b`, `a * b`) + /// A binary operation (e.g., `a + b`, `a * b`). Binary(BinOp, P, P), - /// A unary operation (For example: `!x`, `*x`) + /// A unary operation (e.g., `!x`, `*x`). Unary(UnOp, P), - /// A literal (For example: `1`, `"foo"`) + /// A literal (e.g., `1`, `"foo"`). Lit(P), - /// A cast (`foo as f64`) + /// A cast (e.g., `foo as f64`). Cast(P, P), Type(P, P), /// An `if` block, with an optional else block /// - /// `if expr { expr } else { expr }` + /// I.e., `if { } else { }`. If(P, P, Option>), /// A while loop, with an optional label /// - /// `'label: while expr { block }` + /// I.e., `'label: while expr { }`. While(P, P, Option, D}` + /// An enum definition (e.g., `enum Foo {C, D}`). Enum(EnumDef, Generics), - /// A struct definition, e.g., `struct Foo {x: A}` + /// A struct definition (e.g., `struct Foo {x: A}`). Struct(VariantData, Generics), - /// A union definition, e.g., `union Foo {x: A, y: B}` + /// A union definition (e.g., `union Foo {x: A, y: B}`). Union(VariantData, Generics), - /// Represents a Trait Declaration + /// Represents a trait declaration (e.g., `trait Foo { ... }`). Trait(IsAuto, Unsafety, Generics, GenericBounds, HirVec), - /// Represents a Trait Alias Declaration + /// Represents a trait alias declaration (e.g., `trait Foo = Bar;`). TraitAlias(Generics, GenericBounds), - /// An implementation, eg `impl Trait for Foo { .. }` + /// An implementation (e.g., `impl Trait for Foo { .. }`). Impl(Unsafety, ImplPolarity, Defaultness, Generics, Option, // (optional) trait this impl implements - P, // self + P, // self type HirVec), } @@ -2348,15 +2337,15 @@ pub struct ForeignItem { pub vis: Visibility, } -/// An item within an `extern` block +/// An item within an `extern` block. #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub enum ForeignItemKind { - /// A foreign function + /// A foreign function. Fn(P, HirVec, Generics), /// A foreign static item (`static ext: u8`), with optional mutability - /// (the boolean is true when mutable) + /// (the boolean is true when mutable). Static(P, bool), - /// A foreign type + /// A foreign type. Type, } @@ -2402,7 +2391,7 @@ pub struct TraitCandidate { // Trait method resolution pub type TraitMap = NodeMap>; -// Map from the NodeId of a glob import to a list of items which are actually +// Map from the `NodeId` of a glob import to a list of items which are actually // imported. pub type GlobMap = NodeMap>; @@ -2437,36 +2426,37 @@ pub struct CodegenFnAttrs { bitflags! { #[derive(RustcEncodable, RustcDecodable)] pub struct CodegenFnAttrFlags: u32 { - /// #[cold], a hint to LLVM that this function, when called, is never on - /// the hot path + /// `#[cold]`: a hint to LLVM that this function, when called, is never on + /// the hot path. const COLD = 1 << 0; - /// #[allocator], a hint to LLVM that the pointer returned from this - /// function is never null + /// `#[allocator]`: a hint to LLVM that the pointer returned from this + /// function is never null. const ALLOCATOR = 1 << 1; - /// #[unwind], an indicator that this function may unwind despite what - /// its ABI signature may otherwise imply + /// `#[unwind]`: an indicator that this function may unwind despite what + /// its ABI signature may otherwise imply. const UNWIND = 1 << 2; - /// #[rust_allocator_nounwind], an indicator that an imported FFI + /// `#[rust_allocator_nounwind]`, an indicator that an imported FFI /// function will never unwind. Probably obsolete by recent changes with /// #[unwind], but hasn't been removed/migrated yet const RUSTC_ALLOCATOR_NOUNWIND = 1 << 3; - /// #[naked], indicates to LLVM that no function prologue/epilogue - /// should be generated + /// `#[naked]`: an indicator to LLVM that no function prologue/epilogue + /// should be generated. const NAKED = 1 << 4; - /// #[no_mangle], the function's name should be the same as its symbol + /// `#[no_mangle]`: an indicator that the function's name should be the same + /// as its symbol. const NO_MANGLE = 1 << 5; - /// #[rustc_std_internal_symbol], and indicator that this symbol is a + /// `#[rustc_std_internal_symbol]`: an indicator that this symbol is a /// "weird symbol" for the standard library in that it has slightly /// different linkage, visibility, and reachability rules. const RUSTC_STD_INTERNAL_SYMBOL = 1 << 6; - /// #[no_debug], indicates that no debugging information should be - /// generated for this function by LLVM + /// `#[no_debug]`: an indicator that no debugging information should be + /// generated for this function by LLVM. const NO_DEBUG = 1 << 7; - /// #[thread_local], indicates a static is actually a thread local + /// `#[thread_local]`: indicates a static is actually a thread local /// piece of memory const THREAD_LOCAL = 1 << 8; - /// #[used], indicates that LLVM can't eliminate this function (but the - /// linker can!) + /// `#[used]`: indicates that LLVM can't eliminate this function (but the + /// linker can!). const USED = 1 << 9; } } @@ -2492,17 +2482,17 @@ impl CodegenFnAttrs { } } - /// True if it looks like this symbol needs to be exported, for example: + /// Returns whether it looks like this symbol needs to be exported, for example: /// - /// * `#[no_mangle]` is present - /// * `#[export_name(...)]` is present - /// * `#[linkage]` is present + /// * `#[no_mangle]` is present, + /// * `#[export_name(...)]` is present, + /// * `#[linkage]` is present. pub fn contains_extern_indicator(&self) -> bool { self.flags.contains(CodegenFnAttrFlags::NO_MANGLE) || self.export_name.is_some() || match self.linkage { - // these are private, make sure we don't try to consider - // them external + // These are private, make sure we don't try to consider + // them external. None | Some(Linkage::Internal) | Some(Linkage::Private) => false, @@ -2531,7 +2521,7 @@ pub enum Node<'hir> { Local(&'hir Local), MacroDef(&'hir MacroDef), - /// StructCtor represents a tuple struct. + /// `StructCtor` represents a tuple struct. StructCtor(&'hir VariantData), Lifetime(&'hir Lifetime), diff --git a/src/librustc/ich/impls_hir.rs b/src/librustc/ich/impls_hir.rs index 8ff60e5f56225..e9d922efc1fc5 100644 --- a/src/librustc/ich/impls_hir.rs +++ b/src/librustc/ich/impls_hir.rs @@ -90,12 +90,12 @@ for hir::ItemLocalId { } } -// The following implementations of HashStable for ItemId, TraitItemId, and -// ImplItemId deserve special attention. Normally we do not hash NodeIds within -// the HIR, since they just signify a HIR nodes own path. But ItemId et al +// The following implementations of `HashStable` for `ItemId`, `TraitItemId`, and +// `ImplItemId` deserve special attention. Normally we do not hash `NodeId`s within +// the HIR, since they just signify a HIR nodes own path. But `ItemId` et al // are used when another item in the HIR is *referenced* and we certainly -// want to pick up on a reference changing its target, so we hash the NodeIds -// in "DefPath Mode". +// want to pick up on a reference changing its target, so we hash the `NodeId`s +// in DefPath mode. impl<'a> HashStable> for hir::ItemId { fn hash_stable(&self, @@ -991,7 +991,7 @@ impl_stable_hash_for!(struct hir::InlineAsmOutput { impl_stable_hash_for!(struct hir::GlobalAsm { asm, - ctxt -> _, // This is used for error reporting + ctxt -> _, // used for error reporting }); impl_stable_hash_for!(struct hir::InlineAsm { @@ -1003,7 +1003,7 @@ impl_stable_hash_for!(struct hir::InlineAsm { volatile, alignstack, dialect, - ctxt -> _, // This is used for error reporting + ctxt -> _, // used for error reporting }); impl_stable_hash_for!(enum hir::def::CtorKind { diff --git a/src/librustc/infer/canonical/query_response.rs b/src/librustc/infer/canonical/query_response.rs index 7f113f07276d8..034b62b0207ad 100644 --- a/src/librustc/infer/canonical/query_response.rs +++ b/src/librustc/infer/canonical/query_response.rs @@ -161,7 +161,7 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> { debug!("true_errors = {:#?}", true_errors); if !true_errors.is_empty() { - // FIXME -- we don't indicate *why* we failed to solve + // FIXME: we don't indicate *why* we failed to solve debug!("make_query_response: true_errors={:#?}", true_errors); return Err(NoSolution); } @@ -506,7 +506,7 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> { /// Given a "guess" at the values for the canonical variables in /// the input, try to unify with the *actual* values found in the - /// query result. Often, but not always, this is a no-op, because + /// query result. Often, but not always, this is a noop, because /// we already found the mapping in the "guessing" step. /// /// See also: `query_response_substitution_guess` diff --git a/src/librustc/infer/combine.rs b/src/librustc/infer/combine.rs index ed251d81e625e..911fe9519b7b5 100644 --- a/src/librustc/infer/combine.rs +++ b/src/librustc/infer/combine.rs @@ -1,10 +1,10 @@ /////////////////////////////////////////////////////////////////////////// // # Type combining // -// There are four type combiners: equate, sub, lub, and glb. Each +// There are four type combiners: equate, sub, lub, and glb. Each // implements the trait `Combine` and contains methods for combining -// two instances of various things and yielding a new instance. These -// combiner methods always yield a `Result`. There is a lot of +// two instances of various things and yielding a new instance. These +// combiner methods always yield a `Result`. There is a lot of // common code for these operations, implemented as default methods on // the `Combine` trait. // @@ -18,7 +18,7 @@ // When you are relating two things which have a contravariant // relationship, you should use `contratys()` or `contraregions()`, // rather than inversing the order of arguments! This is necessary -// because the order of arguments is not relevant for LUB and GLB. It +// because the order of arguments is not relevant for LUB and GLB. It // is also useful to track which value is the "expected" value in // terms of error reporting. @@ -189,7 +189,7 @@ impl<'infcx, 'gcx, 'tcx> CombineFields<'infcx, 'gcx, 'tcx> { debug!("instantiate(a_ty={:?} dir={:?} b_vid={:?})", a_ty, dir, b_vid); // Generalize type of `a_ty` appropriately depending on the - // direction. As an example, assume: + // direction. As an example, assume: // // - `a_ty == &'x ?1`, where `'x` is some free region and `?1` is an // inference variable, @@ -310,7 +310,7 @@ struct Generalization<'tcx> { /// particular around 'bivariant' type parameters that are only /// constrained by a where-clause. As an example, imagine a type: /// - /// struct Foo where A: Iterator { + /// struct Foo where A: Iterator { /// data: A /// } /// @@ -488,7 +488,7 @@ impl<'cx, 'gcx, 'tcx> TypeRelation<'cx, 'gcx, 'tcx> for Generalizer<'cx, 'gcx, ' } } - // FIXME: This is non-ideal because we don't give a + // FIXME: this is non-ideal because we don't give a // very descriptive origin for this region variable. Ok(self.infcx.next_region_var(MiscVariable(self.span))) } diff --git a/src/librustc/infer/error_reporting/mod.rs b/src/librustc/infer/error_reporting/mod.rs index e34bb9f4f7bd9..b361d837f6f7d 100644 --- a/src/librustc/infer/error_reporting/mod.rs +++ b/src/librustc/infer/error_reporting/mod.rs @@ -82,7 +82,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { let new_string; let unknown_scope = || { format!( - "{}unknown scope: {:?}{}. Please report a bug.", + "{}unknown scope: {:?}{}. Please report a bug.", prefix, scope, suffix ) }; @@ -882,8 +882,8 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { mut values: Option>, terr: &TypeError<'tcx>, ) { - // For some types of errors, expected-found does not make - // sense, so just ignore the values we were given. + // For some types of errors, the expected-found message format does not + // make sense, so just ignore the values we were given. match terr { TypeError::CyclicTy(_) => { values = None; @@ -906,7 +906,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { let vals = match self.values_str(&values) { Some((expected, found)) => Some((expected, found)), None => { - // Derived error. Cancel the emitter. + // Derived error; cancel the emitter. self.tcx.sess.diagnostic().cancel(diag); return; } diff --git a/src/librustc/infer/error_reporting/need_type_info.rs b/src/librustc/infer/error_reporting/need_type_info.rs index 8ee367c87c3ea..c8904aeaa0df3 100644 --- a/src/librustc/infer/error_reporting/need_type_info.rs +++ b/src/librustc/infer/error_reporting/need_type_info.rs @@ -79,10 +79,10 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { } pub fn need_type_info_err(&self, - body_id: Option, - span: Span, - ty: Ty<'tcx>) - -> DiagnosticBuilder<'gcx> { + body_id: Option, + span: Span, + ty: Ty<'tcx>) + -> DiagnosticBuilder<'gcx> { let ty = self.resolve_type_vars_if_possible(&ty); let name = self.extract_type_name(&ty); diff --git a/src/librustc/infer/error_reporting/nice_region_error/find_anon_type.rs b/src/librustc/infer/error_reporting/nice_region_error/find_anon_type.rs index d230ce55471e9..682268e554a4d 100644 --- a/src/librustc/infer/error_reporting/nice_region_error/find_anon_type.rs +++ b/src/librustc/infer/error_reporting/nice_region_error/find_anon_type.rs @@ -203,7 +203,7 @@ impl<'a, 'gcx, 'tcx> Visitor<'gcx> for FindNestedTypeVisitor<'a, 'gcx, 'tcx> { } // The visitor captures the corresponding `hir::Ty` of the anonymous region -// in the case of structs ie. `hir::TyKind::Path`. +// in the case of structs (i.e., `hir::TyKind::Path`). // This visitor would be invoked for each lifetime corresponding to a struct, // and would walk the types like Vec in the above example and Ref looking for the HIR // where that lifetime appears. This allows us to highlight the diff --git a/src/librustc/infer/error_reporting/note.rs b/src/librustc/infer/error_reporting/note.rs index 91da3197d3c1f..0dfa6bcfa7afe 100644 --- a/src/librustc/infer/error_reporting/note.rs +++ b/src/librustc/infer/error_reporting/note.rs @@ -377,7 +377,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { E0487, "unsafe use of destructor: destructor might be \ called while references are dead"); - // FIXME (22171): terms "super/subregion" are suboptimal + // FIXME(#22171): terms "super"/"subregion" are suboptimal. self.tcx.note_and_explain_region(region_scope_tree, &mut err, "superregion: ", sup, ""); self.tcx.note_and_explain_region(region_scope_tree, &mut err, diff --git a/src/librustc/infer/fudge.rs b/src/librustc/infer/fudge.rs index a38db5d210f7b..85f3aeca5c353 100644 --- a/src/librustc/infer/fudge.rs +++ b/src/librustc/infer/fudge.rs @@ -117,7 +117,7 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for RegionFudger<'a, 'gcx, 'tcx> { match self.type_variables.get(&vid) { None => { // This variable was created before the - // "fudging". Since we refresh all type + // "fudging". Since we refresh all type // variables to their binding anyhow, we know // that it is unbound, so we can just return // it. diff --git a/src/librustc/infer/higher_ranked/mod.rs b/src/librustc/infer/higher_ranked/mod.rs index 3a3a21d0f1d4a..a0bfab09115b5 100644 --- a/src/librustc/infer/higher_ranked/mod.rs +++ b/src/librustc/infer/higher_ranked/mod.rs @@ -31,7 +31,7 @@ impl<'a, 'gcx, 'tcx> CombineFields<'a, 'gcx, 'tcx> { // as-is, we need to do some extra work here in order to make sure // that function subtyping works correctly with respect to regions // - // Note: this is a subtle algorithm. For a full explanation, + // Note: this is a subtle algorithm. For a full explanation, // please see the large comment at the end of the file in the (inlined) module // `doc`. @@ -85,7 +85,7 @@ impl<'a, 'gcx, 'tcx> CombineFields<'a, 'gcx, 'tcx> { /// This routine is (as of this writing) used in trait matching, /// particularly projection. /// - /// NB. It should not happen that there are LBR appearing in `U` + /// N.B., it should not happen that there are LBR appearing in `U` /// that do not appear in `T`. If that happens, those regions are /// unconstrained, and this routine replaces them with `'static`. pub fn higher_ranked_match(&mut self, @@ -375,7 +375,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { // unlikely to cause an ICE or two. It is intended for use // only during a transition period, in which the MIR typeck // uses the "universe-style" check, and the rest of typeck - // uses the more conservative leak check. Since the leak + // uses the more conservative leak check. Since the leak // check is more conservative, we can't test the // universe-style check without disabling it. if self.tcx.sess.opts.debugging_opts.no_leak_check { diff --git a/src/librustc/infer/lattice.rs b/src/librustc/infer/lattice.rs index a8794b4076a9d..9843219d27e4e 100644 --- a/src/librustc/infer/lattice.rs +++ b/src/librustc/infer/lattice.rs @@ -68,7 +68,7 @@ pub fn super_lattice_tys<'a, 'gcx, 'tcx, L>(this: &mut L, // // Example: if the LHS is a type variable, and RHS is // `Box`, then we current compare `v` to the RHS first, - // which will instantiate `v` with `Box`. Then when `v` + // which will instantiate `v` with `Box`. Then when `v` // is compared to the LHS, we instantiate LHS with `Box`. // But if we did in reverse order, we would create a `v <: // LHS` (or vice versa) constraint and then instantiate diff --git a/src/librustc/infer/lexical_region_resolve/graphviz.rs b/src/librustc/infer/lexical_region_resolve/graphviz.rs index 7ce2aba54f5cc..a06274e8e5cdc 100644 --- a/src/librustc/infer/lexical_region_resolve/graphviz.rs +++ b/src/librustc/infer/lexical_region_resolve/graphviz.rs @@ -29,15 +29,15 @@ fn print_help_message() { println!("\ -Z print-region-graph by default prints a region constraint graph for every \n\ function body, to the path `constraints.nodeXXX.dot`, where the XXX is \n\ -replaced with the node id of the function under analysis. \n\ +replaced with the node-ID of the function under analysis. \n\ \n\ To select one particular function body, set `RUST_REGION_GRAPH_NODE=XXX`, \n\ -where XXX is the node id desired. \n\ +where XXX is the node-ID desired. \n\ \n\ To generate output to some path other than the default \n\ `constraints.nodeXXX.dot`, set `RUST_REGION_GRAPH=/path/desired.dot`; \n\ occurrences of the character `%` in the requested path will be replaced with\n\ -the node id of the function under analysis. \n\ +the node-ID of the function under analysis. \n\ \n\ (Since you requested help via RUST_REGION_GRAPH=help, no region constraint \n\ graphs will be printed. \n\ @@ -175,7 +175,7 @@ impl<'a, 'gcx, 'tcx> dot::Labeller<'a> for ConstraintGraph<'a, 'gcx, 'tcx> { let name = || format!("node_{}", node_id); dot::Id::new(name()).unwrap_or_else(|_| - bug!("failed to create graphviz node identified by {}", name())) + bug!("failed to create graphviz node-IDentified by {}", name())) } fn node_label(&self, n: &Node) -> dot::LabelText<'_> { match *n { diff --git a/src/librustc/infer/lexical_region_resolve/mod.rs b/src/librustc/infer/lexical_region_resolve/mod.rs index de64800ee8d35..56847c4e0de30 100644 --- a/src/librustc/infer/lexical_region_resolve/mod.rs +++ b/src/librustc/infer/lexical_region_resolve/mod.rs @@ -282,7 +282,7 @@ impl<'cx, 'gcx, 'tcx> LexicalResolver<'cx, 'gcx, 'tcx> { | (&ReFree(_), &ReScope(s_id)) | (&ReScope(s_id), &ReFree(_)) => { // A "free" region can be interpreted as "some region - // at least as big as fr.scope". So, we can + // at least as big as fr.scope". So, we can // reasonably compare free regions and scopes: let fr_scope = match (a, b) { (&ReEarlyBound(ref br), _) | (_, &ReEarlyBound(ref br)) => self.region_rels @@ -443,7 +443,7 @@ impl<'cx, 'gcx, 'tcx> LexicalResolver<'cx, 'gcx, 'tcx> { // conflicting regions to report to the user. As we walk, we // trip the flags from false to true, and if we find that // we've already reported an error involving any particular - // node we just stop and don't report the current error. The + // node we just stop and don't report the current error. The // idea is to report errors that derive from independent // regions of the graph, but not those that derive from // overlapping locations. @@ -457,7 +457,7 @@ impl<'cx, 'gcx, 'tcx> LexicalResolver<'cx, 'gcx, 'tcx> { inconsistent constraints. I think that in this case we should report an - error now---unlike the case above, we can't + error now -- unlike the case above, we can't wait to see whether the user needs the result of this variable. The reason is that the mere existence of this variable implies that the diff --git a/src/librustc/infer/mod.rs b/src/librustc/infer/mod.rs index c000e3aa013f8..64bcedae25bc7 100644 --- a/src/librustc/infer/mod.rs +++ b/src/librustc/infer/mod.rs @@ -1,11 +1,25 @@ //! See the Book for more information. -pub use self::freshen::TypeFreshener; -pub use self::LateBoundRegionConversionTime::*; -pub use self::RegionVariableOrigin::*; -pub use self::SubregionOrigin::*; -pub use self::ValuePairs::*; -pub use ty::IntVarValue; +pub mod at; +pub mod canonical; +mod combine; +mod equate; +pub mod error_reporting; +mod freshen; +mod fudge; +mod glb; +mod higher_ranked; +pub mod lattice; +mod lexical_region_resolve; +mod lub; +pub mod nll_relate; +pub mod opaque_types; +pub mod outlives; +pub mod region_constraints; +pub mod resolve; +mod sub; +pub mod type_variable; +pub mod unify_key; use arena::SyncDroplessArena; use errors::DiagnosticBuilder; @@ -31,6 +45,13 @@ use ty::{self, GenericParamDefKind, Ty, TyCtxt, CtxtInterners}; use ty::{FloatVid, IntVid, TyVid}; use util::nodemap::FxHashMap; +pub use self::freshen::TypeFreshener; +pub use self::LateBoundRegionConversionTime::*; +pub use self::RegionVariableOrigin::*; +pub use self::SubregionOrigin::*; +pub use self::ValuePairs::*; +pub use ty::IntVarValue; + use self::combine::CombineFields; use self::higher_ranked::HrMatchResult; use self::lexical_region_resolve::LexicalRegionResolutions; @@ -40,27 +61,6 @@ use self::region_constraints::{RegionConstraintCollector, RegionSnapshot}; use self::type_variable::TypeVariableOrigin; use self::unify_key::ToType; -pub mod at; -pub mod canonical; -mod combine; -mod equate; -pub mod error_reporting; -mod freshen; -mod fudge; -mod glb; -mod higher_ranked; -pub mod lattice; -mod lexical_region_resolve; -mod lub; -pub mod nll_relate; -pub mod opaque_types; -pub mod outlives; -pub mod region_constraints; -pub mod resolve; -mod sub; -pub mod type_variable; -pub mod unify_key; - #[must_use] #[derive(Debug)] pub struct InferOk<'tcx, T> { @@ -91,11 +91,11 @@ impl SuppressRegionErrors { /// enabled. pub fn when_nll_is_enabled(tcx: TyCtxt<'_, '_, '_>) -> Self { match tcx.borrowck_mode() { - // If we're on AST or Migrate mode, report AST region errors + // If we're in AST or Migrate mode, report AST region errors. BorrowckMode::Ast | BorrowckMode::Migrate => SuppressRegionErrors { suppressed: false }, - // If we're on MIR or Compare mode, don't report AST region errors as they should - // be reported by NLL + // If we're in MIR or Compare mode, don't report AST region errors as they should + // be reported by NLL. BorrowckMode::Compare | BorrowckMode::Mir => SuppressRegionErrors { suppressed: true }, } } @@ -121,14 +121,14 @@ pub struct InferCtxt<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> { // order, represented by its upper and lower bounds. pub type_variables: RefCell>, - // Map from integral variable to the kind of integer it represents + // Map from integral variable to the kind of integer it represents. int_unification_table: RefCell>>, - // Map from floating variable to the kind of float it represents + // Map from floating variable to the kind of float it represents. float_unification_table: RefCell>>, // Tracks the set of region variables and the constraints between - // them. This is initially `Some(_)` but when + // them. This is initially `Some(_)` but when // `resolve_regions_and_report_errors` is invoked, this gets set // to `None` -- further attempts to perform unification etc may // fail if new region constraints would've been added. @@ -169,7 +169,7 @@ pub struct InferCtxt<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> { // `tained_by_errors`) to avoid reporting certain kinds of errors. err_count_on_creation: usize, - // This flag is true while there is an active snapshot. + // This flag is `true` while there is an active snapshot. in_snapshot: Cell, // The TraitObjectMode used here, @@ -198,7 +198,7 @@ pub struct InferCtxt<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> { // something more fine-grained, is so that it is easier for // regionck to be sure that it has found *all* the region // obligations (otherwise, it's easy to fail to walk to a - // particular node-id). + // particular node-ID). // // Before running `resolve_regions_and_report_errors`, the creator // of the inference context is expected to invoke @@ -225,7 +225,7 @@ pub struct InferCtxt<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> { /// replaced with. pub type PlaceholderMap<'tcx> = BTreeMap>; -/// See `error_reporting` module for more details +/// See the `error_reporting` module for more details. #[derive(Clone, Debug)] pub enum ValuePairs<'tcx> { Types(ExpectedFound>), @@ -237,7 +237,7 @@ pub enum ValuePairs<'tcx> { /// The trace designates the path through inference that we took to /// encounter an error or subtyping constraint. /// -/// See `error_reporting` module for more details. +/// See the `error_reporting` module for more details. #[derive(Clone)] pub struct TypeTrace<'tcx> { cause: ObligationCause<'tcx>, @@ -246,30 +246,30 @@ pub struct TypeTrace<'tcx> { /// The origin of a `r1 <= r2` constraint. /// -/// See `error_reporting` module for more details +/// See the `error_reporting` module for more details. #[derive(Clone, Debug)] pub enum SubregionOrigin<'tcx> { - // Arose from a subtyping relation + // Arose from a subtyping relation. Subtype(TypeTrace<'tcx>), // Stack-allocated closures cannot outlive innermost loop - // or function so as to ensure we only require finite stack + // or function so as to ensure we only require finite stack. InfStackClosure(Span), - // Invocation of closure must be within its lifetime + // Invocation of closure must be within its lifetime. InvokeClosure(Span), - // Dereference of reference must be within its lifetime + // Dereference of reference must be within its lifetime. DerefPointer(Span), - // Closure bound must not outlive captured free variables + // Closure bound must not outlive captured free variables. FreeVariable(Span, ast::NodeId), - // Index into slice must be within its lifetime + // Index into slice must be within its lifetime. IndexSlice(Span), // When casting `&'a T` to an `&'b Trait` object, - // relating `'a` to `'b` + // relating `'a` to `'b`. RelateObjectBound(Span), // Some type parameter was instantiated with the given type, @@ -284,16 +284,16 @@ pub enum SubregionOrigin<'tcx> { // the moment of their instantiation. RelateDefaultParamBound(Span, Ty<'tcx>), - // Creating a pointer `b` to contents of another reference + // Creating a pointer `b` to contents of another reference. Reborrow(Span), - // Creating a pointer `b` to contents of an upvar + // Creating a pointer `b` to contents of an upvar. ReborrowUpvar(Span, ty::UpvarId), - // Data with type `Ty<'tcx>` was borrowed + // Data with type `Ty<'tcx>` was borrowed. DataBorrowed(Ty<'tcx>, Span), - // (&'a &'b T) where a >= b + // `(&'a &'b T)` where `a >= b`. ReferenceOutlivesReferent(Ty<'tcx>, Span), // Type or region parameters must be in scope. @@ -302,28 +302,28 @@ pub enum SubregionOrigin<'tcx> { // The type T of an expression E must outlive the lifetime for E. ExprTypeIsNotInScope(Ty<'tcx>, Span), - // A `ref b` whose region does not enclose the decl site + // A `ref b` whose region does not enclose the declaration site. BindingTypeIsNotValidAtDecl(Span), - // Regions appearing in a method receiver must outlive method call + // Regions appearing in a method receiver must outlive method call. CallRcvr(Span), - // Regions appearing in a function argument must outlive func call + // Regions appearing in a function argument must outlive func call. CallArg(Span), - // Region in return type of invoked fn must enclose call + // Region in return type of invoked fn must enclose call. CallReturn(Span), - // Operands must be in scope + // Operands must be in scope. Operand(Span), - // Region resulting from a `&` expr must enclose the `&` expr + // Region resulting from a `&` expr must enclose the `&` expr. AddrOf(Span), - // An auto-borrow that does not enclose the expr where it occurs + // An auto-borrow that does not enclose the expr where it occurs. AutoBorrow(Span), - // Region constraint arriving from destructor safety + // Region constraint arriving from destructor safety. SafeDestructor(Span), // Comparing the signature and requirements of an impl method against @@ -339,51 +339,51 @@ pub enum SubregionOrigin<'tcx> { /// Places that type/region parameters can appear. #[derive(Clone, Copy, Debug)] pub enum ParameterOrigin { - Path, // foo::bar - MethodCall, // foo.bar() <-- parameters on impl providing bar() - OverloadedOperator, // a + b when overloaded - OverloadedDeref, // *a when overloaded + Path, // `foo::bar` + MethodCall, // `foo.bar()` <-- parameters on impl providing `bar()` + OverloadedOperator, // `a + b` when overloaded + OverloadedDeref, // `*a` when overloaded } -/// Times when we replace late-bound regions with variables: +/// Times when we replace late-bound regions with variables. #[derive(Clone, Copy, Debug)] pub enum LateBoundRegionConversionTime { - /// when a fn is called + /// When a fn is called. FnCall, - /// when two higher-ranked types are compared + /// When two higher-ranked types are compared. HigherRankedType, - /// when projecting an associated type + /// When projecting an associated type. AssocTypeProjection(DefId), } /// Reasons to create a region inference variable /// -/// See `error_reporting` module for more details +/// See the `error_reporting` module for more details #[derive(Copy, Clone, Debug)] pub enum RegionVariableOrigin { // Region variables created for ill-categorized reasons, - // mostly indicates places in need of refactoring + // mostly indicates places in need of refactoring. MiscVariable(Span), - // Regions created by a `&P` or `[...]` pattern + // Regions created by a `&P` or `[...]` pattern. PatternRegion(Span), - // Regions created by `&` operator + // Regions created by `&` operator. AddrOfRegion(Span), - // Regions created as part of an autoref of a method receiver + // Regions created as part of an autoref of a method receiver. Autoref(Span), - // Regions created as part of an automatic coercion + // Regions created as part of an automatic coercion. Coercion(Span), - // Region variables created as the values for early-bound regions + // Region variables created as the values for early-bound regions. EarlyBoundRegion(Span, InternedString), // Region variables created for bound regions - // in a function or method that is called + // in a function or method that is called. LateBoundRegion(Span, ty::BoundRegion, LateBoundRegionConversionTime), UpvarRegion(ty::UpvarId, Span), @@ -458,9 +458,9 @@ impl fmt::Display for FixupError { } } -/// Helper type of a temporary returned by tcx.infer_ctxt(). +/// Helper type of a temporary returned by `tcx.infer_ctxt()`. /// Necessary because we can't write the following bound: -/// F: for<'b, 'tcx> where 'gcx: 'tcx FnOnce(InferCtxt<'b, 'gcx, 'tcx>). +/// `F: for<'b, 'tcx> where 'gcx: 'tcx FnOnce(InferCtxt<'b, 'gcx, 'tcx>)`. pub struct InferCtxtBuilder<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> { global_tcx: TyCtxt<'a, 'gcx, 'gcx>, arena: SyncDroplessArena, @@ -499,7 +499,7 @@ impl<'a, 'gcx, 'tcx> InferCtxtBuilder<'a, 'gcx, 'tcx> { /// inference context that contains each of the bound values /// within instantiated as a fresh variable. The `f` closure is /// invoked with the new infcx, along with the instantiated value - /// `V` and a substitution `S`. This substitution `S` maps from + /// `V` and a substitution `S`. This substitution `S` maps from /// the bound values in `C` to their instantiated values in `V` /// (in other words, `S(C) = V`). pub fn enter_with_canonical( @@ -577,7 +577,7 @@ impl<'tcx, T> InferOk<'tcx, T> { } } - /// Extract `value`, registering any obligations into `fulfill_cx` + /// Extract `value`, registering any obligations into `fulfill_cx`. pub fn into_value_registering_obligations( self, infcx: &InferCtxt<'_, '_, 'tcx>, @@ -712,7 +712,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { // register obligations, within a snapshot. Very useful, much // better than grovelling through megabytes of RUST_LOG output. // - // HOWEVER, in some cases the flag is unhelpful. In particular, we + // _However_, in some cases the flag is unhelpful. In particular, we // sometimes create a "mini-fulfilment-cx" in which we enroll // obligations. As long as this fulfillment cx is fully drained // before we return, this is not a problem, as there won't be any @@ -812,7 +812,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { .commit(region_constraints_snapshot); } - /// Execute `f` and commit the bindings + /// Execute `f` and commit the bindings. pub fn commit_unconditionally(&self, f: F) -> R where F: FnOnce() -> R, @@ -824,7 +824,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { r } - /// Execute `f` and commit the bindings if closure `f` returns `Ok(_)` + /// Execute `f` and commit the bindings if closure `f` returns `Ok(_)`. pub fn commit_if_ok(&self, f: F) -> Result where F: FnOnce(&CombinedSnapshot<'a, 'tcx>) -> Result, @@ -844,7 +844,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { r } - // Execute `f` in a snapshot, and commit the bindings it creates + // Execute `f` in a snapshot, and commit the bindings it creates. pub fn in_snapshot(&self, f: F) -> T where F: FnOnce(&CombinedSnapshot<'a, 'tcx>) -> T, @@ -856,7 +856,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { r } - /// Execute `f` then unroll any bindings it creates + /// Execute `f` then unroll any bindings it creates. pub fn probe(&self, f: F) -> R where F: FnOnce(&CombinedSnapshot<'a, 'tcx>) -> R, @@ -1081,7 +1081,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { } /// True if errors have been reported since this infcx was - /// created. This is sometimes used as a heuristic to skip + /// created. This is sometimes used as a heuristic to skip /// reporting errors that often occur as a result of earlier /// errors, but where it's hard to be 100% sure (e.g., unresolved /// inference variables, regionck errors). @@ -1095,7 +1095,8 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { ); if self.tcx.sess.err_count() > self.err_count_on_creation { - return true; // errors reported since this infcx was made + // Errors have been reported since this infcx was made. + return true; } self.tainted_by_errors_flag.get() } @@ -1145,7 +1146,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { if !self.is_tainted_by_errors() { // As a heuristic, just skip reporting region errors // altogether if other errors have been reported while - // this infcx was in use. This is totally hokey but + // this infcx was in use. This is totally hokey but // otherwise we have a hard time separating legit region // errors from silly ones. self.report_region_errors(region_map, &errors, suppress); @@ -1210,7 +1211,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { self.resolve_type_vars_if_possible(t).to_string() } - // We have this force-inlined variant of shallow_resolve() for the one + // We have this force-inlined variant of `shallow_resolve()` for the one // callsite that is extremely hot. All other callsites use the normal // variant. #[inline(always)] @@ -1289,7 +1290,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { value.fold_with(&mut r) } - /// Returns true if `T` contains unresolved type variables. In the + /// Returns whether `T` contains unresolved type variables. In the /// process of visiting `T`, this will resolve (where possible) /// type variables in `T`, but it never constructs the final, /// resolved type, so it's more efficient than @@ -1325,14 +1326,14 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { } // [Note-Type-error-reporting] - // An invariant is that anytime the expected or actual type is Error (the special - // error type, meaning that an error occurred when typechecking this expression), + // An invariant is that anytime the expected or actual type is `Error` (the special + // error type, meaning that an error occurred when type-checking this expression), // this is a derived error. The error cascaded from another error (that was already // reported), so it's not useful to display it to the user. // The following methods implement this logic. - // They check if either the actual or expected type is Error, and don't print the error - // in this case. The typechecker should only ever report type errors involving mismatched - // types using one of these methods, and should not call span_err directly for such + // They check if either the actual or expected type is `Error`, and don't print the error + // in this case. The type-checker should only ever report type errors involving mismatched + // types using one of these methods, and should not call `span_err` directly for such // errors. pub fn type_error_struct_with_diag( @@ -1393,7 +1394,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { /// and then return the value (here, `&'a u32`) but with the /// substitution applied (hence, `&'x u32`). /// - /// See `higher_ranked_match` in `higher_ranked/mod.rs` for more + /// See the `higher_ranked_match` in `higher_ranked/mod.rs` for more /// details. pub fn match_poly_projection_predicate( &self, @@ -1420,7 +1421,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { }) } - /// See `verify_generic_bound` method in `region_constraints` + /// See the `verify_generic_bound` method in `region_constraints`. pub fn verify_generic_bound( &self, origin: SubregionOrigin<'tcx>, @@ -1471,7 +1472,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { closure_kind_ty.to_opt_closure_kind() } - /// Obtain the signature of a closure. For closures, unlike + /// Obtain the signature of a closure. For closures, unlike /// `tcx.fn_sig(def_id)`, this method will work during the /// type-checking of the enclosing function and return the closure /// signature in its partially inferred state. diff --git a/src/librustc/infer/opaque_types/mod.rs b/src/librustc/infer/opaque_types/mod.rs index 56c6da83ed9a2..0552204f20116 100644 --- a/src/librustc/infer/opaque_types/mod.rs +++ b/src/librustc/infer/opaque_types/mod.rs @@ -88,7 +88,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { /// /// # Parameters /// - /// - `parent_def_id` -- the def-id of the function in which the opaque type + /// - `parent_def_id` -- the def-ID of the function in which the opaque type /// is defined /// - `body_id` -- the body-id with which the resulting obligations should /// be associated @@ -290,7 +290,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { let span = self.tcx.def_span(def_id); // If there are required region bounds, we can just skip - // ahead. There will already be a registered region + // ahead. There will already be a registered region // obligation related `concrete_ty` to those regions. if opaque_defn.has_required_region_bounds { return; @@ -649,7 +649,7 @@ impl<'a, 'gcx, 'tcx> Instantiator<'a, 'gcx, 'tcx> { if let ty::Opaque(def_id, substs) = ty.sty { // Check that this is `impl Trait` type is // declared by `parent_def_id` -- i.e., one whose - // value we are inferring. At present, this is + // value we are inferring. At present, this is // always true during the first phase of // type-check, but not always true later on during // NLL. Once we support named abstract types more fully, diff --git a/src/librustc/infer/outlives/obligations.rs b/src/librustc/infer/outlives/obligations.rs index abe835c9211a5..3463fb8674ced 100644 --- a/src/librustc/infer/outlives/obligations.rs +++ b/src/librustc/infer/outlives/obligations.rs @@ -371,7 +371,7 @@ where // particular). :) First off, we have to choose between using the // OutlivesProjectionEnv, OutlivesProjectionTraitDef, and // OutlivesProjectionComponent rules, any one of which is - // sufficient. If there are no inference variables involved, it's + // sufficient. If there are no inference variables involved, it's // not hard to pick the right rule, but if there are, we're in a // bit of a catch 22: if we picked which rule we were going to // use, we could add constraints to the region inference graph diff --git a/src/librustc/infer/outlives/verify.rs b/src/librustc/infer/outlives/verify.rs index 4e9a8e9ded899..12fe58e31f678 100644 --- a/src/librustc/infer/outlives/verify.rs +++ b/src/librustc/infer/outlives/verify.rs @@ -251,7 +251,7 @@ impl<'cx, 'gcx, 'tcx> VerifyBoundCx<'cx, 'gcx, 'tcx> { .map(move |r| r.subst(tcx, projection_ty.substs)) } - /// Given the def-id of an associated item, returns any region + /// Given the def-ID of an associated item, returns any region /// bounds attached to that associated item from the trait definition. /// /// For example: @@ -262,7 +262,7 @@ impl<'cx, 'gcx, 'tcx> VerifyBoundCx<'cx, 'gcx, 'tcx> { /// } /// ``` /// - /// If we were given the def-id of `Foo::Bar`, we would return + /// If we were given the def-ID of `Foo::Bar`, we would return /// `'a`. You could then apply the substitutions from the /// projection to convert this into your namespace. This also /// works if the user writes `where >::Bar: 'a` on diff --git a/src/librustc/infer/region_constraints/mod.rs b/src/librustc/infer/region_constraints/mod.rs index 66ebbe111dbce..b235902733375 100644 --- a/src/librustc/infer/region_constraints/mod.rs +++ b/src/librustc/infer/region_constraints/mod.rs @@ -565,7 +565,7 @@ impl<'tcx> RegionConstraintCollector<'tcx> { // the top of this file for more details. // // This computation is potentially wrong in the face of - // rollover. It's conceivable, if unlikely, that one might + // rollover. It's conceivable, if unlikely, that one might // wind up with accidental capture for nested functions in // that case, if the outer function had bound regions created // a very long time before and the inner function somehow @@ -612,7 +612,7 @@ impl<'tcx> RegionConstraintCollector<'tcx> { // cannot add verifys once regions are resolved debug!("RegionConstraintCollector: add_verify({:?})", verify); - // skip no-op cases known to be satisfied + // skip noop cases known to be satisfied if let VerifyBound::AllBounds(ref bs) = verify.bound { if bs.len() == 0 { return; @@ -847,7 +847,7 @@ impl<'tcx> RegionConstraintCollector<'tcx> { ); // `result_set` acts as a worklist: we explore all outgoing - // edges and add any new regions we find to result_set. This + // edges and add any new regions we find to result_set. This // is not a terribly efficient implementation. let mut taint_set = taint::TaintSet::new(directions, r0); taint_set.fixed_point(tcx, &self.undo_log[mark.length..], &self.data.verifys); diff --git a/src/librustc/infer/sub.rs b/src/librustc/infer/sub.rs index 1d4842a6d5626..c81a24e029d3f 100644 --- a/src/librustc/infer/sub.rs +++ b/src/librustc/infer/sub.rs @@ -127,7 +127,7 @@ impl<'combine, 'infcx, 'gcx, 'tcx> TypeRelation<'infcx, 'gcx, 'tcx> debug!("{}.regions({:?}, {:?}) self.cause={:?}", self.tag(), a, b, self.fields.cause); - // FIXME -- we have more fine-grained information available + // FIXME: we have more fine-grained information available // from the "cause" field, we could perhaps give more tailored // error messages. let origin = SubregionOrigin::Subtype(self.fields.trace.clone()); diff --git a/src/librustc/infer/type_variable.rs b/src/librustc/infer/type_variable.rs index 3ec27bdcf1bcd..b77d91560b39b 100644 --- a/src/librustc/infer/type_variable.rs +++ b/src/librustc/infer/type_variable.rs @@ -416,7 +416,7 @@ impl<'tcx> ut::UnifyValue for TypeVariableValue<'tcx> { fn unify_values(value1: &Self, value2: &Self) -> Result { match (value1, value2) { // We never equate two type variables, both of which - // have known types. Instead, we recursively equate + // have known types. Instead, we recursively equate // those types. (&TypeVariableValue::Known { .. }, &TypeVariableValue::Known { .. }) => { bug!("equating two type variables, both of which have known types") diff --git a/src/librustc/lint/context.rs b/src/librustc/lint/context.rs index f5a7919ef09c8..d0e93c4fb3743 100644 --- a/src/librustc/lint/context.rs +++ b/src/librustc/lint/context.rs @@ -552,7 +552,6 @@ impl LintPassObject for EarlyLintPassObject {} impl LintPassObject for LateLintPassObject {} - pub trait LintContext<'tcx>: Sized { type PassObject: LintPassObject; @@ -1271,12 +1270,12 @@ pub fn check_ast_crate( } // All of the buffered lints should have been emitted at this point. - // If not, that means that we somehow buffered a lint for a node id + // If not, that means that we somehow buffered a lint for a node-ID // that was not lint-checked (perhaps it doesn't exist?). This is a bug. // // Rustdoc runs everybody-loops before the early lints and removes // function bodies, so it's totally possible for linted - // node ids to not exist (e.g., macros defined within functions for the + // node-IDs to not exist (e.g., macros defined within functions for the // unused_macro lint) anymore. So we only run this check // when we're not in rustdoc mode. (see issue #47639) if !sess.opts.actually_rustdoc { diff --git a/src/librustc/lint/levels.rs b/src/librustc/lint/levels.rs index 1ae12fec50661..8fac0732974a8 100644 --- a/src/librustc/lint/levels.rs +++ b/src/librustc/lint/levels.rs @@ -210,7 +210,7 @@ impl<'a> LintLevelsBuilder<'a> { }; if metas.is_empty() { - // FIXME (#55112): issue unused-attributes lint for `#[level()]` + // FIXME(#55112): issue unused-attributes lint for `#[level()]` continue; } @@ -225,7 +225,7 @@ impl<'a> LintLevelsBuilder<'a> { if item.ident == "reason" { // found reason, reslice meta list to exclude it metas = &metas[0..metas.len()-1]; - // FIXME (#55112): issue unused-attributes lint if we thereby + // FIXME(#55112): issue unused-attributes lint if we thereby // don't have any lint names (`#[level(reason = "foo")]`) if let ast::LitKind::Str(rationale, _) = name_value.node { if !self.sess.features_untracked().lint_reasons { diff --git a/src/librustc/middle/dead.rs b/src/librustc/middle/dead.rs index 0c769c91801b8..3d6ee74785c7d 100644 --- a/src/librustc/middle/dead.rs +++ b/src/librustc/middle/dead.rs @@ -484,7 +484,7 @@ impl<'a, 'tcx> DeadVisitor<'a, 'tcx> { && !has_allow_dead_code_or_lang_attr(self.tcx, fi.id, &fi.attrs) } - // id := node id of an item's definition. + // `id`: node-ID of an item's definition. fn symbol_is_live( &mut self, id: ast::NodeId, diff --git a/src/librustc/middle/expr_use_visitor.rs b/src/librustc/middle/expr_use_visitor.rs index f9bcbb3222955..75c5546a55ff1 100644 --- a/src/librustc/middle/expr_use_visitor.rs +++ b/src/librustc/middle/expr_use_visitor.rs @@ -40,7 +40,7 @@ pub trait Delegate<'tcx> { // The value found at `cmt` has been determined to match the // pattern binding `matched_pat`, and its subparts are being - // copied or moved depending on `mode`. Note that `matched_pat` + // copied or moved depending on `mode`. Note that `matched_pat` // is called on all variant/structs in the pattern (i.e., the // interior nodes of the pattern's tree structure) while // consume_pat is called on the binding identifiers in the pattern @@ -128,7 +128,7 @@ enum TrackMatchMode { impl TrackMatchMode { // Builds up the whole match mode for a pattern from its constituent - // parts. The lattice looks like this: + // parts. The lattice looks like this: // // Conflicting // / \ diff --git a/src/librustc/middle/liveness.rs b/src/librustc/middle/liveness.rs index a78cf1a471b4b..4a4fd7febf946 100644 --- a/src/librustc/middle/liveness.rs +++ b/src/librustc/middle/liveness.rs @@ -14,7 +14,7 @@ //! find a use of a variable, we add it to the set of live variables. If //! we find an assignment to a variable, we remove it from the set of live //! variables. When we have to merge two flows, we take the union of -//! those two flows---if the variable is live on both paths, we simply +//! those two flows -- if the variable is live on both paths, we simply //! pick one id. In the event of loops, we continue doing this until a //! fixed point is reached. //! @@ -200,9 +200,9 @@ impl fmt::Debug for Variable { // Creating ir_maps // // This is the first pass and the one that drives the main -// computation. It walks up and down the IR once. On the way down, +// computation. It walks up and down the IR once. On the way down, // we count for each function the number of variables as well as -// liveness nodes. A liveness node is basically an expression or +// liveness nodes. A liveness node is basically an expression or // capture clause that does something of interest: either it has // interesting control flow or it uses/defines a local variable. // @@ -212,11 +212,11 @@ impl fmt::Debug for Variable { // of live variables at each program point. // // Finally, we run back over the IR one last time and, using the -// computed liveness, check various safety conditions. For example, +// computed liveness, check various safety conditions. For example, // there must be no live nodes at the definition site for a variable -// unless it has an initializer. Similarly, each non-mutable local +// unless it has an initializer. Similarly, each non-mutable local // variable must not be assigned if there is some successor -// assignment. And so forth. +// assignment. And so forth. impl LiveNode { fn is_valid(&self) -> bool { @@ -458,7 +458,7 @@ fn visit_expr<'a, 'tcx>(ir: &mut IrMaps<'a, 'tcx>, expr: &'tcx Expr) { ir.add_live_node_for_node(expr.hir_id, ExprNode(expr.span)); // Make a live_node for each captured variable, with the span - // being the location that the variable is used. This results + // being the location that the variable is used. This results // in better error messages than just pointing at the closure // construction site. let mut call_caps = Vec::new(); @@ -652,8 +652,8 @@ struct Liveness<'a, 'tcx: 'a> { successors: Vec, rwu_table: RWUTable, - // mappings from loop node ID to LiveNode - // ("break" label should map to loop node ID, + // mappings from loop node-ID to LiveNode + // ("break" label should map to loop node-ID, // it probably doesn't now) break_ln: NodeMap, cont_ln: NodeMap, @@ -911,8 +911,8 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> { } fn compute(&mut self, body: &hir::Expr) -> LiveNode { - // if there is a `break` or `again` at the top level, then it's - // effectively a return---this only occurs in `for` loops, + // If there is a `break` or `again` at the top level, then it's + // effectively a return -- this only occurs in `for` loops, // where the body is really a closure. debug!("compute: using id for body, {}", self.ir.tcx.hir().node_to_pretty_string(body.id)); @@ -979,7 +979,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> { fn propagate_through_local(&mut self, local: &hir::Local, succ: LiveNode) -> LiveNode { // Note: we mark the variable as defined regardless of whether - // there is an initializer. Initially I had thought to only mark + // there is an initializer. Initially I had thought to only mark // the live variable as defined if it was initialized, and then we // could check for uninit variables just by scanning what is live // at the start of the function. But that doesn't work so well for @@ -1301,24 +1301,24 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> { // // # Tracked places // - // A tracked place is a local variable/argument `x`. In + // A tracked place is a local variable/argument `x`. In // these cases, the link_node where the write occurs is linked - // to node id of `x`. The `write_place()` routine generates - // the contents of this node. There are no subcomponents to + // to node-ID of `x`. The `write_place()` routine generates + // the contents of this node. There are no subcomponents to // consider. // // # Non-tracked places // - // These are places like `x[5]` or `x.f`. In that case, we + // These are places like `x[5]` or `x.f`. In that case, we // basically ignore the value which is written to but generate - // reads for the components---`x` in these two examples. The + // reads for the components---`x` in these two examples. The // components reads are generated by // `propagate_through_place_components()` (this fn). // // # Illegal places // // It is still possible to observe assignments to non-places; - // these errors are detected in the later pass borrowck. We + // these errors are detected in the later pass borrowck. We // just ignore such cases and treat them as reads. match expr.node { @@ -1336,7 +1336,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> { } // We do not track other places, so just propagate through - // to their subcomponents. Also, it may happen that + // to their subcomponents. Also, it may happen that // non-places occur here, because those are detected in the // later pass borrowck. _ => succ diff --git a/src/librustc/middle/mem_categorization.rs b/src/librustc/middle/mem_categorization.rs index 207382d5e1f45..08820c561681c 100644 --- a/src/librustc/middle/mem_categorization.rs +++ b/src/librustc/middle/mem_categorization.rs @@ -3,7 +3,7 @@ //! The job of the categorization module is to analyze an expression to //! determine what kind of memory is used in evaluating it (for example, //! where dereferences occur and what kind of pointer is dereferenced; -//! whether the memory is mutable; etc) +//! whether the memory is mutable, etc.). //! //! Categorization effectively transforms all of our expressions into //! expressions of the following forms (the actual enum has many more @@ -16,21 +16,21 @@ //! | E.comp // access to an interior component //! //! Imagine a routine ToAddr(Expr) that evaluates an expression and returns an -//! address where the result is to be found. If Expr is a place, then this -//! is the address of the place. If Expr is an rvalue, this is the address of +//! address where the result is to be found. If Expr is a place, then this +//! is the address of the place. If `Expr` is an rvalue, this is the address of //! some temporary spot in memory where the result is stored. //! -//! Now, cat_expr() classifies the expression Expr and the address A=ToAddr(Expr) +//! Now, `cat_expr()` classifies the expression `Expr` and the address `A = ToAddr(Expr)` //! as follows: //! -//! - cat: what kind of expression was this? This is a subset of the +//! - `cat`: what kind of expression was this? This is a subset of the //! full expression forms which only includes those that we care about //! for the purpose of the analysis. -//! - mutbl: mutability of the address A -//! - ty: the type of data found at the address A +//! - `mutbl`: mutability of the address `A`. +//! - `ty`: the type of data found at the address `A`. //! //! The resulting categorization tree differs somewhat from the expressions -//! themselves. For example, auto-derefs are explicit. Also, an index a[b] is +//! themselves. For example, auto-derefs are explicit. Also, an index a[b] is //! decomposed into two operations: a dereference to reach the array data and //! then an index to jump forward to the relevant item. //! @@ -154,10 +154,10 @@ pub enum MutabilityCategory { McInherited, // Inherited from the fact that owner is mutable. } -// A note about the provenance of a `cmt`. This is used for +// A note about the provenance of a `cmt`. This is used for // special-case handling of upvars such as mutability inference. // Upvar categorization can generate a variable number of nested -// derefs. The note allows detecting them without deep pattern +// derefs. The note allows detecting them without deep pattern // matching on the categorization. #[derive(Clone, Copy, PartialEq, Debug)] pub enum Note { @@ -658,7 +658,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> { if self.tables.is_method_call(expr) { // If this is an index implemented by a method call, then it // will include an implicit deref of the result. - // The call to index() returns a `&T` value, which + // The call to `index()` returns a `&T` value, which // is an rvalue. That is what we will be // dereferencing. self.cat_overloaded_place(expr, base, NoteIndex) @@ -766,14 +766,14 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> { // `Categorization::Upvar`, which is itself a fiction -- it represents the reference to the // field from the environment. // - // `Categorization::Upvar`. Next, we add a deref through the implicit + // `Categorization::Upvar`. Next, we add a deref through the implicit // environment pointer with an anonymous free region 'env and // appropriate borrow kind for closure kinds that take self by - // reference. Finally, if the upvar was captured - // by-reference, we add a deref through that reference. The + // reference. Finally, if the upvar was captured + // by-reference, we add a deref through that reference. The // region of this reference is an inference variable 'up that // was previously generated and recorded in the upvar borrow - // map. The borrow kind bk is inferred by based on how the + // map. The borrow kind bk is inferred by based on how the // upvar is used. // // This results in the following table for concrete closure @@ -892,9 +892,9 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> { let var_ty = cmt_result.ty; - // We need to add the env deref. This means + // We need to add the env deref. This means // that the above is actually immutable and - // has a ref type. However, nothing should + // has a ref type. However, nothing should // actually look at the type, so we can get // away with stuffing a `Error` in there // instead of bothering to construct a proper @@ -1180,7 +1180,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> { // back? // // In general, the id of the cmt should be the node that - // "produces" the value---patterns aren't executable code + // "produces" the value -- patterns aren't executable code // exactly, but I consider them to "execute" when they match a // value, and I consider them to produce the value that was // matched. So if you have something like: @@ -1347,7 +1347,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> { } PatKind::Box(ref subpat) | PatKind::Ref(ref subpat, _) => { - // box p1, &p1, &mut p1. we can ignore the mutability of + // box p1, &p1, &mut p1. we can ignore the mutability of // PatKind::Ref since that information is already contained // in the type. let subcmt = Rc::new(self.cat_deref(pat, cmt, NoteNone)?); diff --git a/src/librustc/middle/reachable.rs b/src/librustc/middle/reachable.rs index 10deca836fff3..243d090233234 100644 --- a/src/librustc/middle/reachable.rs +++ b/src/librustc/middle/reachable.rs @@ -24,7 +24,7 @@ use hir::intravisit::{Visitor, NestedVisitorMap}; use hir::itemlikevisit::ItemLikeVisitor; use hir::intravisit; -// Returns true if the given item must be inlined because it may be +// Returns whether the given item must be inlined because it may be // monomorphized or it was marked with `#[inline]`. This will only return // true for functions. fn item_might_be_inlined(tcx: TyCtxt<'a, 'tcx, 'tcx>, @@ -138,8 +138,8 @@ impl<'a, 'tcx> Visitor<'tcx> for ReachableContext<'a, 'tcx> { } impl<'a, 'tcx> ReachableContext<'a, 'tcx> { - // Returns true if the given def ID represents a local item that is - // eligible for inlining and false otherwise. + // Returns whether the given def-ID represents a local item that is + // eligible for inlining. fn def_id_represents_local_inlined_item(&self, def_id: DefId) -> bool { let node_id = match self.tcx.hir().as_local_node_id(def_id) { Some(node_id) => node_id, @@ -326,7 +326,7 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> { // reachable if they are called from inlinable code. Generally, it's not known until // monomorphization if a specific trait impl item can be reachable or not. So, we // conservatively mark all of them as reachable. -// FIXME: One possible strategy for pruning the reachable set is to avoid marking impl +// FIXME: one possible strategy for pruning the reachable set is to avoid marking impl // items of non-exported traits (or maybe all local traits?) unless their respective // trait items are used from inlinable code through method call syntax or UFCS, or their // trait is a lang item. diff --git a/src/librustc/middle/region.rs b/src/librustc/middle/region.rs index ce2a348950622..1f69244734534 100644 --- a/src/librustc/middle/region.rs +++ b/src/librustc/middle/region.rs @@ -86,7 +86,7 @@ use rustc_data_structures::stable_hasher::{HashStable, StableHasher, /// of each range is not really the important thing in the above /// picture, but rather the ending point. /// -/// FIXME (pnkfelix): This currently derives `PartialOrd` and `Ord` to +/// FIXME(pnkfelix): This currently derives `PartialOrd` and `Ord` to /// placate the same deriving in `ty::FreeRegion`, but we may want to /// actually attach a more meaningful ordering to scopes than the one /// generated via deriving here. @@ -125,7 +125,7 @@ pub enum ScopeData { // (they outlive its body). Arguments, - // Scope of destructors for temporaries of node-id. + // Scope of destructors for temporaries of node-ID. Destruction, // Scope following a `let id = expr;` binding in a block. @@ -181,7 +181,7 @@ impl Scope { } /// Returns the span of this Scope. Note that in general the - /// returned span may not correspond to the span of any node id in + /// returned span may not correspond to the span of any node-ID in /// the AST. pub fn span(&self, tcx: TyCtxt<'_, '_, '_>, scope_tree: &ScopeTree) -> Span { let node_id = self.node_id(tcx, scope_tree); @@ -237,7 +237,7 @@ pub struct ScopeTree { /// which that variable is declared. var_map: FxHashMap, - /// maps from a node-id to the associated destruction scope (if any) + /// maps from a node-ID to the associated destruction scope (if any) destruction_scopes: FxHashMap, /// `rvalue_scopes` includes entries for those expressions whose cleanup scope is @@ -551,7 +551,7 @@ impl<'tcx> ScopeTree { self.is_subscope_of(scope2, scope1) } - /// Returns true if `subscope` is equal to or is lexically nested inside `superscope` and false + /// Returns whether `subscope` is equal to or is lexically nested inside `superscope` and false /// otherwise. pub fn is_subscope_of(&self, subscope: Scope, @@ -917,7 +917,7 @@ fn resolve_expr<'a, 'tcx>(visitor: &mut RegionResolutionVisitor<'a, 'tcx>, expr: // The idea is that call.callee_id represents *the time when // the invoked function is actually running* and call.id // represents *the time to prepare the arguments and make the - // call*. See the section "Borrows in Calls" borrowck/README.md + // call*. See the section "Borrows in Calls" borrowck/README.md // for an extended explanation of why this distinction is // important. // diff --git a/src/librustc/middle/resolve_lifetime.rs b/src/librustc/middle/resolve_lifetime.rs index 2d3653464d538..8ff85ae3d70eb 100644 --- a/src/librustc/middle/resolve_lifetime.rs +++ b/src/librustc/middle/resolve_lifetime.rs @@ -197,7 +197,7 @@ struct NamedRegionMap { // `Region` describing how that region is bound pub defs: NodeMap, - // the set of lifetime def ids that are late-bound; a region can + // the set of lifetime def-IDs that are late-bound; a region can // be late-bound if (a) it does NOT appear in a where-clause and // (b) it DOES appear in the arguments. pub late_bound: NodeSet, @@ -370,7 +370,7 @@ pub fn provide(providers: &mut ty::query::Providers<'_>) { ..*providers }; - // (*) FIXME the query should be defined to take a LocalDefId + // (*) FIXME: the query should be defined to take a LocalDefId } /// Computes the `ResolveLifetimes` map that contains data for the @@ -1198,7 +1198,7 @@ fn extract_labels(ctxt: &mut LifetimeContext<'_, '_>, body: &hir::Body) { fn visit_expr(&mut self, ex: &hir::Expr) { if let Some(label) = expression_label(ex) { for prior_label in &self.labels_in_fn[..] { - // FIXME (#24278): non-hygienic comparison + // FIXME(#24278): non-hygienic comparison if label.name == prior_label.name { signal_shadowing_problem( self.tcx, @@ -1246,7 +1246,7 @@ fn extract_labels(ctxt: &mut LifetimeContext<'_, '_>, body: &hir::Body) { Scope::Binder { ref lifetimes, s, .. } => { - // FIXME (#24278): non-hygienic comparison + // FIXME(#24278): non-hygienic comparison if let Some(def) = lifetimes.get(&hir::ParamName::Plain(label.modern())) { let node_id = tcx.hir().as_local_node_id(def.id().unwrap()).unwrap(); @@ -1581,7 +1581,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { match lifetimeuseset { Some(LifetimeUseSet::One(lifetime)) => { let node_id = self.tcx.hir().as_local_node_id(def_id).unwrap(); - debug!("node id first={:?}", node_id); + debug!("node-ID first={:?}", node_id); if let Some((id, span, name)) = match self.tcx.hir().get(node_id) { Node::Lifetime(hir_lifetime) => Some(( hir_lifetime.id, @@ -2565,7 +2565,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { param: &'tcx hir::GenericParam, ) { for label in &self.labels_in_fn { - // FIXME (#24278): non-hygienic comparison + // FIXME(#24278): non-hygienic comparison if param.name.ident().name == label.name { signal_shadowing_problem( self.tcx, @@ -2610,7 +2610,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { } } - /// Returns true if, in the current scope, replacing `'_` would be + /// Returns whether, in the current scope, replacing `'_` would be /// equivalent to a single-use lifetime. fn track_lifetime_uses(&self) -> bool { let mut scope = self.scope; diff --git a/src/librustc/middle/stability.rs b/src/librustc/middle/stability.rs index 43cb89ccf6c0f..4d7bc3000884c 100644 --- a/src/librustc/middle/stability.rs +++ b/src/librustc/middle/stability.rs @@ -49,7 +49,7 @@ enum AnnotationKind { pub struct DeprecationEntry { /// The metadata of the attribute associated with this entry. pub attr: Deprecation, - /// The def id where the attr was originally attached. `None` for non-local + /// The def-ID where the attr was originally attached. `None` for non-local /// `DefId`'s. origin: Option, } @@ -203,7 +203,7 @@ impl<'a, 'tcx: 'a> Annotator<'a, 'tcx> { } } - // Propagate unstability. This can happen even for non-staged-api crates in case + // Propagate unstability. This can happen even for non-staged-api crates in case // -Zforce-unstable-if-unmarked is set. if let Some(stab) = self.parent_stab { if stab.level.is_unstable() { @@ -565,7 +565,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { self.lint_node(lint, id, span, &msg); if id == ast::DUMMY_NODE_ID { - span_bug!(span, "emitted a {} lint with dummy node id: {:?}", lint.name, def_id); + span_bug!(span, "emitted a {} lint with dummy node-ID: {:?}", lint.name, def_id); } }; diff --git a/src/librustc/mir/interpret/allocation.rs b/src/librustc/mir/interpret/allocation.rs index 7ed29c5afd03f..bbf4cfac76ece 100644 --- a/src/librustc/mir/interpret/allocation.rs +++ b/src/librustc/mir/interpret/allocation.rs @@ -1,4 +1,4 @@ -//! The virtual memory representation of the MIR interpreter +//! The virtual memory representation of the MIR interpreter. use super::{ Pointer, EvalResult, AllocId, ScalarMaybeUndef, write_target_uint, read_target_uint, Scalar, @@ -174,7 +174,7 @@ impl<'tcx, Tag: Copy, Extra> Allocation { size: Size, check_defined_and_ptr: bool, ) -> EvalResult<'tcx, &[u8]> - // FIXME: Working around https://github.com/rust-lang/rust/issues/56209 + // FIXME: working around issue #56209. where Extra: AllocationExtra { self.check_bounds(cx, ptr, size)?; @@ -183,7 +183,7 @@ impl<'tcx, Tag: Copy, Extra> Allocation { self.check_defined(ptr, size)?; self.check_relocations(cx, ptr, size)?; } else { - // We still don't want relocations on the *edges* + // We still don't want relocations on the *edges*. self.check_relocation_edges(cx, ptr, size)?; } @@ -202,7 +202,7 @@ impl<'tcx, Tag: Copy, Extra> Allocation { ptr: Pointer, size: Size, ) -> EvalResult<'tcx, &[u8]> - // FIXME: Working around https://github.com/rust-lang/rust/issues/56209 + // FIXME: working around issue #56209. where Extra: AllocationExtra { self.get_bytes_internal(cx, ptr, size, true) @@ -217,7 +217,7 @@ impl<'tcx, Tag: Copy, Extra> Allocation { ptr: Pointer, size: Size, ) -> EvalResult<'tcx, &[u8]> - // FIXME: Working around https://github.com/rust-lang/rust/issues/56209 + // FIXME: working around issue #56209. where Extra: AllocationExtra { self.get_bytes_internal(cx, ptr, size, false) @@ -231,7 +231,7 @@ impl<'tcx, Tag: Copy, Extra> Allocation { ptr: Pointer, size: Size, ) -> EvalResult<'tcx, &mut [u8]> - // FIXME: Working around https://github.com/rust-lang/rust/issues/56209 + // FIXME: working around issue #56209. where Extra: AllocationExtra { assert_ne!(size.bytes(), 0, "0-sized accesses should never even get a `Pointer`"); @@ -258,7 +258,7 @@ impl<'tcx, Tag: Copy, Extra> Allocation { cx: &impl HasDataLayout, ptr: Pointer, ) -> EvalResult<'tcx, &[u8]> - // FIXME: Working around https://github.com/rust-lang/rust/issues/56209 + // FIXME: working around issue #56209. where Extra: AllocationExtra { assert_eq!(ptr.offset.bytes() as usize as u64, ptr.offset.bytes()); @@ -285,7 +285,7 @@ impl<'tcx, Tag: Copy, Extra> Allocation { size: Size, allow_ptr_and_undef: bool, ) -> EvalResult<'tcx> - // FIXME: Working around https://github.com/rust-lang/rust/issues/56209 + // FIXME: working around issue #56209. where Extra: AllocationExtra { // Check bounds and relocations on the edges @@ -307,7 +307,7 @@ impl<'tcx, Tag: Copy, Extra> Allocation { ptr: Pointer, src: &[u8], ) -> EvalResult<'tcx> - // FIXME: Working around https://github.com/rust-lang/rust/issues/56209 + // FIXME: working around issue #56209. where Extra: AllocationExtra { let bytes = self.get_bytes_mut(cx, ptr, Size::from_bytes(src.len() as u64))?; @@ -323,7 +323,7 @@ impl<'tcx, Tag: Copy, Extra> Allocation { val: u8, count: Size ) -> EvalResult<'tcx> - // FIXME: Working around https://github.com/rust-lang/rust/issues/56209 + // FIXME: working around issue #56209. where Extra: AllocationExtra { let bytes = self.get_bytes_mut(cx, ptr, count)?; @@ -347,7 +347,7 @@ impl<'tcx, Tag: Copy, Extra> Allocation { ptr: Pointer, size: Size ) -> EvalResult<'tcx, ScalarMaybeUndef> - // FIXME: Working around https://github.com/rust-lang/rust/issues/56209 + // FIXME: working around issue #56209. where Extra: AllocationExtra { // get_bytes_unchecked tests relocation edges @@ -384,7 +384,7 @@ impl<'tcx, Tag: Copy, Extra> Allocation { cx: &impl HasDataLayout, ptr: Pointer, ) -> EvalResult<'tcx, ScalarMaybeUndef> - // FIXME: Working around https://github.com/rust-lang/rust/issues/56209 + // FIXME: working around issue #56209. where Extra: AllocationExtra { self.read_scalar(cx, ptr, cx.data_layout().pointer_size) @@ -405,7 +405,7 @@ impl<'tcx, Tag: Copy, Extra> Allocation { val: ScalarMaybeUndef, type_size: Size, ) -> EvalResult<'tcx> - // FIXME: Working around https://github.com/rust-lang/rust/issues/56209 + // FIXME: working around issue #56209. where Extra: AllocationExtra { let val = match val { @@ -452,7 +452,7 @@ impl<'tcx, Tag: Copy, Extra> Allocation { ptr: Pointer, val: ScalarMaybeUndef ) -> EvalResult<'tcx> - // FIXME: Working around https://github.com/rust-lang/rust/issues/56209 + // FIXME: working around issue #56209. where Extra: AllocationExtra { let ptr_size = cx.data_layout().pointer_size; @@ -580,7 +580,7 @@ impl<'tcx, Tag, Extra> Allocation { /// Relocations #[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, RustcEncodable, RustcDecodable)] -pub struct Relocations(SortedMap); +pub struct Relocations(SortedMap); impl Relocations { pub fn new() -> Self { diff --git a/src/librustc/mir/interpret/error.rs b/src/librustc/mir/interpret/error.rs index 19be0c08ef13b..6f72d6419d367 100644 --- a/src/librustc/mir/interpret/error.rs +++ b/src/librustc/mir/interpret/error.rs @@ -145,7 +145,7 @@ impl<'a, 'gcx, 'tcx> ConstEvalErr<'tcx> { struct_error(tcx, message) }; err.span_label(self.span, self.error.to_string()); - // Skip the last, which is just the environment of the constant. The stacktrace + // Skip the last, which is just the environment of the constant. The stacktrace // is sometimes empty because we create "fake" eval contexts in CTFE to do work // on constant values. if self.stacktrace.len() > 0 { diff --git a/src/librustc/mir/interpret/pointer.rs b/src/librustc/mir/interpret/pointer.rs index a046825f088bb..fdcafa49f7160 100644 --- a/src/librustc/mir/interpret/pointer.rs +++ b/src/librustc/mir/interpret/pointer.rs @@ -70,7 +70,7 @@ impl PointerArithmetic for T {} /// Pointer is also generic over the `Tag` associated with each pointer, /// which is used to do provenance tracking during execution. #[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, RustcEncodable, RustcDecodable, Hash)] -pub struct Pointer { +pub struct Pointer { pub alloc_id: Id, pub offset: Size, pub tag: Tag, diff --git a/src/librustc/mir/interpret/value.rs b/src/librustc/mir/interpret/value.rs index 1e4cfedc2a6ae..4d73d61f231d0 100644 --- a/src/librustc/mir/interpret/value.rs +++ b/src/librustc/mir/interpret/value.rs @@ -21,7 +21,7 @@ pub enum ConstValue<'tcx> { /// Never returned from the `const_eval` query, but the HIR contains these frequently in order /// to allow HIR creation to happen for everything before needing to be able to run constant /// evaluation - /// FIXME: The query should then return a type that does not even have this variant. + /// FIXME: the query should then return a type that does not even have this variant. Unevaluated(DefId, &'tcx Substs<'tcx>), /// Used only for types with layout::abi::Scalar ABI and ZSTs @@ -83,7 +83,7 @@ impl<'tcx> ConstValue<'tcx> { /// size. Like a range of bytes in an `Allocation`, a `Scalar` can either represent the raw bytes /// of a simple value or a pointer into another `Allocation` #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, RustcEncodable, RustcDecodable, Hash)] -pub enum Scalar { +pub enum Scalar { /// The raw bytes of a simple value. Bits { /// The first `size` bytes are the value. @@ -401,7 +401,7 @@ impl From> for Scalar { } #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, RustcEncodable, RustcDecodable, Hash)] -pub enum ScalarMaybeUndef { +pub enum ScalarMaybeUndef { Scalar(Scalar), Undef, } diff --git a/src/librustc/mir/mod.rs b/src/librustc/mir/mod.rs index 36d51c5971278..5d6e885b5a84a 100644 --- a/src/librustc/mir/mod.rs +++ b/src/librustc/mir/mod.rs @@ -877,7 +877,7 @@ impl<'tcx> LocalDecl<'tcx> { } } - /// Returns true if local is definitely not a `ref ident` or + /// Returns whether local is definitely not a `ref ident` or /// `ref mut ident` binding. (Such bindings cannot be made into /// mutable bindings, but the inverse does not necessarily hold). pub fn is_nonref_binding(&self) -> bool { @@ -961,7 +961,7 @@ impl<'tcx> LocalDecl<'tcx> { visibility_scope: OUTERMOST_SOURCE_SCOPE, internal: false, is_block_tail: None, - name: None, // FIXME maybe we do want some name here? + name: None, // FIXME: maybe we do want some name here? is_user_variable: None, } } @@ -1010,7 +1010,7 @@ pub struct BasicBlockData<'tcx> { /// Terminator for this block. /// - /// NB. This should generally ONLY be `None` during construction. + /// N.B., this should generally ONLY be `None` during construction. /// Therefore, you should generally access it via the /// `terminator()` or `terminator_mut()` methods. The only /// exception is that certain passes, such as `simplify_cfg`, swap @@ -1895,7 +1895,7 @@ pub enum Place<'tcx> { Projection(Box>), } -/// The def-id of a static, along with its normalized type (which is +/// The def-ID of a static, along with its normalized type (which is /// stored to avoid requiring normalization when reading MIR). #[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, RustcEncodable, RustcDecodable)] pub struct Static<'tcx> { @@ -2132,7 +2132,7 @@ impl<'tcx> Debug for Operand<'tcx> { impl<'tcx> Operand<'tcx> { /// Convenience helper to make a constant that refers to the fn - /// with given def-id and substs. Since this is used to synthesize + /// with given def-ID and substs. Since this is used to synthesize /// MIR, assumes `user_ty` is None. pub fn function_handle<'a>( tcx: TyCtxt<'a, 'tcx, 'tcx>, @@ -2530,11 +2530,11 @@ impl<'tcx> UserTypeProjections<'tcx> { UserTypeProjections { contents: projs.collect() } } - pub fn projections_and_spans(&self) -> impl Iterator, Span)> { + pub fn projections_and_spans(&self) -> impl Iterator, Span)> { self.contents.iter() } - pub fn projections(&self) -> impl Iterator> { + pub fn projections(&self) -> impl Iterator> { self.contents.iter().map(|&(ref user_type, _span)| user_type) } } @@ -2740,7 +2740,7 @@ impl Location { } } - /// Returns `true` if `other` is earlier in the control flow graph than `self`. + /// Returns whether `other` is earlier in the control flow graph than `self`. pub fn is_predecessor_of<'tcx>(&self, other: Location, mir: &Mir<'tcx>) -> bool { // If we are in the same block as the other location and are an earlier statement // then we are a predecessor of `other`. diff --git a/src/librustc/mir/mono.rs b/src/librustc/mir/mono.rs index 55f5c36cde66d..762aa0d81a95d 100644 --- a/src/librustc/mir/mono.rs +++ b/src/librustc/mir/mono.rs @@ -268,7 +268,7 @@ impl<'a, 'gcx: 'tcx, 'tcx: 'a> CodegenUnitNameBuilder<'a, 'gcx, 'tcx> { components: I, special_suffix: Option) -> InternedString - where I: IntoIterator, + where I: IntoIterator, C: fmt::Display, S: fmt::Display, { @@ -291,7 +291,7 @@ impl<'a, 'gcx: 'tcx, 'tcx: 'a> CodegenUnitNameBuilder<'a, 'gcx, 'tcx> { components: I, special_suffix: Option) -> InternedString - where I: IntoIterator, + where I: IntoIterator, C: fmt::Display, S: fmt::Display, { diff --git a/src/librustc/mir/visit.rs b/src/librustc/mir/visit.rs index a20b8231f88a2..a762299d14422 100644 --- a/src/librustc/mir/visit.rs +++ b/src/librustc/mir/visit.rs @@ -1033,7 +1033,7 @@ pub enum PlaceContext<'tcx> { } impl<'tcx> PlaceContext<'tcx> { - /// Returns `true` if this place context represents a drop. + /// Returns whether this place context represents a drop. pub fn is_drop(&self) -> bool { match *self { PlaceContext::MutatingUse(MutatingUseContext::Drop) => true, @@ -1041,7 +1041,7 @@ impl<'tcx> PlaceContext<'tcx> { } } - /// Returns `true` if this place context represents a borrow. + /// Returns whether this place context represents a borrow. pub fn is_borrow(&self) -> bool { match *self { PlaceContext::NonMutatingUse(NonMutatingUseContext::SharedBorrow(..)) | @@ -1052,7 +1052,7 @@ impl<'tcx> PlaceContext<'tcx> { } } - /// Returns `true` if this place context represents a storage live or storage dead marker. + /// Returns whether this place context represents a storage live or storage dead marker. pub fn is_storage_marker(&self) -> bool { match *self { PlaceContext::NonUse(NonUseContext::StorageLive) | @@ -1061,7 +1061,7 @@ impl<'tcx> PlaceContext<'tcx> { } } - /// Returns `true` if this place context represents a storage live marker. + /// Returns whether this place context represents a storage live marker. pub fn is_storage_live_marker(&self) -> bool { match *self { PlaceContext::NonUse(NonUseContext::StorageLive) => true, @@ -1069,7 +1069,7 @@ impl<'tcx> PlaceContext<'tcx> { } } - /// Returns `true` if this place context represents a storage dead marker. + /// Returns whether this place context represents a storage dead marker. pub fn is_storage_dead_marker(&self) -> bool { match *self { PlaceContext::NonUse(NonUseContext::StorageDead) => true, @@ -1077,7 +1077,7 @@ impl<'tcx> PlaceContext<'tcx> { } } - /// Returns `true` if this place context represents a use that potentially changes the value. + /// Returns whether this place context represents a use that potentially changes the value. pub fn is_mutating_use(&self) -> bool { match *self { PlaceContext::MutatingUse(..) => true, @@ -1085,7 +1085,7 @@ impl<'tcx> PlaceContext<'tcx> { } } - /// Returns `true` if this place context represents a use that does not change the value. + /// Returns whether this place context represents a use that does not change the value. pub fn is_nonmutating_use(&self) -> bool { match *self { PlaceContext::NonMutatingUse(..) => true, @@ -1093,7 +1093,7 @@ impl<'tcx> PlaceContext<'tcx> { } } - /// Returns `true` if this place context represents a use. + /// Returns whether this place context represents a use. pub fn is_use(&self) -> bool { match *self { PlaceContext::NonUse(..) => false, @@ -1101,7 +1101,7 @@ impl<'tcx> PlaceContext<'tcx> { } } - /// Returns `true` if this place context represents an assignment statement. + /// Returns whether this place context represents an assignment statement. pub fn is_place_assignment(&self) -> bool { match *self { PlaceContext::MutatingUse(MutatingUseContext::Store) | diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs index 33409f9b4a74f..86c0264ea5a46 100644 --- a/src/librustc/session/config.rs +++ b/src/librustc/session/config.rs @@ -526,7 +526,7 @@ impl OutputFilenames { } /// Like temp_path, but also supports things where there is no corresponding - /// OutputType, like no-opt-bitcode or lto-bitcode. + /// OutputType, like noopt-bitcode or lto-bitcode. pub fn temp_path_ext(&self, ext: &str, codegen_unit_name: Option<&str>) -> PathBuf { let base = self.out_directory.join(&self.filestem()); @@ -564,7 +564,7 @@ impl OutputFilenames { pub fn host_triple() -> &'static str { // Get the host triple out of the build environment. This ensures that our // idea of the host triple is the same as for the set of libraries we've - // actually built. We can't just take LLVM's host triple because they + // actually built. We can't just take LLVM's host triple because they // normalize all ix86 architectures to i386. // // Instead of grabbing the host triple (for the current host), we grab (at @@ -1528,7 +1528,7 @@ impl RustcOptGroup { // The `opt` local module holds wrappers around the `getopts` API that // adds extra rustc-specific metadata to each option; such metadata -// is exposed by . The public +// is exposed by . The public // functions below ending with `_u` are the functions that return // *unstable* options, i.e., options that are only enabled when the // user also passes the `-Z unstable-options` debugging flag. diff --git a/src/librustc/session/filesearch.rs b/src/librustc/session/filesearch.rs index 19f1c7a18fad1..f2016f4839228 100644 --- a/src/librustc/session/filesearch.rs +++ b/src/librustc/session/filesearch.rs @@ -115,7 +115,7 @@ pub fn make_target_lib_path(sysroot: &Path, target_triple: &str) -> PathBuf { } pub fn get_or_default_sysroot() -> PathBuf { - // Follow symlinks. If the resolved path is relative, make it absolute. + // Follow symlinks. If the resolved path is relative, make it absolute. fn canonicalize(path: Option) -> Option { path.and_then(|path| { match fs::canonicalize(&path) { @@ -141,7 +141,7 @@ pub fn get_or_default_sysroot() -> PathBuf { // The name of the directory rustc expects libraries to be located. fn find_libdir(sysroot: &Path) -> Cow<'static, str> { - // FIXME: This is a quick hack to make the rustc binary able to locate + // FIXME: this is a quick hack to make the rustc binary able to locate // Rust libraries in Linux environments where libraries might be installed // to lib64/lib32. This would be more foolproof by basing the sysroot off // of the directory where librustc is located, rather than where the rustc diff --git a/src/librustc/session/mod.rs b/src/librustc/session/mod.rs index 5c977d5969e16..c321545dfafdf 100644 --- a/src/librustc/session/mod.rs +++ b/src/librustc/session/mod.rs @@ -236,7 +236,7 @@ impl Session { ) -> DiagnosticBuilder<'a> { self.diagnostic().struct_span_err_with_code(sp, msg, code) } - // FIXME: This method should be removed (every error should have an associated error code). + // FIXME: this method should be removed (every error should have an associated error code). pub fn struct_err<'a>(&'a self, msg: &str) -> DiagnosticBuilder<'a> { self.diagnostic().struct_err(msg) } @@ -391,7 +391,7 @@ impl Session { Some(next) => { self.next_node_id.set(ast::NodeId::from_usize(next)); } - None => bug!("Input too large, ran out of node ids!"), + None => bug!("Input too large, ran out of node-IDs!"), } id @@ -702,7 +702,7 @@ impl Session { &self.sysroot, self.opts.target_triple.triple(), &self.opts.search_paths, - // target_tlib_path==None means it's the same as host_tlib_path. + // `target_tlib_path == None` means it's the same as `host_tlib_path`. self.target_tlib_path.as_ref().unwrap_or(&self.host_tlib_path), kind, ) @@ -1027,7 +1027,7 @@ pub fn build_session_with_source_map( source_map: Lrc, emitter_dest: Option>, ) -> Session { - // FIXME: This is not general enough to make the warning lint completely override + // FIXME: this is not general enough to make the warning lint completely override // normal diagnostic warnings, since the warning lint can also be denied and changed // later via the source code. let warnings_allow = sopts diff --git a/src/librustc/traits/auto_trait.rs b/src/librustc/traits/auto_trait.rs index f96c4e9014b36..74b28735c1e71 100644 --- a/src/librustc/traits/auto_trait.rs +++ b/src/librustc/traits/auto_trait.rs @@ -115,7 +115,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> { } }); - // If an explicit impl exists, it always takes priority over an auto impl + // If an explicit impl exists, it always takes priority over an auto impl. if bail_out { return AutoTraitResult::ExplicitImpl; } diff --git a/src/librustc/traits/codegen/mod.rs b/src/librustc/traits/codegen/mod.rs index 94d56c2cbfc88..25d3f02c776e9 100644 --- a/src/librustc/traits/codegen/mod.rs +++ b/src/librustc/traits/codegen/mod.rs @@ -1,5 +1,5 @@ // This file contains various trait resolution methods used by codegen. -// They all assume regions can be erased and monomorphic types. It +// They all assume regions can be erased and monomorphic types. It // seems likely that they should eventually be merged into more // general routines. @@ -14,8 +14,8 @@ use ty::{self, Ty, TyCtxt}; use ty::subst::{Subst, Substs}; use ty::fold::TypeFoldable; -/// Attempts to resolve an obligation to a vtable.. The result is -/// a shallow vtable resolution -- meaning that we do not +/// Attempts to resolve an obligation to a vtable. The result is +/// a shallow vtable resolution, meaning that we do not /// (necessarily) resolve all nested obligations on the impl. Note /// that type check should guarantee to us that all nested /// obligations *could be* resolved if we wanted to. @@ -45,8 +45,8 @@ pub fn codegen_fulfill_obligation<'a, 'tcx>(ty: TyCtxt<'a, 'tcx, 'tcx>, Ok(Some(selection)) => selection, Ok(None) => { // Ambiguity can happen when monomorphizing during trans - // expands to some humongo type that never occurred - // statically -- this humongo type can then overflow, + // expands to some huge type that never occurred + // statically -- this huge type can then overflow, // leading to an ambiguous result. So report this as an // overflow bug, since I believe this is the only case // where ambiguity can result. diff --git a/src/librustc/traits/coherence.rs b/src/librustc/traits/coherence.rs index 980c98d2a2d50..5d774f125702a 100644 --- a/src/librustc/traits/coherence.rs +++ b/src/librustc/traits/coherence.rs @@ -219,7 +219,7 @@ pub enum OrphanCheckErr<'tcx> { } /// Checks the coherence orphan rules. `impl_def_id` should be the -/// def-id of a trait impl. To pass, either the trait must be local, or else +/// def-ID of a trait impl. To pass, either the trait must be local, or else /// two conditions must be satisfied: /// /// 1. All type parameters in `Self` must be "covered" by some local type constructor. diff --git a/src/librustc/traits/error_reporting.rs b/src/librustc/traits/error_reporting.rs index 0e63ef666c75a..a5386402ff156 100644 --- a/src/librustc/traits/error_reporting.rs +++ b/src/librustc/traits/error_reporting.rs @@ -142,7 +142,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { if let ty::Predicate::Trait(implication) = implication { let error = error.to_poly_trait_ref(); let implication = implication.to_poly_trait_ref(); - // FIXME: I'm just not taking associated types at all here. + // FIXME: i'm just not taking associated types at all here. // Eventually I'll need to implement param-env-aware // `Γ₁ ⊦ φ₁ => Γ₂ ⊦ φ₂` logic. let param_env = ty::ParamEnv::empty(); @@ -1274,7 +1274,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { fn maybe_report_ambiguity(&self, obligation: &PredicateObligation<'tcx>, body_id: Option) { - // Unable to successfully determine, probably means + // Unable to successfully determine; probably means // insufficient type information, but could mean // ambiguous impls. The latter *ought* to be a // coherence violation, so we don't report it here. @@ -1312,16 +1312,16 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { // This is kind of a hack: it frequently happens that some earlier // error prevents types from being fully inferred, and then we get // a bunch of uninteresting errors saying something like " doesn't implement Sized". It may even be true that we + // #0> doesn't implement Sized". It may even be true that we // could just skip over all checks where the self-ty is an // inference variable, but I was afraid that there might be an // inference variable created, registered as an obligation, and // then never forced by writeback, and hence by skipping here we'd - // be ignoring the fact that we don't KNOW the type works + // be ignoring the fact that we don't _know_ the type works // out. Though even that would probably be harmless, given that // we're only talking about builtin traits, which are known to be // inhabited. But in any case I just threw in this check for - // has_errors() to be sure that compilation isn't happening + // `has_errors()` to be sure that compilation isn't happening // anyway. In that case, why inundate the user. if !self.tcx.sess.has_errors() { if @@ -1351,10 +1351,10 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { ty::Predicate::Subtype(ref data) => { if data.references_error() || self.tcx.sess.has_errors() { - // no need to overload user in such cases + // No need to overload user in such `cases.need_type_info_err`. } else { let &SubtypePredicate { a_is_expected: _, a, b } = data.skip_binder(); - // both must be type variables, or the other would've been instantiated + // Both must be type variables, else the other would've been instantiated. assert!(a.is_ty_var() && b.is_ty_var()); self.need_type_info_err(body_id, obligation.cause.span, diff --git a/src/librustc/traits/fulfill.rs b/src/librustc/traits/fulfill.rs index 556b97dc9bcf1..7142165576685 100644 --- a/src/librustc/traits/fulfill.rs +++ b/src/librustc/traits/fulfill.rs @@ -23,7 +23,7 @@ impl<'tcx> ForestObligation for PendingPredicateObligation<'tcx> { fn as_predicate(&self) -> &Self::Predicate { &self.obligation.predicate } } -/// The fulfillment context is used to drive trait resolution. It +/// The fulfillment context is used to drive trait resolution. It /// consists of a list of obligations that must be (eventually) /// satisfied. The job is to track which are satisfied, which yielded /// errors, and which are still pending. At any point, users can call @@ -176,7 +176,7 @@ impl<'tcx> TraitEngine<'tcx> for FulfillmentContext<'tcx> { infcx: &InferCtxt<'a, 'gcx, 'tcx>, obligation: PredicateObligation<'tcx>) { - // this helps to reduce duplicate errors, as well as making + // This helps to reduce duplicate errors, as well as making // debug output much nicer to read and so on. let obligation = infcx.resolve_type_vars_if_possible(&obligation); @@ -500,7 +500,7 @@ impl<'a, 'b, 'gcx, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'b, 'gcx, fn process_backedge<'c, I>(&mut self, cycle: I, _marker: PhantomData<&'c PendingPredicateObligation<'tcx>>) - where I: Clone + Iterator>, + where I: Clone + Iterator>, { if self.selcx.coinductive_match(cycle.clone().map(|s| s.obligation.predicate)) { debug!("process_child_obligations: coinductive match"); diff --git a/src/librustc/traits/mod.rs b/src/librustc/traits/mod.rs index 49bd04782b28e..6587aad11077c 100644 --- a/src/librustc/traits/mod.rs +++ b/src/librustc/traits/mod.rs @@ -72,14 +72,14 @@ pub use self::FulfillmentErrorCode::*; pub use self::SelectionError::*; pub use self::Vtable::*; -// Whether to enable bug compatibility with issue #43355 +/// Whether to enable bug compatibility with issue #43355. #[derive(Copy, Clone, PartialEq, Eq, Debug)] pub enum IntercrateMode { Issue43355, Fixed } -// The mode that trait queries run in +/// The mode that trait queries run in. #[derive(Copy, Clone, PartialEq, Eq, Debug)] pub enum TraitQueryMode { // Standard/un-canonicalized queries get accurate @@ -92,8 +92,8 @@ pub enum TraitQueryMode { Canonical, } -/// An `Obligation` represents some trait reference (e.g., `int:Eq`) for -/// which the vtable must be found. The process of finding a vtable is +/// An `Obligation` represents some trait reference (e.g., `int: Eq`) for +/// which the vtable must be found. The process of finding a vtable is /// called "resolving" the `Obligation`. This process consists of /// either identifying an `impl` (e.g., `impl Eq for int`) that /// provides the required vtable, or else finding a bound that is in @@ -525,7 +525,7 @@ pub enum Vtable<'tcx, N> { /// Successful resolution for a builtin trait. VtableBuiltin(VtableBuiltinData), - /// Vtable automatically generated for a closure. The def ID is the ID + /// Vtable automatically generated for a closure. The def-ID is the ID /// of the closure expression. This is a `VtableImpl` in spirit, but the /// impl is generated by the compiler and does not appear in the source. VtableClosure(VtableClosureData<'tcx, N>), @@ -660,12 +660,12 @@ pub fn type_known_to_meet_bound<'a, 'gcx, 'tcx>(infcx: &InferCtxt<'a, 'gcx, 'tcx // this function's result remains infallible, we must confirm // that guess. While imperfect, I believe this is sound. - // The handling of regions in this area of the code is terrible, + // The handling of regions in this area of the code is terrible; // see issue #29149. We should be able to improve on this with // NLL. let mut fulfill_cx = FulfillmentContext::new_ignoring_regions(); - // We can use a dummy node-id here because we won't pay any mind + // We can use a dummy node-ID here because we won't pay any mind // to region obligations that arise (there shouldn't really be any // anyhow). let cause = ObligationCause::misc(span, ast::DUMMY_NODE_ID); @@ -710,17 +710,17 @@ fn do_normalize_predicates<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, ); let span = cause.span; tcx.infer_ctxt().enter(|infcx| { - // FIXME. We should really... do something with these region - // obligations. But this call just continues the older + // FIXME(nmatsakis): we should really do something with these + // region obligations. But this call just continues the older // behavior (i.e., doesn't cause any new bugs), and it would // take some further refactoring to actually solve them. In // particular, we would have to handle implied bounds // properly, and that code is currently largely confined to // regionck (though I made some efforts to extract it - // out). -nmatsakis + // out). // - // @arielby: In any case, these obligations are checked - // by wfcheck anyway, so I'm not sure we have to check + // NOTE(arielby): in any case, these obligations are checked + // by wfcheck, so I'm not sure we have to check // them here too, and we will remove this function when // we move over to lazy normalization *anyway*. let fulfill_cx = FulfillmentContext::new_ignoring_regions(); @@ -771,14 +771,14 @@ fn do_normalize_predicates<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, match tcx.lift_to_global(&predicates) { Some(predicates) => Ok(predicates), None => { - // FIXME: shouldn't we, you know, actually report an error here? or an ICE? + // FIXME: shouldn't we, you know, actually report an error/ICE here? Err(ErrorReported) } } }) } -// FIXME: this is gonna need to be removed ... +// FIXME: this is gonna need to be removed... /// Normalizes the parameter environment, reporting errors if they occur. pub fn normalize_param_env_or_error<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, region_context: DefId, diff --git a/src/librustc/traits/object_safety.rs b/src/librustc/traits/object_safety.rs index 1554afdeefdaf..d3e06c7c44cc4 100644 --- a/src/librustc/traits/object_safety.rs +++ b/src/librustc/traits/object_safety.rs @@ -6,7 +6,7 @@ //! - have a suitable receiver from which we can extract a vtable and coerce to a "thin" version //! that doesn't contain the vtable; //! - not reference the erased type `Self` except for in this receiver; -//! - not have generic type parameters +//! - not have generic type parameters. use super::elaborate_predicates; @@ -22,17 +22,17 @@ use syntax_pos::Span; #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)] pub enum ObjectSafetyViolation { - /// Self : Sized declared on the trait + /// `Self: Sized` declared on the trait. SizedSelf, /// Supertrait reference references `Self` an in illegal location - /// (e.g., `trait Foo : Bar`) + /// (e.g., `trait Foo : Bar`). SupertraitSelf, - /// Method has something illegal + /// Method has something illegal. Method(ast::Name, MethodViolationCode), - /// Associated const + /// Associated const. AssociatedConst(ast::Name), } @@ -84,7 +84,7 @@ pub enum MethodViolationCode { impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { /// Returns the object safety violations that affect - /// astconv - currently, Self in supertraits. This is needed + /// astconv -- currently, `Self` in supertraits. This is needed /// because `object_safety_violations` can't be used during /// type collection. pub fn astconv_object_safety_violations(self, trait_def_id: DefId) @@ -177,7 +177,7 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { .any(|predicate| { match predicate { ty::Predicate::Trait(ref data) => { - // In the case of a trait predicate, we can skip the "self" type. + // In the case of a trait predicate, we can skip the self type. data.skip_binder().input_types().skip(1).any(|t| t.has_self_ty()) } ty::Predicate::Projection(ref data) => { @@ -187,7 +187,7 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { // the check to be safe. // // Note that we *do* allow projection *outputs* to contain - // `self` (i.e., `trait Foo: Bar { type Result; }`), + // `self` (i.e., `trait Foo: Bar { type Result; }`), // we just require the user to specify *both* outputs // in the object type (i.e., `dyn Foo`). // @@ -220,10 +220,10 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { fn generics_require_sized_self(self, def_id: DefId) -> bool { let sized_def_id = match self.lang_items().sized_trait() { Some(def_id) => def_id, - None => { return false; /* No Sized trait, can't require it! */ } + None => { return false; /* no `Sized` trait; can't require it! */ } }; - // Search for a predicate like `Self : Sized` amongst the trait bounds. + // Search for a predicate like `Self: Sized` amongst the trait bounds. let predicates = self.predicates_of(def_id); let predicates = predicates.instantiate_identity(self).predicates; elaborate_predicates(self, predicates) @@ -252,7 +252,7 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { method: &ty::AssociatedItem) -> Option { - // Any method that has a `Self : Sized` requisite is otherwise + // Any method that has a `Self: Sized` requisite is otherwise // exempt from the regulations. if self.generics_require_sized_self(method.def_id) { return None; @@ -262,15 +262,15 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { } /// We say a method is *vtable safe* if it can be invoked on a trait - /// object. Note that object-safe traits can have some - /// non-vtable-safe methods, so long as they require `Self:Sized` or - /// otherwise ensure that they cannot be used when `Self=Trait`. + /// object. Note that object-safe traits can have some + /// non-vtable-safe methods, so long as they require `Self: Sized` or + /// otherwise ensure that they cannot be used when `Self = Trait`. pub fn is_vtable_safe_method(self, trait_def_id: DefId, method: &ty::AssociatedItem) -> bool { - // Any method that has a `Self : Sized` requisite can't be called. + // Any method that has a `Self: Sized` bound can't be called. if self.generics_require_sized_self(method.def_id) { return false; } @@ -290,7 +290,7 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { method: &ty::AssociatedItem) -> Option { - // The method's first parameter must be named `self` + // The method's first parameter must be named `self`. if !method.method_has_self_argument { return Some(MethodViolationCode::StaticMethod); } @@ -329,15 +329,16 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { &sig.map_bound(|sig| sig.inputs()[0]), ); - // until `unsized_locals` is fully implemented, `self: Self` can't be dispatched on. + // Until `unsized_locals` is fully implemented, `self: Self` can't be dispatched on. // However, this is already considered object-safe. We allow it as a special case here. - // FIXME(mikeyhew) get rid of this `if` statement once `receiver_is_dispatchable` allows - // `Receiver: Unsize dyn Trait]>` + // FIXME(mikeyhew): get rid of this `if` statement once `receiver_is_dispatchable` allows + // `Receiver: Unsize dyn Trait]>`. if receiver_ty != self.mk_self_type() { if !self.receiver_is_dispatchable(method, receiver_ty) { return Some(MethodViolationCode::UndispatchableReceiver); } else { - // sanity check to make sure the receiver actually has the layout of a pointer + // Perform sanity check to make sure the receiver actually has the layout of a + // pointer. use ty::layout::Abi; @@ -352,7 +353,7 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { } }; - // e.g., Rc<()> + // e.g., `Rc<()>` let unit_receiver_ty = self.receiver_for_self_ty( receiver_ty, self.mk_unit(), method.def_id ); @@ -366,7 +367,7 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { trait_def_id, self.mk_region(ty::ReStatic) ); - // e.g., Rc + // e.g., `Rc` let trait_object_receiver = self.receiver_for_self_ty( receiver_ty, trait_object_ty, method.def_id ); @@ -384,8 +385,8 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { None } - /// performs a type substitution to produce the version of receiver_ty when `Self = self_ty` - /// e.g., for receiver_ty = `Rc` and self_ty = `Foo`, returns `Rc` + /// Performs a type substitution to produce the version of receiver_ty when `Self = self_ty` + /// e.g., for receiver_ty = `Rc` and self_ty = `Foo`, returns `Rc`. fn receiver_for_self_ty( self, receiver_ty: Ty<'tcx>, self_ty: Ty<'tcx>, method_def_id: DefId ) -> Ty<'tcx> { @@ -400,9 +401,9 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { receiver_ty.subst(self, substs) } - /// creates the object type for the current trait. For example, + /// Creates the object type for the current trait. For example, /// if the current trait is `Deref`, then this will be - /// `dyn Deref + 'static` + /// `dyn Deref + 'static`. fn object_ty_for_trait(self, trait_def_id: DefId, lifetime: ty::Region<'tcx>) -> Ty<'tcx> { debug!("object_ty_for_trait: trait_def_id={:?}", trait_def_id); @@ -417,7 +418,7 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { .filter(|item| item.kind == ty::AssociatedKind::Type) .collect::>(); - // existential predicates need to be in a specific order + // Existential predicates need to be in a specific order. associated_types.sort_by_cached_key(|item| self.def_path_hash(item.def_id)); let projection_predicates = associated_types.into_iter().map(|item| { @@ -442,7 +443,7 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { object_ty } - /// checks the method's receiver (the `self` argument) can be dispatched on when `Self` is a + /// Checks the method's receiver (the `self` argument) can be dispatched on when `Self` is a /// trait object. We require that `DispatchableFromDyn` be implemented for the receiver type /// in the following way: /// - let `Receiver` be the type of the `self` argument, i.e `Self`, `&Self`, `Rc` @@ -481,7 +482,7 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { /// for `self: Rc`, this means `Rc: DispatchFromDyn>` /// for `self: Pin>`, this means `Pin>: DispatchFromDyn>>` // - // FIXME(mikeyhew) when unsized receivers are implemented as part of unsized rvalues, add this + // FIXME(mikeyhew): when unsized receivers are implemented as part of unsized rvalues, add this // fallback query: `Receiver: Unsize U]>` to support receivers like // `self: Wrapper`. #[allow(dead_code)] @@ -501,10 +502,10 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { return false; }; - // the type `U` in the query - // use a bogus type parameter to mimick a forall(U) query using u32::MAX for now. - // FIXME(mikeyhew) this is a total hack, and we should replace it when real forall queries - // are implemented + // This is the type `U` in the query. + // Use a bogus type parameter to mimick a `forall(U)` query using `u32::MAX` for now. + // FIXME(mikeyhew): this is a total hack, and we should replace it when real forall queries + // are implemented. let unsized_self_ty: Ty<'tcx> = self.mk_ty_param( ::std::u32::MAX, Name::intern("RustaceansAreAwesome").as_interned_str(), @@ -515,18 +516,18 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { receiver_ty, unsized_self_ty, method.def_id ); - // create a modified param env, with `Self: Unsize` and `U: Trait` added to caller bounds - // `U: ?Sized` is already implied here + // Create a modified param env, with `Self: Unsize` and `U: Trait` added to caller + // bounds. `U: ?Sized` is already implied here. let param_env = { let mut param_env = self.param_env(method.def_id); - // Self: Unsize + // `Self: Unsize` let unsize_predicate = ty::TraitRef { def_id: unsize_did, substs: self.mk_substs_trait(self.mk_self_type(), &[unsized_self_ty.into()]), }.to_predicate(); - // U: Trait + // `U: Trait` let trait_predicate = { let substs = Substs::for_item(self, method.container.assert_trait(), |param, _| { if param.index == 0 { @@ -552,7 +553,7 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { param_env }; - // Receiver: DispatchFromDyn U]> + // Receiver: `DispatchFromDyn U]>` let obligation = { let predicate = ty::TraitRef { def_id: dispatch_from_dyn_did, @@ -567,7 +568,7 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { }; self.infer_ctxt().enter(|ref infcx| { - // the receiver is dispatchable iff the obligation holds + // The receiver is dispatchable iff the obligation holds. infcx.predicate_must_hold(&obligation) }) } @@ -643,7 +644,7 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { // SomeTrait` is in fact a supertrait of the // current trait. In that case, this type is // legal, because the type `X` will be specified - // in the object type. Note that we can just use + // in the object type. Note that we can just use // direct equality here because all of these types // are part of the formal parameter listing, and // hence there should be no inference variables. diff --git a/src/librustc/traits/project.rs b/src/librustc/traits/project.rs index 952b37b89f2d4..43e9f9edea092 100644 --- a/src/librustc/traits/project.rs +++ b/src/librustc/traits/project.rs @@ -118,7 +118,7 @@ impl<'tcx> ProjectionTyCandidateSet<'tcx> { *self = ProjectionTyCandidateSet::Error(err); } - // Returns true if the push was successful, or false if the candidate + // Returns whether the push was successful, or false if the candidate // was discarded -- this could be because of ambiguity, or because // a higher-priority candidate is already there. fn push_candidate(&mut self, candidate: ProjectionTyCandidate<'tcx>) -> bool { @@ -142,16 +142,16 @@ impl<'tcx> ProjectionTyCandidateSet<'tcx> { } Single(current) => { - // Duplicates can happen inside ParamEnv. In the case, we + // Duplicates can happen inside `ParamEnv`. In the case, we // perform a lazy deduplication. if current == &candidate { return false; } // Prefer where-clauses. As in select, if there are multiple - // candidates, we prefer where-clause candidates over impls. This + // candidates, we prefer where-clause candidates over impls. This // may seem a bit surprising, since impls are the source of - // "truth" in some sense, but in fact some of the impls that SEEM + // "truth" in some sense, but in fact some of the impls that _seem_ // applicable are not, because of nested obligations. Where // clauses are the safer choice. See the comment on // `select::SelectionCandidate` and #21974 for more details. @@ -532,7 +532,7 @@ fn opt_normalize_projection_type<'a, 'b, 'gcx, 'tcx>( // means we don't capture the type variables that are created in // the case of ambiguity. Which means we may create a large stream // of such variables. OTOH, if we move the caching up a level, we - // would not benefit from caching when proving `T: Trait` + // would not benefit from caching when proving `T: Trait` // bounds. It might be the case that we want two distinct caches, // or else another kind of cache entry. @@ -556,14 +556,14 @@ fn opt_normalize_projection_type<'a, 'b, 'gcx, 'tcx>( } } Err(ProjectionCacheEntry::InProgress) => { - // If while normalized A::B, we are asked to normalize - // A::B, just return A::B itself. This is a conservative - // answer, in the sense that A::B *is* clearly equivalent + // If while normalized `A::B`, we are asked to normalize + // `A::B`, just return `A::B` itself. This is a conservative + // answer, in the sense that `A::B` *is* clearly equivalent // to A::B, though there may be a better value we can // find. // Under lazy normalization, this can arise when - // bootstrapping. That is, imagine an environment with a + // bootstrapping. That is, imagine an environment with a // where-clause like `A::B == u32`. Now, if we are asked // to normalize `A::B`, we will want to check the // where-clauses in scope. So we will try to unify `A::B` @@ -767,9 +767,9 @@ fn prune_cache_value_obligations<'a, 'gcx, 'tcx>(infcx: &'a InferCtxt<'a, 'gcx, /// /// Concern #2. Even within the snapshot, if those original /// obligations are not yet proven, then we are able to do projections -/// that may yet turn out to be wrong. This *may* lead to some sort +/// that may yet turn out to be wrong. This *may* lead to some sort /// of trouble, though we don't have a concrete example of how that -/// can occur yet. But it seems risky at best. +/// can occur yet. But it seems risky at best. fn get_paranoid_cache_value_obligation<'a, 'gcx, 'tcx>( infcx: &'a InferCtxt<'a, 'gcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, @@ -802,7 +802,7 @@ fn get_paranoid_cache_value_obligation<'a, 'gcx, 'tcx>( /// cycles to arise, where you basically had a setup like ` /// as Trait>::Foo == $0`. Here, normalizing ` as /// Trait>::Foo> to `[type error]` would lead to an obligation of -/// ` as Trait>::Foo`. We are supposed to report +/// ` as Trait>::Foo`. We are supposed to report /// an error for this obligation, but we legitimately should not, /// because it contains `[type error]`. Yuck! (See issue #29857 for /// one case where this arose.) @@ -962,14 +962,14 @@ fn assemble_candidates_from_trait_def<'cx, 'gcx, 'tcx>( debug!("assemble_candidates_from_trait_def(..)"); let tcx = selcx.tcx(); - // Check whether the self-type is itself a projection. + // Check whether the self type is itself a projection. let (def_id, substs) = match obligation_trait_ref.self_ty().sty { ty::Projection(ref data) => { (data.trait_ref(tcx).def_id, data.substs) } ty::Opaque(def_id, substs) => (def_id, substs), ty::Infer(ty::TyVar(_)) => { - // If the self-type is an inference variable, then it MAY wind up + // If the self type is an inference variable, then it MAY wind up // being a projected type, so induce an ambiguity. candidate_set.mark_ambiguous(); return; @@ -1548,7 +1548,7 @@ fn assoc_ty_def<'cx, 'gcx, 'tcx>( } else { // This is saying that neither the trait nor // the impl contain a definition for this - // associated type. Normally this situation + // associated type. Normally this situation // could only arise through a compiler bug -- // if the user wrote a bad item name, it // should have failed in astconv. @@ -1561,7 +1561,7 @@ fn assoc_ty_def<'cx, 'gcx, 'tcx>( // # Cache /// The projection cache. Unlike the standard caches, this can include -/// infcx-dependent type variables - therefore, we have to roll the +/// infcx-dependent type variables, therefore we have to roll the /// cache back each time we roll a snapshot back, to avoid assumptions /// on yet-unresolved inference variables. Types with placeholder /// regions also have to be removed when the respective snapshot ends. diff --git a/src/librustc/traits/query/dropck_outlives.rs b/src/librustc/traits/query/dropck_outlives.rs index 1fd2172212d3c..937079c1de439 100644 --- a/src/librustc/traits/query/dropck_outlives.rs +++ b/src/librustc/traits/query/dropck_outlives.rs @@ -96,7 +96,7 @@ impl<'tcx> DropckOutlivesResult<'tcx> { tcx.sess, span, E0320, - "overflow while adding drop-check rules for {}", + "overflow while adding drop-check rules for `{}`", ty, ); err.note(&format!("overflowed on {}", overflow_ty)); diff --git a/src/librustc/traits/query/normalize.rs b/src/librustc/traits/query/normalize.rs index 0d126d37546d6..a5e59f59aefc4 100644 --- a/src/librustc/traits/query/normalize.rs +++ b/src/librustc/traits/query/normalize.rs @@ -24,7 +24,7 @@ impl<'cx, 'gcx, 'tcx> At<'cx, 'gcx, 'tcx> { /// the normalized value along with various outlives relations (in /// the form of obligations that must be discharged). /// - /// NB. This will *eventually* be the main means of + /// N.B., this will *eventually* be the main means of /// normalizing, but for now should be used only when we actually /// know that normalization will succeed, since error reporting /// and other details are still "under development". diff --git a/src/librustc/traits/query/normalize_erasing_regions.rs b/src/librustc/traits/query/normalize_erasing_regions.rs index e7034065bdf2e..040f359efa83a 100644 --- a/src/librustc/traits/query/normalize_erasing_regions.rs +++ b/src/librustc/traits/query/normalize_erasing_regions.rs @@ -45,7 +45,7 @@ impl<'cx, 'tcx> TyCtxt<'cx, 'tcx, 'tcx> { /// a `T` (with regions erased). This is appropriate when the /// binder is being instantiated at the call site. /// - /// NB. Currently, higher-ranked type bounds inhibit + /// N.B., currently, higher-ranked type bounds inhibit /// normalization. Therefore, each time we erase them in /// codegen, we need to normalize the contents. pub fn normalize_erasing_late_bound_regions( diff --git a/src/librustc/traits/query/type_op/implied_outlives_bounds.rs b/src/librustc/traits/query/type_op/implied_outlives_bounds.rs index f4a825a669b48..38cfd5c99defe 100644 --- a/src/librustc/traits/query/type_op/implied_outlives_bounds.rs +++ b/src/librustc/traits/query/type_op/implied_outlives_bounds.rs @@ -28,7 +28,7 @@ impl<'gcx: 'tcx, 'tcx> super::QueryTypeOp<'gcx, 'tcx> for ImpliedOutlivesBounds< tcx: TyCtxt<'_, 'gcx, 'tcx>, canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Self>>, ) -> Fallible> { - // FIXME this `unchecked_map` is only necessary because the + // FIXME: this `unchecked_map` is only necessary because the // query is defined as taking a `ParamEnvAnd`; it should // take a `ImpliedOutlivesBounds` instead let canonicalized = canonicalized.unchecked_map(|ParamEnvAnd { param_env, value }| { diff --git a/src/librustc/traits/query/type_op/mod.rs b/src/librustc/traits/query/type_op/mod.rs index 6e5a6080976c0..a34ecdb1f8fd0 100644 --- a/src/librustc/traits/query/type_op/mod.rs +++ b/src/librustc/traits/query/type_op/mod.rs @@ -74,7 +74,7 @@ pub trait QueryTypeOp<'gcx: 'tcx, 'tcx>: /// the generic code, we have a `Lifted<'gcx, Self::QueryResponse>` /// and we want to convert that to a `Self::QueryResponse`. This is /// not a priori valid, so we can't do it -- but in practice, it - /// is always a no-op (e.g., the lifted form of a type, + /// is always a noop (e.g., the lifted form of a type, /// `Ty<'gcx>`, is a subtype of `Ty<'tcx>`). So we have to push /// the operation into the impls that know more specifically what /// `QueryResponse` is. This operation would (maybe) be nicer with diff --git a/src/librustc/traits/query/type_op/outlives.rs b/src/librustc/traits/query/type_op/outlives.rs index 108aa373e039c..58ac4f4e38e81 100644 --- a/src/librustc/traits/query/type_op/outlives.rs +++ b/src/librustc/traits/query/type_op/outlives.rs @@ -46,7 +46,7 @@ where // know we are not registering any subregion relations or // other things). - // FIXME convert to the type expected by the `dropck_outlives` + // FIXME: convert to the type expected by the `dropck_outlives` // query. This should eventually be fixed by changing the // *underlying query*. let canonicalized = canonicalized.unchecked_map(|ParamEnvAnd { param_env, value }| { diff --git a/src/librustc/traits/select.rs b/src/librustc/traits/select.rs index bd347764cc681..eb4e19b5b66a4 100644 --- a/src/librustc/traits/select.rs +++ b/src/librustc/traits/select.rs @@ -164,11 +164,11 @@ pub struct SelectionCache<'tcx> { } /// The selection process begins by considering all impls, where -/// clauses, and so forth that might resolve an obligation. Sometimes +/// clauses, and so forth that might resolve an obligation. Sometimes /// we'll be able to say definitively that (e.g.) an impl does not /// apply to the obligation: perhaps it is defined for `usize` but the /// obligation is for `int`. In that case, we drop the impl out of the -/// list. But the other cases are considered *candidates*. +/// list. But the other cases are considered *candidates*. /// /// For selection to succeed, there must be exactly one matching /// candidate. If the obligation is fully known, this is guaranteed @@ -332,7 +332,7 @@ enum BuiltinImplConditions<'tcx> { /// - `EvaluatedToErr` implies `EvaluatedToRecur` /// - the "union" of evaluation results is equal to their maximum - /// all the "potential success" candidates can potentially succeed, -/// so they are no-ops when unioned with a definite error, and within +/// so they are noops when unioned with a definite error, and within /// the categories it's easy to see that the unions are correct. pub enum EvaluationResult { /// Evaluation successful @@ -1064,7 +1064,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { } /// Further evaluate `candidate` to decide whether all type parameters match and whether nested - /// obligations are met. Returns true if `candidate` remains viable after this further + /// obligations are met. Returns whether `candidate` remains viable after this further /// scrutiny. fn evaluate_candidate<'o>( &mut self, @@ -1119,8 +1119,8 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { dep_node: DepNodeIndex, result: EvaluationResult, ) { - // Avoid caching results that depend on more than just the trait-ref - // - the stack can create recursion. + // Avoid caching results that depend on more than just the trait-ref; + // the stack can create recursion. if result.is_stack_dependent() { return; } @@ -1132,9 +1132,9 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { trait_ref, result, ); // This may overwrite the cache with the same value - // FIXME: Due to #50507 this overwrites the different values - // This should be changed to use HashMapExt::insert_same - // when that is fixed + // FIXME: due to #50507 this overwrites the different values + // This should be changed to use `HashMapExt::insert_same` + // when that is fixed. self.tcx() .evaluation_cache .hashmap @@ -1351,7 +1351,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { // impl Vec { fn push_clone(...) { ... } } // // and we were to see some code `foo.push_clone()` where `boo` - // is a `Vec` and `Bar` does not implement `Clone`. If + // is a `Vec` and `Bar` does not implement `Clone`. If // we were to winnow, we'd wind up with zero candidates. // Instead, we select the right impl now but report `Bar does // not implement Clone`. @@ -1465,7 +1465,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { } } - /// Returns true if the global caches can be used. + /// Returns whether the global caches can be used. /// Do note that if the type itself is not in the /// global tcx, the local caches will be used. fn can_use_global_caches(&self, param_env: ty::ParamEnv<'tcx>) -> bool { @@ -1694,7 +1694,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { debug!("assemble_candidates_for_projected_tys({:?})", obligation); // before we go into the whole placeholder thing, just - // quickly check if the self-type is a projection at all. + // quickly check if the self type is a projection at all. match obligation.predicate.skip_binder().trait_ref.self_ty().sty { ty::Projection(_) | ty::Opaque(..) => {} ty::Infer(ty::TyVar(_)) => { @@ -1895,7 +1895,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { candidates.vec.push(GeneratorCandidate); } ty::Infer(ty::TyVar(_)) => { - debug!("assemble_generator_candidates: ambiguous self-type"); + debug!("assemble_generator_candidates: ambiguous self type"); candidates.ambiguous = true; } _ => {} @@ -1951,7 +1951,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { } } ty::Infer(ty::TyVar(_)) => { - debug!("assemble_unboxed_closure_candidates: ambiguous self-type"); + debug!("assemble_unboxed_closure_candidates: ambiguous self type"); candidates.ambiguous = true; } _ => {} @@ -1979,7 +1979,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { let self_ty = *obligation.self_ty().skip_binder(); match self_ty.sty { ty::Infer(ty::TyVar(_)) => { - debug!("assemble_fn_pointer_candidates: ambiguous self-type"); + debug!("assemble_fn_pointer_candidates: ambiguous self type"); candidates.ambiguous = true; // could wind up being a fn() type } // provide an impl, but only for suitable `fn` pointers @@ -2058,7 +2058,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { } ty::Param(..) | ty::Projection(..) => { // In these cases, we don't know what the actual - // type is. Therefore, we cannot break it down + // type is. Therefore, we cannot break it down // into its constituent types. So we don't // consider the `..` impl but instead just add no // candidates: this means that typeck will only @@ -2198,7 +2198,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { // 2. Tightening the region bound, e.g., `Foo+'a` to `Foo+'b` if `'a : 'b` // // Note that neither of these changes requires any - // change at runtime. Eventually this will be + // change at runtime. Eventually this will be // generalized. // // We always upcast when we can because of reason @@ -2266,8 +2266,8 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { // type variables and then we also attempt to evaluate recursive // bounds to see if they are satisfied. - /// Returns true if `victim` should be dropped in favor of - /// `other`. Generally speaking we will drop duplicate + /// Returns whether `victim` should be dropped in favor of + /// `other`. Generally speaking we will drop duplicate /// candidates and prefer where-clause candidates. /// /// See the comment for "SelectionCandidate" for more details. @@ -2714,7 +2714,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { // // Confirmation unifies the output type parameters of the trait // with the values found in the obligation, possibly yielding a - // type error. See the [rustc guide] for more details. + // type error. See the [rustc guide] for more details. // // [rustc guide]: // https://rust-lang.github.io/rustc-guide/traits/resolution.html#confirmation @@ -2929,8 +2929,8 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { ) }); - // Adds the predicates from the trait. Note that this contains a `Self: Trait` - // predicate as usual. It won't have any effect since auto traits are coinductive. + // Adds the predicates from the trait. Note that this contains a `Self: Trait` + // predicate as usual. It won't have any effect since auto traits are coinductive. obligations.extend(trait_obligations); debug!("vtable_auto_impl: obligations={:?}", obligations); @@ -3000,7 +3000,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { // are sufficient to determine the impl substs, without // relying on projections in the impl-trait-ref. // - // e.g., `impl> Foo<::T> for V` + // E.g., `impl> Foo<::T> for V`. impl_obligations.append(&mut substs.obligations); VtableImplData { @@ -3263,7 +3263,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { /// we currently treat the input type parameters on the trait as /// outputs. This means that when we have a match we have only /// considered the self type, so we have to go back and make sure - /// to relate the argument types too. This is kind of wrong, but + /// to relate the argument types too. This is kind of wrong, but /// since we control the full set of impls, also not that wrong, /// and it DOES yield better error messages (since we don't report /// errors as if there is no applicable impl, but rather report @@ -3277,7 +3277,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { /// impl Fn(int) for Closure { ... } /// /// Now imagine our obligation is `Fn(usize) for Closure`. So far - /// we have matched the self-type `Closure`. At this point we'll + /// we have matched the self type `Closure`. At this point we'll /// compare the `int` to `usize` and generate an error. /// /// Note that this checking occurs *after* the impl has selected, @@ -3536,7 +3536,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { // Matching // // Matching is a common path used for both evaluation and - // confirmation. It basically unifies types that appear in impls + // confirmation. It basically unifies types that appear in impls // and traits. This does affect the surrounding environment; // therefore, when used during evaluation, match routines must be // run inside of a `probe()` so that their side-effects are @@ -3660,7 +3660,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { } /// Normalize `where_clause_trait_ref` and try to match it against - /// `obligation`. If successful, return any predicates that + /// `obligation`. If successful, return any predicates that /// result from the normalization. Normalization is necessary /// because where-clauses are stored in the parameter environment /// unnormalized. @@ -3739,7 +3739,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { ); // (1) Feels icky to skip the binder here, but OTOH we know - // that the self-type is an unboxed closure type and hence is + // that the self type is an unboxed closure type and hence is // in fact unparameterized (or at least does not reference any // regions bound in the obligation). Still probably some // refactoring could make this nicer. @@ -3762,7 +3762,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { let gen_sig = substs.poly_sig(closure_def_id, self.tcx()); // (1) Feels icky to skip the binder here, but OTOH we know - // that the self-type is an generator type and hence is + // that the self type is an generator type and hence is // in fact unparameterized (or at least does not reference any // regions bound in the obligation). Still probably some // refactoring could make this nicer. @@ -3797,7 +3797,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { // each predicate must be preceded by the obligations required // to normalize it. // for example, if we have: - // impl> Foo for V where U::Item: Copy + // impl> Foo for V where U::Item: Copy // the impl will have the following predicates: // ::Item = U, // U: Iterator, U: Sized, @@ -3836,8 +3836,8 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { // types. // // This code is hot enough that it's worth avoiding the allocation - // required for the FxHashSet when possible. Special-casing lengths 0, - // 1 and 2 covers roughly 75--80% of the cases. + // required for the FxHashSet when possible. Special-casing lengths `0`, + // `1` and `2` covers roughly 75 to 80% of the cases. if predicates.len() <= 1 { // No possibility of duplicates. } else if predicates.len() == 2 { diff --git a/src/librustc/traits/specialize/mod.rs b/src/librustc/traits/specialize/mod.rs index f5d68ddb5bd46..d57f9542aefd6 100644 --- a/src/librustc/traits/specialize/mod.rs +++ b/src/librustc/traits/specialize/mod.rs @@ -62,7 +62,7 @@ pub struct OverlapError { /// /// ```rust /// impl<'a, I, T: 'a> Iterator for Cloned -/// where I: Iterator, T: Clone +/// where I: Iterator, T: Clone /// ``` /// /// In a case like this, the substitution for `T` is determined indirectly, @@ -144,10 +144,10 @@ pub fn find_associated_item<'a, 'tcx>( } } -/// Is impl1 a specialization of impl2? +/// Is `impl1` a specialization of `impl2`? /// /// Specialization is determined by the sets of types to which the impls apply; -/// impl1 specializes impl2 if it applies to a subset of the types impl2 applies +/// `impl1` specializes `impl2` if it applies to a subset of the types `impl2` applies /// to. pub(super) fn specializes<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, (impl1_def_id, impl2_def_id): (DefId, DefId)) @@ -164,11 +164,11 @@ pub(super) fn specializes<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, // We determine whether there's a subset relationship by: // - // - skolemizing impl1, - // - assuming the where clauses for impl1, - // - instantiating impl2 with fresh inference variables, + // - skolemizing `impl1`, + // - assuming the where clauses for `impl1`, + // - instantiating `impl2` with fresh inference variables, // - unifying, - // - attempting to prove the where clauses for impl2 + // - attempting to prove the where clauses for `impl2`. // // The last three steps are encapsulated in `fulfill_implication`. // @@ -179,11 +179,11 @@ pub(super) fn specializes<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, return false; } - // create a parameter environment corresponding to a (placeholder) instantiation of impl1 + // Create a parameter environment corresponding to a (placeholder) instantiation of `impl1`. let penv = tcx.param_env(impl1_def_id); let impl1_trait_ref = tcx.impl_trait_ref(impl1_def_id).unwrap(); - // Create a infcx, taking the predicates of impl1 as assumptions: + // Create a infcx, taking the predicates of `impl1` as assumptions: tcx.infer_ctxt().enter(|infcx| { // Normalize the trait reference. The WF rules ought to ensure // that this always succeeds. @@ -199,7 +199,7 @@ pub(super) fn specializes<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } }; - // Attempt to prove that impl2 applies, given all of the above. + // Attempt to prove that `impl2` applies, given all of the above. fulfill_implication(&infcx, penv, impl1_trait_ref, impl2_def_id).is_ok() }) } @@ -226,7 +226,7 @@ fn fulfill_implication<'a, 'gcx, 'tcx>(infcx: &InferCtxt<'a, 'gcx, 'tcx>, debug!("fulfill_implication: target_trait_ref={:?}, obligations={:?}", target_trait_ref, obligations); - // do the impls unify? If not, no specialization. + // Do the impls unify? If not, no specialization. match infcx.at(&ObligationCause::dummy(), param_env) .eq(source_trait_ref, target_trait_ref) { Ok(InferOk { obligations: o, .. }) => { @@ -240,8 +240,8 @@ fn fulfill_implication<'a, 'gcx, 'tcx>(infcx: &InferCtxt<'a, 'gcx, 'tcx>, } } - // attempt to prove all of the predicates for impl2 given those for impl1 - // (which are packed up in penv) + // Attempt to prove all of the predicates for `impl2` given those for `impl1` + // (which are packed up in penv). infcx.save_and_restore_in_snapshot_flag(|infcx| { // If we came from `translate_substs`, we already know that the @@ -250,7 +250,7 @@ fn fulfill_implication<'a, 'gcx, 'tcx>(infcx: &InferCtxt<'a, 'gcx, 'tcx>, // we only want to process the projections to determine the // the types in our substs using RFC 447, so we can safely // ignore region obligations, which allows us to avoid threading - // a node-id to assign them with. + // a node-ID to assign them with. // // If we came from specialization graph construction, then // we already make a mockery out of the region system, so @@ -261,7 +261,7 @@ fn fulfill_implication<'a, 'gcx, 'tcx>(infcx: &InferCtxt<'a, 'gcx, 'tcx>, } match fulfill_cx.select_all_or_error(infcx) { Err(errors) => { - // no dice! + // No dice! debug!("fulfill_implication: for impls on {:?} and {:?}, \ could not fulfill: {:?} given {:?}", source_trait_ref, @@ -396,7 +396,7 @@ fn to_pretty_impl_header(tcx: TyCtxt<'_, '_, '_>, impl_def_id: DefId) -> Option< let substs = Substs::identity_for_item(tcx, impl_def_id); - // FIXME: Currently only handles ?Sized. + // FIXME: currently only handles ?Sized. // Needs to support ?Move and ?DynSized when they are implemented. let mut types_without_default_bounds = FxHashSet::default(); let sized_trait = tcx.lang_items().sized_trait(); diff --git a/src/librustc/traits/specialize/specialization_graph.rs b/src/librustc/traits/specialize/specialization_graph.rs index fd68917e53991..050e61da17330 100644 --- a/src/librustc/traits/specialize/specialization_graph.rs +++ b/src/librustc/traits/specialize/specialization_graph.rs @@ -93,7 +93,7 @@ impl<'a, 'gcx, 'tcx> Children { debug!("insert_blindly: impl_def_id={:?} sty={:?}", impl_def_id, sty); self.nonblanket_impls.entry(sty).or_default().push(impl_def_id) } else { - debug!("insert_blindly: impl_def_id={:?} sty=None", impl_def_id); + debug!("insert_blindly: impl_def_id={:?} sty = None", impl_def_id); self.blanket_impls.push(impl_def_id) } } @@ -110,7 +110,7 @@ impl<'a, 'gcx, 'tcx> Children { debug!("remove_existing: impl_def_id={:?} sty={:?}", impl_def_id, sty); vec = self.nonblanket_impls.get_mut(&sty).unwrap(); } else { - debug!("remove_existing: impl_def_id={:?} sty=None", impl_def_id); + debug!("remove_existing: impl_def_id={:?} sty = None", impl_def_id); vec = &mut self.blanket_impls; } @@ -402,7 +402,7 @@ impl<'a, 'gcx, 'tcx> Graph { self.children.entry(parent).or_default().insert_blindly(tcx, child); } - /// The parent of a given impl, which is the def id of the trait when the + /// The parent of a given impl, which is the def-ID of the trait when the /// impl is a "specialization root". pub fn parent(&self, child: DefId) -> DefId { *self.parent.get(&child).unwrap() diff --git a/src/librustc/traits/util.rs b/src/librustc/traits/util.rs index 5b7ba5386725e..ebb4fb0a4603e 100644 --- a/src/librustc/traits/util.rs +++ b/src/librustc/traits/util.rs @@ -133,8 +133,8 @@ impl<'cx, 'gcx, 'tcx> Elaborator<'cx, 'gcx, 'tcx> { data, predicates); // Only keep those bounds that we haven't already - // seen. This is necessary to prevent infinite - // recursion in some cases. One common case is when + // seen. This is necessary to prevent infinite + // recursion in some cases. One common case is when // people define `trait Sized: Sized { }` rather than `trait // Sized { }`. predicates.retain(|r| self.visited.insert(r)); @@ -269,7 +269,7 @@ pub fn transitive_bounds<'cx, 'gcx, 'tcx>(tcx: TyCtxt<'cx, 'gcx, 'tcx>, } /////////////////////////////////////////////////////////////////////////// -// Iterator over def-ids of supertraits +// Iterator over def-IDs of supertraits pub struct SupertraitDefIds<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { tcx: TyCtxt<'a, 'gcx, 'tcx>, diff --git a/src/librustc/ty/adjustment.rs b/src/librustc/ty/adjustment.rs index 117112c0c75f4..d16f1f703797e 100644 --- a/src/librustc/ty/adjustment.rs +++ b/src/librustc/ty/adjustment.rs @@ -3,7 +3,6 @@ use hir::def_id::DefId; use ty::{self, Ty, TyCtxt}; use ty::subst::Substs; - /// Represents coercing a value to a different type of value. /// /// We transform values by following a number of `Adjust` steps in order. @@ -15,7 +14,7 @@ use ty::subst::Substs; /// Here the pointer will be dereferenced N times (where a dereference can /// happen to raw or borrowed pointers or any smart pointer which implements /// Deref, including Box<_>). The types of dereferences is given by -/// `autoderefs`. It can then be auto-referenced zero or one times, indicated +/// `autoderefs`. It can then be auto-referenced zero or one times, indicated /// by `autoref`, to either a raw or borrowed pointer. In these cases unsize is /// `false`. /// @@ -38,7 +37,7 @@ use ty::subst::Substs; /// stored in `unsize` is `Foo<[i32]>`, we don't store any further detail about /// the underlying conversions from `[i32; 4]` to `[i32]`. /// -/// 3. Coercing a `Box` to `Box` is an interesting special case. In +/// 3. Coercing a `Box` to `Box` is an interesting special case. In /// that case, we have the pointer we need coming in, so there are no /// autoderefs, and no autoref. Instead we just do the `Unsize` transformation. /// At some point, of course, `Box` should move out of the compiler, in which @@ -78,7 +77,7 @@ pub enum Adjust<'tcx> { /// This will do things like convert thin pointers to fat /// pointers, or convert structs containing thin pointers to /// structs containing fat pointers, or convert between fat - /// pointers. We don't store the details of how the transform is + /// pointers. We don't store the details of how the transform is /// done (in fact, we don't know that, because it might depend on /// the precise type parameters). We just store the target /// type. Codegen backends and miri figure out what has to be done diff --git a/src/librustc/ty/constness.rs b/src/librustc/ty/constness.rs index 3741f4051b896..b1808b0431fd4 100644 --- a/src/librustc/ty/constness.rs +++ b/src/librustc/ty/constness.rs @@ -37,7 +37,7 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { } } - /// Returns true if this function must conform to `min_const_fn` + /// Returns whether this function must conform to `min_const_fn` pub fn is_min_const_fn(self, def_id: DefId) -> bool { // Bail out if the signature doesn't contain `const` if !self.is_const_fn_raw(def_id) { diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index ea69d466ba6c5..44c4a23e9ce65 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -575,10 +575,10 @@ impl<'tcx> TypeckTables<'tcx> { // Returns the type of an expression as a monotype. // - // NB (1): This is the PRE-ADJUSTMENT TYPE for the expression. That is, in + // NB (1): This is the PRE-ADJUSTMENT TYPE for the expression. That is, in // some cases, we insert `Adjustment` annotations such as auto-deref or - // auto-ref. The type returned by this function does not consider such - // adjustments. See `expr_ty_adjusted()` instead. + // auto-ref. The type returned by this function does not consider such + // adjustments. See `expr_ty_adjusted()` instead. // // NB (2): This type doesn't provide type parameter substitutions; e.g., if you // ask for the type of "id" in "id(3)", it will return "fn(&isize) -> isize" @@ -846,7 +846,7 @@ impl<'tcx> CommonTypes<'tcx> { // conflict. #[derive(Debug)] pub struct FreeRegionInfo { - // def id corresponding to FreeRegion + // def-ID corresponding to FreeRegion pub def_id: DefId, // the bound region corresponding to FreeRegion pub boundregion: ty::BoundRegion, @@ -1085,7 +1085,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { value.lift_to_tcx(self.global_tcx()) } - /// Returns true if self is the same as self.global_tcx(). + /// Returns whether self is the same as self.global_tcx(). fn is_global(self) -> bool { let local = self.interners as *const _; let global = &self.global_interners as *const _; @@ -2461,7 +2461,7 @@ slice_interners!( // This isn't a perfect fit: CanonicalVarInfo slices are always // allocated in the global arena, so this `intern_method!` macro is -// overly general. But we just return false for the code that checks +// overly general. But we just return false for the code that checks // whether they belong in the thread-local arena, so no harm done, and // seems better than open-coding the rest. intern_method! { @@ -2763,7 +2763,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { pub fn intern_predicates(self, preds: &[Predicate<'tcx>]) -> &'tcx List> { - // FIXME consider asking the input slice to be sorted to avoid + // FIXME: consider asking the input slice to be sorted to avoid // re-interning permutations, in which case that would be asserted // here. if preds.len() == 0 { @@ -3003,7 +3003,7 @@ pub trait InternAs { impl InternAs<[T], R> for I where E: InternIteratorElement, - I: Iterator { + I: Iterator { type Output = E::Output; fn intern_with(self, f: F) -> Self::Output where F: FnOnce(&[T]) -> R { @@ -3013,12 +3013,12 @@ impl InternAs<[T], R> for I pub trait InternIteratorElement: Sized { type Output; - fn intern_with, F: FnOnce(&[T]) -> R>(iter: I, f: F) -> Self::Output; + fn intern_with, F: FnOnce(&[T]) -> R>(iter: I, f: F) -> Self::Output; } impl InternIteratorElement for T { type Output = R; - fn intern_with, F: FnOnce(&[T]) -> R>(iter: I, f: F) -> Self::Output { + fn intern_with, F: FnOnce(&[T]) -> R>(iter: I, f: F) -> Self::Output { f(&iter.collect::>()) } } @@ -3027,14 +3027,14 @@ impl<'a, T, R> InternIteratorElement for &'a T where T: Clone + 'a { type Output = R; - fn intern_with, F: FnOnce(&[T]) -> R>(iter: I, f: F) -> Self::Output { + fn intern_with, F: FnOnce(&[T]) -> R>(iter: I, f: F) -> Self::Output { f(&iter.cloned().collect::>()) } } impl InternIteratorElement for Result { type Output = Result; - fn intern_with, F: FnOnce(&[T]) -> R>(iter: I, f: F) -> Self::Output { + fn intern_with, F: FnOnce(&[T]) -> R>(iter: I, f: F) -> Self::Output { Ok(f(&iter.collect::, _>>()?)) } } diff --git a/src/librustc/ty/error.rs b/src/librustc/ty/error.rs index c491fdd9957e8..5f4c5596100e1 100644 --- a/src/librustc/ty/error.rs +++ b/src/librustc/ty/error.rs @@ -257,7 +257,8 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { if ty.is_closure() || ty.is_generator() { db.note("closures cannot capture themselves or take themselves as argument;\n\ this error may be the result of a recent compiler bug-fix,\n\ - see https://github.com/rust-lang/rust/issues/46062 for more details"); + see for more\n\ + details"); } } _ => {} diff --git a/src/librustc/ty/inhabitedness/def_id_forest.rs b/src/librustc/ty/inhabitedness/def_id_forest.rs index 41fd88607e893..a79fbf900f70b 100644 --- a/src/librustc/ty/inhabitedness/def_id_forest.rs +++ b/src/librustc/ty/inhabitedness/def_id_forest.rs @@ -62,7 +62,7 @@ impl<'a, 'gcx, 'tcx> DefIdForest { /// Calculate the intersection of a collection of forests. pub fn intersection(tcx: TyCtxt<'a, 'gcx, 'tcx>, iter: I) -> DefIdForest - where I: IntoIterator + where I: IntoIterator { let mut iter = iter.into_iter(); let mut ret = if let Some(first) = iter.next() { @@ -99,7 +99,7 @@ impl<'a, 'gcx, 'tcx> DefIdForest { /// Calculate the union of a collection of forests. pub fn union(tcx: TyCtxt<'a, 'gcx, 'tcx>, iter: I) -> DefIdForest - where I: IntoIterator + where I: IntoIterator { let mut ret = DefIdForest::empty(); let mut next_ret = SmallVec::new(); diff --git a/src/librustc/ty/instance.rs b/src/librustc/ty/instance.rs index 78b6ffaa54e17..0788039221762 100644 --- a/src/librustc/ty/instance.rs +++ b/src/librustc/ty/instance.rs @@ -23,7 +23,7 @@ pub enum InstanceDef<'tcx> { VtableShim(DefId), /// \::call_* - /// def-id is FnTrait::call_* + /// def-ID is FnTrait::call_* FnPtrShim(DefId, Ty<'tcx>), /// ::fn @@ -406,7 +406,7 @@ fn needs_fn_once_adapter_shim<'a, 'tcx>(actual_closure_kind: ty::ClosureKind, Ok(false) } (ty::ClosureKind::Fn, ty::ClosureKind::FnMut) => { - // The closure fn `llfn` is a `fn(&self, ...)`. We want a + // The closure fn `llfn` is a `fn(&self, ...)`. We want a // `fn(&mut self, ...)`. In fact, at codegen time, these are // basically the same thing, so we can just return llfn. Ok(false) @@ -414,7 +414,7 @@ fn needs_fn_once_adapter_shim<'a, 'tcx>(actual_closure_kind: ty::ClosureKind, (ty::ClosureKind::Fn, ty::ClosureKind::FnOnce) | (ty::ClosureKind::FnMut, ty::ClosureKind::FnOnce) => { // The closure fn `llfn` is a `fn(&self, ...)` or `fn(&mut - // self, ...)`. We want a `fn(self, ...)`. We can produce + // self, ...)`. We want a `fn(self, ...)`. We can produce // this by doing something like: // // fn call_once(self, ...) { call_mut(&self, ...) } diff --git a/src/librustc/ty/item_path.rs b/src/librustc/ty/item_path.rs index da467f57d2544..f136e2fdcdf50 100644 --- a/src/librustc/ty/item_path.rs +++ b/src/librustc/ty/item_path.rs @@ -54,7 +54,7 @@ pub fn with_crate_prefix R, R>(f: F) -> R { } impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { - /// Returns a string identifying this def-id. This string is + /// Returns a string identifying this def-ID. This string is /// suitable for user output. It is relative to the current crate /// root, unless with_forced_absolute_paths was used. pub fn item_path_str(self, def_id: DefId) -> String { @@ -71,12 +71,12 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { buffer.into_string() } - /// Returns a string identifying this local node-id. + /// Returns a string identifying this local node-ID. pub fn node_path_str(self, id: ast::NodeId) -> String { self.item_path_str(self.hir().local_def_id(id)) } - /// Returns a string identifying this def-id. This string is + /// Returns a string identifying this def-ID. This string is /// suitable for user output. It always begins with a crate identifier. pub fn absolute_item_path_str(self, def_id: DefId) -> String { let mut buffer = LocalPathBuffer::new(RootMode::Absolute); @@ -376,7 +376,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { // Decide whether to print the parent path for the impl. // Logically, since impls are global, it's never needed, but // users may find it useful. Currently, we omit the parent if - // the impl is either in the same module as the self-type or + // the impl is either in the same module as the self type or // as the trait. let self_ty = self.type_of(impl_def_id); let in_self_mod = match characteristic_def_id_of_type(self_ty) { @@ -391,7 +391,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { }; if !in_self_mod && !in_trait_mod { - // If the impl is not co-located with either self-type or + // If the impl is not co-located with either self type or // trait-type, then fallback to a format that identifies // the module more clearly. self.push_item_path(buffer, parent_def_id, pushed_prelude_crate); @@ -413,7 +413,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { } // Inherent impls. Try to print `Foo::bar` for an inherent - // impl on `Foo`, but fallback to `::bar` if self-type is + // impl on `Foo`, but fallback to `::bar` if self type is // anything other than a simple path. match self_ty.sty { ty::Adt(adt_def, substs) => { @@ -460,7 +460,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { buffer.push(&format!("", span_str)); } - /// Returns the def-id of `def_id`'s parent in the def tree. If + /// Returns the def-ID of `def_id`'s parent in the def tree. If /// this returns `None`, then `def_id` represents a crate root or /// inlined root. pub fn parent_def_id(self, def_id: DefId) -> Option { @@ -470,9 +470,9 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { } /// As a heuristic, when we see an impl, if we see that the -/// 'self-type' is a type defined in the same module as the impl, +/// 'self type' is a type defined in the same module as the impl, /// we can omit including the path to the impl itself. This -/// function tries to find a "characteristic def-id" for a +/// function tries to find a "characteristic def-ID" for a /// type. It's just a heuristic so it makes some questionable /// decisions and we may want to adjust it later. pub fn characteristic_def_id_of_type(ty: Ty<'_>) -> Option { @@ -527,7 +527,7 @@ pub trait ItemPathBuffer { #[derive(Debug)] pub enum RootMode { - /// Try to make a path relative to the local crate. In + /// Try to make a path relative to the local crate. In /// particular, local paths have no prefix, and if the path comes /// from an extern crate, start with the path to the `extern /// crate` declaration. diff --git a/src/librustc/ty/layout.rs b/src/librustc/ty/layout.rs index 171c53b7b20ba..aad8b4c362ea2 100644 --- a/src/librustc/ty/layout.rs +++ b/src/librustc/ty/layout.rs @@ -1686,7 +1686,7 @@ impl<'a, 'tcx, C> TyLayoutMethods<'tcx, C> for Ty<'tcx> tcx.types.re_static, tcx.mk_array(tcx.types.usize, 3), ) - /* FIXME use actual fn pointers + /* FIXME: use actual fn pointers Warning: naively computing the number of entries in the vtable by counting the methods on the trait + methods on all parent traits does not work, because some methods can diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs index 8348aa8a95612..1049b3870fc31 100644 --- a/src/librustc/ty/mod.rs +++ b/src/librustc/ty/mod.rs @@ -143,8 +143,8 @@ pub enum AssociatedItemContainer { } impl AssociatedItemContainer { - /// Asserts that this is the def-id of an associated item declared - /// in a trait, and returns the trait def-id. + /// Asserts that this is the def-ID of an associated item declared + /// in a trait, and returns the trait def-ID. pub fn assert_trait(&self) -> DefId { match *self { TraitContainer(id) => id, @@ -204,13 +204,13 @@ impl AssociatedItem { } /// Tests whether the associated item admits a non-trivial implementation - /// for ! + /// for `!`. pub fn relevant_for_never<'tcx>(&self) -> bool { match self.kind { AssociatedKind::Existential | AssociatedKind::Const | AssociatedKind::Type => true, - // FIXME(canndrew): Be more thorough here, check if any argument is uninhabited. + // FIXME(canndrew): be more thorough here, check if any argument is uninhabited. AssociatedKind::Method => !self.method_has_self_argument, } } @@ -220,7 +220,7 @@ impl AssociatedItem { ty::AssociatedKind::Method => { // We skip the binder here because the binder would deanonymize all // late-bound regions, and we don't want method signatures to show up - // `as for<'r> fn(&'r MyType)`. Pretty-printing handles late-bound + // `as for<'r> fn(&'r MyType)`. Pretty-printing handles late-bound // regions just fine, showing `fn(&MyType)`. tcx.fn_sig(self.def_id).skip_binder().to_string() } @@ -284,7 +284,7 @@ impl Visibility { } } - /// Returns `true` if an item with this visibility is accessible from the given block. + /// Returns whether an item with this visibility is accessible from the given block. pub fn is_accessible_from(self, module: DefId, tree: T) -> bool { let restriction = match self { // Public items are visible everywhere. @@ -299,7 +299,7 @@ impl Visibility { tree.is_descendant_of(module, restriction) } - /// Returns `true` if this visibility is at least as accessible as the given visibility + /// Returns whether this visibility is at least as accessible as the given visibility pub fn is_at_least(self, vis: Visibility, tree: T) -> bool { let vis_restriction = match vis { Visibility::Public => return self == Visibility::Public, @@ -310,7 +310,7 @@ impl Visibility { self.is_accessible_from(vis_restriction, tree) } - // Returns `true` if this item is visible anywhere in the local crate. + // Returns whether this item is visible anywhere in the local crate. pub fn is_visible_locally(self) -> bool { match self { Visibility::Public => true, @@ -336,7 +336,7 @@ pub enum Variance { /// item. pub struct CrateVariancesMap { /// For each item with generics, maps to a vector of the variance - /// of its generics. If an item has no generics, it will have no + /// of its generics. If an item has no generics, it will have no /// entry. pub variances: FxHashMap>>, @@ -346,7 +346,7 @@ pub struct CrateVariancesMap { impl Variance { /// `a.xform(b)` combines the variance of a context with the - /// variance of a type with the following meaning. If we are in a + /// variance of a type with the following meaning. If we are in a /// context with variance `a`, and we encounter a type argument in /// a position with variance `b`, then `a.xform(b)` is the new /// variance with which the argument appears. @@ -370,10 +370,10 @@ impl Variance { /// The ambient variance is covariant. A `fn` type is /// contravariant with respect to its parameters, so the variance /// within which both pointer types appear is - /// `Covariant.xform(Contravariant)`, or `Contravariant`. `*const + /// `Covariant.xform(Contravariant)`, or `Contravariant`. `*const /// T` is covariant with respect to `T`, so the variance within /// which the first `Vec` appears is - /// `Contravariant.xform(Covariant)` or `Contravariant`. The same + /// `Contravariant.xform(Covariant)` or `Contravariant`. The same /// is true for its `i32` argument. In the `*mut T` case, the /// variance of `Vec` is `Contravariant.xform(Invariant)`, /// and hence the outermost type is `Invariant` with respect to @@ -438,7 +438,7 @@ bitflags! { const HAS_TY_ERR = 1 << 7; const HAS_PROJECTION = 1 << 8; - // FIXME: Rename this to the actual property since it's used for generators too + // FIXME: rename this to the actual property since it's used for generators too const HAS_TY_CLOSURE = 1 << 9; // `true` if there are "names" of types and regions and so forth @@ -728,7 +728,7 @@ pub struct UpvarPath { pub hir_id: hir::HirId, } -/// Upvars do not get their own node-id. Instead, we use the pair of +/// Upvars do not get their own node-ID. Instead, we use the pair of /// the original var id (that is, the root variable that is referenced /// by the upvar) and the id of the closure expression. #[derive(Clone, Copy, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)] @@ -742,7 +742,7 @@ pub enum BorrowKind { /// Data must be immutable and is aliasable. ImmBorrow, - /// Data must be immutable but not aliasable. This kind of borrow + /// Data must be immutable but not aliasable. This kind of borrow /// cannot currently be expressed by the user and is used only in /// implicit closure bindings. It is needed when the closure /// is borrowing or mutating a mutable referent, e.g.: @@ -1103,7 +1103,7 @@ impl<'a, 'gcx, 'tcx> Predicate<'tcx> { /// Performs a substitution suitable for going from a /// poly-trait-ref to supertraits that must hold if that /// poly-trait-ref holds. This is slightly different from a normal - /// substitution in terms of what happens with bound regions. See + /// substitution in terms of what happens with bound regions. See /// lengthy comment below for details. pub fn subst_supertrait(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>, trait_ref: &ty::PolyTraitRef<'tcx>) @@ -1125,7 +1125,7 @@ impl<'a, 'gcx, 'tcx> Predicate<'tcx> { // // In terms of why this is sound, the idea is that whenever there // is an impl of `T:Foo<'a>`, it must show that `T:Bar<'a,'a>` - // holds. So if there is an impl of `T:Foo<'a>` that applies to + // holds. So if there is an impl of `T:Foo<'a>` that applies to // all `'a`, then we must know that `T:Bar<'a,'a>` holds for all // `'a`. // @@ -1137,7 +1137,7 @@ impl<'a, 'gcx, 'tcx> Predicate<'tcx> { // Here, if we have `for<'x> T: Foo1<'x>`, then what do we know? // The answer is that we know `for<'x,'b> T: Bar1<'x,'b>`. The // reason is similar to the previous example: any impl of - // `T:Foo1<'x>` must show that `for<'b> T: Bar1<'x, 'b>`. So + // `T:Foo1<'x>` must show that `for<'b> T: Bar1<'x, 'b>`. So // basically we would want to collapse the bound lifetimes from // the input (`trait_ref`) and the supertraits. // @@ -1205,7 +1205,7 @@ impl<'tcx> TraitPredicate<'tcx> { self.trait_ref.def_id } - pub fn input_types<'a>(&'a self) -> impl DoubleEndedIterator> + 'a { + pub fn input_types<'a>(&'a self) -> impl DoubleEndedIterator> + 'a { self.trait_ref.input_types() } @@ -1216,7 +1216,7 @@ impl<'tcx> TraitPredicate<'tcx> { impl<'tcx> PolyTraitPredicate<'tcx> { pub fn def_id(&self) -> DefId { - // ok to skip binder since trait def-id does not care about regions + // ok to skip binder since trait def-ID does not care about regions self.skip_binder().def_id() } } @@ -1242,7 +1242,7 @@ pub type PolySubtypePredicate<'tcx> = ty::Binder>; /// This kind of predicate has no *direct* correspondent in the /// syntax, but it roughly corresponds to the syntactic forms: /// -/// 1. `T: TraitRef<..., Item=Type>` +/// 1. `T: TraitRef<..., Item = Type>` /// 2. `>::Item == Type` (NYI) /// /// In particular, form #1 is "desugared" to the combination of a @@ -1284,7 +1284,7 @@ impl<'tcx> PolyProjectionPredicate<'tcx> { /// Note that this is not the `DefId` of the `TraitRef` containing this /// associated type, which is in `tcx.associated_item(projection_def_id()).container`. pub fn projection_def_id(&self) -> DefId { - // okay to skip binder since trait def-id does not care about regions + // okay to skip binder since trait def-ID does not care about regions self.skip_binder().projection_ty.item_def_id } } @@ -1463,8 +1463,8 @@ impl<'tcx> Predicate<'tcx> { } /// Represents the bounds declared on a particular set of type -/// parameters. Should eventually be generalized into a flag list of -/// where clauses. You can obtain a `InstantiatedPredicates` list from a +/// parameters. Should eventually be generalized into a flag list of +/// where clauses. You can obtain a `InstantiatedPredicates` list from a /// `GenericPredicates` by using the `instantiate` method. Note that this method /// reflects an important semantic invariant of `InstantiatedPredicates`: while /// the `GenericPredicates` are expressed in terms of the bound type @@ -1478,7 +1478,7 @@ impl<'tcx> Predicate<'tcx> { /// struct Foo> { ... } /// /// Here, the `GenericPredicates` for `Foo` would contain a list of bounds like -/// `[[], [U:Bar]]`. Now if there were some particular reference +/// `[[], [U:Bar]]`. Now if there were some particular reference /// like `Foo`, then the `InstantiatedPredicates` would be `[[], /// [usize:Bar]]`. #[derive(Clone)] @@ -1544,7 +1544,7 @@ impl UniverseIndex { /// Returns the "next" universe index in order -- this new index /// is considered to extend all previous universes. This - /// corresponds to entering a `forall` quantifier. So, for + /// corresponds to entering a `forall` quantifier. So, for /// example, suppose we have this type in universe `U`: /// /// ``` @@ -1559,14 +1559,14 @@ impl UniverseIndex { UniverseIndex::from_u32(self.private.checked_add(1).unwrap()) } - /// Returns `true` if `self` can name a name from `other` -- in other words, + /// Returns whether `self` can name a name from `other` -- in other words, /// if the set of names in `self` is a superset of those in /// `other` (`self >= other`). pub fn can_name(self, other: UniverseIndex) -> bool { self.private >= other.private } - /// Returns `true` if `self` cannot name some names from `other` -- in other + /// Returns whether `self` cannot name some names from `other` -- in other /// words, if the set of names in `self` is a strict subset of /// those in `other` (`self < other`). pub fn cannot_name(self, other: UniverseIndex) -> bool { @@ -1658,7 +1658,7 @@ impl<'tcx> ParamEnv<'tcx> { /// Returns a new parameter environment with the same clauses, but /// which "reveals" the true results of projections in all cases - /// (even for associated types that are specializable). This is + /// (even for associated types that are specializable). This is /// the desired behavior during codegen and certain other special /// contexts; normally though we want to use `Reveal::UserFacing`, /// which is the default. @@ -1743,7 +1743,7 @@ impl<'a, 'gcx, T> HashStable> for ParamEnvAnd<'gcx, T> #[derive(Copy, Clone, Debug)] pub struct Destructor { - /// The def-id of the destructor method + /// The def-ID of the destructor method pub did: DefId, } @@ -1790,18 +1790,19 @@ pub struct VariantDef { impl<'a, 'gcx, 'tcx> VariantDef { /// Create a new `VariantDef`. /// - /// - `did` is the DefId used for the variant - for tuple-structs, it is the constructor DefId, - /// and for everything else, it is the variant DefId. + /// - `did` is the `DefId` used for the variant. + /// This is the constructor `DefId` for tuple stucts, and the variant `DefId` for everything + /// else. /// - `attribute_def_id` is the DefId that has the variant's attributes. - /// this is the struct DefId for structs, and the variant DefId for variants. + /// This is the struct `DefId` for structs, and the variant `DefId` for variants. /// - /// Note that we *could* use the constructor DefId, because the constructor attributes + /// Note that we *could* use the constructor `DefId`, because the constructor attributes /// redirect to the base attributes, but compiling a small crate requires - /// loading the AdtDefs for all the structs in the universe (e.g., coherence for any + /// loading the `AdtDef`s for all the structs in the universe (e.g., coherence for any /// built-in trait), and we do not want to load attributes twice. /// /// If someone speeds up attribute loading to not be a performance concern, they can - /// remove this hack and use the constructor DefId everywhere. + /// remove this hack and use the constructor `DefId` everywhere. pub fn new(tcx: TyCtxt<'a, 'gcx, 'tcx>, did: DefId, ident: Ident, @@ -1964,7 +1965,7 @@ bitflags! { const IS_C = 1 << 0; const IS_SIMD = 1 << 1; const IS_TRANSPARENT = 1 << 2; - // Internal only for now. If true, don't reorder fields. + // Internal only for now. If set, then don't reorder fields. const IS_LINEAR = 1 << 3; // Any of these flags being set prevent field reordering optimisation. @@ -2048,21 +2049,21 @@ impl ReprOptions { self.int.unwrap_or(attr::SignedInt(ast::IntTy::Isize)) } - /// Returns `true` if this `#[repr()]` should inhabit "smart enum + /// Returns whether this `#[repr()]` should inhabit "smart enum /// layout" optimizations, such as representing `Foo<&T>` as a /// single pointer. pub fn inhibit_enum_layout_opt(&self) -> bool { self.c() || self.int.is_some() } - /// Returns `true` if this `#[repr()]` should inhibit struct field reordering - /// optimizations, such as with repr(C), repr(packed(1)), or repr(). + /// Returns whether this `#[repr()]` should inhibit struct field reordering + /// optimizations, such as with `repr(C)`, `repr(packed(1))`, or `repr()`. pub fn inhibit_struct_field_reordering_opt(&self) -> bool { self.flags.intersects(ReprFlags::IS_UNOPTIMISABLE) || self.pack == 1 || self.int.is_some() } - /// Returns true if this `#[repr()]` should inhibit union abi optimisations + /// Returns whether this `#[repr()]` should inhibit union ABI optimisations. pub fn inhibit_union_abi_opt(&self) -> bool { self.c() } @@ -2184,23 +2185,23 @@ impl<'a, 'gcx, 'tcx> AdtDef { self.flags.contains(AdtFlags::IS_FUNDAMENTAL) } - /// Returns `true` if this is PhantomData. + /// Returns whether this is `PhantomData`. #[inline] pub fn is_phantom_data(&self) -> bool { self.flags.contains(AdtFlags::IS_PHANTOM_DATA) } - /// Returns `true` if this is `Arc`. + /// Returns whether this is `Arc`. pub fn is_arc(&self) -> bool { self.flags.contains(AdtFlags::IS_ARC) } - /// Returns `true` if this is `Rc`. + /// Returns whether this is `Rc`. pub fn is_rc(&self) -> bool { self.flags.contains(AdtFlags::IS_RC) } - /// Returns `true` if this is Box. + /// Returns whether this is Box. #[inline] pub fn is_box(&self) -> bool { self.flags.contains(AdtFlags::IS_BOX) @@ -2275,7 +2276,7 @@ impl<'a, 'gcx, 'tcx> AdtDef { }; match tcx.const_eval(param_env.and(cid)) { Ok(val) => { - // FIXME: Find the right type and use it instead of `val.ty` here + // FIXME: find the right type and use it instead of `val.ty` here if let Some(b) = val.assert_bits(tcx.global_tcx(), param_env.and(val.ty)) { trace!("discriminants: {} ({:?})", b, repr_type); Some(Discr { @@ -2343,9 +2344,9 @@ impl<'a, 'gcx, 'tcx> AdtDef { explicit_value.checked_add(tcx, offset as u128).0 } - /// Yields a DefId for the discriminant and an offset to add to it + /// Yields a `DefId` for the discriminant and an offset to add to it /// Alternatively, if there is no explicit discriminant, returns the - /// inferred discriminant directly + /// inferred discriminant directly. pub fn discriminant_def_for_variant( &self, variant_index: VariantIdx, @@ -2375,15 +2376,15 @@ impl<'a, 'gcx, 'tcx> AdtDef { } /// Returns a list of types such that `Self: Sized` if and only - /// if that type is Sized, or `TyErr` if this type is recursive. + /// if that type is `Sized`, or `TyErr` if this type is recursive. /// - /// Oddly enough, checking that the sized-constraint is Sized is + /// Oddly enough, checking that the sized-constraint is `Sized` is /// actually more expressive than checking all members: - /// the Sized trait is inductive, so an associated type that references - /// Self would prevent its containing ADT from being Sized. + /// the `Sized` trait is inductive, so an associated type that references + /// `Self` would prevent its containing ADT from being `Sized`. /// /// Due to normalization being eager, this applies even if - /// the associated type is behind a pointer, e.g., issue #31299. + /// the associated type is behind a pointer (e.g., issue #31299). pub fn sized_constraint(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> &'tcx [Ty<'tcx>] { match tcx.try_adt_sized_constraint(DUMMY_SP, self.did) { Ok(tys) => tys, @@ -2418,7 +2419,7 @@ impl<'a, 'gcx, 'tcx> AdtDef { Foreign(..) | Error | GeneratorWitness(..) => { - // these are never sized - return the target type + // These are never sized; return the target type. vec![ty] } @@ -2430,7 +2431,7 @@ impl<'a, 'gcx, 'tcx> AdtDef { } Adt(adt, substs) => { - // recursive case + // Recursive case. let adt_tys = adt.sized_constraint(tcx); debug!("sized_constraint_for_ty({:?}) intermediate = {:?}", ty, adt_tys); @@ -2441,7 +2442,7 @@ impl<'a, 'gcx, 'tcx> AdtDef { } Projection(..) | Opaque(..) => { - // must calculate explicitly. + // Must calculate explicitly. // FIXME: consider special-casing always-Sized projections vec![ty] } @@ -2449,7 +2450,7 @@ impl<'a, 'gcx, 'tcx> AdtDef { UnnormalizedProjection(..) => bug!("only used with chalk-engine"), Param(..) => { - // perf hack: if there is a `T: Sized` bound, then + // Performance hack: if there is a `T: Sized` bound, then // we know that `T` is Sized and do not need to check // it on the impl. @@ -2487,7 +2488,7 @@ impl<'a, 'gcx, 'tcx> FieldDef { } } -/// Represents the various closure traits in the Rust language. This +/// Represents the various closure traits in the language. This /// will determine the type of the environment (`self`, in the /// desugaring) argument that the closure expects. /// @@ -2495,9 +2496,9 @@ impl<'a, 'gcx, 'tcx> FieldDef { /// `tcx.closure_env_ty()`. #[derive(Clone, Copy, PartialOrd, Ord, PartialEq, Eq, Hash, Debug, RustcEncodable, RustcDecodable)] pub enum ClosureKind { - // Warning: Ordering is significant here! The ordering is chosen - // because the trait Fn is a subtrait of FnMut and so in turn, and - // hence we order it so that Fn < FnMut < FnOnce. + // Warning: ordering is significant here! The ordering is chosen + // because the trait `Fn` is a subtrait of `FnMut` and so in turn, and + // hence we order it so that `Fn < FnMut < FnOnce`. Fn, FnMut, FnOnce, @@ -2519,7 +2520,7 @@ impl<'a, 'tcx> ClosureKind { } } - /// Returns `true` if this a type that impls this closure kind + /// Returns whether this a type that impls this closure kind /// must also implement `other`. pub fn extends(self, other: ty::ClosureKind) -> bool { match (self, other) { @@ -2559,7 +2560,7 @@ impl<'tcx> TyS<'tcx> { TypeWalker::new(self) } - /// Iterator that walks the immediate children of `self`. Hence + /// Iterator that walks the immediate children of `self`. Hence /// `Foo, u32>` yields the sequence `[Bar, u32]` /// (but not `i32`, like `walk`). pub fn walk_shallow(&'tcx self) -> smallvec::IntoIter> { @@ -2567,7 +2568,7 @@ impl<'tcx> TyS<'tcx> { } /// Walks `ty` and any types appearing within `ty`, invoking the - /// callback `f` on each type. If the callback returns false, then the + /// callback `f` on each type. If the callback returns `false`, then the /// children of the current type are ignored. /// /// Note: prefer `ty.walk()` where possible. @@ -2638,7 +2639,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { self.typeck_tables_of(self.hir().body_owner_def_id(body)) } - /// Returns an iterator of the def-ids for all body-owners in this + /// Returns an iterator of the def-IDs for all body-owners in this /// crate. If you would prefer to iterate over the bodies /// themselves, you can do `self.hir().krate().body_ids.iter()`. pub fn body_owners( @@ -2662,10 +2663,10 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { e.span } Some(f) => { - bug!("Node id {} is not an expr: {:?}", id, f); + bug!("Node-ID {} is not an expr: {:?}", id, f); } None => { - bug!("Node id {} is not present in the node map", id); + bug!("Node-ID {} is not present in the node map", id); } } } @@ -2689,7 +2690,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { _ => false, } } else { - match self.describe_def(def_id).expect("no def for def-id") { + match self.describe_def(def_id).expect("no def for def-ID") { Def::AssociatedConst(_) | Def::Method(_) | Def::AssociatedTy(_) => true, _ => false, } @@ -2782,7 +2783,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { } } - /// Returns `true` if the impls are the same polarity and the trait either + /// Returns whether the impls are the same polarity and the trait either /// has no items or is annotated #[marker] and prevents item overrides. pub fn impls_are_allowed_to_overlap(self, def_id1: DefId, def_id2: DefId) -> bool { if self.features().overlapping_marker_traits { @@ -2829,16 +2830,16 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { } } - /// Given a `VariantDef`, returns the def-id of the `AdtDef` of which it is a part. + /// Given a `VariantDef`, returns the def-ID of the `AdtDef` of which it is a part. pub fn adt_def_id_of_variant(self, variant_def: &'tcx VariantDef) -> DefId { let def_key = self.def_key(variant_def.did); match def_key.disambiguated_data.data { - // for enum variants and tuple structs, the def-id of the ADT itself - // is the *parent* of the variant + // For enum variants and tuple structs, the def-ID of the ADT itself + // is the *parent* of the variant. DefPathData::EnumVariant(..) | DefPathData::StructCtor => DefId { krate: variant_def.did.krate, index: def_key.parent.unwrap() }, - // otherwise, for structs and unions, they share a def-id + // Otherwise, for structs and unions, they share a def-ID. _ => variant_def.did, } } @@ -2848,7 +2849,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { self.original_crate_name(id.krate).as_interned_str() } else { let def_key = self.def_key(id); - // The name of a StructCtor is that of its struct parent. + // The name of a `StructCtor` is that of its struct parent. if let hir_map::DefPathData::StructCtor = def_key.disambiguated_data.data { self.item_name(DefId { krate: id.krate, @@ -2862,7 +2863,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { } } - /// Return the possibly-auto-generated MIR of a (DefId, Subst) pair. + /// Return the possibly-auto-generated MIR of a `(DefId, Subst)` pair. pub fn instance_mir(self, instance: ty::InstanceDef<'gcx>) -> &'gcx Mir<'gcx> { @@ -2882,8 +2883,8 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { } } - /// Given the DefId of an item, returns its MIR, borrowed immutably. - /// Returns None if there is no MIR for the DefId + /// Given the `DefId` of an item, returns its MIR, borrowed immutably. + /// Returns `None` if there is no MIR for the `DefId`. pub fn maybe_optimized_mir(self, did: DefId) -> Option<&'gcx Mir<'gcx>> { if self.is_mir_available(did) { Some(self.optimized_mir(did)) @@ -2906,7 +2907,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { attr::contains_name(&self.get_attrs(did), attr) } - /// Returns `true` if this is an `auto trait`. + /// Returns whether this is an `auto trait`. pub fn trait_is_auto(self, trait_def_id: DefId) -> bool { self.trait_def(trait_def_id).has_auto_impl } @@ -2915,14 +2916,14 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { self.optimized_mir(def_id).generator_layout.as_ref().unwrap() } - /// Given the def-id of an impl, return the def_id of the trait it implements. + /// Given the def-ID of an impl, return the def_id of the trait it implements. /// If it implements no trait, return `None`. pub fn trait_id_of_impl(self, def_id: DefId) -> Option { self.impl_trait_ref(def_id).map(|tr| tr.def_id) } /// If the given defid describes a method belonging to an impl, return the - /// def-id of the impl that the method belongs to. Otherwise, return `None`. + /// def-ID of the impl that the method belongs to. Otherwise, return `None`. pub fn impl_of_method(self, def_id: DefId) -> Option { let item = if def_id.krate != LOCAL_CRATE { if let Some(Def::Method(_)) = self.describe_def(def_id) { @@ -3037,7 +3038,7 @@ fn associated_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Asso parent_item.node) } -/// Calculates the Sized-constraint. +/// Calculates the `Sized` constraint. /// /// In fact, there are only a few options for the types in the constraint: /// - an obviously-unsized type @@ -3090,9 +3091,9 @@ fn def_span<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Span { tcx.hir().span_if_local(def_id).unwrap() } -/// If the given def ID describes an item belonging to a trait, -/// return the ID of the trait that the trait item belongs to. -/// Otherwise, return `None`. +/// If the given def-ID describes an item belonging to a trait, +/// returns the def-ID of the trait that the trait item belongs to; +/// otherwise, returns `None`. fn trait_of_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Option { tcx.opt_associated_item(def_id) .and_then(|associated_item| { @@ -3103,7 +3104,7 @@ fn trait_of_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Option }) } -/// Yields the parent function's `DefId` if `def_id` is an `impl Trait` definition. +/// Yields the parent function's def-ID if `def_id` is an `impl Trait` definition. pub fn is_impl_trait_defn(tcx: TyCtxt<'_, '_, '_>, def_id: DefId) -> Option { if let Some(node_id) = tcx.hir().as_local_node_id(def_id) { if let Node::Item(item) = tcx.hir().get(node_id) { @@ -3115,7 +3116,7 @@ pub fn is_impl_trait_defn(tcx: TyCtxt<'_, '_, '_>, def_id: DefId) -> Option, def_id: DefId) -> bool { if let Some(node_id) = tcx.hir().as_local_node_id(def_id) { if let Node::Item(item) = tcx.hir().get(node_id) { diff --git a/src/librustc/ty/outlives.rs b/src/librustc/ty/outlives.rs index ca2d5cd718c64..bb0018215dbf5 100644 --- a/src/librustc/ty/outlives.rs +++ b/src/librustc/ty/outlives.rs @@ -105,7 +105,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { out.push(Component::Projection(*data)); } else { // fallback case: hard code - // OutlivesProjectionComponents. Continue walking + // OutlivesProjectionComponents. Continue walking // through and constrain Pi. let subcomponents = self.capture_components(ty); out.push(Component::EscapingProjection(subcomponents)); @@ -150,7 +150,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { ty::Error => { // (*) Bare functions and traits are both binders. In the // RFC, this means we would add the bound regions to the - // "bound regions list". In our representation, no such + // "bound regions list". In our representation, no such // list is maintained explicitly, because bound regions // themselves can be readily identified. diff --git a/src/librustc/ty/query/config.rs b/src/librustc/ty/query/config.rs index 3464464aa229c..d99db98bf753f 100644 --- a/src/librustc/ty/query/config.rs +++ b/src/librustc/ty/query/config.rs @@ -62,7 +62,7 @@ pub(super) trait QueryDescription<'tcx>: QueryAccessors<'tcx> { } } -impl<'tcx, M: QueryAccessors<'tcx, Key=DefId>> QueryDescription<'tcx> for M { +impl<'tcx, M: QueryAccessors<'tcx, Key = DefId>> QueryDescription<'tcx> for M { default fn describe(tcx: TyCtxt<'_, '_, '_>, def_id: DefId) -> Cow<'static, str> { if !tcx.sess.verbose() { format!("processing `{}`", tcx.item_path_str(def_id)).into() diff --git a/src/librustc/ty/query/job.rs b/src/librustc/ty/query/job.rs index 0063794727fd2..d6a3bd87e3bbd 100644 --- a/src/librustc/ty/query/job.rs +++ b/src/librustc/ty/query/job.rs @@ -30,19 +30,20 @@ use { rustc_data_structures::stable_hasher::{StableHasherResult, StableHasher, HashStable}, }; -/// Indicates the state of a query for a given key in a query map +/// Indicates the state of a query for a given key in a query map. pub(super) enum QueryResult<'tcx> { - /// An already executing query. The query job can be used to await for its completion + /// An already executing query. The query job can be used to await for its completion. Started(Lrc>), - /// The query panicked. Queries trying to wait on this will raise a fatal error / silently panic + /// The query panicked. Queries trying to wait on this will raise a fatal error or + /// silently panic. Poisoned, } -/// A span and a query key +/// A span and a query key. #[derive(Clone, Debug)] pub struct QueryInfo<'tcx> { - /// The span for a reason this query was required + /// The span corresponding to the reason for which this query was required. pub span: Span, pub query: Query<'tcx>, } @@ -54,16 +55,16 @@ pub struct QueryJob<'tcx> { /// The parent query job which created this job and is implicitly waiting on it. pub parent: Option>>, - /// Diagnostic messages which are emitted while the query executes + /// Diagnostic messages which are emitted while the query executes. pub diagnostics: Lock>, - /// The latch which is used to wait on this job + /// The latch which is used to wait on this job. #[cfg(parallel_queries)] latch: QueryLatch<'tcx>, } impl<'tcx> QueryJob<'tcx> { - /// Creates a new query job + /// Creates a new query job. pub fn new(info: QueryInfo<'tcx>, parent: Option>>) -> Self { QueryJob { diagnostics: Lock::new(Vec::new()), @@ -107,9 +108,9 @@ impl<'tcx> QueryJob<'tcx> { condvar: Condvar::new(), }); self.latch.await(&waiter); - // FIXME: Get rid of this lock. We have ownership of the QueryWaiter + // FIXME: get rid of this lock. We have ownership of the `QueryWaiter`. // although another thread may still have a Lrc reference so we cannot - // use Lrc::get_mut + // use `Lrc::get_mut`. let mut cycle = waiter.cycle.lock(); match cycle.take() { None => Ok(()), @@ -124,7 +125,7 @@ impl<'tcx> QueryJob<'tcx> { tcx: TyCtxt<'_, 'tcx, 'lcx>, span: Span, ) -> CycleError<'tcx> { - // Get the current executing query (waiter) and find the waitee amongst its parents + // Get the current executing query (waiter) and find the waitee amongst its parents. let mut current_job = tls::with_related_context(tcx, |icx| icx.query.clone()); let mut cycle = Vec::new(); @@ -134,12 +135,12 @@ impl<'tcx> QueryJob<'tcx> { if ptr::eq(&*job, self) { cycle.reverse(); - // This is the end of the cycle + // This is the end of the cycle. // The span entry we included was for the usage // of the cycle itself, and not part of the cycle - // Replace it with the span which caused the cycle to form + // Replace it with the span which caused the cycle to form. cycle[0].span = span; - // Find out why the cycle itself was used + // Find out why the cycle itself was used. let usage = job.parent.as_ref().map(|parent| { (job.info.span, parent.info.query.clone()) }); @@ -216,13 +217,13 @@ impl<'tcx> QueryLatch<'tcx> { // If this detects a deadlock and the deadlock handler wants to resume this thread // we have to be in the `wait` call. This is ensured by the deadlock handler - // getting the self.info lock. + // getting the `self.info` lock. rayon_core::mark_blocked(); waiter.condvar.wait(&mut info); } } - /// Sets the latch and resumes all waiters on it + /// Sets the latch and resumes all waiters on it. fn set(&self) { let mut info = self.info.lock(); debug_assert!(!info.complete); @@ -241,12 +242,12 @@ impl<'tcx> QueryLatch<'tcx> { ) -> Lrc> { let mut info = self.info.lock(); debug_assert!(!info.complete); - // Remove the waiter from the list of waiters + // Remove the waiter from the list of waiters. info.waiters.remove(waiter) } } -/// A resumable waiter of a query. The usize is the index into waiters in the query's latch +/// A resumable waiter of a query. The `usize` is the index into waiters in the query's latch. #[cfg(parallel_queries)] type Waiter<'tcx> = (Lrc>, usize); @@ -258,24 +259,24 @@ type Waiter<'tcx> = (Lrc>, usize); /// For visits of non-resumable waiters it returns the return value of `visit`. /// For visits of resumable waiters it returns Some(Some(Waiter)) which has the /// required information to resume the waiter. -/// If all `visit` calls returns None, this function also returns None. +/// If all `visit` calls returns None, this function also returns `None`. #[cfg(parallel_queries)] fn visit_waiters<'tcx, F>(query: Lrc>, mut visit: F) -> Option>> where F: FnMut(Span, Lrc>) -> Option>> { - // Visit the parent query which is a non-resumable waiter since it's on the same stack + // Visit the parent query which is a non-resumable waiter since it's on the same stack. if let Some(ref parent) = query.parent { if let Some(cycle) = visit(query.info.span, parent.clone()) { return Some(cycle); } } - // Visit the explicit waiters which use condvars and are resumable + // Visit the explicit waiters which use condvars and are resumable. for (i, waiter) in query.latch.info.lock().waiters.iter().enumerate() { if let Some(ref waiter_query) = waiter.query { if visit(waiter.span, waiter_query.clone()).is_some() { - // Return a value which indicates that this waiter can be resumed + // Return a value which indicates that this waiter can be resumed. return Some(Some((query.clone(), i))); } } @@ -295,11 +296,11 @@ fn cycle_check<'tcx>(query: Lrc>, ) -> Option>> { if !visited.insert(query.as_ptr()) { return if let Some(p) = stack.iter().position(|q| q.1.as_ptr() == query.as_ptr()) { - // We detected a query cycle, fix up the initial span and return Some + // We detected a query cycle, fix up the initial span and return `Some`. - // Remove previous stack entries + // Remove previous stack entries. stack.drain(0..p); - // Replace the span for the first query with the cycle cause + // Replace the span for the first query with the cycle cause. stack[0].0 = span; Some(None) } else { @@ -307,15 +308,15 @@ fn cycle_check<'tcx>(query: Lrc>, } } - // Query marked as visited is added it to the stack + // Add the query marked as visited to the stack. stack.push((span, query.clone())); - // Visit all the waiters + // Visit all the waiters. let r = visit_waiters(query, |span, successor| { cycle_check(successor, span, stack, visited) }); - // Remove the entry in our stack if we didn't find a cycle + // Remove the entry in our stack if we didn't find a cycle. if r.is_none() { stack.pop(); } @@ -331,12 +332,12 @@ fn connected_to_root<'tcx>( query: Lrc>, visited: &mut FxHashSet<*const QueryJob<'tcx>> ) -> bool { - // We already visited this or we're deliberately ignoring it + // We already visited this or we're deliberately ignoring it. if !visited.insert(query.as_ptr()) { return false; } - // This query is connected to the root (it has no query parent), return true + // This query is connected to the root (it has no query parent); return `true`. if query.parent.is_none() { return true; } @@ -350,23 +351,23 @@ fn connected_to_root<'tcx>( }).is_some() } -// Deterministically pick an query from a list +// Deterministically pick an query from a list. #[cfg(parallel_queries)] fn pick_query<'a, 'tcx, T, F: Fn(&T) -> (Span, Lrc>)>( tcx: TyCtxt<'_, 'tcx, '_>, queries: &'a [T], f: F ) -> &'a T { - // Deterministically pick an entry point - // FIXME: Sort this instead + // Deterministically pick an entry point. + // FIXME: dort this instead. let mut hcx = tcx.create_stable_hashing_context(); queries.iter().min_by_key(|v| { let (span, query) = f(v); let mut stable_hasher = StableHasher::::new(); query.info.query.hash_stable(&mut hcx, &mut stable_hasher); - // Prefer entry points which have valid spans for nicer error messages + // Prefer entry points which have valid spans for nicer error messages. // We add an integer to the tuple ensuring that entry points - // with valid spans are picked first + // with valid spans are picked first. let span_cmp = if span == DUMMY_SP { 1 } else { 0 }; (span_cmp, stable_hasher.finish()) }).unwrap() @@ -385,22 +386,22 @@ fn remove_cycle<'tcx>( ) -> bool { let mut visited = FxHashSet::default(); let mut stack = Vec::new(); - // Look for a cycle starting with the last query in `jobs` + // Look for a cycle starting with the last query in `jobs`. if let Some(waiter) = cycle_check(jobs.pop().unwrap(), DUMMY_SP, &mut stack, &mut visited) { // The stack is a vector of pairs of spans and queries; reverse it so that - // the earlier entries require later entries + // the earlier entries require later entries. let (mut spans, queries): (Vec<_>, Vec<_>) = stack.into_iter().rev().unzip(); - // Shift the spans so that queries are matched with the span for their waitee + // Shift the spans so that queries are matched with the span for their waitee. spans.rotate_right(1); - // Zip them back together + // Zip them back together. let mut stack: Vec<_> = spans.into_iter().zip(queries).collect(); - // Remove the queries in our cycle from the list of jobs to look at + // Remove the queries in our cycle from the list of jobs to look at. for r in &stack { if let Some(pos) = jobs.iter().position(|j| j.as_ptr() == r.1.as_ptr()) { jobs.remove(pos); @@ -408,16 +409,16 @@ fn remove_cycle<'tcx>( } // Find the queries in the cycle which are - // connected to queries outside the cycle + // connected to queries outside the cycle. let entry_points = stack.iter().filter_map(|(span, query)| { if query.parent.is_none() { - // This query is connected to the root (it has no query parent) + // This query is connected to the root (it has no query parent). Some((*span, query.clone(), None)) } else { let mut waiters = Vec::new(); - // Find all the direct waiters who lead to the root + // Find all the direct waiters who lead to the root. visit_waiters(query.clone(), |span, waiter| { - // Mark all the other queries in the cycle as already visited + // Mark all the other queries in the cycle as already visited. let mut visited = FxHashSet::from_iter(stack.iter().map(|q| q.1.as_ptr())); if connected_to_root(waiter.clone(), &mut visited) { @@ -429,17 +430,17 @@ fn remove_cycle<'tcx>( if waiters.is_empty() { None } else { - // Deterministically pick one of the waiters to show to the user + // Deterministically pick one of the waiters to show to the user. let waiter = pick_query(tcx, &waiters, |s| s.clone()).clone(); Some((*span, query.clone(), Some(waiter))) } } }).collect::>, Option<(Span, Lrc>)>)>>(); - // Deterministically pick an entry point + // Deterministically pick an entry point. let (_, entry_point, usage) = pick_query(tcx, &entry_points, |e| (e.0, e.1.clone())); - // Shift the stack so that our entry point is first + // Shift the stack so that our entry point is first. let entry_point_pos = stack.iter().position(|(_, query)| { query.as_ptr() == entry_point.as_ptr() }); @@ -449,7 +450,7 @@ fn remove_cycle<'tcx>( let usage = usage.as_ref().map(|(span, query)| (*span, query.info.query.clone())); - // Create the cycle error + // Create the cycle error. let mut error = CycleError { usage, cycle: stack.iter().map(|&(s, ref q)| QueryInfo { @@ -459,16 +460,16 @@ fn remove_cycle<'tcx>( }; // We unwrap `waiter` here since there must always be one - // edge which is resumeable / waited using a query latch + // edge which is resumeable / waited using a query latch. let (waitee_query, waiter_idx) = waiter.unwrap(); - // Extract the waiter we want to resume + // Extract the waiter we want to resume. let waiter = waitee_query.latch.extract_waiter(waiter_idx); - // Set the cycle error so it will be picked up when resumed + // Set the cycle error so it will be picked up when resumed. *waiter.cycle.lock() = Some(error); - // Put the waiter on the list of things to resume + // Put the waiter on the list of things to resume. wakelist.push(waiter); true @@ -546,7 +547,7 @@ fn deadlock(tcx: TyCtxt<'_, '_, '_>, registry: &rayon_core::Registry) { // only considers the true dependency and won't detect a cycle. assert!(found_cycle); - // FIXME: Ensure this won't cause a deadlock before we return + // FIXME: ensure this won't cause a deadlock before we return. for waiter in wakelist.into_iter() { waiter.notify(registry); } diff --git a/src/librustc/ty/query/mod.rs b/src/librustc/ty/query/mod.rs index 22bd1cd90a754..59bf2dbdcc6ce 100644 --- a/src/librustc/ty/query/mod.rs +++ b/src/librustc/ty/query/mod.rs @@ -100,11 +100,11 @@ define_queries! { <'tcx> /// Records the type of every item. [] fn type_of: TypeOfItem(DefId) -> Ty<'tcx>, - /// Maps from the def-id of an item (trait/struct/enum/fn) to its + /// Maps from the def-ID of an item (trait/struct/enum/fn) to its /// associated generics. [] fn generics_of: GenericsOfItem(DefId) -> &'tcx ty::Generics, - /// Maps from the def-id of an item (trait/struct/enum/fn) to the + /// Maps from the def-ID of an item (trait/struct/enum/fn) to the /// predicates (where clauses) that must be proven true in order /// to reference it. This is almost always the "predicates query" /// that you want. @@ -121,7 +121,7 @@ define_queries! { <'tcx> /// user.) [] fn predicates_of: PredicatesOfItem(DefId) -> Lrc>, - /// Maps from the def-id of an item (trait/struct/enum/fn) to the + /// Maps from the def-ID of an item (trait/struct/enum/fn) to the /// predicates (where clauses) directly defined on it. This is /// equal to the `explicit_predicates_of` predicates plus the /// `inferred_outlives_of` predicates. @@ -136,7 +136,7 @@ define_queries! { <'tcx> /// Foo<'a, T> { x: &'a T }`, this would return `T: 'a`). [] fn inferred_outlives_of: InferredOutlivesOf(DefId) -> Lrc>>, - /// Maps from the def-id of a trait to the list of + /// Maps from the def-ID of a trait to the list of /// super-predicates. This is a subset of the full list of /// predicates. We store these in a separate map because we must /// evaluate them even during type conversion, often before the @@ -157,44 +157,43 @@ define_queries! { <'tcx> DefId ) -> Result, NoSolution>, - /// True if this is a const fn, use the `is_const_fn` to know whether your crate actually - /// sees it as const fn (e.g., the const-fn-ness might be unstable and you might not have - /// the feature gate active) + /// Returns whether this is a const fn. Use `is_const_fn` to know whether your crate + /// actually sees it as const fn (e.g., the const-fn-ness might be unstable and you might + /// not have the feature gate active). /// /// **Do not call this function manually.** It is only meant to cache the base data for the /// `is_const_fn` function. [] fn is_const_fn_raw: IsConstFn(DefId) -> bool, - - /// Returns true if calls to the function may be promoted + /// Returns whether calls to the function may be promoted. /// - /// This is either because the function is e.g., a tuple-struct or tuple-variant + /// This is either because the function is e.g., a tuple struct or tuple variant /// constructor, or because it has the `#[rustc_promotable]` attribute. The attribute should /// be removed in the future in favour of some form of check which figures out whether the /// function does not inspect the bits of any of its arguments (so is essentially just a /// constructor function). [] fn is_promotable_const_fn: IsPromotableConstFn(DefId) -> bool, - /// True if this is a foreign item (i.e., linked via `extern { ... }`). + /// Returns whether this is a foreign item (i.e., linked via `extern { ... }`). [] fn is_foreign_item: IsForeignItem(DefId) -> bool, /// Get a map with the variance of every item; use `item_variance` /// instead. [] fn crate_variances: crate_variances(CrateNum) -> Lrc, - /// Maps from def-id of a type or region parameter to its + /// Maps from def-ID of a type or region parameter to its /// (inferred) variance. [] fn variances_of: ItemVariances(DefId) -> Lrc>, }, TypeChecking { - /// Maps from def-id of a type to its (inferred) outlives. + /// Maps from def-ID of a type to its (inferred) outlives. [] fn inferred_outlives_crate: InferredOutlivesCrate(CrateNum) -> Lrc>, }, Other { - /// Maps from an impl/trait def-id to a list of the def-ids of its items + /// Maps from an impl/trait def-ID to a list of the def-IDs of its items [] fn associated_item_def_ids: AssociatedItemDefIds(DefId) -> Lrc>, /// Maps from a trait item to the trait item "descriptor" @@ -212,7 +211,7 @@ define_queries! { <'tcx> }, Codegen { - /// Set of all the def-ids in this crate that have MIR associated with + /// Set of all the def-IDs in this crate that have MIR associated with /// them. This includes all the body owners, but also things like struct /// constructors. [] fn mir_keys: mir_keys(CrateNum) -> Lrc, @@ -222,11 +221,11 @@ define_queries! { <'tcx> /// the value isn't known except to the pass itself. [] fn mir_const_qualif: MirConstQualif(DefId) -> (u8, Lrc>), - /// Fetch the MIR for a given def-id right after it's built - this includes + /// Fetch the MIR for a given def-ID right after it's built - this includes /// unreachable code. [] fn mir_built: MirBuilt(DefId) -> &'tcx Steal>, - /// Fetch the MIR for a given def-id up till the point where it is + /// Fetch the MIR for a given def-ID up till the point where it is /// ready for const evaluation. /// /// See the README for the `mir` module for details. @@ -240,7 +239,7 @@ define_queries! { <'tcx> }, TypeChecking { - /// The result of unsafety-checking this def-id. + /// The result of unsafety-checking this def-ID. [] fn unsafety_check_result: UnsafetyCheckResult(DefId) -> mir::UnsafetyCheckResult, /// HACK: when evaluated, this reports a "unsafe derive on repr(packed)" error @@ -283,13 +282,13 @@ define_queries! { <'tcx> TypeChecking { /// Gets a complete map from all types to their inherent impls. /// Not meant to be used directly outside of coherence. - /// (Defined only for LOCAL_CRATE) + /// (Defined only for `LOCAL_CRATE`.) [] fn crate_inherent_impls: crate_inherent_impls_dep_node(CrateNum) -> Lrc, - /// Checks all types in the krate for overlap in their inherent impls. Reports errors. + /// Checks all types in the crate for overlap in their inherent impls. Reports errors. /// Not meant to be used directly outside of coherence. - /// (Defined only for LOCAL_CRATE) + /// (Defined only for `LOCAL_CRATE`.) [] fn crate_inherent_impls_overlap_check: inherent_impls_overlap_check_dep_node(CrateNum) -> (), }, @@ -297,9 +296,9 @@ define_queries! { <'tcx> Other { /// Evaluate a constant without running sanity checks /// - /// DO NOT USE THIS outside const eval. Const eval uses this to break query cycles during - /// validation. Please add a comment to every use site explaining why using `const_eval` - /// isn't sufficient + /// **Do not use this** outside const eval. Const eval uses this to break query cycles + /// during validation. Please add a comment to every use site explaining why using + /// `const_eval` isn't sufficient [] fn const_eval_raw: const_eval_raw_dep_node(ty::ParamEnvAnd<'tcx, GlobalId<'tcx>>) -> ConstEvalRawResult<'tcx>, @@ -320,7 +319,7 @@ define_queries! { <'tcx> Other { [] fn reachable_set: reachability_dep_node(CrateNum) -> ReachableSet, - /// Per-body `region::ScopeTree`. The `DefId` should be the owner-def-id for the body; + /// Per-body `region::ScopeTree`. The `DefId` should be the owner-def-ID for the body; /// in the case of closures, this will be redirected to the enclosing function. [] fn region_scope_tree: RegionScopeTree(DefId) -> Lrc, diff --git a/src/librustc/ty/query/plumbing.rs b/src/librustc/ty/query/plumbing.rs index 6887f480f72e0..eb528fd7fabc7 100644 --- a/src/librustc/ty/query/plumbing.rs +++ b/src/librustc/ty/query/plumbing.rs @@ -669,7 +669,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { } } - // FIXME: Try uninlining this + // FIXME: try uninlining this #[inline(always)] pub(super) fn get_query>( self, diff --git a/src/librustc/ty/relate.rs b/src/librustc/ty/relate.rs index 84e15a751353e..3c0a2af591aa4 100644 --- a/src/librustc/ty/relate.rs +++ b/src/librustc/ty/relate.rs @@ -42,7 +42,7 @@ pub trait TypeRelation<'a, 'gcx: 'a+'tcx, 'tcx: 'a> : Sized { /// Returns a static string we can use for printouts. fn tag(&self) -> &'static str; - /// Returns true if the value `a` is the "expected" type in the + /// Returns whether the value `a` is the "expected" type in the /// relation. Just affects error messages. fn a_is_expected(&self) -> bool; @@ -271,7 +271,7 @@ impl<'tcx> Relate<'tcx> for Vec> { { // To be compatible, `a` and `b` must be for precisely the // same set of traits and item names. We always require that - // projection bounds lists are sorted by trait-def-id and item-name, + // projection bounds lists are sorted by trait-def-ID and item-name, // so we can just iterate through the lists pairwise, so long as they are the // same length. if a.len() != b.len() { diff --git a/src/librustc/ty/sty.rs b/src/librustc/ty/sty.rs index f7adb83f8eb18..87862d0543ecf 100644 --- a/src/librustc/ty/sty.rs +++ b/src/librustc/ty/sty.rs @@ -47,7 +47,7 @@ pub enum BoundRegion { /// Named region parameters for functions (a in &'a T) /// - /// The def-id is needed to distinguish free regions in + /// The def-ID is needed to distinguish free regions in /// the event of shadowing. BrNamed(DefId, InternedString), @@ -335,7 +335,7 @@ impl<'tcx> ClosureSubsts<'tcx> { #[inline] pub fn upvar_tys(self, def_id: DefId, tcx: TyCtxt<'_, '_, '_>) -> - impl Iterator> + 'tcx + impl Iterator> + 'tcx { let SplitClosureSubsts { upvar_kinds, .. } = self.split(def_id, tcx); upvar_kinds.iter().map(|t| { @@ -419,7 +419,7 @@ impl<'tcx> GeneratorSubsts<'tcx> { #[inline] pub fn upvar_tys(self, def_id: DefId, tcx: TyCtxt<'_, '_, '_>) -> - impl Iterator> + 'tcx + impl Iterator> + 'tcx { let SplitGeneratorSubsts { upvar_kinds, .. } = self.split(def_id, tcx); upvar_kinds.iter().map(|t| { @@ -444,7 +444,7 @@ impl<'tcx> GeneratorSubsts<'tcx> { /// Return the "generator signature", which consists of its yield /// and return types. /// - /// NB. Some bits of the code prefers to see this wrapped in a + /// N.B., some bits of the code prefers to see this wrapped in a /// binder, but it never contains bound regions. Probably this /// function should be removed. pub fn poly_sig(self, def_id: DefId, tcx: TyCtxt<'_, '_, '_>) -> PolyGenSig<'tcx> { @@ -469,7 +469,7 @@ impl<'a, 'gcx, 'tcx> GeneratorSubsts<'tcx> { self, def_id: DefId, tcx: TyCtxt<'a, 'gcx, 'tcx>, - ) -> impl Iterator> + Captures<'gcx> + 'a { + ) -> impl Iterator> + Captures<'gcx> + 'a { let state = tcx.generator_layout(def_id).fields.iter(); state.map(move |d| d.ty.subst(tcx, self.substs)) } @@ -478,7 +478,7 @@ impl<'a, 'gcx, 'tcx> GeneratorSubsts<'tcx> { /// is available before the generator transformation. /// It includes the upvars and the state discriminant which is u32. pub fn pre_transforms_tys(self, def_id: DefId, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> - impl Iterator> + 'a + impl Iterator> + 'a { self.upvar_tys(def_id, tcx).chain(iter::once(tcx.types.u32)) } @@ -486,7 +486,7 @@ impl<'a, 'gcx, 'tcx> GeneratorSubsts<'tcx> { /// This is the types of all the fields stored in a generator. /// It includes the upvars, state types and the state discriminant which is u32. pub fn field_tys(self, def_id: DefId, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> - impl Iterator> + Captures<'gcx> + 'a + impl Iterator> + Captures<'gcx> + 'a { self.pre_transforms_tys(def_id, tcx).chain(self.state_tys(def_id, tcx)) } @@ -501,7 +501,7 @@ pub enum UpvarSubsts<'tcx> { impl<'tcx> UpvarSubsts<'tcx> { #[inline] pub fn upvar_tys(self, def_id: DefId, tcx: TyCtxt<'_, '_, '_>) -> - impl Iterator> + 'tcx + impl Iterator> + 'tcx { let upvar_kinds = match self { UpvarSubsts::Closure(substs) => substs.split(def_id, tcx).upvar_kinds, @@ -578,7 +578,7 @@ impl<'tcx> List> { #[inline] pub fn projection_bounds<'a>(&'a self) -> - impl Iterator> + 'a { + impl Iterator> + 'a { self.iter().filter_map(|predicate| { match *predicate { ExistentialPredicate::Projection(p) => Some(p), @@ -588,7 +588,7 @@ impl<'tcx> List> { } #[inline] - pub fn auto_traits<'a>(&'a self) -> impl Iterator + 'a { + pub fn auto_traits<'a>(&'a self) -> impl Iterator + 'a { self.iter().filter_map(|predicate| { match *predicate { ExistentialPredicate::AutoTrait(d) => Some(d), @@ -605,17 +605,17 @@ impl<'tcx> Binder<&'tcx List>> { #[inline] pub fn projection_bounds<'a>(&'a self) -> - impl Iterator> + 'a { + impl Iterator> + 'a { self.skip_binder().projection_bounds().map(Binder::bind) } #[inline] - pub fn auto_traits<'a>(&'a self) -> impl Iterator + 'a { + pub fn auto_traits<'a>(&'a self) -> impl Iterator + 'a { self.skip_binder().auto_traits() } pub fn iter<'a>(&'a self) - -> impl DoubleEndedIterator>> + 'tcx { + -> impl DoubleEndedIterator>> + 'tcx { self.skip_binder().iter().cloned().map(Binder::bind) } } @@ -625,8 +625,8 @@ impl<'tcx> Binder<&'tcx List>> { /// /// T: Foo /// -/// This would be represented by a trait-reference where the def-id is the -/// def-id for the trait `Foo` and the substs define `T` as parameter 0, +/// This would be represented by a trait-reference where the def-ID is the +/// def-ID for the trait `Foo` and the substs define `T` as parameter 0, /// and `U` as parameter 1. /// /// Trait references also appear in object types like `Foo`, but in @@ -712,7 +712,7 @@ pub struct ExistentialTraitRef<'tcx> { } impl<'a, 'gcx, 'tcx> ExistentialTraitRef<'tcx> { - pub fn input_types<'b>(&'b self) -> impl DoubleEndedIterator> + 'b { + pub fn input_types<'b>(&'b self) -> impl DoubleEndedIterator> + 'b { // Select only the "input types" from a trait-reference. For // now this is all the types that appear in the // trait-reference, but it should eventually exclude @@ -732,9 +732,9 @@ impl<'a, 'gcx, 'tcx> ExistentialTraitRef<'tcx> { } } - /// Object types don't have a self-type specified. Therefore, when + /// Object types don't have a self type specified. Therefore, when /// we convert the principal trait-ref into a normal trait-ref, - /// you must give *some* self-type. A common choice is `mk_err()` + /// you must give *some* self type. A common choice is `mk_err()` /// or some placeholder type. pub fn with_self_ty(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>, self_ty: Ty<'tcx>) -> ty::TraitRef<'tcx> { @@ -755,9 +755,9 @@ impl<'tcx> PolyExistentialTraitRef<'tcx> { self.skip_binder().def_id } - /// Object types don't have a self-type specified. Therefore, when + /// Object types don't have a self type specified. Therefore, when /// we convert the principal trait-ref into a normal trait-ref, - /// you must give *some* self-type. A common choice is `mk_err()` + /// you must give *some* self type. A common choice is `mk_err()` /// or some placeholder type. pub fn with_self_ty(&self, tcx: TyCtxt<'_, '_, 'tcx>, self_ty: Ty<'tcx>) @@ -806,7 +806,7 @@ impl Binder { /// /// Some examples where `skip_binder` is reasonable: /// - /// - extracting the def-id from a PolyTraitRef; + /// - extracting the def-ID from a PolyTraitRef; /// - comparing the self type of a PolyTraitRef to see if it is equal to /// a type parameter `X`, since the type `X` does not reference any regions pub fn skip_binder(&self) -> &T { @@ -1487,7 +1487,7 @@ impl RegionKind { flags } - /// Given an early-bound or free region, returns the def-id where it was bound. + /// Given an early-bound or free region, returns the def-ID where it was bound. /// For example, consider the regions in this snippet of code: /// /// ``` @@ -1502,10 +1502,10 @@ impl RegionKind { /// } /// ``` /// - /// Here, `free_region_binding_scope('a)` would return the def-id + /// Here, `free_region_binding_scope('a)` would return the def-ID /// of the impl, and for all the other highlighted regions, it - /// would return the def-id of the function. In other cases (not shown), this - /// function might return the def-id of a closure. + /// would return the def-ID of the function. In other cases (not shown), this + /// function might return the def-ID of a closure. pub fn free_region_binding_scope(&self, tcx: TyCtxt<'_, '_, '_>) -> DefId { match self { ty::ReEarlyBound(br) => { @@ -1688,7 +1688,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> { } } - /// Returns `true` if this type is an `Arc`. + /// Returns whether this type is an `Arc`. pub fn is_arc(&self) -> bool { match self.sty { Adt(def, _) => def.is_arc(), @@ -1696,7 +1696,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> { } } - /// Returns `true` if this type is an `Rc`. + /// Returns whether this type is an `Rc`. pub fn is_rc(&self) -> bool { match self.sty { Adt(def, _) => def.is_rc(), @@ -1731,7 +1731,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> { } } - /// Returns true if this type is a floating point type and false otherwise. + /// Returns whether this type is a floating point type. pub fn is_floating_point(&self) -> bool { match self.sty { Float(_) | diff --git a/src/librustc/ty/subst.rs b/src/librustc/ty/subst.rs index 560e80abb9cbd..bab8451f7491e 100644 --- a/src/librustc/ty/subst.rs +++ b/src/librustc/ty/subst.rs @@ -172,7 +172,7 @@ impl<'a, 'gcx, 'tcx> Substs<'tcx> { /// Creates a `Substs` that maps each generic parameter to a higher-ranked /// var bound at index `0`. For types, we use a `BoundVar` index equal to /// the type parameter index. For regions, we use the `BoundRegion::BrNamed` - /// variant (which has a def-id). + /// variant (which has a def-ID). pub fn bound_vars_for_item( tcx: TyCtxt<'a, 'gcx, 'tcx>, def_id: DefId @@ -603,7 +603,7 @@ pub struct UserSubsts<'tcx> { /// The substitutions for the item as given by the user. pub substs: &'tcx Substs<'tcx>, - /// The self-type, in the case of a `::Item` path (when applied + /// The self type, in the case of a `::Item` path (when applied /// to an inherent impl). See `UserSelfTy` below. pub user_self_ty: Option>, } @@ -623,8 +623,8 @@ BraceStructLiftImpl! { } } -/// Specifies the user-given self-type. In the case of a path that -/// refers to a member in an inherent impl, this self-type is +/// Specifies the user-given self type. In the case of a path that +/// refers to a member in an inherent impl, this self type is /// sometimes needed to constrain the type parameters on the impl. For /// example, in this code: /// @@ -634,11 +634,11 @@ BraceStructLiftImpl! { /// ``` /// /// when you then have a path like `>::method`, -/// this struct would carry the def-id of the impl along with the -/// self-type `Foo`. Then we can instantiate the parameters of +/// this struct would carry the def-ID of the impl along with the +/// self type `Foo`. Then we can instantiate the parameters of /// the impl (with the substs from `UserSubsts`) and apply those to -/// the self-type, giving `Foo`. Finally, we unify that with -/// the self-type here, which contains `?A` to be `&'static u32` +/// the self type, giving `Foo`. Finally, we unify that with +/// the self type here, which contains `?A` to be `&'static u32` #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)] pub struct UserSelfTy<'tcx> { pub impl_def_id: DefId, diff --git a/src/librustc/ty/trait_def.rs b/src/librustc/ty/trait_def.rs index 37ec560d6c19f..367de9daa9ffc 100644 --- a/src/librustc/ty/trait_def.rs +++ b/src/librustc/ty/trait_def.rs @@ -39,7 +39,7 @@ pub struct TraitDef { #[derive(Default)] pub struct TraitImpls { blanket_impls: Vec, - /// Impls indexed by their simplified self-type, for fast lookup. + /// Impls indexed by their simplified self type, for fast lookup. non_blanket_impls: FxHashMap>, } @@ -84,7 +84,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { } /// Iterate over every impl that could possibly match the - /// self-type `self_ty`. + /// self type `self_ty`. pub fn for_each_relevant_impl(self, def_id: DefId, self_ty: Ty<'tcx>, diff --git a/src/librustc/ty/util.rs b/src/librustc/ty/util.rs index 1d30ccb87b5d8..adf843c49b03c 100644 --- a/src/librustc/ty/util.rs +++ b/src/librustc/ty/util.rs @@ -178,7 +178,7 @@ impl<'tcx> ty::ParamEnv<'tcx> { tcx: TyCtxt<'a, 'tcx, 'tcx>, self_type: Ty<'tcx>) -> Result<(), CopyImplementationError<'tcx>> { - // FIXME: (@jroesch) float this code up + // FIXME(jroesch): float this code up. tcx.infer_ctxt().enter(|infcx| { let (adt, substs) = match self_type.sty { // These types used to have a builtin impl. @@ -232,7 +232,7 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { let mut hcx = self.create_stable_hashing_context(); // We want the type_id be independent of the types free regions, so we - // erase them. The erase_regions() call will also anonymize bound + // erase them. The `erase_regions()` call will also anonymize bound // regions, which is desirable too. let ty = self.erase_regions(&ty); @@ -343,7 +343,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { /// Requires that trait definitions have been processed so that we can /// elaborate predicates and walk supertraits. /// - /// FIXME callers may only have a &[Predicate], not a Vec, so that's + /// FIXME: callers may only have a `&[Predicate]`, not a `Vec`, so that's /// what this code should accept. pub fn required_region_bounds(self, erased_self_ty: Ty<'tcx>, @@ -369,9 +369,9 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { None } ty::Predicate::TypeOutlives(predicate) => { - // Search for a bound of the form `erased_self_ty - // : 'a`, but be wary of something like `for<'a> - // erased_self_ty : 'a` (we interpret a + // Search for a bound of the form `erased_self_ty: 'a`, + // but be wary of something like `for<'a> + // erased_self_ty: 'a` (we interpret a // higher-ranked bound like that as 'static, // though at present the code in `fulfill.rs` // considers such bounds to be unsatisfiable, so @@ -452,8 +452,8 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { let impl_def_id = self.associated_item(dtor).container.id(); let impl_generics = self.generics_of(impl_def_id); - // We have a destructor - all the parameters that are not - // pure_wrt_drop (i.e, don't have a #[may_dangle] attribute) + // We have a destructor -- all the parameters that are not + // pure_wrt_drop (i.e, don't have a `#[may_dangle]` attribute) // must be live. // We need to return the list of parameters from the ADTs @@ -495,7 +495,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { !impl_generics.type_param(pt, self).pure_wrt_drop } UnpackedKind::Lifetime(_) | UnpackedKind::Type(_) => { - // not a type or region param - this should be reported + // Not a type or region param; this should be reported // as an error. false } @@ -508,11 +508,11 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { } /// True if `def_id` refers to a closure (e.g., `|x| x * 2`). Note - /// that closures have a def-id, but the closure *expression* also + /// that closures have a def-ID, but the closure *expression* also /// has a `HirId` that is located within the context where the /// closure appears (and, sadly, a corresponding `NodeId`, since /// those are not yet phased out). The parent of the closure's - /// def-id will also be the context where it appears. + /// def-ID will also be the context where it appears. pub fn is_closure(self, def_id: DefId) -> bool { self.def_key(def_id).disambiguated_data.data == DefPathData::ClosureExpr } @@ -526,17 +526,17 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { } } - /// True if this def-id refers to the implicit constructor for - /// a tuple struct like `struct Foo(u32)`. + /// True if this def-ID refers to the implicit constructor for + /// a tuple struct (e.g., `struct Foo(u32)`). pub fn is_struct_constructor(self, def_id: DefId) -> bool { self.def_key(def_id).disambiguated_data.data == DefPathData::StructCtor } /// Given the `DefId` of a fn or closure, returns the `DefId` of /// the innermost fn item that the closure is contained within. - /// This is a significant def-id because, when we do + /// This is a significant def-ID because, when we do /// type-checking, we type-check this fn item and all of its - /// (transitive) closures together. Therefore, when we fetch the + /// (transitive) closures together. Therefore, when we fetch the /// `typeck_tables_of` the closure, for example, we really wind up /// fetching the `typeck_tables_of` the enclosing fn item. pub fn closure_base_def_id(self, def_id: DefId) -> DefId { @@ -549,10 +549,10 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { def_id } - /// Given the def-id and substs a closure, creates the type of + /// Given the def-ID and substs a closure, creates the type of /// `self` argument that the closure expects. For example, for a /// `Fn` closure, this would return a reference type `&T` where - /// `T=closure_ty`. + /// `T = closure_ty`. /// /// Returns `None` if this closure's kind has not yet been inferred. /// This should only be possible during type checking. @@ -576,7 +576,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { Some(ty::Binder::bind(env_ty)) } - /// Given the def-id of some item that has no type parameters, make + /// Given the def-ID of some item that has no type parameters, make /// a suitable "empty substs" for it. pub fn empty_substs_for_def_id(self, item_def_id: DefId) -> &'tcx Substs<'tcx> { Substs::for_item(self, item_def_id, |param, _| { @@ -589,7 +589,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { }) } - /// Return whether the node pointed to by def_id is a static item, and its mutability + /// Return whether the node pointed to by `def_id` is a static item, and its mutability. pub fn is_static(&self, def_id: DefId) -> Option { if let Some(node) = self.hir().get_if_local(def_id) { match node { @@ -679,7 +679,7 @@ impl<'a, 'tcx> ty::TyS<'tcx> { -> Representability { // Iterate until something non-representable is found - fn fold_repr>(iter: It) -> Representability { + fn fold_repr>(iter: It) -> Representability { iter.fold(Representability::Representable, |r1, r2| { match (r1, r2) { (Representability::SelfRecursive(v1), @@ -700,7 +700,7 @@ impl<'a, 'tcx> ty::TyS<'tcx> { { match ty.sty { Tuple(ref ts) => { - // Find non representable + // Find non-representable. fold_repr(ts.iter().map(|ty| { is_type_structurally_recursive(tcx, sp, seen, representable_cache, ty) })) @@ -711,7 +711,7 @@ impl<'a, 'tcx> ty::TyS<'tcx> { is_type_structurally_recursive(tcx, sp, seen, representable_cache, ty) } Adt(def, substs) => { - // Find non representable fields with their spans + // Find non-representable fields with their spans. fold_repr(def.all_fields().map(|field| { let ty = field.ty(tcx, substs); let span = tcx.hir().span_if_local(field.did).unwrap_or(sp); @@ -726,8 +726,8 @@ impl<'a, 'tcx> ty::TyS<'tcx> { })) } Closure(..) => { - // this check is run on type definitions, so we don't expect - // to see closure types + // This check is run on type definitions, so we don't expect + // to see closure types. bug!("requires check invoked on inapplicable type: {:?}", ty) } _ => Representability::Representable, @@ -909,19 +909,19 @@ fn needs_drop_raw<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, assert!(!ty.needs_infer()); match ty.sty { - // Fast-path for primitive types + // Fast-path for primitive types. ty::Infer(ty::FreshIntTy(_)) | ty::Infer(ty::FreshFloatTy(_)) | ty::Bool | ty::Int(_) | ty::Uint(_) | ty::Float(_) | ty::Never | ty::FnDef(..) | ty::FnPtr(_) | ty::Char | ty::GeneratorWitness(..) | ty::RawPtr(_) | ty::Ref(..) | ty::Str => false, - // Foreign types can never have destructors + // Foreign types can never have destructors. ty::Foreign(..) => false, // `ManuallyDrop` doesn't have a destructor regardless of field types. ty::Adt(def, _) if Some(def.did) == tcx.lang_items().manually_drop() => false, - // Issue #22536: We first query type_moves_by_default. It sees a + // Issue #22536: we first query type_moves_by_default. It sees a // normalized version of the type, and therefore will definitely // know whether the type implements Copy (and thus needs no // cleanup/drop/zeroing) ... @@ -930,7 +930,7 @@ fn needs_drop_raw<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, // ... (issue #22536 continued) but as an optimization, still use // prior logic of asking for the structural "may drop". - // FIXME(#22815): Note that this is a conservative heuristic; + // FIXME(#22815): note that this is a conservative heuristic; // it may report that the type "may drop" when actual type does // not actually have a destructor associated with it. But since // the type absolutely did not have the `Copy` bound attached @@ -940,7 +940,7 @@ fn needs_drop_raw<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, ty::Adt(def, _) if def.has_dtor(tcx) => true, // Can refer to a type which may drop. - // FIXME(eddyb) check this against a ParamEnv. + // FIXME(eddyb): check this against a `ParamEnv`. ty::Dynamic(..) | ty::Projection(..) | ty::Param(_) | ty::Bound(..) | ty::Placeholder(..) | ty::Opaque(..) | ty::Infer(_) | ty::Error => true, @@ -953,12 +953,12 @@ fn needs_drop_raw<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, // Pessimistically assume that all generators will require destructors // as we don't know if a destructor is a noop or not until after the MIR - // state transformation pass + // state transformation pass. ty::Generator(..) => true, ty::Tuple(ref tys) => tys.iter().cloned().any(needs_drop), - // unions don't have destructors because of the child types, + // Unions don't have destructors because of the child types, // only if they manually implement `Drop` (handled above). ty::Adt(def, _) if def.is_union() => false, diff --git a/src/librustc/ty/wf.rs b/src/librustc/ty/wf.rs index f4a998fb9905a..0c7728e0f4bb1 100644 --- a/src/librustc/ty/wf.rs +++ b/src/librustc/ty/wf.rs @@ -229,7 +229,7 @@ impl<'a, 'gcx, 'tcx> WfPredicates<'a, 'gcx, 'tcx> { } } - /// Push new obligations into `out`. Returns true if it was able + /// Push new obligations into `out`. Returns whether it was able /// to generate all the predicates needed to validate that `ty0` /// is WF. Returns false if `ty0` is an unresolved type variable, /// in which case we are not able to simplify at all. diff --git a/src/librustc/util/nodemap.rs b/src/librustc/util/nodemap.rs index fe6ab075a1a8a..83ef6b9deb79e 100644 --- a/src/librustc/util/nodemap.rs +++ b/src/librustc/util/nodemap.rs @@ -1,4 +1,4 @@ -//! An efficient hash map for node IDs +//! An efficient hash map for node-IDs. use hir::def_id::DefId; use hir::{HirId, ItemLocalId}; diff --git a/src/librustc/util/ppaux.rs b/src/librustc/util/ppaux.rs index 318d7adb19011..516dee337aed5 100644 --- a/src/librustc/util/ppaux.rs +++ b/src/librustc/util/ppaux.rs @@ -289,7 +289,7 @@ impl PrintContext { // to be a value or type-def or something in there // *somewhere* item_def_id.index = key.parent.unwrap_or_else(|| { - bug!("finding type for {:?}, encountered def-id {:?} with no \ + bug!("finding type for {:?}, encountered def-ID {:?} with no \ parent", did, item_def_id); }); } @@ -709,9 +709,6 @@ define_print! { define_print! { ('tcx) ty::ExistentialTraitRef<'tcx>, (self, f, cx) { - display { - cx.parameterized(f, self.substs, self.def_id, &[]) - } debug { ty::tls::with(|tcx| { let dummy_self = tcx.mk_infer(ty::FreshTy(0)); @@ -775,9 +772,9 @@ define_print! { return self.print_debug(f, cx); } - // These printouts are concise. They do not contain all the information + // These printouts are concise. They do not contain all the information // the user might want to diagnose an error, but there is basically no way - // to fit that into a short string. Hence the recommendation to use + // to fit that into a short string. ence the recommendation to use // `explain_region()` or `note_and_explain_region()`. match *self { ty::ReEarlyBound(ref data) => { diff --git a/src/librustc_apfloat/ieee.rs b/src/librustc_apfloat/ieee.rs index 2ff9faa3bb170..2e761bc2edf55 100644 --- a/src/librustc_apfloat/ieee.rs +++ b/src/librustc_apfloat/ieee.rs @@ -186,7 +186,7 @@ impl Semantics for X87DoubleExtendedS { /// exponent = all 1's, integer bit 0, significand 0 ("pseudoinfinity") /// exponent = all 1's, integer bit 0, significand nonzero ("pseudoNaN") /// exponent = 0, integer bit 1 ("pseudodenormal") - /// exponent!=0 nor all 1's, integer bit 0 ("unnormal") + /// exponent != 0 nor all 1's, integer bit 0 ("unnormal") /// At the moment, the first two are treated as NaNs, the second two as Normal. fn from_bits(bits: u128) -> IeeeFloat { let sign = bits & (1 << (Self::BITS - 1)); @@ -373,7 +373,7 @@ impl fmt::Display for IeeeFloat { // We use enough digits so the number can be round-tripped back to an // APFloat. The formula comes from "How to Print Floating-Point Numbers // Accurately" by Steele and White. - // FIXME: Using a formula based purely on the precision is conservative; + // FIXME: using a formula based purely on the precision is conservative; // we can print fewer digits depending on the actual value being printed. // precision = 2 + floor(S::PRECISION / lg_2(10)) @@ -2421,7 +2421,7 @@ mod sig { let _: Loss = shift_right(&mut dst[..dst_limbs], &mut 0, shift); // We now have (dst_limbs * LIMB_BITS - shift) bits from `src` - // in `dst`. If this is less that src_bits, append the rest, else + // in `dst`. If this is less that src_bits, append the rest, else // clear the high bits. let n = dst_limbs * LIMB_BITS - shift; if n < src_bits { diff --git a/src/librustc_apfloat/lib.rs b/src/librustc_apfloat/lib.rs index 6d2c54ca9ffe9..40b4450bf4ad1 100644 --- a/src/librustc_apfloat/lib.rs +++ b/src/librustc_apfloat/lib.rs @@ -393,7 +393,7 @@ pub trait Float /// /// The *is_exact output tells whether the result is exact, in the sense /// that converting it back to the original floating point type produces - /// the original value. This is almost equivalent to result==Status::OK, + /// the original value. This is almost equivalent to `result == Status::OK`, /// except for negative zeroes. fn to_i128_r(self, width: usize, round: Round, is_exact: &mut bool) -> StatusAnd { let status; @@ -463,13 +463,13 @@ pub trait Float } } - /// IEEE-754R isSignMinus: Returns true if and only if the current value is + /// IEEE-754R isSignMinus: Returns whether the current value is /// negative. /// /// This applies to zeros and NaNs as well. fn is_negative(self) -> bool; - /// IEEE-754R isNormal: Returns true if and only if the current value is normal. + /// IEEE-754R isNormal: Returns whether the current value is normal. /// /// This implies that the current value of the float is not zero, subnormal, /// infinite, or NaN following the definition of normality from IEEE-754R. @@ -477,7 +477,7 @@ pub trait Float !self.is_denormal() && self.is_finite_non_zero() } - /// Returns true if and only if the current value is zero, subnormal, or + /// Returns whether the current value is zero, subnormal, or /// normal. /// /// This means that the value is not infinite or NaN. @@ -485,26 +485,26 @@ pub trait Float !self.is_nan() && !self.is_infinite() } - /// Returns true if and only if the float is plus or minus zero. + /// Returns whether the float is plus or minus zero. fn is_zero(self) -> bool { self.category() == Category::Zero } - /// IEEE-754R isSubnormal(): Returns true if and only if the float is a + /// IEEE-754R isSubnormal(): Returns whether the float is a /// denormal. fn is_denormal(self) -> bool; - /// IEEE-754R isInfinite(): Returns true if and only if the float is infinity. + /// IEEE-754R isInfinite(): Returns whether the float is infinity. fn is_infinite(self) -> bool { self.category() == Category::Infinity } - /// Returns true if and only if the float is a quiet or signaling NaN. + /// Returns whether the float is a quiet or signaling NaN. fn is_nan(self) -> bool { self.category() == Category::NaN } - /// Returns true if and only if the float is a signaling NaN. + /// Returns whether the float is a signaling NaN. fn is_signaling(self) -> bool; // Simple Queries @@ -523,19 +523,19 @@ pub trait Float self.is_zero() && self.is_negative() } - /// Returns true if and only if the number has the smallest possible non-zero + /// Returns whether the number has the smallest possible non-zero /// magnitude in the current semantics. fn is_smallest(self) -> bool { Self::SMALLEST.copy_sign(self).bitwise_eq(self) } - /// Returns true if and only if the number has the largest possible finite + /// Returns whether the number has the largest possible finite /// magnitude in the current semantics. fn is_largest(self) -> bool { Self::largest().copy_sign(self).bitwise_eq(self) } - /// Returns true if and only if the number is an exact integer. + /// Returns whether the number is an exact integer. fn is_integer(self) -> bool { // This could be made more efficient; I'm going for obviously correct. if !self.is_finite() { @@ -581,7 +581,7 @@ pub trait FloatConvert: Float { /// The return value corresponds to the IEEE754 exceptions. *loses_info /// records whether the transformation lost information, i.e., whether /// converting the result back to the original type will produce the - /// original value (this is almost the same as return value==Status::OK, + /// original value (this is almost the same as return `value == Status::OK`, /// but there are edge cases where this is not so). fn convert_r(self, round: Round, loses_info: &mut bool) -> StatusAnd; fn convert(self, loses_info: &mut bool) -> StatusAnd { diff --git a/src/librustc_apfloat/ppc.rs b/src/librustc_apfloat/ppc.rs index 839e88cf34039..9fb145d6c6665 100644 --- a/src/librustc_apfloat/ppc.rs +++ b/src/librustc_apfloat/ppc.rs @@ -27,7 +27,7 @@ pub type DoubleDouble = DoubleFloat; // DoubleDouble -> (Double, Double) -> // DoubleDouble's Fallback -> IEEE operations // -// FIXME: Implement all operations in DoubleDouble, and delete these +// FIXME: implement all operations in DoubleDouble, and delete these // semantics. // FIXME(eddyb) This shouldn't need to be `pub`, it's only used in bounds. pub struct FallbackS(F); diff --git a/src/librustc_apfloat/tests/ppc.rs b/src/librustc_apfloat/tests/ppc.rs index cfb453bd0617a..da185bffdb867 100644 --- a/src/librustc_apfloat/tests/ppc.rs +++ b/src/librustc_apfloat/tests/ppc.rs @@ -366,7 +366,7 @@ fn ppc_double_double_multiply() { #[test] fn ppc_double_double_divide() { - // FIXME: Only a sanity check for now. Add more edge cases when the + // FIXME: only a sanity check for now. Add more edge cases when the // double-double algorithm is implemented. let data = [ // 1 / 3 = 1/3 diff --git a/src/librustc_borrowck/borrowck/check_loans.rs b/src/librustc_borrowck/borrowck/check_loans.rs index 04085387c37f0..84ef699652ba6 100644 --- a/src/librustc_borrowck/borrowck/check_loans.rs +++ b/src/librustc_borrowck/borrowck/check_loans.rs @@ -25,7 +25,7 @@ use rustc_mir::util::borrowck_errors::{BorrowckErrors, Origin}; use std::rc::Rc; -// FIXME (#16118): These functions are intended to allow the borrow checker to +// FIXME(#16118): These functions are intended to allow the borrow checker to // be less precise in its handling of Box while still allowing moves out of a // Box. They should be removed when Unique is removed from LoanPath. diff --git a/src/librustc_borrowck/borrowck/gather_loans/mod.rs b/src/librustc_borrowck/borrowck/gather_loans/mod.rs index d681c771d2fa9..3163b418d2fb3 100644 --- a/src/librustc_borrowck/borrowck/gather_loans/mod.rs +++ b/src/librustc_borrowck/borrowck/gather_loans/mod.rs @@ -2,8 +2,8 @@ // Gathering loans // // The borrow check proceeds in two phases. In phase one, we gather the full -// set of loans that are required at any point. These are sorted according to -// their associated scopes. In phase two, checking loans, we will then make +// set of loans that are required at any point. These are sorted according to +// their associated scopes. In phase two, checking loans, we will then make // sure that all of these loans are honored. use borrowck::*; @@ -276,7 +276,7 @@ impl<'a, 'tcx> GatherLoanCtxt<'a, 'tcx> { lp); } None => { - // This can occur with e.g., `*foo() = 5`. In such + // This can occur with e.g., `*foo() = 5`. In such // cases, there is no need to check for conflicts // with moves etc, just ignore. } @@ -335,7 +335,7 @@ impl<'a, 'tcx> GatherLoanCtxt<'a, 'tcx> { // Create the loan record (if needed). let loan = match restr { RestrictionResult::Safe => { - // No restrictions---no loan record necessary + // No restrictions -- no loan record necessary return; } diff --git a/src/librustc_borrowck/borrowck/mod.rs b/src/librustc_borrowck/borrowck/mod.rs index 66303ab71b25f..6d351d3e9954d 100644 --- a/src/librustc_borrowck/borrowck/mod.rs +++ b/src/librustc_borrowck/borrowck/mod.rs @@ -367,7 +367,7 @@ impl<'tcx> LoanPath<'tcx> { } } -// FIXME (pnkfelix): See discussion here +// FIXME(pnkfelix): See discussion here // https://github.com/pnkfelix/rust/commit/ // b2b39e8700e37ad32b486b9a8409b50a8a53aa51#commitcomment-7892003 const DOWNCAST_PRINTED_OPERATOR: &'static str = " as "; diff --git a/src/librustc_borrowck/dataflow.rs b/src/librustc_borrowck/dataflow.rs index 56e25bd89c9ad..09d592406cf24 100644 --- a/src/librustc_borrowck/dataflow.rs +++ b/src/librustc_borrowck/dataflow.rs @@ -43,10 +43,10 @@ pub struct DataFlowContext<'a, 'tcx: 'a, O> { words_per_id: usize, // mapping from node to cfg node index - // FIXME (#6298): Shouldn't this go with CFG? + // FIXME(#6298): Shouldn't this go with CFG? local_id_to_index: FxHashMap>, - // Bit sets per cfg node. The following three fields (`gens`, `kills`, + // Bit sets per cfg node. The following three fields (`gens`, `kills`, // and `on_entry`) all have the same structure. For each id in // `id_range`, there is a range of words equal to `words_per_id`. // So, to access the bits for any given id, you take a slice of @@ -421,10 +421,10 @@ impl<'a, 'tcx, O:DataFlowOperator> DataFlowContext<'a, 'tcx, O> { if (word & bit) != 0 { // N.B., we round up the total number of bits // that we store in any given bit set so that - // it is an even multiple of usize::BITS. This + // it is an even multiple of usize::BITS. This // means that there may be some stray bits at // the end that do not correspond to any - // actual value. So before we callback, check + // actual value. So before we callback, check // whether the bit_index is greater than the // actual value the user specified and stop // iterating if so. diff --git a/src/librustc_codegen_llvm/abi.rs b/src/librustc_codegen_llvm/abi.rs index 258d839d32e82..489eef43076e2 100644 --- a/src/librustc_codegen_llvm/abi.rs +++ b/src/librustc_codegen_llvm/abi.rs @@ -207,7 +207,7 @@ impl ArgTypeExt<'ll, 'tcx> for ArgType<'tcx, Ty<'tcx>> { bx.store(val, cast_dst, self.layout.align.abi); } else { // The actual return type is a struct, but the ABI - // adaptation code has cast it into some scalar type. The + // adaptation code has cast it into some scalar type. The // code that follows is the only reliable way I have // found to do a transform like i64 -> {i32,i32}. // Basically we dump the data onto the stack then memcpy it. @@ -343,7 +343,7 @@ impl<'tcx> FnTypeExt<'tcx> for FnType<'tcx, Ty<'tcx>> { if arg_idx == Some(0) { let fat_pointer_ty = if layout.is_unsized() { // unsized `self` is passed as a pointer to `self` - // FIXME (mikeyhew) change this to use &own if it is ever added to the language + // FIXME(mikeyhew) change this to use &own if it is ever added to the language cx.tcx.mk_mut_ptr(layout.ty) } else { match layout.abi { diff --git a/src/librustc_codegen_llvm/asm.rs b/src/librustc_codegen_llvm/asm.rs index 5c1a8b070c993..3b21e7e945969 100644 --- a/src/librustc_codegen_llvm/asm.rs +++ b/src/librustc_codegen_llvm/asm.rs @@ -95,7 +95,7 @@ impl AsmBuilderMethods<'tcx> for Builder<'a, 'll, 'tcx> { } // Store mark in a metadata node so we can map LLVM errors - // back to source locations. See #17552. + // back to source locations. See #17552. unsafe { let key = "srcloc"; let kind = llvm::LLVMGetMDKindIDInContext(self.llcx, diff --git a/src/librustc_codegen_llvm/back/link.rs b/src/librustc_codegen_llvm/back/link.rs index fc744201a332c..10b3a1f294a43 100644 --- a/src/librustc_codegen_llvm/back/link.rs +++ b/src/librustc_codegen_llvm/back/link.rs @@ -1019,7 +1019,7 @@ fn link_args(cmd: &mut dyn Linker, cmd.pgo_gen(); } - // FIXME (#2397): At some point we want to rpath our guesses as to + // FIXME(#2397): At some point we want to rpath our guesses as to // where extern libraries might live, based on the // addl_lib_search_paths if sess.opts.cg.rpath { @@ -1237,7 +1237,7 @@ fn add_upstream_rust_crates(cmd: &mut dyn Linker, // rpath to the library as well (the rpath should be absolute, see // PR #41352 for details). // - // FIXME: Remove this logic into librustc_*san once Cargo supports it + // FIXME: remove this logic into librustc_*san once Cargo supports it. let rpath = cratepath.parent().unwrap(); let rpath = rpath.to_str().expect("non-utf8 component in path"); cmd.args(&["-Wl,-rpath".into(), "-Xlinker".into(), rpath.into()]); @@ -1462,7 +1462,7 @@ fn add_upstream_native_libraries(cmd: &mut dyn Linker, NativeLibraryKind::NativeFramework => cmd.link_framework(&name.as_str()), NativeLibraryKind::NativeStaticNobundle => { // Link "static-nobundle" native libs only if the crate they originate from - // is being linked statically to the current crate. If it's linked dynamically + // is being linked statically to the current crate. If it's linked dynamically // or is an rlib already included via some other dylib crate, the symbols from // native libs will have already been included in that dylib. if data[cnum.as_usize() - 1] == Linkage::Static { diff --git a/src/librustc_codegen_llvm/back/lto.rs b/src/librustc_codegen_llvm/back/lto.rs index 5d5f1ceceb88c..4e5d4e8785db2 100644 --- a/src/librustc_codegen_llvm/back/lto.rs +++ b/src/librustc_codegen_llvm/back/lto.rs @@ -389,7 +389,7 @@ fn thin_lto(cgcx: &CodegenContext, timeline.record(&name); } - // FIXME: All upstream crates are deserialized internally in the + // FIXME: all upstream crates are deserialized internally in the // function below to extract their summary and modules. Note that // unlike the loop above we *must* decode and/or read something // here as these are all just serialized files on disk. An diff --git a/src/librustc_codegen_llvm/back/rpath.rs b/src/librustc_codegen_llvm/back/rpath.rs index aeff23dec41bb..c247ca3c5bf36 100644 --- a/src/librustc_codegen_llvm/back/rpath.rs +++ b/src/librustc_codegen_llvm/back/rpath.rs @@ -107,7 +107,7 @@ fn get_rpath_relative_to_output(config: &mut RPathConfig, lib: &Path) -> String let output = fs::canonicalize(&output).unwrap_or(output); let relative = path_relative_from(&lib, &output).unwrap_or_else(|| panic!("couldn't create relative path from {:?} to {:?}", output, lib)); - // FIXME (#9639): This needs to handle non-utf8 paths + // FIXME(#9639): This needs to handle non-utf8 paths format!("{}/{}", prefix, relative.to_str().expect("non-utf8 component in path")) } @@ -157,7 +157,7 @@ fn path_relative_from(path: &Path, base: &Path) -> Option { fn get_install_prefix_rpath(config: &mut RPathConfig) -> String { let path = (config.get_install_prefix_lib_path)(); let path = env::current_dir().unwrap().join(&path); - // FIXME (#9639): This needs to handle non-utf8 paths + // FIXME(#9639): This needs to handle non-utf8 paths path.to_str().expect("non-utf8 component in rpath").to_owned() } diff --git a/src/librustc_codegen_llvm/back/write.rs b/src/librustc_codegen_llvm/back/write.rs index c0a4f5aa44047..c44c54a533f23 100644 --- a/src/librustc_codegen_llvm/back/write.rs +++ b/src/librustc_codegen_llvm/back/write.rs @@ -313,7 +313,7 @@ pub(crate) unsafe fn optimize(cgcx: &CodegenContext, let module_name = Some(&module_name[..]); if config.emit_no_opt_bc { - let out = cgcx.output_filenames.temp_path_ext("no-opt.bc", module_name); + let out = cgcx.output_filenames.temp_path_ext("noopt.bc", module_name); let out = path_to_c_string(&out); llvm::LLVMWriteBitcodeToFile(llmod, out.as_ptr()); } @@ -759,7 +759,7 @@ pub unsafe fn with_llvm_pmb(llmod: &llvm::Module, // Create a `__imp_ = &symbol` global for every public static `symbol`. // This is required to satisfy `dllimport` references to static data in .rlibs -// when using MSVC linker. We do this only for data, as linker can fix up +// when using MSVC linker. We do this only for data, as linker can fix up // code references on its own. // See #26591, #27438 fn create_msvc_imps( diff --git a/src/librustc_codegen_llvm/callee.rs b/src/librustc_codegen_llvm/callee.rs index 0d9d6aa5aa20f..3c194dca35106 100644 --- a/src/librustc_codegen_llvm/callee.rs +++ b/src/librustc_codegen_llvm/callee.rs @@ -47,8 +47,8 @@ pub fn get_fn( let llfn = if let Some(llfn) = cx.get_declared_value(&sym) { // This is subtle and surprising, but sometimes we have to bitcast - // the resulting fn pointer. The reason has to do with external - // functions. If you have two crates that both bind the same C + // the resulting fn pointer. The reason has to do with external + // functions. If you have two crates that both bind the same C // library, they may not use precisely the same types: for // example, they will probably each declare their own structs, // which are distinct types from LLVM's point of view (nominal diff --git a/src/librustc_codegen_llvm/consts.rs b/src/librustc_codegen_llvm/consts.rs index b7a9382c338bd..8023c03a7bdc2 100644 --- a/src/librustc_codegen_llvm/consts.rs +++ b/src/librustc_codegen_llvm/consts.rs @@ -82,7 +82,7 @@ fn set_global_alignment(cx: &CodegenCx<'ll, '_>, mut align: Align) { // The target may require greater alignment for globals than the type does. // Note: GCC and Clang also allow `__attribute__((aligned))` on variables, - // which can force it to be smaller. Rust doesn't support this yet. + // which can force it to be smaller. Rust doesn't support this yet. if let Some(min) = cx.sess().target.target.options.min_global_align { match Align::from_bits(min) { Ok(min) => align = align.max(min), @@ -127,7 +127,7 @@ fn check_and_apply_linkage( llvm::LLVMRustSetLinkage(g1, base::linkage_to_llvm(linkage)); // Declare an internal global `extern_with_linkage_foo` which - // is initialized with the address of `foo`. If `foo` is + // is initialized with the address of `foo`. If `foo` is // discarded during linking (for example, if `foo` has weak // linkage and there are no definitions), then // `extern_with_linkage_foo` will instead be initialized to diff --git a/src/librustc_codegen_llvm/context.rs b/src/librustc_codegen_llvm/context.rs index 3a5da29c68118..c2eba15cae42f 100644 --- a/src/librustc_codegen_llvm/context.rs +++ b/src/librustc_codegen_llvm/context.rs @@ -74,7 +74,7 @@ pub struct CodegenCx<'ll, 'tcx: 'll> { pub statics_to_rauw: RefCell>, /// Statics that will be placed in the llvm.used variable - /// See http://llvm.org/docs/LangRef.html#the-llvm-used-global-variable for details + /// See for details pub used_statics: RefCell>, pub lltypes: RefCell, Option), &'ll Type>>, diff --git a/src/librustc_codegen_llvm/debuginfo/doc.rs b/src/librustc_codegen_llvm/debuginfo/doc.rs index a4acc58eca953..4ee51cdd6bf4b 100644 --- a/src/librustc_codegen_llvm/debuginfo/doc.rs +++ b/src/librustc_codegen_llvm/debuginfo/doc.rs @@ -160,7 +160,7 @@ //! //! This algorithm also provides a stable ID for types that are defined in one //! crate but instantiated from metadata within another crate. We just have to -//! take care to always map crate and node IDs back to the original crate +//! take care to always map crate and node-IDs back to the original crate //! context. //! //! As a side-effect these unique type IDs also help to solve a problem arising @@ -170,7 +170,7 @@ //! with different concrete substitutions for `'a`, and thus there will be N //! `Ty` instances for the type `Struct<'a>` even though it is not generic //! otherwise. Unfortunately this means that we cannot use `ty::type_id()` as -//! cheap identifier for type metadata---we have done this in the past, but it +//! cheap identifier for type metadata -- we have done this in the past, but it //! led to unnecessary metadata duplication in the best case and LLVM //! assertions in the worst. However, the unique type ID as described above //! *can* be used as identifier. Since it is comparatively expensive to diff --git a/src/librustc_codegen_llvm/debuginfo/metadata.rs b/src/librustc_codegen_llvm/debuginfo/metadata.rs index 0fd04e9d20393..3d681051f7211 100644 --- a/src/librustc_codegen_llvm/debuginfo/metadata.rs +++ b/src/librustc_codegen_llvm/debuginfo/metadata.rs @@ -66,7 +66,7 @@ impl fmt::Debug for llvm::Metadata { } // From DWARF 5. -// See http://www.dwarfstd.org/ShowIssue.php?issue=140129.1 +// See . const DW_LANG_RUST: c_uint = 0x1c; #[allow(non_upper_case_globals)] const DW_ATE_boolean: c_uint = 0x02; @@ -1157,7 +1157,7 @@ fn prepare_union_metadata( // Although the earlier enum debug info output did not work properly // in all situations, it is better for the time being to continue to // sometimes emit the old style rather than emit something completely -// useless when rust is compiled against LLVM 6 or older. This +// useless when rust is compiled against LLVM 6 or older. This // function decides which representation will be emitted. fn use_enum_fallback(cx: &CodegenCx) -> bool { // On MSVC we have to use the fallback mode, because LLVM doesn't @@ -1514,7 +1514,7 @@ fn prepare_enum_metadata( let enum_name = compute_debuginfo_type_name(cx, enum_type, false); let containing_scope = get_namespace_for_item(cx, enum_def_id); - // FIXME: This should emit actual file metadata for the enum, but we + // FIXME: this should emit actual file metadata for the enum, but we // currently can't get the necessary information when it comes to types // imported from other crates. Formerly we violated the ODR when performing // LTO because we emitted debuginfo for the same type with varying file @@ -2032,7 +2032,7 @@ pub fn create_vtable_metadata( let name = const_cstr!("vtable"); - // Create a new one each time. We don't want metadata caching + // Create a new one each time. We don't want metadata caching // here, because each vtable will refer to a unique containing // type. let vtable_type = llvm::LLVMRustDIBuilderCreateStructType( diff --git a/src/librustc_codegen_llvm/debuginfo/mod.rs b/src/librustc_codegen_llvm/debuginfo/mod.rs index 2eab626ae8e6e..2c4a6bcfee7de 100644 --- a/src/librustc_codegen_llvm/debuginfo/mod.rs +++ b/src/librustc_codegen_llvm/debuginfo/mod.rs @@ -467,7 +467,7 @@ impl DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> { ) -> &'ll DIScope { // First, let's see if this is a method within an inherent impl. Because // if yes, we want to make the result subroutine DIE a child of the - // subroutine's self-type. + // subroutine's self type. let self_type = cx.tcx.impl_of_method(instance.def_id()).and_then(|impl_def_id| { // If the method does *not* belong to a trait, proceed if cx.tcx.trait_id_of_impl(impl_def_id).is_none() { diff --git a/src/librustc_codegen_llvm/debuginfo/source_loc.rs b/src/librustc_codegen_llvm/debuginfo/source_loc.rs index ccf56c11e735d..f989fcc8864a2 100644 --- a/src/librustc_codegen_llvm/debuginfo/source_loc.rs +++ b/src/librustc_codegen_llvm/debuginfo/source_loc.rs @@ -65,7 +65,7 @@ pub fn set_debug_location( KnownLocation { scope, line, col } => { // For MSVC, set the column number to zero. // Otherwise, emit it. This mimics clang behaviour. - // See discussion in https://github.com/rust-lang/rust/issues/42921 + // See discussion in issue #42921. let col_used = if bx.sess().target.target.options.is_like_msvc { UNKNOWN_COLUMN_NUMBER } else { diff --git a/src/librustc_codegen_llvm/intrinsic.rs b/src/librustc_codegen_llvm/intrinsic.rs index f5680b295477a..31d0db926b6a4 100644 --- a/src/librustc_codegen_llvm/intrinsic.rs +++ b/src/librustc_codegen_llvm/intrinsic.rs @@ -244,7 +244,7 @@ impl IntrinsicCallMethods<'tcx> for Builder<'a, 'll, 'tcx> { } return; } - // Effectively no-ops + // Effectively noops "uninit" | "forget" => { return; } @@ -368,7 +368,7 @@ impl IntrinsicCallMethods<'tcx> for Builder<'a, 'll, 'tcx> { ), "bswap" => { if width == 8 { - args[0].immediate() // byte swap a u8/i8 is just a no-op + args[0].immediate() // byte swap a u8/i8 is just a noop } else { self.call( self.get_intrinsic( @@ -1034,7 +1034,7 @@ fn codegen_gnu_try( // Type indicator for the exception being thrown. // // The first value in this tuple is a pointer to the exception object - // being thrown. The second value is a "selector" indicating which of + // being thrown. The second value is a "selector" indicating which of // the landing pad clauses the exception's type had been matched to. // rust_try ignores the selector. let lpad_ty = bx.type_struct(&[bx.type_i8p(), bx.type_i32()], false); diff --git a/src/librustc_codegen_llvm/lib.rs b/src/librustc_codegen_llvm/lib.rs index 3205348fde33c..a57a304022b3c 100644 --- a/src/librustc_codegen_llvm/lib.rs +++ b/src/librustc_codegen_llvm/lib.rs @@ -108,7 +108,7 @@ mod debuginfo; mod declare; mod intrinsic; -// The following is a work around that replaces `pub mod llvm;` and that fixes issue 53912. +// The following is a work around that replaces `pub mod llvm;` and that fixes issue #53912. #[path = "llvm/mod.rs"] mod llvm_; pub mod llvm { pub use super::llvm_::*; } mod llvm_util; diff --git a/src/librustc_codegen_llvm/llvm/ffi.rs b/src/librustc_codegen_llvm/llvm/ffi.rs index 11e34f600c286..274855c81d0ad 100644 --- a/src/librustc_codegen_llvm/llvm/ffi.rs +++ b/src/librustc_codegen_llvm/llvm/ffi.rs @@ -1302,7 +1302,7 @@ extern "C" { pub fn LLVMGetSections(ObjFile: &'a ObjectFile) -> &'a mut SectionIterator<'a>; /// Destroys a section iterator. pub fn LLVMDisposeSectionIterator(SI: &'a mut SectionIterator<'a>); - /// Returns true if the section iterator is at the end of the section + /// Returns whether the section iterator is at the end of the section /// list: pub fn LLVMIsSectionIteratorAtEnd(ObjFile: &'a ObjectFile, SI: &SectionIterator<'a>) -> Bool; /// Moves the section iterator to point to the next section. diff --git a/src/librustc_codegen_llvm/type_of.rs b/src/librustc_codegen_llvm/type_of.rs index 97128c2d2a2ce..3fefc8fcfcb70 100644 --- a/src/librustc_codegen_llvm/type_of.rs +++ b/src/librustc_codegen_llvm/type_of.rs @@ -48,7 +48,7 @@ fn uncached_llvm_type<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>, ty::Closure(..) | ty::Generator(..) | ty::Adt(..) | - // FIXME(eddyb) producing readable type names for trait objects can result + // FIXME(eddyb): producing readable type names for trait objects can result // in problematically distinct types due to HRTB and subtyping (see #47638). // ty::Dynamic(..) | ty::Foreign(..) | @@ -355,10 +355,10 @@ impl<'tcx> LayoutLlvmExt<'tcx> for TyLayout<'tcx> { let scalar = [a, b][index]; // Make sure to return the same type `immediate_llvm_type` would when - // dealing with an immediate pair. This means that `(bool, bool)` is + // dealing with an immediate pair. This means that `(bool, bool)` is // effectively represented as `{i8, i8}` in memory and two `i1`s as an // immediate, just like `bool` is typically `i8` in memory and only `i1` - // when immediate. We need to load/store `bool` as `i8` to avoid + // when immediate. We need to load/store `bool` as `i8` to avoid // crippling LLVM optimizations or triggering other LLVM bugs with `i1`. if immediate && scalar.is_bool() { return cx.type_i1(); diff --git a/src/librustc_codegen_ssa/back/link.rs b/src/librustc_codegen_ssa/back/link.rs index d03bb0a3d73a4..1b2666ca7a66f 100644 --- a/src/librustc_codegen_ssa/back/link.rs +++ b/src/librustc_codegen_ssa/back/link.rs @@ -32,12 +32,12 @@ pub fn get_linker(sess: &Session, linker: &Path, flavor: LinkerFlavor) -> (PathB // If our linker looks like a batch script on Windows then to execute this // we'll need to spawn `cmd` explicitly. This is primarily done to handle - // emscripten where the linker is `emcc.bat` and needs to be spawned as + // Emscripten where the linker is `emcc.bat` and needs to be spawned as // `cmd /c emcc.bat ...`. // // This worked historically but is needed manually since #42436 (regression // was tagged as #42791) and some more info can be found on #44443 for - // emscripten itself. + // Emscripten itself. let mut cmd = match linker.to_str() { Some(linker) if cfg!(windows) && linker.ends_with(".bat") => Command::bat_script(linker), _ => match flavor { diff --git a/src/librustc_codegen_ssa/back/linker.rs b/src/librustc_codegen_ssa/back/linker.rs index 270387572f137..35fecf5dfefcd 100644 --- a/src/librustc_codegen_ssa/back/linker.rs +++ b/src/librustc_codegen_ssa/back/linker.rs @@ -278,7 +278,7 @@ impl<'a> Linker for GccLinker<'a> { // link times negatively. // // -dead_strip can't be part of the pre_link_args because it's also used - // for partial linking when using multiple codegen units (-r). So we + // for partial linking when using multiple codegen units (-r). So we // insert it here. if self.sess.target.target.options.is_like_osx { self.linker_arg("-dead_strip"); @@ -599,7 +599,7 @@ impl<'a> Linker for MsvcLinker<'a> { let natvis_dir_path = self.sess.sysroot.join("lib\\rustlib\\etc"); if let Ok(natvis_dir) = fs::read_dir(&natvis_dir_path) { // LLVM 5.0.0's lld-link frontend doesn't yet recognize, and chokes - // on, the /NATVIS:... flags. LLVM 6 (or earlier) should at worst ignore + // on, the /NATVIS:... flags. LLVM 6 (or earlier) should at worst ignore // them, eventually mooting this workaround, per this landed patch: // https://github.com/llvm-mirror/lld/commit/27b9c4285364d8d76bb43839daa100 if let Some(ref linker_path) = self.sess.opts.cg.linker { @@ -781,11 +781,11 @@ impl<'a> Linker for EmLinker<'a> { } fn gc_sections(&mut self, _keep_metadata: bool) { - // noop + // No-op. } fn optimize(&mut self) { - // Emscripten performs own optimizations + // Emscripten performs own optimizations. self.cmd.arg(match self.sess.opts.optimize { OptLevel::No => "-O0", OptLevel::Less => "-O1", @@ -794,16 +794,16 @@ impl<'a> Linker for EmLinker<'a> { OptLevel::Size => "-Os", OptLevel::SizeMin => "-Oz" }); - // Unusable until https://github.com/rust-lang/rust/issues/38454 is resolved + // Unusable until issue #38454 is resolved. self.cmd.args(&["--memory-init-file", "0"]); } fn pgo_gen(&mut self) { - // noop, but maybe we need something like the gnu linker? + // No-op, but maybe we need something like the GNU linker? } fn debuginfo(&mut self) { - // Preserve names or generate source maps depending on debug info + // Preserve names or generate source maps depending on debug info. self.cmd.arg(match self.sess.opts.debuginfo { DebugInfo::None => "-g0", DebugInfo::Limited => "-g3", @@ -820,7 +820,7 @@ impl<'a> Linker for EmLinker<'a> { } fn build_static_executable(&mut self) { - // noop + // No-op. } fn export_symbols(&mut self, _tmpdir: &Path, crate_type: CrateType) { @@ -1009,7 +1009,7 @@ impl<'a> Linker for WasmLd<'a> { // corrupting static data. self.cmd.arg("--stack-first"); - // FIXME we probably shouldn't pass this but instead pass an explicit + // FIXME: we probably shouldn't pass this but instead pass an explicit // whitelist of symbols we'll allow to be undefined. Unfortunately // though we can't handle symbols like `log10` that LLVM injects at a // super late date without actually parsing object files. For now let's diff --git a/src/librustc_codegen_ssa/back/write.rs b/src/librustc_codegen_ssa/back/write.rs index fb3e7ea696363..6a19f8e3cc14a 100644 --- a/src/librustc_codegen_ssa/back/write.rs +++ b/src/librustc_codegen_ssa/back/write.rs @@ -66,7 +66,7 @@ pub struct ModuleConfig { pub emit_ir: bool, pub emit_asm: bool, pub emit_obj: bool, - // Miscellaneous flags. These are mostly copied from command-line + // Miscellaneous flags. These are mostly copied from command-line // options. pub verify_llvm_ir: bool, pub no_prepopulate_passes: bool, @@ -78,7 +78,7 @@ pub struct ModuleConfig { pub inline_threshold: Option, // Instead of creating an object file by doing LLVM codegen, just // make the object file bitcode. Provides easy compatibility with - // emscripten's ecc compiler, when used as the linker. + // Emscripten's ecc compiler, when used as the linker. pub obj_is_bitcode: bool, pub no_integrated_as: bool, pub embed_bitcode: bool, @@ -497,7 +497,7 @@ fn produce_final_output_artifacts(sess: &Session, let copy_if_one_unit = |output_type: OutputType, keep_numbered: bool| { if compiled_modules.modules.len() == 1 { - // 1) Only one codegen unit. In this case it's no difficulty + // 1) Only one codegen unit. In this case it's no difficulty // to copy `foo.0.x` to `foo.x`. let module_name = Some(&compiled_modules.modules[0].name[..]); let path = crate_output.temp_path(output_type, module_name); @@ -516,17 +516,17 @@ fn produce_final_output_artifacts(sess: &Session, .to_owned(); if crate_output.outputs.contains_key(&output_type) { - // 2) Multiple codegen units, with `--emit foo=some_name`. We have + // 2) Multiple codegen units, with `--emit foo=some_name`. We have // no good solution for this case, so warn the user. sess.warn(&format!("ignoring emit path because multiple .{} files \ were produced", ext)); } else if crate_output.single_output_file.is_some() { - // 3) Multiple codegen units, with `-o some_name`. We have + // 3) Multiple codegen units, with `-o some_name`. We have // no good solution for this case, so warn the user. sess.warn(&format!("ignoring -o because multiple .{} files \ were produced", ext)); } else { - // 4) Multiple codegen units, but no explicit name. We + // 4) Multiple codegen units, but no explicit name. We // just leave the `foo.0.x` files in place. // (We don't have to do any work in this case.) } @@ -540,7 +540,7 @@ fn produce_final_output_artifacts(sess: &Session, match *output_type { OutputType::Bitcode => { user_wants_bitcode = true; - // Copy to .bc, but always keep the .0.bc. There is a later + // Copy to .bc, but always keep the .0.bc. There is a later // check to figure out if we should delete .0.bc files, or keep // them for making an rlib. copy_if_one_unit(OutputType::Bitcode, true); @@ -575,7 +575,7 @@ fn produce_final_output_artifacts(sess: &Session, // `-C save-temps` or `--emit=` flags). if !sess.opts.cg.save_temps { - // Remove the temporary .#module-name#.o objects. If the user didn't + // Remove the temporary .#module-name#.o objects. If the user didn't // explicitly request bitcode (with --emit=bc), and the bitcode is not // needed for building an rlib, then we must remove .#module-name#.bc as // well. diff --git a/src/librustc_codegen_ssa/base.rs b/src/librustc_codegen_ssa/base.rs index b88ec075653ba..87c68b5294a10 100644 --- a/src/librustc_codegen_ssa/base.rs +++ b/src/librustc_codegen_ssa/base.rs @@ -336,7 +336,7 @@ fn cast_shift_rhs<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( if lhs_sz < rhs_sz { bx.trunc(rhs, lhs_llty) } else if lhs_sz > rhs_sz { - // FIXME (#1877: If in the future shifting by negative + // FIXME(#1877: If in the future shifting by negative // values is no longer undefined then this is wrong. bx.zext(rhs, lhs_llty) } else { @@ -486,7 +486,7 @@ pub fn maybe_create_entry_wrapper<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( ); if cx.get_defined_value("main").is_some() { - // FIXME: We should be smart and show a better diagnostic here. + // FIXME: we should be smart and show a better diagnostic here. cx.sess().struct_span_err(sp, "entry symbol `main` defined multiple times") .help("did you use #[no_mangle] on `fn main`? Use #[start] instead") .emit(); diff --git a/src/librustc_codegen_ssa/common.rs b/src/librustc_codegen_ssa/common.rs index cfb5d24fc12ef..ec340347cf234 100644 --- a/src/librustc_codegen_ssa/common.rs +++ b/src/librustc_codegen_ssa/common.rs @@ -118,7 +118,7 @@ pub enum TypeKind { // ways: (1) it's not a query and (2) CGU are output nodes, so their // Fingerprints are not actually needed. It remains to be clarified // how exactly this case will be handled in the red/green system but -// for now we content ourselves with providing a no-op HashStable +// for now we content ourselves with providing a noop HashStable // implementation for CGUs. mod temp_stable_hash_impls { use rustc_data_structures::stable_hasher::{StableHasherResult, StableHasher, diff --git a/src/librustc_codegen_ssa/glue.rs b/src/librustc_codegen_ssa/glue.rs index ed63e1e62ee5f..d9ddc3a2c81dc 100644 --- a/src/librustc_codegen_ssa/glue.rs +++ b/src/librustc_codegen_ssa/glue.rs @@ -55,7 +55,7 @@ pub fn size_and_align_of_dst<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( let field_ty = layout.field(bx, i).ty; let (unsized_size, mut unsized_align) = size_and_align_of_dst(bx, field_ty, info); - // FIXME (#26403, #27023): We should be adding padding + // FIXME(#26403, #27023): We should be adding padding // to `sized_size` (to accommodate the `unsized_align` // required of the unsized field that follows) before // summing it with `sized_size`. (Note that since #26403 diff --git a/src/librustc_codegen_ssa/mir/mod.rs b/src/librustc_codegen_ssa/mir/mod.rs index 85a663dacdcc5..506dab25041d3 100644 --- a/src/librustc_codegen_ssa/mir/mod.rs +++ b/src/librustc_codegen_ssa/mir/mod.rs @@ -143,9 +143,9 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { } } - // DILocations inherit source file name from the parent DIScope. Due to macro expansions + // DILocations inherit source file name from the parent DIScope. Due to macro expansions // it may so happen that the current span belongs to a different file than the DIScope - // corresponding to span's containing source scope. If so, we need to create a DIScope + // corresponding to span's containing source scope. If so, we need to create a DIScope // "extension" into that file. fn scope_metadata_for_loc(&self, scope_id: mir::SourceScope, pos: BytePos) -> Option { diff --git a/src/librustc_codegen_ssa/mir/rvalue.rs b/src/librustc_codegen_ssa/mir/rvalue.rs index 9ca5414fa717e..2f1e24c7a38ca 100644 --- a/src/librustc_codegen_ssa/mir/rvalue.rs +++ b/src/librustc_codegen_ssa/mir/rvalue.rs @@ -227,7 +227,7 @@ impl<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { } } mir::CastKind::UnsafeFnPointer => { - // this is a no-op at the LLVM level + // this is a noop at the LLVM level operand.val } mir::CastKind::Unsize => { diff --git a/src/librustc_codegen_utils/codegen_backend.rs b/src/librustc_codegen_utils/codegen_backend.rs index 09adaf848be1b..967a137f16f65 100644 --- a/src/librustc_codegen_utils/codegen_backend.rs +++ b/src/librustc_codegen_utils/codegen_backend.rs @@ -142,7 +142,7 @@ impl CodegenBackend for MetadataOnlyCodegenBackend { collector::MonoItemCollectionMode::Eager ).0.iter() ); - // FIXME: Fix this + // FIXME: fix this. // ::rustc::middle::dependency_format::calculate(tcx); let _ = tcx.link_args(LOCAL_CRATE); let _ = tcx.native_libraries(LOCAL_CRATE); diff --git a/src/librustc_codegen_utils/link.rs b/src/librustc_codegen_utils/link.rs index 09e22bd2c91a9..f4916c595422f 100644 --- a/src/librustc_codegen_utils/link.rs +++ b/src/librustc_codegen_utils/link.rs @@ -20,9 +20,9 @@ pub fn out_filename(sess: &Session, out_filename } -// Make sure files are writeable. Mac, FreeBSD, and Windows system linkers +// Make sure files are writeable. Mac, FreeBSD, and Windows system linkers // check this already -- however, the Linux linker will happily overwrite a -// read-only file. We should be consistent. +// read-only file. We should be consistent. pub fn check_file_is_writeable(file: &Path, sess: &Session) { if !is_writeable(file) { sess.fatal(&format!("output file {} is not writeable -- check its \ diff --git a/src/librustc_codegen_utils/symbol_names.rs b/src/librustc_codegen_utils/symbol_names.rs index 5a5d1b20b2151..8ee216cdfeca3 100644 --- a/src/librustc_codegen_utils/symbol_names.rs +++ b/src/librustc_codegen_utils/symbol_names.rs @@ -301,7 +301,7 @@ fn compute_symbol_name<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, instance: Instance // *somewhere* ty_def_id.index = key.parent.unwrap_or_else(|| { bug!( - "finding type for {:?}, encountered def-id {:?} with no \ + "finding type for {:?}, encountered def-ID {:?} with no \ parent", def_id, ty_def_id diff --git a/src/librustc_data_structures/bit_set.rs b/src/librustc_data_structures/bit_set.rs index 8adfe3749af8e..e46e5e07221f2 100644 --- a/src/librustc_data_structures/bit_set.rs +++ b/src/librustc_data_structures/bit_set.rs @@ -106,7 +106,7 @@ impl BitSet { self.words.iter().all(|a| *a == 0) } - /// Insert `elem`. Returns true if the set has changed. + /// Insert `elem`. Returns whether the set has changed. #[inline] pub fn insert(&mut self, elem: T) -> bool { assert!(elem.index() < self.domain_size); @@ -126,7 +126,7 @@ impl BitSet { self.clear_excess_bits(); } - /// Returns true if the set has changed. + /// Returns whether the set has changed. #[inline] pub fn remove(&mut self, elem: T) -> bool { assert!(elem.index() < self.domain_size); @@ -611,7 +611,7 @@ impl GrowableBitSet { GrowableBitSet { bit_set: BitSet::new_empty(bits) } } - /// Returns true if the set has changed. + /// Returns whether the set has changed. #[inline] pub fn insert(&mut self, elem: T) -> bool { self.ensure(elem.index() + 1); @@ -668,7 +668,7 @@ impl BitMatrix { /// Sets the cell at `(row, column)` to true. Put another way, insert /// `column` to the bitset for `row`. /// - /// Returns true if this changed the matrix, and false otherwise. + /// Returns whether this changed the matrix. pub fn insert(&mut self, row: R, column: C) -> bool { assert!(row.index() < self.num_rows && column.index() < self.num_columns); let (start, _) = self.range(row); @@ -793,7 +793,7 @@ impl SparseBitMatrix { /// Sets the cell at `(row, column)` to true. Put another way, insert /// `column` to the bitset for `row`. /// - /// Returns true if this changed the matrix, and false otherwise. + /// Returns whether this changed the matrix. pub fn insert(&mut self, row: R, column: C) -> bool { self.ensure_row(row).insert(column) } diff --git a/src/librustc_data_structures/graph/dominators/mod.rs b/src/librustc_data_structures/graph/dominators/mod.rs index 536efffbb22f4..c930abd655471 100644 --- a/src/librustc_data_structures/graph/dominators/mod.rs +++ b/src/librustc_data_structures/graph/dominators/mod.rs @@ -126,7 +126,7 @@ impl Dominators { } pub fn is_dominated_by(&self, node: Node, dom: Node) -> bool { - // FIXME -- could be optimized by using post-order-rank + // FIXME: could be optimized by using post-order-rank self.dominators(node).any(|n| n == dom) } diff --git a/src/librustc_data_structures/graph/scc/test.rs b/src/librustc_data_structures/graph/scc/test.rs index e23cb1348b015..8b2df41a2f767 100644 --- a/src/librustc_data_structures/graph/scc/test.rs +++ b/src/librustc_data_structures/graph/scc/test.rs @@ -103,7 +103,7 @@ fn test_find_state_2() { // 0 -> 1 -> 2 -> 1 // // and at this point detect a cycle. The state of 2 will thus be - // `InCycleWith { 1 }`. We will then visit the 1 -> 3 edge, which + // `InCycleWith { 1 }`. We will then visit the 1 -> 3 edge, which // will attempt to visit 0 as well, thus going to the state // `InCycleWith { 0 }`. Finally, node 1 will complete; the lowest // depth of any successor was 3 which had depth 0, and thus it diff --git a/src/librustc_data_structures/indexed_vec.rs b/src/librustc_data_structures/indexed_vec.rs index 8d8fbe588a021..8794d056d4559 100644 --- a/src/librustc_data_structures/indexed_vec.rs +++ b/src/librustc_data_structures/indexed_vec.rs @@ -150,13 +150,13 @@ macro_rules! newtype_index { self.as_usize() } - /// Extract value of this index as a usize. + /// Extract value of this index as a `usize`. #[inline] $v fn as_u32(self) -> u32 { self.private } - /// Extract value of this index as a u32. + /// Extract value of this index as a `u32`. #[inline] $v fn as_usize(self) -> usize { self.as_u32() as usize @@ -601,7 +601,7 @@ impl IndexVec { #[inline] pub fn drain<'a, R: RangeBounds>( - &'a mut self, range: R) -> impl Iterator + 'a { + &'a mut self, range: R) -> impl Iterator + 'a { self.raw.drain(range) } @@ -731,7 +731,7 @@ impl Extend for IndexVec { impl FromIterator for IndexVec { #[inline] - fn from_iter(iter: J) -> Self where J: IntoIterator { + fn from_iter(iter: J) -> Self where J: IntoIterator { IndexVec { raw: FromIterator::from_iter(iter), _marker: PhantomData } } } diff --git a/src/librustc_data_structures/obligation_forest/mod.rs b/src/librustc_data_structures/obligation_forest/mod.rs index 59497f0df18e9..bd1b4b189d5b8 100644 --- a/src/librustc_data_structures/obligation_forest/mod.rs +++ b/src/librustc_data_structures/obligation_forest/mod.rs @@ -46,7 +46,7 @@ pub trait ObligationProcessor { fn process_backedge<'c, I>(&mut self, cycle: I, _marker: PhantomData<&'c Self::Obligation>) - where I: Clone + Iterator; + where I: Clone + Iterator; } /// The result type used by `process_obligation`. @@ -88,7 +88,7 @@ pub struct ObligationForest { obligation_tree_id_generator: ObligationTreeIdGenerator, - /// Per tree error cache. This is used to deduplicate errors, + /// Per tree error cache. This is used to deduplicate errors, /// which is necessary to avoid trait resolution overflow in /// some cases. /// @@ -199,7 +199,7 @@ impl ObligationForest { self.nodes.len() } - /// Registers an obligation + /// Registers an obligation. /// /// This CAN be done in a snapshot pub fn register_obligation(&mut self, obligation: O) { @@ -207,7 +207,7 @@ impl ObligationForest { let _ = self.register_obligation_at(obligation, None); } - // returns Err(()) if we already know this obligation failed. + // Returns `Err(())` if we already know this obligation failed. fn register_obligation_at(&mut self, obligation: O, parent: Option) -> Result<(), ()> { @@ -308,10 +308,10 @@ impl ObligationForest { /// Perform a pass through the obligation list. This must /// be called in a loop until `outcome.stalled` is false. /// - /// This CANNOT be unrolled (presently, at least). + /// This _cannot_ be unrolled (presently, at least). pub fn process_obligations

(&mut self, processor: &mut P, do_completed: DoCompleted) -> Outcome - where P: ObligationProcessor + where P: ObligationProcessor { debug!("process_obligations(len={})", self.nodes.len()); @@ -386,12 +386,12 @@ impl ObligationForest { } } - /// Mark all NodeState::Success nodes as NodeState::Done and + /// Mark all `NodeState::Success` nodes as `NodeState::Done` and /// report all cycles between them. This should be called /// after `mark_as_waiting` marks all nodes with pending /// subobligations as NodeState::Waiting. fn process_cycles

(&mut self, processor: &mut P) - where P: ObligationProcessor + where P: ObligationProcessor { let mut stack = self.scratch.take().unwrap(); debug_assert!(stack.is_empty()); @@ -401,7 +401,7 @@ impl ObligationForest { for index in 0..self.nodes.len() { // For rustc-benchmarks/inflate-0.1.0 this state test is extremely // hot and the state is almost always `Pending` or `Waiting`. It's - // a win to handle the no-op cases immediately to avoid the cost of + // a win to handle the noop cases immediately to avoid the cost of // the function call. let state = self.nodes[index].state.get(); match state { @@ -418,7 +418,7 @@ impl ObligationForest { fn find_cycles_from_node

(&self, stack: &mut Vec, processor: &mut P, index: usize) - where P: ObligationProcessor + where P: ObligationProcessor { let node = &self.nodes[index]; let state = node.state.get(); @@ -491,7 +491,7 @@ impl ObligationForest { } } - /// Marks all nodes that depend on a pending node as NodeState::Waiting. + /// Marks all nodes that depend on a pending node as `NodeState::Waiting`. fn mark_as_waiting(&self) { for node in &self.nodes { if node.state.get() == NodeState::Waiting { @@ -607,7 +607,7 @@ impl ObligationForest { if let Some(index) = node.parent { let new_index = node_rewrites[index.get()]; if new_index >= nodes_len { - // parent dead due to error + // Parent is dead due to error. node.parent = None; } else { node.parent = Some(NodeIndex::new(new_index)); @@ -656,7 +656,7 @@ impl Node { } } -// I need a Clone closure +// I need a `Clone` closure. #[derive(Clone)] struct GetObligation<'a, O: 'a>(&'a [Node]); diff --git a/src/librustc_data_structures/obligation_forest/test.rs b/src/librustc_data_structures/obligation_forest/test.rs index 27d4bf4959e63..fdf7771107927 100644 --- a/src/librustc_data_structures/obligation_forest/test.rs +++ b/src/librustc_data_structures/obligation_forest/test.rs @@ -49,7 +49,7 @@ impl ObligationProcessor for ClosureObligationProcessor(&mut self, _cycle: I, _marker: PhantomData<&'c Self::Obligation>) - where I: Clone + Iterator + where I: Clone + Iterator { } } diff --git a/src/librustc_data_structures/owning_ref/mod.rs b/src/librustc_data_structures/owning_ref/mod.rs index 0b126e5c572ed..35e8ee2144dfb 100644 --- a/src/librustc_data_structures/owning_ref/mod.rs +++ b/src/librustc_data_structures/owning_ref/mod.rs @@ -509,13 +509,13 @@ impl OwningRef { // TODO: wrap_owner - // FIXME: Naming convention? + // FIXME: naming convention? /// A getter for the underlying owner. pub fn owner(&self) -> &O { &self.owner } - // FIXME: Naming convention? + // FIXME: naming convention? /// Discards the reference and retrieves the owner. pub fn into_inner(self) -> O { self.owner @@ -755,13 +755,13 @@ impl OwningRefMut { // TODO: wrap_owner - // FIXME: Naming convention? + // FIXME: naming convention? /// A getter for the underlying owner. pub fn owner(&self) -> &O { &self.owner } - // FIXME: Naming convention? + // FIXME: naming convention? /// Discards the reference and retrieves the owner. pub fn into_inner(self) -> O { self.owner @@ -996,7 +996,7 @@ impl From> for OwningRef } } -// ^ FIXME: Is a Into impl for calling into_inner() possible as well? +// ^ FIXME: is a Into impl for calling into_inner() possible as well? impl Debug for OwningRef where O: Debug, diff --git a/src/librustc_data_structures/sync.rs b/src/librustc_data_structures/sync.rs index d935eb7bdab74..b44b2d11a8b9d 100644 --- a/src/librustc_data_structures/sync.rs +++ b/src/librustc_data_structures/sync.rs @@ -153,7 +153,7 @@ cfg_if! { } } - // FIXME: Probably a bad idea (in the threaded case) + // FIXME: probably a bad idea (in the threaded case) impl Clone for MTLock { #[inline] fn clone(&self) -> Self { @@ -595,7 +595,7 @@ impl Default for Lock { } } -// FIXME: Probably a bad idea +// FIXME: probably a bad idea impl Clone for Lock { #[inline] fn clone(&self) -> Self { @@ -687,7 +687,7 @@ impl RwLock { } } -// FIXME: Probably a bad idea +// FIXME: probably a bad idea impl Clone for RwLock { #[inline] fn clone(&self) -> Self { diff --git a/src/librustc_data_structures/transitive_relation.rs b/src/librustc_data_structures/transitive_relation.rs index 9d675ed3096e0..ddaa58078fe5c 100644 --- a/src/librustc_data_structures/transitive_relation.rs +++ b/src/librustc_data_structures/transitive_relation.rs @@ -122,7 +122,7 @@ impl TransitiveRelation { /// Thinking of `x R y` as an edge `x -> y` in a graph, this /// returns all things reachable from `a`. /// - /// Really this probably ought to be `impl Iterator`, but + /// Really this probably ought to be `impl Iterator`, but /// I'm too lazy to make that work, and -- given the caching /// strategy -- it'd be a touch tricky anyhow. pub fn reachable_from(&self, a: &T) -> Vec<&T> { @@ -231,7 +231,7 @@ impl TransitiveRelation { // values. So here is what we do: // // 1. Find the vector `[X | a < X && b < X]` of all values - // `X` where `a < X` and `b < X`. In terms of the + // `X` where `a < X` and `b < X`. In terms of the // graph, this means all values reachable from both `a` // and `b`. Note that this vector is also a set, but we // use the term vector because the order matters diff --git a/src/librustc_driver/driver.rs b/src/librustc_driver/driver.rs index 9b232edc11d4a..7c5203e078a53 100644 --- a/src/librustc_driver/driver.rs +++ b/src/librustc_driver/driver.rs @@ -393,7 +393,7 @@ pub struct CompileController<'a> { pub after_analysis: PhaseController<'a>, pub compilation_done: PhaseController<'a>, - // FIXME we probably want to group the below options together and offer a + // FIXME: we probably want to group the below options together and offer a // better API, rather than this ad-hoc approach. pub make_glob_map: MakeGlobMap, // Whether the compiler should keep the ast beyond parsing. @@ -1184,7 +1184,7 @@ pub fn default_provide_extern(providers: &mut ty::query::Providers) { cstore::provide_extern(providers); } -/// Run the resolution, typechecking, region checking and other +/// Run the resolution, typec-hecking, region checking and other /// miscellaneous analysis passes on the crate. Return various /// structures carrying the results of the analysis. pub fn phase_3_run_analysis_passes<'tcx, F, R>( diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs index e9f309373008b..cd61a6c7af0d5 100644 --- a/src/librustc_driver/lib.rs +++ b/src/librustc_driver/lib.rs @@ -694,7 +694,7 @@ pub trait CompilerCalls<'a> { #[derive(Copy, Clone)] pub struct RustcDefaultCalls; -// FIXME remove these and use winapi 0.3 instead +// FIXME: remove these and use winapi 0.3 instead // Duplicates: bootstrap/compile.rs, librustc_errors/emitter.rs #[cfg(unix)] fn stdout_isatty() -> bool { @@ -1450,7 +1450,7 @@ fn parse_crate_attrs<'a>(sess: &'a Session, input: &Input) -> PResult<'a, Vec(name: String, f: F) -> Result pprust::PpAnn for HygieneAnnotation<'a> { match node { pprust::AnnNode::Ident(&ast::Ident { name, span }) => { s.s.space()?; - // FIXME #16420: this doesn't display the connections + // FIXME(#16420): this doesn't display the connections // between syntax contexts s.synth_comment(format!("{}{:?}", name.as_u32(), span.ctxt())) } @@ -629,7 +629,7 @@ impl UserIdentifiedItem { // Note: Also used by librustdoc, see PR #43348. Consider moving this struct elsewhere. // -// FIXME: Currently the `everybody_loops` transformation is not applied to: +// FIXME: currently the `everybody_loops` transformation is not applied to: // * `const fn`, due to issue #43636 that `loop` is not supported for const evaluation. We are // waiting for miri to fix that. // * `impl Trait`, due to issue #43869 that functions returning impl Trait cannot be diverging. @@ -864,7 +864,7 @@ fn print_flowgraph<'a, 'tcx, W: Write>(variants: Vec, } blocks::Code::Expr(_) => { tcx.sess.err("--pretty flowgraph with -Z flowgraph-print annotations requires \ - fn-like node id."); + fn-like node-ID."); return Ok(()); } blocks::Code::FnLike(fn_like) => { diff --git a/src/librustc_driver/profile/mod.rs b/src/librustc_driver/profile/mod.rs index eb13a5668f927..655582fc1b131 100644 --- a/src/librustc_driver/profile/mod.rs +++ b/src/librustc_driver/profile/mod.rs @@ -27,7 +27,7 @@ pub fn dump(sess: &Session, path: String) { let params = ProfQDumpParams { path, ack: tx, - // FIXME: Add another compiler flag to toggle whether this log + // FIXME: add another compiler flag to toggle whether this log // is written; false for now dump_profq_msg_log: true, }; @@ -69,7 +69,7 @@ fn profile_queries_thread(r: Receiver) { loop { let msg = r.recv(); if let Err(_recv_err) = msg { - // FIXME: Perhaps do something smarter than simply quitting? + // FIXME: perhaps do something smarter than simply quitting? break }; let msg = msg.unwrap(); diff --git a/src/librustc_errors/emitter.rs b/src/librustc_errors/emitter.rs index 0443b2228e5b4..0de03aab82fcb 100644 --- a/src/librustc_errors/emitter.rs +++ b/src/librustc_errors/emitter.rs @@ -1441,11 +1441,11 @@ fn emit_to_destination(rendered_buffer: &[Vec], // // On Unix systems, we write into a buffered terminal rather than directly to a terminal. When // the .flush() is called we take the buffer created from the buffered writes and write it at - // one shot. Because the Unix systems use ANSI for the colors, which is a text-based styling + // one shot. Because the Unix systems use ANSI for the colors, which is a text-based styling // scheme, this buffered approach works and maintains the styling. // // On Windows, styling happens through calls to a terminal API. This prevents us from using the - // same buffering approach. Instead, we use a global Windows mutex, which we acquire long + // same buffering approach. Instead, we use a global Windows mutex, which we acquire long // enough to output the full error message, then we release. let _buffer_lock = lock::acquire_global_lock("rustc_errors"); for (pos, line) in rendered_buffer.iter().enumerate() { diff --git a/src/librustc_errors/lib.rs b/src/librustc_errors/lib.rs index f0fde6bbd8ecc..b3ec9dbbbacbb 100644 --- a/src/librustc_errors/lib.rs +++ b/src/librustc_errors/lib.rs @@ -446,7 +446,7 @@ impl Handler { result.code(code); result } - // FIXME: This method should be removed (every error should have an associated error code). + // FIXME: this method should be removed (every error should have an associated error code). pub fn struct_err<'a>(&'a self, msg: &str) -> DiagnosticBuilder<'a> { DiagnosticBuilder::new(self, Level::Error, msg) } @@ -529,7 +529,7 @@ impl Handler { } pub fn delay_span_bug>(&self, sp: S, msg: &str) { if self.flags.treat_err_as_bug { - // FIXME: don't abort here if report_delayed_bugs is off + // FIXME: don't abort here if `report_delayed_bugs` is off. self.span_bug(sp, msg); } let mut diagnostic = Diagnostic::new(Level::Bug, msg); diff --git a/src/librustc_incremental/assert_dep_graph.rs b/src/librustc_incremental/assert_dep_graph.rs index 57ab48493fa93..6bcda56ceb693 100644 --- a/src/librustc_incremental/assert_dep_graph.rs +++ b/src/librustc_incremental/assert_dep_graph.rs @@ -103,7 +103,7 @@ impl<'a, 'tcx> IfThisChanged<'a, 'tcx> { Some(word) if value.is_none() => value = Some(word.name()), _ => - // FIXME better-encapsulate meta_item (don't directly access `node`) + // FIXME: better-encapsulate meta_item (don't directly access `node`) span_bug!(list_item.span(), "unexpected meta-item {:?}", list_item.node), } } @@ -359,7 +359,7 @@ fn walk_between<'q>(query: &'q DepGraphQuery, { // This is a bit tricky. We want to include a node only if it is: // (a) reachable from a source and (b) will reach a target. And we - // have to be careful about cycles etc. Luckily efficiency is not + // have to be careful about cycles etc. Luckily efficiency is not // a big concern! #[derive(Copy, Clone, PartialEq)] diff --git a/src/librustc_incremental/persist/dirty_clean.rs b/src/librustc_incremental/persist/dirty_clean.rs index 3ff4d2ec38dff..09abf14441ef9 100644 --- a/src/librustc_incremental/persist/dirty_clean.rs +++ b/src/librustc_incremental/persist/dirty_clean.rs @@ -5,7 +5,7 @@ //! //! - `#[rustc_clean(cfg="rev2", except="TypeckTables")]` if we are //! in `#[cfg(rev2)]`, then the fingerprints associated with -//! `DepNode::TypeckTables(X)` must be DIFFERENT (`X` is the def-id of the +//! `DepNode::TypeckTables(X)` must be DIFFERENT (`X` is the def-ID of the //! current node). //! - `#[rustc_clean(cfg="rev2")]` same as above, except that the //! fingerprints must be the SAME (along with all other fingerprints). @@ -33,16 +33,17 @@ const EXCEPT: &str = "except"; const LABEL: &str = "label"; const CFG: &str = "cfg"; -// Base and Extra labels to build up the labels +// `Base` and `Extra` labels to build up the labels +// ------------------------------------------------ -/// For typedef, constants, and statics +/// `DepNode`s for typedefs, constants, and statics. const BASE_CONST: &[&str] = &[ label_strs::TypeOfItem, ]; -/// DepNodes for functions + methods +/// `DepNode`s for functions and methods. const BASE_FN: &[&str] = &[ - // Callers will depend on the signature of these items, so we better test + // Callers will depend on the signature of these items, so we better test. label_strs::FnSignature, label_strs::GenericsOfItem, label_strs::PredicatesOfItem, @@ -53,28 +54,28 @@ const BASE_FN: &[&str] = &[ label_strs::TypeckTables, ]; -/// DepNodes for Hir, which is pretty much everything +/// `DepNode`s for `Hir`, which is pretty much everything. const BASE_HIR: &[&str] = &[ - // Hir and HirBody should be computed for all nodes + // `Hir` and `HirBody` should be computed for all nodes. label_strs::Hir, label_strs::HirBody, ]; -/// `impl` implementation of struct/trait +/// `DepNode`s for `impl` implementations of structs/traits. const BASE_IMPL: &[&str] = &[ label_strs::AssociatedItemDefIds, label_strs::GenericsOfItem, label_strs::ImplTraitRef, ]; -/// DepNodes for MirValidated/Optimized, which is relevant in "executable" -/// code, i.e., functions+methods +/// `DepNode`s for `MirValidated`/`MirOptimized`, which is relevant in "executable" +/// code (i.e., functions and methods). const BASE_MIR: &[&str] = &[ label_strs::MirOptimized, label_strs::MirValidated, ]; -/// Struct, Enum and Union DepNodes +/// Struct, enum and union `DepNode`s. /// /// Note that changing the type of a field does not change the type of the struct or enum, but /// adding/removing fields or changing a fields name or visibility does. @@ -84,7 +85,7 @@ const BASE_STRUCT: &[&str] = &[ label_strs::TypeOfItem, ]; -/// Trait Definition DepNodes +/// Trait definition `DepNode`s. const BASE_TRAIT_DEF: &[&str] = &[ label_strs::AssociatedItemDefIds, label_strs::GenericsOfItem, @@ -95,7 +96,7 @@ const BASE_TRAIT_DEF: &[&str] = &[ label_strs::TraitImpls, ]; -/// extra DepNodes for methods (+fn) +/// Extra `DepNode`s for functions and methods. const EXTRA_ASSOCIATED: &[&str] = &[ label_strs::AssociatedItems, ]; @@ -104,21 +105,22 @@ const EXTRA_TRAIT: &[&str] = &[ label_strs::TraitOfItem, ]; -// Fully Built Labels +// Fully-built labels +// ------------------ const LABELS_CONST: &[&[&str]] = &[ BASE_HIR, BASE_CONST, ]; -/// Constant/Typedef in an impl +/// Impl constant/typedef `DepNode`s. const LABELS_CONST_IN_IMPL: &[&[&str]] = &[ BASE_HIR, BASE_CONST, EXTRA_ASSOCIATED, ]; -/// Trait-Const/Typedef DepNodes +/// Trait constant/typedef `DepNode`s. const LABELS_CONST_IN_TRAIT: &[&[&str]] = &[ BASE_HIR, BASE_CONST, @@ -126,14 +128,14 @@ const LABELS_CONST_IN_TRAIT: &[&[&str]] = &[ EXTRA_TRAIT, ]; -/// Function DepNode +/// Function `DepNode`s. const LABELS_FN: &[&[&str]] = &[ BASE_HIR, BASE_MIR, BASE_FN, ]; -/// Method DepNodes +/// Method `DepNode`s. const LABELS_FN_IN_IMPL: &[&[&str]] = &[ BASE_HIR, BASE_MIR, @@ -141,7 +143,7 @@ const LABELS_FN_IN_IMPL: &[&[&str]] = &[ EXTRA_ASSOCIATED, ]; -/// Trait-Method DepNodes +/// Trait method `DepNode`s. const LABELS_FN_IN_TRAIT: &[&[&str]] = &[ BASE_HIR, BASE_MIR, @@ -150,24 +152,24 @@ const LABELS_FN_IN_TRAIT: &[&[&str]] = &[ EXTRA_TRAIT, ]; -/// For generic cases like inline-assembly/mod/etc +/// For generic cases like inline-assembly, modules, etc. const LABELS_HIR_ONLY: &[&[&str]] = &[ BASE_HIR, ]; -/// Impl DepNodes +/// Impl `DepNode`s. const LABELS_IMPL: &[&[&str]] = &[ BASE_HIR, BASE_IMPL, ]; -/// Abstract Data Type (Struct, Enum, Unions) DepNodes +/// Abstract data type (struct, enum, union) `DepNode`s. const LABELS_ADT: &[&[&str]] = &[ BASE_HIR, BASE_STRUCT, ]; -/// Trait Definition DepNodes +/// Trait definition `DepNode`s. #[allow(dead_code)] const LABELS_TRAIT: &[&[&str]] = &[ BASE_HIR, @@ -175,16 +177,14 @@ const LABELS_TRAIT: &[&[&str]] = &[ ]; -// FIXME: Struct/Enum/Unions Fields (there is currently no way to attach these) +// FIXME: there is currently no way to attach struct/enum/union fields. // // Fields are kind of separate from their containers, as they can change independently from -// them. We should at least check -// -// TypeOfItem for these. +// them. We should at least check `TypeOfItem` for these. type Labels = FxHashSet; -/// Represents the requested configuration by rustc_clean/dirty +/// Represents the requested configuration by rustc_clean/dirty. struct Assertion { clean: Labels, dirty: Labels, @@ -207,7 +207,7 @@ impl Assertion { } pub fn check_dirty_clean_annotations<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { - // can't add `#[rustc_dirty]` etc without opting in to this feature + // Can't add `#[rustc_dirty]`, etc., without opting in to this feature. if !tcx.features().rustc_attrs { return; } @@ -250,11 +250,11 @@ impl<'a, 'tcx> DirtyCleanVisitor<'a, 'tcx> { } else if attr.check_name(ATTR_CLEAN) { true } else { - // skip: not rustc_clean/dirty + // Skip: not rustc_clean/dirty. return None }; if !check_config(self.tcx, attr) { - // skip: not the correct `cfg=` + // Skip: not the correct `cfg=`. return None; } let assertion = if let Some(labels) = self.labels(attr) { @@ -269,7 +269,7 @@ impl<'a, 'tcx> DirtyCleanVisitor<'a, 'tcx> { Some(assertion) } - /// Get the "auto" assertion on pre-validated attr, along with the `except` labels + /// Get the "auto" assertion on pre-validated attr, along with the `except` labels. fn assertion_auto(&mut self, item_id: ast::NodeId, attr: &Attribute, is_clean: bool) -> Assertion { @@ -316,19 +316,19 @@ impl<'a, 'tcx> DirtyCleanVisitor<'a, 'tcx> { return self.resolve_labels(&item, value.as_str().as_ref()); } } - // if no `label` or `except` is given, only the node's group are asserted + // If no `label` or `except` is given, only the node's group are asserted. Labels::default() } /// Return all DepNode labels that should be asserted for this item. - /// index=0 is the "name" used for error messages + /// `index = 0` is the "name" used for error messages fn auto_labels(&mut self, item_id: ast::NodeId, attr: &Attribute) -> (&'static str, Labels) { let node = self.tcx.hir().get(item_id); let (name, labels) = match node { HirNode::Item(item) => { match item.node { - // note: these are in the same order as hir::Item_; - // FIXME(michaelwoerister): do commented out ones + // N.B., these are in the same order as `hir::Item_;` + // FIXME(michaelwoerister): do commented out ones. // // An `extern crate` item, with optional original crate name, // HirItem::ExternCrate(..), // intentionally no assertions @@ -336,37 +336,37 @@ impl<'a, 'tcx> DirtyCleanVisitor<'a, 'tcx> { // // `use foo::bar::*;` or `use foo::bar::baz as quux;` // HirItem::Use(..), // intentionally no assertions - // A `static` item + // A `static` item. HirItem::Static(..) => ("ItemStatic", LABELS_CONST), - // A `const` item + // A `const` item. HirItem::Const(..) => ("ItemConst", LABELS_CONST), - // A function declaration + // A function declaration. HirItem::Fn(..) => ("ItemFn", LABELS_FN), - // // A module + // A module. HirItem::Mod(..) =>("ItemMod", LABELS_HIR_ONLY), - // // An external module + // An external module. HirItem::ForeignMod(..) => ("ItemForeignMod", LABELS_HIR_ONLY), - // Module-level inline assembly (from global_asm!) + // Module-level inline assembly (from `global_asm!`). HirItem::GlobalAsm(..) => ("ItemGlobalAsm", LABELS_HIR_ONLY), - // A type alias, e.g., `type Foo = Bar` + // A type alias (e.g., `type Foo = Bar`) HirItem::Ty(..) => ("ItemTy", LABELS_HIR_ONLY), - // An enum definition, e.g., `enum Foo {C, D}` + // An enum definition (e.g., `enum Foo {C, D}`). HirItem::Enum(..) => ("ItemEnum", LABELS_ADT), - // A struct definition, e.g., `struct Foo {x: A}` + // A struct definition (e.g., `struct Foo {x: A}`). HirItem::Struct(..) => ("ItemStruct", LABELS_ADT), - // A union definition, e.g., `union Foo {x: A, y: B}` + // A union definition (e.g., `union Foo {x: A, y: B}`). HirItem::Union(..) => ("ItemUnion", LABELS_ADT), - // Represents a Trait Declaration + // Represents a trait declaration // FIXME(michaelwoerister): trait declaration is buggy because sometimes some of // the depnodes don't exist (because they legitametely didn't need to be // calculated) @@ -382,7 +382,7 @@ impl<'a, 'tcx> DirtyCleanVisitor<'a, 'tcx> { // //HirItem::Trait(..) => ("ItemTrait", LABELS_TRAIT), - // An implementation, eg `impl Trait for Foo { .. }` + // An implementation (e.g., `impl Trait for Foo { .. }`). HirItem::Impl(..) => ("ItemKind::Impl", LABELS_IMPL), _ => self.tcx.sess.span_fatal( diff --git a/src/librustc_incremental/persist/fs.rs b/src/librustc_incremental/persist/fs.rs index ff8b76829eb2e..d4232e621f3ce 100644 --- a/src/librustc_incremental/persist/fs.rs +++ b/src/librustc_incremental/persist/fs.rs @@ -524,7 +524,7 @@ fn find_source_directory(crate_dir: &Path, fn find_source_directory_in_iter(iter: I, source_directories_already_tried: &FxHashSet) -> Option - where I: Iterator + where I: Iterator { let mut best_candidate = (UNIX_EPOCH, None); diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs index cd4cbcc13a6f2..64558136265b2 100644 --- a/src/librustc_lint/builtin.rs +++ b/src/librustc_lint/builtin.rs @@ -18,16 +18,14 @@ //! Use the former for unit-like structs and the latter for structs with //! a `pub fn new()`. +use lint::{LateContext, LintContext, LintArray}; +use lint::{LintPass, LateLintPass, EarlyLintPass, EarlyContext}; +use rustc::hir::{self, GenericParamKind, Node, PatKind}; use rustc::hir::def::Def; use rustc::hir::def_id::DefId; +use rustc::hir::intravisit::FnKind; use rustc::ty::{self, Ty}; -use hir::Node; -use util::nodemap::NodeSet; -use lint::{LateContext, LintContext, LintArray}; -use lint::{LintPass, LateLintPass, EarlyLintPass, EarlyContext}; - -use rustc::util::nodemap::FxHashSet; - +use rustc::util::nodemap::{FxHashSet, NodeSet}; use syntax::tokenstream::{TokenTree, TokenStream}; use syntax::ast; use syntax::ptr::P; @@ -41,12 +39,9 @@ use syntax::symbol::keywords; use syntax::errors::{Applicability, DiagnosticBuilder}; use syntax::print::pprust::expr_to_string; -use rustc::hir::{self, GenericParamKind, PatKind}; -use rustc::hir::intravisit::FnKind; - use nonstandard_style::{MethodLateContext, method_context}; -// hardwired lints from librustc +// Hardwired lints from librustc. pub use lint::builtin::*; declare_lint! { @@ -173,17 +168,18 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonShorthandFieldPatterns { continue; } if fieldpat.span.ctxt().outer().expn_info().is_some() { - // Don't lint if this is a macro expansion: macro authors + // Don't lint if this is a macro expansion; macro authors // shouldn't have to worry about this kind of style issue - // (Issue #49588) + // (issue #49588). continue; } if let PatKind::Binding(_, _, ident, None) = fieldpat.node.pat.node { if cx.tcx.find_field_index(ident, &variant) == Some(cx.tcx.field_index(fieldpat.node.id, cx.tables)) { - let mut err = cx.struct_span_lint(NON_SHORTHAND_FIELD_PATTERNS, - fieldpat.span, - &format!("the `{}:` in this pattern is redundant", ident)); + let mut err = cx.struct_span_lint( + NON_SHORTHAND_FIELD_PATTERNS, + fieldpat.span, + &format!("the `{}:` in this pattern is redundant", ident)); let subspan = cx.tcx.sess.source_map().span_through_char(fieldpat.span, ':'); err.span_suggestion_short_with_applicability( @@ -288,6 +284,7 @@ declare_lint! { report_in_external_macro: true } +#[derive(Clone)] pub struct MissingDoc { /// Stack of whether #[doc(hidden)] is set /// at each level which has lint attributes. @@ -558,6 +555,7 @@ declare_lint! { "detects missing implementations of fmt::Debug" } +#[derive(Clone)] pub struct MissingDebugImplementations { impling_types: Option, } @@ -621,8 +619,8 @@ declare_lint! { "detects anonymous parameters" } -/// Checks for use of anonymous parameters (RFC 1685) -#[derive(Clone)] +/// Checks for use of anonymous parameters (RFC 1685). +#[derive(Copy, Clone)] pub struct AnonymousParameters; impl LintPass for AnonymousParameters { @@ -674,7 +672,7 @@ impl EarlyLintPass for AnonymousParameters { } /// Checks for incorrect use use of `repr` attributes. -#[derive(Clone)] +#[derive(Copy, Clone)] pub struct BadRepr; impl LintPass for BadRepr { @@ -811,7 +809,7 @@ impl LintPass for UnusedDocComment { impl UnusedDocComment { fn warn_if_doc<'a, 'tcx, - I: Iterator, + I: Iterator, C: LintContext<'tcx>>(&self, mut attrs: I, cx: &C) { if let Some(attr) = attrs.find(|a| a.is_value_str() && a.check_name("doc")) { cx.struct_span_lint(UNUSED_DOC_COMMENTS, attr.span, "doc comment not used by rustdoc") @@ -1016,14 +1014,14 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MutableTransmutes { } } -/// Forbids using the `#[feature(...)]` attribute +/// Forbids using the `#[feature(...)]` attribute. #[derive(Copy, Clone)] pub struct UnstableFeatures; declare_lint! { UNSTABLE_FEATURES, Allow, - "enabling unstable features (deprecated. do not use)" + "enabling unstable features (deprecated, do not use)" } impl LintPass for UnstableFeatures { @@ -1045,6 +1043,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnstableFeatures { } /// Lint for unions that contain fields with possibly non-trivial destructors. +#[derive(Copy, Clone)] pub struct UnionsWithDropFields; declare_lint! { @@ -1077,6 +1076,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnionsWithDropFields { } /// Lint for items marked `pub` that aren't reachable from other crates +#[derive(Copy, Clone)] pub struct UnreachablePub; declare_lint! { @@ -1146,7 +1146,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnreachablePub { /// Lint for trait and lifetime bounds in type aliases being mostly ignored: /// They are relevant when using associated types, but otherwise neither checked /// at definition site nor enforced at use site. - +#[derive(Copy, Clone)] pub struct TypeAliasBounds; declare_lint! { @@ -1182,7 +1182,7 @@ impl TypeAliasBounds { fn suggest_changing_assoc_types(ty: &hir::Ty, err: &mut DiagnosticBuilder) { // Access to associates types should use `::Assoc`, which does not need a - // bound. Let's see if this type does that. + // bound. Let's see if this type does that. // We use a HIR visitor to walk the type. use rustc::hir::intravisit::{self, Visitor}; @@ -1257,6 +1257,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypeAliasBounds { /// Without this lint, we might not get any diagnostic if the constant is /// unused within this crate, even though downstream crates can't use it /// without producing an error. +#[derive(Copy, Clone)] pub struct UnusedBrokenConst; impl LintPass for UnusedBrokenConst { @@ -1264,6 +1265,7 @@ impl LintPass for UnusedBrokenConst { lint_array!() } } + fn check_const(cx: &LateContext, body_id: hir::BodyId) { let def_id = cx.tcx.hir().body_owner_def_id(body_id); let is_static = cx.tcx.is_static(def_id).is_some(); @@ -1297,6 +1299,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnusedBrokenConst { /// Lint for trait and lifetime bounds that don't depend on type parameters /// which either do nothing, or stop the item from being used. +#[derive(Copy, Clone)] pub struct TrivialConstraints; declare_lint! { @@ -1379,7 +1382,7 @@ impl LintPass for SoftLints { UNIONS_WITH_DROP_FIELDS, UNREACHABLE_PUB, TYPE_ALIAS_BOUNDS, - TRIVIAL_BOUNDS + TRIVIAL_BOUNDS, ) } } @@ -1390,7 +1393,7 @@ declare_lint! { "`...` range patterns are deprecated" } - +#[derive(Copy, Clone)] pub struct EllipsisInclusiveRangePatterns; impl LintPass for EllipsisInclusiveRangePatterns { @@ -1453,8 +1456,10 @@ declare_lint! { report_in_external_macro: true } +#[derive(Copy, Clone)] pub struct UnnameableTestItems { - boundary: ast::NodeId, // NodeId of the item under which things are not nameable + // `NodeId` of the item under which things are not nameable. + boundary: ast::NodeId, items_nameable: bool, } @@ -1506,8 +1511,8 @@ declare_lint! { "detects edition keywords being used as an identifier" } -/// Checks for uses of edition keywords used as an identifier -#[derive(Clone)] +/// Checks for uses of edition keywords used as an identifier. +#[derive(Copy, Clone)] pub struct KeywordIdents; impl LintPass for KeywordIdents { @@ -1521,7 +1526,7 @@ impl KeywordIdents { for tt in tokens.into_trees() { match tt { TokenTree::Token(span, tok) => match tok.ident() { - // only report non-raw idents + // Only report non-raw idents. Some((ident, false)) => { self.check_ident(cx, ast::Ident { span: span.substitute_dummy(ident.span), @@ -1612,7 +1617,7 @@ impl EarlyLintPass for KeywordIdents { } } - +#[derive(Copy, Clone)] pub struct ExplicitOutlivesRequirements; impl LintPass for ExplicitOutlivesRequirements { @@ -1631,9 +1636,9 @@ impl ExplicitOutlivesRequirements { infer_static: bool ) -> Vec<(usize, Span)> { // For lack of a more elegant strategy for comparing the `ty::Predicate`s - // returned by this query with the params/bounds grabbed from the HIR—and - // with some regrets—we're going to covert the param/lifetime names to - // strings + // returned by this query with the params/bounds grabbed from the HIR (and + // with some regrets), we're going to covert the param/lifetime names to + // strings. let inferred_outlives = cx.tcx.inferred_outlives_of(item_def_id); let ty_lt_names = inferred_outlives.iter().filter_map(|pred| { @@ -1663,7 +1668,8 @@ impl ExplicitOutlivesRequirements { _ => false }; if is_static && !infer_static { - // infer-outlives for 'static is still feature-gated (tracking issue #44493) + // `infer-outlives` for `'static` is still feature-gated + // (tracking issue #44493). continue; } @@ -1686,9 +1692,9 @@ impl ExplicitOutlivesRequirements { return Vec::new(); } if bound_spans.len() == bounds.len() { - let (_, last_bound_span) = bound_spans[bound_spans.len()-1]; + let (_, last_bound_span) = bound_spans[bound_spans.len() - 1]; // If all bounds are inferable, we want to delete the colon, so - // start from just after the parameter (span passed as argument) + // start from just after the parameter (span passed as argument). vec![lo.to(last_bound_span)] } else { let mut merged = Vec::new(); @@ -1697,18 +1703,18 @@ impl ExplicitOutlivesRequirements { let mut from_start = true; for (i, bound_span) in bound_spans { match last_merged_i { - // If the first bound is inferable, our span should also eat the trailing `+` + // If the first bound is inferable, our span should also eat the trailing `+`. None if i == 0 => { merged.push(bound_span.to(bounds[1].span().shrink_to_lo())); last_merged_i = Some(0); }, - // If consecutive bounds are inferable, merge their spans - Some(h) if i == h+1 => { + // If consecutive bounds are inferable, merge their spans. + Some(h) if i == h + 1 => { if let Some(tail) = merged.last_mut() { // Also eat the trailing `+` if the first - // more-than-one bound is inferable + // more-than-one bound is inferable. let to_span = if from_start && i < bounds.len() { - bounds[i+1].span().shrink_to_lo() + bounds[i + 1].span().shrink_to_lo() } else { bound_span }; @@ -1721,9 +1727,9 @@ impl ExplicitOutlivesRequirements { _ => { // When we find a non-inferable bound, subsequent inferable bounds // won't be consecutive from the start (and we'll eat the leading - // `+` rather than the trailing one) + // `+` rather than the trailing one). from_start = false; - merged.push(bounds[i-1].span().shrink_to_hi().to(bound_span)); + merged.push(bounds[i - 1].span().shrink_to_hi().to(bound_span)); last_merged_i = Some(i); } } diff --git a/src/librustc_lint/lib.rs b/src/librustc_lint/lib.rs index 4dfb664451b91..2a714781fc8eb 100644 --- a/src/librustc_lint/lib.rs +++ b/src/librustc_lint/lib.rs @@ -194,7 +194,7 @@ pub fn register_builtins(store: &mut lint::LintStore, sess: Option<&Session>) { // macros are ready for this yet. // UNREACHABLE_PUB, - // FIXME macro crates are not up for this yet, too much + // FIXME: macro crates are not up for this yet, too much // breakage is seen if we try to encourage this lint. // MACRO_USE_EXTERN_CRATE, ); diff --git a/src/librustc_lint/types.rs b/src/librustc_lint/types.rs index 642681a73a8a0..3b98424509128 100644 --- a/src/librustc_lint/types.rs +++ b/src/librustc_lint/types.rs @@ -435,7 +435,7 @@ enum FfiResult<'tcx> { /// "nullable pointer optimization". Currently restricted /// to function pointers and references, but could be /// expanded to cover NonZero raw pointers and newtypes. -/// FIXME: This duplicates code in codegen. +/// FIXME: this duplicates code in codegen. fn is_repr_nullable_ptr<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def: &'tcx ty::AdtDef, substs: &Substs<'tcx>) @@ -481,7 +481,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> { // Protect against infinite recursion, for example // `struct S(*mut S);`. - // FIXME: A recursion limit is necessary as well, for irregular + // FIXME: a recursion limit is necessary as well, for irregular // recursive types. if !cache.insert(ty) { return FfiSafe; diff --git a/src/librustc_lint/unused.rs b/src/librustc_lint/unused.rs index 205f8941d1ee2..1d44429dbd1cd 100644 --- a/src/librustc_lint/unused.rs +++ b/src/librustc_lint/unused.rs @@ -112,7 +112,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnusedResults { fn_warned = check_must_use(cx, def_id, s.span, "return value of ", ""); } else if type_permits_lack_of_use { // We don't warn about unused unit or uninhabited types. - // (See https://github.com/rust-lang/rust/issues/43806 for details.) + // (See issue #43806 for details.) return; } diff --git a/src/librustc_metadata/cstore_impl.rs b/src/librustc_metadata/cstore_impl.rs index e61229db86ddb..7fa0cca0a1c7a 100644 --- a/src/librustc_metadata/cstore_impl.rs +++ b/src/librustc_metadata/cstore_impl.rs @@ -308,7 +308,7 @@ pub fn provide<'tcx>(providers: &mut Providers<'tcx>) { assert_eq!(cnum, LOCAL_CRATE); let mut visible_parent_map: DefIdMap = Default::default(); - // Issue 46112: We want the map to prefer the shortest + // Issue #46112: We want the map to prefer the shortest // paths when reporting the path to an item. Therefore we // build up the map via a breadth-first search (BFS), // which naturally yields minimal-length paths. @@ -496,8 +496,8 @@ impl CrateStore for cstore::CStore { /// parent `DefId` as well as some idea of what kind of data the /// `DefId` refers to. fn def_key(&self, def: DefId) -> DefKey { - // Note: loading the def-key (or def-path) for a def-id is not - // a *read* of its metadata. This is because the def-id is + // Note: loading the def-key (or def-path) for a def-ID is not + // a *read* of its metadata. This is because the def-ID is // really just an interned shorthand for a def-path, which is the // canonical name for an item. // diff --git a/src/librustc_metadata/decoder.rs b/src/librustc_metadata/decoder.rs index dc8db5be5820a..f093a53abb14c 100644 --- a/src/librustc_metadata/decoder.rs +++ b/src/librustc_metadata/decoder.rs @@ -687,7 +687,7 @@ impl<'a, 'tcx> CrateMetadata { /// Iterates over all the stability attributes in the given crate. pub fn get_lib_features(&self) -> Vec<(ast::Name, Option)> { - // FIXME: For a proc macro crate, not sure whether we should return the "host" + // FIXME: for a proc macro crate, not sure whether we should return the "host" // features or an empty Vec. Both don't cause ICEs. self.root .lib_features diff --git a/src/librustc_metadata/encoder.rs b/src/librustc_metadata/encoder.rs index 032a4656efcda..070bedcd61269 100644 --- a/src/librustc_metadata/encoder.rs +++ b/src/librustc_metadata/encoder.rs @@ -412,7 +412,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> { let def_path_table = self.encode_def_path_table(); let def_path_table_bytes = self.position() - i; - // Encode the def IDs of impls, for coherence checking. + // Encode the def-IDs of impls, for coherence checking. i = self.position(); let impls = self.tracked(IsolatedEncoder::encode_impls, ()); let impl_bytes = self.position() - i; @@ -1443,7 +1443,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> { // We're just going to write a list of crate 'name-hash-version's, with // the assumption that they are numbered 1 to n. - // FIXME (#2166): This is not nearly enough to support correct versioning + // FIXME(#2166): This is not nearly enough to support correct versioning // but is enough to get transitive crate dependencies working. self.lazy_seq_ref(deps.iter().map(|&(_, ref dep)| dep)) } diff --git a/src/librustc_metadata/index_builder.rs b/src/librustc_metadata/index_builder.rs index 3608b12aea934..c64603ffc7d99 100644 --- a/src/librustc_metadata/index_builder.rs +++ b/src/librustc_metadata/index_builder.rs @@ -3,7 +3,7 @@ //! //! ``` //! // big list of item-like things... -//! // ...for most def-ids, there is an entry. +//! // ...for most def-IDs, there is an entry. //! //! //! ``` @@ -85,7 +85,7 @@ impl<'a, 'b, 'tcx> IndexBuilder<'a, 'b, 'tcx> { } } - /// Emit the data for a def-id to the metadata. The function to + /// Emit the data for a def-ID to the metadata. The function to /// emit the data is `op`, and it will be given `data` as /// arguments. This `record` function will call `op` to generate /// the `Entry` (which may point to other encoded information) @@ -214,7 +214,7 @@ impl DepGraphRead for Untracked { /// Newtype that can be used to package up misc data extracted from a /// HIR node that doesn't carry its own id. This will allow an /// arbitrary `T` to be passed in, but register a read on the given -/// node-id. +/// node-ID. pub struct FromId(pub ast::NodeId, pub T); impl DepGraphRead for FromId { diff --git a/src/librustc_metadata/locator.rs b/src/librustc_metadata/locator.rs index 6b49d6b9e52cb..d8dcd0596859b 100644 --- a/src/librustc_metadata/locator.rs +++ b/src/librustc_metadata/locator.rs @@ -27,7 +27,7 @@ //! //! The reason for this is that any of B's types could be composed of C's types, //! any function in B could return a type from C, etc. To be able to guarantee -//! that we can always typecheck/translate any function, we have to have +//! that we can always type-check/translate any function, we have to have //! complete knowledge of the whole ecosystem, not just our immediate //! dependencies. //! diff --git a/src/librustc_mir/borrow_check/borrow_set.rs b/src/librustc_mir/borrow_check/borrow_set.rs index ecbc6118bc37c..2ce8d504fdf48 100644 --- a/src/librustc_mir/borrow_check/borrow_set.rs +++ b/src/librustc_mir/borrow_check/borrow_set.rs @@ -311,7 +311,7 @@ impl<'a, 'gcx, 'tcx> Visitor<'tcx> for GatherBorrows<'a, 'gcx, 'tcx> { } impl<'a, 'gcx, 'tcx> GatherBorrows<'a, 'gcx, 'tcx> { - /// Returns true if the borrow represented by `kind` is + /// Returns whether the borrow represented by `kind` is /// allowed to be split into separate Reservation and /// Activation phases. fn allow_two_phase_borrow(&self, kind: mir::BorrowKind) -> bool { diff --git a/src/librustc_mir/borrow_check/error_reporting.rs b/src/librustc_mir/borrow_check/error_reporting.rs index 6a5b5d172bbe4..4ddf8d8271f9a 100644 --- a/src/librustc_mir/borrow_check/error_reporting.rs +++ b/src/librustc_mir/borrow_check/error_reporting.rs @@ -921,7 +921,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { ) -> DiagnosticBuilder<'cx> { let tcx = self.infcx.tcx; - // FIXME use a better heuristic than Spans + // FIXME: use a better heuristic than Spans let reference_desc = if return_span == self.mir.source_info(borrow.reserve_location).span { "reference to" } else { @@ -1638,7 +1638,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { } ty::Array(ty, _) | ty::Slice(ty) => self.describe_field_from_ty(&ty, field), ty::Closure(def_id, _) | ty::Generator(def_id, _, _) => { - // Convert the def-id into a node-id. node-ids are only valid for + // Convert the def-ID into a node-ID. node-IDs are only valid for // the local code in the current crate, so this returns an `Option` in case // the closure comes from another crate. But in that case we wouldn't // be borrowck'ing it, so we can just unwrap: @@ -1651,7 +1651,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { } _ => { // Might need a revision when the fields in trait RFC is implemented - // (https://github.com/rust-lang/rfcs/pull/1546) + // (RFC #1546). bug!( "End-user description not implemented for field access on `{:?}`", ty.sty diff --git a/src/librustc_mir/borrow_check/mod.rs b/src/librustc_mir/borrow_check/mod.rs index 45632245b61de..e73acad4c53c5 100644 --- a/src/librustc_mir/borrow_check/mod.rs +++ b/src/librustc_mir/borrow_check/mod.rs @@ -425,7 +425,7 @@ pub struct MirBorrowckCtxt<'cx, 'gcx: 'tcx, 'tcx: 'cx> { /// for reservations, so that we don't report seemingly duplicate /// errors for corresponding activations /// - /// FIXME: Ideally this would be a set of BorrowIndex, not Places, + /// FIXME: ideally this would be a set of BorrowIndex, not Places, /// but it is currently inconvenient to track down the BorrowIndex /// at the time we detect and report a reservation error. reservation_error_reported: FxHashSet>, @@ -519,7 +519,7 @@ impl<'cx, 'gcx, 'tcx> DataflowResultsConsumer<'cx, 'tcx> for MirBorrowckCtxt<'cx // assert that a place is safe and live. So we don't have to // do any checks here. // - // FIXME: Remove check that the place is initialized. This is + // FIXME: remove check that the place is initialized. This is // needed for now because matches don't have never patterns yet. // So this is the only place we prevent // let x: !; @@ -898,7 +898,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { /// place is initialized and (b) it is not borrowed in some way that would prevent this /// access. /// - /// Returns true if an error is reported, false otherwise. + /// Returns whether an error is reported. fn access_place( &mut self, context: Context, @@ -1724,15 +1724,15 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { // // and also this: // - // 3. `let mut s = ...; drop(s); s.x=Val;` + // 3. `let mut s = ...; drop(s); s.x = Val;` // - // This does not use check_if_path_or_subpath_is_moved, + // This does not use `check_if_path_or_subpath_is_moved`, // because we want to *allow* reinitializations of fields: // e.g., want to allow // - // `let mut s = ...; drop(s.x); s.x=Val;` + // `let mut s = ...; drop(s.x); s.x = Val;` // - // This does not use check_if_full_path_is_moved on + // This does not use `check_if_full_path_is_moved` on // `base`, because that would report an error about the // `base` as a whole, but in this scenario we *really* // want to report an error about the actual thing that was @@ -1743,7 +1743,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { let maybe_uninits = &flow_state.uninits; // Find the shortest uninitialized prefix you can reach - // without going over a Deref. + // without going over a `Deref`. let mut shortest_uninit_seen = None; for prefix in this.prefixes(base, PrefixSet::Shallow) { let mpi = match this.move_path_for_place(prefix) { @@ -1790,7 +1790,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { /// Check the permissions for the given place and read or write kind /// - /// Returns true if an error is reported, false otherwise. + /// Returns whether an error is reported. fn check_access_permissions( &mut self, (place, span): (&Place<'tcx>, Span), @@ -2107,7 +2107,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { // `self.foo` -- we want to double // check that the context `*self` // is mutable (i.e., this is not a - // `Fn` closure). But if that + // `Fn` closure). But if that // check succeeds, we want to // *blame* the mutability on // `place` (that is, diff --git a/src/librustc_mir/borrow_check/nll/constraints/mod.rs b/src/librustc_mir/borrow_check/nll/constraints/mod.rs index 146bd65dd1143..5d7387bc60294 100644 --- a/src/librustc_mir/borrow_check/nll/constraints/mod.rs +++ b/src/librustc_mir/borrow_check/nll/constraints/mod.rs @@ -66,11 +66,11 @@ impl Deref for ConstraintSet { #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct OutlivesConstraint { - // NB. The ordering here is not significant for correctness, but + // N.B., the ordering here is not significant for correctness, but // it is for convenience. Before we dump the constraints in the // debugging logs, we sort them, and we'd like the "super region" // to be first, etc. (In particular, span should remain last.) - /// The region SUP must outlive SUB... + /// The region SUP must outlive SUB. pub sup: RegionVid, /// Region that must be outlived. diff --git a/src/librustc_mir/borrow_check/nll/facts.rs b/src/librustc_mir/borrow_check/nll/facts.rs index bc33a1c9c65aa..b37ca6b63d405 100644 --- a/src/librustc_mir/borrow_check/nll/facts.rs +++ b/src/librustc_mir/borrow_check/nll/facts.rs @@ -13,7 +13,7 @@ use std::path::Path; crate type AllFacts = PoloniusAllFacts; crate trait AllFactsExt { - /// Returns true if there is a need to gather `AllFacts` given the + /// Returns whether there is a need to gather `AllFacts` given the /// current `-Z` flags. fn enabled(tcx: TyCtxt<'_, '_, '_>) -> bool; diff --git a/src/librustc_mir/borrow_check/nll/mod.rs b/src/librustc_mir/borrow_check/nll/mod.rs index c5eabbbefa9a4..79e361916badc 100644 --- a/src/librustc_mir/borrow_check/nll/mod.rs +++ b/src/librustc_mir/borrow_check/nll/mod.rs @@ -283,7 +283,7 @@ fn dump_annotation<'a, 'gcx, 'tcx>( // When the enclosing function is tagged with `#[rustc_regions]`, // we dump out various bits of state as warnings. This is useful - // for verifying that the compiler is behaving as expected. These + // for verifying that the compiler is behaving as expected. These // warnings focus on the closure region requirements -- for // viewing the intraprocedural state, the -Zdump-mir output is // better. diff --git a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/mod.rs b/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/mod.rs index 77c8a896b04ed..5bf6340245cf1 100644 --- a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/mod.rs +++ b/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/mod.rs @@ -112,7 +112,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { // '5: '6 ('6 is the target) // // Some of those regions are unified with `'6` (in the same - // SCC). We want to screen those out. After that point, the + // SCC). We want to screen those out. After that point, the // "closest" constraint we have to the end is going to be the // most likely to be the point where the value escapes -- but // we still want to screen for an "interesting" point to @@ -584,7 +584,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { // Check whether or not the impl trait return type is intended to capture // data with the static lifetime. // - // eg. check for `impl Trait + 'static` instead of `impl Trait`. + // E.g., check for `impl Trait + 'static` instead of `impl Trait`. let has_static_predicate = { let predicates_of = infcx.tcx.predicates_of(*did); let bounds = predicates_of.instantiate(infcx.tcx, substs); @@ -723,7 +723,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { .unwrap_or((constraint.category, false, mir.source_info(loc).span)) } - /// Returns `true` if a closure is inferred to be an `FnMut` closure. + /// Returns whether a closure is inferred to be an `FnMut` closure. crate fn is_closure_fn_mut(&self, infcx: &InferCtxt<'_, '_, 'tcx>, fr: RegionVid) -> bool { if let Some(ty::ReFree(free_region)) = self.to_error_region(fr) { if let ty::BoundRegion::BrEnv = free_region.bound_region { diff --git a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/region_name.rs b/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/region_name.rs index 963d4ab3a5466..64976ee73c568 100644 --- a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/region_name.rs +++ b/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/region_name.rs @@ -428,7 +428,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { /// to. For example, we might produce an annotation like this: /// /// ``` - /// | fn a(items: &[T]) -> Box> { + /// | fn a(items: &[T]) -> Box> { /// | - let's call the lifetime of this reference `'1` /// ``` /// @@ -492,7 +492,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { match path.def { // Type parameters of the type alias have no reason to // be the same as those of the ADT. - // FIXME: We should be able to do something similar to + // FIXME: we should be able to do something similar to // match_adt_and_segment in this case. hir::def::Def::TyAlias(_) => (), _ => if let Some(last_segment) = path.segments.last() { @@ -526,7 +526,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { } _ => { - // FIXME there are other cases that we could trace + // FIXME: there are other cases that we could trace } } } diff --git a/src/librustc_mir/borrow_check/nll/region_infer/mod.rs b/src/librustc_mir/borrow_check/nll/region_infer/mod.rs index fee5dc8646587..fb4aef7ab4bdc 100644 --- a/src/librustc_mir/borrow_check/nll/region_infer/mod.rs +++ b/src/librustc_mir/borrow_check/nll/region_infer/mod.rs @@ -371,7 +371,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { self.universal_regions.annotate(tcx, err) } - /// Returns true if the region `r` contains the point `p`. + /// Returns whether the region `r` contains the point `p`. /// /// Panics if called before `solve()` executes, crate fn region_contains(&self, r: impl ToRegionVid, p: impl ToElementIndex) -> bool { @@ -753,7 +753,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { // // This is needed because -- particularly in the case // where `ur` is a local bound -- we are sometimes in a - // position to prove things that our caller cannot. See + // position to prove things that our caller cannot. See // #53570 for an example. if self.eval_verify_bound(tcx, mir, generic_ty, ur, &type_test.verify_bound) { continue; @@ -988,7 +988,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { /// different results. (For example, there might be two regions /// with the same value that are not in the same SCC). /// - /// NB. This is not an ideal approach and I would like to revisit + /// N.B., this is not an ideal approach and I would like to revisit /// it. However, it works pretty well in practice. In particular, /// this is needed to deal with projection outlives bounds like /// @@ -1344,7 +1344,7 @@ impl<'gcx, 'tcx> ClosureRegionRequirementsExt<'gcx, 'tcx> for ClosureRegionRequi ); // Extract the values of the free regions in `closure_substs` - // into a vector. These are the regions that we will be + // into a vector. These are the regions that we will be // relating to one another. let closure_mapping = &UniversalRegions::closure_mapping( tcx, diff --git a/src/librustc_mir/borrow_check/nll/region_infer/values.rs b/src/librustc_mir/borrow_check/nll/region_infer/values.rs index 88e8310db6893..2a3dcca2c5a09 100644 --- a/src/librustc_mir/borrow_check/nll/region_infer/values.rs +++ b/src/librustc_mir/borrow_check/nll/region_infer/values.rs @@ -166,7 +166,7 @@ impl LivenessValues { self.points.rows() } - /// Adds the given element to the value for the given region. Returns true if + /// Adds the given element to the value for the given region. Returns whether /// the element is newly added (i.e., was not already present). crate fn add_element(&mut self, row: N, location: Location) -> bool { debug!("LivenessValues::add(r={:?}, location={:?})", row, location); @@ -175,7 +175,7 @@ impl LivenessValues { } /// Adds all the elements in the given bit array into the given - /// region. Returns true if any of them are newly added. + /// region. Returns whether any of them are newly added. crate fn add_elements(&mut self, row: N, locations: &HybridBitSet) -> bool { debug!( "LivenessValues::add_elements(row={:?}, locations={:?})", @@ -291,7 +291,7 @@ impl RegionValues { } } - /// Adds the given element to the value for the given region. Returns true if + /// Adds the given element to the value for the given region. Returns whether /// the element is newly added (i.e., was not already present). crate fn add_element(&mut self, r: N, elem: impl ToElementIndex) -> bool { debug!("add(r={:?}, elem={:?})", r, elem); diff --git a/src/librustc_mir/borrow_check/nll/type_check/free_region_relations.rs b/src/librustc_mir/borrow_check/nll/type_check/free_region_relations.rs index b19dc9091cb86..ced1351d956f2 100644 --- a/src/librustc_mir/borrow_check/nll/type_check/free_region_relations.rs +++ b/src/librustc_mir/borrow_check/nll/type_check/free_region_relations.rs @@ -158,7 +158,7 @@ impl UniversalRegionRelations<'tcx> { debug!("non_local_bound: external_parents={:?}", external_parents); // In case we find more than one, reduce to one for - // convenience. This is to prevent us from generating more + // convenience. This is to prevent us from generating more // complex constraints, but it will cause spurious errors. let post_dom = relation .mutual_immediate_postdominator(external_parents) diff --git a/src/librustc_mir/borrow_check/nll/type_check/liveness/mod.rs b/src/librustc_mir/borrow_check/nll/type_check/liveness/mod.rs index 633695a9b9ce5..91a6b2df41344 100644 --- a/src/librustc_mir/borrow_check/nll/type_check/liveness/mod.rs +++ b/src/librustc_mir/borrow_check/nll/type_check/liveness/mod.rs @@ -23,7 +23,7 @@ mod trace; /// that indicate which types must be live at which point in the CFG. /// This vector is consumed by `constraint_generation`. /// -/// NB. This computation requires normalization; therefore, it must be +/// N.B., this computation requires normalization; therefore, it must be /// performed before pub(super) fn generate<'gcx, 'tcx>( typeck: &mut TypeChecker<'_, 'gcx, 'tcx>, diff --git a/src/librustc_mir/borrow_check/nll/type_check/liveness/trace.rs b/src/librustc_mir/borrow_check/nll/type_check/liveness/trace.rs index 77e8dd9d130e3..dd243a1d80a18 100644 --- a/src/librustc_mir/borrow_check/nll/type_check/liveness/trace.rs +++ b/src/librustc_mir/borrow_check/nll/type_check/liveness/trace.rs @@ -280,7 +280,7 @@ impl LivenessResults<'me, 'typeck, 'flow, 'gcx, 'tcx> { debug_assert!(self.drop_live_at.contains(term_point)); // Otherwise, scan backwards through the statements in the - // block. One of them may be either a definition or use + // block. One of them may be either a definition or use // live point. let term_location = self.cx.elements.to_location(term_point); debug_assert_eq!( @@ -328,7 +328,7 @@ impl LivenessResults<'me, 'typeck, 'flow, 'gcx, 'tcx> { // would have been a "use-live" transition in the earlier // loop, and we'd have returned already. // - // NB. It's possible that the pred-block ends in a call + // N.B., it's possible that the pred-block ends in a call // which stores to the variable; in that case, the // variable may be uninitialized "at exit" because this // call only considers the *unconditional effects* of the diff --git a/src/librustc_mir/borrow_check/nll/type_check/mod.rs b/src/librustc_mir/borrow_check/nll/type_check/mod.rs index 6d2fb54587ea3..6de91280bca83 100644 --- a/src/librustc_mir/borrow_check/nll/type_check/mod.rs +++ b/src/librustc_mir/borrow_check/nll/type_check/mod.rs @@ -366,7 +366,7 @@ impl<'a, 'b, 'gcx, 'tcx> TypeVerifier<'a, 'b, 'gcx, 'tcx> { constant, location ); - // FIXME(#46702) -- We need some way to get the predicates + // FIXME(#46702): we need some way to get the predicates // associated with the "pre-evaluated" form of the // constant. For example, consider that the constant // may have associated constant projections (` TypeVerifier<'a, 'b, 'gcx, 'tcx> { let tcx = self.tcx(); let type_checker = &mut self.cx; - // FIXME -- For now, use the substitutions from + // FIXME: for now, use the substitutions from // `value.ty` rather than `value.val`. The // renumberer will rewrite them to independent // sets of regions; in principle, we ought to @@ -430,7 +430,7 @@ impl<'a, 'b, 'gcx, 'tcx> TypeVerifier<'a, 'b, 'gcx, 'tcx> { }, Place::Promoted(box (_index, sty)) => { let sty = self.sanitize_type(place, sty); - // FIXME -- promoted MIR return types reference + // FIXME: promoted MIR return types reference // various "free regions" (e.g., scopes and things) // that they ought not to do. We have to figure out // how best to handle that -- probably we want treat @@ -809,10 +809,10 @@ pub enum Locations { /// older NLL analysis, we required this only at the entry point /// to the function. By the nature of the constraints, this wound /// up propagating to all points reachable from start (because - /// `'1` -- as a universal region -- is live everywhere). In the + /// `'1` -- as a universal region -- is live everywhere). In the /// newer analysis, though, this doesn't work: `_0` is considered /// dead at the start (it has no usable value) and hence this type - /// equality is basically a no-op. Then, later on, when we do `_0 + /// equality is basically a noop. Then, later on, when we do `_0 /// = &'3 y`, that region `'3` never winds up related to the /// universal region `'1` and hence no error occurs. Therefore, we /// use Locations::All instead, which ensures that the `'1` and @@ -970,7 +970,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { if let TyKind::Opaque(..) = sup.sty { // When you have `let x: impl Foo = ...` in a closure, // the resulting inferend values are stored with the - // def-id of the base function. + // def-ID of the base function. let parent_def_id = self.tcx().closure_base_def_id(self.mir_def_id); return self.eq_opaque_type_and_type(sub, sup, parent_def_id, locations, category); } else { @@ -1328,7 +1328,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { | TerminatorKind::Drop { .. } | TerminatorKind::FalseEdges { .. } | TerminatorKind::FalseUnwind { .. } => { - // no checks needed for these + // No checks needed for these. } TerminatorKind::DropAndReplace { @@ -1378,7 +1378,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { if !switch_ty.is_integral() && !switch_ty.is_char() && !switch_ty.is_bool() { span_mirbug!(self, term, "bad SwitchInt discr ty {:?}", switch_ty); } - // FIXME: check the values + // FIXME: check the values. } TerminatorKind::Call { ref func, @@ -1689,12 +1689,12 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { fn check_local(&mut self, mir: &Mir<'tcx>, local: Local, local_decl: &LocalDecl<'tcx>) { match mir.local_kind(local) { LocalKind::ReturnPointer | LocalKind::Arg => { - // return values of normal functions are required to be + // Return values of normal functions are required to be // sized by typeck, but return values of ADT constructors are // not because we don't include a `Self: Sized` bounds on them. // // Unbound parts of arguments were never required to be Sized - // - maybe we should make that a warning. + // -- maybe we should make that a warning. return; } LocalKind::Var | LocalKind::Temp => {} @@ -1712,7 +1712,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { fn ensure_place_sized(&mut self, ty: Ty<'tcx>, span: Span) { let tcx = self.tcx(); - // Erase the regions from `ty` to get a global type. The + // Erase the regions from `ty` to get a global type. The // `Sized` bound in no way depends on precise regions, so this // shouldn't affect `is_sized`. let gcx = tcx.global_tcx(); @@ -1942,7 +1942,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { self.add_reborrow_constraint(location, region, borrowed_place); } - // FIXME: These other cases have to be implemented in future PRs + // FIXME: these other cases have to be implemented in future PRs Rvalue::Use(..) | Rvalue::Len(..) | Rvalue::BinaryOp(..) @@ -1991,7 +1991,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { self.prove_aggregate_predicates(aggregate_kind, location); if *aggregate_kind == AggregateKind::Tuple { - // tuple rvalue field type is always the type of the op. Nothing to check here. + // Tuple rvalue field type is always the type of the op; nothing to check here. return; } @@ -2230,7 +2230,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { match k1.unpack() { UnpackedKind::Lifetime(r1) => { - // constraint is r1: r2 + // Constraint is `r1: r2`. let r1_vid = borrowck_context.universal_regions.to_region_vid(r1); let r2_vid = borrowck_context.universal_regions.to_region_vid(r2); let outlives_requirements = @@ -2388,7 +2388,7 @@ impl MirPass for TypeckMir { } if tcx.sess.err_count() > 0 { - // compiling a broken program can obviously result in a + // Compiling a broken program can obviously result in a // broken MIR, so try not to report duplicate errors. return; } @@ -2415,7 +2415,7 @@ impl MirPass for TypeckMir { ); // For verification purposes, we just ignore the resulting - // region constraint sets. Not our problem. =) + // region constraint sets -- not our problem. }); } } diff --git a/src/librustc_mir/borrow_check/nll/type_check/relate_tys.rs b/src/librustc_mir/borrow_check/nll/type_check/relate_tys.rs index 74ad7d988cc1a..8232bc921faed 100644 --- a/src/librustc_mir/borrow_check/nll/type_check/relate_tys.rs +++ b/src/librustc_mir/borrow_check/nll/type_check/relate_tys.rs @@ -14,7 +14,7 @@ use rustc::ty::{self, Ty}; /// - "Invariant" `a == b` /// - "Contravariant" `a :> b` /// -/// NB. The type `a` is permitted to have unresolved inference +/// N.B., the type `a` is permitted to have unresolved inference /// variables, but not the type `b`. pub(super) fn relate_types<'tcx>( infcx: &InferCtxt<'_, '_, 'tcx>, diff --git a/src/librustc_mir/borrow_check/nll/universal_regions.rs b/src/librustc_mir/borrow_check/nll/universal_regions.rs index c63d45ce1d272..c75316b07ae06 100644 --- a/src/librustc_mir/borrow_check/nll/universal_regions.rs +++ b/src/librustc_mir/borrow_check/nll/universal_regions.rs @@ -61,14 +61,14 @@ pub struct UniversalRegions<'tcx> { /// The return type of this function, with all regions replaced by /// their universal `RegionVid` equivalents. /// - /// NB. Associated types in this type have not been normalized, + /// N.B., associated types in this type have not been normalized, /// as the name suggests. =) pub unnormalized_output_ty: Ty<'tcx>, /// The fully liberated input types of this function, with all /// regions replaced by their universal `RegionVid` equivalents. /// - /// NB. Associated types in these types have not been normalized, + /// N.B., associated types in these types have not been normalized, /// as the name suggests. =) pub unnormalized_input_tys: &'tcx [Ty<'tcx>], @@ -92,7 +92,7 @@ pub enum DefiningTy<'tcx> { /// `ClosureSubsts::generator_return_ty`. Generator(DefId, ty::GeneratorSubsts<'tcx>, hir::GeneratorMovability), - /// The MIR is a fn item with the given def-id and substs. The signature + /// The MIR is a fn item with the given def-ID and substs. The signature /// of the function can be bound then with the `fn_sig` query. FnDef(DefId, &'tcx Substs<'tcx>), @@ -317,9 +317,9 @@ impl<'tcx> UniversalRegions<'tcx> { &substs.substs[..] )); - // FIXME: It'd be nice to print the late-bound regions + // FIXME: it'd be nice to print the late-bound regions // here, but unfortunately these wind up stored into - // tests, and the resulting print-outs include def-ids + // tests, and the resulting print-outs include def-IDs // and other things that are not stable across tests! // So we just include the region-vid. Annoying. let closure_base_def_id = tcx.closure_base_def_id(def_id); @@ -337,7 +337,7 @@ impl<'tcx> UniversalRegions<'tcx> { &substs.substs[..] )); - // FIXME: As above, we'd like to print out the region + // FIXME: as above, we'd like to print out the region // `r` but doing so is not stable across architectures // and so forth. let closure_base_def_id = tcx.closure_base_def_id(def_id); @@ -572,7 +572,7 @@ impl<'cx, 'gcx, 'tcx> UniversalRegionsBuilder<'cx, 'gcx, 'tcx> { inputs_and_output, |closure_ty, inputs_and_output| { // The "inputs" of the closure in the - // signature appear as a tuple. The MIR side + // signature appear as a tuple. The MIR side // flattens this tuple. let (&output, tuplized_inputs) = inputs_and_output.split_last().unwrap(); assert_eq!(tuplized_inputs.len(), 1, "multiple closure inputs"); @@ -691,7 +691,7 @@ impl<'cx, 'gcx, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'cx, 'gcx, 'tcx> { /// indices vector. Typically, we identify late-bound regions as we process the inputs and /// outputs of the closure/function. However, sometimes there are late-bound regions which do /// not appear in the fn parameters but which are nonetheless in scope. The simplest case of - /// this are unused functions, like fn foo<'a>() { } (see eg., #51351). Despite not being used, + /// this are unused functions, like fn foo<'a>() { } (see e.g., #51351). Despite not being used, /// users can still reference these regions (e.g., let x: &'a u32 = &22;), so we need to create /// entries for them and store them in the indices map. This code iterates over the complete /// set of late-bound regions and checks for any that we have not yet seen, adding them to the diff --git a/src/librustc_mir/borrow_check/path_utils.rs b/src/librustc_mir/borrow_check/path_utils.rs index 6875aced8d231..ddbf74f40bcbf 100644 --- a/src/librustc_mir/borrow_check/path_utils.rs +++ b/src/librustc_mir/borrow_check/path_utils.rs @@ -8,7 +8,7 @@ use rustc::mir::{ProjectionElem, BorrowKind}; use rustc::ty::TyCtxt; use rustc_data_structures::graph::dominators::Dominators; -/// Returns true if the borrow represented by `kind` is +/// Returns whether the borrow represented by `kind` is /// allowed to be split into separate Reservation and /// Activation phases. pub(super) fn allow_two_phase_borrow<'a, 'tcx, 'gcx: 'tcx>( @@ -39,15 +39,15 @@ pub(super) fn each_borrow_involving_path<'a, 'tcx, 'gcx: 'tcx, F, I, S> ( mut op: F, ) where F: FnMut(&mut S, BorrowIndex, &BorrowData<'tcx>) -> Control, - I: Iterator + I: Iterator { let (access, place) = access_place; - // FIXME: analogous code in check_loans first maps `place` to - // its base_path. + // FIXME: analogous code in `check_loans` first maps `place` to + // its `base_path`. - // check for loan restricting path P being used. Accounts for - // borrows of P, P.a.b, etc. + // Check for loan restricting path `P` being used. Accounts for + // borrows of `P`, `P.a.b`, etc. for i in candidates { let borrowed = &borrow_set[i]; diff --git a/src/librustc_mir/borrow_check/place_ext.rs b/src/librustc_mir/borrow_check/place_ext.rs index 4d0b25b1024a3..12b2635ee947a 100644 --- a/src/librustc_mir/borrow_check/place_ext.rs +++ b/src/librustc_mir/borrow_check/place_ext.rs @@ -6,7 +6,7 @@ use borrow_check::borrow_set::LocalsStateAtExit; /// Extension methods for the `Place` type. crate trait PlaceExt<'tcx> { - /// Returns true if we can safely ignore borrows of this place. + /// Returns whether we can safely ignore borrows of this place. /// This is true whenever there is no action that the user can do /// to the place `self` that would invalidate the borrow. This is true /// for borrows of raw pointer dereferents as well as shared references. @@ -67,7 +67,7 @@ impl<'tcx> PlaceExt<'tcx> for Place<'tcx> { match ty.sty { // For both derefs of raw pointers and `&T` // references, the original path is `Copy` and - // therefore not significant. In particular, + // therefore not significant. In particular, // there is nothing the user can do to the // original path that would invalidate the // newly created reference -- and if there diff --git a/src/librustc_mir/build/expr/as_place.rs b/src/librustc_mir/build/expr/as_place.rs index d651b6bdca01f..4c1931a22f2ba 100644 --- a/src/librustc_mir/build/expr/as_place.rs +++ b/src/librustc_mir/build/expr/as_place.rs @@ -73,7 +73,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { let (usize_ty, bool_ty) = (this.hir.usize_ty(), this.hir.bool_ty()); let slice = unpack!(block = this.as_place(block, lhs)); - // region_scope=None so place indexes live forever. They are scalars so they + // `region_scope = None`, so place indexes live forever. They are scalars so they // do not need storage annotations, and they are often copied between // places. // Making this a *fresh* temporary also means we do not have to worry about diff --git a/src/librustc_mir/build/expr/stmt.rs b/src/librustc_mir/build/expr/stmt.rs index 1cbc60586c356..9fb816a025f2b 100644 --- a/src/librustc_mir/build/expr/stmt.rs +++ b/src/librustc_mir/build/expr/stmt.rs @@ -65,7 +65,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { // question raised here -- should we "freeze" the // value of the lhs here? I'm inclined to think not, // since it seems closer to the semantics of the - // overloaded version, which takes `&mut self`. This + // overloaded version, which takes `&mut self`. This // only affects weird things like `x += {x += 1; x}` // -- is that equal to `x + (x + 1)` or `2*(x+1)`? diff --git a/src/librustc_mir/build/matches/mod.rs b/src/librustc_mir/build/matches/mod.rs index 86dbf1422738a..6181583c4914a 100644 --- a/src/librustc_mir/build/matches/mod.rs +++ b/src/librustc_mir/build/matches/mod.rs @@ -623,7 +623,7 @@ struct Binding<'tcx> { } /// Indicates that the type of `source` must be a subtype of the -/// user-given type `user_ty`; this is basically a no-op but can +/// user-given type `user_ty`; this is basically a noop but can /// influence region inference. #[derive(Clone, Debug)] struct Ascription<'tcx> { @@ -1600,10 +1600,10 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { borrowed_input_temps.push(borrowed_input_temp); } - // FIXME: This could be a lot of reads (#fake borrows * #patterns). + // FIXME: this could be a lot of reads (`#fake borrows * #patterns`). // The false edges that we currently generate would allow us to only do - // this on the last Candidate, but it's possible that there might not be - // so many false edges in the future, so we read for all Candidates for + // this on the last `Candidate`, but it's possible that there might not be + // so many false edges in the future, so we read for all `Candidate`s for // now. // Another option would be to make our own block and add our own false // edges to it. diff --git a/src/librustc_mir/build/matches/simplify.rs b/src/librustc_mir/build/matches/simplify.rs index 7692ad4e6834c..0f62c674979ee 100644 --- a/src/librustc_mir/build/matches/simplify.rs +++ b/src/librustc_mir/build/matches/simplify.rs @@ -93,7 +93,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { } PatternKind::Constant { .. } => { - // FIXME normalize patterns when possible + // FIXME: normalize patterns when possible Err(match_pair) } diff --git a/src/librustc_mir/build/matches/test.rs b/src/librustc_mir/build/matches/test.rs index 21109a223bf77..e1d460744d21c 100644 --- a/src/librustc_mir/build/matches/test.rs +++ b/src/librustc_mir/build/matches/test.rs @@ -1,4 +1,4 @@ -// Testing candidates +// Testing candidates. // // After candidates have been simplified, the only match pairs that // remain are those that require some sort of test. The functions here @@ -179,7 +179,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { let source_info = self.source_info(test.span); match test.kind { TestKind::Switch { adt_def, ref variants } => { - // Variants is a BitVec of indexes into adt_def.variants. + // Variants is a `BitVec` of indexes into `adt_def.variants`. let num_enum_variants = adt_def.variants.len(); let used_variants = variants.count(); let mut otherwise_block = None; @@ -232,7 +232,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { true_bb, false_bb)) } else { // The switch may be inexhaustive so we - // add a catch all block + // add a catch all block. let otherwise = self.cfg.start_new_block(); let targets: Vec<_> = options.iter() @@ -253,12 +253,12 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { TestKind::Eq { value, mut ty } => { let val = Operand::Copy(place.clone()); let mut expect = self.literal_operand(test.span, ty, value); - // Use PartialEq::eq instead of BinOp::Eq - // (the binop can only handle primitives) + // Use `PartialEq::eq` instead of `BinOp::Eq` + // (the binop can only handle primitives). let fail = self.cfg.start_new_block(); if !ty.is_scalar() { - // If we're using b"..." as a pattern, we need to insert an - // unsizing coercion, as the byte string has the type &[u8; N]. + // If we're using `b"..."` as a pattern, we need to insert an + // unsizing coercion, as the byte string has the type `&[u8; N]`. // // We want to do this even when the scrutinee is a reference to an // array, so we can call `<[u8]>::eq` rather than having to find an @@ -274,12 +274,12 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { let opt_ref_test_ty = unsize(value.ty); let mut place = place.clone(); match (opt_ref_ty, opt_ref_test_ty) { - // nothing to do, neither is an array + // Nothing to do, since neither is an array. (None, None) => {}, (Some((region, elem_ty, _)), _) | (None, Some((region, elem_ty, _))) => { let tcx = self.hir.tcx(); - // make both a slice + // Make both a slice. ty = tcx.mk_imm_ref(region, tcx.mk_slice(elem_ty)); if opt_ref_ty.is_some() { place = self.temp(ty, test.span); @@ -303,7 +303,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { let eq_def_id = self.hir.tcx().lang_items().eq_trait().unwrap(); let (mty, method) = self.hir.trait_method(eq_def_id, "eq", ty, &[ty.into()]); - // take the argument by reference + // Take the argument by reference. let region_scope = self.topmost_scope(); let region = self.hir.tcx().mk_region(ty::ReScope(region_scope)); let tam = ty::TypeAndMut { @@ -312,17 +312,17 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { }; let ref_ty = self.hir.tcx().mk_ref(region, tam); - // let lhs_ref_place = &lhs; + // `let lhs_ref_place = &lhs;` let ref_rvalue = Rvalue::Ref(region, BorrowKind::Shared, place); let lhs_ref_place = self.temp(ref_ty, test.span); self.cfg.push_assign(block, source_info, &lhs_ref_place, ref_rvalue); let val = Operand::Move(lhs_ref_place); - // let rhs_place = rhs; + // `let rhs_place = rhs;` let rhs_place = self.temp(ty, test.span); self.cfg.push_assign(block, source_info, &rhs_place, Rvalue::Use(expect)); - // let rhs_ref_place = &rhs_place; + // `let rhs_ref_place = &rhs_place;` let ref_rvalue = Rvalue::Ref(region, BorrowKind::Shared, rhs_place); let rhs_ref_place = self.temp(ref_ty, test.span); self.cfg.push_assign(block, source_info, &rhs_ref_place, ref_rvalue); @@ -337,12 +337,11 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { span: test.span, ty: mty, - // FIXME(#54571): This constant comes from user - // input (a constant in a pattern). Are + // FIXME(#54571): this constant comes from user + // input (a constant in a pattern). Are // there forms where users can add type - // annotations here? For example, an - // associated constant? Need to - // experiment. + // annotations here? For example, an + // associated constant? Need to experiment. user_ty: None, literal: method, @@ -353,7 +352,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { from_hir_call: false, }); - // check the result + // Check the result. let block = self.cfg.start_new_block(); self.cfg.terminate(eq_block, source_info, TerminatorKind::if_(self.hir.tcx(), @@ -387,20 +386,20 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { let (actual, result) = (self.temp(usize_ty, test.span), self.temp(bool_ty, test.span)); - // actual = len(place) + // `actual == len(place)` self.cfg.push_assign(block, source_info, &actual, Rvalue::Len(place.clone())); - // expected = + // `expected == ` let expected = self.push_usize(block, source_info, len); - // result = actual == expected OR result = actual < expected + // `result == actual == expected` OR `result == actual < expected` self.cfg.push_assign(block, source_info, &result, Rvalue::BinaryOp(op, Operand::Move(actual), Operand::Move(expected))); - // branch based on result + // Branch based on result. let (false_bb, true_bb) = (self.cfg.start_new_block(), self.cfg.start_new_block()); self.cfg.terminate(block, source_info, @@ -421,12 +420,12 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { let bool_ty = self.hir.bool_ty(); let result = self.temp(bool_ty, span); - // result = op(left, right) + // `result == op(left, right)` let source_info = self.source_info(span); self.cfg.push_assign(block, source_info, &result, Rvalue::BinaryOp(op, left, right)); - // branch based on result + // Branch based on result. let target_block = self.cfg.start_new_block(); self.cfg.terminate(block, source_info, TerminatorKind::if_(self.hir.tcx(), Operand::Move(result), @@ -456,8 +455,8 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { /// algorithm to structure the match as a whole. See `match_candidates` for /// more details. /// - /// FIXME(#29623). In some cases, we have some tricky choices to - /// make. for example, if we are testing that `x == 22`, but the + /// FIXME(#29623): in some cases, we have some tricky choices to + /// make. for example, if we are testing that `x == 22`, but the /// candidate is `x @ 13..55`, what should we do? In the event /// that the test is true, we know that the candidate applies, but /// in the event of false, we don't know that it *doesn't* @@ -470,7 +469,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { candidate: &Candidate<'pat, 'tcx>, resulting_candidates: &mut [Vec>]) -> bool { - // Find the match_pair for this place (if any). At present, + // Find the `match_pair` for this place (if any). At present, // afaik, there can be at most one. (In the future, if we // adopted a more general `@` operator, there might be more // than one, but it'd be very unusual to have two sides that @@ -508,7 +507,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { // If we are performing a switch over integers, then this informs integer // equality, but nothing else. // - // FIXME(#29623) we could use PatternKind::Range to rule + // FIXME(#29623): we could use `PatternKind::Range` to rule // things out here, in some cases. (&TestKind::SwitchInt { switch_ty: _, options: _, ref indices }, &PatternKind::Constant { ref value }) @@ -545,8 +544,8 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { let pat_len = (prefix.len() + suffix.len()) as u64; match (test_len.cmp(&pat_len), slice) { (Ordering::Equal, &None) => { - // on true, min_len = len = $actual_length, - // on false, len != $actual_length + // On true, `min_len == len == $actual_length`. + // On false, `len != $actual_length`. resulting_candidates[0].push( self.candidate_after_slice_test(match_pair_index, candidate, @@ -557,20 +556,20 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { true } (Ordering::Less, _) => { - // test_len < pat_len. If $actual_len = test_len, - // then $actual_len < pat_len and we don't have + // `test_len < pat_len`. If `$actual_len == test_len`, + // then also`$actual_len < pat_len`, and we don't have // enough elements. resulting_candidates[1].push(candidate.clone()); true } (Ordering::Equal, &Some(_)) | (Ordering::Greater, &Some(_)) => { - // This can match both if $actual_len = test_len >= pat_len, - // and if $actual_len > test_len. We can't advance. + // This can match both if `$actual_len == test_len >= pat_len`, + // and if `$actual_len > test_len`. We can't advance. false } (Ordering::Greater, &None) => { - // test_len != pat_len, so if $actual_len = test_len, then - // $actual_len != pat_len. + // `test_len != pat_len`, so if `$actual_len == test_len`, then + // `$actual_len != pat_len`. resulting_candidates[1].push(candidate.clone()); true } @@ -579,11 +578,11 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { (&TestKind::Len { len: test_len, op: BinOp::Ge }, &PatternKind::Slice { ref prefix, ref slice, ref suffix }) => { - // the test is `$actual_len >= test_len` + // The test is `$actual_len >= test_len`. let pat_len = (prefix.len() + suffix.len()) as u64; match (test_len.cmp(&pat_len), slice) { (Ordering::Equal, &Some(_)) => { - // $actual_len >= test_len = pat_len, + // `$actual_len >= test_len == pat_len`, // so we can match. resulting_candidates[0].push( self.candidate_after_slice_test(match_pair_index, @@ -595,20 +594,20 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { true } (Ordering::Less, _) | (Ordering::Equal, &None) => { - // test_len <= pat_len. If $actual_len < test_len, - // then it is also < pat_len, so the test passing is + // `test_len <= pat_len`. If `$actual_len < test_len`, + // then it is also `< pat_len`, so the test passing is // necessary (but insufficient). resulting_candidates[0].push(candidate.clone()); true } (Ordering::Greater, &None) => { - // test_len > pat_len. If $actual_len >= test_len > pat_len, + // `test_len > pat_len`. If `$actual_len >= test_len > pat_len`, // then we know we won't have a match. resulting_candidates[1].push(candidate.clone()); true } (Ordering::Greater, &Some(_)) => { - // test_len < pat_len, and is therefore less + // `test_len < pat_len`, and is therefore less // strict. This can still go both ways. false } @@ -637,10 +636,10 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { let hi = compare_const_vals(tcx, test.hi, pat.lo, param_env)?; match (test.end, pat.end, lo, hi) { - // pat < test + // `pat < test` (_, _, Greater, _) | (_, Excluded, Equal, _) | - // pat > test + // `pat > test` (_, _, _, Less) | (Excluded, _, _, Equal) => Some(true), _ => Some(false), @@ -675,7 +674,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { (&TestKind::Len { .. }, _) => { // These are all binary tests. // - // FIXME(#29623) we can be more clever here + // FIXME(#29623): we can be more clever here. let pattern_test = self.test(&match_pair); if pattern_test.kind == test.kind { let new_candidate = self.candidate_without_match_pair(match_pair_index, @@ -744,7 +743,8 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { // we want to create a set of derived match-patterns like // `(x as Variant).0 @ P1` and `(x as Variant).1 @ P1`. let elem = ProjectionElem::Downcast(adt_def, variant_index); - let downcast_place = match_pair.place.clone().elem(elem); // `(x as Variant)` + // I.e., `(x as Variant)`. + let downcast_place = match_pair.place.clone().elem(elem); let consequent_match_pairs = subpatterns.iter() .map(|subpattern| { diff --git a/src/librustc_mir/build/mod.rs b/src/librustc_mir/build/mod.rs index a700963749f67..bdd9292ad97c0 100644 --- a/src/librustc_mir/build/mod.rs +++ b/src/librustc_mir/build/mod.rs @@ -26,7 +26,7 @@ use util as mir_util; use super::lints; -/// Construct the MIR for a given def-id. +/// Construct the MIR for a given def-ID. pub fn mir_build<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Mir<'tcx> { let id = tcx.hir().as_local_node_id(def_id).unwrap(); @@ -76,8 +76,8 @@ pub fn mir_build<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Mir<'t let mut mir = if cx.tables().tainted_by_errors { build::construct_error(cx, body_id) } else if let hir::BodyOwnerKind::Fn = cx.body_owner_kind { - // fetch the fully liberated fn signature (that is, all bound - // types/lifetimes replaced) + // Fetch the fully liberated fn signature (that is, all bound + // types/lifetimes replaced). let fn_hir_id = tcx.hir().node_to_hir_id(id); let fn_sig = cx.tables().liberated_fn_sigs()[fn_hir_id].clone(); let fn_def_id = tcx.hir().local_def_id(id); @@ -86,7 +86,7 @@ pub fn mir_build<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Mir<'t let mut abi = fn_sig.abi; let implicit_argument = match ty.sty { ty::Closure(..) => { - // HACK(eddyb) Avoid having RustCall on closures, + // HACK(eddyb): avoid having `RustCall` on closures, // as it adds unnecessary (and wrong) auto-tupling. abi = Abi::Rust; Some(ArgInfo(liberated_closure_env_ty(tcx, id, body_id), None, None, None)) @@ -154,7 +154,7 @@ pub fn mir_build<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Mir<'t build::construct_const(cx, body_id, return_ty_span) }; - // Convert the Mir to global types. + // Convert the MIR to global types. let mut globalizer = GlobalizeMir { tcx, span: mir.span @@ -173,9 +173,9 @@ pub fn mir_build<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Mir<'t }) } -/// A pass to lift all the types and substitutions in a Mir +/// A pass to lift all the types and substitutions in a MIR /// to the global tcx. Sadly, we don't have a "folder" that -/// can change 'tcx so we have to transmute afterwards. +/// can change `'tcx` so we have to transmute afterwards. struct GlobalizeMir<'a, 'gcx: 'a> { tcx: TyCtxt<'a, 'gcx, 'gcx>, span: Span @@ -233,7 +233,7 @@ fn create_constructor_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, tcx.infer_ctxt().enter(|infcx| { let mut mir = shim::build_adt_ctor(&infcx, ctor_id, fields, span); - // Convert the Mir to global types. + // Convert the MIR to global types. let tcx = infcx.tcx.global_tcx(); let mut globalizer = GlobalizeMir { tcx, @@ -335,11 +335,11 @@ struct Builder<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { fn_span: Span, arg_count: usize, - /// the current set of scopes, updated as we traverse; - /// see the `scope` module for more details + /// The current set of scopes, updated as we traverse; + /// see the `scope` module for more details. scopes: Vec>, - /// the block-context: each time we build the code within an hair::Block, + /// The block-context: each time we build the code within an hair::Block, /// we push a frame here tracking whether we are building a statement or /// if we are pushing the tail expression of the block. This is used to /// embed information in generated temps about whether they were created @@ -350,44 +350,44 @@ struct Builder<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { /// the code generation in ways that we cannot (or should not) /// start just throwing new entries onto that vector in order to /// distinguish the context of EXPR1 from the context of EXPR2 in - /// `{ STMTS; EXPR1 } + EXPR2` + /// `{ STMTS; EXPR1 } + EXPR2`. block_context: BlockContext, /// The current unsafe block in scope, even if it is hidden by - /// a PushUnsafeBlock + /// a `PushUnsafeBlock`. unpushed_unsafe: Safety, - /// The number of `push_unsafe_block` levels in scope + /// The number of `push_unsafe_block` levels in scope. push_unsafe_count: usize, - /// the current set of breakables; see the `scope` module for more - /// details + /// The current set of breakables; see the `scope` module for more + /// details. breakable_scopes: Vec>, - /// the vector of all scopes that we have created thus far; - /// we track this for debuginfo later + /// The vector of all scopes that we have created thus far; + /// we track this for debuginfo later. source_scopes: IndexVec, source_scope_local_data: IndexVec, source_scope: SourceScope, - /// the guard-context: each time we build the guard expression for + /// The guard-context: each time we build the guard expression for /// a match arm, we push onto this stack, and then pop when we /// finish building it. guard_context: Vec, - /// Maps node ids of variable bindings to the `Local`s created for them. + /// Maps node-IDs of variable bindings to the `Local`s created for them. /// (A match binding can have two locals; the 2nd is for the arm's guard.) var_indices: NodeMap, local_decls: IndexVec>, upvar_decls: Vec, unit_temp: Option>, - /// cached block with the RESUME terminator; this is created + /// Cached block with the `RESUME` terminator; this is created /// when first set of cleanups are built. cached_resume_block: Option, - /// cached block with the RETURN terminator + /// Cached block with the `RETURN` terminator. cached_return_block: Option, - /// cached block with the UNREACHABLE terminator + /// Cached block with the `UNREACHABLE` terminator. cached_unreachable_block: Option, } @@ -406,7 +406,7 @@ impl BlockContext { fn push(&mut self, bf: BlockFrame) { self.0.push(bf); } fn pop(&mut self) -> Option { self.0.pop() } - /// Traverses the frames on the BlockContext, searching for either + /// Traverses the frames on the `BlockContext`, searching for either /// the first block-tail expression frame with no intervening /// statement frame. /// @@ -452,13 +452,13 @@ impl BlockContext { #[derive(Debug)] enum LocalsForNode { - /// In the usual case, a node-id for an identifier maps to at most - /// one Local declaration. + /// In the usual case, a node-ID for an identifier maps to at most + /// one `Local` declaration. One(Local), /// The exceptional case is identifiers in a match arm's pattern /// that are referenced in a guard of that match arm. For these, - /// we can have `2+k` Locals, where `k` is the number of candidate + /// we can have `2 + k` Locals, where `k` is the number of candidate /// patterns (separated by `|`) in the arm. /// /// * `for_arm_body` is the Local used in the arm body (which is @@ -504,11 +504,11 @@ struct GuardFrame { /// P1(id1) if (... (match E2 { P2(id2) if ... => B2 })) => B1, /// } /// - /// here, when building for FIXME + /// here, when building for FIXME. locals: Vec, } -/// ForGuard indicates whether we are talking about: +/// `ForGuard` indicates whether we are talking about: /// 1. the temp for a local binding used solely within guard expressions, /// 2. the temp that holds reference to (1.), which is actually what the /// guard expressions see, or @@ -597,16 +597,16 @@ fn should_abort_on_panic<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>, fn_def_id: DefId, abi: Abi) -> bool { - // Not callable from C, so we can safely unwind through these + // Not callable from C, so we can safely unwind through these. if abi == Abi::Rust || abi == Abi::RustCall { return false; } - // We never unwind, so it's not relevant to stop an unwind + // We never unwind, so it's not relevant to stop an unwind. if tcx.sess.panic_strategy() != PanicStrategy::Unwind { return false; } - // We cannot add landing pads, so don't add one + // We cannot add landing pads, so don't add one. if tcx.sess.no_landing_pads() { return false; } - // This is a special case: some functions have a C abi but are meant to + // This is a special case: some functions have a C ABI but are meant to // unwind anyway. Don't stop them. let attrs = &tcx.get_attrs(fn_def_id); match attr::find_unwind_attr(Some(tcx.sess.diagnostic()), attrs) { @@ -634,7 +634,7 @@ fn construct_fn<'a, 'gcx, 'tcx, A>(hir: Cx<'a, 'gcx, 'tcx>, return_ty_span: Span, body: &'gcx hir::Body) -> Mir<'tcx> - where A: Iterator> + where A: Iterator> { let arguments: Vec<_> = arguments.collect(); @@ -709,7 +709,7 @@ fn construct_fn<'a, 'gcx, 'tcx, A>(hir: Cx<'a, 'gcx, 'tcx>, unpack!(block = builder.in_scope(arg_scope_s, LintLevel::Inherited, block, |builder| { builder.args_and_body(block, &arguments, arg_scope, &body.value) })); - // Attribute epilogue to function's closing brace + // Attribute epilogue to function's closing brace. let fn_end = span.shrink_to_hi(); let source_info = builder.source_info(fn_end); let return_block = builder.return_block(); @@ -717,7 +717,7 @@ fn construct_fn<'a, 'gcx, 'tcx, A>(hir: Cx<'a, 'gcx, 'tcx>, TerminatorKind::Goto { target: return_block }); builder.cfg.terminate(return_block, source_info, TerminatorKind::Return); - // Attribute any unreachable codepaths to the function's closing brace + // Attribute any unreachable codepaths to the function's closing brace. if let Some(unreachable_block) = builder.cached_unreachable_block { builder.cfg.terminate(unreachable_block, source_info, TerminatorKind::Unreachable); @@ -859,7 +859,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { ast_body: &'gcx hir::Expr) -> BlockAnd<()> { - // Allocate locals for the function arguments + // Allocate locals for the function arguments. for &ArgInfo(ty, _, pattern, _) in arguments.iter() { // If this is a simple binding pattern, give the local a name for // debuginfo and so that error reporting knows that this is a user @@ -894,9 +894,9 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { } let mut scope = None; - // Bind the argument patterns + // Bind the argument patterns. for (index, arg_info) in arguments.iter().enumerate() { - // Function arguments always get the first Local indices after the return place + // Function arguments always get the first Local indices after the return place. let local = Local::new(index + 1); let place = Place::Local(local); let &ArgInfo(ty, opt_ty_info, pattern, ref self_binding) = arg_info; @@ -906,7 +906,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { let span = pattern.span; match *pattern.kind { - // Don't introduce extra copies for simple bindings + // Don't introduce extra copies for simple bindings. PatternKind::Binding { mutability, var, mode: BindingMode::ByValue, .. } => { self.local_decls[local].mutability = mutability; self.local_decls[local].is_user_variable = diff --git a/src/librustc_mir/build/scope.rs b/src/librustc_mir/build/scope.rs index b44c2cc9c166a..66fdf0793c1f2 100644 --- a/src/librustc_mir/build/scope.rs +++ b/src/librustc_mir/build/scope.rs @@ -685,7 +685,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { let this_scope = scope.region_scope == region_scope; // When building drops, we try to cache chains of drops in such a way so these drops // could be reused by the drops which would branch into the cached (already built) - // blocks. This, however, means that whenever we add a drop into a scope which already + // blocks. This, however, means that whenever we add a drop into a scope which already // had some blocks built (and thus, cached) for it, we must invalidate all caches which // might branch into the scope which had a drop just added to it. This is necessary, // because otherwise some other code might use the cache to branch into already built diff --git a/src/librustc_mir/const_eval.rs b/src/librustc_mir/const_eval.rs index b9432997b7e19..6f0cd7ab47133 100644 --- a/src/librustc_mir/const_eval.rs +++ b/src/librustc_mir/const_eval.rs @@ -1,4 +1,4 @@ -// Not in interpret to make sure we do not use private implementation details +// This is not in interpret to make sure we do not use private implementation details. use std::fmt; use std::error::Error; @@ -44,8 +44,8 @@ pub fn mk_borrowck_eval_cx<'a, 'mir, 'tcx>( debug!("mk_borrowck_eval_cx: {:?}", instance); let param_env = tcx.param_env(instance.def_id()); let mut ecx = EvalContext::new(tcx.at(span), param_env, CompileTimeInterpreter::new()); - // insert a stack frame so any queries have the correct substs - // cannot use `push_stack_frame`; if we do `const_prop` explodes + // Insert a stack frame so any queries have the correct substs + // cannot use `push_stack_frame`; if we do, the `const_prop` explodes. ecx.stack.push(interpret::Frame { block: mir::START_BLOCK, locals: IndexVec::new(), @@ -69,7 +69,7 @@ pub fn mk_eval_cx<'a, 'tcx>( let span = tcx.def_span(instance.def_id()); let mut ecx = EvalContext::new(tcx.at(span), param_env, CompileTimeInterpreter::new()); let mir = ecx.load_mir(instance.def)?; - // insert a stack frame so any queries have the correct substs + // Insert a stack frame so any queries have the correct substitutions. ecx.push_stack_frame( instance, mir.span, @@ -90,18 +90,18 @@ pub(crate) fn eval_promoted<'a, 'mir, 'tcx>( eval_body_using_ecx(&mut ecx, cid, Some(mir), param_env) } -// FIXME: These two conversion functions are bad hacks. We should just always use allocations. +// FIXME: these two conversion functions are bad hacks. We should just always use allocations. pub fn op_to_const<'tcx>( ecx: &CompileTimeEvalContext<'_, '_, 'tcx>, op: OpTy<'tcx>, may_normalize: bool, ) -> EvalResult<'tcx, &'tcx ty::Const<'tcx>> { - // We do not normalize just any data. Only scalar layout and fat pointers. + // We do not normalize just any data, only scalar layout and fat pointers. let normalize = may_normalize && match op.layout.abi { layout::Abi::Scalar(..) => true, layout::Abi::ScalarPair(..) => { - // Must be a fat pointer + // Must be a fat pointer. op.layout.ty.builtin_deref(true).is_some() }, _ => false, @@ -116,7 +116,7 @@ pub fn op_to_const<'tcx>( }; let val = match normalized_op { Err(MemPlace { ptr, align, meta }) => { - // extract alloc-offset pair + // Extract alloc-offset pair. assert!(meta.is_none()); let ptr = ptr.to_ptr()?; let alloc = ecx.memory.get(ptr.alloc_id)?; @@ -124,8 +124,8 @@ pub fn op_to_const<'tcx>( assert!(alloc.bytes.len() as u64 - ptr.offset.bytes() >= op.layout.size.bytes()); let mut alloc = alloc.clone(); alloc.align = align; - // FIXME shouldn't it be the case that `mark_static_initialized` has already - // interned this? I thought that is the entire point of that `FinishStatic` stuff? + // FIXME: shouldn't it be the case that `mark_static_initialized` has already + // interned this? I thought that is the entire point of that `FinishStatic` stuff? let alloc = ecx.tcx.intern_const_alloc(alloc); ConstValue::ByRef(ptr.alloc_id, alloc, ptr.offset) }, @@ -150,8 +150,8 @@ fn eval_body_and_ecx<'a, 'mir, 'tcx>( mir: Option<&'mir mir::Mir<'tcx>>, param_env: ty::ParamEnv<'tcx>, ) -> (EvalResult<'tcx, MPlaceTy<'tcx>>, CompileTimeEvalContext<'a, 'mir, 'tcx>) { - // we start out with the best span we have - // and try improving it down the road when more information is available + // We start out with the best span we have, and try improving it down the road when more + // information becomes available. let span = tcx.def_span(cid.instance.def_id()); let span = mir.map(|mir| mir.span).unwrap_or(span); let mut ecx = EvalContext::new(tcx.at(span), param_env, CompileTimeInterpreter::new()); @@ -159,7 +159,7 @@ fn eval_body_and_ecx<'a, 'mir, 'tcx>( (r, ecx) } -// Returns a pointer to where the result lives +// Returns a pointer to where the result lives. fn eval_body_using_ecx<'mir, 'tcx>( ecx: &mut CompileTimeEvalContext<'_, 'mir, 'tcx>, cid: GlobalId<'tcx>, @@ -194,7 +194,7 @@ fn eval_body_using_ecx<'mir, 'tcx>( // The main interpreter loop. ecx.run()?; - // Intern the result + // Intern the result. let internally_mutable = !layout.ty.is_freeze(tcx, param_env, mir.span); let is_static = tcx.is_static(cid.instance.def_id()); let mutability = if is_static == Some(hir::Mutability::MutMutable) || internally_mutable { @@ -247,7 +247,7 @@ impl Error for ConstEvalError { } } -// Extra machine state for CTFE, and the Machine instance +// Extra machine state for CTFE, and the machine instance. pub struct CompileTimeInterpreter<'a, 'mir, 'tcx: 'a+'mir> { /// When this value is negative, it indicates the number of interpreter /// steps *until* the loop detector is enabled. When it is positive, it is @@ -335,7 +335,7 @@ type CompileTimeEvalContext<'a, 'mir, 'tcx> = impl interpret::MayLeak for ! { #[inline(always)] fn may_leak(self) -> bool { - // `self` is uninhabited + // `self` is uninhabited. self } } @@ -352,11 +352,13 @@ impl<'a, 'mir, 'tcx> interpret::Machine<'a, 'mir, 'tcx> type MemoryMap = FxHashMap, Allocation)>; - const STATIC_KIND: Option = None; // no copying of statics allowed + // No copying of statics is allowed. + const STATIC_KIND: Option = None; #[inline(always)] fn enforce_validity(_ecx: &EvalContext<'a, 'mir, 'tcx, Self>) -> bool { - false // for now, we don't enforce validity + // For now, we don't enforce validity. + false } fn find_fn( @@ -368,7 +370,7 @@ impl<'a, 'mir, 'tcx> interpret::Machine<'a, 'mir, 'tcx> ) -> EvalResult<'tcx, Option<&'mir mir::Mir<'tcx>>> { debug!("eval_fn_call: {:?}", instance); // Execution might have wandered off into other crates, so we cannot to a stability- - // sensitive check here. But we can at least rule out functions that are not const + // sensitive check here. But we can at least rule out functions that are not const // at all. if !ecx.tcx.is_const_fn_raw(instance.def_id()) { // Some functions we support even if they are non-const -- but avoid testing @@ -381,7 +383,7 @@ impl<'a, 'mir, 'tcx> interpret::Machine<'a, 'mir, 'tcx> err!(MachineError(format!("calling non-const function `{}`", instance))) }; } - // This is a const fn. Call it. + // This is a const fn; call it. Ok(Some(match ecx.load_mir(instance.def) { Ok(mir) => mir, Err(err) => { @@ -405,7 +407,7 @@ impl<'a, 'mir, 'tcx> interpret::Machine<'a, 'mir, 'tcx> if ecx.emulate_intrinsic(instance, args, dest)? { return Ok(()); } - // An intrinsic that we do not support + // An intrinsic that we do not support. let intrinsic_name = &ecx.tcx.item_name(instance.def_id()).as_str()[..]; Err( ConstEvalError::NeedsRfc(format!("calling intrinsic `{}`", intrinsic_name)).into() @@ -438,7 +440,7 @@ impl<'a, 'mir, 'tcx> interpret::Machine<'a, 'mir, 'tcx> alloc: &'b Allocation, _memory_extra: &(), ) -> Cow<'b, Allocation> { - // We do not use a tag so we can just cheaply forward the reference + // We do not use a tag so that we can just cheaply forward the reference. Cow::Borrowed(alloc) } @@ -491,7 +493,7 @@ impl<'a, 'mir, 'tcx> interpret::Machine<'a, 'mir, 'tcx> Ok(()) } - /// Called immediately before a stack frame gets popped + /// Called immediately before a stack frame gets popped. #[inline(always)] fn stack_pop( _ecx: &mut EvalContext<'a, 'mir, 'tcx, Self>, @@ -501,7 +503,7 @@ impl<'a, 'mir, 'tcx> interpret::Machine<'a, 'mir, 'tcx> } } -/// Project to a field of a (variant of a) const +/// Project to a field of a (variant of a) const. pub fn const_field<'a, 'tcx>( tcx: TyCtxt<'a, 'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, @@ -513,16 +515,16 @@ pub fn const_field<'a, 'tcx>( trace!("const_field: {:?}, {:?}, {:?}", instance, field, value); let ecx = mk_eval_cx(tcx, instance, param_env).unwrap(); let result = (|| { - // get the operand again + // Get the operand again, ... let op = const_to_op(&ecx, value)?; - // downcast + // ... downcast, ... let down = match variant { None => op, Some(variant) => ecx.operand_downcast(op, variant)? }; - // then project + // ... then project, ... let field = ecx.operand_field(down, field.index() as u64)?; - // and finally move back to the const world, always normalizing because + // ... and finally move back to the const world, always normalizing because // this is not called for statics. op_to_const(&ecx, field, true) })(); @@ -563,7 +565,7 @@ fn validate_and_turn_into_const<'a, 'tcx>( let ecx = mk_eval_cx(tcx, cid.instance, key.param_env).unwrap(); let val = (|| { let op = ecx.raw_const_to_mplace(constant)?.into(); - // FIXME: Once the visitor infrastructure landed, change validation to + // FIXME: once the visitor infrastructure landed, change validation to // work directly on `MPlaceTy`. let mut ref_tracking = RefTracking::new(op); while let Some((op, path)) = ref_tracking.todo.pop() { @@ -571,10 +573,10 @@ fn validate_and_turn_into_const<'a, 'tcx>( op, path, Some(&mut ref_tracking), - /* const_mode */ true, + true, // const mode )?; } - // Now that we validated, turn this into a proper constant + // Now that we validated, turn this into a proper constant. let def_id = cid.instance.def.def_id(); let normalize = tcx.is_static(def_id).is_none() && cid.promoted.is_none(); op_to_const(&ecx, op, normalize) @@ -605,13 +607,13 @@ pub fn const_eval_provider<'a, 'tcx>( let mut key = key.clone(); key.param_env.reveal = Reveal::UserFacing; match tcx.const_eval(key) { - // try again with reveal all as requested + // Try again with "reveal all", as requested. Err(ErrorHandled::TooGeneric) => { // Promoteds should never be "too generic" when getting evaluated. - // They either don't get evaluated, or we are in a monomorphic context + // They either don't get evaluated, or we are in a monomorphic context. assert!(key.value.promoted.is_none()); }, - // dedupliate calls + // Dedupliate calls. other => return other, } } @@ -636,9 +638,9 @@ pub fn const_eval_raw_provider<'a, 'tcx>( let mut key = key.clone(); key.param_env.reveal = Reveal::UserFacing; match tcx.const_eval_raw(key) { - // try again with reveal all as requested + // Try again with "reveal all" as requested. Err(ErrorHandled::TooGeneric) => {}, - // dedupliate calls + // Dedupliate calls. other => return other, } } @@ -657,7 +659,7 @@ pub fn const_eval_raw_provider<'a, 'tcx>( if let Some(id) = tcx.hir().as_local_node_id(def_id) { let tables = tcx.typeck_tables_of(def_id); - // Do match-check before building MIR + // Do match-check before building MIR. if let Err(ErrorReported) = tcx.check_match(def_id) { return Err(ErrorHandled::Reported) } @@ -666,7 +668,7 @@ pub fn const_eval_raw_provider<'a, 'tcx>( tcx.mir_const_qualif(def_id); } - // Do not continue into miri if typeck errors occurred; it will fail horribly + // Do not continue into miri if typeck errors occurred; it will fail horribly. if tables.tainted_by_errors { return Err(ErrorHandled::Reported) } @@ -680,7 +682,7 @@ pub fn const_eval_raw_provider<'a, 'tcx>( }) }).map_err(|error| { let err = error_to_const_error(&ecx, error); - // errors in statics are always emitted as fatal errors + // Errors in statics are always emitted as fatal errors. if tcx.is_static(def_id).is_some() { let reported_err = err.report_as_error(ecx.tcx, "could not evaluate static initializer"); @@ -693,14 +695,15 @@ pub fn const_eval_raw_provider<'a, 'tcx>( } reported_err } else if def_id.is_local() { - // constant defined in this crate, we can figure out a lint level! + // Constant defined in this crate -- we can figure out a lint level! match tcx.describe_def(def_id) { - // constants never produce a hard error at the definition site. Anything else is - // a backwards compatibility hazard (and will break old versions of winapi for sure) + // Constants never produce a hard error at the definition site. Anything else is + // a backwards compatibility hazard (and will break old versions of WINAPI for + // sure). // - // note that validation may still cause a hard error on this very same constant, + // Note that validation may still cause a hard error on this very same constant, // because any code that existed before validation could not have failed validation - // thus preventing such a hard error from being a backwards compatibility hazard + // thus preventing such a hard error from being a backwards compatibility hazard. Some(Def::Const(_)) | Some(Def::AssociatedConst(_)) => { let node_id = tcx.hir().as_local_node_id(def_id).unwrap(); err.report_as_lint( @@ -709,8 +712,8 @@ pub fn const_eval_raw_provider<'a, 'tcx>( node_id, ) }, - // promoting runtime code is only allowed to error if it references broken constants - // any other kind of error will be reported to the user as a deny-by-default lint + // Promoting runtime code is only allowed to error if it references broken constants + // any other kind of error will be reported to the user as a deny-by-default lint. _ => if let Some(p) = cid.promoted { let span = tcx.optimized_mir(def_id).promoted[p].span; if let EvalErrorKind::ReferencedConstant = err.error { @@ -725,8 +728,8 @@ pub fn const_eval_raw_provider<'a, 'tcx>( tcx.hir().as_local_node_id(def_id).unwrap(), ) } - // anything else (array lengths, enum initializers, constant patterns) are reported - // as hard errors + // Anything else (array lengths, enum initializers, constant patterns) are reported + // as hard errors. } else { err.report_as_error( ecx.tcx, @@ -735,7 +738,7 @@ pub fn const_eval_raw_provider<'a, 'tcx>( }, } } else { - // use of broken constant from other crate + // Use of broken constant from other crate. err.report_as_error(ecx.tcx, "could not evaluate constant") } }) diff --git a/src/librustc_mir/dataflow/impls/mod.rs b/src/librustc_mir/dataflow/impls/mod.rs index 1ccda3a12e433..7816707c03812 100644 --- a/src/librustc_mir/dataflow/impls/mod.rs +++ b/src/librustc_mir/dataflow/impls/mod.rs @@ -143,7 +143,7 @@ impl<'a, 'gcx, 'tcx> HasMoveData<'tcx> for MaybeUninitializedPlaces<'a, 'gcx, 't /// initialized upon reaching a particular point in the control flow /// for a function. /// -/// FIXME: Note that once flow-analysis is complete, this should be +/// FIXME: note that once flow-analysis is complete, this should be /// the set-complement of MaybeUninitializedPlaces; thus we can get rid /// of one or the other of these two. I'm inclined to get rid of /// MaybeUninitializedPlaces, simply because the sets will tend to be diff --git a/src/librustc_mir/dataflow/mod.rs b/src/librustc_mir/dataflow/mod.rs index f09db970b7353..f59bdb8e87127 100644 --- a/src/librustc_mir/dataflow/mod.rs +++ b/src/librustc_mir/dataflow/mod.rs @@ -579,7 +579,7 @@ pub trait BitDenotation<'tcx>: BitSetOperator { /// is that the `statement_effect` and `terminator_effect` methods /// mutate only the gen/kill sets. /// - /// FIXME: We should consider enforcing the intention described in + /// FIXME: we should consider enforcing the intention described in /// the previous paragraph by passing the three sets in separate /// parameters to encode their distinct mutabilities. fn accumulates_intrablock_state() -> bool { false } @@ -677,7 +677,7 @@ pub trait BitDenotation<'tcx>: BitSetOperator { /// GEN and KILL sets attached to the block, and so instead we add /// this extra machinery to represent the flow-dependent effect. /// - /// FIXME: Right now this is a bit of a wart in the API. It might + /// FIXME: right now this is a bit of a wart in the API. It might /// be better to represent this as an additional gen- and /// kill-sets associated with each edge coming out of the basic /// block. diff --git a/src/librustc_mir/diagnostics.rs b/src/librustc_mir/diagnostics.rs index 7e8ac3fb72006..a94876e262912 100644 --- a/src/librustc_mir/diagnostics.rs +++ b/src/librustc_mir/diagnostics.rs @@ -534,7 +534,7 @@ match Some("hi".to_string()) { The `op_string_ref` binding has type `&Option<&String>` in both cases. -See also https://github.com/rust-lang/rust/issues/14587 +See also . "##, E0010: r##" @@ -686,7 +686,7 @@ fn main() { } ``` -See also https://doc.rust-lang.org/book/first-edition/unsafe.html +See also . "##, E0373: r##" @@ -977,7 +977,7 @@ fn mutable() { foo(|| x = 2); } -// Attempts to take a mutable reference to closed-over data. Error message +// Attempts to take a mutable reference to closed-over data. Error message // reads: `cannot borrow data mutably in a captured outer variable...` fn mut_addr() { let mut x = 0u32; diff --git a/src/librustc_mir/hair/cx/expr.rs b/src/librustc_mir/hair/cx/expr.rs index 7b1ed2b0b26ea..f7fc81cce10c4 100644 --- a/src/librustc_mir/hair/cx/expr.rs +++ b/src/librustc_mir/hair/cx/expr.rs @@ -357,7 +357,7 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, if cx.tables().is_method_call(expr) { overloaded_operator(cx, expr, vec![lhs.to_ref(), rhs.to_ref()]) } else { - // FIXME overflow + // FIXME: overflow match (op.node, cx.constness) { // FIXME(eddyb) use logical ops in constants when // they can handle that kind of control-flow. @@ -646,7 +646,7 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, ); // Check to see if this cast is a "coercion cast", where the cast is actually done - // using a coercion (or is a no-op). + // using a coercion (or is a noop). let cast = if let Some(&TyCastKind::CoercionCast) = cx.tables() .cast_kinds() @@ -973,11 +973,11 @@ fn convert_var<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, let var_hir_id = cx.tcx.hir().node_to_hir_id(var_id); let var_ty = cx.tables().node_id_to_type(var_hir_id); - // FIXME free regions in closures are not right + // FIXME: free regions in closures are not right let closure_ty = cx.tables() .node_id_to_type(cx.tcx.hir().node_to_hir_id(closure_expr_id)); - // FIXME we're just hard-coding the idea that the + // FIXME: we're just hard-coding the idea that the // signature will be &self or &mut self and hence will // have a bound region with number 0 let closure_def_id = cx.tcx.hir().local_def_id(closure_expr_id); diff --git a/src/librustc_mir/hair/cx/mod.rs b/src/librustc_mir/hair/cx/mod.rs index 60c8022a374be..087c4765dbc4b 100644 --- a/src/librustc_mir/hair/cx/mod.rs +++ b/src/librustc_mir/hair/cx/mod.rs @@ -1,8 +1,6 @@ -//! This module contains the code to convert from the wacky tcx data -//! structures into the hair. The `builder` is generally ignorant of -//! the tcx etc, and instead goes through the `Cx` for most of its -//! work. -//! +//! This module contains the fcuntaiontliy to convert from the wacky tcx data +//! structures into the HAIR. The `builder` is generally ignorant of the tcx, +//! etc., and instead goes through the `Cx` for most of its work. use hair::*; use hair::util::UserAnnotatedTyHelpers; @@ -44,10 +42,10 @@ pub struct Cx<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> { /// What kind of body is being compiled. pub body_owner_kind: hir::BodyOwnerKind, - /// True if this constant/function needs overflow checks. + /// Whether this constant/function needs overflow checks. check_overflow: bool, - /// See field with the same name on `Mir` + /// See field with the same name on `Mir`. control_flow_destroyed: Vec<(Span, String)>, } @@ -67,11 +65,11 @@ impl<'a, 'gcx, 'tcx> Cx<'a, 'gcx, 'tcx> { let attrs = tcx.hir().attrs(src_id); // Some functions always have overflow checks enabled, - // however, they may not get codegen'd, depending on + // however, they may not get codegen'ed, depending on // the settings for the crate they are codegened in. let mut check_overflow = attr::contains_name(attrs, "rustc_inherit_overflow_checks"); - // Respect -C overflow-checks. + // Respect `-C overflow-checks`. check_overflow |= tcx.sess.overflow_checks(); // Constants always need overflow checks. @@ -99,7 +97,7 @@ impl<'a, 'gcx, 'tcx> Cx<'a, 'gcx, 'tcx> { } impl<'a, 'gcx, 'tcx> Cx<'a, 'gcx, 'tcx> { - /// Normalizes `ast` into the appropriate `mirror` type. + /// Normalizes `ast` into the appropriate "mirror" type. pub fn mirror>(&mut self, ast: M) -> M::Output { ast.make_mirror(self) } @@ -140,13 +138,13 @@ impl<'a, 'gcx, 'tcx> Cx<'a, 'gcx, 'tcx> { match lit_to_const(lit, self.tcx, ty, neg) { Ok(c) => c, Err(LitToConstError::UnparseableFloat) => { - // FIXME(#31407) this is only necessary because float parsing is buggy + // FIXME(#31407): this is only necessary because float parsing is buggy. self.tcx.sess.span_err(sp, "could not evaluate float literal (see issue #31407)"); - // create a dummy value and continue compiling + // Create a dummy value and continue compiling. Const::from_bits(self.tcx, 0, self.param_env.and(ty)) }, Err(LitToConstError::Reported) => { - // create a dummy value and continue compiling + // Create a dummy value and continue compiling. Const::from_bits(self.tcx, 0, self.param_env.and(ty)) } } diff --git a/src/librustc_mir/hair/pattern/_match.rs b/src/librustc_mir/hair/pattern/_match.rs index 13838e5d85dda..b72568e548a5e 100644 --- a/src/librustc_mir/hair/pattern/_match.rs +++ b/src/librustc_mir/hair/pattern/_match.rs @@ -338,7 +338,7 @@ impl<'p, 'tcx> fmt::Debug for Matrix<'p, 'tcx> { impl<'p, 'tcx> FromIterator; 2]>> for Matrix<'p, 'tcx> { fn from_iter(iter: T) -> Self - where T: IntoIterator; 2]>> + where T: IntoIterator; 2]>> { Matrix(iter.into_iter().collect()) } @@ -349,7 +349,7 @@ pub struct MatchCheckCtxt<'a, 'tcx: 'a> { /// The module in which the match occurs. This is necessary for /// checking inhabited-ness of types because whether a type is (visibly) /// inhabited can depend on whether it was defined in the current module or - /// not. eg. `struct Foo { _private: ! }` cannot be seen to be empty + /// not. E.g. `struct Foo { _private: ! }` cannot be seen to be empty /// outside it's module and should not be matchable with an empty match /// statement. pub module: DefId, @@ -699,7 +699,7 @@ fn all_constructors<'a, 'tcx: 'a>(cx: &mut MatchCheckCtxt<'a, 'tcx>, fn max_slice_length<'p, 'a: 'p, 'tcx: 'a, I>( cx: &mut MatchCheckCtxt<'a, 'tcx>, patterns: I) -> u64 - where I: Iterator> + where I: Iterator> { // The exhaustiveness-checking paper does not include any details on // checking variable-length slice patterns. However, they are matched @@ -1020,13 +1020,13 @@ fn compute_missing_ctors<'a, 'tcx: 'a>( } } -/// Algorithm from http://moscova.inria.fr/~maranget/papers/warn/index.html +/// Algorithm from http://moscova.inria.fr/~maranget/papers/warn/index.html. /// The algorithm from the paper has been modified to correctly handle empty /// types. The changes are: /// (0) We don't exit early if the pattern matrix has zero rows. We just /// continue to recurse over columns. /// (1) all_constructors will only return constructors that are statically -/// possible. eg. it will only return Ok for Result +/// possible. E.g., it will only return `Ok` for `Result`. /// /// This finds whether a (row) vector `v` of patterns is 'useful' in relation /// to a set of such vectors `m` - this is defined as there being a set of @@ -1034,8 +1034,8 @@ fn compute_missing_ctors<'a, 'tcx: 'a>( /// /// All the patterns at each column of the `matrix ++ v` matrix must /// have the same type, except that wildcard (PatternKind::Wild) patterns -/// with type TyErr are also allowed, even if the "type of the column" -/// is not TyErr. That is used to represent private fields, as using their +/// with type `TyErr` are also allowed, even if the "type of the column" +/// is not `TyErr`. That is used to represent private fields, as using their /// real type would assert that they are inhabited. /// /// This is used both for reachability checking (if a pattern isn't useful in @@ -1050,10 +1050,10 @@ pub fn is_useful<'p, 'a: 'p, 'tcx: 'a>(cx: &mut MatchCheckCtxt<'a, 'tcx>, let &Matrix(ref rows) = matrix; debug!("is_useful({:#?}, {:#?})", matrix, v); - // The base case. We are pattern-matching on () and the return value is + // The base case. We are pattern-matching on `()` and the return value is // based on whether our matrix has a row or not. - // NOTE: This could potentially be optimized by checking rows.is_empty() - // first and then, if v is non-empty, the return value is based on whether + // N.B., this could potentially be optimized by checking `rows.is_empty()` + // first, and then, if `v` is non-empty, the return value is based on whether // the type of the tuple we're checking is inhabited or not. if v.is_empty() { return if rows.is_empty() { diff --git a/src/librustc_mir/hair/pattern/mod.rs b/src/librustc_mir/hair/pattern/mod.rs index 62ec52aac1346..d391638fa8a12 100644 --- a/src/librustc_mir/hair/pattern/mod.rs +++ b/src/librustc_mir/hair/pattern/mod.rs @@ -1,4 +1,4 @@ -//! Code to validate patterns/matches +//! This module handles the validation of patterns/matches. mod _match; mod check_match; @@ -73,7 +73,7 @@ impl<'tcx> PatternTypeProjections<'tcx> { } pub(crate) fn ref_binding(&self) -> Self { - // FIXME(#55401): ignore for now + // FIXME(#55401): ignore for now. PatternTypeProjections { contents: vec![] } } @@ -177,7 +177,7 @@ pub enum PatternKind<'tcx> { user_ty_span: Span, }, - /// x, ref x, x @ P, etc + /// `x`, `ref x`, `x @ P`, etc. Binding { mutability: Mutability, name: ast::Name, @@ -187,7 +187,8 @@ pub enum PatternKind<'tcx> { subpattern: Option>, }, - /// Foo(...) or Foo{...} or Foo, where `Foo` is a variant name from an adt with >1 variants + /// `Foo(...)` or `Foo{...}` or `Foo`, where `Foo` is a variant name from an ADT with + /// multiple variants. Variant { adt_def: &'tcx AdtDef, substs: &'tcx Substs<'tcx>, @@ -195,12 +196,13 @@ pub enum PatternKind<'tcx> { subpatterns: Vec>, }, - /// (...), Foo(...), Foo{...}, or Foo, where `Foo` is a variant name from an adt with 1 variant + /// `(...)`, `Foo(...)`, `Foo{...}`, or `Foo`, where `Foo` is a variant name from an ADT with + /// a single variant. Leaf { subpatterns: Vec>, }, - /// box P, &P, &mut P, etc + /// `box P`, `&P`, `&mut P`, etc. Deref { subpattern: Pattern<'tcx>, }, @@ -211,7 +213,7 @@ pub enum PatternKind<'tcx> { Range(PatternRange<'tcx>), - /// matches against a slice, checking the length and extracting elements. + /// Matches against a slice, checking the length and extracting elements. /// irrefutable when there is a slice pattern and both `prefix` and `suffix` are empty. /// e.g., `&[ref xs..]`. Slice { @@ -220,7 +222,7 @@ pub enum PatternKind<'tcx> { suffix: Vec>, }, - /// fixed match against an array, irrefutable + /// Fixed match against an array; irrefutable. Array { prefix: Vec>, slice: Option>, @@ -542,7 +544,8 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> { ty::Slice(..) | ty::Array(..) => self.slice_or_array_pattern(pat.span, ty, prefix, slice, suffix), - ty::Error => { // Avoid ICE + ty::Error => { + // Avoid ICE. return Pattern { span: pat.span, ty, kind: Box::new(PatternKind::Wild) }; } ref sty => @@ -567,7 +570,8 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> { PatternKind::Leaf { subpatterns } } - ty::Error => { // Avoid ICE (#50577) + ty::Error => { + // Avoid ICE (#50577). return Pattern { span: pat.span, ty, kind: Box::new(PatternKind::Wild) }; } ref sty => span_bug!(pat.span, "unexpected type for tuple pattern: {:?}", sty), @@ -578,7 +582,8 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> { let var_ty = self.tables.node_id_to_type(pat.hir_id); let region = match var_ty.sty { ty::Ref(r, _, _) => Some(r), - ty::Error => { // Avoid ICE + ty::Error => { + // Avoid ICE. return Pattern { span: pat.span, ty, kind: Box::new(PatternKind::Wild) }; } _ => None, @@ -690,7 +695,7 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> { let orig_prefix = prefix; let orig_suffix = suffix; - // dance because of intentional borrow-checker stupidity. + // Dance because of intentional borrow-checker stupidity. let kind = *orig_slice.kind; match kind { PatternKind::Slice { prefix, slice, mut suffix } | @@ -760,7 +765,8 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> { let substs = match ty.sty { ty::Adt(_, substs) | ty::FnDef(_, substs) => substs, - ty::Error => { // Avoid ICE (#50585) + ty::Error => { + // Avoid ICE (#50585). return PatternKind::Wild; } _ => bug!("inappropriate type for def: {:?}", ty.sty), @@ -809,7 +815,7 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> { /// Takes a HIR Path. If the path is a constant, evaluates it and feeds /// it to `const_to_pat`. Any other path (like enum variants without fields) - /// is converted to the corresponding pattern via `lower_variant_or_leaf` + /// is converted to the corresponding pattern via `lower_variant_or_leaf`. fn lower_path(&mut self, qpath: &hir::QPath, id: hir::HirId, @@ -869,8 +875,8 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> { } /// Converts literals, paths and negation of literals to patterns. - /// The special case for negation exists to allow things like -128i8 - /// which would overflow if we tried to evaluate 128i8 and then negate + /// The special case for negation exists to allow things like `-128_i8` + /// which would overflow if we tried to evaluate `128_i8` and then negate /// afterwards. fn lower_lit(&mut self, expr: &'tcx hir::Expr) -> PatternKind<'tcx> { match expr.node { @@ -919,7 +925,7 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> { /// Converts an evaluated constant to a pattern (if possible). /// This means aggregate values (like structs and enums) are converted - /// to a pattern that matches the value (as if you'd compare via eq). + /// to a pattern that matches the value (as if you'd compared via equality). fn const_to_pat( &self, instance: ty::Instance<'tcx>, @@ -959,7 +965,7 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> { } }, ty::Adt(adt_def, _) if adt_def.is_union() => { - // Matching on union fields is unsafe, we can't hide it in constants + // Matching on union fields is unsafe; we can't hide it in constants. self.tcx.sess.span_err(span, "cannot use unions in constant patterns"); PatternKind::Wild } @@ -1229,7 +1235,7 @@ pub fn compare_const_vals<'a, 'gcx, 'tcx>( let tcx = tcx.global_tcx(); let (a, b, ty) = (a, b, ty).lift_to_tcx(tcx).unwrap(); - // FIXME: This should use assert_bits(ty) instead of use_bits + // FIXME: this should use assert_bits(ty) instead of use_bits // but triggers possibly bugs due to mismatching of arrays and slices if let (Some(a), Some(b)) = (a.to_bits(tcx, ty), b.to_bits(tcx, ty)) { use ::rustc_apfloat::Float; diff --git a/src/librustc_mir/interpret/eval_context.rs b/src/librustc_mir/interpret/eval_context.rs index 9a76a36ef2293..17f0182ff7443 100644 --- a/src/librustc_mir/interpret/eval_context.rs +++ b/src/librustc_mir/interpret/eval_context.rs @@ -54,7 +54,7 @@ pub struct Frame<'mir, 'tcx: 'mir, Tag=(), Extra=()> { /// The MIR for the function called on this frame. pub mir: &'mir mir::Mir<'tcx>, - /// The def_id and substs of the current function + /// The def_id and substs of the current function. pub instance: ty::Instance<'tcx>, /// The span of the call site. @@ -63,7 +63,7 @@ pub struct Frame<'mir, 'tcx: 'mir, Tag=(), Extra=()> { //////////////////////////////////////////////////////////////////////////////// // Return place and locals //////////////////////////////////////////////////////////////////////////////// - /// Work to perform when returning from this function + /// Work to perform when returning from this function. pub return_to_block: StackPopCleanup, /// The location where the result of the current stack frame should be written to, @@ -87,7 +87,7 @@ pub struct Frame<'mir, 'tcx: 'mir, Tag=(), Extra=()> { /// The index of the currently evaluated statement. pub stmt: usize, - /// Extra data for the machine + /// Extra data for the machine. pub extra: Extra, } @@ -98,7 +98,7 @@ pub enum StackPopCleanup { /// we can validate it at that layout. Goto(Option), /// Just do nohing: Used by Main and for the box_alloc hook in miri. - /// `cleanup` says whether locals are deallocated. Static computation + /// `cleanup` says whether locals are deallocated. Static computation /// wants them leaked to intern what they need (and just throw away /// the entire `ecx` when it is done). None { cleanup: bool }, @@ -106,7 +106,7 @@ pub enum StackPopCleanup { // State of a local variable #[derive(Copy, Clone, PartialEq, Eq, Hash)] -pub enum LocalValue { +pub enum LocalValue { Dead, // Mostly for convenience, we re-use the `Operand` type here. // This is an optimization over just always having a pointer here; @@ -330,16 +330,16 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tc ); // Recurse to get the size of the dynamically sized field (must be - // the last field). Can't have foreign types here, how would we + // the last field). Can't have foreign types here, how would we // adjust alignment and size for them? let field = layout.field(self, layout.fields.count() - 1)?; let (unsized_size, unsized_align) = match self.size_and_align_of(metadata, field)? { Some(size_and_align) => size_and_align, None => { - // A field with extern type. If this field is at offset 0, we behave + // A field with extern type. If this field is at offset 0, we behave // like the underlying extern type. - // FIXME: Once we have made decisions for how to handle size and alignment - // of `extern type`, this should be adapted. It is just a temporary hack + // FIXME: once we have made decisions for how to handle size and alignment + // of `extern type`, this should be adapted. It is just a temporary hack // to get some code to work that probably ought to work. if sized_size == Size::ZERO { return Ok(None) @@ -349,7 +349,7 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tc } }; - // FIXME (#26403, #27023): We should be adding padding + // FIXME(#26403, #27023): We should be adding padding // to `sized_size` (to accommodate the `unsized_align` // required of the unsized field that follows) before // summing it with `sized_size`. (Note that since #26403 @@ -411,20 +411,21 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tc return_place: Option>, return_to_block: StackPopCleanup, ) -> EvalResult<'tcx> { - if self.stack.len() > 1 { // FIXME should be "> 0", printing topmost frame crashes rustc... + // FIXME: should be `> 0`, but printing topmost frame crashes rustc. + if self.stack.len() > 1 { info!("PAUSING({}) {}", self.cur_frame(), self.frame().instance); } ::log_settings::settings().indentation += 1; - // first push a stack frame so we have access to the local substs + // First, push a stack frame so we have access to the local substs. let extra = M::stack_push(self)?; self.stack.push(Frame { mir, block: mir::START_BLOCK, return_to_block, return_place, - // empty local array, we fill it in below, after we are inside the stack frame and - // all methods actually know about the frame + // Empty local array -- we fill it in below, after we are inside the stack frame and + // all methods actually know about the frame. locals: IndexVec::new(), span, instance, @@ -432,10 +433,10 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tc extra, }); - // don't allocate at all for trivial constants + // Don't allocate at all for trivial constants. if mir.local_decls.len() > 1 { // We put some marker immediate into the locals that we later want to initialize. - // This can be anything except for LocalValue::Dead -- because *that* is the + // This can be anything except for `LocalValue::Dead` -- because *that* is the // value we use for things that we know are initially dead. let dummy = LocalValue::Live(Operand::Immediate(Immediate::Scalar(ScalarMaybeUndef::Undef))); @@ -443,9 +444,9 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tc // Return place is handled specially by the `eval_place` functions, and the // entry in `locals` should never be used. Make it dead, to be sure. locals[mir::RETURN_PLACE] = LocalValue::Dead; - // Now mark those locals as dead that we do not want to initialize + // Now mark those locals as dead that we do not want to initialize. match self.tcx.describe_def(instance.def_id()) { - // statics and constants don't have `Storage*` statements, no need to look for them + // Statics and constants don't have `Storage*` statements, no need to look for them. Some(Def::Static(..)) | Some(Def::Const(..)) | Some(Def::AssociatedConst(..)) => {}, _ => { trace!("push_stack_frame: {:?}: num_bbs: {}", span, mir.basic_blocks().len()); @@ -463,7 +464,7 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tc } }, } - // Finally, properly initialize all those that still have the dummy value + // Finally, properly initialize all those that still have the dummy value. for (local, decl) in locals.iter_mut().zip(mir.local_decls.iter()) { match *local { LocalValue::Live(_) => { @@ -472,15 +473,16 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tc *local = LocalValue::Live(self.uninit_operand(layout)?); } LocalValue::Dead => { - // Nothing to do + // Nothing to do. } } } - // done + // Done. self.frame_mut().locals = locals; } - if self.stack.len() > 1 { // FIXME no check should be needed, but some instances ICE + // FIXME: should be `> 0`, but printing topmost frame crashes rustc. + if self.stack.len() > 1 { info!("ENTERING({}) {}", self.cur_frame(), self.frame().instance); } @@ -492,7 +494,8 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tc } pub(super) fn pop_stack_frame(&mut self) -> EvalResult<'tcx> { - if self.stack.len() > 1 { // FIXME no check should be needed, but some instances ICE + // FIXME: should be `> 0`, but printing topmost frame crashes rustc. + if self.stack.len() > 1 { info!("LEAVING({}) {}", self.cur_frame(), self.frame().instance); } ::log_settings::settings().indentation -= 1; @@ -546,7 +549,8 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tc StackPopCleanup::None { .. } => {} } - if self.stack.len() > 1 { // FIXME should be "> 0", printing topmost frame crashes rustc... + // FIXME: should be `> 0`, but printing topmost frame crashes rustc. + if self.stack.len() > 1 { info!("CONTINUING({}) {}", self.cur_frame(), self.frame().instance); } @@ -600,9 +604,9 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tc } else { self.param_env }; - // We use `const_eval_raw` here, and get an unvalidated result. That is okay: + // We use `const_eval_raw` here, and get an unvalidated result. That is okay: // Our result will later be validated anyway, and there seems no good reason - // to have to fail early here. This is also more consistent with + // to have to fail early here. This is also more consistent with // `Memory::get_static_alloc` which has to use `const_eval_raw` to avoid cycles. let val = self.tcx.const_eval_raw(param_env.and(gid)).map_err(|err| { match err { diff --git a/src/librustc_mir/interpret/memory.rs b/src/librustc_mir/interpret/memory.rs index 3832d7e8d6245..ad3988e2f7fae 100644 --- a/src/librustc_mir/interpret/memory.rs +++ b/src/librustc_mir/interpret/memory.rs @@ -3,7 +3,7 @@ //! Generally, we use `Pointer` to denote memory addresses. However, some operations //! have a "size"-like parameter, and they take `Scalar` for the address because //! if the size is 0, then the pointer can also be a (properly aligned, non-NULL) -//! integer. It is crucial that these operations call `check_align` *before* +//! integer. It is crucial that these operations call `check_align` *before* //! short-circuiting the empty case! use std::collections::VecDeque; @@ -47,10 +47,10 @@ impl MayLeak for MemoryKind { // `Memory` has to depend on the `Machine` because some of its operations // (e.g., `get`) call a `Machine` hook. pub struct Memory<'a, 'mir, 'tcx: 'a + 'mir, M: Machine<'a, 'mir, 'tcx>> { - /// Allocations local to this instance of the miri engine. The kind + /// Allocations local to this instance of the miri engine. The kind /// helps ensure that the same mechanism is used for allocation and - /// deallocation. When an allocation is not found here, it is a - /// static and looked up in the `tcx` for read access. Some machines may + /// deallocation. When an allocation is not found here, it is a + /// static and looked up in the `tcx` for read access. Some machines may /// have to mutate this map even on a read-only access to a static (because /// they do pointer provenance tracking and the allocations in `tcx` have /// the wrong type), so we let the machine override this type. @@ -79,7 +79,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> HasDataLayout } } -// FIXME: Really we shouldn't clone memory, ever. Snapshot machinery should instead +// FIXME: really we shouldn't clone memory, ever. Snapshot machinery should instead // carefully copy only the reachable parts. impl<'a, 'mir, 'tcx, M> Clone @@ -356,7 +356,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> { } pub fn get(&self, id: AllocId) -> EvalResult<'tcx, &Allocation> { - // The error type of the inner closure here is somewhat funny. We have two + // The error type of the inner closure here is somewhat funny. We have two // ways of "erroring": An actual error, or because we got a reference from // `get_static_alloc` that we can actually use directly without inserting anything anywhere. // So the error type is `EvalResult<'tcx, &Allocation>`. @@ -609,14 +609,14 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> { } } -/// Interning (for CTFE) +/// Interning (for CTFE). impl<'a, 'mir, 'tcx, M> Memory<'a, 'mir, 'tcx, M> where M: Machine<'a, 'mir, 'tcx, PointerTag=(), AllocExtra=(), MemoryExtra=()>, - // FIXME: Working around https://github.com/rust-lang/rust/issues/24159 + // FIXME: working around issue #24159. M::MemoryMap: AllocMap, Allocation)>, { - /// mark an allocation as static and initialized, either mutable or not + /// Mark an allocation as static and initialized, either mutable or not. pub fn intern_static( &mut self, alloc_id: AllocId, @@ -627,29 +627,29 @@ where alloc_id, mutability ); - // remove allocation + // Remove allocation. let (kind, mut alloc) = self.alloc_map.remove(&alloc_id).unwrap(); match kind { MemoryKind::Machine(_) => bug!("Static cannot refer to machine memory"), MemoryKind::Stack | MemoryKind::Vtable => {}, } - // ensure llvm knows not to put this into immutable memory + // Ensure that LLVM knows not to put this into immutable memory. alloc.mutability = mutability; let alloc = self.tcx.intern_const_alloc(alloc); self.tcx.alloc_map.lock().set_alloc_id_memory(alloc_id, alloc); - // recurse into inner allocations + // Recurse into inner allocations. for &(_, alloc) in alloc.relocations.values() { - // FIXME: Reusing the mutability here is likely incorrect. It is originally + // FIXME: reusing the mutability here is likely incorrect. It is originally // determined via `is_freeze`, and data is considered frozen if there is no // `UnsafeCell` *immediately* in that data -- however, this search stops - // at references. So whenever we follow a reference, we should likely + // at references. So whenever we follow a reference, we should likely // assume immutability -- and we should make sure that the compiler // does not permit code that would break this! if self.alloc_map.contains_key(&alloc) { - // Not yet interned, so proceed recursively + // Not yet interned, so proceed recursively. self.intern_static(alloc, mutability)?; } else if self.dead_alloc_map.contains_key(&alloc) { - // dangling pointer + // Dangling pointer. return err!(ValidationFailure( "encountered dangling pointer in final constant".into(), )) @@ -659,7 +659,7 @@ where } } -/// Reading and writing +/// Reading and writing. impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> { pub fn copy( &mut self, @@ -773,7 +773,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> { /// Undefined bytes impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> Memory<'a, 'mir, 'tcx, M> { - // FIXME: Add a fast version for the common, nonoverlapping case + // FIXME: add a fast version for the common, nonoverlapping case fn copy_undef_mask( &mut self, src: Pointer, diff --git a/src/librustc_mir/interpret/operand.rs b/src/librustc_mir/interpret/operand.rs index 1ea3f78c2104f..a72ee01e8bdf2 100644 --- a/src/librustc_mir/interpret/operand.rs +++ b/src/librustc_mir/interpret/operand.rs @@ -22,7 +22,7 @@ pub use rustc::mir::interpret::ScalarMaybeUndef; /// In particular, thanks to `ScalarPair`, arithmetic operations and casts can be entirely /// defined on `Immediate`, and do not have to work with a `Place`. #[derive(Copy, Clone, Debug, Hash, PartialEq, Eq)] -pub enum Immediate { +pub enum Immediate { Scalar(ScalarMaybeUndef), ScalarPair(ScalarMaybeUndef, ScalarMaybeUndef), } @@ -128,7 +128,7 @@ impl<'tcx, Tag> ::std::ops::Deref for ImmTy<'tcx, Tag> { /// or still in memory. The latter is an optimization, to delay reading that chunk of /// memory and to avoid having to store arbitrary-sized data here. #[derive(Copy, Clone, Debug, Hash, PartialEq, Eq)] -pub enum Operand { +pub enum Operand { Immediate(Immediate), Indirect(MemPlace), } @@ -449,7 +449,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> } } else { // The rest should only occur as mplace, we do not use Immediates for types - // allowing such operations. This matches place_projection forcing an allocation. + // allowing such operations. This matches place_projection forcing an allocation. let mplace = base.to_mem_place(); self.mplace_projection(mplace, proj_elem)?.into() } @@ -472,8 +472,8 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> Ok(OpTy { op, layout }) } - // Evaluate a place with the goal of reading from it. This lets us sometimes - // avoid allocations. If you already know the layout, you can pass it in + // Evaluate a place with the goal of reading from it. This lets us sometimes + // avoid allocations. If you already know the layout, you can pass it in // to avoid looking it up again. fn eval_place_to_op( &self, @@ -536,7 +536,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> } // Used when miri runs into a constant, and by CTFE. - // FIXME: CTFE should use allocations, then we can make this private (embed it into + // FIXME: cTFE should use allocations, then we can make this private (embed it into // `eval_operand`, ideally). pub(crate) fn const_value_to_op( &self, diff --git a/src/librustc_mir/interpret/operator.rs b/src/librustc_mir/interpret/operator.rs index 5e3335f4c7219..87082200738a9 100644 --- a/src/librustc_mir/interpret/operator.rs +++ b/src/librustc_mir/interpret/operator.rs @@ -320,7 +320,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> self.binary_float_op(bin_op, fty, left, right) } _ => { - // Must be integer(-like) types. Don't forget about == on fn pointers. + // Must be integer(-like) types. Don't forget about == on fn pointers. assert!(left_layout.ty.is_integral() || left_layout.ty.is_unsafe_ptr() || left_layout.ty.is_fn()); assert!(right_layout.ty.is_integral() || right_layout.ty.is_unsafe_ptr() || diff --git a/src/librustc_mir/interpret/place.rs b/src/librustc_mir/interpret/place.rs index 962e0b7a74201..ce81bd4a1bf85 100644 --- a/src/librustc_mir/interpret/place.rs +++ b/src/librustc_mir/interpret/place.rs @@ -17,20 +17,20 @@ use super::{ }; #[derive(Copy, Clone, Debug, Hash, PartialEq, Eq)] -pub struct MemPlace { +pub struct MemPlace { /// A place may have an integral pointer for ZSTs, and since it might /// be turned back into a reference before ever being dereferenced. /// However, it may never be undef. pub ptr: Scalar, pub align: Align, - /// Metadata for unsized places. Interpretation is up to the type. + /// Metadata for unsized places. Interpretation is up to the type. /// Must not be present for sized types, but can be missing for unsized types /// (e.g., `extern type`). pub meta: Option>, } #[derive(Copy, Clone, Debug, Hash, PartialEq, Eq)] -pub enum Place { +pub enum Place { /// A place referring to a value allocated in the `Memory` system. Ptr(MemPlace), @@ -225,7 +225,7 @@ impl<'tcx, Tag> MPlaceTy<'tcx, Tag> { _ => bug!("len not supported on unsized type {:?}", self.layout.ty), } } else { - // Go through the layout. There are lots of types that support a length, + // Go through the layout. There are lots of types that support a length, // e.g., SIMD types. match self.layout.fields { layout::FieldPlacement::Array { count, .. } => Ok(count), @@ -302,20 +302,20 @@ impl<'tcx, Tag: ::std::fmt::Debug> PlaceTy<'tcx, Tag> { } } -// separating the pointer tag for `impl Trait`, see https://github.com/rust-lang/rust/issues/54385 +// Separating the pointer tag for `impl Trait`, see issue #54385. impl<'a, 'mir, 'tcx, Tag, M> EvalContext<'a, 'mir, 'tcx, M> where - // FIXME: Working around https://github.com/rust-lang/rust/issues/54385 + // FIXME: working around issue #54385. Tag: ::std::fmt::Debug+Default+Copy+Eq+Hash+'static, M: Machine<'a, 'mir, 'tcx, PointerTag=Tag>, - // FIXME: Working around https://github.com/rust-lang/rust/issues/24159 + // FIXME: working around issue #24159. M::MemoryMap: AllocMap, Allocation)>, M::AllocExtra: AllocationExtra, { /// Take a value, which represents a (thin or fat) reference, and make it a place. - /// Alignment is just based on the type. This is the inverse of `MemPlace::to_ref()`. + /// Alignment is just based on the type. This is the inverse of `MemPlace::to_ref()`. /// This does NOT call the "deref" machine hook, so it does NOT count as a - /// deref as far as Stacked Borrows is concerned. Use `deref_operand` for that! + /// deref as far as Stacked Borrows is concerned. Use `deref_operand` for that! pub fn ref_to_mplace( &self, val: ImmTy<'tcx, M::PointerTag>, @@ -332,7 +332,7 @@ where } // Take an operand, representing a pointer, and dereference it to a place -- that - // will always be a MemPlace. Lives in `place.rs` because it creates a place. + // will always be a MemPlace. Lives in `place.rs` because it creates a place. // This calls the "deref" machine hook, and counts as a deref as far as // Stacked Borrows is concerned. pub fn deref_operand( @@ -391,8 +391,8 @@ where Some((_, align)) => align, None if offset == Size::ZERO => // An extern type at offset 0, we fall back to its static alignment. - // FIXME: Once we have made decisions for how to handle size and alignment - // of `extern type`, this should be adapted. It is just a temporary hack + // FIXME: once we have made decisions for how to handle size and alignment + // of `extern type`, this should be adapted. It is just a temporary hack // to get some code to work that probably ought to work. field_layout.align.abi, None => @@ -416,7 +416,7 @@ where &self, base: MPlaceTy<'tcx, Tag>, ) -> - EvalResult<'tcx, impl Iterator>> + 'a> + EvalResult<'tcx, impl Iterator>> + 'a> { let len = base.len(self)?; // also asserts that we have a type where this makes sense let stride = match base.layout.fields { @@ -524,7 +524,7 @@ where base: PlaceTy<'tcx, M::PointerTag>, field: u64, ) -> EvalResult<'tcx, PlaceTy<'tcx, M::PointerTag>> { - // FIXME: We could try to be smarter and avoid allocation for fields that span the + // FIXME: we could try to be smarter and avoid allocation for fields that span the // entire place. let mplace = self.force_allocation(base)?; Ok(self.mplace_field(mplace, field)?.into()) @@ -566,7 +566,7 @@ where }) } - /// Evaluate statics and promoteds to an `MPlace`. Used to share some code between + /// Evaluate statics and promoteds to an `MPlace`. Used to share some code between /// `eval_place` and `eval_place_to_op`. pub(super) fn eval_place_to_mplace( &self, @@ -596,8 +596,8 @@ where // and it knows how to deal with alloc_id that are present in the // global table but not in its local memory: It calls back into tcx through // a query, triggering the CTFE machinery to actually turn this lazy reference - // into a bunch of bytes. IOW, statics are evaluated with CTFE even when - // this EvalContext uses another Machine (e.g., in miri). This is what we + // into a bunch of bytes. That is, statics are evaluated with CTFE even when + // this `EvalContext` uses another Machine (e.g., in miri). This is what we // want! This way, computing statics works concistently between codegen // and miri: They use the same query to eventually obtain a `ty::Const` // and use that for further computation. @@ -609,7 +609,7 @@ where }) } - /// Compute a place. You should only use this if you intend to write into this + /// Compute a place. You should only use this if you intend to write into this /// place; for reading, a more efficient alternative is `eval_place_for_read`. pub fn eval_place( &mut self, @@ -693,7 +693,7 @@ where "Size mismatch when writing bits"), Immediate::Scalar(ScalarMaybeUndef::Undef) => {}, // undef can have any size Immediate::ScalarPair(_, _) => { - // FIXME: Can we check anything here? + // FIXME: can we check anything here? } } } @@ -734,17 +734,17 @@ where // to handle padding properly, which is only correct if we never look at this data with the // wrong type. - // Nothing to do for ZSTs, other than checking alignment + // Nothing to do for ZSTs, other than checking alignment. if dest.layout.is_zst() { return self.memory.check_align(ptr, ptr_align); } - // check for integer pointers before alignment to report better errors + // Check for integer pointers before alignment to report better errors. let ptr = ptr.to_ptr()?; self.memory.check_align(ptr.into(), ptr_align)?; let tcx = &*self.tcx; - // FIXME: We should check that there are dest.layout.size many bytes available in - // memory. The code below is not sufficient, with enough padding it might not + // FIXME: we should check that there are `dest.layout.size` many bytes available in + // memory. The code below is not sufficient, with enough padding it might not // cover all the bytes! match value { Immediate::Scalar(scalar) => { @@ -784,7 +784,7 @@ where } } - /// Copy the data from an operand to a place. This does not support transmuting! + /// Copy the data from an operand to a place. This does not support transmuting! /// Use `copy_op_transmute` if the layouts could disagree. #[inline(always)] pub fn copy_op( @@ -802,7 +802,7 @@ where Ok(()) } - /// Copy the data from an operand to a place. This does not support transmuting! + /// Copy the data from an operand to a place. This does not support transmuting! /// Use `copy_op_transmute` if the layouts could disagree. /// Also, if you use this you are responsible for validating that things git copied at the /// right type. @@ -841,7 +841,7 @@ where Ok(()) } - /// Copy the data from an operand to a place. The layouts may disagree, but they must + /// Copy the data from an operand to a place. The layouts may disagree, but they must /// have the same size. pub fn copy_op_transmute( &mut self, @@ -858,11 +858,11 @@ where assert!(src.layout.size == dest.layout.size, "Size mismatch when transmuting!\nsrc: {:#?}\ndest: {:#?}", src, dest); - // The hard case is `ScalarPair`. `src` is already read from memory in this case, + // The hard case is `ScalarPair`. `src` is already read from memory in this case, // using `src.layout` to figure out which bytes to use for the 1st and 2nd field. // We have to write them to `dest` at the offsets they were *read at*, which is // not necessarily the same as the offsets in `dest.layout`! - // Hence we do the copy with the source layout on both sides. We also make sure to write + // Hence we do the copy with the source layout on both sides. We also make sure to write // into memory, because if `dest` is a local we would not even have a way to write // at the `src` offsets; the fact that we came from a different layout would // just be lost. @@ -894,10 +894,10 @@ where Operand::Indirect(mplace) => mplace, Operand::Immediate(value) => { // We need to make an allocation. - // FIXME: Consider not doing anything for a ZST, and just returning + // FIXME: consider not doing anything for a ZST, and just returning // a fake pointer? Are we even called for ZST? - // We need the layout of the local. We can NOT use the layout we got, + // We need the layout of the local. We can NOT use the layout we got, // that might e.g., be an inner field of a struct with `Scalar` layout, // that has different alignment than the outer field. let local_layout = self.layout_of_local(&self.stack[frame], local)?; @@ -926,7 +926,7 @@ where ) -> MPlaceTy<'tcx, M::PointerTag> { if layout.is_unsized() { assert!(self.tcx.features().unsized_locals, "cannot alloc memory for unsized type"); - // FIXME: What should we do here? We should definitely also tag! + // FIXME: what should we do here? We should definitely also tag! MPlaceTy::dangling(layout, self) } else { let ptr = self.memory.allocate(layout.size, layout.align.abi, kind); diff --git a/src/librustc_mir/interpret/snapshot.rs b/src/librustc_mir/interpret/snapshot.rs index f9ce7b4319fac..4d93d4c89e49b 100644 --- a/src/librustc_mir/interpret/snapshot.rs +++ b/src/librustc_mir/interpret/snapshot.rs @@ -2,7 +2,7 @@ //! during const-evaluation by taking snapshots of the state of the interpreter //! at regular intervals. -// This lives in `interpret` because it needs access to all sots of private state. However, +// This lives in `interpret` because it needs access to all sots of private state. However, // it is not used by the general miri engine, just by CTFE. use std::hash::{Hash, Hasher}; @@ -417,7 +417,7 @@ impl<'a, 'mir, 'tcx> Eq for EvalSnapshot<'a, 'mir, 'tcx> impl<'a, 'mir, 'tcx> PartialEq for EvalSnapshot<'a, 'mir, 'tcx> { fn eq(&self, other: &Self) -> bool { - // FIXME: This looks to be a *ridicolously expensive* comparison operation. + // FIXME: this looks to be a *ridicolously expensive* comparison operation. // Doesn't this make tons of copies? Either `snapshot` is very badly named, // or it does! self.snapshot() == other.snapshot() diff --git a/src/librustc_mir/interpret/terminator.rs b/src/librustc_mir/interpret/terminator.rs index 951e9fabe5932..e9728c74acd6a 100644 --- a/src/librustc_mir/interpret/terminator.rs +++ b/src/librustc_mir/interpret/terminator.rs @@ -203,7 +203,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> fn pass_argument( &mut self, rust_abi: bool, - caller_arg: &mut impl Iterator>, + caller_arg: &mut impl Iterator>, callee_arg: PlaceTy<'tcx, M::PointerTag>, ) -> EvalResult<'tcx> { if rust_abi && callee_arg.layout.is_zst() { @@ -294,7 +294,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> )?; // We want to pop this frame again in case there was an error, to put - // the blame in the right location. Until the 2018 edition is used in + // the blame in the right location. Until the 2018 edition is used in // the compiler, we have to do this with an immediately invoked function. let res = (||{ trace!( @@ -323,7 +323,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> }; // For where they come from: If the ABI is RustCall, we untuple the - // last incoming argument. These two iterators do not have the same type, + // last incoming argument. These two iterators do not have the same type, // so to keep the code paths uniform we accept an allocation // (for RustCall ABI only). let caller_args : Cow<[OpTy<'tcx, M::PointerTag>]> = @@ -346,7 +346,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> .map(|op| *op); // Now we have to spread them out across the callee's locals, - // taking into account the `spread_arg`. If we could write + // taking into account the `spread_arg`. If we could write // this is a single iterator (that handles `spread_arg`), then // `pass_argument` would be the loop body. It takes care to // not advance `caller_iter` for ZSTs. @@ -435,8 +435,8 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> target: mir::BasicBlock, ) -> EvalResult<'tcx> { trace!("drop_in_place: {:?},\n {:?}, {:?}", *place, place.layout.ty, instance); - // We take the address of the object. This may well be unaligned, which is fine - // for us here. However, unaligned accesses will probably make the actual drop + // We take the address of the object. This may well be unaligned, which is fine + // for us here. However, unaligned accesses will probably make the actual drop // implementation fail -- a problem shared by rustc. let place = self.force_allocation(place)?; diff --git a/src/librustc_mir/interpret/validity.rs b/src/librustc_mir/interpret/validity.rs index a5fb44587400a..63b378ec05a2f 100644 --- a/src/librustc_mir/interpret/validity.rs +++ b/src/librustc_mir/interpret/validity.rs @@ -104,7 +104,7 @@ fn path_format(path: &Vec) -> String { ArrayElem(idx) => write!(out, "[{}]", idx), Deref => // This does not match Rust syntax, but it is more readable for long paths -- and - // some of the other items here also are not Rust syntax. Actually we can't + // some of the other items here also are not Rust syntax. Actually we can't // even use the usual syntax because we are just showing the projections, // not the root. write!(out, "."), @@ -331,7 +331,7 @@ impl<'rt, 'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> "invalid drop fn in vtable", self.path); try_validation!(self.ecx.read_size_and_align_from_vtable(vtable), "invalid size or align in vtable", self.path); - // FIXME: More checks for the vtable. + // FIXME: more checks for the vtable. } ty::Slice(..) | ty::Str => { try_validation!(meta.unwrap().to_usize(self.ecx), @@ -380,9 +380,9 @@ impl<'rt, 'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> let alloc_kind = self.ecx.tcx.alloc_map.lock().get(ptr.alloc_id); if let Some(AllocKind::Static(did)) = alloc_kind { // `extern static` cannot be validated as they have no body. - // FIXME: Statics from other crates are also skipped. + // FIXME: statics from other crates are also skipped. // They might be checked at a different type, but for now we - // want to avoid recursing too deeply. This is not sound! + // want to avoid recursing too deeply. This is not sound! if !did.is_local() || self.ecx.tcx.is_foreign_item(did) { return Ok(()); } @@ -396,7 +396,7 @@ impl<'rt, 'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> "dangling (not entirely in bounds) reference", self.path); } // Check if we have encountered this pointer+layout combination - // before. Proceed recursively even for integer pointers, no + // before. Proceed recursively even for integer pointers, no // reason to skip them! They are (recursively) valid for some ZST, // but not for others (e.g., `!` is a ZST). let op = place.into(); @@ -418,7 +418,7 @@ impl<'rt, 'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> value, self.path, "a pointer"); let _fn = try_validation!(self.ecx.memory.get_fn(ptr), value, self.path, "a function pointer"); - // FIXME: Check if the signature matches + // FIXME: check if the signature matches } // This should be all the primitive types _ => bug!("Unexpected primitive type {}", value.layout.ty) @@ -500,7 +500,7 @@ impl<'rt, 'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> fn visit_aggregate( &mut self, op: OpTy<'tcx, M::PointerTag>, - fields: impl Iterator>, + fields: impl Iterator>, ) -> EvalResult<'tcx> { match op.layout.ty.sty { ty::Str => { @@ -537,10 +537,10 @@ impl<'rt, 'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> // NOTE: Keep this in sync with the handling of integer and float // types above, in `visit_primitive`. - // In run-time mode, we accept pointers in here. This is actually more + // In run-time mode, we accept pointers in here. This is actually more // permissive than a per-element check would be, e.g., we accept // an &[u8] that contains a pointer even though bytewise checking would - // reject it. However, that's good: We don't inherently want + // reject it. However, that's good: We don't inherently want // to reject those pointers, we just do not have the machinery to // talk about parts of a pointer. // We also accept undef, for consistency with the type-based checks. diff --git a/src/librustc_mir/interpret/visitor.rs b/src/librustc_mir/interpret/visitor.rs index 4773f5627d716..c1a7009d0139d 100644 --- a/src/librustc_mir/interpret/visitor.rs +++ b/src/librustc_mir/interpret/visitor.rs @@ -154,7 +154,7 @@ macro_rules! make_value_visitor { fn visit_aggregate( &mut self, v: Self::V, - fields: impl Iterator>, + fields: impl Iterator>, ) -> EvalResult<'tcx> { self.walk_aggregate(v, fields) } @@ -227,7 +227,7 @@ macro_rules! make_value_visitor { fn walk_aggregate( &mut self, v: Self::V, - fields: impl Iterator>, + fields: impl Iterator>, ) -> EvalResult<'tcx> { // Now iterate over it. for (idx, field_val) in fields.enumerate() { @@ -271,7 +271,7 @@ macro_rules! make_value_visitor { // Things can be aggregates and have scalar layout at the same time, and that // is very relevant for `NonNull` and similar structs: We need to visit them // at their scalar layout *before* descending into their fields. - // FIXME: We could avoid some redundant checks here. For newtypes wrapping + // FIXME: we could avoid some redundant checks here. For newtypes wrapping // scalars, we do the same check on every "level" (e.g., first we check // MyNewtype and then the scalar in there). match v.layout().abi { @@ -281,12 +281,12 @@ macro_rules! make_value_visitor { layout::Abi::Scalar(ref layout) => { self.visit_scalar(v, layout)?; } - // FIXME: Should we do something for ScalarPair? Vector? + // FIXME: should we do something for `ScalarPair` and `Vector`? _ => {} } - // Check primitive types. We do this after checking the scalar layout, - // just to have that done as well. Primitives can have varying layout, + // Check primitive types. We do this after checking the scalar layout, + // just to have that done as well. Primitives can have varying layout, // so we check them separately and before aggregate handling. // It is CRITICAL that we get this check right, or we might be // validating the wrong thing! @@ -303,7 +303,7 @@ macro_rules! make_value_visitor { match v.layout().fields { layout::FieldPlacement::Union(fields) => { // Empty unions are not accepted by rustc. That's great, it means we can - // use that as an unambiguous signal for detecting primitives. Make sure + // use that as an unambiguous signal for detecting primitives. Make sure // we did not miss any primitive. debug_assert!(fields > 0); self.visit_union(v) @@ -323,7 +323,7 @@ macro_rules! make_value_visitor { Ok(()) } _ => { - // FIXME: We collect in a vec because otherwise there are lifetime + // FIXME: we collect in a vec because otherwise there are lifetime // errors: Projecting to a field needs access to `ecx`. let fields: Vec> = (0..offsets.len()).map(|i| { diff --git a/src/librustc_mir/lints.rs b/src/librustc_mir/lints.rs index 8ded31d89daea..c7e9baa9c1308 100644 --- a/src/librustc_mir/lints.rs +++ b/src/librustc_mir/lints.rs @@ -36,7 +36,7 @@ fn check_fn_for_unconditional_recursion(tcx: TyCtxt<'a, 'tcx, 'tcx>, // pretending that calls of `f` are sinks (i.e., ignoring any // exit edges from them). // - // NB. this has an edge case with non-returning statements, + // N.B., this has an edge case with non-returning statements, // like `loop {}` or `panic!()`: control flow never reaches // the exit node through these, so one can have a function // that never actually calls itself but is still picked up by @@ -132,9 +132,9 @@ fn check_fn_for_unconditional_recursion(tcx: TyCtxt<'a, 'tcx, 'tcx>, let node_id = tcx.hir().as_local_node_id(def_id).unwrap(); let sp = tcx.sess.source_map().def_span(tcx.hir().span(node_id)); let mut db = tcx.struct_span_lint_node(UNCONDITIONAL_RECURSION, - node_id, - sp, - "function cannot return without recursing"); + node_id, + sp, + "function cannot return without recursing"); db.span_label(sp, "cannot return without recursing"); // offer some help to the programmer. for location in &self_call_locations { diff --git a/src/librustc_mir/monomorphize/collector.rs b/src/librustc_mir/monomorphize/collector.rs index d81a4d6a4bc84..ba193f6bdefa2 100644 --- a/src/librustc_mir/monomorphize/collector.rs +++ b/src/librustc_mir/monomorphize/collector.rs @@ -710,7 +710,7 @@ fn visit_instance_use<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } } -// Returns true if we should codegen an instance in the local crate. +// Returns whether we should codegen an instance in the local crate. // Returns false if we can just link to the upstream crate and therefore don't // need a mono item. fn should_monomorphize_locally<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, instance: &Instance<'tcx>) diff --git a/src/librustc_mir/monomorphize/mod.rs b/src/librustc_mir/monomorphize/mod.rs index 7fa904d32cbb4..f43b5bc1b3acb 100644 --- a/src/librustc_mir/monomorphize/mod.rs +++ b/src/librustc_mir/monomorphize/mod.rs @@ -13,7 +13,7 @@ pub mod partitioning; #[inline(never)] // give this a place in the profiler pub fn assert_symbols_are_distinct<'a, 'tcx, I>(tcx: TyCtxt<'a, 'tcx, 'tcx>, mono_items: I) - where I: Iterator> + where I: Iterator> { let mut symbols: Vec<_> = mono_items.map(|mono_item| { (mono_item, mono_item.symbol_name(tcx)) @@ -92,7 +92,7 @@ fn needs_fn_once_adapter_shim(actual_closure_kind: ty::ClosureKind, Ok(false) } (ty::ClosureKind::Fn, ty::ClosureKind::FnMut) => { - // The closure fn `llfn` is a `fn(&self, ...)`. We want a + // The closure fn `llfn` is a `fn(&self, ...)`. We want a // `fn(&mut self, ...)`. In fact, at codegen time, these are // basically the same thing, so we can just return llfn. Ok(false) @@ -100,7 +100,7 @@ fn needs_fn_once_adapter_shim(actual_closure_kind: ty::ClosureKind, (ty::ClosureKind::Fn, ty::ClosureKind::FnOnce) | (ty::ClosureKind::FnMut, ty::ClosureKind::FnOnce) => { // The closure fn `llfn` is a `fn(&self, ...)` or `fn(&mut - // self, ...)`. We want a `fn(self, ...)`. We can produce + // self, ...)`. We want a `fn(self, ...)`. We can produce // this by doing something like: // // fn call_once(self, ...) { call_mut(&self, ...) } diff --git a/src/librustc_mir/monomorphize/partitioning.rs b/src/librustc_mir/monomorphize/partitioning.rs index c3613fbf04c1b..c8312022ce8db 100644 --- a/src/librustc_mir/monomorphize/partitioning.rs +++ b/src/librustc_mir/monomorphize/partitioning.rs @@ -764,7 +764,7 @@ fn characteristic_def_id_of_mono_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, }; // If this is a method, we want to put it into the same module as - // its self-type. If the self-type does not provide a characteristic + // its self type. If the self type does not provide a characteristic // DefId, we use the location of the impl after all. if tcx.trait_of_item(def_id).is_some() { @@ -775,7 +775,7 @@ fn characteristic_def_id_of_mono_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, if let Some(impl_def_id) = tcx.impl_of_method(def_id) { // This is a method within an inherent impl, find out what the - // self-type is: + // self type is: let impl_self_ty = tcx.subst_and_normalize_erasing_regions( instance.substs, ty::ParamEnv::reveal_all(), @@ -864,7 +864,7 @@ fn numbered_codegen_unit_name(name_builder: &mut CodegenUnitNameBuilder, fn debug_dump<'a, 'b, 'tcx, I>(tcx: TyCtxt<'a, 'tcx, 'tcx>, label: &str, cgus: I) - where I: Iterator>, + where I: Iterator>, 'tcx: 'a + 'b { if cfg!(debug_assertions) { diff --git a/src/librustc_mir/shim.rs b/src/librustc_mir/shim.rs index 1029611cecd56..51993344791c8 100644 --- a/src/librustc_mir/shim.rs +++ b/src/librustc_mir/shim.rs @@ -69,7 +69,7 @@ fn make_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, ) } ty::InstanceDef::Virtual(def_id, _) => { - // We are generating a call back to our def-id, which the + // We are generating a call back to our def-ID, which the // codegen backend knows to turn to an actual virtual call. build_call_shim( tcx, diff --git a/src/librustc_mir/transform/add_retag.rs b/src/librustc_mir/transform/add_retag.rs index 3d5897bca9f52..c9904df6be1f0 100644 --- a/src/librustc_mir/transform/add_retag.rs +++ b/src/librustc_mir/transform/add_retag.rs @@ -86,7 +86,7 @@ impl MirPass for AddRetag { let (span, arg_count) = (mir.span, mir.arg_count); let (basic_blocks, local_decls) = mir.basic_blocks_and_local_decls_mut(); let needs_retag = |place: &Place<'tcx>| { - // FIXME: Instead of giving up for unstable places, we should introduce + // FIXME: instead of giving up for unstable places, we should introduce // a temporary and retag on that. is_stable(place) && may_have_reference(place.ty(&*local_decls, tcx).to_ty(tcx), tcx) }; @@ -96,7 +96,7 @@ impl MirPass for AddRetag { { let source_info = SourceInfo { scope: OUTERMOST_SOURCE_SCOPE, - span: span, // FIXME: Consider using just the span covering the function + span: span, // FIXME: consider using just the span covering the function // argument declaration. }; // Gather all arguments, skip return value. @@ -114,7 +114,7 @@ impl MirPass for AddRetag { } // PART 2 - // Retag return values of functions. Also escape-to-raw the argument of `drop`. + // Retag return values of functions. Also escape-to-raw the argument of `drop`. // We collect the return destinations because we cannot mutate while iterating. let mut returns: Vec<(SourceInfo, Place<'tcx>, BasicBlock)> = Vec::new(); for block_data in basic_blocks.iter_mut() { @@ -151,7 +151,7 @@ impl MirPass for AddRetag { // PART 3 // Add retag after assignment. for block_data in basic_blocks { - // We want to insert statements as we iterate. To this end, we + // We want to insert statements as we iterate. To this end, we // iterate backwards using indices. for i in (0..block_data.statements.len()).rev() { let (retag_kind, place) = match block_data.statements[i].kind { @@ -172,7 +172,7 @@ impl MirPass for AddRetag { } } // Assignments of reference or ptr type are the ones where we may have - // to update tags. This includes `x = &[mut] ...` and hence + // to update tags. This includes `x = &[mut] ...` and hence // we also retag after taking a reference! StatementKind::Assign(ref place, box ref rvalue) if needs_retag(place) => { let kind = match rvalue { diff --git a/src/librustc_mir/transform/check_unsafety.rs b/src/librustc_mir/transform/check_unsafety.rs index 0b0845ef945d0..2bad5cb93ef81 100644 --- a/src/librustc_mir/transform/check_unsafety.rs +++ b/src/librustc_mir/transform/check_unsafety.rs @@ -496,7 +496,7 @@ fn unsafety_check_result<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) fn unsafe_derive_on_repr_packed<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) { let lint_node_id = match tcx.hir().as_local_node_id(def_id) { Some(node_id) => node_id, - None => bug!("checking unsafety for non-local def id {:?}", def_id) + None => bug!("checking unsafety for non-local def-ID {:?}", def_id) }; // FIXME: when we make this a hard error, this should have its diff --git a/src/librustc_mir/transform/inline.rs b/src/librustc_mir/transform/inline.rs index 8b970c1408e37..1f3e593d288a4 100644 --- a/src/librustc_mir/transform/inline.rs +++ b/src/librustc_mir/transform/inline.rs @@ -60,7 +60,7 @@ impl<'a, 'tcx> Inliner<'a, 'tcx> { // advantage of the fact that queries detect cycles here to // allow us to try and fetch the fully optimized MIR of a // call; if it succeeds, we can inline it and we know that - // they do not call us. Otherwise, we just don't try to + // they do not call us. Otherwise, we just don't try to // inline. // // We use a queue so that we inline "broadly" before we inline @@ -213,7 +213,7 @@ impl<'a, 'tcx> Inliner<'a, 'tcx> { let tcx = self.tcx; // Don't inline closures that have captures - // FIXME: Handle closures better + // FIXME: handle closures better if callee_mir.upvar_decls.len() > 0 { debug!(" upvar decls present - not inlining"); return false; @@ -276,7 +276,7 @@ impl<'a, 'tcx> Inliner<'a, 'tcx> { } debug!(" final inline threshold = {}", threshold); - // FIXME: Give a bonus to functions with only a single caller + // FIXME: give a bonus to functions with only a single caller let param_env = tcx.param_env(self.source.def_id); @@ -389,7 +389,7 @@ impl<'a, 'tcx> Inliner<'a, 'tcx> { mut callee_mir: Mir<'tcx>) -> bool { let terminator = caller_mir[callsite.bb].terminator.take().unwrap(); match terminator.kind { - // FIXME: Handle inlining of diverging calls + // FIXME: handle inlining of diverging calls TerminatorKind::Call { args, destination: Some(destination), cleanup, .. } => { debug!("Inlined {:?} into {:?}", callsite.callee, self.source); @@ -588,7 +588,7 @@ impl<'a, 'tcx> Inliner<'a, 'tcx> { callsite: &CallSite<'tcx>, caller_mir: &mut Mir<'tcx>, ) -> Local { - // FIXME: Analysis of the usage of the arguments to avoid + // FIXME: analysis of the usage of the arguments to avoid // unnecessary temporaries. if let Operand::Move(Place::Local(local)) = arg { diff --git a/src/librustc_mir/transform/mod.rs b/src/librustc_mir/transform/mod.rs index 4b7645b14fede..3006dd16f4ddb 100644 --- a/src/librustc_mir/transform/mod.rs +++ b/src/librustc_mir/transform/mod.rs @@ -56,7 +56,7 @@ fn is_mir_available<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> boo tcx.mir_keys(def_id.krate).contains(&def_id) } -/// Finds the full set of def-ids within the current crate that have +/// Finds the full set of def-IDs within the current crate that have /// MIR associated with them. fn mir_keys<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, krate: CrateNum) -> Lrc { @@ -256,7 +256,7 @@ fn optimized_mir<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx // elaboration. &add_moves_for_packed_drops::AddMovesForPackedDrops, // AddRetag needs to run after ElaborateDrops, and it needs - // an AllCallEdges pass right before it. Otherwise it should + // an AllCallEdges pass right before it. Otherwise it should // run fairly late, but before optimizations begin. &add_call_guards::AllCallEdges, &add_retag::AddRetag, diff --git a/src/librustc_mir/transform/qualify_consts.rs b/src/librustc_mir/transform/qualify_consts.rs index 7b04af62fe6cc..02c7a5192c54e 100644 --- a/src/librustc_mir/transform/qualify_consts.rs +++ b/src/librustc_mir/transform/qualify_consts.rs @@ -1310,7 +1310,7 @@ impl MirPass for QualifyAndPromoteConstants { debug!("run_pass: mode={:?}", mode); if mode == Mode::Fn || mode == Mode::ConstFn { - // This is ugly because Qualifier holds onto mir, + // This is ugly because `Qualifier` holds onto MIR, // which can't be mutated until its scope ends. let (temps, candidates) = { let mut qualifier = Qualifier::new(tcx, def_id, mir, mode); @@ -1321,7 +1321,7 @@ impl MirPass for QualifyAndPromoteConstants { if let Err((span, err)) = is_min_const_fn(tcx, def_id, mir) { tcx.sess.span_err(span, &err); } else { - // this should not produce any errors, but better safe than sorry + // This should not produce any errors, but better safe than sorry. // FIXME(#53819) qualifier.qualify_const(); } @@ -1358,7 +1358,7 @@ impl MirPass for QualifyAndPromoteConstants { *span, &format!("use of {} here does not actually short circuit due to \ the const evaluator presently not being able to do control flow. \ - See https://github.com/rust-lang/rust/issues/49146 for more \ + See for more \ information.", kind), ); } @@ -1406,7 +1406,7 @@ impl MirPass for QualifyAndPromoteConstants { } } - // Statics must be Sync. + // Statics must be `Sync`. if mode == Mode::Static { // `#[thread_local]` statics don't have to be `Sync`. for attr in &tcx.get_attrs(def_id)[..] { diff --git a/src/librustc_mir/transform/remove_noop_landing_pads.rs b/src/librustc_mir/transform/remove_noop_landing_pads.rs index c8ef2decf2606..ee49a0283533a 100644 --- a/src/librustc_mir/transform/remove_noop_landing_pads.rs +++ b/src/librustc_mir/transform/remove_noop_landing_pads.rs @@ -4,7 +4,7 @@ use rustc_data_structures::bit_set::BitSet; use transform::{MirPass, MirSource}; use util::patch::MirPatch; -/// A pass that removes no-op landing pads and replaces jumps to them with +/// A pass that removes noop landing pads and replaces jumps to them with /// `None`. This is important because otherwise LLVM generates terrible /// code for these. pub struct RemoveNoopLandingPads; diff --git a/src/librustc_mir/transform/rustc_peek.rs b/src/librustc_mir/transform/rustc_peek.rs index 36a6279e50320..d46227058a4f3 100644 --- a/src/librustc_mir/transform/rustc_peek.rs +++ b/src/librustc_mir/transform/rustc_peek.rs @@ -86,7 +86,7 @@ pub fn sanity_check_via_rustc_peek<'a, 'tcx, O>(tcx: TyCtxt<'a, 'tcx, 'tcx>, id: ast::NodeId, _attributes: &[ast::Attribute], results: &DataflowResults<'tcx, O>) - where O: BitDenotation<'tcx, Idx=MovePathIndex> + HasMoveData<'tcx> + where O: BitDenotation<'tcx, Idx = MovePathIndex> + HasMoveData<'tcx> { debug!("sanity_check_via_rustc_peek id: {:?}", id); // FIXME: this is not DRY. Figure out way to abstract this and @@ -102,7 +102,7 @@ fn each_block<'a, 'tcx, O>(tcx: TyCtxt<'a, 'tcx, 'tcx>, mir: &Mir<'tcx>, results: &DataflowResults<'tcx, O>, bb: mir::BasicBlock) where - O: BitDenotation<'tcx, Idx=MovePathIndex> + HasMoveData<'tcx> + O: BitDenotation<'tcx, Idx = MovePathIndex> + HasMoveData<'tcx> { let move_data = results.0.operator.move_data(); let mir::BasicBlockData { ref statements, ref terminator, is_cleanup: _ } = mir[bb]; diff --git a/src/librustc_mir/transform/simplify.rs b/src/librustc_mir/transform/simplify.rs index ed2da98dd5311..f5b1061951746 100644 --- a/src/librustc_mir/transform/simplify.rs +++ b/src/librustc_mir/transform/simplify.rs @@ -48,7 +48,7 @@ pub fn simplify_cfg(mir: &mut Mir) { CfgSimplifier::new(mir).simplify(); remove_dead_blocks(mir); - // FIXME: Should probably be moved into some kind of pass manager + // FIXME: should probably be moved into some kind of pass manager mir.basic_blocks_mut().raw.shrink_to_fit(); } @@ -348,7 +348,7 @@ impl<'tcx> Visitor<'tcx> for DeclMarker { fn visit_local(&mut self, local: &Local, ctx: PlaceContext<'tcx>, _: Location) { // Ignore storage markers altogether, they get removed along with their otherwise unused // decls. - // FIXME: Extend this to all non-uses. + // FIXME: extend this to all non-uses. if !ctx.is_storage_marker() { self.locals.insert(*local); } diff --git a/src/librustc_mir/util/elaborate_drops.rs b/src/librustc_mir/util/elaborate_drops.rs index 5a2f4be71cc2f..6e0dada952f4b 100644 --- a/src/librustc_mir/util/elaborate_drops.rs +++ b/src/librustc_mir/util/elaborate_drops.rs @@ -145,7 +145,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D> /// by the primary drop flag, but only the last rest-field dropped /// should clear it (and it must also not clear anything else). /// - /// FIXME: I think we should just control the flags externally + /// FIXME: i think we should just control the flags externally /// and then we do not need this machinery. pub fn elaborate_drop<'a>(&mut self, bb: BasicBlock) { debug!("elaborate_drop({:?})", self); diff --git a/src/librustc_passes/ast_validation.rs b/src/librustc_passes/ast_validation.rs index 584f0ba0449e1..a0e0b16f1c4c6 100644 --- a/src/librustc_passes/ast_validation.rs +++ b/src/librustc_passes/ast_validation.rs @@ -489,9 +489,9 @@ impl<'a> Visitor<'a> for AstValidator<'a> { } } -// Bans nested `impl Trait`, e.g., `impl Into`. -// Nested `impl Trait` _is_ allowed in associated type position, -// e.g `impl Iterator` +// Bans nested `impl Trait` (e.g., `impl Into`). +// Nested `impl Trait` _is_ allowed in associated type position +// (e.g., `impl Iterator`). struct NestedImplTraitVisitor<'a> { session: &'a Session, outer_impl_trait: Option, @@ -532,7 +532,7 @@ impl<'a> Visitor<'a> for NestedImplTraitVisitor<'a> { self.visit_generic_arg(arg) } for type_binding in &data.bindings { - // Type bindings such as `Item=impl Debug` in `Iterator` + // Type bindings such as `Item = impl Debug` in `Iterator` // are allowed to contain nested `impl Trait`. self.with_impl_trait(None, |this| visit::walk_ty(this, &type_binding.ty)); } diff --git a/src/librustc_passes/rvalue_promotion.rs b/src/librustc_passes/rvalue_promotion.rs index f0b559f80a28c..00415e29aac87 100644 --- a/src/librustc_passes/rvalue_promotion.rs +++ b/src/librustc_passes/rvalue_promotion.rs @@ -54,7 +54,7 @@ fn const_is_rvalue_promotable_to_static<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, assert!(def_id.is_local()); let node_id = tcx.hir().as_local_node_id(def_id) - .expect("rvalue_promotable_map invoked with non-local def-id"); + .expect("rvalue_promotable_map invoked with non-local def-ID"); let body_id = tcx.hir().body_owned_by(node_id); let body_hir_id = tcx.hir().node_to_hir_id(body_id.node_id); tcx.rvalue_promotable_map(def_id).contains(&body_hir_id.local_id) @@ -82,7 +82,7 @@ fn rvalue_promotable_map<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, // `def_id` should be a `Body` owner let node_id = tcx.hir().as_local_node_id(def_id) - .expect("rvalue_promotable_map invoked with non-local def-id"); + .expect("rvalue_promotable_map invoked with non-local def-ID"); let body_id = tcx.hir().body_owned_by(node_id); let _ = visitor.check_nested_body(body_id); @@ -136,7 +136,7 @@ impl BitOr for Promotability { } impl<'a, 'gcx> CheckCrateVisitor<'a, 'gcx> { - // Returns true iff all the values of the type are promotable. + // Returns whetherf all the values of the type are promotable. fn type_promotability(&mut self, ty: Ty<'gcx>) -> Promotability { debug!("type_promotability({})", ty); diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs index c6626c1551f4a..60a782f5f76ca 100644 --- a/src/librustc_privacy/lib.rs +++ b/src/librustc_privacy/lib.rs @@ -20,279 +20,22 @@ use rustc::hir::intravisit::{self, Visitor, NestedVisitorMap}; use rustc::hir::itemlikevisit::DeepVisitor; use rustc::lint; use rustc::middle::privacy::{AccessLevel, AccessLevels}; -use rustc::ty::{self, TyCtxt, Ty, TraitRef, TypeFoldable, GenericParamDefKind}; +use rustc::ty::{self, TyCtxt, Ty, TypeFoldable, GenericParamDefKind}; use rustc::ty::fold::TypeVisitor; use rustc::ty::query::Providers; -use rustc::ty::subst::Substs; +use rustc::ty::subst::UnpackedKind; use rustc::util::nodemap::NodeSet; use rustc_data_structures::fx::FxHashSet; use rustc_data_structures::sync::Lrc; use syntax::ast::{self, CRATE_NODE_ID, Ident}; -use syntax::attr; use syntax::symbol::keywords; use syntax_pos::Span; -use std::{cmp, fmt, mem}; -use std::marker::PhantomData; +use std::cmp; +use std::mem::replace; mod diagnostics; -//////////////////////////////////////////////////////////////////////////////// -/// Generic infrastructure used to implement specific visitors below. -//////////////////////////////////////////////////////////////////////////////// - -/// Implemented to visit all `DefId`s in a type. -/// Visiting `DefId`s is useful because visibilities and reachabilities are attached to them. -/// The idea is to visit "all components of a type", as documented in -/// https://github.com/rust-lang/rfcs/blob/master/text/2145-type-privacy.md#how-to-determine-visibility-of-a-type -/// Default type visitor (`TypeVisitor`) does most of the job, but it has some shortcomings. -/// First, it doesn't have overridable `fn visit_trait_ref`, so we have to catch trait def-ids -/// manually. Second, it doesn't visit some type components like signatures of fn types, or traits -/// in `impl Trait`, see individual commits in `DefIdVisitorSkeleton::visit_ty`. -trait DefIdVisitor<'a, 'tcx: 'a> { - fn tcx(&self) -> TyCtxt<'a, 'tcx, 'tcx>; - fn recurse_into_assoc_tys(&self) -> bool { true } - fn visit_def_id(&mut self, def_id: DefId, kind: &str, descr: &dyn fmt::Display) -> bool; - - /// Not overridden, but used to actually visit types and traits. - fn skeleton(&mut self) -> DefIdVisitorSkeleton<'_, 'a, 'tcx, Self> { - DefIdVisitorSkeleton { - def_id_visitor: self, - visited_opaque_tys: Default::default(), - dummy: Default::default(), - } - } - fn visit(&mut self, ty_fragment: impl TypeFoldable<'tcx>) -> bool { - ty_fragment.visit_with(&mut self.skeleton()) - } - fn visit_trait(&mut self, trait_ref: TraitRef<'tcx>) -> bool { - self.skeleton().visit_trait(trait_ref) - } - fn visit_predicates(&mut self, predicates: Lrc>) -> bool { - self.skeleton().visit_predicates(predicates) - } -} - -struct DefIdVisitorSkeleton<'v, 'a, 'tcx, V> - where V: DefIdVisitor<'a, 'tcx> + ?Sized -{ - def_id_visitor: &'v mut V, - visited_opaque_tys: FxHashSet, - dummy: PhantomData>, -} - -impl<'a, 'tcx, V> DefIdVisitorSkeleton<'_, 'a, 'tcx, V> - where V: DefIdVisitor<'a, 'tcx> + ?Sized -{ - fn visit_trait(&mut self, trait_ref: TraitRef<'tcx>) -> bool { - let TraitRef { def_id, substs } = trait_ref; - self.def_id_visitor.visit_def_id(def_id, "trait", &trait_ref) || substs.visit_with(self) - } - - fn visit_predicates(&mut self, predicates: Lrc>) -> bool { - let ty::GenericPredicates { parent: _, predicates } = &*predicates; - for (predicate, _span) in predicates { - match predicate { - ty::Predicate::Trait(poly_predicate) => { - let ty::TraitPredicate { trait_ref } = *poly_predicate.skip_binder(); - if self.visit_trait(trait_ref) { - return true; - } - } - ty::Predicate::Projection(poly_predicate) => { - let ty::ProjectionPredicate { projection_ty, ty } = - *poly_predicate.skip_binder(); - if ty.visit_with(self) { - return true; - } - if self.visit_trait(projection_ty.trait_ref(self.def_id_visitor.tcx())) { - return true; - } - } - ty::Predicate::TypeOutlives(poly_predicate) => { - let ty::OutlivesPredicate(ty, _region) = *poly_predicate.skip_binder(); - if ty.visit_with(self) { - return true; - } - } - ty::Predicate::RegionOutlives(..) => {}, - _ => bug!("unexpected predicate: {:?}", predicate), - } - } - false - } -} - -impl<'a, 'tcx, V> TypeVisitor<'tcx> for DefIdVisitorSkeleton<'_, 'a, 'tcx, V> - where V: DefIdVisitor<'a, 'tcx> + ?Sized -{ - fn visit_ty(&mut self, ty: Ty<'tcx>) -> bool { - let tcx = self.def_id_visitor.tcx(); - // Substs are not visited here because they are visited below in `super_visit_with`. - match ty.sty { - ty::Adt(&ty::AdtDef { did: def_id, .. }, ..) | - ty::Foreign(def_id) | - ty::FnDef(def_id, ..) | - ty::Closure(def_id, ..) | - ty::Generator(def_id, ..) => { - if self.def_id_visitor.visit_def_id(def_id, "type", ty) { - return true; - } - // Default type visitor doesn't visit signatures of fn types. - // Something like `fn() -> Priv {my_func}` is considered a private type even if - // `my_func` is public, so we need to visit signatures. - if let ty::FnDef(..) = ty.sty { - if tcx.fn_sig(def_id).visit_with(self) { - return true; - } - } - // Inherent static methods don't have self type in substs. - // Something like `fn() {my_method}` type of the method - // `impl Pub { pub fn my_method() {} }` is considered a private type, - // so we need to visit the self type additionally. - if let Some(assoc_item) = tcx.opt_associated_item(def_id) { - if let ty::ImplContainer(impl_def_id) = assoc_item.container { - if tcx.type_of(impl_def_id).visit_with(self) { - return true; - } - } - } - } - ty::Projection(proj) | ty::UnnormalizedProjection(proj) => { - if !self.def_id_visitor.recurse_into_assoc_tys() { - // Visitors searching for minimal visibility/reachability want to - // conservatively approximate associated types like `::Alias` - // as visible/reachable even if both `Type` and `Trait` are private. - // Ideally, associated types should be substituted in the same way as - // free type aliases, but this isn't done yet. - return false; - } - // This will also visit substs, so we don't need to recurse. - return self.visit_trait(proj.trait_ref(tcx)); - } - ty::Dynamic(predicates, ..) => { - for predicate in *predicates.skip_binder() { - let trait_ref = match *predicate { - ty::ExistentialPredicate::Trait(trait_ref) => trait_ref, - ty::ExistentialPredicate::Projection(proj) => proj.trait_ref(tcx), - ty::ExistentialPredicate::AutoTrait(def_id) => - ty::ExistentialTraitRef { def_id, substs: Substs::empty() }, - }; - let ty::ExistentialTraitRef { def_id, substs: _ } = trait_ref; - if self.def_id_visitor.visit_def_id(def_id, "trait", &trait_ref) { - return true; - } - } - } - ty::Opaque(def_id, ..) => { - // Skip repeated `Opaque`s to avoid infinite recursion. - if self.visited_opaque_tys.insert(def_id) { - // Default type visitor doesn't visit traits in `impl Trait`. - // Something like `impl PrivTr` is considered a private type, - // so we need to visit the traits additionally. - if self.visit_predicates(tcx.predicates_of(def_id)) { - return true; - } - } - } - // These types don't have their own def-ids (but may have subcomponents - // with def-ids that should be visited recursively). - ty::Bool | ty::Char | ty::Int(..) | ty::Uint(..) | - ty::Float(..) | ty::Str | ty::Never | - ty::Array(..) | ty::Slice(..) | ty::Tuple(..) | - ty::RawPtr(..) | ty::Ref(..) | ty::FnPtr(..) | - ty::Param(..) | ty::Error | ty::GeneratorWitness(..) => {} - ty::Bound(..) | ty::Placeholder(..) | ty::Infer(..) => - bug!("unexpected type: {:?}", ty), - } - - ty.super_visit_with(self) - } -} - -fn def_id_visibility<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) - -> (ty::Visibility, Span, &'static str) { - match tcx.hir().as_local_node_id(def_id) { - Some(node_id) => { - let vis = match tcx.hir().get(node_id) { - Node::Item(item) => &item.vis, - Node::ForeignItem(foreign_item) => &foreign_item.vis, - Node::TraitItem(..) | Node::Variant(..) => { - return def_id_visibility(tcx, tcx.hir().get_parent_did(node_id)); - } - Node::ImplItem(impl_item) => { - match tcx.hir().get(tcx.hir().get_parent(node_id)) { - Node::Item(item) => match &item.node { - hir::ItemKind::Impl(.., None, _, _) => &impl_item.vis, - hir::ItemKind::Impl(.., Some(trait_ref), _, _) - => return def_id_visibility(tcx, trait_ref.path.def.def_id()), - kind => bug!("unexpected item kind: {:?}", kind), - } - node => bug!("unexpected node kind: {:?}", node), - } - } - Node::StructCtor(vdata) => { - let struct_node_id = tcx.hir().get_parent(node_id); - let item = match tcx.hir().get(struct_node_id) { - Node::Item(item) => item, - node => bug!("unexpected node kind: {:?}", node), - }; - let (mut ctor_vis, mut span, mut descr) = - (ty::Visibility::from_hir(&item.vis, struct_node_id, tcx), - item.vis.span, item.vis.node.descr()); - for field in vdata.fields() { - let field_vis = ty::Visibility::from_hir(&field.vis, node_id, tcx); - if ctor_vis.is_at_least(field_vis, tcx) { - ctor_vis = field_vis; - span = field.vis.span; - descr = field.vis.node.descr(); - } - } - - // If the structure is marked as non_exhaustive then lower the - // visibility to within the crate. - if ctor_vis == ty::Visibility::Public { - let adt_def = tcx.adt_def(tcx.hir().get_parent_did(node_id)); - if adt_def.non_enum_variant().is_field_list_non_exhaustive() { - ctor_vis = ty::Visibility::Restricted(DefId::local(CRATE_DEF_INDEX)); - span = attr::find_by_name(&item.attrs, "non_exhaustive").unwrap().span; - descr = "crate-visible"; - } - } - - return (ctor_vis, span, descr); - } - Node::Expr(expr) => { - return (ty::Visibility::Restricted(tcx.hir().get_module_parent(expr.id)), - expr.span, "private") - } - node => bug!("unexpected node kind: {:?}", node) - }; - (ty::Visibility::from_hir(vis, node_id, tcx), vis.span, vis.node.descr()) - } - None => { - let vis = tcx.visibility(def_id); - let descr = if vis == ty::Visibility::Public { "public" } else { "private" }; - (vis, tcx.def_span(def_id), descr) - } - } -} - -// Set the correct `TypeckTables` for the given `item_id` (or an empty table if -// there is no `TypeckTables` for the item). -fn item_tables<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, - node_id: ast::NodeId, - empty_tables: &'a ty::TypeckTables<'tcx>) - -> &'a ty::TypeckTables<'tcx> { - let def_id = tcx.hir().local_def_id(node_id); - if tcx.has_typeck_tables(def_id) { tcx.typeck_tables_of(def_id) } else { empty_tables } -} - -fn min<'a, 'tcx>(vis1: ty::Visibility, vis2: ty::Visibility, tcx: TyCtxt<'a, 'tcx, 'tcx>) - -> ty::Visibility { - if vis1.is_at_least(vis2, tcx) { vis2 } else { vis1 } -} - //////////////////////////////////////////////////////////////////////////////// /// Visitor used to determine if pub(restricted) is used anywhere in the crate. /// @@ -313,59 +56,6 @@ impl<'a, 'tcx> Visitor<'tcx> for PubRestrictedVisitor<'a, 'tcx> { } } -//////////////////////////////////////////////////////////////////////////////// -/// Visitor used to determine impl visibility and reachability. -//////////////////////////////////////////////////////////////////////////////// - -struct FindMin<'a, 'tcx, VL: VisibilityLike> { - tcx: TyCtxt<'a, 'tcx, 'tcx>, - access_levels: &'a AccessLevels, - min: VL, -} - -impl<'a, 'tcx, VL: VisibilityLike> DefIdVisitor<'a, 'tcx> for FindMin<'a, 'tcx, VL> { - fn tcx(&self) -> TyCtxt<'a, 'tcx, 'tcx> { self.tcx } - fn recurse_into_assoc_tys(&self) -> bool { false } - fn visit_def_id(&mut self, def_id: DefId, _kind: &str, _descr: &dyn fmt::Display) -> bool { - self.min = VL::new_min(self, def_id); - false - } -} - -trait VisibilityLike: Sized { - const MAX: Self; - fn new_min<'a, 'tcx>(find: &FindMin<'a, 'tcx, Self>, def_id: DefId) -> Self; - - // Returns an over-approximation (`recurse_into_assoc_tys` = false) of visibility due to - // associated types for which we can't determine visibility precisely. - fn of_impl<'a, 'tcx>(node_id: ast::NodeId, tcx: TyCtxt<'a, 'tcx, 'tcx>, - access_levels: &'a AccessLevels) -> Self { - let mut find = FindMin { tcx, access_levels, min: Self::MAX }; - let def_id = tcx.hir().local_def_id(node_id); - find.visit(tcx.type_of(def_id)); - if let Some(trait_ref) = tcx.impl_trait_ref(def_id) { - find.visit_trait(trait_ref); - } - find.min - } -} -impl VisibilityLike for ty::Visibility { - const MAX: Self = ty::Visibility::Public; - fn new_min<'a, 'tcx>(find: &FindMin<'a, 'tcx, Self>, def_id: DefId) -> Self { - min(def_id_visibility(find.tcx, def_id).0, find.min, find.tcx) - } -} -impl VisibilityLike for Option { - const MAX: Self = Some(AccessLevel::Public); - fn new_min<'a, 'tcx>(find: &FindMin<'a, 'tcx, Self>, def_id: DefId) -> Self { - cmp::min(if let Some(node_id) = find.tcx.hir().as_local_node_id(def_id) { - find.access_levels.map.get(&node_id).cloned() - } else { - Self::MAX - }, find.min) - } -} - //////////////////////////////////////////////////////////////////////////////// /// The embargo visitor, used to determine the exports of the ast //////////////////////////////////////////////////////////////////////////////// @@ -388,6 +78,30 @@ struct ReachEverythingInTheInterfaceVisitor<'b, 'a: 'b, 'tcx: 'a> { } impl<'a, 'tcx> EmbargoVisitor<'a, 'tcx> { + fn item_ty_level(&self, item_def_id: DefId) -> Option { + let ty_def_id = match self.tcx.type_of(item_def_id).sty { + ty::Adt(adt, _) => adt.did, + ty::Foreign(did) => did, + ty::Dynamic(ref obj, ..) => obj.principal().def_id(), + ty::Projection(ref proj) => proj.trait_ref(self.tcx).def_id, + _ => return Some(AccessLevel::Public) + }; + if let Some(node_id) = self.tcx.hir().as_local_node_id(ty_def_id) { + self.get(node_id) + } else { + Some(AccessLevel::Public) + } + } + + fn impl_trait_level(&self, impl_def_id: DefId) -> Option { + if let Some(trait_ref) = self.tcx.impl_trait_ref(impl_def_id) { + if let Some(node_id) = self.tcx.hir().as_local_node_id(trait_ref.def_id) { + return self.get(node_id); + } + } + Some(AccessLevel::Public) + } + fn get(&self, id: ast::NodeId) -> Option { self.access_levels.map.get(&id).cloned() } @@ -405,10 +119,10 @@ impl<'a, 'tcx> EmbargoVisitor<'a, 'tcx> { } } - fn reach(&mut self, item_id: ast::NodeId, access_level: Option) - -> ReachEverythingInTheInterfaceVisitor<'_, 'a, 'tcx> { + fn reach<'b>(&'b mut self, item_id: ast::NodeId) + -> ReachEverythingInTheInterfaceVisitor<'b, 'a, 'tcx> { ReachEverythingInTheInterfaceVisitor { - access_level: cmp::min(access_level, Some(AccessLevel::Reachable)), + access_level: self.prev_level.map(|l| l.min(AccessLevel::Reachable)), item_def_id: self.tcx.hir().local_def_id(item_id), ev: self, } @@ -424,10 +138,15 @@ impl<'a, 'tcx> Visitor<'tcx> for EmbargoVisitor<'a, 'tcx> { fn visit_item(&mut self, item: &'tcx hir::Item) { let inherited_item_level = match item.node { - hir::ItemKind::Impl(..) => - Option::::of_impl(item.id, self.tcx, &self.access_levels), + // Impls inherit level from their types and traits. + hir::ItemKind::Impl(..) => { + let def_id = self.tcx.hir().local_def_id(item.id); + cmp::min(self.item_ty_level(def_id), self.impl_trait_level(def_id)) + } // Foreign modules inherit level from parents. - hir::ItemKind::ForeignMod(..) => self.prev_level, + hir::ItemKind::ForeignMod(..) => { + self.prev_level + } // Other `pub` items inherit levels from parents. hir::ItemKind::Const(..) | hir::ItemKind::Enum(..) | hir::ItemKind::ExternCrate(..) | hir::ItemKind::GlobalAsm(..) | hir::ItemKind::Fn(..) | hir::ItemKind::Mod(..) | @@ -452,13 +171,18 @@ impl<'a, 'tcx> Visitor<'tcx> for EmbargoVisitor<'a, 'tcx> { } } } - hir::ItemKind::Impl(.., ref trait_ref, _, ref impl_item_refs) => { + hir::ItemKind::Impl(.., None, _, ref impl_item_refs) => { for impl_item_ref in impl_item_refs { - if trait_ref.is_some() || impl_item_ref.vis.node.is_pub() { + if impl_item_ref.vis.node.is_pub() { self.update(impl_item_ref.id.node_id, item_level); } } } + hir::ItemKind::Impl(.., Some(_), _, ref impl_item_refs) => { + for impl_item_ref in impl_item_refs { + self.update(impl_item_ref.id.node_id, item_level); + } + } hir::ItemKind::Trait(.., ref trait_item_refs) => { for trait_item_ref in trait_item_refs { self.update(trait_item_ref.id.node_id, item_level); @@ -481,7 +205,15 @@ impl<'a, 'tcx> Visitor<'tcx> for EmbargoVisitor<'a, 'tcx> { } } } - hir::ItemKind::Existential(..) | + // Impl trait return types mark their parent function. + // It (and its children) are revisited if the change applies. + hir::ItemKind::Existential(ref ty_data) => { + if let Some(impl_trait_fn) = ty_data.impl_trait_fn { + if let Some(node_id) = self.tcx.hir().as_local_node_id(impl_trait_fn) { + self.update(node_id, Some(AccessLevel::ReachableFromImplTrait)); + } + } + } hir::ItemKind::Use(..) | hir::ItemKind::Static(..) | hir::ItemKind::Const(..) | @@ -493,6 +225,10 @@ impl<'a, 'tcx> Visitor<'tcx> for EmbargoVisitor<'a, 'tcx> { hir::ItemKind::ExternCrate(..) => {} } + // Store this node's access level here to propagate the correct + // reachability level through interfaces and children. + let orig_level = replace(&mut self.prev_level, item_level); + // Mark all items in interfaces of reachable items as reachable. match item.node { // The interface is empty. @@ -503,26 +239,26 @@ impl<'a, 'tcx> Visitor<'tcx> for EmbargoVisitor<'a, 'tcx> { hir::ItemKind::Use(..) => {} // The interface is empty. hir::ItemKind::GlobalAsm(..) => {} - hir::ItemKind::Existential(..) => { - // FIXME: This is some serious pessimization intended to workaround deficiencies - // in the reachability pass (`middle/reachable.rs`). Types are marked as link-time - // reachable if they are returned via `impl Trait`, even from private functions. - let exist_level = cmp::max(item_level, Some(AccessLevel::ReachableFromImplTrait)); - self.reach(item.id, exist_level).generics().predicates().ty(); + hir::ItemKind::Existential(hir::ExistTy { impl_trait_fn: Some(_), .. }) => { + if item_level.is_some() { + // Reach the (potentially private) type and the API being exposed. + self.reach(item.id).ty().predicates(); + } } // Visit everything. hir::ItemKind::Const(..) | hir::ItemKind::Static(..) | + hir::ItemKind::Existential(..) | hir::ItemKind::Fn(..) | hir::ItemKind::Ty(..) => { if item_level.is_some() { - self.reach(item.id, item_level).generics().predicates().ty(); + self.reach(item.id).generics().predicates().ty(); } } hir::ItemKind::Trait(.., ref trait_item_refs) => { if item_level.is_some() { - self.reach(item.id, item_level).generics().predicates(); + self.reach(item.id).generics().predicates(); for trait_item_ref in trait_item_refs { - let mut reach = self.reach(trait_item_ref.id.node_id, item_level); + let mut reach = self.reach(trait_item_ref.id.node_id); reach.generics().predicates(); if trait_item_ref.kind == hir::AssociatedItemKind::Type && @@ -536,19 +272,18 @@ impl<'a, 'tcx> Visitor<'tcx> for EmbargoVisitor<'a, 'tcx> { } hir::ItemKind::TraitAlias(..) => { if item_level.is_some() { - self.reach(item.id, item_level).generics().predicates(); + self.reach(item.id).generics().predicates(); } } // Visit everything except for private impl items. - hir::ItemKind::Impl(.., ref impl_item_refs) => { + hir::ItemKind::Impl(.., ref trait_ref, _, ref impl_item_refs) => { if item_level.is_some() { - self.reach(item.id, item_level).generics().predicates(); + self.reach(item.id).generics().predicates().impl_trait_ref(); for impl_item_ref in impl_item_refs { - let impl_item_level = self.get(impl_item_ref.id.node_id); - if impl_item_level.is_some() { - self.reach(impl_item_ref.id.node_id, impl_item_level) - .generics().predicates().ty(); + let id = impl_item_ref.id.node_id; + if trait_ref.is_some() || self.get(id).is_some() { + self.reach(id).generics().predicates().ty(); } } } @@ -557,27 +292,24 @@ impl<'a, 'tcx> Visitor<'tcx> for EmbargoVisitor<'a, 'tcx> { // Visit everything, but enum variants have their own levels. hir::ItemKind::Enum(ref def, _) => { if item_level.is_some() { - self.reach(item.id, item_level).generics().predicates(); + self.reach(item.id).generics().predicates(); } for variant in &def.variants { - let variant_level = self.get(variant.node.data.id()); - if variant_level.is_some() { + if self.get(variant.node.data.id()).is_some() { for field in variant.node.data.fields() { - self.reach(field.id, variant_level).ty(); + self.reach(field.id).ty(); } // Corner case: if the variant is reachable, but its // enum is not, make the enum reachable as well. - self.update(item.id, variant_level); + self.update(item.id, Some(AccessLevel::Reachable)); } } } // Visit everything, but foreign items have their own levels. hir::ItemKind::ForeignMod(ref foreign_mod) => { for foreign_item in &foreign_mod.items { - let foreign_item_level = self.get(foreign_item.id); - if foreign_item_level.is_some() { - self.reach(foreign_item.id, foreign_item_level) - .generics().predicates().ty(); + if self.get(foreign_item.id).is_some() { + self.reach(foreign_item.id).generics().predicates().ty(); } } } @@ -585,28 +317,29 @@ impl<'a, 'tcx> Visitor<'tcx> for EmbargoVisitor<'a, 'tcx> { hir::ItemKind::Struct(ref struct_def, _) | hir::ItemKind::Union(ref struct_def, _) => { if item_level.is_some() { - self.reach(item.id, item_level).generics().predicates(); + self.reach(item.id).generics().predicates(); for field in struct_def.fields() { - let field_level = self.get(field.id); - if field_level.is_some() { - self.reach(field.id, field_level).ty(); + if self.get(field.id).is_some() { + self.reach(field.id).ty(); } } } } } - let orig_level = mem::replace(&mut self.prev_level, item_level); intravisit::walk_item(self, item); + self.prev_level = orig_level; } fn visit_block(&mut self, b: &'tcx hir::Block) { + let orig_level = replace(&mut self.prev_level, None); + // Blocks can have public items, for example impls, but they always // start as completely private regardless of publicity of a function, // constant, type, field, etc., in which this block resides. - let orig_level = mem::replace(&mut self.prev_level, None); intravisit::walk_block(self, b); + self.prev_level = orig_level; } @@ -677,13 +410,13 @@ impl<'a, 'tcx> Visitor<'tcx> for EmbargoVisitor<'a, 'tcx> { } } -impl<'a, 'tcx> ReachEverythingInTheInterfaceVisitor<'_, 'a, 'tcx> { +impl<'b, 'a, 'tcx> ReachEverythingInTheInterfaceVisitor<'b, 'a, 'tcx> { fn generics(&mut self) -> &mut Self { for param in &self.ev.tcx.generics_of(self.item_def_id).params { match param.kind { GenericParamDefKind::Type { has_default, .. } => { if has_default { - self.visit(self.ev.tcx.type_of(param.def_id)); + self.ev.tcx.type_of(param.def_id).visit_with(self); } } GenericParamDefKind::Lifetime => {} @@ -693,23 +426,73 @@ impl<'a, 'tcx> ReachEverythingInTheInterfaceVisitor<'_, 'a, 'tcx> { } fn predicates(&mut self) -> &mut Self { - self.visit_predicates(self.ev.tcx.predicates_of(self.item_def_id)); + let predicates = self.ev.tcx.predicates_of(self.item_def_id); + for (predicate, _) in &predicates.predicates { + predicate.visit_with(self); + match predicate { + &ty::Predicate::Trait(poly_predicate) => { + self.check_trait_ref(poly_predicate.skip_binder().trait_ref); + }, + &ty::Predicate::Projection(poly_predicate) => { + let tcx = self.ev.tcx; + self.check_trait_ref( + poly_predicate.skip_binder().projection_ty.trait_ref(tcx) + ); + }, + _ => (), + }; + } self } fn ty(&mut self) -> &mut Self { - self.visit(self.ev.tcx.type_of(self.item_def_id)); + let ty = self.ev.tcx.type_of(self.item_def_id); + ty.visit_with(self); + if let ty::FnDef(def_id, _) = ty.sty { + if def_id == self.item_def_id { + self.ev.tcx.fn_sig(def_id).visit_with(self); + } + } + self + } + + fn impl_trait_ref(&mut self) -> &mut Self { + if let Some(impl_trait_ref) = self.ev.tcx.impl_trait_ref(self.item_def_id) { + self.check_trait_ref(impl_trait_ref); + impl_trait_ref.super_visit_with(self); + } self } + + fn check_trait_ref(&mut self, trait_ref: ty::TraitRef<'tcx>) { + if let Some(node_id) = self.ev.tcx.hir().as_local_node_id(trait_ref.def_id) { + let item = self.ev.tcx.hir().expect_item(node_id); + self.ev.update(item.id, self.access_level); + } + } } -impl<'a, 'tcx> DefIdVisitor<'a, 'tcx> for ReachEverythingInTheInterfaceVisitor<'_, 'a, 'tcx> { - fn tcx(&self) -> TyCtxt<'a, 'tcx, 'tcx> { self.ev.tcx } - fn visit_def_id(&mut self, def_id: DefId, _kind: &str, _descr: &dyn fmt::Display) -> bool { - if let Some(node_id) = self.ev.tcx.hir().as_local_node_id(def_id) { - self.ev.update(node_id, self.access_level); +impl<'b, 'a, 'tcx> TypeVisitor<'tcx> for ReachEverythingInTheInterfaceVisitor<'b, 'a, 'tcx> { + fn visit_ty(&mut self, ty: Ty<'tcx>) -> bool { + let ty_def_id = match ty.sty { + ty::Adt(adt, _) => Some(adt.did), + ty::Foreign(did) => Some(did), + ty::Dynamic(ref obj, ..) => Some(obj.principal().def_id()), + ty::Projection(ref proj) => Some(proj.item_def_id), + ty::FnDef(def_id, ..) | + ty::Closure(def_id, ..) | + ty::Generator(def_id, ..) | + ty::Opaque(def_id, _) => Some(def_id), + _ => None + }; + + if let Some(def_id) = ty_def_id { + if let Some(node_id) = self.ev.tcx.hir().as_local_node_id(def_id) { + self.ev.update(node_id, self.access_level); + } } - false + + ty.super_visit_with(self) } } @@ -745,6 +528,22 @@ impl<'a, 'tcx> NamePrivacyVisitor<'a, 'tcx> { } } +// Set the correct `TypeckTables` for the given `item_id` (or an empty table if +// there is no `TypeckTables` for the item). +fn update_tables<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, + item_id: ast::NodeId, + tables: &mut &'a ty::TypeckTables<'tcx>, + empty_tables: &'a ty::TypeckTables<'tcx>) + -> &'a ty::TypeckTables<'tcx> { + let def_id = tcx.hir().local_def_id(item_id); + + if tcx.has_typeck_tables(def_id) { + replace(tables, tcx.typeck_tables_of(def_id)) + } else { + replace(tables, empty_tables) + } +} + impl<'a, 'tcx> Visitor<'tcx> for NamePrivacyVisitor<'a, 'tcx> { /// We want to visit items in the context of their containing /// module and so forth, so supply a crate for doing a deep walk. @@ -753,31 +552,28 @@ impl<'a, 'tcx> Visitor<'tcx> for NamePrivacyVisitor<'a, 'tcx> { } fn visit_nested_body(&mut self, body: hir::BodyId) { - let orig_tables = mem::replace(&mut self.tables, self.tcx.body_tables(body)); + let orig_tables = replace(&mut self.tables, self.tcx.body_tables(body)); let body = self.tcx.hir().body(body); self.visit_body(body); self.tables = orig_tables; } fn visit_item(&mut self, item: &'tcx hir::Item) { - let orig_current_item = mem::replace(&mut self.current_item, item.id); - let orig_tables = - mem::replace(&mut self.tables, item_tables(self.tcx, item.id, self.empty_tables)); + let orig_current_item = replace(&mut self.current_item, item.id); + let orig_tables = update_tables(self.tcx, item.id, &mut self.tables, self.empty_tables); intravisit::walk_item(self, item); self.current_item = orig_current_item; self.tables = orig_tables; } fn visit_trait_item(&mut self, ti: &'tcx hir::TraitItem) { - let orig_tables = - mem::replace(&mut self.tables, item_tables(self.tcx, ti.id, self.empty_tables)); + let orig_tables = update_tables(self.tcx, ti.id, &mut self.tables, self.empty_tables); intravisit::walk_trait_item(self, ti); self.tables = orig_tables; } fn visit_impl_item(&mut self, ii: &'tcx hir::ImplItem) { - let orig_tables = - mem::replace(&mut self.tables, item_tables(self.tcx, ii.id, self.empty_tables)); + let orig_tables = update_tables(self.tcx, ii.id, &mut self.tables, self.empty_tables); intravisit::walk_impl_item(self, ii); self.tables = orig_tables; } @@ -848,22 +644,73 @@ struct TypePrivacyVisitor<'a, 'tcx: 'a> { in_body: bool, span: Span, empty_tables: &'a ty::TypeckTables<'tcx>, + visited_opaque_tys: FxHashSet } impl<'a, 'tcx> TypePrivacyVisitor<'a, 'tcx> { + fn def_id_visibility(&self, did: DefId) -> ty::Visibility { + match self.tcx.hir().as_local_node_id(did) { + Some(node_id) => { + let vis = match self.tcx.hir().get(node_id) { + Node::Item(item) => &item.vis, + Node::ForeignItem(foreign_item) => &foreign_item.vis, + Node::ImplItem(impl_item) => &impl_item.vis, + Node::TraitItem(..) | + Node::Variant(..) => { + return self.def_id_visibility(self.tcx.hir().get_parent_did(node_id)); + } + Node::StructCtor(vdata) => { + let struct_node_id = self.tcx.hir().get_parent(node_id); + let struct_vis = match self.tcx.hir().get(struct_node_id) { + Node::Item(item) => &item.vis, + node => bug!("unexpected node kind: {:?}", node), + }; + let mut ctor_vis + = ty::Visibility::from_hir(struct_vis, struct_node_id, self.tcx); + for field in vdata.fields() { + let field_vis = ty::Visibility::from_hir(&field.vis, node_id, self.tcx); + if ctor_vis.is_at_least(field_vis, self.tcx) { + ctor_vis = field_vis; + } + } + + // If the structure is marked as non_exhaustive then lower the + // visibility to within the crate. + let struct_def_id = self.tcx.hir().get_parent_did(node_id); + let adt_def = self.tcx.adt_def(struct_def_id); + if adt_def.non_enum_variant().is_field_list_non_exhaustive() + && ctor_vis == ty::Visibility::Public + { + ctor_vis = ty::Visibility::Restricted( + DefId::local(CRATE_DEF_INDEX)); + } + + return ctor_vis; + } + node => bug!("unexpected node kind: {:?}", node) + }; + ty::Visibility::from_hir(vis, node_id, self.tcx) + } + None => self.tcx.visibility(did), + } + } + fn item_is_accessible(&self, did: DefId) -> bool { - def_id_visibility(self.tcx, did).0.is_accessible_from(self.current_item, self.tcx) + self.def_id_visibility(did).is_accessible_from(self.current_item, self.tcx) } - // Take node-id of an expression or pattern and check its type for privacy. + // Take node-ID of an expression or pattern and check its type for privacy. fn check_expr_pat_type(&mut self, id: hir::HirId, span: Span) -> bool { self.span = span; - if self.visit(self.tables.node_id_to_type(id)) || self.visit(self.tables.node_substs(id)) { + if self.tables.node_id_to_type(id).visit_with(self) { + return true; + } + if self.tables.node_substs(id).visit_with(self) { return true; } if let Some(adjustments) = self.tables.adjustments().get(id) { for adjustment in adjustments { - if self.visit(adjustment.target) { + if adjustment.target.visit_with(self) { return true; } } @@ -871,12 +718,14 @@ impl<'a, 'tcx> TypePrivacyVisitor<'a, 'tcx> { false } - fn check_def_id(&mut self, def_id: DefId, kind: &str, descr: &dyn fmt::Display) -> bool { - let is_error = !self.item_is_accessible(def_id); - if is_error { - self.tcx.sess.span_err(self.span, &format!("{} `{}` is private", kind, descr)); + fn check_trait_ref(&mut self, trait_ref: ty::TraitRef<'tcx>) -> bool { + if !self.item_is_accessible(trait_ref.def_id) { + let msg = format!("trait `{}` is private", trait_ref); + self.tcx.sess.span_err(self.span, &msg); + return true; } - is_error + + trait_ref.super_visit_with(self) } } @@ -888,8 +737,8 @@ impl<'a, 'tcx> Visitor<'tcx> for TypePrivacyVisitor<'a, 'tcx> { } fn visit_nested_body(&mut self, body: hir::BodyId) { - let orig_tables = mem::replace(&mut self.tables, self.tcx.body_tables(body)); - let orig_in_body = mem::replace(&mut self.in_body, true); + let orig_tables = replace(&mut self.tables, self.tcx.body_tables(body)); + let orig_in_body = replace(&mut self.in_body, true); let body = self.tcx.hir().body(body); self.visit_body(body); self.tables = orig_tables; @@ -900,14 +749,14 @@ impl<'a, 'tcx> Visitor<'tcx> for TypePrivacyVisitor<'a, 'tcx> { self.span = hir_ty.span; if self.in_body { // Types in bodies. - if self.visit(self.tables.node_id_to_type(hir_ty.hir_id)) { + if self.tables.node_id_to_type(hir_ty.hir_id).visit_with(self) { return; } } else { // Types in signatures. - // FIXME: This is very ineffective. Ideally each HIR type should be converted + // FIXME: this is very ineffective. Ideally each HIR type should be converted // into a semantic type only once and the result should be cached somehow. - if self.visit(rustc_typeck::hir_ty_to_ty(self.tcx, hir_ty)) { + if rustc_typeck::hir_ty_to_ty(self.tcx, hir_ty).visit_with(self) { return; } } @@ -922,13 +771,12 @@ impl<'a, 'tcx> Visitor<'tcx> for TypePrivacyVisitor<'a, 'tcx> { // The traits' privacy in bodies is already checked as a part of trait object types. let (principal, projections) = rustc_typeck::hir_trait_to_predicates(self.tcx, trait_ref); - if self.visit_trait(*principal.skip_binder()) { + if self.check_trait_ref(*principal.skip_binder()) { return; } for (poly_predicate, _) in projections { let tcx = self.tcx; - if self.visit(poly_predicate.skip_binder().ty) || - self.visit_trait(poly_predicate.skip_binder().projection_ty.trait_ref(tcx)) { + if self.check_trait_ref(poly_predicate.skip_binder().projection_ty.trait_ref(tcx)) { return; } } @@ -954,7 +802,8 @@ impl<'a, 'tcx> Visitor<'tcx> for TypePrivacyVisitor<'a, 'tcx> { // Method calls have to be checked specially. self.span = span; if let Some(def) = self.tables.type_dependent_defs().get(expr.hir_id) { - if self.visit(self.tcx.type_of(def.def_id())) { + let def_id = def.def_id(); + if self.tcx.type_of(def_id).visit_with(self) { return; } } else { @@ -978,8 +827,7 @@ impl<'a, 'tcx> Visitor<'tcx> for TypePrivacyVisitor<'a, 'tcx> { let def = match *qpath { hir::QPath::Resolved(_, ref path) => match path.def { Def::Method(..) | Def::AssociatedConst(..) | - Def::AssociatedTy(..) | Def::AssociatedExistential(..) | - Def::Static(..) => Some(path.def), + Def::AssociatedTy(..) | Def::Static(..) => Some(path.def), _ => None, } hir::QPath::TypeRelative(..) => { @@ -1026,11 +874,13 @@ impl<'a, 'tcx> Visitor<'tcx> for TypePrivacyVisitor<'a, 'tcx> { // Check types in item interfaces. fn visit_item(&mut self, item: &'tcx hir::Item) { - let orig_current_item = - mem::replace(&mut self.current_item, self.tcx.hir().local_def_id(item.id)); - let orig_in_body = mem::replace(&mut self.in_body, false); - let orig_tables = - mem::replace(&mut self.tables, item_tables(self.tcx, item.id, self.empty_tables)); + let orig_current_item = self.current_item; + let orig_tables = update_tables(self.tcx, + item.id, + &mut self.tables, + self.empty_tables); + let orig_in_body = replace(&mut self.in_body, false); + self.current_item = self.tcx.hir().local_def_id(item.id); intravisit::walk_item(self, item); self.tables = orig_tables; self.in_body = orig_in_body; @@ -1038,24 +888,108 @@ impl<'a, 'tcx> Visitor<'tcx> for TypePrivacyVisitor<'a, 'tcx> { } fn visit_trait_item(&mut self, ti: &'tcx hir::TraitItem) { - let orig_tables = - mem::replace(&mut self.tables, item_tables(self.tcx, ti.id, self.empty_tables)); + let orig_tables = update_tables(self.tcx, ti.id, &mut self.tables, self.empty_tables); intravisit::walk_trait_item(self, ti); self.tables = orig_tables; } fn visit_impl_item(&mut self, ii: &'tcx hir::ImplItem) { - let orig_tables = - mem::replace(&mut self.tables, item_tables(self.tcx, ii.id, self.empty_tables)); + let orig_tables = update_tables(self.tcx, ii.id, &mut self.tables, self.empty_tables); intravisit::walk_impl_item(self, ii); self.tables = orig_tables; } } -impl<'a, 'tcx> DefIdVisitor<'a, 'tcx> for TypePrivacyVisitor<'a, 'tcx> { - fn tcx(&self) -> TyCtxt<'a, 'tcx, 'tcx> { self.tcx } - fn visit_def_id(&mut self, def_id: DefId, kind: &str, descr: &dyn fmt::Display) -> bool { - self.check_def_id(def_id, kind, descr) +impl<'a, 'tcx> TypeVisitor<'tcx> for TypePrivacyVisitor<'a, 'tcx> { + fn visit_ty(&mut self, ty: Ty<'tcx>) -> bool { + match ty.sty { + ty::Adt(&ty::AdtDef { did: def_id, .. }, ..) | + ty::FnDef(def_id, ..) | + ty::Foreign(def_id) => { + if !self.item_is_accessible(def_id) { + let msg = format!("type `{}` is private", ty); + self.tcx.sess.span_err(self.span, &msg); + return true; + } + if let ty::FnDef(..) = ty.sty { + if self.tcx.fn_sig(def_id).visit_with(self) { + return true; + } + } + // Inherent static methods don't have self type in substs, + // we have to check it additionally. + if let Some(assoc_item) = self.tcx.opt_associated_item(def_id) { + if let ty::ImplContainer(impl_def_id) = assoc_item.container { + if self.tcx.type_of(impl_def_id).visit_with(self) { + return true; + } + } + } + } + ty::Dynamic(ref predicates, ..) => { + let is_private = predicates.skip_binder().iter().any(|predicate| { + let def_id = match *predicate { + ty::ExistentialPredicate::Trait(trait_ref) => trait_ref.def_id, + ty::ExistentialPredicate::Projection(proj) => + proj.trait_ref(self.tcx).def_id, + ty::ExistentialPredicate::AutoTrait(def_id) => def_id, + }; + !self.item_is_accessible(def_id) + }); + if is_private { + let msg = format!("type `{}` is private", ty); + self.tcx.sess.span_err(self.span, &msg); + return true; + } + } + ty::Projection(ref proj) => { + let tcx = self.tcx; + if self.check_trait_ref(proj.trait_ref(tcx)) { + return true; + } + } + ty::Opaque(def_id, ..) => { + for (predicate, _) in &self.tcx.predicates_of(def_id).predicates { + let trait_ref = match *predicate { + ty::Predicate::Trait(ref poly_trait_predicate) => { + Some(poly_trait_predicate.skip_binder().trait_ref) + } + ty::Predicate::Projection(ref poly_projection_predicate) => { + if poly_projection_predicate.skip_binder().ty.visit_with(self) { + return true; + } + Some(poly_projection_predicate.skip_binder() + .projection_ty.trait_ref(self.tcx)) + } + ty::Predicate::TypeOutlives(..) | ty::Predicate::RegionOutlives(..) => None, + _ => bug!("unexpected predicate: {:?}", predicate), + }; + if let Some(trait_ref) = trait_ref { + if !self.item_is_accessible(trait_ref.def_id) { + let msg = format!("trait `{}` is private", trait_ref); + self.tcx.sess.span_err(self.span, &msg); + return true; + } + for subst in trait_ref.substs.iter() { + // Skip repeated `Opaque`s to avoid infinite recursion. + if let UnpackedKind::Type(ty) = subst.unpack() { + if let ty::Opaque(def_id, ..) = ty.sty { + if !self.visited_opaque_tys.insert(def_id) { + continue; + } + } + } + if subst.visit_with(self) { + return true; + } + } + } + } + } + _ => {} + } + + ty.super_visit_with(self) } } @@ -1349,13 +1283,13 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> { } for predicate in &generics.where_clause.predicates { match predicate { - hir::WherePredicate::BoundPredicate(bound_pred) => { + &hir::WherePredicate::BoundPredicate(ref bound_pred) => { for bound in bound_pred.bounds.iter() { self.check_generic_bound(bound) } } - hir::WherePredicate::RegionPredicate(_) => {} - hir::WherePredicate::EqPredicate(eq_pred) => { + &hir::WherePredicate::RegionPredicate(_) => {} + &hir::WherePredicate::EqPredicate(ref eq_pred) => { self.visit_ty(&eq_pred.rhs_ty); } } @@ -1396,7 +1330,7 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> { // We don't need to introspect into these at all: an // expression/block context can't possibly contain exported things. - // (Making them no-ops stops us from traversing the whole AST without + // (Making them noops stops us from traversing the whole AST without // having to be super careful about our `walk_...` calls above.) fn visit_block(&mut self, _: &'tcx hir::Block) {} fn visit_expr(&mut self, _: &'tcx hir::Expr) {} @@ -1415,6 +1349,8 @@ struct SearchInterfaceForPrivateItemsVisitor<'a, 'tcx: 'a> { span: Span, /// The visitor checks that each component type is at least this visible. required_visibility: ty::Visibility, + /// The visibility of the least visible component that has been visited. + min_visibility: ty::Visibility, has_pub_restricted: bool, has_old_errors: bool, in_assoc_ty: bool, @@ -1426,7 +1362,7 @@ impl<'a, 'tcx: 'a> SearchInterfaceForPrivateItemsVisitor<'a, 'tcx> { match param.kind { GenericParamDefKind::Type { has_default, .. } => { if has_default { - self.visit(self.tcx.type_of(param.def_id)); + self.tcx.type_of(param.def_id).visit_with(self); } } GenericParamDefKind::Lifetime => {} @@ -1442,47 +1378,132 @@ impl<'a, 'tcx: 'a> SearchInterfaceForPrivateItemsVisitor<'a, 'tcx> { // consider the ones that the user wrote. This is important // for the inferred outlives rules; see // `src/test/ui/rfc-2093-infer-outlives/privacy.rs`. - self.visit_predicates(self.tcx.explicit_predicates_of(self.item_def_id)); + let predicates = self.tcx.explicit_predicates_of(self.item_def_id); + for (predicate, _) in &predicates.predicates { + predicate.visit_with(self); + match predicate { + &ty::Predicate::Trait(poly_predicate) => { + self.check_trait_ref(poly_predicate.skip_binder().trait_ref); + }, + &ty::Predicate::Projection(poly_predicate) => { + let tcx = self.tcx; + self.check_trait_ref( + poly_predicate.skip_binder().projection_ty.trait_ref(tcx) + ); + }, + _ => (), + }; + } self } fn ty(&mut self) -> &mut Self { - self.visit(self.tcx.type_of(self.item_def_id)); + let ty = self.tcx.type_of(self.item_def_id); + ty.visit_with(self); + if let ty::FnDef(def_id, _) = ty.sty { + if def_id == self.item_def_id { + self.tcx.fn_sig(def_id).visit_with(self); + } + } self } - fn check_def_id(&mut self, def_id: DefId, kind: &str, descr: &dyn fmt::Display) -> bool { - let node_id = match self.tcx.hir().as_local_node_id(def_id) { - Some(node_id) => node_id, - None => return false, - }; + fn impl_trait_ref(&mut self) -> &mut Self { + if let Some(impl_trait_ref) = self.tcx.impl_trait_ref(self.item_def_id) { + self.check_trait_ref(impl_trait_ref); + impl_trait_ref.super_visit_with(self); + } + self + } - let (vis, vis_span, vis_descr) = def_id_visibility(self.tcx, def_id); - if !vis.is_at_least(self.required_visibility, self.tcx) { - let msg = format!("{} {} `{}` in public interface", vis_descr, kind, descr); - if self.has_pub_restricted || self.has_old_errors || self.in_assoc_ty { - let mut err = if kind == "trait" { - struct_span_err!(self.tcx.sess, self.span, E0445, "{}", msg) + fn check_trait_ref(&mut self, trait_ref: ty::TraitRef<'tcx>) { + // Non-local means public (private items can't leave their crate, modulo bugs). + if let Some(node_id) = self.tcx.hir().as_local_node_id(trait_ref.def_id) { + let item = self.tcx.hir().expect_item(node_id); + let vis = ty::Visibility::from_hir(&item.vis, node_id, self.tcx); + if !vis.is_at_least(self.min_visibility, self.tcx) { + self.min_visibility = vis; + } + if !vis.is_at_least(self.required_visibility, self.tcx) { + if self.has_pub_restricted || self.has_old_errors || self.in_assoc_ty { + struct_span_err!(self.tcx.sess, self.span, E0445, + "private trait `{}` in public interface", trait_ref) + .span_label(self.span, format!( + "can't leak private trait")) + .emit(); } else { - struct_span_err!(self.tcx.sess, self.span, E0446, "{}", msg) - }; - err.span_label(self.span, format!("can't leak {} {}", vis_descr, kind)); - err.span_label(vis_span, format!("`{}` declared as {}", descr, vis_descr)); - err.emit(); - } else { - let err_code = if kind == "trait" { "E0445" } else { "E0446" }; - self.tcx.lint_node(lint::builtin::PRIVATE_IN_PUBLIC, node_id, self.span, - &format!("{} (error {})", msg, err_code)); + self.tcx.lint_node(lint::builtin::PRIVATE_IN_PUBLIC, + node_id, + self.span, + &format!("private trait `{}` in public \ + interface (error E0445)", trait_ref)); + } } } - false } } -impl<'a, 'tcx> DefIdVisitor<'a, 'tcx> for SearchInterfaceForPrivateItemsVisitor<'a, 'tcx> { - fn tcx(&self) -> TyCtxt<'a, 'tcx, 'tcx> { self.tcx } - fn visit_def_id(&mut self, def_id: DefId, kind: &str, descr: &dyn fmt::Display) -> bool { - self.check_def_id(def_id, kind, descr) +impl<'a, 'tcx: 'a> TypeVisitor<'tcx> for SearchInterfaceForPrivateItemsVisitor<'a, 'tcx> { + fn visit_ty(&mut self, ty: Ty<'tcx>) -> bool { + let ty_def_id = match ty.sty { + ty::Adt(adt, _) => Some(adt.did), + ty::Foreign(did) => Some(did), + ty::Dynamic(ref obj, ..) => Some(obj.principal().def_id()), + ty::Projection(ref proj) => { + if self.required_visibility == ty::Visibility::Invisible { + // Conservatively approximate the whole type alias as public without + // recursing into its components when determining impl publicity. + // For example, `impl ::Alias {...}` may be a public impl + // even if both `Type` and `Trait` are private. + // Ideally, associated types should be substituted in the same way as + // free type aliases, but this isn't done yet. + return false; + } + let trait_ref = proj.trait_ref(self.tcx); + Some(trait_ref.def_id) + } + _ => None + }; + + if let Some(def_id) = ty_def_id { + // Non-local means public (private items can't leave their crate, modulo bugs). + if let Some(node_id) = self.tcx.hir().as_local_node_id(def_id) { + let hir_vis = match self.tcx.hir().find(node_id) { + Some(Node::Item(item)) => &item.vis, + Some(Node::ForeignItem(item)) => &item.vis, + _ => bug!("expected item of foreign item"), + }; + + let vis = ty::Visibility::from_hir(hir_vis, node_id, self.tcx); + + if !vis.is_at_least(self.min_visibility, self.tcx) { + self.min_visibility = vis; + } + if !vis.is_at_least(self.required_visibility, self.tcx) { + let vis_adj = match hir_vis.node { + hir::VisibilityKind::Crate(_) => "crate-visible", + hir::VisibilityKind::Restricted { .. } => "restricted", + _ => "private" + }; + + if self.has_pub_restricted || self.has_old_errors || self.in_assoc_ty { + let mut err = struct_span_err!(self.tcx.sess, self.span, E0446, + "{} type `{}` in public interface", vis_adj, ty); + err.span_label(self.span, format!("can't leak {} type", vis_adj)); + err.span_label(hir_vis.span, format!("`{}` declared as {}", ty, vis_adj)); + err.emit(); + } else { + self.tcx.lint_node(lint::builtin::PRIVATE_IN_PUBLIC, + node_id, + self.span, + &format!("{} type `{}` in public \ + interface (error E0446)", vis_adj, ty)); + } + } + } + } + + ty.super_visit_with(self) } } @@ -1490,6 +1511,7 @@ struct PrivateItemsInPublicInterfacesVisitor<'a, 'tcx: 'a> { tcx: TyCtxt<'a, 'tcx, 'tcx>, has_pub_restricted: bool, old_error_set: &'a NodeSet, + inner_visibility: ty::Visibility, } impl<'a, 'tcx> PrivateItemsInPublicInterfacesVisitor<'a, 'tcx> { @@ -1522,6 +1544,7 @@ impl<'a, 'tcx> PrivateItemsInPublicInterfacesVisitor<'a, 'tcx> { tcx: self.tcx, item_def_id: self.tcx.hir().local_def_id(item_id), span: self.tcx.hir().span(item_id), + min_visibility: ty::Visibility::Public, required_visibility, has_pub_restricted: self.has_pub_restricted, has_old_errors, @@ -1537,6 +1560,10 @@ impl<'a, 'tcx> Visitor<'tcx> for PrivateItemsInPublicInterfacesVisitor<'a, 'tcx> fn visit_item(&mut self, item: &'tcx hir::Item) { let tcx = self.tcx; + let min = |vis1: ty::Visibility, vis2| { + if vis1.is_at_least(vis2, tcx) { vis2 } else { vis1 } + }; + let item_visibility = ty::Visibility::from_hir(&item.vis, item.id, tcx); match item.node { @@ -1548,10 +1575,23 @@ impl<'a, 'tcx> Visitor<'tcx> for PrivateItemsInPublicInterfacesVisitor<'a, 'tcx> hir::ItemKind::Use(..) => {} // No subitems. hir::ItemKind::GlobalAsm(..) => {} + hir::ItemKind::Existential(hir::ExistTy { impl_trait_fn: Some(_), .. }) => { + // Check the traits being exposed, as they're separate, + // e.g., `impl Iterator` has two predicates, + // `X: Iterator` and `::Item == T`, + // where `X` is the `impl Iterator` itself, + // stored in `predicates_of`, not in the `Ty` itself. + self.check(item.id, item_visibility).predicates(); + } // Subitems of these items have inherited publicity. hir::ItemKind::Const(..) | hir::ItemKind::Static(..) | hir::ItemKind::Fn(..) | - hir::ItemKind::Existential(..) | hir::ItemKind::Ty(..) => { + hir::ItemKind::Existential(..) | + hir::ItemKind::Ty(..) => { self.check(item.id, item_visibility).generics().predicates().ty(); + + // Recurse for e.g., `impl Trait` (see `visit_ty`). + self.inner_visibility = item_visibility; + intravisit::walk_item(self, item); } hir::ItemKind::Trait(.., ref trait_item_refs) => { self.check(item.id, item_visibility).generics().predicates(); @@ -1595,30 +1635,56 @@ impl<'a, 'tcx> Visitor<'tcx> for PrivateItemsInPublicInterfacesVisitor<'a, 'tcx> for field in struct_def.fields() { let field_visibility = ty::Visibility::from_hir(&field.vis, item.id, tcx); - self.check(field.id, min(item_visibility, field_visibility, tcx)).ty(); + self.check(field.id, min(item_visibility, field_visibility)).ty(); } } // An inherent impl is public when its type is public // Subitems of inherent impls have their own publicity. + hir::ItemKind::Impl(.., None, _, ref impl_item_refs) => { + let ty_vis = + self.check(item.id, ty::Visibility::Invisible).ty().min_visibility; + self.check(item.id, ty_vis).generics().predicates(); + + for impl_item_ref in impl_item_refs { + let impl_item = self.tcx.hir().impl_item(impl_item_ref.id); + let impl_item_vis = ty::Visibility::from_hir(&impl_item.vis, item.id, tcx); + let mut check = self.check(impl_item.id, min(impl_item_vis, ty_vis)); + check.in_assoc_ty = impl_item_ref.kind == hir::AssociatedItemKind::Type; + check.generics().predicates().ty(); + + // Recurse for e.g., `impl Trait` (see `visit_ty`). + self.inner_visibility = impl_item_vis; + intravisit::walk_impl_item(self, impl_item); + } + } // A trait impl is public when both its type and its trait are public // Subitems of trait impls have inherited publicity. - hir::ItemKind::Impl(.., ref trait_ref, _, ref impl_item_refs) => { - let impl_vis = ty::Visibility::of_impl(item.id, tcx, &Default::default()); - self.check(item.id, impl_vis).generics().predicates(); + hir::ItemKind::Impl(.., Some(_), _, ref impl_item_refs) => { + let vis = self.check(item.id, ty::Visibility::Invisible) + .ty().impl_trait_ref().min_visibility; + self.check(item.id, vis).generics().predicates(); for impl_item_ref in impl_item_refs { - let impl_item = tcx.hir().impl_item(impl_item_ref.id); - let impl_item_vis = if trait_ref.is_none() { - min(ty::Visibility::from_hir(&impl_item.vis, item.id, tcx), impl_vis, tcx) - } else { - impl_vis - }; - let mut check = self.check(impl_item.id, impl_item_vis); + let impl_item = self.tcx.hir().impl_item(impl_item_ref.id); + let mut check = self.check(impl_item.id, vis); check.in_assoc_ty = impl_item_ref.kind == hir::AssociatedItemKind::Type; check.generics().predicates().ty(); + + // Recurse for e.g., `impl Trait` (see `visit_ty`). + self.inner_visibility = vis; + intravisit::walk_impl_item(self, impl_item); } } } } + + fn visit_impl_item(&mut self, _impl_item: &'tcx hir::ImplItem) { + // Handled in `visit_item` above. + } + + // Don't recurse into expressions in array sizes or const initializers. + fn visit_expr(&mut self, _: &'tcx hir::Expr) {} + // Don't recurse into patterns in function arguments. + fn visit_pat(&mut self, _: &'tcx hir::Pat) {} } pub fn provide(providers: &mut Providers) { @@ -1658,6 +1724,7 @@ fn privacy_access_levels<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, in_body: false, span: krate.span, empty_tables: &empty_tables, + visited_opaque_tys: FxHashSet::default() }; intravisit::walk_crate(&mut visitor, krate); @@ -1703,6 +1770,7 @@ fn privacy_access_levels<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, tcx, has_pub_restricted, old_error_set: &visitor.old_error_set, + inner_visibility: ty::Visibility::Public, }; krate.visit_all_item_likes(&mut DeepVisitor::new(&mut visitor)); } diff --git a/src/librustc_resolve/build_reduced_graph.rs b/src/librustc_resolve/build_reduced_graph.rs index 21fb29974c880..3d37a29fcfb38 100644 --- a/src/librustc_resolve/build_reduced_graph.rs +++ b/src/librustc_resolve/build_reduced_graph.rs @@ -619,7 +619,7 @@ impl<'a> Resolver<'a> { /// Builds the reduced graph for a single item in an external crate. fn build_reduced_graph_for_external_crate_def(&mut self, parent: Module<'a>, child: Export) { let Export { ident, def, vis, span } = child; - // FIXME: We shouldn't create the gensym here, it should come from metadata, + // FIXME: we shouldn't create the gensym here, it should come from metadata, // but metadata cannot encode gensyms currently, so we create it here. // This is only a guess, two equivalent idents may incorrectly get different gensyms here. let ident = ident.gensym_if_underscore(); diff --git a/src/librustc_resolve/diagnostics.rs b/src/librustc_resolve/diagnostics.rs index 84a9c80ab2f7b..a93d3a592a898 100644 --- a/src/librustc_resolve/diagnostics.rs +++ b/src/librustc_resolve/diagnostics.rs @@ -1,7 +1,7 @@ #![allow(non_snake_case)] -// Error messages for EXXXX errors. Each message should start and end with a -// new line, and be wrapped to 80 characters. In vim you can `:set tw=80` and +// Error messages for EXXXX errors. Each message should start and end with a +// new line, and be wrapped to 80 characters. In vim you can `:set tw=80` and // use `gq` to wrap paragraphs. Use `:set tw=0` to disable. register_long_diagnostics! { @@ -10,7 +10,7 @@ Type parameter defaults can only use parameters that occur before them. Erroneous code example: ```compile_fail,E0128 -struct Foo { +struct Foo { field1: T, filed2: U, } @@ -22,7 +22,7 @@ Since type parameters are evaluated in-order, you may be able to fix this issue by doing: ``` -struct Foo { +struct Foo { field1: T, filed2: U, } diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index 47f9ad5398bca..cd90ea0edd8c9 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -24,6 +24,15 @@ extern crate rustc; extern crate rustc_data_structures; extern crate rustc_metadata; +// N.B., this module needs to be declared first so diagnostics are +// registered before they are used. +mod diagnostics; +mod error_reporting; +mod macros; +mod check_unused; +mod build_reduced_graph; +mod resolve_imports; + pub use rustc::hir::def::{Namespace, PerNS}; use self::TypeParameters::*; @@ -76,15 +85,6 @@ use rustc_data_structures::sync::Lrc; use resolve_imports::{ImportDirective, ImportDirectiveSubclass, NameResolution, ImportResolver}; use macros::{InvocationData, LegacyBinding, ParentScope}; -// N.B., this module needs to be declared first so diagnostics are -// registered before they are used. -mod diagnostics; -mod error_reporting; -mod macros; -mod check_unused; -mod build_reduced_graph; -mod resolve_imports; - fn is_known_tool(name: Name) -> bool { ["clippy", "rustfmt"].contains(&&*name.as_str()) } @@ -139,45 +139,45 @@ impl Ord for BindingError { } enum ResolutionError<'a> { - /// error E0401: can't use type parameters from outer function + /// Error E0401: can't use type parameters from outer function. TypeParametersFromOuterFunction(Def), - /// error E0403: the name is already used for a type parameter in this type parameter list + /// Error E0403: the name is already used for a type parameter in this type parameter list. NameAlreadyUsedInTypeParameterList(Name, &'a Span), - /// error E0407: method is not a member of trait + /// Error E0407: method is not a member of trait. MethodNotMemberOfTrait(Name, &'a str), - /// error E0437: type is not a member of trait + /// Error E0437: type is not a member of trait. TypeNotMemberOfTrait(Name, &'a str), - /// error E0438: const is not a member of trait + /// Error E0438: const is not a member of trait. ConstNotMemberOfTrait(Name, &'a str), - /// error E0408: variable `{}` is not bound in all patterns + /// Error E0408: variable `{}` is not bound in all patterns. VariableNotBoundInPattern(&'a BindingError), - /// error E0409: variable `{}` is bound in inconsistent ways within the same match arm + /// Error E0409: variable `{}` is bound in inconsistent ways within the same match arm. VariableBoundWithDifferentMode(Name, Span), - /// error E0415: identifier is bound more than once in this parameter list + /// Error E0415: identifier is bound more than once in this parameter list. IdentifierBoundMoreThanOnceInParameterList(&'a str), - /// error E0416: identifier is bound more than once in the same pattern + /// Error E0416: identifier is bound more than once in the same pattern. IdentifierBoundMoreThanOnceInSamePattern(&'a str), - /// error E0426: use of undeclared label + /// Error E0426: use of undeclared label. UndeclaredLabel(&'a str, Option), - /// error E0429: `self` imports are only allowed within a { } list + /// Error E0429: `self` imports are only allowed within a `{ }` list. SelfImportsOnlyAllowedWithin, - /// error E0430: `self` import can only appear once in the list + /// Error E0430: `self` import can only appear once in the list. SelfImportCanOnlyAppearOnceInTheList, - /// error E0431: `self` import can only appear in an import list with a non-empty prefix + /// Error E0431: `self` import can only appear in an import list with a non-empty prefix. SelfImportOnlyInImportListWithNonEmptyPrefix, - /// error E0433: failed to resolve + /// Error E0433: failed to resolve. FailedToResolve(&'a str), - /// error E0434: can't capture dynamic environment in a fn item + /// Error E0434: can't capture dynamic environment in a fn item. CannotCaptureDynamicEnvironmentInFnItem, - /// error E0435: attempt to use a non-constant value in a constant + /// Error E0435: attempt to use a non-constant value in a constant. AttemptToUseNonConstantValueInConstant, - /// error E0530: X bindings cannot shadow Ys + /// Error E0530: `X` bindings cannot shadow `Y`s. BindingShadowsSomethingUnacceptable(&'a str, Name, &'a NameBinding<'a>), - /// error E0128: type parameters with a default cannot use forward declared identifiers + /// Error E0128: type parameters with a default cannot use forward declared identifiers. ForwardDeclaredTyParam, } -/// Combines an error with provided span and emits it +/// Combines an error with provided span and emits it. /// /// This takes the error provided, combines it with the span and any additional spans inside the /// error and emits it. @@ -233,10 +233,10 @@ fn resolve_struct_error<'sess, 'a>(resolver: &'sess Resolver, } // Try to retrieve the span of the function signature and generate a new message with - // a local type parameter + // a local type parameter. let sugg_msg = "try using a local type parameter instead"; if let Some((sugg_span, new_snippet)) = cm.generate_local_type_param_snippet(span) { - // Suggest the modification to the user + // Suggest the modification to the user. err.span_suggestion_with_applicability( sugg_span, sugg_msg, @@ -418,11 +418,11 @@ fn resolve_struct_error<'sess, 'a>(resolver: &'sess Resolver, /// Adjust the impl span so that just the `impl` keyword is taken by removing /// everything after `<` (`"impl Iterator for A {}" -> "impl"`) and -/// everything after the first whitespace (`"impl Iterator for A" -> "impl"`) +/// everything after the first whitespace (`"impl Iterator for A" -> "impl"`). /// -/// Attention: The method used is very fragile since it essentially duplicates the work of the +/// *Attention*: the method used is very fragile since it essentially duplicates the work of the /// parser. If you need to use this function or something similar, please consider updating the -/// source_map functions and this function to something more robust. +/// `source_map` functions and this function to something more robust. fn reduce_impl_span_to_impl_keyword(cm: &SourceMap, impl_span: Span) -> Span { let impl_span = cm.span_until_char(impl_span, '<'); let impl_span = cm.span_until_whitespace(impl_span); @@ -483,7 +483,7 @@ enum PathSource<'a> { TupleStruct, // `m::A::B` in `::B::C`. TraitItem(Namespace), - // Path in `pub(path)` + // Path in `pub(path)`. Visibility, } @@ -529,8 +529,8 @@ impl<'a> PathSource<'a> { MacroNS => bug!("associated macro"), }, PathSource::Expr(parent) => match parent.map(|p| &p.node) { - // "function" here means "anything callable" rather than `Def::Fn`, - // this is not precise but usually more helpful than just "value". + // "Function" here means "anything callable" rather than `Def::Fn`; + // this is not precise, but usually more helpful than just "value". Some(&ExprKind::Call(..)) => "function", _ => "value", }, @@ -698,28 +698,28 @@ impl<'tcx> Visitor<'tcx> for UsePlacementFinder { visit::walk_mod(self, module); return; } - // find a use statement + // Find a `use` statement. for item in &module.items { match item.node { ItemKind::Use(..) => { - // don't suggest placing a use before the prelude - // import or other generated ones + // Don't suggest placing a use before the prelude + // import or other generated ones. if item.span.ctxt().outer().expn_info().is_none() { self.span = Some(item.span.shrink_to_lo()); self.found_use = true; return; } }, - // don't place use before extern crate + // Don't place use before `extern crate` ... ItemKind::ExternCrate(_) => {} - // but place them before the first other item + // ... but do place them before the first other item. _ => if self.span.map_or(true, |span| item.span < span ) { if item.span.ctxt().outer().expn_info().is_none() { - // don't insert between attributes and an item + // Don't insert between attributes and an item. if item.attrs.is_empty() { self.span = Some(item.span.shrink_to_lo()); } else { - // find the first attribute on the item + // Find the first attribute on the item. for attr in &item.attrs { if self.span.map_or(true, |span| attr.span < span) { self.span = Some(attr.span.shrink_to_lo()); @@ -733,28 +733,34 @@ impl<'tcx> Visitor<'tcx> for UsePlacementFinder { } } -/// This thing walks the whole crate in DFS manner, visiting each item, resolving names as it goes. +/// Walks the whole crate in DFS order, visiting each item, resolving names as it goes. impl<'a, 'tcx> Visitor<'tcx> for Resolver<'a> { fn visit_item(&mut self, item: &'tcx Item) { self.resolve_item(item); } + fn visit_arm(&mut self, arm: &'tcx Arm) { self.resolve_arm(arm); } + fn visit_block(&mut self, block: &'tcx Block) { self.resolve_block(block); } + fn visit_anon_const(&mut self, constant: &'tcx ast::AnonConst) { self.with_constant_rib(|this| { visit::walk_anon_const(this, constant); }); } + fn visit_expr(&mut self, expr: &'tcx Expr) { self.resolve_expr(expr, None); } + fn visit_local(&mut self, local: &'tcx Local) { self.resolve_local(local); } + fn visit_ty(&mut self, ty: &'tcx Ty) { match ty.node { TyKind::Path(ref qself, ref path) => { @@ -770,13 +776,15 @@ impl<'a, 'tcx> Visitor<'tcx> for Resolver<'a> { } visit::walk_ty(self, ty); } + fn visit_poly_trait_ref(&mut self, - tref: &'tcx ast::PolyTraitRef, + tr: &'tcx ast::PolyTraitRef, m: &'tcx ast::TraitBoundModifier) { - self.smart_resolve_path(tref.trait_ref.ref_id, None, - &tref.trait_ref.path, PathSource::Trait(AliasPossibility::Maybe)); - visit::walk_poly_trait_ref(self, tref, m); + self.smart_resolve_path(tr.trait_ref.ref_id, None, + &tr.trait_ref.path, PathSource::Trait(AliasPossibility::Maybe)); + visit::walk_poly_trait_ref(self, tr, m); } + fn visit_foreign_item(&mut self, foreign_item: &'tcx ForeignItem) { let type_parameters = match foreign_item.node { ForeignItemKind::Fn(_, ref generics) => { @@ -790,6 +798,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Resolver<'a> { visit::walk_foreign_item(this, foreign_item); }); } + fn visit_fn(&mut self, function_kind: FnKind<'tcx>, declaration: &'tcx FnDecl, @@ -803,7 +812,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Resolver<'a> { (TraitOrImplItemRibKind, sig.header.asyncness), FnKind::Closure(_) => // Async closures aren't resolved through `visit_fn`-- they're - // processed separately + // processed separately. (ClosureRibKind(node_id), IsAsync::NotAsync), }; @@ -824,7 +833,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Resolver<'a> { } visit::walk_fn_ret_ty(self, &declaration.output); - // Resolve the function body, potentially inside the body of an async closure + // Resolve the function body, potentially inside the body of an async closure. if let IsAsync::Async { closure_id, .. } = asyncness { let rib_kind = ClosureRibKind(closure_id); self.ribs[ValueNS].push(Rib::new(rib_kind)); @@ -852,6 +861,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Resolver<'a> { self.label_ribs.pop(); self.ribs[ValueNS].pop(); } + fn visit_generics(&mut self, generics: &'tcx Generics) { // For type parameter defaults, we have to ban access // to following type parameters, as the Substs can only @@ -901,11 +911,12 @@ impl<'a, 'tcx> Visitor<'tcx> for Resolver<'a> { #[derive(Copy, Clone)] enum TypeParameters<'a, 'b> { NoTypeParameters, - HasTypeParameters(// Type parameters. - &'b Generics, - - // The kind of the rib used for type parameters. - RibKind<'a>), + HasTypeParameters( + // Type parameters. + &'b Generics, + // The kind of the rib used for type parameters. + RibKind<'a> + ), } /// The rib kind controls the translation of local @@ -915,7 +926,7 @@ enum RibKind<'a> { /// No translation needs to be applied. NormalRibKind, - /// We passed through a closure scope at the given node ID. + /// We passed through a closure scope at the given node-ID. /// Translate upvars as appropriate. ClosureRibKind(NodeId /* func id */), @@ -943,7 +954,7 @@ enum RibKind<'a> { ForwardTyParamBanRibKind, } -/// One local scope. +/// A single local scope. /// /// A rib represents a scope names can live in. Note that these appear in many places, not just /// around braces. At any place where the list of accessible names (of the given namespace) @@ -1037,7 +1048,7 @@ enum PathResult<'a> { } enum ModuleKind { - /// An anonymous module, eg. just a block. + /// An anonymous module; e.g., just a block. /// /// ``` /// fn main() { @@ -1065,7 +1076,7 @@ pub struct ModuleData<'a> { parent: Option>, kind: ModuleKind, - // The def id of the closest normal module (`mod`) ancestor (including this module). + // The def-ID of the closest normal module (`mod`) ancestor (including this module). normal_ancestor_id: DefId, resolutions: RefCell>>>, @@ -1226,11 +1237,11 @@ struct PrivacyError<'a>(Span, Ident, &'a NameBinding<'a>); struct UseError<'a> { err: DiagnosticBuilder<'a>, - /// Attach `use` statements for these candidates + /// Attach `use` statements for these candidates. candidates: Vec, - /// The node id of the module to place the use statements in + /// The node-ID of the module to place the use statements in. node_id: NodeId, - /// Whether the diagnostic should state that it's "better" + /// Whether the diagnostic should state that it's "better". better: bool, } @@ -1321,7 +1332,7 @@ impl<'a> NameBinding<'a> { } } - // We sometimes need to treat variants as `pub` for backwards compatibility + // We sometimes need to treat variants as `pub` for backwards compatibility. fn pseudo_vis(&self) -> ty::Visibility { if self.is_variant() && self.def().def_id().is_local() { ty::Visibility::Public @@ -1402,9 +1413,9 @@ impl<'a> NameBinding<'a> { // Then this function returns `true` if `self` may emerge from a macro *after* that // in some later round and screw up our previously found resolution. // See more detailed explanation in - // https://github.com/rust-lang/rust/pull/53778#issuecomment-419224049 + // https://github.com/rust-lang/rust/pull/53778#issuecomment-419224049. fn may_appear_after(&self, invoc_parent_expansion: Mark, binding: &NameBinding) -> bool { - // self > max(invoc, binding) => !(self <= invoc || self <= binding) + // `self > max(invoc, binding) => !(self <= invoc || self <= binding)` // Expansions are partially ordered, so "may appear after" is an inversion of // "certainly appears before or simultaneously" and includes unordered cases. let self_parent_expansion = self.expansion; @@ -1475,7 +1486,7 @@ pub struct Resolver<'a> { prelude: Option>, pub extern_prelude: FxHashMap>, - /// n.b. This is used only for better diagnostics, not name resolution itself. + /// N.B., this is used only for better diagnostics, not name resolution itself. has_self: FxHashSet, /// Names of fields of an item `DefId` accessible with dot syntax. @@ -1492,7 +1503,7 @@ pub struct Resolver<'a> { current_module: Module<'a>, /// The current set of local scopes for types and values. - /// FIXME #4948: Reuse ribs to avoid allocation. + /// FIXME(#4948): reuse ribs to avoid allocation. ribs: PerNS>>, /// The current set of local scopes, for labels. @@ -1507,7 +1518,7 @@ pub struct Resolver<'a> { /// The current self item if inside an ADT (used for better errors). current_self_item: Option, - /// FIXME: Refactor things so that these fields are passed through arguments and not resolver. + /// FIXME: refactor things so that these fields are passed through arguments and not resolver. /// We are resolving a last import segment during import validation. last_import_segment: bool, /// This binding should be ignored during in-module resolution, so that we don't get @@ -1556,13 +1567,13 @@ pub struct Resolver<'a> { /// they are used (in a `break` or `continue` statement) pub unused_labels: FxHashMap, - /// privacy errors are delayed until the end in order to deduplicate them + /// Privacy errors are delayed until the end in order to deduplicate them. privacy_errors: Vec>, - /// ambiguity errors are delayed for deduplication + /// Ambiguity errors are delayed for deduplication. ambiguity_errors: Vec>, - /// `use` injections are delayed for better placement and deduplication + /// `use` injections are delayed for better placement and deduplication. use_injections: Vec>, - /// crate-local macro expanded `macro_export` referred to by a module-relative path + /// Crate-local macro expanded `macro_export` referred to by a module-relative path. macro_expanded_macro_export_errors: BTreeSet<(Span, Span)>, arenas: &'a ResolverArenas<'a>, @@ -1589,17 +1600,17 @@ pub struct Resolver<'a> { potentially_unused_imports: Vec<&'a ImportDirective<'a>>, - /// This table maps struct IDs into struct constructor IDs, + /// Table for mapping struct IDs into struct constructor IDs, /// it's not used during normal resolution, only for better error reporting. struct_constructors: DefIdMap<(Def, ty::Visibility)>, - /// Only used for better errors on `fn(): fn()` + /// Only used for better errors on `fn(): fn()`. current_type_ascription: Vec, injected_crate: Option>, } -/// Nothing really interesting here, it just provides memory for the rest of the crate. +/// Nothing really interesting here; it just provides memory for the rest of the crate. #[derive(Default)] pub struct ResolverArenas<'a> { modules: arena::TypedArena>, @@ -1699,7 +1710,7 @@ impl<'a> hir::lowering::Resolver for Resolver<'a> { } impl<'a> Resolver<'a> { - /// Rustdoc uses this to resolve things in a recoverable way. ResolutionError<'a> + /// Rustdoc uses this to resolve things in a recoverable way. `ResolutionError<'a>` /// isn't something that can be returned because it can't be made to live that long, /// and also it's a private type. Fortunately rustdoc doesn't need to know the error, /// just that an error occurred. @@ -1736,7 +1747,7 @@ impl<'a> Resolver<'a> { } } - /// resolve_hir_path, but takes a callback in case there was an error + /// `resolve_hir_path`, but takes a callback in case there was an error. fn resolve_hir_path_cb( &mut self, path: &ast::Path, @@ -1749,7 +1760,7 @@ impl<'a> Resolver<'a> { let span = path.span; let segments = &path.segments; let path = Segment::from_path(&path); - // FIXME (Manishearth): Intra doc links won't get warned of epoch changes + // FIXME(manishearth): intra-doc links won't get warned of epoch changes. let def = match self.resolve_path_without_parent_scope(&path, Some(namespace), true, span, CrateLint::No) { PathResult::Module(ModuleOrUniformRoot::Module(module)) => @@ -1837,8 +1848,7 @@ impl<'a> Resolver<'a> { definitions, - // The outermost module has def ID 0; this is not reflected in the - // AST. + // The outermost module has def-ID `0`; this is not reflected in the AST. graph_root, prelude: None, extern_prelude, @@ -2072,7 +2082,8 @@ impl<'a> Resolver<'a> { } match module.kind { - ModuleKind::Block(..) => {}, // We can see through blocks + // We can see through blocks. + ModuleKind::Block(..) => {}, _ => break, } } @@ -2088,7 +2099,8 @@ impl<'a> Resolver<'a> { }; module = unwrap_or!(opt_module, break); let orig_current_module = self.current_module; - self.current_module = module; // Lexical resolutions can never be a privacy error. + // Lexical resolutions can never be a privacy error. + self.current_module = module; let result = self.resolve_ident_in_module_unadjusted( ModuleOrUniformRoot::Module(module), ident, @@ -2165,7 +2177,7 @@ impl<'a> Resolver<'a> { return module; } - // We need to support the next case under a deprecation warning + // We need to support the next case under a deprecation warning. // ``` // struct MyStruct; // ---- begin: this comes from a proc macro derive @@ -2180,7 +2192,7 @@ impl<'a> Resolver<'a> { // Inner module is inside the macro, parent module is outside of the macro. if module.expansion != parent.expansion && module.expansion.is_descendant_of(parent.expansion) { - // The macro is a proc macro derive + // The macro is a proc macro derive. if module.expansion.looks_like_proc_macro_derive() { if parent.expansion.is_descendant_of(span.ctxt().outer()) { *poisoned = Some(node_id); @@ -2246,7 +2258,7 @@ impl<'a> Resolver<'a> { // When resolving `$crate` from a `macro_rules!` invoked in a `macro`, // we don't want to pretend that the `macro_rules!` definition is in the `macro` // as described in `SyntaxContext::apply_mark`, so we ignore prepended modern marks. - // FIXME: This is only a guess and it doesn't work correctly for `macro_rules!` + // FIXME: this is only a guess and it doesn't work correctly for `macro_rules!` // definitions actually produced by `macro` and `macro` definitions produced by // `macro_rules!`, but at least such configurations are not stable yet. ctxt = ctxt.modern_and_legacy(); @@ -2290,7 +2302,7 @@ impl<'a> Resolver<'a> { module } - // AST resolution + // # AST resolution // // We maintain a list of value ribs and type ribs. // @@ -2331,7 +2343,7 @@ impl<'a> Resolver<'a> { } } - /// Searches the current set of local scopes for labels. Returns the first non-None label that + /// Searches the current set of local scopes for labels. Returns the first non-`None` label that /// is returned by the given predicate function /// /// Stops after meeting a closure. @@ -2349,7 +2361,7 @@ impl<'a> Resolver<'a> { } } _ => { - // Do not resolve labels across function boundary + // Do not resolve labels across function boundary. return None; } } @@ -2440,7 +2452,7 @@ impl<'a> Resolver<'a> { this.visit_ty(ty); // Only impose the restrictions of - // ConstRibKind for an actual constant + // `ConstRibKind` for an actual constant // expression in a provided default. if let Some(ref expr) = *default{ this.with_constant_rib(|this| { @@ -2497,7 +2509,7 @@ impl<'a> Resolver<'a> { ItemKind::ExternCrate(..) | ItemKind::MacroDef(..) | ItemKind::GlobalAsm(..) => { - // do nothing, these are just around to be encoded + // Do nothing; these are just around to be encoded. } ItemKind::Mac(_) => panic!("unexpanded macro in resolve!"), @@ -2581,7 +2593,7 @@ impl<'a> Resolver<'a> { fn with_current_self_type(&mut self, self_type: &Ty, f: F) -> T where F: FnOnce(&mut Resolver) -> T { - // Handle nested impls (inside fn bodies) + // Handle nested impls (inside fn bodies). let previous_value = replace(&mut self.current_self_type, Some(self_type.clone())); let result = f(self); self.current_self_type = previous_value; @@ -2597,7 +2609,7 @@ impl<'a> Resolver<'a> { result } - /// This is called to resolve a trait reference from an `impl` (i.e., `impl Trait for Foo`) + /// This is called to resolve a trait reference from an `impl` (i.e., `impl Trait for Foo`). fn with_optional_trait_ref(&mut self, opt_trait_ref: Option<&TraitRef>, f: F) -> T where F: FnOnce(&mut Resolver, Option) -> T { @@ -2640,7 +2652,7 @@ impl<'a> Resolver<'a> { { let mut self_type_rib = Rib::new(NormalRibKind); - // plain insert (no renaming, types are not currently hygienic....) + // Plain insert (no renaming, since types are not currently hygienic). self_type_rib.bindings.insert(keywords::SelfUpper.ident(), self_def); self.ribs[TypeNS].push(self_type_rib); f(self); @@ -2694,7 +2706,7 @@ impl<'a> Resolver<'a> { match impl_item.node { ImplItemKind::Const(..) => { // If this is a trait impl, ensure the const - // exists in trait + // exists in trait. this.check_trait_item(impl_item.ident, ValueNS, impl_item.span, @@ -2705,7 +2717,7 @@ impl<'a> Resolver<'a> { } ImplItemKind::Method(..) => { // If this is a trait impl, ensure the method - // exists in trait + // exists in trait. this.check_trait_item(impl_item.ident, ValueNS, impl_item.span, @@ -2725,7 +2737,7 @@ impl<'a> Resolver<'a> { } ImplItemKind::Existential(ref bounds) => { // If this is a trait impl, ensure the type - // exists in trait + // exists in trait. this.check_trait_item(impl_item.ident, TypeNS, impl_item.span, @@ -2751,7 +2763,7 @@ impl<'a> Resolver<'a> { fn check_trait_item(&mut self, ident: Ident, ns: Namespace, span: Span, err: F) where F: FnOnce(Name, &str) -> ResolutionError { - // If there is a TraitRef in scope for an impl, then the method must be in the + // If there is a `TraitRef` in scope for an impl, then the method must be in the // trait. if let Some((module, _)) = self.current_trait_ref { if self.resolve_ident_in_module( @@ -2779,7 +2791,7 @@ impl<'a> Resolver<'a> { self.resolve_pattern(&local.pat, PatternSource::Let, &mut FxHashMap::default()); } - // build a map from pattern identifiers to binding-info's. + // Build a map from pattern identifiers to binding-info's. // this is done hygienically. This could arise for a macro // that expands into an or-pattern where one 'x' was from the // user and one 'x' came from the macro. @@ -2802,7 +2814,7 @@ impl<'a> Resolver<'a> { binding_map } - // check that all of the arms in an or-pattern have exactly the + // Check that all of the arms in an or-pattern have exactly the // same set of bindings, with the same binding modes for each. fn check_consistent_bindings(&mut self, pats: &[P]) { if pats.is_empty() { @@ -2821,8 +2833,9 @@ impl<'a> Resolver<'a> { let map_j = self.binding_mode_map(&q); for (&key, &binding_i) in &map_i { - if map_j.is_empty() { // Account for missing bindings when - let binding_error = missing_vars // map_j has none. + // Account for missing bindings when `map_j` has none. + if map_j.is_empty() { + let binding_error = missing_vars .entry(key.name) .or_insert(BindingError { name: key.name, @@ -2834,7 +2847,8 @@ impl<'a> Resolver<'a> { } for (&key_j, &binding_j) in &map_j { match map_i.get(&key_j) { - None => { // missing binding + None => { + // Missing binding. let binding_error = missing_vars .entry(key_j.name) .or_insert(BindingError { @@ -2845,7 +2859,8 @@ impl<'a> Resolver<'a> { binding_error.origin.insert(binding_j.span); binding_error.target.insert(p.span); } - Some(binding_i) => { // check consistent binding + Some(binding_i) => { + // Check consistent binding. if binding_i.binding_mode != binding_j.binding_mode { inconsistent_vars .entry(key.name) @@ -2879,7 +2894,7 @@ impl<'a> Resolver<'a> { self.resolve_pattern(&pattern, PatternSource::Match, &mut bindings_list); } - // This has to happen *after* we determine which pat_idents are variants. + // This has to happen *after* we determine which `pat_idents` are variants. self.check_consistent_bindings(&arm.pats); if let Some(ast::Guard::If(ref expr)) = arm.guard { @@ -2894,7 +2909,8 @@ impl<'a> Resolver<'a> { debug!("(resolving block) entering block"); // Move down in the graph, if there's an anonymous module rooted here. let orig_module = self.current_module; - let anonymous_module = self.block_map.get(&block.id).cloned(); // clones a reference + // Clones a reference. + let anonymous_module = self.block_map.get(&block.id).cloned(); let mut num_macro_definition_ribs = 0; if let Some(anonymous_module) = anonymous_module { @@ -2950,7 +2966,7 @@ impl<'a> Resolver<'a> { let mut def = Def::Local(pat_id); match bindings.get(&ident).cloned() { Some(id) if id == outer_pat_id => { - // `Variant(a, a)`, error + // `Variant(a, a)`; error. resolve_error( self, ident.span, @@ -2959,7 +2975,7 @@ impl<'a> Resolver<'a> { ); } Some(..) if pat_src == PatternSource::FnParam => { - // `fn f(a: u8, a: u8)`, error + // `fn f(a: u8, a: u8)`; error. resolve_error( self, ident.span, @@ -2970,7 +2986,7 @@ impl<'a> Resolver<'a> { Some(..) if pat_src == PatternSource::Match || pat_src == PatternSource::IfLet || pat_src == PatternSource::WhileLet => { - // `Variant1(a) | Variant2(a)`, ok + // `Variant1(a) | Variant2(a)`; okay. // Reuse definition from the first `a`. def = self.ribs[ValueNS].last_mut().unwrap().bindings[&ident]; } @@ -2979,7 +2995,7 @@ impl<'a> Resolver<'a> { unexpected pattern source {:?}", pat_src); } None => { - // A completely fresh binding, add to the lists if it's valid. + // A completely fresh binding; add to the lists if it's valid. if ident.name != keywords::Invalid.name() { bindings.insert(ident, outer_pat_id); self.ribs[ValueNS].last_mut().unwrap().bindings.insert(ident, def); @@ -2993,7 +3009,7 @@ impl<'a> Resolver<'a> { fn resolve_pattern(&mut self, pat: &Pat, pat_src: PatternSource, - // Maps idents to the node ID for the + // Maps idents to the node-ID for the // outermost pattern that binds them. bindings: &mut FxHashMap) { // Visit all direct subpatterns of this pattern. @@ -3073,7 +3089,7 @@ impl<'a> Resolver<'a> { // High-level and context dependent path resolution routine. // Resolves the path and records the resolution into definition map. - // If resolution fails tries several techniques to find likely + // If resolution fails, then tries several techniques to find likely // resolution candidates, suggest imports or other help, and report // errors in user friendly way. fn smart_resolve_path(&mut self, @@ -3090,7 +3106,7 @@ impl<'a> Resolver<'a> { /// sometimes needed for the lint that recommends rewriting /// absolute paths to `crate`, so that it knows how to frame the /// suggestion. If you are just resolving a path like `foo::bar` - /// that appears...somewhere, though, then you just want + /// that appears in an arbitrary location, then you just want /// `CrateLint::SimplePath`, which is what `smart_resolve_path` /// already provides. fn smart_resolve_path_with_crate_lint( @@ -3160,7 +3176,7 @@ impl<'a> Resolver<'a> { let code = DiagnosticId::Error(code.into()); let mut err = this.session.struct_span_err_with_code(base_span, &base_msg, code); - // Emit help message for fake-self from other languages like `this`(javascript) + // Emit help message for fake-self from other languages (e.g., `this` in Javascript). if ["this", "my"].contains(&&*item_str.as_str()) && this.self_value_is_available(path[0].ident.span, span) { err.span_suggestion_with_applicability( @@ -3291,7 +3307,7 @@ impl<'a> Resolver<'a> { levenshtein_worked = true; } - // Try context dependent help if relaxed lookup didn't work. + // Try context-dependent help if relaxed lookup didn't work. if let Some(def) = def { match (def, source) { (Def::Macro(..), _) => { @@ -3494,8 +3510,8 @@ impl<'a> Resolver<'a> { _ => report_errors(self, None) }; + // Avoid recording definition of `A::B` in `::B::C`. if let PathSource::TraitItem(..) = source {} else { - // Avoid recording definition of `A::B` in `::B::C`. self.record_def(id, resolution); } resolution @@ -3509,7 +3525,8 @@ impl<'a> Resolver<'a> { debug!("self.current_type_ascription {:?}", self.current_type_ascription); if let Some(sp) = self.current_type_ascription.last() { let mut sp = *sp; - loop { // try to find the `:`, bail on first non-':'/non-whitespace + loop { + // Try to find the `:`; bail on the first non-':'/non-whitespace. sp = cm.next_point(sp); if let Ok(snippet) = cm.span_to_snippet(sp.to(cm.next_point(sp))) { debug!("snippet {:?}", snippet); @@ -3568,7 +3585,7 @@ impl<'a> Resolver<'a> { for (i, ns) in [primary_ns, TypeNS, ValueNS, /*MacroNS*/].iter().cloned().enumerate() { if i == 0 || ns != primary_ns { match self.resolve_qpath(id, qself, path, ns, span, global_by_default, crate_lint) { - // If defer_to_typeck, then resolution > no resolution, + // If `defer_to_typeck`, then resolution > no resolution, // otherwise full resolution > partial resolution > no resolution. Some(res) if res.unresolved_segments() == 0 || defer_to_typeck => return Some(res), @@ -3582,7 +3599,7 @@ impl<'a> Resolver<'a> { .and_then(NameBinding::macro_kind) == Some(MacroKind::Bang) || self.macro_use_prelude.get(&path[0].ident.name).cloned() .and_then(NameBinding::macro_kind) == Some(MacroKind::Bang)) { - // Return some dummy definition, it's enough for error reporting. + // Return some dummy definition; it's enough for error reporting. return Some( PathResolution::new(Def::Macro(DefId::local(CRATE_DEF_INDEX), MacroKind::Bang)) ); @@ -3614,7 +3631,7 @@ impl<'a> Resolver<'a> { if let Some(qself) = qself { if qself.position == 0 { // This is a case like `::B`, where there is no - // trait to resolve. In that case, we leave the `B` + // trait to resolve. In that case, we leave the `B` // segment to be resolved by type-check. return Some(PathResolution::with_unresolved_segments( Def::Mod(DefId::local(CRATE_DEF_INDEX)), path.len() @@ -3624,7 +3641,7 @@ impl<'a> Resolver<'a> { // Make sure `A::B` in `::C` is a trait item. // // Currently, `path` names the full item (`A::B::C`, in - // our example). so we extract the prefix of that that is + // our example). so we extract the prefix of that that is // the trait (the slice upto and including // `qself.position`). And then we recursively resolve that, // but with `qself` set to `None`. @@ -3817,14 +3834,14 @@ impl<'a> Resolver<'a> { } if name == keywords::PathRoot.name() && ident.span.rust_2015() && self.session.rust_2018() { - // `::a::b` from 2015 macro on 2018 global edition + // `::a::b` from 2015 macro on 2018 global edition. module = Some(ModuleOrUniformRoot::CrateRootAndExternPrelude); continue; } if name == keywords::PathRoot.name() || name == keywords::Crate.name() || name == keywords::DollarCrate.name() { - // `::a::b`, `crate::a::b` or `$crate::a::b` + // `::a::b`, `crate::a::b`, or `$crate::a::b`. module = Some(ModuleOrUniformRoot::Module( self.resolve_crate_root(ident))); continue; @@ -3858,9 +3875,9 @@ impl<'a> Resolver<'a> { let record_used_id = if record_used { crate_lint.node_id().or(Some(CRATE_NODE_ID)) } else { None }; match self.resolve_ident_in_lexical_scope(ident, ns, record_used_id, path_span) { - // we found a locally-imported or available item/module + // We found a locally-imported or available item/module. Some(LexicalScopeBinding::Item(binding)) => Ok(binding), - // we found a local variable or type param + // We found a local variable or type param. Some(LexicalScopeBinding::Def(def)) if opt_ns == Some(TypeNS) || opt_ns == Some(ValueNS) => { record_segment_def(self, def); @@ -3965,7 +3982,7 @@ impl<'a> Resolver<'a> { }; let first_name = match path.get(0) { - // In the 2018 edition this lint is a hard error, so nothing to do + // In the 2018 edition this lint is a hard error, so nothing to do. Some(seg) if seg.ident.span.rust_2015() && self.session.rust_2015() => seg.ident.name, _ => return, }; @@ -3977,13 +3994,13 @@ impl<'a> Resolver<'a> { } match path.get(1) { - // If this import looks like `crate::...` it's already good + // If this import looks like `crate::...` it's already good. Some(Segment { ident, .. }) if ident.name == keywords::Crate.name() => return, - // Otherwise go below to see if it's an extern crate + // Otherwise, go below to see if it's an extern crate. Some(_) => {} - // If the path has length one (and it's `PathRoot` most likely) + // If the path has length one (and it's `PathRoot` most likely), // then we don't know whether we're gonna be importing a crate or an - // item in our crate. Defer this lint to elsewhere + // item in our crate. Defer this lint to elsewhere. None => return, } @@ -4037,7 +4054,7 @@ impl<'a> Resolver<'a> { match rib.kind { NormalRibKind | ModuleRibKind(..) | MacroDefinition(..) | ForwardTyParamBanRibKind => { - // Nothing to do. Continue. + // Nothing to do; continue. } ClosureRibKind(function_id) => { let prev_def = def; @@ -4074,7 +4091,7 @@ impl<'a> Resolver<'a> { return Def::Err; } ConstantItemRibKind => { - // Still doesn't deal with upvars + // Still doesn't deal with upvars. if record_used { resolve_error(self, span, ResolutionError::AttemptToUseNonConstantValueInConstant); @@ -4090,7 +4107,7 @@ impl<'a> Resolver<'a> { NormalRibKind | TraitOrImplItemRibKind | ClosureRibKind(..) | ModuleRibKind(..) | MacroDefinition(..) | ForwardTyParamBanRibKind | ConstantItemRibKind => { - // Nothing to do. Continue. + // Nothing to do; continue. } ItemRibKind => { // This was an attempt to use a type parameter outside @@ -4121,7 +4138,7 @@ impl<'a> Resolver<'a> { TyKind::Path(None, _) => Some(t.id), TyKind::Rptr(_, ref mut_ty) => extract_node_id(&mut_ty.ty), // This doesn't handle the remaining `Ty` variants as they are not - // that commonly the self_type, it might be interesting to provide + // that commonly the self type, it might be interesting to provide // support for those in future. _ => None, } @@ -4130,7 +4147,7 @@ impl<'a> Resolver<'a> { // Fields are generally expected in the same contexts as locals. if filter_fn(Def::Local(ast::DUMMY_NODE_ID)) { if let Some(node_id) = self.current_self_type.as_ref().and_then(extract_node_id) { - // Look for a field with the same name in the current self_type. + // Look for a field with the same name in the current self type. if let Some(resolution) = self.def_map.get(&node_id) { match resolution.base_def() { Def::Struct(did) | Def::Union(did) @@ -4200,15 +4217,15 @@ impl<'a> Resolver<'a> { names.push(ident.name); } } - // Items in scope + // Items in scope. if let ModuleRibKind(module) = rib.kind { - // Items from this module + // Items from this module. add_module_candidates(module, &mut names); if let ModuleKind::Block(..) = module.kind { - // We can see through blocks + // We can see through blocks. } else { - // Items from the prelude + // Items from the prelude. if !module.no_implicit_prelude { names.extend(self.extern_prelude.iter().map(|(ident, _)| ident.name)); if let Some(prelude) = self.prelude { @@ -4219,7 +4236,7 @@ impl<'a> Resolver<'a> { } } } - // Add primitive types to the mix + // Add primitive types to the mix. if filter_fn(Def::PrimTy(Bool)) { names.extend( self.primitive_type_table.primitive_types.iter().map(|(name, _)| name) @@ -4269,7 +4286,6 @@ impl<'a> Resolver<'a> { fn resolve_expr(&mut self, expr: &Expr, parent: Option<&Expr>) { // First, record candidate traits for this expression if it could // result in the invocation of a method call. - self.record_candidate_traits_for_expr_if_necessary(expr); // Next, resolve the node. @@ -4290,9 +4306,9 @@ impl<'a> Resolver<'a> { }); match def { None => { - // Search again for close matches... + // Search again for close matches. // Picks the first label that is "close enough", which is not necessarily - // the closest match + // the closest match. let close_match = self.search_label(label.ident, |rib, ident| { let names = rib.bindings.iter().map(|(id, _)| &id.name); find_best_match_for_name(names, &*ident.as_str(), None) @@ -4313,7 +4329,7 @@ impl<'a> Resolver<'a> { } } - // visit `break` argument if any + // Visit `break` argument, if there is one. visit::walk_expr(self, expr); } @@ -4325,7 +4341,7 @@ impl<'a> Resolver<'a> { for pat in pats { self.resolve_pattern(pat, PatternSource::IfLet, &mut bindings_list); } - // This has to happen *after* we determine which pat_idents are variants + // This has to happen *after* we determine which `pat_idents` are variants. self.check_consistent_bindings(pats); self.visit_block(if_block); self.ribs[ValueNS].pop(); @@ -4350,7 +4366,7 @@ impl<'a> Resolver<'a> { for pat in pats { this.resolve_pattern(pat, PatternSource::WhileLet, &mut bindings_list); } - // This has to happen *after* we determine which pat_idents are variants. + // This has to happen *after* we determine which `pat_idents` are variants. this.check_consistent_bindings(pats); this.visit_block(block); this.ribs[ValueNS].pop(); @@ -4369,7 +4385,7 @@ impl<'a> Resolver<'a> { ExprKind::Block(ref block, label) => self.resolve_labeled_block(label, block.id, block), - // Equivalent to `visit::walk_expr` + passing some context to children. + // Equivalent to `visit::walk_expr` plus passing some context to children. ExprKind::Field(ref subexpression, _) => { self.resolve_expr(subexpression, Some(expr)); } @@ -4393,7 +4409,7 @@ impl<'a> Resolver<'a> { visit::walk_expr(self, expr); self.current_type_ascription.pop(); } - // Resolve the body of async exprs inside the async closure to which they desugar + // Resolve the body of async exprs inside the async closure to which they desugar. ExprKind::Async(_, async_closure_id, ref block) => { let rib_kind = ClosureRibKind(async_closure_id); self.ribs[ValueNS].push(Rib::new(rib_kind)); @@ -4412,24 +4428,24 @@ impl<'a> Resolver<'a> { let rib_kind = ClosureRibKind(expr.id); self.ribs[ValueNS].push(Rib::new(rib_kind)); self.label_ribs.push(Rib::new(rib_kind)); - // Resolve arguments: + // Resolve the arguments. let mut bindings_list = FxHashMap::default(); for argument in &fn_decl.inputs { self.resolve_pattern(&argument.pat, PatternSource::FnParam, &mut bindings_list); self.visit_ty(&argument.ty); } - // No need to resolve return type-- the outer closure return type is - // FunctionRetTy::Default + // No need to resolve return type -- the outer closure return type is + // `FunctionRetTy::Default`. - // Now resolve the inner closure + // Now resolve the inner closure. { let rib_kind = ClosureRibKind(inner_closure_id); self.ribs[ValueNS].push(Rib::new(rib_kind)); self.label_ribs.push(Rib::new(rib_kind)); // No need to resolve arguments: the inner closure has none. - // Resolve the return type: + // Resolve the return type. visit::walk_fn_ret_ty(self, &fn_decl.output); - // Resolve the body + // Resolve the body. self.visit_expr(body); self.label_ribs.pop(); self.ribs[ValueNS].pop(); @@ -4446,7 +4462,7 @@ impl<'a> Resolver<'a> { fn record_candidate_traits_for_expr_if_necessary(&mut self, expr: &Expr) { match expr.node { ExprKind::Field(_, ident) => { - // FIXME(#6890): Even though you can't treat a method like a + // FIXME(#6890): even though you can't treat a method like a // field, we need to add any trait methods we find that match // the field name so that we can do some nice error reporting // later on in typeck. @@ -4454,7 +4470,7 @@ impl<'a> Resolver<'a> { self.trait_map.insert(expr.id, traits); } ExprKind::MethodCall(ref segment, ..) => { - debug!("(recording candidate traits for expr) recording traits for {}", + debug!("(recording candidate traits for expr) recording traits for node {}", expr.id); let traits = self.get_traits_containing_item(segment.ident, ValueNS); self.trait_map.insert(expr.id, traits); @@ -4549,12 +4565,12 @@ impl<'a> Resolver<'a> { } fn lookup_import_candidates_from_module(&mut self, - lookup_ident: Ident, - namespace: Namespace, - start_module: &'a ModuleData<'a>, - crate_name: Ident, - filter_fn: FilterFn) - -> Vec + lookup_ident: Ident, + namespace: Namespace, + start_module: &'a ModuleData<'a>, + crate_name: Ident, + filter_fn: FilterFn) + -> Vec where FilterFn: Fn(Def) -> bool { let mut candidates = Vec::new(); @@ -4593,22 +4609,22 @@ impl<'a> Resolver<'a> { span: name_binding.span, segments: segms, }; - // the entity is accessible in the following cases: + // The entity is accessible in the following cases: // 1. if it's defined in the same crate, it's always // accessible (since private entities can be made public) // 2. if it's defined in another crate, it's accessible // only if both the module is public and the entity is // declared as public (due to pruning, we don't explore - // outside crate private modules => no need to check this) + // outside crate private modules, so no need to check this). if !in_module_is_extern || name_binding.vis == ty::Visibility::Public { candidates.push(ImportSuggestion { path }); } } } - // collect submodules to explore + // Collect submodules to explore. if let Some(module) = name_binding.module() { - // form the path + // Form the path. let mut path_segments = path_segments.clone(); path_segments.push(ast::PathSegment::from_ident(ident)); @@ -4620,7 +4636,7 @@ impl<'a> Resolver<'a> { !in_module_is_extern || name_binding.vis == ty::Visibility::Public; if !is_extern_crate_that_also_appears_in_prelude && is_visible_to_user { - // add the module to the lookup + // Add the module to the lookup. let is_extern = in_module_is_extern || name_binding.is_extern_crate(); if seen_modules.insert(module.def_id().unwrap()) { worklist.push((module, path_segments, is_extern)); @@ -4636,9 +4652,9 @@ impl<'a> Resolver<'a> { /// When name resolution fails, this method can be used to look up candidate /// entities with the expected name. It allows filtering them using the /// supplied predicate (which should be used to only accept the types of - /// definitions expected e.g., traits). The lookup spans across all crates. + /// definitions expected, e.g., traits). The lookup spans across all crates. /// - /// NOTE: The method does not look into imports, but this is not a problem, + /// N.B., the method does not look into imports, but this is not a problem, /// since we report the definitions (thus, the de-aliased imports). fn lookup_import_candidates(&mut self, lookup_ident: Ident, @@ -4679,13 +4695,13 @@ impl<'a> Resolver<'a> { let mut worklist = vec![(self.graph_root, Vec::new())]; while let Some((in_module, path_segments)) = worklist.pop() { - // abort if the module is already found + // Abort if the module is already found. if result.is_some() { break; } self.populate_module_if_necessary(in_module); in_module.for_each_child_stable(|ident, _, name_binding| { - // abort if the module is already found or if name_binding is private external + // Abort if the module is already found or if `name_binding` is private external. if result.is_some() || !name_binding.vis.is_visible_locally() { return } @@ -4700,7 +4716,7 @@ impl<'a> Resolver<'a> { }; result = Some((module, ImportSuggestion { path })); } else { - // add the module to the lookup + // Add the module to the lookup. if seen_modules.insert(module.def_id().unwrap()) { worklist.push((module, path_segments)); } @@ -4714,7 +4730,7 @@ impl<'a> Resolver<'a> { fn collect_enum_variants(&mut self, enum_def: Def) -> Option> { if let Def::Enum(..) = enum_def {} else { - panic!("Non-enum def passed to collect_enum_variants: {:?}", enum_def) + panic!("non-enum def passed to collect_enum_variants: {:?}", enum_def) } self.find_module(enum_def).map(|(enum_module, enum_import_suggestion)| { @@ -4736,7 +4752,7 @@ impl<'a> Resolver<'a> { } fn record_def(&mut self, node_id: NodeId, resolution: PathResolution) { - debug!("(recording def) recording {:?} for {}", resolution, node_id); + debug!("(recording def) recording {:?} for node {}", resolution, node_id); if let Some(prev_res) = self.def_map.insert(node_id, resolution) { panic!("path resolved multiple times ({:?} before, {:?} now)", prev_res, resolution); } @@ -4963,7 +4979,7 @@ impl<'a> Resolver<'a> { ns: Namespace, new_binding: &NameBinding<'b>, old_binding: &NameBinding<'b>) { - // Error on the second of two conflicting names + // Error on the second of two conflicting names. if old_binding.span.lo() > new_binding.span.lo() { return self.report_conflict(parent, ident, ns, old_binding, new_binding); } @@ -5028,7 +5044,7 @@ impl<'a> Resolver<'a> { format!("previous {} of the {} `{}` here", old_noun, old_kind, name)); } - // See https://github.com/rust-lang/rust/issues/32354 + // See issue #32354. if old_binding.is_import() || new_binding.is_import() { let binding = if new_binding.is_import() && !new_binding.span.is_dummy() { new_binding @@ -5093,7 +5109,7 @@ impl<'a> Resolver<'a> { fn extern_prelude_get(&mut self, ident: Ident, speculative: bool) -> Option<&'a NameBinding<'a>> { if ident.is_path_segment_keyword() { - // Make sure `self`, `super` etc produce an error when passed to here. + // Make sure `self`, `super`, etc. produce an error when passed to here. return None; } self.extern_prelude.get(&ident.modern()).cloned().and_then(|entry| { @@ -5162,16 +5178,16 @@ fn import_candidate_to_enum_paths(suggestion: &ImportSuggestion) -> (String, Str /// When an entity with a given name is not available in scope, we search for /// entities with that name in all crates. This method allows outputting the -/// results of this search in a programmer-friendly way +/// results of this search in a programmer-friendly way. fn show_candidates(err: &mut DiagnosticBuilder, - // This is `None` if all placement locations are inside expansions + // This is `None` if all placement locations are inside expansions. span: Option, candidates: &[ImportSuggestion], better: bool, found_use: bool) { - // we want consistent results across executions, but candidates are produced - // by iterating through a hash map, so make sure they are ordered: + // We want consistent results across executions, but candidates are produced + // by iterating through a hash map, so make sure they are ordered. let mut path_strings: Vec<_> = candidates.into_iter().map(|c| path_names_to_string(&c.path)).collect(); path_strings.sort(); @@ -5185,7 +5201,7 @@ fn show_candidates(err: &mut DiagnosticBuilder, if let Some(span) = span { for candidate in &mut path_strings { - // produce an additional newline to separate the new use statement + // Produce an additional newline to separate the new use statement // from the directly following item. let additional_newline = if found_use { "" @@ -5222,7 +5238,7 @@ fn module_to_string(module: Module) -> Option { collect_mod(names, parent); } } else { - // danger, shouldn't be ident? + // Danger; shouldn't be ident? names.push(Ident::from_str("")); collect_mod(names, module.parent.unwrap()); } @@ -5249,11 +5265,11 @@ pub enum MakeGlobMap { #[derive(Copy, Clone, Debug)] enum CrateLint { - /// Do not issue the lint + /// Do not issue the lint. No, - /// This lint applies to some random path like `impl ::foo::Bar` - /// or whatever. In this case, we can take the span of that path. + /// This lint applies to some arbitrary path; e.g., `impl ::foo::Bar`. + /// In this case, we can take the span of that path. SimplePath(NodeId), /// This lint comes from a `use` statement. In this case, what we diff --git a/src/librustc_resolve/macros.rs b/src/librustc_resolve/macros.rs index 379ebe2399474..8fa52d9ff48f1 100644 --- a/src/librustc_resolve/macros.rs +++ b/src/librustc_resolve/macros.rs @@ -414,7 +414,7 @@ impl<'a> Resolver<'a> { // 2. "Closed set" below means new names cannot appear after the current resolution attempt. // Places to search (in order of decreasing priority): // (Type NS) - // 1. FIXME: Ribs (type parameters), there's no necessary infrastructure yet + // 1. FIXME: ribs (type parameters), there's no necessary infrastructure yet // (open set, not controlled). // 2. Names in modules (both normal `mod`ules and blocks), loop through hygienic parents // (open, not controlled). @@ -423,7 +423,7 @@ impl<'a> Resolver<'a> { // 5. Standard library prelude (de-facto closed, controlled). // 6. Language prelude (closed, controlled). // (Value NS) - // 1. FIXME: Ribs (local variables), there's no necessary infrastructure yet + // 1. FIXME: ribs (local variables), there's no necessary infrastructure yet // (open set, not controlled). // 2. Names in modules (both normal `mod`ules and blocks), loop through hygienic parents // (open, not controlled). @@ -921,7 +921,7 @@ impl<'a> Resolver<'a> { let macro_resolutions = mem::replace(&mut *module.multi_segment_macro_resolutions.borrow_mut(), Vec::new()); for (mut path, path_span, kind, parent_scope, initial_def) in macro_resolutions { - // FIXME: Path resolution will ICE if segment IDs present. + // FIXME: path resolution will ICE if segment IDs present. for seg in &mut path { seg.id = None; } match self.resolve_path(&path, Some(MacroNS), &parent_scope, true, path_span, CrateLint::No) { diff --git a/src/librustc_resolve/resolve_imports.rs b/src/librustc_resolve/resolve_imports.rs index ab440eda538a9..4a51fad8aa6be 100644 --- a/src/librustc_resolve/resolve_imports.rs +++ b/src/librustc_resolve/resolve_imports.rs @@ -195,7 +195,7 @@ impl<'a> Resolver<'a> { return Ok(binding); } else if ident.name == keywords::Super.name() || ident.name == keywords::SelfLower.name() { - // FIXME: Implement these with renaming requirements so that e.g. + // FIXME: implement these with renaming requirements so that e.g. // `use super;` doesn't work, but `use super as name;` does. // Fall through here to get an error from `early_resolve_...`. } @@ -980,7 +980,7 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> { } } Err(..) => { - // FIXME: This assert may fire if public glob is later shadowed by a private + // FIXME: this assert may fire if public glob is later shadowed by a private // single import (see test `issue-55884-2.rs`). In theory single imports should // always block globs, even if they are not yet resolved, so that this kind of // self-inconsistent resolution never happens. diff --git a/src/librustc_save_analysis/dump_visitor.rs b/src/librustc_save_analysis/dump_visitor.rs index 3c83c45f98403..986566b10270c 100644 --- a/src/librustc_save_analysis/dump_visitor.rs +++ b/src/librustc_save_analysis/dump_visitor.rs @@ -1,9 +1,9 @@ //! Write the output of rustc's analysis to an implementor of Dump. //! //! Dumping the analysis is implemented by walking the AST and getting a bunch of -//! info out from all over the place. We use Def IDs to identify objects. The +//! info out from all over the place. We use def-IDs to identify objects. The //! tricky part is getting syntactic (span, source text) and semantic (reference -//! Def IDs) information for parts of expressions which the compiler has discarded. +//! def-IDs) information for parts of expressions which the compiler has discarded. //! E.g., in a path `foo::bar::baz`, the compiler only keeps a span for the whole //! path and a reference to `baz`, but we want spans and references for all three //! idents. @@ -455,7 +455,7 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> { } } - // FIXME tuple structs should generate tuple-specific data. + // FIXME: tuple structs should generate tuple-specific data. fn process_struct( &mut self, item: &'l ast::Item, @@ -855,7 +855,7 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> { fn process_pat(&mut self, p: &'l ast::Pat) { match p.node { PatKind::Struct(ref _path, ref fields, _) => { - // FIXME do something with _path? + // FIXME: do something with _path? let hir_id = self.tcx.hir().node_to_hir_id(p.id); let adt = match self.save_ctxt.tables.node_id_to_type_opt(hir_id) { Some(ty) => ty.ty_adt_def().unwrap(), @@ -1023,7 +1023,7 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> { /// callsite spans to record macro definition and use data, using the /// mac_uses and mac_defs sets to prevent multiples. fn process_macro_use(&mut self, _span: Span) { - // FIXME if we're not dumping the defs (see below), there is no point + // FIXME: if we're not dumping the defs (see below), there is no point // dumping refs either. // let source_span = span.source_callsite(); // if !self.macro_calls.insert(source_span) { @@ -1037,7 +1037,7 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> { // self.dumper.macro_use(data); - // FIXME write the macro def + // FIXME: write the macro def // let mut hasher = DefaultHasher::new(); // data.callee_span.hash(&mut hasher); // let hash = hasher.finish(); @@ -1051,7 +1051,7 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> { // span: sub_span, // name: data.name.clone(), // qualname: qualname.clone(), - // // FIXME where do macro docs come from? + // // FIXME: where do macro docs come from? // docs: String::new(), // }.lower(self.tcx)); // } @@ -1085,7 +1085,7 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> { ); } ast::TraitItemKind::Type(ref bounds, ref default_ty) => { - // FIXME do something with _bounds (for type refs) + // FIXME: do something with _bounds (for type refs) let name = trait_item.ident.name.to_string(); let qualname = format!("::{}", self.tcx.node_path_str(trait_item.id)); @@ -1155,13 +1155,13 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> { ); } ast::ImplItemKind::Type(ref ty) => { - // FIXME uses of the assoc type should ideally point to this + // FIXME: uses of the assoc type should ideally point to this // 'def' and the name here should be a ref to the def in the // trait. self.visit_ty(ty) } ast::ImplItemKind::Existential(ref bounds) => { - // FIXME uses of the assoc type should ideally point to this + // FIXME: uses of the assoc type should ideally point to this // 'def' and the name here should be a ref to the def in the // trait. for bound in bounds.iter() { @@ -1193,7 +1193,7 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> { // (since nested trees don't have their own visibility). let access = access_from!(self.save_ctxt, root_item.vis, id); - // The parent def id of a given use tree is always the enclosing item. + // The parent def-ID of a given use tree is always the enclosing item. let parent = self.save_ctxt.tcx.hir().opt_local_def_id(id) .and_then(|id| self.save_ctxt.tcx.parent_def_id(id)) .map(::id_from_def_id); @@ -1417,7 +1417,7 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> Visitor<'l> for DumpVisitor<'l, 'tc } Existential(ref _bounds, ref ty_params) => { let qualname = format!("::{}", self.tcx.node_path_str(item.id)); - // FIXME do something with _bounds + // FIXME: do something with _bounds let value = String::new(); if !self.span.filter_generated(item.ident.span) { let span = self.span_from_span(item.ident.span); diff --git a/src/librustc_save_analysis/lib.rs b/src/librustc_save_analysis/lib.rs index d5b3070372ba5..58f74052d9d9d 100644 --- a/src/librustc_save_analysis/lib.rs +++ b/src/librustc_save_analysis/lib.rs @@ -399,7 +399,7 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> { } } - // FIXME would be nice to take a MethodItem here, but the ast provides both + // FIXME: would be nice to take a MethodItem here, but the ast provides both // trait and impl flavours, so the caller must do the disassembly. pub fn get_method_data(&self, id: ast::NodeId, ident: ast::Ident, span: Span) -> Option { // The qualname for a method is the trait name or name of the struct in an impl in @@ -490,7 +490,7 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> { span: self.span_from_span(ident.span), name: ident.name.to_string(), qualname, - // FIXME you get better data here by using the visitor. + // FIXME: you get better data here by using the visitor. value: String::new(), parent: parent_scope.map(|id| id_from_def_id(id)), children: vec![], @@ -569,7 +569,7 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> { })) } _ => { - // FIXME ty could legitimately be an enum, but then we will fail + // FIXME: ty could legitimately be an enum, but then we will fail // later if we try to look up the fields. debug!("expected struct or union, found {:?}", ty); None @@ -696,7 +696,7 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> { path_seg: &ast::PathSegment, id: NodeId, ) -> Option { - // Returns true if the path is function type sugar, e.g., `Fn(A) -> B`. + // Returns whether the path is function type sugar, e.g., `Fn(A) -> B`. fn fn_type(seg: &ast::PathSegment) -> bool { if let Some(ref generic_args) = seg.args { if let ast::GenericArgs::Parenthesized(_) = **generic_args { diff --git a/src/librustc_save_analysis/sig.rs b/src/librustc_save_analysis/sig.rs index 7d4c0d0f9f56f..94899d8b709b8 100644 --- a/src/librustc_save_analysis/sig.rs +++ b/src/librustc_save_analysis/sig.rs @@ -23,7 +23,7 @@ // Signatures do not include visibility info. I'm not sure if this is a feature // or an ommission (FIXME). // -// FIXME where clauses need implementing, defs/refs in generics are mostly missing. +// FIXME: where clauses need implementing, defs/refs in generics are mostly missing. use {id_from_def_id, id_from_node_id, SaveContext}; @@ -209,7 +209,7 @@ impl Sig for ast::Ty { ast::TyKind::BareFn(ref f) => { let mut text = String::new(); if !f.generic_params.is_empty() { - // FIXME defs, bounds on lifetimes + // FIXME: defs, bounds on lifetimes text.push_str("for<"); text.push_str(&f.generic_params .iter() @@ -264,7 +264,7 @@ impl Sig for ast::Ty { let first = pprust::path_segment_to_string(&path.segments[0]); format!("<{} as {}>::", nested_ty.text, first) } else { - // FIXME handle path instead of elipses. + // FIXME: handle path instead of elipses. format!("<{} as ...>::", nested_ty.text) }; @@ -283,7 +283,7 @@ impl Sig for ast::Ty { } else { let start = offset + prefix.len() + 5; let end = start + name.len(); - // FIXME should put the proper path in there, not elipses. + // FIXME: should put the proper path in there, not elipses. Ok(Signature { text: prefix + "...::" + &name, defs: vec![], @@ -292,12 +292,12 @@ impl Sig for ast::Ty { } } ast::TyKind::TraitObject(ref bounds, ..) => { - // FIXME recurse into bounds + // FIXME: recurse into bounds let nested = pprust::bounds_to_string(bounds); Ok(text_sig(nested)) } ast::TyKind::ImplTrait(_, ref bounds) => { - // FIXME recurse into bounds + // FIXME: recurse into bounds let nested = pprust::bounds_to_string(bounds); Ok(text_sig(format!("impl {}", nested))) } @@ -392,7 +392,7 @@ impl Sig for ast::Item { sig.text.push('('); for i in &decl.inputs { - // FIXME should descend into patterns to add defs. + // FIXME: should descend into patterns to add defs. sig.text.push_str(&pprust::pat_to_string(&i.pat)); sig.text.push_str(": "); let nested = i.ty.make(offset + sig.text.len(), Some(i.id), scx)?; @@ -492,7 +492,7 @@ impl Sig for ast::Item { sig.text.push_str(": "); sig.text.push_str(&pprust::bounds_to_string(bounds)); } - // FIXME where clause + // FIXME: where clause sig.text.push_str(" {}"); Ok(sig) @@ -511,7 +511,7 @@ impl Sig for ast::Item { sig.text.push_str(" = "); sig.text.push_str(&pprust::bounds_to_string(bounds)); } - // FIXME where clause + // FIXME: where clause sig.text.push_str(";"); Ok(sig) @@ -558,12 +558,12 @@ impl Sig for ast::Item { Ok(merge_sigs(text, vec![generics_sig, trait_sig, ty_sig])) - // FIXME where clause + // FIXME: where clause } ast::ItemKind::ForeignMod(_) => Err("extern mod"), ast::ItemKind::GlobalAsm(_) => Err("glboal asm"), ast::ItemKind::ExternCrate(_) => Err("extern crate"), - // FIXME should implement this (e.g., pub use). + // FIXME: should implement this (e.g., pub use). ast::ItemKind::Use(_) => Err("import"), ast::ItemKind::Mac(..) | ast::ItemKind::MacroDef(_) => Err("Macro"), } @@ -640,11 +640,11 @@ impl Sig for ast::Generics { .collect::>() .join(" + "); param_text.push_str(&bounds); - // FIXME add lifetime bounds refs. + // FIXME: add lifetime bounds refs. } ast::GenericParamKind::Type { .. } => { param_text.push_str(&pprust::bounds_to_string(¶m.bounds)); - // FIXME descend properly into bounds. + // FIXME: descend properly into bounds. } } } @@ -754,7 +754,7 @@ impl Sig for ast::ForeignItem { sig.text.push('('); for i in &decl.inputs { - // FIXME should descend into patterns to add defs. + // FIXME: should descend into patterns to add defs. sig.text.push_str(&pprust::pat_to_string(&i.pat)); sig.text.push_str(": "); let nested = i.ty.make(offset + sig.text.len(), Some(i.id), scx)?; @@ -837,7 +837,7 @@ fn name_and_generics( }; text.push_str(&name); let generics: Signature = generics.make(offset + text.len(), Some(id), scx)?; - // FIXME where clause + // FIXME: where clause let text = format!("{}{}", text, generics.text); Ok(extend_sig(generics, text, vec![def], vec![])) } @@ -863,7 +863,7 @@ fn make_assoc_type_signature( text.push_str(&name); if let Some(bounds) = bounds { text.push_str(": "); - // FIXME should descend into bounds + // FIXME: should descend into bounds text.push_str(&pprust::bounds_to_string(bounds)); } if let Some(default) = default { @@ -917,7 +917,7 @@ fn make_method_signature( m: &ast::MethodSig, scx: &SaveContext, ) -> Result { - // FIXME code dup with function signature + // FIXME: code dup with function signature let mut text = String::new(); if m.header.constness.node == ast::Constness::Const { text.push_str("const "); @@ -939,7 +939,7 @@ fn make_method_signature( sig.text.push('('); for i in &m.decl.inputs { - // FIXME should descend into patterns to add defs. + // FIXME: should descend into patterns to add defs. sig.text.push_str(&pprust::pat_to_string(&i.pat)); sig.text.push_str(": "); let nested = i.ty.make(sig.text.len(), Some(i.id), scx)?; diff --git a/src/librustc_save_analysis/span_utils.rs b/src/librustc_save_analysis/span_utils.rs index 88c6012f71f69..e006224122358 100644 --- a/src/librustc_save_analysis/span_utils.rs +++ b/src/librustc_save_analysis/span_utils.rs @@ -11,7 +11,7 @@ use syntax_pos::*; #[derive(Clone)] pub struct SpanUtils<'a> { pub sess: &'a Session, - // FIXME given that we clone SpanUtils all over the place, this err_count is + // FIXME: given that we clone SpanUtils all over the place, this err_count is // probably useless and any logic relying on it is bogus. pub err_count: Cell, } diff --git a/src/librustc_target/abi/call/powerpc64.rs b/src/librustc_target/abi/call/powerpc64.rs index 3ae9ab9ac5ec9..9d9e5a895f486 100644 --- a/src/librustc_target/abi/call/powerpc64.rs +++ b/src/librustc_target/abi/call/powerpc64.rs @@ -1,5 +1,4 @@ -// FIXME: -// Alignment of 128 bit types is not currently handled, this will +// FIXME: alignment of 128-bit types is not currently handled -- this will // need to be fixed when PowerPC vector support is added. use abi::call::{FnType, ArgType, Reg, RegKind, Uniform}; @@ -8,8 +7,10 @@ use spec::HasTargetSpec; #[derive(Debug, Clone, Copy, PartialEq)] enum ABI { - ELFv1, // original ABI used for powerpc64 (big-endian) - ELFv2, // newer ABI used for powerpc64le and musl (both endians) + // Original ABI used for `powerpc64` (big-endian). + ELFv1, + // Newer ABI used for `powerpc64le` and `musl` (both endians). + ELFv2, } use self::ABI::*; @@ -52,7 +53,7 @@ fn classify_ret_ty<'a, Ty, C>(cx: &C, ret: &mut ArgType<'a, Ty>, abi: ABI) return; } - // The ELFv1 ABI doesn't return aggregates in registers + // The ELFv1 ABI doesn't return aggregates in registers. if abi == ELFv1 { ret.make_indirect(); return; diff --git a/src/librustc_target/abi/call/s390x.rs b/src/librustc_target/abi/call/s390x.rs index 954c37fee42dd..83046c57c91be 100644 --- a/src/librustc_target/abi/call/s390x.rs +++ b/src/librustc_target/abi/call/s390x.rs @@ -1,5 +1,5 @@ -// FIXME: The assumes we're using the non-vector ABI, i.e., compiling -// for a pre-z13 machine or using -mno-vx. +// FIXME: the assumes we're using the non-vector ABI, i.e., compiling +// for a pre-z13 machine or using `-mno-vx`. use abi::call::{FnType, ArgType, Reg}; use abi::{self, HasDataLayout, LayoutOf, TyLayout, TyLayoutMethods}; diff --git a/src/librustc_target/abi/call/sparc64.rs b/src/librustc_target/abi/call/sparc64.rs index bb0c9b7967afc..7b3d10fda3bce 100644 --- a/src/librustc_target/abi/call/sparc64.rs +++ b/src/librustc_target/abi/call/sparc64.rs @@ -1,4 +1,4 @@ -// FIXME: This needs an audit for correctness and completeness. +// FIXME: this needs an audit for correctness and completeness. use abi::call::{FnType, ArgType, Reg, RegKind, Uniform}; use abi::{HasDataLayout, LayoutOf, TyLayout, TyLayoutMethods}; diff --git a/src/librustc_target/abi/mod.rs b/src/librustc_target/abi/mod.rs index 3f95e666535be..fe26e950f2ac1 100644 --- a/src/librustc_target/abi/mod.rs +++ b/src/librustc_target/abi/mod.rs @@ -786,7 +786,7 @@ pub enum Abi { } impl Abi { - /// Returns true if the layout corresponds to an unsized type. + /// Returns whether the layout corresponds to an unsized type. pub fn is_unsized(&self) -> bool { match *self { Abi::Uninhabited | @@ -797,7 +797,7 @@ impl Abi { } } - /// Returns true if this is a single signed integer scalar + /// Returns whether this is a single signed integer scalar pub fn is_signed(&self) -> bool { match *self { Abi::Scalar(ref scal) => match scal.value { @@ -808,7 +808,7 @@ impl Abi { } } - /// Returns true if this is an uninhabited type + /// Returns whether this is an uninhabited type pub fn is_uninhabited(&self) -> bool { match *self { Abi::Uninhabited => true, @@ -924,12 +924,12 @@ impl<'a, Ty> TyLayout<'a, Ty> { } impl<'a, Ty> TyLayout<'a, Ty> { - /// Returns true if the layout corresponds to an unsized type. + /// Returns whether the layout corresponds to an unsized type. pub fn is_unsized(&self) -> bool { self.abi.is_unsized() } - /// Returns true if the type is a ZST and not unsized. + /// Returns whether the type is a ZST and not unsized. pub fn is_zst(&self) -> bool { match self.abi { Abi::Scalar(_) | diff --git a/src/librustc_target/spec/dragonfly_base.rs b/src/librustc_target/spec/dragonfly_base.rs index 6ce2912da75cf..1f80b551cea5e 100644 --- a/src/librustc_target/spec/dragonfly_base.rs +++ b/src/librustc_target/spec/dragonfly_base.rs @@ -6,7 +6,7 @@ pub fn opts() -> TargetOptions { args.insert(LinkerFlavor::Gcc, vec![ // GNU-style linkers will use this to omit linking to libraries // which don't actually fulfill any relocations, but only for - // libraries which follow this flag. Thus, use it before + // libraries which follow this flag. Thus, use it before // specifying libraries to link to. "-Wl,--as-needed".to_string(), diff --git a/src/librustc_target/spec/freebsd_base.rs b/src/librustc_target/spec/freebsd_base.rs index 47316f77e634e..13b843d21ec05 100644 --- a/src/librustc_target/spec/freebsd_base.rs +++ b/src/librustc_target/spec/freebsd_base.rs @@ -6,7 +6,7 @@ pub fn opts() -> TargetOptions { args.insert(LinkerFlavor::Gcc, vec![ // GNU-style linkers will use this to omit linking to libraries // which don't actually fulfill any relocations, but only for - // libraries which follow this flag. Thus, use it before + // libraries which follow this flag. Thus, use it before // specifying libraries to link to. "-Wl,--as-needed".to_string(), @@ -22,7 +22,7 @@ pub fn opts() -> TargetOptions { has_rpath: true, pre_link_args: args, position_independent_executables: true, - eliminate_frame_pointer: false, // FIXME 43575 + eliminate_frame_pointer: false, // FIXME: 43575 relro_level: RelroLevel::Full, abi_return_struct_as_int: true, .. Default::default() diff --git a/src/librustc_target/spec/mod.rs b/src/librustc_target/spec/mod.rs index f42b0a1c3c958..a562a4ed82875 100644 --- a/src/librustc_target/spec/mod.rs +++ b/src/librustc_target/spec/mod.rs @@ -633,7 +633,7 @@ pub struct TargetOptions { pub crt_static_allows_dylibs: bool, /// Whether or not the CRT is statically linked by default. pub crt_static_default: bool, - /// Whether or not crt-static is respected by the compiler (or is a no-op). + /// Whether or not crt-static is respected by the compiler (or is a noop). pub crt_static_respected: bool, /// Whether or not stack probes (__rust_probestack) are enabled @@ -1119,7 +1119,7 @@ impl Target { let target_path = env::var_os("RUST_TARGET_PATH").unwrap_or_default(); - // FIXME 16351: add a sane default search path? + // FIXME: 16351: add a sane default search path? for dir in env::split_paths(&target_path) { let p = dir.join(&path); diff --git a/src/librustc_target/spec/netbsd_base.rs b/src/librustc_target/spec/netbsd_base.rs index b88d360dd3785..7ab9a7cc89869 100644 --- a/src/librustc_target/spec/netbsd_base.rs +++ b/src/librustc_target/spec/netbsd_base.rs @@ -6,7 +6,7 @@ pub fn opts() -> TargetOptions { args.insert(LinkerFlavor::Gcc, vec![ // GNU-style linkers will use this to omit linking to libraries // which don't actually fulfill any relocations, but only for - // libraries which follow this flag. Thus, use it before + // libraries which follow this flag. Thus, use it before // specifying libraries to link to. "-Wl,--as-needed".to_string(), diff --git a/src/librustc_target/spec/openbsd_base.rs b/src/librustc_target/spec/openbsd_base.rs index 4bdf73fc92213..1dd621380fbf4 100644 --- a/src/librustc_target/spec/openbsd_base.rs +++ b/src/librustc_target/spec/openbsd_base.rs @@ -6,7 +6,7 @@ pub fn opts() -> TargetOptions { args.insert(LinkerFlavor::Gcc, vec![ // GNU-style linkers will use this to omit linking to libraries // which don't actually fulfill any relocations, but only for - // libraries which follow this flag. Thus, use it before + // libraries which follow this flag. Thus, use it before // specifying libraries to link to. "-Wl,--as-needed".to_string(), @@ -23,7 +23,7 @@ pub fn opts() -> TargetOptions { abi_return_struct_as_int: true, pre_link_args: args, position_independent_executables: true, - eliminate_frame_pointer: false, // FIXME 43575 + eliminate_frame_pointer: false, // FIXME: 43575 relro_level: RelroLevel::Full, .. Default::default() } diff --git a/src/librustc_target/spec/s390x_unknown_linux_gnu.rs b/src/librustc_target/spec/s390x_unknown_linux_gnu.rs index c18c94511f8d7..1fbf2b4d5582c 100644 --- a/src/librustc_target/spec/s390x_unknown_linux_gnu.rs +++ b/src/librustc_target/spec/s390x_unknown_linux_gnu.rs @@ -4,7 +4,7 @@ pub fn target() -> TargetResult { let mut base = super::linux_base::opts(); // z10 is the oldest CPU supported by LLVM base.cpu = "z10".to_string(); - // FIXME: The data_layout string below and the ABI implementation in + // FIXME: the data_layout string below and the ABI implementation in // cabi_s390x.rs are for now hard-coded to assume the no-vector ABI. // Pass the -vector feature string to LLVM to respect this assumption. base.features = "-vector".to_string(); diff --git a/src/librustc_target/spec/sparcv9_sun_solaris.rs b/src/librustc_target/spec/sparcv9_sun_solaris.rs index f1c5c5ac44f1a..6e140fef3984c 100644 --- a/src/librustc_target/spec/sparcv9_sun_solaris.rs +++ b/src/librustc_target/spec/sparcv9_sun_solaris.rs @@ -14,7 +14,7 @@ pub fn target() -> TargetResult { target_c_int_width: "32".to_string(), data_layout: "E-m:e-i64:64-n32:64-S128".to_string(), // Use "sparc64" instead of "sparcv9" here, since the former is already - // used widely in the source base. If we ever needed ABI + // used widely in the source base. If we ever needed ABI // differentiation from the sparc64, we could, but that would probably // just be confusing. arch: "sparc64".to_string(), diff --git a/src/librustc_target/spec/windows_base.rs b/src/librustc_target/spec/windows_base.rs index 65d618232a249..838aa7c10d933 100644 --- a/src/librustc_target/spec/windows_base.rs +++ b/src/librustc_target/spec/windows_base.rs @@ -55,14 +55,14 @@ pub fn opts() -> TargetOptions { // Listing the library twice seems to fix that, and seems to also be done // by mingw's gcc (Though not sure if it's done on purpose, or by mistake). // - // See https://github.com/rust-lang/rust/pull/47483 + // See PR #47483. "-lmsvcrt".to_string(), "-luser32".to_string(), "-lkernel32".to_string(), ]); TargetOptions { - // FIXME(#13846) this should be enabled for windows + // FIXME(#13846): this should be enabled for Windows. function_sections: false, linker: Some("gcc".to_string()), dynamic_linking: true, diff --git a/src/librustc_traits/chalk_context/mod.rs b/src/librustc_traits/chalk_context/mod.rs index 303920b5842c9..7abff7b627dd9 100644 --- a/src/librustc_traits/chalk_context/mod.rs +++ b/src/librustc_traits/chalk_context/mod.rs @@ -211,9 +211,9 @@ impl context::ContextOps> for ChalkContext<'cx, 'gcx> { /// each bound variable in `arg` to a fresh inference variable /// from T. Returns: /// - /// - the table `T` - /// - the substitution `S` - /// - the environment and goal found by substitution `S` into `arg` + /// - the table `T`, + /// - the substitution `S`, + /// - the environment and goal found by substitution `S` into `arg`. fn instantiate_ucanonical_goal( &self, arg: &Canonical<'gcx, InEnvironment<'gcx, Goal<'gcx>>>, @@ -241,7 +241,7 @@ impl context::ContextOps> for ChalkContext<'cx, 'gcx> { }) } - /// True if this solution has no region constraints. + /// Returns whether this solution has no region constraints. fn empty_constraints(ccs: &Canonical<'gcx, ConstrainedSubst<'gcx>>) -> bool { ccs.value.constraints.is_empty() } @@ -301,14 +301,16 @@ impl context::ContextOps> for ChalkContext<'cx, 'gcx> { _map: &UniverseMap, value: &Canonical<'gcx, InEnvironment<'gcx, Goal<'gcx>>>, ) -> Canonical<'gcx, InEnvironment<'gcx, Goal<'gcx>>> { - *value // FIXME universe maps not implemented yet + // FIXME: universe maps not implemented yet + *value } fn map_subst_from_canonical( _map: &UniverseMap, value: &Canonical<'gcx, ConstrainedSubst<'gcx>>, ) -> Canonical<'gcx, ConstrainedSubst<'gcx>> { - value.clone() // FIXME universe maps not implemented yet + // FIXME: universe maps not implemented yet + value.clone() } } @@ -363,14 +365,14 @@ impl context::TruncateOps, ChalkArenas<'tcx>> &mut self, _subgoal: &InEnvironment<'tcx, Goal<'tcx>>, ) -> Option>> { - None // FIXME we should truncate at some point! + None // FIXME: we should truncate at some point! } fn truncate_answer( &mut self, _subst: &CanonicalVarValues<'tcx>, ) -> Option> { - None // FIXME we should truncate at some point! + None // FIXME: we should truncate at some point! } } diff --git a/src/librustc_traits/implied_outlives_bounds.rs b/src/librustc_traits/implied_outlives_bounds.rs index a3fb96990545e..b69c90173d61e 100644 --- a/src/librustc_traits/implied_outlives_bounds.rs +++ b/src/librustc_traits/implied_outlives_bounds.rs @@ -73,14 +73,14 @@ fn compute_implied_outlives_bounds<'tcx>( // an annoying scenario where: // // - Some `T::Foo` gets normalized, resulting in a - // variable `_1` and a `T: Trait` constraint + // variable `_1` and a `T: Trait` constraint // (not sure why it couldn't immediately get // solved). This result of `_1` got cached. // - These obligations were dropped on the floor here, // rather than being registered. // - Then later we would get a request to normalize // `T::Foo` which would result in `_1` being used from - // the cache, but hence without the `T: Trait` + // the cache, but hence without the `T: Trait` // constraint. As a result, `_1` never gets resolved, // and we get an ICE (in dropck). // diff --git a/src/librustc_traits/lowering/mod.rs b/src/librustc_traits/lowering/mod.rs index 5502a1d186eee..0727278c58299 100644 --- a/src/librustc_traits/lowering/mod.rs +++ b/src/librustc_traits/lowering/mod.rs @@ -231,12 +231,12 @@ fn program_clauses_for_trait<'a, 'tcx>( .map(|wc| { // we move binders to the left wc.map_bound(|goal| ProgramClause { - // FIXME: As where clauses can only bind lifetimes for now, and that named - // bound regions have a def-id, it is safe to just inject `bound_vars` and + // FIXME: as where clauses can only bind lifetimes for now, and that named + // bound regions have a def-ID, it is safe to just inject `bound_vars` and // `hypotheses` (which contain named vars bound at index `0`) into this // binding level. This may change if we ever allow where clauses to bind - // types (e.g. for GATs things), because bound types only use a `BoundVar` - // index (no def-id). + // types (e.g., for GATs things), because bound types only use a `BoundVar` + // index (no def-ID). goal: goal.subst(tcx, bound_vars).into_from_env_goal(), hypotheses, @@ -381,7 +381,7 @@ pub fn program_clauses_for_type_def<'a, 'tcx>( // move the binders to the left wc.map_bound(|goal| ProgramClause { // FIXME: we inject `bound_vars` and `hypotheses` into this binding - // level, which may be incorrect in the future: see the FIXME in + // level, which may be incorrect in the future; see the FIXME in // `program_clauses_for_trait`. goal: goal.subst(tcx, bound_vars).into_from_env_goal(), hypotheses, @@ -545,7 +545,7 @@ pub fn program_clauses_for_associated_type_value<'a, 'tcx>( // } // ``` // - // FIXME: For the moment, we don't account for where clauses written on the associated + // FIXME: for the moment, we don't account for where clauses written on the associated // ty definition (i.e., in the trait def, as in `type AssocType where T: Sized`). // ``` // forall { diff --git a/src/librustc_traits/type_op.rs b/src/librustc_traits/type_op.rs index d38ce3478d93d..a93878f3e31f0 100644 --- a/src/librustc_traits/type_op.rs +++ b/src/librustc_traits/type_op.rs @@ -138,7 +138,7 @@ impl AscribeUserTypeCx<'me, 'gcx, 'tcx> { let ty = tcx.type_of(def_id); let ty = self.subst(ty, substs); - debug!("relate_type_and_user_type: ty of def-id is {:?}", ty); + debug!("relate_type_and_user_type: ty of def-ID is {:?}", ty); let ty = self.normalize(ty); // We need to follow any provided projetions into the type. diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index 1db7141917f98..1fac5baeaff74 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -400,8 +400,8 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { /// Creates the relevant generic argument substitutions /// corresponding to a set of generic parameters. This is a - /// rather complex little function. Let me try to explain the - /// role of each of its parameters: + /// rather complex function. Let us try to explain the role + /// of each of its parameters: /// /// To start, we are given the `def_id` of the thing we are /// creating the substitutions for, and a partial set of @@ -417,9 +417,9 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { /// we can append those and move on. Otherwise, it invokes the /// three callback functions: /// - /// - `args_for_def_id`: given the def-id `P`, supplies back the + /// - `args_for_def_id`: given the def-ID `P`, supplies back the /// generic arguments that were given to that parent from within - /// the path; so e.g., if you have `::Bar`, the def-id + /// the path; so e.g., if you have `::Bar`, the def-ID /// might refer to the trait `Foo`, and the arguments might be /// `[T]`. The boolean value indicates whether to infer values /// for arguments whose values were not explicitly provided. @@ -564,7 +564,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { let tcx = self.tcx(); let generic_params = tcx.generics_of(def_id); - // If a self-type was declared, one should be provided. + // If a self type was declared, one should be provided. assert_eq!(generic_params.has_self, self_ty.is_some()); let has_self = generic_params.has_self; @@ -584,7 +584,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { if is_object && has_default { if tcx.at(span).type_of(param.def_id).has_self_ty() { // There is no suitable inference default for a type parameter - // that references self, in an object type. + // that references the self type in an object type. return true; } } @@ -680,7 +680,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { /// bound to a valid trait type. Returns the def_id for the defining trait. /// The type _cannot_ be a type other than a trait type. /// - /// If the `projections` argument is `None`, then assoc type bindings like `Foo` + /// If the `projections` argument is `None`, then assoc type bindings like `Foo` /// are disallowed. Otherwise, they are pushed onto the vector given. pub fn instantiate_mono_trait_ref(&self, trait_ref: &hir::TraitRef, @@ -931,6 +931,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { })) } + // `item_segment` is used to substitute the generic arguments. fn ast_path_to_ty(&self, span: Span, did: DefId, @@ -1032,11 +1033,11 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { // } // ``` // - // Here, the user could theoretically write `dyn MyTrait`, + // Here, the user could theoretically write `dyn MyTrait`, // but actually supporting that would "expand" to an infinitely-long type - // `fix $ τ → dyn MyTrait::MyOutput`. + // `fix $ τ → dyn MyTrait::MyOutput`. // - // Instead, we force the user to write `dyn MyTrait`, + // Instead, we force the user to write `dyn MyTrait`, // which is uglier but works. See the discussion in #56288 for alternatives. if !references_self { // Include projections defined on supertraits, diff --git a/src/librustc_typeck/check/_match.rs b/src/librustc_typeck/check/_match.rs index b66c383edb51e..723eba345fe4a 100644 --- a/src/librustc_typeck/check/_match.rs +++ b/src/librustc_typeck/check/_match.rs @@ -155,7 +155,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // cases. Actually what we really want is not a subtyping // relation at all but rather that there exists a LUB (so // that they can be compared). However, in practice, - // constants are always scalars or strings. For scalars + // constants are always scalars or strings. For scalars // subtyping is irrelevant, and for strings `ty` is // type is `&'static str`, so if we say that // @@ -329,7 +329,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // below for details. // Take region, inner-type from expected type if we - // can, to avoid creating needless variables. This + // can, to avoid creating needless variables. This // also helps with the bad interactions of the given // hack detailed in (*) below. debug!("check_pat_walk: expected={:?}", expected); @@ -475,7 +475,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // int`) as a subtype of `Z`: `&'x int <: Z`. And hence we // will instantiate `Z` as a type `&'0 int` where `'0` is // a fresh region variable, with the constraint that `'x : - // '0`. So basically we're all set. + // '0`. So basically we're all set. // // Note that there are two tests to check that this remains true // (`regions-reassign-{match,let}-bound-pointer.rs`). @@ -613,12 +613,12 @@ https://doc.rust-lang.org/reference/types.html#trait-objects"); } } - // Otherwise, we have to union together the types that the - // arms produce and so forth. + // Otherwise, we have to take the union of the types that the + // arms produce, and so forth. let discrim_diverges = self.diverges.get(); self.diverges.set(Diverges::Maybe); - // rust-lang/rust#55810: Typecheck patterns first (via eager + // Issue #55810: type-check patterns first (via eager // collection into `Vec`), so we get types for all bindings. let all_arm_pats_diverge: Vec<_> = arms.iter().map(|arm| { let mut all_pats_diverge = Diverges::WarnedAlways; @@ -638,7 +638,7 @@ https://doc.rust-lang.org/reference/types.html#trait-objects"); } }).collect(); - // Now typecheck the blocks. + // Now type-check the blocks. // // The result of the match is the common supertype of all the // arms. Start out the value as bottom, since it's the, well, @@ -885,7 +885,7 @@ https://doc.rust-lang.org/reference/types.html#trait-objects"); let mut no_field_errors = true; let mut inexistent_fields = vec![]; - // Typecheck each field. + // Type-check each field. for &Spanned { node: ref field, span } in fields { let ident = tcx.adjust_ident(field.ident, variant.did, self.body_id).0; let field_ty = match used_fields.entry(ident) { diff --git a/src/librustc_typeck/check/autoderef.rs b/src/librustc_typeck/check/autoderef.rs index 35ac4f3957eb4..26dc1f6af2cdc 100644 --- a/src/librustc_typeck/check/autoderef.rs +++ b/src/librustc_typeck/check/autoderef.rs @@ -112,7 +112,7 @@ impl<'a, 'gcx, 'tcx> Autoderef<'a, 'gcx, 'tcx> { let tcx = self.infcx.tcx; - // + // `` let trait_ref = TraitRef { def_id: tcx.lang_items().deref_trait()?, substs: tcx.mk_substs_trait(self.cur_ty, &[]), diff --git a/src/librustc_typeck/check/callee.rs b/src/librustc_typeck/check/callee.rs index d4f639c070de3..e60d880fb428a 100644 --- a/src/librustc_typeck/check/callee.rs +++ b/src/librustc_typeck/check/callee.rs @@ -51,7 +51,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { let output = match result { None => { - // this will report an error since original_callee_ty is not a fn + // This will report an error since `original_callee_ty` is not a fn. self.confirm_builtin_call(call_expr, original_callee_ty, arg_exprs, expected) } @@ -68,7 +68,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } }; - // we must check that return type of called functions is WF: + // We must check that return type of called functions is WF. self.register_wf_obligation(output, call_expr.span, traits::MiscObligation); output @@ -96,8 +96,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { assert_eq!(def_id.krate, LOCAL_CRATE); // Check whether this is a call to a closure where we - // haven't yet decided on whether the closure is fn vs - // fnmut vs fnonce. If so, we have to defer further processing. + // haven't yet decided on whether the closure is `fn` versus + // `FnMut` versus `FnOnce`. If so, we have to defer further processing. if self.closure_kind(def_id, substs).is_none() { let closure_ty = self.closure_sig(def_id, substs); let fn_sig = self.replace_bound_vars_with_fresh_vars( @@ -119,8 +119,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } } - // Hack: we know that there are traits implementing Fn for &F - // where F:Fn and so forth. In the particular case of types + // Hack: we know that there are traits implementing `Fn` for `&F` + // where `F: Fn` and so forth. In the particular case of types // like `x: &mut FnMut()`, if there is a call `x()`, we would // normally translate to `FnMut::call_mut(&mut x, ())`, but // that winds up requiring `mut x: &mut FnMut()`. A little @@ -306,16 +306,15 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // previously appeared within a `Binder<>` and hence would not // have been normalized before. let fn_sig = - self.replace_bound_vars_with_fresh_vars(call_expr.span, infer::FnCall, &fn_sig) - .0; + self.replace_bound_vars_with_fresh_vars(call_expr.span, infer::FnCall, &fn_sig).0; let fn_sig = self.normalize_associated_types_in(call_expr.span, &fn_sig); // Call the generic checker. let expected_arg_tys = self.expected_inputs_for_expected_output(call_expr.span, - expected, - fn_sig.output(), - fn_sig.inputs()); + expected, + fn_sig.output(), + fn_sig.inputs()); self.check_argument_types(call_expr.span, call_expr.span, fn_sig.inputs(), @@ -335,7 +334,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { fn_sig: ty::FnSig<'tcx>) -> Ty<'tcx> { // `fn_sig` is the *signature* of the cosure being called. We - // don't know the full details yet (`Fn` vs `FnMut` etc), but we + // don't know the full details yet (`Fn` versus `FnMut`, etc..), but we // do know the types expected for each argument and the return // type. @@ -389,11 +388,11 @@ impl<'a, 'gcx, 'tcx> DeferredCallResolution<'gcx, 'tcx> { pub fn resolve(self, fcx: &FnCtxt<'a, 'gcx, 'tcx>) { debug!("DeferredCallResolution::resolve() {:?}", self); - // we should not be invoked until the closure kind has been - // determined by upvar inference + // We should not be invoked until the closure kind has been + // determined by upvar inference. assert!(fcx.closure_kind(self.closure_def_id, self.closure_substs).is_some()); - // We may now know enough to figure out fn vs fnmut etc. + // We may now know enough to figure out `fn` versus `FnMut`, etc. match fcx.try_overloaded_call_traits(self.call_expr, self.adjusted_ty) { Some((autoref, method_callee)) => { @@ -401,8 +400,8 @@ impl<'a, 'gcx, 'tcx> DeferredCallResolution<'gcx, 'tcx> { // to have a newly instantiated function signature // from the call trait. This has to be reconciled with // the older function signature we had before. In - // principle we *should* be able to fn_sigs(), but we - // can't because of the annoying need for a TypeTrace. + // principle we *should* be able to `fn_sigs()`, but we + // can't because of the annoying need for a `TypeTrace`. // (This always bites me, should find a way to // refactor it.) let method_sig = method_callee.sig; diff --git a/src/librustc_typeck/check/cast.rs b/src/librustc_typeck/check/cast.rs index 6ad707e3d2c78..7d5c44d93f073 100644 --- a/src/librustc_typeck/check/cast.rs +++ b/src/librustc_typeck/check/cast.rs @@ -140,7 +140,7 @@ enum CastError { CastToBool, CastToChar, DifferingKinds, - /// Cast of thin to fat raw ptr (eg. `*const () as *const [u8]`) + /// Cast of thin to fat raw ptr (e.g., `*const () as *const [u8]`). SizedUnsizedCast, IllegalCast, NeedDeref, diff --git a/src/librustc_typeck/check/closure.rs b/src/librustc_typeck/check/closure.rs index 25b1c0836c28b..b5e62aa6f3fbf 100644 --- a/src/librustc_typeck/check/closure.rs +++ b/src/librustc_typeck/check/closure.rs @@ -363,7 +363,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { /// /// # Arguments /// - /// - `expr_def_id`: the def-id of the closure expression + /// - `expr_def_id`: the def-ID of the closure expression /// - `decl`: the HIR declaration of the closure /// - `body`: the body of the closure /// - `expected_sig`: the expected signature (if any). Note that @@ -479,7 +479,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // FIXME(#45727): As discussed in [this comment][c1], naively // forcing equality here actually results in suboptimal error - // messages in some cases. For now, if there would have been + // messages in some cases. For now, if there would have been // an obvious error, we fallback to declaring the type of the // closure to be the one the user gave, which allows other // error message code to trigger. diff --git a/src/librustc_typeck/check/coercion.rs b/src/librustc_typeck/check/coercion.rs index a82a0d3ce5232..da4507eba8a06 100644 --- a/src/librustc_typeck/check/coercion.rs +++ b/src/librustc_typeck/check/coercion.rs @@ -1,7 +1,7 @@ //! # Type Coercion //! //! Under certain circumstances we will coerce from one type to another, -//! for example by auto-borrowing. This occurs in situations where the +//! for example by auto-borrowing. This occurs in situations where the //! compiler has a firm 'expected type' that was supplied from the user, //! and where the actual type is similar to that expected type in purpose //! but not in representation (so actual subtyping is inappropriate). @@ -9,24 +9,24 @@ //! ## Reborrowing //! //! Note that if we are expecting a reference, we will *reborrow* -//! even if the argument provided was already a reference. This is +//! even if the argument provided was already a reference. This is //! useful for freezing mut/const things (that is, when the expected is &T //! but you have &const T or &mut T) and also for avoiding the linearity -//! of mut things (when the expected is &mut T and you have &mut T). See +//! of mut things (when the expected is &mut T and you have &mut T). See //! the various `src/test/run-pass/coerce-reborrow-*.rs` tests for //! examples of where this is useful. //! //! ## Subtle note //! //! When deciding what type coercions to consider, we do not attempt to -//! resolve any type variables we may encounter. This is because `b` +//! resolve any type variables we may encounter. This is because `b` //! represents the expected type "as the user wrote it", meaning that if //! the user defined a generic function like //! //! fn foo(a: A, b: A) { ... } //! //! and then we wrote `foo(&1, @2)`, we will not auto-borrow -//! either argument. In older code we went to some lengths to +//! either argument. In older code we went to some lengths to //! resolve the `b` variable, which could mean that we'd //! auto-borrow later arguments but not earlier ones, which //! seems very confusing. @@ -39,15 +39,15 @@ //! foo::<&int>(@1, @2) //! //! then we *will* auto-borrow, because we can't distinguish this from a -//! function that declared `&int`. This is inconsistent but it's easiest +//! function that declared `&int`. This is inconsistent but it's easiest //! at the moment. The right thing to do, I think, is to consider the //! *unsubstituted* type when deciding whether to auto-borrow, but the //! *substituted* type when considering the bounds and so forth. But most //! of our methods don't give access to the unsubstituted type, and -//! rightly so because they'd be error-prone. So maybe the thing to do is +//! rightly so because they'd be error-prone. So maybe the thing to do is //! to actually determine the kind of coercions that should occur -//! separately and pass them in. Or maybe it's ok as is. Anyway, it's -//! sort of a minor point so I've opted to leave it for later---after all +//! separately and pass them in. Or maybe it's ok as is. Anyway, it's +//! sort of a minor point so I've opted to leave it for later -- after all, //! we may want to adjust precisely when coercions occur. use check::{FnCtxt, Needs}; @@ -249,7 +249,7 @@ impl<'f, 'gcx, 'tcx> Coerce<'f, 'gcx, 'tcx> { // If we have a parameter of type `&M T_a` and the value // provided is `expr`, we will be adding an implicit borrow, - // meaning that we convert `f(expr)` to `f(&M *expr)`. Therefore, + // meaning that we convert `f(expr)` to `f(&M *expr)`. Therefore, // to type check, we will construct the type that `&M*expr` would // yield. @@ -276,7 +276,7 @@ impl<'f, 'gcx, 'tcx> Coerce<'f, 'gcx, 'tcx> { continue; } - // At this point, we have deref'd `a` to `referent_ty`. So + // At this point, we have deref'd `a` to `referent_ty`. So, // imagine we are coercing from `&'a mut Vec` to `&'b mut [T]`. // In the autoderef loop for `&'a mut Vec`, we would get // three callbacks: @@ -307,7 +307,7 @@ impl<'f, 'gcx, 'tcx> Coerce<'f, 'gcx, 'tcx> { // - if in sub mode, that means we want to use `'b` (the // region from the target reference) for both // pointers [2]. This is because sub mode (somewhat - // arbitrarily) returns the subtype region. In the case + // arbitrarily) returns the subtype region. In the case // where we are coercing to a target type, we know we // want to use that target type region (`'b`) because -- // for the program to type-check -- it must be the @@ -319,7 +319,7 @@ impl<'f, 'gcx, 'tcx> Coerce<'f, 'gcx, 'tcx> { // annotate the region of a borrow), and regionck has // code that adds edges from the region of a borrow // (`'b`, here) into the regions in the borrowed - // expression (`*x`, here). (Search for "link".) + // expression (`*x`, here). (Search for "link".) // - if in lub mode, things can get fairly complicated. The // easiest thing is just to make a fresh // region variable [4], which effectively means we defer @@ -393,8 +393,8 @@ impl<'f, 'gcx, 'tcx> Coerce<'f, 'gcx, 'tcx> { if ty == a && mt_a.mutbl == hir::MutImmutable && autoderef.step_count() == 1 { // As a special case, if we would produce `&'a *x`, that's - // a total no-op. We end up with the type `&'a T` just as - // we started with. In that case, just skip it + // a total noop. We end up with the type `&'a T` just as + // we started with. In that case, just skip it // altogether. This is just an optimization. // // Note that for `&mut`, we DO want to reborrow -- @@ -1032,7 +1032,7 @@ impl<'gcx, 'tcx, 'exprs, E> CoerceMany<'gcx, 'tcx, 'exprs, E> } /// Return the "expected type" with which this coercion was - /// constructed. This represents the "downward propagated" type + /// constructed. This represents the "downward propagated" type /// that was given to us at the start of typing whatever construct /// we are typing (e.g., the match expression). /// @@ -1153,7 +1153,7 @@ impl<'gcx, 'tcx, 'exprs, E> CoerceMany<'gcx, 'tcx, 'exprs, E> // if let Some(x) = ... { } // // we wind up with a second match arm that is like `_ => - // ()`. That is the case we are considering here. We take + // ()`. That is the case we are considering here. We take // a different path to get the right "expected, found" // message and so forth (and because we know that // `expression_ty` will be unit). diff --git a/src/librustc_typeck/check/compare_method.rs b/src/librustc_typeck/check/compare_method.rs index 8c193cc8ff1a3..460b34e6e0a1e 100644 --- a/src/librustc_typeck/check/compare_method.rs +++ b/src/librustc_typeck/check/compare_method.rs @@ -17,10 +17,10 @@ use super::{Inherited, FnCtxt, potentially_plural_count}; /// /// # Parameters /// -/// - impl_m: type of the method we are checking -/// - impl_m_span: span to use for reporting errors -/// - trait_m: the method in the trait -/// - impl_trait_ref: the TraitRef corresponding to the trait implementation +/// - `impl_m`: type of the method we are checking +/// - `impl_m_span`: span to use for reporting errors +/// - `trait_m`: the method in the trait +/// - `impl_trait_ref`: the TraitRef corresponding to the trait implementation pub fn compare_impl_method<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, impl_m: &ty::AssociatedItem, @@ -80,7 +80,7 @@ fn compare_predicate_entailment<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, -> Result<(), ErrorReported> { let trait_to_impl_substs = impl_trait_ref.substs; - // This node-id should be used for the `body_id` field on each + // This node-ID should be used for the `body_id` field on each // `ObligationCause` (and the `FnCtxt`). This is what // `regionck_item` expects. let impl_m_node_id = tcx.hir().as_local_node_id(impl_m.def_id).unwrap(); @@ -144,7 +144,7 @@ fn compare_predicate_entailment<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, // <'a> fn(t: &'i0 U0, m: &'a) -> Foo // // This type is also the same but the name of the bound region ('a - // vs 'b). However, the normal subtyping rules on fn types handle + // vs 'b). However, the normal subtyping rules on fn types handle // this kind of equivalency just fine. // // We now use these substitutions to ensure that all declared bounds are @@ -243,7 +243,7 @@ fn compare_predicate_entailment<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, // compatible with that of the trait method. We do this by // checking that `impl_fty <: trait_fty`. // - // FIXME. Unfortunately, this doesn't quite work right now because + // FIXME: unfortunately, this doesn't quite work right now because // associated type normalization is not integrated into subtype // checks. For the comparison to be valid, we need to // normalize the associated types in the impl/trait methods @@ -252,7 +252,7 @@ fn compare_predicate_entailment<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, // any associated types appearing in the fn arguments or return // type. - // Compute placeholder form of impl and trait method tys. + // Compute placeholder forms of impl and trait method types. let tcx = infcx.tcx; let (impl_sig, _) = infcx.replace_bound_vars_with_fresh_vars( @@ -375,7 +375,7 @@ fn check_region_bounds_on_impl_method<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, // Must have same number of early-bound lifetime parameters. // Unfortunately, if the user screws up the bounds, then this - // will change classification between early and late. E.g., + // will change classification between early and late. E.g., // if in trait we have `<'a,'b:'a>`, and in impl we just have // `<'a,'b>`, then we have 2 early-bound lifetime parameters // in trait but 0 in the impl. But if we report "expected 2 @@ -498,9 +498,9 @@ fn compare_self_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, -> Result<(), ErrorReported> { // Try to give more informative error messages about self typing - // mismatches. Note that any mismatch will also be detected + // mismatches. Note that any mismatch will also be detected // below, where we construct a canonical function type that - // includes the self parameter as a normal parameter. It's just + // includes the self parameter as a normal parameter. It's just // that the error messages you get out of this code are a bit more // inscrutable, particularly for cases where one method has no // self. @@ -714,10 +714,10 @@ fn compare_synthetic_generics<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, impl_m: &ty::AssociatedItem, trait_m: &ty::AssociatedItem) -> Result<(), ErrorReported> { - // FIXME(chrisvittal) Clean up this function, list of FIXME items: - // 1. Better messages for the span labels - // 2. Explanation as to what is going on - // If we get here, we already have the same number of generics, so the zip will + // FIXME(chrisvittal): clean up this function. + // 1. Better messages for the span labels. + // 2. Explanation as to what is going on. + // If we get here, we already have the same number of generics, so the `zip` will // be okay. let mut error_found = false; let impl_m_generics = tcx.generics_of(impl_m.def_id); @@ -933,7 +933,7 @@ pub fn compare_const_impl<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, impl_ty, trait_ty); - // Locate the Span containing just the type of the offending impl + // Locate the Span containing just the type of the offending impl. match tcx.hir().expect_impl_item(impl_c_node_id).node { ImplItemKind::Const(ref ty, _) => cause.span = ty.span, _ => bug!("{:?} is not a impl const", impl_c), @@ -948,7 +948,7 @@ pub fn compare_const_impl<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, let trait_c_node_id = tcx.hir().as_local_node_id(trait_c.def_id); let trait_c_span = trait_c_node_id.map(|trait_c_node_id| { - // Add a label to the Span containing just the type of the const + // Add a label to the `Span` containing just the type of the const. match tcx.hir().expect_trait_item(trait_c_node_id).node { TraitItemKind::Const(ref ty, _) => ty.span, _ => bug!("{:?} is not a trait const", trait_c), diff --git a/src/librustc_typeck/check/demand.rs b/src/librustc_typeck/check/demand.rs index 84ca77663a6ab..97e811803a9b1 100644 --- a/src/librustc_typeck/check/demand.rs +++ b/src/librustc_typeck/check/demand.rs @@ -152,7 +152,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // This special internal attribute is used to whitelist // "identity-like" conversion methods to be suggested here. // - // FIXME (#46459 and #46460): ideally + // FIXME(#46459 and #46460): ideally // `std::convert::Into::into` and `std::borrow:ToOwned` would // also be `#[rustc_conversion_suggestion]`, if not for // method-probing false-positives and -negatives (respectively). diff --git a/src/librustc_typeck/check/dropck.rs b/src/librustc_typeck/check/dropck.rs index 60b5db0d12cc4..994d86fa86bd9 100644 --- a/src/librustc_typeck/check/dropck.rs +++ b/src/librustc_typeck/check/dropck.rs @@ -12,7 +12,7 @@ use util::common::ErrorReported; use syntax::ast; use syntax_pos::Span; -/// check_drop_impl confirms that the Drop implementation identified by +/// This function confirms that the `Drop` implementation identified by /// `drop_impl_did` is not any more specialized than the type it is /// attached to (Issue #8142). /// @@ -21,7 +21,7 @@ use syntax_pos::Span; /// 1. The self type must be nominal (this is already checked during /// coherence), /// -/// 2. The generic region/type parameters of the impl's self-type must +/// 2. The generic region/type parameters of the impl's self type must /// all be parameters of the Drop impl itself (i.e., no /// specialization like `impl Drop for Foo`), and, /// @@ -53,7 +53,7 @@ pub fn check_drop_impl<'a, 'tcx>( ) } _ => { - // Destructors only work on nominal types. This was + // Destructors only work on nominal types. This was // already checked by coherence, but compilation may // not have been terminated. let span = tcx.def_span(drop_impl_did); @@ -72,8 +72,7 @@ fn ensure_drop_params_and_item_params_correspond<'a, 'tcx>( ) -> Result<(), ErrorReported> { let drop_impl_node_id = tcx.hir().as_local_node_id(drop_impl_did).unwrap(); - // check that the impl type can be made to match the trait type. - + // Check that the impl type can be made to match the trait type. tcx.infer_ctxt().enter(|ref infcx| { let impl_param_env = tcx.param_env(self_type_did); let tcx = infcx.tcx; @@ -111,21 +110,21 @@ fn ensure_drop_params_and_item_params_correspond<'a, 'tcx>( } if let Err(ref errors) = fulfillment_cx.select_all_or_error(&infcx) { - // this could be reached when we get lazy normalization + // This could be reached when we get lazy normalization. infcx.report_fulfillment_errors(errors, None, false); return Err(ErrorReported); } let region_scope_tree = region::ScopeTree::default(); - // NB. It seems a bit... suspicious to use an empty param-env - // here. The correct thing, I imagine, would be + // FIXMKE(nmatsakis): it seems a bit suspicious to use an empty + // param-env here. The correct thing, I imagine, would be // `OutlivesEnvironment::new(impl_param_env)`, which would // allow region solving to take any `a: 'b` relations on the // impl into account. But I could not create a test case where // it did the wrong thing, so I chose to preserve existing // behavior, since it ought to be simply more - // conservative. -nmatsakis + // conservative. let outlives_env = OutlivesEnvironment::new(ty::ParamEnv::empty()); infcx.resolve_regions_and_report_errors( @@ -236,9 +235,9 @@ fn ensure_drop_predicates_are_implied_by_item_defn<'a, 'tcx>( result } -/// check_safety_of_destructor_if_necessary confirms that the type +/// This function confirms that the type /// expression `typ` conforms to the "Drop Check Rule" from the Sound -/// Generic Drop (RFC 769). +/// Generic Drop RFC (#769). /// /// ---- /// @@ -287,7 +286,6 @@ fn ensure_drop_predicates_are_implied_by_item_defn<'a, 'tcx>( /// this conservative assumption (and thus assume the obligation of /// ensuring that they do not access data nor invoke methods of /// values that have been previously dropped). -/// pub fn check_safety_of_destructor_if_necessary<'a, 'gcx, 'tcx>( rcx: &mut RegionCtxt<'a, 'gcx, 'tcx>, ty: Ty<'tcx>, @@ -295,7 +293,7 @@ pub fn check_safety_of_destructor_if_necessary<'a, 'gcx, 'tcx>( body_id: ast::NodeId, scope: region::Scope, ) -> Result<(), ErrorReported> { - debug!("check_safety_of_destructor_if_necessary typ: {:?} scope: {:?}", + debug!("check_safety_of_destructor_if_necessary: typ={:?} scope={:?}", ty, scope); let parent_scope = match rcx.region_scope_tree.opt_encl_scope(scope) { @@ -308,7 +306,7 @@ pub fn check_safety_of_destructor_if_necessary<'a, 'gcx, 'tcx>( let origin = || infer::SubregionOrigin::SafeDestructor(span); let cause = &ObligationCause::misc(span, body_id); let infer_ok = rcx.infcx.at(cause, rcx.fcx.param_env).dropck_outlives(ty); - debug!("dropck_outlives = {:#?}", infer_ok); + debug!("check_safety_of_destructor_if_necessary: dropck_outlives={:#?}", infer_ok); let kinds = rcx.fcx.register_infer_ok_obligations(infer_ok); for kind in kinds { match kind.unpack() { diff --git a/src/librustc_typeck/check/method/confirm.rs b/src/librustc_typeck/check/method/confirm.rs index 4343f751e6aee..7b00202091860 100644 --- a/src/librustc_typeck/check/method/confirm.rs +++ b/src/librustc_typeck/check/method/confirm.rs @@ -94,7 +94,7 @@ impl<'a, 'gcx, 'tcx> ConfirmContext<'a, 'gcx, 'tcx> { // // SUBTLE: if we want good error messages, because of "guessing" while matching // traits, no trait system method can be called before this point because they - // could alter our Self-type, except for normalizing the receiver from the + // could alter our self type, except for normalizing the receiver from the // signature (which is also done during probing). let method_sig_rcvr = self.normalize_associated_types_in(self.span, &method_sig.inputs()[0]); @@ -249,7 +249,7 @@ impl<'a, 'gcx, 'tcx> ConfirmContext<'a, 'gcx, 'tcx> { // Make a trait reference `$0 : Trait<$1...$n>` // consisting entirely of type variables. Later on in - // the process we will unify the transformed-self-type + // the process we will unify the transformed-self type // of the method with the actual type in order to // unify some of these variables. self.fresh_substs_for_item(self.span, trait_def_id) @@ -270,7 +270,7 @@ impl<'a, 'gcx, 'tcx> ConfirmContext<'a, 'gcx, 'tcx> { -> R { // If we specified that this is an object method, then the - // self-type ought to be something that can be dereferenced to + // self type ought to be something that can be dereferenced to // yield an object-type (e.g., `&Object` or `Box` // etc). @@ -287,7 +287,7 @@ impl<'a, 'gcx, 'tcx> ConfirmContext<'a, 'gcx, 'tcx> { .next() .unwrap_or_else(|| span_bug!(self.span, - "self-type `{}` for ObjectPick never dereferenced to an object", + "self type `{}` for ObjectPick never dereferenced to an object", self_ty) ) } diff --git a/src/librustc_typeck/check/method/mod.rs b/src/librustc_typeck/check/method/mod.rs index fe5f43e3c01ef..007beee86ffa3 100644 --- a/src/librustc_typeck/check/method/mod.rs +++ b/src/librustc_typeck/check/method/mod.rs @@ -224,7 +224,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { /// `lookup_method_in_trait` is used for overloaded operators. /// It does a very narrow slice of what the normal probe/confirm path does. /// In particular, it doesn't really do any probing: it simply constructs - /// an obligation for a particular trait with the given self-type and checks + /// an obligation for a particular trait with the given self type and checks /// whether that trait is implemented. /// /// FIXME(#18741): it seems likely that we can consolidate some of this @@ -314,7 +314,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // Register obligations for the parameters. This will include the // `Self` parameter, which in turn has a bound of the main trait, - // so this also effectively registers `obligation` as well. (We + // so this also effectively registers `obligation` as well. (We // used to register `obligation` explicitly, but that resulted in // double error messages being reported.) // diff --git a/src/librustc_typeck/check/method/probe.rs b/src/librustc_typeck/check/method/probe.rs index 30a868622a596..2183e211193b3 100644 --- a/src/librustc_typeck/check/method/probe.rs +++ b/src/librustc_typeck/check/method/probe.rs @@ -250,8 +250,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { self.tcx.method_autoderef_steps(param_env_and_self_ty) } else { self.infcx.probe(|_| { - // Mode::Path - the deref steps is "trivial". This turns - // our CanonicalQuery into a "trivial" QueryResponse. This + // `Mode::Path` -- the deref steps is "trivial". This turns + // our `CanonicalQuery` into a "trivial" `QueryResponse`. This // is a bit inefficient, but I don't think that writing // special handling for this "trivial case" is a good idea. @@ -298,12 +298,12 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // ambiguous. if let Some(bad_ty) = &steps.opt_bad_ty { if is_suggestion.0 { - // Ambiguity was encountered during a suggestion. Just keep going. + // Ambiguity was encountered during a suggestion; just keep going. debug!("ProbeContext: encountered ambiguity in suggestion"); } else if bad_ty.reached_raw_pointer && !self.tcx.features().arbitrary_self_types { - // this case used to be allowed by the compiler, - // so we do a future-compat lint here for the 2015 edition - // (see https://github.com/rust-lang/rust/issues/46906) + // Rhis case used to be allowed by the compiler, + // so we do a future-compat lint here for the 2015 edition. + // (See issue #46906.) if self.tcx.sess.rust_2018() { span_err!(self.tcx.sess, span, E0699, "the type of this value must be known \ @@ -336,9 +336,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { self_ty, steps); - - // this creates one big transaction so that all type variables etc - // that we create during the probe process are removed later + // This creates one big transaction so that all type variables, etc., + // that we create during the probe process are removed later. self.probe(|_| { let mut probe_cx = ProbeContext::new( self, span, mode, method_name, return_type, orig_values, @@ -708,7 +707,7 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> { fn assemble_inherent_candidates_from_param(&mut self, param_ty: ty::ParamTy) { - // FIXME -- Do we want to commit to this behavior for param bounds? + // FIXME: do we want to commit to this behavior for param bounds? let bounds = self.param_env .caller_bounds @@ -1143,7 +1142,7 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> { "a method with this name may be added to the standard library in the future", ); - // FIXME: This should be a `span_suggestion_with_applicability` instead of `help` + // FIXME: this should be a `span_suggestion_with_applicability` instead of `help` // However `self.span` only // highlights the method name, so we can't use it. Also consider reusing the code from // `report_method_error()`. @@ -1212,7 +1211,7 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> { .sup(probe.xform_self_ty, self_ty) { Ok(InferOk { obligations, value: () }) => obligations, Err(_) => { - debug!("--> cannot relate self-types"); + debug!("--> cannot relate self types"); return ProbeResult::NoMatch; } }; @@ -1419,7 +1418,7 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> { ty::AssociatedKind::Method | ty::AssociatedKind::Const => true }, } - // FIXME -- check for types that deref to `Self`, + // FIXME: check for types that deref to `Self`, // like `Rc` and so on. // // Note also that the current code will break if this type diff --git a/src/librustc_typeck/check/method/suggest.rs b/src/librustc_typeck/check/method/suggest.rs index 98c425655d2d3..e4097409892ed 100644 --- a/src/librustc_typeck/check/method/suggest.rs +++ b/src/librustc_typeck/check/method/suggest.rs @@ -613,7 +613,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { candidates.sort_by(|a, b| a.cmp(b).reverse()); candidates.dedup(); - // FIXME #21673: this help message could be tuned to the case + // FIXME(#21673): this help message could be tuned to the case // of a type parameter: suggest adding a trait bound rather // than implementing. err.help("items from traits can only be used if the trait is implemented and in scope"); diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 974df84beef5f..4cc70ef90babe 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -1,6 +1,6 @@ /*! -# check.rs +# typeck: check phase Within the check phase of type check, we check each item one at a time (bodies of function expressions are checked as part of the containing @@ -14,18 +14,18 @@ can be broken down into several distinct phases: - main: the main pass does the lion's share of the work: it determines the types of all expressions, resolves - methods, checks for most invalid conditions, and so forth. In + methods, checks for most invalid conditions, and so forth. In some cases, where a type is unknown, it may create a type or region variable and use that as the type of an expression. In the process of checking, various constraints will be placed on these type variables through the subtyping relationships requested - through the `demand` module. The `infer` module is in charge + through the `demand` module. The `infer` module is in charge of resolving those constraints. - regionck: after main is complete, the regionck pass goes over all types looking for regions and making sure that they did not escape - into places they are not in scope. This may also influence the + into places they are not in scope. This may also influence the final assignments of the various region variables if there is some flexibility. @@ -33,7 +33,7 @@ can be broken down into several distinct phases: appears on a type parameter. - writeback: writes the final types within a function body, replacing - type variables with their final inferred types. These final types + type variables with their final inferred types. These final types are written into the `tcx.node_types` table, which should *never* contain any reference to a type variable. @@ -41,8 +41,8 @@ can be broken down into several distinct phases: While type checking a function, the intermediate types for the expressions, blocks, and so forth contained within the function are -stored in `fcx.node_types` and `fcx.node_substs`. These types -may contain unresolved type variables. After type checking is +stored in `fcx.node_types` and `fcx.node_substs`. These types +may contain unresolved type variables. After type checking is complete, the functions in the writeback module are used to take the types from this table, resolve them, and then write them into their permanent home in the type context `tcx`. @@ -54,12 +54,12 @@ nodes within the function. The types of top-level items, which never contain unbound type variables, are stored directly into the `tcx` tables. -N.B., a type variable is not the same thing as a type parameter. A +N.B., a type variable is not the same thing as a type parameter. A type variable is rather an "instance" of a type parameter: that is, given a generic function `fn foo(t: T)`: while checking the function `foo`, the type `ty_param(0)` refers to the type `T`, which -is treated in abstract. When `foo()` is called, however, `T` will be -substituted for a fresh type variable `N`. This variable will +is treated in abstract. When `foo()` is called, however, `T` will be +substituted for a fresh type variable `N`. This variable will eventually be resolved to some concrete type (which might itself be type parameter). @@ -152,7 +152,7 @@ pub struct LocalTy<'tcx> { revealed_ty: Ty<'tcx> } -/// A wrapper for InferCtxt's `in_progress_tables` field. +/// A wrapper for `InferCtxt`'s `in_progress_tables` field. #[derive(Copy, Clone)] struct MaybeInProgressTables<'a, 'tcx: 'a> { maybe_tables: Option<&'a RefCell>>, @@ -178,7 +178,7 @@ impl<'a, 'tcx> MaybeInProgressTables<'a, 'tcx> { } } -/// closures defined within the function. For example: +/// Closures defined within the function. For example: /// /// fn foo() { /// bar(move|| { ... }) @@ -205,7 +205,7 @@ pub struct Inherited<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { // `FnOnce` closure. In that case, we defer full resolution of the // call until upvar inference can kick in and make the // decision. We keep these deferred resolutions grouped by the - // def-id of the closure, so that once we decide, we can easily go + // def-ID of the closure, so that once we decide, we can easily go // back and process them. deferred_call_resolutions: RefCell>>>, @@ -247,10 +247,10 @@ pub enum Expectation<'tcx> { /// This expression is an `if` condition, it must resolve to `bool`. ExpectIfCondition, - /// This expression should have the type given (or some subtype) + /// This expression should have the type given (or some subtype). ExpectHasType(Ty<'tcx>), - /// This expression will be cast to the `Ty` + /// This expression will be cast to the `Ty`. ExpectCastableToType(Ty<'tcx>), /// This rvalue expression will be wrapped in `&` or `Box` and coerced @@ -447,7 +447,7 @@ pub enum Diverges { Always, /// Same as `Always` but with a reachability - /// warning already emitted + /// warning already emitted. WarnedAlways } @@ -488,8 +488,8 @@ impl Diverges { pub struct BreakableCtxt<'gcx: 'tcx, 'tcx> { may_break: bool, - // this is `null` for loops where break with a value is illegal, - // such as `while`, `for`, and `while let` + // This is `null` for loops where break with a value is illegal, + // such as `while`, `for`, and `while let`. coerce: Option>, } @@ -532,16 +532,16 @@ pub struct FnCtxt<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { ps: RefCell, /// Whether the last checked node generates a divergence (e.g., - /// `return` will set this to Always). In general, when entering + /// `return` will set this to `Always`). In general, when entering /// an expression or other node in the tree, the initial value /// indicates whether prior parts of the containing expression may /// have diverged. It is then typically set to `Maybe` (and the /// old value remembered) for processing the subparts of the /// current expression. As each subpart is processed, they may set - /// the flag to `Always` etc. Finally, at the end, we take the + /// the flag to `Always`, etc. Finally, at the end, we take the /// result and "union" it with the original value, so that when we /// return the flag indicates if any subpart of the parent - /// expression (up to and including this part) has diverged. So, + /// expression (up to and including this part) has diverged. So, /// if you read it after evaluating a subexpression `X`, the value /// you get indicates whether any subexpression that was /// evaluating up to and including `X` diverged. @@ -560,7 +560,7 @@ pub struct FnCtxt<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { /// foo();}` or `{return; 22}`, where we would warn on the /// `foo()` or `22`. /// - /// An expression represents dead-code if, after checking it, + /// An expression represents dead code if, after checking it, /// the diverges flag is set to something other than `Maybe`. diverges: Cell, @@ -579,9 +579,9 @@ impl<'a, 'gcx, 'tcx> Deref for FnCtxt<'a, 'gcx, 'tcx> { } } -/// Helper type of a temporary returned by Inherited::build(...). +/// Helper type of a temporary returned by `Inherited::build(...)`. /// Necessary because we can't write the following bound: -/// F: for<'b, 'tcx> where 'gcx: 'tcx FnOnce(Inherited<'b, 'gcx, 'tcx>). +/// `F: for<'b, 'tcx> where 'gcx: 'tcx FnOnce(Inherited<'b, 'gcx, 'tcx>)`. pub struct InheritedBuilder<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { infcx: infer::InferCtxtBuilder<'a, 'gcx, 'tcx>, def_id: DefId, @@ -751,13 +751,13 @@ fn adt_destructor<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, tcx.calculate_dtor(def_id, &mut dropck::check_drop_impl) } -/// If this def-id is a "primary tables entry", returns `Some((body_id, decl))` +/// If this def-ID is a "primary tables entry", returns `Some((body_id, decl))` /// with information about it's body-id and fn-decl (if any). Otherwise, /// returns `None`. /// /// If this function returns "some", then `typeck_tables(def_id)` will /// succeed; if it returns `None`, then `typeck_tables(def_id)` may or -/// may not succeed. In some cases where this function returns `None` +/// may not succeed. In some cases where this function returns `None` /// (notably closures), `typeck_tables(def_id)` would wind up /// redirecting to the owning function. fn primary_body_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, @@ -914,7 +914,7 @@ fn typeck_tables_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, fcx.resolve_type_vars_in_body(body) }); - // Consistency check our TypeckTables instance can hold all ItemLocalIds + // Consistency check our `TypeckTables` instance can hold all `ItemLocalId`s // it will need to hold. assert_eq!(tables.local_id_root, Some(DefId::local(tcx.hir().definitions().node_to_hir_id(id).owner))); @@ -1011,7 +1011,7 @@ impl<'a, 'gcx, 'tcx> Visitor<'gcx> for GatherLocalsVisitor<'a, 'gcx, 'tcx> { intravisit::walk_pat(self, p); } - // Don't descend into the bodies of nested closures + // Don't descend into the bodies of nested closures. fn visit_fn(&mut self, _: intravisit::FnKind<'gcx>, _: &'gcx hir::FnDecl, _: hir::BodyId, _: Span, _: ast::NodeId) { } } @@ -1026,7 +1026,7 @@ struct GeneratorTypes<'tcx> { /// Types that are captured (see `GeneratorInterior` for more). interior: ty::Ty<'tcx>, - /// Indicates if the generator is movable or static (immovable) + /// Indicates if the generator is movable or static (immovable). movability: hir::GeneratorMovability, } @@ -1049,7 +1049,7 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>, debug!("check_fn(sig={:?}, fn_id={}, param_env={:?})", fn_sig, fn_id, param_env); - // Create the function context. This is either derived from scratch or, + // Create the function context. This is either derived from scratch or, // in the case of closures, based on the outer context. let mut fcx = FnCtxt::new(inherited, param_env, body.value.id); *fcx.ps.borrow_mut() = UnsafetyState::function(fn_sig.unsafety, fn_id); @@ -1084,7 +1084,7 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>, fcx.check_pat_walk(&arg.pat, arg_ty, ty::BindingMode::BindByValue(hir::Mutability::MutImmutable), true); - // Check that argument is Sized. + // Check that argument is `Sized`. // The check for a non-trivial pattern is a hack to avoid duplicate warnings // for simple cases like `fn foo(x: Trait)`, // where we would error once on the parameter as a whole, and once on the binding `x`. @@ -1102,7 +1102,7 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>, // We insert the deferred_generator_interiors entry after visiting the body. // This ensures that all nested generators appear before the entry of this generator. - // resolve_generator_interiors relies on this property. + // `resolve_generator_interiors` relies on this property. let gen_ty = if can_be_generator.is_some() && body.is_generator { let interior = fcx.next_ty_var(TypeVariableOrigin::MiscVariable(span)); fcx.deferred_generator_interiors.borrow_mut().push((body.id(), interior)); @@ -1165,13 +1165,13 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>, } } - // Check that a function marked as `#[panic_handler]` has signature `fn(&PanicInfo) -> !` + // Check that a function marked as `#[panic_handler]` has signature `fn(&PanicInfo) -> !`. if let Some(panic_impl_did) = fcx.tcx.lang_items().panic_impl() { if panic_impl_did == fcx.tcx.hir().local_def_id(fn_id) { if let Some(panic_info_did) = fcx.tcx.lang_items().panic_info() { - // at this point we don't care if there are duplicate handlers or if the handler has - // the wrong signature as this value we'll be used when writing metadata and that - // only happens if compilation succeeded + // At this point we don't care if there are duplicate handlers or if the handler has + // the wrong signature, as this value will be used when writing metadata, and that + // only happens if compilation succeeded. fcx.tcx.sess.has_panic_handler.try_set_same(true); if declared_ret_ty.sty != ty::Never { @@ -1223,7 +1223,7 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>, } } - // Check that a function marked as `#[alloc_error_handler]` has signature `fn(Layout) -> !` + // Check that a function marked as `#[alloc_error_handler]` has signature `fn(Layout) -> !`. if let Some(alloc_error_handler_did) = fcx.tcx.lang_items().oom() { if alloc_error_handler_did == fcx.tcx.hir().local_def_id(fn_id) { if let Some(alloc_layout_did) = fcx.tcx.lang_items().alloc_layout() { @@ -1280,7 +1280,8 @@ fn check_struct<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, span: Span) { let def_id = tcx.hir().local_def_id(id); let def = tcx.adt_def(def_id); - def.destructor(tcx); // force the destructor to be evaluated + // Force the destructor to be evaluated. + def.destructor(tcx); check_representable(tcx, span, def_id); if def.repr.simd() { @@ -1296,7 +1297,8 @@ fn check_union<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, span: Span) { let def_id = tcx.hir().local_def_id(id); let def = tcx.adt_def(def_id); - def.destructor(tcx); // force the destructor to be evaluated + // Force the destructor to be evaluated. + def.destructor(tcx); check_representable(tcx, span, def_id); check_packed(tcx, span, def_id); @@ -1396,12 +1398,12 @@ pub fn check_item_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, it: &'tcx hir::Ite } fn maybe_check_static_with_link_section(tcx: TyCtxt, id: DefId, span: Span) { - // Only restricted on wasm32 target for now + // Only restricted on wasm32 target for now. if !tcx.sess.opts.target_triple.triple().starts_with("wasm32") { return } - // If `#[link_section]` is missing, then nothing to verify + // If `#[link_section]` is missing, then nothing to verify. let attrs = tcx.codegen_fn_attrs(id); if attrs.link_section.is_none() { return @@ -1437,7 +1439,7 @@ fn check_on_unimplemented<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, trait_def_id: DefId, item: &hir::Item) { let item_def_id = tcx.hir().local_def_id(item.id); - // an error would be reported if this fails. + // An error would be reported if this fails. let _ = traits::OnUnimplementedDirective::of_item(tcx, trait_def_id, item_def_id); } @@ -1512,14 +1514,14 @@ fn check_impl_items_against_trait<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, let impl_items = || impl_item_refs.iter().map(|iiref| tcx.hir().impl_item(iiref.id)); // Check existing impl methods to see if they are both present in trait - // and compatible with trait signature + // and compatible with trait signature. for impl_item in impl_items() { let ty_impl_item = tcx.associated_item(tcx.hir().local_def_id(impl_item.id)); let ty_trait_item = tcx.associated_items(impl_trait_ref.def_id) .find(|ac| Namespace::from(&impl_item.node) == Namespace::from(ac.kind) && tcx.hygienic_eq(ty_impl_item.ident, ac.ident, impl_trait_ref.def_id)) .or_else(|| { - // Not compatible, but needed for the error message + // Not compatible, but needed for the error message. tcx.associated_items(impl_trait_ref.def_id) .find(|ac| tcx.hygienic_eq(ty_impl_item.ident, ac.ident, impl_trait_ref.def_id)) }); @@ -1542,8 +1544,8 @@ fn check_impl_items_against_trait<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, ty_impl_item.ident, impl_trait_ref); err.span_label(impl_item.span, "does not match trait"); - // We can only get the spans from local trait definition - // Same for E0324 and E0325 + // We can only get the spans from local trait definition. + // Same for E0324 and E0325. if let Some(trait_span) = tcx.hir().span_if_local(ty_trait_item.def_id) { err.span_label(trait_span, "item in trait"); } @@ -1597,7 +1599,7 @@ fn check_impl_items_against_trait<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } } - // Check for missing items from trait + // Check for missing items from the trait. let mut missing_items = Vec::new(); let mut invalidated_items = Vec::new(); let associated_type_overridden = overridden_associated_type.is_some(); @@ -1744,7 +1746,7 @@ fn check_packed_inner<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, if tcx.adt_def(def.did).repr.align > 0 { return true; } - // push struct def_id before checking fields + // Push `def_id` of struct before checking fields. stack.push(def_id); for field in &def.non_enum_variant().fields { let f = field.ty(tcx, substs); @@ -1754,7 +1756,7 @@ fn check_packed_inner<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } } } - // only need to pop if not early out + // We only need to pop if we didn't exit early. stack.pop(); } } @@ -1767,12 +1769,12 @@ fn check_transparent<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, sp: Span, def_id: De return; } - // For each field, figure out if it's known to be a ZST and align(1) + // For each field, figure out if it's known to be a ZST and align(1). let field_infos = adt.non_enum_variant().fields.iter().map(|field| { let ty = field.ty(tcx, Substs::identity_for_item(tcx, field.did)); let param_env = tcx.param_env(field.did); let layout = tcx.layout_of(param_env.and(ty)); - // We are currently checking the type this field came from, so it must be local + // We are currently checking the type this field came from, so it must be local. let span = tcx.hir().span_if_local(field.did).unwrap(); let zst = layout.map(|layout| layout.is_zst()).unwrap_or(false); let align1 = layout.map(|layout| layout.align.abi.bytes() == 1).unwrap_or(false); @@ -1804,7 +1806,8 @@ pub fn check_enum<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, id: ast::NodeId) { let def_id = tcx.hir().local_def_id(id); let def = tcx.adt_def(def_id); - def.destructor(tcx); // force the destructor to be evaluated + // Force the destructor to be evaluated. + def.destructor(tcx); if vs.is_empty() { let attributes = tcx.get_attrs(def_id); @@ -1836,7 +1839,7 @@ pub fn check_enum<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, let mut disr_vals: Vec> = Vec::with_capacity(vs.len()); for ((_, discr), v) in def.discriminants(tcx).zip(vs) { - // Check for duplicate discriminant values + // Check for duplicate discriminant values. if let Some(i) = disr_vals.iter().position(|&x| x.val == discr.val) { let variant_did = def.variants[VariantIdx::new(i)].did; let variant_i_node_id = tcx.hir().as_local_node_id(variant_did).unwrap(); @@ -1889,7 +1892,7 @@ impl<'a, 'gcx, 'tcx> AstConv<'gcx, 'tcx> for FnCtxt<'a, 'gcx, 'tcx> { match predicate { ty::Predicate::Trait(ref data) if data.skip_binder().self_ty().is_param(index) => { - // HACK(eddyb) should get the original `Span`. + // HACK(eddyb): should get the original `Span`. let span = tcx.def_span(def_id); Some((predicate, span)) } @@ -1938,7 +1941,8 @@ impl<'a, 'gcx, 'tcx> AstConv<'gcx, 'tcx> for FnCtxt<'a, 'gcx, 'tcx> { fn normalize_ty(&self, span: Span, ty: Ty<'tcx>) -> Ty<'tcx> { if ty.has_escaping_bound_vars() { - ty // FIXME: normalization and escaping regions + // FIXME: normalization and escaping regions + ty } else { self.normalize_associated_types_in(span, &ty) } @@ -2034,13 +2038,13 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } /// Resolves type variables in `ty` if possible. Unlike the infcx - /// version (resolve_type_vars_if_possible), this version will + /// version (`resolve_type_vars_if_possible`), this version will /// also select obligations if it seems useful, in an effort /// to get more type information. fn resolve_type_vars_with_obligations(&self, mut ty: Ty<'tcx>) -> Ty<'tcx> { debug!("resolve_type_vars_with_obligations(ty={:?})", ty); - // No Infer()? Nothing needs doing. + // No `Infer()`? Nothing needs doing. if !ty.has_infer_types() { debug!("resolve_type_vars_with_obligations: ty={:?}", ty); return ty; @@ -2108,7 +2112,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { self.tables.borrow_mut().field_indices_mut().insert(hir_id, index); } - // The NodeId and the ItemLocalId must identify the same item. We just pass + // The `NodeId` and the `ItemLocalId` must identify the same item. We just pass // both of them for consistency checking. pub fn write_method_call(&self, hir_id: hir::HirId, @@ -2228,7 +2232,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { debug!(" - composing on top of {:?}", entry.get()); match (&entry.get()[..], &adj[..]) { // Applying any adjustment on top of a NeverToAny - // is a valid NeverToAny adjustment, because it can't + // is a valid `NeverToAny` adjustment, because it can't // be reached. (&[Adjustment { kind: Adjust::NeverToAny, .. }], _) => return, (&[ @@ -2241,7 +2245,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // A reborrow has no effect before a dereference. } // FIXME: currently we never try to compose autoderefs - // and ReifyFnPointer/UnsafeFnPointer, but we could. + // and `ReifyFnPointer`/`UnsafeFnPointer`, but we could. _ => bug!("while adjusting {:?}, can't compose {:?} and {:?}", expr, entry.get(), adj) @@ -2413,7 +2417,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { span: Span, code: traits::ObligationCauseCode<'tcx>) { - // WF obligations never themselves fail, so no real need to give a detailed cause: + // WF obligations never themselves fail, so no real need to give a detailed cause. let cause = traits::ObligationCause::new(span, self.body_id, code); self.register_predicate(traits::Obligation::new(cause, self.param_env, @@ -2487,11 +2491,11 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } // Tries to apply a fallback to `ty` if it is an unsolved variable. - // Non-numerics get replaced with ! or () (depending on whether - // feature(never_type) is enabled, unconstrained ints with i32, + // Non-numerics get replaced with `!` or `()` (depending on whether + // feature(never_type) is enabled, unconstrained ints with `i32`, // unconstrained floats with f64. // Fallback becomes very dubious if we have encountered type-checking errors. - // In that case, fallback to Error. + // In that case, fallback to `Error`. // The return value indicates whether fallback has occurred. fn fallback_if_possible(&self, ty: Ty<'tcx>) -> bool { use rustc::ty::error::UnconstrainedNumeric::Neither; @@ -2532,10 +2536,10 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { method: MethodCallee<'tcx>) -> ty::TypeAndMut<'tcx> { - // extract method return type, which will be &T; + // Extract method return type, which will be `&T`. let ret_ty = method.sig.output(); - // method returns &T, but the type as visible to user is T, so deref + // Method returns `&T`, but type as visible to user is `T`, so deref. ret_ty.builtin_deref(true).unwrap() } @@ -2547,7 +2551,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { needs: Needs) -> Option<(/*index type*/ Ty<'tcx>, /*element type*/ Ty<'tcx>)> { - // FIXME(#18741) -- this is almost but not quite the same as the + // FIXME(#18741): this is almost but not quite the same as the // autoderef that normal method probing does. They could likely be // consolidated. @@ -2594,7 +2598,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // If some lookup succeeds, write callee into table and extract index/element // type from the method signature. - // If some lookup succeeded, install method in table + // If some lookup succeeded, install method in table. let input_ty = self.next_ty_var(TypeVariableOrigin::AutoDeref(base_expr.span)); let method = self.try_overloaded_place_op( expr.span, self_ty, &[input_ty], needs, PlaceOp::Index); @@ -2610,7 +2614,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { hir::MutMutable => AutoBorrowMutability::Mutable { // Indexing can be desugared to a method call, // so maybe we could use two-phase here. - // See the documentation of AllowTwoPhase for why that's + // See the documentation of `AllowTwoPhase` for why that's // not the case today. allow_two_phase_borrow: AllowTwoPhase::No, } @@ -2670,7 +2674,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { needs, op); - // Try Mut first, if needed. + // Try `Mut` first, if needed. let (mut_tr, mut_op) = self.resolve_place_op(op, true); let method = match (needs, mut_tr) { (Needs::MutPlace, Some(trait_did)) => { @@ -2719,7 +2723,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } let method = method.unwrap(); - // HACK(eddyb) ignore self in the definition (see above). + // HACK(eddyb): ignore self in the definition (see above). let expected_arg_tys = self.expected_inputs_for_expected_output( sp, expected, @@ -2812,7 +2816,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { let tcx = self.tcx; // Grab the argument types, supplying fresh type variables - // if the wrong number of arguments were supplied + // if the wrong number of arguments were supplied. let supplied_arg_count = if tuple_arguments == DontTupleArguments { args.len() } else { @@ -2897,7 +2901,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { self.err_args(supplied_arg_count) } } else { - // is the missing argument of type `()`? + // Is the missing argument of type `()`? let sugg_unit = if expected_arg_tys.len() == 1 && supplied_arg_count == 0 { self.resolve_type_vars_if_possible(&expected_arg_tys[0]).is_unit() } else if fn_inputs.len() == 1 && supplied_arg_count == 0 { @@ -2910,7 +2914,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { expected_arg_tys = &[]; self.err_args(supplied_arg_count) }; - // If there is no expectation, expect formal_tys. + // If there is no expectation, expect `formal_tys`. let expected_arg_tys = if !expected_arg_tys.is_empty() { expected_arg_tys } else { @@ -2985,8 +2989,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } } - // We also need to make sure we at least write the ty of the other - // arguments which we skipped above. + // We also need to make sure we at least write the type of the other + // arguments that we skipped above. if variadic { fn variadic_error<'tcx>(s: &Session, span: Span, t: Ty<'tcx>, cast_ty: &str) { use structured_errors::{VariadicError, StructuredDiagnostic}; @@ -2996,8 +3000,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { for arg in args.iter().skip(expected_arg_count) { let arg_ty = self.check_expr(&arg); - // There are a few types which get autopromoted when passed via varargs - // in C but we just error out instead and require explicit casts. + // There are a few types that get auto-promoted when passed via varargs + // in C, but we just error out instead and require explicit casts. let arg_ty = self.structurally_resolved_type(arg.span, arg_ty); match arg_ty.sty { ty::Float(ast::FloatTy::F32) => { @@ -3131,7 +3135,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { expr: &'gcx hir::Expr, expected: Ty<'tcx>) -> Ty<'tcx> { let ty = self.check_expr_with_hint(expr, expected); - // checks don't need two phase + // Checks don't need two phase. self.demand_coerce(expr, ty, expected, AllowTwoPhase::No) } @@ -3198,7 +3202,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { match ures { Ok(ok) => { // Process any obligations locally as much as - // we can. We don't care if some things turn + // we can. We don't care if some things turn // out unconstrained or ambiguous, as we're // just trying to get hints here. self.save_and_restore_in_snapshot_flag(|_| { @@ -3234,7 +3238,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { needs: Needs) -> Ty<'tcx> { let rcvr = &args[0]; let rcvr_t = self.check_expr_with_needs(&rcvr, needs); - // no need to check for bot/err -- callee does that + // No need to check for bot/err -- callee does that. let rcvr_t = self.structurally_resolved_type(args[0].span, rcvr_t); let method = match self.lookup_method(rcvr_t, @@ -3338,7 +3342,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } } - // Check field access expressions + // Check field access expressions. fn check_field(&self, expr: &'gcx hir::Expr, needs: Needs, @@ -3422,12 +3426,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { if let Some(suggested_field_name) = Self::suggest_field_name(def.non_enum_variant(), &field.as_str(), vec![]) { - err.span_suggestion_with_applicability( - field.span, - "a field with a similar name exists", - suggested_field_name.to_string(), - Applicability::MaybeIncorrect, - ); + err.span_label(field.span, + format!("did you mean `{}`?", suggested_field_name)); } else { err.span_label(field.span, "unknown field"); let struct_variant_def = def.non_enum_variant(); @@ -3483,13 +3483,13 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } } - // Return an hint about the closest match in field names + // Return an hint about the closest match in field names. fn suggest_field_name(variant: &'tcx ty::VariantDef, field: &str, skip: Vec) -> Option { let names = variant.fields.iter().filter_map(|field| { - // ignore already set fields and private fields from non-local crates + // Ignore already-set fields and private fields from non-local crates. if skip.iter().any(|x| *x == field.ident.as_str()) || (variant.did.krate != LOCAL_CRATE && field.vis != Visibility::Public) { None @@ -3511,7 +3511,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } fn name_series_display(&self, names: Vec) -> String { - // dynamic limit, to never omit just one field + // Use dynamic limit, in order to never omit just one field. let limit = if names.len() == 6 { 6 } else { 5 }; let mut display = names.iter().take(limit) .map(|n| format!("`{}`", n)).collect::>().join(", "); @@ -3549,17 +3549,13 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } }, ty); - // prevent all specified fields from being suggested + // Prevent all specified fields from being suggested. let skip_fields = skip_fields.iter().map(|ref x| x.ident.as_str()); if let Some(field_name) = Self::suggest_field_name(variant, &field.ident.as_str(), skip_fields.collect()) { - err.span_suggestion_with_applicability( - field.ident.span, - "a field with a similar name exists", - field_name.to_string(), - Applicability::MaybeIncorrect, - ); + err.span_label(field.ident.span, + format!("field does not exist - did you mean `{}`?", field_name)); } else { match ty.sty { ty::Adt(adt, ..) => { @@ -3596,7 +3592,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { let adt_ty_hint = self.expected_inputs_for_expected_output(span, expected, adt_ty, &[adt_ty]) .get(0).cloned().unwrap_or(adt_ty); - // re-link the regions that EIfEO can erase. + // Re-link the regions that EIfEO can erase. self.demand_eqtype(span, adt_ty_hint, adt_ty); let (substs, adt_kind, kind_name) = match &adt_ty.sty { @@ -3768,7 +3764,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { fields: &'gcx [hir::Field], base_expr: &'gcx Option>) -> Ty<'tcx> { - // Find the relevant variant + // Find the relevant variant. let (variant, adt_ty) = if let Some(variant_ty) = self.check_struct_path(qpath, expr.id) { variant_ty @@ -3793,8 +3789,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { let error_happened = self.check_expr_struct_fields(adt_ty, expected, expr.id, path_span, variant, fields, base_expr.is_none()); if let &Some(ref base_expr) = base_expr { - // If check_expr_struct_fields hit an error, do not attempt to populate - // the fields with the base_expr. This could cause us to hit errors later + // If `check_expr_struct_fields` hit an error, do not attempt to populate + // the fields with the `base_expr`. This could cause us to hit errors later // when certain fields are assumed to exist that in fact do not. if !error_happened { self.check_expr_has_type_or_error(base_expr, adt_ty); @@ -3820,14 +3816,13 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { adt_ty } - /// Invariant: /// If an expression has any sub-expressions that result in a type error, /// inspecting that expression's type with `ty.references_error()` will return /// true. Likewise, if an expression is known to diverge, inspecting its - /// type with `ty::type_is_bot` will return true (n.b.: since Rust is - /// strict, _|_ can appear in the type of an expression that does not, - /// itself, diverge: for example, fn() -> _|_.) + /// type with `ty::type_is_bot` will return true (N.B., since Rust is + /// strict, `_|_` can appear in the type of an expression that does not + /// itself diverge, e.g., `fn() -> _|_`.) /// Note that inspecting a type's structure *directly* may expose the fact /// that there are actually multiple representations for `Error`, so avoid /// that when err needs to be handled differently. @@ -3841,7 +3836,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // Warn for expressions after diverging siblings. self.warn_if_unreachable(expr.id, expr.span, "expression"); - // Hide the outer diverging and has_errors flags. + // Hide the outer diverging and `has_errors` flags. let old_diverges = self.diverges.get(); let old_has_errors = self.has_errors.get(); self.diverges.set(Diverges::Maybe); @@ -3858,7 +3853,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { _ => self.warn_if_unreachable(expr.id, expr.span, "expression") } - // Any expression that produces a value of type `!` must have diverged + // Any expression that produces a value of type `!` must have diverged. if ty.is_never() { self.diverges.set(self.diverges.get() | Diverges::Always); } @@ -3868,7 +3863,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // we don't warn for the diverging expression itself. self.write_ty(expr.hir_id, ty); - // Combine the diverging and has_error flags. + // Combine the diverging and `has_error` flags. self.diverges.set(self.diverges.get() | old_diverges); self.has_errors.set(self.has_errors.get() | old_has_errors); @@ -4007,14 +4002,14 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { tcx.types.err } else { // Note: at this point, we cannot say what the best lifetime - // is to use for resulting pointer. We want to use the + // is to use for resulting pointer. We want to use the // shortest lifetime possible so as to avoid spurious borrowck - // errors. Moreover, the longest lifetime will depend on the + // errors. Moreover, the longest lifetime will depend on the // precise details of the value whose address is being taken // (and how long it is valid), which we don't know yet until type // inference is complete. // - // Therefore, here we simply generate a region variable. The + // Therefore, here we simply generate a region variable. The // region inferencer will then select the ultimate value. // Finally, borrowck is charged with guaranteeing that the // value whose address was taken can actually be made to live @@ -4042,11 +4037,9 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { if !tcx.features().unsized_locals { // We want to remove some Sized bounds from std functions, // but don't want to expose the removal to stable Rust. - // i.e., we don't want to allow + // I.e., we don't want to allow // - // ```rust - // drop as fn(str); - // ``` + // drop as fn(str); // // to work in stable even if the Sized bound on `drop` is relaxed. for i in 0..fn_sig.inputs().skip_binder().len() { @@ -4130,7 +4123,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } } else { // If `ctxt.coerce` is `None`, we can just ignore - // the type of the expresison. This is because + // the type of the expresison. This is because // either this was a break *without* a value, in // which case it is always a legal type (`()`), or // else an error would have been flagged by the @@ -4141,7 +4134,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { ctxt.may_break = true; - // the type of a `break` is always `!`, since it diverges + // The type of a `break` is always `!`, since it diverges. tcx.types.never } else { // Otherwise, we failed to find the enclosing loop; @@ -4166,7 +4159,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } } } - // There was an error; make type-check fail. + // There was an error; make type-checking fail. tcx.types.err } @@ -4175,7 +4168,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { if destination.target_id.is_ok() { tcx.types.never } else { - // There was an error; make type-check fail. + // There was an error; make type-checking fail. tcx.types.err } } @@ -4247,9 +4240,10 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } ExprKind::While(ref cond, ref body, _) => { let ctxt = BreakableCtxt { - // cannot use break with a value from a while loop + // Cannot use break with a value from a while loop. coerce: None, - may_break: false, // Will get updated if/when we find a `break`. + // Will get updated if/when we find a `break`. + may_break: false, }; let (ctxt, ()) = self.with_breakable_ctxt(expr.id, ctxt, || { @@ -4271,7 +4265,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } ExprKind::Loop(ref body, _, source) => { let coerce = match source { - // you can only use break with a value from a normal `loop { }` + // Can only use `break` with a value from a normal `loop { }`. hir::LoopSource::Loop => { let coerce_to = expected.coercion_target_type(self, body.span); Some(CoerceMany::new(coerce_to)) @@ -4285,7 +4279,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { let ctxt = BreakableCtxt { coerce, - may_break: false, // Will get updated if/when we find a `break`. + // Will get updated if/when we find a `break`. + may_break: false, }; let (ctxt, ()) = self.with_breakable_ctxt(expr.id, ctxt, || { @@ -4419,8 +4414,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { if let Ok(count) = count { let zero_or_one = count.assert_usize(tcx).map_or(false, |count| count <= 1); if !zero_or_one { - // For [foo, ..n] where n > 1, `foo` must have - // Copy type: + // For [foo, ..n] where n > 1, `foo` must have `Copy` type. let lang_item = self.tcx.require_lang_item(lang_items::CopyTraitLangItem); self.require_type_meets(t, expr.span, traits::RepeatVec, lang_item); } @@ -4482,7 +4476,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { let base_t = self.structurally_resolved_type(base.span, base_t); match self.lookup_indexing(expr, base, base_t, idx_t, needs) { Some((index_ty, element_ty)) => { - // two-phase not needed because index_ty is never mutable + // Two-phase not needed because `index_ty` is never mutable. self.demand_coerce(idx, idx_t, index_ty, AllowTwoPhase::No); element_ty } @@ -4772,7 +4766,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { self.check_stmt(s); } - // check the tail expression **without** holding the + // Check the tail expression **without** holding the // `enclosing_breakables` lock below. let tail_expr_ty = tail_expr.map(|t| self.check_expr_with_expectation(t, expected)); @@ -4812,7 +4806,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { if ctxt.may_break { // If we can break from the block, then the block's exit is always reachable - // (... as long as the entry is reachable) - regardless of the tail of the block. + // (as long as the entry is reachable), regardless of the tail of the block. self.diverges.set(prev_diverges); } @@ -4831,7 +4825,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { /// Given a `NodeId`, return the `FnDecl` of the method it is enclosed by and whether a /// suggestion can be made, `None` otherwise. pub fn get_fn_decl(&self, blk_id: ast::NodeId) -> Option<(hir::FnDecl, bool)> { - // Get enclosing Fn, if it is a function or a trait method, unless there's a `loop` or + // Get enclosing fn, if it is a function or a trait method, unless there's a `loop` or // `while` before reaching it, as block tail returns are not available in them. if let Some(fn_id) = self.tcx.hir().get_return_block(blk_id) { let parent = self.tcx.hir().get(fn_id); @@ -4871,9 +4865,9 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { /// On implicit return expressions with mismatched types, provide the following suggestions: /// - /// - Point out the method's return type as the reason for the expected type - /// - Possible missing semicolon - /// - Possible missing return type if the return type is the default, and not `fn main()` + /// - Point out the method's return type as the reason for the expected type. + /// - Possible missing semicolon. + /// - Possible missing return type if the return type is the default, and not `fn main()`. pub fn suggest_mismatched_types_on_tail(&self, err: &mut DiagnosticBuilder<'tcx>, expression: &'gcx hir::Expr, @@ -4934,7 +4928,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } } - /// A common error is to forget to add a semicolon at the end of a block: + /// A common error is to forget to add a semicolon at the end of a block, e.g., /// /// ``` /// fn foo() { @@ -5177,7 +5171,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { ); if suppress_errors { infer_args_for_err.insert(index); - self.set_tainted_by_errors(); // See issue #53251. + // See issue #53251. + self.set_tainted_by_errors(); } } @@ -5203,15 +5198,13 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { if let Some(adt_def) = adt_def { match adt_def.adt_kind() { AdtKind::Enum => { - err.help("did you mean to use one of the enum's variants?"); + err.note("did you mean to use one of the enum's variants?"); }, AdtKind::Struct | AdtKind::Union => { - err.span_suggestion_with_applicability( + err.span_label( span, - "use curly brackets", - String::from("Self { /* fields */ }"), - Applicability::HasPlaceholders, + format!("did you mean `Self {{ /* fields */ }}`?"), ); } } @@ -5224,7 +5217,6 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } _ => { let def_id = def.def_id(); - // The things we are substituting into the type should not contain // escaping late-bound regions, and nor should the base type scheme. let ty = tcx.type_of(def_id); @@ -5348,7 +5340,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { node_id: ast::NodeId, span: Span) { // We're only interested in functions tagged with - // #[rustc_args_required_const], so ignore anything that's not. + // `#[rustc_args_required_const]`, so ignore anything that's not. if !self.tcx.has_attr(def_id, "rustc_args_required_const") { return } @@ -5465,12 +5457,12 @@ fn fatally_break_rust(sess: &Session) { let handler = sess.diagnostic(); handler.span_bug_no_panic( MultiSpan::new(), - "It looks like you're trying to break rust; would you like some ICE?", + "It looks like you're trying to break Rust; would you like some ICE?", ); handler.note_without_error("the compiler expectedly panicked. this is a feature."); handler.note_without_error( "we would appreciate a joke overview: \ - https://github.com/rust-lang/rust/issues/43162#issuecomment-320764675" + " ); handler.note_without_error(&format!("rustc {} running on {}", option_env!("CFG_VERSION").unwrap_or("unknown_version"), diff --git a/src/librustc_typeck/check/op.rs b/src/librustc_typeck/check/op.rs index 8cf97970a1556..ce3a94d1e6e10 100644 --- a/src/librustc_typeck/check/op.rs +++ b/src/librustc_typeck/check/op.rs @@ -672,7 +672,7 @@ enum Op { Unary(hir::UnOp, Span), } -/// Returns true if this is a built-in arithmetic operation (e.g., u32 +/// Returns whether this is a built-in arithmetic operation (e.g., u32 /// + u32, i16x4 == i16x4) and false if these types would have to be /// overloaded to be legal. There are two reasons that we distinguish /// builtin operations from overloaded ones (vs trying to drive @@ -681,7 +681,7 @@ enum Op { /// /// 1. Builtin operations can trivially be evaluated in constants. /// 2. For comparison operators applied to SIMD types the result is -/// not of type `bool`. For example, `i16x4==i16x4` yields a +/// not of type `bool`. For example, `i16x4 == i16x4` yields a /// type like `i16x4`. This means that the overloaded trait /// `PartialEq` is not applicable. /// diff --git a/src/librustc_typeck/check/regionck.rs b/src/librustc_typeck/check/regionck.rs index b90c18eb41cb5..4329fcc4e2d61 100644 --- a/src/librustc_typeck/check/regionck.rs +++ b/src/librustc_typeck/check/regionck.rs @@ -1,6 +1,6 @@ //! The region check is a final pass that runs over the AST after we have //! inferred the type constraints but before we have actually finalized -//! the types. Its purpose is to embed a variety of region constraints. +//! the types. Its purpose is to embed a variety of region constraints. //! Inserting these constraints as a separate pass is good because (1) it //! localizes the code that has to do with region inference and (2) often //! we cannot know what constraints are needed until the basic types have @@ -34,17 +34,17 @@ //! #### Reborrows //! //! Generally speaking, `regionck` does NOT try to ensure that the data -//! `data` will outlive the pointer `x`. That is the job of borrowck. The +//! `data` will outlive the pointer `x`. That is the job of borrowck. The //! one exception is when "re-borrowing" the contents of another borrowed //! pointer. For example, imagine you have a borrowed pointer `b` with -//! lifetime L1 and you have an expression `&*b`. The result of this -//! expression will be another borrowed pointer with lifetime L2 (which is +//! lifetime `L1` and you have an expression `&*b`. The result of this +//! expression will be another borrowed pointer with lifetime `L2` (which is //! an inference variable). The borrow checker is going to enforce the -//! constraint that L2 < L1, because otherwise you are re-borrowing data -//! for a lifetime larger than the original loan. However, without the +//! constraint that `L2 < L1`, because otherwise you are re-borrowing data +//! for a lifetime larger than the original loan. However, without the //! routines in this module, the region inferencer would not know of this -//! dependency and thus it might infer the lifetime of L2 to be greater -//! than L1 (issue #3148). +//! dependency and thus it might infer the lifetime of `L2` to be greater +//! than `L1` (issue #3148). //! //! There are a number of troublesome scenarios in the tests //! `region-dependent-*.rs`, but here is one example: @@ -62,13 +62,13 @@ //! //! The key point here is that when you are borrowing a value that //! is "guaranteed" by a borrowed pointer, you must link the -//! lifetime of that borrowed pointer (L1, here) to the lifetime of -//! the borrow itself (L2). What do I mean by "guaranteed" by a +//! lifetime of that borrowed pointer (`L1`, here) to the lifetime of +//! the borrow itself (`L2`). What do I mean by "guaranteed" by a //! borrowed pointer? I mean any data that is reached by first //! dereferencing a borrowed pointer and then either traversing -//! interior offsets or boxes. We say that the guarantor +//! interior offsets or boxes. We say that the guarantor //! of such data is the region of the borrowed pointer that was -//! traversed. This is essentially the same as the ownership +//! traversed. This is essentially the same as the ownership //! relation, except that a borrowed pointer never owns its //! contents. @@ -121,12 +121,12 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { self.param_env, ); - // There are no add'l implied bounds when checking a + // There are no additional implied bounds when checking a // standalone expr (e.g., the `E` in a type like `[u32; E]`). rcx.outlives_environment.save_implied_bounds(id); if self.err_count_since_creation() == 0 { - // regionck assumes typeck succeeded + // regionck assumes typeck succeeded. rcx.visit_body(body); rcx.visit_region_obligations(id); } @@ -176,7 +176,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { ); if self.err_count_since_creation() == 0 { - // regionck assumes typeck succeeded + // regionck assumes typeck succeeded. rcx.visit_fn_body(fn_id, body, self.tcx.hir().span(fn_id)); } @@ -248,11 +248,11 @@ impl<'a, 'gcx, 'tcx> RegionCtxt<'a, 'gcx, 'tcx> { mem::replace(&mut self.repeating_scope, scope) } - /// Try to resolve the type for the given node, returning t_err if an error results. Note that + /// Try to resolve the type for the given node, returning `t_err` if an error results. Note that /// we never care about the details of the error, the same error will be detected and reported /// in the writeback phase. /// - /// Note one important point: we do not attempt to resolve *region variables* here. This is + /// Note one important point: we do not attempt to resolve *region variables* here. This is /// because regionck is essentially adding constraints to those region variables and so may yet /// influence how they are resolved. /// @@ -266,9 +266,9 @@ impl<'a, 'gcx, 'tcx> RegionCtxt<'a, 'gcx, 'tcx> { /// } /// ``` /// - /// Here, the region of `b` will be ``. `` is constrained to be some subregion of the - /// block B and some superregion of the call. If we forced it now, we'd choose the smaller - /// region (the call). But that would make the *b illegal. Since we don't resolve, the type + /// Here, the region of `b` will be ``. `` is constrained to be some subregion of the + /// block B and some superregion of the call. If we forced it now, we'd choose the smaller + /// region (the call). But that would make the *b illegal. Since we don't resolve, the type /// of b will be `&.i32` and then `*b` will require that `` be bigger than the let and /// the `*b` expression, so we will effectively resolve `` to be the block B. pub fn resolve_type(&self, unresolved_ty: Ty<'tcx>) -> Ty<'tcx> { @@ -305,7 +305,7 @@ impl<'a, 'gcx, 'tcx> RegionCtxt<'a, 'gcx, 'tcx> { body: &'gcx hir::Body, span: Span, ) { - // When we enter a function, we can derive + // When we enter a function, we can derive. debug!("visit_fn_body(id={})", id); let body_id = body.id(); @@ -322,7 +322,7 @@ impl<'a, 'gcx, 'tcx> RegionCtxt<'a, 'gcx, 'tcx> { match self.tables.borrow().liberated_fn_sigs().get(fn_hir_id) { Some(f) => f.clone(), None => { - bug!("No fn-sig entry for id={}", id); + bug!("no fn-sig entry for id={}", id); } } }; @@ -331,7 +331,7 @@ impl<'a, 'gcx, 'tcx> RegionCtxt<'a, 'gcx, 'tcx> { // For the return type, if diverging, substitute `bool` just // because it will have no effect. // - // FIXME(#27579) return types should not be implied bounds + // FIXME(#27579): return types should not be implied bounds. let fn_sig_tys: Vec<_> = fn_sig .inputs() .iter() @@ -359,7 +359,7 @@ impl<'a, 'gcx, 'tcx> RegionCtxt<'a, 'gcx, 'tcx> { let call_site_scope = self.call_site_scope.unwrap(); debug!( - "visit_fn_body body.id {:?} call_site_scope: {:?}", + "visit_fn_body: body.id={:?} call_site_scope={:?}", body.id(), call_site_scope ); @@ -439,7 +439,7 @@ impl<'a, 'gcx, 'tcx> RegionCtxt<'a, 'gcx, 'tcx> { } impl<'a, 'gcx, 'tcx> Visitor<'gcx> for RegionCtxt<'a, 'gcx, 'tcx> { - // (..) FIXME(#3238) should use visit_pat, not visit_arm/visit_local, + // (..) FIXME(#3238): should use `visit_pat`, not `visit_arm`/`visit_local`, // However, right now we run into an issue whereby some free // regions are not properly related if they appear within the // types of arguments that must be inferred. This could be @@ -468,7 +468,7 @@ impl<'a, 'gcx, 'tcx> Visitor<'gcx> for RegionCtxt<'a, 'gcx, 'tcx> { ); // Save state of current function before invoking - // `visit_fn_body`. We will restore afterwards. + // `visit_fn_body`. We will restore afterwards. let old_body_id = self.body_id; let old_call_site_scope = self.call_site_scope; let env_snapshot = self.outlives_environment.push_snapshot_pre_closure(); @@ -477,16 +477,15 @@ impl<'a, 'gcx, 'tcx> Visitor<'gcx> for RegionCtxt<'a, 'gcx, 'tcx> { self.visit_fn_body(id, body, span); // Restore state from previous function. - self.outlives_environment - .pop_snapshot_post_closure(env_snapshot); + self.outlives_environment.pop_snapshot_post_closure(env_snapshot); self.call_site_scope = old_call_site_scope; self.body_id = old_body_id; } - //visit_pat: visit_pat, // (..) see above + // visit_pat: visit_pat, // (..) see above fn visit_arm(&mut self, arm: &'gcx hir::Arm) { - // see above + // See above. for p in &arm.pats { self.constrain_bindings_in_pat(p); } @@ -494,7 +493,7 @@ impl<'a, 'gcx, 'tcx> Visitor<'gcx> for RegionCtxt<'a, 'gcx, 'tcx> { } fn visit_local(&mut self, l: &'gcx hir::Local) { - // see above + // See above. self.constrain_bindings_in_pat(&l.pat); self.link_local(l); intravisit::walk_local(self, l); @@ -550,7 +549,7 @@ impl<'a, 'gcx, 'tcx> Visitor<'gcx> for RegionCtxt<'a, 'gcx, 'tcx> { self.check_safety_of_rvalue_destructor_if_necessary(&head_cmt, expr.span); } Err(..) => { - self.tcx.sess.delay_span_bug(expr.span, "cat_expr Errd"); + self.tcx.sess.delay_span_bug(expr.span, "cat_expr errored"); } } @@ -646,7 +645,7 @@ impl<'a, 'gcx, 'tcx> Visitor<'gcx> for RegionCtxt<'a, 'gcx, 'tcx> { hir::ExprKind::Cast(ref source, _) => { // Determine if we are casting `source` to a trait - // instance. If so, we have to be sure that the type of + // instance. If so, we have to be sure that the type of // the source obeys the trait's region bound. self.constrain_cast(expr, &source); intravisit::walk_expr(self, expr); @@ -997,7 +996,7 @@ impl<'a, 'gcx, 'tcx> RegionCtxt<'a, 'gcx, 'tcx> { hir_id: hir::HirId, minimum_lifetime: ty::Region<'tcx>, ) { - // Try to resolve the type. If we encounter an error, then typeck + // Try to resolve the type. If we encounter an error, then typeck // is going to fail anyway, so just stop here and let typeck // report errors later on in the writeback phase. let ty0 = self.resolve_node_type(hir_id); diff --git a/src/librustc_typeck/check/upvar.rs b/src/librustc_typeck/check/upvar.rs index 86165d50b27e4..136970f0af80d 100644 --- a/src/librustc_typeck/check/upvar.rs +++ b/src/librustc_typeck/check/upvar.rs @@ -270,7 +270,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { struct InferBorrowKind<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> { fcx: &'a FnCtxt<'a, 'gcx, 'tcx>, - // The def-id of the closure whose kind and upvar accesses are being inferred. + // The def-ID of the closure whose kind and upvar accesses are being inferred. closure_def_id: DefId, // The kind that we have inferred that the current closure diff --git a/src/librustc_typeck/check/writeback.rs b/src/librustc_typeck/check/writeback.rs index 8bd9b097d2df1..f4e72ce88b37a 100644 --- a/src/librustc_typeck/check/writeback.rs +++ b/src/librustc_typeck/check/writeback.rs @@ -208,7 +208,7 @@ impl<'cx, 'gcx, 'tcx> WritebackCx<'cx, 'gcx, 'tcx> { // This is the master code which walks the AST. It delegates most of // the heavy lifting to the generic visit and resolve functions // below. In general, a function is made into a `visitor` if it must -// traffic in node-ids or update tables in the type context etc. +// traffic in node-IDs or update tables in the type context etc. impl<'cx, 'gcx, 'tcx> Visitor<'gcx> for WritebackCx<'cx, 'gcx, 'tcx> { fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'gcx> { @@ -771,7 +771,7 @@ impl<'cx, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for Resolver<'cx, 'gcx, 'tcx> { } } - // FIXME This should be carefully checked + // FIXME: This should be carefully checked // We could use `self.report_error` but it doesn't accept a ty::Region, right now. fn fold_region(&mut self, r: ty::Region<'tcx>) -> ty::Region<'tcx> { self.infcx.fully_resolve(&r).unwrap_or(self.tcx.types.re_static) diff --git a/src/librustc_typeck/check_unused.rs b/src/librustc_typeck/check_unused.rs index bf767726ef715..e9ae8d930f01e 100644 --- a/src/librustc_typeck/check_unused.rs +++ b/src/librustc_typeck/check_unused.rs @@ -74,7 +74,7 @@ impl<'a, 'tcx> CheckVisitor<'a, 'tcx> { fn unused_crates_lint<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>) { let lint = lint::builtin::UNUSED_EXTERN_CRATES; - // Collect first the crates that are completely unused. These we + // Collect first the crates that are completely unused. These we // can always suggest removing (no matter which edition we are // in). let unused_extern_crates: FxHashMap = @@ -194,7 +194,7 @@ struct CollectExternCrateVisitor<'a, 'tcx: 'a> { } struct ExternCrateToLint { - /// def-id of the extern crate + /// def-ID of the extern crate def_id: DefId, /// span from the item diff --git a/src/librustc_typeck/coherence/builtin.rs b/src/librustc_typeck/coherence/builtin.rs index bd2373d1659c9..263874019899a 100644 --- a/src/librustc_typeck/coherence/builtin.rs +++ b/src/librustc_typeck/coherence/builtin.rs @@ -47,7 +47,7 @@ impl<'a, 'tcx> Checker<'a, 'tcx> { fn visit_implementation_of_drop<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, impl_did: DefId) { if let ty::Adt(..) = tcx.type_of(impl_did).sty { - /* do nothing */ + // Do nothing. } else { // Destructors only work on nominal types. if let Some(impl_node_id) = tcx.hir().as_local_node_id(impl_did) { @@ -331,9 +331,9 @@ pub fn coerce_unsized_info<'a, 'gcx>(gcx: TyCtxt<'a, 'gcx, 'gcx>, gcx.sess.fatal(&format!("`CoerceUnsized` implementation {}", err)); }); - // this provider should only get invoked for local def-ids + // This provider should only get invoked for local def-IDs. let impl_node_id = gcx.hir().as_local_node_id(impl_did).unwrap_or_else(|| { - bug!("coerce_unsized_info: invoked for non-local def-id {:?}", impl_did) + bug!("coerce_unsized_info: invoked for non-local def-ID {:?}", impl_did) }); let source = gcx.type_of(impl_did); @@ -419,7 +419,7 @@ pub fn coerce_unsized_info<'a, 'gcx>(gcx: TyCtxt<'a, 'gcx, 'gcx>, // when this coercion occurs, we would be changing the // field `ptr` from a thin pointer of type `*mut [i32; // 3]` to a fat pointer of type `*mut [i32]` (with - // extra data `3`). **The purpose of this check is to + // extra data `3`). **The purpose of this check is to // make sure that we know how to do this conversion.** // // To check if this impl is legal, we would walk down @@ -467,7 +467,7 @@ pub fn coerce_unsized_info<'a, 'gcx>(gcx: TyCtxt<'a, 'gcx, 'gcx>, } // Collect up all fields that were significantly changed - // i.e., those that contain T in coerce_unsized T -> U + // i.e., those that contain `T` in `coerce_unsized T -> U`. Some((i, a, b)) }) .collect::>(); diff --git a/src/librustc_typeck/coherence/inherent_impls.rs b/src/librustc_typeck/coherence/inherent_impls.rs index b9324a17fccd2..a88a84b1b08c1 100644 --- a/src/librustc_typeck/coherence/inherent_impls.rs +++ b/src/librustc_typeck/coherence/inherent_impls.rs @@ -38,9 +38,9 @@ pub fn inherent_impls<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, -> Lrc> { assert!(ty_def_id.is_local()); - // NB. Until we adopt the red-green dep-tracking algorithm (see + // N.B., until we adopt the red-green dep-tracking algorithm (see // [the plan] for details on that), we do some hackery here to get - // the dependencies correct. Basically, we use a `with_ignore` to + // the dependencies correct. Basically, we use a `with_ignore` to // read the result we want. If we didn't have the `with_ignore`, // we would wind up with a dependency on the entire crate, which // we don't want. Then we go and add dependencies on all the impls @@ -286,7 +286,7 @@ impl<'a, 'tcx> InherentCollect<'a, 'tcx> { fn check_def_id(&mut self, item: &hir::Item, def_id: DefId) { if def_id.is_local() { // Add the implementation to the mapping from implementation to base - // type def ID, if there is a base type for this implementation and + // type def-ID, if there is a base type for this implementation and // the implementation does not have any associated traits. let impl_def_id = self.tcx.hir().local_def_id(item.id); let mut rc_vec = self.impls_map.inherent_impls diff --git a/src/librustc_typeck/coherence/mod.rs b/src/librustc_typeck/coherence/mod.rs index 060fc4977a709..1288f9282d0dc 100644 --- a/src/librustc_typeck/coherence/mod.rs +++ b/src/librustc_typeck/coherence/mod.rs @@ -1,6 +1,6 @@ -// Coherence phase +// The coherence phase of type-checking. // -// The job of the coherence phase of typechecking is to ensure that +// The job of the coherence phase of type-checking is to ensure that // each trait has at most one implementation for each type. This is // done by the orphan and overlap modules. Then we build up various // mappings. That mapping code resides here. @@ -172,7 +172,7 @@ fn check_impl_overlap<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, node_id: ast::NodeI // if Trait1 is a supertrait of Trait2 or Trait2 is not object safe. if !tcx.is_object_safe(data.principal().def_id()) { - // This is an error, but it will be reported by wfcheck. Ignore it here. + // This is an error, but it will be reported by wfcheck. Ignore it here. // This is tested by `coherence-impl-trait-for-trait-object-safe.rs`. } else { let mut supertrait_def_ids = diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index 9fc2f11b19738..7787b0a9e6d28 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -20,13 +20,16 @@ use lint; use middle::lang_items::SizedTraitLangItem; use middle::resolve_lifetime as rl; use middle::weak_lang_items; +use rustc::hir::{GenericParamKind, Node}; +use rustc::hir::def::{CtorKind, Def}; +use rustc::hir::def_id::{DefId, LOCAL_CRATE}; +use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor}; +use rustc::hir::{self, CodegenFnAttrFlags, CodegenFnAttrs, Unsafety}; use rustc::mir::mono::Linkage; +use rustc::ty::{self, AdtKind, ReprOptions, ToPolyTraitRef, ToPredicate, Ty, TyCtxt}; use rustc::ty::query::Providers; use rustc::ty::subst::Substs; -use rustc::ty::util::Discr; -use rustc::ty::util::IntTypeExt; -use rustc::ty::{self, AdtKind, ToPolyTraitRef, Ty, TyCtxt}; -use rustc::ty::{ReprOptions, ToPredicate}; +use rustc::ty::util::{Discr, IntTypeExt}; use rustc::util::captures::Captures; use rustc::util::nodemap::FxHashMap; use rustc_data_structures::sync::Lrc; @@ -40,13 +43,6 @@ use syntax::feature_gate; use syntax::symbol::{keywords, Symbol}; use syntax_pos::{Span, DUMMY_SP}; -use rustc::hir::def::{CtorKind, Def}; -use rustc::hir::Node; -use rustc::hir::def_id::{DefId, LOCAL_CRATE}; -use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor}; -use rustc::hir::GenericParamKind; -use rustc::hir::{self, CodegenFnAttrFlags, CodegenFnAttrs, Unsafety}; - use std::iter; struct OnlySelfBounds(bool); @@ -84,7 +80,7 @@ pub fn provide(providers: &mut Providers) { /////////////////////////////////////////////////////////////////////////// /// Context specific to some particular item. This is what implements -/// AstConv. It has information about the predicates that are defined +/// `AstConv`. It has information about the predicates that are defined /// on the trait. Unfortunately, this predicate information is /// available in various different forms at various points in the /// process. So we can't just store a pointer to e.g., the AST or the @@ -218,17 +214,17 @@ impl<'a, 'tcx> AstConv<'tcx, 'tcx> for ItemCtxt<'a, 'tcx> { } fn normalize_ty(&self, _span: Span, ty: Ty<'tcx>) -> Ty<'tcx> { - // types in item signatures are not normalized, to avoid undue + // Types in item signatures are not normalized, to avoid undue // dependencies. ty } fn set_tainted_by_errors(&self) { - // no obvious place to track this, just let it go + // No obvious place to track this; just let it go. } fn record_ty(&self, _hir_id: hir::HirId, _ty: Ty<'tcx>, _span: Span) { - // no place to record types from signatures? + // No place to record types from signatures? } } @@ -239,8 +235,8 @@ fn type_param_predicates<'a, 'tcx>( use rustc::hir::*; // In the AST, bounds can derive from two places. Either - // written inline like `` or in a where clause like - // `where T : Foo`. + // written inline like `` or in a where clause like + // `where T: Foo`. let param_id = tcx.hir().as_local_node_id(def_id).unwrap(); let param_owner = tcx.hir().ty_param_owner(param_id); @@ -672,7 +668,7 @@ fn adt_def<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty::Ad tcx.alloc_adt_def(def_id, kind, variants, repr) } -/// Ensures that the super-predicates of the trait with def-id +/// Ensures that the super-predicates of the trait with def-ID /// trait_def_id are converted and stored. This also ensures that /// the transitive super-predicates are converted; fn super_predicates_of<'a, 'tcx>( @@ -695,14 +691,14 @@ fn super_predicates_of<'a, 'tcx>( let icx = ItemCtxt::new(tcx, trait_def_id); - // Convert the bounds that follow the colon, e.g., `Bar + Zed` in `trait Foo : Bar + Zed`. + // Convert the bounds that follow the colon, e.g., `Bar + Zed` in `trait Foo: Bar + Zed`. let self_param_ty = tcx.mk_self_type(); let superbounds1 = compute_bounds(&icx, self_param_ty, bounds, SizedByDefault::No, item.span); let superbounds1 = superbounds1.predicates(tcx, self_param_ty); // Convert any explicit superbounds in the where clause, - // e.g., `trait Foo where Self : Bar`. + // e.g., `trait Foo where Self: Bar`. // In the case of trait aliases, however, we include all bounds in the where clause, // so e.g., `trait Foo = where u32: PartialEq` would include `u32: PartialEq` // as one of its "superpredicates". @@ -923,8 +919,8 @@ fn generics_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty | ItemKind::TraitAlias(ref generics, ..) => { // Add in the self type parameter. // - // Something of a hack: use the node id for the trait, also as - // the node id for the Self type parameter. + // Something of a hack: use the node-ID for the trait, also as + // the node-ID for the Self type parameter. let param_id = item.id; opt_self = Some(ty::GenericParamDef { @@ -1523,7 +1519,7 @@ fn impl_polarity<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> hir::I } } -// Is it marked with ?Sized +// Returns whether the given bounds include `?Sized`. fn is_unsized<'gcx: 'tcx, 'tcx>( astconv: &dyn AstConv<'gcx, 'tcx>, ast_bounds: &[hir::GenericBound], @@ -1575,7 +1571,7 @@ fn is_unsized<'gcx: 'tcx, 'tcx>( } /// Returns the early-bound lifetimes declared in this generics -/// listing. For anything other than fns/methods, this is just all +/// listing. For anything other than fns/methods, this is just all /// the lifetimes that are declared. For fns or methods, we have to /// screen out those that do not appear in any where-clauses etc using /// `resolve_lifetime::early_bound_lifetimes`. @@ -1595,6 +1591,9 @@ fn early_bound_lifetimes_from_generics<'a, 'tcx>( }) } +/// Returns a list of type predicates for the definition with ID `def_id`, including inferred +/// lifetime constraints. This includes all predicates returned by `explicit_predicates_of`, plus +/// inferred constraints concerning which regions outlive other regions. fn predicates_defined_on<'a, 'tcx>( tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId, @@ -1621,6 +1620,9 @@ fn predicates_defined_on<'a, 'tcx>( result } +/// Returns a list of all type predicates (explicit and implicit) for the definition with +/// ID `def_id`. This includes all predicates returned by `predicates_defined_on`, plus +/// `Self: Trait` predicates for traits. fn predicates_of<'a, 'tcx>( tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId, @@ -1633,7 +1635,7 @@ fn predicates_of<'a, 'tcx>( // is something that one must prove in order to invoke a // method or project an associated type. // - // In the chalk setup, this predicate is not part of the + // In the Chalk setup, this predicate is not part of the // "predicates" for a trait item. But it is useful in // rustc because if you directly (e.g.) invoke a trait // method like `Trait::method(...)`, you must naturally @@ -1648,6 +1650,8 @@ fn predicates_of<'a, 'tcx>( result } +/// Returns a list of user-specified type predicates for the definition with ID `def_id`. +/// N.B., this does not include any implied/inferred constraints. fn explicit_predicates_of<'a, 'tcx>( tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId, @@ -1838,7 +1842,7 @@ fn explicit_predicates_of<'a, 'tcx>( } // Collect the predicates that were written inline by the user on each - // type parameter (e.g., ``). + // type parameter (e.g., ``). for param in &ast_generics.params { if let GenericParamKind::Type { .. } = param.kind { let name = param.name.ident().as_interned_str(); @@ -1851,7 +1855,7 @@ fn explicit_predicates_of<'a, 'tcx>( } } - // Add in the bounds that appear in the where-clause + // Add in the bounds that appear in the where-clause. let where_clause = &ast_generics.where_clause; for predicate in &where_clause.predicates { match predicate { @@ -1953,8 +1957,8 @@ fn explicit_predicates_of<'a, 'tcx>( let mut predicates = predicates.predicates; // Subtle: before we store the predicates into the tcx, we - // sort them so that predicates like `T: Foo` come - // before uses of `U`. This avoids false ambiguity errors + // sort them so that predicates like `T: Foo` come + // before uses of `U`. This avoids false ambiguity errors // in trait checking. See `setup_constraining_predicates` // for details. if let Node::Item(&Item { @@ -2041,9 +2045,9 @@ pub fn compute_bounds<'gcx: 'tcx, 'tcx>( } /// Converts a specific `GenericBound` from the AST into a set of -/// predicates that apply to the self-type. A vector is returned -/// because this can be anywhere from zero predicates (`T : ?Sized` adds no -/// predicates) to one (`T : Foo`) to many (`T : Bar` adds `T : Bar` +/// predicates that apply to the self type. A vector is returned +/// because this can be anywhere from zero predicates (`T: ?Sized` adds no +/// predicates) to one (`T: Foo`) to many (`T: Bar` adds `T: Bar` /// and `::X == i32`). fn predicates_from_bound<'tcx>( astconv: &dyn AstConv<'tcx, 'tcx>, @@ -2121,7 +2125,7 @@ fn is_foreign_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> bool match tcx.hir().get_if_local(def_id) { Some(Node::ForeignItem(..)) => true, Some(_) => false, - _ => bug!("is_foreign_item applied to non-local def-id {:?}", def_id), + _ => bug!("is_foreign_item applied to non-local def-ID {:?}", def_id), } } @@ -2227,7 +2231,7 @@ fn linkage_by_name<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId, name: & // may pop up in the future. // // ghost, dllimport, dllexport and linkonce_odr_autohide are not supported - // and don't have to be, LLVM treats them as no-ops. + // and don't have to be, LLVM treats them as noops. match name { "appending" => Appending, "available_externally" => AvailableExternally, diff --git a/src/librustc_typeck/constrained_type_params.rs b/src/librustc_typeck/constrained_type_params.rs index 199ea315896df..8f854b95e5110 100644 --- a/src/librustc_typeck/constrained_type_params.rs +++ b/src/librustc_typeck/constrained_type_params.rs @@ -89,7 +89,7 @@ pub fn identify_constrained_type_params<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>, /// parameters so constrained to `input_parameters`. For example, /// imagine the following impl: /// -/// impl> Trait for U +/// impl> Trait for U /// /// The impl's predicates are collected from left to right. Ignoring /// the implicit `Sized` bounds, these are @@ -112,10 +112,10 @@ pub fn identify_constrained_type_params<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>, /// We *do* have to be somewhat careful when projection targets contain /// projections themselves, for example in /// impl Trait for U where -/// /* 0 */ S: Iterator, +/// /* 0 */ S: Iterator, /// /* - */ U: Iterator, /// /* 1 */ ::Item: ToOwned::Item)> -/// /* 2 */ W: Iterator +/// /* 2 */ W: Iterator /// /* 3 */ V: Debug /// we have to evaluate the projections in the order I wrote them: /// `V: Debug` requires `V` to be evaluated. The only projection that diff --git a/src/librustc_typeck/diagnostics.rs b/src/librustc_typeck/diagnostics.rs index 5910a8b3110d0..37d1b5c75ba9e 100644 --- a/src/librustc_typeck/diagnostics.rs +++ b/src/librustc_typeck/diagnostics.rs @@ -192,7 +192,7 @@ want to capture values of an orderable type between two end-points, you can use a guard. ```compile_fail,E0029 -let string = "salutations !"; +let string = "salutations!"; // The ordering relation for strings can't be evaluated at compile time, // so this doesn't work: @@ -563,10 +563,10 @@ fn foo(f: F) { E0059: r##" The built-in function traits are generic over a tuple of the function arguments. -If one uses angle-bracket notation (`Fn<(T,), Output=U>`) instead of parentheses -(`Fn(T) -> U`) to denote the function trait, the type parameter should be a -tuple. Otherwise function call notation cannot be used and the trait will not be -implemented by closures. +If one uses angle-bracket notation (`Fn<(T,), Output = U>`) instead of +parentheses (`Fn(T) -> U`) to denote the function trait, the type parameter +should be a tuple. Otherwise, function call notation cannot be used and the +trait will not be implemented by closures. The most likely source of this error is using angle-bracket notation without wrapping the function argument type into a tuple, for example: @@ -728,7 +728,7 @@ LinkedList::new() += 1; // ... fn some_func(i: &mut i32) { - i += 12; // Error : '+=' operation cannot be applied on a reference ! + i += 12; // error: '+=' operation cannot be applied on a reference! } ``` @@ -737,12 +737,12 @@ And now some working examples: ``` let mut i : i32 = 0; -i += 12; // Good ! +i += 12; // good! // ... fn some_func(i: &mut i32) { - *i += 12; // Good ! + *i += 12; // good! } ``` "##, @@ -785,10 +785,10 @@ const SOME_CONST : i32 = 12; fn some_other_func() {} fn some_function() { - SOME_CONST = 14; // error : a constant value cannot be changed! - 1 = 3; // error : 1 isn't a valid place! - some_other_func() = 4; // error : we can't assign value to a function! - SomeStruct.x = 12; // error : SomeStruct a structure name but it is used + SOME_CONST = 14; // error: a constant value cannot be changed! + 1 = 3; // error: 1 isn't a valid place! + some_other_func() = 4; // error: we can't assign value to a function! + SomeStruct.x = 12; // error: SomeStruct a structure name but it is used // like a variable! } ``` @@ -802,12 +802,12 @@ struct SomeStruct { } let mut s = SomeStruct {x: 0, y: 0}; -s.x = 3; // that's good ! +s.x = 3; // that's good! // ... fn some_func(x: &mut i32) { - *x = 12; // that's good ! + *x = 12; // that's good! } ``` "##, @@ -2388,7 +2388,7 @@ impl Foo for isize { fn boo(&self) -> usize { 42 } } -fn baz(x: &>::A) {} +fn baz(x: &>::A) {} // error: associated type bindings are not allowed here ``` @@ -2398,7 +2398,7 @@ declaration: ``` # struct Bar; # trait Foo { type A; } -fn baz>(x: &::A) {} // ok! +fn baz>(x: &::A) {} // ok! ``` Or in the `where` clause: @@ -2406,7 +2406,7 @@ Or in the `where` clause: ``` # struct Bar; # trait Foo { type A; } -fn baz(x: &::A) where I: Foo {} +fn baz(x: &::A) where I: Foo {} ``` "##, @@ -3230,7 +3230,7 @@ A type parameter which references `Self` in its default value was not specified. Example of erroneous code: ```compile_fail,E0393 -trait A {} +trait A {} fn together_we_will_rule_the_galaxy(son: &A) {} // error: the type parameter `T` must be explicitly specified in an @@ -3250,7 +3250,7 @@ disallowed. Making the trait concrete by explicitly specifying the value of the defaulted parameter will fix this issue. Fixed example: ``` -trait A {} +trait A {} fn together_we_will_rule_the_galaxy(son: &A) {} // Ok! ``` diff --git a/src/librustc_typeck/impl_wf_check.rs b/src/librustc_typeck/impl_wf_check.rs index d5e15b28fb04b..e8f0cfe5f9f90 100644 --- a/src/librustc_typeck/impl_wf_check.rs +++ b/src/librustc_typeck/impl_wf_check.rs @@ -19,7 +19,7 @@ use std::collections::hash_map::Entry::{Occupied, Vacant}; use syntax_pos::Span; /// Checks that all the type/lifetime parameters on an impl also -/// appear in the trait ref or self-type (or are constrained by a +/// appear in the trait ref or self type (or are constrained by a /// where-clause). These rules are needed to ensure that, given a /// trait ref like `>`, we can derive the values of all /// parameters on the impl (which is needed to make specialization @@ -39,7 +39,7 @@ use syntax_pos::Span; /// impl Trait> for Bar { ... } /// // ^ T appears in `Foo`, ok. /// -/// impl Trait for Bar where Bar: Iterator { ... } +/// impl Trait for Bar where Bar: Iterator { ... } /// // ^ T is bound to `::Item`, ok. /// /// impl<'a> Trait for Bar { } diff --git a/src/librustc_typeck/lib.rs b/src/librustc_typeck/lib.rs index c55a1258ce955..1555b065de9f9 100644 --- a/src/librustc_typeck/lib.rs +++ b/src/librustc_typeck/lib.rs @@ -1,6 +1,6 @@ /*! -# typeck.rs +# typeck The type checker is responsible for: @@ -22,7 +22,7 @@ several major phases: 4. Finally, the check phase then checks function bodies and so forth. Within the check phase, we check each function body one at a time (bodies of function expressions are checked as part of the - containing function). Inference is used to supply types wherever + containing function). Inference is used to supply types wherever they are unknown. The actual checking of a function itself has several phases (check, regionck, writeback), as discussed in the documentation for the `check` module. @@ -43,10 +43,10 @@ independently: - outlives: outlives inference - check: walks over function bodies and type checks them, inferring types for - local variables, type parameters, etc as necessary. + local variables, type parameters, etc., as necessary. - infer: finds the types to use for each type variable such that - all subtyping and assignment constraints are met. In essence, the check + all subtyping and assignment constraints are met. In essence, the check module specifies the constraints, and the infer module solves them. ## Note @@ -374,11 +374,11 @@ pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) } /// A quasi-deprecated helper used in rustdoc and save-analysis to get -/// the type from a HIR node. +/// the type from an HIR node. pub fn hir_ty_to_ty<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, hir_ty: &hir::Ty) -> Ty<'tcx> { // In case there are any projections etc, find the "environment" - // def-id that will be used to determine the traits/predicates in - // scope. This is derived from the enclosing item-like thing. + // def-ID that will be used to determine the traits/predicates in + // scope. This is derived from the enclosing item-like thing. let env_node_id = tcx.hir().get_parent(hir_ty.id); let env_def_id = tcx.hir().local_def_id(env_node_id); let item_cx = self::collect::ItemCtxt::new(tcx, env_def_id); @@ -389,8 +389,8 @@ pub fn hir_ty_to_ty<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, hir_ty: &hir::Ty) -> pub fn hir_trait_to_predicates<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, hir_trait: &hir::TraitRef) -> (ty::PolyTraitRef<'tcx>, Vec<(ty::PolyProjectionPredicate<'tcx>, Span)>) { // In case there are any projections etc, find the "environment" - // def-id that will be used to determine the traits/predicates in - // scope. This is derived from the enclosing item-like thing. + // def-ID that will be used to determine the traits/predicates in + // scope. This is derived from the enclosing item-like thing. let env_node_id = tcx.hir().get_parent(hir_trait.ref_id); let env_def_id = tcx.hir().local_def_id(env_node_id); let item_cx = self::collect::ItemCtxt::new(tcx, env_def_id); diff --git a/src/librustc_typeck/outlives/implicit_infer.rs b/src/librustc_typeck/outlives/implicit_infer.rs index 8929f5e5c6a3e..7072d99d29493 100644 --- a/src/librustc_typeck/outlives/implicit_infer.rs +++ b/src/librustc_typeck/outlives/implicit_infer.rs @@ -61,7 +61,7 @@ impl<'cx, 'tcx> ItemLikeVisitor<'tcx> for InferVisitor<'cx, 'tcx> { .tcx .hir() .as_local_node_id(item_did) - .expect("expected local def-id"); + .expect("expected local def-ID"); let item = match self.tcx.hir().get(node_id) { Node::Item(item) => item, _ => bug!(), @@ -162,7 +162,7 @@ fn insert_required_predicates_to_be_wf<'tcx>( if let Some(unsubstituted_predicates) = global_inferred_outlives.get(&def.did) { for unsubstituted_predicate in unsubstituted_predicates { // `unsubstituted_predicate` is `U: 'b` in the - // example above. So apply the substitution to + // example above. So apply the substitution to // get `T: 'a` (or `predicate`): let predicate = unsubstituted_predicate.subst(tcx, substs); insert_outlives_predicate( diff --git a/src/librustc_typeck/outlives/mod.rs b/src/librustc_typeck/outlives/mod.rs index f0310f250a9bd..d9da7a06f360c 100644 --- a/src/librustc_typeck/outlives/mod.rs +++ b/src/librustc_typeck/outlives/mod.rs @@ -27,7 +27,7 @@ fn inferred_outlives_of<'a, 'tcx>( let id = tcx .hir() .as_local_node_id(item_def_id) - .expect("expected local def-id"); + .expect("expected local def-ID"); match tcx.hir().get(id) { Node::Item(item) => match item.node { @@ -83,7 +83,7 @@ fn inferred_outlives_crate<'tcx>( // predicate is satisfied, so they form a kind of base set of requirements // for the type. - // Compute the inferred predicates + // Compute the inferred predicates. let mut exp_map = explicit::ExplicitPredicatesMap::new(); let global_inferred_outlives = implicit_infer::infer_predicates(tcx, &mut exp_map); @@ -91,7 +91,7 @@ fn inferred_outlives_crate<'tcx>( // Convert the inferred predicates into the "collected" form the // global data structure expects. // - // FIXME -- consider correcting impedance mismatch in some way, + // FIXME: consider correcting impedance mismatch in some way, // probably by updating the global data structure. let predicates = global_inferred_outlives .iter() diff --git a/src/librustc_typeck/outlives/utils.rs b/src/librustc_typeck/outlives/utils.rs index c886c7a4ffce5..eb3392fdbd65b 100644 --- a/src/librustc_typeck/outlives/utils.rs +++ b/src/librustc_typeck/outlives/utils.rs @@ -45,7 +45,7 @@ pub fn insert_outlives_predicate<'tcx>( // ``` // // Here `outlived_region = 'a` and `kind = &'b - // u32`. Decomposing `&'b u32` into + // u32`. Decomposing `&'b u32` into // components would yield `'b`, and we add the // where clause that `'b: 'a`. insert_outlives_predicate( @@ -67,7 +67,7 @@ pub fn insert_outlives_predicate<'tcx>( // ``` // // Here `outlived_region = 'a` and `kind = - // Vec`. Decomposing `Vec` into + // Vec`. Decomposing `Vec` into // components would yield `U`, and we add the // where clause that `U: 'a`. let ty: Ty<'tcx> = param_ty.to_ty(tcx); @@ -92,7 +92,7 @@ pub fn insert_outlives_predicate<'tcx>( Component::EscapingProjection(_) => { // As above, but the projection involves - // late-bound regions. Therefore, the WF + // late-bound regions. Therefore, the WF // requirement is not checked in type definition // but at fn call site, so ignore it. // @@ -153,7 +153,7 @@ fn is_free_region<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>, region: Region<'_>) -> bool // } // // The type above might generate a `T: 'b` bound, but we can - // ignore it. We can't put it on the struct header anyway. + // ignore it. We can't put it on the struct header anyway. RegionKind::ReLateBound(..) => false, // These regions don't appear in types from type declarations: diff --git a/src/librustc_typeck/variance/constraints.rs b/src/librustc_typeck/variance/constraints.rs index 51d89688dc2a0..f0655d7ebe204 100644 --- a/src/librustc_typeck/variance/constraints.rs +++ b/src/librustc_typeck/variance/constraints.rs @@ -41,7 +41,7 @@ pub struct Constraint<'a> { /// } /// /// then while we are visiting `Bar`, the `CurrentItem` would have -/// the def-id and the start of `Foo`'s inferreds. +/// the def-ID and the start of `Foo`'s inferreds. pub struct CurrentItem { inferred_start: InferredIndex, } @@ -200,7 +200,7 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> { fn xform(&mut self, v1: VarianceTermPtr<'a>, v2: VarianceTermPtr<'a>) -> VarianceTermPtr<'a> { match (*v1, *v2) { (_, ConstantTerm(ty::Covariant)) => { - // Applying a "covariant" transform is always a no-op + // Applying a "covariant" transform is always a noop v1 } diff --git a/src/librustc_typeck/variance/mod.rs b/src/librustc_typeck/variance/mod.rs index afb6a68482013..45918b67abdc2 100644 --- a/src/librustc_typeck/variance/mod.rs +++ b/src/librustc_typeck/variance/mod.rs @@ -46,7 +46,7 @@ fn crate_variances<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, crate_num: CrateNum) fn variances_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, item_def_id: DefId) -> Lrc> { - let id = tcx.hir().as_local_node_id(item_def_id).expect("expected local def-id"); + let id = tcx.hir().as_local_node_id(item_def_id).expect("expected local def-ID"); let unsupported = || { // Variance not relevant. span_bug!(tcx.hir().span(id), "asked to compute variance for wrong kind of item") diff --git a/src/librustc_typeck/variance/solve.rs b/src/librustc_typeck/variance/solve.rs index 550c1b1d68bd3..ee161a3074370 100644 --- a/src/librustc_typeck/variance/solve.rs +++ b/src/librustc_typeck/variance/solve.rs @@ -48,7 +48,7 @@ pub fn solve_constraints(constraints_cx: ConstraintContext) -> ty::CrateVariance impl<'a, 'tcx> SolveContext<'a, 'tcx> { fn solve(&mut self) { - // Propagate constraints until a fixed point is reached. Note + // Propagate constraints until a fixed point is reached. Note // that the maximum number of iterations is 2C where C is the // number of constraints (each variable can change values at most // twice). Since number of constraints is linear in size of the diff --git a/src/librustc_typeck/variance/terms.rs b/src/librustc_typeck/variance/terms.rs index d53e2d2ad7883..4365f25563f4d 100644 --- a/src/librustc_typeck/variance/terms.rs +++ b/src/librustc_typeck/variance/terms.rs @@ -57,7 +57,7 @@ pub struct TermsContext<'a, 'tcx: 'a> { // variance. pub lang_items: Vec<(ast::NodeId, Vec)>, - // Maps from the node id of an item to the first inferred index + // Maps from the node-ID of an item to the first inferred index // used for its type & region parameters. pub inferred_starts: NodeMap, diff --git a/src/librustdoc/clean/auto_trait.rs b/src/librustdoc/clean/auto_trait.rs index bdd2b058fd16e..49222dcbf1df6 100644 --- a/src/librustdoc/clean/auto_trait.rs +++ b/src/librustdoc/clean/auto_trait.rs @@ -677,7 +677,7 @@ impl<'a, 'tcx, 'rcx> AutoTraitFinder<'a, 'tcx, 'rcx> { continue; } - // FIXME: Remove this scope when NLL lands + // FIXME: remove this scope when NLL lands { let args = &mut new_trait_path.segments @@ -761,7 +761,7 @@ impl<'a, 'tcx, 'rcx> AutoTraitFinder<'a, 'tcx, 'rcx> { for param in generic_params.iter_mut() { match param.kind { GenericParamDefKind::Type { ref mut default, ref mut bounds, .. } => { - // We never want something like `impl`. + // We never want something like `impl`. default.take(); let generic_ty = Type::Generic(param.name.clone()); if !has_sized.contains(&generic_ty) { diff --git a/src/librustdoc/clean/cfg.rs b/src/librustdoc/clean/cfg.rs index 0cfe6be7efbf3..a3cc587606ea4 100644 --- a/src/librustdoc/clean/cfg.rs +++ b/src/librustdoc/clean/cfg.rs @@ -1,4 +1,4 @@ -//! Representation of a `#[doc(cfg(...))]` attribute. +//! The representation of a `#[doc(cfg(...))]` attribute. // FIXME: Once the portability lint RFC is implemented (see tracking issue #41619), // switch to use those structures instead. @@ -95,7 +95,7 @@ impl Cfg { /// Checks whether the given configuration can be matched in the current session. /// /// Equivalent to `attr::cfg_matches`. - // FIXME: Actually make use of `features`. + // FIXME: actually make use of `features`. pub fn matches(&self, parse_sess: &ParseSess, features: Option<&Features>) -> bool { match *self { Cfg::False => false, diff --git a/src/librustdoc/clean/inline.rs b/src/librustdoc/clean/inline.rs index 9cb21df713e5b..bf0671f087071 100644 --- a/src/librustdoc/clean/inline.rs +++ b/src/librustdoc/clean/inline.rs @@ -284,10 +284,10 @@ pub fn build_impl(cx: &DocContext, did: DefId, ret: &mut Vec) { let associated_trait = tcx.impl_trait_ref(did); // Only inline impl if the implemented trait is - // reachable in rustdoc generated documentation + // reachable in rustdoc-generated documentation. if !did.is_local() { - if let Some(traitref) = associated_trait { - if !cx.renderinfo.borrow().access_levels.is_doc_reachable(traitref.def_id) { + if let Some(tr) = associated_trait { + if !cx.renderinfo.borrow().access_levels.is_doc_reachable(tr.def_id) { return } } @@ -305,7 +305,7 @@ pub fn build_impl(cx: &DocContext, did: DefId, ret: &mut Vec) { }; // Only inline impl if the implementing type is - // reachable in rustdoc generated documentation + // reachable in rustdoc-generated documentation. if !did.is_local() { if let Some(did) = for_.def_id() { if !cx.renderinfo.borrow().access_levels.is_doc_reachable(did) { diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 38b2452b420e9..65076b5509d19 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -3763,7 +3763,7 @@ pub fn register_def(cx: &DocContext, def: Def) -> DefId { Def::ForeignTy(i) => (i, TypeKind::Foreign), Def::Const(i) => (i, TypeKind::Const), Def::Static(i, _) => (i, TypeKind::Static), - Def::Variant(i) => (cx.tcx.parent_def_id(i).expect("cannot get parent def id"), + Def::Variant(i) => (cx.tcx.parent_def_id(i).expect("cannot get parent def-ID"), TypeKind::Enum), Def::Macro(i, mac_kind) => match mac_kind { MacroKind::Bang => (i, TypeKind::Macro), @@ -3907,7 +3907,7 @@ impl Clean for attr::Deprecation { } } -/// An equality constraint on an associated type, e.g., `A=Bar` in `Foo` +/// An equality constraint on an associated type, e.g., `A = Bar` in `Foo` #[derive(Clone, PartialEq, Eq, RustcDecodable, RustcEncodable, Debug, Hash)] pub struct TypeBinding { pub name: String, diff --git a/src/librustdoc/clean/simplify.rs b/src/librustdoc/clean/simplify.rs index 31e842b338962..1d451e3803904 100644 --- a/src/librustdoc/clean/simplify.rs +++ b/src/librustdoc/clean/simplify.rs @@ -5,7 +5,7 @@ //! the AST (e.g., see all of `clean::inline`), but this is not always a //! non-lossy transformation. The current format of storage for where clauses //! for functions and such is simply a list of predicates. One example of this -//! is that the AST predicate of: `where T: Trait` is encoded as: +//! is that the AST predicate of: `where T: Trait` is encoded as: //! `where T: Trait, ::Foo = Bar`. //! //! This module attempts to reconstruct the original where and/or parameter diff --git a/src/librustdoc/config.rs b/src/librustdoc/config.rs index d99136802514d..355b84ce0887e 100644 --- a/src/librustdoc/config.rs +++ b/src/librustdoc/config.rs @@ -498,7 +498,7 @@ fn check_deprecated_options(matches: &getopts::Matches, diag: &errors::Handler) if matches.opt_present(flag) { let mut err = diag.struct_warn(&format!("the '{}' flag is considered deprecated", flag)); - err.warn("please see https://github.com/rust-lang/rust/issues/44136"); + err.warn("see "); if *flag == "no-defaults" { err.help("you may want to use --document-private-items"); diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index 3fa2d085ece94..da909610390c4 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -66,7 +66,7 @@ pub struct DocContext<'a, 'tcx: 'a, 'rcx: 'a> { /// Table type parameter definition -> substituted type pub ty_substs: RefCell>, - /// Table node id of lifetime parameter definition -> substituted lifetime + /// Table node-ID of lifetime parameter definition -> substituted lifetime pub lt_substs: RefCell>, /// Table DefId of `impl Trait` in argument position -> bounds pub impl_trait_bounds: RefCell>>, @@ -104,9 +104,9 @@ impl<'a, 'tcx, 'rcx> DocContext<'a, 'tcx, 'rcx> { // registered after the AST is constructed would require storing the defid mapping in a // RefCell, decreasing the performance for normal compilation for very little gain. // - // Instead, we construct 'fake' def ids, which start immediately after the last DefId in + // Instead, we construct 'fake' def-IDs, which start immediately after the last DefId in // DefIndexAddressSpace::Low. In the Debug impl for clean::Item, we explicitly check for fake - // def ids, as we'll end up with a panic if we use the DefId Debug impl for fake DefIds + // def-IDs, as we'll end up with a panic if we use the DefId Debug impl for fake DefIds pub fn next_def_id(&self, crate_num: CrateNum) -> DefId { let start_def_id = { let next_id = if crate_num == LOCAL_CRATE { @@ -310,7 +310,7 @@ pub fn new_handler(error_format: ErrorOutputType, } pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOptions, Vec) { - // Parse, resolve, and typecheck the given crate. + // Parse, resolve, and type-check the given crate. let RustdocOptions { input, @@ -546,7 +546,7 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt fn report_deprecated_attr(name: &str, diag: &errors::Handler) { let mut msg = diag.struct_warn(&format!("the `#![doc({})]` attribute is \ considered deprecated", name)); - msg.warn("please see https://github.com/rust-lang/rust/issues/44136"); + msg.warn("see "); if name == "no_default_passes" { msg.help("you may want to use `#![doc(document_private_items)]`"); diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs index 05a9a2d1312ae..de28382701f0e 100644 --- a/src/librustdoc/html/markdown.rs +++ b/src/librustdoc/html/markdown.rs @@ -96,7 +96,7 @@ impl<'a> Line<'a> { } } -// FIXME: There is a minor inconsistency here. For lines that start with ##, we +// FIXME: there is a minor inconsistency here. For lines that start with ##, we // have no easy way of removing a potential single space after the hashes, which // is done in the single # case. This inconsistency seems okay, if non-ideal. In // order to fix it we'd have to iterate to find the first non-# character, and @@ -929,7 +929,7 @@ impl IdMap { IdMap::default() } - pub fn populate>(&mut self, ids: I) { + pub fn populate>(&mut self, ids: I) { for id in ids { let _ = self.derive(id); } diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index 184d5b24d6e12..b3749731e857d 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -1,4 +1,4 @@ -//! Rustdoc's HTML Rendering module +//! Rustdoc's HTML rendering module. //! //! This modules contains the bulk of the logic necessary for rendering a //! rustdoc `clean::Crate` instance to a set of static HTML pages. This @@ -267,7 +267,7 @@ pub struct Cache { /// found on that implementation. pub impls: FxHashMap>, - /// Maintains a mapping of local crate node ids to the fully qualified name + /// Maintains a mapping of local crate node-IDs to the fully qualified name /// and "short type description" of that node. This is used when generating /// URLs when a type is being linked to. External paths are not located in /// this map because the `External` type itself has all the information @@ -278,7 +278,7 @@ pub struct Cache { /// generating explicit hyperlinks to other crates. pub external_paths: FxHashMap, ItemType)>, - /// Maps local def ids of exported types to fully qualified paths. + /// Maps local def-IDs of exported types to fully qualified paths. /// Unlike 'paths', this mapping ignores any renames that occur /// due to 'use' statements. /// @@ -2597,7 +2597,7 @@ fn item_module(w: &mut fmt::Formatter, cx: &Context, // // `Double` will appear twice in the generated docs. // - // FIXME: This code is quite ugly and could be improved. Small issue: DefId + // FIXME: this code is quite ugly and could be improved. Small issue: `DefId` // can be identical even if the elements are different (mostly in imports). // So in case this is an import, we keep everything by adding a "unique id" // (which is the position in the vector). @@ -4356,7 +4356,7 @@ impl<'a> fmt::Display for Sidebar<'a> { path = relpath)?; if parentlen == 0 { // There is no sidebar-items.js beyond the crate root path - // FIXME maybe dynamic crate loading can be merged here + // FIXME: maybe dynamic crate loading can be merged here } else { write!(fmt, "", path = relpath)?; diff --git a/src/librustdoc/visit_ast.rs b/src/librustdoc/visit_ast.rs index 953ab7c2565bf..20ecd37b99772 100644 --- a/src/librustdoc/visit_ast.rs +++ b/src/librustdoc/visit_ast.rs @@ -259,7 +259,7 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> { /// Cross-crate inlining occurs later on during crate cleaning /// and follows different rules. /// - /// Returns true if the target has been inlined. + /// Returns whether the target has been inlined. fn maybe_inline_local(&mut self, id: ast::NodeId, def: Def, diff --git a/src/libserialize/json.rs b/src/libserialize/json.rs index 3c289596d0ee8..d72723000ab60 100644 --- a/src/libserialize/json.rs +++ b/src/libserialize/json.rs @@ -327,14 +327,14 @@ fn io_error_to_error(io: io::Error) -> ParserError { impl fmt::Display for ParserError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - // FIXME this should be a nicer error + // FIXME: this should be a nicer error fmt::Debug::fmt(self, f) } } impl fmt::Display for DecoderError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - // FIXME this should be a nicer error + // FIXME: this should be a nicer error fmt::Debug::fmt(self, f) } } @@ -345,7 +345,7 @@ impl std::error::Error for DecoderError { impl fmt::Display for EncoderError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - // FIXME this should be a nicer error + // FIXME: this should be a nicer error fmt::Debug::fmt(self, f) } } @@ -1073,13 +1073,13 @@ impl Json { } } - /// Returns true if the Json value is an Object. Returns false otherwise. + /// Returns whether the Json value is an `Object`. pub fn is_object(&self) -> bool { self.as_object().is_some() } - /// If the Json value is an Object, returns the associated BTreeMap. - /// Returns None otherwise. + /// If the Json value is an `Object`, returns the associated `BTreeMap`; + /// returns `None` otherwise. pub fn as_object(&self) -> Option<&Object> { match *self { Json::Object(ref map) => Some(map), @@ -1087,13 +1087,13 @@ impl Json { } } - /// Returns true if the Json value is an Array. Returns false otherwise. + /// Returns whether the Json value is an `Array`. pub fn is_array(&self) -> bool { self.as_array().is_some() } - /// If the Json value is an Array, returns the associated vector. - /// Returns None otherwise. + /// If the Json value is an `Array`, returns the associated vector; + /// returns `None` otherwise. pub fn as_array(&self) -> Option<&Array> { match *self { Json::Array(ref array) => Some(&*array), @@ -1101,13 +1101,13 @@ impl Json { } } - /// Returns true if the Json value is a String. Returns false otherwise. + /// Returns whether the Json value is a `String`. pub fn is_string(&self) -> bool { self.as_string().is_some() } - /// If the Json value is a String, returns the associated str. - /// Returns None otherwise. + /// If the Json value is a `String`, returns the associated `str`; + /// returns `None` otherwise. pub fn as_string(&self) -> Option<&str> { match *self { Json::String(ref s) => Some(&s[..]), @@ -1115,7 +1115,7 @@ impl Json { } } - /// Returns true if the Json value is a Number. Returns false otherwise. + /// Returns whether the Json value is a `Number`. pub fn is_number(&self) -> bool { match *self { Json::I64(_) | Json::U64(_) | Json::F64(_) => true, @@ -1123,7 +1123,7 @@ impl Json { } } - /// Returns true if the Json value is a i64. Returns false otherwise. + /// Returns whether the Json value is a `i64`. pub fn is_i64(&self) -> bool { match *self { Json::I64(_) => true, @@ -1131,7 +1131,7 @@ impl Json { } } - /// Returns true if the Json value is a u64. Returns false otherwise. + /// Returns whether the Json value is a `u64`. pub fn is_u64(&self) -> bool { match *self { Json::U64(_) => true, @@ -1139,7 +1139,7 @@ impl Json { } } - /// Returns true if the Json value is a f64. Returns false otherwise. + /// Returns whether the Json value is a `f64`. pub fn is_f64(&self) -> bool { match *self { Json::F64(_) => true, @@ -1147,8 +1147,8 @@ impl Json { } } - /// If the Json value is a number, return or cast it to a i64. - /// Returns None otherwise. + /// If the Json value is a number, returns or cast it to a `i64`; + /// returns `None` otherwise. pub fn as_i64(&self) -> Option { match *self { Json::I64(n) => Some(n), @@ -1157,8 +1157,8 @@ impl Json { } } - /// If the Json value is a number, return or cast it to a u64. - /// Returns None otherwise. + /// If the Json value is a number, returns or cast it to a `u64`; + /// returns `None` otherwise. pub fn as_u64(&self) -> Option { match *self { Json::I64(n) => Some(n as u64), @@ -1167,8 +1167,8 @@ impl Json { } } - /// If the Json value is a number, return or cast it to a f64. - /// Returns None otherwise. + /// If the Json value is a number, returns or cast it to a `f64`; + /// returns `None` otherwise. pub fn as_f64(&self) -> Option { match *self { Json::I64(n) => Some(n as f64), @@ -1178,13 +1178,13 @@ impl Json { } } - /// Returns true if the Json value is a Boolean. Returns false otherwise. + /// Returns whether the Json value is a `Boolean`. pub fn is_boolean(&self) -> bool { self.as_boolean().is_some() } - /// If the Json value is a Boolean, returns the associated bool. - /// Returns None otherwise. + /// If the Json value is a `Boolean`, returns the associated `bool`; + /// returns `None` otherwise. pub fn as_boolean(&self) -> Option { match *self { Json::Boolean(b) => Some(b), @@ -1192,13 +1192,13 @@ impl Json { } } - /// Returns true if the Json value is a Null. Returns false otherwise. + /// Returns whether the Json value is a `Null`. pub fn is_null(&self) -> bool { self.as_null().is_some() } - /// If the Json value is a Null, returns (). - /// Returns None otherwise. + /// If the Json value is a `Null`, returns `()`; + /// returns `None` otherwise. pub fn as_null(&self) -> Option<()> { match *self { Json::Null => Some(()), @@ -1294,7 +1294,7 @@ impl Stack { /// Returns The number of elements in the Stack. pub fn len(&self) -> usize { self.stack.len() } - /// Returns true if the stack is empty. + /// Returns whether the stack is empty. pub fn is_empty(&self) -> bool { self.stack.is_empty() } /// Provides access to the StackElement at a given index. @@ -1320,7 +1320,7 @@ impl Stack { true } - /// Returns true if the bottom-most elements of this stack are the same as + /// Returns whether the bottom-most elements of this stack are the same as /// the ones passed as parameter. pub fn starts_with(&self, rhs: &[StackElement]) -> bool { if self.stack.len() < rhs.len() { return false; } @@ -1330,7 +1330,7 @@ impl Stack { true } - /// Returns true if the top-most elements of this stack are the same as + /// Returns whether the top-most elements of this stack are the same as /// the ones passed as parameter. pub fn ends_with(&self, rhs: &[StackElement]) -> bool { if self.stack.len() < rhs.len() { return false; } diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs index 91c4e990e007d..afc9d6601bf56 100644 --- a/src/libstd/collections/hash/map.rs +++ b/src/libstd/collections/hash/map.rs @@ -64,8 +64,8 @@ impl DefaultResizePolicy { // This doesn't have to be checked for overflow since allocation size // in bytes will overflow earlier than multiplication by 10. // - // As per https://github.com/rust-lang/rust/pull/30991 this is updated - // to be: (raw_cap * den + den - 1) / num + // As per PR #30991, this is updated + // to be `(raw_cap * den + den - 1) / num`. (raw_cap * 10 + 10 - 1) / 11 } } @@ -1214,7 +1214,7 @@ impl HashMap self.table.size() } - /// Returns true if the map contains no elements. + /// Returns whether the map contains no elements. /// /// # Examples /// @@ -1332,7 +1332,7 @@ impl HashMap self.search(k).map(|bucket| bucket.into_refs()) } - /// Returns true if the map contains a value for the specified key. + /// Returns whether the map contains a value for the specified key. /// /// The key may be any borrowed form of the map's key type, but /// [`Hash`] and [`Eq`] on the borrowed form *must* match those for diff --git a/src/libstd/collections/hash/set.rs b/src/libstd/collections/hash/set.rs index aebd0eb5de694..8ea7791106df5 100644 --- a/src/libstd/collections/hash/set.rs +++ b/src/libstd/collections/hash/set.rs @@ -456,7 +456,7 @@ impl HashSet self.map.len() } - /// Returns true if the set contains no elements. + /// Returns whether the set contains no elements. /// /// # Examples /// @@ -513,7 +513,7 @@ impl HashSet self.map.clear() } - /// Returns `true` if the set contains a value. + /// Returns whether the set contains a value. /// /// The value may be any borrowed form of the set's value type, but /// [`Hash`] and [`Eq`] on the borrowed form *must* match those for @@ -565,7 +565,7 @@ impl HashSet Recover::get(&self.map, value) } - /// Returns `true` if `self` has no elements in common with `other`. + /// Returns whether `self` has no elements in common with `other`. /// This is equivalent to checking for an empty intersection. /// /// # Examples @@ -587,7 +587,7 @@ impl HashSet self.iter().all(|v| !other.contains(v)) } - /// Returns `true` if the set is a subset of another, + /// Returns whether the set is a subset of another, /// i.e., `other` contains at least all the values in `self`. /// /// # Examples @@ -609,7 +609,7 @@ impl HashSet self.iter().all(|v| other.contains(v)) } - /// Returns `true` if the set is a superset of another, + /// Returns whether the set is a superset of another, /// i.e., `self` contains at least all the values in `other`. /// /// # Examples @@ -677,7 +677,7 @@ impl HashSet Recover::replace(&mut self.map, value) } - /// Removes a value from the set. Returns `true` if the value was + /// Removes a value from the set. Returns whether the value was /// present in the set. /// /// The value may be any borrowed form of the set's value type, but diff --git a/src/libstd/collections/hash/table.rs b/src/libstd/collections/hash/table.rs index 28beb80612ceb..e701ede5bae39 100644 --- a/src/libstd/collections/hash/table.rs +++ b/src/libstd/collections/hash/table.rs @@ -655,7 +655,7 @@ fn calculate_layout(capacity: usize) -> Result<(Layout, usize), LayoutErr> // possibly due to the use of NonZeroUsize. This little hack allows it // to generate optimal code. // - // See https://github.com/rust-lang/rust/issues/51346 for more details. + // See issue #51346 for more details. ( layout, hashes.size() + hashes.padding_needed_for(mem::align_of::<(K, V)>()), diff --git a/src/libstd/env.rs b/src/libstd/env.rs index 1f3b264c414a2..dfa1eabf16fdb 100644 --- a/src/libstd/env.rs +++ b/src/libstd/env.rs @@ -479,7 +479,7 @@ pub struct JoinPathsError { /// ``` #[stable(feature = "env", since = "1.0.0")] pub fn join_paths(paths: I) -> Result - where I: IntoIterator, T: AsRef + where I: IntoIterator, T: AsRef { os_imp::join_paths(paths.into_iter()).map_err(|e| { JoinPathsError { inner: e } diff --git a/src/libstd/error.rs b/src/libstd/error.rs index f026cadd639c3..c770a965d0aac 100644 --- a/src/libstd/error.rs +++ b/src/libstd/error.rs @@ -566,7 +566,7 @@ impl Error for char::ParseCharError { // copied from any.rs impl dyn Error + 'static { - /// Returns true if the boxed type is the same as `T` + /// Returns whether the boxed type is the same as `T` #[stable(feature = "error_downcast", since = "1.3.0")] #[inline] pub fn is(&self) -> bool { diff --git a/src/libstd/f64.rs b/src/libstd/f64.rs index 2e0383ccef58e..57ce991e8ca3f 100644 --- a/src/libstd/f64.rs +++ b/src/libstd/f64.rs @@ -990,7 +990,7 @@ mod tests { assert_eq!(Fp::Zero, neg_zero.classify()); } - #[cfg_attr(all(target_arch = "wasm32", target_os = "emscripten"), ignore)] // issue 42630 + #[cfg_attr(all(target_arch = "wasm32", target_os = "emscripten"), ignore)] // issue #42630 #[test] fn test_one() { let one: f64 = 1.0f64; @@ -1043,7 +1043,7 @@ mod tests { assert!((-109.2f64).is_finite()); } - #[cfg_attr(all(target_arch = "wasm32", target_os = "emscripten"), ignore)] // issue 42630 + #[cfg_attr(all(target_arch = "wasm32", target_os = "emscripten"), ignore)] // issue #42630 #[test] fn test_is_normal() { let nan: f64 = NAN; @@ -1061,7 +1061,7 @@ mod tests { assert!(!1e-308f64.is_normal()); } - #[cfg_attr(all(target_arch = "wasm32", target_os = "emscripten"), ignore)] // issue 42630 + #[cfg_attr(all(target_arch = "wasm32", target_os = "emscripten"), ignore)] // issue #42630 #[test] fn test_classify() { let nan: f64 = NAN; diff --git a/src/libstd/ffi/os_str.rs b/src/libstd/ffi/os_str.rs index f817689251324..e0469e910446a 100644 --- a/src/libstd/ffi/os_str.rs +++ b/src/libstd/ffi/os_str.rs @@ -834,7 +834,7 @@ impl PartialOrd for OsStr { } } -// FIXME (#19470): cannot provide PartialOrd for str until we +// FIXME(#19470): cannot provide PartialOrd for str until we // have more flexible coherence rules. #[stable(feature = "rust1", since = "1.0.0")] diff --git a/src/libstd/fs.rs b/src/libstd/fs.rs index 119b3f7f9f296..941335a1b186e 100644 --- a/src/libstd/fs.rs +++ b/src/libstd/fs.rs @@ -214,7 +214,7 @@ pub struct DirBuilder { /// How large a buffer to pre-allocate before reading the entire file. fn initial_buffer_size(file: &File) -> usize { // Allocate one extra byte so the buffer doesn't need to grow before the - // final `read` call at the end of the file. Don't worry about `usize` + // final `read` call at the end of the file. Don't worry about `usize` // overflow because reading will fail regardless in that case. file.metadata().map(|m| m.len() as usize + 1).unwrap_or(0) } diff --git a/src/libstd/keyword_docs.rs b/src/libstd/keyword_docs.rs index 4ca62cca94bc8..bb90874ead4cb 100644 --- a/src/libstd/keyword_docs.rs +++ b/src/libstd/keyword_docs.rs @@ -260,7 +260,7 @@ mod extern_keyword { } /// } /// /// fn generic_where(x: T) -> T -/// where T: std::ops::Add + Copy +/// where T: std::ops::Add + Copy /// { /// x + x + x /// } diff --git a/src/libstd/net/addr.rs b/src/libstd/net/addr.rs index 8ace11276586f..bd44ce8ddfd34 100644 --- a/src/libstd/net/addr.rs +++ b/src/libstd/net/addr.rs @@ -787,7 +787,7 @@ pub trait ToSocketAddrs { /// Returned iterator over socket addresses which this type may correspond /// to. #[stable(feature = "rust1", since = "1.0.0")] - type Iter: Iterator; + type Iter: Iterator; /// Converts this object to an iterator of resolved `SocketAddr`s. /// diff --git a/src/libstd/net/udp.rs b/src/libstd/net/udp.rs index 83459946ba6de..4f2e1010e291b 100644 --- a/src/libstd/net/udp.rs +++ b/src/libstd/net/udp.rs @@ -158,7 +158,7 @@ impl UdpSocket { /// This will return an error when the IP version of the local socket /// does not match that returned from [`ToSocketAddrs`]. /// - /// See for more details. + /// See issue #34202 for more details. /// /// [`ToSocketAddrs`]: ../../std/net/trait.ToSocketAddrs.html /// diff --git a/src/libstd/num.rs b/src/libstd/num.rs index c80b9a56704a7..9eb583f7de7c4 100644 --- a/src/libstd/num.rs +++ b/src/libstd/num.rs @@ -21,9 +21,9 @@ pub use core::num::{NonZeroU8, NonZeroU16, NonZeroU32, NonZeroU64, NonZeroU128, #[cfg(test)] pub fn test_num(ten: T, two: T) where T: PartialEq - + Add + Sub - + Mul + Div - + Rem + fmt::Debug + + Add + Sub + + Mul + Div + + Rem + fmt::Debug + Copy { assert_eq!(ten.add(two), ten + two); @@ -188,7 +188,7 @@ mod tests { #[test] fn test_pow() { - fn naive_pow + Copy>(one: T, base: T, exp: usize) -> T { + fn naive_pow + Copy>(one: T, base: T, exp: usize) -> T { (0..exp).fold(one, |acc, _| acc * base) } macro_rules! assert_pow { diff --git a/src/libstd/path.rs b/src/libstd/path.rs index 317a7d817db43..a1b7d28157505 100644 --- a/src/libstd/path.rs +++ b/src/libstd/path.rs @@ -91,7 +91,7 @@ use sys::path::{is_sep_byte, is_verbatim_sep, MAIN_SEP_STR, parse_prefix}; // // Parsing in this module is done by directly transmuting OsStr to [u8] slices, // taking advantage of the fact that OsStr always encodes ASCII characters -// as-is. Eventually, this transmutation should be replaced by direct uses of +// as-is. Eventually, this transmutation should be replaced by direct uses of // OsStr APIs for parsing, but it will take a while for those to become // available. @@ -1800,7 +1800,7 @@ impl Path { PathBuf::from(self.inner.to_os_string()) } - /// Returns `true` if the `Path` is absolute, i.e., if it is independent of + /// Returns whether the `Path` is absolute, i.e., if it is independent of /// the current directory. /// /// * On Unix, a path is absolute if it starts with the root, so @@ -1822,14 +1822,14 @@ impl Path { #[allow(deprecated)] pub fn is_absolute(&self) -> bool { if cfg!(target_os = "redox") { - // FIXME: Allow Redox prefixes + // FIXME: allow Redox prefixes self.has_root() || has_redox_scheme(self.as_u8_slice()) } else { self.has_root() && (cfg!(unix) || self.prefix().is_some()) } } - /// Returns `true` if the `Path` is relative, i.e., not absolute. + /// Returns whether the `Path` is relative, i.e., not absolute. /// /// See [`is_absolute`]'s documentation for more details. /// @@ -1851,7 +1851,7 @@ impl Path { self.components().prefix } - /// Returns `true` if the `Path` has a root. + /// Returns whether the `Path` has a root. /// /// * On Unix, a path has a root if it begins with `/`. /// diff --git a/src/libstd/process.rs b/src/libstd/process.rs index 1263ef82e4872..05e6c97402bec 100644 --- a/src/libstd/process.rs +++ b/src/libstd/process.rs @@ -427,7 +427,7 @@ impl Command { /// The search path to be used may be controlled by setting the /// `PATH` environment variable on the Command, /// but this has some implementation limitations on Windows - /// (see ). + /// (see issue #37519). /// /// # Examples /// @@ -507,7 +507,7 @@ impl Command { /// ``` #[stable(feature = "process", since = "1.0.0")] pub fn args(&mut self, args: I) -> &mut Command - where I: IntoIterator, S: AsRef + where I: IntoIterator, S: AsRef { for arg in args { self.arg(arg.as_ref()); diff --git a/src/libstd/sync/mpsc/blocking.rs b/src/libstd/sync/mpsc/blocking.rs index ae5a18adbb3c0..ba6e594803a05 100644 --- a/src/libstd/sync/mpsc/blocking.rs +++ b/src/libstd/sync/mpsc/blocking.rs @@ -72,7 +72,7 @@ impl WaitToken { } } - /// Returns true if we wake up normally, false otherwise. + /// Returns whether we wake up normally. pub fn wait_max_until(self, end: Instant) -> bool { while !self.inner.woken.load(Ordering::SeqCst) { let now = Instant::now(); diff --git a/src/libstd/sync/mpsc/shared.rs b/src/libstd/sync/mpsc/shared.rs index af538b75b701d..057649f2824ea 100644 --- a/src/libstd/sync/mpsc/shared.rs +++ b/src/libstd/sync/mpsc/shared.rs @@ -102,7 +102,7 @@ impl Packet { // up and rather only wake them up at the appropriate time. This // implementation of shared channels assumes that any blocking // recv() will undo the increment of steals performed in try_recv() - // once the recv is complete. This thread that we're inheriting, + // once the recv is complete. This thread that we're inheriting, // however, is not in the middle of recv. Hence, the first time we // wake them up, they're going to wake up from their old port, move // on to the upgraded port, and then call the block recv() function. @@ -237,7 +237,7 @@ impl Packet { } // Essentially the exact same thing as the stream decrement function. - // Returns true if blocking should proceed. + // Returns whether blocking should proceed. fn decrement(&self, token: SignalToken) -> StartResult { unsafe { assert_eq!(self.to_wake.load(Ordering::SeqCst), 0); @@ -269,7 +269,7 @@ impl Packet { // This is a bit of an interesting case. The channel is reported as // having data available, but our pop() has failed due to the queue - // being in an inconsistent state. This means that there is some + // being in an inconsistent state. This means that there is some // pusher somewhere which has yet to complete, but we are guaranteed // that a pop will eventually succeed. In this case, we spin in a // yield loop because the remote sender should finish their enqueue diff --git a/src/libstd/sync/mutex.rs b/src/libstd/sync/mutex.rs index 856bb26042490..f377fe0ea0723 100644 --- a/src/libstd/sync/mutex.rs +++ b/src/libstd/sync/mutex.rs @@ -335,7 +335,7 @@ impl Mutex { /// Returns a mutable reference to the underlying data. /// /// Since this call borrows the `Mutex` mutably, no actual locking needs to - /// take place---the mutable borrow statically guarantees no locks exist. + /// take place -- the mutable borrow statically guarantees no locks exist. /// /// # Errors /// diff --git a/src/libstd/sync/once.rs b/src/libstd/sync/once.rs index fcab2ffe1444c..fe9576b209292 100644 --- a/src/libstd/sync/once.rs +++ b/src/libstd/sync/once.rs @@ -228,7 +228,7 @@ impl Once { /// result in an immediate panic. If `f` panics, the `Once` will remain /// in a poison state. If `f` does _not_ panic, the `Once` will no /// longer be in a poison state and all future calls to `call_once` or - /// `call_one_force` will no-op. + /// `call_one_force` will noop. /// /// The closure `f` is yielded a [`OnceState`] structure which can be used /// to query the poison status of the `Once`. @@ -279,7 +279,7 @@ impl Once { }); } - /// Returns true if some `call_once` call has completed + /// Returns whether some `call_once` call has completed /// successfully. Specifically, `is_completed` will return false in /// the following situations: /// * `call_once` was not called at all, diff --git a/src/libstd/sync/rwlock.rs b/src/libstd/sync/rwlock.rs index 7fbe0b8c19900..5f989f91be846 100644 --- a/src/libstd/sync/rwlock.rs +++ b/src/libstd/sync/rwlock.rs @@ -384,7 +384,7 @@ impl RwLock { /// Returns a mutable reference to the underlying data. /// /// Since this call borrows the `RwLock` mutably, no actual locking needs to - /// take place---the mutable borrow statically guarantees no locks exist. + /// take place -- the mutable borrow statically guarantees no locks exist. /// /// # Errors /// diff --git a/src/libstd/sys/cloudabi/abi/bitflags.rs b/src/libstd/sys/cloudabi/abi/bitflags.rs index f764cc1df5a5c..be76496e12e34 100644 --- a/src/libstd/sys/cloudabi/abi/bitflags.rs +++ b/src/libstd/sys/cloudabi/abi/bitflags.rs @@ -12,7 +12,7 @@ // THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) diff --git a/src/libstd/sys/cloudabi/abi/cloudabi.rs b/src/libstd/sys/cloudabi/abi/cloudabi.rs index cd9a5ad448f58..c467036d57fd1 100644 --- a/src/libstd/sys/cloudabi/abi/cloudabi.rs +++ b/src/libstd/sys/cloudabi/abi/cloudabi.rs @@ -12,7 +12,7 @@ // THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) diff --git a/src/libstd/sys/redox/ext/fs.rs b/src/libstd/sys/redox/ext/fs.rs index 04edfd6851dde..0048609e32c32 100644 --- a/src/libstd/sys/redox/ext/fs.rs +++ b/src/libstd/sys/redox/ext/fs.rs @@ -274,10 +274,10 @@ pub trait FileTypeExt { #[stable(feature = "file_type_ext", since = "1.5.0")] impl FileTypeExt for fs::FileType { - fn is_block_device(&self) -> bool { false /*FIXME: Implement block device mode*/ } - fn is_char_device(&self) -> bool { false /*FIXME: Implement char device mode*/ } - fn is_fifo(&self) -> bool { false /*FIXME: Implement fifo mode*/ } - fn is_socket(&self) -> bool { false /*FIXME: Implement socket mode*/ } + fn is_block_device(&self) -> bool { false /*FIXME: implement block device mode*/ } + fn is_char_device(&self) -> bool { false /*FIXME: implement char device mode*/ } + fn is_fifo(&self) -> bool { false /*FIXME: implement fifo mode*/ } + fn is_socket(&self) -> bool { false /*FIXME: implement socket mode*/ } } /// Creates a new symbolic link on the filesystem. diff --git a/src/libstd/sys/redox/ext/net.rs b/src/libstd/sys/redox/ext/net.rs index 76c68829b7f1b..cd8ecde842ca5 100644 --- a/src/libstd/sys/redox/ext/net.rs +++ b/src/libstd/sys/redox/ext/net.rs @@ -60,7 +60,7 @@ impl SocketAddr { None } - /// Returns true if and only if the address is unnamed. + /// Returns whether the address is unnamed. /// /// # Examples /// diff --git a/src/libstd/sys/redox/os.rs b/src/libstd/sys/redox/os.rs index f7a26c9497025..fc4a2323e68ae 100644 --- a/src/libstd/sys/redox/os.rs +++ b/src/libstd/sys/redox/os.rs @@ -80,7 +80,7 @@ impl<'a> Iterator for SplitPaths<'a> { pub struct JoinPathsError; pub fn join_paths(paths: I) -> Result - where I: Iterator, T: AsRef + where I: Iterator, T: AsRef { let mut joined = Vec::new(); let sep = b';'; diff --git a/src/libstd/sys/redox/path.rs b/src/libstd/sys/redox/path.rs index a7a8b03c8b1f6..0ceb14eb4fa16 100644 --- a/src/libstd/sys/redox/path.rs +++ b/src/libstd/sys/redox/path.rs @@ -14,7 +14,7 @@ pub fn is_verbatim_sep(b: u8) -> bool { pub fn parse_prefix(path: &OsStr) -> Option { if let Some(path_str) = path.to_str() { if let Some(_i) = path_str.find(':') { - // FIXME: Redox specific prefix + // FIXME: redox specific prefix // Some(Prefix::Verbatim(OsStr::new(&path_str[..i]))) None } else { diff --git a/src/libstd/sys/redox/pipe.rs b/src/libstd/sys/redox/pipe.rs index 9e40eadb2370e..317ece6d2a2a2 100644 --- a/src/libstd/sys/redox/pipe.rs +++ b/src/libstd/sys/redox/pipe.rs @@ -36,8 +36,8 @@ pub fn read2(p1: AnonPipe, v1: &mut Vec, p2: AnonPipe, v2: &mut Vec) -> io::Result<()> { - //FIXME: Use event based I/O multiplexing - //unimplemented!() + // FIXME: use event based I/O multiplexing. + //unimplemented!(); p1.0.read_to_end(v1)?; p2.0.read_to_end(v2)?; diff --git a/src/libstd/sys/redox/process.rs b/src/libstd/sys/redox/process.rs index 4199ab98cf17e..5a2e05ea956e1 100644 --- a/src/libstd/sys/redox/process.rs +++ b/src/libstd/sys/redox/process.rs @@ -358,7 +358,7 @@ impl Command { interpreter.pop().unwrap(); } - // FIXME: Here we could just reassign `file` directly, if it + // FIXME: here we could just reassign `file` directly, if it // wasn't for lexical lifetimes. Remove the whole `let // interpreter = { ... };` hack once NLL lands. // NOTE: Although DO REMEMBER to make sure the interpreter path diff --git a/src/libstd/sys/sgx/abi/usercalls/alloc.rs b/src/libstd/sys/sgx/abi/usercalls/alloc.rs index 8d0013a235ac7..72c9a9f231a90 100644 --- a/src/libstd/sys/sgx/abi/usercalls/alloc.rs +++ b/src/libstd/sys/sgx/abi/usercalls/alloc.rs @@ -63,44 +63,49 @@ pub unsafe trait UserSafe { /// Construct a pointer to `Self` given a memory range in user space. /// - /// NB. This takes a size, not a length! + /// N.B., this takes a size, not a length! /// /// # Safety + /// /// The caller must ensure the memory range is in user memory, is the /// correct size and is correctly aligned and points to the right type. unsafe fn from_raw_sized_unchecked(ptr: *mut u8, size: usize) -> *mut Self; /// Construct a pointer to `Self` given a memory range. /// - /// NB. This takes a size, not a length! + /// N.B., this takes a size, not a length! /// /// # Safety + /// /// The caller must ensure the memory range points to the correct type. /// /// # Panics + /// /// This function panics if: /// - /// * The pointer is not aligned - /// * The pointer is null - /// * The pointed-to range is not in user memory + /// * the pointer is not aligned. + /// * the pointer is null. + /// * the pointed-to range is not in user memory. unsafe fn from_raw_sized(ptr: *mut u8, size: usize) -> NonNull { let ret = Self::from_raw_sized_unchecked(ptr, size); Self::check_ptr(ret); NonNull::new_unchecked(ret as _) } - /// Check if a pointer may point to Self in user memory. + /// Check if a pointer may point to `Self` in user memory. /// /// # Safety + /// /// The caller must ensure the memory range points to the correct type and /// length (if this is a slice). /// /// # Panics + /// /// This function panics if: /// - /// * The pointer is not aligned - /// * The pointer is null - /// * The pointed-to range is not in user memory + /// * the pointer is not aligned. + /// * the pointer is null. + /// * the pointed-to range is not in user memory. unsafe fn check_ptr(ptr: *const Self) { let is_aligned = |p| -> bool { 0 == (p as usize) & (Self::align_of() - 1) diff --git a/src/libstd/sys/sgx/abi/usercalls/raw.rs b/src/libstd/sys/sgx/abi/usercalls/raw.rs index 27aca7c0903de..8f61607395c74 100644 --- a/src/libstd/sys/sgx/abi/usercalls/raw.rs +++ b/src/libstd/sys/sgx/abi/usercalls/raw.rs @@ -15,11 +15,13 @@ extern "C" { /// Perform the raw usercall operation as defined in the ABI calling convention. /// /// # Safety +/// /// The caller must ensure to pass parameters appropriate for the usercall `nr` /// and to observe all requirements specified in the ABI. /// /// # Panics -/// Panics if `nr` is 0. +/// +/// Panics if `nr` is `0`. #[unstable(feature = "sgx_platform", issue = "56975")] pub unsafe fn do_usercall(nr: u64, p1: u64, p2: u64, p3: u64, p4: u64) -> (u64, u64) { if nr==0 { panic!("Invalid usercall number {}",nr) } diff --git a/src/libstd/sys/sgx/os.rs b/src/libstd/sys/sgx/os.rs index b1e4d371a6779..a240ebb5bf8ca 100644 --- a/src/libstd/sys/sgx/os.rs +++ b/src/libstd/sys/sgx/os.rs @@ -52,7 +52,7 @@ impl<'a> Iterator for SplitPaths<'a> { pub struct JoinPathsError; pub fn join_paths(_paths: I) -> Result - where I: Iterator, T: AsRef + where I: Iterator, T: AsRef { Err(JoinPathsError) } diff --git a/src/libstd/sys/sgx/stdio.rs b/src/libstd/sys/sgx/stdio.rs index 6f206cd9a51d7..9d48cc9ab3398 100644 --- a/src/libstd/sys/sgx/stdio.rs +++ b/src/libstd/sys/sgx/stdio.rs @@ -62,7 +62,7 @@ impl io::Write for Stderr { pub const STDIN_BUF_SIZE: usize = ::sys_common::io::DEFAULT_BUF_SIZE; pub fn is_ebadf(err: &io::Error) -> bool { - // FIXME: Rust normally maps Unix EBADF to `Other` + // FIXME: rust normally maps Unix EBADF to `Other` err.raw_os_error() == Some(abi::Error::BrokenPipe as _) } diff --git a/src/libstd/sys/sgx/waitqueue.rs b/src/libstd/sys/sgx/waitqueue.rs index a47382087782d..fd2c4cb824acb 100644 --- a/src/libstd/sys/sgx/waitqueue.rs +++ b/src/libstd/sys/sgx/waitqueue.rs @@ -402,7 +402,7 @@ mod unsafe_list { } /// Trivial spinlock-based implementation of `sync::Mutex`. -// FIXME: Perhaps use Intel TSX to avoid locking? +// FIXME: perhaps use Intel TSX to avoid locking? mod spin_mutex { use cell::UnsafeCell; use sync::atomic::{AtomicBool, Ordering, spin_loop_hint}; diff --git a/src/libstd/sys/unix/condvar.rs b/src/libstd/sys/unix/condvar.rs index 3e048d5c6e4f3..9af779fc383fa 100644 --- a/src/libstd/sys/unix/condvar.rs +++ b/src/libstd/sys/unix/condvar.rs @@ -133,7 +133,7 @@ impl Condvar { } // First, figure out what time it currently is, in both system and - // stable time. pthread_cond_timedwait uses system time, but we want to + // stable time. `pthread_cond_timedwait` uses system time, but we want to // report timeout based on stable time. let mut sys_now = libc::timeval { tv_sec: 0, tv_usec: 0 }; let stable_now = Instant::now(); diff --git a/src/libstd/sys/unix/ext/net.rs b/src/libstd/sys/unix/ext/net.rs index a3ae5943f6038..518b66b39e52f 100644 --- a/src/libstd/sys/unix/ext/net.rs +++ b/src/libstd/sys/unix/ext/net.rs @@ -134,7 +134,7 @@ impl SocketAddr { }) } - /// Returns true if and only if the address is unnamed. + /// Returns whether the address is unnamed. /// /// # Examples /// diff --git a/src/libstd/sys/unix/fs.rs b/src/libstd/sys/unix/fs.rs index 5183d6fadd218..c281f7cca7361 100644 --- a/src/libstd/sys/unix/fs.rs +++ b/src/libstd/sys/unix/fs.rs @@ -633,7 +633,7 @@ impl fmt::Debug for File { #[cfg(target_os = "macos")] fn get_path(fd: c_int) -> Option { - // FIXME: The use of PATH_MAX is generally not encouraged, but it + // FIXME: the use of `PATH_MAX` is generally not encouraged, but it // is inevitable in this case because macOS defines `fcntl` with // `F_GETPATH` in terms of `MAXPATHLEN`, and there are no // alternatives. If a better method is invented, it should be used diff --git a/src/libstd/sys/unix/mod.rs b/src/libstd/sys/unix/mod.rs index b36c117fd09d4..1665ede0db3d6 100644 --- a/src/libstd/sys/unix/mod.rs +++ b/src/libstd/sys/unix/mod.rs @@ -146,10 +146,10 @@ pub fn cvt_r(mut f: F) -> io::Result } } -// On Unix-like platforms, libc::abort will unregister signal handlers -// including the SIGABRT handler, preventing the abort from being blocked, and +// On Unix-like platforms, `libc::abort` will unregister signal handlers +// including the `SIGABRT` handler, preventing the abort from being blocked, and // fclose streams, with the side effect of flushing them so libc bufferred -// output will be printed. Additionally the shell will generally print a more +// output will be printed. Additionally the shell will generally print a more // understandable error message like "Abort trap" rather than "Illegal // instruction" that intrinsics::abort would cause, as intrinsics::abort is // implemented as an illegal instruction. diff --git a/src/libstd/sys/unix/net.rs b/src/libstd/sys/unix/net.rs index d780d71c37693..69ebe08bf71e7 100644 --- a/src/libstd/sys/unix/net.rs +++ b/src/libstd/sys/unix/net.rs @@ -359,17 +359,17 @@ impl IntoInner for Socket { } // In versions of glibc prior to 2.26, there's a bug where the DNS resolver -// will cache the contents of /etc/resolv.conf, so changes to that file on disk +// will cache the contents of `/etc/resolv.conf`, so changes to that file on disk // can be ignored by a long-running program. That can break DNS lookups on e.g. // laptops where the network comes and goes. See -// https://sourceware.org/bugzilla/show_bug.cgi?id=984. Note however that some +// . Note however that some // distros including Debian have patched glibc to fix this for a long time. // // A workaround for this bug is to call the res_init libc function, to clear // the cached configs. Unfortunately, while we believe glibc's implementation // of res_init is thread-safe, we know that other implementations are not -// (https://github.com/rust-lang/rust/issues/43592). Code here in libstd could -// try to synchronize its res_init calls with a Mutex, but that wouldn't +// (issue #43592). Code here in libstd could +// try to synchronize its `res_init` calls with a `Mutex`, but that wouldn't // protect programs that call into libc in other ways. So instead of calling // res_init unconditionally, we call it only when we detect we're linking // against glibc version < 2.26. (That is, when we both know its needed and diff --git a/src/libstd/sys/unix/os.rs b/src/libstd/sys/unix/os.rs index 58ea190fcc004..6a3f10c76d611 100644 --- a/src/libstd/sys/unix/os.rs +++ b/src/libstd/sys/unix/os.rs @@ -173,7 +173,7 @@ impl<'a> Iterator for SplitPaths<'a> { pub struct JoinPathsError; pub fn join_paths(paths: I) -> Result - where I: Iterator, T: AsRef + where I: Iterator, T: AsRef { let mut joined = Vec::new(); let sep = b':'; diff --git a/src/libstd/sys/unix/process/process_fuchsia.rs b/src/libstd/sys/unix/process/process_fuchsia.rs index 5582310adbf74..e56f9009a7c8e 100644 --- a/src/libstd/sys/unix/process/process_fuchsia.rs +++ b/src/libstd/sys/unix/process/process_fuchsia.rs @@ -35,7 +35,7 @@ impl Command { match self.setup_io(default, true) { Ok((_, _)) => { - // FIXME: This is tough because we don't support the exec syscalls + // FIXME: this is tough because we don't support the exec syscalls unimplemented!(); }, Err(e) => e, @@ -89,7 +89,7 @@ impl Command { &mut process_handle, ptr::null_mut(), ))?; - // FIXME: See if we want to do something with that err_msg + // FIXME: see if we want to do something with that err_msg Ok(process_handle) } diff --git a/src/libstd/sys/unix/process/zircon.rs b/src/libstd/sys/unix/process/zircon.rs index 690c745218b64..6b3b487faabc7 100644 --- a/src/libstd/sys/unix/process/zircon.rs +++ b/src/libstd/sys/unix/process/zircon.rs @@ -159,7 +159,7 @@ pub const FDIO_SPAWN_ACTION_TRANSFER_FD: u32 = 0x0002; #[allow(unused)] pub const ERR_CALL_FAILED: zx_status_t = -5; // ERR_INTERRUPTED_RETRY: The system call was interrupted, but should be -// retried. This should not be seen outside of the VDSO. +// retried. This should not be seen outside of the VDSO. #[allow(unused)] pub const ERR_INTERRUPTED_RETRY: zx_status_t = -6; // ======= Parameter errors ======= diff --git a/src/libstd/sys/unix/thread.rs b/src/libstd/sys/unix/thread.rs index e29557f1ba29b..74fca656d31ec 100644 --- a/src/libstd/sys/unix/thread.rs +++ b/src/libstd/sys/unix/thread.rs @@ -55,7 +55,7 @@ impl Thread { n => { assert_eq!(n, libc::EINVAL); // EINVAL means |stack_size| is either too small or not a - // multiple of the system page size. Because it's definitely + // multiple of the system page size. Because it's definitely // >= PTHREAD_STACK_MIN, it must be an alignment issue. // Round up to the nearest page and try again. let page_size = os::page_size(); @@ -303,10 +303,10 @@ pub mod guard { if cfg!(target_os = "linux") { // Linux doesn't allocate the whole stack right away, and // the kernel has its own stack-guard mechanism to fault - // when growing too close to an existing mapping. If we map + // when growing too close to an existing mapping. If we map // our own guard, then the kernel starts enforcing a rather // large gap above that, rendering much of the possible - // stack space useless. See #43052. + // stack space useless. See #43052. // // Instead, we'll just note where we expect rlimit to start // faulting, so our handler can report "stack overflow", and @@ -376,16 +376,16 @@ pub mod guard { let stackaddr = stackaddr as usize; ret = if cfg!(target_os = "freebsd") { - // FIXME does freebsd really fault *below* the guard addr? + // FIXME: does freebsd really fault *below* the guard addr? let guardaddr = stackaddr - guardsize; Some(guardaddr - PAGE_SIZE..guardaddr) } else if cfg!(target_os = "netbsd") { Some(stackaddr - guardsize..stackaddr) } else if cfg!(all(target_os = "linux", target_env = "gnu")) { // glibc used to include the guard area within the stack, as noted in the BUGS - // section of `man pthread_attr_getguardsize`. This has been corrected starting + // section of `man pthread_attr_getguardsize`. This has been corrected starting // with glibc 2.27, and in some distro backports, so the guard is now placed at the - // end (below) the stack. There's no easy way for us to know which we have at + // end (below) the stack. There's no easy way for us to know which we have at // runtime, so we'll just match any fault in the range right above or below the // stack base to call that fault a stack overflow. Some(stackaddr - guardsize..stackaddr + guardsize) @@ -400,7 +400,7 @@ pub mod guard { // glibc >= 2.15 has a __pthread_get_minstack() function that returns // PTHREAD_STACK_MIN plus however many bytes are needed for thread-local -// storage. We need that information to avoid blowing up when a small stack +// storage. We need that information to avoid blowing up when a small stack // is created in an application with big thread-local storage requirements. // See #6233 for rationale and details. #[cfg(target_os = "linux")] diff --git a/src/libstd/sys/wasm/os.rs b/src/libstd/sys/wasm/os.rs index 9b278dfb9f8b2..3f51d42c97a56 100644 --- a/src/libstd/sys/wasm/os.rs +++ b/src/libstd/sys/wasm/os.rs @@ -39,7 +39,7 @@ impl<'a> Iterator for SplitPaths<'a> { pub struct JoinPathsError; pub fn join_paths(_paths: I) -> Result - where I: Iterator, T: AsRef + where I: Iterator, T: AsRef { Err(JoinPathsError) } diff --git a/src/libstd/sys/windows/backtrace/printing/msvc.rs b/src/libstd/sys/windows/backtrace/printing/msvc.rs index b186bb423345c..6a81b2a9ed340 100644 --- a/src/libstd/sys/windows/backtrace/printing/msvc.rs +++ b/src/libstd/sys/windows/backtrace/printing/msvc.rs @@ -105,7 +105,7 @@ where unsafe { let mut info: c::SYMBOL_INFO = mem::zeroed(); info.MaxNameLen = c::MAX_SYM_NAME as c_ulong; - // the struct size in C. the value is different to + // the struct size in C. the value is different to // `size_of::() - MAX_SYM_NAME + 1` (== 81) // due to struct alignment. info.SizeOfStruct = 88; diff --git a/src/libstd/sys/windows/c.rs b/src/libstd/sys/windows/c.rs index 28fd4df386e99..036a9ebd3744c 100644 --- a/src/libstd/sys/windows/c.rs +++ b/src/libstd/sys/windows/c.rs @@ -786,7 +786,7 @@ pub struct M128A { #[cfg(target_arch = "x86_64")] #[repr(C, align(16))] pub struct FLOATING_SAVE_AREA { - _Dummy: [u8; 512] // FIXME: Fill this out + _Dummy: [u8; 512] // FIXME: fill this out. } #[cfg(target_arch = "arm")] diff --git a/src/libstd/sys/windows/handle.rs b/src/libstd/sys/windows/handle.rs index 855efbd3eb5d6..7d12e0f6ef085 100644 --- a/src/libstd/sys/windows/handle.rs +++ b/src/libstd/sys/windows/handle.rs @@ -160,6 +160,11 @@ impl RawHandle { } } + pub fn read_to_end(&self, buf: &mut Vec) -> io::Result { + let mut me = self; + (&mut me).read_to_end(buf) + } + pub fn write(&self, buf: &[u8]) -> io::Result { let mut amt = 0; let len = cmp::min(buf.len(), ::max_value() as usize) as c::DWORD; diff --git a/src/libstd/sys/windows/mod.rs b/src/libstd/sys/windows/mod.rs index e97e436efbf71..99916c25544ac 100644 --- a/src/libstd/sys/windows/mod.rs +++ b/src/libstd/sys/windows/mod.rs @@ -249,9 +249,9 @@ pub fn dur2timeout(dur: Duration) -> c::DWORD { }).unwrap_or(c::INFINITE) } -// On Windows, use the processor-specific __fastfail mechanism. In Windows 8 +// On Windows, use the processor-specific __fastfail mechanism. In Windows 8 // and later, this will terminate the process immediately without running any -// in-process exception handlers. In earlier versions of Windows, this +// in-process exception handlers. In earlier versions of Windows, this // sequence of instructions will be treated as an access violation, // terminating the process but without necessarily bypassing all exception // handlers. diff --git a/src/libstd/sys/windows/os.rs b/src/libstd/sys/windows/os.rs index 5f478827b43b1..ab90aee87557c 100644 --- a/src/libstd/sys/windows/os.rs +++ b/src/libstd/sys/windows/os.rs @@ -150,7 +150,7 @@ impl<'a> Iterator for SplitPaths<'a> { // Double quotes are used as a way of introducing literal semicolons // (since c:\some;dir is a valid Windows path). Double quotes are not // themselves permitted in path names, so there is no way to escape a - // double quote. Quoted regions can appear in arbitrary locations, so + // double quote. Quoted regions can appear in arbitrary locations, so // // c:\foo;c:\som"e;di"r;c:\bar // @@ -188,7 +188,7 @@ impl<'a> Iterator for SplitPaths<'a> { pub struct JoinPathsError; pub fn join_paths(paths: I) -> Result - where I: Iterator, T: AsRef + where I: Iterator, T: AsRef { let mut joined = Vec::new(); let sep = b';' as u16; diff --git a/src/libstd/sys/windows/pipe.rs b/src/libstd/sys/windows/pipe.rs index 2b1dbe310eea4..2897c9d6d0b42 100644 --- a/src/libstd/sys/windows/pipe.rs +++ b/src/libstd/sys/windows/pipe.rs @@ -106,7 +106,7 @@ pub fn anon_pipe(ours_readable: bool) -> io::Result { // Proper fix would increase the number of FFI imports and introduce // significant amount of Windows XP specific code with no clean // testing strategy - // For more info, see https://github.com/rust-lang/rust/pull/37677. + // For more info, see PR #37677. if handle == c::INVALID_HANDLE_VALUE { let err = io::Error::last_os_error(); let raw_os_err = err.raw_os_error(); diff --git a/src/libstd/sys/windows/stdio.rs b/src/libstd/sys/windows/stdio.rs index a4f4bd22cd921..f5cd2c2179b9d 100644 --- a/src/libstd/sys/windows/stdio.rs +++ b/src/libstd/sys/windows/stdio.rs @@ -75,7 +75,7 @@ fn write(handle: c::DWORD, data: &[u8]) -> io::Result { ptr::null_mut()) })?; - // FIXME if this only partially writes the utf16 buffer then we need to + // FIXME: if this only partially writes the utf16 buffer then we need to // figure out how many bytes of `data` were actually written assert_eq!(written as usize, utf16.len()); Ok(utf8.len()) @@ -128,6 +128,11 @@ impl Stdin { // MemReader shouldn't error here since we just filled it utf8.read(buf) } + + pub fn read_to_end(&self, buf: &mut Vec) -> io::Result { + let mut me = self; + (&mut me).read_to_end(buf) + } } #[unstable(reason = "not public", issue = "0", feature = "fd_read")] diff --git a/src/libstd/sys/windows/thread.rs b/src/libstd/sys/windows/thread.rs index bd7cb673a0dbe..5b601b5c810f1 100644 --- a/src/libstd/sys/windows/thread.rs +++ b/src/libstd/sys/windows/thread.rs @@ -18,17 +18,17 @@ pub struct Thread { } impl Thread { - // unsafe: see thread::Builder::spawn_unchecked for safety requirements + // Unsafe: see `thread::Builder::spawn_unchecked` for safety requirements. pub unsafe fn new(stack: usize, p: Box) -> io::Result { let p = box p; - // FIXME On UNIX, we guard against stack sizes that are too small but + // FIXME: on Unix, we guard against stack sizes that are too small but // that's because pthreads enforces that stacks are at least - // PTHREAD_STACK_MIN bytes big. Windows has no such lower limit, it's + // `PTHREAD_STACK_MIN` bytes big. Windows has no such lower limit, it's // just that below a certain threshold you can't do anything useful. // That threshold is application and architecture-specific, however. - // Round up to the next 64 kB because that's what the NT kernel does, + // Round up to the next 64kB because that's what the NT kernel does, // might as well make it explicit. let stack_size = (stack + 0xfffe) & (!0xfffe); let ret = c::CreateThread(ptr::null_mut(), stack_size, @@ -39,7 +39,8 @@ impl Thread { return if ret as usize == 0 { Err(io::Error::last_os_error()) } else { - mem::forget(p); // ownership passed to CreateThread + // Ownership passed to `CreateThread`. + mem::forget(p); Ok(Thread { handle: Handle::new(ret) }) }; diff --git a/src/libstd/sys_common/util.rs b/src/libstd/sys_common/util.rs index 7dec22be97808..42e58c128645c 100644 --- a/src/libstd/sys_common/util.rs +++ b/src/libstd/sys_common/util.rs @@ -10,8 +10,8 @@ pub fn dumb_print(args: fmt::Arguments) { } // Other platforms should use the appropriate platform-specific mechanism for -// aborting the process. If no platform-specific mechanism is available, -// ::intrinsics::abort() may be used instead. The above implementations cover +// aborting the process. If no platform-specific mechanism is available, +// ::intrinsics::abort() may be used instead. The above implementations cover // all targets currently supported by libstd. pub fn abort(args: fmt::Arguments) -> ! { diff --git a/src/libstd/sys_common/wtf8.rs b/src/libstd/sys_common/wtf8.rs index 7f355fa7ec23b..5e3e49b11d6d2 100644 --- a/src/libstd/sys_common/wtf8.rs +++ b/src/libstd/sys_common/wtf8.rs @@ -371,7 +371,7 @@ impl Wtf8Buf { /// This replaces surrogate code point pairs with supplementary code points, /// like concatenating ill-formed UTF-16 strings effectively would. impl FromIterator for Wtf8Buf { - fn from_iter>(iter: T) -> Wtf8Buf { + fn from_iter>(iter: T) -> Wtf8Buf { let mut string = Wtf8Buf::new(); string.extend(iter); string @@ -383,7 +383,7 @@ impl FromIterator for Wtf8Buf { /// This replaces surrogate code point pairs with supplementary code points, /// like concatenating ill-formed UTF-16 strings effectively would. impl Extend for Wtf8Buf { - fn extend>(&mut self, iter: T) { + fn extend>(&mut self, iter: T) { let iterator = iter.into_iter(); let (low, _high) = iterator.size_hint(); // Lower bound of one byte per code point (ASCII only) diff --git a/src/libstd/thread/mod.rs b/src/libstd/thread/mod.rs index a55b32c08a303..df9f692434fbc 100644 --- a/src/libstd/thread/mod.rs +++ b/src/libstd/thread/mod.rs @@ -841,7 +841,7 @@ const NOTIFIED: usize = 2; /// let flag2 = Arc::clone(&flag); /// /// let parked_thread = thread::spawn(move || { -/// // We want to wait until the flag is set. We *could* just spin, but using +/// // We want to wait until the flag is set. We *could* just spin, but using /// // park/unpark is more efficient. /// while !flag2.load(Ordering::Acquire) { /// println!("Parking thread"); diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index e3a8980a975c1..a26f03bb4832a 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -163,7 +163,7 @@ pub struct AngleBracketedArgs { pub args: Vec, /// Bindings (equality constraints) on associated types, if present. /// - /// E.g., `Foo`. + /// E.g., `Foo`. pub bindings: Vec, } @@ -179,7 +179,7 @@ impl Into>> for ParenthesisedArgs { } } -/// A path like `Foo(A,B) -> C` +/// A path like `Foo(A, B) -> C`. #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub struct ParenthesisedArgs { /// Overall span @@ -233,7 +233,7 @@ impl serialize::UseSpecializedDecodable for NodeId { } } -/// Node id used to represent the root of the crate. +/// Node-ID used to represent the root of the crate. pub const CRATE_NODE_ID: NodeId = NodeId::from_u32_const(0); /// When parsing and doing expansions, we initially give all AST nodes this AST @@ -696,7 +696,7 @@ impl BinOpKind { } } - /// Returns `true` if the binary operator takes its arguments by value + /// Returns whether the binary operator takes its arguments by value pub fn is_by_value(&self) -> bool { !self.is_comparison() } @@ -715,7 +715,7 @@ pub enum UnOp { } impl UnOp { - /// Returns `true` if the unary operator takes its argument by value + /// Returns whether the unary operator takes its argument by value pub fn is_by_value(u: UnOp) -> bool { match u { UnOp::Neg | UnOp::Not => true, @@ -1288,7 +1288,7 @@ pub enum LitKind { } impl LitKind { - /// Returns `true` if this literal is a string. + /// Returns whether this literal is a string. pub fn is_str(&self) -> bool { match *self { LitKind::Str(..) => true, @@ -1296,7 +1296,7 @@ impl LitKind { } } - /// Returns `true` if this literal is byte literal string. + /// Returns whether this literal is byte literal string. pub fn is_bytestr(&self) -> bool { match self { LitKind::ByteStr(_) => true, @@ -1304,7 +1304,7 @@ impl LitKind { } } - /// Returns `true` if this is a numeric literal. + /// Returns whether this is a numeric literal. pub fn is_numeric(&self) -> bool { match *self { LitKind::Int(..) | LitKind::Float(..) | LitKind::FloatUnsuffixed(..) => true, @@ -1312,7 +1312,7 @@ impl LitKind { } } - /// Returns `true` if this literal has no suffix. + /// Returns whether this literal has no suffix. /// Note: this will return true for literals with prefixes such as raw strings and byte strings. pub fn is_unsuffixed(&self) -> bool { match *self { @@ -1331,7 +1331,7 @@ impl LitKind { } } - /// Returns `true` if this literal has a suffix. + /// Returns whether this literal has a suffix. pub fn is_suffixed(&self) -> bool { !self.is_unsuffixed() } @@ -1980,7 +1980,7 @@ pub struct Attribute { /// Resolve maps each `TraitRef`'s `ref_id` to its defining trait; that's all /// that the `ref_id` is for. The `impl_id` maps to the "self type" of this impl. /// If this impl is an `ItemKind::Impl`, the `impl_id` is redundant (it could be the -/// same as the impl's node-id). +/// same as the impl's node-ID). #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub struct TraitRef { pub path: Path, diff --git a/src/libsyntax/attr/mod.rs b/src/libsyntax/attr/mod.rs index a309775a1a40b..89b079c2db99a 100644 --- a/src/libsyntax/attr/mod.rs +++ b/src/libsyntax/attr/mod.rs @@ -81,7 +81,7 @@ impl NestedMetaItem { self.span } - /// Returns true if this list item is a MetaItem with a name of `name`. + /// Returns whether this list item is a MetaItem with a name of `name`. pub fn check_name(&self, name: &str) -> bool { self.meta_item().map_or(false, |meta_item| meta_item.check_name(name)) } @@ -130,27 +130,27 @@ impl NestedMetaItem { self.meta_item().and_then(|meta_item| meta_item.meta_item_list()) } - /// Returns `true` if the variant is MetaItem. + /// Returns whether the variant is MetaItem. pub fn is_meta_item(&self) -> bool { self.meta_item().is_some() } - /// Returns `true` if the variant is Literal. + /// Returns whether the variant is Literal. pub fn is_literal(&self) -> bool { self.literal().is_some() } - /// Returns `true` if self is a MetaItem and the meta item is a word. + /// Returns whether self is a MetaItem and the meta item is a word. pub fn is_word(&self) -> bool { self.word().is_some() } - /// Returns `true` if self is a MetaItem and the meta item is a ValueString. + /// Returns whether self is a MetaItem and the meta item is a ValueString. pub fn is_value_str(&self) -> bool { self.value_str().is_some() } - /// Returns `true` if self is a MetaItem and the meta item is a list. + /// Returns whether self is a MetaItem and the meta item is a list. pub fn is_meta_item_list(&self) -> bool { self.meta_item_list().is_some() } @@ -479,7 +479,7 @@ impl MetaItem { fn from_tokens(tokens: &mut iter::Peekable) -> Option where I: Iterator, { - // FIXME: Share code with `parse_path`. + // FIXME: share code with `parse_path`. let ident = match tokens.next() { Some(TokenTree::Token(span, Token::Ident(ident, _))) => { if let Some(TokenTree::Token(_, Token::ModSep)) = tokens.peek() { diff --git a/src/libsyntax/config.rs b/src/libsyntax/config.rs index 9eebbedc0bc8c..7806dd5a82c6b 100644 --- a/src/libsyntax/config.rs +++ b/src/libsyntax/config.rs @@ -132,7 +132,7 @@ impl<'a> StripUnconfigured<'a> { // along the compilation. match (expanded_attrs.len(), gate_cfg_attr_multi) { (0, false) => { - // FIXME: Emit unused attribute lint here. + // FIXME: emit unused attribute lint here. }, (1, _) => {}, (_, true) => { diff --git a/src/libsyntax/diagnostic_list.rs b/src/libsyntax/diagnostic_list.rs index 548bf8b7f8a80..a07c1e34e3528 100644 --- a/src/libsyntax/diagnostic_list.rs +++ b/src/libsyntax/diagnostic_list.rs @@ -358,7 +358,7 @@ The `#[unwind]` attribute should be used as follows: should be allowed to unwind. This can easily result in Undefined Behavior (UB), so be careful. -NB. The default behavior here is "allowed", but this is unspecified +N.B., the default behavior here is "allowed", but this is unspecified and likely to change in the future. "##, diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index 2793754e1033a..560b82c3d78e6 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -173,7 +173,7 @@ impl MultiItemDecorator for F } // `meta_item` is the annotation, and `item` is the item being modified. -// FIXME Decorators should follow the same pattern too. +// FIXME: Decorators should follow the same pattern too. pub trait MultiItemModifier { fn expand(&self, ecx: &mut ExtCtxt, @@ -219,7 +219,7 @@ impl ProcMacro for F _span: Span, ts: TokenStream) -> TokenStream { - // FIXME setup implicit context in TLS before calling self. + // FIXME: setup implicit context in TLS before calling self. (*self)(ts) } } @@ -242,7 +242,7 @@ impl AttrProcMacro for F annotation: TokenStream, annotated: TokenStream) -> TokenStream { - // FIXME setup implicit context in TLS before calling self. + // FIXME: setup implicit context in TLS before calling self. (*self)(annotation, annotated) } } @@ -847,8 +847,8 @@ impl<'a> ExtCtxt<'a> { expand::MacroExpander::new(self, false) } - /// Returns a `Folder` that deeply expands all macros and assigns all node ids in an AST node. - /// Once node ids are assigned, the node may not be expanded, removed, or otherwise modified. + /// Returns a `Folder` that deeply expands all macros and assigns all node-IDs in an AST node. + /// Once node-IDs are assigned, the node may not be expanded, removed, or otherwise modified. pub fn monotonic_expander<'b>(&'b mut self) -> expand::MacroExpander<'b, 'a> { expand::MacroExpander::new(self, true) } diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs index a8eec1a74dd2b..347940a98e826 100644 --- a/src/libsyntax/ext/build.rs +++ b/src/libsyntax/ext/build.rs @@ -203,7 +203,7 @@ pub trait AstBuilder { name: Ident, attrs: Vec , node: ast::ItemKind) -> P; fn arg(&self, span: Span, name: Ident, ty: P) -> ast::Arg; - // FIXME unused self + // FIXME: unused self fn fn_decl(&self, inputs: Vec , output: ast::FunctionRetTy) -> P; fn item_fn_poly(&self, @@ -344,7 +344,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { /// Constructs a qualified path. /// - /// Constructs a path like `::ident<'a, T, A=Bar>`. + /// Constructs a path like `::ident<'a, T, A = Bar>`. fn qpath_all(&self, self_type: P, trait_path: ast::Path, @@ -923,7 +923,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { ids.iter().map(|id| self.arg(span, *id, self.ty_infer(span))).collect(), ast::FunctionRetTy::Default(span)); - // FIXME -- We are using `span` as the span of the `|...|` + // FIXME: we are using `span` as the span of the `|...|` // part of the lambda, but it probably (maybe?) corresponds to // the entire lambda body. Probably we should extend the API // here, but that's not entirely clear. @@ -967,7 +967,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { } } - // FIXME unused self + // FIXME: unused self fn fn_decl(&self, inputs: Vec, output: ast::FunctionRetTy) -> P { P(ast::FnDecl { inputs, @@ -978,7 +978,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { fn item(&self, span: Span, name: Ident, attrs: Vec, node: ast::ItemKind) -> P { - // FIXME: Would be nice if our generated code didn't violate + // FIXME: would be nice if our generated code didn't violate // Rust coding conventions P(ast::Item { ident: name, diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index 9369e66cf83da..f26f2dfee3909 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -34,7 +34,7 @@ macro_rules! ast_fragments { ( $($Kind:ident($AstTy:ty) { $kind_name:expr; - // FIXME: HACK: this should be `$(one ...)?` and `$(many ...)?` but `?` macro + // HACK: this should be `$(one ...)?` and `$(many ...)?` but `?` macro // repetition was removed from 2015 edition in #51587 because of ambiguities. $(one fn $fold_ast:ident; fn $visit_ast:ident;)* $(many fn $fold_ast_elt:ident; fn $visit_ast_elt:ident;)* @@ -829,11 +829,11 @@ impl<'a, 'b> MacroExpander<'a, 'b> { self.gate_proc_macro_expansion_kind(span, kind); invoc.expansion_data.mark.set_expn_info(ExpnInfo { call_site: span, - // FIXME procedural macros do not have proper span info + // FIXME: procedural macros do not have proper span info // yet, when they do, we should use it here. def_site: None, format: macro_bang_format(path), - // FIXME probably want to follow macro_rules macros here. + // FIXME: probably want to follow macro_rules macros here. allow_internal_unstable, allow_internal_unsafe: false, local_inner_macros: false, diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs index ad8668aca70f9..2c1588848e5be 100644 --- a/src/libsyntax/ext/quote.rs +++ b/src/libsyntax/ext/quote.rs @@ -219,7 +219,7 @@ pub mod rt { impl ToTokens for ast::Attribute { fn to_tokens(&self, _cx: &ExtCtxt) -> Vec { let mut r = vec![]; - // FIXME: The spans could be better + // FIXME: the spans could be better r.push(TokenTree::Token(self.span, token::Pound)); if self.style == ast::AttrStyle::Inner { r.push(TokenTree::Token(self.span, token::Not)); @@ -260,7 +260,7 @@ pub mod rt { impl ToTokens for ast::Lit { fn to_tokens(&self, cx: &ExtCtxt) -> Vec { - // FIXME: This is wrong + // FIXME: this is wrong P(ast::Expr { id: ast::DUMMY_NODE_ID, node: ast::ExprKind::Lit(self.clone()), @@ -771,13 +771,13 @@ fn parse_arguments_to_quote(cx: &ExtCtxt, tts: &[TokenTree]) } fn mk_stmts_let(cx: &ExtCtxt, sp: Span) -> Vec { - // We also bind a single value, sp, to ext_cx.call_site() + // We also bind a single value, `sp`, to `ext_cx.call_site()`. // // This causes every span in a token-tree quote to be attributed to the // call site of the extension using the quote. We can't really do much // better since the source of the quote may well be in a library that // was not even parsed by this compilation run, that the user has no - // source code for (eg. in libsyntax, which they're just _using_). + // source code for (e.g., in libsyntax, which they're just _using_). // // The old quasiquoter had an elaborate mechanism for denoting input // file locations from which quotes originated; unfortunately this @@ -788,7 +788,7 @@ fn mk_stmts_let(cx: &ExtCtxt, sp: Span) -> Vec { // the site the string literal occurred, which was in a source file // _other_ than the one the user has control over. For example, an // error in a quote from the protocol compiler, invoked in user code - // using macro_rules! for example, will be attributed to the macro_rules.rs + // using macro_rules! for example, will be attributed to the `macro_rules.rs` // file in libsyntax, which the user might not even have source to (unless // they happen to have a compiler on hand). Over all, the phase distinction // just makes quotes "hard to attribute". Possibly this could be fixed diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs index cb8fbce66978b..884431672feb7 100644 --- a/src/libsyntax/ext/tt/macro_rules.rs +++ b/src/libsyntax/ext/tt/macro_rules.rs @@ -783,7 +783,7 @@ fn check_matcher_core(sess: &ParseSess, // case, we make a temp copy of suffix and stuff // delimiter in there. // - // FIXME: Should I first scan suffix_first to see if + // FIXME: should I first scan suffix_first to see if // delimiter is already in it before I go through the // work of cloning it? But then again, this way I may // get a "tighter" span? diff --git a/src/libsyntax/ext/tt/quoted.rs b/src/libsyntax/ext/tt/quoted.rs index b56871a18857f..4bf357a4ade87 100644 --- a/src/libsyntax/ext/tt/quoted.rs +++ b/src/libsyntax/ext/tt/quoted.rs @@ -106,7 +106,7 @@ impl TokenTree { } } - /// Returns true if the given token tree contains no other tokens. This is vacuously true for + /// Returns whether the given token tree contains no other tokens. This is vacuously true for /// single tokens or metavar/decls, but may be false for delimited trees or sequences. pub fn is_empty(&self) -> bool { match *self { diff --git a/src/libsyntax/ext/tt/transcribe.rs b/src/libsyntax/ext/tt/transcribe.rs index 31d87508c6bca..f6ad72273c4d5 100644 --- a/src/libsyntax/ext/tt/transcribe.rs +++ b/src/libsyntax/ext/tt/transcribe.rs @@ -120,13 +120,13 @@ pub fn transcribe(cx: &ExtCtxt, variables matched as repeating at this depth"); } LockstepIterSize::Contradiction(ref msg) => { - // FIXME #2887 blame macro invoker instead + // FIXME(#2887): blame macro invoker instead cx.span_fatal(sp.entire(), &msg[..]); } LockstepIterSize::Constraint(len, _) => { if len == 0 { if seq.op == quoted::KleeneOp::OneOrMore { - // FIXME #2887 blame invoker + // FIXME(#2887): blame invoker cx.span_fatal(sp.entire(), "this must repeat at least once"); } } else { @@ -140,7 +140,7 @@ pub fn transcribe(cx: &ExtCtxt, } } } - // FIXME #2887: think about span stuff here + // FIXME(#2887): think about span stuff here quoted::TokenTree::MetaVar(mut sp, ident) => { if let Some(cur_matched) = lookup_cur_matched(ident, &interpolations, &repeats) { if let MatchedNonterminal(ref nt) = *cur_matched { diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 3f2122e24a642..33a8f60d80674 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -1300,7 +1300,7 @@ pub fn check_attribute(attr: &ast::Attribute, parse_sess: &ParseSess, features: fn find_lang_feature_issue(feature: &str) -> Option { if let Some(info) = ACTIVE_FEATURES.iter().find(|t| t.0 == feature) { let issue = info.2; - // FIXME (#28244): enforce that active features have issue numbers + // FIXME(#28244): enforce that active features have issue numbers // assert!(issue.is_some()) issue } else { diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs index 8ac103856dcd1..d1061f530d983 100644 --- a/src/libsyntax/fold.rs +++ b/src/libsyntax/fold.rs @@ -1356,7 +1356,7 @@ pub fn noop_fold_expr(Expr {id, node, span, attrs}: Expr, folder: &mu ExprKind::Paren(ex) => { let sub_expr = folder.fold_expr(ex); return Expr { - // Nodes that are equal modulo `Paren` sugar no-ops should have the same ids. + // Nodes that are equal modulo `Paren` sugar noops should have the same ids. id: sub_expr.id, node: ExprKind::Paren(sub_expr), span: folder.new_span(span), diff --git a/src/libsyntax/json.rs b/src/libsyntax/json.rs index ea0fe712d16e0..cf11ac550b763 100644 --- a/src/libsyntax/json.rs +++ b/src/libsyntax/json.rs @@ -7,7 +7,7 @@ //! The format of the JSON output should be considered *unstable*. For now the //! structs at the end of this file (Diagnostic*) specify the error format. -// FIXME spec the JSON output properly. +// FIXME: spec the JSON output properly. use source_map::{SourceMap, FilePathMapping}; use syntax_pos::{self, MacroBacktrace, Span, SpanLabel, MultiSpan}; diff --git a/src/libsyntax/parse/classify.rs b/src/libsyntax/parse/classify.rs index a1cdfd9146a1e..19ae480e75187 100644 --- a/src/libsyntax/parse/classify.rs +++ b/src/libsyntax/parse/classify.rs @@ -1,6 +1,6 @@ -//! Routines the parser uses to classify AST nodes +//! Routines the parser uses to classify AST nodes. -// Predicates on exprs and stmts that the pretty-printer and parser use +// Predicates on expressions and statements that the pretty-printer and parser use. use ast; diff --git a/src/libsyntax/parse/lexer/comments.rs b/src/libsyntax/parse/lexer/comments.rs index ffc480d829d89..703d2b07a9497 100644 --- a/src/libsyntax/parse/lexer/comments.rs +++ b/src/libsyntax/parse/lexer/comments.rs @@ -192,9 +192,9 @@ fn read_line_comments(rdr: &mut StringReader, } } -/// Returns None if the first col chars of s contain a non-whitespace char. -/// Otherwise returns Some(k) where k is first char offset after that leading -/// whitespace. Note k may be outside bounds of s. +/// Returns `None` if the first `col` chars of `s` contain a non-whitespace char. +/// Otherwise returns `Some(k)` where `k` is first char offset after that leading +/// whitespace. Note that `k` may be outside bounds of `s`. fn all_whitespace(s: &str, col: CharPos) -> Option { let mut idx = 0; for (i, ch) in s.char_indices().take(col.to_usize()) { @@ -243,7 +243,7 @@ fn read_block_comment(rdr: &mut StringReader, let mut curr_line = String::from("/*"); - // doc-comments are not really comments, they are attributes + // Doc-comments are not really comments; they are attributes. if (rdr.ch_is('*') && !rdr.nextch_is('*')) || rdr.ch_is('!') { while !(rdr.ch_is('*') && rdr.nextch_is('/')) && !rdr.is_eof() { curr_line.push(rdr.ch.unwrap()); @@ -368,7 +368,7 @@ pub fn gather_comments_and_literals(sess: &ParseSess, path: FileName, srdr: &mut code_to_the_left = false; anything_to_the_left = false; } - // Eat one comment group + // Eat one comment group. if rdr.peeking_at_comment() { consume_comment(&mut rdr, &mut comments, &mut code_to_the_left, &mut anything_to_the_left); @@ -379,7 +379,7 @@ pub fn gather_comments_and_literals(sess: &ParseSess, path: FileName, srdr: &mut let bstart = rdr.pos; rdr.next_token(); - // discard, and look ahead; we're working with internal state + // Discard, and look ahead; we're working with internal state. let TokenAndSpan { tok, sp } = rdr.peek(); if tok.is_lit() { rdr.with_str_from(bstart, |s| { diff --git a/src/libsyntax/parse/lexer/mod.rs b/src/libsyntax/parse/lexer/mod.rs index d13de0029682e..1d0f7fb2ea822 100644 --- a/src/libsyntax/parse/lexer/mod.rs +++ b/src/libsyntax/parse/lexer/mod.rs @@ -561,8 +561,8 @@ impl<'a> StringReader<'a> { .warn("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 #42326 \ - ") + .note("for more information, see \ + ") .emit(); None } else { @@ -652,7 +652,7 @@ impl<'a> StringReader<'a> { let loc = smap.lookup_char_pos_adj(self.pos); debug!("Skipping a shebang"); if loc.line == 1 && loc.col == CharPos(0) { - // FIXME: Add shebang "token", return it + // FIXME: add shebang "token", return it let start = self.pos; while !self.ch_is('\n') && !self.is_eof() { self.bump(); @@ -920,7 +920,7 @@ impl<'a> StringReader<'a> { /// in a byte, (non-raw) byte string, char, or (non-raw) string literal. /// `start` is the position of `first_source_char`, which is already consumed. /// - /// Returns true if there was a valid char/byte, false otherwise. + /// Returns whether there was a valid char/byte. fn scan_char_or_byte(&mut self, start: BytePos, first_source_char: char, diff --git a/src/libsyntax/parse/lexer/unicode_chars.rs b/src/libsyntax/parse/lexer/unicode_chars.rs index c31756714a6c3..9c1e714c2cd1f 100644 --- a/src/libsyntax/parse/lexer/unicode_chars.rs +++ b/src/libsyntax/parse/lexer/unicode_chars.rs @@ -1,5 +1,5 @@ -// Characters and their corresponding confusables were collected from -// http://www.unicode.org/Public/security/10.0.0/confusables.txt +// Characters and their corresponding confusables were collected from. +// See for more details. use syntax_pos::{Span, NO_EXPANSION}; use errors::{Applicability, DiagnosticBuilder}; diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index ba5676a65d7eb..e600b38089cc8 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -1,4 +1,4 @@ -//! The main parser interface +//! The main parser interface. use rustc_data_structures::sync::{Lrc, Lock}; use ast::{self, CrateConfig, NodeId}; @@ -532,7 +532,7 @@ fn filtered_float_lit(data: Symbol, suffix: Option, diag: Option<(Span, fn float_lit(s: &str, suffix: Option, diag: Option<(Span, &Handler)>) -> Option { debug!("float_lit: {:?}, {:?}", s, suffix); - // FIXME #2252: bounds checking float literals is deferred until trans + // FIXME(#2252): bounds checking float literals is deferred until trans // Strip underscores without allocating a new String unless necessary. let s2; diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 52da8a072c751..f93b866d8d7fd 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -73,7 +73,7 @@ bitflags! { type ItemInfo = (Ident, ItemKind, Option>); -/// How to parse a path. +/// Specifies how to parse a path. #[derive(Copy, Clone, PartialEq)] pub enum PathStyle { /// In some contexts, notably in expressions, paths with generic arguments are ambiguous @@ -108,7 +108,7 @@ enum BlockMode { Ignore, } -/// Possibly accept an `token::Interpolated` expression (a pre-parsed expression +/// Possibly accepts an `token::Interpolated` expression (a pre-parsed expression /// dropped into the token stream, which happens while parsing the result of /// macro expansion). Placement of these is not as complex as I feared it would /// be. The important thing is to make sure that lookahead doesn't balk at @@ -214,26 +214,26 @@ impl RecoverQPath for Expr { } } -/* ident is handled by common.rs */ +// Ident is handled by `common.rs`. #[derive(Clone)] pub struct Parser<'a> { pub sess: &'a ParseSess, - /// the current token: + /// The current token. pub token: token::Token, - /// the span of the current token: + /// The span of the current token. pub span: Span, - /// the span of the previous token: + /// The span of the previous token. meta_var_span: Option, pub prev_span: Span, - /// the previous token kind + /// The previous token kind. prev_token_kind: PrevTokenKind, restrictions: Restrictions, - /// Used to determine the path to externally loaded source files + /// Used to determine the path to externally loaded source files. crate directory: Directory<'a>, /// Whether to parse sub-modules in other files. pub recurse_into_file_modules: bool, - /// Name of the root module this parser originated from. If `None`, then the + /// The name of the root module this parser originated from. If `None`, then the /// name is not known. This does not change while the parser is descending /// into modules, and sub-parsers have new values for this name. pub root_module_name: Option, @@ -404,11 +404,11 @@ impl TokenType { } } -/// Returns true if `IDENT t` can start a type - `IDENT::a::b`, `IDENT`, +/// Returns whether `IDENT t` can start a type -- `IDENT::a::b`, `IDENT`, /// `IDENT<::AssocTy>`. /// /// Types can also be of the form `IDENT(u8, u8) -> u8`, however this assumes -/// that IDENT is not the ident of a fn trait +/// that `IDENT` is not the ident of a fn trait. fn can_continue_type_after_non_fn_ident(t: &token::Token) -> bool { t == &token::ModSep || t == &token::Lt || t == &token::BinOp(token::Shl) @@ -509,7 +509,7 @@ impl From> for LhsExpr { } } -/// Create a placeholder argument. +/// Creates a placeholder argument. fn dummy_arg(span: Span) -> Arg { let ident = Ident::new(keywords::Invalid.name(), span); let pat = P(Pat { @@ -595,7 +595,7 @@ impl<'a> Parser<'a> { next } - /// Convert the current token to a string using self's reader + /// Converts the current token to a string using `self`'s reader. pub fn this_token_to_string(&self) -> String { pprust::token_to_string(&self.token) } @@ -630,8 +630,8 @@ impl<'a> Parser<'a> { } } - /// Expect and consume the token t. Signal an error if - /// the next token is not t. + /// Expects and consumes the token `t`. Signal an error if + /// the next token is not `t`. pub fn expect(&mut self, t: &token::Token) -> PResult<'a, ()> { if self.expected_tokens.is_empty() { if self.token == *t { @@ -670,15 +670,15 @@ impl<'a> Parser<'a> { } } - /// Expect next token to be edible or inedible token. If edible, - /// then consume it; if inedible, then return without consuming - /// anything. Signal a fatal error if next token is unexpected. + /// Expects the next token to be an edible or an inedible token; if edible, + /// then consumes it; if inedible, then returns without consuming anything. + /// Signals a fatal error if next token is unexpected. pub fn expect_one_of(&mut self, edible: &[token::Token], inedible: &[token::Token]) -> PResult<'a, ()>{ fn tokens_to_string(tokens: &[TokenType]) -> String { let mut i = tokens.iter(); - // This might be a sign we need a connect method on Iterator. + // This might be a sign we need a connect method on `Iterator`. let b = i.next() .map_or(String::new(), |t| t.to_string()); i.enumerate().fold(b, |mut b, (i, a)| { @@ -697,7 +697,7 @@ impl<'a> Parser<'a> { self.bump(); Ok(()) } else if inedible.contains(&self.token) { - // leave it in the input + // Leave it in the input. Ok(()) } else { let mut expected = edible.iter() @@ -744,7 +744,8 @@ impl<'a> Parser<'a> { ); } let sp = if self.token == token::Token::Eof { - // This is EOF, don't want to point at the following char, but rather the last token + // This is EOF, don't want to point at the following char, but rather the + // last token. self.prev_span } else { label_sp @@ -781,7 +782,7 @@ impl<'a> Parser<'a> { } } - /// returns the span of expr, if it was not interpolated or the span of the interpolated token + /// Returns the span of expr, if it was not interpolated or the span of the interpolated token. fn interpolated_or_expr_span(&self, expr: PResult<'a, P>) -> PResult<'a, (Span, P)> { @@ -843,7 +844,7 @@ impl<'a> Parser<'a> { } } - /// Check if the next token is `tok`, and return `true` if so. + /// Checks if the next token is `tok`, and returns `true` if so. /// /// This method will automatically add `tok` to `expected_tokens` if `tok` is not /// encountered. @@ -853,8 +854,7 @@ impl<'a> Parser<'a> { is_present } - /// Consume token 'tok' if it exists. Returns true if the given - /// token was present, false otherwise. + /// Consumes a token 'tok' if it exists. Returns whether the given token was present. pub fn eat(&mut self, tok: &token::Token) -> bool { let is_present = self.check(tok); if is_present { self.bump() } @@ -866,8 +866,8 @@ impl<'a> Parser<'a> { self.token.is_keyword(kw) } - /// If the next token is the given keyword, eat it and return - /// true. Otherwise, return false. + /// If the next token is the given keyword, eats it and returns + /// `true`. Otherwise, returns `false`. pub fn eat_keyword(&mut self, kw: keywords::Keyword) -> bool { if self.check_keyword(kw) { self.bump(); @@ -886,9 +886,9 @@ impl<'a> Parser<'a> { } } - /// If the given word is not a keyword, signal an error. - /// If the next token is not the given word, signal an error. - /// Otherwise, eat it. + /// If the given word is not a keyword, signals an error. + /// If the next token is not the given word, signals an error. + /// Otherwise, eats it. fn expect_keyword(&mut self, kw: keywords::Keyword) -> PResult<'a, ()> { if !self.eat_keyword(kw) { self.unexpected() @@ -924,11 +924,11 @@ impl<'a> Parser<'a> { } } - /// Expect and consume a `+`. if `+=` is seen, replace it with a `=` - /// and continue. If a `+` is not seen, return false. + /// Expects and consumes a `+`. if `+=` is seen, replaces it with a `=` + /// and continues. If a `+` is not seen, returns `false`. /// - /// This is using when token splitting += into +. - /// See issue 47856 for an example of when this may occur. + /// This is used when token-splitting `+=` into `+`. + /// See issue #47856 for an example of when this may occur. fn eat_plus(&mut self) -> bool { self.expected_tokens.push(TokenType::Token(token::BinOp(token::Plus))); match self.token { @@ -947,7 +947,7 @@ impl<'a> Parser<'a> { /// Checks to see if the next token is either `+` or `+=`. - /// Otherwise returns false. + /// Otherwise returns `false`. fn check_plus(&mut self) -> bool { if self.token.is_like_plus() { true @@ -958,8 +958,8 @@ impl<'a> Parser<'a> { } } - /// Expect and consume an `&`. If `&&` is seen, replace it with a single - /// `&` and continue. If an `&` is not seen, signal an error. + /// Expects and consumes an `&`. If `&&` is seen, replaces it with a single + /// `&` and continues. If an `&` is not seen, signals an error. fn expect_and(&mut self) -> PResult<'a, ()> { self.expected_tokens.push(TokenType::Token(token::BinOp(token::And))); match self.token { @@ -975,8 +975,8 @@ impl<'a> Parser<'a> { } } - /// Expect and consume an `|`. If `||` is seen, replace it with a single - /// `|` and continue. If an `|` is not seen, signal an error. + /// Expects and consumes an `|`. If `||` is seen, replaces it with a single + /// `|` and continues. If an `|` is not seen, signals an error. fn expect_or(&mut self) -> PResult<'a, ()> { self.expected_tokens.push(TokenType::Token(token::BinOp(token::Or))); match self.token { @@ -1005,8 +1005,8 @@ impl<'a> Parser<'a> { } } - /// Attempt to consume a `<`. If `<<` is seen, replace it with a single - /// `<` and continue. If a `<` is not seen, return false. + /// Attempts to consume a `<` token. If `<<` is seen, replace it with a single + /// `<` and continue. If a `<` is not seen, returns `false`. /// /// This is meant to be used when parsing generics on a path to get the /// starting token. @@ -1034,9 +1034,8 @@ impl<'a> Parser<'a> { } } - /// Expect and consume a GT. if a >> is seen, replace it - /// with a single > and continue. If a GT is not seen, - /// signal an error. + /// Expects and consumes a single `>` token. if a `>>` is seen, replaces it + /// with a single `>` and continues. If a `>` is not seen, signals an error. fn expect_gt(&mut self) -> PResult<'a, ()> { self.expected_tokens.push(TokenType::Token(token::Gt)); match self.token { @@ -1060,7 +1059,7 @@ impl<'a> Parser<'a> { } } - /// Eat and discard tokens until one of `kets` is encountered. Respects token trees, + /// Eats and discards tokens until one of `kets` is encountered. Respects token trees, /// passes through any errors encountered. Used for error recovery. fn eat_to_tokens(&mut self, kets: &[&token::Token]) { let handler = self.diagnostic(); @@ -1073,8 +1072,8 @@ impl<'a> Parser<'a> { } } - /// Parse a sequence, including the closing delimiter. The function - /// f must consume tokens until reaching the next separator or + /// Parses a sequence, including the closing delimiter. The function + /// `f` must consume tokens until reaching the next separator or /// closing bracket. pub fn parse_seq_to_end(&mut self, ket: &token::Token, @@ -1088,8 +1087,8 @@ impl<'a> Parser<'a> { Ok(val) } - /// Parse a sequence, not including the closing delimiter. The function - /// f must consume tokens until reaching the next separator or + /// Parses a sequence, not including the closing delimiter. The function + /// `f` must consume tokens until reaching the next separator or /// closing bracket. pub fn parse_seq_to_before_end(&mut self, ket: &token::Token, @@ -1127,14 +1126,14 @@ impl<'a> Parser<'a> { first = false; } else { if let Err(mut e) = self.expect(t) { - // Attempt to keep parsing if it was a similar separator + // Attempt to keep parsing if it was a similar separator. if let Some(ref tokens) = t.similar_tokens() { if tokens.contains(&self.token) { self.bump(); } } e.emit(); - // Attempt to keep parsing if it was an omitted separator + // Attempt to keep parsing if it was an omitted separator. match f(self) { Ok(t) => { v.push(t); @@ -1164,8 +1163,8 @@ impl<'a> Parser<'a> { Ok(v) } - /// Parse a sequence, including the closing delimiter. The function - /// f must consume tokens until reaching the next separator or + /// Parses a sequence, including the closing delimiter. The function + /// `f` must consume tokens until reaching the next separator or /// closing bracket. fn parse_unspanned_seq(&mut self, bra: &token::Token, @@ -1181,10 +1180,10 @@ impl<'a> Parser<'a> { Ok(result) } - /// Advance the parser by one token + /// Advances the parser by a single token. pub fn bump(&mut self) { if self.prev_token_kind == PrevTokenKind::Eof { - // Bumping after EOF is a bad sign, usually an infinite loop. + // Bumping after EOF is a bad sign; usually an infinite loop. self.bug("attempted to bump the parser past EOF (may be stuck in a loop)"); } @@ -1205,17 +1204,17 @@ impl<'a> Parser<'a> { self.span = next.sp; self.token = next.tok; self.expected_tokens.clear(); - // check after each token + // Check after each token. self.process_potential_macro_variable(); } - /// Advance the parser using provided token as a next one. Use this when - /// consuming a part of a token. For example a single `<` from `<<`. + /// Advances the parser using provided token as a next one. Use this when + /// consuming a part of a token. E.g., a single `<` from `<<`. fn bump_with(&mut self, next: token::Token, span: Span) { self.prev_span = self.span.with_hi(span.lo()); // It would be incorrect to record the kind of the current token, but // fortunately for tokens currently using `bump_with`, the - // prev_token_kind will be of no use anyway. + // `prev_token_kind` will be of no use anyway. self.prev_token_kind = PrevTokenKind::Other; self.span = span; self.token = next; @@ -1290,7 +1289,7 @@ impl<'a> Parser<'a> { self.check_keyword(keywords::Extern) && self.is_extern_non_path() } - /// parse a `TyKind::BareFn` type: + /// Parses a `TyKind::BareFn` type: fn parse_ty_bare_fn(&mut self, generic_params: Vec) -> PResult<'a, TyKind> { /* @@ -1327,7 +1326,7 @@ impl<'a> Parser<'a> { }))) } - /// Parse asyncness: `async` or nothing + /// Parses asyncness: `async` or nothing. fn parse_asyncness(&mut self) -> IsAsync { if self.eat_keyword(keywords::Async) { IsAsync::Async { @@ -1339,7 +1338,7 @@ impl<'a> Parser<'a> { } } - /// Parse unsafety: `unsafe` or nothing. + /// Parses unsafety: `unsafe` or nothing. fn parse_unsafety(&mut self) -> Unsafety { if self.eat_keyword(keywords::Unsafe) { Unsafety::Unsafe @@ -1348,7 +1347,7 @@ impl<'a> Parser<'a> { } } - /// Parse the items in a trait declaration + /// Parses the items in a trait declaration. pub fn parse_trait_item(&mut self, at_end: &mut bool) -> PResult<'a, TraitItem> { maybe_whole!(self, NtTraitItem, |x| x); let attrs = self.parse_outer_attributes()?; @@ -1384,7 +1383,7 @@ impl<'a> Parser<'a> { }; (ident, TraitItemKind::Const(ty, default), ast::Generics::default()) } else if let Some(mac) = self.parse_assoc_macro_invoc("trait", None, &mut false)? { - // trait item macro. + // Trait item macro (keywords::Invalid.ident(), ast::TraitItemKind::Macro(mac), ast::Generics::default()) } else { let (constness, unsafety, asyncness, abi) = self.parse_fn_front_matter()?; @@ -1393,9 +1392,9 @@ impl<'a> Parser<'a> { let mut generics = self.parse_generics()?; let d = self.parse_fn_decl_with_self(|p: &mut Parser<'a>| { - // This is somewhat dubious; We don't want to allow + // This is somewhat dubious; we don't want to allow // argument names to be left off if there is a - // definition... + // definition. // We don't allow argument names to be left off in edition 2018. p.parse_arg_general(p.span.rust_2018(), true) @@ -1465,7 +1464,7 @@ impl<'a> Parser<'a> { }) } - /// Parse optional return type [ -> TY ] in function decl + /// Parses an optional return type `[ -> TY ]` in a function declaration. fn parse_ret_ty(&mut self, allow_plus: bool) -> PResult<'a, FunctionRetTy> { if self.eat(&token::RArrow) { Ok(FunctionRetTy::Ty(self.parse_ty_common(allow_plus, true)?)) @@ -1479,7 +1478,7 @@ impl<'a> Parser<'a> { self.parse_ty_common(true, true) } - /// Parse a type in restricted contexts where `+` is not permitted. + /// Parses a type in restricted contexts where `+` is not permitted. /// Example 1: `&'a TYPE` /// `+` is prohibited to maintain operator priority (P(+) < P(&)). /// Example 2: `value1 as TYPE + value2` @@ -1515,7 +1514,7 @@ impl<'a> Parser<'a> { let ty = ts.into_iter().nth(0).unwrap().into_inner(); let maybe_bounds = allow_plus && self.token.is_like_plus(); match ty.node { - // `(TY_BOUND_NOPAREN) + BOUND + ...`. + // `(TY_BOUND_NOPAREN) + BOUND + ...` TyKind::Path(None, ref path) if maybe_bounds => { self.parse_remaining_bounds(Vec::new(), path.clone(), lo, true)? } @@ -1542,7 +1541,7 @@ impl<'a> Parser<'a> { } else if self.eat(&token::OpenDelim(token::Bracket)) { // Array or slice let t = self.parse_ty()?; - // Parse optional `; EXPR` in `[TYPE; EXPR]` + // Parse optional `; EXPR` in `[TYPE; EXPR]`. let t = match self.maybe_parse_fixed_length_of_vec()? { None => TyKind::Slice(t), Some(length) => TyKind::Array(t, AnonConst { @@ -1647,7 +1646,8 @@ impl<'a> Parser<'a> { let poly_trait_ref = PolyTraitRef::new(generic_params, path, lo.to(self.prev_span)); let mut bounds = vec![GenericBound::Trait(poly_trait_ref, TraitBoundModifier::None)]; if parse_plus { - self.eat_plus(); // `+`, or `+=` gets split and `+` is discarded + // `+`, or `+=` gets split and `+` is discarded. + self.eat_plus(); bounds.append(&mut self.parse_generic_bounds()?); } Ok(TyKind::TraitObject(bounds, TraitObjectSyntax::None)) @@ -1710,7 +1710,7 @@ impl<'a> Parser<'a> { Ok(()) } - // Try to recover from associated item paths like `[T]::AssocItem`/`(T, U)::AssocItem`. + // Try to recover from associated item paths like `[T]::AssocItem` / `(T, U)::AssocItem`. fn maybe_recover_from_bad_qpath(&mut self, base: T, allow_recovery: bool) -> PResult<'a, T> { // Do not add `::` to expected tokens. @@ -1780,7 +1780,8 @@ impl<'a> Parser<'a> { self.look_ahead(offset + 1, |t| t == &token::Colon) } - /// Skip unexpected attributes and doc comments in this position and emit an appropriate error. + /// Skips unexpected attributes and doc comments in this position and emits an appropriate + /// error. fn eat_incorrect_doc_comment(&mut self, applied_to: &str) { if let token::DocComment(_) = self.token { let mut err = self.diagnostic().struct_span_err( @@ -1809,8 +1810,7 @@ impl<'a> Parser<'a> { } } - /// This version of parse arg doesn't necessarily require - /// identifier names. + /// This version of parse arg doesn't necessarily require identifier names. fn parse_arg_general(&mut self, require_name: bool, is_trait_item: bool) -> PResult<'a, Arg> { maybe_whole!(self, NtArg, |x| x); @@ -1917,12 +1917,12 @@ impl<'a> Parser<'a> { Ok(Arg { ty, pat, id: ast::DUMMY_NODE_ID }) } - /// Parse a single function argument + /// Parses a single function argument. crate fn parse_arg(&mut self) -> PResult<'a, Arg> { self.parse_arg_general(true, false) } - /// Parse an argument in a lambda header e.g., |arg, arg| + /// Parses an argument in a lambda header (e.g., |arg, arg|). fn parse_fn_block_arg(&mut self) -> PResult<'a, Arg> { let pat = self.parse_pat(Some("argument name"))?; let t = if self.eat(&token::Colon) { @@ -1949,7 +1949,7 @@ impl<'a> Parser<'a> { } } - /// Matches token_lit = LIT_INTEGER | ... + /// Matches `token_lit = LIT_INTEGER | ...`. fn parse_lit_token(&mut self) -> PResult<'a, LitKind> { let out = match self.token { token::Interpolated(ref nt) => match nt.0 { @@ -1977,7 +1977,7 @@ impl<'a> Parser<'a> { Ok(out) } - /// Matches lit = true | false | token_lit + /// Matches `lit = true | false | token_lit`. crate fn parse_lit(&mut self) -> PResult<'a, Lit> { let lo = self.span; let lit = if self.eat_keyword(keywords::True) { @@ -1991,7 +1991,7 @@ impl<'a> Parser<'a> { Ok(source_map::Spanned { node: lit, span: lo.to(self.prev_span) }) } - /// matches '-' lit | lit (cf. ast_validation::AstValidator::check_expr_within_pat) + /// Matches `'-' lit | lit` (cf. `ast_validation::AstValidator::check_expr_within_pat`). crate fn parse_literal_maybe_minus(&mut self) -> PResult<'a, P> { maybe_whole_expr!(self); @@ -2033,7 +2033,7 @@ impl<'a> Parser<'a> { } } - /// Parses qualified path. + /// Parses a qualified path. /// Assumes that the leading `<` has been parsed already. /// /// `qualified_path = ::path` @@ -2105,8 +2105,9 @@ impl<'a> Parser<'a> { Ok(ast::Path { segments, span: lo.to(self.prev_span) }) } - /// Like `parse_path`, but also supports parsing `Word` meta items into paths for back-compat. - /// This is used when parsing derive macro paths in `#[derive]` attributes. + /// Like `parse_path`, but also supports parsing `Word` meta items into paths for + /// backwards-compatibility. This is used when parsing derive macro paths in `#[derive]` + /// attributes. pub fn parse_path_allowing_meta(&mut self, style: PathStyle) -> PResult<'a, ast::Path> { let meta_ident = match self.token { token::Interpolated(ref nt) => match nt.0 { @@ -2157,7 +2158,7 @@ impl<'a> Parser<'a> { Ok(if style == PathStyle::Type && check_args_start(self) || style != PathStyle::Mod && self.check(&token::ModSep) && self.look_ahead(1, |t| is_args_start(t)) { - // Generic arguments are found - `<`, `(`, `::<` or `::(`. + // Generic arguments are found: `<`, `(`, `::<` or `::(`. let lo = self.span; if self.eat(&token::ModSep) && style == PathStyle::Type && enable_warning { self.diagnostic().struct_span_warn(self.prev_span, "unnecessary path disambiguator") @@ -2200,7 +2201,7 @@ impl<'a> Parser<'a> { self.token.is_lifetime() } - /// Parse single lifetime 'a or panic. + /// Parses a single lifetime `'a` or panics. crate fn expect_lifetime(&mut self) -> Lifetime { if let Some(ident) = self.token.lifetime() { let span = self.span; @@ -2221,7 +2222,7 @@ impl<'a> Parser<'a> { } } - /// Parse mutability (`mut` or nothing). + /// Parses mutability (`mut` or nothing). fn parse_mutability(&mut self) -> Mutability { if self.eat_keyword(keywords::Mut) { Mutability::Mutable @@ -2239,12 +2240,12 @@ impl<'a> Parser<'a> { } } - /// Parse ident (COLON expr)? + /// Parses `ident (COLON expr)?`. fn parse_field(&mut self) -> PResult<'a, Field> { let attrs = self.parse_outer_attributes()?; let lo = self.span; - // Check if a colon exists one ahead. This means we're parsing a fieldname. + // Check if a colon exists one ahead. This means we're parsing a field name. let (fieldname, expr, is_shorthand) = if self.look_ahead(1, |t| t == &token::Colon) { let fieldname = self.parse_field_name()?; self.bump(); // `:` @@ -2336,12 +2337,10 @@ impl<'a> Parser<'a> { } /// At the bottom (top?) of the precedence hierarchy, - /// parse things like parenthesized exprs, - /// macros, return, etc. + /// Parses things like parenthesized exprs, macros, `return`, etc. /// - /// N.B., this does not parse outer attributes, - /// and is private because it only works - /// correctly if called from parse_dot_or_call_expr(). + /// N.B., this does not parse outer attributes, and is private because it only works + /// correctly if called from `parse_dot_or_call_expr()`. fn parse_bottom_expr(&mut self) -> PResult<'a, P> { maybe_whole_expr!(self); @@ -2364,8 +2363,8 @@ impl<'a> Parser<'a> { attrs.extend(self.parse_inner_attributes()?); - // (e) is parenthesized e - // (e,) is a tuple with only one field, e + // `(e)` is parenthesized `e`. + // `(e,)` is a tuple with only one field, `e`. let mut es = vec![]; let mut trailing_comma = false; while self.token != token::CloseDelim(token::Paren) { @@ -2405,7 +2404,7 @@ impl<'a> Parser<'a> { // Nonempty vector. let first_expr = self.parse_expr()?; if self.eat(&token::Semi) { - // Repeating array syntax: [ 0; 512 ] + // Repeating array syntax: `[ 0; 512 ]` let count = AnonConst { id: ast::DUMMY_NODE_ID, value: self.parse_expr()?, @@ -2438,7 +2437,8 @@ impl<'a> Parser<'a> { } if self.span.rust_2018() && self.check_keyword(keywords::Async) { - if self.is_async_block() { // check for `async {` and `async move {` + // Check for `async {` and `async move {`. + if self.is_async_block() { return self.parse_async_block(attrs); } else { return self.parse_lambda_expr(attrs); @@ -2680,7 +2680,7 @@ impl<'a> Parser<'a> { } } - /// Parse a block or unsafe block + /// Parses a block or unsafe block. fn parse_block_expr(&mut self, opt_label: Option { fn move_flat_map(mut self, mut f: F) -> Self where F: FnMut(T) -> I, - I: IntoIterator + I: IntoIterator { let mut read_i = 0; let mut write_i = 0; diff --git a/src/libsyntax/util/parser.rs b/src/libsyntax/util/parser.rs index 89d4e53b8d140..1815d5573a4c9 100644 --- a/src/libsyntax/util/parser.rs +++ b/src/libsyntax/util/parser.rs @@ -281,7 +281,7 @@ impl ExprPrecedence { ExprPrecedence::Yield => PREC_JUMP, // `Range` claims to have higher precedence than `Assign`, but `x .. x = x` fails to - // parse, instead of parsing as `(x .. x) = x`. Giving `Range` a lower precedence + // parse, instead of parsing as `(x .. x) = x`. Giving `Range` a lower precedence // ensures that `pprust` will add parentheses in the right places to get the desired // parse. ExprPrecedence::Range => PREC_RANGE, diff --git a/src/libsyntax_ext/deriving/generic/mod.rs b/src/libsyntax_ext/deriving/generic/mod.rs index 22643db501693..ae318be0465ac 100644 --- a/src/libsyntax_ext/deriving/generic/mod.rs +++ b/src/libsyntax_ext/deriving/generic/mod.rs @@ -1262,7 +1262,7 @@ impl<'a> MethodDef<'a> { // we are in. // All of the Self args have the same variant in these - // cases. So we transpose the info in self_pats_idents + // cases. So we transpose the info in self_pats_idents // to gather the getter expressions together, in the // form that EnumMatching expects. @@ -1341,7 +1341,7 @@ impl<'a> MethodDef<'a> { // We will usually need the catch-all after matching the // tuples `(VariantK, VariantK, ...)` for each VariantK of the - // enum. But: + // enum. But: // // * when there is only one Self arg, the arms above suffice // (and the deriving we call back into may not be prepared to @@ -1358,7 +1358,7 @@ impl<'a> MethodDef<'a> { // Build a series of let statements mapping each self_arg // to its discriminant value. If this is a C-style enum // with a specific repr type, then casts the values to - // that type. Otherwise casts to `i32` (the default repr + // that type. Otherwise casts to `i32` (the default repr // type). // // i.e., for `enum E { A, B(1), C(T, T) }`, and a deriving @@ -1450,7 +1450,7 @@ impl<'a> MethodDef<'a> { // least safely), according to the type system. // // The most expedient fix for this is to just let the - // code fall through to the catch-all. But even this is + // code fall through to the catch-all. But even this is // error-prone, since the catch-all as defined above would // generate code like this: // @@ -1462,13 +1462,13 @@ impl<'a> MethodDef<'a> { // inference cannot resolve to unique types. // // One option to the above might be to add explicit type - // annotations. But the *only* reason to go down that path + // annotations. But the *only* reason to go down that path // would be to try to make the expanded output consistent // with the case when the number of enum variants >= 1. // - // That just isn't worth it. In fact, trying to generate + // That just isn't worth it. In fact, trying to generate // sensible code for *any* deriving on a zero-variant enum - // does not make sense. But at the same time, for now, we + // does not make sense. But at the same time, for now, we // do not want to cause a compile failure just because the // user happened to attach a deriving to their // zero-variant enum. diff --git a/src/libsyntax_ext/env.rs b/src/libsyntax_ext/env.rs index 16fb64a5f3912..84569a5ba821d 100644 --- a/src/libsyntax_ext/env.rs +++ b/src/libsyntax_ext/env.rs @@ -1,7 +1,6 @@ -// The compiler code necessary to support the env! extension. Eventually this +// The compiler code necessary to support the `env!` extension. Eventually this // should all get sucked into either the compiler syntax extension plugin // interface. -// use syntax::ast::{self, Ident, GenericArg}; use syntax::ext::base::*; diff --git a/src/libsyntax_ext/format.rs b/src/libsyntax_ext/format.rs index ac1402a0faaa5..b45a4c153b8d8 100644 --- a/src/libsyntax_ext/format.rs +++ b/src/libsyntax_ext/format.rs @@ -980,7 +980,7 @@ pub fn expand_preparsed_format_args(ecx: &mut ExtCtxt, if args_used < args_unused { use super::format_foreign as foreign; - // The set of foreign substitutions we've explained. This prevents spamming the user + // The set of foreign substitutions we've explained. This prevents spamming the user // with `%d should be written as {}` over and over again. let mut explained = FxHashSet::default(); diff --git a/src/libsyntax_ext/format_foreign.rs b/src/libsyntax_ext/format_foreign.rs index 8ac6d460ec3d9..ea67af175fe5e 100644 --- a/src/libsyntax_ext/format_foreign.rs +++ b/src/libsyntax_ext/format_foreign.rs @@ -225,7 +225,7 @@ pub mod printf { #[derive(Copy, Clone, PartialEq, Debug)] pub enum Num { // The range of these values is technically bounded by `NL_ARGMAX`... but, at least for GNU - // libc, it apparently has no real fixed limit. A `u16` is used here on the basis that it + // libc, it apparently has no real fixed limit. A `u16` is used here on the basis that it // is *vanishingly* unlikely that *anyone* is going to try formatting something wider, or // with more precision, than 32 thousand positions which is so wide it couldn't possibly fit // on a screen. diff --git a/src/libsyntax_ext/proc_macro_server.rs b/src/libsyntax_ext/proc_macro_server.rs index afd86a4f7465c..dac9126e6d7ad 100644 --- a/src/libsyntax_ext/proc_macro_server.rs +++ b/src/libsyntax_ext/proc_macro_server.rs @@ -300,7 +300,7 @@ pub struct Group { #[derive(Copy, Clone, PartialEq, Eq, Hash)] pub struct Punct { ch: char, - // NB. not using `Spacing` here because it doesn't implement `Hash`. + // N.B., not using `Spacing` here because it doesn't implement `Hash`. joint: bool, span: Span, } @@ -353,7 +353,7 @@ impl Ident { } } -// FIXME(eddyb) `Literal` should not expose internal `Debug` impls. +// FIXME(eddyb): `Literal` should not expose internal `Debug` impls. #[derive(Clone, Debug)] pub struct Literal { lit: token::Lit, diff --git a/src/libsyntax_pos/analyze_source_file.rs b/src/libsyntax_pos/analyze_source_file.rs index 3abd260ac6f8f..0658c9bea00a6 100644 --- a/src/libsyntax_pos/analyze_source_file.rs +++ b/src/libsyntax_pos/analyze_source_file.rs @@ -258,7 +258,7 @@ fn analyze_source_file_generic(src: &str, } // Assume control characters are zero width. - // FIXME: How can we decide between `width` and `width_cjk`? + // FIXME: how can we decide between `width` and `width_cjk`? let char_width = UnicodeWidthChar::width(c).unwrap_or(0); if char_width != 1 { diff --git a/src/libsyntax_pos/lib.rs b/src/libsyntax_pos/lib.rs index 6a41a93f0b4fd..743ad7a93e177 100644 --- a/src/libsyntax_pos/lib.rs +++ b/src/libsyntax_pos/lib.rs @@ -292,7 +292,7 @@ impl Span { self.data().with_ctxt(ctxt) } - /// Returns `true` if this is a dummy span with any hygienic context. + /// Returns whether this is a dummy span with any hygienic context. #[inline] pub fn is_dummy(self) -> bool { let span = self.data(); @@ -668,7 +668,7 @@ impl MultiSpan { &self.primary_spans } - /// Returns `true` if this contains only a dummy primary span with any hygienic context. + /// Returns whether this contains only a dummy primary span with any hygienic context. pub fn is_dummy(&self) -> bool { let mut is_dummy = true; for span in &self.primary_spans { @@ -680,7 +680,7 @@ impl MultiSpan { } /// Replaces all occurrences of one Span with another. Used to move `Span`s in areas that don't - /// display well (like std macros). Returns true if replacements occurred. + /// display well (like std macros). Returns whether replacements occurred. pub fn replace(&mut self, before: Span, after: Span) -> bool { let mut replacements_occurred = false; for primary_span in &mut self.primary_spans { diff --git a/src/libsyntax_pos/symbol.rs b/src/libsyntax_pos/symbol.rs index 76d47f421b3de..e24ff5dfc59eb 100644 --- a/src/libsyntax_pos/symbol.rs +++ b/src/libsyntax_pos/symbol.rs @@ -454,21 +454,21 @@ impl Ident { self.name <= keywords::Underscore.name() } - /// Returns `true` if the token is a keyword used in the language. + /// Returns whether the token is a keyword used in the language. pub fn is_used_keyword(self) -> bool { // Note: `span.edition()` is relatively expensive, don't call it unless necessary. self.name >= keywords::As.name() && self.name <= keywords::While.name() || self.name.is_used_keyword_2018() && self.span.rust_2018() } - /// Returns `true` if the token is a keyword reserved for possible future use. + /// Returns whether the token is a keyword reserved for possible future use. pub fn is_unused_keyword(self) -> bool { // Note: `span.edition()` is relatively expensive, don't call it unless necessary. self.name >= keywords::Abstract.name() && self.name <= keywords::Yield.name() || self.name.is_unused_keyword_2018() && self.span.rust_2018() } - /// Returns `true` if the token is either a special identifier or a keyword. + /// Returns whether the token is either a special identifier or a keyword. pub fn is_reserved(self) -> bool { self.is_special() || self.is_used_keyword() || self.is_unused_keyword() } diff --git a/src/libterm/terminfo/searcher.rs b/src/libterm/terminfo/searcher.rs index d48e189abc450..17f1f2c4ad305 100644 --- a/src/libterm/terminfo/searcher.rs +++ b/src/libterm/terminfo/searcher.rs @@ -71,7 +71,7 @@ fn test_get_dbpath_for_term() { // woefully inadequate test coverage // note: current tests won't work with non-standard terminfo hierarchies (e.g., macOS's) use std::env; - // FIXME (#9639): This needs to handle non-utf8 paths + // FIXME(#9639): This needs to handle non-utf8 paths fn x(t: &str) -> String { let p = get_dbpath_for_term(t).expect("no terminfo entry found"); p.to_str().unwrap().to_string() diff --git a/src/libterm/win.rs b/src/libterm/win.rs index 25b03ba59acbc..1d7b3857ab2dd 100644 --- a/src/libterm/win.rs +++ b/src/libterm/win.rs @@ -1,6 +1,6 @@ //! Windows console handling -// FIXME (#13400): this is only a tiny fraction of the Windows console api +// FIXME(#13400): this is only a tiny fraction of the Windows console api extern crate libc; diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs index 4e227745a793f..51ac1893c5409 100644 --- a/src/libtest/lib.rs +++ b/src/libtest/lib.rs @@ -507,7 +507,7 @@ Test Attributes: ); } -// FIXME: Copied from libsyntax until linkage errors are resolved. Issue #47566 +// FIXME: copied from libsyntax until linkage errors are resolved. Issue #47566 fn is_nightly() -> bool { // Whether this is a feature-staged build, i.e., on the beta or stable channel let disable_unstable_features = option_env!("CFG_DISABLE_UNSTABLE_FEATURES").is_some(); @@ -1017,7 +1017,7 @@ fn use_color(opts: &TestOpts) -> bool { all(target_arch = "wasm32", not(target_os = "emscripten")), target_env = "sgx"))] fn stdout_isatty() -> bool { - // FIXME: Implement isatty on Redox and SGX + // FIXME: implement isatty on Redox and SGX false } #[cfg(unix)] @@ -1242,7 +1242,7 @@ fn get_concurrency() -> usize { #[cfg(target_os = "redox")] fn num_cpus() -> usize { - // FIXME: Implement num_cpus on Redox + // FIXME: implement num_cpus on Redox 1 } @@ -1547,7 +1547,7 @@ impl MetricMap { /// pretend to use outputs to assist in avoiding dead-code /// elimination. /// -/// This function is a no-op, and does not even read from `dummy`. +/// This function is a noop, and does not even read from `dummy`. #[cfg(not(any(target_arch = "asmjs", target_arch = "wasm32")))] pub fn black_box(dummy: T) -> T { // we need to "use" the argument in some way LLVM can't diff --git a/src/libtest/stats.rs b/src/libtest/stats.rs index 9fc5f09ba6c92..21a3ed8828d7a 100644 --- a/src/libtest/stats.rs +++ b/src/libtest/stats.rs @@ -150,7 +150,7 @@ impl Summary { } impl Stats for [f64] { - // FIXME #11059 handle NaN, inf and overflow + // FIXME(#11059): handle NaN, inf and overflow. fn sum(&self) -> f64 { let mut partials = vec![]; diff --git a/src/libunwind/libunwind.rs b/src/libunwind/libunwind.rs index 31e806c8fb656..5867b9a37487f 100644 --- a/src/libunwind/libunwind.rs +++ b/src/libunwind/libunwind.rs @@ -201,7 +201,7 @@ if #[cfg(all(any(target_os = "ios", target_os = "netbsd", not(target_arch = "arm _Unwind_GetIP(ctx) } - // This function also doesn't exist on Android or ARM/Linux, so make it a no-op + // This function also doesn't exist on Android or ARM/Linux, so make it a noop pub unsafe fn _Unwind_FindEnclosingFunction(pc: *mut c_void) -> *mut c_void { pc } diff --git a/src/test/codegen-units/partitioning/methods-are-with-self-type.rs b/src/test/codegen-units/partitioning/methods-are-with-self-type.rs index c2961ed9322ad..3ccabbce24618 100644 --- a/src/test/codegen-units/partitioning/methods-are-with-self-type.rs +++ b/src/test/codegen-units/partitioning/methods-are-with-self-type.rs @@ -19,7 +19,7 @@ mod mod1 { use super::{SomeType, SomeGenericType}; // Even though the impl is in `mod1`, the methods should end up in the - // parent module, since that is where their self-type is. + // parent module, since that is where their self type is. impl SomeType { //~ MONO_ITEM fn methods_are_with_self_type::mod1[0]::{{impl}}[0]::method[0] @@ methods_are_with_self_type[External] fn method(&self) {} diff --git a/src/test/codegen/align-struct.rs b/src/test/codegen/align-struct.rs index c0d6a0c80e1cf..1151689873649 100644 --- a/src/test/codegen/align-struct.rs +++ b/src/test/codegen/align-struct.rs @@ -38,7 +38,7 @@ pub fn align64(i : i32) -> Align64 { a64 } -// For issue 54028: make sure that we are specifying the correct alignment for fields of aligned +// For issue #54028: make sure that we are specifying the correct alignment for fields of aligned // structs // CHECK-LABEL: @align64_load #[no_mangle] diff --git a/src/test/codegen/dllimports/auxiliary/dummy.rs b/src/test/codegen/dllimports/auxiliary/dummy.rs index 113a164f1457f..244bd91837f53 100644 --- a/src/test/codegen/dllimports/auxiliary/dummy.rs +++ b/src/test/codegen/dllimports/auxiliary/dummy.rs @@ -2,5 +2,5 @@ #![crate_type = "staticlib"] // Since codegen tests don't actually perform linking, this library doesn't need to export -// any symbols. It's here just to satisfy the compiler looking for a .lib file when processing +// any symbols. It's here just to satisfy the compiler looking for a .lib file when processing // #[link(...)] attributes in wrapper.rs. diff --git a/src/test/codegen/enum-debug-clike.rs b/src/test/codegen/enum-debug-clike.rs index 98f07505f7539..276b2e2033973 100644 --- a/src/test/codegen/enum-debug-clike.rs +++ b/src/test/codegen/enum-debug-clike.rs @@ -1,5 +1,5 @@ // This test depends on a patch that was committed to upstream LLVM -// before 7.0, then backported to the Rust LLVM fork. It tests that +// before 7.0, then backported to the Rust LLVM fork. It tests that // debug info for "c-like" enums is properly emitted. // ignore-tidy-linelength diff --git a/src/test/codegen/enum-debug-niche-2.rs b/src/test/codegen/enum-debug-niche-2.rs index 369fa1fcfda7b..bb4f3a2a9ff27 100644 --- a/src/test/codegen/enum-debug-niche-2.rs +++ b/src/test/codegen/enum-debug-niche-2.rs @@ -1,5 +1,5 @@ // This test depends on a patch that was committed to upstream LLVM -// before 7.0, then backported to the Rust LLVM fork. It tests that +// before 7.0, then backported to the Rust LLVM fork. It tests that // optimized enum debug info accurately reflects the enum layout. // ignore-tidy-linelength diff --git a/src/test/codegen/enum-debug-niche.rs b/src/test/codegen/enum-debug-niche.rs index 1273a785ba42f..9a0c6b5a32db7 100644 --- a/src/test/codegen/enum-debug-niche.rs +++ b/src/test/codegen/enum-debug-niche.rs @@ -1,5 +1,5 @@ // This test depends on a patch that was committed to upstream LLVM -// before 7.0, then backported to the Rust LLVM fork. It tests that +// before 7.0, then backported to the Rust LLVM fork. It tests that // optimized enum debug info accurately reflects the enum layout. // ignore-tidy-linelength diff --git a/src/test/codegen/enum-debug-tagged.rs b/src/test/codegen/enum-debug-tagged.rs index 5c37e40c27032..9357478289ef5 100644 --- a/src/test/codegen/enum-debug-tagged.rs +++ b/src/test/codegen/enum-debug-tagged.rs @@ -1,5 +1,5 @@ // This test depends on a patch that was committed to upstream LLVM -// before 7.0, then backported to the Rust LLVM fork. It tests that +// before 7.0, then backported to the Rust LLVM fork. It tests that // debug info for tagged (ordinary) enums is properly emitted. // ignore-tidy-linelength diff --git a/src/test/codegen/function-arguments.rs b/src/test/codegen/function-arguments.rs index c2d697fd046bf..cc51130b32adb 100644 --- a/src/test/codegen/function-arguments.rs +++ b/src/test/codegen/function-arguments.rs @@ -5,51 +5,51 @@ #![feature(custom_attribute)] pub struct S { - _field: [i32; 8], + _field: [i32; 8], } pub struct UnsafeInner { - _field: std::cell::UnsafeCell, + _field: std::cell::UnsafeCell, } // CHECK: zeroext i1 @boolean(i1 zeroext %x) #[no_mangle] pub fn boolean(x: bool) -> bool { - x + x } // CHECK: @readonly_borrow(i32* noalias readonly align 4 dereferenceable(4) %arg0) -// FIXME #25759 This should also have `nocapture` +// FIXME(#25759): this should also have `nocapture`. #[no_mangle] pub fn readonly_borrow(_: &i32) { } // CHECK: @static_borrow(i32* noalias readonly align 4 dereferenceable(4) %arg0) -// static borrow may be captured +// Static borrow may be captured. #[no_mangle] pub fn static_borrow(_: &'static i32) { } // CHECK: @named_borrow(i32* noalias readonly align 4 dereferenceable(4) %arg0) -// borrow with named lifetime may be captured +// Borrow with named lifetime may be captured. #[no_mangle] pub fn named_borrow<'r>(_: &'r i32) { } // CHECK: @unsafe_borrow(i16* align 2 dereferenceable(2) %arg0) -// unsafe interior means this isn't actually readonly and there may be aliases ... +// Unsafe interior means this isn't actually readonly and there may be aliases ... #[no_mangle] pub fn unsafe_borrow(_: &UnsafeInner) { } // CHECK: @mutable_unsafe_borrow(i16* align 2 dereferenceable(2) %arg0) -// ... unless this is a mutable borrow, those never alias +// ... unless this is a mutable borrow, those never alias. #[no_mangle] pub fn mutable_unsafe_borrow(_: &mut UnsafeInner) { } // CHECK: @mutable_borrow(i32* align 4 dereferenceable(4) %arg0) -// FIXME #25759 This should also have `nocapture` +// FIXME(#25759): this should also have `nocapture`. #[no_mangle] pub fn mutable_borrow(_: &mut i32) { } @@ -60,7 +60,7 @@ pub fn indirect_struct(_: S) { } // CHECK: @borrowed_struct(%S* noalias readonly align 4 dereferenceable(32) %arg0) -// FIXME #25759 This should also have `nocapture` +// FIXME(#25759): this should also have `nocapture`. #[no_mangle] pub fn borrowed_struct(_: &S) { } @@ -68,49 +68,49 @@ pub fn borrowed_struct(_: &S) { // CHECK: noalias align 4 dereferenceable(4) i32* @_box(i32* noalias align 4 dereferenceable(4) %x) #[no_mangle] pub fn _box(x: Box) -> Box { - x + x } // CHECK: @struct_return(%S* noalias nocapture sret dereferenceable(32)) #[no_mangle] pub fn struct_return() -> S { - S { - _field: [0, 0, 0, 0, 0, 0, 0, 0] - } + S { + _field: [0, 0, 0, 0, 0, 0, 0, 0] + } } -// Hack to get the correct size for the length part in slices +// Hack to get the correct size for the length part in slices. // CHECK: @helper([[USIZE:i[0-9]+]] %arg0) #[no_mangle] pub fn helper(_: usize) { } // CHECK: @slice([0 x i8]* noalias nonnull readonly align 1 %arg0.0, [[USIZE]] %arg0.1) -// FIXME #25759 This should also have `nocapture` +// FIXME(#25759): this should also have `nocapture`. #[no_mangle] pub fn slice(_: &[u8]) { } // CHECK: @mutable_slice([0 x i8]* nonnull align 1 %arg0.0, [[USIZE]] %arg0.1) -// FIXME #25759 This should also have `nocapture` +// FIXME(#25759): this should also have `nocapture`. #[no_mangle] pub fn mutable_slice(_: &mut [u8]) { } // CHECK: @unsafe_slice([0 x i16]* nonnull align 2 %arg0.0, [[USIZE]] %arg0.1) -// unsafe interior means this isn't actually readonly and there may be aliases ... +// Unsafe interior means this isn't actually readonly and there may be aliases ... #[no_mangle] pub fn unsafe_slice(_: &[UnsafeInner]) { } // CHECK: @str([0 x i8]* noalias nonnull readonly align 1 %arg0.0, [[USIZE]] %arg0.1) -// FIXME #25759 This should also have `nocapture` +// FIXME(#25759): this should also have `nocapture`. #[no_mangle] pub fn str(_: &[u8]) { } // CHECK: @trait_borrow({}* nonnull align 1 %arg0.0, [3 x [[USIZE]]]* noalias readonly align {{.*}} dereferenceable({{.*}}) %arg0.1) -// FIXME #25759 This should also have `nocapture` +// FIXME(#25759): this should also have `nocapture`. #[no_mangle] pub fn trait_borrow(_: &Drop) { } @@ -123,30 +123,30 @@ pub fn trait_box(_: Box) { // CHECK: { i8*, i8* } @trait_option(i8* noalias align 1 %x.0, i8* %x.1) #[no_mangle] pub fn trait_option(x: Option>) -> Option> { - x + x } // CHECK: { [0 x i16]*, [[USIZE]] } @return_slice([0 x i16]* noalias nonnull readonly align 2 %x.0, [[USIZE]] %x.1) #[no_mangle] pub fn return_slice(x: &[u16]) -> &[u16] { - x + x } // CHECK: { i16, i16 } @enum_id_1(i16 %x.0, i16 %x.1) #[no_mangle] pub fn enum_id_1(x: Option>) -> Option> { - x + x } // CHECK: { i8, i8 } @enum_id_2(i1 zeroext %x.0, i8 %x.1) #[no_mangle] pub fn enum_id_2(x: Option) -> Option { - x + x } // CHECK: noalias i8* @allocator() #[no_mangle] #[allocator] pub fn allocator() -> *const i8 { - std::ptr::null() + std::ptr::null() } diff --git a/src/test/codegen/issue-13018.rs b/src/test/codegen/issue-13018.rs index b70ea1f48c8ce..f6989fedb9294 100644 --- a/src/test/codegen/issue-13018.rs +++ b/src/test/codegen/issue-13018.rs @@ -1,6 +1,6 @@ // compile-flags: -O -// A drop([...].clone()) sequence on an Rc should be a no-op +// A drop([...].clone()) sequence on an Rc should be a noop // In particular, no call to __rust_dealloc should be emitted #![crate_type = "lib"] use std::rc::Rc; diff --git a/src/test/compile-fail/auxiliary/weak-lang-items.rs b/src/test/compile-fail/auxiliary/weak-lang-items.rs index 7a698cf76ae51..c5181f3b6719e 100644 --- a/src/test/compile-fail/auxiliary/weak-lang-items.rs +++ b/src/test/compile-fail/auxiliary/weak-lang-items.rs @@ -1,6 +1,6 @@ // no-prefer-dynamic -// This aux-file will require the eh_personality function to be codegen'd, but +// This aux-file will require the `eh_personality` function to be codegen'ed, but // it hasn't been defined just yet. Make sure we don't explode. #![no_std] diff --git a/src/test/compile-fail/issue-23595-1.rs b/src/test/compile-fail/issue-23595-1.rs index b8a0c4846abeb..5505fcd888631 100644 --- a/src/test/compile-fail/issue-23595-1.rs +++ b/src/test/compile-fail/issue-23595-1.rs @@ -5,7 +5,7 @@ use std::ops::{Index}; trait Hierarchy { type Value; type ChildKey; - type Children = Index; + type Children = Index; //~^ ERROR: the value of the associated types `Value` (from the trait `Hierarchy`), `ChildKey` fn data(&self) -> Option<(Self::Value, Self::Children)>; diff --git a/src/test/compile-fail/meta-expected-error-wrong-rev.rs b/src/test/compile-fail/meta-expected-error-wrong-rev.rs index 7e49434142bcb..48fe3f4c5856e 100644 --- a/src/test/compile-fail/meta-expected-error-wrong-rev.rs +++ b/src/test/compile-fail/meta-expected-error-wrong-rev.rs @@ -3,7 +3,7 @@ // revisions: a // should-fail -// This is a "meta-test" of the compilertest framework itself. In +// This is a "meta-test" of the compilertest framework itself. In // particular, it includes the right error message, but the message // targets the wrong revision, so we expect the execution to fail. // See also `meta-expected-error-correct-rev.rs`. diff --git a/src/test/debuginfo/borrowed-enum-legacy.rs b/src/test/debuginfo/borrowed-enum-legacy.rs index 9a973ed74e867..66f07e91e1ad6 100644 --- a/src/test/debuginfo/borrowed-enum-legacy.rs +++ b/src/test/debuginfo/borrowed-enum-legacy.rs @@ -2,7 +2,7 @@ // min-lldb-version: 310 // As long as LLVM 5 and LLVM 6 are supported, we want to test the -// enum debuginfo fallback mode. Once those are desupported, this +// enum debuginfo fallback mode. Once those are desupported, this // test can be removed, as there is another (non-"legacy") test that // tests the new mode. // ignore-llvm-version: 7.0 - 9.9.9 diff --git a/src/test/debuginfo/drop-locations.rs b/src/test/debuginfo/drop-locations.rs index c195f46208a0c..1e7ab823424d9 100644 --- a/src/test/debuginfo/drop-locations.rs +++ b/src/test/debuginfo/drop-locations.rs @@ -37,8 +37,8 @@ // lldb-command:set set stop-line-count-before 0 // lldb-command:set set stop-line-count-after 1 -// Can't set both to zero or lldb will stop printing source at all. So it will output the current -// line and the next. We deal with this by having at least 2 lines between the #loc's +// Can't set both to zero or lldb will stop printing source at all. So it will output the current +// line and the next. We deal with this by having at least 2 lines between the #loc's // lldb-command:run // lldb-command:next diff --git a/src/test/debuginfo/generic-enum-with-different-disr-sizes-legacy.rs b/src/test/debuginfo/generic-enum-with-different-disr-sizes-legacy.rs index 4f17e48c6a437..b761f951625e2 100644 --- a/src/test/debuginfo/generic-enum-with-different-disr-sizes-legacy.rs +++ b/src/test/debuginfo/generic-enum-with-different-disr-sizes-legacy.rs @@ -3,7 +3,7 @@ // min-lldb-version: 310 // As long as LLVM 5 and LLVM 6 are supported, we want to test the -// enum debuginfo fallback mode. Once those are desupported, this +// enum debuginfo fallback mode. Once those are desupported, this // test can be removed, as there is another (non-"legacy") test that // tests the new mode. // ignore-llvm-version: 7.0 - 9.9.9 diff --git a/src/test/debuginfo/generic-struct-style-enum-legacy.rs b/src/test/debuginfo/generic-struct-style-enum-legacy.rs index 37a875a4188c1..f2bd0f8d4d648 100644 --- a/src/test/debuginfo/generic-struct-style-enum-legacy.rs +++ b/src/test/debuginfo/generic-struct-style-enum-legacy.rs @@ -3,7 +3,7 @@ // ignore-gdb-version: 7.11.90 - 7.12.9 // As long as LLVM 5 and LLVM 6 are supported, we want to test the -// enum debuginfo fallback mode. Once those are desupported, this +// enum debuginfo fallback mode. Once those are desupported, this // test can be removed, as there is another (non-"legacy") test that // tests the new mode. // ignore-llvm-version: 7.0 - 9.9.9 diff --git a/src/test/debuginfo/generic-tuple-style-enum-legacy.rs b/src/test/debuginfo/generic-tuple-style-enum-legacy.rs index 452e90008ea60..33daf65613fc4 100644 --- a/src/test/debuginfo/generic-tuple-style-enum-legacy.rs +++ b/src/test/debuginfo/generic-tuple-style-enum-legacy.rs @@ -3,7 +3,7 @@ // ignore-gdb-version: 7.11.90 - 7.12.9 // As long as LLVM 5 and LLVM 6 are supported, we want to test the -// enum debuginfo fallback mode. Once those are desupported, this +// enum debuginfo fallback mode. Once those are desupported, this // test can be removed, as there is another (non-"legacy") test that // tests the new mode. // ignore-llvm-version: 7.0 - 9.9.9 diff --git a/src/test/debuginfo/issue-12886.rs b/src/test/debuginfo/issue-12886.rs index 892f7d9485f9c..bbc1b8f372197 100644 --- a/src/test/debuginfo/issue-12886.rs +++ b/src/test/debuginfo/issue-12886.rs @@ -1,4 +1,4 @@ -// ignore-windows failing on 64-bit bots FIXME #17638 +// ignore-windows FIXME(#17638): failing on 64-bit bots // ignore-lldb // ignore-aarch64 diff --git a/src/test/debuginfo/lexical-scope-with-macro.rs b/src/test/debuginfo/lexical-scope-with-macro.rs index 3dab7939265ac..3bfe54cc5fa01 100644 --- a/src/test/debuginfo/lexical-scope-with-macro.rs +++ b/src/test/debuginfo/lexical-scope-with-macro.rs @@ -1,5 +1,5 @@ // min-lldb-version: 310 -// ignore-lldb FIXME #48807 +// ignore-lldb FIXME(#48807): // compile-flags:-g -Zdebug-macros diff --git a/src/test/debuginfo/macro-stepping.rs b/src/test/debuginfo/macro-stepping.rs index e4b2b7b79bcb9..a3bcaee8b78c7 100644 --- a/src/test/debuginfo/macro-stepping.rs +++ b/src/test/debuginfo/macro-stepping.rs @@ -50,8 +50,8 @@ extern crate macro_stepping; // exports new_scope!() // lldb-command:set set stop-line-count-before 0 // lldb-command:set set stop-line-count-after 1 -// Can't set both to zero or lldb will stop printing source at all. So it will output the current -// line and the next. We deal with this by having at least 2 lines between the #loc's +// Can't set both to zero or lldb will stop printing source at all. So it will output the current +// line and the next. We deal with this by having at least 2 lines between the #loc's // lldb-command:run // lldb-command:next diff --git a/src/test/debuginfo/recursive-struct-legacy.rs b/src/test/debuginfo/recursive-struct-legacy.rs index 99286708ae243..54d9c3763c4f2 100644 --- a/src/test/debuginfo/recursive-struct-legacy.rs +++ b/src/test/debuginfo/recursive-struct-legacy.rs @@ -2,7 +2,7 @@ // ignore-lldb // As long as LLVM 5 and LLVM 6 are supported, we want to test the -// enum debuginfo fallback mode. Once those are desupported, this +// enum debuginfo fallback mode. Once those are desupported, this // test can be removed, as there is another (non-"legacy") test that // tests the new mode. // ignore-llvm-version: 7.0 - 9.9.9 diff --git a/src/test/debuginfo/struct-style-enum-legacy.rs b/src/test/debuginfo/struct-style-enum-legacy.rs index 1433493fd5d0f..0a5eb8cb5d716 100644 --- a/src/test/debuginfo/struct-style-enum-legacy.rs +++ b/src/test/debuginfo/struct-style-enum-legacy.rs @@ -2,7 +2,7 @@ // min-lldb-version: 310 // As long as LLVM 5 and LLVM 6 are supported, we want to test the -// enum debuginfo fallback mode. Once those are desupported, this +// enum debuginfo fallback mode. Once those are desupported, this // test can be removed, as there is another (non-"legacy") test that // tests the new mode. // ignore-llvm-version: 7.0 - 9.9.9 diff --git a/src/test/debuginfo/tuple-style-enum-legacy.rs b/src/test/debuginfo/tuple-style-enum-legacy.rs index ebc8e03443881..68dace7b27fdc 100644 --- a/src/test/debuginfo/tuple-style-enum-legacy.rs +++ b/src/test/debuginfo/tuple-style-enum-legacy.rs @@ -2,7 +2,7 @@ // min-lldb-version: 310 // As long as LLVM 5 and LLVM 6 are supported, we want to test the -// enum debuginfo fallback mode. Once those are desupported, this +// enum debuginfo fallback mode. Once those are desupported, this // test can be removed, as there is another (non-"legacy") test that // tests the new mode. // ignore-llvm-version: 7.0 - 9.9.9 diff --git a/src/test/debuginfo/unique-enum-legacy.rs b/src/test/debuginfo/unique-enum-legacy.rs index e7c9357752897..6888b4bcd88e1 100644 --- a/src/test/debuginfo/unique-enum-legacy.rs +++ b/src/test/debuginfo/unique-enum-legacy.rs @@ -2,7 +2,7 @@ // min-lldb-version: 310 // As long as LLVM 5 and LLVM 6 are supported, we want to test the -// enum debuginfo fallback mode. Once those are desupported, this +// enum debuginfo fallback mode. Once those are desupported, this // test can be removed, as there is another (non-"legacy") test that // tests the new mode. // ignore-llvm-version: 7.0 - 9.9.9 diff --git a/src/test/debuginfo/vec-slices.rs b/src/test/debuginfo/vec-slices.rs index 8d9fc498882d3..93b888e296815 100644 --- a/src/test/debuginfo/vec-slices.rs +++ b/src/test/debuginfo/vec-slices.rs @@ -59,12 +59,12 @@ // gdbg-check:$15 = {64, 65} // gdbr-check:$15 = [64, 65] -//gdb-command:print mut_slice.length -//gdb-check:$16 = 5 -//gdbg-command:print *((i64[5]*)(mut_slice.data_ptr)) -//gdbr-command:print *(mut_slice.data_ptr as &[i64; 5]) -//gdbg-check:$17 = {1, 2, 3, 4, 5} -//gdbr-check:$17 = [1, 2, 3, 4, 5] +// gdb-command:print mut_slice.length +// gdb-check:$16 = 5 +// gdbg-command:print *((i64[5]*)(mut_slice.data_ptr)) +// gdbr-command:print *(mut_slice.data_ptr as &[i64; 5]) +// gdbg-check:$17 = {1, 2, 3, 4, 5} +// gdbr-check:$17 = [1, 2, 3, 4, 5] // === LLDB TESTS ================================================================================== diff --git a/src/test/incremental/change_add_field/struct_point.rs b/src/test/incremental/change_add_field/struct_point.rs index 6006831e48234..fe680a7bc4e07 100644 --- a/src/test/incremental/change_add_field/struct_point.rs +++ b/src/test/incremental/change_add_field/struct_point.rs @@ -1,7 +1,7 @@ -// Test where we change a type definition by adding a field. Fns with -// this type in their signature are recompiled, as are their callers. -// Fns with that type used only in their body are also recompiled, but -// their callers are not. +// Test where we change a type definition by adding a field. Functions +// with this type in their signature are recompiled, as are their callers. +// Functions with that type used only in their body are also recompiled, +// but their callers are not. // revisions:cfail1 cfail2 // compile-flags: -Z query-dep-graph @@ -60,7 +60,7 @@ pub mod point { } } -/// A fn that has the changed type in its signature; must currently be +/// A function that has the changed type in its signature; must currently be /// rebuilt. /// /// You could imagine that, in the future, if the change were @@ -76,7 +76,7 @@ pub mod fn_with_type_in_sig { } } -/// Call a fn that has the changed type in its signature; this +/// Call a function that has the changed type in its signature; this /// currently must also be rebuilt. /// /// You could imagine that, in the future, if the change were @@ -92,7 +92,7 @@ pub mod call_fn_with_type_in_sig { } } -/// A fn that uses the changed type, but only in its body, not its +/// A function that uses the changed type, but only in its body, not its /// signature. /// /// You could imagine that, in the future, if the change were @@ -108,10 +108,10 @@ pub mod fn_with_type_in_body { } } -/// A fn X that calls a fn Y, where Y uses the changed type in its +/// A function `X` that calls a function `Y`, where `Y` uses the changed type in its /// body. In this case, the effects of the change should be contained -/// to Y; X should not have to be rebuilt, nor should it need to be -/// typechecked again. +/// to `Y`; `X` should not have to be rebuilt, nor should it need to be +/// type-checked again. pub mod call_fn_with_type_in_body { use fn_with_type_in_body; @@ -121,7 +121,7 @@ pub mod call_fn_with_type_in_body { } } -/// A fn item that makes an instance of `Point` but does not invoke methods +/// A function item that makes an instance of `Point` but does not invoke methods. pub mod fn_make_struct { use point::Point; @@ -131,7 +131,7 @@ pub mod fn_make_struct { } } -/// A fn item that reads fields from `Point` but does not invoke methods +/// A function item that reads fields from `Point` but does not invoke methods. pub mod fn_read_field { use point::Point; @@ -141,7 +141,7 @@ pub mod fn_read_field { } } -/// A fn item that writes to a field of `Point` but does not invoke methods +/// A function item that writes to a field of `Point` but does not invoke methods. pub mod fn_write_field { use point::Point; diff --git a/src/test/incremental/extern_static/issue-49153.rs b/src/test/incremental/extern_static/issue-49153.rs index f1dbac288853e..c17ef275f7d5b 100644 --- a/src/test/incremental/extern_static/issue-49153.rs +++ b/src/test/incremental/extern_static/issue-49153.rs @@ -1,5 +1,3 @@ -// https://github.com/rust-lang/rust/issues/49153 - // revisions:rpass1 rpass2 extern "C" { diff --git a/src/test/incremental/inlined_hir_34991/main.rs b/src/test/incremental/inlined_hir_34991/main.rs index 819b8434b0839..fc625648e8428 100644 --- a/src/test/incremental/inlined_hir_34991/main.rs +++ b/src/test/incremental/inlined_hir_34991/main.rs @@ -1,7 +1,7 @@ // Regression test for #34991: an ICE occurred here because we inline -// some of the vector routines and give them a local def-id `X`. This +// some of the vector routines and give them a local def-ID `X`. This // got hashed after codegen (`Hir(X)`). When we load back up, we get an -// error because the `X` is remapped to the original def-id (in +// error because the `X` is remapped to the original def-ID (in // libstd), and we can't hash a HIR node from std. // revisions:rpass1 rpass2 diff --git a/src/test/incremental/issue-38222.rs b/src/test/incremental/issue-38222.rs index df08661c1500e..42073a1adcd44 100644 --- a/src/test/incremental/issue-38222.rs +++ b/src/test/incremental/issue-38222.rs @@ -1,16 +1,13 @@ -// Test that debuginfo does not introduce a dependency edge to the Krate -// dep-node. +// Test that debuginfo does not introduce a dependency edge to the crate dep-node. // revisions:rpass1 rpass2 // compile-flags: -Z query-dep-graph - #![feature(rustc_attrs)] - #![rustc_partition_reused(module="issue_38222-mod1", cfg="rpass2")] -// If codegen had added a dependency edge to the Krate dep-node, nothing would +// If codegen had added a dependency edge to the crate dep-node, nothing would // be re-used, so checking that this module was re-used is sufficient. #![rustc_partition_reused(module="issue_38222", cfg="rpass2")] diff --git a/src/test/incremental/issue-49043.rs b/src/test/incremental/issue-49043.rs index 50d8fb8693077..337f976c289d5 100644 --- a/src/test/incremental/issue-49043.rs +++ b/src/test/incremental/issue-49043.rs @@ -1,7 +1,7 @@ -// Regression test for hashing involving canonical variables. In this -// test -- which has an intensional error -- the type of the value +// Regression test for hashing involving canonical variables. In this +// test, which has an intentional error, the type of the value // being dropped winds up including a type variable. Canonicalization -// would then produce a `?0` which -- in turn -- triggered an ICE in +// would then produce a `?0`, which in turn triggered an ICE during // hashing. // revisions:cfail1 diff --git a/src/test/incremental/static_refering_to_other_static/issue-49081.rs b/src/test/incremental/static_refering_to_other_static/issue-49081.rs index 8e3715d1d8341..5a67d87eca873 100644 --- a/src/test/incremental/static_refering_to_other_static/issue-49081.rs +++ b/src/test/incremental/static_refering_to_other_static/issue-49081.rs @@ -1,5 +1,3 @@ -// https://github.com/rust-lang/rust/issues/49081 - // revisions:rpass1 rpass2 pub static A: i32 = 42; diff --git a/src/test/incremental/static_stable_hash/issue-49301.rs b/src/test/incremental/static_stable_hash/issue-49301.rs index fdd05c72ca3cd..d759817d006c0 100644 --- a/src/test/incremental/static_stable_hash/issue-49301.rs +++ b/src/test/incremental/static_stable_hash/issue-49301.rs @@ -1,5 +1,3 @@ -// https://github.com/rust-lang/rust/issues/49081 - // revisions:rpass1 rpass2 #[cfg(rpass1)] diff --git a/src/test/pretty/disamb-stmt-expr.rs b/src/test/pretty/disamb-stmt-expr.rs index 601ca7bb6de1c..1fdbe0a316224 100644 --- a/src/test/pretty/disamb-stmt-expr.rs +++ b/src/test/pretty/disamb-stmt-expr.rs @@ -1,7 +1,7 @@ // pp-exact // Here we check that the parentheses around the body of `wsucc()` are -// preserved. They are needed to disambiguate `{return n+1}; - 0` from +// preserved. They are needed to disambiguate `{return n+1}; - 0` from // `({return n+1}-0)`. fn id(f: F) -> isize where F: Fn() -> isize { f() } diff --git a/src/test/pretty/top-level-doc-comments.rs b/src/test/pretty/top-level-doc-comments.rs index 16f95d334cbcf..1ba38944899af 100644 --- a/src/test/pretty/top-level-doc-comments.rs +++ b/src/test/pretty/top-level-doc-comments.rs @@ -8,6 +8,6 @@ struct X; // pp-exact -// Test that rust can properly pretty print a doc comment if it's the first line in a file. some +// Test that rust can properly pretty print a doc comment if it's the first line in a file. some fn main() { let x = X; } diff --git a/src/test/run-pass-fulldeps/ast_stmt_expr_attr.rs b/src/test/run-pass-fulldeps/ast_stmt_expr_attr.rs index d32fafd215c07..d3e1bfab99317 100644 --- a/src/test/run-pass-fulldeps/ast_stmt_expr_attr.rs +++ b/src/test/run-pass-fulldeps/ast_stmt_expr_attr.rs @@ -272,7 +272,7 @@ fn run() { reject_stmt_parse("#[attr] #![attr] foo![]"); reject_stmt_parse("#[attr] #![attr] foo!{}"); - // FIXME: Allow attributes in pattern constexprs? + // FIXME: allow attributes in pattern constexprs? // note: requires parens in patterns to allow disambiguation reject_expr_parse("match 0 { diff --git a/src/test/run-pass-fulldeps/issue-15149.rs b/src/test/run-pass-fulldeps/issue-15149.rs index 2a62fabf53d3a..acf70faf2e435 100644 --- a/src/test/run-pass-fulldeps/issue-15149.rs +++ b/src/test/run-pass-fulldeps/issue-15149.rs @@ -12,7 +12,7 @@ fn main() { // If we're the child, make sure we were invoked correctly let args: Vec = env::args().collect(); if args.len() > 1 && args[1] == "child" { - // FIXME: This should check the whole `args[0]` instead of just + // FIXME: this should check the whole `args[0]` instead of just // checking that it ends_with the executable name. This // is needed because of Windows, which has a different behavior. // See #15149 for more info. diff --git a/src/test/run-pass-fulldeps/issue-15924.rs b/src/test/run-pass-fulldeps/issue-15924.rs index 9d807533f429d..aab6fbfdf5bd1 100644 --- a/src/test/run-pass-fulldeps/issue-15924.rs +++ b/src/test/run-pass-fulldeps/issue-15924.rs @@ -1,6 +1,6 @@ #![allow(unused_imports)] #![allow(unused_must_use)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![feature(rustc_private)] diff --git a/src/test/run-pass-fulldeps/issue-4036.rs b/src/test/run-pass-fulldeps/issue-4036.rs index 0cbd8adf977d8..b261f0538173f 100644 --- a/src/test/run-pass-fulldeps/issue-4036.rs +++ b/src/test/run-pass-fulldeps/issue-4036.rs @@ -1,7 +1,7 @@ // Issue #4036: Test for an issue that arose around fixing up type inference // byproducts in vtable records. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![feature(rustc_private)] diff --git a/src/test/run-pass-fulldeps/myriad-closures.rs b/src/test/run-pass-fulldeps/myriad-closures.rs index a1ea0e685d659..bc21b354c5586 100644 --- a/src/test/run-pass-fulldeps/myriad-closures.rs +++ b/src/test/run-pass-fulldeps/myriad-closures.rs @@ -1,7 +1,7 @@ // This test case tests whether we can handle code bases that contain a high // number of closures, something that needs special handling in the MingGW // toolchain. -// See https://github.com/rust-lang/rust/issues/34793 for more information. +// See issue #34793 for more information. // Make sure we don't optimize anything away: // compile-flags: -C no-prepopulate-passes -Cpasses=name-anon-globals diff --git a/src/test/run-pass-fulldeps/pprust-expr-roundtrip.rs b/src/test/run-pass-fulldeps/pprust-expr-roundtrip.rs index ce3b03efd2604..37dbb56208dac 100644 --- a/src/test/run-pass-fulldeps/pprust-expr-roundtrip.rs +++ b/src/test/run-pass-fulldeps/pprust-expr-roundtrip.rs @@ -2,19 +2,19 @@ // The general idea of this test is to enumerate all "interesting" expressions and check that -// `parse(print(e)) == e` for all `e`. Here's what's interesting, for the purposes of this test: +// `parse(print(e)) == e` for all `e`. Here's what's interesting, for the purposes of this test: // // 1. The test focuses on expression nesting, because interactions between different expression // types are harder to test manually than single expression types in isolation. // -// 2. The test only considers expressions of at most two nontrivial nodes. So it will check `x + -// x` and `x + (x - x)` but not `(x * x) + (x - x)`. The assumption here is that the correct +// 2. The test only considers expressions of at most two nontrivial nodes. So it will check `x + +// x` and `x + (x - x)` but not `(x * x) + (x - x)`. The assumption here is that the correct // handling of an expression might depend on the expression's parent, but doesn't depend on its // siblings or any more distant ancestors. // -// 3. The test only checks certain expression kinds. The assumption is that similar expression -// types, such as `if` and `while` or `+` and `-`, will be handled identically in the printer -// and parser. So if all combinations of exprs involving `if` work correctly, then combinations +// 3. The test only checks certain expression kinds. The assumption is that similar expression +// types, such as `if` and `while` or `+` and `-`, will be handled identically in the printer +// and parser. So if all combinations of exprs involving `if` work correctly, then combinations // using `while`, `if let`, and so on will likely work as well. @@ -155,7 +155,7 @@ fn iter_exprs(depth: usize, f: &mut FnMut(P)) { } -// Folders for manipulating the placement of `Paren` nodes. See below for why this is needed. +// Folders for manipulating the placement of `Paren` nodes. See below for why this is needed. /// Folder that removes all `ExprKind::Paren` nodes. struct RemoveParens; @@ -203,8 +203,8 @@ fn run() { // We want to know if `parsed` is structurally identical to `e`, ignoring trivial // differences like placement of `Paren`s or the exact ranges of node spans. - // Unfortunately, there is no easy way to make this comparison. Instead, we add `Paren`s - // everywhere we can, then pretty-print. This should give an unambiguous representation of + // Unfortunately, there is no easy way to make this comparison. Instead, we add `Paren`s + // everywhere we can, then pretty-print. This should give an unambiguous representation of // each `Expr`, and it bypasses nearly all of the parenthesization logic, so we aren't // relying on the correctness of the very thing we're testing. let e1 = AddParens.fold_expr(RemoveParens.fold_expr(e)); diff --git a/src/test/run-pass-valgrind/coerce-match-calls.rs b/src/test/run-pass-valgrind/coerce-match-calls.rs index 60943aad80dc2..d53b7b70f4aba 100644 --- a/src/test/run-pass-valgrind/coerce-match-calls.rs +++ b/src/test/run-pass-valgrind/coerce-match-calls.rs @@ -1,6 +1,6 @@ // Check that coercions are propagated through match and if expressions. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): use std::boxed::Box; diff --git a/src/test/run-pass-valgrind/coerce-match.rs b/src/test/run-pass-valgrind/coerce-match.rs index a4ba5427d4b04..8dbfd4731fdeb 100644 --- a/src/test/run-pass-valgrind/coerce-match.rs +++ b/src/test/run-pass-valgrind/coerce-match.rs @@ -1,6 +1,6 @@ // Check that coercions are propagated through match and if expressions. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![feature(box_syntax)] diff --git a/src/test/run-pass-valgrind/osx-frameworks.rs b/src/test/run-pass-valgrind/osx-frameworks.rs index 4ea804a184474..1236c2b3a3471 100644 --- a/src/test/run-pass-valgrind/osx-frameworks.rs +++ b/src/test/run-pass-valgrind/osx-frameworks.rs @@ -1,5 +1,5 @@ // no-prefer-dynamic -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![feature(rustc_private)] diff --git a/src/test/run-pass/alias-uninit-value.rs b/src/test/run-pass/alias-uninit-value.rs index c0fd09cbd40fb..a5b36b1ee5096 100644 --- a/src/test/run-pass/alias-uninit-value.rs +++ b/src/test/run-pass/alias-uninit-value.rs @@ -5,7 +5,7 @@ // Regression test for issue #374 -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): enum sty { ty_nil, } diff --git a/src/test/run-pass/alloca-from-derived-tydesc.rs b/src/test/run-pass/alloca-from-derived-tydesc.rs index 55f65806ab094..c9c40de40820c 100644 --- a/src/test/run-pass/alloca-from-derived-tydesc.rs +++ b/src/test/run-pass/alloca-from-derived-tydesc.rs @@ -2,7 +2,7 @@ #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): enum option { some(T), none, } diff --git a/src/test/run-pass/anon-extern-mod.rs b/src/test/run-pass/anon-extern-mod.rs index 6d7e3f3cd5c1a..d6279655b8291 100644 --- a/src/test/run-pass/anon-extern-mod.rs +++ b/src/test/run-pass/anon-extern-mod.rs @@ -1,5 +1,5 @@ -// pretty-expanded FIXME #23616 -// ignore-wasm32-bare no libc to test ffi with +// pretty-expanded FIXME(#23616) +// ignore-wasm32-bare no libc to test FFI with #![feature(rustc_private)] diff --git a/src/test/run-pass/arbitrary_self_types_pointers_and_wrappers.rs b/src/test/run-pass/arbitrary_self_types_pointers_and_wrappers.rs index 6904c29111ee3..e165ec5ed760a 100644 --- a/src/test/run-pass/arbitrary_self_types_pointers_and_wrappers.rs +++ b/src/test/run-pass/arbitrary_self_types_pointers_and_wrappers.rs @@ -36,7 +36,7 @@ impl, U> DispatchFromDyn> for Wrapper {} trait Trait { // This method isn't object-safe yet. Unsized by-value `self` is object-safe (but not callable // without unsized_locals), but wrappers arond `Self` currently are not. - // FIXME (mikeyhew) uncomment this when unsized rvalues object-safety is implemented + // FIXME(mikeyhew) uncomment this when unsized rvalues object-safety is implemented // fn wrapper(self: Wrapper) -> i32; fn ptr_wrapper(self: Ptr>) -> i32; fn wrapper_ptr(self: Wrapper>) -> i32; diff --git a/src/test/run-pass/array-slice-vec/box-of-array-of-drop-1.rs b/src/test/run-pass/array-slice-vec/box-of-array-of-drop-1.rs index d485893281562..1beb58e860337 100644 --- a/src/test/run-pass/array-slice-vec/box-of-array-of-drop-1.rs +++ b/src/test/run-pass/array-slice-vec/box-of-array-of-drop-1.rs @@ -32,11 +32,11 @@ fn main() { assert!(g.join().is_err()); // When the panic occurs, we will be in the midst of constructing - // the input to `_b3`. Therefore, we drop the elements of the + // the input to `_b3`. Therefore, we drop the elements of the // partially filled array first, before we get around to dropping // the elements of `_b1` and _b2`. - // Issue 23222: The order in which the elements actually get + // Issue #23222: The order in which the elements actually get // dropped is a little funky. See similar notes in nested-vec-3; // in essence, I would not be surprised if we change the ordering // given in `expect` in the future. diff --git a/src/test/run-pass/array-slice-vec/box-of-array-of-drop-2.rs b/src/test/run-pass/array-slice-vec/box-of-array-of-drop-2.rs index e8a5b00a55b9c..13b98b52cab09 100644 --- a/src/test/run-pass/array-slice-vec/box-of-array-of-drop-2.rs +++ b/src/test/run-pass/array-slice-vec/box-of-array-of-drop-2.rs @@ -32,11 +32,11 @@ fn main() { assert!(g.join().is_err()); // When the panic occurs, we will be in the midst of constructing - // the input to `_b3`. Therefore, we drop the elements of the + // the input to `_b3`. Therefore, we drop the elements of the // partially filled array first, before we get around to dropping // the elements of `_b1` and _b2`. - // Issue 23222: The order in which the elements actually get + // Issue #23222: The order in which the elements actually get // dropped is a little funky. See similar notes in nested-vec-3; // in essence, I would not be surprised if we change the ordering // given in `expect` in the future. diff --git a/src/test/run-pass/array-slice-vec/cast-in-array-size.rs b/src/test/run-pass/array-slice-vec/cast-in-array-size.rs index b112dcaef3e42..7953d4056659c 100644 --- a/src/test/run-pass/array-slice-vec/cast-in-array-size.rs +++ b/src/test/run-pass/array-slice-vec/cast-in-array-size.rs @@ -2,7 +2,7 @@ // issues #10618 and #16382 -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): const SIZE: isize = 25; diff --git a/src/test/run-pass/array-slice-vec/empty-mutable-vec.rs b/src/test/run-pass/array-slice-vec/empty-mutable-vec.rs index 91ab280b9c7ec..f3a17a4ee218d 100644 --- a/src/test/run-pass/array-slice-vec/empty-mutable-vec.rs +++ b/src/test/run-pass/array-slice-vec/empty-mutable-vec.rs @@ -1,6 +1,6 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![allow(unused_mut)] diff --git a/src/test/run-pass/array-slice-vec/nested-vec-3.rs b/src/test/run-pass/array-slice-vec/nested-vec-3.rs index 52b892dbcdfaf..6d6de8c2094c9 100644 --- a/src/test/run-pass/array-slice-vec/nested-vec-3.rs +++ b/src/test/run-pass/array-slice-vec/nested-vec-3.rs @@ -33,11 +33,11 @@ fn main() { assert!(g.join().is_err()); // When the panic occurs, we will be in the midst of constructing the - // second inner vector. Therefore, we drop the elements of the + // second inner vector. Therefore, we drop the elements of the // partially filled vector first, before we get around to dropping // the elements of the filled vector. - // Issue 23222: The order in which the elements actually get + // Issue #23222: The order in which the elements actually get // dropped is a little funky: as noted above, we'll drop the 9+10 // first, but due to #23222, they get dropped in reverse // order. Likewise, again due to #23222, we will drop the second diff --git a/src/test/run-pass/array-slice-vec/vec-macro-with-brackets.rs b/src/test/run-pass/array-slice-vec/vec-macro-with-brackets.rs index 6c95bd50007f5..8c93173002f85 100644 --- a/src/test/run-pass/array-slice-vec/vec-macro-with-brackets.rs +++ b/src/test/run-pass/array-slice-vec/vec-macro-with-brackets.rs @@ -1,7 +1,7 @@ // run-pass #![allow(unused_variables)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): macro_rules! vec [ ($($e:expr),*) => ({ diff --git a/src/test/run-pass/array-slice-vec/vec-matching-autoslice.rs b/src/test/run-pass/array-slice-vec/vec-matching-autoslice.rs index 8179edf420cb0..764eb9f86d3a7 100644 --- a/src/test/run-pass/array-slice-vec/vec-matching-autoslice.rs +++ b/src/test/run-pass/array-slice-vec/vec-matching-autoslice.rs @@ -1,5 +1,5 @@ // run-pass -#![allow(illegal_floating_point_literal_pattern)] // FIXME #41620 +#![allow(illegal_floating_point_literal_pattern)] // FIXME(#41620): pub fn main() { let x = [1, 2, 3]; diff --git a/src/test/run-pass/array-slice-vec/vec-repeat-with-cast.rs b/src/test/run-pass/array-slice-vec/vec-repeat-with-cast.rs index 3e0e18873ab0f..a34ca4423bfcb 100644 --- a/src/test/run-pass/array-slice-vec/vec-repeat-with-cast.rs +++ b/src/test/run-pass/array-slice-vec/vec-repeat-with-cast.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): pub fn main() { let _a = [0; 1 as usize]; } diff --git a/src/test/run-pass/array-slice-vec/vector-no-ann-2.rs b/src/test/run-pass/array-slice-vec/vector-no-ann-2.rs index dd8f402f3f6a5..46363b836dd30 100644 --- a/src/test/run-pass/array-slice-vec/vector-no-ann-2.rs +++ b/src/test/run-pass/array-slice-vec/vector-no-ann-2.rs @@ -1,6 +1,6 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![feature(box_syntax)] diff --git a/src/test/run-pass/asm-concat-src.rs b/src/test/run-pass/asm-concat-src.rs index b24586464d673..d9c1c1f40bf33 100644 --- a/src/test/run-pass/asm-concat-src.rs +++ b/src/test/run-pass/asm-concat-src.rs @@ -1,4 +1,4 @@ -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616) // ignore-emscripten no asm #![feature(asm)] diff --git a/src/test/run-pass/assign-assign.rs b/src/test/run-pass/assign-assign.rs index ea0337676fc5f..284068fe81164 100644 --- a/src/test/run-pass/assign-assign.rs +++ b/src/test/run-pass/assign-assign.rs @@ -1,4 +1,4 @@ -// Issue 483 - Assignment expressions result in nil +// Issue #483: assignment expressions result in nil. fn test_assign() { let mut x: isize; diff --git a/src/test/run-pass/associated-types/associated-types-binding-in-where-clause.rs b/src/test/run-pass/associated-types/associated-types-binding-in-where-clause.rs index c54bc3cd6230c..0236f1aec88a7 100644 --- a/src/test/run-pass/associated-types/associated-types-binding-in-where-clause.rs +++ b/src/test/run-pass/associated-types/associated-types-binding-in-where-clause.rs @@ -1,7 +1,7 @@ // run-pass // Test equality constraints on associated types in a where clause. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): pub trait Foo { type A; @@ -21,7 +21,7 @@ impl Foo for char { fn boo(&self) -> Bar { Bar } } -fn foo_bar>(x: I) -> Bar { +fn foo_bar>(x: I) -> Bar { x.boo() } diff --git a/src/test/run-pass/associated-types/associated-types-conditional-dispatch.rs b/src/test/run-pass/associated-types/associated-types-conditional-dispatch.rs index 70ee60517ae86..362eb0d888914 100644 --- a/src/test/run-pass/associated-types/associated-types-conditional-dispatch.rs +++ b/src/test/run-pass/associated-types/associated-types-conditional-dispatch.rs @@ -5,12 +5,12 @@ // `Target=[A]`, then the impl marked with `(*)` is seen to conflict // with all the others. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): use std::marker::PhantomData; use std::ops::Deref; -pub trait MyEq { +pub trait MyEq { fn eq(&self, u: &U) -> bool; } diff --git a/src/test/run-pass/associated-types/associated-types-duplicate-binding-in-env-hrtb.rs b/src/test/run-pass/associated-types/associated-types-duplicate-binding-in-env-hrtb.rs index 12ca100435a47..5f4d0bd48778c 100644 --- a/src/test/run-pass/associated-types/associated-types-duplicate-binding-in-env-hrtb.rs +++ b/src/test/run-pass/associated-types/associated-types-duplicate-binding-in-env-hrtb.rs @@ -4,7 +4,7 @@ // (modulo bound lifetime names) appears in the environment // twice. Issue #21965. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): fn foo(t: T) -> i32 where T : for<'a> Fn(&'a u8) -> i32, diff --git a/src/test/run-pass/associated-types/associated-types-duplicate-binding-in-env.rs b/src/test/run-pass/associated-types/associated-types-duplicate-binding-in-env.rs index 9ffccd3d8ff0d..ff9271aa0839a 100644 --- a/src/test/run-pass/associated-types/associated-types-duplicate-binding-in-env.rs +++ b/src/test/run-pass/associated-types/associated-types-duplicate-binding-in-env.rs @@ -3,7 +3,7 @@ // Check that we do not report ambiguities when the same predicate // appears in the environment twice. Issue #21965. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): trait Foo { type B; diff --git a/src/test/run-pass/associated-types/associated-types-enum-field-named.rs b/src/test/run-pass/associated-types/associated-types-enum-field-named.rs index 896d67213e9b1..95832277b514a 100644 --- a/src/test/run-pass/associated-types/associated-types-enum-field-named.rs +++ b/src/test/run-pass/associated-types/associated-types-enum-field-named.rs @@ -14,7 +14,7 @@ pub enum VarValue { Root { value: K::Value, rank: usize }, } -fn get<'a,K:UnifyKey>,V>(table: &'a Vec>, key: &K) -> &'a Option { +fn get<'a,K:UnifyKey>,V>(table: &'a Vec>, key: &K) -> &'a Option { match table[key.to_index()] { VarValue::Redirect { to: ref k } => get(table, k), VarValue::Root { value: ref v, rank: _ } => v, diff --git a/src/test/run-pass/associated-types/associated-types-enum-field-numbered.rs b/src/test/run-pass/associated-types/associated-types-enum-field-numbered.rs index 77ced3c078106..202842b649094 100644 --- a/src/test/run-pass/associated-types/associated-types-enum-field-numbered.rs +++ b/src/test/run-pass/associated-types/associated-types-enum-field-numbered.rs @@ -14,7 +14,7 @@ pub enum VarValue { Root(K::Value, usize), } -fn get<'a,K:UnifyKey>,V>(table: &'a Vec>, key: &K) -> &'a Option { +fn get<'a,K:UnifyKey>,V>(table: &'a Vec>, key: &K) -> &'a Option { match table[key.to_index()] { VarValue::Redirect(ref k) => get(table, k), VarValue::Root(ref v, _) => v, diff --git a/src/test/run-pass/associated-types/associated-types-eq-obj.rs b/src/test/run-pass/associated-types/associated-types-eq-obj.rs index 0f3dfe338a33c..b4a5056dfeab6 100644 --- a/src/test/run-pass/associated-types/associated-types-eq-obj.rs +++ b/src/test/run-pass/associated-types/associated-types-eq-obj.rs @@ -1,7 +1,7 @@ // run-pass // Test equality constraints on associated types inside of an object type -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): pub trait Foo { type A; @@ -15,7 +15,7 @@ impl Foo for char { fn boo(&self) -> Bar { Bar } } -fn baz(x: &Foo) -> Bar { +fn baz(x: &Foo) -> Bar { x.boo() } diff --git a/src/test/run-pass/associated-types/associated-types-impl-redirect.rs b/src/test/run-pass/associated-types/associated-types-impl-redirect.rs index 8fa20cdf4b7a1..3bfe19ffdc94d 100644 --- a/src/test/run-pass/associated-types/associated-types-impl-redirect.rs +++ b/src/test/run-pass/associated-types/associated-types-impl-redirect.rs @@ -2,7 +2,7 @@ #![allow(dead_code)] #![allow(unused_mut)] #![allow(unused_imports)] -// Test how resolving a projection interacts with inference. In this +// Test how resolving a projection interacts with inference. In this // case, we were eagerly unifying the type variable for the iterator // type with `I` from the where clause, ignoring the in-scope `impl` // for `ByRef`. The right answer was to consider the result ambiguous @@ -38,13 +38,13 @@ impl<'a, I: Iterator> Iterator for ByRef<'a, I> { } } -fn is_iterator_of>(_: &I) {} +fn is_iterator_of>(_: &I) {} -fn test>(mut it: I) { +fn test>(mut it: I) { is_iterator_of::(&it.by_ref()); } -fn test2, I2: Iterator>(mut it: I2) { +fn test2, I2: Iterator>(mut it: I2) { is_iterator_of::(&it) } diff --git a/src/test/run-pass/associated-types/associated-types-issue-20220.rs b/src/test/run-pass/associated-types/associated-types-issue-20220.rs index 19fa7a6085a56..cf280442681a1 100644 --- a/src/test/run-pass/associated-types/associated-types-issue-20220.rs +++ b/src/test/run-pass/associated-types/associated-types-issue-20220.rs @@ -6,7 +6,7 @@ use std::vec; trait IntoIteratorX { type Item; - type IntoIter: Iterator; + type IntoIter: Iterator; fn into_iter_x(self) -> Self::IntoIter; } diff --git a/src/test/run-pass/associated-types/associated-types-issue-20371.rs b/src/test/run-pass/associated-types/associated-types-issue-20371.rs index ae8a8767d2746..55a78c8a2d8f5 100644 --- a/src/test/run-pass/associated-types/associated-types-issue-20371.rs +++ b/src/test/run-pass/associated-types/associated-types-issue-20371.rs @@ -2,7 +2,7 @@ // Test that we are able to have an impl that defines an associated type // before the actual trait. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): impl X for f64 { type Y = isize; } trait X { type Y; } diff --git a/src/test/run-pass/associated-types/associated-types-nested-projections.rs b/src/test/run-pass/associated-types/associated-types-nested-projections.rs index 76ba7496250cc..f4ae903b4a37a 100644 --- a/src/test/run-pass/associated-types/associated-types-nested-projections.rs +++ b/src/test/run-pass/associated-types/associated-types-nested-projections.rs @@ -2,7 +2,7 @@ #![allow(unused_variables)] // Test that we can resolve nested projection types. Issue #20666. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): use std::slice; @@ -32,8 +32,8 @@ fn foo(x: X) where fn bar(x: X) where T: Bound, - I: Iterator, - X: IntoIterator, + I: Iterator, + X: IntoIterator, { } diff --git a/src/test/run-pass/associated-types/associated-types-normalize-in-bounds-binding.rs b/src/test/run-pass/associated-types/associated-types-normalize-in-bounds-binding.rs index 7c54efb83c26a..0caaa48dde261 100644 --- a/src/test/run-pass/associated-types/associated-types-normalize-in-bounds-binding.rs +++ b/src/test/run-pass/associated-types/associated-types-normalize-in-bounds-binding.rs @@ -3,7 +3,7 @@ // Test that we normalize associated types that appear in a bound that // contains a binding. Issue #21664. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![allow(dead_code)] diff --git a/src/test/run-pass/associated-types/associated-types-normalize-in-bounds-ufcs.rs b/src/test/run-pass/associated-types/associated-types-normalize-in-bounds-ufcs.rs index e09aa3663c6e5..474d38e018c73 100644 --- a/src/test/run-pass/associated-types/associated-types-normalize-in-bounds-ufcs.rs +++ b/src/test/run-pass/associated-types/associated-types-normalize-in-bounds-ufcs.rs @@ -3,7 +3,7 @@ // Test that we normalize associated types that appear in bounds; if // we didn't, the call to `self.split2()` fails to type check. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): use std::marker::PhantomData; diff --git a/src/test/run-pass/associated-types/associated-types-normalize-in-bounds.rs b/src/test/run-pass/associated-types/associated-types-normalize-in-bounds.rs index dcfae0f37e1da..ffcdb240ff449 100644 --- a/src/test/run-pass/associated-types/associated-types-normalize-in-bounds.rs +++ b/src/test/run-pass/associated-types/associated-types-normalize-in-bounds.rs @@ -3,7 +3,7 @@ // Test that we normalize associated types that appear in bounds; if // we didn't, the call to `self.split2()` fails to type check. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): use std::marker::PhantomData; diff --git a/src/test/run-pass/associated-types/associated-types-projection-bound-in-supertraits.rs b/src/test/run-pass/associated-types/associated-types-projection-bound-in-supertraits.rs index 107e6b4ce0ca0..e9c618f16ae2c 100644 --- a/src/test/run-pass/associated-types/associated-types-projection-bound-in-supertraits.rs +++ b/src/test/run-pass/associated-types/associated-types-projection-bound-in-supertraits.rs @@ -2,7 +2,7 @@ #![allow(unused_variables)] // Test that we correctly handle projection bounds appearing in the // supertrait list (and in conjunction with overloaded operators). In -// this case, the `Result=Self` binding in the supertrait listing of +// this case, the `Result = Self` binding in the supertrait listing of // `Int` was being ignored. trait Not { @@ -11,7 +11,7 @@ trait Not { fn not(self) -> Self::Result; } -trait Int: Not + Sized { +trait Int: Not + Sized { fn count_ones(self) -> usize; fn count_zeros(self) -> usize { // neither works diff --git a/src/test/run-pass/associated-types/associated-types-projection-in-object-type.rs b/src/test/run-pass/associated-types/associated-types-projection-in-object-type.rs index 0dc32f2fd94ec..b1b3ba5836d0d 100644 --- a/src/test/run-pass/associated-types/associated-types-projection-in-object-type.rs +++ b/src/test/run-pass/associated-types/associated-types-projection-in-object-type.rs @@ -6,7 +6,7 @@ // appear in associated type bindings in object types, which were not // being properly flagged. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): use std::ops::{Shl, Shr}; use std::cell::RefCell; @@ -19,7 +19,7 @@ pub trait Subscriber { pub trait Publisher<'a> { type Output; - fn subscribe(&mut self, _: Box + 'a>); + fn subscribe(&mut self, _: Box + 'a>); } pub trait Processor<'a> : Subscriber + Publisher<'a> { } diff --git a/src/test/run-pass/associated-types/associated-types-projection-in-where-clause.rs b/src/test/run-pass/associated-types/associated-types-projection-in-where-clause.rs index e9a26e53c3c7d..b10d9077f8722 100644 --- a/src/test/run-pass/associated-types/associated-types-projection-in-where-clause.rs +++ b/src/test/run-pass/associated-types/associated-types-projection-in-where-clause.rs @@ -3,7 +3,7 @@ #![allow(unused_variables)] // Test a where clause that uses a non-normalized projection type. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): trait Int { @@ -17,7 +17,7 @@ trait NonZero fn non_zero(self) -> bool; } -fn foo,J>(t: I) -> bool +fn foo,J>(t: I) -> bool where ::T : NonZero // ^~~~~~~~~~~~~ canonical form is just J { diff --git a/src/test/run-pass/associated-types/associated-types-qualified-path-with-trait-with-type-parameters.rs b/src/test/run-pass/associated-types/associated-types-qualified-path-with-trait-with-type-parameters.rs index 3c830d37060ab..69a2b3043d223 100644 --- a/src/test/run-pass/associated-types/associated-types-qualified-path-with-trait-with-type-parameters.rs +++ b/src/test/run-pass/associated-types/associated-types-qualified-path-with-trait-with-type-parameters.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): trait Foo { type Bar; diff --git a/src/test/run-pass/associated-types/associated-types-ref-from-struct.rs b/src/test/run-pass/associated-types/associated-types-ref-from-struct.rs index 3ccba289e4b0a..ab16a3ec5ffd0 100644 --- a/src/test/run-pass/associated-types/associated-types-ref-from-struct.rs +++ b/src/test/run-pass/associated-types/associated-types-ref-from-struct.rs @@ -1,7 +1,7 @@ // run-pass // Test associated type references in structure fields. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): trait Test { type V; diff --git a/src/test/run-pass/associated-types/associated-types-region-erasure-issue-20582.rs b/src/test/run-pass/associated-types/associated-types-region-erasure-issue-20582.rs index b722506dbbf0e..4756e791693d3 100644 --- a/src/test/run-pass/associated-types/associated-types-region-erasure-issue-20582.rs +++ b/src/test/run-pass/associated-types/associated-types-region-erasure-issue-20582.rs @@ -3,7 +3,7 @@ // Regression test for #20582. This test caused an ICE related to // inconsistent region erasure in codegen. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): struct Foo<'a> { buf: &'a[u8] diff --git a/src/test/run-pass/associated-types/associated-types-resolve-lifetime.rs b/src/test/run-pass/associated-types/associated-types-resolve-lifetime.rs index 52f2324d72ab7..4c51fa4ef5f98 100644 --- a/src/test/run-pass/associated-types/associated-types-resolve-lifetime.rs +++ b/src/test/run-pass/associated-types/associated-types-resolve-lifetime.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): trait Get { fn get(&self) -> T; diff --git a/src/test/run-pass/associated-types/associated-types-return.rs b/src/test/run-pass/associated-types/associated-types-return.rs index 997a48b0379a9..9fa81117921e5 100644 --- a/src/test/run-pass/associated-types/associated-types-return.rs +++ b/src/test/run-pass/associated-types/associated-types-return.rs @@ -25,7 +25,7 @@ impl Foo for char { fn boo(&self) -> Bar { Bar } } -fn foo1>(x: I) -> Bar { +fn foo1>(x: I) -> Bar { x.boo() } diff --git a/src/test/run-pass/associated-types/associated-types-struct-field-named.rs b/src/test/run-pass/associated-types/associated-types-struct-field-named.rs index c400bf943e182..28b0fe313e29d 100644 --- a/src/test/run-pass/associated-types/associated-types-struct-field-named.rs +++ b/src/test/run-pass/associated-types/associated-types-struct-field-named.rs @@ -14,7 +14,7 @@ pub struct Node { pub value: K::Value, } -fn foo>,V : Clone>(node: &Node) -> Option { +fn foo>,V : Clone>(node: &Node) -> Option { node.value.clone() } diff --git a/src/test/run-pass/associated-types/associated-types-struct-field-numbered.rs b/src/test/run-pass/associated-types/associated-types-struct-field-numbered.rs index fa59060629ddf..8a1b9755e977b 100644 --- a/src/test/run-pass/associated-types/associated-types-struct-field-numbered.rs +++ b/src/test/run-pass/associated-types/associated-types-struct-field-numbered.rs @@ -11,7 +11,7 @@ pub trait UnifyKey { pub struct Node(K, K::Value); -fn foo>,V : Clone>(node: &Node) -> Option { +fn foo>,V : Clone>(node: &Node) -> Option { node.1.clone() } diff --git a/src/test/run-pass/associated-types/associated-types-where-clause-impl-ambiguity.rs b/src/test/run-pass/associated-types/associated-types-where-clause-impl-ambiguity.rs index f2a4c6e42a93f..33d2abf403790 100644 --- a/src/test/run-pass/associated-types/associated-types-where-clause-impl-ambiguity.rs +++ b/src/test/run-pass/associated-types/associated-types-where-clause-impl-ambiguity.rs @@ -1,7 +1,7 @@ // run-pass #![allow(dead_code)] #![allow(unused_imports)] -// Test how resolving a projection interacts with inference. In this +// Test how resolving a projection interacts with inference. In this // case, we were eagerly unifying the type variable for the iterator // type with `I` from the where clause, ignoring the in-scope `impl` // for `ByRef`. The right answer was to consider the result ambiguous @@ -29,7 +29,7 @@ impl IteratorExt for I where I: Iterator {} struct ByRef<'a, I: 'a + Iterator>(&'a mut I); -impl<'a, A, I> Iterator for ByRef<'a, I> where I: Iterator { +impl<'a, A, I> Iterator for ByRef<'a, I> where I: Iterator { type Item = A; fn next(&mut self) -> Option< ::Item > { @@ -37,9 +37,9 @@ impl<'a, A, I> Iterator for ByRef<'a, I> where I: Iterator { } } -fn is_iterator_of>(_: &I) {} +fn is_iterator_of>(_: &I) {} -fn test>(mut it: I) { +fn test>(mut it: I) { is_iterator_of::(&it.by_ref()); } diff --git a/src/test/run-pass/attr-before-view-item.rs b/src/test/run-pass/attr-before-view-item.rs index 14b4189684f9c..caef882668f34 100644 --- a/src/test/run-pass/attr-before-view-item.rs +++ b/src/test/run-pass/attr-before-view-item.rs @@ -1,6 +1,6 @@ #![allow(unused_attributes)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![feature(custom_attribute, test)] diff --git a/src/test/run-pass/attr-before-view-item2.rs b/src/test/run-pass/attr-before-view-item2.rs index 6fc1e35d47ac5..6bcf1cbc6b01d 100644 --- a/src/test/run-pass/attr-before-view-item2.rs +++ b/src/test/run-pass/attr-before-view-item2.rs @@ -1,6 +1,6 @@ #![allow(unused_attributes)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![feature(custom_attribute, test)] diff --git a/src/test/run-pass/attr-main.rs b/src/test/run-pass/attr-main.rs index 645baf32e0458..9e93479ad83c7 100644 --- a/src/test/run-pass/attr-main.rs +++ b/src/test/run-pass/attr-main.rs @@ -1,4 +1,4 @@ -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616) #![feature(main)] diff --git a/src/test/run-pass/attr-mix-new.rs b/src/test/run-pass/attr-mix-new.rs index 223a434dbb9e7..23d6db3f35201 100644 --- a/src/test/run-pass/attr-mix-new.rs +++ b/src/test/run-pass/attr-mix-new.rs @@ -1,7 +1,7 @@ #![allow(unused_attributes)] #![allow(unknown_lints)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![allow(unused_attribute)] #![feature(custom_attribute)] diff --git a/src/test/run-pass/attr-start.rs b/src/test/run-pass/attr-start.rs index 29f86c9b59e99..fe60fd4aa41f4 100644 --- a/src/test/run-pass/attr-start.rs +++ b/src/test/run-pass/attr-start.rs @@ -1,4 +1,4 @@ -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616) #![feature(start)] diff --git a/src/test/run-pass/attr.rs b/src/test/run-pass/attr.rs index 645baf32e0458..9e93479ad83c7 100644 --- a/src/test/run-pass/attr.rs +++ b/src/test/run-pass/attr.rs @@ -1,4 +1,4 @@ -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616) #![feature(main)] diff --git a/src/test/run-pass/autoref-autoderef/autoderef-and-borrow-method-receiver.rs b/src/test/run-pass/autoref-autoderef/autoderef-and-borrow-method-receiver.rs index 874f4228277e1..f51beb844db8f 100644 --- a/src/test/run-pass/autoref-autoderef/autoderef-and-borrow-method-receiver.rs +++ b/src/test/run-pass/autoref-autoderef/autoderef-and-borrow-method-receiver.rs @@ -1,6 +1,6 @@ // run-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): struct Foo { x: isize, diff --git a/src/test/run-pass/auxiliary/foreign_lib.rs b/src/test/run-pass/auxiliary/foreign_lib.rs index de6b0e2118a58..be1a6b78cf4f5 100644 --- a/src/test/run-pass/auxiliary/foreign_lib.rs +++ b/src/test/run-pass/auxiliary/foreign_lib.rs @@ -23,7 +23,7 @@ pub mod rustrt3 { // Different type, but same ABI (on all supported platforms). // Ensures that we don't ICE or trigger LLVM asserts when // importing the same symbol under different types. - // See https://github.com/rust-lang/rust/issues/32740. + // See issue #32740. extern { pub fn rust_get_test_int() -> *const u8; } diff --git a/src/test/run-pass/auxiliary/kinds_in_metadata.rs b/src/test/run-pass/auxiliary/kinds_in_metadata.rs index 2a2106ff70ac6..2469657ba41bf 100644 --- a/src/test/run-pass/auxiliary/kinds_in_metadata.rs +++ b/src/test/run-pass/auxiliary/kinds_in_metadata.rs @@ -1,6 +1,3 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - // Tests that metadata serialization works for the `Copy` kind. #![crate_type="lib"] diff --git a/src/test/run-pass/auxiliary/nested_item.rs b/src/test/run-pass/auxiliary/nested_item.rs index 9db9d19d6f610..53ae251302b74 100644 --- a/src/test/run-pass/auxiliary/nested_item.rs +++ b/src/test/run-pass/auxiliary/nested_item.rs @@ -6,7 +6,7 @@ pub fn foo() -> isize { } } -// issue 8134 +// issue #8134 struct Foo; impl Foo { pub fn foo(&self) { @@ -14,7 +14,7 @@ impl Foo { } } -// issue 8134 +// issue #8134 pub struct Parser(T); impl> Parser { fn in_doctype(&mut self) { diff --git a/src/test/run-pass/auxiliary/weak-lang-items.rs b/src/test/run-pass/auxiliary/weak-lang-items.rs index 7a698cf76ae51..c5181f3b6719e 100644 --- a/src/test/run-pass/auxiliary/weak-lang-items.rs +++ b/src/test/run-pass/auxiliary/weak-lang-items.rs @@ -1,6 +1,6 @@ // no-prefer-dynamic -// This aux-file will require the eh_personality function to be codegen'd, but +// This aux-file will require the `eh_personality` function to be codegen'ed, but // it hasn't been defined just yet. Make sure we don't explode. #![no_std] diff --git a/src/test/run-pass/backtrace.rs b/src/test/run-pass/backtrace.rs index da3871aba095c..4dd94e62599a2 100644 --- a/src/test/run-pass/backtrace.rs +++ b/src/test/run-pass/backtrace.rs @@ -1,4 +1,4 @@ -// ignore-android FIXME #17520 +// ignore-android FIXME(#17520) // ignore-cloudabi spawning processes is not supported // ignore-emscripten spawning processes is not supported // ignore-openbsd no support for libbacktrace without filename diff --git a/src/test/run-pass/bench/issue-32062.rs b/src/test/run-pass/bench/issue-32062.rs index dc45061da5b50..93001b0dfb573 100644 --- a/src/test/run-pass/bench/issue-32062.rs +++ b/src/test/run-pass/bench/issue-32062.rs @@ -1,6 +1,6 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): fn main() { let _ = test(Some(0).into_iter()); diff --git a/src/test/run-pass/binding/inconsistent-lifetime-mismatch.rs b/src/test/run-pass/binding/inconsistent-lifetime-mismatch.rs index 87768c28cf4a1..cad9a4ad50bb7 100644 --- a/src/test/run-pass/binding/inconsistent-lifetime-mismatch.rs +++ b/src/test/run-pass/binding/inconsistent-lifetime-mismatch.rs @@ -1,6 +1,6 @@ // run-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): fn foo(_: &[&str]) {} diff --git a/src/test/run-pass/binding/match-naked-record-expr.rs b/src/test/run-pass/binding/match-naked-record-expr.rs index c23ff8c949580..05baeb4b0e986 100644 --- a/src/test/run-pass/binding/match-naked-record-expr.rs +++ b/src/test/run-pass/binding/match-naked-record-expr.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): struct X { x: isize } diff --git a/src/test/run-pass/binding/match-naked-record.rs b/src/test/run-pass/binding/match-naked-record.rs index f7479152ebcac..b9f25fc86e8e5 100644 --- a/src/test/run-pass/binding/match-naked-record.rs +++ b/src/test/run-pass/binding/match-naked-record.rs @@ -1,6 +1,6 @@ // run-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): struct X { x: isize } diff --git a/src/test/run-pass/binding/match-path.rs b/src/test/run-pass/binding/match-path.rs index 286214eb8ace8..ac33cd192c89c 100644 --- a/src/test/run-pass/binding/match-path.rs +++ b/src/test/run-pass/binding/match-path.rs @@ -3,7 +3,7 @@ #![allow(non_camel_case_types)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): mod m1 { pub enum foo { foo1, foo2, } diff --git a/src/test/run-pass/binding/match-pattern-simple.rs b/src/test/run-pass/binding/match-pattern-simple.rs index 3f56cd4796d87..c4a33c3a05aab 100644 --- a/src/test/run-pass/binding/match-pattern-simple.rs +++ b/src/test/run-pass/binding/match-pattern-simple.rs @@ -2,7 +2,7 @@ #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): fn altsimple(f: isize) { match f { _x => () } } diff --git a/src/test/run-pass/binding/match-phi.rs b/src/test/run-pass/binding/match-phi.rs index 92a3f6e0f7f60..f12e27d5fcd8a 100644 --- a/src/test/run-pass/binding/match-phi.rs +++ b/src/test/run-pass/binding/match-phi.rs @@ -1,7 +1,7 @@ // run-pass #![allow(dead_code)] #![allow(unused_assignments)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![allow(non_camel_case_types)] #![allow(unused_variables)] diff --git a/src/test/run-pass/binding/match-pipe-binding.rs b/src/test/run-pass/binding/match-pipe-binding.rs index 40dbd2468950e..237b4bb4e6cf5 100644 --- a/src/test/run-pass/binding/match-pipe-binding.rs +++ b/src/test/run-pass/binding/match-pipe-binding.rs @@ -2,7 +2,7 @@ // compile-flags: -Z borrowck=compare fn test1() { - // from issue 6338 + // from issue #6338 match ((1, "a".to_string()), (2, "b".to_string())) { ((1, a), (2, b)) | ((2, b), (1, a)) => { assert_eq!(a, "a".to_string()); diff --git a/src/test/run-pass/binding/match-range-static.rs b/src/test/run-pass/binding/match-range-static.rs index f01a3505ee618..afb59f0bda268 100644 --- a/src/test/run-pass/binding/match-range-static.rs +++ b/src/test/run-pass/binding/match-range-static.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![allow(non_upper_case_globals)] const s: isize = 1; diff --git a/src/test/run-pass/binding/match-range.rs b/src/test/run-pass/binding/match-range.rs index 1dca84dfd45ff..5db6b76e99dfe 100644 --- a/src/test/run-pass/binding/match-range.rs +++ b/src/test/run-pass/binding/match-range.rs @@ -1,5 +1,5 @@ // run-pass -#![allow(illegal_floating_point_literal_pattern)] // FIXME #41620 +#![allow(illegal_floating_point_literal_pattern)] // FIXME(#41620): #![feature(exclusive_range_pattern)] pub fn main() { diff --git a/src/test/run-pass/binding/match-value-binding-in-guard-3291.rs b/src/test/run-pass/binding/match-value-binding-in-guard-3291.rs index 4b209b20a18aa..347275f05df5a 100644 --- a/src/test/run-pass/binding/match-value-binding-in-guard-3291.rs +++ b/src/test/run-pass/binding/match-value-binding-in-guard-3291.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![feature(box_syntax)] diff --git a/src/test/run-pass/binding/nested-exhaustive-match.rs b/src/test/run-pass/binding/nested-exhaustive-match.rs index 8b2294f843272..7a3b5100cb1d3 100644 --- a/src/test/run-pass/binding/nested-exhaustive-match.rs +++ b/src/test/run-pass/binding/nested-exhaustive-match.rs @@ -1,6 +1,6 @@ // run-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): struct Foo { foo: bool, bar: Option, baz: isize } diff --git a/src/test/run-pass/binding/nil-pattern.rs b/src/test/run-pass/binding/nil-pattern.rs index 268af351d0879..2335c42c5a8f4 100644 --- a/src/test/run-pass/binding/nil-pattern.rs +++ b/src/test/run-pass/binding/nil-pattern.rs @@ -1,4 +1,4 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): pub fn main() { let x = (); match x { () => { } } } diff --git a/src/test/run-pass/binding/simple-generic-match.rs b/src/test/run-pass/binding/simple-generic-match.rs index 50cfe19fef48d..7a9c1af8ae75c 100644 --- a/src/test/run-pass/binding/simple-generic-match.rs +++ b/src/test/run-pass/binding/simple-generic-match.rs @@ -1,7 +1,7 @@ // run-pass #![allow(non_camel_case_types)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): enum clam { a(T), } diff --git a/src/test/run-pass/blind-item-mixed-crate-use-item.rs b/src/test/run-pass/blind-item-mixed-crate-use-item.rs index 00d171f6e4d43..1f6570f841301 100644 --- a/src/test/run-pass/blind-item-mixed-crate-use-item.rs +++ b/src/test/run-pass/blind-item-mixed-crate-use-item.rs @@ -1,7 +1,7 @@ // aux-build:blind-item-mixed-crate-use-item-foo.rs // aux-build:blind-item-mixed-crate-use-item-foo2.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): mod m { pub fn f(_: T, _: (), _: ()) { } diff --git a/src/test/run-pass/blind-item-mixed-use-item.rs b/src/test/run-pass/blind-item-mixed-use-item.rs index e6008206ba8f0..e76ec37983e30 100644 --- a/src/test/run-pass/blind-item-mixed-use-item.rs +++ b/src/test/run-pass/blind-item-mixed-use-item.rs @@ -1,4 +1,4 @@ -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616) mod m { pub fn f(_: T, _: ()) { } diff --git a/src/test/run-pass/borrowck/borrowck-assign-to-subfield.rs b/src/test/run-pass/borrowck/borrowck-assign-to-subfield.rs index 050d702b625ab..2bfef675922b7 100644 --- a/src/test/run-pass/borrowck/borrowck-assign-to-subfield.rs +++ b/src/test/run-pass/borrowck/borrowck-assign-to-subfield.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): pub fn main() { struct A { diff --git a/src/test/run-pass/borrowck/borrowck-assignment-to-static-mut.rs b/src/test/run-pass/borrowck/borrowck-assignment-to-static-mut.rs index 25ef48d0d5ce3..780395387b46c 100644 --- a/src/test/run-pass/borrowck/borrowck-assignment-to-static-mut.rs +++ b/src/test/run-pass/borrowck/borrowck-assignment-to-static-mut.rs @@ -1,6 +1,8 @@ +// Test taken from issue #45641. + // run-pass + #![allow(dead_code)] -// Test taken from #45641 (https://github.com/rust-lang/rust/issues/45641) // revisions: ast mir //[mir]compile-flags: -Z borrowck=mir diff --git a/src/test/run-pass/borrowck/borrowck-borrow-of-mut-base-ptr-safe.rs b/src/test/run-pass/borrowck/borrowck-borrow-of-mut-base-ptr-safe.rs index 2839a9195a0e2..82c66e8eb725a 100644 --- a/src/test/run-pass/borrowck/borrowck-borrow-of-mut-base-ptr-safe.rs +++ b/src/test/run-pass/borrowck/borrowck-borrow-of-mut-base-ptr-safe.rs @@ -7,7 +7,7 @@ // // Example from src/librustc_borrowck/borrowck/README.md -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): fn foo<'a>(mut t0: &'a mut isize, mut t1: &'a mut isize) { diff --git a/src/test/run-pass/borrowck/borrowck-field-sensitivity.rs b/src/test/run-pass/borrowck/borrowck-field-sensitivity.rs index cb1ba90de891e..56ae844e722c5 100644 --- a/src/test/run-pass/borrowck/borrowck-field-sensitivity.rs +++ b/src/test/run-pass/borrowck/borrowck-field-sensitivity.rs @@ -1,7 +1,7 @@ // run-pass #![allow(unused_mut)] #![allow(unused_variables)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![feature(box_syntax)] diff --git a/src/test/run-pass/borrowck/borrowck-lend-args.rs b/src/test/run-pass/borrowck/borrowck-lend-args.rs index d0ef2dcdd2867..be54982a9fcae 100644 --- a/src/test/run-pass/borrowck/borrowck-lend-args.rs +++ b/src/test/run-pass/borrowck/borrowck-lend-args.rs @@ -1,7 +1,7 @@ // run-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): fn borrow(_v: &isize) {} diff --git a/src/test/run-pass/borrowck/borrowck-slice-pattern-element-loan.rs b/src/test/run-pass/borrowck/borrowck-slice-pattern-element-loan.rs index 7675147c8ec2a..ba529292f6b2d 100644 --- a/src/test/run-pass/borrowck/borrowck-slice-pattern-element-loan.rs +++ b/src/test/run-pass/borrowck/borrowck-slice-pattern-element-loan.rs @@ -1,5 +1,5 @@ // run-pass -//compile-flags: -Z borrowck=mir +// compile-flags: -Z borrowck=mir #![feature(slice_patterns)] diff --git a/src/test/run-pass/borrowck/borrowck-static-item-in-fn.rs b/src/test/run-pass/borrowck/borrowck-static-item-in-fn.rs index 5f4379325a58a..ff0aac3cd8fb8 100644 --- a/src/test/run-pass/borrowck/borrowck-static-item-in-fn.rs +++ b/src/test/run-pass/borrowck/borrowck-static-item-in-fn.rs @@ -2,7 +2,7 @@ #![allow(dead_code)] // Regression test for issue #7740 -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): pub fn main() { static A: &'static char = &'A'; diff --git a/src/test/run-pass/borrowck/borrowck-trait-lifetime.rs b/src/test/run-pass/borrowck/borrowck-trait-lifetime.rs index 9721b08233e39..b2046a7800fd0 100644 --- a/src/test/run-pass/borrowck/borrowck-trait-lifetime.rs +++ b/src/test/run-pass/borrowck/borrowck-trait-lifetime.rs @@ -3,7 +3,7 @@ // This test verifies that casting from the same lifetime on a value // to the same lifetime on a trait succeeds. See issue #10766. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![allow(dead_code)] diff --git a/src/test/run-pass/borrowck/borrowck-uniq-via-ref.rs b/src/test/run-pass/borrowck/borrowck-uniq-via-ref.rs index bdf7cc57a539e..f66457c3bb082 100644 --- a/src/test/run-pass/borrowck/borrowck-uniq-via-ref.rs +++ b/src/test/run-pass/borrowck/borrowck-uniq-via-ref.rs @@ -1,7 +1,7 @@ // run-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): struct Rec { f: Box, diff --git a/src/test/run-pass/borrowck/borrowck-unsafe-static-mutable-borrows.rs b/src/test/run-pass/borrowck/borrowck-unsafe-static-mutable-borrows.rs index 0487c179e3688..65753ea171173 100644 --- a/src/test/run-pass/borrowck/borrowck-unsafe-static-mutable-borrows.rs +++ b/src/test/run-pass/borrowck/borrowck-unsafe-static-mutable-borrows.rs @@ -1,9 +1,9 @@ +// Test taken from issue #45129. + // run-pass // revisions: ast mir //[mir]compile-flags: -Z borrowck=mir -// Test file taken from issue 45129 (https://github.com/rust-lang/rust/issues/45129) - struct Foo { x: [usize; 2] } static mut SFOO: Foo = Foo { x: [23, 32] }; diff --git a/src/test/run-pass/borrowck/borrowck-use-mut-borrow.rs b/src/test/run-pass/borrowck/borrowck-use-mut-borrow.rs index bcd1d3ccd8acb..c626e96304e75 100644 --- a/src/test/run-pass/borrowck/borrowck-use-mut-borrow.rs +++ b/src/test/run-pass/borrowck/borrowck-use-mut-borrow.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![feature(box_syntax)] diff --git a/src/test/run-pass/box-new.rs b/src/test/run-pass/box-new.rs index 2d177bcf9276c..368a62f05fc5f 100644 --- a/src/test/run-pass/box-new.rs +++ b/src/test/run-pass/box-new.rs @@ -1,4 +1,4 @@ -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616) fn main() { let _a = Box::new(1); diff --git a/src/test/run-pass/bug-7295.rs b/src/test/run-pass/bug-7295.rs index b6dea6c82dc1a..98041345c0ea7 100644 --- a/src/test/run-pass/bug-7295.rs +++ b/src/test/run-pass/bug-7295.rs @@ -1,4 +1,4 @@ -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616) pub trait Foo { fn func1(&self, t: U, w: T); @@ -8,6 +8,4 @@ pub trait Foo { } } -pub fn main() { - -} +pub fn main() {} diff --git a/src/test/run-pass/builtin-superkinds-phantom-typaram.rs b/src/test/run-pass/builtin-superkinds-phantom-typaram.rs index 3899ecf6f3f7d..310a529f65662 100644 --- a/src/test/run-pass/builtin-superkinds-phantom-typaram.rs +++ b/src/test/run-pass/builtin-superkinds-phantom-typaram.rs @@ -3,7 +3,7 @@ // super-builtin-kind of a trait, if the type parameter is never used, // the type can implement the trait anyway. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): use std::marker; diff --git a/src/test/run-pass/builtin-superkinds-simple.rs b/src/test/run-pass/builtin-superkinds-simple.rs index 670b8ed0e9bc1..aae36151a475e 100644 --- a/src/test/run-pass/builtin-superkinds-simple.rs +++ b/src/test/run-pass/builtin-superkinds-simple.rs @@ -1,6 +1,6 @@ // Simple test case of implementing a trait with super-builtin-kinds. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): trait Foo : Send { } diff --git a/src/test/run-pass/builtin-superkinds-typaram.rs b/src/test/run-pass/builtin-superkinds-typaram.rs index c3a456318bce6..bc903a55cae08 100644 --- a/src/test/run-pass/builtin-superkinds-typaram.rs +++ b/src/test/run-pass/builtin-superkinds-typaram.rs @@ -1,7 +1,7 @@ // Tests correct implementation of traits with super-builtin-kinds // using a bounded type parameter. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): trait Foo : Send { } diff --git a/src/test/run-pass/c-stack-as-value.rs b/src/test/run-pass/c-stack-as-value.rs index 3b997295c122a..0230b913f8370 100644 --- a/src/test/run-pass/c-stack-as-value.rs +++ b/src/test/run-pass/c-stack-as-value.rs @@ -1,5 +1,5 @@ -// pretty-expanded FIXME #23616 -// ignore-wasm32-bare no libc to test ffi with +// pretty-expanded FIXME(#23616) +// ignore-wasm32-bare no libc to test FFI with #![feature(rustc_private)] diff --git a/src/test/run-pass/can-copy-pod.rs b/src/test/run-pass/can-copy-pod.rs index bc10d236b3639..95b596ec5af6e 100644 --- a/src/test/run-pass/can-copy-pod.rs +++ b/src/test/run-pass/can-copy-pod.rs @@ -1,7 +1,4 @@ -// pretty-expanded FIXME #23616 - -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ +// pretty-expanded FIXME(#23616) // Tests that type parameters with the `Copy` are implicitly copyable. diff --git a/src/test/run-pass/cancel-clean-via-immediate-rvalue-ref.rs b/src/test/run-pass/cancel-clean-via-immediate-rvalue-ref.rs index f27803677cc0e..323a495486554 100644 --- a/src/test/run-pass/cancel-clean-via-immediate-rvalue-ref.rs +++ b/src/test/run-pass/cancel-clean-via-immediate-rvalue-ref.rs @@ -1,4 +1,4 @@ -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616) #![feature(box_syntax)] diff --git a/src/test/run-pass/cfg/cfg-attr-cfg.rs b/src/test/run-pass/cfg/cfg-attr-cfg.rs index 61794e0bfa90e..6cffd86247f44 100644 --- a/src/test/run-pass/cfg/cfg-attr-cfg.rs +++ b/src/test/run-pass/cfg/cfg-attr-cfg.rs @@ -2,7 +2,7 @@ // main is conditionally compiled, but the conditional compilation // is conditional too! -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #[cfg_attr(foo, cfg(bar))] fn main() { } diff --git a/src/test/run-pass/cfg/cfg-attr-crate.rs b/src/test/run-pass/cfg/cfg-attr-crate.rs index 1d70f2f84f29b..65ad0954b36ac 100644 --- a/src/test/run-pass/cfg/cfg-attr-crate.rs +++ b/src/test/run-pass/cfg/cfg-attr-crate.rs @@ -1,7 +1,7 @@ // run-pass // https://github.com/rust-lang/rust/issues/21833#issuecomment-72353044 -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![cfg_attr(not_used, no_core)] diff --git a/src/test/run-pass/cfg/cfg-family.rs b/src/test/run-pass/cfg/cfg-family.rs index 282ac4abcee98..edb144a23efcc 100644 --- a/src/test/run-pass/cfg/cfg-family.rs +++ b/src/test/run-pass/cfg/cfg-family.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): // ignore-cloudabi no target_family // ignore-wasm32-bare no target_family diff --git a/src/test/run-pass/cfg/cfg-match-arm.rs b/src/test/run-pass/cfg/cfg-match-arm.rs index 071008f9eb6a4..901f6b7013f3c 100644 --- a/src/test/run-pass/cfg/cfg-match-arm.rs +++ b/src/test/run-pass/cfg/cfg-match-arm.rs @@ -1,6 +1,6 @@ // run-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): enum Foo { Bar, diff --git a/src/test/run-pass/cfg/cfg-target-family.rs b/src/test/run-pass/cfg/cfg-target-family.rs index 2cd0ba5bf881c..00b0fab986e30 100644 --- a/src/test/run-pass/cfg/cfg-target-family.rs +++ b/src/test/run-pass/cfg/cfg-target-family.rs @@ -2,7 +2,7 @@ // ignore-cloudabi no target_family // ignore-wasm32-bare no target_family -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #[cfg(target_family = "windows")] pub fn main() { diff --git a/src/test/run-pass/cfg/cfg_inner_static.rs b/src/test/run-pass/cfg/cfg_inner_static.rs index 45dbbcc10844b..08c60988d04cd 100644 --- a/src/test/run-pass/cfg/cfg_inner_static.rs +++ b/src/test/run-pass/cfg/cfg_inner_static.rs @@ -1,7 +1,7 @@ // run-pass // aux-build:cfg_inner_static.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate cfg_inner_static; diff --git a/src/test/run-pass/cfg/conditional-compile-arch.rs b/src/test/run-pass/cfg/conditional-compile-arch.rs index ea3affee4066e..314b20295d64d 100644 --- a/src/test/run-pass/cfg/conditional-compile-arch.rs +++ b/src/test/run-pass/cfg/conditional-compile-arch.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #[cfg(target_arch = "x86")] pub fn main() { } diff --git a/src/test/run-pass/cfg/conditional-compile.rs b/src/test/run-pass/cfg/conditional-compile.rs index de5bd5f07dd57..8453f9b79cb59 100644 --- a/src/test/run-pass/cfg/conditional-compile.rs +++ b/src/test/run-pass/cfg/conditional-compile.rs @@ -1,10 +1,11 @@ // run-pass + #![allow(dead_code)] #![allow(non_upper_case_globals)] #![allow(non_camel_case_types)] #![allow(improper_ctypes)] -// Crate use statements +// Crate `use` statements. #[cfg(bogus)] use flippity; @@ -18,7 +19,7 @@ mod rustrt { #[cfg(bogus)] extern { // This symbol doesn't exist and would be a link error if this - // module was codegened + // module was codegen'ed. pub fn bogus(); } @@ -60,13 +61,13 @@ fn r(i:isize) -> r { #[cfg(bogus)] mod m { // This needs to parse but would fail in typeck. Since it's not in - // the current config it should not be typechecked. + // the current config it should not be type-checked. pub fn bogus() { return 0; } } mod m { // Submodules have slightly different code paths than the top-level - // module, so let's make sure this jazz works here as well + // module, so let's make sure this jazz works here as well. #[cfg(bogus)] pub fn f() { } @@ -74,13 +75,13 @@ mod m { } // Since the bogus configuration isn't defined main will just be -// parsed, but nothing further will be done with it +// parsed, but nothing further will be done with it. #[cfg(bogus)] pub fn main() { panic!() } pub fn main() { // Exercise some of the configured items in ways that wouldn't be possible - // if they had the bogus definition + // if they had the bogus definition. assert!((b)); let _x: t = true; let _y: tg = tg::bar; @@ -145,5 +146,6 @@ mod test_methods { } } +// Check that unconfigured non-inline modules are not loaded or parsed. #[cfg(any())] -mod nonexistent_file; // Check that unconfigured non-inline modules are not loaded or parsed. +mod nonexistent_file; diff --git a/src/test/run-pass/check-static-recursion-foreign.rs b/src/test/run-pass/check-static-recursion-foreign.rs index c423bf666e5fb..819ee8b68b639 100644 --- a/src/test/run-pass/check-static-recursion-foreign.rs +++ b/src/test/run-pass/check-static-recursion-foreign.rs @@ -4,7 +4,7 @@ // aux-build:check_static_recursion_foreign_helper.rs // ignore-wasm32-bare no libc to test ffi with -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![feature(custom_attribute, rustc_private)] diff --git a/src/test/run-pass/child-outlives-parent.rs b/src/test/run-pass/child-outlives-parent.rs index 80e3c81af5281..61c54722b3250 100644 --- a/src/test/run-pass/child-outlives-parent.rs +++ b/src/test/run-pass/child-outlives-parent.rs @@ -1,6 +1,6 @@ // Reported as issue #126, child leaks the string. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): // ignore-emscripten no threads support use std::thread; diff --git a/src/test/run-pass/cleanup-arm-conditional.rs b/src/test/run-pass/cleanup-arm-conditional.rs index b8b109905209d..e70b171229385 100644 --- a/src/test/run-pass/cleanup-arm-conditional.rs +++ b/src/test/run-pass/cleanup-arm-conditional.rs @@ -3,7 +3,7 @@ // Test that cleanup scope for temporaries created in a match // arm is confined to the match arm itself. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![feature(box_syntax, os)] diff --git a/src/test/run-pass/cleanup-rvalue-temp-during-incomplete-alloc.rs b/src/test/run-pass/cleanup-rvalue-temp-during-incomplete-alloc.rs index 7b4d66e7571b1..cd3479f8eaaac 100644 --- a/src/test/run-pass/cleanup-rvalue-temp-during-incomplete-alloc.rs +++ b/src/test/run-pass/cleanup-rvalue-temp-during-incomplete-alloc.rs @@ -2,7 +2,7 @@ #![allow(dead_code)] #![allow(unused_variables)] // Test cleanup of rvalue temporary that occurs while `box` construction -// is in progress. This scenario revealed a rather terrible bug. The +// is in progress. This scenario revealed a rather terrible bug. The // ingredients are: // // 1. Partial cleanup of `box` is in scope, diff --git a/src/test/run-pass/cleanup-shortcircuit.rs b/src/test/run-pass/cleanup-shortcircuit.rs index 118fa0083ab47..d27d13b9b29a2 100644 --- a/src/test/run-pass/cleanup-shortcircuit.rs +++ b/src/test/run-pass/cleanup-shortcircuit.rs @@ -1,6 +1,6 @@ // Test that cleanups for the RHS of shortcircuiting operators work. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): // ignore-cloudabi no std::env support use std::env; diff --git a/src/test/run-pass/coerce/coerce-overloaded-autoderef.rs b/src/test/run-pass/coerce/coerce-overloaded-autoderef.rs index 3fe18103ef8c3..d6864fc4d34b9 100644 --- a/src/test/run-pass/coerce/coerce-overloaded-autoderef.rs +++ b/src/test/run-pass/coerce/coerce-overloaded-autoderef.rs @@ -1,6 +1,6 @@ // run-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): use std::rc::Rc; diff --git a/src/test/run-pass/coerce/coerce-reborrow-imm-ptr-arg.rs b/src/test/run-pass/coerce/coerce-reborrow-imm-ptr-arg.rs index f033e1b5d2b01..2f749bbd14fd5 100644 --- a/src/test/run-pass/coerce/coerce-reborrow-imm-ptr-arg.rs +++ b/src/test/run-pass/coerce/coerce-reborrow-imm-ptr-arg.rs @@ -1,6 +1,6 @@ // run-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): fn negate(x: &isize) -> isize { -*x diff --git a/src/test/run-pass/coerce/coerce-reborrow-imm-vec-arg.rs b/src/test/run-pass/coerce/coerce-reborrow-imm-vec-arg.rs index c2aaae1c73ec8..aa45f1f9c3b71 100644 --- a/src/test/run-pass/coerce/coerce-reborrow-imm-vec-arg.rs +++ b/src/test/run-pass/coerce/coerce-reborrow-imm-vec-arg.rs @@ -1,6 +1,6 @@ // run-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): fn sum(x: &[isize]) -> isize { let mut sum = 0; diff --git a/src/test/run-pass/coerce/coerce-reborrow-mut-ptr-arg.rs b/src/test/run-pass/coerce/coerce-reborrow-mut-ptr-arg.rs index 76cd6793b3c23..1aacfa632ca70 100644 --- a/src/test/run-pass/coerce/coerce-reborrow-mut-ptr-arg.rs +++ b/src/test/run-pass/coerce/coerce-reborrow-mut-ptr-arg.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): struct SpeechMaker { speeches: usize diff --git a/src/test/run-pass/coerce/coerce-reborrow-mut-ptr-rcvr.rs b/src/test/run-pass/coerce/coerce-reborrow-mut-ptr-rcvr.rs index e6e7c3a51aa09..7b5e40c908801 100644 --- a/src/test/run-pass/coerce/coerce-reborrow-mut-ptr-rcvr.rs +++ b/src/test/run-pass/coerce/coerce-reborrow-mut-ptr-rcvr.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): struct SpeechMaker { speeches: usize diff --git a/src/test/run-pass/coerce/coerce-unify-return.rs b/src/test/run-pass/coerce/coerce-unify-return.rs index 95a7ee8fe0f2b..9fcef247be5eb 100644 --- a/src/test/run-pass/coerce/coerce-unify-return.rs +++ b/src/test/run-pass/coerce/coerce-unify-return.rs @@ -2,7 +2,7 @@ // Check that coercions unify the expected return type of a polymorphic // function call, instead of leaving the type variables as they were. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): struct Foo; impl Foo { diff --git a/src/test/run-pass/coerce/coerce-unsize-subtype.rs b/src/test/run-pass/coerce/coerce-unsize-subtype.rs index 45b53300c5b4b..072e50704fdd5 100644 --- a/src/test/run-pass/coerce/coerce-unsize-subtype.rs +++ b/src/test/run-pass/coerce/coerce-unsize-subtype.rs @@ -1,6 +1,6 @@ // run-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): use std::rc::Rc; diff --git a/src/test/run-pass/coherence/coherence-bigint-int.rs b/src/test/run-pass/coherence/coherence-bigint-int.rs index 02945e9dade3a..cf976f5a9b6d4 100644 --- a/src/test/run-pass/coherence/coherence-bigint-int.rs +++ b/src/test/run-pass/coherence/coherence-bigint-int.rs @@ -1,7 +1,7 @@ // run-pass // aux-build:coherence_lib.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate coherence_lib as lib; use lib::Remote1; diff --git a/src/test/run-pass/coherence/coherence-bigint-vecint.rs b/src/test/run-pass/coherence/coherence-bigint-vecint.rs index a5dba90be5c59..0da6de65b4c3e 100644 --- a/src/test/run-pass/coherence/coherence-bigint-vecint.rs +++ b/src/test/run-pass/coherence/coherence-bigint-vecint.rs @@ -1,7 +1,7 @@ // run-pass // aux-build:coherence_lib.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate coherence_lib as lib; use lib::Remote1; diff --git a/src/test/run-pass/coherence/coherence-blanket.rs b/src/test/run-pass/coherence/coherence-blanket.rs index 55fa89d75070a..394936ada4277 100644 --- a/src/test/run-pass/coherence/coherence-blanket.rs +++ b/src/test/run-pass/coherence/coherence-blanket.rs @@ -2,7 +2,7 @@ #![allow(unused_imports)] // aux-build:coherence_lib.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate coherence_lib as lib; use lib::Remote1; diff --git a/src/test/run-pass/coherence/coherence-covered-type-parameter.rs b/src/test/run-pass/coherence/coherence-covered-type-parameter.rs index bb95c59d183f9..fc1d597abc67b 100644 --- a/src/test/run-pass/coherence/coherence-covered-type-parameter.rs +++ b/src/test/run-pass/coherence/coherence-covered-type-parameter.rs @@ -2,7 +2,7 @@ #![allow(dead_code)] // aux-build:coherence_lib.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate coherence_lib as lib; use lib::Remote; diff --git a/src/test/run-pass/coherence/coherence-iterator-vec-any-elem.rs b/src/test/run-pass/coherence/coherence-iterator-vec-any-elem.rs index 43a0a5c427774..a9d3976629a9c 100644 --- a/src/test/run-pass/coherence/coherence-iterator-vec-any-elem.rs +++ b/src/test/run-pass/coherence/coherence-iterator-vec-any-elem.rs @@ -2,7 +2,7 @@ #![allow(dead_code)] // aux-build:coherence_lib.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate coherence_lib as lib; use lib::Remote1; diff --git a/src/test/run-pass/coherence/coherence-iterator-vec.rs b/src/test/run-pass/coherence/coherence-iterator-vec.rs index 386fe40ac3ca8..4126260a896b2 100644 --- a/src/test/run-pass/coherence/coherence-iterator-vec.rs +++ b/src/test/run-pass/coherence/coherence-iterator-vec.rs @@ -2,7 +2,7 @@ #![allow(dead_code)] // aux-build:coherence_lib.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate coherence_lib as lib; use lib::Remote1; diff --git a/src/test/run-pass/coherence/coherence-multidispatch-tuple.rs b/src/test/run-pass/coherence/coherence-multidispatch-tuple.rs index fa1d4bbb49665..ed8e782bd6018 100644 --- a/src/test/run-pass/coherence/coherence-multidispatch-tuple.rs +++ b/src/test/run-pass/coherence/coherence-multidispatch-tuple.rs @@ -1,6 +1,6 @@ // run-pass #![allow(unused_imports)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): use std::fmt::Debug; use std::default::Default; diff --git a/src/test/run-pass/coherence/coherence-negative-impls-safe.rs b/src/test/run-pass/coherence/coherence-negative-impls-safe.rs index 695a71cbd2d7c..e4600dc5fe02a 100644 --- a/src/test/run-pass/coherence/coherence-negative-impls-safe.rs +++ b/src/test/run-pass/coherence/coherence-negative-impls-safe.rs @@ -1,6 +1,6 @@ // run-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![feature(optin_builtin_traits)] diff --git a/src/test/run-pass/coherence/coherence-rfc447-constrained.rs b/src/test/run-pass/coherence/coherence-rfc447-constrained.rs index 9d1d86883259f..b374972205fb0 100644 --- a/src/test/run-pass/coherence/coherence-rfc447-constrained.rs +++ b/src/test/run-pass/coherence/coherence-rfc447-constrained.rs @@ -9,7 +9,7 @@ trait Mirror { type Image: ?Sized; } impl Mirror for T { type Image = T; } trait Bar {} -impl, L: Mirror> Bar for V +impl, L: Mirror> Bar for V where U::Image: IsU32 {} trait Foo { fn name() -> &'static str; } diff --git a/src/test/run-pass/consts/const-bound.rs b/src/test/run-pass/consts/const-bound.rs index 735056a0ab0b1..a3b991c84c333 100644 --- a/src/test/run-pass/consts/const-bound.rs +++ b/src/test/run-pass/consts/const-bound.rs @@ -3,7 +3,7 @@ // Make sure const bounds work on things, and test that a few types // are const. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): fn foo(x: T) -> T { x } diff --git a/src/test/run-pass/consts/const-expr-in-fixed-length-vec.rs b/src/test/run-pass/consts/const-expr-in-fixed-length-vec.rs index a9960b4552b6e..428fd1c33f619 100644 --- a/src/test/run-pass/consts/const-expr-in-fixed-length-vec.rs +++ b/src/test/run-pass/consts/const-expr-in-fixed-length-vec.rs @@ -2,7 +2,7 @@ // Check that constant expressions can be used for declaring the // type of a fixed length vector. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): pub fn main() { diff --git a/src/test/run-pass/consts/const-expr-in-vec-repeat.rs b/src/test/run-pass/consts/const-expr-in-vec-repeat.rs index 4eaef25059b0b..dd032190e2eb1 100644 --- a/src/test/run-pass/consts/const-expr-in-vec-repeat.rs +++ b/src/test/run-pass/consts/const-expr-in-vec-repeat.rs @@ -1,7 +1,7 @@ // run-pass // Check that constant expressions can be used in vec repeat syntax. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): pub fn main() { diff --git a/src/test/run-pass/consts/const-struct-offsets.rs b/src/test/run-pass/consts/const-struct-offsets.rs index 26a008320797e..819ee9fc71ff2 100644 --- a/src/test/run-pass/consts/const-struct-offsets.rs +++ b/src/test/run-pass/consts/const-struct-offsets.rs @@ -1,6 +1,6 @@ // run-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![allow(non_upper_case_globals)] enum Foo { diff --git a/src/test/run-pass/consts/const-unit-struct.rs b/src/test/run-pass/consts/const-unit-struct.rs index 1c9e0e8d3c989..7df569fda6b56 100644 --- a/src/test/run-pass/consts/const-unit-struct.rs +++ b/src/test/run-pass/consts/const-unit-struct.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): struct Foo; diff --git a/src/test/run-pass/consts/const-vec-of-fns.rs b/src/test/run-pass/consts/const-vec-of-fns.rs index 6d90b066b74d7..46413b3fe5402 100644 --- a/src/test/run-pass/consts/const-vec-of-fns.rs +++ b/src/test/run-pass/consts/const-vec-of-fns.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![allow(non_upper_case_globals)] /*! diff --git a/src/test/run-pass/consts/const-vec-syntax.rs b/src/test/run-pass/consts/const-vec-syntax.rs index 61246e44eba8d..6b8c9be983f77 100644 --- a/src/test/run-pass/consts/const-vec-syntax.rs +++ b/src/test/run-pass/consts/const-vec-syntax.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): fn f(_: &[isize]) {} diff --git a/src/test/run-pass/crate-leading-sep.rs b/src/test/run-pass/crate-leading-sep.rs index 26d4df433aae1..ffb605a2b334e 100644 --- a/src/test/run-pass/crate-leading-sep.rs +++ b/src/test/run-pass/crate-leading-sep.rs @@ -1,4 +1,4 @@ -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616) fn main() { use ::std::mem; diff --git a/src/test/run-pass/crate-method-reexport-grrrrrrr.rs b/src/test/run-pass/crate-method-reexport-grrrrrrr.rs index 0d243e14b94c5..a8a88ee74c4a0 100644 --- a/src/test/run-pass/crate-method-reexport-grrrrrrr.rs +++ b/src/test/run-pass/crate-method-reexport-grrrrrrr.rs @@ -1,4 +1,4 @@ -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616) #![feature(box_syntax)] diff --git a/src/test/run-pass/crate-name-attr-used.rs b/src/test/run-pass/crate-name-attr-used.rs index 666f80e566262..07eed1d8a233f 100644 --- a/src/test/run-pass/crate-name-attr-used.rs +++ b/src/test/run-pass/crate-name-attr-used.rs @@ -1,6 +1,6 @@ // compile-flags:--crate-name crate_name_attr_used -F unused-attributes -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![crate_name = "crate_name_attr_used"] diff --git a/src/test/run-pass/cross-crate/anon-extern-mod-cross-crate-2.rs b/src/test/run-pass/cross-crate/anon-extern-mod-cross-crate-2.rs index 77168be5374b2..8de4175d63ed3 100644 --- a/src/test/run-pass/cross-crate/anon-extern-mod-cross-crate-2.rs +++ b/src/test/run-pass/cross-crate/anon-extern-mod-cross-crate-2.rs @@ -1,6 +1,6 @@ // run-pass // aux-build:anon-extern-mod-cross-crate-1.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): // ignore-wasm32-bare no libc to test ffi with extern crate anonexternmod; diff --git a/src/test/run-pass/cross-crate/cci_capture_clause.rs b/src/test/run-pass/cross-crate/cci_capture_clause.rs index ea699b5f5ac4e..46afc27202dff 100644 --- a/src/test/run-pass/cross-crate/cci_capture_clause.rs +++ b/src/test/run-pass/cross-crate/cci_capture_clause.rs @@ -4,7 +4,7 @@ // This test makes sure we can do cross-crate inlining on functions // that use capture clauses. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): // ignore-emscripten no threads support extern crate cci_capture_clause; diff --git a/src/test/run-pass/cross-crate/cci_no_inline_exe.rs b/src/test/run-pass/cross-crate/cci_no_inline_exe.rs index ffc701678d3b6..5125c5c3153e5 100644 --- a/src/test/run-pass/cross-crate/cci_no_inline_exe.rs +++ b/src/test/run-pass/cross-crate/cci_no_inline_exe.rs @@ -6,7 +6,7 @@ use cci_no_inline_lib::iter; pub fn main() { // Check that a cross-crate call function not marked as inline - // does not, in fact, get inlined. Also, perhaps more + // does not, in fact, get inlined. Also, perhaps more // importantly, checks that our scheme of using // sys::frame_address() to determine if we are inlining is // actually working. diff --git a/src/test/run-pass/cross-crate/cross-crate-const-pat.rs b/src/test/run-pass/cross-crate/cross-crate-const-pat.rs index e8fa8485ab2fb..b733b9258b641 100644 --- a/src/test/run-pass/cross-crate/cross-crate-const-pat.rs +++ b/src/test/run-pass/cross-crate/cross-crate-const-pat.rs @@ -1,7 +1,7 @@ // run-pass // aux-build:cci_const.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate cci_const; diff --git a/src/test/run-pass/cross-crate/moves-based-on-type-cross-crate.rs b/src/test/run-pass/cross-crate/moves-based-on-type-cross-crate.rs index 3881e3352202f..ade7ddff7b536 100644 --- a/src/test/run-pass/cross-crate/moves-based-on-type-cross-crate.rs +++ b/src/test/run-pass/cross-crate/moves-based-on-type-cross-crate.rs @@ -1,7 +1,7 @@ // run-pass // aux-build:moves_based_on_type_lib.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate moves_based_on_type_lib; use moves_based_on_type_lib::f; diff --git a/src/test/run-pass/cross-crate/xcrate-static-addresses.rs b/src/test/run-pass/cross-crate/xcrate-static-addresses.rs index 3c33976568e94..4205b601ffb84 100644 --- a/src/test/run-pass/cross-crate/xcrate-static-addresses.rs +++ b/src/test/run-pass/cross-crate/xcrate-static-addresses.rs @@ -1,7 +1,7 @@ // run-pass // aux-build:xcrate_static_addresses.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate xcrate_static_addresses; diff --git a/src/test/run-pass/cross-crate/xcrate-trait-lifetime-param.rs b/src/test/run-pass/cross-crate/xcrate-trait-lifetime-param.rs index 1fd7eb878d98a..c19ea524e3173 100644 --- a/src/test/run-pass/cross-crate/xcrate-trait-lifetime-param.rs +++ b/src/test/run-pass/cross-crate/xcrate-trait-lifetime-param.rs @@ -2,7 +2,7 @@ #![allow(dead_code)] // aux-build:xcrate-trait-lifetime-param.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate xcrate_trait_lifetime_param as other; diff --git a/src/test/run-pass/cross-crate/xcrate-unit-struct.rs b/src/test/run-pass/cross-crate/xcrate-unit-struct.rs index 7aa3eb0d6c44a..4c2700a3abcd6 100644 --- a/src/test/run-pass/cross-crate/xcrate-unit-struct.rs +++ b/src/test/run-pass/cross-crate/xcrate-unit-struct.rs @@ -1,6 +1,6 @@ // run-pass // aux-build:xcrate_unit_struct.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![allow(non_upper_case_globals)] extern crate xcrate_unit_struct; diff --git a/src/test/run-pass/ctfe/chained-constants-stackoverflow.rs b/src/test/run-pass/ctfe/chained-constants-stackoverflow.rs index a171567c5d2fa..41eaa4befa018 100644 --- a/src/test/run-pass/ctfe/chained-constants-stackoverflow.rs +++ b/src/test/run-pass/ctfe/chained-constants-stackoverflow.rs @@ -1,7 +1,5 @@ // run-pass -// https://github.com/rust-lang/rust/issues/34997 - pub const CST_1: u32 = 0; pub const CST_2: u32 = CST_1+1; pub const CST_3: u32 = CST_2+1; diff --git a/src/test/run-pass/ctfe/deref_in_pattern.rs b/src/test/run-pass/ctfe/deref_in_pattern.rs index cc47b5b49c0b3..6b4e3a065e517 100644 --- a/src/test/run-pass/ctfe/deref_in_pattern.rs +++ b/src/test/run-pass/ctfe/deref_in_pattern.rs @@ -1,7 +1,5 @@ // run-pass -// https://github.com/rust-lang/rust/issues/25574 - const A: [u8; 4] = *b"fooo"; fn main() { diff --git a/src/test/run-pass/ctfe/ice-48279.rs b/src/test/run-pass/ctfe/ice-48279.rs index d1d90df240ca5..a806c725c6521 100644 --- a/src/test/run-pass/ctfe/ice-48279.rs +++ b/src/test/run-pass/ctfe/ice-48279.rs @@ -1,9 +1,8 @@ // run-pass + #![allow(dead_code)] #![allow(unused_unsafe)] -// https://github.com/rust-lang/rust/issues/48279 - #[derive(PartialEq, Eq)] pub struct NonZeroU32 { value: u32 @@ -15,7 +14,7 @@ impl NonZeroU32 { } } -//pub const FOO_ATOM: NonZeroU32 = unsafe { NonZeroU32::new_unchecked(7) }; +// pub const FOO_ATOM: NonZeroU32 = unsafe { NonZeroU32::new_unchecked(7) }; pub const FOO_ATOM: NonZeroU32 = unsafe { NonZeroU32 { value: 7 } }; fn main() { diff --git a/src/test/run-pass/ctfe/issue-broken-mir.rs b/src/test/run-pass/ctfe/issue-broken-mir.rs index 36f0ff92104e1..d4c55345c2388 100644 --- a/src/test/run-pass/ctfe/issue-broken-mir.rs +++ b/src/test/run-pass/ctfe/issue-broken-mir.rs @@ -1,7 +1,5 @@ // run-pass -// https://github.com/rust-lang/rust/issues/27918 - fn main() { match b" " { b"1234" => {}, diff --git a/src/test/run-pass/ctfe/locals-in-const-fn.rs b/src/test/run-pass/ctfe/locals-in-const-fn.rs index e527e1e88c8da..e2187f34bc2de 100644 --- a/src/test/run-pass/ctfe/locals-in-const-fn.rs +++ b/src/test/run-pass/ctfe/locals-in-const-fn.rs @@ -1,7 +1,5 @@ // run-pass -// https://github.com/rust-lang/rust/issues/48821 - #![feature(const_fn, const_let)] const fn foo(i: usize) -> usize { diff --git a/src/test/run-pass/ctfe/match-const-fn-structs.rs b/src/test/run-pass/ctfe/match-const-fn-structs.rs index 5a68048c47725..494dc6dbd2b70 100644 --- a/src/test/run-pass/ctfe/match-const-fn-structs.rs +++ b/src/test/run-pass/ctfe/match-const-fn-structs.rs @@ -1,7 +1,6 @@ // run-pass -#![allow(unused_variables)] -// https://github.com/rust-lang/rust/issues/46114 +#![allow(unused_variables)] #[derive(Eq, PartialEq)] struct A { value: u32 } diff --git a/src/test/run-pass/ctfe/non-scalar-cast.rs b/src/test/run-pass/ctfe/non-scalar-cast.rs index 671366c90ec8e..4343def1d90e3 100644 --- a/src/test/run-pass/ctfe/non-scalar-cast.rs +++ b/src/test/run-pass/ctfe/non-scalar-cast.rs @@ -1,7 +1,5 @@ // run-pass -// https://github.com/rust-lang/rust/issues/37448 - fn main() { struct A; const FOO: &A = &(A as A); diff --git a/src/test/run-pass/ctfe/repeat_match.rs b/src/test/run-pass/ctfe/repeat_match.rs index 20983184a473a..895a4fa66f0ef 100644 --- a/src/test/run-pass/ctfe/repeat_match.rs +++ b/src/test/run-pass/ctfe/repeat_match.rs @@ -1,7 +1,5 @@ // run-pass -// https://github.com/rust-lang/rust/issues/45044 - const X: [u8; 1] = [0; 1]; fn main() { diff --git a/src/test/run-pass/ctfe/return-in-const-fn.rs b/src/test/run-pass/ctfe/return-in-const-fn.rs index 077a33c081ba8..f12dc0e8daffb 100644 --- a/src/test/run-pass/ctfe/return-in-const-fn.rs +++ b/src/test/run-pass/ctfe/return-in-const-fn.rs @@ -1,10 +1,9 @@ // run-pass -// https://github.com/rust-lang/rust/issues/43754 - const fn foo(x: usize) -> usize { return x; } + fn main() { [0; foo(2)]; } diff --git a/src/test/run-pass/ctfe/signed_enum_discr.rs b/src/test/run-pass/ctfe/signed_enum_discr.rs index 2e4395ccf2277..026a62dd029b2 100644 --- a/src/test/run-pass/ctfe/signed_enum_discr.rs +++ b/src/test/run-pass/ctfe/signed_enum_discr.rs @@ -1,7 +1,5 @@ // run-pass -// https://github.com/rust-lang/rust/issues/49181 - #[derive(Eq, PartialEq)] #[repr(i8)] pub enum A { diff --git a/src/test/run-pass/ctfe/tuple-struct-constructors.rs b/src/test/run-pass/ctfe/tuple-struct-constructors.rs index 1655f0eb85038..1564053098404 100644 --- a/src/test/run-pass/ctfe/tuple-struct-constructors.rs +++ b/src/test/run-pass/ctfe/tuple-struct-constructors.rs @@ -1,7 +1,5 @@ // run-pass -// https://github.com/rust-lang/rust/issues/41898 - use std::num::NonZeroU64; fn main() { diff --git a/src/test/run-pass/cycle-generic-bound.rs b/src/test/run-pass/cycle-generic-bound.rs index 56bfa98451f74..1a4eb44dabf30 100644 --- a/src/test/run-pass/cycle-generic-bound.rs +++ b/src/test/run-pass/cycle-generic-bound.rs @@ -1,6 +1,6 @@ // Regression test for #15477. This test just needs to compile. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): trait Chromosome> { } diff --git a/src/test/run-pass/dead-code-leading-underscore.rs b/src/test/run-pass/dead-code-leading-underscore.rs index eff40111ac9d4..852b28137ee52 100644 --- a/src/test/run-pass/dead-code-leading-underscore.rs +++ b/src/test/run-pass/dead-code-leading-underscore.rs @@ -1,4 +1,4 @@ -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616) #![deny(dead_code)] diff --git a/src/test/run-pass/default-method-parsing.rs b/src/test/run-pass/default-method-parsing.rs index 7f66605d7c363..f2a8d7a1a2ab6 100644 --- a/src/test/run-pass/default-method-parsing.rs +++ b/src/test/run-pass/default-method-parsing.rs @@ -1,4 +1,4 @@ -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616) trait Foo { fn m(&self, _:isize) { } diff --git a/src/test/run-pass/defaults-well-formedness.rs b/src/test/run-pass/defaults-well-formedness.rs index cbcdb38fbebaf..c5077b60a4731 100644 --- a/src/test/run-pass/defaults-well-formedness.rs +++ b/src/test/run-pass/defaults-well-formedness.rs @@ -14,7 +14,7 @@ struct NonDefaultedInClause(TwoParams) where TwoParams: struct DefaultedLhs(U, V) where V: Trait; // Dependent defaults are not checked. struct Dependent(T, U) where U: Copy; -trait SelfBound {} +trait SelfBound {} // Not even for well-formedness. struct WellFormedProjection::Item>(A, T); diff --git a/src/test/run-pass/deref-on-ref.rs b/src/test/run-pass/deref-on-ref.rs index 651ccd5be855c..b34eb52ace310 100644 --- a/src/test/run-pass/deref-on-ref.rs +++ b/src/test/run-pass/deref-on-ref.rs @@ -3,7 +3,7 @@ use std::ops::Deref; -fn deref>(t: T) -> U { +fn deref>(t: T) -> U { *t } diff --git a/src/test/run-pass/deref.rs b/src/test/run-pass/deref.rs index 08b047f54d94b..40761ab15978a 100644 --- a/src/test/run-pass/deref.rs +++ b/src/test/run-pass/deref.rs @@ -1,4 +1,4 @@ -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616) #![feature(box_syntax)] diff --git a/src/test/run-pass/deriving/deriving-clone-enum.rs b/src/test/run-pass/deriving/deriving-clone-enum.rs index 09e7497407254..3b4319907751d 100644 --- a/src/test/run-pass/deriving/deriving-clone-enum.rs +++ b/src/test/run-pass/deriving/deriving-clone-enum.rs @@ -1,6 +1,6 @@ // run-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #[derive(Clone)] enum E { diff --git a/src/test/run-pass/deriving/deriving-clone-generic-enum.rs b/src/test/run-pass/deriving/deriving-clone-generic-enum.rs index a344d7fc43a2e..6a044e993bcfa 100644 --- a/src/test/run-pass/deriving/deriving-clone-generic-enum.rs +++ b/src/test/run-pass/deriving/deriving-clone-generic-enum.rs @@ -1,6 +1,6 @@ // run-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #[derive(Clone)] enum E { diff --git a/src/test/run-pass/deriving/deriving-clone-generic-struct.rs b/src/test/run-pass/deriving/deriving-clone-generic-struct.rs index f6e105555fd9d..87576f15d5314 100644 --- a/src/test/run-pass/deriving/deriving-clone-generic-struct.rs +++ b/src/test/run-pass/deriving/deriving-clone-generic-struct.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #[derive(Clone)] struct S { diff --git a/src/test/run-pass/deriving/deriving-clone-generic-tuple-struct.rs b/src/test/run-pass/deriving/deriving-clone-generic-tuple-struct.rs index 8b9840de172da..bde400ca60542 100644 --- a/src/test/run-pass/deriving/deriving-clone-generic-tuple-struct.rs +++ b/src/test/run-pass/deriving/deriving-clone-generic-tuple-struct.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #[derive(Clone)] struct S(T, ()); diff --git a/src/test/run-pass/deriving/deriving-clone-struct.rs b/src/test/run-pass/deriving/deriving-clone-struct.rs index 7b0a1d20260d4..24ee189bee767 100644 --- a/src/test/run-pass/deriving/deriving-clone-struct.rs +++ b/src/test/run-pass/deriving/deriving-clone-struct.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #[derive(Clone)] struct S { diff --git a/src/test/run-pass/deriving/deriving-clone-tuple-struct.rs b/src/test/run-pass/deriving/deriving-clone-tuple-struct.rs index 166f1be55e02a..cf0a5facef56d 100644 --- a/src/test/run-pass/deriving/deriving-clone-tuple-struct.rs +++ b/src/test/run-pass/deriving/deriving-clone-tuple-struct.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #[derive(Clone)] struct S((), ()); diff --git a/src/test/run-pass/deriving/deriving-enum-single-variant.rs b/src/test/run-pass/deriving/deriving-enum-single-variant.rs index 1c5979c074758..0efd9686046a7 100644 --- a/src/test/run-pass/deriving/deriving-enum-single-variant.rs +++ b/src/test/run-pass/deriving/deriving-enum-single-variant.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![allow(non_camel_case_types)] pub type task_id = isize; diff --git a/src/test/run-pass/deriving/deriving-in-macro.rs b/src/test/run-pass/deriving/deriving-in-macro.rs index 46e8e37838dbd..b97c82387e62a 100644 --- a/src/test/run-pass/deriving/deriving-in-macro.rs +++ b/src/test/run-pass/deriving/deriving-in-macro.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![allow(non_camel_case_types)] macro_rules! define_vec { diff --git a/src/test/run-pass/deriving/deriving-meta-multiple.rs b/src/test/run-pass/deriving/deriving-meta-multiple.rs index ad255be8dab23..b40d0da49c408 100644 --- a/src/test/run-pass/deriving/deriving-meta-multiple.rs +++ b/src/test/run-pass/deriving/deriving-meta-multiple.rs @@ -1,7 +1,7 @@ // run-pass #![allow(unused_must_use)] #![allow(unused_imports)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![allow(deprecated)] use std::hash::{Hash, SipHasher}; diff --git a/src/test/run-pass/deriving/deriving-meta.rs b/src/test/run-pass/deriving/deriving-meta.rs index f2ff4f535576f..9488244de42c0 100644 --- a/src/test/run-pass/deriving/deriving-meta.rs +++ b/src/test/run-pass/deriving/deriving-meta.rs @@ -1,7 +1,7 @@ // run-pass #![allow(unused_must_use)] #![allow(unused_imports)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![allow(deprecated)] use std::hash::{Hash, SipHasher}; diff --git a/src/test/run-pass/deriving/deriving-via-extension-hash-struct.rs b/src/test/run-pass/deriving/deriving-via-extension-hash-struct.rs index c4037dc2714db..58e7202e98076 100644 --- a/src/test/run-pass/deriving/deriving-via-extension-hash-struct.rs +++ b/src/test/run-pass/deriving/deriving-via-extension-hash-struct.rs @@ -1,6 +1,6 @@ // run-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #[derive(Hash)] struct Foo { diff --git a/src/test/run-pass/diverging-fallback-control-flow.rs b/src/test/run-pass/diverging-fallback-control-flow.rs index c88ab42d5a89a..73cbc443f46fc 100644 --- a/src/test/run-pass/diverging-fallback-control-flow.rs +++ b/src/test/run-pass/diverging-fallback-control-flow.rs @@ -5,7 +5,7 @@ // Test various cases where we permit an unconstrained variable // to fallback based on control-flow. // -// These represent current behavior, but are pretty dubious. I would +// These represent current behavior, but are pretty dubious. I would // like to revisit these and potentially change them. --nmatsakis #![feature(never_type)] diff --git a/src/test/run-pass/double-ref.rs b/src/test/run-pass/double-ref.rs index 16c98da94565e..713aa6dff8723 100644 --- a/src/test/run-pass/double-ref.rs +++ b/src/test/run-pass/double-ref.rs @@ -1,5 +1,5 @@ #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): fn check_expr() { let _: & usize = &1; diff --git a/src/test/run-pass/drop/drop-on-empty-block-exit.rs b/src/test/run-pass/drop/drop-on-empty-block-exit.rs index 1747bf029aa33..46cc14f042579 100644 --- a/src/test/run-pass/drop/drop-on-empty-block-exit.rs +++ b/src/test/run-pass/drop/drop-on-empty-block-exit.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![allow(non_camel_case_types)] #![feature(box_syntax)] diff --git a/src/test/run-pass/drop/drop-on-ret.rs b/src/test/run-pass/drop/drop-on-ret.rs index 290e274f30541..f9bb3d8404005 100644 --- a/src/test/run-pass/drop/drop-on-ret.rs +++ b/src/test/run-pass/drop/drop-on-ret.rs @@ -2,7 +2,7 @@ -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): fn f() -> isize { if true { diff --git a/src/test/run-pass/drop/drop-uninhabited-enum.rs b/src/test/run-pass/drop/drop-uninhabited-enum.rs index b3566f68533bd..1a2ab4c68af00 100644 --- a/src/test/run-pass/drop/drop-uninhabited-enum.rs +++ b/src/test/run-pass/drop/drop-uninhabited-enum.rs @@ -1,7 +1,7 @@ // run-pass #![allow(dead_code)] #![allow(unused_variables)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): enum Foo { } diff --git a/src/test/run-pass/drop/nondrop-cycle.rs b/src/test/run-pass/drop/nondrop-cycle.rs index 29070f917e432..f97b7f1baec4b 100644 --- a/src/test/run-pass/drop/nondrop-cycle.rs +++ b/src/test/run-pass/drop/nondrop-cycle.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): use std::cell::Cell; diff --git a/src/test/run-pass/duplicated-external-mods.rs b/src/test/run-pass/duplicated-external-mods.rs index f2c1e1f654016..5ca68aaa5e03e 100644 --- a/src/test/run-pass/duplicated-external-mods.rs +++ b/src/test/run-pass/duplicated-external-mods.rs @@ -1,6 +1,6 @@ // aux-build:anon-extern-mod-cross-crate-1.rs // aux-build:anon-extern-mod-cross-crate-1.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): // ignore-wasm32-bare no libc to test ffi with extern crate anonexternmod; diff --git a/src/test/run-pass/dynamically-sized-types/dst-coercions.rs b/src/test/run-pass/dynamically-sized-types/dst-coercions.rs index 06c2892b69ea2..00d79c25ca0d0 100644 --- a/src/test/run-pass/dynamically-sized-types/dst-coercions.rs +++ b/src/test/run-pass/dynamically-sized-types/dst-coercions.rs @@ -2,7 +2,7 @@ #![allow(unused_variables)] // Test coercions involving DST and/or raw pointers -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): struct S; trait T { fn dummy(&self) { } } diff --git a/src/test/run-pass/early-ret-binop-add.rs b/src/test/run-pass/early-ret-binop-add.rs index 158468c572c6d..9d5e986bf617f 100644 --- a/src/test/run-pass/early-ret-binop-add.rs +++ b/src/test/run-pass/early-ret-binop-add.rs @@ -1,9 +1,9 @@ #![allow(dead_code)] #![allow(unreachable_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): use std::ops::Add; -fn wsucc + Copy>(n: T) -> T { n + { return n } } +fn wsucc + Copy>(n: T) -> T { n + { return n } } pub fn main() { } diff --git a/src/test/run-pass/early-vtbl-resolution.rs b/src/test/run-pass/early-vtbl-resolution.rs index 812771c29b3ab..ac524a70060ac 100644 --- a/src/test/run-pass/early-vtbl-resolution.rs +++ b/src/test/run-pass/early-vtbl-resolution.rs @@ -1,6 +1,6 @@ #![allow(non_camel_case_types)] #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): trait thing { fn foo(&self) -> Option; diff --git a/src/test/run-pass/empty-allocation-rvalue-non-null.rs b/src/test/run-pass/empty-allocation-rvalue-non-null.rs index ac597bcb20870..d32f16d60a9c0 100644 --- a/src/test/run-pass/empty-allocation-rvalue-non-null.rs +++ b/src/test/run-pass/empty-allocation-rvalue-non-null.rs @@ -1,5 +1,5 @@ #![allow(unused_variables)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): pub fn main() { let x = *Box::new(()); diff --git a/src/test/run-pass/explicit-i-suffix.rs b/src/test/run-pass/explicit-i-suffix.rs index 119cce3087e84..21763c7e78375 100644 --- a/src/test/run-pass/explicit-i-suffix.rs +++ b/src/test/run-pass/explicit-i-suffix.rs @@ -1,5 +1,5 @@ #![allow(unused_must_use)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): pub fn main() { let x: isize = 8; diff --git a/src/test/run-pass/export-glob-imports-target.rs b/src/test/run-pass/export-glob-imports-target.rs index 0ac80e657982d..ed1b59a8ac964 100644 --- a/src/test/run-pass/export-glob-imports-target.rs +++ b/src/test/run-pass/export-glob-imports-target.rs @@ -5,7 +5,7 @@ // Modified to not use export since it's going away. --pcw -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): mod foo { use foo::bar::*; diff --git a/src/test/run-pass/export-multi.rs b/src/test/run-pass/export-multi.rs index bfa2765d25457..acd100abe286b 100644 --- a/src/test/run-pass/export-multi.rs +++ b/src/test/run-pass/export-multi.rs @@ -1,4 +1,4 @@ -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616) use m::f; use m::g; diff --git a/src/test/run-pass/expr-empty-ret.rs b/src/test/run-pass/expr-empty-ret.rs index 6bdf4350a9907..5e5b34a2480e1 100644 --- a/src/test/run-pass/expr-empty-ret.rs +++ b/src/test/run-pass/expr-empty-ret.rs @@ -1,7 +1,7 @@ #![allow(dead_code)] // Issue #521 -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): fn f() { let _x = match true { diff --git a/src/test/run-pass/expr-scope.rs b/src/test/run-pass/expr-scope.rs index 15bb4a2eb0b44..56131052c543b 100644 --- a/src/test/run-pass/expr-scope.rs +++ b/src/test/run-pass/expr-scope.rs @@ -1,6 +1,6 @@ // Regression test for issue #762 -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): pub fn f() { } pub fn main() { return ::f(); } diff --git a/src/test/run-pass/extern/extern-1.rs b/src/test/run-pass/extern/extern-1.rs index eb9aabc87bc8b..33e73c35a6940 100644 --- a/src/test/run-pass/extern/extern-1.rs +++ b/src/test/run-pass/extern/extern-1.rs @@ -1,6 +1,6 @@ // run-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern fn f() { } diff --git a/src/test/run-pass/extern/extern-calling-convention-test.rs b/src/test/run-pass/extern/extern-calling-convention-test.rs index 7231a7cde85e0..5e67db5f456bb 100644 --- a/src/test/run-pass/extern/extern-calling-convention-test.rs +++ b/src/test/run-pass/extern/extern-calling-convention-test.rs @@ -1,7 +1,7 @@ // run-pass // aux-build:extern_calling_convention.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate extern_calling_convention; diff --git a/src/test/run-pass/extern/extern-foreign-crate.rs b/src/test/run-pass/extern/extern-foreign-crate.rs index 7f774c44277f3..92240701ea08e 100644 --- a/src/test/run-pass/extern/extern-foreign-crate.rs +++ b/src/test/run-pass/extern/extern-foreign-crate.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate std as mystd; diff --git a/src/test/run-pass/extern/extern-mod-abi.rs b/src/test/run-pass/extern/extern-mod-abi.rs index c543394cca05f..05a32885297a3 100644 --- a/src/test/run-pass/extern/extern-mod-abi.rs +++ b/src/test/run-pass/extern/extern-mod-abi.rs @@ -1,6 +1,6 @@ // run-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern "C" { fn pow(x: f64, y: f64) -> f64; diff --git a/src/test/run-pass/extern/extern-mod-ordering-exe.rs b/src/test/run-pass/extern/extern-mod-ordering-exe.rs index d7cc4dffb440a..0ebef68dc1673 100644 --- a/src/test/run-pass/extern/extern-mod-ordering-exe.rs +++ b/src/test/run-pass/extern/extern-mod-ordering-exe.rs @@ -1,7 +1,7 @@ // run-pass // aux-build:extern_mod_ordering_lib.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate extern_mod_ordering_lib; diff --git a/src/test/run-pass/extern/extern-pass-empty.rs b/src/test/run-pass/extern/extern-pass-empty.rs index 07099a2420483..9d3ca16fd70db 100644 --- a/src/test/run-pass/extern/extern-pass-empty.rs +++ b/src/test/run-pass/extern/extern-pass-empty.rs @@ -3,7 +3,7 @@ // Test a foreign function that accepts empty struct. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): // ignore-msvc // ignore-emscripten emcc asserts on an empty struct as an argument diff --git a/src/test/run-pass/extern/extern-pub.rs b/src/test/run-pass/extern/extern-pub.rs index c97e04b0755ee..8c0b7d35a838f 100644 --- a/src/test/run-pass/extern/extern-pub.rs +++ b/src/test/run-pass/extern/extern-pub.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern { pub fn free(p: *const u8); diff --git a/src/test/run-pass/extern/extern-rust.rs b/src/test/run-pass/extern/extern-rust.rs index 0cb190257be89..69d16fdf9cd50 100644 --- a/src/test/run-pass/extern/extern-rust.rs +++ b/src/test/run-pass/extern/extern-rust.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #[repr(C)] pub struct Foo(u32); diff --git a/src/test/run-pass/filter-block-view-items.rs b/src/test/run-pass/filter-block-view-items.rs index d2b9866504a98..d116639c96709 100644 --- a/src/test/run-pass/filter-block-view-items.rs +++ b/src/test/run-pass/filter-block-view-items.rs @@ -1,7 +1,7 @@ -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616) pub fn main() { // Make sure that this view item is filtered out because otherwise it would - // trigger a compilation error + // trigger a compilation error. #[cfg(not_present)] use bar as foo; } diff --git a/src/test/run-pass/fixup-deref-mut.rs b/src/test/run-pass/fixup-deref-mut.rs index a35412fea3fec..143a70c9b128e 100644 --- a/src/test/run-pass/fixup-deref-mut.rs +++ b/src/test/run-pass/fixup-deref-mut.rs @@ -1,5 +1,5 @@ #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): use std::ops::{Deref, DerefMut}; diff --git a/src/test/run-pass/for-loop-while/break-value.rs b/src/test/run-pass/for-loop-while/break-value.rs index 9fc49fa8181b1..a3fb83a4d2650 100644 --- a/src/test/run-pass/for-loop-while/break-value.rs +++ b/src/test/run-pass/for-loop-while/break-value.rs @@ -1,6 +1,6 @@ // run-pass #![allow(unreachable_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): fn int_id(x: isize) -> isize { return x; } diff --git a/src/test/run-pass/for-loop-while/labeled-break.rs b/src/test/run-pass/for-loop-while/labeled-break.rs index 4dacc57574f17..993af40d43c8d 100644 --- a/src/test/run-pass/for-loop-while/labeled-break.rs +++ b/src/test/run-pass/for-loop-while/labeled-break.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): pub fn main() { 'foo: loop { diff --git a/src/test/run-pass/for-loop-while/liveness-assign-imm-local-after-loop.rs b/src/test/run-pass/for-loop-while/liveness-assign-imm-local-after-loop.rs index 11b6971656f08..64bfc736b409b 100644 --- a/src/test/run-pass/for-loop-while/liveness-assign-imm-local-after-loop.rs +++ b/src/test/run-pass/for-loop-while/liveness-assign-imm-local-after-loop.rs @@ -1,7 +1,7 @@ // run-pass #![allow(dead_code)] #![allow(unused_assignments)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![allow(unreachable_code)] #![allow(unused_variables)] diff --git a/src/test/run-pass/for-loop-while/liveness-move-in-loop.rs b/src/test/run-pass/for-loop-while/liveness-move-in-loop.rs index ce73d6335cb21..f63f65b3fffc5 100644 --- a/src/test/run-pass/for-loop-while/liveness-move-in-loop.rs +++ b/src/test/run-pass/for-loop-while/liveness-move-in-loop.rs @@ -1,7 +1,7 @@ // run-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): fn take(x: isize) -> isize {x} diff --git a/src/test/run-pass/for-loop-while/loop-diverges.rs b/src/test/run-pass/for-loop-while/loop-diverges.rs index f657bf9e0b3bc..c03d2f1f203e2 100644 --- a/src/test/run-pass/for-loop-while/loop-diverges.rs +++ b/src/test/run-pass/for-loop-while/loop-diverges.rs @@ -1,6 +1,6 @@ // run-pass #![allow(unused_parens)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): /* Make sure a loop{} can be the tailexpr in the body of a diverging function */ diff --git a/src/test/run-pass/for-loop-while/loop-label-shadowing.rs b/src/test/run-pass/for-loop-while/loop-label-shadowing.rs index acb53e254bb78..1a5a204d3731b 100644 --- a/src/test/run-pass/for-loop-while/loop-label-shadowing.rs +++ b/src/test/run-pass/for-loop-while/loop-label-shadowing.rs @@ -1,7 +1,7 @@ // run-pass // Issue #12512. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): fn main() { let mut foo = Vec::new(); diff --git a/src/test/run-pass/for-loop-while/loop-labeled-break-value.rs b/src/test/run-pass/for-loop-while/loop-labeled-break-value.rs index cc8f826983b6a..45355ad1b3b6e 100644 --- a/src/test/run-pass/for-loop-while/loop-labeled-break-value.rs +++ b/src/test/run-pass/for-loop-while/loop-labeled-break-value.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): fn main() { 'outer: loop { diff --git a/src/test/run-pass/for-loop-while/loop-no-reinit-needed-post-bot.rs b/src/test/run-pass/for-loop-while/loop-no-reinit-needed-post-bot.rs index 1b5db20129d8b..779db45b892ca 100644 --- a/src/test/run-pass/for-loop-while/loop-no-reinit-needed-post-bot.rs +++ b/src/test/run-pass/for-loop-while/loop-no-reinit-needed-post-bot.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): struct S; // Ensure S is moved, not copied, on assignment. diff --git a/src/test/run-pass/for-loop-while/while-flow-graph.rs b/src/test/run-pass/for-loop-while/while-flow-graph.rs index 1748964a7b2a0..33dcbf315d8ae 100644 --- a/src/test/run-pass/for-loop-while/while-flow-graph.rs +++ b/src/test/run-pass/for-loop-while/while-flow-graph.rs @@ -1,6 +1,6 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): pub fn main() { let x: isize = 10; while x == 10 && x == 11 { let _y = 0xf00_usize; } } diff --git a/src/test/run-pass/foreign/auxiliary/foreign_lib.rs b/src/test/run-pass/foreign/auxiliary/foreign_lib.rs index de6b0e2118a58..be1a6b78cf4f5 100644 --- a/src/test/run-pass/foreign/auxiliary/foreign_lib.rs +++ b/src/test/run-pass/foreign/auxiliary/foreign_lib.rs @@ -23,7 +23,7 @@ pub mod rustrt3 { // Different type, but same ABI (on all supported platforms). // Ensures that we don't ICE or trigger LLVM asserts when // importing the same symbol under different types. - // See https://github.com/rust-lang/rust/issues/32740. + // See issue #32740. extern { pub fn rust_get_test_int() -> *const u8; } diff --git a/src/test/run-pass/foreign/foreign-mod-unused-const.rs b/src/test/run-pass/foreign/foreign-mod-unused-const.rs index d9efbe00e525d..4f04e993a45a9 100644 --- a/src/test/run-pass/foreign/foreign-mod-unused-const.rs +++ b/src/test/run-pass/foreign/foreign-mod-unused-const.rs @@ -1,6 +1,6 @@ // run-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): mod foo { extern { diff --git a/src/test/run-pass/foreign/foreign-no-abi.rs b/src/test/run-pass/foreign/foreign-no-abi.rs index 2f33fb4765690..aabac0aac61aa 100644 --- a/src/test/run-pass/foreign/foreign-no-abi.rs +++ b/src/test/run-pass/foreign/foreign-no-abi.rs @@ -2,7 +2,7 @@ // ABI is cdecl by default // ignore-wasm32-bare no libc to test ffi with -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![feature(rustc_private)] diff --git a/src/test/run-pass/foreign/foreign-truncated-arguments.rs b/src/test/run-pass/foreign/foreign-truncated-arguments.rs index c61c2b587b652..e5a3f1f5f606a 100644 --- a/src/test/run-pass/foreign/foreign-truncated-arguments.rs +++ b/src/test/run-pass/foreign/foreign-truncated-arguments.rs @@ -1,6 +1,5 @@ // run-pass // compile-flags: -O -// Regression test for https://github.com/rust-lang/rust/issues/33868 #[repr(C)] pub struct S { diff --git a/src/test/run-pass/foreign/foreign2.rs b/src/test/run-pass/foreign/foreign2.rs index c1ab57776f6dc..de2a1887d2e81 100644 --- a/src/test/run-pass/foreign/foreign2.rs +++ b/src/test/run-pass/foreign/foreign2.rs @@ -1,7 +1,7 @@ // run-pass #![allow(dead_code)] // ignore-wasm32-bare no libc to test ffi with -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![feature(rustc_private)] diff --git a/src/test/run-pass/format-ref-cell.rs b/src/test/run-pass/format-ref-cell.rs index 0e7925af78f24..8f1358ea5a365 100644 --- a/src/test/run-pass/format-ref-cell.rs +++ b/src/test/run-pass/format-ref-cell.rs @@ -3,6 +3,6 @@ use std::cell::RefCell; pub fn main() { let name = RefCell::new("rust"); let what = RefCell::new("rocks"); - let msg = format!("{name} {}", &*what.borrow(), name=&*name.borrow()); + let msg = format!("{name} {}", &*what.borrow(), name = &*name.borrow()); assert_eq!(msg, "rust rocks".to_string()); } diff --git a/src/test/run-pass/fsu-moves-and-copies.rs b/src/test/run-pass/fsu-moves-and-copies.rs index f9544ec39a0c7..b2fc9d100300e 100644 --- a/src/test/run-pass/fsu-moves-and-copies.rs +++ b/src/test/run-pass/fsu-moves-and-copies.rs @@ -1,6 +1,6 @@ #![allow(non_camel_case_types)] #![allow(stable_features)] -// Issue 4691: Ensure that functional-struct-updates operates +// Issue #4691: Ensure that functional-struct-updates operates // correctly and moves rather than copy when appropriate. #![feature(box_syntax, core)] diff --git a/src/test/run-pass/functions-closures/closure-bounds-can-capture-chan.rs b/src/test/run-pass/functions-closures/closure-bounds-can-capture-chan.rs index ccb2e201d7d12..89989794259d3 100644 --- a/src/test/run-pass/functions-closures/closure-bounds-can-capture-chan.rs +++ b/src/test/run-pass/functions-closures/closure-bounds-can-capture-chan.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): use std::sync::mpsc::channel; diff --git a/src/test/run-pass/functions-closures/closure-reform.rs b/src/test/run-pass/functions-closures/closure-reform.rs index 0bb6159ff4aa1..1af371f3bbd25 100644 --- a/src/test/run-pass/functions-closures/closure-reform.rs +++ b/src/test/run-pass/functions-closures/closure-reform.rs @@ -1,7 +1,6 @@ // run-pass + #![allow(unused_variables)] -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ fn call_it(f: F) where F : FnOnce(String) -> String diff --git a/src/test/run-pass/functions-closures/fn-abi.rs b/src/test/run-pass/functions-closures/fn-abi.rs index 900af9c1f66b7..d8eb46924470d 100644 --- a/src/test/run-pass/functions-closures/fn-abi.rs +++ b/src/test/run-pass/functions-closures/fn-abi.rs @@ -2,7 +2,7 @@ // Ensure that declarations and types which use `extern fn` both have the same // ABI (#9309). -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): // aux-build:fn-abi.rs extern crate fn_abi; diff --git a/src/test/run-pass/functions-closures/fn-bare-coerce-to-block.rs b/src/test/run-pass/functions-closures/fn-bare-coerce-to-block.rs index 922e016ddc808..0c5a3df341a9d 100644 --- a/src/test/run-pass/functions-closures/fn-bare-coerce-to-block.rs +++ b/src/test/run-pass/functions-closures/fn-bare-coerce-to-block.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): fn bare() {} diff --git a/src/test/run-pass/functions-closures/fn-coerce-field.rs b/src/test/run-pass/functions-closures/fn-coerce-field.rs index 38bde7b9e8fbc..52ac8ab73a038 100644 --- a/src/test/run-pass/functions-closures/fn-coerce-field.rs +++ b/src/test/run-pass/functions-closures/fn-coerce-field.rs @@ -1,6 +1,6 @@ // run-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![allow(non_camel_case_types)] struct r where F: FnOnce() { diff --git a/src/test/run-pass/functions-closures/fn-item-type-coerce.rs b/src/test/run-pass/functions-closures/fn-item-type-coerce.rs index 7a096764e45fe..19a44c087a354 100644 --- a/src/test/run-pass/functions-closures/fn-item-type-coerce.rs +++ b/src/test/run-pass/functions-closures/fn-item-type-coerce.rs @@ -2,7 +2,7 @@ #![allow(unused_variables)] // Test implicit coercions from a fn item type to a fn pointer type. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): fn foo(x: isize) -> isize { x * 2 } fn bar(x: isize) -> isize { x * 4 } diff --git a/src/test/run-pass/functions-closures/fn-lval.rs b/src/test/run-pass/functions-closures/fn-lval.rs index 01079eea457c3..6dcdda324b858 100644 --- a/src/test/run-pass/functions-closures/fn-lval.rs +++ b/src/test/run-pass/functions-closures/fn-lval.rs @@ -2,7 +2,7 @@ -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): fn foo(_f: fn(isize) -> isize) { } diff --git a/src/test/run-pass/functions-closures/fn-type-infer.rs b/src/test/run-pass/functions-closures/fn-type-infer.rs index fe6567f22b504..f2ae86840039d 100644 --- a/src/test/run-pass/functions-closures/fn-type-infer.rs +++ b/src/test/run-pass/functions-closures/fn-type-infer.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![allow(unused_variables)] diff --git a/src/test/run-pass/generator/yield-in-initializer.rs b/src/test/run-pass/generator/yield-in-initializer.rs index 8ff35d8ddf10f..c338638b7f854 100644 --- a/src/test/run-pass/generator/yield-in-initializer.rs +++ b/src/test/run-pass/generator/yield-in-initializer.rs @@ -5,8 +5,8 @@ fn main() { static || { loop { - // Test that `opt` is not live across the yield, even when borrowed in a loop - // See https://github.com/rust-lang/rust/issues/52792 + // Test that `opt` is not live across the yield, even when borrowed in a loop. + // See issue #52792. let opt = { yield; true diff --git a/src/test/run-pass/generics/generic-default-type-params-cross-crate.rs b/src/test/run-pass/generics/generic-default-type-params-cross-crate.rs index 9e5eaa72c152f..afe1d8abfe2fa 100644 --- a/src/test/run-pass/generics/generic-default-type-params-cross-crate.rs +++ b/src/test/run-pass/generics/generic-default-type-params-cross-crate.rs @@ -1,7 +1,7 @@ // run-pass // aux-build:default_type_params_xc.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate default_type_params_xc; diff --git a/src/test/run-pass/generics/generic-fn-twice.rs b/src/test/run-pass/generics/generic-fn-twice.rs index 2f25fc24ced0b..91633737f009c 100644 --- a/src/test/run-pass/generics/generic-fn-twice.rs +++ b/src/test/run-pass/generics/generic-fn-twice.rs @@ -2,7 +2,7 @@ -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): mod foomod { pub fn foo() { } diff --git a/src/test/run-pass/generics/generic-newtype-struct.rs b/src/test/run-pass/generics/generic-newtype-struct.rs index 570c982cc8700..01c8b6a45775b 100644 --- a/src/test/run-pass/generics/generic-newtype-struct.rs +++ b/src/test/run-pass/generics/generic-newtype-struct.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): struct S(T); diff --git a/src/test/run-pass/generics/generic-tag-corruption.rs b/src/test/run-pass/generics/generic-tag-corruption.rs index aa26183a0d491..9205c397ebce2 100644 --- a/src/test/run-pass/generics/generic-tag-corruption.rs +++ b/src/test/run-pass/generics/generic-tag-corruption.rs @@ -3,7 +3,7 @@ // This used to cause memory corruption in stage 0. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): enum thing { some(K), } diff --git a/src/test/run-pass/generics/generic-tag-local.rs b/src/test/run-pass/generics/generic-tag-local.rs index cc85e6e0f0a8d..b521434d76819 100644 --- a/src/test/run-pass/generics/generic-tag-local.rs +++ b/src/test/run-pass/generics/generic-tag-local.rs @@ -1,7 +1,7 @@ // run-pass #![allow(non_camel_case_types)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): enum clam { a(T), } diff --git a/src/test/run-pass/generics/generic-tag.rs b/src/test/run-pass/generics/generic-tag.rs index 74ef4eeba8ab7..db219644fde22 100644 --- a/src/test/run-pass/generics/generic-tag.rs +++ b/src/test/run-pass/generics/generic-tag.rs @@ -2,7 +2,7 @@ #![allow(unused_assignments)] #![allow(non_camel_case_types)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![allow(unused_variables)] #![feature(box_syntax)] diff --git a/src/test/run-pass/generics/generic-type-synonym.rs b/src/test/run-pass/generics/generic-type-synonym.rs index 4f181fbcc7e38..12c83fbb3abd1 100644 --- a/src/test/run-pass/generics/generic-type-synonym.rs +++ b/src/test/run-pass/generics/generic-type-synonym.rs @@ -2,7 +2,7 @@ #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): struct Foo { a: T diff --git a/src/test/run-pass/higher-rank-trait-bounds/hrtb-binder-levels-in-object-types.rs b/src/test/run-pass/higher-rank-trait-bounds/hrtb-binder-levels-in-object-types.rs index 1591d616cac78..c90fd81aebbec 100644 --- a/src/test/run-pass/higher-rank-trait-bounds/hrtb-binder-levels-in-object-types.rs +++ b/src/test/run-pass/higher-rank-trait-bounds/hrtb-binder-levels-in-object-types.rs @@ -6,7 +6,7 @@ // `&Typer<'tcx>` was getting an incorrect binder level, yielding // weird compilation ICEs and so forth. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): trait Typer<'tcx> { fn method(&self, data: &'tcx isize) -> &'tcx isize { data } diff --git a/src/test/run-pass/higher-rank-trait-bounds/hrtb-debruijn-object-types-in-closures.rs b/src/test/run-pass/higher-rank-trait-bounds/hrtb-debruijn-object-types-in-closures.rs index 09152970fdcd2..c61d9ce9ca5dd 100644 --- a/src/test/run-pass/higher-rank-trait-bounds/hrtb-debruijn-object-types-in-closures.rs +++ b/src/test/run-pass/higher-rank-trait-bounds/hrtb-debruijn-object-types-in-closures.rs @@ -1,6 +1,6 @@ // run-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): trait Typer<'tcx> { fn method(&self, data: &'tcx isize) -> &'tcx isize { data } diff --git a/src/test/run-pass/higher-rank-trait-bounds/hrtb-parse.rs b/src/test/run-pass/higher-rank-trait-bounds/hrtb-parse.rs index 3fb0b3290eb02..8e37192746be7 100644 --- a/src/test/run-pass/higher-rank-trait-bounds/hrtb-parse.rs +++ b/src/test/run-pass/higher-rank-trait-bounds/hrtb-parse.rs @@ -2,7 +2,7 @@ // Test that we can parse all the various places that a `for` keyword // can appear representing universal quantification. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![allow(unused_variables)] #![allow(dead_code)] diff --git a/src/test/run-pass/higher-rank-trait-bounds/hrtb-precedence-of-plus-where-clause.rs b/src/test/run-pass/higher-rank-trait-bounds/hrtb-precedence-of-plus-where-clause.rs index 42247798f661b..22a78e6e2b48e 100644 --- a/src/test/run-pass/higher-rank-trait-bounds/hrtb-precedence-of-plus-where-clause.rs +++ b/src/test/run-pass/higher-rank-trait-bounds/hrtb-precedence-of-plus-where-clause.rs @@ -1,7 +1,7 @@ // run-pass #![allow(dead_code)] #![allow(unused_variables)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): // Test that `F : Fn(isize) -> isize + Send` is interpreted as two // distinct bounds on `F`. diff --git a/src/test/run-pass/higher-rank-trait-bounds/hrtb-precedence-of-plus.rs b/src/test/run-pass/higher-rank-trait-bounds/hrtb-precedence-of-plus.rs index 5fda4b826e00c..a7db597fe24e7 100644 --- a/src/test/run-pass/higher-rank-trait-bounds/hrtb-precedence-of-plus.rs +++ b/src/test/run-pass/higher-rank-trait-bounds/hrtb-precedence-of-plus.rs @@ -1,6 +1,6 @@ // run-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): // Test that `Fn(isize) -> isize + 'static` parses as `(Fn(isize) -> isize) + // 'static` and not `Fn(isize) -> (isize + 'static)`. The latter would diff --git a/src/test/run-pass/higher-rank-trait-bounds/hrtb-resolve-lifetime.rs b/src/test/run-pass/higher-rank-trait-bounds/hrtb-resolve-lifetime.rs index 917f6f9611844..f228ea7afa7d2 100644 --- a/src/test/run-pass/higher-rank-trait-bounds/hrtb-resolve-lifetime.rs +++ b/src/test/run-pass/higher-rank-trait-bounds/hrtb-resolve-lifetime.rs @@ -2,7 +2,7 @@ #![allow(dead_code)] // A basic test of using a higher-ranked trait bound. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): trait FnLike { fn call(&self, arg: A) -> R; diff --git a/src/test/run-pass/higher-rank-trait-bounds/hrtb-trait-object-passed-to-closure.rs b/src/test/run-pass/higher-rank-trait-bounds/hrtb-trait-object-passed-to-closure.rs index 4cb9242f0ed80..e407c7d8aa3a3 100644 --- a/src/test/run-pass/higher-rank-trait-bounds/hrtb-trait-object-passed-to-closure.rs +++ b/src/test/run-pass/higher-rank-trait-bounds/hrtb-trait-object-passed-to-closure.rs @@ -4,7 +4,7 @@ // PrinterSupport<'b>`, gets properly expanded when it appears in a // closure type. This used to result in messed up De Bruijn indices. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): trait PrinterSupport<'ast> { fn ast_map(&self) -> Option<&'ast usize> { None } diff --git a/src/test/run-pass/hygiene/hygienic-labels-in-let.rs b/src/test/run-pass/hygiene/hygienic-labels-in-let.rs index fb9523b547d2e..b078d64cf5863 100644 --- a/src/test/run-pass/hygiene/hygienic-labels-in-let.rs +++ b/src/test/run-pass/hygiene/hygienic-labels-in-let.rs @@ -1,7 +1,7 @@ // run-pass #![allow(unreachable_code)] -// Test that labels injected by macros do not break hygiene. This +// Test that labels injected by macros do not break hygiene. This // checks cases where the macros invocations are under the rhs of a // let statement. diff --git a/src/test/run-pass/if-ret.rs b/src/test/run-pass/if-ret.rs index 3c2377466a150..aed39c117643b 100644 --- a/src/test/run-pass/if-ret.rs +++ b/src/test/run-pass/if-ret.rs @@ -1,5 +1,5 @@ #![allow(unused_parens)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): fn foo() { if (return) { } } diff --git a/src/test/run-pass/ignore-all-the-things.rs b/src/test/run-pass/ignore-all-the-things.rs index 6916a199a1003..e3f89535a1f96 100644 --- a/src/test/run-pass/ignore-all-the-things.rs +++ b/src/test/run-pass/ignore-all-the-things.rs @@ -1,7 +1,7 @@ #![allow(non_shorthand_field_patterns)] #![allow(dead_code)] #![allow(unused_variables)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![feature(slice_patterns)] diff --git a/src/test/run-pass/impl-privacy-xc-1.rs b/src/test/run-pass/impl-privacy-xc-1.rs index 42e149eacb543..e0711bb519218 100644 --- a/src/test/run-pass/impl-privacy-xc-1.rs +++ b/src/test/run-pass/impl-privacy-xc-1.rs @@ -1,6 +1,6 @@ // aux-build:impl_privacy_xc_1.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate impl_privacy_xc_1; diff --git a/src/test/run-pass/impl-trait/auxiliary/xcrate.rs b/src/test/run-pass/impl-trait/auxiliary/xcrate.rs index ac016258b7f92..28286b45f48c8 100644 --- a/src/test/run-pass/impl-trait/auxiliary/xcrate.rs +++ b/src/test/run-pass/impl-trait/auxiliary/xcrate.rs @@ -1,5 +1,5 @@ // NOTE commented out due to issue #45994 -//pub fn fourway_add(a: i32) -> impl Fn(i32) -> impl Fn(i32) -> impl Fn(i32) -> i32 { +// pub fn fourway_add(a: i32) -> impl Fn(i32) -> impl Fn(i32) -> impl Fn(i32) -> i32 { // move |b| move |c| move |d| a + b + c + d //} diff --git a/src/test/run-pass/impl-trait/example-calendar.rs b/src/test/run-pass/impl-trait/example-calendar.rs index cd3d48f1a03b2..34d8394c771ea 100644 --- a/src/test/run-pass/impl-trait/example-calendar.rs +++ b/src/test/run-pass/impl-trait/example-calendar.rs @@ -330,7 +330,7 @@ fn test_spaces() { } /// Returns an iterator of dates in a given year. -fn dates_in_year(year: i32) -> impl Iterator+Clone { +fn dates_in_year(year: i32) -> impl Iterator+Clone { InGroup { it: NaiveDate::from_ymd(year, 1, 1).., f: |d: &NaiveDate| d.year(), @@ -376,8 +376,8 @@ fn test_dates_in_year() { /// Convenience trait for verifying that a given type iterates over /// `NaiveDate`s. -trait DateIterator: Iterator + Clone {} -impl DateIterator for It where It: Iterator + Clone {} +trait DateIterator: Iterator + Clone {} +impl DateIterator for It where It: Iterator + Clone {} fn test_group_by() { let input = [ @@ -412,8 +412,8 @@ fn test_group_by() { } /// Groups an iterator of dates by month. -fn by_month(it: impl Iterator + Clone) - -> impl Iterator + Clone)> + Clone +fn by_month(it: impl Iterator + Clone) + -> impl Iterator + Clone)> + Clone { it.group_by(|d| d.month()) } @@ -499,7 +499,7 @@ const COLS_PER_DAY: u32 = 3; const COLS_PER_WEEK: u32 = 7 * COLS_PER_DAY; /// Formats an iterator of weeks into an iterator of strings. -fn format_weeks(it: impl Iterator) -> impl Iterator { +fn format_weeks(it: impl Iterator) -> impl Iterator { it.map(|week| { let mut buf = String::with_capacity((COLS_PER_DAY * COLS_PER_WEEK + 2) as usize); @@ -573,7 +573,7 @@ fn test_month_title() { } /// Formats a month. -fn format_month(it: impl DateIterator) -> impl Iterator { +fn format_month(it: impl DateIterator) -> impl Iterator { let mut month_days = it.peekable(); let title = month_title(month_days.peek().unwrap().month()); @@ -603,7 +603,7 @@ fn test_format_month() { /// Formats an iterator of months. fn format_months(it: impl Iterator) - -> impl Iterator> + -> impl Iterator> { it.map(format_month) } @@ -622,10 +622,10 @@ where Self::Item: Iterator { } } -impl PasteBlocks for It where It: Iterator, It::Item: Iterator {} +impl PasteBlocks for It where It: Iterator, It::Item: Iterator {} struct PasteBlocksIter -where StrIt: Iterator { +where StrIt: Iterator { iters: Vec, cache: Vec>, col_widths: Option>, @@ -633,7 +633,7 @@ where StrIt: Iterator { } impl Iterator for PasteBlocksIter -where StrIt: Iterator { +where StrIt: Iterator { type Item = String; fn next(&mut self) -> Option { diff --git a/src/test/run-pass/imports/import-crate-with-invalid-spans/main.rs b/src/test/run-pass/imports/import-crate-with-invalid-spans/main.rs index 64a4deca8c359..8e1654e1e29da 100644 --- a/src/test/run-pass/imports/import-crate-with-invalid-spans/main.rs +++ b/src/test/run-pass/imports/import-crate-with-invalid-spans/main.rs @@ -1,7 +1,7 @@ // run-pass // aux-build:crate_with_invalid_spans.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate crate_with_invalid_spans; diff --git a/src/test/run-pass/imports/import-from.rs b/src/test/run-pass/imports/import-from.rs index 2817977b39394..5e17180f89138 100644 --- a/src/test/run-pass/imports/import-from.rs +++ b/src/test/run-pass/imports/import-from.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): use spam::{ham, eggs}; diff --git a/src/test/run-pass/imports/import-in-block.rs b/src/test/run-pass/imports/import-in-block.rs index c0ba6220b5443..0377a6a3d742a 100644 --- a/src/test/run-pass/imports/import-in-block.rs +++ b/src/test/run-pass/imports/import-in-block.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): pub fn main() { use std::mem::replace; diff --git a/src/test/run-pass/imports/import-trailing-comma.rs b/src/test/run-pass/imports/import-trailing-comma.rs index f65c5c866a3b8..5fb0fe9b1cfc0 100644 --- a/src/test/run-pass/imports/import-trailing-comma.rs +++ b/src/test/run-pass/imports/import-trailing-comma.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): use foo::bar::{baz, quux,}; diff --git a/src/test/run-pass/infer-fn-tail-expr.rs b/src/test/run-pass/infer-fn-tail-expr.rs index ab0210baa96ed..4984088ef203b 100644 --- a/src/test/run-pass/infer-fn-tail-expr.rs +++ b/src/test/run-pass/infer-fn-tail-expr.rs @@ -2,7 +2,7 @@ // issue #680 -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): fn f() -> Vec { Vec::new() } diff --git a/src/test/run-pass/init-large-type.rs b/src/test/run-pass/init-large-type.rs index cb64cd0b0f3a8..6962c979a32d0 100644 --- a/src/test/run-pass/init-large-type.rs +++ b/src/test/run-pass/init-large-type.rs @@ -3,7 +3,7 @@ // Doing it incorrectly causes massive slowdown in LLVM during // optimisation. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): // ignore-emscripten no threads support #![feature(intrinsics)] diff --git a/src/test/run-pass/instantiable.rs b/src/test/run-pass/instantiable.rs index fe8d9f9714915..1bfb42aa7f1f5 100644 --- a/src/test/run-pass/instantiable.rs +++ b/src/test/run-pass/instantiable.rs @@ -1,6 +1,6 @@ #![allow(non_camel_case_types)] #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): use std::ptr; diff --git a/src/test/run-pass/intrinsics/intrinsic-uninit.rs b/src/test/run-pass/intrinsics/intrinsic-uninit.rs index 9555efb639b50..b327ff0139078 100644 --- a/src/test/run-pass/intrinsics/intrinsic-uninit.rs +++ b/src/test/run-pass/intrinsics/intrinsic-uninit.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![feature(intrinsics)] diff --git a/src/test/run-pass/intrinsics/intrinsics-integer.rs b/src/test/run-pass/intrinsics/intrinsics-integer.rs index 66e07f8683a87..39c334807be19 100644 --- a/src/test/run-pass/intrinsics/intrinsics-integer.rs +++ b/src/test/run-pass/intrinsics/intrinsics-integer.rs @@ -145,8 +145,8 @@ pub fn main() { assert_eq!(cttz_nonzero(100u64), 2); assert_eq!(cttz_nonzero(100i64), 2); assert_eq!(cttz_nonzero(100u128), 2); assert_eq!(cttz_nonzero(100i128), 2); - assert_eq!(bswap(0x0Au8), 0x0A); // no-op - assert_eq!(bswap(0x0Ai8), 0x0A); // no-op + assert_eq!(bswap(0x0Au8), 0x0A); // noop + assert_eq!(bswap(0x0Ai8), 0x0A); // noop assert_eq!(bswap(0x0A0Bu16), 0x0B0A); assert_eq!(bswap(0x0A0Bi16), 0x0B0A); assert_eq!(bswap(0x0ABBCC0Du32), 0x0DCCBB0A); diff --git a/src/test/run-pass/invoke-external-foreign.rs b/src/test/run-pass/invoke-external-foreign.rs index d34933cde4246..9109c48870520 100644 --- a/src/test/run-pass/invoke-external-foreign.rs +++ b/src/test/run-pass/invoke-external-foreign.rs @@ -5,7 +5,7 @@ // successfully (and safely) invoke external, cdecl // functions from outside the crate. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate foreign_lib; diff --git a/src/test/run-pass/irrefutable-unit.rs b/src/test/run-pass/irrefutable-unit.rs index f588ae3a55742..922b9a50444c1 100644 --- a/src/test/run-pass/irrefutable-unit.rs +++ b/src/test/run-pass/irrefutable-unit.rs @@ -1,5 +1,5 @@ -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616) pub fn main() { - let ((),()) = ((),()); + let ((), ()) = ((), ()); } diff --git a/src/test/run-pass/issue-53843.rs b/src/test/run-pass/issue-53843.rs index 53728ec4d9fa5..03657da697c4b 100644 --- a/src/test/run-pass/issue-53843.rs +++ b/src/test/run-pass/issue-53843.rs @@ -4,7 +4,7 @@ pub struct Pin

(P); impl Deref for Pin

where - P: Deref, + P: Deref, { type Target = T; diff --git a/src/test/run-pass/issues/auxiliary/issue34796aux.rs b/src/test/run-pass/issues/auxiliary/issue34796aux.rs index 09c69b90329ff..68a9704f0e590 100644 --- a/src/test/run-pass/issues/auxiliary/issue34796aux.rs +++ b/src/test/run-pass/issues/auxiliary/issue34796aux.rs @@ -9,7 +9,7 @@ impl Future for u32 { type Error = Box<()>; } -fn foo() -> Box>> { +fn foo() -> Box>> { Box::new(0u32) } diff --git a/src/test/run-pass/issues/issue-10025.rs b/src/test/run-pass/issues/issue-10025.rs index 193d7ee891f07..29f446a052365 100644 --- a/src/test/run-pass/issues/issue-10025.rs +++ b/src/test/run-pass/issues/issue-10025.rs @@ -1,6 +1,6 @@ // run-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): unsafe extern fn foo() {} unsafe extern "C" fn bar() {} diff --git a/src/test/run-pass/issues/issue-10028.rs b/src/test/run-pass/issues/issue-10028.rs index 1692470e8d1a8..d09968bf17a75 100644 --- a/src/test/run-pass/issues/issue-10028.rs +++ b/src/test/run-pass/issues/issue-10028.rs @@ -2,7 +2,7 @@ #![allow(dead_code)] // aux-build:issue-10028.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate issue_10028 as issue10028; diff --git a/src/test/run-pass/issues/issue-10031.rs b/src/test/run-pass/issues/issue-10031.rs index ba1fbac48453a..5274831b47b49 100644 --- a/src/test/run-pass/issues/issue-10031.rs +++ b/src/test/run-pass/issues/issue-10031.rs @@ -1,6 +1,6 @@ // run-pass // aux-build:issue_10031_aux.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate issue_10031_aux; diff --git a/src/test/run-pass/issues/issue-10228.rs b/src/test/run-pass/issues/issue-10228.rs index ebf8b436f132f..b6f6246cb6d9a 100644 --- a/src/test/run-pass/issues/issue-10228.rs +++ b/src/test/run-pass/issues/issue-10228.rs @@ -1,7 +1,7 @@ // run-pass #![allow(dead_code)] #![allow(unused_variables)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): enum StdioContainer { CreatePipe(bool) diff --git a/src/test/run-pass/issues/issue-10638.rs b/src/test/run-pass/issues/issue-10638.rs index e359669c00dad..d40d73b82d820 100644 --- a/src/test/run-pass/issues/issue-10638.rs +++ b/src/test/run-pass/issues/issue-10638.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): pub fn main() { //// I am not a doc comment! diff --git a/src/test/run-pass/issues/issue-10682.rs b/src/test/run-pass/issues/issue-10682.rs index afaa90f05caa1..120c211ef7006 100644 --- a/src/test/run-pass/issues/issue-10682.rs +++ b/src/test/run-pass/issues/issue-10682.rs @@ -2,7 +2,7 @@ // Regression test for issue #10682 // Nested `proc` usage can't use outer owned data -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![feature(box_syntax)] diff --git a/src/test/run-pass/issues/issue-10683.rs b/src/test/run-pass/issues/issue-10683.rs index dcb221f8c5776..d675e9b855e2a 100644 --- a/src/test/run-pass/issues/issue-10683.rs +++ b/src/test/run-pass/issues/issue-10683.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): static NAME: &'static str = "hello world"; diff --git a/src/test/run-pass/issues/issue-10718.rs b/src/test/run-pass/issues/issue-10718.rs index a1de0cfe6ca6a..367bdacdcfc68 100644 --- a/src/test/run-pass/issues/issue-10718.rs +++ b/src/test/run-pass/issues/issue-10718.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): fn f(p: F) { p(); diff --git a/src/test/run-pass/issues/issue-10764.rs b/src/test/run-pass/issues/issue-10764.rs index 42ed1ae93b551..2ec5af046c7d1 100644 --- a/src/test/run-pass/issues/issue-10764.rs +++ b/src/test/run-pass/issues/issue-10764.rs @@ -1,4 +1,4 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern "Rust" fn main() {} diff --git a/src/test/run-pass/issues/issue-10767.rs b/src/test/run-pass/issues/issue-10767.rs index fa10f073b4576..bd96138115359 100644 --- a/src/test/run-pass/issues/issue-10767.rs +++ b/src/test/run-pass/issues/issue-10767.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![feature(box_syntax)] diff --git a/src/test/run-pass/issues/issue-10806.rs b/src/test/run-pass/issues/issue-10806.rs index 2f1d7bb5aaf3d..d6e858f11b067 100644 --- a/src/test/run-pass/issues/issue-10806.rs +++ b/src/test/run-pass/issues/issue-10806.rs @@ -1,7 +1,7 @@ // run-pass #![allow(unused_imports)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): pub fn foo() -> isize { 3 diff --git a/src/test/run-pass/issues/issue-11085.rs b/src/test/run-pass/issues/issue-11085.rs index 47c03238b55f0..e33772761f189 100644 --- a/src/test/run-pass/issues/issue-11085.rs +++ b/src/test/run-pass/issues/issue-11085.rs @@ -2,7 +2,7 @@ #![allow(dead_code)] // compile-flags: --cfg foo -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): struct Foo { #[cfg(fail)] diff --git a/src/test/run-pass/issues/issue-11205.rs b/src/test/run-pass/issues/issue-11205.rs index b628bf601968d..dc20b193db924 100644 --- a/src/test/run-pass/issues/issue-11205.rs +++ b/src/test/run-pass/issues/issue-11205.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![allow(dead_code)] diff --git a/src/test/run-pass/issues/issue-11224.rs b/src/test/run-pass/issues/issue-11224.rs index e1c1df99aca9e..c9ee06ba3cccd 100644 --- a/src/test/run-pass/issues/issue-11224.rs +++ b/src/test/run-pass/issues/issue-11224.rs @@ -1,7 +1,7 @@ // run-pass // aux-build:issue-11224.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate issue_11224 as unused; diff --git a/src/test/run-pass/issues/issue-11225-1.rs b/src/test/run-pass/issues/issue-11225-1.rs index d1f2ea5e7de28..182844723da57 100644 --- a/src/test/run-pass/issues/issue-11225-1.rs +++ b/src/test/run-pass/issues/issue-11225-1.rs @@ -1,7 +1,7 @@ // run-pass // aux-build:issue-11225-1.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate issue_11225_1 as foo; diff --git a/src/test/run-pass/issues/issue-11225-2.rs b/src/test/run-pass/issues/issue-11225-2.rs index d41c75443f1a6..da8c1fe9ce027 100644 --- a/src/test/run-pass/issues/issue-11225-2.rs +++ b/src/test/run-pass/issues/issue-11225-2.rs @@ -1,7 +1,7 @@ // run-pass // aux-build:issue-11225-2.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate issue_11225_2 as foo; diff --git a/src/test/run-pass/issues/issue-11225-3.rs b/src/test/run-pass/issues/issue-11225-3.rs index e69496baa2669..4a8bfaefb480e 100644 --- a/src/test/run-pass/issues/issue-11225-3.rs +++ b/src/test/run-pass/issues/issue-11225-3.rs @@ -1,7 +1,7 @@ // run-pass // aux-build:issue-11225-3.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate issue_11225_3; diff --git a/src/test/run-pass/issues/issue-11529.rs b/src/test/run-pass/issues/issue-11529.rs index 9a6cc8e9fe881..46fd573ca39e6 100644 --- a/src/test/run-pass/issues/issue-11529.rs +++ b/src/test/run-pass/issues/issue-11529.rs @@ -1,7 +1,7 @@ // run-pass // aux-build:issue-11529.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate issue_11529 as a; diff --git a/src/test/run-pass/issues/issue-11820.rs b/src/test/run-pass/issues/issue-11820.rs index 7ffe9652797cf..fc98a4c3a9427 100644 --- a/src/test/run-pass/issues/issue-11820.rs +++ b/src/test/run-pass/issues/issue-11820.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): struct NoClone; diff --git a/src/test/run-pass/issues/issue-12133-1.rs b/src/test/run-pass/issues/issue-12133-1.rs index 96ad5abd5483e..38af5bfc123fd 100644 --- a/src/test/run-pass/issues/issue-12133-1.rs +++ b/src/test/run-pass/issues/issue-12133-1.rs @@ -2,7 +2,7 @@ // aux-build:issue-12133-rlib.rs // aux-build:issue-12133-dylib.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate issue_12133_rlib as a; extern crate issue_12133_dylib as b; diff --git a/src/test/run-pass/issues/issue-12133-2.rs b/src/test/run-pass/issues/issue-12133-2.rs index 02fec65c2ed54..a6b8ac4f6cb22 100644 --- a/src/test/run-pass/issues/issue-12133-2.rs +++ b/src/test/run-pass/issues/issue-12133-2.rs @@ -3,7 +3,7 @@ // aux-build:issue-12133-dylib.rs // no-prefer-dynamic -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate issue_12133_rlib as a; extern crate issue_12133_dylib as b; diff --git a/src/test/run-pass/issues/issue-12133-3.rs b/src/test/run-pass/issues/issue-12133-3.rs index c87a37ab6b787..49a2fcdec417c 100644 --- a/src/test/run-pass/issues/issue-12133-3.rs +++ b/src/test/run-pass/issues/issue-12133-3.rs @@ -6,7 +6,7 @@ // ignore-emscripten no dylib support // ignore-musl -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate issue_12133_dylib2 as other; diff --git a/src/test/run-pass/issues/issue-1257.rs b/src/test/run-pass/issues/issue-1257.rs index de5a6d3592586..6b726a33691a0 100644 --- a/src/test/run-pass/issues/issue-1257.rs +++ b/src/test/run-pass/issues/issue-1257.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): pub fn main () { let mut line = "".to_string(); diff --git a/src/test/run-pass/issues/issue-12612.rs b/src/test/run-pass/issues/issue-12612.rs index 158c2aed13724..cb36196a36dc0 100644 --- a/src/test/run-pass/issues/issue-12612.rs +++ b/src/test/run-pass/issues/issue-12612.rs @@ -3,7 +3,7 @@ // aux-build:issue_12612_1.rs // aux-build:issue_12612_2.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate issue_12612_1 as foo; extern crate issue_12612_2 as bar; diff --git a/src/test/run-pass/issues/issue-12660.rs b/src/test/run-pass/issues/issue-12660.rs index 44c492b43f0a8..234bbb1575423 100644 --- a/src/test/run-pass/issues/issue-12660.rs +++ b/src/test/run-pass/issues/issue-12660.rs @@ -1,7 +1,7 @@ // run-pass // aux-build:issue-12660-aux.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate issue12660aux; diff --git a/src/test/run-pass/issues/issue-12909.rs b/src/test/run-pass/issues/issue-12909.rs index a68d73a004f5d..c34a773b3dfa1 100644 --- a/src/test/run-pass/issues/issue-12909.rs +++ b/src/test/run-pass/issues/issue-12909.rs @@ -1,6 +1,6 @@ // run-pass #![allow(unused_variables)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): use std::collections::HashMap; diff --git a/src/test/run-pass/issues/issue-13204.rs b/src/test/run-pass/issues/issue-13204.rs index 3d6aba8455a94..b0218931d19f7 100644 --- a/src/test/run-pass/issues/issue-13204.rs +++ b/src/test/run-pass/issues/issue-13204.rs @@ -5,7 +5,7 @@ pub trait Foo { - fn bar<'a, I: Iterator>(&self, it: I) -> usize { + fn bar<'a, I: Iterator>(&self, it: I) -> usize { let mut xs = it.filter(|_| true); xs.count() } diff --git a/src/test/run-pass/issues/issue-13620.rs b/src/test/run-pass/issues/issue-13620.rs index 3c3c19df75d63..ca138254e3823 100644 --- a/src/test/run-pass/issues/issue-13620.rs +++ b/src/test/run-pass/issues/issue-13620.rs @@ -2,7 +2,7 @@ // aux-build:issue-13620-1.rs // aux-build:issue-13620-2.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate issue_13620_2 as crate2; diff --git a/src/test/run-pass/issues/issue-13665.rs b/src/test/run-pass/issues/issue-13665.rs index a3843c65034bc..5fffa8fd56b28 100644 --- a/src/test/run-pass/issues/issue-13665.rs +++ b/src/test/run-pass/issues/issue-13665.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): fn foo<'r>() { let maybe_value_ref: Option<&'r u8> = None; diff --git a/src/test/run-pass/issues/issue-13763.rs b/src/test/run-pass/issues/issue-13763.rs index dd5f6dbc9dcbb..9835c469978fb 100644 --- a/src/test/run-pass/issues/issue-13763.rs +++ b/src/test/run-pass/issues/issue-13763.rs @@ -1,6 +1,6 @@ // run-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): mod u8 { pub const BITS: usize = 8; diff --git a/src/test/run-pass/issues/issue-13808.rs b/src/test/run-pass/issues/issue-13808.rs index d1b94c7186462..e635642571670 100644 --- a/src/test/run-pass/issues/issue-13808.rs +++ b/src/test/run-pass/issues/issue-13808.rs @@ -1,7 +1,7 @@ // run-pass #![allow(dead_code)] #![allow(unused_variables)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): struct Foo<'a> { listener: Box, diff --git a/src/test/run-pass/issues/issue-13872.rs b/src/test/run-pass/issues/issue-13872.rs index aade6b8367c0b..d67879affa446 100644 --- a/src/test/run-pass/issues/issue-13872.rs +++ b/src/test/run-pass/issues/issue-13872.rs @@ -3,7 +3,7 @@ // aux-build:issue-13872-2.rs // aux-build:issue-13872-3.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate issue_13872_3 as other; diff --git a/src/test/run-pass/issues/issue-14393.rs b/src/test/run-pass/issues/issue-14393.rs index df635407af6ee..c833102b473d0 100644 --- a/src/test/run-pass/issues/issue-14393.rs +++ b/src/test/run-pass/issues/issue-14393.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): fn main() { match ("", 1_usize) { diff --git a/src/test/run-pass/issues/issue-14399.rs b/src/test/run-pass/issues/issue-14399.rs index 1b57856e95566..55c27de6132e0 100644 --- a/src/test/run-pass/issues/issue-14399.rs +++ b/src/test/run-pass/issues/issue-14399.rs @@ -4,7 +4,7 @@ // value was coerced to a trait object. (v.clone() returns Box // which is coerced to Box). -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![feature(box_syntax)] diff --git a/src/test/run-pass/issues/issue-14421.rs b/src/test/run-pass/issues/issue-14421.rs index c59bd87065f25..32f95d5716f6e 100644 --- a/src/test/run-pass/issues/issue-14421.rs +++ b/src/test/run-pass/issues/issue-14421.rs @@ -3,7 +3,7 @@ // aux-build:issue-14421.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate issue_14421 as bug_lib; diff --git a/src/test/run-pass/issues/issue-14422.rs b/src/test/run-pass/issues/issue-14422.rs index b9e2065d01468..0f5dfa00892ed 100644 --- a/src/test/run-pass/issues/issue-14422.rs +++ b/src/test/run-pass/issues/issue-14422.rs @@ -3,7 +3,7 @@ // aux-build:issue-14422.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate issue_14422 as bug_lib; diff --git a/src/test/run-pass/issues/issue-1451.rs b/src/test/run-pass/issues/issue-1451.rs index ad8928b2043ac..20af32fd04958 100644 --- a/src/test/run-pass/issues/issue-1451.rs +++ b/src/test/run-pass/issues/issue-1451.rs @@ -1,6 +1,6 @@ // run-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![allow(non_snake_case)] #![allow(unused_variables)] diff --git a/src/test/run-pass/issues/issue-14589.rs b/src/test/run-pass/issues/issue-14589.rs index d495602dff7e7..5531bb2ca4bd9 100644 --- a/src/test/run-pass/issues/issue-14589.rs +++ b/src/test/run-pass/issues/issue-14589.rs @@ -2,7 +2,7 @@ // All 3 expressions should work in that the argument gets // coerced to a trait object -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): fn main() { send::>(Box::new(Output(0))); diff --git a/src/test/run-pass/issues/issue-1460.rs b/src/test/run-pass/issues/issue-1460.rs index 143a0387e218f..da120606a5c15 100644 --- a/src/test/run-pass/issues/issue-1460.rs +++ b/src/test/run-pass/issues/issue-1460.rs @@ -1,6 +1,6 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): pub fn main() { {|i: u32| if 1 == i { }}; diff --git a/src/test/run-pass/issues/issue-14919.rs b/src/test/run-pass/issues/issue-14919.rs index c6ccb7575bb83..39161cd7cad87 100644 --- a/src/test/run-pass/issues/issue-14919.rs +++ b/src/test/run-pass/issues/issue-14919.rs @@ -1,7 +1,7 @@ // run-pass #![allow(unused_must_use)] #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): trait Matcher { fn next_match(&mut self) -> Option<(usize, usize)>; diff --git a/src/test/run-pass/issues/issue-14958.rs b/src/test/run-pass/issues/issue-14958.rs index 17f7f159fd2db..7f9d59c040b45 100644 --- a/src/test/run-pass/issues/issue-14958.rs +++ b/src/test/run-pass/issues/issue-14958.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![feature(fn_traits, unboxed_closures)] diff --git a/src/test/run-pass/issues/issue-15043.rs b/src/test/run-pass/issues/issue-15043.rs index 53748be8a02f7..43a97ced420fb 100644 --- a/src/test/run-pass/issues/issue-15043.rs +++ b/src/test/run-pass/issues/issue-15043.rs @@ -1,12 +1,12 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![allow(warnings)] struct S(T); -static s1: S>=S(S(0)); -static s2: S=S(0); +static s1: S> = S(S(0)); +static s2: S = S(0); fn main() { let foo: S>=S(S(0)); diff --git a/src/test/run-pass/issues/issue-15221.rs b/src/test/run-pass/issues/issue-15221.rs index 4b8319a8304ff..e72fad92701db 100644 --- a/src/test/run-pass/issues/issue-15221.rs +++ b/src/test/run-pass/issues/issue-15221.rs @@ -1,6 +1,6 @@ // run-pass #![allow(path_statements)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): macro_rules! inner { ($e:pat ) => ($e) diff --git a/src/test/run-pass/issues/issue-15444.rs b/src/test/run-pass/issues/issue-15444.rs index e94afee963419..aa3e8e2c366f4 100644 --- a/src/test/run-pass/issues/issue-15444.rs +++ b/src/test/run-pass/issues/issue-15444.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): trait MyTrait { fn foo(&self); diff --git a/src/test/run-pass/issues/issue-15523-big.rs b/src/test/run-pass/issues/issue-15523-big.rs index 05414f1db72be..50bcdb69ee400 100644 --- a/src/test/run-pass/issues/issue-15523-big.rs +++ b/src/test/run-pass/issues/issue-15523-big.rs @@ -1,5 +1,5 @@ // run-pass -// Issue 15523: derive(PartialOrd) should use the provided +// Issue #15523: derive(PartialOrd) should use the provided // discriminant values for the derived ordering. // // This test is checking corner cases that arise when you have diff --git a/src/test/run-pass/issues/issue-15523.rs b/src/test/run-pass/issues/issue-15523.rs index 220a34b9b0f3f..430fbb82b0f83 100644 --- a/src/test/run-pass/issues/issue-15523.rs +++ b/src/test/run-pass/issues/issue-15523.rs @@ -1,5 +1,5 @@ // run-pass -// Issue 15523: derive(PartialOrd) should use the provided +// Issue #15523: derive(PartialOrd) should use the provided // discriminant values for the derived ordering. // // This is checking the basic functionality. diff --git a/src/test/run-pass/issues/issue-15562.rs b/src/test/run-pass/issues/issue-15562.rs index b37ba81e291e6..d4be4e3790599 100644 --- a/src/test/run-pass/issues/issue-15562.rs +++ b/src/test/run-pass/issues/issue-15562.rs @@ -1,7 +1,7 @@ // run-pass // aux-build:issue-15562.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate issue_15562 as i; diff --git a/src/test/run-pass/issues/issue-15730.rs b/src/test/run-pass/issues/issue-15730.rs index dacffd154fc29..722b2f1612324 100644 --- a/src/test/run-pass/issues/issue-15730.rs +++ b/src/test/run-pass/issues/issue-15730.rs @@ -1,7 +1,7 @@ // run-pass #![allow(unused_mut)] #![allow(unused_variables)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): fn main() { let mut array = [1, 2, 3]; diff --git a/src/test/run-pass/issues/issue-15734.rs b/src/test/run-pass/issues/issue-15734.rs index be582060601e7..ee5ce4e240946 100644 --- a/src/test/run-pass/issues/issue-15734.rs +++ b/src/test/run-pass/issues/issue-15734.rs @@ -33,7 +33,7 @@ impl<'a, T> Index<(usize, usize)> for &'a Mat { struct Row { mat: M, row: usize, } -impl> Index for Row { +impl> Index for Row { type Output = T; fn index<'a>(&'a self, col: usize) -> &'a T { diff --git a/src/test/run-pass/issues/issue-15774.rs b/src/test/run-pass/issues/issue-15774.rs index ed2235758b9d9..d75b7c04b6a10 100644 --- a/src/test/run-pass/issues/issue-15774.rs +++ b/src/test/run-pass/issues/issue-15774.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![deny(warnings)] #![allow(unused_imports)] diff --git a/src/test/run-pass/issues/issue-15881-model-lexer-dotdotdot.rs b/src/test/run-pass/issues/issue-15881-model-lexer-dotdotdot.rs index 2470e37e1820b..6136b21b0ecfa 100644 --- a/src/test/run-pass/issues/issue-15881-model-lexer-dotdotdot.rs +++ b/src/test/run-pass/issues/issue-15881-model-lexer-dotdotdot.rs @@ -1,5 +1,5 @@ // run-pass -#![allow(illegal_floating_point_literal_pattern)] // FIXME #41620 +#![allow(illegal_floating_point_literal_pattern)] // FIXME(#41620): // regression test for the model lexer handling the DOTDOTDOT syntax (#15877) diff --git a/src/test/run-pass/issues/issue-16256.rs b/src/test/run-pass/issues/issue-16256.rs index e566eede8d227..af03476830ae7 100644 --- a/src/test/run-pass/issues/issue-16256.rs +++ b/src/test/run-pass/issues/issue-16256.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): fn main() { let mut buf = Vec::new(); diff --git a/src/test/run-pass/issues/issue-16441.rs b/src/test/run-pass/issues/issue-16441.rs index bae3813f9da95..bd920db10e78a 100644 --- a/src/test/run-pass/issues/issue-16441.rs +++ b/src/test/run-pass/issues/issue-16441.rs @@ -1,6 +1,6 @@ // run-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): struct Empty; diff --git a/src/test/run-pass/issues/issue-16452.rs b/src/test/run-pass/issues/issue-16452.rs index faf9edd3b2640..f5c3c4bc19d94 100644 --- a/src/test/run-pass/issues/issue-16452.rs +++ b/src/test/run-pass/issues/issue-16452.rs @@ -1,6 +1,6 @@ // run-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): fn main() { if true { return } diff --git a/src/test/run-pass/issues/issue-1660.rs b/src/test/run-pass/issues/issue-1660.rs index aa60a8d8a9693..1ab5d3b992ecd 100644 --- a/src/test/run-pass/issues/issue-1660.rs +++ b/src/test/run-pass/issues/issue-1660.rs @@ -1,7 +1,7 @@ // run-pass #![allow(non_upper_case_globals)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): pub fn main() { static _x: isize = 1<<2; diff --git a/src/test/run-pass/issues/issue-16643.rs b/src/test/run-pass/issues/issue-16643.rs index c74a554af2e42..01b77d1c443f6 100644 --- a/src/test/run-pass/issues/issue-16643.rs +++ b/src/test/run-pass/issues/issue-16643.rs @@ -1,7 +1,7 @@ // run-pass // aux-build:issue-16643.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate issue_16643 as i; diff --git a/src/test/run-pass/issues/issue-16671.rs b/src/test/run-pass/issues/issue-16671.rs index 81a6b669b70ef..e5572609ff8eb 100644 --- a/src/test/run-pass/issues/issue-16671.rs +++ b/src/test/run-pass/issues/issue-16671.rs @@ -1,5 +1,5 @@ // run-pass -//compile-flags: -Z borrowck=compare +// compile-flags: -Z borrowck=compare #![deny(warnings)] diff --git a/src/test/run-pass/issues/issue-16783.rs b/src/test/run-pass/issues/issue-16783.rs index 4af4031d278b8..6075b6336aa0d 100644 --- a/src/test/run-pass/issues/issue-16783.rs +++ b/src/test/run-pass/issues/issue-16783.rs @@ -1,6 +1,6 @@ // run-pass #![allow(unused_variables)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): pub fn main() { let x = [1, 2, 3]; diff --git a/src/test/run-pass/issues/issue-16922.rs b/src/test/run-pass/issues/issue-16922.rs index 82a3943e9efa5..5361d6426f836 100644 --- a/src/test/run-pass/issues/issue-16922.rs +++ b/src/test/run-pass/issues/issue-16922.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): use std::any::Any; diff --git a/src/test/run-pass/issues/issue-17322.rs b/src/test/run-pass/issues/issue-17322.rs index 79b6a5ae5337c..47c648dda464f 100644 --- a/src/test/run-pass/issues/issue-17322.rs +++ b/src/test/run-pass/issues/issue-17322.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![feature(box_syntax)] diff --git a/src/test/run-pass/issues/issue-17351.rs b/src/test/run-pass/issues/issue-17351.rs index f51f0b3ca0171..295e1f167cdb6 100644 --- a/src/test/run-pass/issues/issue-17351.rs +++ b/src/test/run-pass/issues/issue-17351.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): trait Str { fn foo(&self) {} } impl Str for str {} diff --git a/src/test/run-pass/issues/issue-17361.rs b/src/test/run-pass/issues/issue-17361.rs index e97fc3afd1ccc..e16c9e2bfdee4 100644 --- a/src/test/run-pass/issues/issue-17361.rs +++ b/src/test/run-pass/issues/issue-17361.rs @@ -1,7 +1,7 @@ // run-pass // Test that astconv doesn't forget about mutability of &mut str -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): fn main() { fn foo(_: &mut T) {} diff --git a/src/test/run-pass/issues/issue-17718-static-unsafe-interior.rs b/src/test/run-pass/issues/issue-17718-static-unsafe-interior.rs index 65a8713ba056e..010cf9c06acf8 100644 --- a/src/test/run-pass/issues/issue-17718-static-unsafe-interior.rs +++ b/src/test/run-pass/issues/issue-17718-static-unsafe-interior.rs @@ -2,7 +2,7 @@ #![allow(dead_code)] #![allow(unused_variables)] #![allow(unused_imports)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): use std::marker; use std::cell::UnsafeCell; diff --git a/src/test/run-pass/issues/issue-17771.rs b/src/test/run-pass/issues/issue-17771.rs index 7eea5ce6589b5..be3bece7f7a65 100644 --- a/src/test/run-pass/issues/issue-17771.rs +++ b/src/test/run-pass/issues/issue-17771.rs @@ -1,6 +1,6 @@ // run-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): trait Aaa { fn dummy(&self) { } } diff --git a/src/test/run-pass/issues/issue-18110.rs b/src/test/run-pass/issues/issue-18110.rs index 41c29e77da5c5..cf5bed4374f28 100644 --- a/src/test/run-pass/issues/issue-18110.rs +++ b/src/test/run-pass/issues/issue-18110.rs @@ -1,6 +1,6 @@ // run-pass #![allow(unreachable_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): fn main() { ({return},); diff --git a/src/test/run-pass/issues/issue-18232.rs b/src/test/run-pass/issues/issue-18232.rs index 7e6f6ef0f3904..c80c8d99157d9 100644 --- a/src/test/run-pass/issues/issue-18232.rs +++ b/src/test/run-pass/issues/issue-18232.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): struct Cursor<'a>(::std::marker::PhantomData<&'a ()>); diff --git a/src/test/run-pass/issues/issue-18353.rs b/src/test/run-pass/issues/issue-18353.rs index aaa896b66c5d4..11ad052bcc7b7 100644 --- a/src/test/run-pass/issues/issue-18353.rs +++ b/src/test/run-pass/issues/issue-18353.rs @@ -3,7 +3,7 @@ // Test that wrapping an unsized struct in an enum which gets optimised does // not ICE. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): struct Str { f: [u8] diff --git a/src/test/run-pass/issues/issue-18425.rs b/src/test/run-pass/issues/issue-18425.rs index 354c14a756aaf..c940ffade95f1 100644 --- a/src/test/run-pass/issues/issue-18425.rs +++ b/src/test/run-pass/issues/issue-18425.rs @@ -2,7 +2,7 @@ // Check that codegen doesn't ICE when codegenning an array repeat // expression with a count of 1 and a non-Copy element type. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): fn main() { let _ = [Box::new(1_usize); 1]; diff --git a/src/test/run-pass/issues/issue-18501.rs b/src/test/run-pass/issues/issue-18501.rs index 0ca23074c5520..efb5f68e325ec 100644 --- a/src/test/run-pass/issues/issue-18501.rs +++ b/src/test/run-pass/issues/issue-18501.rs @@ -1,10 +1,10 @@ // run-pass // Test that we don't ICE when inlining a function from another // crate that uses a trait method as a value due to incorrectly -// translating the def ID of the trait during AST decoding. +// translating the def-ID of the trait during AST decoding. // aux-build:issue-18501.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate issue_18501 as issue; diff --git a/src/test/run-pass/issues/issue-18539.rs b/src/test/run-pass/issues/issue-18539.rs index 745df26e3209c..3a976653f0e01 100644 --- a/src/test/run-pass/issues/issue-18539.rs +++ b/src/test/run-pass/issues/issue-18539.rs @@ -2,7 +2,7 @@ // Test that coercing bare fn's that return a zero sized type to // a closure doesn't cause an LLVM ERROR -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): struct Foo; diff --git a/src/test/run-pass/issues/issue-18652.rs b/src/test/run-pass/issues/issue-18652.rs index 59aa01568429a..31798a6aadd86 100644 --- a/src/test/run-pass/issues/issue-18652.rs +++ b/src/test/run-pass/issues/issue-18652.rs @@ -1,6 +1,6 @@ // run-pass // Tests multiple free variables being passed by value into an unboxed -// once closure as an optimization by codegen. This used to hit an +// once closure as an optimization by codegen. This used to hit an // incorrect assert. fn main() { diff --git a/src/test/run-pass/issues/issue-18661.rs b/src/test/run-pass/issues/issue-18661.rs index e242724323505..bf3af65b043d1 100644 --- a/src/test/run-pass/issues/issue-18661.rs +++ b/src/test/run-pass/issues/issue-18661.rs @@ -2,7 +2,7 @@ // Test that param substitutions from the correct environment are // used when codegenning unboxed closure calls. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): pub fn inside(c: F) { c(); diff --git a/src/test/run-pass/issues/issue-18685.rs b/src/test/run-pass/issues/issue-18685.rs index bfe24b663f60f..8c898d3427fcc 100644 --- a/src/test/run-pass/issues/issue-18685.rs +++ b/src/test/run-pass/issues/issue-18685.rs @@ -2,7 +2,7 @@ // Test that the self param space is not used in a conflicting // manner by unboxed closures within a default method on a trait -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): trait Tr { fn foo(&self); diff --git a/src/test/run-pass/issues/issue-18711.rs b/src/test/run-pass/issues/issue-18711.rs index 4358418775250..78a6c6c9da31f 100644 --- a/src/test/run-pass/issues/issue-18711.rs +++ b/src/test/run-pass/issues/issue-18711.rs @@ -2,7 +2,7 @@ // Test that we don't panic on a RefCell borrow conflict in certain // code paths involving unboxed closures. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): // aux-build:issue-18711.rs extern crate issue_18711 as issue; diff --git a/src/test/run-pass/issues/issue-19127.rs b/src/test/run-pass/issues/issue-19127.rs index c847ac9e43597..186c9cd80f4e2 100644 --- a/src/test/run-pass/issues/issue-19127.rs +++ b/src/test/run-pass/issues/issue-19127.rs @@ -1,6 +1,6 @@ // run-pass #![allow(unused_variables)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): fn foo T>(f: F) {} fn id<'a>(input: &'a u8) -> &'a u8 { input } diff --git a/src/test/run-pass/issues/issue-19293.rs b/src/test/run-pass/issues/issue-19293.rs index 90f96566f382b..025e73ecfed25 100644 --- a/src/test/run-pass/issues/issue-19293.rs +++ b/src/test/run-pass/issues/issue-19293.rs @@ -1,6 +1,6 @@ // run-pass // aux-build:issue_19293.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate issue_19293; use issue_19293::{Foo, MyEnum}; diff --git a/src/test/run-pass/issues/issue-19340-1.rs b/src/test/run-pass/issues/issue-19340-1.rs index e3cc2daae9b9e..982da3b916333 100644 --- a/src/test/run-pass/issues/issue-19340-1.rs +++ b/src/test/run-pass/issues/issue-19340-1.rs @@ -2,7 +2,7 @@ #![allow(unused_variables)] // aux-build:issue-19340-1.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate issue_19340_1 as lib; diff --git a/src/test/run-pass/issues/issue-19340-2.rs b/src/test/run-pass/issues/issue-19340-2.rs index a222e9e462104..8406a9c174a63 100644 --- a/src/test/run-pass/issues/issue-19340-2.rs +++ b/src/test/run-pass/issues/issue-19340-2.rs @@ -1,6 +1,6 @@ // run-pass #![allow(unused_variables)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): enum Homura { Madoka { diff --git a/src/test/run-pass/issues/issue-19499.rs b/src/test/run-pass/issues/issue-19499.rs index d09056ce3de4f..c2e4f4258938c 100644 --- a/src/test/run-pass/issues/issue-19499.rs +++ b/src/test/run-pass/issues/issue-19499.rs @@ -7,7 +7,7 @@ // reasonable examples) let to ambiguity errors about not being able // to infer sufficient type information. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): fn main() { let n = 0; diff --git a/src/test/run-pass/issues/issue-1974.rs b/src/test/run-pass/issues/issue-1974.rs index 74a54a6029e1c..0e4f19ce4efe6 100644 --- a/src/test/run-pass/issues/issue-1974.rs +++ b/src/test/run-pass/issues/issue-1974.rs @@ -1,7 +1,7 @@ // run-pass -// Issue 1974 +// Issue #1974 // Don't double free the condition allocation -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): pub fn main() { let s = "hej".to_string(); diff --git a/src/test/run-pass/issues/issue-20313.rs b/src/test/run-pass/issues/issue-20313.rs index 09352044b0161..18f25d1b8bc4a 100644 --- a/src/test/run-pass/issues/issue-20313.rs +++ b/src/test/run-pass/issues/issue-20313.rs @@ -1,6 +1,6 @@ // run-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![feature(link_llvm_intrinsics)] diff --git a/src/test/run-pass/issues/issue-20343.rs b/src/test/run-pass/issues/issue-20343.rs index 000b6398442a3..767db511e7ac3 100644 --- a/src/test/run-pass/issues/issue-20343.rs +++ b/src/test/run-pass/issues/issue-20343.rs @@ -2,7 +2,7 @@ #![allow(unused_variables)] // Regression test for Issue #20343. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![deny(dead_code)] diff --git a/src/test/run-pass/issues/issue-20389.rs b/src/test/run-pass/issues/issue-20389.rs index 9c5a1844e293b..23397dea0bbd2 100644 --- a/src/test/run-pass/issues/issue-20389.rs +++ b/src/test/run-pass/issues/issue-20389.rs @@ -2,7 +2,7 @@ #![allow(dead_code)] // aux-build:issue_20389.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate issue_20389; diff --git a/src/test/run-pass/issues/issue-20575.rs b/src/test/run-pass/issues/issue-20575.rs index 95273edcf7e82..5a2ff04688dce 100644 --- a/src/test/run-pass/issues/issue-20575.rs +++ b/src/test/run-pass/issues/issue-20575.rs @@ -1,7 +1,7 @@ // run-pass // Test that overloaded calls work with zero arity closures -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): fn main() { let functions: [Box Option<()>>; 1] = [Box::new(|| None)]; diff --git a/src/test/run-pass/issues/issue-2063.rs b/src/test/run-pass/issues/issue-2063.rs index 9dbac6ccee1d1..96278997cc07e 100644 --- a/src/test/run-pass/issues/issue-2063.rs +++ b/src/test/run-pass/issues/issue-2063.rs @@ -1,6 +1,6 @@ // run-pass // test that autoderef of a type like this does not -// cause compiler to loop. Note that no instances +// cause compiler to loop. Note that no instances // of such a type could ever be constructed. struct T(Box); diff --git a/src/test/run-pass/issues/issue-2074.rs b/src/test/run-pass/issues/issue-2074.rs index bd5f015cca0dc..27dd959fdc28c 100644 --- a/src/test/run-pass/issues/issue-2074.rs +++ b/src/test/run-pass/issues/issue-2074.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/issues/issue-21033.rs b/src/test/run-pass/issues/issue-21033.rs index 86cc7707e50f9..80fa211d69a16 100644 --- a/src/test/run-pass/issues/issue-21033.rs +++ b/src/test/run-pass/issues/issue-21033.rs @@ -1,7 +1,7 @@ // run-pass #![allow(unused_mut)] #![allow(unused_variables)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![feature(box_patterns)] #![feature(box_syntax)] diff --git a/src/test/run-pass/issues/issue-21475.rs b/src/test/run-pass/issues/issue-21475.rs index 16d003aba7cab..191652c5cacad 100644 --- a/src/test/run-pass/issues/issue-21475.rs +++ b/src/test/run-pass/issues/issue-21475.rs @@ -1,6 +1,6 @@ // run-pass #![allow(unused_imports)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): use m::{START, END}; diff --git a/src/test/run-pass/issues/issue-2190-1.rs b/src/test/run-pass/issues/issue-2190-1.rs index 34a80ab00516b..232b59479c5c7 100644 --- a/src/test/run-pass/issues/issue-2190-1.rs +++ b/src/test/run-pass/issues/issue-2190-1.rs @@ -2,7 +2,7 @@ #![allow(unused_must_use)] #![allow(non_upper_case_globals)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): // ignore-emscripten no threads use std::thread::Builder; diff --git a/src/test/run-pass/issues/issue-21909.rs b/src/test/run-pass/issues/issue-21909.rs index 7cb558d9a4fa6..055574beb35da 100644 --- a/src/test/run-pass/issues/issue-21909.rs +++ b/src/test/run-pass/issues/issue-21909.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): trait A { fn dummy(&self, arg: X); diff --git a/src/test/run-pass/issues/issue-22346.rs b/src/test/run-pass/issues/issue-22346.rs index b728911e54170..9c2bc29e0d1e3 100644 --- a/src/test/run-pass/issues/issue-22346.rs +++ b/src/test/run-pass/issues/issue-22346.rs @@ -1,6 +1,6 @@ // run-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): // This used to cause an ICE because the retslot for the "return" had the wrong type fn testcase<'a>() -> Box + 'a> { diff --git a/src/test/run-pass/issues/issue-22426.rs b/src/test/run-pass/issues/issue-22426.rs index adf060a8292be..bbd0776ff72d1 100644 --- a/src/test/run-pass/issues/issue-22426.rs +++ b/src/test/run-pass/issues/issue-22426.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): fn main() { match 42 { diff --git a/src/test/run-pass/issues/issue-22577.rs b/src/test/run-pass/issues/issue-22577.rs index 24f4f60aa2f4e..7fb894c1bcf89 100644 --- a/src/test/run-pass/issues/issue-22577.rs +++ b/src/test/run-pass/issues/issue-22577.rs @@ -1,6 +1,6 @@ // run-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): // ignore-cloudabi no std::fs use std::{fs, net}; diff --git a/src/test/run-pass/issues/issue-22629.rs b/src/test/run-pass/issues/issue-22629.rs index 7beeb126ee45c..09e81506dad33 100644 --- a/src/test/run-pass/issues/issue-22629.rs +++ b/src/test/run-pass/issues/issue-22629.rs @@ -3,7 +3,7 @@ // Test transitive analysis for associated types. Collected types // should be normalized and new obligations generated. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): use std::borrow::{ToOwned, Cow}; diff --git a/src/test/run-pass/issues/issue-22828.rs b/src/test/run-pass/issues/issue-22828.rs index adf4dd6ce75a0..9ec6db3d8937d 100644 --- a/src/test/run-pass/issues/issue-22828.rs +++ b/src/test/run-pass/issues/issue-22828.rs @@ -3,7 +3,7 @@ // Test transitive analysis for associated types. Collected types // should be normalized and new obligations generated. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): trait Foo { type A; diff --git a/src/test/run-pass/issues/issue-2284.rs b/src/test/run-pass/issues/issue-2284.rs index 6f2c958341b5e..8b16a1843ae93 100644 --- a/src/test/run-pass/issues/issue-2284.rs +++ b/src/test/run-pass/issues/issue-2284.rs @@ -1,6 +1,6 @@ // run-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): trait Send { fn f(&self); diff --git a/src/test/run-pass/issues/issue-2316-c.rs b/src/test/run-pass/issues/issue-2316-c.rs index 6783f3fcfc691..fdb2192837cfa 100644 --- a/src/test/run-pass/issues/issue-2316-c.rs +++ b/src/test/run-pass/issues/issue-2316-c.rs @@ -2,7 +2,7 @@ // aux-build:issue_2316_a.rs // aux-build:issue_2316_b.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate issue_2316_b; use issue_2316_b::cloth; diff --git a/src/test/run-pass/issues/issue-23485.rs b/src/test/run-pass/issues/issue-23485.rs index a55846f40dfbd..26544bfc5b9af 100644 --- a/src/test/run-pass/issues/issue-23485.rs +++ b/src/test/run-pass/issues/issue-23485.rs @@ -45,6 +45,6 @@ impl Iterator for Counter { } fn main() { - let mut x: Box> = Box::new(Counter { value: 22 }); + let mut x: Box> = Box::new(Counter { value: 22 }); assert_eq!(x.next().unwrap().value, 22); } diff --git a/src/test/run-pass/issues/issue-23611-enum-swap-in-drop.rs b/src/test/run-pass/issues/issue-23611-enum-swap-in-drop.rs index 6ef7fd42ec6d0..bc8d8b50744f4 100644 --- a/src/test/run-pass/issues/issue-23611-enum-swap-in-drop.rs +++ b/src/test/run-pass/issues/issue-23611-enum-swap-in-drop.rs @@ -1,7 +1,7 @@ // run-pass #![allow(non_upper_case_globals)] -// Issue 23611: this test is ensuring that, for an instance `X` of the +// Issue #23611: this test is ensuring that, for an instance `X` of the // enum `E`, if you swap in a different variant during the execution // of the `::drop`, then the appropriate substructure will // be torn down after the `::drop` method returns. diff --git a/src/test/run-pass/issues/issue-2380-b.rs b/src/test/run-pass/issues/issue-2380-b.rs index d708c7b4213b2..d41b44065b690 100644 --- a/src/test/run-pass/issues/issue-2380-b.rs +++ b/src/test/run-pass/issues/issue-2380-b.rs @@ -1,7 +1,7 @@ // run-pass // aux-build:issue-2380.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate a; diff --git a/src/test/run-pass/issues/issue-2383.rs b/src/test/run-pass/issues/issue-2383.rs index 06e61ce680b38..0fe921f3e3466 100644 --- a/src/test/run-pass/issues/issue-2383.rs +++ b/src/test/run-pass/issues/issue-2383.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): use std::collections::VecDeque; diff --git a/src/test/run-pass/issues/issue-2414-c.rs b/src/test/run-pass/issues/issue-2414-c.rs index f6fe9798067a8..07c1e9f41b8d0 100644 --- a/src/test/run-pass/issues/issue-2414-c.rs +++ b/src/test/run-pass/issues/issue-2414-c.rs @@ -2,7 +2,7 @@ // aux-build:issue-2414-a.rs // aux-build:issue-2414-b.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate b; diff --git a/src/test/run-pass/issues/issue-2445-b.rs b/src/test/run-pass/issues/issue-2445-b.rs index f369eae3af348..cccf4ebb85425 100644 --- a/src/test/run-pass/issues/issue-2445-b.rs +++ b/src/test/run-pass/issues/issue-2445-b.rs @@ -2,7 +2,7 @@ #![allow(dead_code)] #![allow(non_camel_case_types)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): struct c1 { x: T, diff --git a/src/test/run-pass/issues/issue-2445.rs b/src/test/run-pass/issues/issue-2445.rs index 5730ce165748e..1fe2196061f59 100644 --- a/src/test/run-pass/issues/issue-2445.rs +++ b/src/test/run-pass/issues/issue-2445.rs @@ -2,7 +2,7 @@ #![allow(dead_code)] #![allow(non_camel_case_types)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): struct c1 { x: T, diff --git a/src/test/run-pass/issues/issue-24535-allow-mutable-borrow-in-match-guard.rs b/src/test/run-pass/issues/issue-24535-allow-mutable-borrow-in-match-guard.rs index 68f7dfd38f4f4..4e242c59e089c 100644 --- a/src/test/run-pass/issues/issue-24535-allow-mutable-borrow-in-match-guard.rs +++ b/src/test/run-pass/issues/issue-24535-allow-mutable-borrow-in-match-guard.rs @@ -38,7 +38,7 @@ fn rfcs_issue_1006_1() { fn rfcs_issue_1006_2() { #[inline(always)] - fn check<'a, I: Iterator>(mut i: I) -> bool { + fn check<'a, I: Iterator>(mut i: I) -> bool { i.any(|&x| x == 2) } diff --git a/src/test/run-pass/issues/issue-2463.rs b/src/test/run-pass/issues/issue-2463.rs index d24a47c53d9ee..d7040241e8517 100644 --- a/src/test/run-pass/issues/issue-2463.rs +++ b/src/test/run-pass/issues/issue-2463.rs @@ -1,6 +1,6 @@ // run-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): struct Pair { f: isize, g: isize } diff --git a/src/test/run-pass/issues/issue-2472.rs b/src/test/run-pass/issues/issue-2472.rs index cadd0151b4e81..d802fddde5fdf 100644 --- a/src/test/run-pass/issues/issue-2472.rs +++ b/src/test/run-pass/issues/issue-2472.rs @@ -1,7 +1,7 @@ // run-pass // aux-build:issue_2472_b.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate issue_2472_b; diff --git a/src/test/run-pass/issues/issue-24805-dropck-itemless.rs b/src/test/run-pass/issues/issue-24805-dropck-itemless.rs index db427ed3d3194..77e2bd2d61748 100644 --- a/src/test/run-pass/issues/issue-24805-dropck-itemless.rs +++ b/src/test/run-pass/issues/issue-24805-dropck-itemless.rs @@ -55,7 +55,7 @@ fn f_send() { body!(D_Send) } fn f_sized() { body!(D_Sized) } fn f_sync() { body!(D_Sync) } -// Issue 24895: Copy: Clone implies `impl Drop for ...` can +// Issue #24895: Copy: Clone implies `impl Drop for ...` can // access a user-defined clone() method, which causes this test case // to fail. // diff --git a/src/test/run-pass/issues/issue-2526-a.rs b/src/test/run-pass/issues/issue-2526-a.rs index f3fdc0bd377f3..75c40e5799274 100644 --- a/src/test/run-pass/issues/issue-2526-a.rs +++ b/src/test/run-pass/issues/issue-2526-a.rs @@ -1,7 +1,7 @@ // run-pass // aux-build:issue-2526.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![allow(unused_imports)] diff --git a/src/test/run-pass/issues/issue-25339.rs b/src/test/run-pass/issues/issue-25339.rs index 602f458e4cf54..3deaa19bb3282 100644 --- a/src/test/run-pass/issues/issue-25339.rs +++ b/src/test/run-pass/issues/issue-25339.rs @@ -22,7 +22,7 @@ pub struct Mount> { } impl> Mount { - pub fn create>(mount: &str, input: T) { + pub fn create>(mount: &str, input: T) { input.to_routing(); } } diff --git a/src/test/run-pass/issues/issue-25343.rs b/src/test/run-pass/issues/issue-25343.rs index 95a0bd9155d96..0addc81e5db53 100644 --- a/src/test/run-pass/issues/issue-25343.rs +++ b/src/test/run-pass/issues/issue-25343.rs @@ -6,7 +6,7 @@ fn main() { } }; - // More cases added from issue 31754 + // More cases added from issue #31754 'label2: loop { break; diff --git a/src/test/run-pass/issues/issue-2550.rs b/src/test/run-pass/issues/issue-2550.rs index 04ec66b80d7bb..0826d9a913750 100644 --- a/src/test/run-pass/issues/issue-2550.rs +++ b/src/test/run-pass/issues/issue-2550.rs @@ -2,7 +2,7 @@ #![allow(dead_code)] #![allow(non_snake_case)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): struct C { x: usize, diff --git a/src/test/run-pass/issues/issue-25700-1.rs b/src/test/run-pass/issues/issue-25700-1.rs index 7bc9673a5be36..e6fbeb4c87d35 100644 --- a/src/test/run-pass/issues/issue-25700-1.rs +++ b/src/test/run-pass/issues/issue-25700-1.rs @@ -4,8 +4,8 @@ struct S(Option<&'static T>); trait Tr { type Out; } impl Tr for T { type Out = T; } -impl Copy for S where S: Tr {} -impl Clone for S where S: Tr { +impl Copy for S where S: Tr {} +impl Clone for S where S: Tr { fn clone(&self) -> Self { *self } } fn main() { diff --git a/src/test/run-pass/issues/issue-2633-2.rs b/src/test/run-pass/issues/issue-2633-2.rs index 02c1a166301eb..47ac56beb31b4 100644 --- a/src/test/run-pass/issues/issue-2633-2.rs +++ b/src/test/run-pass/issues/issue-2633-2.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![feature(box_syntax)] diff --git a/src/test/run-pass/issues/issue-2642.rs b/src/test/run-pass/issues/issue-2642.rs index 95c5632258eaa..ea02eb66516a4 100644 --- a/src/test/run-pass/issues/issue-2642.rs +++ b/src/test/run-pass/issues/issue-2642.rs @@ -1,6 +1,6 @@ // run-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): fn f() { let _x: usize = loop { loop { break; } }; diff --git a/src/test/run-pass/issues/issue-26905.rs b/src/test/run-pass/issues/issue-26905.rs index 309e2f7e5719b..7c01302db73c6 100644 --- a/src/test/run-pass/issues/issue-26905.rs +++ b/src/test/run-pass/issues/issue-26905.rs @@ -17,6 +17,6 @@ fn main() { let data = [1, 2, 3]; let iter = data.iter(); let x = MyRc { _ptr: &iter, _boo: PhantomData }; - let _y: MyRc> = x; + let _y: MyRc> = x; } diff --git a/src/test/run-pass/issues/issue-2708.rs b/src/test/run-pass/issues/issue-2708.rs index abd5e9507f8ee..fa75f2ea6e994 100644 --- a/src/test/run-pass/issues/issue-2708.rs +++ b/src/test/run-pass/issues/issue-2708.rs @@ -2,7 +2,7 @@ #![allow(dead_code)] #![allow(non_snake_case)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![feature(box_syntax)] diff --git a/src/test/run-pass/issues/issue-2734.rs b/src/test/run-pass/issues/issue-2734.rs index fcb224e2d043d..63ab7df72bed4 100644 --- a/src/test/run-pass/issues/issue-2734.rs +++ b/src/test/run-pass/issues/issue-2734.rs @@ -2,7 +2,7 @@ #![allow(dead_code)] #![allow(non_camel_case_types)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![feature(box_syntax)] diff --git a/src/test/run-pass/issues/issue-2735.rs b/src/test/run-pass/issues/issue-2735.rs index c48bedf14f7b7..35fd618d02679 100644 --- a/src/test/run-pass/issues/issue-2735.rs +++ b/src/test/run-pass/issues/issue-2735.rs @@ -2,7 +2,7 @@ #![allow(dead_code)] #![allow(non_camel_case_types)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![feature(box_syntax)] diff --git a/src/test/run-pass/issues/issue-27859.rs b/src/test/run-pass/issues/issue-27859.rs index 259d706fa2a17..c310bc000815f 100644 --- a/src/test/run-pass/issues/issue-27859.rs +++ b/src/test/run-pass/issues/issue-27859.rs @@ -1,6 +1,6 @@ // run-pass // ignore-cloudabi no std::env -// ignore-wasm32 issue 42629 +// ignore-wasm32 issue #42629 #[inline(never)] fn foo(a: f32, b: f32) -> f32 { diff --git a/src/test/run-pass/issues/issue-2935.rs b/src/test/run-pass/issues/issue-2935.rs index 58ade32b2502c..c76875791cd08 100644 --- a/src/test/run-pass/issues/issue-2935.rs +++ b/src/test/run-pass/issues/issue-2935.rs @@ -3,7 +3,7 @@ #![allow(non_camel_case_types)] #![feature(box_syntax)] -//type t = { a: isize }; +// type t = { a: isize }; // type t = { a: bool }; type t = bool; diff --git a/src/test/run-pass/issues/issue-3012-2.rs b/src/test/run-pass/issues/issue-3012-2.rs index 7d32c51f5699c..a6c044a3381f1 100644 --- a/src/test/run-pass/issues/issue-3012-2.rs +++ b/src/test/run-pass/issues/issue-3012-2.rs @@ -1,7 +1,7 @@ // run-pass // aux-build:issue-3012-1.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate socketlib; diff --git a/src/test/run-pass/issues/issue-3026.rs b/src/test/run-pass/issues/issue-3026.rs index 1dea8134fba2f..100e38bda056d 100644 --- a/src/test/run-pass/issues/issue-3026.rs +++ b/src/test/run-pass/issues/issue-3026.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![feature(box_syntax)] diff --git a/src/test/run-pass/issues/issue-3037.rs b/src/test/run-pass/issues/issue-3037.rs index ff4d32c284073..9adf03f712c2a 100644 --- a/src/test/run-pass/issues/issue-3037.rs +++ b/src/test/run-pass/issues/issue-3037.rs @@ -1,6 +1,6 @@ // run-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![allow(non_camel_case_types)] enum what { } diff --git a/src/test/run-pass/issues/issue-3052.rs b/src/test/run-pass/issues/issue-3052.rs index 927102981e7f9..dd8410c2a9001 100644 --- a/src/test/run-pass/issues/issue-3052.rs +++ b/src/test/run-pass/issues/issue-3052.rs @@ -1,6 +1,6 @@ // run-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): type Connection = Box) + 'static>; diff --git a/src/test/run-pass/issues/issue-3220.rs b/src/test/run-pass/issues/issue-3220.rs index 7dc672edb54bb..ba136fd1ea9f6 100644 --- a/src/test/run-pass/issues/issue-3220.rs +++ b/src/test/run-pass/issues/issue-3220.rs @@ -1,7 +1,7 @@ // run-pass #![allow(dead_code)] #![allow(non_camel_case_types)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): struct thing { x: isize, } diff --git a/src/test/run-pass/issues/issue-3429.rs b/src/test/run-pass/issues/issue-3429.rs index 9d94c3ff61c48..0df1054d3afa2 100644 --- a/src/test/run-pass/issues/issue-3429.rs +++ b/src/test/run-pass/issues/issue-3429.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): pub fn main() { let x = 1_usize; diff --git a/src/test/run-pass/issues/issue-34569.rs b/src/test/run-pass/issues/issue-34569.rs index 1f68560509e8c..73876ce935706 100644 --- a/src/test/run-pass/issues/issue-34569.rs +++ b/src/test/run-pass/issues/issue-34569.rs @@ -5,8 +5,6 @@ // a debuginfo verification assertion during compilation. This was caused by the // closure in the guard being codegened twice due to how match expressions are // handled. -// -// See https://github.com/rust-lang/rust/issues/34569 for details. fn main() { match 0 { diff --git a/src/test/run-pass/issues/issue-3500.rs b/src/test/run-pass/issues/issue-3500.rs index 7b39cc16cab4a..33aa79e990166 100644 --- a/src/test/run-pass/issues/issue-3500.rs +++ b/src/test/run-pass/issues/issue-3500.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): pub fn main() { let x = &Some(1); diff --git a/src/test/run-pass/issues/issue-3563-3.rs b/src/test/run-pass/issues/issue-3563-3.rs index bedfdab97d58b..afed22b1187ff 100644 --- a/src/test/run-pass/issues/issue-3563-3.rs +++ b/src/test/run-pass/issues/issue-3563-3.rs @@ -2,12 +2,12 @@ #![allow(unused_imports)] #![allow(non_snake_case)] -// ASCII art shape renderer. Demonstrates traits, impls, operator overloading, -// non-copyable struct, unit testing. To run execute: rustc --test shapes.rs && +// ASCII art shape renderer. Demonstrates traits, impls, operator overloading, +// non-copyable struct, unit testing. To run execute: rustc --test shapes.rs && // ./shapes // Rust's std library is tightly bound to the language itself so it is -// automatically linked in. However the extra library is designed to be +// automatically linked in. However the extra library is designed to be // optional (for code that must run on constrained environments like embedded // devices or special environments like kernel code) so it must be explicitly // linked in. @@ -99,7 +99,7 @@ impl fmt::Display for AsciiArt { .map(|line| line.iter().cloned().collect()) .collect::>(); - // Concatenate the lines together using a new-line. + // Concatenate the lines together using a newline. write!(f, "{}", lines.join("\n")) } } diff --git a/src/test/run-pass/issues/issue-36036-associated-type-layout.rs b/src/test/run-pass/issues/issue-36036-associated-type-layout.rs index 022f9a5d556f1..28d800590c9a9 100644 --- a/src/test/run-pass/issues/issue-36036-associated-type-layout.rs +++ b/src/test/run-pass/issues/issue-36036-associated-type-layout.rs @@ -1,5 +1,5 @@ // run-pass -// Issue 36036: computing the layout of a type composed from another +// Issue #36036: computing the layout of a type composed from another // trait's associated type caused compiler to ICE when the associated // type was allowed to be unsized, even though the known instantiated // type is itself sized. diff --git a/src/test/run-pass/issues/issue-36278-prefix-nesting.rs b/src/test/run-pass/issues/issue-36278-prefix-nesting.rs index 62d1f5f825886..7fd48bb652074 100644 --- a/src/test/run-pass/issues/issue-36278-prefix-nesting.rs +++ b/src/test/run-pass/issues/issue-36278-prefix-nesting.rs @@ -1,5 +1,5 @@ // run-pass -// Issue 36278: On an unsized struct with >1 level of nontrivial +// Issue #36278: On an unsized struct with >1 level of nontrivial // nesting, ensure we are computing dynamic size of prefix correctly. use std::mem; diff --git a/src/test/run-pass/issues/issue-3656.rs b/src/test/run-pass/issues/issue-3656.rs index d55a22a72b6ff..27b1115ad2434 100644 --- a/src/test/run-pass/issues/issue-3656.rs +++ b/src/test/run-pass/issues/issue-3656.rs @@ -6,7 +6,7 @@ // Incorrect struct size computation in the FFI, because of not taking // the alignment of elements into account. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): // ignore-wasm32-bare no libc to test with #![feature(rustc_private)] diff --git a/src/test/run-pass/issues/issue-3743.rs b/src/test/run-pass/issues/issue-3743.rs index 07741914f802c..5e6e63f1a01ac 100644 --- a/src/test/run-pass/issues/issue-3743.rs +++ b/src/test/run-pass/issues/issue-3743.rs @@ -26,7 +26,7 @@ trait RhsOfVec2Mul { } // Vec2's implementation of Mul "from the other side" using the above trait -impl> Mul for Vec2 { +impl> Mul for Vec2 { type Output = Res; fn mul(self, rhs: Rhs) -> Res { rhs.mul_vec2_by(&self) } diff --git a/src/test/run-pass/issues/issue-38033.rs b/src/test/run-pass/issues/issue-38033.rs index 16b867ec88f17..707de03100817 100644 --- a/src/test/run-pass/issues/issue-38033.rs +++ b/src/test/run-pass/issues/issue-38033.rs @@ -15,7 +15,7 @@ trait Future { } trait IntoFuture { - type Future: Future; + type Future: Future; type Item; type Error; diff --git a/src/test/run-pass/issues/issue-3878.rs b/src/test/run-pass/issues/issue-3878.rs index a121f0ba878ef..ba5cc98f0ea7b 100644 --- a/src/test/run-pass/issues/issue-3878.rs +++ b/src/test/run-pass/issues/issue-3878.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![allow(path_statements)] #![feature(box_syntax)] diff --git a/src/test/run-pass/issues/issue-38942.rs b/src/test/run-pass/issues/issue-38942.rs index 308bdd6e28cc4..f1859efd06523 100644 --- a/src/test/run-pass/issues/issue-38942.rs +++ b/src/test/run-pass/issues/issue-38942.rs @@ -1,5 +1,4 @@ // run-pass -// See https://github.com/rust-lang/rust/issues/38942 #[repr(u64)] pub enum NSEventType { diff --git a/src/test/run-pass/issues/issue-3979-generics.rs b/src/test/run-pass/issues/issue-3979-generics.rs index 519de1cad6ef9..8be103646de96 100644 --- a/src/test/run-pass/issues/issue-3979-generics.rs +++ b/src/test/run-pass/issues/issue-3979-generics.rs @@ -9,7 +9,7 @@ trait Positioned { fn X(&self) -> S; } -trait Movable>: Positioned { +trait Movable>: Positioned { fn translate(&mut self, dx: S) { let x = self.X() + dx; self.SetX(x); diff --git a/src/test/run-pass/issues/issue-40003.rs b/src/test/run-pass/issues/issue-40003.rs index 642de6b8fe352..24cf70bbe258c 100644 --- a/src/test/run-pass/issues/issue-40003.rs +++ b/src/test/run-pass/issues/issue-40003.rs @@ -31,7 +31,7 @@ mod future { } fn flatten_stream(self) -> FlattenStream - where ::Item: stream::Stream, + where ::Item: stream::Stream, Self: Sized { panic!() @@ -39,7 +39,7 @@ mod future { } pub trait IntoFuture { - type Future: Future; + type Future: Future; type Item; type Error; fn into_future(self) -> Self::Future; @@ -83,7 +83,7 @@ mod future { impl Stream for FlattenStream where F: Future, - ::Item: Stream, + ::Item: Stream, { type Item = ::Item; type Error = ::Error; @@ -125,13 +125,13 @@ mod stream { } pub fn iter(_: J) -> IterStream - where J: IntoIterator>, + where J: IntoIterator>, { panic!() } impl Stream for IterStream - where I: Iterator>, + where I: Iterator>, { type Item = T; type Error = E; diff --git a/src/test/run-pass/issues/issue-41677.rs b/src/test/run-pass/issues/issue-41677.rs index afddbc799b773..5d4e979bc83da 100644 --- a/src/test/run-pass/issues/issue-41677.rs +++ b/src/test/run-pass/issues/issue-41677.rs @@ -17,7 +17,7 @@ impl Handle for ResizingHandle { type Inner = H; } -struct Receiver>(PhantomData); +struct Receiver>(PhantomData); fn channel(size: usize) -> Receiver> { let rx = Receiver(PhantomData); diff --git a/src/test/run-pass/issues/issue-4208.rs b/src/test/run-pass/issues/issue-4208.rs index 3b01811a9e80e..cfd1bd96b521e 100644 --- a/src/test/run-pass/issues/issue-4208.rs +++ b/src/test/run-pass/issues/issue-4208.rs @@ -2,7 +2,7 @@ #![allow(dead_code)] // aux-build:issue-4208-cc.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate numeric; use numeric::{sin, Angle}; diff --git a/src/test/run-pass/issues/issue-4228.rs b/src/test/run-pass/issues/issue-4228.rs index 491000b6510a8..fba368b93f76f 100644 --- a/src/test/run-pass/issues/issue-4228.rs +++ b/src/test/run-pass/issues/issue-4228.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): struct Foo; diff --git a/src/test/run-pass/issues/issue-4333.rs b/src/test/run-pass/issues/issue-4333.rs index ae9f4c8bdb523..b80bab0df7ace 100644 --- a/src/test/run-pass/issues/issue-4333.rs +++ b/src/test/run-pass/issues/issue-4333.rs @@ -1,6 +1,6 @@ // run-pass #![allow(unused_must_use)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): use std::io; diff --git a/src/test/run-pass/issues/issue-4387.rs b/src/test/run-pass/issues/issue-4387.rs index 84592f16a4ca9..c2a9d10e2e555 100644 --- a/src/test/run-pass/issues/issue-4387.rs +++ b/src/test/run-pass/issues/issue-4387.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): pub fn main() { let _foo = [0; 2*4]; diff --git a/src/test/run-pass/issues/issue-4542.rs b/src/test/run-pass/issues/issue-4542.rs index 24752114e9f5c..5f55a3e6b75f3 100644 --- a/src/test/run-pass/issues/issue-4542.rs +++ b/src/test/run-pass/issues/issue-4542.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): // ignore-cloudabi no std::env use std::env; diff --git a/src/test/run-pass/issues/issue-4545.rs b/src/test/run-pass/issues/issue-4545.rs index 86fcf9af21fc5..73e032a538b56 100644 --- a/src/test/run-pass/issues/issue-4545.rs +++ b/src/test/run-pass/issues/issue-4545.rs @@ -1,7 +1,7 @@ // run-pass // aux-build:issue-4545.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate issue_4545 as somelib; pub fn main() { somelib::mk::(); } diff --git a/src/test/run-pass/issues/issue-46095.rs b/src/test/run-pass/issues/issue-46095.rs index 59ddb60c9f239..b246192bb7ba1 100644 --- a/src/test/run-pass/issues/issue-46095.rs +++ b/src/test/run-pass/issues/issue-46095.rs @@ -9,7 +9,7 @@ fn identity(t: T) -> T { t } -// Issue 46095 +// Issue #46095 // Built-in indexing should be used even when the index is not // trivially an integer // Overloaded indexing would cause wrapped to be borrowed mutably diff --git a/src/test/run-pass/issues/issue-4735.rs b/src/test/run-pass/issues/issue-4735.rs index 3ea4b01cd2bbe..389823ec703a7 100644 --- a/src/test/run-pass/issues/issue-4735.rs +++ b/src/test/run-pass/issues/issue-4735.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): use std::mem::transmute; diff --git a/src/test/run-pass/issues/issue-4759.rs b/src/test/run-pass/issues/issue-4759.rs index 53785af09626a..fef9d8af26e95 100644 --- a/src/test/run-pass/issues/issue-4759.rs +++ b/src/test/run-pass/issues/issue-4759.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![allow(non_shorthand_field_patterns)] #![feature(box_syntax)] diff --git a/src/test/run-pass/issues/issue-4875.rs b/src/test/run-pass/issues/issue-4875.rs index 8d361314f73a0..88541dda81af0 100644 --- a/src/test/run-pass/issues/issue-4875.rs +++ b/src/test/run-pass/issues/issue-4875.rs @@ -1,8 +1,8 @@ // run-pass #![allow(dead_code)] -// regression test for issue 4875 +// regression test for issue #4875 -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): pub struct Foo { data: T, diff --git a/src/test/run-pass/issues/issue-5192.rs b/src/test/run-pass/issues/issue-5192.rs index 74d8d861a7d05..dd2bf1f43d671 100644 --- a/src/test/run-pass/issues/issue-5192.rs +++ b/src/test/run-pass/issues/issue-5192.rs @@ -1,6 +1,6 @@ // run-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![feature(box_syntax)] diff --git a/src/test/run-pass/issues/issue-5243.rs b/src/test/run-pass/issues/issue-5243.rs index c511d45f02de4..cf5af4835f9b0 100644 --- a/src/test/run-pass/issues/issue-5243.rs +++ b/src/test/run-pass/issues/issue-5243.rs @@ -4,7 +4,7 @@ // enough for codegen to consider this as non-monomorphic, // which led to various assertions and failures in turn. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): struct S<'a> { v: &'a isize diff --git a/src/test/run-pass/issues/issue-5315.rs b/src/test/run-pass/issues/issue-5315.rs index 38c98254b9350..19014312bd7ad 100644 --- a/src/test/run-pass/issues/issue-5315.rs +++ b/src/test/run-pass/issues/issue-5315.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): struct A(bool); diff --git a/src/test/run-pass/issues/issue-5518.rs b/src/test/run-pass/issues/issue-5518.rs index 97ed9ef309d5a..141e50aa1ecf8 100644 --- a/src/test/run-pass/issues/issue-5518.rs +++ b/src/test/run-pass/issues/issue-5518.rs @@ -1,7 +1,7 @@ // run-pass // aux-build:issue-5518.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate issue_5518 as other; diff --git a/src/test/run-pass/issues/issue-5550.rs b/src/test/run-pass/issues/issue-5550.rs index 6ea24747b3965..6fcdf8b6ae2ba 100644 --- a/src/test/run-pass/issues/issue-5550.rs +++ b/src/test/run-pass/issues/issue-5550.rs @@ -1,6 +1,6 @@ // run-pass #![allow(unused_assignments)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): pub fn main() { let s: String = "foobar".to_string(); diff --git a/src/test/run-pass/issues/issue-5554.rs b/src/test/run-pass/issues/issue-5554.rs index 7737536f43dfe..fa88ddf5bdcee 100644 --- a/src/test/run-pass/issues/issue-5554.rs +++ b/src/test/run-pass/issues/issue-5554.rs @@ -1,6 +1,6 @@ // run-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): use std::default::Default; diff --git a/src/test/run-pass/issues/issue-5688.rs b/src/test/run-pass/issues/issue-5688.rs index b6e364c2f4095..eb0d12f849f4d 100644 --- a/src/test/run-pass/issues/issue-5688.rs +++ b/src/test/run-pass/issues/issue-5688.rs @@ -1,12 +1,11 @@ // run-pass -/* -# Corrupted initialization in the static struct -...should print &[1, 2, 3] but instead prints something like -&[4492532864, 24]. It is pretty evident that the compiler messed up -with the representation of [isize; n] and [isize] somehow, or at least -failed to typecheck correctly. -*/ +// Corrupted initialization in the static struct. +// +// This hould print `&[1, 2, 3]` but instead prints something like +// `&[4492532864, 24]`. It is pretty evident that the compiler messed up +// with the representation of `[isize; n]` and `[isize]` somehow, or at least +// failed to type-check correctly. #[derive(Copy, Clone)] struct X { vec: &'static [isize] } diff --git a/src/test/run-pass/issues/issue-5718.rs b/src/test/run-pass/issues/issue-5718.rs index 63efec953118a..66c20c55b5d5d 100644 --- a/src/test/run-pass/issues/issue-5718.rs +++ b/src/test/run-pass/issues/issue-5718.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![feature(box_syntax)] diff --git a/src/test/run-pass/issues/issue-5741.rs b/src/test/run-pass/issues/issue-5741.rs index b9eaf0be7fb3a..65a82e1cef94b 100644 --- a/src/test/run-pass/issues/issue-5741.rs +++ b/src/test/run-pass/issues/issue-5741.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![allow(while_true)] #![allow(unreachable_code)] diff --git a/src/test/run-pass/issues/issue-5791.rs b/src/test/run-pass/issues/issue-5791.rs index 2f8bf1e936905..48a4857a344d0 100644 --- a/src/test/run-pass/issues/issue-5791.rs +++ b/src/test/run-pass/issues/issue-5791.rs @@ -1,6 +1,6 @@ // run-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern { #[link_name = "malloc"] diff --git a/src/test/run-pass/issues/issue-5988.rs b/src/test/run-pass/issues/issue-5988.rs index db77ca4375fc3..7a743be37f37e 100644 --- a/src/test/run-pass/issues/issue-5988.rs +++ b/src/test/run-pass/issues/issue-5988.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): trait B { fn f(&self); diff --git a/src/test/run-pass/issues/issue-6117.rs b/src/test/run-pass/issues/issue-6117.rs index 5235d53d84a14..c6d64ab665b68 100644 --- a/src/test/run-pass/issues/issue-6117.rs +++ b/src/test/run-pass/issues/issue-6117.rs @@ -1,6 +1,6 @@ // run-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): enum Either { Left(T), Right(U) } diff --git a/src/test/run-pass/issues/issue-6157.rs b/src/test/run-pass/issues/issue-6157.rs index 354797cb2a784..7c3f683495709 100644 --- a/src/test/run-pass/issues/issue-6157.rs +++ b/src/test/run-pass/issues/issue-6157.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): pub trait OpInt { fn call(&mut self, _: isize, _: isize) -> isize; } diff --git a/src/test/run-pass/issues/issue-6318.rs b/src/test/run-pass/issues/issue-6318.rs index d416048265fa5..b535338f72df8 100644 --- a/src/test/run-pass/issues/issue-6318.rs +++ b/src/test/run-pass/issues/issue-6318.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![feature(box_syntax)] diff --git a/src/test/run-pass/issues/issue-6919.rs b/src/test/run-pass/issues/issue-6919.rs index 11aed12087313..7ece78912ee90 100644 --- a/src/test/run-pass/issues/issue-6919.rs +++ b/src/test/run-pass/issues/issue-6919.rs @@ -2,7 +2,7 @@ #![allow(unused_attributes)] // aux-build:iss.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![crate_id="issue-6919"] extern crate issue6919_3; diff --git a/src/test/run-pass/issues/issue-7012.rs b/src/test/run-pass/issues/issue-7012.rs index a1c4bf83beb34..6bb74025f3468 100644 --- a/src/test/run-pass/issues/issue-7012.rs +++ b/src/test/run-pass/issues/issue-7012.rs @@ -5,18 +5,18 @@ /* # Comparison of static arrays -The expected behaviour would be that test==test1, therefore 'true' +The expected behaviour would be that `test == test1`, therefore 'true' would be printed, however the below prints false. */ struct signature<'a> { pattern : &'a [u32] } static test1: signature<'static> = signature { - pattern: &[0x243f6a88,0x85a308d3,0x13198a2e,0x03707344,0xa4093822,0x299f31d0] + pattern: &[0x243f6a88, 0x85a308d3, 0x13198a2e, 0x03707344, 0xa4093822, 0x299f31d0] }; pub fn main() { - let test: &[u32] = &[0x243f6a88,0x85a308d3,0x13198a2e, - 0x03707344,0xa4093822,0x299f31d0]; - println!("{}",test==test1.pattern); + let test: &[u32] = &[0x243f6a88, 0x85a308d3, 0x13198a2e, + 0x03707344, 0xa4093822, 0x299f31d0]; + println!("{}",test == test1.pattern); } diff --git a/src/test/run-pass/issues/issue-7178.rs b/src/test/run-pass/issues/issue-7178.rs index 30aa736cdc619..650621e323807 100644 --- a/src/test/run-pass/issues/issue-7178.rs +++ b/src/test/run-pass/issues/issue-7178.rs @@ -1,7 +1,7 @@ // run-pass // aux-build:issue-7178.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate issue_7178 as cross_crate_self; diff --git a/src/test/run-pass/issues/issue-7222.rs b/src/test/run-pass/issues/issue-7222.rs index 6490731662664..bfe2a5e764fcd 100644 --- a/src/test/run-pass/issues/issue-7222.rs +++ b/src/test/run-pass/issues/issue-7222.rs @@ -1,6 +1,6 @@ // run-pass -// pretty-expanded FIXME #23616 -#![allow(illegal_floating_point_literal_pattern)] // FIXME #41620 +// pretty-expanded FIXME(#23616): +#![allow(illegal_floating_point_literal_pattern)] // FIXME(#41620): pub fn main() { const FOO: f64 = 10.0; diff --git a/src/test/run-pass/issues/issue-7344.rs b/src/test/run-pass/issues/issue-7344.rs index f1727d0c1aef1..f0100affd6085 100644 --- a/src/test/run-pass/issues/issue-7344.rs +++ b/src/test/run-pass/issues/issue-7344.rs @@ -1,6 +1,6 @@ // run-pass #![allow(unused_must_use)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![allow(unreachable_code)] diff --git a/src/test/run-pass/issues/issue-7519-match-unit-in-arg.rs b/src/test/run-pass/issues/issue-7519-match-unit-in-arg.rs index 7d838cbb09b76..800be8c9e6777 100644 --- a/src/test/run-pass/issues/issue-7519-match-unit-in-arg.rs +++ b/src/test/run-pass/issues/issue-7519-match-unit-in-arg.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): /* #7519 ICE pattern matching unit in function argument diff --git a/src/test/run-pass/issues/issue-7660.rs b/src/test/run-pass/issues/issue-7660.rs index ad0b8ecff39e9..3ee90e5930bfa 100644 --- a/src/test/run-pass/issues/issue-7660.rs +++ b/src/test/run-pass/issues/issue-7660.rs @@ -1,9 +1,9 @@ // run-pass #![allow(unused_variables)] -// Regression test for issue 7660 +// Regression test for issue #7660 // rvalue lifetime too short when equivalent `match` works -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): use std::collections::HashMap; diff --git a/src/test/run-pass/issues/issue-7784.rs b/src/test/run-pass/issues/issue-7784.rs index b75e547079ef5..7fcf31fb07efa 100644 --- a/src/test/run-pass/issues/issue-7784.rs +++ b/src/test/run-pass/issues/issue-7784.rs @@ -3,7 +3,7 @@ use std::ops::Add; -fn foo + Clone>([x, y, z]: [T; 3]) -> (T, T, T) { +fn foo + Clone>([x, y, z]: [T; 3]) -> (T, T, T) { (x.clone(), x.clone() + y.clone(), x + y + z) } fn bar(a: &'static str, b: &'static str) -> [&'static str; 4] { diff --git a/src/test/run-pass/issues/issue-7899.rs b/src/test/run-pass/issues/issue-7899.rs index fb631f83697ed..503d3e9461596 100644 --- a/src/test/run-pass/issues/issue-7899.rs +++ b/src/test/run-pass/issues/issue-7899.rs @@ -2,7 +2,7 @@ #![allow(unused_variables)] // aux-build:issue-7899.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate issue_7899 as testcrate; diff --git a/src/test/run-pass/issues/issue-8044.rs b/src/test/run-pass/issues/issue-8044.rs index 858f98b654d31..071b97b86b993 100644 --- a/src/test/run-pass/issues/issue-8044.rs +++ b/src/test/run-pass/issues/issue-8044.rs @@ -1,7 +1,7 @@ // run-pass // aux-build:issue-8044.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate issue_8044 as minimal; use minimal::{BTree, leaf}; diff --git a/src/test/run-pass/issues/issue-8248.rs b/src/test/run-pass/issues/issue-8248.rs index 239c432e457bf..e2f4c744f3bbe 100644 --- a/src/test/run-pass/issues/issue-8248.rs +++ b/src/test/run-pass/issues/issue-8248.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): trait A { fn dummy(&self) { } diff --git a/src/test/run-pass/issues/issue-8249.rs b/src/test/run-pass/issues/issue-8249.rs index db49f354a3929..86233ad1fa6ec 100644 --- a/src/test/run-pass/issues/issue-8249.rs +++ b/src/test/run-pass/issues/issue-8249.rs @@ -1,6 +1,6 @@ // run-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): trait A { fn dummy(&self) { } diff --git a/src/test/run-pass/issues/issue-8259.rs b/src/test/run-pass/issues/issue-8259.rs index 2802bea7fe028..9440ee5eb0210 100644 --- a/src/test/run-pass/issues/issue-8259.rs +++ b/src/test/run-pass/issues/issue-8259.rs @@ -4,7 +4,7 @@ // aux-build:issue-8259.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate issue_8259 as other; static a: other::Foo<'static> = other::Foo::A; diff --git a/src/test/run-pass/issues/issue-8401.rs b/src/test/run-pass/issues/issue-8401.rs index 97d66c5e40f04..f65d34ebcf389 100644 --- a/src/test/run-pass/issues/issue-8401.rs +++ b/src/test/run-pass/issues/issue-8401.rs @@ -1,7 +1,7 @@ // run-pass // aux-build:issue_8401.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate issue_8401; diff --git a/src/test/run-pass/issues/issue-8506.rs b/src/test/run-pass/issues/issue-8506.rs index cc32b89234f21..f14bcc6c1fae7 100644 --- a/src/test/run-pass/issues/issue-8506.rs +++ b/src/test/run-pass/issues/issue-8506.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![allow(non_upper_case_globals)] #![allow(dead_code)] diff --git a/src/test/run-pass/issues/issue-868.rs b/src/test/run-pass/issues/issue-868.rs index ce0a3c7ca526c..c3017542b79cf 100644 --- a/src/test/run-pass/issues/issue-868.rs +++ b/src/test/run-pass/issues/issue-868.rs @@ -1,6 +1,6 @@ // run-pass #![allow(unused_parens)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): fn f(g: F) -> T where F: FnOnce() -> T { g() } diff --git a/src/test/run-pass/issues/issue-8783.rs b/src/test/run-pass/issues/issue-8783.rs index 4eb49c8216184..14818eaf340b0 100644 --- a/src/test/run-pass/issues/issue-8783.rs +++ b/src/test/run-pass/issues/issue-8783.rs @@ -1,6 +1,6 @@ // run-pass #![allow(unused_variables)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): use std::default::Default; diff --git a/src/test/run-pass/issues/issue-8851.rs b/src/test/run-pass/issues/issue-8851.rs index faacfe5f8952d..ba254fb6ec3bf 100644 --- a/src/test/run-pass/issues/issue-8851.rs +++ b/src/test/run-pass/issues/issue-8851.rs @@ -5,7 +5,7 @@ // doesn't cause capture. Making this macro hygienic (as I've done) // could very well make this test case completely pointless.... -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): enum T { A(isize), diff --git a/src/test/run-pass/issues/issue-9123.rs b/src/test/run-pass/issues/issue-9123.rs index 5072ca6ba5374..91a198d95e701 100644 --- a/src/test/run-pass/issues/issue-9123.rs +++ b/src/test/run-pass/issues/issue-9123.rs @@ -1,7 +1,7 @@ // run-pass // aux-build:issue_9123.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate issue_9123; diff --git a/src/test/run-pass/issues/issue-9382.rs b/src/test/run-pass/issues/issue-9382.rs index dbb0fa524ef51..776f9a297f1b8 100644 --- a/src/test/run-pass/issues/issue-9382.rs +++ b/src/test/run-pass/issues/issue-9382.rs @@ -1,4 +1,4 @@ -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): // run-pass diff --git a/src/test/run-pass/issues/issue-9906.rs b/src/test/run-pass/issues/issue-9906.rs index a2870cf0f6eb7..a97bbe4bedd28 100644 --- a/src/test/run-pass/issues/issue-9906.rs +++ b/src/test/run-pass/issues/issue-9906.rs @@ -1,7 +1,7 @@ // run-pass // aux-build:issue-9906.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate issue_9906 as testmod; diff --git a/src/test/run-pass/issues/issue-9942.rs b/src/test/run-pass/issues/issue-9942.rs index f4880446526e7..b70b9e7bd68fe 100644 --- a/src/test/run-pass/issues/issue-9942.rs +++ b/src/test/run-pass/issues/issue-9942.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): pub fn main() { const S: usize = 23 as usize; [0; S]; () diff --git a/src/test/run-pass/issues/issue-9951.rs b/src/test/run-pass/issues/issue-9951.rs index 4e14bdbd73429..9ebf9b0ec19d8 100644 --- a/src/test/run-pass/issues/issue-9951.rs +++ b/src/test/run-pass/issues/issue-9951.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![allow(unused_variables)] diff --git a/src/test/run-pass/issues/issue-9968.rs b/src/test/run-pass/issues/issue-9968.rs index 3ab90d99af9cc..73c6cba665b7f 100644 --- a/src/test/run-pass/issues/issue-9968.rs +++ b/src/test/run-pass/issues/issue-9968.rs @@ -1,7 +1,7 @@ // run-pass // aux-build:issue-9968.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate issue_9968 as lib; diff --git a/src/test/run-pass/issues/issue2170exe.rs b/src/test/run-pass/issues/issue2170exe.rs index 4169ddf9bb7f7..7f6d40db116e6 100644 --- a/src/test/run-pass/issues/issue2170exe.rs +++ b/src/test/run-pass/issues/issue2170exe.rs @@ -1,6 +1,6 @@ // run-pass // aux-build:issue2170lib.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate issue2170lib; diff --git a/src/test/run-pass/issues/issue24687-embed-debuginfo/auxiliary/issue24687_mbcs_in_comments.rs b/src/test/run-pass/issues/issue24687-embed-debuginfo/auxiliary/issue24687_mbcs_in_comments.rs index 215145a64b177..1d75fe26ca2d2 100644 --- a/src/test/run-pass/issues/issue24687-embed-debuginfo/auxiliary/issue24687_mbcs_in_comments.rs +++ b/src/test/run-pass/issues/issue24687-embed-debuginfo/auxiliary/issue24687_mbcs_in_comments.rs @@ -1,7 +1,7 @@ use std::fmt; // This ia file with many multi-byte characters, to try to encourage -// the compiler to trip on them. The Drop implementation below will +// the compiler to trip on them. The Drop implementation below will // need to have its source location embedded into the debug info for // the output file. diff --git a/src/test/run-pass/issues/issue_3136_b.rs b/src/test/run-pass/issues/issue_3136_b.rs index f0bdd2b5ec050..9d441cdbc8370 100644 --- a/src/test/run-pass/issues/issue_3136_b.rs +++ b/src/test/run-pass/issues/issue_3136_b.rs @@ -1,7 +1,7 @@ // run-pass // aux-build:issue_3136_a.rc -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate issue_3136_a; pub fn main() {} diff --git a/src/test/run-pass/issues/issue_9155.rs b/src/test/run-pass/issues/issue_9155.rs index 87c453be1420b..abbe68b570dfd 100644 --- a/src/test/run-pass/issues/issue_9155.rs +++ b/src/test/run-pass/issues/issue_9155.rs @@ -1,7 +1,7 @@ // run-pass // aux-build:issue_9155.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate issue_9155; diff --git a/src/test/run-pass/item-attributes.rs b/src/test/run-pass/item-attributes.rs index 52b931f638c09..e3ed350f29a94 100644 --- a/src/test/run-pass/item-attributes.rs +++ b/src/test/run-pass/item-attributes.rs @@ -163,7 +163,7 @@ mod test_foreign_items { } -// FIXME #623 - these aren't supported yet +// FIXME(#623): - these aren't supported yet /*mod test_literals { #![str = "s"] #![char = 'c'] diff --git a/src/test/run-pass/item-name-overload.rs b/src/test/run-pass/item-name-overload.rs index 58ef977919cdd..20964957c4a91 100644 --- a/src/test/run-pass/item-name-overload.rs +++ b/src/test/run-pass/item-name-overload.rs @@ -2,7 +2,7 @@ -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): mod foo { pub fn baz() { } diff --git a/src/test/run-pass/iterators/into-iterator-type-inference-shift.rs b/src/test/run-pass/iterators/into-iterator-type-inference-shift.rs index 9151172fd15ed..227d3f0d0ad56 100644 --- a/src/test/run-pass/iterators/into-iterator-type-inference-shift.rs +++ b/src/test/run-pass/iterators/into-iterator-type-inference-shift.rs @@ -8,7 +8,7 @@ // propagation yet, and so we just saw a type variable, yielding an // error. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): trait IntoIterator { type Iter: Iterator; diff --git a/src/test/run-pass/keyword-changes-2012-07-31.rs b/src/test/run-pass/keyword-changes-2012-07-31.rs index 73b0d07090b24..98eb40fc7326f 100644 --- a/src/test/run-pass/keyword-changes-2012-07-31.rs +++ b/src/test/run-pass/keyword-changes-2012-07-31.rs @@ -3,7 +3,7 @@ // mod -> module // match -> match -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): pub fn main() { } diff --git a/src/test/run-pass/kindck-implicit-close-over-mut-var.rs b/src/test/run-pass/kindck-implicit-close-over-mut-var.rs index 3b2991ede9962..d25cc6b492625 100644 --- a/src/test/run-pass/kindck-implicit-close-over-mut-var.rs +++ b/src/test/run-pass/kindck-implicit-close-over-mut-var.rs @@ -6,7 +6,7 @@ fn user(_i: isize) {} fn foo() { // Here, i is *copied* into the proc (heap closure). - // Requires allocation. The proc's copy is not mutable. + // Requires allocation. The proc's copy is not mutable. let mut i = 0; let t = thread::spawn(move|| { user(i); diff --git a/src/test/run-pass/kinds-in-metadata.rs b/src/test/run-pass/kinds-in-metadata.rs index 7cfc28b12b98a..b5d8854d7880c 100644 --- a/src/test/run-pass/kinds-in-metadata.rs +++ b/src/test/run-pass/kinds-in-metadata.rs @@ -1,9 +1,6 @@ // aux-build:kinds_in_metadata.rs -// pretty-expanded FIXME #23616 - -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ +// pretty-expanded FIXME(#23616): // Tests that metadata serialization works for the `Copy` kind. diff --git a/src/test/run-pass/lambda-infer-unresolved.rs b/src/test/run-pass/lambda-infer-unresolved.rs index 751801e7c217b..2236be45163c9 100644 --- a/src/test/run-pass/lambda-infer-unresolved.rs +++ b/src/test/run-pass/lambda-infer-unresolved.rs @@ -1,7 +1,7 @@ #![allow(unused_mut)] -// This should typecheck even though the type of e is not fully -// resolved when we finish typechecking the ||. +// This should type-check even though the type of `e` is not fully +// resolved when we finish type-checking the `||`. struct Refs { refs: Vec , n: isize } diff --git a/src/test/run-pass/large-records.rs b/src/test/run-pass/large-records.rs index 9786ea7978090..6ed6779082996 100644 --- a/src/test/run-pass/large-records.rs +++ b/src/test/run-pass/large-records.rs @@ -3,7 +3,7 @@ -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): struct Large {a: isize, b: isize, diff --git a/src/test/run-pass/leak-unique-as-tydesc.rs b/src/test/run-pass/leak-unique-as-tydesc.rs index 2293e3c823f8c..76c4439a0dc80 100644 --- a/src/test/run-pass/leak-unique-as-tydesc.rs +++ b/src/test/run-pass/leak-unique-as-tydesc.rs @@ -1,7 +1,10 @@ -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616) #![feature(box_syntax)] -fn leaky(_t: T) { } +fn leaky(_t: T) {} -pub fn main() { let x = box 10; leaky::>(x); } +pub fn main() { + let x = box 10; + leaky::>(x); +} diff --git a/src/test/run-pass/lint-non-camel-case-with-trailing-underscores.rs b/src/test/run-pass/lint-non-camel-case-with-trailing-underscores.rs index 6c0ea83e0f43b..df3a349c646f5 100644 --- a/src/test/run-pass/lint-non-camel-case-with-trailing-underscores.rs +++ b/src/test/run-pass/lint-non-camel-case-with-trailing-underscores.rs @@ -1,7 +1,7 @@ #![allow(dead_code)] // This is ok because we often use the trailing underscore to mean 'prime' -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #[forbid(non_camel_case_types)] type Foo_ = isize; diff --git a/src/test/run-pass/list.rs b/src/test/run-pass/list.rs index 62c04bcac757b..b1cf585df9004 100644 --- a/src/test/run-pass/list.rs +++ b/src/test/run-pass/list.rs @@ -1,5 +1,5 @@ #![allow(non_camel_case_types)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![feature(box_syntax)] diff --git a/src/test/run-pass/liveness-assign-imm-local-after-ret.rs b/src/test/run-pass/liveness-assign-imm-local-after-ret.rs index 3dc27dde52b32..07c08cc322e70 100644 --- a/src/test/run-pass/liveness-assign-imm-local-after-ret.rs +++ b/src/test/run-pass/liveness-assign-imm-local-after-ret.rs @@ -1,5 +1,5 @@ #![allow(unreachable_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![allow(dead_code)] diff --git a/src/test/run-pass/logging_before_rt_started.rs b/src/test/run-pass/logging_before_rt_started.rs index 0cba1080de265..e8d3b7fa5e02d 100644 --- a/src/test/run-pass/logging_before_rt_started.rs +++ b/src/test/run-pass/logging_before_rt_started.rs @@ -6,6 +6,6 @@ // this test will trigger "output during runtime initialization" to make sure // that the bug isn't re-introduced. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): pub fn main() {} diff --git a/src/test/run-pass/long-while.rs b/src/test/run-pass/long-while.rs index 4a3ee6f971387..9a12ee5f2353e 100644 --- a/src/test/run-pass/long-while.rs +++ b/src/test/run-pass/long-while.rs @@ -1,4 +1,4 @@ -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616) #![allow(unused_variables)] diff --git a/src/test/run-pass/macros/log_syntax-trace_macros-macro-locations.rs b/src/test/run-pass/macros/log_syntax-trace_macros-macro-locations.rs index 2d78ae6f90833..36a8aa00444bc 100644 --- a/src/test/run-pass/macros/log_syntax-trace_macros-macro-locations.rs +++ b/src/test/run-pass/macros/log_syntax-trace_macros-macro-locations.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![feature(trace_macros, log_syntax)] diff --git a/src/test/run-pass/macros/macro-export-inner-module.rs b/src/test/run-pass/macros/macro-export-inner-module.rs index 1f23e90b65cd5..fbe7419e19d77 100644 --- a/src/test/run-pass/macros/macro-export-inner-module.rs +++ b/src/test/run-pass/macros/macro-export-inner-module.rs @@ -1,5 +1,5 @@ // run-pass -//aux-build:macro_export_inner_module.rs +// aux-build:macro_export_inner_module.rs #[macro_use] #[no_link] extern crate macro_export_inner_module; diff --git a/src/test/run-pass/macros/macro-first-set.rs b/src/test/run-pass/macros/macro-first-set.rs index 8b09e72ed2951..8504194edf4d0 100644 --- a/src/test/run-pass/macros/macro-first-set.rs +++ b/src/test/run-pass/macros/macro-first-set.rs @@ -1,6 +1,6 @@ // run-pass -//{{{ issue 40569 ============================================================== +//{{{ issue #40569 ============================================================== macro_rules! my_struct { ($(#[$meta:meta])* $ident:ident) => { @@ -16,7 +16,7 @@ fn test_40569() { //}}} -//{{{ issue 26444 ============================================================== +//{{{ issue #26444 ============================================================== macro_rules! foo_26444 { ($($beginning:ident),*; $middle:ident; $($end:ident),*) => { @@ -38,7 +38,7 @@ pat_26444!(bar Some(ref x) Ok(ref mut y) &(w, z) =); //}}} -//{{{ issue 40984 ============================================================== +//{{{ issue #40984 ============================================================== macro_rules! thread_local_40984 { () => {}; @@ -62,7 +62,7 @@ thread_local_40984! { //}}} -//{{{ issue 35650 ============================================================== +//{{{ issue #35650 ============================================================== macro_rules! size { ($ty:ty) => { @@ -80,7 +80,7 @@ fn test_35650() { //}}} -//{{{ issue 27832 ============================================================== +//{{{ issue #27832 ============================================================== macro_rules! m { ( $i:ident ) => (); @@ -105,7 +105,7 @@ m2!(enum Foo); //}}} -//{{{ issue 39964 ============================================================== +//{{{ issue #39964 ============================================================== macro_rules! foo_39964 { ($a:ident) => {}; @@ -116,7 +116,7 @@ foo_39964!(_); //}}} -//{{{ issue 34030 ============================================================== +//{{{ issue #34030 ============================================================== macro_rules! foo_34030 { ($($t:ident),* /) => {}; @@ -128,7 +128,7 @@ foo_34030!(/); //}}} -//{{{ issue 24189 ============================================================== +//{{{ issue #24189 ============================================================== macro_rules! foo_24189 { ( @@ -189,7 +189,7 @@ fn test_24189() { //}}} -//{{{ issue 50903 ============================================================== +//{{{ issue #50903 ============================================================== macro_rules! foo_50903 { ($($lif:lifetime ,)* #) => {}; @@ -201,7 +201,7 @@ foo_50903!(#); //}}} -//{{{ issue 51477 ============================================================== +//{{{ issue #51477 ============================================================== macro_rules! foo_51477 { ($lifetime:lifetime) => { @@ -250,7 +250,7 @@ test_path!(); test_path!(,); test_path!(::std); test_path!(std::u8,); -test_path!(any, super, super::super::self::path, X::Z<'a, T=U>); +test_path!(any, super, super::super::self::path, X::Z<'a, T = U>); macro_rules! test_meta_block { ($($m:meta)* $b:block) => {}; diff --git a/src/test/run-pass/macros/macro-invocation-in-count-expr-fixed-array-type.rs b/src/test/run-pass/macros/macro-invocation-in-count-expr-fixed-array-type.rs index 8f9dcb94794b6..c425317ba97f0 100644 --- a/src/test/run-pass/macros/macro-invocation-in-count-expr-fixed-array-type.rs +++ b/src/test/run-pass/macros/macro-invocation-in-count-expr-fixed-array-type.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): macro_rules! four { () => (4) diff --git a/src/test/run-pass/macros/macro-nt-list.rs b/src/test/run-pass/macros/macro-nt-list.rs index 36aa74f082530..68b542412ccf7 100644 --- a/src/test/run-pass/macros/macro-nt-list.rs +++ b/src/test/run-pass/macros/macro-nt-list.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): macro_rules! list { ( ($($id:ident),*) ) => (()); diff --git a/src/test/run-pass/macros/macro-seq-followed-by-seq.rs b/src/test/run-pass/macros/macro-seq-followed-by-seq.rs index 8f0f4fd4a0d44..0704c06a59a3f 100644 --- a/src/test/run-pass/macros/macro-seq-followed-by-seq.rs +++ b/src/test/run-pass/macros/macro-seq-followed-by-seq.rs @@ -1,7 +1,6 @@ // run-pass // Test of allowing two sequences repetitions in a row, -// functionality added as byproduct of RFC amendment #1384 -// https://github.com/rust-lang/rfcs/pull/1384 +// functionality added as by-product of RFC amendment #1384. // Old version of Rust would reject this macro definition, even though // there are no local ambiguities (the initial `banana` and `orange` diff --git a/src/test/run-pass/macros/macro_with_super_2.rs b/src/test/run-pass/macros/macro_with_super_2.rs index 2901a74f612b4..4f9aca8ced5f3 100644 --- a/src/test/run-pass/macros/macro_with_super_2.rs +++ b/src/test/run-pass/macros/macro_with_super_2.rs @@ -1,7 +1,7 @@ // run-pass // aux-build:macro_with_super_1.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #[macro_use] extern crate macro_with_super_1; diff --git a/src/test/run-pass/macros/parse-complex-macro-invoc-op.rs b/src/test/run-pass/macros/parse-complex-macro-invoc-op.rs index 8fef9b0ed877b..b647e9fa596a1 100644 --- a/src/test/run-pass/macros/parse-complex-macro-invoc-op.rs +++ b/src/test/run-pass/macros/parse-complex-macro-invoc-op.rs @@ -7,7 +7,7 @@ // Test parsing binary operators after macro invocations. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![feature(macro_rules)] diff --git a/src/test/run-pass/macros/pub-item-inside-macro.rs b/src/test/run-pass/macros/pub-item-inside-macro.rs index d07681453a23a..82d0df19da1dc 100644 --- a/src/test/run-pass/macros/pub-item-inside-macro.rs +++ b/src/test/run-pass/macros/pub-item-inside-macro.rs @@ -1,7 +1,7 @@ // run-pass // Issue #14660 -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): mod bleh { macro_rules! foo { diff --git a/src/test/run-pass/macros/pub-method-inside-macro.rs b/src/test/run-pass/macros/pub-method-inside-macro.rs index bc918c7a4dc22..4c4b9771ded18 100644 --- a/src/test/run-pass/macros/pub-method-inside-macro.rs +++ b/src/test/run-pass/macros/pub-method-inside-macro.rs @@ -1,7 +1,7 @@ // run-pass // Issue #17436 -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): mod bleh { macro_rules! foo { diff --git a/src/test/run-pass/methods/method-attributes.rs b/src/test/run-pass/methods/method-attributes.rs index c7d8b3b1403ab..99f7aab7d1376 100644 --- a/src/test/run-pass/methods/method-attributes.rs +++ b/src/test/run-pass/methods/method-attributes.rs @@ -3,7 +3,7 @@ #![allow(non_camel_case_types)] // pp-exact - Make sure we print all the attributes -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![feature(custom_attribute)] diff --git a/src/test/run-pass/methods/method-early-bound-lifetimes-on-self.rs b/src/test/run-pass/methods/method-early-bound-lifetimes-on-self.rs index f2ace32c6b636..ca0bf41bae4b1 100644 --- a/src/test/run-pass/methods/method-early-bound-lifetimes-on-self.rs +++ b/src/test/run-pass/methods/method-early-bound-lifetimes-on-self.rs @@ -2,7 +2,7 @@ // Check that we successfully handle methods where the `self` type has // an early-bound lifetime. Issue #18208. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![allow(dead_code)] diff --git a/src/test/run-pass/methods/method-normalize-bounds-issue-20604.rs b/src/test/run-pass/methods/method-normalize-bounds-issue-20604.rs index 9c0b952849eab..bae5b1271ca38 100644 --- a/src/test/run-pass/methods/method-normalize-bounds-issue-20604.rs +++ b/src/test/run-pass/methods/method-normalize-bounds-issue-20604.rs @@ -9,7 +9,7 @@ // winnowing stage of method resolution failed to handle an associated // type projection. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![feature(associated_types)] diff --git a/src/test/run-pass/methods/method-recursive-blanket-impl.rs b/src/test/run-pass/methods/method-recursive-blanket-impl.rs index a2db75b4e85d8..1fd916cf190c9 100644 --- a/src/test/run-pass/methods/method-recursive-blanket-impl.rs +++ b/src/test/run-pass/methods/method-recursive-blanket-impl.rs @@ -2,11 +2,11 @@ #![allow(unused_variables)] #![allow(unused_imports)] // Test that we don't trigger on the blanket impl for all `&'a T` but -// rather keep autoderefing and trigger on the underlying impl. To +// rather keep autoderefing and trigger on the underlying impl. To // know not to stop at the blanket, we have to recursively evaluate // the `T:Foo` bound. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): use std::marker::Sized; diff --git a/src/test/run-pass/methods/method-two-trait-defer-resolution-2.rs b/src/test/run-pass/methods/method-two-trait-defer-resolution-2.rs index 8af3dcf5c3db0..d2c50ba4e379e 100644 --- a/src/test/run-pass/methods/method-two-trait-defer-resolution-2.rs +++ b/src/test/run-pass/methods/method-two-trait-defer-resolution-2.rs @@ -4,7 +4,7 @@ // this case, we know that `x: Vec<_1>`, but we don't know what type // `_1` is (because the call to `push` comes later). To pick between // the impls, we would have to know `_1`, since we have to know -// whether `_1: MyCopy` or `_1 == Box`. However (and this is the +// whether `_1: MyCopy` or `_1 == Box`. However (and this is the // point of the test), we don't have to pick between the two impls -- // it is enough to know that `foo` comes from the `Foo` trait. We can // codegen the call as `Foo::foo(&x)` and let the specific impl get diff --git a/src/test/run-pass/methods/method-two-traits-distinguished-via-where-clause.rs b/src/test/run-pass/methods/method-two-traits-distinguished-via-where-clause.rs index d820d2ad08ae8..7c7c2ae229e16 100644 --- a/src/test/run-pass/methods/method-two-traits-distinguished-via-where-clause.rs +++ b/src/test/run-pass/methods/method-two-traits-distinguished-via-where-clause.rs @@ -2,7 +2,7 @@ // Test that we select between traits A and B. To do that, we must // consider the `Sized` bound. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): trait A { fn foo(self); diff --git a/src/test/run-pass/mid-path-type-params.rs b/src/test/run-pass/mid-path-type-params.rs index e8ed0424e4aca..6b9c0320b7011 100644 --- a/src/test/run-pass/mid-path-type-params.rs +++ b/src/test/run-pass/mid-path-type-params.rs @@ -1,5 +1,5 @@ #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): struct S { contents: T, diff --git a/src/test/run-pass/mir/mir_codegen_critical_edge.rs b/src/test/run-pass/mir/mir_codegen_critical_edge.rs index 03b111e93dd25..20f74b09e442b 100644 --- a/src/test/run-pass/mir/mir_codegen_critical_edge.rs +++ b/src/test/run-pass/mir/mir_codegen_critical_edge.rs @@ -18,7 +18,7 @@ pub struct Foo { } impl Foo -where A: Iterator, B: Iterator +where A: Iterator, B: Iterator { // This is the function we care about fn next(&mut self) -> Option { diff --git a/src/test/run-pass/mir/mir_early_return_scope.rs b/src/test/run-pass/mir/mir_early_return_scope.rs index a696471c36150..bed10fc59e1f0 100644 --- a/src/test/run-pass/mir/mir_early_return_scope.rs +++ b/src/test/run-pass/mir/mir_early_return_scope.rs @@ -4,7 +4,7 @@ static mut DROP: bool = false; struct ConnWrap(Conn); impl ::std::ops::Deref for ConnWrap { - type Target=Conn; + type Target = Conn; fn deref(&self) -> &Conn { &self.0 } } diff --git a/src/test/run-pass/modules/mod-view-items.rs b/src/test/run-pass/modules/mod-view-items.rs index db2b303668b7e..b9cd2867a1de5 100644 --- a/src/test/run-pass/modules/mod-view-items.rs +++ b/src/test/run-pass/modules/mod-view-items.rs @@ -5,7 +5,7 @@ // pretty-print such view items. If that happens again, this should // begin failing. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): mod m { pub fn f() -> Vec { Vec::new() } diff --git a/src/test/run-pass/monomorphized-callees-with-ty-params-3314.rs b/src/test/run-pass/monomorphized-callees-with-ty-params-3314.rs index ec7ff2d8a5174..6249f7db775f8 100644 --- a/src/test/run-pass/monomorphized-callees-with-ty-params-3314.rs +++ b/src/test/run-pass/monomorphized-callees-with-ty-params-3314.rs @@ -1,4 +1,4 @@ -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616) trait Serializer { } diff --git a/src/test/run-pass/moves/move-nullary-fn.rs b/src/test/run-pass/moves/move-nullary-fn.rs index 14c9262c74d18..e4003263fed20 100644 --- a/src/test/run-pass/moves/move-nullary-fn.rs +++ b/src/test/run-pass/moves/move-nullary-fn.rs @@ -1,6 +1,6 @@ // run-pass // Issue #922 -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): fn f2(_thing: F) where F: FnOnce() { } diff --git a/src/test/run-pass/mpsc_stress.rs b/src/test/run-pass/mpsc_stress.rs index cd30dd62bc4ce..930480dd09632 100644 --- a/src/test/run-pass/mpsc_stress.rs +++ b/src/test/run-pass/mpsc_stress.rs @@ -67,7 +67,7 @@ fn shared_close_sender_does_not_lose_messages() { } -// https://github.com/rust-lang/rust/issues/39364 +// See issue #39364. fn concurrent_recv_timeout_and_upgrade_iter() { // 1 us let sleep = Duration::new(0, 1_000); diff --git a/src/test/run-pass/multiline-comment.rs b/src/test/run-pass/multiline-comment.rs index 76f9284eb3eb1..590d3fd49781f 100644 --- a/src/test/run-pass/multiline-comment.rs +++ b/src/test/run-pass/multiline-comment.rs @@ -1,4 +1,4 @@ -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616) /* * This is a multi-line oldcomment. diff --git a/src/test/run-pass/mut-vstore-expr.rs b/src/test/run-pass/mut-vstore-expr.rs index d598e3b88db91..27bac4a417489 100644 --- a/src/test/run-pass/mut-vstore-expr.rs +++ b/src/test/run-pass/mut-vstore-expr.rs @@ -1,4 +1,4 @@ -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616) pub fn main() { let _x: &mut [isize] = &mut [ 1, 2, 3 ]; diff --git a/src/test/run-pass/mutual-recursion-group.rs b/src/test/run-pass/mutual-recursion-group.rs index 3be87b5a49051..c26a69e9c2837 100644 --- a/src/test/run-pass/mutual-recursion-group.rs +++ b/src/test/run-pass/mutual-recursion-group.rs @@ -1,7 +1,7 @@ #![allow(non_camel_case_types)] #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): enum colour { red, green, blue, } diff --git a/src/test/run-pass/nested-block-comment.rs b/src/test/run-pass/nested-block-comment.rs index 62d038024a276..864f3bc8c6496 100644 --- a/src/test/run-pass/nested-block-comment.rs +++ b/src/test/run-pass/nested-block-comment.rs @@ -1,11 +1,10 @@ -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616) -/* This test checks that nested comments are supported +/* This test checks that nested comments are supported. /* This should not panic */ */ -pub fn main() { -} +pub fn main() {} diff --git a/src/test/run-pass/new-box-syntax.rs b/src/test/run-pass/new-box-syntax.rs index a39803c2eb84b..896fc8d925731 100644 --- a/src/test/run-pass/new-box-syntax.rs +++ b/src/test/run-pass/new-box-syntax.rs @@ -1,7 +1,4 @@ -// pretty-expanded FIXME #23616 - -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ +// pretty-expanded FIXME(#23616) #![allow(dead_code, unused_variables)] #![feature(box_syntax)] diff --git a/src/test/run-pass/new-unsafe-pointers.rs b/src/test/run-pass/new-unsafe-pointers.rs index a80ef1410876c..fe02cecd26527 100644 --- a/src/test/run-pass/new-unsafe-pointers.rs +++ b/src/test/run-pass/new-unsafe-pointers.rs @@ -1,4 +1,4 @@ -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616) fn main() { let _a: *const isize = 3 as *const isize; diff --git a/src/test/run-pass/newlambdas-ret-infer.rs b/src/test/run-pass/newlambdas-ret-infer.rs index 969868486e6eb..2cf9285e294f7 100644 --- a/src/test/run-pass/newlambdas-ret-infer.rs +++ b/src/test/run-pass/newlambdas-ret-infer.rs @@ -2,7 +2,7 @@ // Test that the lambda kind is inferred correctly as a return // expression -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): fn unique() -> Box { return Box::new(|| ()); } diff --git a/src/test/run-pass/newlambdas-ret-infer2.rs b/src/test/run-pass/newlambdas-ret-infer2.rs index 676b3507c5740..fc80af70a3d35 100644 --- a/src/test/run-pass/newlambdas-ret-infer2.rs +++ b/src/test/run-pass/newlambdas-ret-infer2.rs @@ -2,7 +2,7 @@ // Test that the lambda kind is inferred correctly as a return // expression -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): fn unique() -> Box { Box::new(|| ()) } diff --git a/src/test/run-pass/nil-decl-in-foreign.rs b/src/test/run-pass/nil-decl-in-foreign.rs index faff6b48730cf..6077dad401af5 100644 --- a/src/test/run-pass/nil-decl-in-foreign.rs +++ b/src/test/run-pass/nil-decl-in-foreign.rs @@ -1,7 +1,7 @@ #![allow(improper_ctypes)] #![allow(dead_code)] // Issue #901 -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): mod libc { extern { diff --git a/src/test/run-pass/nll/rc-loop.rs b/src/test/run-pass/nll/rc-loop.rs index 2c54ee8693902..1ecd6498ed4f0 100644 --- a/src/test/run-pass/nll/rc-loop.rs +++ b/src/test/run-pass/nll/rc-loop.rs @@ -3,7 +3,7 @@ // A test for something that NLL enables. It sometimes happens that // the `while let` pattern makes some borrows from a variable (in this // case, `x`) that you need in order to compute the next value for -// `x`. The lexical checker makes this very painful. The NLL checker +// `x`. The lexical checker makes this very painful. The NLL checker // does not. #![feature(nll)] diff --git a/src/test/run-pass/non-built-in-quote.rs b/src/test/run-pass/non-built-in-quote.rs index 75df2788d7918..fc842c0227cd0 100644 --- a/src/test/run-pass/non-built-in-quote.rs +++ b/src/test/run-pass/non-built-in-quote.rs @@ -1,4 +1,4 @@ -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616) macro_rules! quote_tokens { () => (()) } diff --git a/src/test/run-pass/numbers-arithmetic/i128.rs b/src/test/run-pass/numbers-arithmetic/i128.rs index f3b5506ae32a6..6d71060ecf840 100644 --- a/src/test/run-pass/numbers-arithmetic/i128.rs +++ b/src/test/run-pass/numbers-arithmetic/i128.rs @@ -100,7 +100,7 @@ fn main() { assert_eq!(b(1u128).checked_shl(b(127)), Some(1 << 127)); assert_eq!(o.checked_shl(b(128)), None); - // https://github.com/rust-lang/rust/issues/41228 + // See issue #41228. assert_eq!(b(-87559967289969187895646876466835277875_i128) / b(84285771033834995895337664386045050880_i128), -1i128); diff --git a/src/test/run-pass/numbers-arithmetic/int.rs b/src/test/run-pass/numbers-arithmetic/int.rs index b496a70a6feae..5bf1e8a0ae77c 100644 --- a/src/test/run-pass/numbers-arithmetic/int.rs +++ b/src/test/run-pass/numbers-arithmetic/int.rs @@ -2,6 +2,6 @@ -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): pub fn main() { let _x: isize = 10; } diff --git a/src/test/run-pass/numbers-arithmetic/integer-literal-suffix-inference-2.rs b/src/test/run-pass/numbers-arithmetic/integer-literal-suffix-inference-2.rs index 80248dc223dcc..4444a6c85f4f7 100644 --- a/src/test/run-pass/numbers-arithmetic/integer-literal-suffix-inference-2.rs +++ b/src/test/run-pass/numbers-arithmetic/integer-literal-suffix-inference-2.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): fn foo(_: *const ()) {} diff --git a/src/test/run-pass/numbers-arithmetic/integer-literal-suffix-inference.rs b/src/test/run-pass/numbers-arithmetic/integer-literal-suffix-inference.rs index d177ced1a6966..36a50b640b98d 100644 --- a/src/test/run-pass/numbers-arithmetic/integer-literal-suffix-inference.rs +++ b/src/test/run-pass/numbers-arithmetic/integer-literal-suffix-inference.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): pub fn main() { fn id_i8(n: i8) -> i8 { n } diff --git a/src/test/run-pass/numbers-arithmetic/saturating-float-casts.rs b/src/test/run-pass/numbers-arithmetic/saturating-float-casts.rs index f13964fb38665..06d51805b9541 100644 --- a/src/test/run-pass/numbers-arithmetic/saturating-float-casts.rs +++ b/src/test/run-pass/numbers-arithmetic/saturating-float-casts.rs @@ -88,7 +88,7 @@ macro_rules! fptoui_tests { pub fn main() { common_fptoi_tests!(f* -> i8 i16 i32 i64 u8 u16 u32 u64); fptoui_tests!(f* -> u8 u16 u32 u64); - // FIXME emscripten does not support i128 + // FIXME: emscripten does not support i128 #[cfg(not(target_os="emscripten"))] { common_fptoi_tests!(f* -> i128 u128); fptoui_tests!(f* -> u128); diff --git a/src/test/run-pass/numbers-arithmetic/u128.rs b/src/test/run-pass/numbers-arithmetic/u128.rs index 56d1f221d844c..21a2bf5d72ba7 100644 --- a/src/test/run-pass/numbers-arithmetic/u128.rs +++ b/src/test/run-pass/numbers-arithmetic/u128.rs @@ -88,7 +88,7 @@ fn main() { assert_eq!(b(0xa9008fb6c9d81e42_0e25730562a601c8_u128) / b(1u128 << 120), 169u128); - // case "KK/K0" with N >= D (https://github.com/rust-lang/rust/issues/41228). + // case "KK/K0" with N >= D (issue #41228). assert_eq!(b(0xe4d26e59f0640328_06da5b06efe83a41_u128) / b(0x330fcb030ea4447c_u128 << 64), 4u128); diff --git a/src/test/run-pass/numbers-arithmetic/uint.rs b/src/test/run-pass/numbers-arithmetic/uint.rs index d219eae8f333e..8178f34692694 100644 --- a/src/test/run-pass/numbers-arithmetic/uint.rs +++ b/src/test/run-pass/numbers-arithmetic/uint.rs @@ -2,6 +2,6 @@ -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): pub fn main() { let _x: usize = 10 as usize; } diff --git a/src/test/run-pass/object-lifetime-default-default-to-static.rs b/src/test/run-pass/object-lifetime-default-default-to-static.rs index cf836c1a7deda..05c7d42866b94 100644 --- a/src/test/run-pass/object-lifetime-default-default-to-static.rs +++ b/src/test/run-pass/object-lifetime-default-default-to-static.rs @@ -1,7 +1,7 @@ // Test that `Box` is equivalent to `Box`, both in // fields and fn arguments. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![allow(dead_code)] diff --git a/src/test/run-pass/object-lifetime-default-from-rptr-box.rs b/src/test/run-pass/object-lifetime-default-from-rptr-box.rs index 3f69c9274889c..59c60b836be95 100644 --- a/src/test/run-pass/object-lifetime-default-from-rptr-box.rs +++ b/src/test/run-pass/object-lifetime-default-from-rptr-box.rs @@ -1,7 +1,7 @@ // Test that the lifetime from the enclosing `&` is "inherited" // through the `Box` struct. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![allow(dead_code)] diff --git a/src/test/run-pass/object-lifetime-default-from-rptr-mut.rs b/src/test/run-pass/object-lifetime-default-from-rptr-mut.rs index dc9e292f0de38..4b5cf1bc041d1 100644 --- a/src/test/run-pass/object-lifetime-default-from-rptr-mut.rs +++ b/src/test/run-pass/object-lifetime-default-from-rptr-mut.rs @@ -1,7 +1,7 @@ // Test that the lifetime of the enclosing `&` is used for the object // lifetime bound. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![allow(dead_code)] diff --git a/src/test/run-pass/object-lifetime-default-from-rptr.rs b/src/test/run-pass/object-lifetime-default-from-rptr.rs index 061f71b9ae6bf..bdc3c65702260 100644 --- a/src/test/run-pass/object-lifetime-default-from-rptr.rs +++ b/src/test/run-pass/object-lifetime-default-from-rptr.rs @@ -1,7 +1,7 @@ // Test that the lifetime of the enclosing `&` is used for the object // lifetime bound. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![allow(dead_code)] diff --git a/src/test/run-pass/out-of-stack.rs b/src/test/run-pass/out-of-stack.rs index 72d6d6806229e..7a3a7973bc776 100644 --- a/src/test/run-pass/out-of-stack.rs +++ b/src/test/run-pass/out-of-stack.rs @@ -1,6 +1,6 @@ #![allow(unused_must_use)] #![allow(unconditional_recursion)] -// ignore-android: FIXME (#20004) +// ignore-android: FIXME(#20004) // ignore-musl // ignore-cloudabi no processes // ignore-emscripten no processes diff --git a/src/test/run-pass/output-slot-variants.rs b/src/test/run-pass/output-slot-variants.rs index f3cc2e99e0ff4..1f12701599d73 100644 --- a/src/test/run-pass/output-slot-variants.rs +++ b/src/test/run-pass/output-slot-variants.rs @@ -1,7 +1,7 @@ #![allow(dead_code)] #![allow(unused_assignments)] #![allow(unknown_lints)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![allow(dead_assignment)] #![allow(unused_variables)] diff --git a/src/test/run-pass/overloaded/overloaded-calls-param-vtables.rs b/src/test/run-pass/overloaded/overloaded-calls-param-vtables.rs index fde1ad20f7d9c..4ace17a3d954c 100644 --- a/src/test/run-pass/overloaded/overloaded-calls-param-vtables.rs +++ b/src/test/run-pass/overloaded/overloaded-calls-param-vtables.rs @@ -1,7 +1,7 @@ // run-pass // Tests that nested vtables work with overloaded calls. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![feature(unboxed_closures, fn_traits)] diff --git a/src/test/run-pass/overloaded/overloaded-deref-count.rs b/src/test/run-pass/overloaded/overloaded-deref-count.rs index e2f1e10b5c8ae..8e935be30c61d 100644 --- a/src/test/run-pass/overloaded/overloaded-deref-count.rs +++ b/src/test/run-pass/overloaded/overloaded-deref-count.rs @@ -44,30 +44,30 @@ pub fn main() { let mut n = DerefCounter::new(0); let mut v = DerefCounter::new(Vec::new()); - let _ = *n; // Immutable deref + copy a POD. + let _ = *n; // Immutable deref and copy a POD. assert_eq!(n.counts(), (1, 0)); - let _ = (&*n, &*v); // Immutable deref + borrow. + let _ = (&*n, &*v); // Immutable deref and borrow. assert_eq!(n.counts(), (2, 0)); assert_eq!(v.counts(), (1, 0)); - let _ = (&mut *n, &mut *v); // Mutable deref + mutable borrow. + let _ = (&mut *n, &mut *v); // Mutable deref and mutable borrow. assert_eq!(n.counts(), (2, 1)); assert_eq!(v.counts(), (1, 1)); let mut v2 = Vec::new(); v2.push(1); - *n = 5; *v = v2; // Mutable deref + assignment. + *n = 5; *v = v2; // Mutable deref and assignment. assert_eq!(n.counts(), (2, 2)); assert_eq!(v.counts(), (1, 2)); - *n -= 3; // Mutable deref + assignment with binary operation. + *n -= 3; // Mutable deref and assignment with binary operation. assert_eq!(n.counts(), (2, 3)); - // Immutable deref used for calling a method taking &self. (The - // typechecker is smarter now about doing this.) + // Immutable deref used for calling a method taking `&self`. (The + // type-checker is smarter now about doing this.) (*n).to_string(); assert_eq!(n.counts(), (3, 3)); - // Mutable deref used for calling a method taking &mut self. + // Mutable deref used for calling a method taking `&mut self`. (*v).push(2); assert_eq!(v.counts(), (1, 3)); diff --git a/src/test/run-pass/overloaded/overloaded-index-assoc-list.rs b/src/test/run-pass/overloaded/overloaded-index-assoc-list.rs index eb027afeacde9..6e3d5f4905389 100644 --- a/src/test/run-pass/overloaded/overloaded-index-assoc-list.rs +++ b/src/test/run-pass/overloaded/overloaded-index-assoc-list.rs @@ -1,5 +1,5 @@ // run-pass -// Test overloading of the `[]` operator. In particular test that it +// Test overloading of the `[]` operator. In particular test that it // takes its argument *by reference*. use std::ops::Index; diff --git a/src/test/run-pass/owned-implies-static.rs b/src/test/run-pass/owned-implies-static.rs index 7101726ab6a60..fbd7687c1cabc 100644 --- a/src/test/run-pass/owned-implies-static.rs +++ b/src/test/run-pass/owned-implies-static.rs @@ -1,4 +1,4 @@ -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616) fn f(_x: T) {} diff --git a/src/test/run-pass/parse-assoc-type-lt.rs b/src/test/run-pass/parse-assoc-type-lt.rs index e6b07c583fb09..e9bf273c95d39 100644 --- a/src/test/run-pass/parse-assoc-type-lt.rs +++ b/src/test/run-pass/parse-assoc-type-lt.rs @@ -1,4 +1,4 @@ -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616) trait Foo { type T; diff --git a/src/test/run-pass/path.rs b/src/test/run-pass/path.rs index 7a9b04c070465..6d30f0e884ea2 100644 --- a/src/test/run-pass/path.rs +++ b/src/test/run-pass/path.rs @@ -1,4 +1,4 @@ -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616) mod foo { pub fn bar(_offset: usize) { } diff --git a/src/test/run-pass/privacy/priv-impl-prim-ty.rs b/src/test/run-pass/privacy/priv-impl-prim-ty.rs index 5d6a6b64ed36a..e709960645bec 100644 --- a/src/test/run-pass/privacy/priv-impl-prim-ty.rs +++ b/src/test/run-pass/privacy/priv-impl-prim-ty.rs @@ -1,7 +1,7 @@ // run-pass // aux-build:priv-impl-prim-ty.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate priv_impl_prim_ty as bar; diff --git a/src/test/run-pass/privacy/privacy-ns.rs b/src/test/run-pass/privacy/privacy-ns.rs index b1b03eae5db5f..521cd9f5847f0 100644 --- a/src/test/run-pass/privacy/privacy-ns.rs +++ b/src/test/run-pass/privacy/privacy-ns.rs @@ -5,7 +5,7 @@ // Check we do the correct privacy checks when we import a name and there is an // item with that name in both the value and type namespaces. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![allow(dead_code)] #![allow(unused_imports)] diff --git a/src/test/run-pass/privacy/privacy-reexport.rs b/src/test/run-pass/privacy/privacy-reexport.rs index b3ec3af04ace8..c431cdaa471ba 100644 --- a/src/test/run-pass/privacy/privacy-reexport.rs +++ b/src/test/run-pass/privacy/privacy-reexport.rs @@ -1,7 +1,7 @@ // run-pass // aux-build:privacy_reexport.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate privacy_reexport; diff --git a/src/test/run-pass/privacy/privacy1.rs b/src/test/run-pass/privacy/privacy1.rs index 4e54780dad2bb..ebd3d73cd8dd1 100644 --- a/src/test/run-pass/privacy/privacy1.rs +++ b/src/test/run-pass/privacy/privacy1.rs @@ -1,6 +1,6 @@ // run-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): pub mod test2 { // This used to generate an ICE (make sure that default functions are diff --git a/src/test/run-pass/privacy/private-method.rs b/src/test/run-pass/privacy/private-method.rs index 726944fb25122..08c4feb980256 100644 --- a/src/test/run-pass/privacy/private-method.rs +++ b/src/test/run-pass/privacy/private-method.rs @@ -2,7 +2,7 @@ #![allow(dead_code)] #![allow(non_camel_case_types)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): struct cat { meows : usize, diff --git a/src/test/run-pass/privacy/pub-extern-privacy.rs b/src/test/run-pass/privacy/pub-extern-privacy.rs index 832acfbadcbd4..c88d19095b487 100644 --- a/src/test/run-pass/privacy/pub-extern-privacy.rs +++ b/src/test/run-pass/privacy/pub-extern-privacy.rs @@ -1,7 +1,7 @@ // run-pass // ignore-wasm32-bare no libc to test ffi with -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): use std::mem::transmute; diff --git a/src/test/run-pass/privacy/pub-use-xcrate.rs b/src/test/run-pass/privacy/pub-use-xcrate.rs index e8a6e8cf182d4..b2bf9448cfb7e 100644 --- a/src/test/run-pass/privacy/pub-use-xcrate.rs +++ b/src/test/run-pass/privacy/pub-use-xcrate.rs @@ -2,7 +2,7 @@ // aux-build:pub_use_xcrate1.rs // aux-build:pub_use_xcrate2.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate pub_use_xcrate2; diff --git a/src/test/run-pass/privacy/pub_use_mods_xcrate_exe.rs b/src/test/run-pass/privacy/pub_use_mods_xcrate_exe.rs index f163619e7cb5f..b78c046a0c2be 100644 --- a/src/test/run-pass/privacy/pub_use_mods_xcrate_exe.rs +++ b/src/test/run-pass/privacy/pub_use_mods_xcrate_exe.rs @@ -1,7 +1,7 @@ // run-pass // aux-build:pub_use_mods_xcrate.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![allow(unused_imports)] diff --git a/src/test/run-pass/proc-macro/auxiliary/double.rs b/src/test/run-pass/proc-macro/auxiliary/double.rs index 3a2e8d04c36b5..aaad7bd04a3f6 100644 --- a/src/test/run-pass/proc-macro/auxiliary/double.rs +++ b/src/test/run-pass/proc-macro/auxiliary/double.rs @@ -7,7 +7,7 @@ extern crate proc_macro; use proc_macro::TokenStream; -// Outputs another copy of the struct. Useful for testing the tokens +// Outputs another copy of the struct. Useful for testing the tokens // seen by the proc_macro. #[proc_macro_derive(Double)] pub fn derive(input: TokenStream) -> TokenStream { diff --git a/src/test/run-pass/process/process-spawn-with-unicode-params.rs b/src/test/run-pass/process/process-spawn-with-unicode-params.rs index e3508cb4e8fc9..5434490e54cc7 100644 --- a/src/test/run-pass/process/process-spawn-with-unicode-params.rs +++ b/src/test/run-pass/process/process-spawn-with-unicode-params.rs @@ -2,9 +2,9 @@ // no-prefer-dynamic // The test copies itself into a subdirectory with a non-ASCII name and then -// runs it as a child process within the subdirectory. The parent process +// runs it as a child process within the subdirectory. The parent process // also adds an environment variable and an argument, both containing -// non-ASCII characters. The child process ensures all the strings are +// non-ASCII characters. The child process ensures all the strings are // intact. // ignore-cloudabi no processes diff --git a/src/test/run-pass/project-cache-issue-37154.rs b/src/test/run-pass/project-cache-issue-37154.rs index 8b07b9c98ad8e..27b1c7070d95f 100644 --- a/src/test/run-pass/project-cache-issue-37154.rs +++ b/src/test/run-pass/project-cache-issue-37154.rs @@ -9,7 +9,7 @@ trait Foo { struct Wrapper(T); -impl Foo for Wrapper where for<'a> &'a T: IntoIterator {} +impl Foo for Wrapper where for<'a> &'a T: IntoIterator {} fn f(x: Wrapper>) { x.method(); // This works. diff --git a/src/test/run-pass/ptr-coercion.rs b/src/test/run-pass/ptr-coercion.rs index 0dd2b5467d9a9..383af2f9af6fe 100644 --- a/src/test/run-pass/ptr-coercion.rs +++ b/src/test/run-pass/ptr-coercion.rs @@ -1,7 +1,7 @@ #![allow(unused_variables)] // Test coercions between pointers which don't do anything fancy like unsizing. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): pub fn main() { // &mut -> & diff --git a/src/test/run-pass/pure-sum.rs b/src/test/run-pass/pure-sum.rs index d000c8488a686..b32c71410aa21 100644 --- a/src/test/run-pass/pure-sum.rs +++ b/src/test/run-pass/pure-sum.rs @@ -1,7 +1,7 @@ #![allow(dead_code)] // Check that functions can modify local state. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![feature(box_syntax)] diff --git a/src/test/run-pass/reexport-should-still-link.rs b/src/test/run-pass/reexport-should-still-link.rs index 733f8f9c1f37d..9f5fadd6bf8d8 100644 --- a/src/test/run-pass/reexport-should-still-link.rs +++ b/src/test/run-pass/reexport-should-still-link.rs @@ -1,6 +1,6 @@ // aux-build:reexport-should-still-link.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate reexport_should_still_link as foo; diff --git a/src/test/run-pass/reexport-star.rs b/src/test/run-pass/reexport-star.rs index ae48f97a9ddb5..a4097bd9d919f 100644 --- a/src/test/run-pass/reexport-star.rs +++ b/src/test/run-pass/reexport-star.rs @@ -1,4 +1,4 @@ -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616) mod a { pub fn f() {} diff --git a/src/test/run-pass/regions/regions-addr-of-interior-of-unique-box.rs b/src/test/run-pass/regions/regions-addr-of-interior-of-unique-box.rs index 4221ebfdffb2b..c02844268b0f3 100644 --- a/src/test/run-pass/regions/regions-addr-of-interior-of-unique-box.rs +++ b/src/test/run-pass/regions/regions-addr-of-interior-of-unique-box.rs @@ -1,7 +1,7 @@ // run-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): struct Point { x: isize, diff --git a/src/test/run-pass/regions/regions-assoc-type-region-bound.rs b/src/test/run-pass/regions/regions-assoc-type-region-bound.rs index cbb7d1726d9e1..74918c3403268 100644 --- a/src/test/run-pass/regions/regions-assoc-type-region-bound.rs +++ b/src/test/run-pass/regions/regions-assoc-type-region-bound.rs @@ -3,7 +3,7 @@ // Test that the compiler considers the 'a bound declared in the // trait. Issue #20890. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): trait Foo<'a> { type Value: 'a; diff --git a/src/test/run-pass/regions/regions-assoc-type-static-bound.rs b/src/test/run-pass/regions/regions-assoc-type-static-bound.rs index 1458787ea65a3..53895be72fa43 100644 --- a/src/test/run-pass/regions/regions-assoc-type-static-bound.rs +++ b/src/test/run-pass/regions/regions-assoc-type-static-bound.rs @@ -3,7 +3,7 @@ // Test that the compiler considers the 'static bound declared in the // trait. Issue #20890. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): trait Foo { type Value: 'static; diff --git a/src/test/run-pass/regions/regions-creating-enums2.rs b/src/test/run-pass/regions/regions-creating-enums2.rs index 7b16fb1a8e081..b62e493c995cd 100644 --- a/src/test/run-pass/regions/regions-creating-enums2.rs +++ b/src/test/run-pass/regions/regions-creating-enums2.rs @@ -2,7 +2,7 @@ #![allow(dead_code)] #![allow(non_camel_case_types)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): enum ast<'a> { num(usize), diff --git a/src/test/run-pass/regions/regions-creating-enums5.rs b/src/test/run-pass/regions/regions-creating-enums5.rs index ad3d9748bf0a6..631119a572a9b 100644 --- a/src/test/run-pass/regions/regions-creating-enums5.rs +++ b/src/test/run-pass/regions/regions-creating-enums5.rs @@ -2,7 +2,7 @@ #![allow(dead_code)] #![allow(non_camel_case_types)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): enum ast<'a> { num(usize), diff --git a/src/test/run-pass/regions/regions-debruijn-of-object.rs b/src/test/run-pass/regions/regions-debruijn-of-object.rs index 24c0cf53317e0..986adeb0646e4 100644 --- a/src/test/run-pass/regions/regions-debruijn-of-object.rs +++ b/src/test/run-pass/regions/regions-debruijn-of-object.rs @@ -3,7 +3,7 @@ #![allow(unused_variables)] #![allow(non_camel_case_types)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): struct ctxt<'tcx> { x: &'tcx i32 diff --git a/src/test/run-pass/regions/regions-dependent-autofn.rs b/src/test/run-pass/regions/regions-dependent-autofn.rs index 246dbb5563c1c..bd38cb8b6611f 100644 --- a/src/test/run-pass/regions/regions-dependent-autofn.rs +++ b/src/test/run-pass/regions/regions-dependent-autofn.rs @@ -2,7 +2,7 @@ // Test lifetimes are linked properly when we autoslice a vector. // Issue #3148. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): fn subslice(v: F) -> F where F: FnOnce() { v } diff --git a/src/test/run-pass/regions/regions-dependent-let-ref.rs b/src/test/run-pass/regions/regions-dependent-let-ref.rs index 94e3df4b3f1e8..0113ffaea43db 100644 --- a/src/test/run-pass/regions/regions-dependent-let-ref.rs +++ b/src/test/run-pass/regions/regions-dependent-let-ref.rs @@ -2,7 +2,7 @@ // Test lifetimes are linked properly when we take reference // to interior. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): struct Foo(isize); pub fn main() { diff --git a/src/test/run-pass/regions/regions-early-bound-lifetime-in-assoc-fn.rs b/src/test/run-pass/regions/regions-early-bound-lifetime-in-assoc-fn.rs index fe50a7dd1be33..dcc8a6b24511d 100644 --- a/src/test/run-pass/regions/regions-early-bound-lifetime-in-assoc-fn.rs +++ b/src/test/run-pass/regions/regions-early-bound-lifetime-in-assoc-fn.rs @@ -6,7 +6,7 @@ // lifetime parameters must be early bound in the type of the // associated item. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): use std::marker; diff --git a/src/test/run-pass/regions/regions-early-bound-trait-param.rs b/src/test/run-pass/regions/regions-early-bound-trait-param.rs index c71e47db22d41..3bd8a181281e3 100644 --- a/src/test/run-pass/regions/regions-early-bound-trait-param.rs +++ b/src/test/run-pass/regions/regions-early-bound-trait-param.rs @@ -122,7 +122,7 @@ pub fn main() { assert_eq!(object_invoke2(&*m), 5); // The RefMakerTrait above is pretty strange (i.e., it is strange - // to consume a value of type T and return a &T). Easiest thing + // to consume a value of type T and return a &T). Easiest thing // that came to my mind: consume a cell of a linked list and // return a reference to the list it points to. let l0 = List::Null; diff --git a/src/test/run-pass/regions/regions-expl-self.rs b/src/test/run-pass/regions/regions-expl-self.rs index f7315d628a57e..857ee90917676 100644 --- a/src/test/run-pass/regions/regions-expl-self.rs +++ b/src/test/run-pass/regions/regions-expl-self.rs @@ -2,7 +2,7 @@ #![allow(dead_code)] // Test that you can insert an explicit lifetime in explicit self. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): struct Foo { f: usize diff --git a/src/test/run-pass/regions/regions-fn-subtyping-2.rs b/src/test/run-pass/regions/regions-fn-subtyping-2.rs index cbd88ebde0d1e..2af3d408c9d90 100644 --- a/src/test/run-pass/regions/regions-fn-subtyping-2.rs +++ b/src/test/run-pass/regions/regions-fn-subtyping-2.rs @@ -5,7 +5,7 @@ // Here, `f` is a function that takes a pointer `x` and a function // `g`, where `g` requires its argument `y` to be in the same region // that `x` is in. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): fn has_same_region(f: Box FnMut(&'a isize, Box)>) { // `f` should be the type that `wants_same_region` wants, but diff --git a/src/test/run-pass/regions/regions-fn-subtyping.rs b/src/test/run-pass/regions/regions-fn-subtyping.rs index a1da966659a21..b5bce82dcef6d 100644 --- a/src/test/run-pass/regions/regions-fn-subtyping.rs +++ b/src/test/run-pass/regions/regions-fn-subtyping.rs @@ -3,7 +3,7 @@ #![allow(unused_assignments)] // Issue #2263. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![allow(unused_variables)] @@ -11,9 +11,9 @@ fn ok(f: Box) { // Here, g is a function that can accept a usize pointer with // lifetime r, and f is a function that can accept a usize pointer - // with any lifetime. The assignment g = f should be OK (i.e., + // with any lifetime. The assignment g = f should be OK (i.e., // f's type should be a subtype of g's type), because f can be - // used in any context that expects g's type. But this currently + // used in any context that expects g's type. But this currently // fails. let mut g: Box FnMut(&'r usize)> = Box::new(|x| { }); g = f; diff --git a/src/test/run-pass/regions/regions-infer-borrow-scope-addr-of.rs b/src/test/run-pass/regions/regions-infer-borrow-scope-addr-of.rs index 5d8ad932ed61c..627b51885ebb0 100644 --- a/src/test/run-pass/regions/regions-infer-borrow-scope-addr-of.rs +++ b/src/test/run-pass/regions/regions-infer-borrow-scope-addr-of.rs @@ -8,7 +8,7 @@ pub fn main() { for i in 0_usize..3 { // ensure that the borrow in this alt // does not interfere with the swap - // below. note that it would it you + // below. note that it would it you // naively borrowed &x for the lifetime // of the variable x, as we once did match i { diff --git a/src/test/run-pass/regions/regions-infer-reborrow-ref-mut-recurse.rs b/src/test/run-pass/regions/regions-infer-reborrow-ref-mut-recurse.rs index 31a48b4adcfaf..2913a54de9c14 100644 --- a/src/test/run-pass/regions/regions-infer-reborrow-ref-mut-recurse.rs +++ b/src/test/run-pass/regions/regions-infer-reborrow-ref-mut-recurse.rs @@ -3,7 +3,7 @@ // Test an edge case in region inference: the lifetime of the borrow // of `*x` must be extended to at least 'a. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): fn foo<'a,'b>(x: &'a &'b mut isize) -> &'a isize { let y = &*x; // should be inferred to have type &'a &'b mut isize... diff --git a/src/test/run-pass/regions/regions-infer-region-in-fn-but-not-type.rs b/src/test/run-pass/regions/regions-infer-region-in-fn-but-not-type.rs index dff36e6d183b9..4729958fd8741 100644 --- a/src/test/run-pass/regions/regions-infer-region-in-fn-but-not-type.rs +++ b/src/test/run-pass/regions/regions-infer-region-in-fn-but-not-type.rs @@ -6,7 +6,7 @@ // check that the &isize here does not cause us to think that `foo` // contains region pointers -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): struct foo(Box); diff --git a/src/test/run-pass/regions/regions-infer-static-from-proc.rs b/src/test/run-pass/regions/regions-infer-static-from-proc.rs index 39501e2d697a3..e4fa079b5aabe 100644 --- a/src/test/run-pass/regions/regions-infer-static-from-proc.rs +++ b/src/test/run-pass/regions/regions-infer-static-from-proc.rs @@ -5,7 +5,7 @@ // region variables contained within (otherwise, region inference will // give `x` a very short lifetime). -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): static i: usize = 3; fn foo(_: F) {} diff --git a/src/test/run-pass/regions/regions-issue-21422.rs b/src/test/run-pass/regions/regions-issue-21422.rs index 198b714664789..22032267482e3 100644 --- a/src/test/run-pass/regions/regions-issue-21422.rs +++ b/src/test/run-pass/regions/regions-issue-21422.rs @@ -3,7 +3,7 @@ // add inference constraints that the operands of a binary operator // should outlive the binary operation itself. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): pub struct P<'a> { _ptr: *const &'a u8, diff --git a/src/test/run-pass/regions/regions-issue-22246.rs b/src/test/run-pass/regions/regions-issue-22246.rs index 0858833678bfa..0ff75375117b1 100644 --- a/src/test/run-pass/regions/regions-issue-22246.rs +++ b/src/test/run-pass/regions/regions-issue-22246.rs @@ -3,7 +3,7 @@ // Regression test for issue #22246 -- we should be able to deduce // that `&'a B::Owned` implies that `B::Owned : 'a`. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![allow(dead_code)] diff --git a/src/test/run-pass/regions/regions-lifetime-nonfree-late-bound.rs b/src/test/run-pass/regions/regions-lifetime-nonfree-late-bound.rs index 189f617202968..3dbebb367558e 100644 --- a/src/test/run-pass/regions/regions-lifetime-nonfree-late-bound.rs +++ b/src/test/run-pass/regions/regions-lifetime-nonfree-late-bound.rs @@ -8,12 +8,12 @@ // // However, those encounters were occurring within the lexical scope // of the binding for the late-bound lifetime; that is, the late-bound -// lifetimes were perfectly valid. The core problem was that the type +// lifetimes were perfectly valid. The core problem was that the type // folding code was over-zealously passing back all lifetimes when // doing region-folding, when really all clients of the region-folding // case only want to see FREE lifetime variables, not bound ones. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![feature(box_syntax)] diff --git a/src/test/run-pass/regions/regions-link-fn-args.rs b/src/test/run-pass/regions/regions-link-fn-args.rs index 231407b226ee9..908cfa7a9d9d1 100644 --- a/src/test/run-pass/regions/regions-link-fn-args.rs +++ b/src/test/run-pass/regions/regions-link-fn-args.rs @@ -2,7 +2,7 @@ // Test that region inference correctly links up the regions when a // `ref` borrow occurs inside a fn argument. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![allow(dead_code)] diff --git a/src/test/run-pass/regions/regions-lub-ref-ref-rc.rs b/src/test/run-pass/regions/regions-lub-ref-ref-rc.rs index cd095f6f3a4a3..6bd655cfe06f5 100644 --- a/src/test/run-pass/regions/regions-lub-ref-ref-rc.rs +++ b/src/test/run-pass/regions/regions-lub-ref-ref-rc.rs @@ -3,7 +3,7 @@ // Test a corner case of LUB coercion. In this case, one arm of the // match requires a deref coercion and the other doesn't, and there // is an extra `&` on the `rc`. We want to be sure that the lifetime -// assigned to this `&rc` value is not `'a` but something smaller. In +// assigned to this `&rc` value is not `'a` but something smaller. In // other words, the type from `rc` is `&'a Rc` and the type // from `&rc` should be `&'x &'a Rc`, where `'x` is something // small. diff --git a/src/test/run-pass/regions/regions-mock-codegen.rs b/src/test/run-pass/regions/regions-mock-codegen.rs index 521ef3f6a4b52..95b0d1cb4a792 100644 --- a/src/test/run-pass/regions/regions-mock-codegen.rs +++ b/src/test/run-pass/regions/regions-mock-codegen.rs @@ -2,7 +2,7 @@ #![allow(dead_code)] #![allow(non_camel_case_types)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![feature(allocator_api)] diff --git a/src/test/run-pass/regions/regions-no-bound-in-argument-cleanup.rs b/src/test/run-pass/regions/regions-no-bound-in-argument-cleanup.rs index aafab5d86b865..deb75de20a4d5 100644 --- a/src/test/run-pass/regions/regions-no-bound-in-argument-cleanup.rs +++ b/src/test/run-pass/regions/regions-no-bound-in-argument-cleanup.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): use std::marker; diff --git a/src/test/run-pass/regions/regions-nullary-variant.rs b/src/test/run-pass/regions/regions-nullary-variant.rs index 82470af82faf3..24a320d2823d2 100644 --- a/src/test/run-pass/regions/regions-nullary-variant.rs +++ b/src/test/run-pass/regions/regions-nullary-variant.rs @@ -2,7 +2,7 @@ #![allow(dead_code)] #![allow(non_camel_case_types)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): enum roption<'a> { a, b(&'a usize) diff --git a/src/test/run-pass/regions/regions-reassign-let-bound-pointer.rs b/src/test/run-pass/regions/regions-reassign-let-bound-pointer.rs index 948b11e0f3023..65bcf2667cf82 100644 --- a/src/test/run-pass/regions/regions-reassign-let-bound-pointer.rs +++ b/src/test/run-pass/regions/regions-reassign-let-bound-pointer.rs @@ -5,7 +5,7 @@ // started out with a longer lifetime and was reassigned to a shorter // one (it should infer to be the intersection). -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): fn foo(x: &isize) { let a = 1; diff --git a/src/test/run-pass/regions/regions-reassign-match-bound-pointer.rs b/src/test/run-pass/regions/regions-reassign-match-bound-pointer.rs index ca52659c4db14..5bd24e954af08 100644 --- a/src/test/run-pass/regions/regions-reassign-match-bound-pointer.rs +++ b/src/test/run-pass/regions/regions-reassign-match-bound-pointer.rs @@ -5,7 +5,7 @@ // started out with a longer lifetime and was reassigned to a shorter // one (it should infer to be the intersection). -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): fn foo(x: &isize) { let a = 1; diff --git a/src/test/run-pass/regions/regions-relate-bound-regions-on-closures-to-inference-variables.rs b/src/test/run-pass/regions/regions-relate-bound-regions-on-closures-to-inference-variables.rs index f26ef85ef7234..8436e2a1e0605 100644 --- a/src/test/run-pass/regions/regions-relate-bound-regions-on-closures-to-inference-variables.rs +++ b/src/test/run-pass/regions/regions-relate-bound-regions-on-closures-to-inference-variables.rs @@ -1,10 +1,11 @@ // run-pass + #![allow(dead_code)] // Test that this fairly specialized, but also reasonable, pattern -// typechecks. The pattern involves regions bound in closures that +// type-checks. The pattern involves regions bound in closures that // wind up related to inference variables. // -// NB. Changes to the region implementations have broken this pattern +// N.B., changes to the region implementations have broken this pattern // a few times, but it happens to be used in the compiler so those // changes were caught. However, those uses in the compiler could // easily get changed or refactored away in the future. diff --git a/src/test/run-pass/regions/regions-scope-chain-example.rs b/src/test/run-pass/regions/regions-scope-chain-example.rs index 2beb20add32e0..cabbdb0b11892 100644 --- a/src/test/run-pass/regions/regions-scope-chain-example.rs +++ b/src/test/run-pass/regions/regions-scope-chain-example.rs @@ -1,4 +1,5 @@ // run-pass + #![allow(dead_code)] #![allow(unused_variables)] // This is an example where the older inference algorithm failed. The @@ -7,9 +8,9 @@ // mutual supertype of both sides of the `if` it would be faced with a // choice of tightening bounds or unifying variables and it took the // wrong path. The new algorithm avoids this problem and hence this -// example typechecks correctly. +// example type-checks correctly. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): enum ScopeChain<'a> { Link(Scope<'a>), diff --git a/src/test/run-pass/regions/regions-variance-contravariant-use-contravariant.rs b/src/test/run-pass/regions/regions-variance-contravariant-use-contravariant.rs index f10d5a25f1628..45d112c2940c5 100644 --- a/src/test/run-pass/regions/regions-variance-contravariant-use-contravariant.rs +++ b/src/test/run-pass/regions/regions-variance-contravariant-use-contravariant.rs @@ -7,7 +7,7 @@ // Note: see compile-fail/variance-regions-*.rs for the tests that check that the // variance inference works in the first place. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): struct Contravariant<'a> { f: &'a isize diff --git a/src/test/run-pass/regions/regions-variance-covariant-use-covariant.rs b/src/test/run-pass/regions/regions-variance-covariant-use-covariant.rs index 9316aa15d32a3..5f2d45afa0bf9 100644 --- a/src/test/run-pass/regions/regions-variance-covariant-use-covariant.rs +++ b/src/test/run-pass/regions/regions-variance-covariant-use-covariant.rs @@ -9,7 +9,7 @@ // This is covariant with respect to 'a, meaning that // Covariant<'foo> <: Covariant<'static> because // 'foo <= 'static -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): struct Covariant<'a> { f: extern "Rust" fn(&'a isize) diff --git a/src/test/run-pass/ret-none.rs b/src/test/run-pass/ret-none.rs index f23461faaf444..0c6714680b521 100644 --- a/src/test/run-pass/ret-none.rs +++ b/src/test/run-pass/ret-none.rs @@ -2,7 +2,7 @@ #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): enum option { none, some(T), } diff --git a/src/test/run-pass/return-nil.rs b/src/test/run-pass/return-nil.rs index f24df197234f8..ee6dc26e2d658 100644 --- a/src/test/run-pass/return-nil.rs +++ b/src/test/run-pass/return-nil.rs @@ -1,5 +1,10 @@ -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616) -fn f() { let x: () = (); return x; } +fn f() { + let x: () = (); + return x; +} -pub fn main() { let _x = f(); } +pub fn main() { + let _x = f(); +} diff --git a/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/structs.rs b/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/structs.rs index 3cd7234269e1d..7869414084701 100644 --- a/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/structs.rs +++ b/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/structs.rs @@ -7,7 +7,7 @@ extern crate structs; use structs::{NormalStruct, UnitStruct, TupleStruct}; // We only test matching here as we cannot create non-exhaustive -// structs from another crate. ie. they'll never pass in run-pass tests. +// structs from another crate; i.e., they'll never pass in run-pass tests. fn match_structs(ns: NormalStruct, ts: TupleStruct, us: UnitStruct) { let NormalStruct { first_field, second_field, .. } = ns; diff --git a/src/test/run-pass/self/explicit-self-closures.rs b/src/test/run-pass/self/explicit-self-closures.rs index 61be98fe3d3cd..48a58530a42c2 100644 --- a/src/test/run-pass/self/explicit-self-closures.rs +++ b/src/test/run-pass/self/explicit-self-closures.rs @@ -2,7 +2,7 @@ #![allow(dead_code)] // Test to make sure that explicit self params work inside closures -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): struct Box { x: usize diff --git a/src/test/run-pass/self/explicit_self_xcrate_exe.rs b/src/test/run-pass/self/explicit_self_xcrate_exe.rs index c3796f73ab5f7..a5a3e3934b943 100644 --- a/src/test/run-pass/self/explicit_self_xcrate_exe.rs +++ b/src/test/run-pass/self/explicit_self_xcrate_exe.rs @@ -1,7 +1,7 @@ // run-pass // aux-build:explicit_self_xcrate.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate explicit_self_xcrate; use explicit_self_xcrate::{Foo, Bar}; diff --git a/src/test/run-pass/self/self-impl.rs b/src/test/run-pass/self/self-impl.rs index 23d513e3fac07..031f4b6f6feb2 100644 --- a/src/test/run-pass/self/self-impl.rs +++ b/src/test/run-pass/self/self-impl.rs @@ -3,7 +3,7 @@ #![allow(unused_variables)] // Test that we can use `Self` types in impls in the expected way. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![feature(box_syntax)] diff --git a/src/test/run-pass/self/self-type-param.rs b/src/test/run-pass/self/self-type-param.rs index 6deae5f2d12f4..8a1a032067921 100644 --- a/src/test/run-pass/self/self-type-param.rs +++ b/src/test/run-pass/self/self-type-param.rs @@ -1,6 +1,6 @@ // run-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): trait MyTrait { fn f(&self) -> Self; diff --git a/src/test/run-pass/sepcomp/sepcomp-fns-backwards.rs b/src/test/run-pass/sepcomp/sepcomp-fns-backwards.rs index 96bcc260bdf5c..cf31685ca7443 100644 --- a/src/test/run-pass/sepcomp/sepcomp-fns-backwards.rs +++ b/src/test/run-pass/sepcomp/sepcomp-fns-backwards.rs @@ -6,7 +6,7 @@ // Test references to items that haven't been codegened yet. // Generate some code in the first compilation unit before declaring any -// modules. This ensures that the first module doesn't go into the same +// modules. This ensures that the first module doesn't go into the same // compilation unit as the top-level module. fn pad() -> usize { 0 } diff --git a/src/test/run-pass/sepcomp/sepcomp-fns.rs b/src/test/run-pass/sepcomp/sepcomp-fns.rs index c4ea17225b44e..c2cdee36a78ab 100644 --- a/src/test/run-pass/sepcomp/sepcomp-fns.rs +++ b/src/test/run-pass/sepcomp/sepcomp-fns.rs @@ -2,12 +2,12 @@ // ignore-bitrig // compile-flags: -C codegen-units=3 -// Test basic separate compilation functionality. The functions should be able +// Test basic separate compilation functionality. The functions should be able // to call each other even though they will be placed in different compilation // units. // Generate some code in the first compilation unit before declaring any -// modules. This ensures that the first module doesn't go into the same +// modules. This ensures that the first module doesn't go into the same // compilation unit as the top-level module. fn one() -> usize { 1 } diff --git a/src/test/run-pass/sepcomp/sepcomp-statics.rs b/src/test/run-pass/sepcomp/sepcomp-statics.rs index e0c6b268b177c..38130c695549e 100644 --- a/src/test/run-pass/sepcomp/sepcomp-statics.rs +++ b/src/test/run-pass/sepcomp/sepcomp-statics.rs @@ -12,7 +12,7 @@ const ONE: usize = 1; mod b { // Separate compilation always switches to the LLVM module with the fewest - // instructions. Make sure we have some instructions in this module so + // instructions. Make sure we have some instructions in this module so // that `a` and `b` don't go into the same compilation unit. fn pad() -> usize { 0 } diff --git a/src/test/run-pass/sepcomp/sepcomp-unwind.rs b/src/test/run-pass/sepcomp/sepcomp-unwind.rs index 01dbea08098bd..dc1d69c6f3a83 100644 --- a/src/test/run-pass/sepcomp/sepcomp-unwind.rs +++ b/src/test/run-pass/sepcomp/sepcomp-unwind.rs @@ -8,7 +8,7 @@ // According to acrichto, in the distant past `ld -r` (which is used during // linking when codegen-units > 1) was known to produce object files with -// damaged unwinding tables. This may be related to GNU binutils bug #6893 +// damaged unwinding tables. This may be related to GNU binutils bug #6893 // ("Partial linking results in corrupt .eh_frame_hdr"), but I'm not certain. // In any case, this test should let us know if enabling parallel codegen ever // breaks unwinding. diff --git a/src/test/run-pass/simd/simd-generics.rs b/src/test/run-pass/simd/simd-generics.rs index ab6caee9d7bce..7369ef2999d1f 100644 --- a/src/test/run-pass/simd/simd-generics.rs +++ b/src/test/run-pass/simd/simd-generics.rs @@ -15,7 +15,7 @@ extern "platform-intrinsic" { fn simd_add(x: T, y: T) -> T; } -fn add>(lhs: T, rhs: T) -> T { +fn add>(lhs: T, rhs: T) -> T { lhs + rhs } diff --git a/src/test/run-pass/simd/simd-intrinsic-float-minmax.rs b/src/test/run-pass/simd/simd-intrinsic-float-minmax.rs index 350bc434935b3..4a8eb1793bf85 100644 --- a/src/test/run-pass/simd/simd-intrinsic-float-minmax.rs +++ b/src/test/run-pass/simd/simd-intrinsic-float-minmax.rs @@ -24,7 +24,7 @@ fn main() { #[cfg(not(any(target_arch = "mips", target_arch = "mips64")))] let nan = ::std::f32::NAN; // MIPS hardware treats f32::NAN as SNAN. Clear the signaling bit. - // See https://github.com/rust-lang/rust/issues/52746. + // See issue #52746. #[cfg(any(target_arch = "mips", target_arch = "mips64"))] let nan = f32::from_bits(::std::f32::NAN.to_bits() - 1); diff --git a/src/test/run-pass/simd/simd-type.rs b/src/test/run-pass/simd/simd-type.rs index e7b9bfe32f8df..6eb9f6c59769d 100644 --- a/src/test/run-pass/simd/simd-type.rs +++ b/src/test/run-pass/simd/simd-type.rs @@ -1,7 +1,7 @@ // run-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![feature(repr_simd)] diff --git a/src/test/run-pass/sized-borrowed-pointer.rs b/src/test/run-pass/sized-borrowed-pointer.rs index e5d55761539a4..5d403fbdfb864 100644 --- a/src/test/run-pass/sized-borrowed-pointer.rs +++ b/src/test/run-pass/sized-borrowed-pointer.rs @@ -1,7 +1,7 @@ #![allow(dead_code)] // Possibly-dynamic size of typaram should be cleared at pointer boundary. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): fn bar() { } fn foo() { bar::<&T>() } diff --git a/src/test/run-pass/sized-owned-pointer.rs b/src/test/run-pass/sized-owned-pointer.rs index 8dd3227ba8875..6f2c22e70568f 100644 --- a/src/test/run-pass/sized-owned-pointer.rs +++ b/src/test/run-pass/sized-owned-pointer.rs @@ -2,7 +2,7 @@ // Possibly-dynamic size of typaram should be cleared at pointer boundary. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): fn bar() { } fn foo() { bar::>() } diff --git a/src/test/run-pass/snake-case-no-lowercase-equivalent.rs b/src/test/run-pass/snake-case-no-lowercase-equivalent.rs index cf7a163c4c97b..dab6aa2eec71e 100644 --- a/src/test/run-pass/snake-case-no-lowercase-equivalent.rs +++ b/src/test/run-pass/snake-case-no-lowercase-equivalent.rs @@ -1,5 +1,5 @@ #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![feature(non_ascii_idents)] #![deny(non_snake_case)] diff --git a/src/test/run-pass/specialization/specialization-translate-projections-with-lifetimes.rs b/src/test/run-pass/specialization/specialization-translate-projections-with-lifetimes.rs index 2e32e3ff02d3e..e165711beacbc 100644 --- a/src/test/run-pass/specialization/specialization-translate-projections-with-lifetimes.rs +++ b/src/test/run-pass/specialization/specialization-translate-projections-with-lifetimes.rs @@ -17,13 +17,13 @@ impl<'a> WithAssoc for &'a () { struct Cloned(I); impl<'a, I, T: 'a> Iterator for Cloned - where I: WithAssoc, T: Clone + where I: WithAssoc, T: Clone { fn next(&self) {} } impl<'a, I, T: 'a> Iterator for Cloned - where I: WithAssoc, T: Copy + where I: WithAssoc, T: Copy { } diff --git a/src/test/run-pass/specialization/specialization-translate-projections-with-params.rs b/src/test/run-pass/specialization/specialization-translate-projections-with-params.rs index bdc6501df44b8..96fc5e85991f4 100644 --- a/src/test/run-pass/specialization/specialization-translate-projections-with-params.rs +++ b/src/test/run-pass/specialization/specialization-translate-projections-with-params.rs @@ -14,7 +14,7 @@ trait WithAssoc { fn as_item(&self) -> &Self::Item; } -impl Trait for T where T: WithAssoc, U: Clone { +impl Trait for T where T: WithAssoc, U: Clone { fn convert(&self) -> U { self.as_item().clone() } diff --git a/src/test/run-pass/specialization/specialization-translate-projections.rs b/src/test/run-pass/specialization/specialization-translate-projections.rs index fcccb67902e58..a4049b36f894d 100644 --- a/src/test/run-pass/specialization/specialization-translate-projections.rs +++ b/src/test/run-pass/specialization/specialization-translate-projections.rs @@ -15,7 +15,7 @@ trait WithAssoc { fn to_item(&self) -> Self::Item; } -impl Trait for T where T: WithAssoc, U: Into { +impl Trait for T where T: WithAssoc, U: Into { fn to_u8(&self) -> u8 { self.to_item().into() } diff --git a/src/test/run-pass/stack-probes-lto.rs b/src/test/run-pass/stack-probes-lto.rs index 2705950b01424..3c4678c5dc37e 100644 --- a/src/test/run-pass/stack-probes-lto.rs +++ b/src/test/run-pass/stack-probes-lto.rs @@ -9,7 +9,7 @@ // ignore-wasm // ignore-cloudabi no processes // ignore-emscripten no processes -// ignore-musl FIXME #31506 +// ignore-musl FIXME(#31506): // ignore-pretty // compile-flags: -C lto // no-prefer-dynamic diff --git a/src/test/run-pass/stack-probes.rs b/src/test/run-pass/stack-probes.rs index ff264421cfbcf..3297cf8a0463a 100644 --- a/src/test/run-pass/stack-probes.rs +++ b/src/test/run-pass/stack-probes.rs @@ -9,7 +9,7 @@ // ignore-wasm // ignore-cloudabi no processes // ignore-emscripten no processes -// ignore-musl FIXME #31506 +// ignore-musl FIXME(#31506): use std::mem; use std::process::Command; diff --git a/src/test/run-pass/statics/static-fn-inline-xc.rs b/src/test/run-pass/statics/static-fn-inline-xc.rs index a400b9c8d5662..dd1ac02509ef3 100644 --- a/src/test/run-pass/statics/static-fn-inline-xc.rs +++ b/src/test/run-pass/statics/static-fn-inline-xc.rs @@ -1,7 +1,7 @@ // run-pass // aux-build:static_fn_inline_xc_aux.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate static_fn_inline_xc_aux as mycore; diff --git a/src/test/run-pass/statics/static-fn-trait-xc.rs b/src/test/run-pass/statics/static-fn-trait-xc.rs index 1d3126128c92b..49278249c8ab1 100644 --- a/src/test/run-pass/statics/static-fn-trait-xc.rs +++ b/src/test/run-pass/statics/static-fn-trait-xc.rs @@ -1,7 +1,7 @@ // run-pass // aux-build:static_fn_trait_xc_aux.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate static_fn_trait_xc_aux as mycore; diff --git a/src/test/run-pass/statics/static-methods-in-traits2.rs b/src/test/run-pass/statics/static-methods-in-traits2.rs index 2c43ff6a788cc..b70f99ca09148 100644 --- a/src/test/run-pass/statics/static-methods-in-traits2.rs +++ b/src/test/run-pass/statics/static-methods-in-traits2.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): pub trait Number: NumConv { fn from(n: T) -> Self; diff --git a/src/test/run-pass/structs-enums/class-cast-to-trait.rs b/src/test/run-pass/structs-enums/class-cast-to-trait.rs index 7fa60da6e5762..2f22ecee0bbc1 100644 --- a/src/test/run-pass/structs-enums/class-cast-to-trait.rs +++ b/src/test/run-pass/structs-enums/class-cast-to-trait.rs @@ -3,7 +3,7 @@ #![allow(unused_mut)] #![allow(non_camel_case_types)] -// ignore-freebsd FIXME fails on BSD +// ignore-freebsd FIXME: fails on BSD trait noisy { diff --git a/src/test/run-pass/structs-enums/class-dtor.rs b/src/test/run-pass/structs-enums/class-dtor.rs index ee1cac03c81e8..c07922e9d7268 100644 --- a/src/test/run-pass/structs-enums/class-dtor.rs +++ b/src/test/run-pass/structs-enums/class-dtor.rs @@ -2,7 +2,7 @@ #![allow(dead_code)] #![allow(non_camel_case_types)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): struct cat { done : extern fn(usize), diff --git a/src/test/run-pass/structs-enums/class-str-field.rs b/src/test/run-pass/structs-enums/class-str-field.rs index a3dc66aab129f..8d6622188588a 100644 --- a/src/test/run-pass/structs-enums/class-str-field.rs +++ b/src/test/run-pass/structs-enums/class-str-field.rs @@ -2,7 +2,7 @@ #![allow(dead_code)] #![allow(non_camel_case_types)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): struct cat { diff --git a/src/test/run-pass/structs-enums/class-typarams.rs b/src/test/run-pass/structs-enums/class-typarams.rs index 4b2d4b12ec9cd..c57bed8364620 100644 --- a/src/test/run-pass/structs-enums/class-typarams.rs +++ b/src/test/run-pass/structs-enums/class-typarams.rs @@ -2,7 +2,7 @@ #![allow(dead_code)] #![allow(non_camel_case_types)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): use std::marker::PhantomData; diff --git a/src/test/run-pass/structs-enums/classes-self-referential.rs b/src/test/run-pass/structs-enums/classes-self-referential.rs index 27d6ebf2c2a39..63be80ef380d4 100644 --- a/src/test/run-pass/structs-enums/classes-self-referential.rs +++ b/src/test/run-pass/structs-enums/classes-self-referential.rs @@ -3,7 +3,7 @@ #![allow(non_camel_case_types)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): struct kitten { cat: Option, diff --git a/src/test/run-pass/structs-enums/discrim-explicit-23030.rs b/src/test/run-pass/structs-enums/discrim-explicit-23030.rs index 211ca7e4e8feb..cab5782182e31 100644 --- a/src/test/run-pass/structs-enums/discrim-explicit-23030.rs +++ b/src/test/run-pass/structs-enums/discrim-explicit-23030.rs @@ -1,5 +1,5 @@ // run-pass -// Issue 23030: Workaround overflowing discriminant +// Issue #23030: Workaround overflowing discriminant // with explicit assignments. // See also compile-fail/overflow-discrim.rs, which shows what diff --git a/src/test/run-pass/structs-enums/enum-discrim-range-overflow.rs b/src/test/run-pass/structs-enums/enum-discrim-range-overflow.rs index 9c4c61e684b9c..c9272f58c2614 100644 --- a/src/test/run-pass/structs-enums/enum-discrim-range-overflow.rs +++ b/src/test/run-pass/structs-enums/enum-discrim-range-overflow.rs @@ -1,7 +1,7 @@ // run-pass #![allow(overflowing_literals)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): pub enum E64 { H64 = 0x7FFF_FFFF_FFFF_FFFF, diff --git a/src/test/run-pass/structs-enums/enum-export-inheritance.rs b/src/test/run-pass/structs-enums/enum-export-inheritance.rs index 6a36a004a7c94..68e571b8e929a 100644 --- a/src/test/run-pass/structs-enums/enum-export-inheritance.rs +++ b/src/test/run-pass/structs-enums/enum-export-inheritance.rs @@ -1,6 +1,6 @@ // run-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): mod a { pub enum Foo { diff --git a/src/test/run-pass/structs-enums/enum-variants.rs b/src/test/run-pass/structs-enums/enum-variants.rs index 9ac5aae726a00..2f6bf4bc40720 100644 --- a/src/test/run-pass/structs-enums/enum-variants.rs +++ b/src/test/run-pass/structs-enums/enum-variants.rs @@ -1,7 +1,7 @@ // run-pass #![allow(dead_code)] #![allow(unused_assignments)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![allow(unused_variables)] diff --git a/src/test/run-pass/structs-enums/enum-vec-initializer.rs b/src/test/run-pass/structs-enums/enum-vec-initializer.rs index 42ee8ba971ebd..0a4fe93594243 100644 --- a/src/test/run-pass/structs-enums/enum-vec-initializer.rs +++ b/src/test/run-pass/structs-enums/enum-vec-initializer.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): enum Flopsy { Bunny = 2 diff --git a/src/test/run-pass/structs-enums/export-abstract-tag.rs b/src/test/run-pass/structs-enums/export-abstract-tag.rs index 76ac73321d3cb..7201a3419eda3 100644 --- a/src/test/run-pass/structs-enums/export-abstract-tag.rs +++ b/src/test/run-pass/structs-enums/export-abstract-tag.rs @@ -4,7 +4,7 @@ // We can export tags without exporting the variants to create a simple // sort of ADT. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): mod foo { pub enum t { t1, } diff --git a/src/test/run-pass/structs-enums/export-tag-variant.rs b/src/test/run-pass/structs-enums/export-tag-variant.rs index 52e0aba0979a6..d7d06d54455ec 100644 --- a/src/test/run-pass/structs-enums/export-tag-variant.rs +++ b/src/test/run-pass/structs-enums/export-tag-variant.rs @@ -1,6 +1,6 @@ // run-pass #![allow(non_camel_case_types)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): mod foo { pub enum t { t1, } diff --git a/src/test/run-pass/structs-enums/foreign-struct.rs b/src/test/run-pass/structs-enums/foreign-struct.rs index ce02c8fb5c3a5..8643d66c890a2 100644 --- a/src/test/run-pass/structs-enums/foreign-struct.rs +++ b/src/test/run-pass/structs-enums/foreign-struct.rs @@ -4,7 +4,7 @@ // Passing enums by value -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): pub enum void { } diff --git a/src/test/run-pass/structs-enums/module-qualified-struct-destructure.rs b/src/test/run-pass/structs-enums/module-qualified-struct-destructure.rs index 57be37cdf2bbc..1418075824890 100644 --- a/src/test/run-pass/structs-enums/module-qualified-struct-destructure.rs +++ b/src/test/run-pass/structs-enums/module-qualified-struct-destructure.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): mod m { pub struct S { diff --git a/src/test/run-pass/structs-enums/namespaced-enum-emulate-flat-xc.rs b/src/test/run-pass/structs-enums/namespaced-enum-emulate-flat-xc.rs index 30cf645821d20..95e219da2eb17 100644 --- a/src/test/run-pass/structs-enums/namespaced-enum-emulate-flat-xc.rs +++ b/src/test/run-pass/structs-enums/namespaced-enum-emulate-flat-xc.rs @@ -3,7 +3,7 @@ // aux-build:namespaced_enum_emulate_flat.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate namespaced_enum_emulate_flat; diff --git a/src/test/run-pass/structs-enums/namespaced-enum-emulate-flat.rs b/src/test/run-pass/structs-enums/namespaced-enum-emulate-flat.rs index f6c395059ede5..7ad56ecdf7f2b 100644 --- a/src/test/run-pass/structs-enums/namespaced-enum-emulate-flat.rs +++ b/src/test/run-pass/structs-enums/namespaced-enum-emulate-flat.rs @@ -1,6 +1,6 @@ // run-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): pub use Foo::*; use nest::{Bar, D, E, F}; diff --git a/src/test/run-pass/structs-enums/namespaced-enum-glob-import-xcrate.rs b/src/test/run-pass/structs-enums/namespaced-enum-glob-import-xcrate.rs index d2ccadea00778..7bca20e017e57 100644 --- a/src/test/run-pass/structs-enums/namespaced-enum-glob-import-xcrate.rs +++ b/src/test/run-pass/structs-enums/namespaced-enum-glob-import-xcrate.rs @@ -1,7 +1,7 @@ // run-pass // aux-build:namespaced_enums.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate namespaced_enums; diff --git a/src/test/run-pass/structs-enums/namespaced-enum-glob-import.rs b/src/test/run-pass/structs-enums/namespaced-enum-glob-import.rs index f36ac69dc0886..07d73fc16bf1e 100644 --- a/src/test/run-pass/structs-enums/namespaced-enum-glob-import.rs +++ b/src/test/run-pass/structs-enums/namespaced-enum-glob-import.rs @@ -1,6 +1,6 @@ // run-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): mod m2 { pub enum Foo { diff --git a/src/test/run-pass/structs-enums/namespaced-enums-xcrate.rs b/src/test/run-pass/structs-enums/namespaced-enums-xcrate.rs index 5e10c3ec1d0f8..fd45fd379db5e 100644 --- a/src/test/run-pass/structs-enums/namespaced-enums-xcrate.rs +++ b/src/test/run-pass/structs-enums/namespaced-enums-xcrate.rs @@ -1,7 +1,7 @@ // run-pass // aux-build:namespaced_enums.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate namespaced_enums; diff --git a/src/test/run-pass/structs-enums/namespaced-enums.rs b/src/test/run-pass/structs-enums/namespaced-enums.rs index 6a2602501a541..8ba44500fe045 100644 --- a/src/test/run-pass/structs-enums/namespaced-enums.rs +++ b/src/test/run-pass/structs-enums/namespaced-enums.rs @@ -1,6 +1,6 @@ // run-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): enum Foo { A, diff --git a/src/test/run-pass/structs-enums/nested-enum-same-names.rs b/src/test/run-pass/structs-enums/nested-enum-same-names.rs index dece3dcd54b2f..14cc9b2713105 100644 --- a/src/test/run-pass/structs-enums/nested-enum-same-names.rs +++ b/src/test/run-pass/structs-enums/nested-enum-same-names.rs @@ -1,6 +1,6 @@ // run-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): /* diff --git a/src/test/run-pass/structs-enums/newtype-struct-with-dtor.rs b/src/test/run-pass/structs-enums/newtype-struct-with-dtor.rs index f73b492dfcfc1..07d8cb7784c5a 100644 --- a/src/test/run-pass/structs-enums/newtype-struct-with-dtor.rs +++ b/src/test/run-pass/structs-enums/newtype-struct-with-dtor.rs @@ -1,7 +1,7 @@ // run-pass #![allow(unused_unsafe)] #![allow(unused_variables)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): pub struct Fd(u32); diff --git a/src/test/run-pass/structs-enums/newtype-struct-xc-2.rs b/src/test/run-pass/structs-enums/newtype-struct-xc-2.rs index 40837321be2c3..b374bc952f16d 100644 --- a/src/test/run-pass/structs-enums/newtype-struct-xc-2.rs +++ b/src/test/run-pass/structs-enums/newtype-struct-xc-2.rs @@ -1,7 +1,7 @@ // run-pass // aux-build:newtype_struct_xc.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate newtype_struct_xc; use newtype_struct_xc::Au; diff --git a/src/test/run-pass/structs-enums/newtype-struct-xc.rs b/src/test/run-pass/structs-enums/newtype-struct-xc.rs index 0c6466d97fc94..b2ab2b1090021 100644 --- a/src/test/run-pass/structs-enums/newtype-struct-xc.rs +++ b/src/test/run-pass/structs-enums/newtype-struct-xc.rs @@ -1,7 +1,7 @@ // run-pass // aux-build:newtype_struct_xc.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate newtype_struct_xc; diff --git a/src/test/run-pass/structs-enums/object-lifetime-default-from-ref-struct.rs b/src/test/run-pass/structs-enums/object-lifetime-default-from-ref-struct.rs index 0a48725cbe44a..6fff1a963403f 100644 --- a/src/test/run-pass/structs-enums/object-lifetime-default-from-ref-struct.rs +++ b/src/test/run-pass/structs-enums/object-lifetime-default-from-ref-struct.rs @@ -2,7 +2,7 @@ // Test that the lifetime of the enclosing `&` is used for the object // lifetime bound. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![allow(dead_code)] diff --git a/src/test/run-pass/structs-enums/object-lifetime-default-from-rptr-struct.rs b/src/test/run-pass/structs-enums/object-lifetime-default-from-rptr-struct.rs index 48ee5a2ed5450..d3555cf9e7408 100644 --- a/src/test/run-pass/structs-enums/object-lifetime-default-from-rptr-struct.rs +++ b/src/test/run-pass/structs-enums/object-lifetime-default-from-rptr-struct.rs @@ -2,7 +2,7 @@ // Test that the lifetime from the enclosing `&` is "inherited" // through the `MyBox` struct. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![allow(dead_code)] diff --git a/src/test/run-pass/structs-enums/simple-generic-tag.rs b/src/test/run-pass/structs-enums/simple-generic-tag.rs index dbd2834d46857..7bd3912485f3b 100644 --- a/src/test/run-pass/structs-enums/simple-generic-tag.rs +++ b/src/test/run-pass/structs-enums/simple-generic-tag.rs @@ -4,7 +4,7 @@ -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): enum clam { a(T), } diff --git a/src/test/run-pass/structs-enums/struct-like-variant-construct.rs b/src/test/run-pass/structs-enums/struct-like-variant-construct.rs index 60fc7ce394c05..83876e84dd866 100644 --- a/src/test/run-pass/structs-enums/struct-like-variant-construct.rs +++ b/src/test/run-pass/structs-enums/struct-like-variant-construct.rs @@ -1,6 +1,6 @@ // run-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): enum Foo { Bar { diff --git a/src/test/run-pass/structs-enums/struct-variant-field-visibility.rs b/src/test/run-pass/structs-enums/struct-variant-field-visibility.rs index 7896c829a6e1f..3013385a6677b 100644 --- a/src/test/run-pass/structs-enums/struct-variant-field-visibility.rs +++ b/src/test/run-pass/structs-enums/struct-variant-field-visibility.rs @@ -1,6 +1,6 @@ // run-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): mod foo { pub enum Foo { diff --git a/src/test/run-pass/structs-enums/struct_variant_xc.rs b/src/test/run-pass/structs-enums/struct_variant_xc.rs index 9c8d1a69a3e9e..2e59233be7ec4 100644 --- a/src/test/run-pass/structs-enums/struct_variant_xc.rs +++ b/src/test/run-pass/structs-enums/struct_variant_xc.rs @@ -1,6 +1,6 @@ // run-pass // aux-build:struct_variant_xc_aux.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate struct_variant_xc_aux; diff --git a/src/test/run-pass/structs-enums/tag-exports.rs b/src/test/run-pass/structs-enums/tag-exports.rs index 1bcb7d35da38a..aee618a991eaa 100644 --- a/src/test/run-pass/structs-enums/tag-exports.rs +++ b/src/test/run-pass/structs-enums/tag-exports.rs @@ -2,7 +2,7 @@ #![allow(dead_code)] #![allow(non_camel_case_types)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): use alder::*; diff --git a/src/test/run-pass/structs-enums/tag-in-block.rs b/src/test/run-pass/structs-enums/tag-in-block.rs index 03d4dd9b0abcd..02ad2c6a75c0a 100644 --- a/src/test/run-pass/structs-enums/tag-in-block.rs +++ b/src/test/run-pass/structs-enums/tag-in-block.rs @@ -4,7 +4,7 @@ -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): fn foo() { fn zed(_z: bar) { } diff --git a/src/test/run-pass/structs-enums/tag-variant-disr-type-mismatch.rs b/src/test/run-pass/structs-enums/tag-variant-disr-type-mismatch.rs index 3f59db383107d..7cfb1a0831dda 100644 --- a/src/test/run-pass/structs-enums/tag-variant-disr-type-mismatch.rs +++ b/src/test/run-pass/structs-enums/tag-variant-disr-type-mismatch.rs @@ -2,7 +2,7 @@ #![allow(dead_code)] #![allow(non_camel_case_types)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): enum color { red = 1, diff --git a/src/test/run-pass/structs-enums/tuple-struct-trivial.rs b/src/test/run-pass/structs-enums/tuple-struct-trivial.rs index c8651fd29dedf..ac99ea0a1bac0 100644 --- a/src/test/run-pass/structs-enums/tuple-struct-trivial.rs +++ b/src/test/run-pass/structs-enums/tuple-struct-trivial.rs @@ -1,6 +1,6 @@ // run-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): struct Foo(isize, isize, isize); diff --git a/src/test/run-pass/structs-enums/variant-structs-trivial.rs b/src/test/run-pass/structs-enums/variant-structs-trivial.rs index 31fa610a69d95..ebe4711296270 100644 --- a/src/test/run-pass/structs-enums/variant-structs-trivial.rs +++ b/src/test/run-pass/structs-enums/variant-structs-trivial.rs @@ -1,6 +1,6 @@ // run-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): enum Foo { Bar { x: isize }, diff --git a/src/test/run-pass/super.rs b/src/test/run-pass/super.rs index e378aac8be413..6c291578b89a9 100644 --- a/src/test/run-pass/super.rs +++ b/src/test/run-pass/super.rs @@ -1,5 +1,5 @@ #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): pub mod a { pub fn f() {} diff --git a/src/test/run-pass/svh-add-nothing.rs b/src/test/run-pass/svh-add-nothing.rs index b673fa55e3817..96d994b27e603 100644 --- a/src/test/run-pass/svh-add-nothing.rs +++ b/src/test/run-pass/svh-add-nothing.rs @@ -3,7 +3,7 @@ // aux-build:svh-b.rs // aux-build:svh-a-base.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate a; extern crate b; diff --git a/src/test/run-pass/swap-overlapping.rs b/src/test/run-pass/swap-overlapping.rs index 31fd9ce7d1a49..c7b35a3ec028c 100644 --- a/src/test/run-pass/swap-overlapping.rs +++ b/src/test/run-pass/swap-overlapping.rs @@ -1,7 +1,7 @@ #![allow(dead_code)] // Issue #5041 - avoid overlapping memcpy when src and dest of a swap are the same -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): use std::ptr; diff --git a/src/test/run-pass/tail-call-arg-leak.rs b/src/test/run-pass/tail-call-arg-leak.rs index 53ec5ea7ff7ba..0faf6f1c58455 100644 --- a/src/test/run-pass/tail-call-arg-leak.rs +++ b/src/test/run-pass/tail-call-arg-leak.rs @@ -1,5 +1,5 @@ // use of tail calls causes arg slot leaks, issue #160. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): fn inner(dummy: String, b: bool) { if b { return inner(dummy, false); } } diff --git a/src/test/run-pass/threads-sendsync/send-resource.rs b/src/test/run-pass/threads-sendsync/send-resource.rs index 023a84d6b6ec0..4f47e0a2e1098 100644 --- a/src/test/run-pass/threads-sendsync/send-resource.rs +++ b/src/test/run-pass/threads-sendsync/send-resource.rs @@ -3,7 +3,7 @@ #![allow(dead_code)] #![allow(non_camel_case_types)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): // ignore-emscripten no threads support use std::thread; diff --git a/src/test/run-pass/threads-sendsync/send-type-inference.rs b/src/test/run-pass/threads-sendsync/send-type-inference.rs index 0d9af7512b466..f245c09f3c616 100644 --- a/src/test/run-pass/threads-sendsync/send-type-inference.rs +++ b/src/test/run-pass/threads-sendsync/send-type-inference.rs @@ -2,7 +2,7 @@ #![allow(unused_must_use)] #![allow(dead_code)] #![allow(unused_mut)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): use std::sync::mpsc::{channel, Sender}; diff --git a/src/test/run-pass/threads-sendsync/sendable-class.rs b/src/test/run-pass/threads-sendsync/sendable-class.rs index 7facf245bde42..7963b96305f9a 100644 --- a/src/test/run-pass/threads-sendsync/sendable-class.rs +++ b/src/test/run-pass/threads-sendsync/sendable-class.rs @@ -6,7 +6,7 @@ // Test that a class with only sendable fields can be sent -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): use std::sync::mpsc::channel; diff --git a/src/test/run-pass/threads-sendsync/std-sync-right-kind-impls.rs b/src/test/run-pass/threads-sendsync/std-sync-right-kind-impls.rs index bc64c8162433b..3d778bd0be704 100644 --- a/src/test/run-pass/threads-sendsync/std-sync-right-kind-impls.rs +++ b/src/test/run-pass/threads-sendsync/std-sync-right-kind-impls.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): use std::sync; diff --git a/src/test/run-pass/threads-sendsync/sync-send-atomics.rs b/src/test/run-pass/threads-sendsync/sync-send-atomics.rs index 0466f4f0e9ddc..2a76492f819a2 100644 --- a/src/test/run-pass/threads-sendsync/sync-send-atomics.rs +++ b/src/test/run-pass/threads-sendsync/sync-send-atomics.rs @@ -1,6 +1,6 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): use std::sync::atomic::*; diff --git a/src/test/run-pass/threads-sendsync/sync-send-iterators-in-libcore.rs b/src/test/run-pass/threads-sendsync/sync-send-iterators-in-libcore.rs index 903bbf5163443..61d2616d0e91a 100644 --- a/src/test/run-pass/threads-sendsync/sync-send-iterators-in-libcore.rs +++ b/src/test/run-pass/threads-sendsync/sync-send-iterators-in-libcore.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![allow(warnings)] #![feature(iter_empty)] diff --git a/src/test/run-pass/threads-sendsync/task-comm-11.rs b/src/test/run-pass/threads-sendsync/task-comm-11.rs index 8541e143fb976..286345713bee0 100644 --- a/src/test/run-pass/threads-sendsync/task-comm-11.rs +++ b/src/test/run-pass/threads-sendsync/task-comm-11.rs @@ -1,6 +1,6 @@ // run-pass #![allow(unused_must_use)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): // ignore-emscripten no threads support use std::sync::mpsc::{channel, Sender}; diff --git a/src/test/run-pass/threads-sendsync/task-comm-15.rs b/src/test/run-pass/threads-sendsync/task-comm-15.rs index adb14abdce9df..125768be68926 100644 --- a/src/test/run-pass/threads-sendsync/task-comm-15.rs +++ b/src/test/run-pass/threads-sendsync/task-comm-15.rs @@ -1,7 +1,7 @@ // run-pass #![allow(unused_must_use)] // ignore-emscripten no threads support -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): use std::sync::mpsc::{channel, Sender}; use std::thread; diff --git a/src/test/run-pass/threads-sendsync/task-comm-17.rs b/src/test/run-pass/threads-sendsync/task-comm-17.rs index 7224978709371..964573387b2dd 100644 --- a/src/test/run-pass/threads-sendsync/task-comm-17.rs +++ b/src/test/run-pass/threads-sendsync/task-comm-17.rs @@ -1,7 +1,7 @@ // run-pass #![allow(unused_must_use)] // ignore-emscripten no threads support -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): // Issue #922 diff --git a/src/test/run-pass/threads-sendsync/task-life-0.rs b/src/test/run-pass/threads-sendsync/task-life-0.rs index 785cff9a0f304..aa526c062f43f 100644 --- a/src/test/run-pass/threads-sendsync/task-life-0.rs +++ b/src/test/run-pass/threads-sendsync/task-life-0.rs @@ -1,7 +1,7 @@ // run-pass #![allow(unused_must_use)] // ignore-emscripten no threads support -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): use std::thread; diff --git a/src/test/run-pass/trailing-comma.rs b/src/test/run-pass/trailing-comma.rs index 197af295a42c7..30705334a585e 100644 --- a/src/test/run-pass/trailing-comma.rs +++ b/src/test/run-pass/trailing-comma.rs @@ -1,4 +1,4 @@ -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616) #![feature(slice_patterns)] diff --git a/src/test/run-pass/traits/astconv-cycle-between-trait-and-type.rs b/src/test/run-pass/traits/astconv-cycle-between-trait-and-type.rs index cc8f9dc519084..3f3fdf53a26ee 100644 --- a/src/test/run-pass/traits/astconv-cycle-between-trait-and-type.rs +++ b/src/test/run-pass/traits/astconv-cycle-between-trait-and-type.rs @@ -4,7 +4,7 @@ // carries a predicate that references the trait (`u32 : Trait1`, // substituted). -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![allow(dead_code)] diff --git a/src/test/run-pass/traits/auxiliary/trait_inheritance_overloading_xc.rs b/src/test/run-pass/traits/auxiliary/trait_inheritance_overloading_xc.rs index a25704412262d..311036dac0d25 100644 --- a/src/test/run-pass/traits/auxiliary/trait_inheritance_overloading_xc.rs +++ b/src/test/run-pass/traits/auxiliary/trait_inheritance_overloading_xc.rs @@ -1,7 +1,7 @@ use std::cmp::PartialEq; use std::ops::{Add, Sub, Mul}; -pub trait MyNum : Add + Sub + Mul + PartialEq + Clone { +pub trait MyNum : Add + Sub + Mul + PartialEq + Clone { } #[derive(Clone, Debug)] diff --git a/src/test/run-pass/traits/cycle-trait-type-trait.rs b/src/test/run-pass/traits/cycle-trait-type-trait.rs index c62d01403c7f8..047116bc386d3 100644 --- a/src/test/run-pass/traits/cycle-trait-type-trait.rs +++ b/src/test/run-pass/traits/cycle-trait-type-trait.rs @@ -3,7 +3,7 @@ // Test a case where a supertrait references a type that references // the original trait. This poses no problem at the moment. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): trait Chromosome: Get> { } diff --git a/src/test/run-pass/traits/impl-implicit-trait.rs b/src/test/run-pass/traits/impl-implicit-trait.rs index fac2bcce2481b..b6be1b92c97ca 100644 --- a/src/test/run-pass/traits/impl-implicit-trait.rs +++ b/src/test/run-pass/traits/impl-implicit-trait.rs @@ -2,7 +2,7 @@ #![allow(dead_code)] #![allow(non_camel_case_types)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): enum option_ { none_, diff --git a/src/test/run-pass/traits/multiple-trait-bounds.rs b/src/test/run-pass/traits/multiple-trait-bounds.rs index 868b334070bdd..82c78ce0b80c7 100644 --- a/src/test/run-pass/traits/multiple-trait-bounds.rs +++ b/src/test/run-pass/traits/multiple-trait-bounds.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): fn f(_: T) { } diff --git a/src/test/run-pass/traits/parameterized-trait-with-bounds.rs b/src/test/run-pass/traits/parameterized-trait-with-bounds.rs index b1339b207ebae..2d1e296c9f099 100644 --- a/src/test/run-pass/traits/parameterized-trait-with-bounds.rs +++ b/src/test/run-pass/traits/parameterized-trait-with-bounds.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![allow(dead_code)] diff --git a/src/test/run-pass/traits/supertrait-default-generics.rs b/src/test/run-pass/traits/supertrait-default-generics.rs index e862c0e976b31..9760d0c154f25 100644 --- a/src/test/run-pass/traits/supertrait-default-generics.rs +++ b/src/test/run-pass/traits/supertrait-default-generics.rs @@ -12,7 +12,7 @@ trait Positioned { fn X(&self) -> S; } -trait Movable>: Positioned { +trait Movable>: Positioned { fn translate(&mut self, dx: S) { let x = self.X() + dx; self.SetX(x); @@ -30,7 +30,7 @@ impl Positioned for Point { } } -impl> Movable for Point {} +impl> Movable for Point {} pub fn main() { let mut p = Point{ x: 1, y: 2}; diff --git a/src/test/run-pass/traits/syntax-trait-polarity.rs b/src/test/run-pass/traits/syntax-trait-polarity.rs index c6524f5c8e782..a86f17b9c3ef0 100644 --- a/src/test/run-pass/traits/syntax-trait-polarity.rs +++ b/src/test/run-pass/traits/syntax-trait-polarity.rs @@ -1,6 +1,6 @@ // run-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![feature(optin_builtin_traits)] diff --git a/src/test/run-pass/traits/trait-bounds-basic.rs b/src/test/run-pass/traits/trait-bounds-basic.rs index af6392e565859..f789713f03e3f 100644 --- a/src/test/run-pass/traits/trait-bounds-basic.rs +++ b/src/test/run-pass/traits/trait-bounds-basic.rs @@ -2,7 +2,7 @@ #![allow(dead_code)] #![allow(unconditional_recursion)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): trait Foo { } diff --git a/src/test/run-pass/traits/trait-bounds-impl-comparison-duplicates.rs b/src/test/run-pass/traits/trait-bounds-impl-comparison-duplicates.rs index de6c2afa2bbe1..9f1922ae3668f 100644 --- a/src/test/run-pass/traits/trait-bounds-impl-comparison-duplicates.rs +++ b/src/test/run-pass/traits/trait-bounds-impl-comparison-duplicates.rs @@ -3,7 +3,7 @@ // trait exactly, as long as the implementation doesn't demand *more* bounds // than the trait. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): trait A { fn foo(&self); diff --git a/src/test/run-pass/traits/trait-bounds-on-structs-and-enums.rs b/src/test/run-pass/traits/trait-bounds-on-structs-and-enums.rs index 18b25b852d173..523c7b04ef2f3 100644 --- a/src/test/run-pass/traits/trait-bounds-on-structs-and-enums.rs +++ b/src/test/run-pass/traits/trait-bounds-on-structs-and-enums.rs @@ -1,7 +1,7 @@ // run-pass #![allow(dead_code)] #![allow(unused_variables)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): trait U {} trait T { fn get(self) -> X; } diff --git a/src/test/run-pass/traits/trait-bounds-recursion.rs b/src/test/run-pass/traits/trait-bounds-recursion.rs index 0023ff654e84c..5a7bd5deddffa 100644 --- a/src/test/run-pass/traits/trait-bounds-recursion.rs +++ b/src/test/run-pass/traits/trait-bounds-recursion.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): trait I { fn i(&self) -> Self; } diff --git a/src/test/run-pass/traits/trait-cache-issue-18209.rs b/src/test/run-pass/traits/trait-cache-issue-18209.rs index 15676e4554aeb..062d733a44204 100644 --- a/src/test/run-pass/traits/trait-cache-issue-18209.rs +++ b/src/test/run-pass/traits/trait-cache-issue-18209.rs @@ -4,7 +4,7 @@ // // See issue #18209. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): pub trait Foo { fn load_from() -> Box; diff --git a/src/test/run-pass/traits/trait-composition-trivial.rs b/src/test/run-pass/traits/trait-composition-trivial.rs index 90e5dcd68e8c4..7d58252b10271 100644 --- a/src/test/run-pass/traits/trait-composition-trivial.rs +++ b/src/test/run-pass/traits/trait-composition-trivial.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): trait Foo { fn foo(&self); diff --git a/src/test/run-pass/traits/trait-false-ambiguity-where-clause-builtin-bound.rs b/src/test/run-pass/traits/trait-false-ambiguity-where-clause-builtin-bound.rs index 3413db6a6845b..a4330187480fe 100644 --- a/src/test/run-pass/traits/trait-false-ambiguity-where-clause-builtin-bound.rs +++ b/src/test/run-pass/traits/trait-false-ambiguity-where-clause-builtin-bound.rs @@ -3,7 +3,7 @@ // between the builtin rules for Sized and the where clause. Issue // #20959. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): fn foo(x: Option) where Option : Sized diff --git a/src/test/run-pass/traits/trait-impl-2.rs b/src/test/run-pass/traits/trait-impl-2.rs index b28d74a7b35b1..a32f352ef0c1f 100644 --- a/src/test/run-pass/traits/trait-impl-2.rs +++ b/src/test/run-pass/traits/trait-impl-2.rs @@ -2,7 +2,7 @@ #![allow(dead_code)] #![allow(non_snake_case)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): pub mod Foo { pub trait Trait { diff --git a/src/test/run-pass/traits/trait-inheritance-num.rs b/src/test/run-pass/traits/trait-inheritance-num.rs index 3d63d78cabb45..e14990c5c2df2 100644 --- a/src/test/run-pass/traits/trait-inheritance-num.rs +++ b/src/test/run-pass/traits/trait-inheritance-num.rs @@ -1,7 +1,7 @@ // run-pass #![allow(dead_code)] #![allow(unused_variables)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): pub trait NumExt: PartialEq + PartialOrd {} diff --git a/src/test/run-pass/traits/trait-inheritance-num0.rs b/src/test/run-pass/traits/trait-inheritance-num0.rs index cee52542d38d2..93f3b7ca72d33 100644 --- a/src/test/run-pass/traits/trait-inheritance-num0.rs +++ b/src/test/run-pass/traits/trait-inheritance-num0.rs @@ -2,7 +2,7 @@ #![allow(dead_code)] // Extending Num and using inherited static methods -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): use std::cmp::PartialOrd; diff --git a/src/test/run-pass/traits/trait-inheritance-num1.rs b/src/test/run-pass/traits/trait-inheritance-num1.rs index 663dd3a5eafdb..fa5bcf725cfba 100644 --- a/src/test/run-pass/traits/trait-inheritance-num1.rs +++ b/src/test/run-pass/traits/trait-inheritance-num1.rs @@ -1,6 +1,6 @@ // run-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): pub trait NumCast: Sized { fn from(i: i32) -> Option; diff --git a/src/test/run-pass/traits/trait-inheritance-num5.rs b/src/test/run-pass/traits/trait-inheritance-num5.rs index f478618f7b593..d399aa7485282 100644 --- a/src/test/run-pass/traits/trait-inheritance-num5.rs +++ b/src/test/run-pass/traits/trait-inheritance-num5.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): pub trait NumCast: Sized { fn from(i: i32) -> Option; diff --git a/src/test/run-pass/traits/trait-inheritance-overloading.rs b/src/test/run-pass/traits/trait-inheritance-overloading.rs index 083643e821f4b..fa834faf925d7 100644 --- a/src/test/run-pass/traits/trait-inheritance-overloading.rs +++ b/src/test/run-pass/traits/trait-inheritance-overloading.rs @@ -2,7 +2,7 @@ use std::cmp::PartialEq; use std::ops::{Add, Sub, Mul}; -trait MyNum : Add + Sub + Mul + PartialEq + Clone { } +trait MyNum : Add + Sub + Mul + PartialEq + Clone { } #[derive(Clone, Debug)] struct MyInt { val: isize } diff --git a/src/test/run-pass/traits/trait-where-clause-vs-impl.rs b/src/test/run-pass/traits/trait-where-clause-vs-impl.rs index 7cfee27efb32a..ef51e165e9d4e 100644 --- a/src/test/run-pass/traits/trait-where-clause-vs-impl.rs +++ b/src/test/run-pass/traits/trait-where-clause-vs-impl.rs @@ -6,7 +6,7 @@ // // Issue #18453. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): use std::rc::Rc; diff --git a/src/test/run-pass/traits/traits-conditional-dispatch.rs b/src/test/run-pass/traits/traits-conditional-dispatch.rs index a9c194486fecb..863bfd15a4cfa 100644 --- a/src/test/run-pass/traits/traits-conditional-dispatch.rs +++ b/src/test/run-pass/traits/traits-conditional-dispatch.rs @@ -1,5 +1,5 @@ // run-pass -// Test that we are able to resolve conditional dispatch. Here, the +// Test that we are able to resolve conditional dispatch. Here, the // blanket impl for T:Copy coexists with an impl for Box, because // Box does not impl Copy. diff --git a/src/test/run-pass/traits/traits-default-method-mut.rs b/src/test/run-pass/traits/traits-default-method-mut.rs index 5f8e983b09cfb..b43d493239319 100644 --- a/src/test/run-pass/traits/traits-default-method-mut.rs +++ b/src/test/run-pass/traits/traits-default-method-mut.rs @@ -1,6 +1,6 @@ // run-pass #![allow(unused_assignments)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![allow(unused_variables)] diff --git a/src/test/run-pass/traits/traits-issue-22019.rs b/src/test/run-pass/traits/traits-issue-22019.rs index 1a887f0f39f6b..0008bd89f6ad0 100644 --- a/src/test/run-pass/traits/traits-issue-22019.rs +++ b/src/test/run-pass/traits/traits-issue-22019.rs @@ -3,7 +3,7 @@ // distinct scopes to be compared (`'g` and `'h`). The only important // thing is that compilation succeeds here. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![allow(missing_copy_implementations)] #![allow(unused_variables)] @@ -16,18 +16,18 @@ pub type Node<'a> = &'a CFGNode; pub trait GraphWalk<'c, N> { /// Returns all the nodes in this graph. - fn nodes(&'c self) where [N]:ToOwned>; + fn nodes(&'c self) where [N]:ToOwned>; } impl<'g> GraphWalk<'g, Node<'g>> for u32 { - fn nodes(&'g self) where [Node<'g>]:ToOwned>> + fn nodes(&'g self) where [Node<'g>]:ToOwned>> { loop { } } } impl<'h> GraphWalk<'h, Node<'h>> for u64 { - fn nodes(&'h self) where [Node<'h>]:ToOwned>> + fn nodes(&'h self) where [Node<'h>]:ToOwned>> { loop { } } } diff --git a/src/test/run-pass/traits/traits-issue-22110.rs b/src/test/run-pass/traits/traits-issue-22110.rs index bdbfee799f176..dc052610a76d4 100644 --- a/src/test/run-pass/traits/traits-issue-22110.rs +++ b/src/test/run-pass/traits/traits-issue-22110.rs @@ -3,7 +3,7 @@ // and the blanket impl. The only important thing is that compilation // succeeds here. Issue #22110. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![allow(dead_code)] diff --git a/src/test/run-pass/traits/traits-issue-22655.rs b/src/test/run-pass/traits/traits-issue-22655.rs index bc08ca0a2ba64..601d330a440b5 100644 --- a/src/test/run-pass/traits/traits-issue-22655.rs +++ b/src/test/run-pass/traits/traits-issue-22655.rs @@ -3,7 +3,7 @@ // Regression test for issue #22655: This test should not lead to // infinite recursion. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): unsafe impl Send for Unique { } diff --git a/src/test/run-pass/traits/traits-issue-23003.rs b/src/test/run-pass/traits/traits-issue-23003.rs index 24c2b2ad66074..737e9055ada57 100644 --- a/src/test/run-pass/traits/traits-issue-23003.rs +++ b/src/test/run-pass/traits/traits-issue-23003.rs @@ -4,7 +4,7 @@ // Async>::Cancel` be WF. This normalizes to `Receipt` // again, leading to an infinite cycle. Issue #23003. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![allow(dead_code)] #![allow(unused_variables)] diff --git a/src/test/run-pass/traits/use-trait-before-def.rs b/src/test/run-pass/traits/use-trait-before-def.rs index 1ee2b941909f4..4a2e43c69f536 100644 --- a/src/test/run-pass/traits/use-trait-before-def.rs +++ b/src/test/run-pass/traits/use-trait-before-def.rs @@ -3,7 +3,7 @@ // Issue #1761 -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): impl foo for isize { fn foo(&self) -> isize { 10 } } trait foo { fn foo(&self) -> isize; } diff --git a/src/test/run-pass/transmute-non-immediate-to-immediate.rs b/src/test/run-pass/transmute-non-immediate-to-immediate.rs index 2119c8336f4c0..7448cd0592cd9 100644 --- a/src/test/run-pass/transmute-non-immediate-to-immediate.rs +++ b/src/test/run-pass/transmute-non-immediate-to-immediate.rs @@ -1,7 +1,7 @@ // Issue #7988 // Transmuting non-immediate type to immediate type -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): pub fn main() { unsafe { diff --git a/src/test/run-pass/type-in-nested-module.rs b/src/test/run-pass/type-in-nested-module.rs index 077a28436df3b..5cf1ac78d6c7a 100644 --- a/src/test/run-pass/type-in-nested-module.rs +++ b/src/test/run-pass/type-in-nested-module.rs @@ -2,7 +2,7 @@ #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): mod a { pub mod b { diff --git a/src/test/run-pass/type-param-constraints.rs b/src/test/run-pass/type-param-constraints.rs index 8194562899667..d2160569cb3e3 100644 --- a/src/test/run-pass/type-param-constraints.rs +++ b/src/test/run-pass/type-param-constraints.rs @@ -1,6 +1,6 @@ #![allow(non_camel_case_types)] #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![feature(box_syntax)] diff --git a/src/test/run-pass/type-param.rs b/src/test/run-pass/type-param.rs index bfce3f3287912..437b946f42498 100644 --- a/src/test/run-pass/type-param.rs +++ b/src/test/run-pass/type-param.rs @@ -2,7 +2,7 @@ #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): type lteq = extern fn(T) -> bool; diff --git a/src/test/run-pass/type-params-in-for-each.rs b/src/test/run-pass/type-params-in-for-each.rs index 509843c6b9281..0c2a43c4588f3 100644 --- a/src/test/run-pass/type-params-in-for-each.rs +++ b/src/test/run-pass/type-params-in-for-each.rs @@ -1,6 +1,6 @@ #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): struct S { a: T, diff --git a/src/test/run-pass/type-ptr.rs b/src/test/run-pass/type-ptr.rs index 57c229a21758f..c40f7fda209c7 100644 --- a/src/test/run-pass/type-ptr.rs +++ b/src/test/run-pass/type-ptr.rs @@ -1,5 +1,5 @@ #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): fn f(a: *const isize) -> *const isize { return a; } diff --git a/src/test/run-pass/type-use-i1-versus-i8.rs b/src/test/run-pass/type-use-i1-versus-i8.rs index dc029e4569ef5..84c7dae095efc 100644 --- a/src/test/run-pass/type-use-i1-versus-i8.rs +++ b/src/test/run-pass/type-use-i1-versus-i8.rs @@ -1,4 +1,4 @@ -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616) use std::ptr; diff --git a/src/test/run-pass/typestate-cfg-nesting.rs b/src/test/run-pass/typestate-cfg-nesting.rs index 994c7d516926c..540efa8669b63 100644 --- a/src/test/run-pass/typestate-cfg-nesting.rs +++ b/src/test/run-pass/typestate-cfg-nesting.rs @@ -1,7 +1,7 @@ #![allow(dead_code)] #![allow(unused_assignments)] #![allow(unknown_lints)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![allow(dead_assignment)] #![allow(unused_variables)] diff --git a/src/test/run-pass/ufcs-type-params.rs b/src/test/run-pass/ufcs-type-params.rs index 2bb15b91760fa..d3670a64e9cca 100644 --- a/src/test/run-pass/ufcs-type-params.rs +++ b/src/test/run-pass/ufcs-type-params.rs @@ -1,4 +1,4 @@ -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616) trait Foo { fn get(&self) -> T; diff --git a/src/test/run-pass/unboxed-closures/auxiliary/unboxed-closures-cross-crate.rs b/src/test/run-pass/unboxed-closures/auxiliary/unboxed-closures-cross-crate.rs index ac0a74eebd5e5..47d41b6458abe 100644 --- a/src/test/run-pass/unboxed-closures/auxiliary/unboxed-closures-cross-crate.rs +++ b/src/test/run-pass/unboxed-closures/auxiliary/unboxed-closures-cross-crate.rs @@ -9,7 +9,7 @@ pub fn has_closures() -> usize { f() + g() } -pub fn has_generic_closures + Copy>(x: T, y: T) -> T { +pub fn has_generic_closures + Copy>(x: T, y: T) -> T { let mut f = move || x; let g = || y; f() + g() diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-direct-sugary-call.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-direct-sugary-call.rs index 1c5e74e593cb9..ad572eede08b8 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-direct-sugary-call.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-direct-sugary-call.rs @@ -1,6 +1,6 @@ // run-pass #![allow(unused_mut)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): fn main() { let mut unboxed = || {}; diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-infer-arg-types-from-expected-bound.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-infer-arg-types-from-expected-bound.rs index e0c9105760d24..c960aa8cf512c 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-infer-arg-types-from-expected-bound.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-infer-arg-types-from-expected-bound.rs @@ -2,7 +2,7 @@ // Test that we are able to infer that the type of `x` is `isize` based // on the expected type from the object. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): pub trait ToPrimitive { fn to_int(&self) {} diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-infer-arg-types-from-expected-object-type.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-infer-arg-types-from-expected-object-type.rs index 4f23f85b649e4..c6864b2e276d2 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-infer-arg-types-from-expected-object-type.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-infer-arg-types-from-expected-object-type.rs @@ -2,7 +2,7 @@ // Test that we are able to infer that the type of `x` is `isize` based // on the expected type from the object. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): pub trait ToPrimitive { fn to_int(&self) {} diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-infer-arg-types-w-bound-regs-from-expected-bound.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-infer-arg-types-w-bound-regs-from-expected-bound.rs index c3abdd8aab09e..c01047250056d 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-infer-arg-types-w-bound-regs-from-expected-bound.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-infer-arg-types-w-bound-regs-from-expected-bound.rs @@ -2,7 +2,7 @@ // Test that we are able to infer that the type of `x` is `isize` based // on the expected type from the object. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): pub trait ToPrimitive { fn to_int(&self) {} diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-infer-recursive-fn.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-infer-recursive-fn.rs index 72d658f393bd9..abe9b988483e6 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-infer-recursive-fn.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-infer-recursive-fn.rs @@ -4,7 +4,7 @@ use std::marker::PhantomData; // Test that we are able to infer a suitable kind for a "recursive" -// closure. As far as I can tell, coding up a recursive closure +// closure. As far as I can tell, coding up a recursive closure // requires the good ol' [Y Combinator]. // // [Y Combinator]: http://en.wikipedia.org/wiki/Fixed-point_combinator#Y_combinator diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-move-mutable.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-move-mutable.rs index 9b519e63a95cc..ff43d29f8699d 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-move-mutable.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-move-mutable.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![deny(unused_mut)] diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-prelude.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-prelude.rs index 7e53c4d9eb613..fb393f423a871 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-prelude.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-prelude.rs @@ -1,7 +1,7 @@ // run-pass // Tests that the re-exports of `FnOnce` et al from the prelude work. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): fn main() { let task: Box isize> = Box::new(|x| x); diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-static-call-fn-once.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-static-call-fn-once.rs index 054f284ea2a54..b9864d5075f2c 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-static-call-fn-once.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-static-call-fn-once.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): fn main() { let onetime = |x| x; diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-zero-args.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-zero-args.rs index 6f41c35584e83..3eebb38fdc2ac 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-zero-args.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-zero-args.rs @@ -1,6 +1,6 @@ // run-pass #![allow(unused_mut)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): fn main() { let mut zero = || {}; diff --git a/src/test/run-pass/unify-return-ty.rs b/src/test/run-pass/unify-return-ty.rs index 3f743a7da4066..49841ed39348e 100644 --- a/src/test/run-pass/unify-return-ty.rs +++ b/src/test/run-pass/unify-return-ty.rs @@ -2,7 +2,7 @@ // unified with the type *T, and so the type variable // in that type gets resolved. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): use std::mem; diff --git a/src/test/run-pass/uninit-empty-types.rs b/src/test/run-pass/uninit-empty-types.rs index b59971b349802..f211aa9c5ed4d 100644 --- a/src/test/run-pass/uninit-empty-types.rs +++ b/src/test/run-pass/uninit-empty-types.rs @@ -1,6 +1,6 @@ // Test the uninit() construct returning various empty types. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): use std::mem; diff --git a/src/test/run-pass/unique/unique-containing-tag.rs b/src/test/run-pass/unique/unique-containing-tag.rs index f24b3a8645f29..f40f14f5f9dcf 100644 --- a/src/test/run-pass/unique/unique-containing-tag.rs +++ b/src/test/run-pass/unique/unique-containing-tag.rs @@ -2,7 +2,7 @@ #![allow(dead_code)] #![allow(non_camel_case_types)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![feature(box_syntax)] diff --git a/src/test/run-pass/unique/unique-create.rs b/src/test/run-pass/unique/unique-create.rs index 3df0f7d55fd58..27e41ad65fbbf 100644 --- a/src/test/run-pass/unique/unique-create.rs +++ b/src/test/run-pass/unique/unique-create.rs @@ -1,6 +1,6 @@ // run-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![feature(box_syntax)] diff --git a/src/test/run-pass/unique/unique-drop-complex.rs b/src/test/run-pass/unique/unique-drop-complex.rs index 0b7bda83b3fa1..0c128b2ee3918 100644 --- a/src/test/run-pass/unique/unique-drop-complex.rs +++ b/src/test/run-pass/unique/unique-drop-complex.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![feature(box_syntax)] diff --git a/src/test/run-pass/unique/unique-generic-assign.rs b/src/test/run-pass/unique/unique-generic-assign.rs index 9c4405aa8ac2a..dffb995c460c4 100644 --- a/src/test/run-pass/unique/unique-generic-assign.rs +++ b/src/test/run-pass/unique/unique-generic-assign.rs @@ -3,7 +3,7 @@ // Issue #976 -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): fn f(x: Box) { let _x2 = x; diff --git a/src/test/run-pass/unique/unique-init.rs b/src/test/run-pass/unique/unique-init.rs index c8a150522fd2e..e0f3e67617f0e 100644 --- a/src/test/run-pass/unique/unique-init.rs +++ b/src/test/run-pass/unique/unique-init.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![feature(box_syntax)] diff --git a/src/test/run-pass/unique/unique-match-discrim.rs b/src/test/run-pass/unique/unique-match-discrim.rs index 6e6d7432277d9..a42fe4f89cf5a 100644 --- a/src/test/run-pass/unique/unique-match-discrim.rs +++ b/src/test/run-pass/unique/unique-match-discrim.rs @@ -2,7 +2,7 @@ #![allow(dead_code)] // Issue #961 -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): fn altsimple() { match Box::new(true) { diff --git a/src/test/run-pass/unique/unique-object-move.rs b/src/test/run-pass/unique/unique-object-move.rs index 4bd3764fa15a7..08ebab03f2338 100644 --- a/src/test/run-pass/unique/unique-object-move.rs +++ b/src/test/run-pass/unique/unique-object-move.rs @@ -2,7 +2,7 @@ #![allow(dead_code)] // Issue #5192 -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![feature(box_syntax)] diff --git a/src/test/run-pass/unit.rs b/src/test/run-pass/unit.rs index e10b2408cb79e..a9e1a4c165014 100644 --- a/src/test/run-pass/unit.rs +++ b/src/test/run-pass/unit.rs @@ -1,6 +1,6 @@ #![allow(unused_assignments)] #![allow(unknown_lints)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![allow(unused_variables)] #![allow(dead_assignment)] diff --git a/src/test/run-pass/unnamed_argument_mode.rs b/src/test/run-pass/unnamed_argument_mode.rs index fa817be270496..9e63013ae0aa8 100644 --- a/src/test/run-pass/unnamed_argument_mode.rs +++ b/src/test/run-pass/unnamed_argument_mode.rs @@ -1,10 +1,9 @@ -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616) fn good(_a: &isize) { } -// unnamed argument &isize is now parse x: &isize - +// Unnamed argument `&isize` is parsed like `x: &isize`. fn called(_f: F) where F: FnOnce(&isize) { } diff --git a/src/test/run-pass/unsafe-fn-called-from-unsafe-blk.rs b/src/test/run-pass/unsafe-fn-called-from-unsafe-blk.rs index e49b372981bf7..00159db4b1999 100644 --- a/src/test/run-pass/unsafe-fn-called-from-unsafe-blk.rs +++ b/src/test/run-pass/unsafe-fn-called-from-unsafe-blk.rs @@ -2,7 +2,7 @@ // // See also: compile-fail/unsafe-fn-called-from-safe.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): unsafe fn f() { return; } diff --git a/src/test/run-pass/unsafe-fn-called-from-unsafe-fn.rs b/src/test/run-pass/unsafe-fn-called-from-unsafe-fn.rs index f9414bee2987e..63ff395e22c05 100644 --- a/src/test/run-pass/unsafe-fn-called-from-unsafe-fn.rs +++ b/src/test/run-pass/unsafe-fn-called-from-unsafe-fn.rs @@ -2,7 +2,7 @@ // // See also: compile-fail/unsafe-fn-called-from-safe.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): unsafe fn f() { return; } diff --git a/src/test/run-pass/unused-move-capture.rs b/src/test/run-pass/unused-move-capture.rs index baba19c08cd55..1c9c7cfd291a0 100644 --- a/src/test/run-pass/unused-move-capture.rs +++ b/src/test/run-pass/unused-move-capture.rs @@ -1,4 +1,4 @@ -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616) #![feature(box_syntax)] diff --git a/src/test/run-pass/unused-move.rs b/src/test/run-pass/unused-move.rs index 74632dbc797fa..a230a8ec2698e 100644 --- a/src/test/run-pass/unused-move.rs +++ b/src/test/run-pass/unused-move.rs @@ -2,7 +2,7 @@ // Issue Name: Unused move causes a crash // Abstract: zero-fill to block after drop -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![allow(path_statements)] #![feature(box_syntax)] diff --git a/src/test/run-pass/use-crate-name-alias.rs b/src/test/run-pass/use-crate-name-alias.rs index 520e72676b097..702f8f0239b3a 100644 --- a/src/test/run-pass/use-crate-name-alias.rs +++ b/src/test/run-pass/use-crate-name-alias.rs @@ -1,5 +1,5 @@ // Issue #1706 -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate std as stdlib; diff --git a/src/test/run-pass/use-import-export.rs b/src/test/run-pass/use-import-export.rs index bb6a8ee55bfc8..243381c49c8b1 100644 --- a/src/test/run-pass/use-import-export.rs +++ b/src/test/run-pass/use-import-export.rs @@ -1,4 +1,4 @@ -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616) mod foo { pub fn x() -> isize { return 1; } @@ -8,4 +8,7 @@ mod bar { pub fn y() -> isize { return 1; } } -pub fn main() { foo::x(); bar::y(); } +pub fn main() { + foo::x(); + bar::y(); +} diff --git a/src/test/run-pass/use-mod.rs b/src/test/run-pass/use-mod.rs index 9af56b71de00d..f444be3d1a112 100644 --- a/src/test/run-pass/use-mod.rs +++ b/src/test/run-pass/use-mod.rs @@ -1,5 +1,5 @@ #![allow(unused_imports)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): pub use foo::bar::{self, First}; use self::bar::Second; diff --git a/src/test/run-pass/use.rs b/src/test/run-pass/use.rs index df37a60e35608..b9c3c53b010aa 100644 --- a/src/test/run-pass/use.rs +++ b/src/test/run-pass/use.rs @@ -1,5 +1,5 @@ #![allow(stable_features)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![allow(unused_imports)] #![feature(start, no_core, core)] diff --git a/src/test/run-pass/use_inline_dtor.rs b/src/test/run-pass/use_inline_dtor.rs index 0873d185575b1..823284f764b50 100644 --- a/src/test/run-pass/use_inline_dtor.rs +++ b/src/test/run-pass/use_inline_dtor.rs @@ -1,6 +1,6 @@ // aux-build:inline_dtor.rs -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate inline_dtor; diff --git a/src/test/run-pass/variant-attributes.rs b/src/test/run-pass/variant-attributes.rs index 19de3ff2f63f3..d736266cf38d0 100644 --- a/src/test/run-pass/variant-attributes.rs +++ b/src/test/run-pass/variant-attributes.rs @@ -2,7 +2,7 @@ #![allow(non_camel_case_types)] #![allow(dead_code)] // pp-exact - Make sure we actually print the attributes -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![feature(custom_attribute)] diff --git a/src/test/run-pass/warn-ctypes-inhibit.rs b/src/test/run-pass/warn-ctypes-inhibit.rs index 76b36a12c200c..3ea27ce40db39 100644 --- a/src/test/run-pass/warn-ctypes-inhibit.rs +++ b/src/test/run-pass/warn-ctypes-inhibit.rs @@ -1,7 +1,7 @@ #![allow(dead_code)] // compile-flags:-D improper-ctypes -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![allow(improper_ctypes)] diff --git a/src/test/run-pass/weak-lang-item.rs b/src/test/run-pass/weak-lang-item.rs index 9a36606a46509..0608f825cc015 100644 --- a/src/test/run-pass/weak-lang-item.rs +++ b/src/test/run-pass/weak-lang-item.rs @@ -1,7 +1,7 @@ // aux-build:weak-lang-items.rs // ignore-emscripten no threads support -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern crate weak_lang_items as other; diff --git a/src/test/run-pass/wf-bound-region-in-object-type.rs b/src/test/run-pass/wf-bound-region-in-object-type.rs index d81059ca6a844..d34e3ced6794e 100644 --- a/src/test/run-pass/wf-bound-region-in-object-type.rs +++ b/src/test/run-pass/wf-bound-region-in-object-type.rs @@ -3,7 +3,7 @@ // Test that the `wf` checker properly handles bound regions in object // types. Compiling this code used to trigger an ICE. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): pub struct Context<'tcx> { vec: &'tcx Vec diff --git a/src/test/run-pass/where-clauses/where-clause-bounds-inconsistency.rs b/src/test/run-pass/where-clauses/where-clause-bounds-inconsistency.rs index cf7d06b6179b0..de53792be9627 100644 --- a/src/test/run-pass/where-clauses/where-clause-bounds-inconsistency.rs +++ b/src/test/run-pass/where-clauses/where-clause-bounds-inconsistency.rs @@ -1,5 +1,5 @@ // run-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): trait Bound { fn dummy(&self) { } diff --git a/src/test/run-pass/where-clauses/where-clause-early-bound-lifetimes.rs b/src/test/run-pass/where-clauses/where-clause-early-bound-lifetimes.rs index 6fc570b9b5b9b..8357c051b1ff2 100644 --- a/src/test/run-pass/where-clauses/where-clause-early-bound-lifetimes.rs +++ b/src/test/run-pass/where-clauses/where-clause-early-bound-lifetimes.rs @@ -1,7 +1,7 @@ // run-pass #![allow(non_upper_case_globals)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): trait TheTrait { fn dummy(&self) { } } diff --git a/src/test/run-pass/where-clauses/where-clause-method-substituion.rs b/src/test/run-pass/where-clauses/where-clause-method-substituion.rs index daa3c8dd8e367..38b40263b79cf 100644 --- a/src/test/run-pass/where-clauses/where-clause-method-substituion.rs +++ b/src/test/run-pass/where-clauses/where-clause-method-substituion.rs @@ -1,6 +1,6 @@ // run-pass #![allow(unused_variables)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): trait Foo { fn dummy(&self, arg: T) { } } diff --git a/src/test/run-pass/where-clauses/where-clause-region-outlives.rs b/src/test/run-pass/where-clauses/where-clause-region-outlives.rs index 84925345de14e..b90fff3103cb9 100644 --- a/src/test/run-pass/where-clauses/where-clause-region-outlives.rs +++ b/src/test/run-pass/where-clauses/where-clause-region-outlives.rs @@ -1,7 +1,7 @@ // run-pass #![allow(dead_code)] #![allow(unused_variables)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): struct A<'a, 'b> where 'a : 'b { x: &'a isize, y: &'b isize } diff --git a/src/test/run-pass/where-clauses/where-clauses-lifetimes.rs b/src/test/run-pass/where-clauses/where-clauses-lifetimes.rs index 4bfd9e6590fba..fb03102fc3ddf 100644 --- a/src/test/run-pass/where-clauses/where-clauses-lifetimes.rs +++ b/src/test/run-pass/where-clauses/where-clauses-lifetimes.rs @@ -1,9 +1,9 @@ // run-pass #![allow(unused_mut)] #![allow(unused_variables)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): -fn foo<'a, I>(mut it: I) where I: Iterator {} +fn foo<'a, I>(mut it: I) where I: Iterator {} fn main() { foo([1, 2].iter()); diff --git a/src/test/run-pass/where-clauses/where-clauses-unboxed-closures.rs b/src/test/run-pass/where-clauses/where-clauses-unboxed-closures.rs index 6964cfa2eb044..95678656023a2 100644 --- a/src/test/run-pass/where-clauses/where-clauses-unboxed-closures.rs +++ b/src/test/run-pass/where-clauses/where-clauses-unboxed-closures.rs @@ -1,6 +1,6 @@ // run-pass #![allow(unused_variables)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): struct Bencher; diff --git a/src/test/rustdoc-ui/deprecated-attrs.stderr b/src/test/rustdoc-ui/deprecated-attrs.stderr index 5bd62d60b48f3..7782b118085d4 100644 --- a/src/test/rustdoc-ui/deprecated-attrs.stderr +++ b/src/test/rustdoc-ui/deprecated-attrs.stderr @@ -1,9 +1,9 @@ warning: the `#![doc(no_default_passes)]` attribute is considered deprecated | - = warning: please see https://github.com/rust-lang/rust/issues/44136 + = warning: see = help: you may want to use `#![doc(document_private_items)]` warning: the `#![doc(passes = "...")]` attribute is considered deprecated | - = warning: please see https://github.com/rust-lang/rust/issues/44136 + = warning: see diff --git a/src/test/rustdoc-ui/intra-link-span-ice-55723.rs b/src/test/rustdoc-ui/intra-link-span-ice-55723.rs index 5891a553e3255..b8e612e628858 100644 --- a/src/test/rustdoc-ui/intra-link-span-ice-55723.rs +++ b/src/test/rustdoc-ui/intra-link-span-ice-55723.rs @@ -3,8 +3,7 @@ #![deny(intra_doc_link_resolution_failure)] // An error in calculating spans while reporting intra-doc link resolution errors caused rustdoc to -// attempt to slice in the middle of a multibyte character. See -// https://github.com/rust-lang/rust/issues/55723 +// attempt to slice in the middle of a multibyte character. /// ## For example: /// diff --git a/src/test/rustdoc-ui/intra-link-span-ice-55723.stderr b/src/test/rustdoc-ui/intra-link-span-ice-55723.stderr index 4eb1861062872..8c23a3e1b9170 100644 --- a/src/test/rustdoc-ui/intra-link-span-ice-55723.stderr +++ b/src/test/rustdoc-ui/intra-link-span-ice-55723.stderr @@ -1,5 +1,5 @@ error: `[i]` cannot be resolved, ignoring it... - --> $DIR/intra-link-span-ice-55723.rs:11:10 + --> $DIR/intra-link-span-ice-55723.rs:10:10 | LL | /// (arr[i]) | ^ cannot be resolved, ignoring diff --git a/src/test/rustdoc/auto-impl-for-trait.rs b/src/test/rustdoc/auto-impl-for-trait.rs index bc658fbfc8cce..0ff04e59eb5d1 100644 --- a/src/test/rustdoc/auto-impl-for-trait.rs +++ b/src/test/rustdoc/auto-impl-for-trait.rs @@ -1,4 +1,4 @@ -// Test for https://github.com/rust-lang/rust/issues/48463 issue. +// Test for issue #48463. use std::any::Any; use std::ops::Deref; diff --git a/src/test/rustdoc/comment-in-doctest.rs b/src/test/rustdoc/comment-in-doctest.rs index e4e41bc7ce308..d60d7d98655c5 100644 --- a/src/test/rustdoc/comment-in-doctest.rs +++ b/src/test/rustdoc/comment-in-doctest.rs @@ -1,11 +1,11 @@ // compile-flags:--test -// comments, both doc comments and regular ones, used to trick rustdoc's doctest parser into -// thinking that everything after it was part of the regular program. combined with the libsyntax +// Comments, both doc comments and regular ones, used to trick rustdoc's doctest parser into +// thinking that everything after it was part of the regular program. Combined with the libsyntax // parser loop failing to detect the manual main function, it would wrap everything in `fn main`, // which would cause the doctest to fail as the "extern crate" declaration was no longer valid. -// oddly enough, it would pass in 2018 if a crate was in the extern prelude. see -// https://github.com/rust-lang/rust/issues/56727 +// Oddly enough, it would pass in 2018 if a crate was in the extern prelude. See +// issue #56727. //! ``` //! // crate: proc-macro-test diff --git a/src/test/rustdoc/impl-parts-crosscrate.rs b/src/test/rustdoc/impl-parts-crosscrate.rs index f9583d1a72296..1cc0027dc1969 100644 --- a/src/test/rustdoc/impl-parts-crosscrate.rs +++ b/src/test/rustdoc/impl-parts-crosscrate.rs @@ -9,7 +9,7 @@ pub struct Bar { t: T } // The output file is html embedded in javascript, so the html tags // aren't stripped by the processing script and we can't check for the -// full impl string. Instead, just make sure something from each part +// full impl string. Instead, just make sure something from each part // is mentioned. // @has implementors/rustdoc_impl_parts_crosscrate/trait.AnOibit.js Bar diff --git a/src/test/rustdoc/issue-25001.rs b/src/test/rustdoc/issue-25001.rs index 3c1580f3786bb..b04fa13159657 100644 --- a/src/test/rustdoc/issue-25001.rs +++ b/src/test/rustdoc/issue-25001.rs @@ -25,21 +25,21 @@ impl Foo { impl Bar for Foo { // @has - '//*[@id="associatedtype.Item"]//code' 'type Item = T' - type Item=T; + type Item = T; // @has - '//*[@id="method.quux"]//code' 'fn quux(self)' fn quux(self) {} } impl<'a, T> Bar for &'a Foo { // @has - '//*[@id="associatedtype.Item-1"]//code' "type Item = &'a T" - type Item=&'a T; + type Item = &'a T; // @has - '//*[@id="method.quux-1"]//code' 'fn quux(self)' fn quux(self) {} } impl<'a, T> Bar for &'a mut Foo { // @has - '//*[@id="associatedtype.Item-2"]//code' "type Item = &'a mut T" - type Item=&'a mut T; + type Item = &'a mut T; // @has - '//*[@id="method.quux-2"]//code' 'fn quux(self)' fn quux(self) {} diff --git a/src/test/rustdoc/issue-43869.rs b/src/test/rustdoc/issue-43869.rs index 44356848fbfad..23561adbae7b5 100644 --- a/src/test/rustdoc/issue-43869.rs +++ b/src/test/rustdoc/issue-43869.rs @@ -45,15 +45,15 @@ pub fn test_44731_1() -> Result, ()> { // NOTE these involve Fn sugar, where impl Trait is disallowed for now, see issue #45994 // -//pub fn test_44731_2() -> Box { +// pub fn test_44731_2() -> Box { // Box::new(|_: u32| {}) //} // -//pub fn test_44731_3() -> Box impl Clone> { +// pub fn test_44731_3() -> Box impl Clone> { // Box::new(|| 0u32) //} -pub fn test_44731_4() -> Box> { +pub fn test_44731_4() -> Box> { Box::new(g()) } diff --git a/src/test/rustdoc/traits-in-bodies.rs b/src/test/rustdoc/traits-in-bodies.rs index 1c3727a5748e6..8cfd50b24b835 100644 --- a/src/test/rustdoc/traits-in-bodies.rs +++ b/src/test/rustdoc/traits-in-bodies.rs @@ -1,5 +1,5 @@ -//prior to fixing `everybody_loops` to preserve items, rustdoc would crash on this file, as it -//didn't see that `SomeStruct` implemented `Clone` +// prior to fixing `everybody_loops` to preserve items, rustdoc would crash on this file, as it +// didn't see that `SomeStruct` implemented `Clone` pub struct Bounded(T); diff --git a/src/test/ui-fulldeps/gated-quote.rs b/src/test/ui-fulldeps/gated-quote.rs index 86848e3156fbd..c5903884de2ac 100644 --- a/src/test/ui-fulldeps/gated-quote.rs +++ b/src/test/ui-fulldeps/gated-quote.rs @@ -3,7 +3,7 @@ // (To sanity-check the code, uncomment this.) // #![feature(quote)] -// FIXME the error message that is current emitted seems pretty bad. +// FIXME: the error message that is current emitted seems pretty bad. // gate-test-quote diff --git a/src/test/ui/associated-type/associated-type-projection-from-multiple-supertraits.rs b/src/test/ui/associated-type/associated-type-projection-from-multiple-supertraits.rs index df9143d685ff3..e9eb6687bca19 100644 --- a/src/test/ui/associated-type/associated-type-projection-from-multiple-supertraits.rs +++ b/src/test/ui/associated-type/associated-type-projection-from-multiple-supertraits.rs @@ -20,7 +20,7 @@ fn dent(c: C, color: C::Color) { //~^ ERROR ambiguous associated type `Color` in bounds of `C` } -fn dent_object(c: BoxCar) { +fn dent_object(c: BoxCar) { //~^ ERROR ambiguous associated type //~| ERROR the value of the associated type `Color` (from the trait `Vehicle`) must be specified } diff --git a/src/test/ui/associated-type/associated-type-projection-from-multiple-supertraits.stderr b/src/test/ui/associated-type/associated-type-projection-from-multiple-supertraits.stderr index 0994dc87c994b..42f557ac0ab81 100644 --- a/src/test/ui/associated-type/associated-type-projection-from-multiple-supertraits.stderr +++ b/src/test/ui/associated-type/associated-type-projection-from-multiple-supertraits.stderr @@ -19,8 +19,8 @@ LL | type Color; LL | type Color; | ----------- ambiguous `Color` from `Box` ... -LL | fn dent_object(c: BoxCar) { - | ^^^^^^^^^^^ ambiguous associated type `Color` +LL | fn dent_object(c: BoxCar) { + | ^^^^^^^^^^^^^ ambiguous associated type `Color` error[E0191]: the value of the associated type `Color` (from the trait `Vehicle`) must be specified --> $DIR/associated-type-projection-from-multiple-supertraits.rs:23:26 @@ -28,8 +28,8 @@ error[E0191]: the value of the associated type `Color` (from the trait `Vehicle` LL | type Color; | ----------- `Color` defined here ... -LL | fn dent_object(c: BoxCar) { - | ^^^^^^^^^^^^^^^^^^^ associated type `Color` must be specified +LL | fn dent_object(c: BoxCar) { + | ^^^^^^^^^^^^^^^^^^^^^ associated type `Color` must be specified error[E0221]: ambiguous associated type `Color` in bounds of `C` --> $DIR/associated-type-projection-from-multiple-supertraits.rs:28:29 diff --git a/src/test/ui/associated-types/associated-types-ICE-when-projecting-out-of-err.rs b/src/test/ui/associated-types/associated-types-ICE-when-projecting-out-of-err.rs index 707bcac78bf92..2ddbc7a6a5a65 100644 --- a/src/test/ui/associated-types/associated-types-ICE-when-projecting-out-of-err.rs +++ b/src/test/ui/associated-types/associated-types-ICE-when-projecting-out-of-err.rs @@ -12,7 +12,7 @@ pub trait Sized { } #[lang = "add"] -trait Add { +trait Add { type Output; fn add(self, _: RHS) -> Self::Output; diff --git a/src/test/ui/associated-types/associated-types-binding-to-type-defined-in-supertrait.rs b/src/test/ui/associated-types/associated-types-binding-to-type-defined-in-supertrait.rs index 653130843c8de..ba64395e564bb 100644 --- a/src/test/ui/associated-types/associated-types-binding-to-type-defined-in-supertrait.rs +++ b/src/test/ui/associated-types/associated-types-binding-to-type-defined-in-supertrait.rs @@ -27,10 +27,10 @@ impl Car for ModelU { } /////////////////////////////////////////////////////////////////////////// -fn black_car>(c: C) { +fn black_car>(c: C) { } -fn blue_car>(c: C) { +fn blue_car>(c: C) { } fn a() { black_car(ModelT); } diff --git a/src/test/ui/associated-types/associated-types-binding-to-type-defined-in-supertrait.stderr b/src/test/ui/associated-types/associated-types-binding-to-type-defined-in-supertrait.stderr index 126fb572d992a..0cf364787be30 100644 --- a/src/test/ui/associated-types/associated-types-binding-to-type-defined-in-supertrait.stderr +++ b/src/test/ui/associated-types/associated-types-binding-to-type-defined-in-supertrait.stderr @@ -9,8 +9,8 @@ LL | fn b() { blue_car(ModelT); } //~ ERROR type mismatch note: required by `blue_car` --> $DIR/associated-types-binding-to-type-defined-in-supertrait.rs:33:1 | -LL | fn blue_car>(c: C) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn blue_car>(c: C) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0271]: type mismatch resolving `::Color == Black` --> $DIR/associated-types-binding-to-type-defined-in-supertrait.rs:38:10 @@ -23,8 +23,8 @@ LL | fn c() { black_car(ModelU); } //~ ERROR type mismatch note: required by `black_car` --> $DIR/associated-types-binding-to-type-defined-in-supertrait.rs:30:1 | -LL | fn black_car>(c: C) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn black_car>(c: C) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/associated-types/associated-types-eq-2.rs b/src/test/ui/associated-types/associated-types-eq-2.rs index 18e38d4466702..c4bf894a22559 100644 --- a/src/test/ui/associated-types/associated-types-eq-2.rs +++ b/src/test/ui/associated-types/associated-types-eq-2.rs @@ -13,7 +13,7 @@ impl Foo for isize { fn boo(&self) -> usize { 42 } } -fn baz(x: &>::A) {} +fn baz(x: &>::A) {} //~^ ERROR associated type bindings are not allowed here pub fn main() {} diff --git a/src/test/ui/associated-types/associated-types-eq-2.stderr b/src/test/ui/associated-types/associated-types-eq-2.stderr index 23ee8cd23b5c3..c8e89839d429c 100644 --- a/src/test/ui/associated-types/associated-types-eq-2.stderr +++ b/src/test/ui/associated-types/associated-types-eq-2.stderr @@ -1,8 +1,8 @@ error[E0229]: associated type bindings are not allowed here --> $DIR/associated-types-eq-2.rs:16:30 | -LL | fn baz(x: &>::A) {} - | ^^^^^ associated type not allowed here +LL | fn baz(x: &>::A) {} + | ^^^^^^^ associated type not allowed here error: aborting due to previous error diff --git a/src/test/ui/associated-types/associated-types-eq-3.rs b/src/test/ui/associated-types/associated-types-eq-3.rs index 1a58dcca9e249..eae75791d0024 100644 --- a/src/test/ui/associated-types/associated-types-eq-3.rs +++ b/src/test/ui/associated-types/associated-types-eq-3.rs @@ -15,7 +15,7 @@ impl Foo for isize { } } -fn foo1>(x: I) { +fn foo1>(x: I) { let _: Bar = x.boo(); } @@ -28,7 +28,7 @@ fn foo2(x: I) { } -pub fn baz(x: &Foo) { +pub fn baz(x: &Foo) { let _: Bar = x.boo(); } diff --git a/src/test/ui/associated-types/associated-types-eq-3.stderr b/src/test/ui/associated-types/associated-types-eq-3.stderr index c1a8e2002be61..1fe248f0cb10b 100644 --- a/src/test/ui/associated-types/associated-types-eq-3.stderr +++ b/src/test/ui/associated-types/associated-types-eq-3.stderr @@ -18,8 +18,8 @@ LL | foo1(a); note: required by `foo1` --> $DIR/associated-types-eq-3.rs:18:1 | -LL | fn foo1>(x: I) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn foo1>(x: I) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0271]: type mismatch resolving `::A == Bar` --> $DIR/associated-types-eq-3.rs:41:9 diff --git a/src/test/ui/associated-types/associated-types-issue-20346.rs b/src/test/ui/associated-types/associated-types-issue-20346.rs index 0cce847e1be54..4741988b5c7b4 100644 --- a/src/test/ui/associated-types/associated-types-issue-20346.rs +++ b/src/test/ui/associated-types/associated-types-issue-20346.rs @@ -12,14 +12,14 @@ trait Iterator { fn next(&mut self) -> Option; } -fn is_iterator_of>(_: &I) {} +fn is_iterator_of>(_: &I) {} struct Adapter { iter: I, found_none: bool, } -impl Iterator for Adapter where I: Iterator> { +impl Iterator for Adapter where I: Iterator> { type Item = T; fn next(&mut self) -> Option { @@ -27,7 +27,7 @@ impl Iterator for Adapter where I: Iterator> { } } -fn test_adapter>>(it: I) { +fn test_adapter>>(it: I) { is_iterator_of::, _>(&it); // Sanity check let adapter = Adapter { iter: it, found_none: false }; is_iterator_of::(&adapter); // OK diff --git a/src/test/ui/associated-types/associated-types-issue-20346.stderr b/src/test/ui/associated-types/associated-types-issue-20346.stderr index 27b5b1e00f9ec..63f3a13ff7ab6 100644 --- a/src/test/ui/associated-types/associated-types-issue-20346.stderr +++ b/src/test/ui/associated-types/associated-types-issue-20346.stderr @@ -9,8 +9,8 @@ LL | is_iterator_of::, _>(&adapter); //~ ERROR type mismatch note: required by `is_iterator_of` --> $DIR/associated-types-issue-20346.rs:15:1 | -LL | fn is_iterator_of>(_: &I) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn is_iterator_of>(_: &I) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/associated-types/bound-lifetime-in-binding-only.angle.stderr b/src/test/ui/associated-types/bound-lifetime-in-binding-only.angle.stderr index fee64c0f663b7..36fe42362ae6b 100644 --- a/src/test/ui/associated-types/bound-lifetime-in-binding-only.angle.stderr +++ b/src/test/ui/associated-types/bound-lifetime-in-binding-only.angle.stderr @@ -1,26 +1,26 @@ error[E0582]: binding for associated type `Item` references lifetime `'a`, which does not appear in the trait input types --> $DIR/bound-lifetime-in-binding-only.rs:12:25 | -LL | fn angle Foo>() { - | ^^^^^^^^^^^^ +LL | fn angle Foo>() { + | ^^^^^^^^^^^^^^ error[E0582]: binding for associated type `Item` references lifetime `'a`, which does not appear in the trait input types --> $DIR/bound-lifetime-in-binding-only.rs:17:37 | -LL | fn angle1() where T: for<'a> Foo { - | ^^^^^^^^^^^^ +LL | fn angle1() where T: for<'a> Foo { + | ^^^^^^^^^^^^^^ error[E0582]: binding for associated type `Item` references lifetime `'a`, which does not appear in the trait input types --> $DIR/bound-lifetime-in-binding-only.rs:22:37 | -LL | fn angle2() where for<'a> T: Foo { - | ^^^^^^^^^^^^ +LL | fn angle2() where for<'a> T: Foo { + | ^^^^^^^^^^^^^^ error[E0582]: binding for associated type `Item` references lifetime `'a`, which does not appear in the trait input types --> $DIR/bound-lifetime-in-binding-only.rs:27:27 | -LL | fn angle3(_: &for<'a> Foo) { - | ^^^^^^^^^^^^ +LL | fn angle3(_: &for<'a> Foo) { + | ^^^^^^^^^^^^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/associated-types/bound-lifetime-in-binding-only.rs b/src/test/ui/associated-types/bound-lifetime-in-binding-only.rs index e1989d35bbb8c..a8d68ee4c7641 100644 --- a/src/test/ui/associated-types/bound-lifetime-in-binding-only.rs +++ b/src/test/ui/associated-types/bound-lifetime-in-binding-only.rs @@ -9,22 +9,22 @@ trait Foo { } #[cfg(angle)] -fn angle Foo>() { +fn angle Foo>() { //[angle]~^ ERROR binding for associated type `Item` references lifetime `'a` } #[cfg(angle)] -fn angle1() where T: for<'a> Foo { +fn angle1() where T: for<'a> Foo { //[angle]~^ ERROR binding for associated type `Item` references lifetime `'a` } #[cfg(angle)] -fn angle2() where for<'a> T: Foo { +fn angle2() where for<'a> T: Foo { //[angle]~^ ERROR binding for associated type `Item` references lifetime `'a` } #[cfg(angle)] -fn angle3(_: &for<'a> Foo) { +fn angle3(_: &for<'a> Foo) { //[angle]~^ ERROR binding for associated type `Item` references lifetime `'a` } @@ -60,11 +60,11 @@ fn ok1 Fn(&Parameterized<'a>) -> &'a i32>() { } #[cfg(ok)] -fn ok2 Fn<(&'b Parameterized<'a>,), Output=&'a i32>>() { +fn ok2 Fn<(&'b Parameterized<'a>,), Output = &'a i32>>() { } #[cfg(ok)] -fn ok3() where for<'a> Parameterized<'a>: Foo { +fn ok3() where for<'a> Parameterized<'a>: Foo { } #[rustc_error] diff --git a/src/test/ui/associated-types/bound-lifetime-in-return-only.rs b/src/test/ui/associated-types/bound-lifetime-in-return-only.rs index 5a7e086fd476c..7e7a1c76f5838 100644 --- a/src/test/ui/associated-types/bound-lifetime-in-return-only.rs +++ b/src/test/ui/associated-types/bound-lifetime-in-return-only.rs @@ -42,7 +42,7 @@ fn ok1(_: &for<'a> Fn(&Parameterized<'a>) -> &'a i32) { } #[cfg(ok)] -fn ok2(_: &for<'a,'b> Fn<(&'b Parameterized<'a>,), Output=&'a i32>) { +fn ok2(_: &for<'a,'b> Fn<(&'b Parameterized<'a>,), Output = &'a i32>) { } #[rustc_error] diff --git a/src/test/ui/associated-types/cache/chrono-scan.rs b/src/test/ui/associated-types/cache/chrono-scan.rs index 00d47c92a374c..efbd5ac4cc64b 100644 --- a/src/test/ui/associated-types/cache/chrono-scan.rs +++ b/src/test/ui/associated-types/cache/chrono-scan.rs @@ -16,7 +16,7 @@ pub fn timezone_offset_zulu(s: &str, colon: F) -> ParseResult<(&str, i32)> } pub fn parse<'a, I>(mut s: &str, items: I) -> ParseResult<()> - where I: Iterator> { + where I: Iterator> { macro_rules! try_consume { ($e:expr) => ({ let (s_, v) = try!($e); s = s_; v }) } diff --git a/src/test/ui/associated-types/higher-ranked-projection.bad.stderr b/src/test/ui/associated-types/higher-ranked-projection.bad.stderr index cc69e849fe144..446f5b0592651 100644 --- a/src/test/ui/associated-types/higher-ranked-projection.bad.stderr +++ b/src/test/ui/associated-types/higher-ranked-projection.bad.stderr @@ -8,7 +8,7 @@ note: required by `foo` --> $DIR/higher-ranked-projection.rs:14:1 | LL | / fn foo(_t: T) -LL | | where for<'a> &'a T: Mirror +LL | | where for<'a> &'a T: Mirror LL | | {} | |__^ diff --git a/src/test/ui/associated-types/higher-ranked-projection.rs b/src/test/ui/associated-types/higher-ranked-projection.rs index be6300c418293..9867d50fe4494 100644 --- a/src/test/ui/associated-types/higher-ranked-projection.rs +++ b/src/test/ui/associated-types/higher-ranked-projection.rs @@ -12,12 +12,12 @@ impl Mirror for T { #[cfg(bad)] fn foo(_t: T) - where for<'a> &'a T: Mirror + where for<'a> &'a T: Mirror {} #[cfg(good)] fn foo(_t: T) - where for<'a> &'a T: Mirror + where for<'a> &'a T: Mirror {} #[rustc_error] diff --git a/src/test/ui/auxiliary/weak-lang-items.rs b/src/test/ui/auxiliary/weak-lang-items.rs index 7a698cf76ae51..c5181f3b6719e 100644 --- a/src/test/ui/auxiliary/weak-lang-items.rs +++ b/src/test/ui/auxiliary/weak-lang-items.rs @@ -1,6 +1,6 @@ // no-prefer-dynamic -// This aux-file will require the eh_personality function to be codegen'd, but +// This aux-file will require the `eh_personality` function to be codegen'ed, but // it hasn't been defined just yet. Make sure we don't explode. #![no_std] diff --git a/src/test/ui/bastion-of-the-turbofish.rs b/src/test/ui/bastion-of-the-turbofish.rs index 0716fcf7f26a8..be8c99d429fb1 100644 --- a/src/test/ui/bastion-of-the-turbofish.rs +++ b/src/test/ui/bastion-of-the-turbofish.rs @@ -26,9 +26,7 @@ // My heart aches in sorrow, for I know I am defeated. Let this be a warning // to all those who come after. Here stands the bastion of the Turbofish. -// See https://github.com/rust-lang/rust/pull/53562 -// and https://github.com/rust-lang/rfcs/pull/2527 -// for context. +// See PR #53562 and RFC #2527 for context. fn main() { let (oh, woe, is, me) = ("the", "Turbofish", "remains", "undefeated"); diff --git a/src/test/ui/borrowck/borrowck-access-permissions.rs b/src/test/ui/borrowck/borrowck-access-permissions.rs index 993742f427e03..1a239a5416c22 100644 --- a/src/test/ui/borrowck/borrowck-access-permissions.rs +++ b/src/test/ui/borrowck/borrowck-access-permissions.rs @@ -55,6 +55,6 @@ fn main() { let foo_ref = &foo; let _y = &mut *foo_ref.f; //[ast]~ ERROR [E0389] //[mir]~^ ERROR [E0596] - // FIXME: Wrong error in MIR + // FIXME: wrong error in MIR } } diff --git a/src/test/ui/borrowck/borrowck-assign-comp.rs b/src/test/ui/borrowck/borrowck-assign-comp.rs index 0cacc3882d800..42607c71e79fe 100644 --- a/src/test/ui/borrowck/borrowck-assign-comp.rs +++ b/src/test/ui/borrowck/borrowck-assign-comp.rs @@ -9,14 +9,14 @@ fn a() { // This assignment is illegal because the field x is not // inherently mutable; since `p` was made immutable, `p.x` is now - // immutable. Otherwise the type of &_q.x (&isize) would be wrong. + // immutable. Otherwise the type of &_q.x (&isize) would be wrong. p.x = 5; //[ast]~ ERROR cannot assign to `p.x` //[mir]~^ ERROR cannot assign to `p.x` because it is borrowed q.x; } fn c() { - // this is sort of the opposite. We take a loan to the interior of `p` + // this is sort of the opposite. We take a loan to the interior of `p` // and then try to overwrite `p` as a whole. let mut p = Point {x: 3, y: 4}; diff --git a/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue.rs b/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue.rs index 88bd106d6f35e..05d951dd4c9d8 100644 --- a/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue.rs +++ b/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue.rs @@ -1,4 +1,4 @@ -//buggy.rs +// buggy.rs #![feature(box_syntax)] diff --git a/src/test/ui/borrowck/borrowck-drop-from-guard.rs b/src/test/ui/borrowck/borrowck-drop-from-guard.rs index 67a2275dcf74f..901b3d0d268c7 100644 --- a/src/test/ui/borrowck/borrowck-drop-from-guard.rs +++ b/src/test/ui/borrowck/borrowck-drop-from-guard.rs @@ -1,4 +1,4 @@ -//compile-flags: -Z borrowck=mir +// compile-flags: -Z borrowck=mir fn foo(_:String) {} diff --git a/src/test/ui/borrowck/borrowck-lend-flow-if.rs b/src/test/ui/borrowck/borrowck-lend-flow-if.rs index 1150346f752fa..9e36a8f46e048 100644 --- a/src/test/ui/borrowck/borrowck-lend-flow-if.rs +++ b/src/test/ui/borrowck/borrowck-lend-flow-if.rs @@ -1,7 +1,7 @@ // Note: the borrowck analysis is currently flow-insensitive. // Therefore, some of these errors are marked as spurious and could be -// corrected by a simple change to the analysis. The others are -// either genuine or would require more advanced changes. The latter +// corrected by a simple change to the analysis. The others are +// either genuine or would require more advanced changes. The latter // cases are noted. #![feature(box_syntax)] diff --git a/src/test/ui/borrowck/borrowck-lend-flow.rs b/src/test/ui/borrowck/borrowck-lend-flow.rs index 0eb62ede5d65a..e32eaa8a9f19d 100644 --- a/src/test/ui/borrowck/borrowck-lend-flow.rs +++ b/src/test/ui/borrowck/borrowck-lend-flow.rs @@ -1,7 +1,7 @@ // Note: the borrowck analysis is currently flow-insensitive. // Therefore, some of these errors are marked as spurious and could be -// corrected by a simple change to the analysis. The others are -// either genuine or would require more advanced changes. The latter +// corrected by a simple change to the analysis. The others are +// either genuine or would require more advanced changes. The latter // cases are noted. #![feature(box_syntax)] diff --git a/src/test/ui/borrowck/borrowck-mut-borrow-linear-errors.rs b/src/test/ui/borrowck/borrowck-mut-borrow-linear-errors.rs index bb0b26ecf0663..88c081aa4dcf0 100644 --- a/src/test/ui/borrowck/borrowck-mut-borrow-linear-errors.rs +++ b/src/test/ui/borrowck/borrowck-mut-borrow-linear-errors.rs @@ -1,5 +1,5 @@ // Test to ensure we only report an error for the first issued loan that -// conflicts with a new loan, as opposed to every issued loan. This keeps us +// conflicts with a new loan, as opposed to every issued loan. This keeps us // down to O(n) errors (for n problem lines), instead of O(n^2) errors. // revisions: ast mir diff --git a/src/test/ui/borrowck/borrowck-slice-pattern-element-loan.rs b/src/test/ui/borrowck/borrowck-slice-pattern-element-loan.rs index 5de8dd3305e37..50c5ae12e9f2e 100644 --- a/src/test/ui/borrowck/borrowck-slice-pattern-element-loan.rs +++ b/src/test/ui/borrowck/borrowck-slice-pattern-element-loan.rs @@ -1,4 +1,4 @@ -//compile-flags: -Z borrowck=mir +// compile-flags: -Z borrowck=mir #![feature(slice_patterns)] diff --git a/src/test/ui/borrowck/borrowck-struct-update-with-dtor.rs b/src/test/ui/borrowck/borrowck-struct-update-with-dtor.rs index da5bb6366314a..a2547d2a372f1 100644 --- a/src/test/ui/borrowck/borrowck-struct-update-with-dtor.rs +++ b/src/test/ui/borrowck/borrowck-struct-update-with-dtor.rs @@ -1,7 +1,7 @@ // revisions: ast mir //[mir]compile-flags: -Z borrowck=mir -// Issue 4691: Ensure that functional-struct-update can only copy, not +// Issue #4691: Ensure that functional-struct-update can only copy, not // move, when the struct implements Drop. struct B; diff --git a/src/test/ui/borrowck/immutable-arg.rs b/src/test/ui/borrowck/immutable-arg.rs index 5a5e619ef31f2..4959b4992bf7b 100644 --- a/src/test/ui/borrowck/immutable-arg.rs +++ b/src/test/ui/borrowck/immutable-arg.rs @@ -1,4 +1,4 @@ -//compile-flags: -Z borrowck=compare +// compile-flags: -Z borrowck=compare fn foo(_x: u32) { _x = 4; diff --git a/src/test/ui/borrowck/regions-bound-missing-bound-in-impl.rs b/src/test/ui/borrowck/regions-bound-missing-bound-in-impl.rs index da918ba92b863..c8dc461b08fa5 100644 --- a/src/test/ui/borrowck/regions-bound-missing-bound-in-impl.rs +++ b/src/test/ui/borrowck/regions-bound-missing-bound-in-impl.rs @@ -30,7 +30,7 @@ impl<'a, 't> Foo<'a, 't> for &'a isize { // Note: This is a terrible error message. It is caused // because, in the trait, 'b is early bound, and in the impl, // 'c is early bound, so -- after substitution -- the - // lifetimes themselves look isomorphic. We fail because the + // lifetimes themselves look isomorphic. We fail because the // lifetimes that appear in the types are in the wrong // order. This should really be fixed by keeping more // information about the lifetime declarations in the trait so diff --git a/src/test/ui/changing-crates.rs b/src/test/ui/changing-crates.rs index 60c043bc43f88..74ade67ebca69 100644 --- a/src/test/ui/changing-crates.rs +++ b/src/test/ui/changing-crates.rs @@ -1,6 +1,6 @@ -// ignore-msvc FIXME #31306 +// ignore-msvc FIXME(#31306) -// note that these aux-build directives must be in this order +// Note that these aux-build directives must be in this order: // aux-build:changing-crates-a1.rs // aux-build:changing-crates-b.rs // aux-build:changing-crates-a2.rs diff --git a/src/test/ui/closures/closure-reform-bad.rs b/src/test/ui/closures/closure-reform-bad.rs index 0ba48ab518442..71072e5b77ce3 100644 --- a/src/test/ui/closures/closure-reform-bad.rs +++ b/src/test/ui/closures/closure-reform-bad.rs @@ -1,6 +1,3 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - fn call_bare(f: fn(&str)) { f("Hello "); } @@ -8,5 +5,5 @@ fn call_bare(f: fn(&str)) { fn main() { let string = "world!"; let f = |s: &str| println!("{}{}", s, string); - call_bare(f) //~ ERROR mismatched types + call_bare(f) //~ ERROR mismatched types } diff --git a/src/test/ui/closures/closure-reform-bad.stderr b/src/test/ui/closures/closure-reform-bad.stderr index 76f88d0490745..7948f2d72b71e 100644 --- a/src/test/ui/closures/closure-reform-bad.stderr +++ b/src/test/ui/closures/closure-reform-bad.stderr @@ -1,11 +1,11 @@ error[E0308]: mismatched types - --> $DIR/closure-reform-bad.rs:11:15 + --> $DIR/closure-reform-bad.rs:8:15 | -LL | call_bare(f) //~ ERROR mismatched types +LL | call_bare(f) //~ ERROR mismatched types | ^ expected fn pointer, found closure | = note: expected type `for<'r> fn(&'r str)` - found type `[closure@$DIR/closure-reform-bad.rs:10:13: 10:50 string:_]` + found type `[closure@$DIR/closure-reform-bad.rs:7:13: 7:50 string:_]` error: aborting due to previous error diff --git a/src/test/ui/closures/closure-wrong-kind.rs b/src/test/ui/closures/closure-wrong-kind.rs index 9bf38bfb66b62..3e159103436ca 100644 --- a/src/test/ui/closures/closure-wrong-kind.rs +++ b/src/test/ui/closures/closure-wrong-kind.rs @@ -1,12 +1,10 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - struct X; + fn foo(_: T) {} fn bar(_: T) {} fn main() { let x = X; - let closure = |_| foo(x); //~ ERROR E0525 + let closure = |_| foo(x); //~ ERROR E0525 bar(closure); } diff --git a/src/test/ui/closures/closure-wrong-kind.stderr b/src/test/ui/closures/closure-wrong-kind.stderr index b289ea2964426..06f0d93ee7d29 100644 --- a/src/test/ui/closures/closure-wrong-kind.stderr +++ b/src/test/ui/closures/closure-wrong-kind.stderr @@ -1,7 +1,7 @@ error[E0525]: expected a closure that implements the `Fn` trait, but this closure only implements `FnOnce` - --> $DIR/closure-wrong-kind.rs:10:19 + --> $DIR/closure-wrong-kind.rs:8:19 | -LL | let closure = |_| foo(x); //~ ERROR E0525 +LL | let closure = |_| foo(x); //~ ERROR E0525 | ^^^^^^^^-^ | | | | | closure is `FnOnce` because it moves the variable `x` out of its environment diff --git a/src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-implemented.rs b/src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-implemented.rs index 46d878859e0e6..e7d3ac9a6d7d9 100644 --- a/src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-implemented.rs +++ b/src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-implemented.rs @@ -2,7 +2,7 @@ use std::fmt::Debug; use std::default::Default; // Test that two blanket impls conflict (at least without negative -// bounds). After all, some other crate could implement Even or Odd +// bounds). After all, some other crate could implement Even or Odd // for the same type (though this crate doesn't). trait MyTrait { diff --git a/src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-unimplemented.rs b/src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-unimplemented.rs index 0044760161e5c..c8ff8ebc05c48 100644 --- a/src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-unimplemented.rs +++ b/src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-unimplemented.rs @@ -2,7 +2,7 @@ use std::fmt::Debug; use std::default::Default; // Test that two blanket impls conflict (at least without negative -// bounds). After all, some other crate could implement Even or Odd +// bounds). After all, some other crate could implement Even or Odd // for the same type (though this crate doesn't implement them at all). trait MyTrait { diff --git a/src/test/ui/conditional-compilation/cfg-attr-crate-2.rs b/src/test/ui/conditional-compilation/cfg-attr-crate-2.rs index 9345229704a67..c7c3192115af8 100644 --- a/src/test/ui/conditional-compilation/cfg-attr-crate-2.rs +++ b/src/test/ui/conditional-compilation/cfg-attr-crate-2.rs @@ -1,7 +1,7 @@ // // compile-flags: --cfg broken -// https://github.com/rust-lang/rust/issues/21833#issuecomment-72353044 +// See . #![cfg_attr(broken, no_core)] //~ ERROR no_core is experimental diff --git a/src/test/ui/constructor-lifetime-args.rs b/src/test/ui/constructor-lifetime-args.rs index 6af5f6d56e7f6..43ee087f60048 100644 --- a/src/test/ui/constructor-lifetime-args.rs +++ b/src/test/ui/constructor-lifetime-args.rs @@ -4,7 +4,7 @@ // it would get late bound lifetime parameters. // Variant constructors behave in the same way, lifetime parameters are considered // belonging to the enum and being early bound. -// https://github.com/rust-lang/rust/issues/30904 +// See issue #30904. struct S<'a, 'b>(&'a u8, &'b u8); enum E<'a, 'b> { diff --git a/src/test/ui/consts/const-eval/const-eval-overflow-3.rs b/src/test/ui/consts/const-eval/const-eval-overflow-3.rs index 95deb04fb01d5..fdadd47700719 100644 --- a/src/test/ui/consts/const-eval/const-eval-overflow-3.rs +++ b/src/test/ui/consts/const-eval/const-eval-overflow-3.rs @@ -3,7 +3,7 @@ // // This test is checking the count in an array expression. -// FIXME (#23926): the error output is not consistent between a +// FIXME(#23926): the error output is not consistent between a // self-hosted and a cross-compiled setup; therefore resorting to // error-pattern for now. diff --git a/src/test/ui/consts/const-eval/const-eval-overflow-3b.rs b/src/test/ui/consts/const-eval/const-eval-overflow-3b.rs index 5a6be0c9bd38b..60d676ce59c35 100644 --- a/src/test/ui/consts/const-eval/const-eval-overflow-3b.rs +++ b/src/test/ui/consts/const-eval/const-eval-overflow-3b.rs @@ -7,7 +7,7 @@ // types for the left- and right-hand sides of the addition do not // match (as well as overflow). -// FIXME (#23926): the error output is not consistent between a +// FIXME(#23926): the error output is not consistent between a // self-hosted and a cross-compiled setup; therefore resorting to // error-pattern for now. diff --git a/src/test/ui/consts/const-eval/issue-51300.rs b/src/test/ui/consts/const-eval/issue-51300.rs index 72a6072e4b7b4..e7b96e3c524d4 100644 --- a/src/test/ui/consts/const-eval/issue-51300.rs +++ b/src/test/ui/consts/const-eval/issue-51300.rs @@ -1,5 +1,4 @@ // compile-pass -// https://github.com/rust-lang/rust/issues/51300 #[derive(PartialEq, Eq, Clone, Copy)] pub struct Stat { diff --git a/src/test/ui/consts/const-validation-fail-55455.rs b/src/test/ui/consts/const-validation-fail-55455.rs index def4062339f96..2e0ec726a8804 100644 --- a/src/test/ui/consts/const-validation-fail-55455.rs +++ b/src/test/ui/consts/const-validation-fail-55455.rs @@ -1,9 +1,7 @@ -// https://github.com/rust-lang/rust/issues/55454 // compile-pass struct This(T); const C: This> = This(Some(&1)); -fn main() { -} +fn main() {} diff --git a/src/test/ui/consts/const_short_circuit.stderr b/src/test/ui/consts/const_short_circuit.stderr index a67bb0b1b6d98..cd67aede721a4 100644 --- a/src/test/ui/consts/const_short_circuit.stderr +++ b/src/test/ui/consts/const_short_circuit.stderr @@ -4,7 +4,7 @@ error: new features like let bindings are not permitted in constants which also LL | let mut x = true && false; | ^^^^^ | -note: use of `&&` operator here does not actually short circuit due to the const evaluator presently not being able to do control flow. See https://github.com/rust-lang/rust/issues/49146 for more information. +note: use of `&&` operator here does not actually short circuit due to the const evaluator presently not being able to do control flow. See for more information. --> $DIR/const_short_circuit.rs:6:22 | LL | let mut x = true && false; @@ -16,7 +16,7 @@ error: new features like let bindings are not permitted in constants which also LL | let x = true && false; | ^ | -note: use of `&&` operator here does not actually short circuit due to the const evaluator presently not being able to do control flow. See https://github.com/rust-lang/rust/issues/49146 for more information. +note: use of `&&` operator here does not actually short circuit due to the const evaluator presently not being able to do control flow. See for more information. --> $DIR/const_short_circuit.rs:11:18 | LL | let x = true && false; diff --git a/src/test/ui/consts/dangling-alloc-id-ice.rs b/src/test/ui/consts/dangling-alloc-id-ice.rs index 695d33b690898..fc4293a57a8f5 100644 --- a/src/test/ui/consts/dangling-alloc-id-ice.rs +++ b/src/test/ui/consts/dangling-alloc-id-ice.rs @@ -1,4 +1,4 @@ -// https://github.com/rust-lang/rust/issues/55223 +// See issue #55223. #![feature(const_let)] diff --git a/src/test/ui/consts/promoted-validation-55454.rs b/src/test/ui/consts/promoted-validation-55454.rs index 5e193b1b7de0b..f6f4f466ffcaa 100644 --- a/src/test/ui/consts/promoted-validation-55454.rs +++ b/src/test/ui/consts/promoted-validation-55454.rs @@ -1,4 +1,5 @@ -// https://github.com/rust-lang/rust/issues/55454 +// See issue #55454. + // compile-pass #[derive(PartialEq)] diff --git a/src/test/ui/derives/deriving-copyclone.rs b/src/test/ui/derives/deriving-copyclone.rs index afe619690711f..7660102794b69 100644 --- a/src/test/ui/derives/deriving-copyclone.rs +++ b/src/test/ui/derives/deriving-copyclone.rs @@ -1,38 +1,40 @@ -// this will get a no-op Clone impl +// This will get a no-op `Clone` impl. #[derive(Copy, Clone)] struct A { a: i32, b: i64 } -// this will get a deep Clone impl +// This will get a no-op `Clone` impl. #[derive(Copy, Clone)] struct B { a: i32, b: T } -struct C; // not Copy or Clone -#[derive(Clone)] struct D; // Clone but not Copy +// Not `Copy` or `Clone`. +struct C; +// `Clone` but not `Copy`. +#[derive(Clone)] +struct D; fn is_copy(_: T) {} fn is_clone(_: T) {} fn main() { - // A can be copied and cloned + // `A` can be copied and cloned. is_copy(A { a: 1, b: 2 }); is_clone(A { a: 1, b: 2 }); - // B can be copied and cloned + // `B` can be copied and cloned. is_copy(B { a: 1, b: 2 }); is_clone(B { a: 1, b: 2 }); - // B cannot be copied or cloned + // `B` cannot be copied or cloned. is_copy(B { a: 1, b: C }); //~ERROR Copy is_clone(B { a: 1, b: C }); //~ERROR Clone - // B can be cloned but not copied + // `B` can be cloned but not copied. is_copy(B { a: 1, b: D }); //~ERROR Copy is_clone(B { a: 1, b: D }); } - diff --git a/src/test/ui/derives/deriving-copyclone.stderr b/src/test/ui/derives/deriving-copyclone.stderr index 0a9fdd34fe2e0..371994dbcd7ef 100644 --- a/src/test/ui/derives/deriving-copyclone.stderr +++ b/src/test/ui/derives/deriving-copyclone.stderr @@ -1,38 +1,38 @@ error[E0277]: the trait bound `C: std::marker::Copy` is not satisfied - --> $DIR/deriving-copyclone.rs:31:5 + --> $DIR/deriving-copyclone.rs:34:5 | LL | is_copy(B { a: 1, b: C }); //~ERROR Copy | ^^^^^^^ the trait `std::marker::Copy` is not implemented for `C` | = note: required because of the requirements on the impl of `std::marker::Copy` for `B` note: required by `is_copy` - --> $DIR/deriving-copyclone.rs:18:1 + --> $DIR/deriving-copyclone.rs:21:1 | LL | fn is_copy(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `C: std::clone::Clone` is not satisfied - --> $DIR/deriving-copyclone.rs:32:5 + --> $DIR/deriving-copyclone.rs:35:5 | LL | is_clone(B { a: 1, b: C }); //~ERROR Clone | ^^^^^^^^ the trait `std::clone::Clone` is not implemented for `C` | = note: required because of the requirements on the impl of `std::clone::Clone` for `B` note: required by `is_clone` - --> $DIR/deriving-copyclone.rs:19:1 + --> $DIR/deriving-copyclone.rs:22:1 | LL | fn is_clone(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `D: std::marker::Copy` is not satisfied - --> $DIR/deriving-copyclone.rs:35:5 + --> $DIR/deriving-copyclone.rs:38:5 | LL | is_copy(B { a: 1, b: D }); //~ERROR Copy | ^^^^^^^ the trait `std::marker::Copy` is not implemented for `D` | = note: required because of the requirements on the impl of `std::marker::Copy` for `B` note: required by `is_copy` - --> $DIR/deriving-copyclone.rs:18:1 + --> $DIR/deriving-copyclone.rs:21:1 | LL | fn is_copy(_: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/did_you_mean/issue-36798.stderr b/src/test/ui/did_you_mean/issue-36798.stderr index 8273fad476462..41dc15c1b81e7 100644 --- a/src/test/ui/did_you_mean/issue-36798.stderr +++ b/src/test/ui/did_you_mean/issue-36798.stderr @@ -2,7 +2,7 @@ error[E0609]: no field `baz` on type `Foo` --> $DIR/issue-36798.rs:7:7 | LL | f.baz; //~ ERROR no field - | ^^^ help: a field with a similar name exists: `bar` + | ^^^ did you mean `bar`? error: aborting due to previous error diff --git a/src/test/ui/did_you_mean/issue-42599_available_fields_note.stderr b/src/test/ui/did_you_mean/issue-42599_available_fields_note.stderr index e5dd61c45d662..808ff1670da09 100644 --- a/src/test/ui/did_you_mean/issue-42599_available_fields_note.stderr +++ b/src/test/ui/did_you_mean/issue-42599_available_fields_note.stderr @@ -2,7 +2,7 @@ error[E0560]: struct `submodule::Demo` has no field named `inocently_mispellable --> $DIR/issue-42599_available_fields_note.rs:16:39 | LL | Self { secret_integer: 2, inocently_mispellable: () } - | ^^^^^^^^^^^^^^^^^^^^^ help: a field with a similar name exists: `innocently_misspellable` + | ^^^^^^^^^^^^^^^^^^^^^ field does not exist - did you mean `innocently_misspellable`? error[E0560]: struct `submodule::Demo` has no field named `egregiously_nonexistent_field` --> $DIR/issue-42599_available_fields_note.rs:21:39 @@ -16,7 +16,7 @@ error[E0609]: no field `inocently_mispellable` on type `submodule::Demo` --> $DIR/issue-42599_available_fields_note.rs:32:41 | LL | let innocent_field_misaccess = demo.inocently_mispellable; - | ^^^^^^^^^^^^^^^^^^^^^ help: a field with a similar name exists: `innocently_misspellable` + | ^^^^^^^^^^^^^^^^^^^^^ did you mean `innocently_misspellable`? error[E0609]: no field `egregiously_nonexistent_field` on type `submodule::Demo` --> $DIR/issue-42599_available_fields_note.rs:35:42 diff --git a/src/test/ui/discrim/discrim-overflow-2.rs b/src/test/ui/discrim/discrim-overflow-2.rs index 9ff39cd048454..3feb15f0ec995 100644 --- a/src/test/ui/discrim/discrim-overflow-2.rs +++ b/src/test/ui/discrim/discrim-overflow-2.rs @@ -1,6 +1,6 @@ // ignore-tidy-linelength -// Issue 23030: Detect overflowing discriminant +// Issue #23030: Detect overflowing discriminant // // Check that we detect the overflow even if enum is not used. diff --git a/src/test/ui/discrim/discrim-overflow.rs b/src/test/ui/discrim/discrim-overflow.rs index c612661178cf6..dbedfa5bec2ee 100644 --- a/src/test/ui/discrim/discrim-overflow.rs +++ b/src/test/ui/discrim/discrim-overflow.rs @@ -1,6 +1,6 @@ // ignore-tidy-linelength -// Issue 23030: Detect overflowing discriminant +// Issue #23030: Detect overflowing discriminant // See also run-pass/discrim-explicit-23030.rs where the suggested // workaround is tested. diff --git a/src/test/ui/dropck/dropck_no_diverge_on_nonregular_1.rs b/src/test/ui/dropck/dropck_no_diverge_on_nonregular_1.rs index 6ca5f5e3c5fcf..1f1e6f49e11f8 100644 --- a/src/test/ui/dropck/dropck_no_diverge_on_nonregular_1.rs +++ b/src/test/ui/dropck/dropck_no_diverge_on_nonregular_1.rs @@ -1,4 +1,4 @@ -// Issue 22443: Reject code using non-regular types that would +// Issue #22443: reject code using non-regular types that would // otherwise cause dropck to loop infinitely. use std::marker::PhantomData; @@ -9,19 +9,18 @@ struct Digit { struct Node { m: PhantomData<&'static T> } - enum FingerTree { Single(T), - // Bug report said Digit after Box would stack overflow (versus - // Digit before Box; see dropck_no_diverge_on_nonregular_2). + // Bug report indicated `Digit` after `Box` would stack-overflow (versus + // `Digit` before `Box`; see `dropck_no_diverge_on_nonregular_2`). Deep( Box>>, Digit, - ) + ) } fn main() { - let ft = //~ ERROR overflow while adding drop-check rules for FingerTree - FingerTree::Single(1); - //~^ ERROR overflow while adding drop-check rules for FingerTree + let ft = FingerTree::Single(1); + //~^ ERROR overflow while adding drop-check rules for `FingerTree` [E0320] + //~^^ ERROR overflow while adding drop-check rules for `FingerTree` [E0320] } diff --git a/src/test/ui/dropck/dropck_no_diverge_on_nonregular_1.stderr b/src/test/ui/dropck/dropck_no_diverge_on_nonregular_1.stderr index 317ac7674311a..a44a849dd31db 100644 --- a/src/test/ui/dropck/dropck_no_diverge_on_nonregular_1.stderr +++ b/src/test/ui/dropck/dropck_no_diverge_on_nonregular_1.stderr @@ -1,16 +1,16 @@ -error[E0320]: overflow while adding drop-check rules for FingerTree - --> $DIR/dropck_no_diverge_on_nonregular_1.rs:24:9 +error[E0320]: overflow while adding drop-check rules for `FingerTree` + --> $DIR/dropck_no_diverge_on_nonregular_1.rs:23:9 | -LL | let ft = //~ ERROR overflow while adding drop-check rules for FingerTree +LL | let ft = FingerTree::Single(1); | ^^ | = note: overflowed on FingerTree>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> -error[E0320]: overflow while adding drop-check rules for FingerTree - --> $DIR/dropck_no_diverge_on_nonregular_1.rs:25:9 +error[E0320]: overflow while adding drop-check rules for `FingerTree` + --> $DIR/dropck_no_diverge_on_nonregular_1.rs:23:14 | -LL | FingerTree::Single(1); - | ^^^^^^^^^^^^^^^^^^^^^ +LL | let ft = FingerTree::Single(1); + | ^^^^^^^^^^^^^^^^^^^^^ | = note: overflowed on FingerTree>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> diff --git a/src/test/ui/dropck/dropck_no_diverge_on_nonregular_2.rs b/src/test/ui/dropck/dropck_no_diverge_on_nonregular_2.rs index d34f7e326d15f..294794d43153c 100644 --- a/src/test/ui/dropck/dropck_no_diverge_on_nonregular_2.rs +++ b/src/test/ui/dropck/dropck_no_diverge_on_nonregular_2.rs @@ -1,4 +1,4 @@ -// Issue 22443: Reject code using non-regular types that would +// Issue #22443: reject code using non-regular types that would // otherwise cause dropck to loop infinitely. use std::marker::PhantomData; @@ -11,16 +11,16 @@ struct Node { m: PhantomData<&'static T> } enum FingerTree { Single(T), - // Bug report said Digit before Box would infinite loop (versus - // Digit after Box; see dropck_no_diverge_on_nonregular_1). + // Bug report indicated `Digit` before `Box` would loop infinitely (versus + // `Digit` before `Box`; see `dropck_no_diverge_on_nonregular_1`). Deep( Digit, Box>>, - ) + ) } fn main() { - let ft = //~ ERROR overflow while adding drop-check rules for FingerTree - FingerTree::Single(1); - //~^ ERROR overflow while adding drop-check rules for FingerTree + let ft = FingerTree::Single(1); + //~^ ERROR overflow while adding drop-check rules for `FingerTree` [E0320] + //~^^ ERROR overflow while adding drop-check rules for `FingerTree` [E0320] } diff --git a/src/test/ui/dropck/dropck_no_diverge_on_nonregular_2.stderr b/src/test/ui/dropck/dropck_no_diverge_on_nonregular_2.stderr index b87e7a111493e..8a72adfa4026d 100644 --- a/src/test/ui/dropck/dropck_no_diverge_on_nonregular_2.stderr +++ b/src/test/ui/dropck/dropck_no_diverge_on_nonregular_2.stderr @@ -1,16 +1,16 @@ -error[E0320]: overflow while adding drop-check rules for FingerTree +error[E0320]: overflow while adding drop-check rules for `FingerTree` --> $DIR/dropck_no_diverge_on_nonregular_2.rs:23:9 | -LL | let ft = //~ ERROR overflow while adding drop-check rules for FingerTree +LL | let ft = FingerTree::Single(1); | ^^ | = note: overflowed on FingerTree>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> -error[E0320]: overflow while adding drop-check rules for FingerTree - --> $DIR/dropck_no_diverge_on_nonregular_2.rs:24:9 +error[E0320]: overflow while adding drop-check rules for `FingerTree` + --> $DIR/dropck_no_diverge_on_nonregular_2.rs:23:14 | -LL | FingerTree::Single(1); - | ^^^^^^^^^^^^^^^^^^^^^ +LL | let ft = FingerTree::Single(1); + | ^^^^^^^^^^^^^^^^^^^^^ | = note: overflowed on FingerTree>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> diff --git a/src/test/ui/dropck/dropck_no_diverge_on_nonregular_3.rs b/src/test/ui/dropck/dropck_no_diverge_on_nonregular_3.rs index e2e600b17f21e..492ba719ea0e6 100644 --- a/src/test/ui/dropck/dropck_no_diverge_on_nonregular_3.rs +++ b/src/test/ui/dropck/dropck_no_diverge_on_nonregular_3.rs @@ -1,4 +1,4 @@ -// Issue 22443: Reject code using non-regular types that would +// Issue #22443: reject code using non-regular types that would // otherwise cause dropck to loop infinitely. // // This version is just checking that we still sanely handle a trivial @@ -6,6 +6,8 @@ // error messages will report different types depending on which type // dropck is analyzing.) +// ignore-tidy-linelength + use std::marker::PhantomData; struct Digit { @@ -16,11 +18,11 @@ struct Node { m: PhantomData<&'static T> } enum FingerTree { Single(T), - // According to the bug report, Digit before Box would infinite loop. + // Bug report indicated `Digit` before `Box` would loop infinitely. Deep( Digit, Box>>, - ) + ) } enum Wrapper { @@ -29,8 +31,8 @@ enum Wrapper { } fn main() { - let w = //~ ERROR overflow while adding drop-check rules for std::option - Some(Wrapper::Simple::); - //~^ ERROR overflow while adding drop-check rules for std::option::Option - //~| ERROR overflow while adding drop-check rules for Wrapper + let w = Some(Wrapper::Simple::); + //~^ ERROR overflow while adding drop-check rules for `std::option::Option>` [E0320] + //~^^ ERROR overflow while adding drop-check rules for `std::option::Option>` [E0320] + //~| ERROR overflow while adding drop-check rules for `Wrapper` [E0320] } diff --git a/src/test/ui/dropck/dropck_no_diverge_on_nonregular_3.stderr b/src/test/ui/dropck/dropck_no_diverge_on_nonregular_3.stderr index 799ee45a2022d..9ba629df2b8de 100644 --- a/src/test/ui/dropck/dropck_no_diverge_on_nonregular_3.stderr +++ b/src/test/ui/dropck/dropck_no_diverge_on_nonregular_3.stderr @@ -1,24 +1,24 @@ -error[E0320]: overflow while adding drop-check rules for std::option::Option> - --> $DIR/dropck_no_diverge_on_nonregular_3.rs:32:9 +error[E0320]: overflow while adding drop-check rules for `std::option::Option>` + --> $DIR/dropck_no_diverge_on_nonregular_3.rs:34:9 | -LL | let w = //~ ERROR overflow while adding drop-check rules for std::option +LL | let w = Some(Wrapper::Simple::); | ^ | = note: overflowed on FingerTree>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> -error[E0320]: overflow while adding drop-check rules for std::option::Option> - --> $DIR/dropck_no_diverge_on_nonregular_3.rs:33:9 +error[E0320]: overflow while adding drop-check rules for `std::option::Option>` + --> $DIR/dropck_no_diverge_on_nonregular_3.rs:34:13 | -LL | Some(Wrapper::Simple::); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | let w = Some(Wrapper::Simple::); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: overflowed on FingerTree>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> -error[E0320]: overflow while adding drop-check rules for Wrapper - --> $DIR/dropck_no_diverge_on_nonregular_3.rs:33:14 +error[E0320]: overflow while adding drop-check rules for `Wrapper` + --> $DIR/dropck_no_diverge_on_nonregular_3.rs:34:18 | -LL | Some(Wrapper::Simple::); - | ^^^^^^^^^^^^^^^^^^^^^^ +LL | let w = Some(Wrapper::Simple::); + | ^^^^^^^^^^^^^^^^^^^^^^ | = note: overflowed on FingerTree>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> diff --git a/src/test/ui/e0119/auxiliary/complex_impl_support.rs b/src/test/ui/e0119/auxiliary/complex_impl_support.rs index ad5bb107fc6e7..ad0d9e23814e4 100644 --- a/src/test/ui/e0119/auxiliary/complex_impl_support.rs +++ b/src/test/ui/e0119/auxiliary/complex_impl_support.rs @@ -16,7 +16,7 @@ where 'b: 'a, T: 'a, U: (FnOnce(T) -> V) + 'static, - V: Iterator + Clone, + V: Iterator + Clone, W: std::ops::Add, W::Output: Copy, {} diff --git a/src/test/ui/e0119/auxiliary/issue_23563_a.rs b/src/test/ui/e0119/auxiliary/issue_23563_a.rs index 4e85bcc4ba623..860ae65fd5272 100644 --- a/src/test/ui/e0119/auxiliary/issue_23563_a.rs +++ b/src/test/ui/e0119/auxiliary/issue_23563_a.rs @@ -1,4 +1,4 @@ -// Ref: https://github.com/rust-lang/rust/issues/23563#issuecomment-260751672 +// See . pub trait LolTo { fn convert_to(&self) -> T; diff --git a/src/test/ui/e0119/issue-23563.rs b/src/test/ui/e0119/issue-23563.rs index a2804fcf1cc55..c312184946025 100644 --- a/src/test/ui/e0119/issue-23563.rs +++ b/src/test/ui/e0119/issue-23563.rs @@ -1,6 +1,6 @@ // aux-build:issue_23563_a.rs -// Ref: https://github.com/rust-lang/rust/issues/23563#issuecomment-260751672 +// See . extern crate issue_23563_a as a; diff --git a/src/test/ui/enum/enum-discrim-too-small.rs b/src/test/ui/enum/enum-discrim-too-small.rs index e498414020b41..d168b9ba5b346 100644 --- a/src/test/ui/enum/enum-discrim-too-small.rs +++ b/src/test/ui/enum/enum-discrim-too-small.rs @@ -30,7 +30,7 @@ enum Eu64 { //~^ ERROR cannot apply unary operator `-` to type `u64` } -// u64 currently allows negative numbers, and i64 allows numbers greater than `1<<63`. This is a +// u64 currently allows negative numbers, and i64 allows numbers greater than `1<<63`. This is a // little counterintuitive, but since the discriminant can store all the bits, and extracting it // with a cast requires specifying the signedness, there is no loss of information in those cases. // This also applies to isize and usize on 64-bit targets. diff --git a/src/test/ui/enum/enum-discrim-too-small2.rs b/src/test/ui/enum/enum-discrim-too-small2.rs index af60564302599..72f801882b6e5 100644 --- a/src/test/ui/enum/enum-discrim-too-small2.rs +++ b/src/test/ui/enum/enum-discrim-too-small2.rs @@ -29,7 +29,7 @@ enum Ei64 { Ci64 = 9223372036854775809, //~ ERROR literal out of range for i64 } -// u64 currently allows negative numbers, and i64 allows numbers greater than `1<<63`. This is a +// u64 currently allows negative numbers, and i64 allows numbers greater than `1<<63`. This is a // little counterintuitive, but since the discriminant can store all the bits, and extracting it // with a cast requires specifying the signedness, there is no loss of information in those cases. // This also applies to isize and usize on 64-bit targets. diff --git a/src/test/ui/error-codes/E0128.rs b/src/test/ui/error-codes/E0128.rs index f42c32b91cc06..1e47340888af6 100644 --- a/src/test/ui/error-codes/E0128.rs +++ b/src/test/ui/error-codes/E0128.rs @@ -1,7 +1,6 @@ -struct Foo { //~ ERROR E0128 +struct Foo { //~ ERROR E0128 field1: T, field2: U, } -fn main() { -} +fn main() {} diff --git a/src/test/ui/error-codes/E0128.stderr b/src/test/ui/error-codes/E0128.stderr index 9ea3c09e63f53..a8d27e22788ae 100644 --- a/src/test/ui/error-codes/E0128.stderr +++ b/src/test/ui/error-codes/E0128.stderr @@ -1,8 +1,8 @@ error[E0128]: type parameters with a default cannot use forward declared identifiers - --> $DIR/E0128.rs:1:14 + --> $DIR/E0128.rs:1:16 | -LL | struct Foo { //~ ERROR E0128 - | ^ defaulted type parameters cannot be forward declared +LL | struct Foo { //~ ERROR E0128 + | ^ defaulted type parameters cannot be forward declared error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0229.rs b/src/test/ui/error-codes/E0229.rs index 4c1934107a6d6..20b08399cafef 100644 --- a/src/test/ui/error-codes/E0229.rs +++ b/src/test/ui/error-codes/E0229.rs @@ -10,7 +10,7 @@ impl Foo for isize { fn boo(&self) -> usize { 42 } } -fn baz(x: &>::A) {} +fn baz(x: &>::A) {} //~^ ERROR associated type bindings are not allowed here [E0229] fn main() { diff --git a/src/test/ui/error-codes/E0229.stderr b/src/test/ui/error-codes/E0229.stderr index 46793314bf9f9..6a64110bc8c12 100644 --- a/src/test/ui/error-codes/E0229.stderr +++ b/src/test/ui/error-codes/E0229.stderr @@ -1,8 +1,8 @@ error[E0229]: associated type bindings are not allowed here --> $DIR/E0229.rs:13:25 | -LL | fn baz(x: &>::A) {} - | ^^^^^ associated type not allowed here +LL | fn baz(x: &>::A) {} + | ^^^^^^^ associated type not allowed here error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0393.rs b/src/test/ui/error-codes/E0393.rs index bdd4deafc838e..55104419155c2 100644 --- a/src/test/ui/error-codes/E0393.rs +++ b/src/test/ui/error-codes/E0393.rs @@ -1,7 +1,6 @@ -trait A {} +trait A {} fn together_we_will_rule_the_galaxy(son: &A) {} //~^ ERROR E0393 -fn main() { -} +fn main() {} diff --git a/src/test/ui/error-codes/E0445.rs b/src/test/ui/error-codes/E0445.rs index a9a3aee2500fb..570c37ef2ccbe 100644 --- a/src/test/ui/error-codes/E0445.rs +++ b/src/test/ui/error-codes/E0445.rs @@ -4,9 +4,12 @@ trait Foo { pub trait Bar : Foo {} //~^ ERROR private trait `Foo` in public interface [E0445] +//~| NOTE can't leak private trait pub struct Bar2(pub T); //~^ ERROR private trait `Foo` in public interface [E0445] +//~| NOTE can't leak private trait pub fn foo (t: T) {} //~^ ERROR private trait `Foo` in public interface [E0445] +//~| NOTE can't leak private trait fn main() {} diff --git a/src/test/ui/error-codes/E0445.stderr b/src/test/ui/error-codes/E0445.stderr index d0d6ebe16c7f7..747e4daf74ec2 100644 --- a/src/test/ui/error-codes/E0445.stderr +++ b/src/test/ui/error-codes/E0445.stderr @@ -5,13 +5,13 @@ LL | pub trait Bar : Foo {} | ^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait error[E0445]: private trait `Foo` in public interface - --> $DIR/E0445.rs:7:1 + --> $DIR/E0445.rs:8:1 | LL | pub struct Bar2(pub T); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait error[E0445]: private trait `Foo` in public interface - --> $DIR/E0445.rs:9:1 + --> $DIR/E0445.rs:11:1 | LL | pub fn foo (t: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait diff --git a/src/test/ui/error-codes/E0582.rs b/src/test/ui/error-codes/E0582.rs index ff25012d0f925..2cdd63fb80299 100644 --- a/src/test/ui/error-codes/E0582.rs +++ b/src/test/ui/error-codes/E0582.rs @@ -1,5 +1,5 @@ -// This test was derived from the wasm and parsell crates. They -// stopped compiling when #32330 is fixed. +// This test was derived from the *wasm* and *parsell* crates. They +// stopped compiling when issue #32330 was fixed. #![allow(dead_code, unused_variables)] @@ -33,10 +33,9 @@ fn bar(t: F) fn baz(t: F) // No type can satisfy this requirement, since `'a` does not // appear in any of the input types: - where F: for<'a> Iterator + where F: for<'a> Iterator //~^ ERROR E0582 { } -fn main() { -} +fn main() {} diff --git a/src/test/ui/error-codes/E0582.stderr b/src/test/ui/error-codes/E0582.stderr index 81a2f004653d2..bdd6a223319ac 100644 --- a/src/test/ui/error-codes/E0582.stderr +++ b/src/test/ui/error-codes/E0582.stderr @@ -7,8 +7,8 @@ LL | where F: for<'a> Fn() -> Option<&'a i32> error[E0582]: binding for associated type `Item` references lifetime `'a`, which does not appear in the trait input types --> $DIR/E0582.rs:36:31 | -LL | where F: for<'a> Iterator - | ^^^^^^^^^^^^ +LL | where F: for<'a> Iterator + | ^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/error-codes/E0621-does-not-trigger-for-closures.rs b/src/test/ui/error-codes/E0621-does-not-trigger-for-closures.rs index c58744d386ca5..43992daa5961f 100644 --- a/src/test/ui/error-codes/E0621-does-not-trigger-for-closures.rs +++ b/src/test/ui/error-codes/E0621-does-not-trigger-for-closures.rs @@ -2,7 +2,7 @@ // bound in a closure (rather than suggesting a change to the signature // of the closure, which is not specified in `foo` but rather in `invoke`). -// FIXME - This might be better as a UI test, but the finer details +// FIXME: - This might be better as a UI test, but the finer details // of the error seem to vary on different machines. fn invoke<'a, F>(x: &'a i32, f: F) -> &'a i32 where F: FnOnce(&'a i32, &i32) -> &'a i32 diff --git a/src/test/ui/error-codes/ex-E0612.stderr b/src/test/ui/error-codes/ex-E0612.stderr index 0f498d1643905..e65e8bd814266 100644 --- a/src/test/ui/error-codes/ex-E0612.stderr +++ b/src/test/ui/error-codes/ex-E0612.stderr @@ -2,7 +2,7 @@ error[E0609]: no field `1` on type `Foo` --> $DIR/ex-E0612.rs:5:6 | LL | y.1; //~ ERROR no field `1` on type `Foo` - | ^ help: a field with a similar name exists: `0` + | ^ did you mean `0`? error: aborting due to previous error diff --git a/src/test/ui/existential_types/no_inferrable_concrete_type.rs b/src/test/ui/existential_types/no_inferrable_concrete_type.rs index 6bbe8bdc0cd6d..585eebce228ea 100644 --- a/src/test/ui/existential_types/no_inferrable_concrete_type.rs +++ b/src/test/ui/existential_types/no_inferrable_concrete_type.rs @@ -1,11 +1,11 @@ -// Issue 52985: Cause cycle error if user code provides no use case that allows an existential type +// Issue #52985: Cause cycle error if user code provides no use case that allows an existential type // to be inferred to a concrete type. This results in an infinite cycle during type normalization. #![feature(existential_type)] existential type Foo: Copy; //~ cycle detected -// make compiler happy about using 'Foo' +// Make compiler happy about using `Foo`. fn bar(x: Foo) -> Foo { x } fn main() { diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-macro_escape.rs b/src/test/ui/feature-gate/issue-43106-gating-of-macro_escape.rs index 98ca3444c91bd..8902a21314ed5 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-macro_escape.rs +++ b/src/test/ui/feature-gate/issue-43106-gating-of-macro_escape.rs @@ -1,5 +1,5 @@ // Testing that crate-level `#![macro_escape]` is not gated beyond a -// depecation warning. This file sits on its own, because crate-level +// depecation warning. This file sits on its own, because crate-level // `#![macro_escape]` is incompatible with crate-level `#![macro_use]` // already present in issue-43106-gating-of-builtin-attrs. diff --git a/src/test/ui/feature-gates/feature-gate-negate-unsigned.rs b/src/test/ui/feature-gates/feature-gate-negate-unsigned.rs index 05e04f3e2b48c..06e98ab936e17 100644 --- a/src/test/ui/feature-gates/feature-gate-negate-unsigned.rs +++ b/src/test/ui/feature-gates/feature-gate-negate-unsigned.rs @@ -14,5 +14,5 @@ fn main() { let _y = -x; //~^ ERROR cannot apply unary operator `-` to type `u8` - -S; // should not trigger the gate; issue 26840 + -S; // should not trigger the gate; issue #26840 } diff --git a/src/test/ui/feature-gates/feature-gate-plugin_registrar.rs b/src/test/ui/feature-gates/feature-gate-plugin_registrar.rs index 0e357f89d14a6..232522309f59c 100644 --- a/src/test/ui/feature-gates/feature-gate-plugin_registrar.rs +++ b/src/test/ui/feature-gates/feature-gate-plugin_registrar.rs @@ -1,8 +1,9 @@ // Test that `#[plugin_registrar]` attribute is gated by `plugin_registrar` // feature gate. -// the registration function isn't typechecked yet +// The registration function isn't type-checked yet. #[plugin_registrar] pub fn registrar() {} //~^ ERROR compiler plugins are experimental + fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-simd.rs b/src/test/ui/feature-gates/feature-gate-simd.rs index d01d33de28988..5fbe2c81368fd 100644 --- a/src/test/ui/feature-gates/feature-gate-simd.rs +++ b/src/test/ui/feature-gates/feature-gate-simd.rs @@ -1,4 +1,4 @@ -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616) #[repr(simd)] //~ ERROR SIMD types are experimental struct RGBA { diff --git a/src/test/ui/feature-gates/feature-gate-trivial_bounds.rs b/src/test/ui/feature-gates/feature-gate-trivial_bounds.rs index e5028f2f8aa78..87c4c295abab2 100644 --- a/src/test/ui/feature-gates/feature-gate-trivial_bounds.rs +++ b/src/test/ui/feature-gates/feature-gate-trivial_bounds.rs @@ -33,7 +33,7 @@ fn f() where i32: Foo //~ ERROR generic_function(5i32); } -fn use_op(s: String) -> String where String: ::std::ops::Neg { //~ ERROR +fn use_op(s: String) -> String where String: ::std::ops::Neg { //~ ERROR -s } 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 34c457875ec16..064f7b4e44cc8 100644 --- a/src/test/ui/feature-gates/feature-gate-trivial_bounds.stderr +++ b/src/test/ui/feature-gates/feature-gate-trivial_bounds.stderr @@ -67,7 +67,7 @@ LL | | } error[E0277]: the trait bound `std::string::String: std::ops::Neg` is not satisfied --> $DIR/feature-gate-trivial_bounds.rs:36:1 | -LL | / fn use_op(s: String) -> String where String: ::std::ops::Neg { //~ ERROR +LL | / fn use_op(s: String) -> String where String: ::std::ops::Neg { //~ ERROR LL | | -s LL | | } | |_^ the trait `std::ops::Neg` is not implemented for `std::string::String` diff --git a/src/test/ui/functional-struct-update/functional-struct-update-noncopyable.rs b/src/test/ui/functional-struct-update/functional-struct-update-noncopyable.rs index a9d7d9c8aa903..f985c88a0c09b 100644 --- a/src/test/ui/functional-struct-update/functional-struct-update-noncopyable.rs +++ b/src/test/ui/functional-struct-update/functional-struct-update-noncopyable.rs @@ -1,4 +1,4 @@ -// issue 7327 +// Test for issue #7327. use std::sync::Arc; diff --git a/src/test/ui/functional-struct-update/functional-struct-update-respects-privacy.rs b/src/test/ui/functional-struct-update/functional-struct-update-respects-privacy.rs index 00606af904835..0b9dacfb20773 100644 --- a/src/test/ui/functional-struct-update/functional-struct-update-respects-privacy.rs +++ b/src/test/ui/functional-struct-update/functional-struct-update-respects-privacy.rs @@ -28,5 +28,5 @@ fn main() { let s_2 = foo::S { b: format!("ess two"), ..s_1 }; // FRU ... //~^ ERROR field `secret_uid` of struct `foo::S` is private println!("main forged an S named: {}", s_2.b); - // at end of scope, ... both s_1 *and* s_2 get dropped. Boom! + // at end of scope, ... both s_1 *and* s_2 get dropped. Boom! } diff --git a/src/test/ui/generator-yielding-or-returning-itself.stderr b/src/test/ui/generator-yielding-or-returning-itself.stderr index 5834aed2450b1..190cbf4b57d83 100644 --- a/src/test/ui/generator-yielding-or-returning-itself.stderr +++ b/src/test/ui/generator-yielding-or-returning-itself.stderr @@ -6,7 +6,8 @@ LL | want_cyclic_generator_return(|| { | = note: closures cannot capture themselves or take themselves as argument; this error may be the result of a recent compiler bug-fix, - see https://github.com/rust-lang/rust/issues/46062 for more details + see for more + details note: required by `want_cyclic_generator_return` --> $DIR/generator-yielding-or-returning-itself.rs:9:1 | @@ -24,7 +25,8 @@ LL | want_cyclic_generator_yield(|| { | = note: closures cannot capture themselves or take themselves as argument; this error may be the result of a recent compiler bug-fix, - see https://github.com/rust-lang/rust/issues/46062 for more details + see for more + details note: required by `want_cyclic_generator_yield` --> $DIR/generator-yielding-or-returning-itself.rs:22:1 | diff --git a/src/test/ui/generator/yield-while-iterating.rs b/src/test/ui/generator/yield-while-iterating.rs index b0966d2e921b7..f3edccd664eed 100644 --- a/src/test/ui/generator/yield-while-iterating.rs +++ b/src/test/ui/generator/yield-while-iterating.rs @@ -5,7 +5,7 @@ use std::cell::Cell; fn yield_during_iter_owned_data(x: Vec) { // The generator owns `x`, so we error out when yielding with a - // reference to it. This winds up becoming a rather confusing + // reference to it. This winds up becoming a rather confusing // regionck error -- in particular, we would freeze with the // reference in scope, and it doesn't live long enough. let _b = move || { diff --git a/src/test/ui/generic/generic-lifetime-trait-impl.rs b/src/test/ui/generic/generic-lifetime-trait-impl.rs index 6ffaba19d78b8..d3deca3fba732 100644 --- a/src/test/ui/generic/generic-lifetime-trait-impl.rs +++ b/src/test/ui/generic/generic-lifetime-trait-impl.rs @@ -1,8 +1,8 @@ -// This code used to produce an ICE on the definition of trait Bar +// This code used to produce an ICE on the definition of `trait Bar` // with the following message: // -// Type parameter out of range when substituting in region 'a (root -// type=fn(Self) -> 'astr) (space=FnSpace, index=0) +// Type parameter out of range when substituting in region `'a` (root +// type `fn(Self) -> &'a str`) (space = `FnSpace`, index = `0`). // // Regression test for issue #16218. @@ -19,5 +19,4 @@ impl<'a> Foo<'a> for &'a str { fn bar>(self) -> &'a str { panic!() } //~ ERROR lifetime } -fn main() { -} +fn main() {} diff --git a/src/test/ui/hrtb/hrtb-perfect-forwarding.rs b/src/test/ui/hrtb/hrtb-perfect-forwarding.rs index 90e1773a3f62d..daed0f7fda84d 100644 --- a/src/test/ui/hrtb/hrtb-perfect-forwarding.rs +++ b/src/test/ui/hrtb/hrtb-perfect-forwarding.rs @@ -31,7 +31,7 @@ fn bar_hrtb(mut t: T) where T : for<'b> Bar<&'b isize> { // OK -- `T : for<'b> Bar<&'b isize>`, and thus the impl above - // ensures that `&mut T : for<'b> Bar<&'b isize>`. This is an + // ensures that `&mut T : for<'b> Bar<&'b isize>`. This is an // example of a "perfect forwarding" impl. bar_hrtb(&mut t); } diff --git a/src/test/ui/huge-array-simple.rs b/src/test/ui/huge-array-simple.rs index 5fa874c1fa0d3..c140ee4ed2a10 100644 --- a/src/test/ui/huge-array-simple.rs +++ b/src/test/ui/huge-array-simple.rs @@ -1,11 +1,11 @@ -// FIXME (#23926): the error output is not consistent between a -// self-hosted and a cross-compiled setup. Skipping for now. +// FIXME(#23926): the error output is not consistent between a +// self-hosted and a cross-compiled setup; skipping for now. // ignore-test FIXME(#23926) #![allow(exceeding_bitshifts)] fn main() { - let _fat : [u8; (1<<61)+(1<<31)] = - [0; (1u64<<61) as usize +(1u64<<31) as usize]; + let _fat : [u8; (1 << 61) + (1 << 31)] = + [0; (1u64 << 61) as usize + (1u64 << 31) as usize]; } diff --git a/src/test/ui/hygiene/expansion-info-reset.rs b/src/test/ui/hygiene/expansion-info-reset.rs index 5c384c4ada9fc..ede2c0343f786 100644 --- a/src/test/ui/hygiene/expansion-info-reset.rs +++ b/src/test/ui/hygiene/expansion-info-reset.rs @@ -1,4 +1,4 @@ -// FIXME: Investigate why expansion info for a single expansion id is reset from +// FIXME: investigate why expansion info for a single expansion ID is reset from // `MacroBang(format_args)` to `MacroAttribute(derive(Clone))` (issue #52363). fn main() { diff --git a/src/test/ui/impl-trait/closure-calling-parent-fn.rs b/src/test/ui/impl-trait/closure-calling-parent-fn.rs index cb5f78bd6fc0f..20ef264cbf7b5 100644 --- a/src/test/ui/impl-trait/closure-calling-parent-fn.rs +++ b/src/test/ui/impl-trait/closure-calling-parent-fn.rs @@ -4,7 +4,7 @@ // when a closure returns the `impl Copy` from its parent fn. It was // (incorrectly) replacing the `impl Copy` in its return type with the // hidden type (`()`) but that type resulted from a recursive call to -// `foo` and hence is treated opaquely within the closure body. This +// `foo` and hence is treated opaquely within the closure body. This // resulted in a failed subtype relationship. // // run-pass diff --git a/src/test/ui/impl-trait/issue-49376.rs b/src/test/ui/impl-trait/issue-49376.rs index 13671b8dbf448..4a45988e45d7f 100644 --- a/src/test/ui/impl-trait/issue-49376.rs +++ b/src/test/ui/impl-trait/issue-49376.rs @@ -9,11 +9,9 @@ fn gen() -> impl PartialOrd + PartialEq + Debug { } struct Bar {} trait Foo {} -trait FooNested> {} impl Foo for Bar {} -impl FooNested for Bar {} -fn foo() -> impl Foo + FooNested { +fn foo() -> impl Foo { Bar {} } diff --git a/src/test/ui/impl-trait/region-escape-via-bound-contravariant-closure.rs b/src/test/ui/impl-trait/region-escape-via-bound-contravariant-closure.rs index cb40d90ae551a..3325014b78371 100644 --- a/src/test/ui/impl-trait/region-escape-via-bound-contravariant-closure.rs +++ b/src/test/ui/impl-trait/region-escape-via-bound-contravariant-closure.rs @@ -3,7 +3,7 @@ // appear in the bounds. This is because `&` is contravariant, and so // we are *actually* returning a `&'y u32`. // -// See https://github.com/rust-lang/rust/issues/46541 for more details. +// See for more details. // run-pass diff --git a/src/test/ui/impl-trait/region-escape-via-bound-contravariant.rs b/src/test/ui/impl-trait/region-escape-via-bound-contravariant.rs index e2310a3907f7e..80c5de501ef42 100644 --- a/src/test/ui/impl-trait/region-escape-via-bound-contravariant.rs +++ b/src/test/ui/impl-trait/region-escape-via-bound-contravariant.rs @@ -3,7 +3,7 @@ // appear in the bounds. This is because `&` is contravariant, and so // we are *actually* returning a `&'y u32`. // -// See https://github.com/rust-lang/rust/issues/46541 for more details. +// See issue #46541 for more details. // run-pass diff --git a/src/test/ui/impl-trait/region-escape-via-bound.rs b/src/test/ui/impl-trait/region-escape-via-bound.rs index d62aec800e8ce..547e1ea4cde26 100644 --- a/src/test/ui/impl-trait/region-escape-via-bound.rs +++ b/src/test/ui/impl-trait/region-escape-via-bound.rs @@ -1,7 +1,7 @@ // Test that we do not allow the region `'x` to escape in the impl // trait **even though** `'y` escapes, which outlives `'x`. // -// See https://github.com/rust-lang/rust/issues/46541 for more details. +// See issue #46541 for more details. #![allow(dead_code)] #![feature(in_band_lifetimes)] diff --git a/src/test/ui/impl-unused-tps-inherent.rs b/src/test/ui/impl-unused-tps-inherent.rs index 83a228e551aa6..791a95a914e1d 100644 --- a/src/test/ui/impl-unused-tps-inherent.rs +++ b/src/test/ui/impl-unused-tps-inherent.rs @@ -18,7 +18,7 @@ impl MyType1 { //~^ ERROR the type parameter `U` is not constrained } -impl MyType1 where T: Bar { +impl MyType1 where T: Bar { // OK, T is used in `Foo`. } diff --git a/src/test/ui/impl-unused-tps.rs b/src/test/ui/impl-unused-tps.rs index 7cc1ae613bc3f..a85b296eeb1ea 100644 --- a/src/test/ui/impl-unused-tps.rs +++ b/src/test/ui/impl-unused-tps.rs @@ -14,11 +14,11 @@ impl Foo for [isize;1] { //~^ ERROR the type parameter `U` is not constrained } -impl Foo for [isize;2] where T : Bar { +impl Foo for [isize;2] where T : Bar { // OK, `U` is now constrained by the output type parameter. } -impl,U> Foo for [isize;3] { +impl,U> Foo for [isize;3] { // OK, same as above but written differently. } @@ -36,7 +36,7 @@ impl Bar for T { } impl Bar for T - where T : Bar + where T : Bar { //~^^^ ERROR the type parameter `U` is not constrained @@ -44,7 +44,7 @@ impl Bar for T } impl Foo for T - where (T,U): Bar + where (T,U): Bar { //~^^^ ERROR the type parameter `U` is not constrained //~| ERROR the type parameter `V` is not constrained @@ -54,7 +54,7 @@ impl Foo for T } impl Foo<(T,U)> for T - where (T,U): Bar + where (T,U): Bar { // As above, but both T and U ARE constrained. } diff --git a/src/test/ui/infinite/infinite-recursion-const-fn.rs b/src/test/ui/infinite/infinite-recursion-const-fn.rs index 020c417bf61ad..f8ca686eaaa81 100644 --- a/src/test/ui/infinite/infinite-recursion-const-fn.rs +++ b/src/test/ui/infinite/infinite-recursion-const-fn.rs @@ -1,4 +1,4 @@ -//https://github.com/rust-lang/rust/issues/31364 +// Test for issue #31364. const fn a() -> usize { b() } //~ ERROR evaluation of constant value failed const fn b() -> usize { a() } diff --git a/src/test/ui/invalid/invalid-crate-type.rs b/src/test/ui/invalid/invalid-crate-type.rs index 6c44c3b4f2b13..1ef061052598d 100644 --- a/src/test/ui/invalid/invalid-crate-type.rs +++ b/src/test/ui/invalid/invalid-crate-type.rs @@ -1,5 +1,6 @@ -// regression test for issue 11256 -#![crate_type="foo"] //~ ERROR invalid `crate_type` value +// Regression test for issue #11256. + +#![crate_type="foo"] //~ ERROR invalid `crate_type` value // Tests for suggestions (#53958) diff --git a/src/test/ui/invalid/invalid-crate-type.stderr b/src/test/ui/invalid/invalid-crate-type.stderr index 63edd04650b21..4d87b58f24460 100644 --- a/src/test/ui/invalid/invalid-crate-type.stderr +++ b/src/test/ui/invalid/invalid-crate-type.stderr @@ -1,55 +1,55 @@ error: invalid `crate_type` value - --> $DIR/invalid-crate-type.rs:2:15 + --> $DIR/invalid-crate-type.rs:3:15 | -LL | #![crate_type="foo"] //~ ERROR invalid `crate_type` value +LL | #![crate_type="foo"] //~ ERROR invalid `crate_type` value | ^^^^^ | = note: #[deny(unknown_crate_types)] on by default error: invalid `crate_type` value - --> $DIR/invalid-crate-type.rs:6:15 + --> $DIR/invalid-crate-type.rs:7:15 | LL | #![crate_type="statoclib"] | ^^^^^^^^^^^ help: did you mean: `"staticlib"` error: invalid `crate_type` value - --> $DIR/invalid-crate-type.rs:11:15 + --> $DIR/invalid-crate-type.rs:12:15 | LL | #![crate_type="procmacro"] | ^^^^^^^^^^^ help: did you mean: `"proc-macro"` error: invalid `crate_type` value - --> $DIR/invalid-crate-type.rs:16:15 + --> $DIR/invalid-crate-type.rs:17:15 | LL | #![crate_type="static-lib"] | ^^^^^^^^^^^^ help: did you mean: `"staticlib"` error: invalid `crate_type` value - --> $DIR/invalid-crate-type.rs:21:15 + --> $DIR/invalid-crate-type.rs:22:15 | LL | #![crate_type="drylib"] | ^^^^^^^^ help: did you mean: `"dylib"` error: invalid `crate_type` value - --> $DIR/invalid-crate-type.rs:26:15 + --> $DIR/invalid-crate-type.rs:27:15 | LL | #![crate_type="dlib"] | ^^^^^^ help: did you mean: `"rlib"` error: invalid `crate_type` value - --> $DIR/invalid-crate-type.rs:31:15 + --> $DIR/invalid-crate-type.rs:32:15 | LL | #![crate_type="lob"] | ^^^^^ help: did you mean: `"lib"` error: invalid `crate_type` value - --> $DIR/invalid-crate-type.rs:36:15 + --> $DIR/invalid-crate-type.rs:37:15 | LL | #![crate_type="bon"] | ^^^^^ help: did you mean: `"bin"` error: invalid `crate_type` value - --> $DIR/invalid-crate-type.rs:41:15 + --> $DIR/invalid-crate-type.rs:42:15 | LL | #![crate_type="cdalib"] | ^^^^^^^^ help: did you mean: `"cdylib"` diff --git a/src/test/ui/invalid_crate_type_syntax.rs b/src/test/ui/invalid_crate_type_syntax.rs index eae4fad5b4fa7..2aa84658f12b5 100644 --- a/src/test/ui/invalid_crate_type_syntax.rs +++ b/src/test/ui/invalid_crate_type_syntax.rs @@ -1,5 +1,6 @@ -// regression test for issue 16974 -#![crate_type(lib)] //~ ERROR `crate_type` requires a value +// Regression test for issue #16974. + +#![crate_type(lib)] //~ ERROR `crate_type` requires a value fn my_lib_fn() {} diff --git a/src/test/ui/invalid_crate_type_syntax.stderr b/src/test/ui/invalid_crate_type_syntax.stderr index 8494f718817f3..17de7040f0e91 100644 --- a/src/test/ui/invalid_crate_type_syntax.stderr +++ b/src/test/ui/invalid_crate_type_syntax.stderr @@ -1,7 +1,7 @@ error: `crate_type` requires a value - --> $DIR/invalid_crate_type_syntax.rs:2:1 + --> $DIR/invalid_crate_type_syntax.rs:3:1 | -LL | #![crate_type(lib)] //~ ERROR `crate_type` requires a value +LL | #![crate_type(lib)] //~ ERROR `crate_type` requires a value | ^^^^^^^^^^^^^^^^^^^ | = note: for example: `#![crate_type="lib"]` diff --git a/src/test/ui/issues/issue-10456.rs b/src/test/ui/issues/issue-10456.rs index 4b548362f4aff..ae3f9aef4858f 100644 --- a/src/test/ui/issues/issue-10456.rs +++ b/src/test/ui/issues/issue-10456.rs @@ -1,5 +1,5 @@ // compile-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): pub struct Foo; diff --git a/src/test/ui/issues/issue-10763.rs b/src/test/ui/issues/issue-10763.rs index f2d4c5b47d782..518d22d70e30f 100644 --- a/src/test/ui/issues/issue-10763.rs +++ b/src/test/ui/issues/issue-10763.rs @@ -1,6 +1,6 @@ // compile-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): extern "Rust" fn foo() {} diff --git a/src/test/ui/issues/issue-10853.rs b/src/test/ui/issues/issue-10853.rs index 0b74eaddcdd3a..ceadd92be36ee 100644 --- a/src/test/ui/issues/issue-10853.rs +++ b/src/test/ui/issues/issue-10853.rs @@ -1,5 +1,5 @@ // compile-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![deny(missing_docs)] #![doc="module"] diff --git a/src/test/ui/issues/issue-10902.rs b/src/test/ui/issues/issue-10902.rs index 672386bc8a6c2..b274bfc880d76 100644 --- a/src/test/ui/issues/issue-10902.rs +++ b/src/test/ui/issues/issue-10902.rs @@ -1,6 +1,6 @@ // compile-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): pub mod two_tuple { pub trait T { fn dummy(&self) { } } diff --git a/src/test/ui/issues/issue-11384.rs b/src/test/ui/issues/issue-11384.rs index 59d85b175cf69..2f7531558fa95 100644 --- a/src/test/ui/issues/issue-11384.rs +++ b/src/test/ui/issues/issue-11384.rs @@ -1,5 +1,5 @@ // compile-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): trait Common { fn dummy(&self) { } } diff --git a/src/test/ui/issues/issue-11612.rs b/src/test/ui/issues/issue-11612.rs index 4d6f4656d589d..bca5bda050501 100644 --- a/src/test/ui/issues/issue-11612.rs +++ b/src/test/ui/issues/issue-11612.rs @@ -4,7 +4,7 @@ // We weren't updating the auto adjustments with all the resolved // type information after type check. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): trait A { fn dummy(&self) { } } diff --git a/src/test/ui/issues/issue-11869.rs b/src/test/ui/issues/issue-11869.rs index e62879f1f29ea..bb0a3648956b8 100644 --- a/src/test/ui/issues/issue-11869.rs +++ b/src/test/ui/issues/issue-11869.rs @@ -1,6 +1,6 @@ // compile-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): struct A { a: String diff --git a/src/test/ui/issues/issue-1251.rs b/src/test/ui/issues/issue-1251.rs index 84a14a8c09be6..3be6e65d7bae5 100644 --- a/src/test/ui/issues/issue-1251.rs +++ b/src/test/ui/issues/issue-1251.rs @@ -1,7 +1,7 @@ // compile-pass #![allow(unused_attributes)] #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): // ignore-wasm32-bare no libc to test ffi with #![feature(rustc_private)] diff --git a/src/test/ui/issues/issue-12729.rs b/src/test/ui/issues/issue-12729.rs index c2572c78280eb..6afc73757cd3e 100644 --- a/src/test/ui/issues/issue-12729.rs +++ b/src/test/ui/issues/issue-12729.rs @@ -1,6 +1,6 @@ // compile-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): pub struct Foo; diff --git a/src/test/ui/issues/issue-13058.rs b/src/test/ui/issues/issue-13058.rs index a5806feb720d6..b9c5b3a0aaf41 100644 --- a/src/test/ui/issues/issue-13058.rs +++ b/src/test/ui/issues/issue-13058.rs @@ -1,6 +1,6 @@ use std::ops::Range; -trait Itble<'r, T, I: Iterator> { fn iter(&'r self) -> I; } +trait Itble<'r, T, I: Iterator> { fn iter(&'r self) -> I; } impl<'r> Itble<'r, usize, Range> for (usize, usize) { fn iter(&'r self) -> Range { diff --git a/src/test/ui/issues/issue-13105.rs b/src/test/ui/issues/issue-13105.rs index 0e118043d5564..486de1471466a 100644 --- a/src/test/ui/issues/issue-13105.rs +++ b/src/test/ui/issues/issue-13105.rs @@ -1,5 +1,5 @@ // compile-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): trait Foo { #[allow(anonymous_parameters)] diff --git a/src/test/ui/issues/issue-13167.rs b/src/test/ui/issues/issue-13167.rs index dcc25a446fad6..d62fd9d074cf1 100644 --- a/src/test/ui/issues/issue-13167.rs +++ b/src/test/ui/issues/issue-13167.rs @@ -1,5 +1,5 @@ // compile-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): use std::slice; diff --git a/src/test/ui/issues/issue-13214.rs b/src/test/ui/issues/issue-13214.rs index af2d95c5e4286..f7a1af5e97b55 100644 --- a/src/test/ui/issues/issue-13214.rs +++ b/src/test/ui/issues/issue-13214.rs @@ -3,7 +3,7 @@ // defining static with struct that contains enum // with &'static str variant used to cause ICE -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): pub enum Foo { Bar, diff --git a/src/test/ui/issues/issue-13405.rs b/src/test/ui/issues/issue-13405.rs index 32965cb0c6d8c..225d1280b9cad 100644 --- a/src/test/ui/issues/issue-13405.rs +++ b/src/test/ui/issues/issue-13405.rs @@ -1,7 +1,7 @@ // compile-pass #![allow(dead_code)] #![allow(unused_variables)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): struct Foo<'a> { i: &'a bool, diff --git a/src/test/ui/issues/issue-13703.rs b/src/test/ui/issues/issue-13703.rs index 212fff7bcecd7..b5141012369fb 100644 --- a/src/test/ui/issues/issue-13703.rs +++ b/src/test/ui/issues/issue-13703.rs @@ -1,5 +1,5 @@ // compile-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): pub struct Foo<'a, 'b: 'a> { foo: &'a &'b isize } pub fn foo<'a, 'b>(x: Foo<'a, 'b>, _o: Option<& & ()>) { let _y = x.foo; } diff --git a/src/test/ui/issues/issue-13775.rs b/src/test/ui/issues/issue-13775.rs index 39e42dc2c0d5a..f62e6dbaa0bba 100644 --- a/src/test/ui/issues/issue-13775.rs +++ b/src/test/ui/issues/issue-13775.rs @@ -1,5 +1,5 @@ // compile-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): trait Foo { #[allow(anonymous_parameters)] diff --git a/src/test/ui/issues/issue-13837.rs b/src/test/ui/issues/issue-13837.rs index d475ce1d83319..ce12a1704082f 100644 --- a/src/test/ui/issues/issue-13837.rs +++ b/src/test/ui/issues/issue-13837.rs @@ -1,6 +1,6 @@ // compile-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): struct TestStruct { x: *const [isize; 2] diff --git a/src/test/ui/issues/issue-13853.rs b/src/test/ui/issues/issue-13853.rs index ac9886d2e7249..f9cf33332c56f 100644 --- a/src/test/ui/issues/issue-13853.rs +++ b/src/test/ui/issues/issue-13853.rs @@ -3,12 +3,12 @@ trait Node { } trait Graph { - fn nodes<'a, I: Iterator>(&'a self) -> I + fn nodes<'a, I: Iterator>(&'a self) -> I where N: 'a; } impl Graph for Vec { - fn nodes<'a, I: Iterator>(&self) -> I + fn nodes<'a, I: Iterator>(&self) -> I where N: 'a { self.iter() //~ ERROR mismatched types diff --git a/src/test/ui/issues/issue-13853.stderr b/src/test/ui/issues/issue-13853.stderr index 6da5da04fb165..1b889b0b760f3 100644 --- a/src/test/ui/issues/issue-13853.stderr +++ b/src/test/ui/issues/issue-13853.stderr @@ -1,8 +1,8 @@ error[E0308]: mismatched types --> $DIR/issue-13853.rs:14:9 | -LL | fn nodes<'a, I: Iterator>(&self) -> I - | - expected `I` because of return type +LL | fn nodes<'a, I: Iterator>(&self) -> I + | - expected `I` because of return type ... LL | self.iter() //~ ERROR mismatched types | ^^^^^^^^^^^ expected type parameter, found struct `std::slice::Iter` diff --git a/src/test/ui/issues/issue-14082.rs b/src/test/ui/issues/issue-14082.rs index 4849077c144e1..72c033c8e109c 100644 --- a/src/test/ui/issues/issue-14082.rs +++ b/src/test/ui/issues/issue-14082.rs @@ -1,5 +1,5 @@ // compile-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![allow(unused_imports, dead_code)] diff --git a/src/test/ui/issues/issue-14254.rs b/src/test/ui/issues/issue-14254.rs index 3ad388dc2d790..5007e93ba6de6 100644 --- a/src/test/ui/issues/issue-14254.rs +++ b/src/test/ui/issues/issue-14254.rs @@ -1,5 +1,5 @@ // compile-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): trait Foo: Sized { fn bar(&self); diff --git a/src/test/ui/issues/issue-14330.rs b/src/test/ui/issues/issue-14330.rs index d8f225eb07c24..71cc8d449523f 100644 --- a/src/test/ui/issues/issue-14330.rs +++ b/src/test/ui/issues/issue-14330.rs @@ -1,6 +1,6 @@ // compile-pass #![allow(unused_imports)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #[macro_use] extern crate std as std2; diff --git a/src/test/ui/issues/issue-14837.rs b/src/test/ui/issues/issue-14837.rs index 54387804affeb..11957a7215607 100644 --- a/src/test/ui/issues/issue-14837.rs +++ b/src/test/ui/issues/issue-14837.rs @@ -1,5 +1,5 @@ // compile-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #[deny(dead_code)] pub enum Foo { diff --git a/src/test/ui/issues/issue-14933.rs b/src/test/ui/issues/issue-14933.rs index 9249ba3d6466e..9e91d01c70cff 100644 --- a/src/test/ui/issues/issue-14933.rs +++ b/src/test/ui/issues/issue-14933.rs @@ -1,5 +1,5 @@ // compile-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): pub type BigRat = T; diff --git a/src/test/ui/issues/issue-14959.rs b/src/test/ui/issues/issue-14959.rs index 78ae21e2837af..5c15a628c94d0 100644 --- a/src/test/ui/issues/issue-14959.rs +++ b/src/test/ui/issues/issue-14959.rs @@ -1,5 +1,5 @@ // compile-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![feature(fn_traits, unboxed_closures)] diff --git a/src/test/ui/issues/issue-15108.rs b/src/test/ui/issues/issue-15108.rs index d2b56c0949d63..402c2c1c59c6d 100644 --- a/src/test/ui/issues/issue-15108.rs +++ b/src/test/ui/issues/issue-15108.rs @@ -1,4 +1,4 @@ // compile-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): fn main() {} diff --git a/src/test/ui/issues/issue-15261.rs b/src/test/ui/issues/issue-15261.rs index 4119cb055c590..295c3119eec71 100644 --- a/src/test/ui/issues/issue-15261.rs +++ b/src/test/ui/issues/issue-15261.rs @@ -2,7 +2,7 @@ #![allow(dead_code)] #![allow(non_upper_case_globals)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): static mut n_mut: usize = 0; diff --git a/src/test/ui/issues/issue-15689-2.rs b/src/test/ui/issues/issue-15689-2.rs index 4a1326113910e..627781dae3ebe 100644 --- a/src/test/ui/issues/issue-15689-2.rs +++ b/src/test/ui/issues/issue-15689-2.rs @@ -1,6 +1,6 @@ // compile-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #[derive(Clone)] enum Test<'a> { diff --git a/src/test/ui/issues/issue-17121.rs b/src/test/ui/issues/issue-17121.rs index 706350fc1e205..cd2d19d7d41f4 100644 --- a/src/test/ui/issues/issue-17121.rs +++ b/src/test/ui/issues/issue-17121.rs @@ -1,6 +1,6 @@ // compile-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): // ignore-cloudabi no std::fs use std::fs::File; diff --git a/src/test/ui/issues/issue-17732.rs b/src/test/ui/issues/issue-17732.rs index 7993bbb38bb4a..13563a32ab994 100644 --- a/src/test/ui/issues/issue-17732.rs +++ b/src/test/ui/issues/issue-17732.rs @@ -1,6 +1,6 @@ // compile-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): trait Person { type string; diff --git a/src/test/ui/issues/issue-17904.rs b/src/test/ui/issues/issue-17904.rs index 2fe54957b3c08..0891541d9959c 100644 --- a/src/test/ui/issues/issue-17904.rs +++ b/src/test/ui/issues/issue-17904.rs @@ -3,7 +3,7 @@ // Test that we can parse where clauses on various forms of tuple // structs. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): struct Bar(T) where T: Copy; struct Bleh(T, U) where T: Copy, U: Sized; diff --git a/src/test/ui/issues/issue-18183.rs b/src/test/ui/issues/issue-18183.rs index 64476d1c10999..086c59df057ef 100644 --- a/src/test/ui/issues/issue-18183.rs +++ b/src/test/ui/issues/issue-18183.rs @@ -1,3 +1,4 @@ -pub struct Foo(Bar); //~ ERROR E0128 +pub struct Foo(Bar); //~ ERROR E0128 pub struct Baz(Foo); + fn main() {} diff --git a/src/test/ui/issues/issue-18183.stderr b/src/test/ui/issues/issue-18183.stderr index cf33124bc950a..60a63f9fc51e6 100644 --- a/src/test/ui/issues/issue-18183.stderr +++ b/src/test/ui/issues/issue-18183.stderr @@ -1,8 +1,8 @@ error[E0128]: type parameters with a default cannot use forward declared identifiers - --> $DIR/issue-18183.rs:1:20 + --> $DIR/issue-18183.rs:1:22 | -LL | pub struct Foo(Bar); //~ ERROR E0128 - | ^^^ defaulted type parameters cannot be forward declared +LL | pub struct Foo(Bar); //~ ERROR E0128 + | ^^^ defaulted type parameters cannot be forward declared error: aborting due to previous error diff --git a/src/test/ui/issues/issue-18188.rs b/src/test/ui/issues/issue-18188.rs index 8e39dc15597e7..ef60ae51ee05d 100644 --- a/src/test/ui/issues/issue-18188.rs +++ b/src/test/ui/issues/issue-18188.rs @@ -1,5 +1,5 @@ // compile-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): pub trait Promisable: Send + Sync {} impl Promisable for T {} diff --git a/src/test/ui/issues/issue-1821.rs b/src/test/ui/issues/issue-1821.rs index 0177b70a69885..4a1b8dc885092 100644 --- a/src/test/ui/issues/issue-1821.rs +++ b/src/test/ui/issues/issue-1821.rs @@ -1,13 +1,13 @@ // compile-pass -#![allow(dead_code)] -#![allow(non_camel_case_types)] - -// Issue #1821 - Don't recurse trying to typecheck this +// pretty-expanded FIXME(#23616) +// Issue #1821: don't recurse trying to type-check this. -// pretty-expanded FIXME #23616 +#![allow(dead_code)] +#![allow(non_camel_case_types)] enum t { foo(Vec) } + pub fn main() {} diff --git a/src/test/ui/issues/issue-18389.stderr b/src/test/ui/issues/issue-18389.stderr index 02ff6b6d5bff4..9cbe8c05b7e3d 100644 --- a/src/test/ui/issues/issue-18389.stderr +++ b/src/test/ui/issues/issue-18389.stderr @@ -1,9 +1,6 @@ error[E0445]: private trait `Private<::P, ::R>` in public interface --> $DIR/issue-18389.rs:7:1 | -LL | trait Private { - | - `Private<::P, ::R>` declared as private -... LL | / pub trait Public: Private< LL | | //~^ ERROR private trait `Private<::P, ::R>` in public interface LL | | ::P, diff --git a/src/test/ui/issues/issue-1866.rs b/src/test/ui/issues/issue-1866.rs index 3de547bfe6fce..ea23e717b73d6 100644 --- a/src/test/ui/issues/issue-1866.rs +++ b/src/test/ui/issues/issue-1866.rs @@ -2,7 +2,7 @@ #![allow(dead_code)] #![allow(non_camel_case_types)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): mod a { pub type rust_task = usize; diff --git a/src/test/ui/issues/issue-18906.rs b/src/test/ui/issues/issue-18906.rs index 0b9625b1868ef..e5aba5c9f66f7 100644 --- a/src/test/ui/issues/issue-18906.rs +++ b/src/test/ui/issues/issue-18906.rs @@ -1,6 +1,6 @@ // compile-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): pub trait Borrow { fn borrow(&self) -> &Borrowed; diff --git a/src/test/ui/issues/issue-19037.rs b/src/test/ui/issues/issue-19037.rs index 4efc0719ffbb2..c6e66bf4200cb 100644 --- a/src/test/ui/issues/issue-19037.rs +++ b/src/test/ui/issues/issue-19037.rs @@ -1,6 +1,6 @@ // compile-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): struct Str([u8]); diff --git a/src/test/ui/issues/issue-19129-1.rs b/src/test/ui/issues/issue-19129-1.rs index 4be2cc6d1797b..0f2e31f362207 100644 --- a/src/test/ui/issues/issue-19129-1.rs +++ b/src/test/ui/issues/issue-19129-1.rs @@ -1,5 +1,5 @@ // compile-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): trait Trait { type Output; diff --git a/src/test/ui/issues/issue-19129-2.rs b/src/test/ui/issues/issue-19129-2.rs index d11ef8af709ef..08c65cf513e33 100644 --- a/src/test/ui/issues/issue-19129-2.rs +++ b/src/test/ui/issues/issue-19129-2.rs @@ -1,6 +1,6 @@ // compile-pass #![allow(unused_variables)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): trait Trait { type Output; diff --git a/src/test/ui/issues/issue-19398.rs b/src/test/ui/issues/issue-19398.rs index 5daa14b7cb7bb..f80aa20965333 100644 --- a/src/test/ui/issues/issue-19398.rs +++ b/src/test/ui/issues/issue-19398.rs @@ -1,5 +1,5 @@ // compile-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): trait T { unsafe extern "Rust" fn foo(&self); diff --git a/src/test/ui/issues/issue-19479.rs b/src/test/ui/issues/issue-19479.rs index 8b78952a6e2b1..94f6328300836 100644 --- a/src/test/ui/issues/issue-19479.rs +++ b/src/test/ui/issues/issue-19479.rs @@ -1,5 +1,5 @@ // compile-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): trait Base { fn dummy(&self) { } diff --git a/src/test/ui/issues/issue-19631.rs b/src/test/ui/issues/issue-19631.rs index 8c58331e581b7..3d11888d1afb7 100644 --- a/src/test/ui/issues/issue-19631.rs +++ b/src/test/ui/issues/issue-19631.rs @@ -1,6 +1,6 @@ // compile-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): trait PoolManager { type C; diff --git a/src/test/ui/issues/issue-19632.rs b/src/test/ui/issues/issue-19632.rs index b032b67c1ebd1..9dd2c9cab9a20 100644 --- a/src/test/ui/issues/issue-19632.rs +++ b/src/test/ui/issues/issue-19632.rs @@ -1,6 +1,6 @@ // compile-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): trait PoolManager { type C; diff --git a/src/test/ui/issues/issue-19850.rs b/src/test/ui/issues/issue-19850.rs index fb64ef8940557..96eed9cc14c51 100644 --- a/src/test/ui/issues/issue-19850.rs +++ b/src/test/ui/issues/issue-19850.rs @@ -3,7 +3,7 @@ // Test that `::Output` and `Self::Output` are accepted as type annotations in let // bindings -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): trait Int { fn one() -> Self; diff --git a/src/test/ui/issues/issue-20009.rs b/src/test/ui/issues/issue-20009.rs index 6228d044ad11a..dfd1bebcdf3dd 100644 --- a/src/test/ui/issues/issue-20009.rs +++ b/src/test/ui/issues/issue-20009.rs @@ -1,7 +1,7 @@ // compile-pass // Check that associated types are `Sized` -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): trait Trait { type Output; diff --git a/src/test/ui/issues/issue-20261.rs b/src/test/ui/issues/issue-20261.rs index 528393606f380..004173e05f1f9 100644 --- a/src/test/ui/issues/issue-20261.rs +++ b/src/test/ui/issues/issue-20261.rs @@ -1,5 +1,5 @@ fn main() { - // N.B., this (almost) typechecks when default binding modes are enabled. + // N.B., this (almost) type-checks when default binding modes are enabled. for (ref i,) in [].iter() { i.clone(); //~^ ERROR type annotations needed diff --git a/src/test/ui/issues/issue-20396.rs b/src/test/ui/issues/issue-20396.rs index b6dfffbd69ebb..27b213d17344e 100644 --- a/src/test/ui/issues/issue-20396.rs +++ b/src/test/ui/issues/issue-20396.rs @@ -1,5 +1,5 @@ // compile-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![allow(dead_code)] diff --git a/src/test/ui/issues/issue-20414.rs b/src/test/ui/issues/issue-20414.rs index 1653a9da0045a..543ca23508bd6 100644 --- a/src/test/ui/issues/issue-20414.rs +++ b/src/test/ui/issues/issue-20414.rs @@ -1,6 +1,6 @@ // compile-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): trait Trait { fn method(self) -> isize; diff --git a/src/test/ui/issues/issue-20605.rs b/src/test/ui/issues/issue-20605.rs index 11a2a573ea677..983a02370e89f 100644 --- a/src/test/ui/issues/issue-20605.rs +++ b/src/test/ui/issues/issue-20605.rs @@ -1,4 +1,4 @@ -fn changer<'a>(mut things: Box>) { +fn changer<'a>(mut things: Box>) { for item in *things { *item = 0 } //~^ ERROR the size for values of type } diff --git a/src/test/ui/issues/issue-20616-1.rs b/src/test/ui/issues/issue-20616-1.rs index 49e9cb310c144..b4dd68de86044 100644 --- a/src/test/ui/issues/issue-20616-1.rs +++ b/src/test/ui/issues/issue-20616-1.rs @@ -9,28 +9,28 @@ type Type_1_<'a, T> = &'a T; type Type_1<'a T> = &'a T; //~ error: expected one of `,`, `:`, or `>`, found `T` -//type Type_2 = Type_1_<'static ()>; // error: expected `,` or `>` after lifetime name, found `(` +// type Type_2 = Type_1_<'static ()>; // error: expected `,` or `>` after lifetime name, found `(` -//type Type_3 = Box; // error: expected type, found `,` +// type Type_3 = Box; // error: expected type, found `,` -//type Type_4 = Type_1_<'static,, T>; // error: expected type, found `,` +// type Type_4 = Type_1_<'static,, T>; // error: expected type, found `,` type Type_5_<'a> = Type_1_<'a, ()>; -//type Type_5<'a> = Type_1_<'a, (),,>; // error: expected type, found `,` +// type Type_5<'a> = Type_1_<'a, (),,>; // error: expected type, found `,` -//type Type_6 = Type_5_<'a,,>; // error: expected type, found `,` +// type Type_6 = Type_5_<'a,,>; // error: expected type, found `,` -//type Type_7 = Box<(),,>; // error: expected type, found `,` +// type Type_7 = Box<(),,>; // error: expected type, found `,` -//type Type_8<'a,,> = &'a (); // error: expected ident, found `,` +// type Type_8<'a,,> = &'a (); // error: expected ident, found `,` -//type Type_9 = Box; // error: expected ident, found `,` +// type Type_9 = Box; // error: expected ident, found `,` diff --git a/src/test/ui/issues/issue-20616-2.rs b/src/test/ui/issues/issue-20616-2.rs index 2f2c6903a9f4c..01e036200b504 100644 --- a/src/test/ui/issues/issue-20616-2.rs +++ b/src/test/ui/issues/issue-20616-2.rs @@ -6,31 +6,31 @@ type Type_1_<'a, T> = &'a T; -//type Type_1<'a T> = &'a T; // error: expected `,` or `>` after lifetime name, found `T` +// type Type_1<'a T> = &'a T; // error: expected `,` or `>` after lifetime name, found `T` type Type_2 = Type_1_<'static ()>; //~ error: expected one of `,` or `>`, found `(` -//type Type_3 = Box; // error: expected type, found `,` +// type Type_3 = Box; // error: expected type, found `,` -//type Type_4 = Type_1_<'static,, T>; // error: expected type, found `,` +// type Type_4 = Type_1_<'static,, T>; // error: expected type, found `,` type Type_5_<'a> = Type_1_<'a, ()>; -//type Type_5<'a> = Type_1_<'a, (),,>; // error: expected type, found `,` +// type Type_5<'a> = Type_1_<'a, (),,>; // error: expected type, found `,` -//type Type_6 = Type_5_<'a,,>; // error: expected type, found `,` +// type Type_6 = Type_5_<'a,,>; // error: expected type, found `,` -//type Type_7 = Box<(),,>; // error: expected type, found `,` +// type Type_7 = Box<(),,>; // error: expected type, found `,` -//type Type_8<'a,,> = &'a (); // error: expected ident, found `,` +// type Type_8<'a,,> = &'a (); // error: expected ident, found `,` -//type Type_9 = Box; // error: expected ident, found `,` +// type Type_9 = Box; // error: expected ident, found `,` diff --git a/src/test/ui/issues/issue-20616-3.rs b/src/test/ui/issues/issue-20616-3.rs index e84506ee249d2..774f1f2528458 100644 --- a/src/test/ui/issues/issue-20616-3.rs +++ b/src/test/ui/issues/issue-20616-3.rs @@ -6,31 +6,31 @@ type Type_1_<'a, T> = &'a T; -//type Type_1<'a T> = &'a T; // error: expected `,` or `>` after lifetime name, found `T` +// type Type_1<'a T> = &'a T; // error: expected `,` or `>` after lifetime name, found `T` -//type Type_2 = Type_1_<'static ()>; // error: expected `,` or `>` after lifetime name, found `(` +// type Type_2 = Type_1_<'static ()>; // error: expected `,` or `>` after lifetime name, found `(` type Type_3 = Box; //~ error: expected one of `>`, identifier, lifetime, or type, found `,` -//type Type_4 = Type_1_<'static,, T>; // error: expected type, found `,` +// type Type_4 = Type_1_<'static,, T>; // error: expected type, found `,` type Type_5_<'a> = Type_1_<'a, ()>; -//type Type_5<'a> = Type_1_<'a, (),,>; // error: expected type, found `,` +// type Type_5<'a> = Type_1_<'a, (),,>; // error: expected type, found `,` -//type Type_6 = Type_5_<'a,,>; // error: expected type, found `,` +// type Type_6 = Type_5_<'a,,>; // error: expected type, found `,` -//type Type_7 = Box<(),,>; // error: expected type, found `,` +// type Type_7 = Box<(),,>; // error: expected type, found `,` -//type Type_8<'a,,> = &'a (); // error: expected ident, found `,` +// type Type_8<'a,,> = &'a (); // error: expected ident, found `,` -//type Type_9 = Box; // error: expected ident, found `,` +// type Type_9 = Box; // error: expected ident, found `,` diff --git a/src/test/ui/issues/issue-20616-4.rs b/src/test/ui/issues/issue-20616-4.rs index 785a6fa7d9a2f..3662d27324380 100644 --- a/src/test/ui/issues/issue-20616-4.rs +++ b/src/test/ui/issues/issue-20616-4.rs @@ -6,13 +6,13 @@ type Type_1_<'a, T> = &'a T; -//type Type_1<'a T> = &'a T; // error: expected `,` or `>` after lifetime name, found `T` +// type Type_1<'a T> = &'a T; // error: expected `,` or `>` after lifetime name, found `T` -//type Type_2 = Type_1_<'static ()>; // error: expected `,` or `>` after lifetime name, found `(` +// type Type_2 = Type_1_<'static ()>; // error: expected `,` or `>` after lifetime name, found `(` -//type Type_3 = Box; // error: expected type, found `,` +// type Type_3 = Box; // error: expected type, found `,` type Type_4 = Type_1_<'static,, T>; @@ -22,16 +22,16 @@ type Type_4 = Type_1_<'static,, T>; type Type_5_<'a> = Type_1_<'a, ()>; -//type Type_5<'a> = Type_1_<'a, (),,>; // error: expected type, found `,` +// type Type_5<'a> = Type_1_<'a, (),,>; // error: expected type, found `,` -//type Type_6 = Type_5_<'a,,>; // error: expected type, found `,` +// type Type_6 = Type_5_<'a,,>; // error: expected type, found `,` -//type Type_7 = Box<(),,>; // error: expected type, found `,` +// type Type_7 = Box<(),,>; // error: expected type, found `,` -//type Type_8<'a,,> = &'a (); // error: expected ident, found `,` +// type Type_8<'a,,> = &'a (); // error: expected ident, found `,` -//type Type_9 = Box; // error: expected ident, found `,` +// type Type_9 = Box; // error: expected ident, found `,` diff --git a/src/test/ui/issues/issue-20616-5.rs b/src/test/ui/issues/issue-20616-5.rs index 71dcc1f3a024f..8f156dc12c2fe 100644 --- a/src/test/ui/issues/issue-20616-5.rs +++ b/src/test/ui/issues/issue-20616-5.rs @@ -6,16 +6,16 @@ type Type_1_<'a, T> = &'a T; -//type Type_1<'a T> = &'a T; // error: expected `,` or `>` after lifetime name, found `T` +// type Type_1<'a T> = &'a T; // error: expected `,` or `>` after lifetime name, found `T` -//type Type_2 = Type_1_<'static ()>; // error: expected `,` or `>` after lifetime name, found `(` +// type Type_2 = Type_1_<'static ()>; // error: expected `,` or `>` after lifetime name, found `(` -//type Type_3 = Box; // error: expected type, found `,` +// type Type_3 = Box; // error: expected type, found `,` -//type Type_4 = Type_1_<'static,, T>; // error: expected type, found `,` +// type Type_4 = Type_1_<'static,, T>; // error: expected type, found `,` type Type_5_<'a> = Type_1_<'a, ()>; @@ -25,13 +25,13 @@ type Type_5<'a> = Type_1_<'a, (),,>; //~^ error: expected one of `>`, identifier, lifetime, or type, found `,` -//type Type_6 = Type_5_<'a,,>; // error: expected type, found `,` +// type Type_6 = Type_5_<'a,,>; // error: expected type, found `,` -//type Type_7 = Box<(),,>; // error: expected type, found `,` +// type Type_7 = Box<(),,>; // error: expected type, found `,` -//type Type_8<'a,,> = &'a (); // error: expected ident, found `,` +// type Type_8<'a,,> = &'a (); // error: expected ident, found `,` -//type Type_9 = Box; // error: expected ident, found `,` +// type Type_9 = Box; // error: expected ident, found `,` diff --git a/src/test/ui/issues/issue-20616-6.rs b/src/test/ui/issues/issue-20616-6.rs index da32da4885242..af85ed68695bc 100644 --- a/src/test/ui/issues/issue-20616-6.rs +++ b/src/test/ui/issues/issue-20616-6.rs @@ -6,32 +6,32 @@ type Type_1_<'a, T> = &'a T; -//type Type_1<'a T> = &'a T; // error: expected `,` or `>` after lifetime name, found `T` +// type Type_1<'a T> = &'a T; // error: expected `,` or `>` after lifetime name, found `T` -//type Type_2 = Type_1_<'static ()>; // error: expected `,` or `>` after lifetime name, found `(` +// type Type_2 = Type_1_<'static ()>; // error: expected `,` or `>` after lifetime name, found `(` -//type Type_3 = Box; // error: expected type, found `,` +// type Type_3 = Box; // error: expected type, found `,` -//type Type_4 = Type_1_<'static,, T>; // error: expected type, found `,` +// type Type_4 = Type_1_<'static,, T>; // error: expected type, found `,` type Type_5_<'a> = Type_1_<'a, ()>; -//type Type_5<'a> = Type_1_<'a, (),,>; // error: expected type, found `,` +// type Type_5<'a> = Type_1_<'a, (),,>; // error: expected type, found `,` type Type_6 = Type_5_<'a,,>; //~^ error: expected one of `>`, identifier, lifetime, or type, found `,` -//type Type_7 = Box<(),,>; // error: expected type, found `,` +// type Type_7 = Box<(),,>; // error: expected type, found `,` -//type Type_8<'a,,> = &'a (); // error: expected ident, found `,` +// type Type_8<'a,,> = &'a (); // error: expected ident, found `,` -//type Type_9 = Box; // error: expected ident, found `,` +// type Type_9 = Box; // error: expected ident, found `,` diff --git a/src/test/ui/issues/issue-20616-7.rs b/src/test/ui/issues/issue-20616-7.rs index feaaff2c89025..8a4a93c2a481c 100644 --- a/src/test/ui/issues/issue-20616-7.rs +++ b/src/test/ui/issues/issue-20616-7.rs @@ -6,31 +6,31 @@ type Type_1_<'a, T> = &'a T; -//type Type_1<'a T> = &'a T; // error: expected `,` or `>` after lifetime name, found `T` +// type Type_1<'a T> = &'a T; // error: expected `,` or `>` after lifetime name, found `T` -//type Type_2 = Type_1_<'static ()>; // error: expected `,` or `>` after lifetime name, found `(` +// type Type_2 = Type_1_<'static ()>; // error: expected `,` or `>` after lifetime name, found `(` -//type Type_3 = Box; // error: expected type, found `,` +// type Type_3 = Box; // error: expected type, found `,` -//type Type_4 = Type_1_<'static,, T>; // error: expected type, found `,` +// type Type_4 = Type_1_<'static,, T>; // error: expected type, found `,` type Type_5_<'a> = Type_1_<'a, ()>; -//type Type_5<'a> = Type_1_<'a, (),,>; // error: expected type, found `,` +// type Type_5<'a> = Type_1_<'a, (),,>; // error: expected type, found `,` -//type Type_6 = Type_5_<'a,,>; // error: expected type, found `,` +// type Type_6 = Type_5_<'a,,>; // error: expected type, found `,` type Type_7 = Box<(),,>; //~ error: expected one of `>`, identifier, lifetime, or type, found `,` -//type Type_8<'a,,> = &'a (); // error: expected ident, found `,` +// type Type_8<'a,,> = &'a (); // error: expected ident, found `,` -//type Type_9 = Box; // error: expected ident, found `,` +// type Type_9 = Box; // error: expected ident, found `,` diff --git a/src/test/ui/issues/issue-20616-8.rs b/src/test/ui/issues/issue-20616-8.rs index 2fc7243559a31..2fa2a7e7f8827 100644 --- a/src/test/ui/issues/issue-20616-8.rs +++ b/src/test/ui/issues/issue-20616-8.rs @@ -6,31 +6,31 @@ type Type_1_<'a, T> = &'a T; -//type Type_1<'a T> = &'a T; // error: expected `,` or `>` after lifetime name, found `T` +// type Type_1<'a T> = &'a T; // error: expected `,` or `>` after lifetime name, found `T` -//type Type_2 = Type_1_<'static ()>; // error: expected `,` or `>` after lifetime name, found `(` +// type Type_2 = Type_1_<'static ()>; // error: expected `,` or `>` after lifetime name, found `(` -//type Type_3 = Box; // error: expected type, found `,` +// type Type_3 = Box; // error: expected type, found `,` -//type Type_4 = Type_1_<'static,, T>; // error: expected type, found `,` +// type Type_4 = Type_1_<'static,, T>; // error: expected type, found `,` type Type_5_<'a> = Type_1_<'a, ()>; -//type Type_5<'a> = Type_1_<'a, (),,>; // error: expected type, found `,` +// type Type_5<'a> = Type_1_<'a, (),,>; // error: expected type, found `,` -//type Type_6 = Type_5_<'a,,>; // error: expected type, found `,` +// type Type_6 = Type_5_<'a,,>; // error: expected type, found `,` -//type Type_7 = Box<(),,>; // error: expected type, found `,` +// type Type_7 = Box<(),,>; // error: expected type, found `,` type Type_8<'a,,> = &'a (); //~ error: expected one of `>`, identifier, or lifetime, found `,` -//type Type_9 = Box; // error: expected identifier, found `,` +// type Type_9 = Box; // error: expected identifier, found `,` diff --git a/src/test/ui/issues/issue-20616-9.rs b/src/test/ui/issues/issue-20616-9.rs index b14a5b0ff36da..703f70be3cd47 100644 --- a/src/test/ui/issues/issue-20616-9.rs +++ b/src/test/ui/issues/issue-20616-9.rs @@ -6,31 +6,31 @@ type Type_1_<'a, T> = &'a T; -//type Type_1<'a T> = &'a T; // error: expected `,` or `>` after lifetime name, found `T` +// type Type_1<'a T> = &'a T; // error: expected `,` or `>` after lifetime name, found `T` -//type Type_2 = Type_1_<'static ()>; // error: expected `,` or `>` after lifetime name, found `(` +// type Type_2 = Type_1_<'static ()>; // error: expected `,` or `>` after lifetime name, found `(` -//type Type_3 = Box; // error: expected type, found `,` +// type Type_3 = Box; // error: expected type, found `,` -//type Type_4 = Type_1_<'static,, T>; // error: expected type, found `,` +// type Type_4 = Type_1_<'static,, T>; // error: expected type, found `,` type Type_5_<'a> = Type_1_<'a, ()>; -//type Type_5<'a> = Type_1_<'a, (),,>; // error: expected type, found `,` +// type Type_5<'a> = Type_1_<'a, (),,>; // error: expected type, found `,` -//type Type_6 = Type_5_<'a,,>; // error: expected type, found `,` +// type Type_6 = Type_5_<'a,,>; // error: expected type, found `,` -//type Type_7 = Box<(),,>; // error: expected type, found `,` +// type Type_7 = Box<(),,>; // error: expected type, found `,` -//type Type_8<'a,,> = &'a (); // error: expected identifier, found `,` +// type Type_8<'a,,> = &'a (); // error: expected identifier, found `,` type Type_9 = Box; //~ error: expected one of `>`, identifier, or lifetime, found `,` diff --git a/src/test/ui/issues/issue-2063-resource.rs b/src/test/ui/issues/issue-2063-resource.rs index 6ed3e027ffa48..d8150939da5e7 100644 --- a/src/test/ui/issues/issue-2063-resource.rs +++ b/src/test/ui/issues/issue-2063-resource.rs @@ -1,7 +1,7 @@ // compile-pass #![allow(dead_code)] // test that autoderef of a type like this does not -// cause compiler to loop. Note that no instances +// cause compiler to loop. Note that no instances // of such a type could ever be constructed. struct S { diff --git a/src/test/ui/issues/issue-20644.rs b/src/test/ui/issues/issue-20644.rs index db32344864c46..7224a23dedd50 100644 --- a/src/test/ui/issues/issue-20644.rs +++ b/src/test/ui/issues/issue-20644.rs @@ -6,7 +6,7 @@ // A reduced version of the rustbook ice. The problem this encountered // had to do with codegen ignoring binders. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): // ignore-cloudabi no std::fs #![feature(os)] diff --git a/src/test/ui/issues/issue-20763-1.rs b/src/test/ui/issues/issue-20763-1.rs index c5b2852094591..fb05c835b9d31 100644 --- a/src/test/ui/issues/issue-20763-1.rs +++ b/src/test/ui/issues/issue-20763-1.rs @@ -1,6 +1,6 @@ // compile-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): trait T0 { type O; diff --git a/src/test/ui/issues/issue-20763-2.rs b/src/test/ui/issues/issue-20763-2.rs index cfa252b095e47..0dcd04ef892bf 100644 --- a/src/test/ui/issues/issue-20763-2.rs +++ b/src/test/ui/issues/issue-20763-2.rs @@ -1,6 +1,6 @@ // compile-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): trait T0 { type O; diff --git a/src/test/ui/issues/issue-20772.rs b/src/test/ui/issues/issue-20772.rs index 36551e7014f10..b75891123de58 100644 --- a/src/test/ui/issues/issue-20772.rs +++ b/src/test/ui/issues/issue-20772.rs @@ -1,6 +1,6 @@ -trait T : Iterator +trait T: Iterator { //~^ ERROR cycle detected //~| ERROR associated type `Item` not found for `Self` -{} +} fn main() {} diff --git a/src/test/ui/issues/issue-20772.stderr b/src/test/ui/issues/issue-20772.stderr index 15a5fc40926fe..0f423c82efef3 100644 --- a/src/test/ui/issues/issue-20772.stderr +++ b/src/test/ui/issues/issue-20772.stderr @@ -1,19 +1,16 @@ error[E0391]: cycle detected when computing the supertraits of `T` --> $DIR/issue-20772.rs:1:1 | -LL | / trait T : Iterator -LL | | //~^ ERROR cycle detected -LL | | //~| ERROR associated type `Item` not found for `Self` -LL | | {} - | |__^ +LL | trait T: Iterator { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: ...which again requires computing the supertraits of `T`, completing the cycle error[E0220]: associated type `Item` not found for `Self` - --> $DIR/issue-20772.rs:1:25 + --> $DIR/issue-20772.rs:1:26 | -LL | trait T : Iterator - | ^^^^^^^^^^ associated type `Item` not found +LL | trait T: Iterator { + | ^^^^^^^^^^ associated type `Item` not found error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-20831-debruijn.rs b/src/test/ui/issues/issue-20831-debruijn.rs index 6d3c7331a4579..cf82421160132 100644 --- a/src/test/ui/issues/issue-20831-debruijn.rs +++ b/src/test/ui/issues/issue-20831-debruijn.rs @@ -12,7 +12,7 @@ pub trait Subscriber { pub trait Publisher<'a> { type Output; - fn subscribe(&mut self, _: Box + 'a>); + fn subscribe(&mut self, _: Box + 'a>); } pub trait Processor<'a> : Subscriber + Publisher<'a> { } diff --git a/src/test/ui/issues/issue-21245.rs b/src/test/ui/issues/issue-21245.rs index edf482afc53d4..4967a9dcdb559 100644 --- a/src/test/ui/issues/issue-21245.rs +++ b/src/test/ui/issues/issue-21245.rs @@ -5,7 +5,7 @@ // insufficient type propagation caused the type of the iterator to be // incorrectly unified with the `*const` type to which it is coerced. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): use std::ptr; diff --git a/src/test/ui/issues/issue-21363.rs b/src/test/ui/issues/issue-21363.rs index 5e30db17c6d18..5a121b1bcd342 100644 --- a/src/test/ui/issues/issue-21363.rs +++ b/src/test/ui/issues/issue-21363.rs @@ -1,5 +1,5 @@ // compile-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![no_implicit_prelude] @@ -8,7 +8,7 @@ trait Iterator { fn dummy(&self) { } } -impl<'a, T> Iterator for &'a mut (Iterator + 'a) { +impl<'a, T> Iterator for &'a mut (Iterator + 'a) { type Item = T; } diff --git a/src/test/ui/issues/issue-21402.rs b/src/test/ui/issues/issue-21402.rs index 518d3cfe5a660..53cc52e4e2e3f 100644 --- a/src/test/ui/issues/issue-21402.rs +++ b/src/test/ui/issues/issue-21402.rs @@ -1,6 +1,6 @@ // compile-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #[derive(Hash)] struct Foo { diff --git a/src/test/ui/issues/issue-21520.rs b/src/test/ui/issues/issue-21520.rs index 450448f1a1185..b4cf834c0efbe 100644 --- a/src/test/ui/issues/issue-21520.rs +++ b/src/test/ui/issues/issue-21520.rs @@ -3,7 +3,7 @@ // Test that the requirement (in `Bar`) that `T::Bar : 'static` does // not wind up propagating to `T`. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): pub trait Foo { type Bar; diff --git a/src/test/ui/issues/issue-21726.rs b/src/test/ui/issues/issue-21726.rs index f2065976b35d0..d2247568ddf14 100644 --- a/src/test/ui/issues/issue-21726.rs +++ b/src/test/ui/issues/issue-21726.rs @@ -4,7 +4,7 @@ // subtyping of projection types that resulted in an unconstrained // region, yielding region inference failures. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): fn main() { } diff --git a/src/test/ui/issues/issue-21891.rs b/src/test/ui/issues/issue-21891.rs index 9b1e44c181759..c1c8794aa07b9 100644 --- a/src/test/ui/issues/issue-21891.rs +++ b/src/test/ui/issues/issue-21891.rs @@ -2,7 +2,7 @@ #![allow(dead_code)] #![allow(non_upper_case_globals)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): static foo: [usize; 3] = [1, 2, 3]; diff --git a/src/test/ui/issues/issue-22066.rs b/src/test/ui/issues/issue-22066.rs index 8c0b664d78ad5..aac9596c8f356 100644 --- a/src/test/ui/issues/issue-22066.rs +++ b/src/test/ui/issues/issue-22066.rs @@ -1,6 +1,6 @@ // compile-pass pub trait LineFormatter<'a> { - type Iter: Iterator + 'a; + type Iter: Iterator + 'a; fn iter(&'a self, line: &'a str) -> Self::Iter; fn dimensions(&'a self, line: &'a str) { diff --git a/src/test/ui/issues/issue-22356.rs b/src/test/ui/issues/issue-22356.rs index 3f3b1d3e5f1d9..2e2b2afc15258 100644 --- a/src/test/ui/issues/issue-22356.rs +++ b/src/test/ui/issues/issue-22356.rs @@ -1,7 +1,7 @@ // compile-pass #![allow(type_alias_bounds)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): use std::marker::PhantomData; diff --git a/src/test/ui/issues/issue-22370.rs b/src/test/ui/issues/issue-22370.rs index 44eef2da83ce3..b80ef4f035ec1 100644 --- a/src/test/ui/issues/issue-22370.rs +++ b/src/test/ui/issues/issue-22370.rs @@ -1,6 +1,6 @@ // ignore-tidy-linelength -trait A {} +trait A {} fn f(a: &A) {} //~^ ERROR E0393 diff --git a/src/test/ui/issues/issue-22777.rs b/src/test/ui/issues/issue-22777.rs index f9b264623d6bb..8c6c02527c4a6 100644 --- a/src/test/ui/issues/issue-22777.rs +++ b/src/test/ui/issues/issue-22777.rs @@ -1,9 +1,9 @@ // compile-pass -// This test is reduced from libsyntax. It is just checking that we +// This test is reduced from libsyntax. It is just checking that we // can successfully deal with a "deep" structure, which the drop-check // was hitting a recursion limit on at one point. -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![allow(non_camel_case_types)] diff --git a/src/test/ui/issues/issue-2311.rs b/src/test/ui/issues/issue-2311.rs index 07b9951e68d39..02ea90d5e4ec1 100644 --- a/src/test/ui/issues/issue-2311.rs +++ b/src/test/ui/issues/issue-2311.rs @@ -1,7 +1,7 @@ // compile-pass #![allow(non_camel_case_types)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): trait clam { fn get(self) -> A; } trait foo { diff --git a/src/test/ui/issues/issue-2487-a.rs b/src/test/ui/issues/issue-2487-a.rs index 36e121ddb7ad9..0da6ec3428049 100644 --- a/src/test/ui/issues/issue-2487-a.rs +++ b/src/test/ui/issues/issue-2487-a.rs @@ -2,7 +2,7 @@ #![allow(dead_code)] #![allow(non_camel_case_types)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): struct socket { sock: isize, diff --git a/src/test/ui/issues/issue-2502.rs b/src/test/ui/issues/issue-2502.rs index 29b68c94c2e7c..82ae82fec08cd 100644 --- a/src/test/ui/issues/issue-2502.rs +++ b/src/test/ui/issues/issue-2502.rs @@ -3,7 +3,7 @@ #![allow(non_camel_case_types)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): struct font<'a> { fontbuf: &'a Vec , diff --git a/src/test/ui/issues/issue-25076.rs b/src/test/ui/issues/issue-25076.rs index 6c5a553924561..488ce44d9970f 100644 --- a/src/test/ui/issues/issue-25076.rs +++ b/src/test/ui/issues/issue-25076.rs @@ -2,7 +2,7 @@ struct S; trait InOut { type Out; } -fn do_fold>(init: B, f: F) {} +fn do_fold>(init: B, f: F) {} fn bot() -> T { loop {} } diff --git a/src/test/ui/issues/issue-25076.stderr b/src/test/ui/issues/issue-25076.stderr index 8793475e6d4ed..7a94fe5cbbe7a 100644 --- a/src/test/ui/issues/issue-25076.stderr +++ b/src/test/ui/issues/issue-25076.stderr @@ -7,8 +7,8 @@ LL | do_fold(bot(), ()); //~ ERROR `(): InOut<_>` is not satisfied note: required by `do_fold` --> $DIR/issue-25076.rs:5:1 | -LL | fn do_fold>(init: B, f: F) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn do_fold>(init: B, f: F) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-25439.stderr b/src/test/ui/issues/issue-25439.stderr index 9e9ab4e39d34c..acd0d3c5cd7ce 100644 --- a/src/test/ui/issues/issue-25439.stderr +++ b/src/test/ui/issues/issue-25439.stderr @@ -6,7 +6,8 @@ LL | fix(|_, x| x); //~ ERROR closure/generator type that references itself | = note: closures cannot capture themselves or take themselves as argument; this error may be the result of a recent compiler bug-fix, - see https://github.com/rust-lang/rust/issues/46062 for more details + see for more + details error: aborting due to previous error diff --git a/src/test/ui/issues/issue-25700.rs b/src/test/ui/issues/issue-25700.rs index 45c452d618d84..5a7436fa9cc7e 100644 --- a/src/test/ui/issues/issue-25700.rs +++ b/src/test/ui/issues/issue-25700.rs @@ -3,8 +3,8 @@ struct S(Option<&'static T>); trait Tr { type Out; } impl Tr for T { type Out = T; } -impl Copy for S where S: Tr {} -impl Clone for S where S: Tr { +impl Copy for S where S: Tr {} +impl Clone for S where S: Tr { fn clone(&self) -> Self { *self } } fn main() { diff --git a/src/test/ui/issues/issue-26638.rs b/src/test/ui/issues/issue-26638.rs index 0f5ed5caa74cb..a76da61fd83ef 100644 --- a/src/test/ui/issues/issue-26638.rs +++ b/src/test/ui/issues/issue-26638.rs @@ -1,10 +1,16 @@ -fn parse_type(iter: Box+'static>) -> &str { iter.next() } +fn parse_type(iter: Box+'static>) -> &str { //~^ ERROR missing lifetime specifier [E0106] + iter.next() +} -fn parse_type_2(iter: fn(&u8)->&u8) -> &str { iter() } +fn parse_type_2(iter: fn(&u8)->&u8) -> &str { //~^ ERROR missing lifetime specifier [E0106] + iter() +} -fn parse_type_3() -> &str { unimplemented!() } +fn parse_type_3() -> &str { //~^ ERROR missing lifetime specifier [E0106] + unimplemented!() +} fn main() {} diff --git a/src/test/ui/issues/issue-26638.stderr b/src/test/ui/issues/issue-26638.stderr index 64c2cd43264d0..46eab8abe70e8 100644 --- a/src/test/ui/issues/issue-26638.stderr +++ b/src/test/ui/issues/issue-26638.stderr @@ -1,23 +1,23 @@ error[E0106]: missing lifetime specifier - --> $DIR/issue-26638.rs:1:58 + --> $DIR/issue-26638.rs:1:60 | -LL | fn parse_type(iter: Box+'static>) -> &str { iter.next() } - | ^ expected lifetime parameter +LL | fn parse_type(iter: Box+'static>) -> &str { + | ^ expected lifetime parameter | = help: this function's return type contains a borrowed value, but the signature does not say which one of `iter`'s 2 lifetimes it is borrowed from error[E0106]: missing lifetime specifier - --> $DIR/issue-26638.rs:4:40 + --> $DIR/issue-26638.rs:6:40 | -LL | fn parse_type_2(iter: fn(&u8)->&u8) -> &str { iter() } +LL | fn parse_type_2(iter: fn(&u8)->&u8) -> &str { | ^ help: consider giving it an explicit bounded or 'static lifetime: `&'static` | = help: this function's return type contains a borrowed value with an elided lifetime, but the lifetime cannot be derived from the arguments error[E0106]: missing lifetime specifier - --> $DIR/issue-26638.rs:7:22 + --> $DIR/issue-26638.rs:11:22 | -LL | fn parse_type_3() -> &str { unimplemented!() } +LL | fn parse_type_3() -> &str { | ^ help: consider giving it a 'static lifetime: `&'static` | = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from diff --git a/src/test/ui/issues/issue-26812.rs b/src/test/ui/issues/issue-26812.rs index b2494a91a3f8a..6a2548409d924 100644 --- a/src/test/ui/issues/issue-26812.rs +++ b/src/test/ui/issues/issue-26812.rs @@ -1,6 +1,6 @@ #![feature(default_type_parameter_fallback)] -fn avg(_: T) {} +fn avg(_: T) {} //~^ ERROR type parameters with a default cannot use forward declared identifiers fn main() {} diff --git a/src/test/ui/issues/issue-26812.stderr b/src/test/ui/issues/issue-26812.stderr index 8d507a7ea0144..226053e5b6bfc 100644 --- a/src/test/ui/issues/issue-26812.stderr +++ b/src/test/ui/issues/issue-26812.stderr @@ -1,8 +1,8 @@ error[E0128]: type parameters with a default cannot use forward declared identifiers - --> $DIR/issue-26812.rs:3:10 + --> $DIR/issue-26812.rs:3:12 | -LL | fn avg(_: T) {} - | ^^^^^^^ defaulted type parameters cannot be forward declared +LL | fn avg(_: T) {} + | ^^^^^^^ defaulted type parameters cannot be forward declared error: aborting due to previous error diff --git a/src/test/ui/issues/issue-26905.rs b/src/test/ui/issues/issue-26905.rs index 0cd166f4ac694..c6a2327e6d776 100644 --- a/src/test/ui/issues/issue-26905.rs +++ b/src/test/ui/issues/issue-26905.rs @@ -19,6 +19,6 @@ fn main() { let data = [1, 2, 3]; let iter = data.iter(); let x = MyRc { _ptr: &iter, _boo: NotPhantomData(PhantomData) }; - let _y: MyRc> = x; + let _y: MyRc> = x; } diff --git a/src/test/ui/issues/issue-27282-move-match-input-into-guard.rs b/src/test/ui/issues/issue-27282-move-match-input-into-guard.rs index 0721b051bcbd8..6126b4713bd8c 100644 --- a/src/test/ui/issues/issue-27282-move-match-input-into-guard.rs +++ b/src/test/ui/issues/issue-27282-move-match-input-into-guard.rs @@ -1,4 +1,4 @@ -// Issue 27282: Example 2: This sidesteps the AST checks disallowing +// Issue #27282: Example 2: this sidesteps the AST checks disallowing // mutable borrows in match guards by hiding the mutable borrow in a // guard behind a move (of the mutably borrowed match input) within a // closure. diff --git a/src/test/ui/issues/issue-27282-move-ref-mut-into-guard.rs b/src/test/ui/issues/issue-27282-move-ref-mut-into-guard.rs index 1312aff30fecf..5e68bf227aa95 100644 --- a/src/test/ui/issues/issue-27282-move-ref-mut-into-guard.rs +++ b/src/test/ui/issues/issue-27282-move-ref-mut-into-guard.rs @@ -1,4 +1,4 @@ -// Issue 27282: Example 1: This sidesteps the AST checks disallowing +// Issue #27282: Example 1: this sidesteps the AST checks disallowing // mutable borrows in match guards by hiding the mutable borrow in a // guard behind a move (of the ref mut pattern id) within a closure. // diff --git a/src/test/ui/issues/issue-27282-reborrow-ref-mut-in-guard.rs b/src/test/ui/issues/issue-27282-reborrow-ref-mut-in-guard.rs index c79b1873241c8..4d739af89f72a 100644 --- a/src/test/ui/issues/issue-27282-reborrow-ref-mut-in-guard.rs +++ b/src/test/ui/issues/issue-27282-reborrow-ref-mut-in-guard.rs @@ -1,11 +1,10 @@ -// Issue 27282: This is a variation on issue-27282-move-ref-mut-into-guard.rs +// Issue #27282: this is a variation on `issue-27282-move-ref-mut-into-guard.rs`. // // It reborrows instead of moving the `ref mut` pattern borrow. This // means that our conservative check for mutation in guards will // reject it. But I want to make sure that we continue to reject it // (under NLL) even when that conservaive check goes away. - #![feature(bind_by_move_pattern_guards)] #![feature(nll)] diff --git a/src/test/ui/issues/issue-27282-reborrow-ref-mut-in-guard.stderr b/src/test/ui/issues/issue-27282-reborrow-ref-mut-in-guard.stderr index 3a10928981c8b..77b3592d86d7e 100644 --- a/src/test/ui/issues/issue-27282-reborrow-ref-mut-in-guard.stderr +++ b/src/test/ui/issues/issue-27282-reborrow-ref-mut-in-guard.stderr @@ -1,5 +1,5 @@ error[E0596]: cannot borrow `r` as mutable, as it is immutable for the pattern guard - --> $DIR/issue-27282-reborrow-ref-mut-in-guard.rs:16:25 + --> $DIR/issue-27282-reborrow-ref-mut-in-guard.rs:15:25 | LL | ref mut r if { (|| { let bar = &mut *r; **bar = false; })(); | ^^ - mutable borrow occurs due to use of `r` in closure diff --git a/src/test/ui/issues/issue-2748-a.rs b/src/test/ui/issues/issue-2748-a.rs index 683a931cc3d5b..f8607c2e699c6 100644 --- a/src/test/ui/issues/issue-2748-a.rs +++ b/src/test/ui/issues/issue-2748-a.rs @@ -2,7 +2,7 @@ #![allow(dead_code)] #![allow(non_snake_case)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): struct CMap<'a> { buf: &'a [u8], diff --git a/src/test/ui/issues/issue-2804-2.rs b/src/test/ui/issues/issue-2804-2.rs index d5157420617d7..a7b73342afd78 100644 --- a/src/test/ui/issues/issue-2804-2.rs +++ b/src/test/ui/issues/issue-2804-2.rs @@ -1,7 +1,7 @@ // compile-pass #![allow(dead_code)] // Minimized version of issue-2804.rs. Both check that callee IDs don't -// clobber the previous node ID in a macro expr +// clobber the previous node-ID in a macro expr use std::collections::HashMap; diff --git a/src/test/ui/issues/issue-28576.rs b/src/test/ui/issues/issue-28576.rs index de665d5aa1680..784d203a681c1 100644 --- a/src/test/ui/issues/issue-28576.rs +++ b/src/test/ui/issues/issue-28576.rs @@ -1,11 +1,11 @@ -pub trait Foo { +pub trait Foo { type Assoc; } -pub trait Bar: Foo { +pub trait Bar: Foo { fn new(&self, b: & - Bar //~ ERROR the trait `Bar` cannot be made into an object - + Bar + //~^ ERROR the trait `Bar` cannot be made into an object ); } diff --git a/src/test/ui/issues/issue-28576.stderr b/src/test/ui/issues/issue-28576.stderr index b04715f23f49e..cc48db14354ad 100644 --- a/src/test/ui/issues/issue-28576.stderr +++ b/src/test/ui/issues/issue-28576.stderr @@ -1,9 +1,8 @@ error[E0038]: the trait `Bar` cannot be made into an object --> $DIR/issue-28576.rs:7:12 | -LL | / Bar //~ ERROR the trait `Bar` cannot be made into an object -LL | | - | |________________________^ the trait `Bar` cannot be made into an object +LL | Bar + | ^^^^^^^^^^^^^ the trait `Bar` cannot be made into an object | = note: the trait cannot use `Self` as a type parameter in the supertraits or where-clauses diff --git a/src/test/ui/issues/issue-29723.rs b/src/test/ui/issues/issue-29723.rs index 41db52a1fadac..51601b9f1df07 100644 --- a/src/test/ui/issues/issue-29723.rs +++ b/src/test/ui/issues/issue-29723.rs @@ -1,7 +1,5 @@ #![feature(nll)] -// test for https://github.com/rust-lang/rust/issues/29723 - fn main() { let s = String::new(); let _s = match 0 { diff --git a/src/test/ui/issues/issue-29723.stderr b/src/test/ui/issues/issue-29723.stderr index de858aec881f7..28d0ed87e1a5a 100644 --- a/src/test/ui/issues/issue-29723.stderr +++ b/src/test/ui/issues/issue-29723.stderr @@ -1,5 +1,5 @@ error[E0382]: use of moved value: `s` - --> $DIR/issue-29723.rs:12:13 + --> $DIR/issue-29723.rs:10:13 | LL | 0 if { drop(s); false } => String::from("oops"), | - value moved here diff --git a/src/test/ui/issues/issue-3149.rs b/src/test/ui/issues/issue-3149.rs index c9a6f537757d0..883323171eb8f 100644 --- a/src/test/ui/issues/issue-3149.rs +++ b/src/test/ui/issues/issue-3149.rs @@ -1,7 +1,7 @@ // compile-pass #![allow(dead_code)] #![allow(non_snake_case)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): fn Matrix4(m11: T, m12: T, m13: T, m14: T, m21: T, m22: T, m23: T, m24: T, diff --git a/src/test/ui/issues/issue-33903.rs b/src/test/ui/issues/issue-33903.rs index 98544aca5f9da..366fbe746395d 100644 --- a/src/test/ui/issues/issue-33903.rs +++ b/src/test/ui/issues/issue-33903.rs @@ -1,6 +1,6 @@ // compile-pass #![allow(dead_code)] -// Issue 33903: +// Issue #33903: // Built-in indexing should be used even when the index is not // trivially an integer // Only built-in indexing can be used in constant expressions diff --git a/src/test/ui/issues/issue-3563-2.rs b/src/test/ui/issues/issue-3563-2.rs index 48f7c845d5e84..7fdcdf77daffc 100644 --- a/src/test/ui/issues/issue-3563-2.rs +++ b/src/test/ui/issues/issue-3563-2.rs @@ -1,5 +1,5 @@ // compile-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): trait Canvas { fn add_point(&self, point: &isize); diff --git a/src/test/ui/issues/issue-35668.rs b/src/test/ui/issues/issue-35668.rs index 1b8ada57ed69c..663ea385080a9 100644 --- a/src/test/ui/issues/issue-35668.rs +++ b/src/test/ui/issues/issue-35668.rs @@ -1,4 +1,4 @@ -fn func<'a, T>(a: &'a [T]) -> impl Iterator { +fn func<'a, T>(a: &'a [T]) -> impl Iterator { a.iter().map(|a| a*a) //~^ ERROR binary operation `*` cannot be applied to type `&T` } diff --git a/src/test/ui/issues/issue-35976.rs b/src/test/ui/issues/issue-35976.rs index 95c0cc95bb2ba..6cf684f087339 100644 --- a/src/test/ui/issues/issue-35976.rs +++ b/src/test/ui/issues/issue-35976.rs @@ -8,7 +8,7 @@ mod private { } } -//use private::Future; +// use private::Future; fn bar(arg: Box) { arg.wait(); diff --git a/src/test/ui/issues/issue-3874.rs b/src/test/ui/issues/issue-3874.rs index 8a7eaf29539cb..836a693f8d082 100644 --- a/src/test/ui/issues/issue-3874.rs +++ b/src/test/ui/issues/issue-3874.rs @@ -1,6 +1,6 @@ // compile-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): enum PureCounter { PureCounterVariant(usize) } diff --git a/src/test/ui/issues/issue-3888-2.rs b/src/test/ui/issues/issue-3888-2.rs index 27d05b470becf..524c87cadf3b7 100644 --- a/src/test/ui/issues/issue-3888-2.rs +++ b/src/test/ui/issues/issue-3888-2.rs @@ -1,6 +1,6 @@ // compile-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): fn vec_peek<'r, T>(v: &'r [T]) -> &'r [T] { &v[1..5] diff --git a/src/test/ui/issues/issue-3979-2.rs b/src/test/ui/issues/issue-3979-2.rs index eec8c85f276c7..9f1332a25063e 100644 --- a/src/test/ui/issues/issue-3979-2.rs +++ b/src/test/ui/issues/issue-3979-2.rs @@ -1,5 +1,5 @@ // compile-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): trait A { fn a_method(&self); diff --git a/src/test/ui/issues/issue-3991.rs b/src/test/ui/issues/issue-3991.rs index bc63aae0b9eac..893416203cc3f 100644 --- a/src/test/ui/issues/issue-3991.rs +++ b/src/test/ui/issues/issue-3991.rs @@ -1,7 +1,7 @@ // compile-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): struct HasNested { nest: Vec > , diff --git a/src/test/ui/issues/issue-39970.rs b/src/test/ui/issues/issue-39970.rs index f51e3b522e1c5..c374e9be5d4e0 100644 --- a/src/test/ui/issues/issue-39970.rs +++ b/src/test/ui/issues/issue-39970.rs @@ -11,7 +11,7 @@ impl<'a> Array<'a> for () { } impl Visit for () where - //(): for<'a> Array<'a, Element=&'a ()>, // No ICE + //(): for<'a> Array<'a, Element = &'a ()>, // No ICE (): for<'a> Array<'a, Element=()>, // ICE {} diff --git a/src/test/ui/issues/issue-43189.rs b/src/test/ui/issues/issue-43189.rs index f4f4dce7682fa..1177dad618a81 100644 --- a/src/test/ui/issues/issue-43189.rs +++ b/src/test/ui/issues/issue-43189.rs @@ -1,4 +1,4 @@ -// Issue 46112: An extern crate pub re-exporting libcore was causing +// Issue #46112: an extern crate pub re-exporting libcore was causing // paths rooted from `std` to be misrendered in the diagnostic output. // ignore-windows diff --git a/src/test/ui/issues/issue-4366.rs b/src/test/ui/issues/issue-4366.rs index 9ec2e58ecadcb..775795cc50a0d 100644 --- a/src/test/ui/issues/issue-4366.rs +++ b/src/test/ui/issues/issue-4366.rs @@ -1,7 +1,7 @@ -// regression test for issue 4366 +// Regression test for issue #4366. -// ensures that 'use foo:*' doesn't import non-public 'use' statements in the -// module 'foo' +// Ensures that `use foo:*` doesn't import non-public `use` statements in the +// module `foo`. use m1::*; diff --git a/src/test/ui/issues/issue-4464.rs b/src/test/ui/issues/issue-4464.rs index c20c1cad66909..99c1452ca7169 100644 --- a/src/test/ui/issues/issue-4464.rs +++ b/src/test/ui/issues/issue-4464.rs @@ -1,6 +1,6 @@ // compile-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): fn broken(v: &[u8], i: usize, j: usize) -> &[u8] { &v[i..j] } diff --git a/src/test/ui/issues/issue-46036.rs b/src/test/ui/issues/issue-46036.rs index c517bbe57e82b..ff87660975114 100644 --- a/src/test/ui/issues/issue-46036.rs +++ b/src/test/ui/issues/issue-46036.rs @@ -1,5 +1,6 @@ -// Issue 46036: [NLL] false edges on infinite loops +// Issue #46036: [NLL] false edges on infinite loops. // Infinite loops should create false edges to the cleanup block. + #![feature(nll)] struct Foo { x: &'static u32 } @@ -7,7 +8,7 @@ struct Foo { x: &'static u32 } fn foo() { let a = 3; let foo = Foo { x: &a }; //~ ERROR E0597 - loop { } + loop {} } -fn main() { } +fn main() {} diff --git a/src/test/ui/issues/issue-46036.stderr b/src/test/ui/issues/issue-46036.stderr index 40a77f925b94e..4be7296d28b60 100644 --- a/src/test/ui/issues/issue-46036.stderr +++ b/src/test/ui/issues/issue-46036.stderr @@ -1,12 +1,12 @@ error[E0597]: `a` does not live long enough - --> $DIR/issue-46036.rs:9:24 + --> $DIR/issue-46036.rs:10:24 | LL | let foo = Foo { x: &a }; //~ ERROR E0597 | ^^ | | | borrowed value does not live long enough | requires that `a` is borrowed for `'static` -LL | loop { } +LL | loop {} LL | } | - `a` dropped here while still borrowed diff --git a/src/test/ui/issues/issue-46112.rs b/src/test/ui/issues/issue-46112.rs index 0cdd2c27ff73e..f50484a094614 100644 --- a/src/test/ui/issues/issue-46112.rs +++ b/src/test/ui/issues/issue-46112.rs @@ -1,4 +1,4 @@ -// Issue 46112: An extern crate pub re-exporting libcore was causing +// Issue #46112: an extern crate pub re-exporting libcore was causing // paths rooted from `std` to be misrendered in the diagnostic output. // ignore-windows diff --git a/src/test/ui/issues/issue-47073-zero-padded-tuple-struct-indices.stderr b/src/test/ui/issues/issue-47073-zero-padded-tuple-struct-indices.stderr index 5e1b816defda3..6e8d1ef2f7b9e 100644 --- a/src/test/ui/issues/issue-47073-zero-padded-tuple-struct-indices.stderr +++ b/src/test/ui/issues/issue-47073-zero-padded-tuple-struct-indices.stderr @@ -2,7 +2,7 @@ error[E0609]: no field `00` on type `Verdict` --> $DIR/issue-47073-zero-padded-tuple-struct-indices.rs:8:30 | LL | let _condemned = justice.00; - | ^^ help: a field with a similar name exists: `0` + | ^^ did you mean `0`? error[E0609]: no field `001` on type `Verdict` --> $DIR/issue-47073-zero-padded-tuple-struct-indices.rs:10:31 diff --git a/src/test/ui/issues/issue-47309.rs b/src/test/ui/issues/issue-47309.rs index a9aeecb61b6a5..869f01f20c01f 100644 --- a/src/test/ui/issues/issue-47309.rs +++ b/src/test/ui/issues/issue-47309.rs @@ -1,6 +1,5 @@ // Make sure that the mono-item collector does not crash when trying to // instantiate a default impl of a method with lifetime parameters. -// See https://github.com/rust-lang/rust/issues/47309 // compile-flags:-Clink-dead-code // compile-pass diff --git a/src/test/ui/issues/issue-4736.stderr b/src/test/ui/issues/issue-4736.stderr index 39c649ba3e0e7..eac7e65064d49 100644 --- a/src/test/ui/issues/issue-4736.stderr +++ b/src/test/ui/issues/issue-4736.stderr @@ -2,7 +2,7 @@ error[E0560]: struct `NonCopyable` has no field named `p` --> $DIR/issue-4736.rs:4:26 | LL | let z = NonCopyable{ p: () }; //~ ERROR struct `NonCopyable` has no field named `p` - | ^ help: a field with a similar name exists: `0` + | ^ field does not exist - did you mean `0`? error: aborting due to previous error diff --git a/src/test/ui/issues/issue-4830.rs b/src/test/ui/issues/issue-4830.rs index cf94094a7985f..334633f0b8dd0 100644 --- a/src/test/ui/issues/issue-4830.rs +++ b/src/test/ui/issues/issue-4830.rs @@ -1,7 +1,7 @@ // compile-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): pub struct Scheduler { /// The event loop used to drive the scheduler and perform I/O diff --git a/src/test/ui/issues/issue-50714-1.rs b/src/test/ui/issues/issue-50714-1.rs index 31de3f3c0a1b8..bdebc3a176e72 100644 --- a/src/test/ui/issues/issue-50714-1.rs +++ b/src/test/ui/issues/issue-50714-1.rs @@ -1,4 +1,4 @@ -// Regression test for issue 50714, make sure that this isn't a linker error. +// Regression test for issue #50714: make sure that this isn't a linker error. #![no_std] #![feature(start)] @@ -6,7 +6,8 @@ extern crate std; #[start] -fn start(_: isize, _: *const *const u8) -> isize where fn(&()): Eq { //~ ERROR [E0647] +fn start(_: isize, _: *const *const u8) -> isize where fn(&()): Eq { +//~^ ERROR [E0647] 0 } diff --git a/src/test/ui/issues/issue-50714-1.stderr b/src/test/ui/issues/issue-50714-1.stderr index e5fdd18d3328e..427b200adf431 100644 --- a/src/test/ui/issues/issue-50714-1.stderr +++ b/src/test/ui/issues/issue-50714-1.stderr @@ -1,7 +1,7 @@ error[E0647]: start function is not allowed to have a `where` clause --> $DIR/issue-50714-1.rs:9:56 | -LL | fn start(_: isize, _: *const *const u8) -> isize where fn(&()): Eq { //~ ERROR [E0647] +LL | fn start(_: isize, _: *const *const u8) -> isize where fn(&()): Eq { | ^^^^^^^^^^^ start function cannot have a `where` clause error: aborting due to previous error diff --git a/src/test/ui/issues/issue-50714.rs b/src/test/ui/issues/issue-50714.rs index 3683d4bdaccd5..e665b02d6b4e2 100644 --- a/src/test/ui/issues/issue-50714.rs +++ b/src/test/ui/issues/issue-50714.rs @@ -1,4 +1,5 @@ -// Regression test for issue 50714, make sure that this isn't a linker error. - -fn main() where fn(&()): Eq {} //~ ERROR [E0646] +// Regression test for issue #50714: make sure that this isn't a linker error. +fn main() where fn(&()): Eq { +//~^ ERROR [E0646] +} diff --git a/src/test/ui/issues/issue-50714.stderr b/src/test/ui/issues/issue-50714.stderr index d7631adc7b26f..34ee0dfc03190 100644 --- a/src/test/ui/issues/issue-50714.stderr +++ b/src/test/ui/issues/issue-50714.stderr @@ -1,7 +1,7 @@ error[E0646]: `main` function is not allowed to have a `where` clause --> $DIR/issue-50714.rs:3:17 | -LL | fn main() where fn(&()): Eq {} //~ ERROR [E0646] +LL | fn main() where fn(&()): Eq { | ^^^^^^^^^^^ `main` cannot have a `where` clause error: aborting due to previous error diff --git a/src/test/ui/issues/issue-52060.rs b/src/test/ui/issues/issue-52060.rs index 54eff228934e3..ca79e1134963c 100644 --- a/src/test/ui/issues/issue-52060.rs +++ b/src/test/ui/issues/issue-52060.rs @@ -1,5 +1,4 @@ -// Regression test for https://github.com/rust-lang/rust/issues/52060 -// The compiler shouldn't ICE in this case +// The compiler shouldn't ICE in this case. static A: &'static [u32] = &[1]; static B: [u32; 1] = [0; A.len()]; //~^ ERROR [E0013] diff --git a/src/test/ui/issues/issue-52060.stderr b/src/test/ui/issues/issue-52060.stderr index 7c3f7695549f0..a70322574a8ae 100644 --- a/src/test/ui/issues/issue-52060.stderr +++ b/src/test/ui/issues/issue-52060.stderr @@ -1,11 +1,11 @@ error[E0013]: constants cannot refer to statics, use a constant instead - --> $DIR/issue-52060.rs:4:26 + --> $DIR/issue-52060.rs:3:26 | LL | static B: [u32; 1] = [0; A.len()]; | ^ error: `core::slice::::len` is not yet stable as a const fn - --> $DIR/issue-52060.rs:4:26 + --> $DIR/issue-52060.rs:3:26 | LL | static B: [u32; 1] = [0; A.len()]; | ^^^^^^^ diff --git a/src/test/ui/issues/issue-52126-assign-op-invariance.rs b/src/test/ui/issues/issue-52126-assign-op-invariance.rs index b974a8d4bdafb..0c214a8ba6430 100644 --- a/src/test/ui/issues/issue-52126-assign-op-invariance.rs +++ b/src/test/ui/issues/issue-52126-assign-op-invariance.rs @@ -1,8 +1,8 @@ -// Issue 52126: With respect to variance, the assign-op's like += were +// Issue #52126: with respect to variance, the assign-op's like `+=` were // accidentally lumped together with other binary op's. In both cases // we were coercing the LHS of the op to the expected supertype. // -// The problem is that since the LHS of += is modified, we need the +// The problem is that since the LHS of `+=` is modified, we need the // parameter to be invariant with respect to the overall type, not // covariant. @@ -27,7 +27,7 @@ impl<'l> AddAssign for Counter<'l> } } -/// often times crashes, if not prints invalid strings +/// Often crashes, if not prints invalid strings. pub fn panics() { let mut acc = Counter{map: HashMap::new()}; for line in vec!["123456789".to_string(), "12345678".to_string()] { diff --git a/src/test/ui/issues/issue-53300.rs b/src/test/ui/issues/issue-53300.rs index 09f0fe9d93553..a55485f0ad08a 100644 --- a/src/test/ui/issues/issue-53300.rs +++ b/src/test/ui/issues/issue-53300.rs @@ -1,4 +1,4 @@ -// issue 53300 +// Test for issue #53300. pub trait A { fn add(&self, b: i32) -> i32; diff --git a/src/test/ui/issues/issue-53419.rs b/src/test/ui/issues/issue-53419.rs index fc2a926f90ff6..73dcbe62d2927 100644 --- a/src/test/ui/issues/issue-53419.rs +++ b/src/test/ui/issues/issue-53419.rs @@ -1,4 +1,4 @@ -//compile-pass +// compile-pass struct Foo { bar: for<'r> Fn(usize, &'r FnMut()) diff --git a/src/test/ui/issues/issue-5353.rs b/src/test/ui/issues/issue-5353.rs index 808b73ec72f75..2070e58d93eda 100644 --- a/src/test/ui/issues/issue-5353.rs +++ b/src/test/ui/issues/issue-5353.rs @@ -1,6 +1,6 @@ // compile-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): const INVALID_ENUM : u32 = 0; const INVALID_VALUE : u32 = 1; diff --git a/src/test/ui/issues/issue-54302-cases.rs b/src/test/ui/issues/issue-54302-cases.rs index 0c852a2eb6321..2ef779dc2c85e 100644 --- a/src/test/ui/issues/issue-54302-cases.rs +++ b/src/test/ui/issues/issue-54302-cases.rs @@ -34,14 +34,14 @@ impl<'x, 'a: 'x> Foo2<'x, i32> for &'a i32 // example 3 - fails due to issue #XYZ + Leak-check impl<'x, T> Foo2<'x, u64> for T - where T: Mirror + where T: Mirror { fn foo2(self) -> &'x u64 { self.coerce() } } // example 4 - fails due to issue #XYZ impl<'x, 'a: 'x, T> Foo2<'x, i64> for T - where T: Mirror + where T: Mirror { fn foo2(self) -> &'x i64 { self.coerce() } } diff --git a/src/test/ui/issues/issue-5572.rs b/src/test/ui/issues/issue-5572.rs index e5963a7c435f0..12eb06592c8c0 100644 --- a/src/test/ui/issues/issue-5572.rs +++ b/src/test/ui/issues/issue-5572.rs @@ -1,6 +1,6 @@ // compile-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): fn foo(_t: T) { } diff --git a/src/test/ui/issues/issue-56199.stderr b/src/test/ui/issues/issue-56199.stderr index 7aaf8e4ac2f14..9503183deb97c 100644 --- a/src/test/ui/issues/issue-56199.stderr +++ b/src/test/ui/issues/issue-56199.stderr @@ -4,7 +4,7 @@ error: the `Self` constructor can only be used with tuple or unit structs LL | let _ = Self; | ^^^^ | - = help: did you mean to use one of the enum's variants? + = note: did you mean to use one of the enum's variants? error: the `Self` constructor can only be used with tuple or unit structs --> $DIR/issue-56199.rs:8:17 @@ -12,19 +12,19 @@ error: the `Self` constructor can only be used with tuple or unit structs LL | let _ = Self(); | ^^^^ | - = help: did you mean to use one of the enum's variants? + = note: did you mean to use one of the enum's variants? error: the `Self` constructor can only be used with tuple or unit structs --> $DIR/issue-56199.rs:15:17 | LL | let _ = Self; - | ^^^^ help: use curly brackets: `Self { /* fields */ }` + | ^^^^ did you mean `Self { /* fields */ }`? error: the `Self` constructor can only be used with tuple or unit structs --> $DIR/issue-56199.rs:17:17 | LL | let _ = Self(); - | ^^^^ help: use curly brackets: `Self { /* fields */ }` + | ^^^^ did you mean `Self { /* fields */ }`? error: aborting due to 4 previous errors diff --git a/src/test/ui/issues/issue-56835.stderr b/src/test/ui/issues/issue-56835.stderr index f9fdf23af9715..21ecbf05dc72f 100644 --- a/src/test/ui/issues/issue-56835.stderr +++ b/src/test/ui/issues/issue-56835.stderr @@ -2,7 +2,7 @@ error: the `Self` constructor can only be used with tuple or unit structs --> $DIR/issue-56835.rs:4:12 | LL | fn bar(Self(foo): Self) {} - | ^^^^^^^^^ help: use curly brackets: `Self { /* fields */ }` + | ^^^^^^^^^ did you mean `Self { /* fields */ }`? error[E0164]: expected tuple struct/variant, found self constructor `Self` --> $DIR/issue-56835.rs:4:12 diff --git a/src/test/ui/issues/issue-5754.rs b/src/test/ui/issues/issue-5754.rs index 78e8701335905..81a2e16bbdd4f 100644 --- a/src/test/ui/issues/issue-5754.rs +++ b/src/test/ui/issues/issue-5754.rs @@ -2,7 +2,7 @@ #![allow(dead_code)] #![allow(improper_ctypes)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): struct TwoDoubles { r: f64, diff --git a/src/test/ui/issues/issue-5844.rs b/src/test/ui/issues/issue-5844.rs index b855e87e3f559..00c5686163919 100644 --- a/src/test/ui/issues/issue-5844.rs +++ b/src/test/ui/issues/issue-5844.rs @@ -1,4 +1,4 @@ -//aux-build:issue-5844-aux.rs +// aux-build:issue-5844-aux.rs extern crate issue_5844_aux; diff --git a/src/test/ui/issues/issue-5884.rs b/src/test/ui/issues/issue-5884.rs index ad7067bb9b162..5ecdb2a13eaae 100644 --- a/src/test/ui/issues/issue-5884.rs +++ b/src/test/ui/issues/issue-5884.rs @@ -1,6 +1,6 @@ // compile-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![feature(box_syntax)] diff --git a/src/test/ui/issues/issue-5900.rs b/src/test/ui/issues/issue-5900.rs index 5ac7acc8e3980..d14104bd31548 100644 --- a/src/test/ui/issues/issue-5900.rs +++ b/src/test/ui/issues/issue-5900.rs @@ -1,6 +1,6 @@ // compile-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): pub mod foo { use super::Bar; diff --git a/src/test/ui/issues/issue-5950.rs b/src/test/ui/issues/issue-5950.rs index 19e0cfc7f2703..5a36040c11b1e 100644 --- a/src/test/ui/issues/issue-5950.rs +++ b/src/test/ui/issues/issue-5950.rs @@ -1,6 +1,6 @@ // compile-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): pub use local as local_alias; diff --git a/src/test/ui/issues/issue-6341.rs b/src/test/ui/issues/issue-6341.rs index 2b23ccd258643..879176a7f29f8 100644 --- a/src/test/ui/issues/issue-6341.rs +++ b/src/test/ui/issues/issue-6341.rs @@ -1,5 +1,5 @@ // compile-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #[derive(PartialEq)] struct A { x: usize } diff --git a/src/test/ui/issues/issue-6470.rs b/src/test/ui/issues/issue-6470.rs index 49a313f90de09..1d21c457634cd 100644 --- a/src/test/ui/issues/issue-6470.rs +++ b/src/test/ui/issues/issue-6470.rs @@ -2,7 +2,7 @@ #![allow(dead_code)] #![allow(improper_ctypes)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![allow(non_snake_case)] pub mod Bar { diff --git a/src/test/ui/issues/issue-6557.rs b/src/test/ui/issues/issue-6557.rs index aa091ca594aab..a26f19ec89758 100644 --- a/src/test/ui/issues/issue-6557.rs +++ b/src/test/ui/issues/issue-6557.rs @@ -1,6 +1,6 @@ // compile-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![feature(box_patterns)] #![feature(box_syntax)] diff --git a/src/test/ui/issues/issue-6898.rs b/src/test/ui/issues/issue-6898.rs index 608c0c80716a6..fa2d06205eeb8 100644 --- a/src/test/ui/issues/issue-6898.rs +++ b/src/test/ui/issues/issue-6898.rs @@ -1,5 +1,5 @@ // compile-pass -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): use std::mem; diff --git a/src/test/ui/issues/issue-7268.rs b/src/test/ui/issues/issue-7268.rs index 0b94fabf385df..08c4e8e9f7438 100644 --- a/src/test/ui/issues/issue-7268.rs +++ b/src/test/ui/issues/issue-7268.rs @@ -1,6 +1,6 @@ // compile-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): fn foo(_: T) {} diff --git a/src/test/ui/issues/issue-7364.rs b/src/test/ui/issues/issue-7364.rs index 3f9c2ef48a7af..c606895742a0c 100644 --- a/src/test/ui/issues/issue-7364.rs +++ b/src/test/ui/issues/issue-7364.rs @@ -2,7 +2,6 @@ use std::cell::RefCell; -// Regression test for issue 7364 static boxed: Box> = box RefCell::new(0); //~^ ERROR allocations are not allowed in statics //~| ERROR `std::cell::RefCell` cannot be shared between threads safely [E0277] diff --git a/src/test/ui/issues/issue-7364.stderr b/src/test/ui/issues/issue-7364.stderr index 0e4d6ff1d71fa..1570c715dc387 100644 --- a/src/test/ui/issues/issue-7364.stderr +++ b/src/test/ui/issues/issue-7364.stderr @@ -1,11 +1,11 @@ error[E0010]: allocations are not allowed in statics - --> $DIR/issue-7364.rs:6:37 + --> $DIR/issue-7364.rs:5:37 | LL | static boxed: Box> = box RefCell::new(0); | ^^^^^^^^^^^^^^^^^^^ allocation not allowed in statics error[E0277]: `std::cell::RefCell` cannot be shared between threads safely - --> $DIR/issue-7364.rs:6:1 + --> $DIR/issue-7364.rs:5:1 | LL | static boxed: Box> = box RefCell::new(0); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `std::cell::RefCell` cannot be shared between threads safely diff --git a/src/test/ui/issues/issue-7607-2.rs b/src/test/ui/issues/issue-7607-2.rs index 8b5c8505d3ad7..76e61269be94e 100644 --- a/src/test/ui/issues/issue-7607-2.rs +++ b/src/test/ui/issues/issue-7607-2.rs @@ -1,6 +1,6 @@ // compile-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): pub mod a { pub struct Foo { a: usize } diff --git a/src/test/ui/issues/issue-7673-cast-generically-implemented-trait.rs b/src/test/ui/issues/issue-7673-cast-generically-implemented-trait.rs index 7dd6b07177f93..8d0321327040e 100644 --- a/src/test/ui/issues/issue-7673-cast-generically-implemented-trait.rs +++ b/src/test/ui/issues/issue-7673-cast-generically-implemented-trait.rs @@ -1,6 +1,6 @@ // compile-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): /* diff --git a/src/test/ui/issues/issue-8171-default-method-self-inherit-builtin-trait.rs b/src/test/ui/issues/issue-8171-default-method-self-inherit-builtin-trait.rs index e4dafc073ab3b..e179690f70e40 100644 --- a/src/test/ui/issues/issue-8171-default-method-self-inherit-builtin-trait.rs +++ b/src/test/ui/issues/issue-8171-default-method-self-inherit-builtin-trait.rs @@ -1,6 +1,6 @@ // compile-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): /* diff --git a/src/test/ui/issues/issue-8398.rs b/src/test/ui/issues/issue-8398.rs index bd37b8582b204..2cd8452bf1198 100644 --- a/src/test/ui/issues/issue-8398.rs +++ b/src/test/ui/issues/issue-8398.rs @@ -1,6 +1,6 @@ // compile-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): pub trait Writer { fn write(&mut self, b: &[u8]) -> Result<(), ()>; diff --git a/src/test/ui/issues/issue-8578.rs b/src/test/ui/issues/issue-8578.rs index 4cc21234796ae..2f8fa0363061c 100644 --- a/src/test/ui/issues/issue-8578.rs +++ b/src/test/ui/issues/issue-8578.rs @@ -2,7 +2,7 @@ #![allow(dead_code)] #![allow(non_camel_case_types)] #![allow(non_upper_case_globals)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): pub struct UninterpretedOption_NamePart { name_part: Option, diff --git a/src/test/ui/issues/issue-9110.rs b/src/test/ui/issues/issue-9110.rs index 30acd61a34a09..a51ae78c21e04 100644 --- a/src/test/ui/issues/issue-9110.rs +++ b/src/test/ui/issues/issue-9110.rs @@ -1,6 +1,6 @@ // compile-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): #![allow(non_snake_case)] macro_rules! silly_macro { diff --git a/src/test/ui/issues/issue-9243.rs b/src/test/ui/issues/issue-9243.rs index e877dd6492214..558938936aa4f 100644 --- a/src/test/ui/issues/issue-9243.rs +++ b/src/test/ui/issues/issue-9243.rs @@ -1,13 +1,13 @@ // compile-pass + #![allow(dead_code)] -// Regression test for issue 9243 #![allow(non_upper_case_globals)] pub struct Test { mem: isize, } -pub static g_test: Test = Test {mem: 0}; +pub static g_test: Test = Test { mem: 0 }; impl Drop for Test { fn drop(&mut self) {} diff --git a/src/test/ui/issues/issue-9249.rs b/src/test/ui/issues/issue-9249.rs index e4e9c4597192e..a127aed5cc963 100644 --- a/src/test/ui/issues/issue-9249.rs +++ b/src/test/ui/issues/issue-9249.rs @@ -1,6 +1,6 @@ // compile-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): static DATA:&'static [&'static str] = &["my string"]; fn main() { } diff --git a/src/test/ui/issues/issue-9719.rs b/src/test/ui/issues/issue-9719.rs index 96865344e7464..faf7d70597483 100644 --- a/src/test/ui/issues/issue-9719.rs +++ b/src/test/ui/issues/issue-9719.rs @@ -1,6 +1,6 @@ // compile-pass #![allow(dead_code)] -// pretty-expanded FIXME #23616 +// pretty-expanded FIXME(#23616): mod a { pub enum Enum { diff --git a/src/test/ui/lifetimes/lifetime-elision-return-type-trait.rs b/src/test/ui/lifetimes/lifetime-elision-return-type-trait.rs index 1c288a7e44f37..14e3d9fbc1268 100644 --- a/src/test/ui/lifetimes/lifetime-elision-return-type-trait.rs +++ b/src/test/ui/lifetimes/lifetime-elision-return-type-trait.rs @@ -5,7 +5,7 @@ trait Future { use std::error::Error; -fn foo() -> impl Future> { +fn foo() -> impl Future> { //~^ ERROR missing lifetime Ok(()) } diff --git a/src/test/ui/lifetimes/lifetime-elision-return-type-trait.stderr b/src/test/ui/lifetimes/lifetime-elision-return-type-trait.stderr index b2a3d9a94361f..dd037bb1ee50b 100644 --- a/src/test/ui/lifetimes/lifetime-elision-return-type-trait.stderr +++ b/src/test/ui/lifetimes/lifetime-elision-return-type-trait.stderr @@ -1,8 +1,8 @@ error[E0106]: missing lifetime specifier - --> $DIR/lifetime-elision-return-type-trait.rs:8:44 + --> $DIR/lifetime-elision-return-type-trait.rs:8:46 | -LL | fn foo() -> impl Future> { - | ^^^^^ help: consider giving it a 'static lifetime: `Error + 'static` +LL | fn foo() -> impl Future> { + | ^^^^^ help: consider giving it a 'static lifetime: `Error + 'static` | = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from diff --git a/src/test/ui/lifetimes/lifetime-errors/liveness-assign-imm-local-notes.rs b/src/test/ui/lifetimes/lifetime-errors/liveness-assign-imm-local-notes.rs index 99949e17b6f4a..98a195835123b 100644 --- a/src/test/ui/lifetimes/lifetime-errors/liveness-assign-imm-local-notes.rs +++ b/src/test/ui/lifetimes/lifetime-errors/liveness-assign-imm-local-notes.rs @@ -1,4 +1,4 @@ -// FIXME: Change to UI Test +// FIXME: change to UI test. // Check notes are placed on an assignment that can actually precede the current assignment // Don't emit a first assignment for assignment in a loop. diff --git a/src/test/ui/lint/lint-missing-copy-implementations.rs b/src/test/ui/lint/lint-missing-copy-implementations.rs index 918f40de15378..354b6615426ac 100644 --- a/src/test/ui/lint/lint-missing-copy-implementations.rs +++ b/src/test/ui/lint/lint-missing-copy-implementations.rs @@ -1,4 +1,4 @@ -// See issue 19712 +// Test for issue #19712. #![deny(missing_copy_implementations)] diff --git a/src/test/ui/lint/lint-unconditional-recursion.rs b/src/test/ui/lint/lint-unconditional-recursion.rs index 44af1179097ed..1f54300baa317 100644 --- a/src/test/ui/lint/lint-unconditional-recursion.rs +++ b/src/test/ui/lint/lint-unconditional-recursion.rs @@ -124,7 +124,7 @@ fn all_fine() { let _f = all_fine; } -// issue 26333 +// issue #26333 trait Bar { fn method(&self, x: &T) { x.method(x) diff --git a/src/test/ui/macros/format-foreign.rs b/src/test/ui/macros/format-foreign.rs index ac65838f21d85..8d6cbed451534 100644 --- a/src/test/ui/macros/format-foreign.rs +++ b/src/test/ui/macros/format-foreign.rs @@ -8,7 +8,7 @@ fn main() { // correctly account for raw strings in inline suggestions // This should *not* produce hints, on the basis that there's equally as - // many "correct" format specifiers. It's *probably* just an actual typo. + // many "correct" format specifiers. It's *probably* just an actual typo. println!("{} %f", "one", 2.0); //~ ERROR never used println!("Hi there, $NAME.", NAME="Tim"); //~ ERROR never used diff --git a/src/test/ui/match/match-range-fail-dominate.rs b/src/test/ui/match/match-range-fail-dominate.rs index 99069183e4eda..ae7135905a155 100644 --- a/src/test/ui/match/match-range-fail-dominate.rs +++ b/src/test/ui/match/match-range-fail-dominate.rs @@ -1,8 +1,8 @@ -//error-pattern: unreachable -//error-pattern: unreachable -//error-pattern: unreachable -//error-pattern: unreachable -//error-pattern: unreachable +// error-pattern: unreachable +// error-pattern: unreachable +// error-pattern: unreachable +// error-pattern: unreachable +// error-pattern: unreachable #![deny(unreachable_patterns)] diff --git a/src/test/ui/moves/move-guard-same-consts.rs b/src/test/ui/moves/move-guard-same-consts.rs index a2beb368b6e60..d035599b8c681 100644 --- a/src/test/ui/moves/move-guard-same-consts.rs +++ b/src/test/ui/moves/move-guard-same-consts.rs @@ -4,7 +4,7 @@ // // THis was broken for various reasons. In particular, that hack was // originally authored under the assunption that other checks -// elsewhere would ensure that the two patterns did not overlap. But +// elsewhere would ensure that the two patterns did not overlap. But // that assumption did not hold, at least not in the long run (namely, // overlapping patterns were turned into warnings rather than errors). diff --git a/src/test/ui/multiple-plugin-registrars.rs b/src/test/ui/multiple-plugin-registrars.rs index d211204b134be..1547224084200 100644 --- a/src/test/ui/multiple-plugin-registrars.rs +++ b/src/test/ui/multiple-plugin-registrars.rs @@ -2,7 +2,7 @@ #![feature(plugin_registrar)] -// the registration function isn't typechecked yet +// The registration function isn't type-checked yet. #[plugin_registrar] pub fn one() {} diff --git a/src/test/ui/nested_impl_trait.rs b/src/test/ui/nested_impl_trait.rs index be2c21a7743ce..efa51e46426d7 100644 --- a/src/test/ui/nested_impl_trait.rs +++ b/src/test/ui/nested_impl_trait.rs @@ -18,7 +18,7 @@ impl X { //~^ ERROR nested `impl Trait` is not allowed } -fn allowed_in_assoc_type() -> impl Iterator { +fn allowed_in_assoc_type() -> impl Iterator { vec![|| println!("woot")].into_iter() } diff --git a/src/test/ui/nll/closure-requirements/escape-upvar-ref.rs b/src/test/ui/nll/closure-requirements/escape-upvar-ref.rs index a916ccd6c21a2..63618ce3049b9 100644 --- a/src/test/ui/nll/closure-requirements/escape-upvar-ref.rs +++ b/src/test/ui/nll/closure-requirements/escape-upvar-ref.rs @@ -6,7 +6,7 @@ // Both of these are upvars of reference type (the capture of `y` is // of type `&'a i32`, the capture of `p` is of type `&mut &'b // i32`). The closure thus computes a relationship between `'a` and -// `'b`. This relationship is propagated to the closure creator, +// `'b`. This relationship is propagated to the closure creator, // which reports an error. // compile-flags:-Zborrowck=mir -Zverbose diff --git a/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.rs b/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.rs index c1467fcc9b6cf..0fc4ed8c1942c 100644 --- a/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.rs +++ b/src/test/ui/nll/closure-requirements/propagate-fail-to-approximate-longer-wrong-bounds.rs @@ -19,7 +19,7 @@ use std::cell::Cell; // 'b: 'y // // but this doesn't really help us in proving that `'x: 'y`, so -// closure gets an error. In particular, we would need to know that +// closure gets an error. In particular, we would need to know that // `'x: 'a`, so that we could approximate `'x` "downwards" to `'a`. fn establish_relationships<'a, 'b, F>(_cell_a: &Cell<&'a u32>, _cell_b: &Cell<&'b u32>, _closure: F) where diff --git a/src/test/ui/nll/match-guards-always-borrow.rs b/src/test/ui/nll/match-guards-always-borrow.rs index ec4eed6797600..36e3fbf75e58a 100644 --- a/src/test/ui/nll/match-guards-always-borrow.rs +++ b/src/test/ui/nll/match-guards-always-borrow.rs @@ -1,4 +1,4 @@ -//revisions: ast mir +// revisions: ast mir //[mir] compile-flags: -Z borrowck=mir #![feature(rustc_attrs)] diff --git a/src/test/ui/nll/maybe-initialized-drop-implicit-fragment-drop.rs b/src/test/ui/nll/maybe-initialized-drop-implicit-fragment-drop.rs index 5b609820a237f..644a7b7236df7 100644 --- a/src/test/ui/nll/maybe-initialized-drop-implicit-fragment-drop.rs +++ b/src/test/ui/nll/maybe-initialized-drop-implicit-fragment-drop.rs @@ -18,5 +18,5 @@ fn main() { let foo = Foo { a: s, b: wrap }; std::mem::drop(foo.b); x = 1; //~ ERROR cannot assign to `x` because it is borrowed [E0506] - // FIXME ^ Should not error in the future with implicit dtors, only manually implemented ones + // FIXME: ^ Should not error in the future with implicit dtors, only manually implemented ones } diff --git a/src/test/ui/nll/maybe-initialized-drop-implicit-fragment-drop.stderr b/src/test/ui/nll/maybe-initialized-drop-implicit-fragment-drop.stderr index 3ff778675bcf4..4ad07fc6b411d 100644 --- a/src/test/ui/nll/maybe-initialized-drop-implicit-fragment-drop.stderr +++ b/src/test/ui/nll/maybe-initialized-drop-implicit-fragment-drop.stderr @@ -6,7 +6,7 @@ LL | let wrap = Wrap { p: &mut x }; ... LL | x = 1; //~ ERROR cannot assign to `x` because it is borrowed [E0506] | ^^^^^ assignment to borrowed `x` occurs here -LL | // FIXME ^ Should not error in the future with implicit dtors, only manually implemented ones +LL | // FIXME: ^ Should not error in the future with implicit dtors, only manually implemented ones LL | } | - borrow might be used here, when `foo` is dropped and runs the destructor for type `Foo<'_>` diff --git a/src/test/ui/nll/maybe-initialized-drop-with-fragment.rs b/src/test/ui/nll/maybe-initialized-drop-with-fragment.rs index d6cea55c1e07d..f3c47c7c51a22 100644 --- a/src/test/ui/nll/maybe-initialized-drop-with-fragment.rs +++ b/src/test/ui/nll/maybe-initialized-drop-with-fragment.rs @@ -1,4 +1,4 @@ -//compile-flags: -Zborrowck=mir +// compile-flags: -Zborrowck=mir #![allow(warnings)] diff --git a/src/test/ui/nll/maybe-initialized-drop-with-uninitialized-fragments.rs b/src/test/ui/nll/maybe-initialized-drop-with-uninitialized-fragments.rs index d2d1b98c41c14..0693047ff14af 100644 --- a/src/test/ui/nll/maybe-initialized-drop-with-uninitialized-fragments.rs +++ b/src/test/ui/nll/maybe-initialized-drop-with-uninitialized-fragments.rs @@ -1,4 +1,4 @@ -//compile-flags: -Zborrowck=mir +// compile-flags: -Zborrowck=mir #![allow(warnings)] @@ -20,5 +20,5 @@ fn main() { std::mem::drop(foo.a); std::mem::drop(foo.b); x = 1; //~ ERROR cannot assign to `x` because it is borrowed [E0506] - // FIXME ^ This currently errors and it should not. + // FIXME: ^ This currently errors and it should not. } diff --git a/src/test/ui/nll/maybe-initialized-drop-with-uninitialized-fragments.stderr b/src/test/ui/nll/maybe-initialized-drop-with-uninitialized-fragments.stderr index aa9544927f899..b8a40f6355f94 100644 --- a/src/test/ui/nll/maybe-initialized-drop-with-uninitialized-fragments.stderr +++ b/src/test/ui/nll/maybe-initialized-drop-with-uninitialized-fragments.stderr @@ -6,7 +6,7 @@ LL | let wrap = Wrap { p: &mut x }; ... LL | x = 1; //~ ERROR cannot assign to `x` because it is borrowed [E0506] | ^^^^^ assignment to borrowed `x` occurs here -LL | // FIXME ^ This currently errors and it should not. +LL | // FIXME: ^ This currently errors and it should not. LL | } | - borrow might be used here, when `foo` is dropped and runs the destructor for type `Foo<'_>` diff --git a/src/test/ui/nll/maybe-initialized-drop.rs b/src/test/ui/nll/maybe-initialized-drop.rs index cd12e93d555ff..71a8b3fcdba1d 100644 --- a/src/test/ui/nll/maybe-initialized-drop.rs +++ b/src/test/ui/nll/maybe-initialized-drop.rs @@ -1,4 +1,4 @@ -//compile-flags: -Zborrowck=mir +// compile-flags: -Zborrowck=mir #![allow(warnings)] diff --git a/src/test/ui/nll/normalization-bounds.rs b/src/test/ui/nll/normalization-bounds.rs index ebc19d7cc8350..df5064be666bb 100644 --- a/src/test/ui/nll/normalization-bounds.rs +++ b/src/test/ui/nll/normalization-bounds.rs @@ -1,6 +1,6 @@ // Check that lifetime bounds get checked the right way around with NLL enabled. -//run-pass +// run-pass #![feature(nll)] trait Visitor<'d> { diff --git a/src/test/ui/nll/reference-carried-through-struct-field.rs b/src/test/ui/nll/reference-carried-through-struct-field.rs index f7903cba6a22c..9b745a366e810 100644 --- a/src/test/ui/nll/reference-carried-through-struct-field.rs +++ b/src/test/ui/nll/reference-carried-through-struct-field.rs @@ -1,4 +1,4 @@ -//revisions: ast mir +// revisions: ast mir //[mir] compile-flags: -Z borrowck=mir #![allow(unused_assignments)] diff --git a/src/test/ui/nll/ty-outlives/projection-where-clause-env.rs b/src/test/ui/nll/ty-outlives/projection-where-clause-env.rs index c6935badf54b2..485c3dd0d5cab 100644 --- a/src/test/ui/nll/ty-outlives/projection-where-clause-env.rs +++ b/src/test/ui/nll/ty-outlives/projection-where-clause-env.rs @@ -1,7 +1,7 @@ #![feature(nll)] // Test that when we have a `>::Output: 'a` -// relationship in the environment we take advantage of it. In this +// relationship in the environment we take advantage of it. In this // case, that means we **don't** have to prove that `T: 'a`. // // Regression test for #53121. diff --git a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.rs b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.rs index 7fce771fc8b6e..0ee322d7eb7b2 100644 --- a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.rs +++ b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-return-type.rs @@ -17,7 +17,7 @@ where T: Debug, { // Here, the closure winds up being required to prove that `T: - // 'a`. In principle, it could know that, except that it is + // 'a`. In principle, it could know that, except that it is // type-checked in a fully generic way, and hence it winds up with // a propagated requirement that `T: '_#2`, where `'_#2` appears // in the return type. The caller makes the mapping from `'_#2` to diff --git a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.rs b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.rs index c93172885bfcc..bedf5fba5bc3a 100644 --- a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.rs +++ b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.rs @@ -1,4 +1,4 @@ -// Test that we can propagate `T: 'a` obligations to our caller. See +// Test that we can propagate `T: 'a` obligations to our caller. See // `correct_region` for an explanation of how this test is setup; it's // somewhat intricate. @@ -28,7 +28,7 @@ fn no_region<'a, T>(a: Cell<&'a ()>, b: T) { //~^ ERROR the parameter type `T` may not live long enough // // See `correct_region`, which explains the point of this - // test. The only difference is that, in the case of this + // test. The only difference is that, in the case of this // function, there is no where clause *anywhere*, and hence we // get an error (but reported by the closure creator). require(&x, &y) @@ -63,7 +63,7 @@ where { with_signature(a, b, |x, y| { //~^ ERROR the parameter type `T` may not live long enough - // See `correct_region` + // See `correct_region`. require(&x, &y) }) } @@ -75,7 +75,7 @@ where 'b: 'a, { with_signature(a, b, |x, y| { - // See `correct_region` + // See `correct_region`. require(&x, &y) }) } diff --git a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr index a76a9463cc801..6ada2e361f55a 100644 --- a/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr +++ b/src/test/ui/nll/ty-outlives/ty-param-closure-outlives-from-where-clause.stderr @@ -96,7 +96,7 @@ note: External requirements LL | with_signature(a, b, |x, y| { | __________________________^ LL | | //~^ ERROR the parameter type `T` may not live long enough -LL | | // See `correct_region` +LL | | // See `correct_region`. LL | | require(&x, &y) LL | | }) | |_____^ @@ -134,7 +134,7 @@ error[E0309]: the parameter type `T` may not live long enough LL | with_signature(a, b, |x, y| { | __________________________^ LL | | //~^ ERROR the parameter type `T` may not live long enough -LL | | // See `correct_region` +LL | | // See `correct_region`. LL | | require(&x, &y) LL | | }) | |_____^ @@ -146,7 +146,7 @@ note: External requirements | LL | with_signature(a, b, |x, y| { | __________________________^ -LL | | // See `correct_region` +LL | | // See `correct_region`. LL | | require(&x, &y) LL | | }) | |_____^ diff --git a/src/test/ui/nll/user-annotations/issue-55219.rs b/src/test/ui/nll/user-annotations/issue-55219.rs index 7daa5a59b9977..99d8a6ac5cc09 100644 --- a/src/test/ui/nll/user-annotations/issue-55219.rs +++ b/src/test/ui/nll/user-annotations/issue-55219.rs @@ -1,8 +1,6 @@ -// Regression test for #55219: -// -// The `Self::HASH_LEN` here expands to a "self-type" where `T` is not +// The `Self::HASH_LEN` here expands to a self type where `T` is not // known. This unbound inference variable was causing an ICE. -// + // run-pass #![feature(nll)] diff --git a/src/test/ui/no-warn-on-field-replace-issue-34101.rs b/src/test/ui/no-warn-on-field-replace-issue-34101.rs index af6ccf35d538c..be34cf3010a15 100644 --- a/src/test/ui/no-warn-on-field-replace-issue-34101.rs +++ b/src/test/ui/no-warn-on-field-replace-issue-34101.rs @@ -1,4 +1,4 @@ -// Issue 34101: Circa 2016-06-05, `fn inline` below issued an +// Issue #34101: circa 2016-06-05, `fn inline` below issued an // erroneous warning from the elaborate_drops pass about moving out of // a field in `Foo`, which has a destructor (and thus cannot have // content moved out of it). The reason that the warning is erroneous @@ -11,13 +11,6 @@ // flag for such subcontent of `Foo` will always have the same value // as the drop flag for `Foo` itself. - - - - - - - // compile-pass struct Foo(String); @@ -27,7 +20,7 @@ impl Drop for Foo { } fn inline() { - // (dummy variable so `f` gets assigned `var1` in MIR for both fn's) + // Dummy variable so `f` gets assigned `var1` in MIR for both fn's. let _s = (); let mut f = Foo(String::from("foo")); f.0 = String::from("bar"); diff --git a/src/test/ui/no_crate_type.rs b/src/test/ui/no_crate_type.rs index 43efdac5e8c74..c3458c9848625 100644 --- a/src/test/ui/no_crate_type.rs +++ b/src/test/ui/no_crate_type.rs @@ -1,5 +1,5 @@ -// regression test for issue 11256 -#![crate_type] //~ ERROR `crate_type` requires a value +// Regression test for issue #11256. +#![crate_type] //~ ERROR `crate_type` requires a value fn main() { return diff --git a/src/test/ui/no_crate_type.stderr b/src/test/ui/no_crate_type.stderr index 9d691f3eb54ca..750eb23515dc2 100644 --- a/src/test/ui/no_crate_type.stderr +++ b/src/test/ui/no_crate_type.stderr @@ -1,7 +1,7 @@ error: `crate_type` requires a value --> $DIR/no_crate_type.rs:2:1 | -LL | #![crate_type] //~ ERROR `crate_type` requires a value +LL | #![crate_type] //~ ERROR `crate_type` requires a value | ^^^^^^^^^^^^^^ | = note: for example: `#![crate_type="lib"]` diff --git a/src/test/ui/on-unimplemented/bad-annotation.rs b/src/test/ui/on-unimplemented/bad-annotation.rs index e5e921ca28f95..52cfc38d55184 100644 --- a/src/test/ui/on-unimplemented/bad-annotation.rs +++ b/src/test/ui/on-unimplemented/bad-annotation.rs @@ -11,7 +11,7 @@ trait Foo #[rustc_on_unimplemented="a collection of type `{Self}` cannot be built from an iterator over elements of type `{A}`"] trait MyFromIterator { /// Build a container with elements from an external iterator. - fn my_from_iter>(iterator: T) -> Self; + fn my_from_iter>(iterator: T) -> Self; } #[rustc_on_unimplemented] //~ ERROR `#[rustc_on_unimplemented]` requires a value diff --git a/src/test/ui/on-unimplemented/on-trait.rs b/src/test/ui/on-unimplemented/on-trait.rs index 22afda16f433a..ff5b61705083e 100644 --- a/src/test/ui/on-unimplemented/on-trait.rs +++ b/src/test/ui/on-unimplemented/on-trait.rs @@ -16,10 +16,10 @@ fn foobar>() -> T { #[rustc_on_unimplemented="a collection of type `{Self}` cannot be built from an iterator over elements of type `{A}`"] trait MyFromIterator { /// Build a container with elements from an external iterator. - fn my_from_iter>(iterator: T) -> Self; + fn my_from_iter>(iterator: T) -> Self; } -fn collect, B: MyFromIterator>(it: I) -> B { +fn collect, B: MyFromIterator>(it: I) -> B { MyFromIterator::my_from_iter(it) } diff --git a/src/test/ui/on-unimplemented/on-trait.stderr b/src/test/ui/on-unimplemented/on-trait.stderr index 939c2725cc472..581de87154946 100644 --- a/src/test/ui/on-unimplemented/on-trait.stderr +++ b/src/test/ui/on-unimplemented/on-trait.stderr @@ -8,8 +8,8 @@ LL | let y: Option> = collect(x.iter()); // this should give approxi note: required by `collect` --> $DIR/on-trait.rs:22:1 | -LL | fn collect, B: MyFromIterator>(it: I) -> B { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn collect, B: MyFromIterator>(it: I) -> B { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `std::string::String: Bar::Foo` is not satisfied --> $DIR/on-trait.rs:31:21 diff --git a/src/test/ui/overlap-marker-trait.rs b/src/test/ui/overlap-marker-trait.rs index bf39d9c903f80..4b2ec7a6064f6 100644 --- a/src/test/ui/overlap-marker-trait.rs +++ b/src/test/ui/overlap-marker-trait.rs @@ -1,7 +1,7 @@ // Test for RFC 1268: we allow overlapping impls of marker traits, // that is, traits without items. In this case, a type `T` is // `MyMarker` if it is either `Debug` or `Display`. This test just -// checks that we don't consider **all** types to be `MyMarker`. See +// checks that we don't consider **all** types to be `MyMarker`. See // also the companion test in // `run-pass/overlap-permitted-for-marker-traits.rs`. diff --git a/src/test/ui/parser/fn-arg-doc-comment.rs b/src/test/ui/parser/fn-arg-doc-comment.rs index 22af94b628452..14cce418f4033 100644 --- a/src/test/ui/parser/fn-arg-doc-comment.rs +++ b/src/test/ui/parser/fn-arg-doc-comment.rs @@ -18,7 +18,7 @@ fn bar(id: #[allow(dead_code)] i32) {} //~| NOTE attributes are not allowed here fn main() { - // verify that the parser recovered and properly typechecked the args + // Verify that the parser recovered and properly type-checked the args. f("", ""); //~^ ERROR mismatched types //~| NOTE expected u8, found reference diff --git a/src/test/ui/parser/tag-variant-disr-non-nullary.rs b/src/test/ui/parser/tag-variant-disr-non-nullary.rs index 55ab871dd333f..372c92aaea966 100644 --- a/src/test/ui/parser/tag-variant-disr-non-nullary.rs +++ b/src/test/ui/parser/tag-variant-disr-non-nullary.rs @@ -1,6 +1,6 @@ // compile-flags: -Z parse-only -//error-pattern: discriminator values can only be used with a field-less enum +// error-pattern: discriminator values can only be used with a field-less enum enum color { red = 0xff0000, diff --git a/src/test/ui/parser/underscore-suffix-for-string.stderr b/src/test/ui/parser/underscore-suffix-for-string.stderr index ed1b4d3ebd026..1ff0c1060f5b0 100644 --- a/src/test/ui/parser/underscore-suffix-for-string.stderr +++ b/src/test/ui/parser/underscore-suffix-for-string.stderr @@ -5,5 +5,5 @@ LL | let _ = "Foo"_; | ^ | = 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 #42326 + = note: for more information, see diff --git a/src/test/ui/print_type_sizes/repr_int_c.rs b/src/test/ui/print_type_sizes/repr_int_c.rs index 6816bb71a0012..1b630dbeb6086 100644 --- a/src/test/ui/print_type_sizes/repr_int_c.rs +++ b/src/test/ui/print_type_sizes/repr_int_c.rs @@ -2,7 +2,7 @@ // compile-pass // This test makes sure that the tag is not grown for `repr(C)` or `repr(u8)` -// variants (see https://github.com/rust-lang/rust/issues/50098 for the original bug). +// variants (see issue #50098 for the original bug). #![feature(start)] #![allow(dead_code)] diff --git a/src/test/ui/privacy/associated-item-privacy-type-binding.rs b/src/test/ui/privacy/associated-item-privacy-type-binding.rs index 591e9df81eb0b..ff274ab8f1f8d 100644 --- a/src/test/ui/privacy/associated-item-privacy-type-binding.rs +++ b/src/test/ui/privacy/associated-item-privacy-type-binding.rs @@ -9,19 +9,19 @@ mod priv_trait { pub macro mac1() { let _: Box>; - //~^ ERROR trait `priv_trait::PrivTr` is private - //~| ERROR trait `priv_trait::PrivTr` is private + //~^ ERROR type `(dyn priv_trait::PubTr + ')` is private + //~| ERROR type `(dyn priv_trait::PubTr + ')` is private type InSignatureTy2 = Box>; - //~^ ERROR trait `priv_trait::PrivTr` is private + //~^ ERROR type `(dyn priv_trait::PubTr + 'static)` is private trait InSignatureTr2: PubTr {} //~^ ERROR trait `priv_trait::PrivTr` is private } pub macro mac2() { let _: Box>; - //~^ ERROR trait `priv_trait::PrivTr` is private - //~| ERROR trait `priv_trait::PrivTr` is private + //~^ ERROR type `(dyn priv_trait::PrivTr + ')` is private + //~| ERROR type `(dyn priv_trait::PrivTr + ')` is private type InSignatureTy1 = Box>; - //~^ ERROR trait `priv_trait::PrivTr` is private + //~^ ERROR type `(dyn priv_trait::PrivTr + 'static)` is private trait InSignatureTr1: PrivTr {} //~^ ERROR trait `priv_trait::PrivTr` is private } diff --git a/src/test/ui/privacy/associated-item-privacy-type-binding.stderr b/src/test/ui/privacy/associated-item-privacy-type-binding.stderr index 7f6886d7f9ad4..331e2f689b547 100644 --- a/src/test/ui/privacy/associated-item-privacy-type-binding.stderr +++ b/src/test/ui/privacy/associated-item-privacy-type-binding.stderr @@ -1,4 +1,4 @@ -error: trait `priv_trait::PrivTr` is private +error: type `(dyn priv_trait::PubTr + ')` is private --> $DIR/associated-item-privacy-type-binding.rs:11:13 | LL | let _: Box>; @@ -7,7 +7,7 @@ LL | let _: Box>; LL | priv_trait::mac1!(); | -------------------- in this macro invocation -error: trait `priv_trait::PrivTr` is private +error: type `(dyn priv_trait::PubTr + ')` is private --> $DIR/associated-item-privacy-type-binding.rs:11:16 | LL | let _: Box>; @@ -16,7 +16,7 @@ LL | let _: Box>; LL | priv_trait::mac1!(); | -------------------- in this macro invocation -error: trait `priv_trait::PrivTr` is private +error: type `(dyn priv_trait::PubTr + 'static)` is private --> $DIR/associated-item-privacy-type-binding.rs:14:31 | LL | type InSignatureTy2 = Box>; @@ -34,7 +34,7 @@ LL | trait InSignatureTr2: PubTr {} LL | priv_trait::mac1!(); | -------------------- in this macro invocation -error: trait `priv_trait::PrivTr` is private +error: type `(dyn priv_trait::PrivTr + ')` is private --> $DIR/associated-item-privacy-type-binding.rs:20:13 | LL | let _: Box>; @@ -43,7 +43,7 @@ LL | let _: Box>; LL | priv_trait::mac2!(); | -------------------- in this macro invocation -error: trait `priv_trait::PrivTr` is private +error: type `(dyn priv_trait::PrivTr + ')` is private --> $DIR/associated-item-privacy-type-binding.rs:20:16 | LL | let _: Box>; @@ -52,7 +52,7 @@ LL | let _: Box>; LL | priv_trait::mac2!(); | -------------------- in this macro invocation -error: trait `priv_trait::PrivTr` is private +error: type `(dyn priv_trait::PrivTr + 'static)` is private --> $DIR/associated-item-privacy-type-binding.rs:23:31 | LL | type InSignatureTy1 = Box>; diff --git a/src/test/ui/privacy/private-in-public-expr-pat.rs b/src/test/ui/privacy/private-in-public-expr-pat.rs deleted file mode 100644 index a3e53bdf45de3..0000000000000 --- a/src/test/ui/privacy/private-in-public-expr-pat.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Patterns and expressions are not interface parts and don't produce private-in-public errors. - -// compile-pass - -struct Priv1(usize); -struct Priv2; - -pub struct Pub(Priv2); - -pub fn public_expr(_: [u8; Priv1(0).0]) {} // OK -pub fn public_pat(Pub(Priv2): Pub) {} // OK - -fn main() {} diff --git a/src/test/ui/privacy/private-in-public-non-principal-2.rs b/src/test/ui/privacy/private-in-public-non-principal-2.rs deleted file mode 100644 index 02fd92aa7a4ef..0000000000000 --- a/src/test/ui/privacy/private-in-public-non-principal-2.rs +++ /dev/null @@ -1,13 +0,0 @@ -#![feature(optin_builtin_traits)] - -#[allow(private_in_public)] -mod m { - pub trait PubPrincipal {} - auto trait PrivNonPrincipal {} - pub fn leak_dyn_nonprincipal() -> Box { loop {} } -} - -fn main() { - m::leak_dyn_nonprincipal(); - //~^ ERROR trait `m::PrivNonPrincipal` is private -} diff --git a/src/test/ui/privacy/private-in-public-non-principal-2.stderr b/src/test/ui/privacy/private-in-public-non-principal-2.stderr deleted file mode 100644 index 2db4925722642..0000000000000 --- a/src/test/ui/privacy/private-in-public-non-principal-2.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: trait `m::PrivNonPrincipal` is private - --> $DIR/private-in-public-non-principal-2.rs:11:5 - | -LL | m::leak_dyn_nonprincipal(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to previous error - diff --git a/src/test/ui/privacy/private-in-public-non-principal.rs b/src/test/ui/privacy/private-in-public-non-principal.rs deleted file mode 100644 index 5de5a685208cd..0000000000000 --- a/src/test/ui/privacy/private-in-public-non-principal.rs +++ /dev/null @@ -1,20 +0,0 @@ -#![feature(optin_builtin_traits)] - -pub trait PubPrincipal {} -auto trait PrivNonPrincipal {} - -pub fn leak_dyn_nonprincipal() -> Box { loop {} } -//~^ WARN private trait `PrivNonPrincipal` in public interface -//~| WARN this was previously accepted - -#[deny(missing_docs)] -fn container() { - impl dyn PubPrincipal { - pub fn check_doc_lint() {} //~ ERROR missing documentation for a method - } - impl dyn PubPrincipal + PrivNonPrincipal { - pub fn check_doc_lint() {} // OK, no missing doc lint - } -} - -fn main() {} diff --git a/src/test/ui/privacy/private-in-public-non-principal.stderr b/src/test/ui/privacy/private-in-public-non-principal.stderr deleted file mode 100644 index 9967405589777..0000000000000 --- a/src/test/ui/privacy/private-in-public-non-principal.stderr +++ /dev/null @@ -1,24 +0,0 @@ -warning: private trait `PrivNonPrincipal` in public interface (error E0445) - --> $DIR/private-in-public-non-principal.rs:6:1 - | -LL | pub fn leak_dyn_nonprincipal() -> Box { loop {} } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: #[warn(private_in_public)] 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 #34537 - -error: missing documentation for a method - --> $DIR/private-in-public-non-principal.rs:13:9 - | -LL | pub fn check_doc_lint() {} //~ ERROR missing documentation for a method - | ^^^^^^^^^^^^^^^^^^^^^^^ - | -note: lint level defined here - --> $DIR/private-in-public-non-principal.rs:10:8 - | -LL | #[deny(missing_docs)] - | ^^^^^^^^^^^^ - -error: aborting due to previous error - diff --git a/src/test/ui/privacy/private-in-public-warn.rs b/src/test/ui/privacy/private-in-public-warn.rs index 29f365b69be4d..0da0d03595d83 100644 --- a/src/test/ui/privacy/private-in-public-warn.rs +++ b/src/test/ui/privacy/private-in-public-warn.rs @@ -213,15 +213,6 @@ mod aliases_pub { impl PrivUseAliasTr for ::AssocAlias { type Check = Priv; //~ ERROR private type `aliases_pub::Priv` in public interface } - impl PrivUseAliasTr for Option<::AssocAlias> { - type Check = Priv; //~ ERROR private type `aliases_pub::Priv` in public interface - } - impl PrivUseAliasTr for (::AssocAlias, Priv) { - type Check = Priv; // OK - } - impl PrivUseAliasTr for Option<(::AssocAlias, Priv)> { - type Check = Priv; // OK - } } mod aliases_priv { diff --git a/src/test/ui/privacy/private-in-public-warn.stderr b/src/test/ui/privacy/private-in-public-warn.stderr index 8f9e7cd74f992..ab9ff8d64d36c 100644 --- a/src/test/ui/privacy/private-in-public-warn.stderr +++ b/src/test/ui/privacy/private-in-public-warn.stderr @@ -297,17 +297,8 @@ LL | struct Priv; LL | type Check = Priv; //~ ERROR private type `aliases_pub::Priv` in public interface | ^^^^^^^^^^^^^^^^^^ can't leak private type -error[E0446]: private type `aliases_pub::Priv` in public interface - --> $DIR/private-in-public-warn.rs:217:9 - | -LL | struct Priv; - | - `aliases_pub::Priv` declared as private -... -LL | type Check = Priv; //~ ERROR private type `aliases_pub::Priv` in public interface - | ^^^^^^^^^^^^^^^^^^ can't leak private type - error: private trait `aliases_priv::PrivTr1` in public interface (error E0445) - --> $DIR/private-in-public-warn.rs:247:5 + --> $DIR/private-in-public-warn.rs:238:5 | LL | pub trait Tr1: PrivUseAliasTr {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -315,8 +306,8 @@ LL | pub trait Tr1: PrivUseAliasTr {} = 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 #34537 -error: private trait `aliases_priv::PrivTr1` in public interface (error E0445) - --> $DIR/private-in-public-warn.rs:250:5 +error: private type `aliases_priv::Priv2` in public interface (error E0446) + --> $DIR/private-in-public-warn.rs:241:5 | LL | pub trait Tr2: PrivUseAliasTr {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -324,8 +315,8 @@ LL | pub trait Tr2: PrivUseAliasTr {} = 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 #34537 -error: private type `aliases_priv::Priv2` in public interface (error E0446) - --> $DIR/private-in-public-warn.rs:250:5 +error: private trait `aliases_priv::PrivTr1` in public interface (error E0445) + --> $DIR/private-in-public-warn.rs:241:5 | LL | pub trait Tr2: PrivUseAliasTr {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -333,6 +324,6 @@ LL | pub trait Tr2: PrivUseAliasTr {} = 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 #34537 -error: aborting due to 36 previous errors +error: aborting due to 35 previous errors For more information about this error, try `rustc --explain E0446`. diff --git a/src/test/ui/privacy/private-in-public.rs b/src/test/ui/privacy/private-in-public.rs index 08c00f44f2269..288298cfbfcf6 100644 --- a/src/test/ui/privacy/private-in-public.rs +++ b/src/test/ui/privacy/private-in-public.rs @@ -102,7 +102,7 @@ mod aliases_pub { // This should be OK, but associated type aliases are not substituted yet pub fn f3(arg: ::Assoc) {} - //~^ ERROR private trait `aliases_pub::PrivTr` in public interface + //~^ ERROR private type `::Assoc` in public interface //~| ERROR private type `aliases_pub::Priv` in public interface impl PrivUseAlias { @@ -131,7 +131,7 @@ mod aliases_priv { pub fn f1(arg: PrivUseAlias) {} //~ ERROR private type `aliases_priv::Priv1` in public interface pub fn f2(arg: PrivAlias) {} //~ ERROR private type `aliases_priv::Priv2` in public interface pub fn f3(arg: ::Assoc) {} - //~^ ERROR private trait `aliases_priv::PrivTr` in public interface + //~^ ERROR private type `::Assoc` in public //~| ERROR private type `aliases_priv::Priv` in public interface } diff --git a/src/test/ui/privacy/private-in-public.stderr b/src/test/ui/privacy/private-in-public.stderr index bf88a83e633cc..2bd7503ab5aae 100644 --- a/src/test/ui/privacy/private-in-public.stderr +++ b/src/test/ui/privacy/private-in-public.stderr @@ -82,36 +82,24 @@ LL | pub fn f2() -> Priv { panic!() } //~ ERROR private type `types::Pri error[E0445]: private trait `traits::PrivTr` in public interface --> $DIR/private-in-public.rs:31:5 | -LL | trait PrivTr {} - | - `traits::PrivTr` declared as private -... LL | pub enum E { V(T) } //~ ERROR private trait `traits::PrivTr` in public interface | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait error[E0445]: private trait `traits::PrivTr` in public interface --> $DIR/private-in-public.rs:32:5 | -LL | trait PrivTr {} - | - `traits::PrivTr` declared as private -... LL | pub fn f(arg: T) {} //~ ERROR private trait `traits::PrivTr` in public interface | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait error[E0445]: private trait `traits::PrivTr` in public interface --> $DIR/private-in-public.rs:33:5 | -LL | trait PrivTr {} - | - `traits::PrivTr` declared as private -... LL | pub struct S1(T); //~ ERROR private trait `traits::PrivTr` in public interface | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait error[E0445]: private trait `traits::PrivTr` in public interface --> $DIR/private-in-public.rs:34:5 | -LL | trait PrivTr {} - | - `traits::PrivTr` declared as private -... LL | / impl Pub { //~ ERROR private trait `traits::PrivTr` in public interface LL | | pub fn f(arg: U) {} //~ ERROR private trait `traits::PrivTr` in public interface LL | | } @@ -120,45 +108,30 @@ LL | | } error[E0445]: private trait `traits::PrivTr` in public interface --> $DIR/private-in-public.rs:35:9 | -LL | trait PrivTr {} - | - `traits::PrivTr` declared as private -... LL | pub fn f(arg: U) {} //~ ERROR private trait `traits::PrivTr` in public interface | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait error[E0445]: private trait `traits_where::PrivTr` in public interface --> $DIR/private-in-public.rs:44:5 | -LL | trait PrivTr {} - | - `traits_where::PrivTr` declared as private -... LL | pub enum E where T: PrivTr { V(T) } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait error[E0445]: private trait `traits_where::PrivTr` in public interface --> $DIR/private-in-public.rs:46:5 | -LL | trait PrivTr {} - | - `traits_where::PrivTr` declared as private -... LL | pub fn f(arg: T) where T: PrivTr {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait error[E0445]: private trait `traits_where::PrivTr` in public interface --> $DIR/private-in-public.rs:48:5 | -LL | trait PrivTr {} - | - `traits_where::PrivTr` declared as private -... LL | pub struct S1(T) where T: PrivTr; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait error[E0445]: private trait `traits_where::PrivTr` in public interface --> $DIR/private-in-public.rs:50:5 | -LL | trait PrivTr {} - | - `traits_where::PrivTr` declared as private -... LL | / impl Pub where T: PrivTr { LL | | //~^ ERROR private trait `traits_where::PrivTr` in public interface LL | | pub fn f(arg: U) where U: PrivTr {} @@ -169,9 +142,6 @@ LL | | } error[E0445]: private trait `traits_where::PrivTr` in public interface --> $DIR/private-in-public.rs:52:9 | -LL | trait PrivTr {} - | - `traits_where::PrivTr` declared as private -... LL | pub fn f(arg: U) where U: PrivTr {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait @@ -211,14 +181,14 @@ LL | struct Priv; LL | pub fn f(arg: Priv) {} //~ ERROR private type `impls::Priv` in public interface | ^^^^^^^^^^^^^^^^^^^^^^ can't leak private type -error[E0445]: private trait `aliases_pub::PrivTr` in public interface +error[E0446]: private type `::Assoc` in public interface --> $DIR/private-in-public.rs:104:5 | LL | trait PrivTr { - | - `aliases_pub::PrivTr` declared as private + | - `::Assoc` declared as private ... LL | pub fn f3(arg: ::Assoc) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type error[E0446]: private type `aliases_pub::Priv` in public interface --> $DIR/private-in-public.rs:104:5 @@ -256,14 +226,14 @@ LL | struct Priv2; LL | pub fn f2(arg: PrivAlias) {} //~ ERROR private type `aliases_priv::Priv2` in public interface | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type -error[E0445]: private trait `aliases_priv::PrivTr` in public interface +error[E0446]: private type `::Assoc` in public interface --> $DIR/private-in-public.rs:133:5 | LL | trait PrivTr { - | - `aliases_priv::PrivTr` declared as private + | - `::Assoc` declared as private ... LL | pub fn f3(arg: ::Assoc) {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type error[E0446]: private type `aliases_priv::Priv` in public interface --> $DIR/private-in-public.rs:133:5 diff --git a/src/test/ui/privacy/private-inferred-type.rs b/src/test/ui/privacy/private-inferred-type.rs index 69b60a56c67f1..1eb5fa408cd7f 100644 --- a/src/test/ui/privacy/private-inferred-type.rs +++ b/src/test/ui/privacy/private-inferred-type.rs @@ -119,7 +119,7 @@ fn main() { m::leak_anon2(); //~ ERROR type `m::Priv` is private m::leak_anon3(); //~ ERROR type `m::Priv` is private - m::leak_dyn1(); //~ ERROR trait `m::Trait` is private + m::leak_dyn1(); //~ ERROR type `(dyn m::Trait + 'static)` is private m::leak_dyn2(); //~ ERROR type `m::Priv` is private m::leak_dyn3(); //~ ERROR type `m::Priv` is private diff --git a/src/test/ui/privacy/private-inferred-type.stderr b/src/test/ui/privacy/private-inferred-type.stderr index 80a475f7dceea..089fb1d3c3ea8 100644 --- a/src/test/ui/privacy/private-inferred-type.stderr +++ b/src/test/ui/privacy/private-inferred-type.stderr @@ -160,10 +160,10 @@ error: type `m::Priv` is private LL | m::leak_anon3(); //~ ERROR type `m::Priv` is private | ^^^^^^^^^^^^^^^ -error: trait `m::Trait` is private +error: type `(dyn m::Trait + 'static)` is private --> $DIR/private-inferred-type.rs:122:5 | -LL | m::leak_dyn1(); //~ ERROR trait `m::Trait` is private +LL | m::leak_dyn1(); //~ ERROR type `(dyn m::Trait + 'static)` is private | ^^^^^^^^^^^^^^ error: type `m::Priv` is private diff --git a/src/test/ui/proc-macro/issue-41211.rs b/src/test/ui/proc-macro/issue-41211.rs index 0b082f4818f1b..51217e164fdcc 100644 --- a/src/test/ui/proc-macro/issue-41211.rs +++ b/src/test/ui/proc-macro/issue-41211.rs @@ -1,7 +1,7 @@ // aux-build:issue-41211.rs -// FIXME: https://github.com/rust-lang/rust/issues/41430 -// This is a temporary regression test for the ICE reported in #41211 +// FIXME: issue #41430. +// This is a temporary regression test for the ICE reported in issue #41211. #![feature(custom_inner_attributes)] diff --git a/src/test/ui/proc-macro/proc-macro-gates2.rs b/src/test/ui/proc-macro/proc-macro-gates2.rs index 46b543a397cc7..daeba70cd53d7 100644 --- a/src/test/ui/proc-macro/proc-macro-gates2.rs +++ b/src/test/ui/proc-macro/proc-macro-gates2.rs @@ -6,7 +6,7 @@ extern crate proc_macro_gates as foo; use foo::*; -// NB. these errors aren't the best errors right now, but they're definitely +// N.B., these errors aren't the best errors right now, but they're definitely // intended to be errors. Somehow using a custom attribute in these positions // should either require a feature gate or not be allowed on stable. diff --git a/src/test/ui/proc-macro/span-preservation.rs b/src/test/ui/proc-macro/span-preservation.rs index 64f675ecc1c4d..9b8bc64898e97 100644 --- a/src/test/ui/proc-macro/span-preservation.rs +++ b/src/test/ui/proc-macro/span-preservation.rs @@ -36,7 +36,7 @@ fn c() { let y = Foo { a: 10, b: 10isize }; //~ ERROR has no field named `b` } -// FIXME: This doesn't work at the moment. See the one below. The pretty-printer +// FIXME: this doesn't work at the moment. See the one below. The pretty-printer // injects a "C" between `extern` and `fn` which causes a "probably_eq" // `TokenStream` mismatch. The lack of `"C"` should be preserved in the AST. #[foo] diff --git a/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.rs b/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.rs index df7c1e0c7c78b..54d3a1cb502b5 100644 --- a/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.rs +++ b/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.rs @@ -37,7 +37,7 @@ fn with_assoc<'a,'b>() { // outlive 'a. In this case, that means TheType<'b>::TheAssocType, // which is &'b (), must outlive 'a. - // FIXME (#54943) NLL doesn't enforce WF condition in unreachable code if + // FIXME(#54943) NLL doesn't enforce WF condition in unreachable code if // `_x` is changed to `_` let _x: &'a WithAssoc> = loop { }; //~^ ERROR reference has a longer lifetime diff --git a/src/test/ui/regions/regions-free-region-ordering-callee-4.rs b/src/test/ui/regions/regions-free-region-ordering-callee-4.rs index de58dd0b10f24..5af3487533533 100644 --- a/src/test/ui/regions/regions-free-region-ordering-callee-4.rs +++ b/src/test/ui/regions/regions-free-region-ordering-callee-4.rs @@ -1,5 +1,5 @@ // Tests that callees correctly infer an ordering between free regions -// that appear in their parameter list. See also +// that appear in their parameter list. See also // regions-free-region-ordering-caller.rs fn ordering4<'a, 'b, F>(a: &'a usize, b: &'b usize, x: F) where F: FnOnce(&'a &'b usize) { diff --git a/src/test/ui/regions/regions-free-region-ordering-callee.rs b/src/test/ui/regions/regions-free-region-ordering-callee.rs index ee9a977a74f2d..f8328898a9960 100644 --- a/src/test/ui/regions/regions-free-region-ordering-callee.rs +++ b/src/test/ui/regions/regions-free-region-ordering-callee.rs @@ -1,5 +1,5 @@ // Tests that callees correctly infer an ordering between free regions -// that appear in their parameter list. See also +// that appear in their parameter list. See also // regions-free-region-ordering-caller.rs fn ordering1<'a, 'b>(x: &'a &'b usize) -> &'a usize { diff --git a/src/test/ui/regions/regions-implied-bounds-projection-gap-hr-1.rs b/src/test/ui/regions/regions-implied-bounds-projection-gap-hr-1.rs index 7e04b6782eba1..cdd80f4faa717 100644 --- a/src/test/ui/regions/regions-implied-bounds-projection-gap-hr-1.rs +++ b/src/test/ui/regions/regions-implied-bounds-projection-gap-hr-1.rs @@ -1,5 +1,5 @@ // The "projection gap" is particularly "fun" around higher-ranked -// projections. This is because the current code is hard-coded to say +// projections. This is because the current code is hard-coded to say // that a projection that contains escaping regions, like `>::Foo` where `'z` is bound, can only be found to // outlive a region if all components that appear free (`'y`, where) diff --git a/src/test/ui/regions/regions-infer-contravariance-due-to-decl.rs b/src/test/ui/regions/regions-infer-contravariance-due-to-decl.rs index 84161388a6e61..657854068e05f 100644 --- a/src/test/ui/regions/regions-infer-contravariance-due-to-decl.rs +++ b/src/test/ui/regions/regions-infer-contravariance-due-to-decl.rs @@ -18,7 +18,7 @@ fn use_<'short,'long>(c: Contravariant<'short>, l: &'long isize, _where:Option<&'short &'long ()>) { - // Test whether Contravariant<'short> <: Contravariant<'long>. Since + // Test whether Contravariant<'short> <: Contravariant<'long>. Since // 'short <= 'long, this would be true if the Contravariant type were // covariant with respect to its parameter 'a. diff --git a/src/test/ui/regions/regions-infer-covariance-due-to-decl.rs b/src/test/ui/regions/regions-infer-covariance-due-to-decl.rs index b5079206578dc..92b2c9bff2b1b 100644 --- a/src/test/ui/regions/regions-infer-covariance-due-to-decl.rs +++ b/src/test/ui/regions/regions-infer-covariance-due-to-decl.rs @@ -15,7 +15,7 @@ fn use_<'short,'long>(c: Covariant<'long>, l: &'long isize, _where:Option<&'short &'long ()>) { - // Test whether Covariant<'long> <: Covariant<'short>. Since + // Test whether Covariant<'long> <: Covariant<'short>. Since // 'short <= 'long, this would be true if the Covariant type were // contravariant with respect to its parameter 'a. diff --git a/src/test/ui/regions/regions-normalize-in-where-clause-list.rs b/src/test/ui/regions/regions-normalize-in-where-clause-list.rs index e94e8b25d6529..55c18f2ae7f97 100644 --- a/src/test/ui/regions/regions-normalize-in-where-clause-list.rs +++ b/src/test/ui/regions/regions-normalize-in-where-clause-list.rs @@ -12,16 +12,12 @@ impl<'a, 'b> Project<'a, 'b> for () } // No error here, we have 'a: 'b. We used to report an error here -// though, see https://github.com/rust-lang/rust/issues/45937. +// though, see issue #45937. fn foo<'a: 'b, 'b>() - where <() as Project<'a, 'b>>::Item : Eq -{ -} + where <() as Project<'a, 'b>>::Item: Eq {} // Here we get an error: we need `'a: 'b`. fn bar<'a, 'b>() //~ ERROR cannot infer - where <() as Project<'a, 'b>>::Item : Eq -{ -} + where <() as Project<'a, 'b>>::Item: Eq {} -fn main() { } +fn main() {} diff --git a/src/test/ui/regions/regions-normalize-in-where-clause-list.stderr b/src/test/ui/regions/regions-normalize-in-where-clause-list.stderr index a4197eed22524..3e8e2cf75ebaa 100644 --- a/src/test/ui/regions/regions-normalize-in-where-clause-list.stderr +++ b/src/test/ui/regions/regions-normalize-in-where-clause-list.stderr @@ -1,19 +1,17 @@ error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements - --> $DIR/regions-normalize-in-where-clause-list.rs:22:1 + --> $DIR/regions-normalize-in-where-clause-list.rs:20:1 | LL | / fn bar<'a, 'b>() //~ ERROR cannot infer -LL | | where <() as Project<'a, 'b>>::Item : Eq -LL | | { -LL | | } - | |_^ +LL | | where <() as Project<'a, 'b>>::Item: Eq {} + | |______________________________________________^ | -note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 22:8... - --> $DIR/regions-normalize-in-where-clause-list.rs:22:8 +note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 20:8... + --> $DIR/regions-normalize-in-where-clause-list.rs:20:8 | LL | fn bar<'a, 'b>() //~ ERROR cannot infer | ^^ -note: ...but the lifetime must also be valid for the lifetime 'b as defined on the function body at 22:12... - --> $DIR/regions-normalize-in-where-clause-list.rs:22:12 +note: ...but the lifetime must also be valid for the lifetime 'b as defined on the function body at 20:12... + --> $DIR/regions-normalize-in-where-clause-list.rs:20:12 | LL | fn bar<'a, 'b>() //~ ERROR cannot infer | ^^ diff --git a/src/test/ui/regions/regions-outlives-nominal-type-enum-type-rev.rs b/src/test/ui/regions/regions-outlives-nominal-type-enum-type-rev.rs index 20b391c263c26..d50354c86969b 100644 --- a/src/test/ui/regions/regions-outlives-nominal-type-enum-type-rev.rs +++ b/src/test/ui/regions/regions-outlives-nominal-type-enum-type-rev.rs @@ -3,7 +3,7 @@ // // Rule OutlivesNominalType from RFC 1214. -//compile-pass +// compile-pass #![feature(rustc_attrs)] #![allow(dead_code)] diff --git a/src/test/ui/regions/regions-outlives-projection-container-wc.rs b/src/test/ui/regions/regions-outlives-projection-container-wc.rs index d38706defe7ad..6d7dbbd018450 100644 --- a/src/test/ui/regions/regions-outlives-projection-container-wc.rs +++ b/src/test/ui/regions/regions-outlives-projection-container-wc.rs @@ -31,7 +31,7 @@ fn with_assoc<'a,'b>() { // outlive 'a. In this case, that means TheType<'b>::TheAssocType, // which is &'b (), must outlive 'a. - // FIXME (#54943) NLL doesn't enforce WF condition in unreachable code if + // FIXME(#54943) NLL doesn't enforce WF condition in unreachable code if // `_x` is changed to `_` let _x: &'a WithAssoc> = loop { }; //~^ ERROR reference has a longer lifetime diff --git a/src/test/ui/regions/regions-outlives-projection-container.rs b/src/test/ui/regions/regions-outlives-projection-container.rs index 78305c0693905..a026c7c293b8f 100644 --- a/src/test/ui/regions/regions-outlives-projection-container.rs +++ b/src/test/ui/regions/regions-outlives-projection-container.rs @@ -35,7 +35,7 @@ fn with_assoc<'a,'b>() { // outlive 'a. In this case, that means TheType<'b>::TheAssocType, // which is &'b (), must outlive 'a. - // FIXME (#54943) NLL doesn't enforce WF condition in unreachable code if + // FIXME(#54943) NLL doesn't enforce WF condition in unreachable code if // `_x` is changed to `_` let _x: &'a WithAssoc> = loop { }; //~^ ERROR reference has a longer lifetime diff --git a/src/test/ui/regions/regions-outlives-projection-trait-def.rs b/src/test/ui/regions/regions-outlives-projection-trait-def.rs index bad476d27794e..86dc187005715 100644 --- a/src/test/ui/regions/regions-outlives-projection-trait-def.rs +++ b/src/test/ui/regions/regions-outlives-projection-trait-def.rs @@ -13,7 +13,7 @@ impl<'a: 'c, 'c, T> SomeTrait<'a> for &'c T where T: SomeTrait<'a> { // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // | // Note that this type must outlive 'a, due to the trait - // definition. If we fall back to OutlivesProjectionComponents + // definition. If we fall back to OutlivesProjectionComponents // here, then we would require that `T:'a`, which is too strong. } diff --git a/src/test/ui/regions/regions-ret-borrowed-1.rs b/src/test/ui/regions/regions-ret-borrowed-1.rs index 1be5edee599c4..0e6a3b138d562 100644 --- a/src/test/ui/regions/regions-ret-borrowed-1.rs +++ b/src/test/ui/regions/regions-ret-borrowed-1.rs @@ -1,5 +1,5 @@ -// Similar to regions-ret-borrowed.rs, but using a named lifetime. At -// some point regions-ret-borrowed reported an error but this file did +// Similar to `regions-ret-borrowed.rs`, but using a named lifetime. At +// some point, `regions-ret-borrowed` reported an error but this file did // not, due to special hardcoding around the anonymous region. fn with(f: F) -> R where F: for<'a> FnOnce(&'a isize) -> R { diff --git a/src/test/ui/regions/regions-ret-borrowed.rs b/src/test/ui/regions/regions-ret-borrowed.rs index 5fca92d68b65c..beed0b36c91c9 100644 --- a/src/test/ui/regions/regions-ret-borrowed.rs +++ b/src/test/ui/regions/regions-ret-borrowed.rs @@ -1,6 +1,6 @@ // Ensure that you cannot use generic types to return a region outside -// of its bound. Here, in the `return_it()` fn, we call with() but -// with R bound to &isize from the return_it. Meanwhile, with() +// of its bound. Here, in the `return_it()` fn, we call with() but +// with R bound to &isize from the return_it. Meanwhile, with() // provides a value that is only good within its own stack frame. This // used to successfully compile because we failed to account for the // fact that fn(x: &isize) rebound the region &. diff --git a/src/test/ui/regions/regions-variance-contravariant-use-covariant-in-second-position.rs b/src/test/ui/regions/regions-variance-contravariant-use-covariant-in-second-position.rs index 8ddd041d45731..231e5454143eb 100644 --- a/src/test/ui/regions/regions-variance-contravariant-use-covariant-in-second-position.rs +++ b/src/test/ui/regions/regions-variance-contravariant-use-covariant-in-second-position.rs @@ -18,7 +18,7 @@ fn use_<'short,'long>(c: S<'long, 'short>, let _: S<'long, 'short> = c; // OK let _: S<'short, 'short> = c; // OK - // Test whether S<_,'short> <: S<_,'long>. Since + // Test whether S<_,'short> <: S<_,'long>. Since // 'short <= 'long, this would be true if the Contravariant type were // covariant with respect to its parameter 'a. diff --git a/src/test/ui/regions/regions-variance-contravariant-use-covariant.rs b/src/test/ui/regions/regions-variance-contravariant-use-covariant.rs index cbdf62ecb613f..d6c23bd902d27 100644 --- a/src/test/ui/regions/regions-variance-contravariant-use-covariant.rs +++ b/src/test/ui/regions/regions-variance-contravariant-use-covariant.rs @@ -16,7 +16,7 @@ fn use_<'short,'long>(c: Contravariant<'short>, l: &'long isize, _where:Option<&'short &'long ()>) { - // Test whether Contravariant<'short> <: Contravariant<'long>. Since + // Test whether Contravariant<'short> <: Contravariant<'long>. Since // 'short <= 'long, this would be true if the Contravariant type were // covariant with respect to its parameter 'a. diff --git a/src/test/ui/regions/regions-variance-covariant-use-contravariant.rs b/src/test/ui/regions/regions-variance-covariant-use-contravariant.rs index 9aa0c81927197..145cabf203a99 100644 --- a/src/test/ui/regions/regions-variance-covariant-use-contravariant.rs +++ b/src/test/ui/regions/regions-variance-covariant-use-contravariant.rs @@ -16,7 +16,7 @@ fn use_<'short,'long>(c: Covariant<'long>, l: &'long isize, _where:Option<&'short &'long ()>) { - // Test whether Covariant<'long> <: Covariant<'short>. Since + // Test whether Covariant<'long> <: Covariant<'short>. Since // 'short <= 'long, this would be true if the Covariant type were // contravariant with respect to its parameter 'a. diff --git a/src/test/ui/regions/regions-variance-invariant-use-contravariant.rs b/src/test/ui/regions/regions-variance-invariant-use-contravariant.rs index 663b23b37d46a..70a8afd73c32b 100644 --- a/src/test/ui/regions/regions-variance-invariant-use-contravariant.rs +++ b/src/test/ui/regions/regions-variance-invariant-use-contravariant.rs @@ -13,7 +13,7 @@ fn use_<'short,'long>(c: Invariant<'long>, l: &'long isize, _where:Option<&'short &'long ()>) { - // Test whether Invariant<'long> <: Invariant<'short>. Since + // Test whether Invariant<'long> <: Invariant<'short>. Since // 'short <= 'long, this would be true if the Invariant type were // contravariant with respect to its parameter 'a. diff --git a/src/test/ui/reject-specialized-drops-8142.rs b/src/test/ui/reject-specialized-drops-8142.rs index f047e16bc0b94..5c95a531eae44 100644 --- a/src/test/ui/reject-specialized-drops-8142.rs +++ b/src/test/ui/reject-specialized-drops-8142.rs @@ -1,4 +1,4 @@ -// Issue 8142: Test that Drop impls cannot be specialized beyond the +// Issue #8142: test that `Drop` impls cannot be specialized beyond the // predicates attached to the struct/enum definition itself. trait Bound { fn foo(&self) { } } @@ -54,4 +54,4 @@ impl Drop for V { fn drop(&mut self) { } } // REJECT impl<'lw> Drop for W<'lw,'lw> { fn drop(&mut self) { } } // REJECT //~^ ERROR cannot infer an appropriate lifetime -pub fn main() { } +pub fn main() {} diff --git a/src/test/ui/resolve/issue-21221-1.rs b/src/test/ui/resolve/issue-21221-1.rs index b180624d2f491..746e6e84d28be 100644 --- a/src/test/ui/resolve/issue-21221-1.rs +++ b/src/test/ui/resolve/issue-21221-1.rs @@ -28,7 +28,7 @@ mod mul5 { struct Foo; // When we comment the next line: -//use mul1::Mul; +// use mul1::Mul; // BEFORE, we got the following error for the `impl` below: // error: use of undeclared trait name `Mul` [E0405] diff --git a/src/test/ui/rfc-2093-infer-outlives/privacy.rs b/src/test/ui/rfc-2093-infer-outlives/privacy.rs index 180f5ac6cdc46..ea3980c33e114 100644 --- a/src/test/ui/rfc-2093-infer-outlives/privacy.rs +++ b/src/test/ui/rfc-2093-infer-outlives/privacy.rs @@ -1,4 +1,4 @@ -// Test that we do not get a privacy error here. Initially, we did, +// Test that we do not get a privacy error here. Initially, we did, // because we inferred an outlives predciate of ` as // Private>::Out: 'a`, but the private trait is -- well -- private, // and hence it was not something that a pub trait could refer to. diff --git a/src/test/ui/rfc1598-generic-associated-types/collections.rs b/src/test/ui/rfc1598-generic-associated-types/collections.rs index 5414bb4a6d20e..22a1ac4bd416a 100644 --- a/src/test/ui/rfc1598-generic-associated-types/collections.rs +++ b/src/test/ui/rfc1598-generic-associated-types/collections.rs @@ -10,7 +10,7 @@ // associated-type-constructors-part-2-family-traits/ trait Collection { - type Iter<'iter>: Iterator; + type Iter<'iter>: Iterator; type Family: CollectionFamily; // Test associated type defaults with parameters type Sibling: Collection = diff --git a/src/test/ui/rfc1598-generic-associated-types/generic-associated-types-where.rs b/src/test/ui/rfc1598-generic-associated-types/generic-associated-types-where.rs index b0d1fa1a74fb5..4e88f5fbc1a97 100644 --- a/src/test/ui/rfc1598-generic-associated-types/generic-associated-types-where.rs +++ b/src/test/ui/rfc1598-generic-associated-types/generic-associated-types-where.rs @@ -9,7 +9,7 @@ trait Foo { type Assoc where Self: Sized; type Assoc2 where T: Display; type Assoc3; - type WithDefault where T: Debug = Iterator; + type WithDefault where T: Debug = Iterator; type NoGenerics; } diff --git a/src/test/ui/rfc1598-generic-associated-types/shadowing.rs b/src/test/ui/rfc1598-generic-associated-types/shadowing.rs index 82a7c2510e5d7..920bebd90bdfb 100644 --- a/src/test/ui/rfc1598-generic-associated-types/shadowing.rs +++ b/src/test/ui/rfc1598-generic-associated-types/shadowing.rs @@ -1,6 +1,6 @@ #![feature(generic_associated_types)] -//FIXME(#44265): The lifetime shadowing and type parameter shadowing +// FIXME(#44265): The lifetime shadowing and type parameter shadowing // should cause an error. Now it compiles (erroneously) and this will be addressed // by a future PR. Then remove the following: // compile-pass diff --git a/src/test/ui/rfc1598-generic-associated-types/streaming_iterator.rs b/src/test/ui/rfc1598-generic-associated-types/streaming_iterator.rs index 1ef154447903b..06d3bedf9c98b 100644 --- a/src/test/ui/rfc1598-generic-associated-types/streaming_iterator.rs +++ b/src/test/ui/rfc1598-generic-associated-types/streaming_iterator.rs @@ -21,8 +21,8 @@ struct Foo { // Users can bound parameters by the type constructed by that trait's associated type constructor // of a trait using HRTB. Both type equality bounds and trait bounds of this kind are valid: -//FIXME(sunjay): This next line should parse and be valid -//fn foo StreamingIterator=&'a [i32]>>(iter: T) { /* ... */ } +// FIXME(sunjay): This next line should parse and be valid +// fn foo StreamingIterator=&'a [i32]>>(iter: T) { /* ... */ } fn foo(iter: T) where T: StreamingIterator, for<'a> T::Item<'a>: Display { /* ... */ } //~^ ERROR lifetime arguments are not allowed on this entity [E0110] diff --git a/src/test/ui/rmeta_meta_main.stderr b/src/test/ui/rmeta_meta_main.stderr index bed9076d84cbe..b7d7f89cfbb4c 100644 --- a/src/test/ui/rmeta_meta_main.stderr +++ b/src/test/ui/rmeta_meta_main.stderr @@ -2,7 +2,7 @@ error[E0560]: struct `rmeta_meta::Foo` has no field named `field2` --> $DIR/rmeta_meta_main.rs:13:19 | LL | let _ = Foo { field2: 42 }; //~ ERROR struct `rmeta_meta::Foo` has no field named `field2` - | ^^^^^^ help: a field with a similar name exists: `field` + | ^^^^^^ field does not exist - did you mean `field`? error: aborting due to previous error diff --git a/src/test/ui/rust-2018/edition-lint-infer-outlives.fixed b/src/test/ui/rust-2018/edition-lint-infer-outlives.fixed index eb48933dca537..640d0e6691a2a 100644 --- a/src/test/ui/rust-2018/edition-lint-infer-outlives.fixed +++ b/src/test/ui/rust-2018/edition-lint-infer-outlives.fixed @@ -193,7 +193,7 @@ struct TeeWhereOutlivesAyBeeYooWhereIsDebug<'a, 'b, T, U> where U: Debug { // But outlives inference for 'static lifetimes is under a separate // feature-gate for now -// (https://github.com/rust-lang/rust/issues/44493#issuecomment-407846046). +// (see ). struct StaticRef { field: &'static T } diff --git a/src/test/ui/rust-2018/edition-lint-infer-outlives.rs b/src/test/ui/rust-2018/edition-lint-infer-outlives.rs index fd31341365c65..55b832161f702 100644 --- a/src/test/ui/rust-2018/edition-lint-infer-outlives.rs +++ b/src/test/ui/rust-2018/edition-lint-infer-outlives.rs @@ -193,7 +193,7 @@ struct TeeWhereOutlivesAyBeeYooWhereIsDebug<'a, 'b, T, U> where T: 'a + 'b, U: D // But outlives inference for 'static lifetimes is under a separate // feature-gate for now -// (https://github.com/rust-lang/rust/issues/44493#issuecomment-407846046). +// (see ). struct StaticRef { field: &'static T } diff --git a/src/test/ui/rust-2018/future-proofing-locals.rs b/src/test/ui/rust-2018/future-proofing-locals.rs index d777b1165f30b..95024ce0506d5 100644 --- a/src/test/ui/rust-2018/future-proofing-locals.rs +++ b/src/test/ui/rust-2018/future-proofing-locals.rs @@ -17,7 +17,7 @@ fn type_param() { } fn self_import() { - use T; // FIXME Should be an error, but future-proofing fails due to `T` being "self-shadowed" + use T; // FIXME: Should be an error, but future-proofing fails due to `T` being "self-shadowed" } fn let_binding() { diff --git a/src/test/ui/span/regions-escape-loop-via-variable.rs b/src/test/ui/span/regions-escape-loop-via-variable.rs index ad468896b1302..3816dfb513e61 100644 --- a/src/test/ui/span/regions-escape-loop-via-variable.rs +++ b/src/test/ui/span/regions-escape-loop-via-variable.rs @@ -2,7 +2,7 @@ fn main() { let x = 3; // Here, the variable `p` gets inferred to a type with a lifetime - // of the loop body. The regionck then determines that this type + // of the loop body. The regionck then determines that this type // is invalid. let mut p = &x; diff --git a/src/test/ui/structs/struct-fields-hints-no-dupe.stderr b/src/test/ui/structs/struct-fields-hints-no-dupe.stderr index 1a88f269347c2..105f330463a94 100644 --- a/src/test/ui/structs/struct-fields-hints-no-dupe.stderr +++ b/src/test/ui/structs/struct-fields-hints-no-dupe.stderr @@ -2,7 +2,7 @@ error[E0560]: struct `A` has no field named `bar` --> $DIR/struct-fields-hints-no-dupe.rs:10:9 | LL | bar : 42, - | ^^^ help: a field with a similar name exists: `barr` + | ^^^ field does not exist - did you mean `barr`? error: aborting due to previous error diff --git a/src/test/ui/structs/struct-fields-hints.stderr b/src/test/ui/structs/struct-fields-hints.stderr index 3b8a2b5c7bad0..d713030563102 100644 --- a/src/test/ui/structs/struct-fields-hints.stderr +++ b/src/test/ui/structs/struct-fields-hints.stderr @@ -2,7 +2,7 @@ error[E0560]: struct `A` has no field named `bar` --> $DIR/struct-fields-hints.rs:10:9 | LL | bar : 42, - | ^^^ help: a field with a similar name exists: `car` + | ^^^ field does not exist - did you mean `car`? error: aborting due to previous error diff --git a/src/test/ui/structs/struct-fields-typo.rs b/src/test/ui/structs/struct-fields-typo.rs index 0e9b2ae5145d7..b435a0a47773d 100644 --- a/src/test/ui/structs/struct-fields-typo.rs +++ b/src/test/ui/structs/struct-fields-typo.rs @@ -8,8 +8,7 @@ fn main() { foo: 0, bar: 0.5, }; - let x = foo.baa; //~ ERROR no field `baa` on type `BuildData` - //~| HELP a field with a similar name exists - //~| SUGGESTION bar + let x = foo.baa;//~ no field `baa` on type `BuildData` + //~^ did you mean `bar`? println!("{}", x); } diff --git a/src/test/ui/structs/struct-fields-typo.stderr b/src/test/ui/structs/struct-fields-typo.stderr index c2fab714f7c15..93127ab5beb6e 100644 --- a/src/test/ui/structs/struct-fields-typo.stderr +++ b/src/test/ui/structs/struct-fields-typo.stderr @@ -1,8 +1,8 @@ error[E0609]: no field `baa` on type `BuildData` --> $DIR/struct-fields-typo.rs:11:17 | -LL | let x = foo.baa; //~ ERROR no field `baa` on type `BuildData` - | ^^^ help: a field with a similar name exists: `bar` +LL | let x = foo.baa;//~ no field `baa` on type `BuildData` + | ^^^ did you mean `bar`? error: aborting due to previous error diff --git a/src/test/ui/suggestions/dont-suggest-ref/simple.rs b/src/test/ui/suggestions/dont-suggest-ref/simple.rs index 58aab85ac2673..79c337906afc4 100644 --- a/src/test/ui/suggestions/dont-suggest-ref/simple.rs +++ b/src/test/ui/suggestions/dont-suggest-ref/simple.rs @@ -255,7 +255,7 @@ pub fn main() { // -------- move from tuple of &Either/&X -------- - // FIXME: These should have suggestions. + // FIXME: these should have suggestions. let (&X(_t),) = (&x.clone(),); //~^ ERROR cannot move diff --git a/src/test/ui/suggestions/suggest-private-fields.stderr b/src/test/ui/suggestions/suggest-private-fields.stderr index 524558e0ec564..5f0176473ea74 100644 --- a/src/test/ui/suggestions/suggest-private-fields.stderr +++ b/src/test/ui/suggestions/suggest-private-fields.stderr @@ -2,7 +2,7 @@ error[E0560]: struct `xc::B` has no field named `aa` --> $DIR/suggest-private-fields.rs:15:9 | LL | aa: 20, - | ^^ help: a field with a similar name exists: `a` + | ^^ field does not exist - did you mean `a`? error[E0560]: struct `xc::B` has no field named `bb` --> $DIR/suggest-private-fields.rs:17:9 @@ -16,13 +16,13 @@ error[E0560]: struct `A` has no field named `aa` --> $DIR/suggest-private-fields.rs:22:9 | LL | aa: 20, - | ^^ help: a field with a similar name exists: `a` + | ^^ field does not exist - did you mean `a`? error[E0560]: struct `A` has no field named `bb` --> $DIR/suggest-private-fields.rs:24:9 | LL | bb: 20, - | ^^ help: a field with a similar name exists: `b` + | ^^ field does not exist - did you mean `b`? error: aborting due to 4 previous errors diff --git a/src/test/ui/svh/svh-change-lit.rs b/src/test/ui/svh/svh-change-lit.rs index 7d991cc99716e..d285b5a4975f2 100644 --- a/src/test/ui/svh/svh-change-lit.rs +++ b/src/test/ui/svh/svh-change-lit.rs @@ -1,6 +1,6 @@ -// ignore-msvc FIXME #31306 +// ignore-msvc FIXME(#31306) -// note that these aux-build directives must be in this order +// Note that these aux-build directives must be in this order: // aux-build:svh-a-base.rs // aux-build:svh-b.rs // aux-build:svh-a-change-lit.rs diff --git a/src/test/ui/svh/svh-change-significant-cfg.rs b/src/test/ui/svh/svh-change-significant-cfg.rs index 8cf0d9ccaf1e8..d8c8f230dcc52 100644 --- a/src/test/ui/svh/svh-change-significant-cfg.rs +++ b/src/test/ui/svh/svh-change-significant-cfg.rs @@ -1,6 +1,6 @@ -// ignore-msvc FIXME #31306 +// ignore-msvc FIXME(#31306) -// note that these aux-build directives must be in this order +// Note that these aux-build directives must be in this order: // aux-build:svh-a-base.rs // aux-build:svh-b.rs // aux-build:svh-a-change-significant-cfg.rs diff --git a/src/test/ui/svh/svh-change-trait-bound.rs b/src/test/ui/svh/svh-change-trait-bound.rs index ddd10ac068df3..b72a3c7104178 100644 --- a/src/test/ui/svh/svh-change-trait-bound.rs +++ b/src/test/ui/svh/svh-change-trait-bound.rs @@ -1,6 +1,6 @@ -// ignore-msvc FIXME #31306 +// ignore-msvc FIXME(#31306) -// note that these aux-build directives must be in this order +// Note that these aux-build directives must be in this order: // aux-build:svh-a-base.rs // aux-build:svh-b.rs // aux-build:svh-a-change-trait-bound.rs diff --git a/src/test/ui/svh/svh-change-type-arg.rs b/src/test/ui/svh/svh-change-type-arg.rs index f845ab5bc6a91..7040f8ed63554 100644 --- a/src/test/ui/svh/svh-change-type-arg.rs +++ b/src/test/ui/svh/svh-change-type-arg.rs @@ -1,6 +1,6 @@ -// ignore-msvc FIXME #31306 +// ignore-msvc FIXME(#31306) -// note that these aux-build directives must be in this order +// Note that these aux-build directives must be in this order: // aux-build:svh-a-base.rs // aux-build:svh-b.rs // aux-build:svh-a-change-type-arg.rs diff --git a/src/test/ui/svh/svh-change-type-ret.rs b/src/test/ui/svh/svh-change-type-ret.rs index fb3e996c5fd8c..c5b8b7a5b3163 100644 --- a/src/test/ui/svh/svh-change-type-ret.rs +++ b/src/test/ui/svh/svh-change-type-ret.rs @@ -1,6 +1,6 @@ -// ignore-msvc FIXME #31306 +// ignore-msvc FIXME(#31306) -// note that these aux-build directives must be in this order +// Note that these aux-build directives must be in this order: // aux-build:svh-a-base.rs // aux-build:svh-b.rs // aux-build:svh-a-change-type-ret.rs diff --git a/src/test/ui/svh/svh-change-type-static.rs b/src/test/ui/svh/svh-change-type-static.rs index 0dfcaa0003b66..bb50cc596038a 100644 --- a/src/test/ui/svh/svh-change-type-static.rs +++ b/src/test/ui/svh/svh-change-type-static.rs @@ -1,6 +1,6 @@ -// ignore-msvc FIXME #31306 +// ignore-msvc FIXME(#31306) -// note that these aux-build directives must be in this order +// Note that these aux-build directives must be in this order: // aux-build:svh-a-base.rs // aux-build:svh-b.rs // aux-build:svh-a-change-type-static.rs diff --git a/src/test/ui/svh/svh-use-trait.rs b/src/test/ui/svh/svh-use-trait.rs index 93daca034c067..cb4819d8006c0 100644 --- a/src/test/ui/svh/svh-use-trait.rs +++ b/src/test/ui/svh/svh-use-trait.rs @@ -1,12 +1,12 @@ -// ignore-msvc FIXME #31306 +// ignore-msvc FIXME(#31306) -// note that these aux-build directives must be in this order +// Note that these aux-build directives must be in this order: // aux-build:svh-uta-base.rs // aux-build:svh-utb.rs // aux-build:svh-uta-change-use-trait.rs // normalize-stderr-test: "(crate `(\w+)`:) .*" -> "$1 $$PATH_$2" -//! "compile-fail/svh-uta-trait.rs" is checking that we detect a +//! `compile-fail/svh-uta-trait.rs` is checking that we detect a //! change from `use foo::TraitB` to use `foo::TraitB` in the hash //! (SVH) computation (#14132), since that will affect method //! resolution. diff --git a/src/test/ui/traits/conservative_impl_trait.rs b/src/test/ui/traits/conservative_impl_trait.rs index 964e21779d51b..772da5bc683d1 100644 --- a/src/test/ui/traits/conservative_impl_trait.rs +++ b/src/test/ui/traits/conservative_impl_trait.rs @@ -1,7 +1,7 @@ // compile-pass // #39665 -fn batches(n: &u32) -> impl Iterator { +fn batches(n: &u32) -> impl Iterator { std::iter::once(n) } diff --git a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent.rs b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent.rs index fdbaec9a5c7ff..cf4e578827963 100644 --- a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent.rs +++ b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent.rs @@ -60,7 +60,7 @@ fn return_str() -> str where str: Sized { *"Sized".to_string().into_boxed_str() } -fn use_op(s: String) -> String where String: ::std::ops::Neg { +fn use_op(s: String) -> String where String: ::std::ops::Neg { -s } diff --git a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent.stderr b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent.stderr index 744e146f83003..0d396d2a368fe 100644 --- a/src/test/ui/trivial-bounds/trivial-bounds-inconsistent.stderr +++ b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent.stderr @@ -78,8 +78,8 @@ LL | fn return_str() -> str where str: Sized { warning: Trait bound std::string::String: std::ops::Neg does not depend on any type or lifetime parameters --> $DIR/trivial-bounds-inconsistent.rs:63:46 | -LL | fn use_op(s: String) -> String where String: ::std::ops::Neg { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn use_op(s: String) -> String where String: ::std::ops::Neg { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: Trait bound i32: std::iter::Iterator does not depend on any type or lifetime parameters --> $DIR/trivial-bounds-inconsistent.rs:67:25 diff --git a/src/test/ui/tuple/tuple-index-not-tuple.stderr b/src/test/ui/tuple/tuple-index-not-tuple.stderr index a1bcdfaedbc60..ab9ac4c4142fe 100644 --- a/src/test/ui/tuple/tuple-index-not-tuple.stderr +++ b/src/test/ui/tuple/tuple-index-not-tuple.stderr @@ -2,7 +2,7 @@ error[E0609]: no field `0` on type `Point` --> $DIR/tuple-index-not-tuple.rs:6:12 | LL | origin.0; - | ^ help: a field with a similar name exists: `x` + | ^ did you mean `x`? error[E0609]: no field `0` on type `Empty` --> $DIR/tuple-index-not-tuple.rs:8:11 diff --git a/src/test/ui/tuple/tuple-index-out-of-bounds.stderr b/src/test/ui/tuple/tuple-index-out-of-bounds.stderr index 7d7c5cd7892ea..86e977a01b76d 100644 --- a/src/test/ui/tuple/tuple-index-out-of-bounds.stderr +++ b/src/test/ui/tuple/tuple-index-out-of-bounds.stderr @@ -2,7 +2,7 @@ error[E0609]: no field `2` on type `Point` --> $DIR/tuple-index-out-of-bounds.rs:7:12 | LL | origin.2; - | ^ help: a field with a similar name exists: `0` + | ^ did you mean `0`? error[E0609]: no field `2` on type `({integer}, {integer})` --> $DIR/tuple-index-out-of-bounds.rs:12:11 diff --git a/src/test/ui/type/type-check-defaults.rs b/src/test/ui/type/type-check-defaults.rs index 5748c9bcff8cb..77510b06a574e 100644 --- a/src/test/ui/type/type-check-defaults.rs +++ b/src/test/ui/type/type-check-defaults.rs @@ -8,13 +8,13 @@ struct WellFormed>(Z); struct WellFormedNoBounds>(Z); //~^ ERROR a collection of type `i32` cannot be built from an iterator over elements of type `i32` -struct Bounds(T); +struct Bounds(T); //~^ ERROR the trait bound `std::string::String: std::marker::Copy` is not satisfied [E0277] -struct WhereClause(T) where T: Copy; +struct WhereClause(T) where T: Copy; //~^ ERROR the trait bound `std::string::String: std::marker::Copy` is not satisfied [E0277] -trait TraitBound {} +trait TraitBound {} //~^ ERROR the trait bound `std::string::String: std::marker::Copy` is not satisfied [E0277] trait Super { } diff --git a/src/test/ui/type/type-check-defaults.stderr b/src/test/ui/type/type-check-defaults.stderr index a46d79ec3183e..59b4b016597bb 100644 --- a/src/test/ui/type/type-check-defaults.stderr +++ b/src/test/ui/type/type-check-defaults.stderr @@ -27,38 +27,38 @@ LL | struct Foo>(T, U); error[E0277]: the trait bound `std::string::String: std::marker::Copy` is not satisfied --> $DIR/type-check-defaults.rs:11:1 | -LL | struct Bounds(T); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::string::String` +LL | struct Bounds(T); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::string::String` | note: required by `Bounds` --> $DIR/type-check-defaults.rs:11:1 | -LL | struct Bounds(T); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | struct Bounds(T); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `std::string::String: std::marker::Copy` is not satisfied --> $DIR/type-check-defaults.rs:14:1 | -LL | struct WhereClause(T) where T: Copy; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::string::String` +LL | struct WhereClause(T) where T: Copy; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::string::String` | note: required by `WhereClause` --> $DIR/type-check-defaults.rs:14:1 | -LL | struct WhereClause(T) where T: Copy; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | struct WhereClause(T) where T: Copy; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `std::string::String: std::marker::Copy` is not satisfied --> $DIR/type-check-defaults.rs:17:1 | -LL | trait TraitBound {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::string::String` +LL | trait TraitBound {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::string::String` | note: required by `TraitBound` --> $DIR/type-check-defaults.rs:17:1 | -LL | trait TraitBound {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | trait TraitBound {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied --> $DIR/type-check-defaults.rs:21:1 diff --git a/src/test/ui/type/type-parameter-defaults-referencing-Self-ppaux.rs b/src/test/ui/type/type-parameter-defaults-referencing-Self-ppaux.rs index 3e1c876c76ba8..ceee51bc7a8a5 100644 --- a/src/test/ui/type/type-parameter-defaults-referencing-Self-ppaux.rs +++ b/src/test/ui/type/type-parameter-defaults-referencing-Self-ppaux.rs @@ -3,7 +3,7 @@ // the user, but pretty-printing the type during the error message // caused an ICE. -trait MyAdd { fn add(&self, other: &Rhs) -> Self; } +trait MyAdd { fn add(&self, other: &Rhs) -> Self; } impl MyAdd for i32 { fn add(&self, other: &i32) -> i32 { *self + *other } diff --git a/src/test/ui/type/type-parameter-defaults-referencing-Self.rs b/src/test/ui/type/type-parameter-defaults-referencing-Self.rs index 721bf960a55c2..5f9f3d0b928a2 100644 --- a/src/test/ui/type/type-parameter-defaults-referencing-Self.rs +++ b/src/test/ui/type/type-parameter-defaults-referencing-Self.rs @@ -3,7 +3,7 @@ #![feature(default_type_params)] -trait Foo { +trait Foo { fn method(&self); } diff --git a/src/test/ui/type/type-params-in-different-spaces-1.rs b/src/test/ui/type/type-params-in-different-spaces-1.rs index 449a26e901d42..7ab2a83a78e98 100644 --- a/src/test/ui/type/type-params-in-different-spaces-1.rs +++ b/src/test/ui/type/type-params-in-different-spaces-1.rs @@ -1,6 +1,6 @@ use std::ops::Add; -trait BrokenAdd: Copy + Add { +trait BrokenAdd: Copy + Add { fn broken_add(&self, rhs: T) -> Self { *self + rhs //~ ERROR mismatched types //~| expected type `Self` @@ -9,7 +9,7 @@ trait BrokenAdd: Copy + Add { } } -impl> BrokenAdd for T {} +impl> BrokenAdd for T {} pub fn main() { let foo: u8 = 0; diff --git a/src/test/ui/unboxed-closures/unboxed-closure-no-cyclic-sig.stderr b/src/test/ui/unboxed-closures/unboxed-closure-no-cyclic-sig.stderr index fc45520851889..8ce5820249125 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-no-cyclic-sig.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-no-cyclic-sig.stderr @@ -6,7 +6,8 @@ LL | g(|_| { }); //~ ERROR closure/generator type that references itself | = note: closures cannot capture themselves or take themselves as argument; this error may be the result of a recent compiler bug-fix, - see https://github.com/rust-lang/rust/issues/46062 for more details + see for more + details error: aborting due to previous error diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-default.rs b/src/test/ui/unboxed-closures/unboxed-closure-sugar-default.rs index 044859de6a4a5..d1dded3a41e2c 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-default.rs +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-default.rs @@ -4,7 +4,7 @@ #![feature(unboxed_closures)] #![allow(dead_code)] -trait Foo { +trait Foo { type Output; fn dummy(&self, t: T, v: V); } diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-equiv.rs b/src/test/ui/unboxed-closures/unboxed-closure-sugar-equiv.rs index 95bd391f251b8..13aa88ec34839 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-equiv.rs +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-equiv.rs @@ -36,7 +36,7 @@ fn test<'a,'b>() { Foo(&isize,&usize) -> usize >(); // lifetime elision - eq::< for<'x> Foo<(&'x isize,), Output=&'x isize>, + eq::< for<'x> Foo<(&'x isize,), Output = &'x isize>, Foo(&isize) -> &isize >(); // Errors expected: diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-lifetime-elision.rs b/src/test/ui/unboxed-closures/unboxed-closure-sugar-lifetime-elision.rs index b61d8b8c8c790..84fd5ced92d64 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-sugar-lifetime-elision.rs +++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-lifetime-elision.rs @@ -18,7 +18,7 @@ impl Eq for X { } fn eq>() { } fn main() { - eq::< for<'a> Foo<(&'a isize,), Output=&'a isize>, + eq::< for<'a> Foo<(&'a isize,), Output = &'a isize>, Foo(&isize) -> &isize >(); eq::< for<'a> Foo<(&'a isize,), Output=(&'a isize, &'a isize)>, Foo(&isize) -> (&isize, &isize) >(); diff --git a/src/test/ui/underscore-lifetime/dyn-trait-underscore.rs b/src/test/ui/underscore-lifetime/dyn-trait-underscore.rs index d5aa18eb0f4e7..a45a13ddfba4f 100644 --- a/src/test/ui/underscore-lifetime/dyn-trait-underscore.rs +++ b/src/test/ui/underscore-lifetime/dyn-trait-underscore.rs @@ -3,16 +3,16 @@ // // cc #48468 -fn a(items: &[T]) -> Box> { +fn a(items: &[T]) -> Box> { // ^^^^^^^^^^^^^^^^^^^^^ bound *here* defaults to `'static` Box::new(items.iter()) //~ ERROR cannot infer an appropriate lifetime } -fn b(items: &[T]) -> Box + '_> { +fn b(items: &[T]) -> Box + '_> { Box::new(items.iter()) // OK, equivalent to c } -fn c<'a, T>(items: &'a [T]) -> Box + 'a> { +fn c<'a, T>(items: &'a [T]) -> Box + 'a> { Box::new(items.iter()) // OK, equivalent to b } diff --git a/src/test/ui/underscore-lifetime/dyn-trait-underscore.stderr b/src/test/ui/underscore-lifetime/dyn-trait-underscore.stderr index 4eb959311ca48..f8e890cc578b8 100644 --- a/src/test/ui/underscore-lifetime/dyn-trait-underscore.stderr +++ b/src/test/ui/underscore-lifetime/dyn-trait-underscore.stderr @@ -7,7 +7,7 @@ LL | Box::new(items.iter()) //~ ERROR cannot infer an appropriate lifetime note: first, the lifetime cannot outlive the anonymous lifetime #1 defined on the function body at 6:1... --> $DIR/dyn-trait-underscore.rs:6:1 | -LL | / fn a(items: &[T]) -> Box> { +LL | / fn a(items: &[T]) -> Box> { LL | | // ^^^^^^^^^^^^^^^^^^^^^ bound *here* defaults to `'static` LL | | Box::new(items.iter()) //~ ERROR cannot infer an appropriate lifetime LL | | } diff --git a/src/test/ui/unevaluated_fixed_size_array_len.rs b/src/test/ui/unevaluated_fixed_size_array_len.rs index 6c545913dd9dc..b8097e2a1c8e8 100644 --- a/src/test/ui/unevaluated_fixed_size_array_len.rs +++ b/src/test/ui/unevaluated_fixed_size_array_len.rs @@ -1,4 +1,4 @@ -// https://github.com/rust-lang/rust/issues/49208 +// Test for issue #49208. trait Foo { fn foo(); diff --git a/src/test/ui/union/union-suggest-field.rs b/src/test/ui/union/union-suggest-field.rs index b2d8c0efea8fe..ad527a9791802 100644 --- a/src/test/ui/union/union-suggest-field.rs +++ b/src/test/ui/union/union-suggest-field.rs @@ -9,12 +9,8 @@ impl U { fn main() { let u = U { principle: 0 }; //~^ ERROR union `U` has no field named `principle` - //~| HELP a field with a similar name exists - //~| SUGGESTION principal let w = u.principial; //~ ERROR no field `principial` on type `U` - //~| HELP a field with a similar name exists - //~| SUGGESTION principal + //~^ did you mean `principal`? let y = u.calculate; //~ ERROR attempted to take value of method `calculate` on type `U` - //~| HELP maybe a `()` to call it is missing } diff --git a/src/test/ui/union/union-suggest-field.stderr b/src/test/ui/union/union-suggest-field.stderr index 91d6b30ea0267..15464eea4c2f3 100644 --- a/src/test/ui/union/union-suggest-field.stderr +++ b/src/test/ui/union/union-suggest-field.stderr @@ -2,16 +2,16 @@ error[E0560]: union `U` has no field named `principle` --> $DIR/union-suggest-field.rs:10:17 | LL | let u = U { principle: 0 }; - | ^^^^^^^^^ help: a field with a similar name exists: `principal` + | ^^^^^^^^^ field does not exist - did you mean `principal`? error[E0609]: no field `principial` on type `U` - --> $DIR/union-suggest-field.rs:14:15 + --> $DIR/union-suggest-field.rs:12:15 | LL | let w = u.principial; //~ ERROR no field `principial` on type `U` - | ^^^^^^^^^^ help: a field with a similar name exists: `principal` + | ^^^^^^^^^^ did you mean `principal`? error[E0615]: attempted to take value of method `calculate` on type `U` - --> $DIR/union-suggest-field.rs:18:15 + --> $DIR/union-suggest-field.rs:15:15 | LL | let y = u.calculate; //~ ERROR attempted to take value of method `calculate` on type `U` | ^^^^^^^^^ diff --git a/src/test/ui/unop-move-semantics.rs b/src/test/ui/unop-move-semantics.rs index 24bd89d4c39ce..6597d1ca02081 100644 --- a/src/test/ui/unop-move-semantics.rs +++ b/src/test/ui/unop-move-semantics.rs @@ -2,13 +2,13 @@ use std::ops::Not; -fn move_then_borrow + Clone>(x: T) { +fn move_then_borrow + Clone>(x: T) { !x; x.clone(); //~ ERROR: use of moved value } -fn move_borrowed>(x: T, mut y: T) { +fn move_borrowed>(x: T, mut y: T) { let m = &x; let n = &mut y; @@ -17,7 +17,7 @@ fn move_borrowed>(x: T, mut y: T) { !y; //~ ERROR: cannot move out of `y` because it is borrowed use_mut(n); use_imm(m); } -fn illegal_dereference>(mut x: T, y: T) { +fn illegal_dereference>(mut x: T, y: T) { let m = &mut x; let n = &y; diff --git a/src/test/ui/unsafe/unsafe-fn-autoderef.rs b/src/test/ui/unsafe/unsafe-fn-autoderef.rs index 60460fc6e49de..2cc46e80cb213 100644 --- a/src/test/ui/unsafe/unsafe-fn-autoderef.rs +++ b/src/test/ui/unsafe/unsafe-fn-autoderef.rs @@ -4,9 +4,9 @@ struct Rec { fn f(p: *const Rec) -> isize { - // Test that * ptrs do not autoderef. There is a deeper reason for + // Test that * ptrs do not autoderef. There is a deeper reason for // prohibiting this, beyond making unsafe things annoying (which doesn't - // actually seem desirable to me). The deeper reason is that if you + // actually seem desirable to me). The deeper reason is that if you // have a type like: // // enum foo = *foo; diff --git a/src/test/ui/unspecified-self-in-trait-ref.rs b/src/test/ui/unspecified-self-in-trait-ref.rs index 74a9af84cae85..914b7b500e021 100644 --- a/src/test/ui/unspecified-self-in-trait-ref.rs +++ b/src/test/ui/unspecified-self-in-trait-ref.rs @@ -1,8 +1,8 @@ -pub trait Foo { +pub trait Foo { fn foo(&self); } -pub trait Bar { +pub trait Bar { fn foo(&self); } diff --git a/src/test/ui/variants/variant-used-as-type.rs b/src/test/ui/variants/variant-used-as-type.rs index f27db1024760a..e882215f4ecb6 100644 --- a/src/test/ui/variants/variant-used-as-type.rs +++ b/src/test/ui/variants/variant-used-as-type.rs @@ -1,7 +1,6 @@ -// Test error message when enum variants are used as types +// Test error message when enum variants are used as types. - -// issue 21225 +// See issue #21225. enum Ty { A, B(Ty::A), @@ -9,7 +8,7 @@ enum Ty { } -// issue 19197 +// See issue #19197. enum E { A } diff --git a/src/test/ui/variants/variant-used-as-type.stderr b/src/test/ui/variants/variant-used-as-type.stderr index fdfc044d81f6c..2500e3540c9be 100644 --- a/src/test/ui/variants/variant-used-as-type.stderr +++ b/src/test/ui/variants/variant-used-as-type.stderr @@ -1,5 +1,5 @@ error[E0573]: expected type, found variant `Ty::A` - --> $DIR/variant-used-as-type.rs:7:7 + --> $DIR/variant-used-as-type.rs:6:7 | LL | B(Ty::A), | ^^^^^ not a type @@ -11,7 +11,7 @@ LL | B(Ty), | ^^ error[E0573]: expected type, found variant `E::A` - --> $DIR/variant-used-as-type.rs:17:6 + --> $DIR/variant-used-as-type.rs:16:6 | LL | impl E::A {} | ^^^^ not a type diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs index 5eb1f5ec5ffda..896df057b7b54 100644 --- a/src/tools/compiletest/src/header.rs +++ b/src/tools/compiletest/src/header.rs @@ -309,7 +309,7 @@ pub struct TestProps { pub forbid_output: Vec, // Revisions to test for incremental compilation. pub revisions: Vec, - // Directory (if any) to use for incremental compilation. This is + // Directory (if any) to use for incremental compilation. This is // not set by end-users; rather it is set by the incremental // testing harness and used when generating compilation // arguments. (In particular, it propagates to the aux-builds.) @@ -671,7 +671,7 @@ impl Config { fn parse_env(&self, line: &str, name: &str) -> Option<(String, String)> { self.parse_name_value_directive(line, name).map(|nv| { - // nv is either FOO or FOO=BAR + // `nv` is either `"FOO"` or `"FOO=BAR"`. let mut strs: Vec = nv.splitn(2, '=').map(str::to_owned).collect(); match strs.len() { @@ -856,7 +856,7 @@ fn expand_variables(mut value: String, config: &Config) -> String { /// assert_eq!(s, " -> \"something ($WORD bits)\"."); /// ``` fn parse_normalization_string(line: &mut &str) -> Option { - // FIXME support escapes in strings. + // FIXME: support escapes in strings. let begin = line.find('"')? + 1; let end = line[begin..].find('"')? + begin; let result = line[begin..end].to_owned(); diff --git a/src/tools/compiletest/src/json.rs b/src/tools/compiletest/src/json.rs index 106aa67157a42..c4cdd35c06381 100644 --- a/src/tools/compiletest/src/json.rs +++ b/src/tools/compiletest/src/json.rs @@ -93,7 +93,7 @@ pub fn parse_output(file_name: &str, output: &str, proc_res: &ProcRes) -> Vec Vec { // The compiler sometimes intermingles non-JSON stuff into the - // output. This hack just skips over such lines. Yuck. + // output. This hack just skips over such lines. Yuck. if line.starts_with('{') { match serde_json::from_str::(line) { Ok(diagnostic) => { @@ -147,7 +147,7 @@ fn push_expected_errors( }; // We break the output into multiple lines, and then append the - // [E123] to every line in the output. This may be overkill. The + // [E123] to every line in the output. This may be overkill. The // intention was to match existing tests that do things like "//| // found `i32` [E123]" and expect to match that somewhere, and yet // also ensure that `//~ ERROR E123` *always* works. The diff --git a/src/tools/compiletest/src/main.rs b/src/tools/compiletest/src/main.rs index c35addc4f21a8..02b7276ea2941 100644 --- a/src/tools/compiletest/src/main.rs +++ b/src/tools/compiletest/src/main.rs @@ -140,7 +140,7 @@ pub fn parse_config(args: Vec) -> Config { "", "runtool", "supervisor program to run tests under \ - (eg. emulator, valgrind)", + (e.g., emulator, valgrind)", "PROGRAM", ) .optopt( @@ -644,7 +644,7 @@ pub fn make_test(config: &Config, testpaths: &TestPaths) -> Vec bool { match &target[..] { @@ -939,7 +939,7 @@ fn extract_lldb_version(full_version_line: Option) -> (Option, b // There doesn't seem to be a way to correlate the Apple version // with the upstream version, and since the tests were originally // written against Apple versions, we make a fake Apple version by - // multiplying the first number by 100. This is a hack, but + // multiplying the first number by 100. This is a hack, but // normally fine because the only non-Apple version we test is // rust-enabled. diff --git a/src/tools/compiletest/src/read2.rs b/src/tools/compiletest/src/read2.rs index 5a4caddcdd319..91773203745bf 100644 --- a/src/tools/compiletest/src/read2.rs +++ b/src/tools/compiletest/src/read2.rs @@ -1,5 +1,5 @@ -// FIXME: This is a complete copy of `cargo/src/cargo/util/read2.rs` -// Consider unify the read2() in libstd, cargo and this to prevent further code duplication. +// FIXME: this is a complete copy of `cargo/src/cargo/util/read2.rs` +// Consider unifying the `read2()` in libstd, cargo and this to prevent further code duplication. pub use self::imp::read2; @@ -56,7 +56,7 @@ mod imp { let mut errfd = 1; while nfds > 0 { - // wait for either pipe to become readable using `select` + // Wait for either pipe to become readable using `select`. let r = unsafe { libc::poll(fds.as_mut_ptr(), nfds, -1) }; if r == -1 { let err = io::Error::last_os_error(); diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 84f3f30d6915e..4620233011f3e 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -394,7 +394,7 @@ impl<'test> TestCx<'test> { self.fatal_proc_rec("compilation failed!", &proc_res); } - // FIXME(#41968): Move this check to tidy? + // FIXME(#41968): move this check to *tidy*? let expected_errors = errors::load_errors(&self.testpaths.file, self.revision); assert!( expected_errors.is_empty(), @@ -496,7 +496,7 @@ impl<'test> TestCx<'test> { let mut actual = srcs[srcs.len() - 1].clone(); if self.props.pp_exact.is_some() { - // Now we have to care about line endings + // Now we have to care about line endings. let cr = "\r".to_owned(); actual = actual.replace(&cr, "").to_owned(); expected = expected.replace(&cr, "").to_owned(); @@ -504,22 +504,22 @@ impl<'test> TestCx<'test> { self.compare_source(&expected, &actual); - // If we're only making sure that the output matches then just stop here + // If we're only making sure that the output matches then just stop here. if self.props.pretty_compare_only { return; } - // Finally, let's make sure it actually appears to remain valid code + // Finally, let's make sure it actually appears to remain valid code. let proc_res = self.typecheck_source(actual); if !proc_res.status.success() { - self.fatal_proc_rec("pretty-printed source does not typecheck", &proc_res); + self.fatal_proc_rec("pretty-printed source does not type-check", &proc_res); } if !self.props.pretty_expanded { return; } - // additionally, run `--pretty expanded` and try to build it. + // Additionally, run `--pretty expanded` and try to build it. let proc_res = self.print_source(ReadFrom::Path, "expanded"); if !proc_res.status.success() { self.fatal_proc_rec("pretty-printing (expanded) failed", &proc_res); @@ -532,7 +532,7 @@ impl<'test> TestCx<'test> { let proc_res = self.typecheck_source(expanded_src); if !proc_res.status.success() { self.fatal_proc_rec( - "pretty-printed source (expanded) does not typecheck", + "pretty-printed source (expanded) does not type-check", &proc_res, ); } @@ -643,12 +643,12 @@ impl<'test> TestCx<'test> { fn run_debuginfo_gdb_test_no_opt(&self) { let prefixes = if self.config.gdb_native_rust { - // GDB with Rust + // GDB with Rust. static PREFIXES: &'static [&'static str] = &["gdb", "gdbr"]; println!("NOTE: compiletest thinks it is using GDB with native rust support"); PREFIXES } else { - // Generic GDB + // Generic GDB. static PREFIXES: &'static [&'static str] = &["gdb", "gdbg"]; println!("NOTE: compiletest thinks it is using GDB without native rust support"); PREFIXES @@ -661,7 +661,7 @@ impl<'test> TestCx<'test> { } = self.parse_debugger_commands(prefixes); let mut cmds = commands.join("\n"); - // compile test file (it should have 'compile-flags:-g' in the header) + // Compile test file (it should have `compile-flags:-g` in the header). let compiler_run_result = self.compile_test(); if !compiler_run_result.status.success() { self.fatal_proc_rec("compilation failed!", &compiler_run_result); @@ -678,7 +678,7 @@ impl<'test> TestCx<'test> { None => self.fatal("cannot find android cross path"), }; - // write debugger script + // Write debugger script. let mut script_str = String::with_capacity(2048); script_str.push_str(&format!("set charset {}\n", Self::charset())); script_str.push_str(&format!("set sysroot {}\n", tool_path)); @@ -828,14 +828,14 @@ impl<'test> TestCx<'test> { } } - // The following line actually doesn't have to do anything with - // pretty printing, it just tells GDB to print values on one line: + // Theis doesn't actually have to do anything with pretty printing, + // it just tells GDB to print values on one line. script_str.push_str("set print pretty off\n"); - // Add the pretty printer directory to GDB's source-file search path + // Add the pretty printer directory to GDB's source-file search path. script_str.push_str(&format!("directory {}\n", rust_pp_module_abs_path)); - // Load the target executable + // Load the target executable. script_str.push_str(&format!( "file {}\n", exe_file.to_str().unwrap().replace(r"\", r"\\") @@ -846,7 +846,7 @@ impl<'test> TestCx<'test> { script_str.push_str("set language rust\n"); } - // Add line breakpoints + // Add line breakpoints. for line in &breakpoint_lines { script_str.push_str(&format!( "break '{}':{}\n", @@ -913,7 +913,7 @@ impl<'test> TestCx<'test> { } fn run_debuginfo_lldb_test_no_opt(&self) { - // compile test file (it should have 'compile-flags:-g' in the header) + // Compile test file (it should have `compile-flags:-g` in the header). let compile_result = self.compile_test(); if !compile_result.status.success() { self.fatal_proc_rec("compilation failed!", &compile_result); @@ -946,7 +946,7 @@ impl<'test> TestCx<'test> { PREFIXES }; - // Parse debugger commands etc from test files + // Parse debugger commands, etc., from test files. let DebuggerCommands { commands, check_lines, @@ -954,14 +954,14 @@ impl<'test> TestCx<'test> { .. } = self.parse_debugger_commands(prefixes); - // Write debugger script: - // We don't want to hang when calling `quit` while the process is still running + // Write debugger script. + // We don't want to hang when calling `quit` while the process is still running. let mut script_str = String::from("settings set auto-confirm true\n"); - // Make LLDB emit its version, so we have it documented in the test output + // Make LLDB emit its version, so we have it documented in the test output. script_str.push_str("version\n"); - // Switch LLDB into "Rust mode" + // Switch LLDB into "Rust mode". let rust_src_root = self .config .find_rust_src_root() @@ -980,7 +980,7 @@ impl<'test> TestCx<'test> { script_str.push_str("-x \".*\" --category Rust\n"); script_str.push_str("type category enable Rust\n"); - // Set breakpoints on every line that contains the string "#break" + // Set breakpoints on every line that contains the string `"#break"`. let source_file_name = self.testpaths.file.file_name().unwrap().to_string_lossy(); for line in &breakpoint_lines { script_str.push_str(&format!( @@ -989,21 +989,21 @@ impl<'test> TestCx<'test> { )); } - // Append the other commands + // Append the other commands. for line in &commands { script_str.push_str(line); script_str.push_str("\n"); } - // Finally, quit the debugger + // Finally, quit the debugger. script_str.push_str("\nquit\n"); - // Write the script into a file + // Write the script into a file. debug!("script_str = {}", script_str); self.dump_output_file(&script_str, "debugger.script"); let debugger_script = self.make_out_name("debugger.script"); - // Let LLDB execute the script via lldb_batchmode.py + // Let LLDB execute the script via `lldb_batchmode.py`. let debugger_run_result = self.run_lldb(&exe_file, &debugger_script, &rust_src_root); if !debugger_run_result.status.success() { @@ -1019,7 +1019,7 @@ impl<'test> TestCx<'test> { debugger_script: &Path, rust_src_root: &Path, ) -> ProcRes { - // Prepare the lldb_batchmode which executes the debugger script + // Prepare the lldb_batchmode which executes the debugger script. let lldb_script_path = rust_src_root.join("src/etc/lldb_batchmode.py"); self.cmd2procres( Command::new(&self.config.lldb_python) @@ -1108,7 +1108,8 @@ impl<'test> TestCx<'test> { return None; } - // Remove options that are either unwanted (-O) or may lead to duplicates due to RUSTFLAGS. + // Remove options that are either unwanted (`-O`) or may lead to duplicates due to + // `RUSTFLAGS`. let options_to_remove = ["-O".to_owned(), "-g".to_owned(), "--debuginfo".to_owned()]; let new_options = self .split_maybe_args(options) @@ -1144,7 +1145,7 @@ impl<'test> TestCx<'test> { fn check_single_line(line: &str, check_line: &str) -> bool { // Allow check lines to leave parts unspecified (e.g., uninitialized - // bits in the wrong case of an enum) with the notation "[...]". + // bits in the wrong case of an enum) with the notation `[...]`. let line = line.trim(); let check_line = check_line.trim(); let can_start_anywhere = check_line.starts_with("[...]"); @@ -1251,11 +1252,11 @@ impl<'test> TestCx<'test> { self.fatal_proc_rec("process did not return an error status", proc_res); } - // On Windows, keep all '\' path separators to match the paths reported in the JSON output - // from the compiler + // On Windows, keep all `\` path separators to match the paths reported in the JSON output + // from the compiler. let os_file_name = self.testpaths.file.display().to_string(); - // on windows, translate all '\' path separators to '/' + // On windows, translate all `\` path separators to `/`. let file_name = format!("{}", self.testpaths.file.display()).replace(r"\", "/"); // If the testcase being checked contains at least one expected "help" @@ -1285,7 +1286,7 @@ impl<'test> TestCx<'test> { match opt_index { Some(index) => { - // found a match, everybody is happy + // Found a match; everybody is happy. assert!(!found[index]); found[index] = true; } @@ -1309,7 +1310,7 @@ impl<'test> TestCx<'test> { } let mut not_found = Vec::new(); - // anything not yet found is a problem + // Anything not yet found is a problem. for (index, expected_error) in expected_errors.iter().enumerate() { if !found[index] { self.error(&format!( @@ -1343,7 +1344,7 @@ impl<'test> TestCx<'test> { } } - /// Returns true if we should report an error about `actual_error`, + /// Returns whether we should report an error about `actual_error`, /// which did not match any of the expected error. We always require /// errors/warnings to be explicitly listed, but only require /// helps/notes if there are explicit helps/notes given. @@ -1499,8 +1500,8 @@ impl<'test> TestCx<'test> { }; if proc_res.status.success() { - // delete the executable after running it to save space. - // it is ok if the deletion failed. + // Delete the executable after running it to save space. + // it is okay if the deletion failed. let _ = fs::remove_file(self.make_exe_name()); } @@ -1642,7 +1643,7 @@ impl<'test> TestCx<'test> { } path.insert(0, PathBuf::from(lib_path)); - // Add the new dylib search path var + // Add the new dylib search path var. let newpath = env::join_paths(&path).unwrap(); command.env(dylib_env_var(), newpath); @@ -1688,10 +1689,10 @@ impl<'test> TestCx<'test> { .expect("no rustdoc built yet"), ) }; - // FIXME Why is -L here? + // FIXME: why is `-L` here? rustc.arg(input_file); //.arg("-L").arg(&self.config.build_base); - // Optionally prevent default --target if specified in test compile-flags. + // Optionally prevent default `--target` if specified in test compile-flags. let custom_target = self .props .compile_flags @@ -1827,11 +1828,11 @@ impl<'test> TestCx<'test> { fn make_exe_name(&self) -> PathBuf { // Using a single letter here to keep the path length down for - // Windows. Some test names get very long. rustc creates `rcgu` + // Windows. Some test names get very long. rustc creates `rcgu` // files with the module name appended to it which can more than // double the length. let mut f = self.output_base_dir().join("a"); - // FIXME: This is using the host architecture exe suffix, not target! + // FIXME: this is using the host architecture exe suffix, not target! if self.config.target.contains("emscripten") { f = f.with_extra_extension("js"); } else if self.config.target.contains("wasm32") { @@ -1872,10 +1873,10 @@ impl<'test> TestCx<'test> { let exe_file = self.make_exe_name(); - // FIXME (#9639): This needs to handle non-utf8 paths + // FIXME(#9639): This needs to handle non-UTF8 paths. args.push(exe_file.to_str().unwrap().to_owned()); - // Add the arguments in the run_flags directive + // Add the arguments in the `run_flags` directive. args.extend(self.split_maybe_args(&self.props.run_flags)); let prog = args.remove(0); @@ -1901,12 +1902,12 @@ impl<'test> TestCx<'test> { fn make_cmdline(&self, command: &Command, libpath: &str) -> String { use util; - // Linux and mac don't require adjusting the library search path + // Linux and macOS don't require adjusting the library search path. if cfg!(unix) { format!("{:?}", command) } else { - // Build the LD_LIBRARY_PATH variable as it would be seen on the command line - // for diagnostic purposes + // Build the `LD_LIBRARY_PATH` variable as it would be seen on the command line + // for diagnostic purposes. fn lib_path_cmd_prefix(path: &str) -> String { format!( "{}=\"{}\"", @@ -1936,14 +1937,14 @@ impl<'test> TestCx<'test> { fs::write(&outfile, out).unwrap(); } - /// Create a filename for output with the given extension. Example: - /// /.../testname.revision.mode/testname.extension + /// Creates a filename for output with the given extension. + /// E.g., `/.../testname.revision.mode/testname.extension` fn make_out_name(&self, extension: &str) -> PathBuf { self.output_base_name().with_extension(extension) } - /// Directory where auxiliary files are written. Example: - /// /.../testname.revision.mode/auxiliary/ + /// Gets the directory where auxiliary files are written. + /// E.g., `/.../testname.revision.mode/auxiliary/` fn aux_output_dir_name(&self) -> PathBuf { self.output_base_dir() .join("auxiliary") @@ -1955,7 +1956,7 @@ impl<'test> TestCx<'test> { output_testname_unique(self.config, self.testpaths, self.safe_revision()) } - /// The revision, ignored for Incremental since it wants all revisions in + /// The revision, ignored for incremental compilation since it wants all revisions in /// the same directory. fn safe_revision(&self) -> Option<&str> { if self.config.mode == Incremental { @@ -1965,16 +1966,16 @@ impl<'test> TestCx<'test> { } } - /// Absolute path to the directory where all output for the given - /// test/revision should reside. Example: - /// /path/to/build/host-triple/test/ui/relative/testname.revision.mode/ + /// Gets the absolute path to the directory where all output for the given + /// test/revision should reside. + /// E.g., `/path/to/build/host-triple/test/ui/relative/testname.revision.mode/` fn output_base_dir(&self) -> PathBuf { output_base_dir(self.config, self.testpaths, self.safe_revision()) } /// Absolute path to the base filename used as output for the given - /// test/revision. Example: - /// /.../relative/testname.revision.mode/testname + /// test/revision. + /// E.g., `/.../relative/testname.revision.mode/testname` fn output_base_name(&self) -> PathBuf { output_base_name(self.config, self.testpaths, self.safe_revision()) } @@ -2007,8 +2008,8 @@ impl<'test> TestCx<'test> { proc_res.fatal(None); } - // This function is a poor man's attempt to debug rust-lang/rust#38620, if - // that's closed then this should be deleted + // This function is a poor man's attempt to debug issue #38620 -- + // when that's closed, this should be deleted. // // This is a very "opportunistic" debugging attempt, so we ignore all // errors here. @@ -2046,7 +2047,7 @@ impl<'test> TestCx<'test> { println!("---------------------------------------------------"); } - // codegen tests (using FileCheck) + // Codegen tests (using `FileCheck`) fn compile_test_and_save_ir(&self) -> ProcRes { let aux_dir = self.aux_output_dir_name(); @@ -2087,7 +2088,7 @@ impl<'test> TestCx<'test> { } fn charset() -> &'static str { - // FreeBSD 10.1 defaults to GDB 6.1.1 which doesn't support "auto" charset + // FreeBSD 10.1 defaults to GDB 6.1.1 which doesn't support "auto" charset. if cfg!(target_os = "bitrig") { "auto" } else if cfg!(target_os = "freebsd") { @@ -2275,7 +2276,7 @@ impl<'test> TestCx<'test> { if let Some(actual_item) = actual_item_with_same_name { if !expected_item.codegen_units.is_empty() && - // Also check for codegen units + // Also check for codegen units. expected_item.codegen_units != actual_item.codegen_units { wrong_cgus.push((expected_item.clone(), actual_item.clone())); @@ -2348,7 +2349,7 @@ impl<'test> TestCx<'test> { string: String, } - // [MONO_ITEM] name [@@ (cgu)+] + // `[MONO_ITEM] name [@@ (cgu)+]` fn str_to_mono_item(s: &str, cgu_has_crate_disambiguator: bool) -> MonoItem { let s = if s.starts_with(PREFIX) { (&s[PREFIX.len()..]).trim() @@ -2405,8 +2406,8 @@ impl<'test> TestCx<'test> { string } - // Given a cgu-name-prefix of the form . or - // the form .-in-., + // Given a cgu-name-prefix of the form `.` or + // `.-in-.`, // remove all crate-disambiguators. fn remove_crate_disambiguator_from_cgu(cgu: &str) -> String { lazy_static! { @@ -2433,16 +2434,16 @@ impl<'test> TestCx<'test> { } fn init_incremental_test(&self) { - // (See `run_incremental_test` for an overview of how incremental tests work.) + // See `run_incremental_test` for an overview of how incremental tests work. // Before any of the revisions have executed, create the - // incremental workproduct directory. Delete any old + // incremental workproduct directory. Delete any old // incremental work products that may be there from prior // runs. let incremental_dir = self.incremental_dir(); if incremental_dir.exists() { - // Canonicalizing the path will convert it to the //?/ format - // on Windows, which enables paths longer than 260 character + // Canonicalizing the path will convert it to the `//?/` format + // on Windows, which enables paths longer than 260 characters. let canonicalized = incremental_dir.canonicalize().unwrap(); fs::remove_dir_all(canonicalized).unwrap(); } @@ -2457,24 +2458,24 @@ impl<'test> TestCx<'test> { } fn run_incremental_test(&self) { - // Basic plan for a test incremental/foo/bar.rs: - // - load list of revisions rpass1, cfail2, rpass3 + // Basic plan for a test `incremental/foo/bar.rs`: + // - load list of revisions `rpass1`, `cfail2`, `rpass3` // - each should begin with `rpass`, `cfail`, or `rfail` // - if `rpass`, expect compile and execution to succeed // - if `cfail`, expect compilation to fail // - if `rfail`, expect execution to fail - // - create a directory build/foo/bar.incremental - // - compile foo/bar.rs with -Z incremental=.../foo/bar.incremental and -C rpass1 - // - because name of revision starts with "rpass", expect success - // - compile foo/bar.rs with -Z incremental=.../foo/bar.incremental and -C cfail2 - // - because name of revision starts with "cfail", expect an error + // - create a directory `build/foo/bar.incremental` + // - compile `foo/bar.rs` with `-Z incremental=.../foo/bar.incremental` and `-C rpass1` + // - because name of revision starts with `rpass`, expect success + // - compile `foo/bar.rs` with `-Z incremental=.../foo/bar.incremental` and `-C cfail2` + // - because name of revision starts with `cfail`, expect an error // - load expected errors as usual, but filter for those that end in `[rfail2]` - // - compile foo/bar.rs with -Z incremental=.../foo/bar.incremental and -C rpass3 - // - because name of revision starts with "rpass", expect success - // - execute build/foo/bar.exe and save output + // - compile `foo/bar.rs` with `-Z incremental=.../foo/bar.incremental` and `-C rpass3` + // - because name of revision starts with `rpass`, expect success + // - execute `build/foo/bar` and save output // - // FIXME -- use non-incremental mode as an oracle? That doesn't apply - // to #[rustc_dirty] and clean tests I guess + // FIXME: use non-incremental mode as an oracle? That doesn't apply + // to `#[rustc_dirty]` and clean tests, I guess. let revision = self .revision @@ -2587,8 +2588,8 @@ impl<'test> TestCx<'test> { cmd.env("RUSTC_LINKER", linker); } - // We don't want RUSTFLAGS set from the outside to interfere with - // compiler flags set in the test cases: + // We don't want `RUSTFLAGS` set from the outside to interfere with + // compiler flags set in the test cases. cmd.env_remove("RUSTFLAGS"); if self.config.target.contains("msvc") && self.config.cc != "" { @@ -2644,7 +2645,7 @@ impl<'test> TestCx<'test> { if entry.file_type()?.is_dir() { self.aggressive_rm_rf(&path)?; } else { - // Remove readonly files as well on windows (by default we can't) + // Remove read-only files as well, on Windows (by default we can't). fs::remove_file(&path).or_else(|e| { if cfg!(windows) && e.kind() == io::ErrorKind::PermissionDenied { let mut meta = entry.metadata()?.permissions(); @@ -2661,9 +2662,9 @@ impl<'test> TestCx<'test> { } fn run_ui_test(&self) { - // if the user specified a format in the ui test + // If the user specified a format in the ui test // print the output to the stderr file, otherwise extract - // the rendered error messages from json and print them + // the rendered error messages from the JSON and print them. let explicit = self .props .compile_flags @@ -2699,9 +2700,9 @@ impl<'test> TestCx<'test> { self.prune_duplicate_outputs(&modes_to_prune); if self.config.compare_mode.is_some() { - // don't test rustfix with nll right now + // Don't test rustfix with NLL right now. } else if self.props.run_rustfix { - // Apply suggestions from rustc to the code itself + // Apply suggestions from rustc to the code itself. let unfixed_code = self .load_expected_output_from_path(&self.testpaths.file) .unwrap(); @@ -2918,7 +2919,7 @@ impl<'test> TestCx<'test> { }; // We expect each non-empty line to appear consecutively, non-consecutive lines - // must be separated by at least one Elision + // must be separated by at least one elision. let mut start_block_line = None; while let Some(dumped_line) = dumped_lines.next() { match expected_lines.next() { @@ -2943,7 +2944,7 @@ impl<'test> TestCx<'test> { } } Some(&ExpectedLine::Elision) => { - // skip any number of elisions in a row. + // Skip any number of elisions in a row. while let Some(&&ExpectedLine::Elision) = expected_lines.peek() { expected_lines.next(); } @@ -2991,7 +2992,7 @@ impl<'test> TestCx<'test> { let mut normalized = output.replace(&parent_dir_str, "$DIR"); - // Paths into the libstd/libcore + // Paths into the libstd/libcore. let src_dir = self.config.src_base.parent().unwrap().parent().unwrap(); let src_dir_str = if json { src_dir.display().to_string().replace("\\", "\\\\") @@ -3000,39 +3001,43 @@ impl<'test> TestCx<'test> { }; normalized = normalized.replace(&src_dir_str, "$SRC_DIR"); - // Paths into the build directory + // Paths into the build directory. let test_build_dir = &self.config.build_base; let parent_build_dir = test_build_dir.parent().unwrap().parent().unwrap().parent().unwrap(); - // eg. /home/user/rust/build/x86_64-unknown-linux-gnu/test/ui + // E.g., `/home/user/rust/build/x86_64-unknown-linux-gnu/test/ui`. normalized = normalized.replace(test_build_dir.to_str().unwrap(), "$TEST_BUILD_DIR"); - // eg. /home/user/rust/build + // E.g., `/home/user/rust/build`. normalized = normalized.replace(&parent_build_dir.to_str().unwrap(), "$BUILD_DIR"); - // Paths into lib directory. + // Paths into `lib` directory. let mut lib_dir = parent_build_dir.parent().unwrap().to_path_buf(); lib_dir.push("lib"); normalized = normalized.replace(&lib_dir.to_str().unwrap(), "$LIB_DIR"); if json { - // escaped newlines in json strings should be readable - // in the stderr files. There's no point int being correct, + // Escaped newlines in JSON strings should be readable + // in the stderr files. There's no point in being correct, // since only humans process the stderr files. - // Thus we just turn escaped newlines back into newlines. + // Thus, we just turn escaped newlines back into newlines. normalized = normalized.replace("\\n", "\n"); } // If there are `$SRC_DIR` normalizations with line and column numbers, then replace them // with placeholders as we do not want tests needing updated when compiler source code // changes. - // eg. $SRC_DIR/libcore/mem.rs:323:14 becomes $SRC_DIR/libcore/mem.rs:LL:COL + // E.g., `$SRC_DIR/libcore/mem.rs:323:14` becomes `$SRC_DIR/libcore/mem.rs:LL:COL`. normalized = Regex::new("SRC_DIR(.+):\\d+:\\d+").unwrap() .replace_all(&normalized, "SRC_DIR$1:LL:COL").into_owned(); - normalized = normalized.replace("\\\\", "\\") // denormalize for paths on windows - .replace("\\", "/") // normalize for paths on windows - .replace("\r\n", "\n") // normalize for linebreaks on windows - .replace("\t", "\\t"); // makes tabs visible + // Denormalize for paths on Windows. + normalized = normalized.replace("\\\\", "\\") + // Normalize for paths on windows. + .replace("\\", "/") + // Normalize for line breaks on windows. + .replace("\r\n", "\n") + // Makes tabs visible. + .replace("\t", "\\t"); for rule in custom_rules { let re = Regex::new(&rule.0).expect("bad regex in custom normalization rule"); normalized = re.replace_all(&normalized, &rule.1[..]).into_owned(); diff --git a/src/tools/tidy/src/features.rs b/src/tools/tidy/src/features.rs index 049a0ee49f0a4..154ec3c83ff7f 100644 --- a/src/tools/tidy/src/features.rs +++ b/src/tools/tidy/src/features.rs @@ -1,12 +1,12 @@ -//! Tidy check to ensure that unstable features are all in order +//! Tidy check to ensure that unstable features are all in order. //! //! This check will ensure properties like: //! -//! * All stability attributes look reasonably well formed -//! * The set of library features is disjoint from the set of language features -//! * Library features have at most one stability level -//! * Library features have at most one `since` value -//! * All unstable lang features have tests to ensure they are actually unstable +//! * All stability attributes look reasonably well formed. +//! * The set of library features is disjoint from the set of language features. +//! * Library features have at most one stability level. +//! * Library features have at most one `since` value. +//! * All unstable lang features have tests to ensure they are actually unstable. use std::collections::HashMap; use std::fmt; @@ -172,7 +172,7 @@ fn test_filen_gate(filen_underscore: &str, features: &mut Features) -> bool { pub fn collect_lang_features(base_src_path: &Path, bad: &mut bool) -> Features { let contents = t!(fs::read_to_string(base_src_path.join("libsyntax/feature_gate.rs"))); - // we allow rustc-internal features to omit a tracking issue. + // We allow rustc-internal features to omit a tracking issue. // these features must be marked with `// rustc internal` in its own group. let mut next_feature_is_rustc_internal = false; @@ -327,7 +327,7 @@ fn map_lib_features(base_src_path: &Path, } becoming_feature = None; if line.contains("rustc_const_unstable(") { - // const fn features are handled specially + // Const fn features are handled specially. let feature_name = match find_attr_val(line, "feature") { Some(name) => name, None => err!("malformed stability attribute"), @@ -336,11 +336,11 @@ fn map_lib_features(base_src_path: &Path, level: Status::Unstable, since: "None".to_owned(), has_gate_test: false, - // Whether there is a common tracking issue - // for these feature gates remains an open question - // https://github.com/rust-lang/rust/issues/24111#issuecomment-340283184 - // But we take 24111 otherwise they will be shown as - // "internal to the compiler" which they are not. + // Whether there is a common tracking issue for these feature gates remains + // an open question (see + // ). + // However, we still reference issue #24111, otherwise they will be shown as + // "internal to the compiler", which they are not. tracking_issue: Some(24111), }; mf(Ok((feature_name, feature)), file, i + 1);