]> git.lizzy.rs Git - rust.git/commitdiff
Various minor/cosmetic improvements to code
authorAlexander Regueiro <alexreg@me.com>
Tue, 27 Nov 2018 02:59:49 +0000 (02:59 +0000)
committerAlexander Regueiro <alexreg@me.com>
Fri, 7 Dec 2018 23:53:34 +0000 (23:53 +0000)
457 files changed:
src/bootstrap/builder.rs
src/bootstrap/dist.rs
src/bootstrap/flags.rs
src/bootstrap/job.rs
src/bootstrap/lib.rs
src/bootstrap/native.rs
src/bootstrap/test.rs
src/bootstrap/tool.rs
src/liballoc/boxed.rs
src/liballoc/collections/binary_heap.rs
src/liballoc/collections/btree/set.rs
src/liballoc/raw_vec.rs
src/liballoc/rc.rs
src/liballoc/slice.rs
src/liballoc/sync.rs
src/liballoc/tests/slice.rs
src/liballoc/tests/str.rs
src/liballoc/vec.rs
src/libcore/alloc.rs
src/libcore/any.rs
src/libcore/cell.rs
src/libcore/char/mod.rs
src/libcore/clone.rs
src/libcore/ffi.rs
src/libcore/hash/mod.rs
src/libcore/hint.rs
src/libcore/intrinsics.rs
src/libcore/iter/iterator.rs
src/libcore/iter/traits.rs
src/libcore/marker.rs
src/libcore/mem.rs
src/libcore/num/bignum.rs
src/libcore/num/dec2flt/algorithm.rs
src/libcore/num/dec2flt/rawfp.rs
src/libcore/num/flt2dec/mod.rs
src/libcore/num/flt2dec/strategy/dragon.rs
src/libcore/num/flt2dec/strategy/grisu.rs
src/libcore/num/mod.rs
src/libcore/num/wrapping.rs
src/libcore/ops/function.rs
src/libcore/ops/mod.rs
src/libcore/option.rs
src/libcore/pin.rs
src/libcore/ptr.rs
src/libcore/raw.rs
src/libcore/slice/mod.rs
src/libcore/str/mod.rs
src/libcore/str/pattern.rs
src/libcore/task/wake.rs
src/libcore/tests/num/dec2flt/mod.rs
src/libcore/tests/num/flt2dec/random.rs
src/libcore/time.rs
src/libgraphviz/lib.rs
src/libpanic_unwind/dwarf/mod.rs
src/libpanic_unwind/gcc.rs
src/libpanic_unwind/seh.rs
src/libproc_macro/bridge/client.rs
src/libproc_macro/bridge/mod.rs
src/libproc_macro/bridge/scoped_cell.rs
src/libproc_macro/bridge/server.rs
src/libproc_macro/lib.rs
src/librustc/cfg/construct.rs
src/librustc/dep_graph/dep_node.rs
src/librustc/diagnostics.rs
src/librustc/hir/def.rs
src/librustc/hir/intravisit.rs
src/librustc/hir/lowering.rs
src/librustc/hir/map/blocks.rs
src/librustc/hir/map/definitions.rs
src/librustc/hir/map/mod.rs
src/librustc/hir/mod.rs
src/librustc/hir/pat_util.rs
src/librustc/hir/print.rs
src/librustc/ich/hcx.rs
src/librustc/infer/combine.rs
src/librustc/infer/equate.rs
src/librustc/infer/error_reporting/nice_region_error/find_anon_type.rs
src/librustc/infer/higher_ranked/mod.rs
src/librustc/infer/mod.rs
src/librustc/infer/nll_relate/mod.rs
src/librustc/infer/opaque_types/mod.rs
src/librustc/infer/outlives/obligations.rs
src/librustc/infer/region_constraints/mod.rs
src/librustc/infer/type_variable.rs
src/librustc/lib.rs
src/librustc/lint/builtin.rs
src/librustc/lint/context.rs
src/librustc/lint/levels.rs
src/librustc/lint/mod.rs
src/librustc/middle/cstore.rs
src/librustc/middle/dead.rs
src/librustc/middle/dependency_format.rs
src/librustc/middle/entry.rs
src/librustc/middle/expr_use_visitor.rs
src/librustc/middle/lang_items.rs
src/librustc/middle/lib_features.rs
src/librustc/middle/liveness.rs
src/librustc/middle/mem_categorization.rs
src/librustc/middle/region.rs
src/librustc/middle/resolve_lifetime.rs
src/librustc/middle/stability.rs
src/librustc/mir/interpret/error.rs
src/librustc/mir/mod.rs
src/librustc/mir/mono.rs
src/librustc/mir/traversal.rs
src/librustc/mir/visit.rs
src/librustc/session/config.rs
src/librustc/session/filesearch.rs
src/librustc/session/mod.rs
src/librustc/traits/auto_trait.rs
src/librustc/traits/coherence.rs
src/librustc/traits/error_reporting.rs
src/librustc/traits/mod.rs
src/librustc/traits/object_safety.rs
src/librustc/traits/project.rs
src/librustc/traits/select.rs
src/librustc/traits/specialize/mod.rs
src/librustc/traits/specialize/specialization_graph.rs
src/librustc/traits/util.rs
src/librustc/ty/adjustment.rs
src/librustc/ty/codec.rs
src/librustc/ty/context.rs
src/librustc/ty/erase_regions.rs
src/librustc/ty/fast_reject.rs
src/librustc/ty/fold.rs
src/librustc/ty/item_path.rs
src/librustc/ty/layout.rs
src/librustc/ty/mod.rs
src/librustc/ty/query/mod.rs
src/librustc/ty/relate.rs
src/librustc/ty/sty.rs
src/librustc/ty/subst.rs
src/librustc/ty/util.rs
src/librustc/util/common.rs
src/librustc_apfloat/ieee.rs
src/librustc_apfloat/lib.rs
src/librustc_apfloat/ppc.rs
src/librustc_borrowck/borrowck/gather_loans/mod.rs
src/librustc_borrowck/borrowck/mod.rs
src/librustc_borrowck/dataflow.rs
src/librustc_codegen_llvm/abi.rs
src/librustc_codegen_llvm/attributes.rs
src/librustc_codegen_llvm/back/link.rs
src/librustc_codegen_llvm/back/write.rs
src/librustc_codegen_llvm/common.rs
src/librustc_codegen_llvm/consts.rs
src/librustc_codegen_llvm/context.rs
src/librustc_codegen_llvm/debuginfo/doc.rs
src/librustc_codegen_llvm/debuginfo/metadata.rs
src/librustc_codegen_llvm/debuginfo/mod.rs
src/librustc_codegen_llvm/debuginfo/type_names.rs
src/librustc_codegen_llvm/debuginfo/utils.rs
src/librustc_codegen_llvm/intrinsic.rs
src/librustc_codegen_llvm/llvm/mod.rs
src/librustc_codegen_llvm/mono_item.rs
src/librustc_codegen_llvm/type_.rs
src/librustc_codegen_llvm/type_of.rs
src/librustc_codegen_ssa/back/linker.rs
src/librustc_codegen_ssa/back/symbol_export.rs
src/librustc_codegen_ssa/base.rs
src/librustc_codegen_ssa/common.rs
src/librustc_codegen_ssa/lib.rs
src/librustc_codegen_ssa/mir/analyze.rs
src/librustc_codegen_ssa/mir/mod.rs
src/librustc_codegen_ssa/mir/place.rs
src/librustc_codegen_ssa/mir/rvalue.rs
src/librustc_codegen_ssa/traits/declare.rs
src/librustc_codegen_ssa/traits/type_.rs
src/librustc_codegen_utils/symbol_names.rs
src/librustc_data_structures/obligation_forest/mod.rs
src/librustc_data_structures/owning_ref/mod.rs
src/librustc_data_structures/thin_vec.rs
src/librustc_data_structures/transitive_relation.rs
src/librustc_driver/driver.rs
src/librustc_driver/pretty.rs
src/librustc_driver/test.rs
src/librustc_incremental/persist/dirty_clean.rs
src/librustc_lint/builtin.rs
src/librustc_lint/lib.rs
src/librustc_lint/nonstandard_style.rs
src/librustc_llvm/lib.rs
src/librustc_metadata/cstore.rs
src/librustc_metadata/cstore_impl.rs
src/librustc_metadata/locator.rs
src/librustc_metadata/schema.rs
src/librustc_mir/borrow_check/error_reporting.rs
src/librustc_mir/borrow_check/mod.rs
src/librustc_mir/borrow_check/move_errors.rs
src/librustc_mir/borrow_check/nll/constraints/mod.rs
src/librustc_mir/borrow_check/nll/region_infer/error_reporting/var_name.rs
src/librustc_mir/borrow_check/nll/region_infer/mod.rs
src/librustc_mir/borrow_check/nll/region_infer/values.rs
src/librustc_mir/borrow_check/nll/type_check/input_output.rs
src/librustc_mir/borrow_check/nll/type_check/liveness/local_use_map.rs
src/librustc_mir/borrow_check/nll/type_check/mod.rs
src/librustc_mir/borrow_check/places_conflict.rs
src/librustc_mir/borrow_check/prefixes.rs
src/librustc_mir/build/block.rs
src/librustc_mir/build/expr/as_rvalue.rs
src/librustc_mir/build/expr/into.rs
src/librustc_mir/build/expr/stmt.rs
src/librustc_mir/build/into.rs
src/librustc_mir/build/matches/mod.rs
src/librustc_mir/build/misc.rs
src/librustc_mir/build/scope.rs
src/librustc_mir/dataflow/at_location.rs
src/librustc_mir/dataflow/impls/borrows.rs
src/librustc_mir/dataflow/impls/mod.rs
src/librustc_mir/dataflow/mod.rs
src/librustc_mir/dataflow/move_paths/abs_domain.rs
src/librustc_mir/hair/cx/expr.rs
src/librustc_mir/hair/pattern/_match.rs
src/librustc_mir/hair/pattern/check_match.rs
src/librustc_mir/hair/pattern/mod.rs
src/librustc_mir/interpret/machine.rs
src/librustc_mir/interpret/memory.rs
src/librustc_mir/interpret/place.rs
src/librustc_mir/interpret/step.rs
src/librustc_mir/interpret/terminator.rs
src/librustc_mir/interpret/validity.rs
src/librustc_mir/interpret/visitor.rs
src/librustc_mir/lints.rs
src/librustc_mir/monomorphize/collector.rs
src/librustc_mir/monomorphize/partitioning.rs
src/librustc_mir/transform/check_unsafety.rs
src/librustc_mir/transform/const_prop.rs
src/librustc_mir/transform/inline.rs
src/librustc_mir/transform/promote_consts.rs
src/librustc_mir/transform/qualify_consts.rs
src/librustc_mir/transform/remove_noop_landing_pads.rs
src/librustc_mir/util/elaborate_drops.rs
src/librustc_mir/util/liveness.rs
src/librustc_passes/ast_validation.rs
src/librustc_passes/rvalue_promotion.rs
src/librustc_plugin/load.rs
src/librustc_privacy/lib.rs
src/librustc_resolve/lib.rs
src/librustc_resolve/macros.rs
src/librustc_resolve/resolve_imports.rs
src/librustc_save_analysis/lib.rs
src/librustc_target/abi/call/mod.rs
src/librustc_target/abi/call/s390x.rs
src/librustc_target/abi/call/x86_64.rs
src/librustc_target/abi/mod.rs
src/librustc_target/spec/abi.rs
src/librustc_target/spec/mod.rs
src/librustc_target/spec/thumb_base.rs
src/librustc_traits/implied_outlives_bounds.rs
src/librustc_traits/lowering/mod.rs
src/librustc_typeck/astconv.rs
src/librustc_typeck/check/_match.rs
src/librustc_typeck/check/autoderef.rs
src/librustc_typeck/check/callee.rs
src/librustc_typeck/check/cast.rs
src/librustc_typeck/check/closure.rs
src/librustc_typeck/check/coercion.rs
src/librustc_typeck/check/demand.rs
src/librustc_typeck/check/dropck.rs
src/librustc_typeck/check/intrinsic.rs
src/librustc_typeck/check/method/confirm.rs
src/librustc_typeck/check/method/mod.rs
src/librustc_typeck/check/method/probe.rs
src/librustc_typeck/check/method/suggest.rs
src/librustc_typeck/check/mod.rs
src/librustc_typeck/check/op.rs
src/librustc_typeck/coherence/builtin.rs
src/librustc_typeck/coherence/mod.rs
src/librustc_typeck/coherence/orphan.rs
src/librustc_typeck/collect.rs
src/librustc_typeck/constrained_type_params.rs
src/librustc_typeck/diagnostics.rs
src/librustc_typeck/lib.rs
src/librustc_typeck/outlives/implicit_infer.rs
src/librustc_typeck/variance/constraints.rs
src/librustc_typeck/variance/terms.rs
src/librustdoc/clean/auto_trait.rs
src/librustdoc/clean/cfg.rs
src/librustdoc/clean/mod.rs
src/librustdoc/clean/simplify.rs
src/librustdoc/html/layout.rs
src/librustdoc/html/render.rs
src/librustdoc/html/toc.rs
src/librustdoc/lib.rs
src/librustdoc/markdown.rs
src/librustdoc/passes/collect_intra_doc_links.rs
src/librustdoc/test.rs
src/librustdoc/visit_ast.rs
src/librustdoc/visit_lib.rs
src/libstd/collections/hash/set.rs
src/libstd/error.rs
src/libstd/f64.rs
src/libstd/ffi/c_str.rs
src/libstd/ffi/mod.rs
src/libstd/ffi/os_str.rs
src/libstd/fs.rs
src/libstd/io/cursor.rs
src/libstd/io/stdio.rs
src/libstd/keyword_docs.rs
src/libstd/net/addr.rs
src/libstd/net/tcp.rs
src/libstd/net/udp.rs
src/libstd/panic.rs
src/libstd/panicking.rs
src/libstd/path.rs
src/libstd/primitive_docs.rs
src/libstd/process.rs
src/libstd/sync/mod.rs
src/libstd/sync/mpsc/sync.rs
src/libstd/sync/once.rs
src/libstd/sys/unix/android.rs
src/libstd/sys/unix/ext/net.rs
src/libstd/sys/unix/net.rs
src/libstd/sys/unix/process/zircon.rs
src/libstd/sys/windows/ext/ffi.rs
src/libstd/sys/windows/fs.rs
src/libstd/sys/windows/os.rs
src/libstd/sys/windows/pipe.rs
src/libstd/sys_common/gnu/libbacktrace.rs
src/libstd/thread/local.rs
src/libstd/thread/mod.rs
src/libstd/time.rs
src/libsyntax/ast.rs
src/libsyntax/attr/mod.rs
src/libsyntax/config.rs
src/libsyntax/ext/base.rs
src/libsyntax/ext/expand.rs
src/libsyntax/ext/tt/macro_parser.rs
src/libsyntax/ext/tt/macro_rules.rs
src/libsyntax/ext/tt/quoted.rs
src/libsyntax/feature_gate.rs
src/libsyntax/fold.rs
src/libsyntax/lib.rs
src/libsyntax/parse/lexer/mod.rs
src/libsyntax/parse/parser.rs
src/libsyntax/parse/token.rs
src/libsyntax/print/pp.rs
src/libsyntax/ptr.rs
src/libsyntax/test.rs
src/libsyntax/util/parser.rs
src/libsyntax/visit.rs
src/libsyntax_ext/deriving/cmp/partial_ord.rs
src/libsyntax_ext/deriving/generic/mod.rs
src/libsyntax_ext/deriving/generic/ty.rs
src/libsyntax_ext/format.rs
src/libsyntax_ext/test.rs
src/libsyntax_pos/hygiene.rs
src/libsyntax_pos/lib.rs
src/libsyntax_pos/symbol.rs
src/libterm/lib.rs
src/libterm/terminfo/searcher.rs
src/libtest/formatters/terse.rs
src/libtest/lib.rs
src/libtest/stats.rs
src/rtstartup/rsbegin.rs
src/test/codegen-units/item-collection/unreferenced-inline-function.rs
src/test/codegen/external-no-mangle-fns.rs
src/test/codegen/external-no-mangle-statics.rs
src/test/debuginfo/type-names.rs
src/test/incremental/hashes/panic_exprs.rs
src/test/incremental/hashes/struct_defs.rs
src/test/pretty/block-disambig.rs
src/test/run-make-fulldeps/reproducible-build/reproducible-build.rs
src/test/run-pass/coerce/coerce-unify.rs
src/test/run-pass/coerce/coerce-unsize-subtype.rs
src/test/run-pass/core-run-destroy.rs
src/test/run-pass/drop/dropck-eyepatch.rs
src/test/run-pass/drop/dropck_legal_cycles.rs
src/test/run-pass/for-loop-while/loop-no-reinit-needed-post-bot.rs
src/test/run-pass/impl-trait/example-calendar.rs
src/test/run-pass/issues/issue-23808.rs
src/test/run-pass/issues/issue-24805-dropck-itemless.rs
src/test/run-pass/issues/issue-26996.rs
src/test/run-pass/issues/issue-27021.rs
src/test/run-pass/issues/issue-3563-3.rs
src/test/run-pass/issues/issue-49298.rs
src/test/run-pass/issues/issue-49955-2.rs
src/test/run-pass/lexer-crlf-line-endings-string-literal-doc-comment.rs
src/test/run-pass/lint-non-camel-case-types-non-uppercase-statics-unicode.rs
src/test/run-pass/macros/macro-comma-behavior.rs
src/test/run-pass/packed/packed-struct-optimized-enum.rs
src/test/run-pass/regions/regions-early-bound-trait-param.rs
src/test/run-pass/simd/simd-intrinsic-generic-cast.rs
src/test/run-pass/try-operator-hygiene.rs
src/test/run-pass/uniform-paths/basic-nested.rs
src/test/run-pass/uniform-paths/macros-nested.rs
src/test/ui/associated-const/associated-const-no-item.stderr
src/test/ui/bogus-tag.stderr
src/test/ui/borrowck/two-phase-nonrecv-autoref.rs
src/test/ui/coherence/coherence-all-remote.stderr
src/test/ui/coherence/coherence-bigint-param.stderr
src/test/ui/coherence/coherence-cow.a.stderr
src/test/ui/coherence/coherence-cow.b.stderr
src/test/ui/coherence/coherence-cow.c.stderr
src/test/ui/coherence/coherence-cross-crate-conflict.stderr
src/test/ui/coherence/coherence-lone-type-parameter.stderr
src/test/ui/coherence/coherence-overlapping-pairs.stderr
src/test/ui/coherence/coherence-pair-covered-uncovered-1.stderr
src/test/ui/coherence/coherence-pair-covered-uncovered.stderr
src/test/ui/coherence/coherence-vec-local-2.stderr
src/test/ui/constructor-lifetime-args.rs
src/test/ui/consts/const-eval/const-eval-overflow2.rs
src/test/ui/consts/const-eval/const-eval-overflow2b.rs
src/test/ui/consts/const-eval/const-eval-overflow2c.rs
src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.stderr
src/test/ui/consts/const-pattern-irrefutable.rs
src/test/ui/consts/const-typeid-of.stderr
src/test/ui/did_you_mean/bad-assoc-pat.stderr
src/test/ui/dont-suggest-private-trait-method.stderr
src/test/ui/dropck/dropck-eyepatch.rs
src/test/ui/e0119/complex-impl.stderr
src/test/ui/e0119/issue-28981.stderr
src/test/ui/empty/empty-struct-braces-expr.stderr
src/test/ui/error-codes/E0599.stderr
src/test/ui/imports/unused.rs
src/test/ui/invalid/invalid-path-in-const.stderr
src/test/ui/issues/issue-20261.rs
src/test/ui/issues/issue-22933-2.stderr
src/test/ui/issues/issue-22933-3.stderr
src/test/ui/issues/issue-23173.stderr
src/test/ui/issues/issue-23217.stderr
src/test/ui/issues/issue-27842.stderr
src/test/ui/issues/issue-28344.stderr
src/test/ui/issues/issue-28586.stderr
src/test/ui/issues/issue-28971.stderr
src/test/ui/issues/issue-30123.stderr
src/test/ui/issues/issue-36744-without-calls.rs
src/test/ui/issues/issue-38919.stderr
src/test/ui/issues/issue-39559.stderr
src/test/ui/issues/issue-3973.stderr
src/test/ui/issues/issue-40861.stderr
src/test/ui/issues/issue-41974.stderr
src/test/ui/issues/issue-42880.stderr
src/test/ui/issues/issue-52060.stderr
src/test/ui/issues/issue-7950.stderr
src/test/ui/lexical-scopes.stderr
src/test/ui/lint/lint-unused-imports.rs
src/test/ui/namespace/namespace-mix.rs
src/test/ui/nll/issue-21232-partial-init-and-use.rs
src/test/ui/no-implicit-prelude-nested.rs
src/test/ui/no-implicit-prelude.rs
src/test/ui/orphan-check-diagnostics.stderr
src/test/ui/parser/assoc-oddities-1.rs
src/test/ui/print_type_sizes/generics.rs
src/test/ui/regions/regions-free-region-ordering-incorrect.rs
src/test/ui/regions/regions-free-region-ordering-incorrect.stderr
src/test/ui/resolve/issue-5035.rs
src/test/ui/rfc-2005-default-binding-mode/no-double-error.stderr
src/test/ui/rfc-2126-extern-absolute-paths/meta.rs
src/test/ui/rust-2018/trait-import-suggestions.stderr
src/test/ui/simd-intrinsic/simd-intrinsic-single-nominal-type.rs
src/test/ui/span/issue-24805-dropck-trait-has-items.rs
src/test/ui/traits/trait-item-privacy.stderr
src/test/ui/type/type-alias-bounds.rs
src/test/ui/ufcs/ufcs-partially-resolved.stderr
src/test/ui/unspecified-self-in-trait-ref.stderr
src/tools/compiletest/src/errors.rs
src/tools/compiletest/src/header.rs

index 98005f93961048e197bb53d74129a74027e101c9..b3682850de75836b7841345fdff66417c6c6fac6 100644 (file)
@@ -793,7 +793,7 @@ pub fn cargo(
         }
 
         // Set a flag for `check` so that certain build scripts can do less work
-        // (e.g. not building/requiring LLVM).
+        // (e.g., not building/requiring LLVM).
         if cmd == "check" {
             cargo.env("RUST_CHECK", "1");
         }
@@ -923,12 +923,12 @@ pub fn cargo(
             cargo.env("RUSTC_FORCE_UNSTABLE", "1");
 
             // Currently the compiler depends on crates from crates.io, and
-            // then other crates can depend on the compiler (e.g. proc-macro
+            // then other crates can depend on the compiler (e.g., proc-macro
             // crates). Let's say, for example that rustc itself depends on the
             // bitflags crate. If an external crate then depends on the
             // bitflags crate as well, we need to make sure they don't
             // conflict, even if they pick the same version of bitflags. We'll
-            // want to make sure that e.g. a plugin and rustc each get their
+            // want to make sure that e.g., a plugin and rustc each get their
             // own copy of bitflags.
 
             // Cargo ensures that this works in general through the -C metadata
index 6108692e43c667ddaac1443e20c0a7c9f4458561..35348a34b0b0ede2619ddf3dc4dd8864afdf6b82 100644 (file)
@@ -353,7 +353,7 @@ fn make_run(run: RunConfig) {
     /// Build the `rust-mingw` installer component.
     ///
     /// This contains all the bits and pieces to run the MinGW Windows targets
-    /// without any extra installed software (e.g. we bundle gcc, libraries, etc).
+    /// without any extra installed software (e.g., we bundle gcc, libraries, etc).
     fn run(self, builder: &Builder) -> Option<PathBuf> {
         let host = self.host;
 
index 1211d485d1c12cfb24143795508539bf1afc29db..c49da8fc734892042d4f70c03e2e8a39600461bb 100644 (file)
@@ -121,11 +121,11 @@ pub fn parse(args: &[String]) -> Flags {
         opts.optopt("", "on-fail", "command to run on failure", "CMD");
         opts.optflag("", "dry-run", "dry run; don't build anything");
         opts.optopt("", "stage",
-            "stage to build (indicates compiler to use/test, e.g. stage 0 uses the \
+            "stage to build (indicates compiler to use/test, e.g., stage 0 uses the \
              bootstrap compiler, stage 1 the stage 0 rustc artifacts, etc.)",
             "N");
         opts.optmulti("", "keep-stage", "stage(s) to keep without recompiling \
-            (pass multiple times to keep e.g. both stages 0 and 1)", "N");
+            (pass multiple times to keep e.g., both stages 0 and 1)", "N");
         opts.optopt("", "src", "path to the root of the rust checkout", "DIR");
         opts.optopt("j", "jobs", "number of jobs to run in parallel", "JOBS");
         opts.optflag("h", "help", "print this help message");
index e6ee525ca2e0304bf4a8f615b3a6288361f2bc17..f7b1c50f0fd67de61b24743c87b99118a331be59 100644 (file)
@@ -10,7 +10,7 @@
 
 //! Job management on Windows for bootstrapping
 //!
-//! Most of the time when you're running a build system (e.g. make) you expect
+//! Most of the time when you're running a build system (e.g., make) you expect
 //! Ctrl-C or abnormal termination to actually terminate the entire tree of
 //! process in play, not just the one at the top. This currently works "by
 //! default" on Unix platforms because Ctrl-C actually sends a signal to the
@@ -162,11 +162,11 @@ pub unsafe fn setup(build: &mut Build) {
         return
     }
 
-    // If we've got a parent process (e.g. the python script that called us)
+    // If we've got a parent process (e.g., the python script that called us)
     // then move ownership of this job object up to them. That way if the python
-    // script is killed (e.g. via ctrl-c) then we'll all be torn down.
+    // script is killed (e.g., via ctrl-c) then we'll all be torn down.
     //
-    // If we don't have a parent (e.g. this was run directly) then we
+    // If we don't have a parent (e.g., this was run directly) then we
     // intentionally leak the job object handle. When our process exits
     // (normally or abnormally) it will close the handle implicitly, causing all
     // processes in the job to be cleaned up.
@@ -184,7 +184,7 @@ pub unsafe fn setup(build: &mut Build) {
 
     // If this failed, well at least we tried! An example of DuplicateHandle
     // failing in the past has been when the wrong python2 package spawned this
-    // build system (e.g. the `python2` package in MSYS instead of
+    // build system (e.g., the `python2` package in MSYS instead of
     // `mingw-w64-x86_64-python2`. Not sure why it failed, but the "failure
     // mode" here is that we only clean everything up when the build system
     // dies, not when the python parent does, so not too bad.
index 2832f5bebddd61bd2d1b7dccde7b9c19c2d7ab8a..2bcccc7b95bbaf5580dfbe61f034fba2676d4c8b 100644 (file)
@@ -38,7 +38,7 @@
 //! However, compiletest itself tries to avoid running tests when the artifacts
 //! that are involved (mainly the compiler) haven't changed.
 //!
-//! When you execute `x.py build`, the steps which are executed are:
+//! When you execute `x.py build`, the steps executed are:
 //!
 //! * First, the python script is run. This will automatically download the
 //!   stage0 rustc and cargo according to `src/stage0.txt`, or use the cached
index 448967ef0c2e160adb2bd93476c8666bb509c282..27ed61d49fead2db74658d30b973ce47e7f1ccfb 100644 (file)
@@ -251,7 +251,7 @@ fn run(self, builder: &Builder) -> PathBuf {
         configure_cmake(builder, target, &mut cfg, false);
 
         // FIXME: we don't actually need to build all LLVM tools and all LLVM
-        //        libraries here, e.g. we just want a few components and a few
+        //        libraries here, e.g., we just want a few components and a few
         //        tools. Figure out how to filter them down and only build the right
         //        tools and libs on all platforms.
 
index da827356800e96ed76a04f846a1d16057923a3c9..eaffc9df1f03139f2ef7e083570a3121847609ce 100644 (file)
@@ -971,7 +971,7 @@ fn run(self, builder: &Builder) {
         }
 
         if builder.no_std(target) == Some(true) {
-            // for no_std run-make (e.g. thumb*),
+            // for no_std run-make (e.g., thumb*),
             // we need a host compiler which is called by cargo.
             builder.ensure(compile::Std { compiler, target: compiler.host });
         }
@@ -1277,7 +1277,7 @@ fn should_run(run: ShouldRun) -> ShouldRun {
 
     /// Run `rustdoc --test` for all documentation in `src/doc`.
     ///
-    /// This will run all tests in our markdown documentation (e.g. the book)
+    /// This will run all tests in our markdown documentation (e.g., the book)
     /// located in `src/doc`. The `rustdoc` that's run is the one that sits next to
     /// `compiler`.
     fn run(self, builder: &Builder) {
index 58c5296beb35e5281fedd8006280ec16357caa83..1bd4403a66ffa9aea6888d9f02f7fefd6086f77a 100644 (file)
@@ -646,7 +646,7 @@ fn prepare_tool_cmd(&self, compiler: Compiler, tool: Tool, cmd: &mut Command) {
             self.cargo_out(compiler, tool.get_mode(), *host).join("deps"),
         ];
 
-        // On MSVC a tool may invoke a C compiler (e.g. compiletest in run-make
+        // On MSVC a tool may invoke a C compiler (e.g., compiletest in run-make
         // mode) and that C compiler may need some extra PATH modification. Do
         // so here.
         if compiler.host.contains("msvc") {
index c3a84bf778d03de1d67ed15c09a352006845c47a..83adcce5c742c6f06456703c19ee10dacb60a746 100644 (file)
@@ -801,7 +801,7 @@ fn as_mut(&mut self) -> &mut T {
  *        safe.)
  *      - It is in practice very useful to have Box<T> be unconditionally
  *        Unpin because of trait objects, for which the structural auto
- *        trait functionality does not apply (e.g. Box<dyn Foo> would
+ *        trait functionality does not apply (e.g., Box<dyn Foo> would
  *        otherwise not be Unpin).
  *
  *  Another type with the same semantics as Box but only a conditional
index 8c36962a299c2eef03ac89c4dae89cbbb35db1de..5dd0ea7d431a719879bb2c6d1cefbb3c940d3b55 100644 (file)
@@ -858,7 +858,7 @@ fn better_to_rebuild(len1: usize, len2: usize) -> bool {
     }
 }
 
-/// Hole represents a hole in a slice i.e. an index without valid value
+/// Hole represents a hole in a slice i.e., an index without valid value
 /// (because it was moved from or duplicated).
 /// In drop, `Hole` will restore the slice by filling the hole
 /// position with the value that was originally removed.
index af9a7074e4a4f96d9916ae126ac8f936879cf2e2..fa74dce2f1f4a2c45df841078c157bc837bb9bab 100644 (file)
@@ -258,7 +258,7 @@ pub fn range<K: ?Sized, R>(&self, range: R) -> Range<T>
     }
 
     /// Visits the values representing the difference,
-    /// i.e. the values that are in `self` but not in `other`,
+    /// i.e., the values that are in `self` but not in `other`,
     /// in ascending order.
     ///
     /// # Examples
@@ -286,7 +286,7 @@ pub fn difference<'a>(&'a self, other: &'a BTreeSet<T>) -> Difference<'a, T> {
     }
 
     /// Visits the values representing the symmetric difference,
-    /// i.e. the values that are in `self` or in `other` but not in both,
+    /// i.e., the values that are in `self` or in `other` but not in both,
     /// in ascending order.
     ///
     /// # Examples
@@ -316,7 +316,7 @@ pub fn symmetric_difference<'a>(&'a self,
     }
 
     /// Visits the values representing the intersection,
-    /// i.e. the values that are both in `self` and `other`,
+    /// i.e., the values that are both in `self` and `other`,
     /// in ascending order.
     ///
     /// # Examples
@@ -344,7 +344,7 @@ pub fn intersection<'a>(&'a self, other: &'a BTreeSet<T>) -> Intersection<'a, T>
     }
 
     /// Visits the values representing the union,
-    /// i.e. all the values in `self` or `other`, without duplicates,
+    /// i.e., all the values in `self` or `other`, without duplicates,
     /// in ascending order.
     ///
     /// # Examples
@@ -455,7 +455,7 @@ pub fn is_disjoint(&self, other: &BTreeSet<T>) -> bool {
     }
 
     /// Returns `true` if the set is a subset of another,
-    /// i.e. `other` contains at least all the values in `self`.
+    /// i.e., `other` contains at least all the values in `self`.
     ///
     /// # Examples
     ///
@@ -498,7 +498,7 @@ pub fn is_subset(&self, other: &BTreeSet<T>) -> bool {
     }
 
     /// Returns `true` if the set is a superset of another,
-    /// i.e. `self` contains at least all the values in `other`.
+    /// i.e., `self` contains at least all the values in `other`.
     ///
     /// # Examples
     ///
index e87bf78561c615fbbaff275f2a07b4e8eb8797c3..f4674b327695e834e900d8231a005f1b9fee03f6 100644 (file)
@@ -739,7 +739,7 @@ fn drop(&mut self) {
 // On 64-bit we just need to check for overflow since trying to allocate
 // `> isize::MAX` bytes will surely fail. On 32-bit and 16-bit we need to add
 // an extra guard for this in case we're running on a platform which can use
-// all 4GB in user-space. e.g. PAE or x32
+// all 4GB in user-space. e.g., PAE or x32
 
 #[inline]
 fn alloc_guard(alloc_size: usize) -> Result<(), CollectionAllocErr> {
index c0a947e701108fe587a89cf43abf78598096a7a9..52ad30c411a10c0aac16a379a6a2a45642ad4852 100644 (file)
@@ -276,7 +276,7 @@ struct RcBox<T: ?Sized> {
 /// See the [module-level documentation](./index.html) for more details.
 ///
 /// The inherent methods of `Rc` are all associated functions, which means
-/// that you have to call them as e.g. [`Rc::get_mut(&mut value)`][get_mut] instead of
+/// that you have to call them as e.g., [`Rc::get_mut(&mut value)`][get_mut] instead of
 /// `value.get_mut()`. This avoids conflicts with methods of the inner
 /// type `T`.
 ///
@@ -1252,7 +1252,7 @@ pub fn upgrade(&self) -> Option<Rc<T>> {
     }
 
     /// Return `None` when the pointer is dangling and there is no allocated `RcBox`,
-    /// i.e. this `Weak` was created by `Weak::new`
+    /// i.e., this `Weak` was created by `Weak::new`
     #[inline]
     fn inner(&self) -> Option<&RcBox<T>> {
         if is_dangling(self.ptr) {
index 22da9dd6e9619804beece5a0487977d82288a15a..a8e9a2f5a390f79d96f592b1a70b1b6f7f52549a 100644 (file)
@@ -177,7 +177,7 @@ pub fn to_vec<T>(s: &[T]) -> Vec<T>
 impl<T> [T] {
     /// Sorts the slice.
     ///
-    /// This sort is stable (i.e. does not reorder equal elements) and `O(n log n)` worst-case.
+    /// This sort is stable (i.e., does not reorder equal elements) and `O(n log n)` worst-case.
     ///
     /// When applicable, unstable sorting is preferred because it is generally faster than stable
     /// sorting and it doesn't allocate auxiliary memory.
@@ -211,7 +211,7 @@ pub fn sort(&mut self)
 
     /// Sorts the slice with a comparator function.
     ///
-    /// This sort is stable (i.e. does not reorder equal elements) and `O(n log n)` worst-case.
+    /// This sort is stable (i.e., does not reorder equal elements) and `O(n log n)` worst-case.
     ///
     /// The comparator function must define a total ordering for the elements in the slice. If
     /// the ordering is not total, the order of the elements is unspecified. An order is a
@@ -264,7 +264,7 @@ pub fn sort_by<F>(&mut self, mut compare: F)
 
     /// Sorts the slice with a key extraction function.
     ///
-    /// This sort is stable (i.e. does not reorder equal elements) and `O(m n log(m n))`
+    /// This sort is stable (i.e., does not reorder equal elements) and `O(m n log(m n))`
     /// worst-case, where the key function is `O(m)`.
     ///
     /// When applicable, unstable sorting is preferred because it is generally faster than stable
@@ -301,10 +301,10 @@ pub fn sort_by_key<K, F>(&mut self, mut f: F)
     ///
     /// During sorting, the key function is called only once per element.
     ///
-    /// This sort is stable (i.e. does not reorder equal elements) and `O(m n + n log n)`
+    /// This sort is stable (i.e., does not reorder equal elements) and `O(m n + n log n)`
     /// worst-case, where the key function is `O(m)`.
     ///
-    /// For simple key functions (e.g. functions that are property accesses or
+    /// For simple key functions (e.g., functions that are property accesses or
     /// basic operations), [`sort_by_key`](#method.sort_by_key) is likely to be
     /// faster.
     ///
index 0a397f79103dbbf5826f61b8a54322e483485fc8..111459d12a4df1dd9495d696c611f3e5eaa0d23c 100644 (file)
@@ -1121,7 +1121,7 @@ pub fn upgrade(&self) -> Option<Arc<T>> {
     }
 
     /// Return `None` when the pointer is dangling and there is no allocated `ArcInner`,
-    /// i.e. this `Weak` was created by `Weak::new`
+    /// i.e., this `Weak` was created by `Weak::new`
     #[inline]
     fn inner(&self) -> Option<&ArcInner<T>> {
         if is_dangling(self.ptr) {
index a50f99b00220aaf68ed92bcbea68cf5138c239a5..787e4952882e9ea097ccddfb8646292293881e5a 100644 (file)
@@ -484,7 +484,7 @@ fn test_sort_stability() {
             // create a vector like [(6, 1), (5, 1), (6, 2), ...],
             // where the first item of each tuple is random, but
             // the second item represents which occurrence of that
-            // number this element is, i.e. the second elements
+            // number this element is, i.e., the second elements
             // will occur in sorted order.
             let mut orig: Vec<_> = (0..len)
                 .map(|_| {
@@ -502,7 +502,7 @@ fn test_sort_stability() {
             // This comparison includes the count (the second item
             // of the tuple), so elements with equal first items
             // will need to be ordered with increasing
-            // counts... i.e. exactly asserting that this sort is
+            // counts... i.e., exactly asserting that this sort is
             // stable.
             assert!(v.windows(2).all(|w| w[0] <= w[1]));
 
@@ -1579,7 +1579,7 @@ macro_rules! test {
             }).join();
 
             // Check that the number of things dropped is exactly
-            // what we expect (i.e. the contents of `v`).
+            // what we expect (i.e., the contents of `v`).
             for (i, c) in DROP_COUNTS.iter().enumerate().take(len) {
                 let count = c.load(Relaxed);
                 assert!(count == 1,
index 494b36f85417d9fdac22b6c0da9051813376bf46..683ce2bf112454c7659926185be69a90784a8e96 100644 (file)
@@ -1005,7 +1005,7 @@ fn test_escape_debug() {
     // Note that there are subtleties with the number of backslashes
     // on the left- and right-hand sides. In particular, Unicode code points
     // are usually escaped with two backslashes on the right-hand side, as
-    // they are escaped. However, when the character is unescaped (e.g. for
+    // they are escaped. However, when the character is unescaped (e.g., for
     // printable characters), only a single backslash appears (as the character
     // itself appears in the debug string).
     assert_eq!("abc".escape_debug(), "abc");
index ca7c766e413307a268a828212b31f84ae57db622..63af69dda1dce8d82abb81ba401239f1279b8de2 100644 (file)
 /// about its design. This ensures that it's as low-overhead as possible in
 /// the general case, and can be correctly manipulated in primitive ways
 /// by unsafe code. Note that these guarantees refer to an unqualified `Vec<T>`.
-/// If additional type parameters are added (e.g. to support custom allocators),
+/// If additional type parameters are added (e.g., to support custom allocators),
 /// overriding their defaults may change the behavior.
 ///
 /// Most fundamentally, `Vec` is and always will be a (pointer, capacity, length)
index 58639808faedbfc5c3e28fe2e73ad1b0d8cb6838..8db7d33bdecaa1a3490b2c490b24ff73d4c6f639 100644 (file)
@@ -69,7 +69,7 @@ impl Layout {
     /// * `align` must be a power of two,
     ///
     /// * `size`, when rounded up to the nearest multiple of `align`,
-    ///    must not overflow (i.e. the rounded value must be less than
+    ///    must not overflow (i.e., the rounded value must be less than
     ///    `usize::MAX`).
     #[stable(feature = "alloc_layout", since = "1.28.0")]
     #[inline]
@@ -177,7 +177,7 @@ pub fn align_to(&self, align: usize) -> Result<Self, LayoutErr> {
     /// to ensure that the following address will satisfy `align`
     /// (measured in bytes).
     ///
-    /// E.g. if `self.size()` is 9, then `self.padding_needed_for(4)`
+    /// e.g., if `self.size()` is 9, then `self.padding_needed_for(4)`
     /// returns 3, because that is the minimum number of bytes of
     /// padding required to get a 4-aligned address (assuming that the
     /// corresponding memory block starts at a 4-aligned address).
@@ -455,7 +455,7 @@ pub unsafe trait GlobalAlloc {
     /// if the caller does not ensure that `layout` has non-zero size.
     ///
     /// (Extension subtraits might provide more specific bounds on
-    /// behavior, e.g. guarantee a sentinel address or a null pointer
+    /// behavior, e.g., guarantee a sentinel address or a null pointer
     /// in response to a zero-size allocation request.)
     ///
     /// The allocated block of memory may or may not be initialized.
@@ -550,10 +550,10 @@ unsafe fn alloc_zeroed(&self, layout: Layout) -> *mut u8 {
     /// * `new_size` must be greater than zero.
     ///
     /// * `new_size`, when rounded up to the nearest multiple of `layout.align()`,
-    ///   must not overflow (i.e. the rounded value must be less than `usize::MAX`).
+    ///   must not overflow (i.e., the rounded value must be less than `usize::MAX`).
     ///
     /// (Extension subtraits might provide more specific bounds on
-    /// behavior, e.g. guarantee a sentinel address or a null pointer
+    /// behavior, e.g., guarantee a sentinel address or a null pointer
     /// in response to a zero-size allocation request.)
     ///
     /// # Errors
@@ -616,7 +616,7 @@ unsafe fn realloc(&self, ptr: *mut u8, layout: Layout, new_size: usize) -> *mut
 ///   whether to return `Err`, or to return `Ok` with some pointer.
 ///
 /// * If an `Alloc` implementation chooses to return `Ok` in this
-///   case (i.e. the pointer denotes a zero-sized inaccessible block)
+///   case (i.e., the pointer denotes a zero-sized inaccessible block)
 ///   then that returned pointer must be considered "currently
 ///   allocated". On such an allocator, *all* methods that take
 ///   currently-allocated pointers as inputs must accept these
@@ -651,7 +651,7 @@ unsafe fn realloc(&self, ptr: *mut u8, layout: Layout, new_size: usize) -> *mut
 ///
 ///  * if a layout `k` fits a memory block (denoted by `ptr`)
 ///    currently allocated via an allocator `a`, then it is legal to
-///    use that layout to deallocate it, i.e. `a.dealloc(ptr, k);`.
+///    use that layout to deallocate it, i.e., `a.dealloc(ptr, k);`.
 ///
 /// # Unsafety
 ///
@@ -673,7 +673,7 @@ pub unsafe trait Alloc {
 
     // (Note: some existing allocators have unspecified but well-defined
     // behavior in response to a zero size allocation request ;
-    // e.g. in C, `malloc` of 0 will either return a null pointer or a
+    // e.g., in C, `malloc` of 0 will either return a null pointer or a
     // unique pointer, but will not have arbitrary undefined
     // behavior.
     // However in jemalloc for example,
@@ -688,7 +688,7 @@ pub unsafe trait Alloc {
     ///
     /// The returned block of storage may or may not have its contents
     /// initialized. (Extension subtraits might restrict this
-    /// behavior, e.g. to ensure initialization to particular sets of
+    /// behavior, e.g., to ensure initialization to particular sets of
     /// bit patterns.)
     ///
     /// # Safety
@@ -697,7 +697,7 @@ pub unsafe trait Alloc {
     /// if the caller does not ensure that `layout` has non-zero size.
     ///
     /// (Extension subtraits might provide more specific bounds on
-    /// behavior, e.g. guarantee a sentinel address or a null pointer
+    /// behavior, e.g., guarantee a sentinel address or a null pointer
     /// in response to a zero-size allocation request.)
     ///
     /// # Errors
@@ -803,10 +803,10 @@ fn usable_size(&self, layout: &Layout) -> (usize, usize) {
     /// * `new_size` must be greater than zero.
     ///
     /// * `new_size`, when rounded up to the nearest multiple of `layout.align()`,
-    ///   must not overflow (i.e. the rounded value must be less than `usize::MAX`).
+    ///   must not overflow (i.e., the rounded value must be less than `usize::MAX`).
     ///
     /// (Extension subtraits might provide more specific bounds on
-    /// behavior, e.g. guarantee a sentinel address or a null pointer
+    /// behavior, e.g., guarantee a sentinel address or a null pointer
     /// in response to a zero-size allocation request.)
     ///
     /// # Errors
index c2113dfd2a06714e5224dc58a59585b4a9d5b74c..f521ab994cd9fefbafb8575409a3b5c92992df03 100644 (file)
@@ -126,7 +126,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
     }
 }
 
-// Ensure that the result of e.g. joining a thread can be printed and
+// Ensure that the result of e.g., joining a thread can be printed and
 // hence used with `unwrap`. May eventually no longer be needed if
 // dispatch works with upcasting.
 #[stable(feature = "rust1", since = "1.0.0")]
index d8d51f53377f724e229f92f7b6ab546fcd16fa46..0a16c92928d444c46fcec8752b652d9d29f22603 100644 (file)
@@ -97,7 +97,7 @@
 //! ## Implementation details of logically-immutable methods
 //!
 //! Occasionally it may be desirable not to expose in an API that there is mutation happening
-//! "under the hood". This may be because logically the operation is immutable, but e.g. caching
+//! "under the hood". This may be because logically the operation is immutable, but e.g., caching
 //! forces the implementation to perform mutation; or because you must employ mutation to implement
 //! a trait method that was originally defined to take `&self`.
 //!
@@ -1227,7 +1227,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
 }
 
 impl<'b, T: ?Sized> RefMut<'b, T> {
-    /// Make a new `RefMut` for a component of the borrowed data, e.g. an enum
+    /// Make a new `RefMut` for a component of the borrowed data, e.g., an enum
     /// variant.
     ///
     /// The `RefCell` is already mutably borrowed, so this cannot fail.
index 7e1313747eef205f2d92d6e54645b8914159216a..e07a0f5d712b03cf75332e53925cdbbc4ac2657a 100644 (file)
@@ -131,7 +131,7 @@ pub struct EscapeUnicode {
     state: EscapeUnicodeState,
 
     // The index of the next hex digit to be printed (0 if none),
-    // i.e. the number of remaining hex digits to be printed;
+    // i.e., the number of remaining hex digits to be printed;
     // increasing from the least significant digit: 0x543210
     hex_digit_idx: usize,
 }
index 46bb580dcddb1af2d8e80152be0a5ccca040b0ac..225ea3de9cd686f5f40fa6e8898156218dbb05f4 100644 (file)
@@ -13,7 +13,7 @@
 //! In Rust, some simple types are "implicitly copyable" and when you
 //! assign them or pass them as arguments, the receiver will get a copy,
 //! leaving the original value in place. These types do not require
-//! allocation to copy and do not have finalizers (i.e. they do not
+//! allocation to copy and do not have finalizers (i.e., they do not
 //! contain owned boxes or implement [`Drop`]), so the compiler considers
 //! them cheap and safe to copy. For other types copies must be made
 //! explicitly, by convention implementing the [`Clone`] trait and calling
 /// In addition to the [implementors listed below][impls],
 /// the following types also implement `Clone`:
 ///
-/// * Function item types (i.e. the distinct types defined for each function)
-/// * Function pointer types (e.g. `fn() -> i32`)
-/// * Array types, for all sizes, if the item type also implements `Clone` (e.g. `[i32; 123456]`)
-/// * Tuple types, if each component also implements `Clone` (e.g. `()`, `(i32, bool)`)
+/// * Function item types (i.e., the distinct types defined for each function)
+/// * Function pointer types (e.g., `fn() -> i32`)
+/// * Array types, for all sizes, if the item type also implements `Clone` (e.g., `[i32; 123456]`)
+/// * Tuple types, if each component also implements `Clone` (e.g., `()`, `(i32, bool)`)
 /// * Closure types, if they capture no value from the environment
 ///   or if all such captured values implement `Clone` themselves.
 ///   Note that variables captured by shared reference always implement `Clone`
index edeb3b0d368b3077b4e7982c4a46a3ab5bf2a05a..1dbf03923e11bc8532c2cdd05411aa4a76d08c5e 100644 (file)
@@ -18,7 +18,7 @@
 ///
 /// [`!`]: ../../std/primitive.never.html
 /// [pointer]: ../../std/primitive.pointer.html
-// NB: For LLVM to recognize the void pointer type and by extension
+// N.B., for LLVM to recognize the void pointer type and by extension
 //     functions like malloc(), we need to have it represented as i8* in
 //     LLVM bitcode. The enum used here ensures this and prevents misuse
 //     of the "raw" type by only having private variants.. We need two
index bbebadd452a269a8474c297fb9756afde65a5ba7..3e59ee1f8e5f5efdc243fc4afe5c1d3586cd9c1d 100644 (file)
@@ -408,7 +408,7 @@ fn write_isize(&mut self, i: isize) {
 
 /// A trait for creating instances of [`Hasher`].
 ///
-/// A `BuildHasher` is typically used (e.g. by [`HashMap`]) to create
+/// A `BuildHasher` is typically used (e.g., by [`HashMap`]) to create
 /// [`Hasher`]s for each key such that they are hashed independently of one
 /// another, since [`Hasher`]s contain state.
 ///
index f4e96e67b2c66aeea3b8b7b73e7949fd2d1ffba2..0bfdd937abd630c1431100f9aa5139b7b6be8b0c 100644 (file)
@@ -24,7 +24,7 @@
 /// therefore will eliminate all branches that reach to a call to
 /// `unreachable_unchecked()`.
 ///
-/// Like all instances of UB, if this assumption turns out to be wrong, i.e. the
+/// Like all instances of UB, if this assumption turns out to be wrong, i.e., the
 /// `unreachable_unchecked()` call is actually reachable among all possible
 /// control flow, the compiler will apply the wrong optimization strategy, and
 /// may sometimes even corrupt seemingly unrelated code, causing
index 16f0299c18b9a21f37c0ffec6410503f1c84d2f8..eebb98b5e6d4580727bb8ceacab2204029e897ca 100644 (file)
@@ -52,7 +52,7 @@
 pub use ptr::drop_in_place;
 
 extern "rust-intrinsic" {
-    // NB: These intrinsics take raw pointers because they mutate aliased
+    // N.B., these intrinsics take raw pointers because they mutate aliased
     // memory, which is not valid for either `&` or `&mut`.
 
     /// Stores a value if the current value is the same as the `old` value.
     /// Tells LLVM that this point in the code is not reachable, enabling
     /// further optimizations.
     ///
-    /// NB: This is very different from the `unreachable!()` macro: Unlike the
+    /// N.B., this is very different from the `unreachable!()` macro: Unlike the
     /// macro, which panics when it is executed, it is *undefined behavior* to
     /// reach code marked with this function.
     ///
index 3063cb1a7df440022fcd58d6a7a11f8ab010a500..92a4aed4e27e586c2eced47623495fc93b40694e 100644 (file)
@@ -154,7 +154,7 @@ pub trait Iterator {
     ///
     /// `size_hint()` is primarily intended to be used for optimizations such as
     /// reserving space for the elements of the iterator, but must not be
-    /// trusted to e.g. omit bounds checks in unsafe code. An incorrect
+    /// trusted to e.g., omit bounds checks in unsafe code. An incorrect
     /// implementation of `size_hint()` should not lead to memory safety
     /// violations.
     ///
index d2c5a3bed2869aa137a91b7af1dc225ced0a29d2..45e5b614db3e0bdea9940be4ec47b57987900bcb 100644 (file)
@@ -770,7 +770,7 @@ pub trait Product<A = Self>: Sized {
     fn product<I: Iterator<Item=A>>(iter: I) -> Self;
 }
 
-// NB: explicitly use Add and Mul here to inherit overflow checks
+// N.B., explicitly use Add and Mul here to inherit overflow checks
 macro_rules! integer_sum_product {
     (@impls $zero:expr, $one:expr, #[$attr:meta], $($a:ty)*) => ($(
         #[$attr]
index 23f07773f3f3431186d62c1d5a1eac4c04c77624..0d43f927115f8dd7bf20a4169bb6570a09827a48 100644 (file)
@@ -274,10 +274,10 @@ pub trait Unsize<T: ?Sized> {
 /// In addition to the [implementors listed below][impls],
 /// the following types also implement `Copy`:
 ///
-/// * Function item types (i.e. the distinct types defined for each function)
-/// * Function pointer types (e.g. `fn() -> i32`)
-/// * Array types, for all sizes, if the item type also implements `Copy` (e.g. `[i32; 123456]`)
-/// * Tuple types, if each component also implements `Copy` (e.g. `()`, `(i32, bool)`)
+/// * Function item types (i.e., the distinct types defined for each function)
+/// * Function pointer types (e.g., `fn() -> i32`)
+/// * Array types, for all sizes, if the item type also implements `Copy` (e.g., `[i32; 123456]`)
+/// * Tuple types, if each component also implements `Copy` (e.g., `()`, `(i32, bool)`)
 /// * Closure types, if they capture no value from the environment
 ///   or if all such captured values implement `Copy` themselves.
 ///   Note that variables captured by shared reference always implement `Copy`
index e4b2800ae211720a4ee12c42ca09480f4c6043bc..06754f17a6f6d972093501e1c366c43a30cbaf68 100644 (file)
@@ -305,7 +305,7 @@ pub const fn size_of<T>() -> usize {
 /// Returns the size of the pointed-to value in bytes.
 ///
 /// This is usually the same as `size_of::<T>()`. However, when `T` *has* no
-/// statically known size, e.g. a slice [`[T]`][slice] or a [trait object],
+/// statically known size, e.g., a slice [`[T]`][slice] or a [trait object],
 /// then `size_of_val` can be used to get the dynamically-known size.
 ///
 /// [slice]: ../../std/primitive.slice.html
@@ -1119,7 +1119,7 @@ pub unsafe fn get_ref(&self) -> &T {
     /// 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)]
index 732a02e8c427dd6a0bdc36e3c31f334c052bd295..2bfb49c0682bb1b62df46ac3a51d5d294f930207 100644 (file)
@@ -183,7 +183,7 @@ pub fn bit_length(&self) -> usize {
                 let nonzero = &digits[..end];
 
                 if nonzero.is_empty() {
-                    // There are no non-zero digits, i.e. the number is zero.
+                    // There are no non-zero digits, i.e., the number is zero.
                     return 0;
                 }
                 // This could be optimized with leading_zeros() and bit shifts, but that's
index ccf3950c2ba396920c1500aa650af46aa40cf7e6..c3a983d0f0e5b188408cfdb92bfc4a90204fe9ad 100644 (file)
@@ -61,9 +61,9 @@ mod fpu_precision {
     ///
     /// The only field which is relevant for the following code is PC, Precision Control. This
     /// field determines the precision of the operations performed by the  FPU. It can be set to:
-    ///  - 0b00, single precision i.e. 32-bits
-    ///  - 0b10, double precision i.e. 64-bits
-    ///  - 0b11, double extended precision i.e. 80-bits (default state)
+    ///  - 0b00, single precision i.e., 32-bits
+    ///  - 0b10, double precision i.e., 64-bits
+    ///  - 0b11, double extended precision i.e., 80-bits (default state)
     /// The 0b01 value is reserved and should not be used.
     pub struct FPUControlWord(u16);
 
index 38f4e4687a99b6358b946eb7ced49fd7796bcb2e..18c30e29c796743e999be3b59e1e6bd3a55766b1 100644 (file)
@@ -349,7 +349,7 @@ pub fn prev_float<T: RawFloat>(x: T) -> T {
 }
 
 // Find the smallest floating point number strictly larger than the argument.
-// This operation is saturating, i.e. next_float(inf) == inf.
+// This operation is saturating, i.e., next_float(inf) == inf.
 // Unlike most code in this module, this function does handle zero, subnormals, and infinities.
 // However, like all other code here, it does not deal with NaN and negative numbers.
 pub fn next_float<T: RawFloat>(x: T) -> T {
index d58015beecb1e7172f38cf54706dfe5d3411cf13..097240e58ae50b6574f87a31911009bc0f462d42 100644 (file)
@@ -23,7 +23,7 @@
 - `d[0]` is non-zero.
 
 - It's correctly rounded when parsed back: `v - minus < V < v + plus`.
-  Furthermore it is shortest such one, i.e. there is no representation
+  Furthermore it is shortest such one, i.e., there is no representation
   with less than `n` digits that is correctly rounded.
 
 - It's closest to the original value: `abs(V - v) <= 10^(k-n) / 2`. Note that
@@ -398,7 +398,7 @@ fn determine_sign(sign: Sign, decoded: &FullDecoded, negative: bool) -> &'static
 /// given number of fractional digits. The result is stored to the supplied parts
 /// array while utilizing given byte buffer as a scratch. `upper` is currently
 /// unused but left for the future decision to change the case of non-finite values,
-/// i.e. `inf` and `nan`. The first part to be rendered is always a `Part::Sign`
+/// i.e., `inf` and `nan`. The first part to be rendered is always a `Part::Sign`
 /// (which can be an empty string if no sign is rendered).
 ///
 /// `format_shortest` should be the underlying digit-generation function.
@@ -591,7 +591,7 @@ pub fn to_exact_exp_str<'a, T, F>(mut format_exact: F, v: T,
 /// given number of fractional digits. The result is stored to the supplied parts
 /// array while utilizing given byte buffer as a scratch. `upper` is currently
 /// unused but left for the future decision to change the case of non-finite values,
-/// i.e. `inf` and `nan`. The first part to be rendered is always a `Part::Sign`
+/// i.e., `inf` and `nan`. The first part to be rendered is always a `Part::Sign`
 /// (which can be an empty string if no sign is rendered).
 ///
 /// `format_exact` should be the underlying digit-generation function.
index aa6a08cb2057ea34a4e1faed0dfa1c700a56b5a6..cda0773afbd5b810da08ce6b8f928457189db848 100644 (file)
@@ -81,11 +81,11 @@ pub fn format_shortest(d: &Decoded, buf: &mut [u8]) -> (/*#digits*/ usize, /*exp
     // - followed by `(mant + 2 * plus) * 2^exp` in the original type.
     //
     // obviously, `minus` and `plus` cannot be zero. (for infinities, we use out-of-range values.)
-    // also we assume that at least one digit is generated, i.e. `mant` cannot be zero too.
+    // also we assume that at least one digit is generated, i.e., `mant` cannot be zero too.
     //
     // this also means that any number between `low = (mant - minus) * 2^exp` and
     // `high = (mant + plus) * 2^exp` will map to this exact floating point number,
-    // with bounds included when the original mantissa was even (i.e. `!mant_was_odd`).
+    // with bounds included when the original mantissa was even (i.e., `!mant_was_odd`).
 
     assert!(d.mant > 0);
     assert!(d.minus > 0);
@@ -172,7 +172,7 @@ pub fn format_shortest(d: &Decoded, buf: &mut [u8]) -> (/*#digits*/ usize, /*exp
         // - `high - v = plus / scale * 10^(k-n)`
         //
         // assume that `d[0..n-1]` is the shortest representation between `low` and `high`,
-        // i.e. `d[0..n-1]` satisfies both of the following but `d[0..n-2]` doesn't:
+        // i.e., `d[0..n-1]` satisfies both of the following but `d[0..n-2]` doesn't:
         // - `low < d[0..n-1] * 10^(k-n) < high` (bijectivity: digits round to `v`); and
         // - `abs(v / 10^(k-n) - d[0..n-1]) <= 1/2` (the last digit is correct).
         //
@@ -304,7 +304,7 @@ pub fn format_exact(d: &Decoded, buf: &mut [u8], limit: i16) -> (/*#digits*/ usi
 
     // rounding up if we stop in the middle of digits
     // if the following digits are exactly 5000..., check the prior digit and try to
-    // round to even (i.e. avoid rounding up when the prior digit is even).
+    // round to even (i.e., avoid rounding up when the prior digit is even).
     let order = mant.cmp(scale.mul_small(5));
     if order == Ordering::Greater || (order == Ordering::Equal &&
                                       (len == 0 || buf[len-1] & 1 == 1)) {
index effe073c3816c4936eabadc58944a62679c34f7f..3e76feca885bc1bfdaefd8aefd21609a0dd1cc0b 100644 (file)
@@ -242,7 +242,7 @@ pub fn format_shortest_opt(d: &Decoded,
     //
     // find the digit length `kappa` between `(minus1, plus1)` as per Theorem 6.2.
     // Theorem 6.2 can be adopted to exclude `x` by requiring `y mod 10^k < y - x` instead.
-    // (e.g. `x` = 32000, `y` = 32777; `kappa` = 2 since `y mod 10^3 = 777 < y - x = 777`.)
+    // (e.g., `x` = 32000, `y` = 32777; `kappa` = 2 since `y mod 10^3 = 777 < y - x = 777`.)
     // the algorithm relies on the later verification phase to exclude `y`.
     let delta1 = plus1 - minus1;
 //  let delta1int = (delta1 >> e) as usize; // only for explanation
@@ -362,19 +362,19 @@ fn round_and_weed(buf: &mut [u8], exp: i16, remainder: u64, threshold: u64, plus
             // proceed, but we then have at least one valid representation known to be closest to
             // `v + 1 ulp` anyway. we will denote them as TC1 through TC3 for brevity.
             //
-            // TC1: `w(n) <= v + 1 ulp`, i.e. this is the last repr that can be the closest one.
+            // TC1: `w(n) <= v + 1 ulp`, i.e., this is the last repr that can be the closest one.
             // this is equivalent to `plus1 - w(n) = plus1w(n) >= plus1 - (v + 1 ulp) = plus1v_up`.
             // combined with TC2 (which checks if `w(n+1)` is valid), this prevents the possible
             // overflow on the calculation of `plus1w(n)`.
             //
-            // TC2: `w(n+1) < minus1`, i.e. the next repr definitely does not round to `v`.
+            // TC2: `w(n+1) < minus1`, i.e., the next repr definitely does not round to `v`.
             // this is equivalent to `plus1 - w(n) + 10^kappa = plus1w(n) + 10^kappa >
             // plus1 - minus1 = threshold`. the left hand side can overflow, but we know
             // `threshold > plus1v`, so if TC1 is false, `threshold - plus1w(n) >
             // threshold - (plus1v - 1 ulp) > 1 ulp` and we can safely test if
             // `threshold - plus1w(n) < 10^kappa` instead.
             //
-            // TC3: `abs(w(n) - (v + 1 ulp)) <= abs(w(n+1) - (v + 1 ulp))`, i.e. the next repr is
+            // TC3: `abs(w(n) - (v + 1 ulp)) <= abs(w(n+1) - (v + 1 ulp))`, i.e., the next repr is
             // no closer to `v + 1 ulp` than the current repr. given `z(n) = plus1v_up - plus1w(n)`,
             // this becomes `abs(z(n)) <= abs(z(n+1))`. again assuming that TC1 is false, we have
             // `z(n) > 0`. we have two cases to consider:
@@ -384,7 +384,7 @@ fn round_and_weed(buf: &mut [u8], exp: i16, remainder: u64, threshold: u64, plus
             // - when `z(n+1) < 0`:
             //   - TC3a: the precondition is `plus1v_up < plus1w(n) + 10^kappa`. assuming TC2 is
             //     false, `threshold >= plus1w(n) + 10^kappa` so it cannot overflow.
-            //   - TC3b: TC3 becomes `z(n) <= -z(n+1)`, i.e. `plus1v_up - plus1w(n) >=
+            //   - TC3b: TC3 becomes `z(n) <= -z(n+1)`, i.e., `plus1v_up - plus1w(n) >=
             //     plus1w(n+1) - plus1v_up = plus1w(n) + 10^kappa - plus1v_up`. the negated TC1
             //     gives `plus1v_up > plus1w(n)`, so it cannot overflow or underflow when
             //     combined with TC3a.
@@ -414,7 +414,7 @@ fn round_and_weed(buf: &mut [u8], exp: i16, remainder: u64, threshold: u64, plus
 
         // now we have the closest representation to `v` between `plus1` and `minus1`.
         // this is too liberal, though, so we reject any `w(n)` not between `plus0` and `minus0`,
-        // i.e. `plus1 - plus1w(n) <= minus0` or `plus1 - plus1w(n) >= plus0`. we utilize the facts
+        // i.e., `plus1 - plus1w(n) <= minus0` or `plus1 - plus1w(n) >= plus0`. we utilize the facts
         // that `threshold = plus1 - minus1` and `plus1 - plus0 = minus0 - minus1 = 2 ulp`.
         if 2 * ulp <= plus1w && plus1w <= threshold - 4 * ulp {
             Some((buf.len(), exp))
@@ -675,7 +675,7 @@ fn possibly_round(buf: &mut [u8], mut len: usize, mut exp: i16, limit: i16,
             return Some((len, exp));
         }
 
-        // otherwise we are doomed (i.e. some values between `v - 1 ulp` and `v + 1 ulp` are
+        // otherwise we are doomed (i.e., some values between `v - 1 ulp` and `v + 1 ulp` are
         // rounding down and others are rounding up) and give up.
         None
     }
index 7f5d596b220b9e99fdf604d86467a7d28c51f351..13b422162f3d600d9b119c24b56e9f85918468b1 100644 (file)
@@ -1544,7 +1544,7 @@ pub fn overflowing_mod_euc(self, rhs: Self) -> (Self, bool) {
             concat!("Negates self, overflowing if this is equal to the minimum value.
 
 Returns a tuple of the negated version of self along with a boolean indicating whether an overflow
-happened. If `self` is the minimum value (e.g. `i32::MIN` for values of type `i32`), then the
+happened. If `self` is the minimum value (e.g., `i32::MIN` for values of type `i32`), then the
 minimum value will be returned again and `true` will be returned for an overflow happening.
 
 # Examples
@@ -1621,7 +1621,7 @@ pub const fn overflowing_shr(self, rhs: u32) -> (Self, bool) {
             concat!("Computes the absolute value of `self`.
 
 Returns a tuple of the absolute version of self along with a boolean indicating whether an overflow
-happened. If self is the minimum value (e.g. ", stringify!($SelfT), "::MIN for values of type
+happened. If self is the minimum value (e.g., ", stringify!($SelfT), "::MIN for values of type
  ", stringify!($SelfT), "), then the minimum value will be returned again and true will be returned
 for an overflow happening.
 
@@ -3617,7 +3617,7 @@ fn one_less_than_next_power_of_two(self) -> Self {
         doc_comment! {
             concat!("Returns the smallest power of two greater than or equal to `self`.
 
-When return value overflows (i.e. `self > (1 << (N-1))` for type
+When return value overflows (i.e., `self > (1 << (N-1))` for type
 `uN`), it panics in debug mode and return value is wrapped to 0 in
 release mode (the only situation in which method can return 0).
 
@@ -4827,7 +4827,7 @@ fn from_str_radix<T: FromStrRadixHelper>(src: &str, radix: u32) -> Result<T, Par
 /// # Potential causes
 ///
 /// Among other causes, `ParseIntError` can be thrown because of leading or trailing whitespace
-/// in the string e.g. when it is obtained from the standard input.
+/// in the string e.g., when it is obtained from the standard input.
 /// Using the [`str.trim()`] method ensures that no whitespace remains before parsing.
 ///
 /// [`str.trim()`]: ../../std/primitive.str.html#method.trim
index 00134a58d30f1c2e00a5917b4db3a25a0516fbaa..94dd657ec97c5e5295822c15b9be4b871234eb2f 100644 (file)
@@ -865,7 +865,7 @@ pub fn is_power_of_two(self) -> bool {
             doc_comment! {
                 concat!("Returns the smallest power of two greater than or equal to `self`.
 
-When return value overflows (i.e. `self > (1 << (N-1))` for type
+When return value overflows (i.e., `self > (1 << (N-1))` for type
 `uN`), overflows to `2^N = 0`.
 
 # Examples
index c9591c3f57bb0fd74b3f34f274b8fe0e85e502e1..d1be724c3264e6c1a7430d94878bb8d1d55eee8b 100644 (file)
@@ -26,7 +26,7 @@
 /// is expected.
 ///
 /// Use `Fn` as a bound when you want to accept a parameter of function-like
-/// type and need to call it repeatedly and without mutating state (e.g. when
+/// type and need to call it repeatedly and without mutating state (e.g., when
 /// calling it concurrently). If you do not need such strict requirements, use
 /// [`FnMut`] or [`FnOnce`] as bounds.
 ///
@@ -84,7 +84,7 @@ pub trait Fn<Args> : FnMut<Args> {
 ///
 /// `FnMut` is implemented automatically by closures which take mutable
 /// references to captured variables, as well as all types that implement
-/// [`Fn`], e.g. (safe) [function pointers][] (since `FnMut` is a supertrait of
+/// [`Fn`], e.g., (safe) [function pointers][] (since `FnMut` is a supertrait of
 /// [`Fn`]). Additionally, for any type `F` that implements `FnMut`, `&mut F`
 /// implements `FnMut`, too.
 ///
@@ -163,7 +163,7 @@ pub trait FnMut<Args> : FnOnce<Args> {
 /// implements `FnOnce`, it can only be called once.
 ///
 /// `FnOnce` is implemented automatically by closure that might consume captured
-/// variables, as well as all types that implement [`FnMut`], e.g. (safe)
+/// variables, as well as all types that implement [`FnMut`], e.g., (safe)
 /// [function pointers][] (since `FnOnce` is a supertrait of [`FnMut`]).
 ///
 /// Since both [`Fn`] and [`FnMut`] are subtraits of `FnOnce`, any instance of
index edfa6df11aceb6e958273084271ccf87762d20e9..785f0733df2b85eb3cdbe9023eb434b2fefc5f4f 100644 (file)
@@ -27,7 +27,7 @@
 //! should have some resemblance to multiplication (and share expected
 //! properties like associativity).
 //!
-//! Note that the `&&` and `||` operators short-circuit, i.e. they only
+//! Note that the `&&` and `||` operators short-circuit, i.e., they only
 //! evaluate their second operand if it contributes to the result. Since this
 //! behavior is not enforceable by traits, `&&` and `||` are not supported as
 //! overloadable operators.
index cf1c77041b91fe24dcf4e92361ad7f018a26cee1..44d632ece055c47513d2010ebb5dc102d3e8bdbc 100644 (file)
@@ -62,7 +62,7 @@
 //! The following example uses [`Option`] to create an optional box of
 //! [`i32`]. Notice that in order to use the inner [`i32`] value first, the
 //! `check_optional` function needs to use pattern matching to
-//! determine whether the box has a value (i.e. it is [`Some(...)`][`Some`]) or
+//! determine whether the box has a value (i.e., it is [`Some(...)`][`Some`]) or
 //! not ([`None`]).
 //!
 //! ```
index 308dd9c79fa374391e1e222d379725c3c968f27d..aa5155536c903cbca88f5554b5c8b2a2e128dfb0 100644 (file)
@@ -9,7 +9,7 @@
 //!
 //! In order to prevent objects from moving, they must be pinned
 //! by wrapping a pointer to the data in the [`Pin`] type. A pointer wrapped
-//! in a `Pin` is otherwise equivalent to its normal version, e.g. `Pin<Box<T>>`
+//! in a `Pin` is otherwise equivalent to its normal version, e.g., `Pin<Box<T>>`
 //! and `Box<T>` work the same way except that the first is pinning the value
 //! of `T` in place.
 //!
index 8630dd402ef68043a34ec9523de66007296ba3fc..a2d32e9d68fb5bf590bb0603066895f3db6b2277 100644 (file)
 ///   dropped normally.
 ///
 /// * It is friendlier to the optimizer to do this over [`ptr::read`] when
-///   dropping manually allocated memory (e.g. when writing Box/Rc/Vec),
+///   dropping manually allocated memory (e.g., when writing Box/Rc/Vec),
 ///   as the compiler doesn't need to prove that it's sound to elide the
 ///   copy.
 ///
@@ -836,7 +836,7 @@ pub unsafe fn write_unaligned<T>(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 no-ops
 /// and may be ignored.
 ///
 /// [c11]: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf
@@ -913,7 +913,7 @@ pub unsafe fn read_volatile<T>(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 no-ops
 /// and may be ignored.
 ///
 /// [c11]: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf
@@ -1035,7 +1035,7 @@ pub unsafe fn as_ref<'a>(self) -> Option<&'a T> {
 
     /// Calculates the offset from a pointer.
     ///
-    /// `count` is in units of T; e.g. a `count` of 3 represents a pointer
+    /// `count` is in units of T; e.g., a `count` of 3 represents a pointer
     /// offset of `3 * size_of::<T>()` bytes.
     ///
     /// # Safety
@@ -1089,7 +1089,7 @@ pub unsafe fn offset(self, count: isize) -> *const T where T: Sized {
 
     /// Calculates the offset from a pointer using wrapping arithmetic.
     ///
-    /// `count` is in units of T; e.g. a `count` of 3 represents a pointer
+    /// `count` is in units of T; e.g., a `count` of 3 represents a pointer
     /// offset of `3 * size_of::<T>()` bytes.
     ///
     /// # Safety
@@ -1253,7 +1253,7 @@ pub fn wrapping_offset_from(self, origin: *const T) -> isize where T: Sized {
 
     /// Calculates the offset from a pointer (convenience for `.offset(count as isize)`).
     ///
-    /// `count` is in units of T; e.g. a `count` of 3 represents a pointer
+    /// `count` is in units of T; e.g., a `count` of 3 represents a pointer
     /// offset of `3 * size_of::<T>()` bytes.
     ///
     /// # Safety
@@ -1310,7 +1310,7 @@ pub unsafe fn add(self, count: usize) -> Self
     /// Calculates the offset from a pointer (convenience for
     /// `.offset((count as isize).wrapping_neg())`).
     ///
-    /// `count` is in units of T; e.g. a `count` of 3 represents a pointer
+    /// `count` is in units of T; e.g., a `count` of 3 represents a pointer
     /// offset of `3 * size_of::<T>()` bytes.
     ///
     /// # Safety
@@ -1367,7 +1367,7 @@ pub unsafe fn sub(self, count: usize) -> Self
     /// Calculates the offset from a pointer using wrapping arithmetic.
     /// (convenience for `.wrapping_offset(count as isize)`)
     ///
-    /// `count` is in units of T; e.g. a `count` of 3 represents a pointer
+    /// `count` is in units of T; e.g., a `count` of 3 represents a pointer
     /// offset of `3 * size_of::<T>()` bytes.
     ///
     /// # Safety
@@ -1408,7 +1408,7 @@ pub fn wrapping_add(self, count: usize) -> Self
     /// Calculates the offset from a pointer using wrapping arithmetic.
     /// (convenience for `.wrapping_offset((count as isize).wrapping_sub())`)
     ///
-    /// `count` is in units of T; e.g. a `count` of 3 represents a pointer
+    /// `count` is in units of T; e.g., a `count` of 3 represents a pointer
     /// offset of `3 * size_of::<T>()` bytes.
     ///
     /// # Safety
@@ -1655,7 +1655,7 @@ pub unsafe fn as_ref<'a>(self) -> Option<&'a T> {
 
     /// Calculates the offset from a pointer.
     ///
-    /// `count` is in units of T; e.g. a `count` of 3 represents a pointer
+    /// `count` is in units of T; e.g., a `count` of 3 represents a pointer
     /// offset of `3 * size_of::<T>()` bytes.
     ///
     /// # Safety
@@ -1708,7 +1708,7 @@ pub unsafe fn offset(self, count: isize) -> *mut T where T: Sized {
     }
 
     /// Calculates the offset from a pointer using wrapping arithmetic.
-    /// `count` is in units of T; e.g. a `count` of 3 represents a pointer
+    /// `count` is in units of T; e.g., a `count` of 3 represents a pointer
     /// offset of `3 * size_of::<T>()` bytes.
     ///
     /// # Safety
@@ -1891,7 +1891,7 @@ pub fn wrapping_offset_from(self, origin: *const T) -> isize where T: Sized {
 
     /// Calculates the offset from a pointer (convenience for `.offset(count as isize)`).
     ///
-    /// `count` is in units of T; e.g. a `count` of 3 represents a pointer
+    /// `count` is in units of T; e.g., a `count` of 3 represents a pointer
     /// offset of `3 * size_of::<T>()` bytes.
     ///
     /// # Safety
@@ -1948,7 +1948,7 @@ pub unsafe fn add(self, count: usize) -> Self
     /// Calculates the offset from a pointer (convenience for
     /// `.offset((count as isize).wrapping_neg())`).
     ///
-    /// `count` is in units of T; e.g. a `count` of 3 represents a pointer
+    /// `count` is in units of T; e.g., a `count` of 3 represents a pointer
     /// offset of `3 * size_of::<T>()` bytes.
     ///
     /// # Safety
@@ -2005,7 +2005,7 @@ pub unsafe fn sub(self, count: usize) -> Self
     /// Calculates the offset from a pointer using wrapping arithmetic.
     /// (convenience for `.wrapping_offset(count as isize)`)
     ///
-    /// `count` is in units of T; e.g. a `count` of 3 represents a pointer
+    /// `count` is in units of T; e.g., a `count` of 3 represents a pointer
     /// offset of `3 * size_of::<T>()` bytes.
     ///
     /// # Safety
@@ -2046,7 +2046,7 @@ pub fn wrapping_add(self, count: usize) -> Self
     /// Calculates the offset from a pointer using wrapping arithmetic.
     /// (convenience for `.wrapping_offset((count as isize).wrapping_sub())`)
     ///
-    /// `count` is in units of T; e.g. a `count` of 3 represents a pointer
+    /// `count` is in units of T; e.g., a `count` of 3 represents a pointer
     /// offset of `3 * size_of::<T>()` bytes.
     ///
     /// # Safety
@@ -2375,7 +2375,7 @@ pub(crate) unsafe fn align_offset<T: Sized>(p: *const T, a: usize) -> usize {
     fn mod_inv(x: usize, m: usize) -> usize {
         /// Multiplicative modular inverse table modulo 2⁴ = 16.
         ///
-        /// Note, that this table does not contain values where inverse does not exist (i.e. for
+        /// Note, that this table does not contain values where inverse does not exist (i.e., for
         /// `0⁻¹ mod 16`, `2⁻¹ mod 16`, etc.)
         const INV_TABLE_MOD_16: [u8; 8] = [1, 11, 13, 7, 9, 3, 5, 15];
         /// Modulo for which the `INV_TABLE_MOD_16` is intended.
@@ -2398,7 +2398,7 @@ fn mod_inv(x: usize, m: usize) -> usize {
                 // y = y * (2 - xy) mod n
                 //
                 // Note, that we use wrapping operations here intentionally – the original formula
-                // uses e.g. subtraction `mod n`. It is entirely fine to do them `mod
+                // uses e.g., subtraction `mod n`. It is entirely fine to do them `mod
                 // usize::max_value()` instead, because we take the result `mod n` at the end
                 // anyway.
                 inverse = inverse.wrapping_mul(
@@ -2887,12 +2887,12 @@ pub struct NonNull<T: ?Sized> {
 }
 
 /// `NonNull` pointers are not `Send` because the data they reference may be aliased.
-// NB: This impl is unnecessary, but should provide better error messages.
+// N.B., this impl is unnecessary, but should provide better error messages.
 #[stable(feature = "nonnull", since = "1.25.0")]
 impl<T: ?Sized> !Send for NonNull<T> { }
 
 /// `NonNull` pointers are not `Sync` because the data they reference may be aliased.
-// NB: This impl is unnecessary, but should provide better error messages.
+// N.B., this impl is unnecessary, but should provide better error messages.
 #[stable(feature = "nonnull", since = "1.25.0")]
 impl<T: ?Sized> !Sync for NonNull<T> { }
 
index 3d4bccb4f9d654ebc049cb95588cda36fc245b09..4f1af8bf110e4c12987c0e326c27c768694728d1 100644 (file)
@@ -24,7 +24,7 @@
 /// `Box<dyn AnotherTrait>`.
 ///
 /// `TraitObject` is guaranteed to match layouts, but it is not the
-/// type of trait objects (e.g. the fields are not directly accessible
+/// type of trait objects (e.g., the fields are not directly accessible
 /// on a `&SomeTrait`) nor does it control that layout (changing the
 /// definition will not change the layout of a `&SomeTrait`). It is
 /// only designed to be used by unsafe code that needs to manipulate
index 5b57dcabb8da9de963998b055d04c5389cb213f6..59c11b273293f484dd5496bf25fc75a46147ff0e 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-//! Slice management and manipulation
+//! Slice management and manipulation.
 //!
 //! For more details see [`std::slice`].
 //!
@@ -1151,7 +1151,7 @@ pub fn rsplit_mut<F>(&mut self, pred: F) -> RSplitMut<T, F>
     ///
     /// # Examples
     ///
-    /// Print the slice split once by numbers divisible by 3 (i.e. `[10, 40]`,
+    /// Print the slice split once by numbers divisible by 3 (i.e., `[10, 40]`,
     /// `[20, 60, 50]`):
     ///
     /// ```
@@ -1215,7 +1215,7 @@ pub fn splitn_mut<F>(&mut self, n: usize, pred: F) -> SplitNMut<T, F>
     /// # Examples
     ///
     /// Print the slice split once, starting from the end, by numbers divisible
-    /// by 3 (i.e. `[50]`, `[10, 40, 30, 20]`):
+    /// by 3 (i.e., `[50]`, `[10, 40, 30, 20]`):
     ///
     /// ```
     /// let v = [10, 40, 30, 20, 60, 50];
@@ -1471,8 +1471,8 @@ pub fn binary_search_by_key<'a, B, F>(&'a self, b: &B, mut f: F) -> Result<usize
 
     /// Sorts the slice, but may not preserve the order of equal elements.
     ///
-    /// This sort is unstable (i.e. may reorder equal elements), in-place (i.e. does not allocate),
-    /// and `O(n log n)` worst-case.
+    /// This sort is unstable (i.e., may reorder equal elements), in-place
+    /// (i.e., does not allocate), and `O(n log n)` worst-case.
     ///
     /// # Current implementation
     ///
@@ -1482,7 +1482,7 @@ pub fn binary_search_by_key<'a, B, F>(&'a self, b: &B, mut f: F) -> Result<usize
     /// randomization to avoid degenerate cases, but with a fixed seed to always provide
     /// deterministic behavior.
     ///
-    /// It is typically faster than stable sorting, except in a few special cases, e.g. when the
+    /// It is typically faster than stable sorting, except in a few special cases, e.g., when the
     /// slice consists of several concatenated sorted sequences.
     ///
     /// # Examples
@@ -1506,8 +1506,8 @@ pub fn sort_unstable(&mut self)
     /// Sorts the slice with a comparator function, but may not preserve the order of equal
     /// elements.
     ///
-    /// This sort is unstable (i.e. may reorder equal elements), in-place (i.e. does not allocate),
-    /// and `O(n log n)` worst-case.
+    /// This sort is unstable (i.e., may reorder equal elements), in-place
+    /// (i.e., does not allocate), and `O(n log n)` worst-case.
     ///
     /// The comparator function must define a total ordering for the elements in the slice. If
     /// the ordering is not total, the order of the elements is unspecified. An order is a
@@ -1533,7 +1533,7 @@ pub fn sort_unstable(&mut self)
     /// randomization to avoid degenerate cases, but with a fixed seed to always provide
     /// deterministic behavior.
     ///
-    /// It is typically faster than stable sorting, except in a few special cases, e.g. when the
+    /// It is typically faster than stable sorting, except in a few special cases, e.g., when the
     /// slice consists of several concatenated sorted sequences.
     ///
     /// # Examples
@@ -1560,8 +1560,9 @@ pub fn sort_unstable_by<F>(&mut self, mut compare: F)
     /// Sorts the slice with a key extraction function, but may not preserve the order of equal
     /// elements.
     ///
-    /// This sort is unstable (i.e. may reorder equal elements), in-place (i.e. does not allocate),
-    /// and `O(m n log(m n))` worst-case, where the key function is `O(m)`.
+    /// This sort is unstable (i.e., may reorder equal elements), in-place
+    /// (i.e., does not allocate), and `O(m n log(m n))` worst-case, where the key function is
+    /// `O(m)`.
     ///
     /// # Current implementation
     ///
@@ -2458,13 +2459,13 @@ unsafe fn get_unchecked_mut(self, slice: &mut [T]) -> &mut T {
 
     #[inline]
     fn index(self, slice: &[T]) -> &T {
-        // NB: use intrinsic indexing
+        // N.B., use intrinsic indexing
         &(*slice)[self]
     }
 
     #[inline]
     fn index_mut(self, slice: &mut [T]) -> &mut T {
-        // NB: use intrinsic indexing
+        // N.B., use intrinsic indexing
         &mut (*slice)[self]
     }
 }
index 6c953d1b9a0acefb716c3a148a2817956ffe24b9..4a22d929fede0e3db0721dad190da09780b11c0a 100644 (file)
@@ -482,7 +482,7 @@ fn utf8_first_byte(byte: u8, width: u32) -> u32 { (byte & (0x7F >> width)) as u3
 #[inline]
 fn utf8_acc_cont_byte(ch: u32, byte: u8) -> u32 { (ch << 6) | (byte & CONT_MASK) as u32 }
 
-/// Checks whether the byte is a UTF-8 continuation byte (i.e. starts with the
+/// Checks whether the byte is a UTF-8 continuation byte (i.e., starts with the
 /// bits `10`).
 #[inline]
 fn utf8_is_cont_byte(byte: u8) -> bool { (byte & !CONT_MASK) == TAG_CONT_U8 }
index 1c974533e10c826a60eef8e6c3ef852d7d85b2f0..2059160ddfe67f914a6bc8a9100efb67e9010751 100644 (file)
@@ -397,7 +397,7 @@ fn next_match_back(&mut self) -> Option<(usize, usize)> {
                     let found_char = index - shift;
                     if let Some(slice) = haystack.get(found_char..(found_char + self.utf8_size)) {
                         if slice == &self.utf8_encoded[0..self.utf8_size] {
-                            // move finger to before the character found (i.e. at its start index)
+                            // move finger to before the character found (i.e., at its start index)
                             self.finger_back = found_char;
                             return Some((self.finger_back, self.finger_back + self.utf8_size));
                         }
@@ -1016,7 +1016,7 @@ struct TwoWaySearcher {
     It can be proven that the following is an equivalent definition of a local period
     for a factorization (u, v): any positive integer r such that x[i] == x[i+r] for
     all i such that |u| - r <= i <= |u| - 1 and such that both x[i] and x[i+r] are
-    defined. (i.e. i > 0 and i + r < |x|).
+    defined. (i.e., i > 0 and i + r < |x|).
 
     Using the above reformulation, it is easy to prove that
 
index c0ce7255d62875cdd64e12a469d233aedaddbae2..8ea7abce67bfafaf810a0ba6a03d269a4c4cb66f 100644 (file)
@@ -227,7 +227,7 @@ pub unsafe trait UnsafeWake: Send + Sync {
     /// # Unsafety
     ///
     /// This function is unsafe to call because it's asserting the `UnsafeWake`
-    /// value is in a consistent state, i.e. hasn't been dropped.
+    /// value is in a consistent state, i.e., hasn't been dropped.
     unsafe fn clone_raw(&self) -> Waker;
 
     /// Drops this instance of `UnsafeWake`, deallocating resources
@@ -249,7 +249,7 @@ pub unsafe trait UnsafeWake: Send + Sync {
     /// # Unsafety
     ///
     /// This function is unsafe to call because it's asserting the `UnsafeWake`
-    /// value is in a consistent state, i.e. hasn't been dropped.
+    /// value is in a consistent state, i.e., hasn't been dropped.
     unsafe fn drop_raw(&self);
 
     /// Indicates that the associated task is ready to make progress and should
@@ -266,7 +266,7 @@ pub unsafe trait UnsafeWake: Send + Sync {
     /// # Unsafety
     ///
     /// This function is unsafe to call because it's asserting the `UnsafeWake`
-    /// value is in a consistent state, i.e. hasn't been dropped.
+    /// value is in a consistent state, i.e., hasn't been dropped.
     unsafe fn wake(&self);
 
     /// Indicates that the associated task is ready to make progress and should
@@ -286,7 +286,7 @@ pub unsafe trait UnsafeWake: Send + Sync {
     /// # Unsafety
     ///
     /// This function is unsafe to call because it's asserting the `UnsafeWake`
-    /// value is in a consistent state, i.e. hasn't been dropped, and that the
+    /// value is in a consistent state, i.e., hasn't been dropped, and that the
     /// `UnsafeWake` hasn't moved from the thread on which it was created.
     unsafe fn wake_local(&self) {
         self.wake()
index 17b2f59cd4df2814e47e1175eab92b011b3ddd99..879a41b4b770d911072a5012f534a07b98a44f12 100644 (file)
@@ -17,7 +17,7 @@
 
 // Take a float literal, turn it into a string in various ways (that are all trusted
 // to be correct) and see if those strings are parsed back to the value of the literal.
-// Requires a *polymorphic literal*, i.e. one that can serve as f64 as well as f32.
+// Requires a *polymorphic literal*, i.e., one that can serve as f64 as well as f32.
 macro_rules! test_literal {
     ($x: expr) => ({
         let x32: f32 = $x;
index ab619093d9d85b77969fc2ee9b0999cb8e5e56e5..95dfcb522e0a922537612654095449eba880d854 100644 (file)
@@ -99,7 +99,7 @@ pub fn f32_exhaustive_equivalence_test<F, G>(f: F, g: G, k: usize)
     // this is of course very stressful (and thus should be behind an `#[ignore]` attribute),
     // but with `-C opt-level=3 -C lto` this only takes about an hour or so.
 
-    // iterate from 0x0000_0001 to 0x7f7f_ffff, i.e. all finite ranges
+    // iterate from 0x0000_0001 to 0x7f7f_ffff, i.e., all finite ranges
     let (npassed, nignored) = iterate("f32_exhaustive_equivalence_test",
                                       k, 0x7f7f_ffff, f, g, |i: usize| {
 
index 938e97503deb6d716f88d693f6f68cf0933294ad..475bb721f23f70092c75e8159cb6f5a3c8a5f331 100644 (file)
@@ -216,7 +216,7 @@ pub const fn as_secs(&self) -> u64 { self.secs }
     ///
     /// This method does **not** return the length of the duration when
     /// represented by milliseconds. The returned number always represents a
-    /// fractional portion of a second (i.e. it is less than one thousand).
+    /// fractional portion of a second (i.e., it is less than one thousand).
     ///
     /// # Examples
     ///
@@ -235,7 +235,7 @@ pub const fn subsec_millis(&self) -> u32 { self.nanos / NANOS_PER_MILLI }
     ///
     /// This method does **not** return the length of the duration when
     /// represented by microseconds. The returned number always represents a
-    /// fractional portion of a second (i.e. it is less than one million).
+    /// fractional portion of a second (i.e., it is less than one million).
     ///
     /// # Examples
     ///
@@ -254,7 +254,7 @@ pub const fn subsec_micros(&self) -> u32 { self.nanos / NANOS_PER_MICRO }
     ///
     /// This method does **not** return the length of the duration when
     /// represented by nanoseconds. The returned number always represents a
-    /// fractional portion of a second (i.e. it is less than one billion).
+    /// fractional portion of a second (i.e., it is less than one billion).
     ///
     /// # Examples
     ///
index 396b0366074b2ebe4ba739662d765900b9e273bb..e3cf959beb8e5e019ca47919190ffce7d6515f2d 100644 (file)
@@ -10,7 +10,7 @@
 
 //! Generate files suitable for use with [Graphviz](http://www.graphviz.org/)
 //!
-//! The `render` function generates output (e.g. an `output.dot` file) for
+//! The `render` function generates output (e.g., an `output.dot` file) for
 //! use with [Graphviz](http://www.graphviz.org/) by walking a labeled
 //! graph. (Graphviz can then automatically lay out the nodes and edges
 //! of the graph, and also optionally render the graph as an image or
@@ -25,7 +25,7 @@
 //! expressiveness of the [DOT language](
 //! http://www.graphviz.org/doc/info/lang.html). For example, there are
 //! many [attributes](http://www.graphviz.org/content/attrs) related to
-//! providing layout hints (e.g. left-to-right versus top-down, which
+//! providing layout hints (e.g., left-to-right versus top-down, which
 //! algorithm to use, etc). The current intention of this library is to
 //! emit a human-readable .dot file with very regular structure suitable
 //! for easy post-processing.
@@ -373,7 +373,7 @@ pub fn as_slice(self) -> &'static str {
 // implement a Labelling service) that I have encountered is that it
 // makes it impossible to use types outside of the current crate
 // directly as Nodes/Edges; you need to wrap them in newtype'd
-// structs. See e.g. the `No` and `Ed` structs in the examples. (In
+// structs. See e.g., the `No` and `Ed` structs in the examples. (In
 // practice clients using a graph in some other crate would need to
 // provide some sort of adapter shim over the graph anyway to
 // interface with this library).
@@ -400,7 +400,7 @@ impl<'a> Id<'a> {
     /// The caller must ensure that the input conforms to an
     /// identifier format: it must be a non-empty string made up of
     /// alphanumeric or underscore characters, not beginning with a
-    /// digit (i.e. the regular expression `[a-zA-Z_][a-zA-Z_0-9]*`).
+    /// digit (i.e., the regular expression `[a-zA-Z_][a-zA-Z_0-9]*`).
     ///
     /// (Note: this format is a strict subset of the `ID` format
     /// defined by the DOT language.  This function may change in the
index 3ff250ff6592bdbb717ab98c273b7b20d94e1a48..c9ae87ade283db3f0582980581434636afbdb906 100644 (file)
@@ -32,7 +32,7 @@ pub fn new(ptr: *const u8) -> DwarfReader {
         DwarfReader { ptr }
     }
 
-    // DWARF streams are packed, so e.g. a u32 would not necessarily be aligned
+    // DWARF streams are packed, so e.g., a u32 would not necessarily be aligned
     // on a 4-byte boundary. This may cause problems on platforms with strict
     // alignment requirements. By wrapping data in a "packed" struct, we are
     // telling the backend to generate "misalignment-safe" code.
index 11ebcf5c01ea79e3ca62052577c394afd3c951c8..441058c8d74ca7316a106e965391c199bc11e4eb 100644 (file)
@@ -25,7 +25,7 @@
 //!
 //! In both phases the unwinder walks stack frames from top to bottom using
 //! information from the stack frame unwind sections of the current process's
-//! modules ("module" here refers to an OS module, i.e. an executable or a
+//! modules ("module" here refers to an OS module, i.e., an executable or a
 //! dynamic library).
 //!
 //! For each stack frame, it invokes the associated "personality routine", whose
@@ -296,7 +296,7 @@ unsafe fn find_eh_action(context: *mut uw::_Unwind_Context)
 // Each module's image contains a frame unwind info section (usually
 // ".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
index 832a0aff71be1b6e4dc434de60245ed7673b653a..9d24079d91e2df6f9db584faea1e4b9fc5f45734 100644 (file)
@@ -12,7 +12,7 @@
 //!
 //! On Windows (currently only on MSVC), the default exception handling
 //! mechanism is Structured Exception Handling (SEH). This is quite different
-//! than Dwarf-based exception handling (e.g. what other unix platforms use) in
+//! than Dwarf-based exception handling (e.g., what other unix platforms use) in
 //! terms of compiler internals, so LLVM is required to have a good deal of
 //! extra support for SEH.
 //!
@@ -304,7 +304,7 @@ pub unsafe fn panic(data: Box<dyn Any + Send>) -> u32 {
     })
 }
 
-// This is required by the compiler to exist (e.g. it's a lang item), but
+// This is required by the compiler to exist (e.g., it's a lang item), but
 // it's never actually called by the compiler because __C_specific_handler
 // or _except_handler3 is the personality function that is always used.
 // Hence this is just an aborting stub.
index ed27df4496256aa12f51afc5073a7c8afa3f6025..f5e12713e4e72f50100b8924dda12f56b4be3509 100644 (file)
@@ -262,7 +262,7 @@ enum BridgeState<'a> {
     Connected(Bridge<'a>),
 
     /// Access to the bridge is being exclusively acquired
-    /// (e.g. during `BridgeState::with`).
+    /// (e.g., during `BridgeState::with`).
     InUse,
 }
 
@@ -283,7 +283,7 @@ impl BridgeState<'_> {
     /// The state will be restored after `f` exits, even
     /// by panic, including modifications made to it by `f`.
     ///
-    /// NB: while `f` is running, the thread-local state
+    /// N.B., while `f` is running, the thread-local state
     /// is `BridgeState::InUse`.
     fn with<R>(f: impl FnOnce(&mut BridgeState) -> R) -> R {
         BRIDGE_STATE.with(|state| {
@@ -333,7 +333,7 @@ fn with<R>(f: impl FnOnce(&mut Bridge) -> R) -> R {
 /// which may be using a different `proc_macro` from the one
 /// used by the server, but can be interacted with compatibly.
 ///
-/// NB: `F` must have FFI-friendly memory layout (e.g. a pointer).
+/// N.B., `F` must have FFI-friendly memory layout (e.g., a pointer).
 /// The call ABI of function pointers used for `F` doesn't
 /// need to match between server and client, since it's only
 /// passed between them and (eventually) called by the client.
index f03c63fc04c8146800f6b2a133a9d64bd67e975a..edb4d3fbdaabb6208c1e0695eb1f728d19263bd0 100644 (file)
@@ -14,7 +14,7 @@
 //! Serialization (with C ABI buffers) and unique integer handles are employed
 //! to allow safely interfacing between two copies of `proc_macro` built
 //! (from the same source) by different compilers with potentially mismatching
-//! Rust ABIs (e.g. stage0/bin/rustc vs stage1/bin/rustc during bootstrap).
+//! Rust ABIs (e.g., stage0/bin/rustc vs stage1/bin/rustc during bootstrap).
 
 #![deny(unsafe_code)]
 
index 51d1fece79b92a4926e741872c55479091aae486..c86d5fc309a39d491087c1a1acf5feee0c343ce1 100644 (file)
@@ -19,7 +19,7 @@ pub trait ApplyL<'a> {
     type Out;
 }
 
-/// Type lambda taking a lifetime, i.e. `Lifetime -> Type`.
+/// Type lambda taking a lifetime, i.e., `Lifetime -> Type`.
 pub trait LambdaL: for<'a> ApplyL<'a> {}
 
 impl<T: for<'a> ApplyL<'a>> LambdaL for T {}
index f500b17d1caf316f01105fff1d59d2d9cb96bf07..0c1d4f7cc5069b45002a0c18bfedeab89f352001 100644 (file)
@@ -16,7 +16,7 @@
 use super::client::HandleStore;
 
 /// Declare an associated item of one of the traits below, optionally
-/// adjusting it (i.e. adding bounds to types and default bodies to methods).
+/// adjusting it (i.e., adding bounds to types and default bodies to methods).
 macro_rules! associated_item {
     (type TokenStream) =>
         (type TokenStream: 'static + Clone;);
index 32c81302931f36865b659062c0ce9bb4c860a86b..f2b85832dac31759d455051f09a42cefc5f35b39 100644 (file)
@@ -110,7 +110,7 @@ fn from_str(src: &str) -> Result<TokenStream, LexError> {
     }
 }
 
-// NB: the bridge only provides `to_string`, implement `fmt::Display`
+// N.B., the bridge only provides `to_string`, implement `fmt::Display`
 // based on it (the reverse of the usual relationship between the two).
 #[stable(feature = "proc_macro_lib", since = "1.15.0")]
 impl ToString for TokenStream {
@@ -196,7 +196,7 @@ pub mod token_stream {
     use {bridge, Group, Ident, Literal, Punct, TokenTree, TokenStream};
 
     /// An iterator over `TokenStream`'s `TokenTree`s.
-    /// The iteration is "shallow", e.g. the iterator doesn't recurse into delimited groups,
+    /// The iteration is "shallow", e.g., the iterator doesn't recurse into delimited groups,
     /// and returns whole groups as token trees.
     #[derive(Clone)]
     #[stable(feature = "proc_macro_lib2", since = "1.29.0")]
@@ -426,7 +426,7 @@ fn eq(&self, other: &Self) -> bool {
 #[unstable(feature = "proc_macro_span", issue = "54725")]
 impl Eq for SourceFile {}
 
-/// A single token or a delimited sequence of token trees (e.g. `[1, (), ..]`).
+/// A single token or a delimited sequence of token trees (e.g., `[1, (), ..]`).
 #[stable(feature = "proc_macro_lib2", since = "1.29.0")]
 #[derive(Clone)]
 pub enum TokenTree {
@@ -533,7 +533,7 @@ fn from(g: Literal) -> TokenTree {
     }
 }
 
-// NB: the bridge only provides `to_string`, implement `fmt::Display`
+// N.B., the bridge only provides `to_string`, implement `fmt::Display`
 // based on it (the reverse of the usual relationship between the two).
 #[stable(feature = "proc_macro_lib", since = "1.15.0")]
 impl ToString for TokenTree {
@@ -663,7 +663,7 @@ pub fn set_span(&mut self, span: Span) {
     }
 }
 
-// NB: the bridge only provides `to_string`, implement `fmt::Display`
+// N.B., the bridge only provides `to_string`, implement `fmt::Display`
 // based on it (the reverse of the usual relationship between the two).
 #[stable(feature = "proc_macro_lib", since = "1.15.0")]
 impl ToString for Group {
@@ -711,10 +711,10 @@ impl !Sync for Punct {}
 #[derive(Copy, Clone, Debug, PartialEq, Eq)]
 #[stable(feature = "proc_macro_lib2", since = "1.29.0")]
 pub enum Spacing {
-    /// E.g. `+` is `Alone` in `+ =`, `+ident` or `+()`.
+    /// e.g., `+` is `Alone` in `+ =`, `+ident` or `+()`.
     #[stable(feature = "proc_macro_lib2", since = "1.29.0")]
     Alone,
-    /// E.g. `+` is `Joint` in `+=` or `'#`.
+    /// e.g., `+` is `Joint` in `+=` or `'#`.
     /// Additionally, single quote `'` can join with identifiers to form lifetimes `'ident`.
     #[stable(feature = "proc_macro_lib2", since = "1.29.0")]
     Joint,
@@ -765,7 +765,7 @@ pub fn set_span(&mut self, span: Span) {
     }
 }
 
-// NB: the bridge only provides `to_string`, implement `fmt::Display`
+// N.B., the bridge only provides `to_string`, implement `fmt::Display`
 // based on it (the reverse of the usual relationship between the two).
 #[stable(feature = "proc_macro_lib", since = "1.15.0")]
 impl ToString for Punct {
@@ -860,7 +860,7 @@ pub fn set_span(&mut self, span: Span) {
     }
 }
 
-// NB: the bridge only provides `to_string`, implement `fmt::Display`
+// N.B., the bridge only provides `to_string`, implement `fmt::Display`
 // based on it (the reverse of the usual relationship between the two).
 #[stable(feature = "proc_macro_lib", since = "1.15.0")]
 impl ToString for Ident {
@@ -1110,7 +1110,7 @@ fn cloned_bound<T: Clone>(bound: Bound<&T>) -> Bound<T> {
     }
 }
 
-// NB: the bridge only provides `to_string`, implement `fmt::Display`
+// N.B., the bridge only provides `to_string`, implement `fmt::Display`
 // based on it (the reverse of the usual relationship between the two).
 #[stable(feature = "proc_macro_lib", since = "1.15.0")]
 impl ToString for Literal {
index 457f33f8bd7b93485ad7ba22cc33f4fe9ad2f365..c5d6ce24c5df4d03ec132032756ff385f7638f22 100644 (file)
@@ -379,7 +379,7 @@ fn expr(&mut self, expr: &hir::Expr, pred: CFGIndex) -> CFGIndex {
             }
 
             hir::ExprKind::Index(ref l, ref r) |
-            hir::ExprKind::Binary(_, ref l, ref r) => { // NB: && and || handled earlier
+            hir::ExprKind::Binary(_, ref l, ref r) => { // N.B., && and || handled earlier
                 self.straightline(expr, pred, [l, r].iter().map(|&e| &**e))
             }
 
index dd46dd3fd6461f8355c771120a6cb9faa694b51a..f0c6196412adb982ce2c12a391620d04bb021e65 100644 (file)
@@ -17,7 +17,7 @@
 //! fully identify a dependency node, even across multiple compilation sessions.
 //! In other words, the value of the fingerprint does not depend on anything
 //! that is specific to a given compilation session, like an unpredictable
-//! interning key (e.g. NodeId, DefId, Symbol) or the numeric value of a
+//! interning key (e.g., NodeId, DefId, Symbol) or the numeric value of a
 //! pointer. The concept behind this could be compared to how git commit hashes
 //! uniquely identify a given commit and has a few advantages:
 //!
@@ -28,7 +28,7 @@
 //! * A `Fingerprint` is just a bunch of bits, which allows `DepNode` to
 //!   implement `Copy`, `Sync`, `Send`, `Freeze`, etc.
 //! * Since we just have a bit pattern, `DepNode` can be mapped from disk into
-//!   memory without any post-processing (e.g. "abomination-style" pointer
+//!   memory without any post-processing (e.g., "abomination-style" pointer
 //!   reconstruction).
 //! * Because a `DepNode` is self-contained, we can instantiate `DepNodes` that
 //!   refer to things that do not exist anymore. In previous implementations
@@ -81,7 +81,7 @@
 use ty::subst::Substs;
 
 // erase!() just makes tokens go away. It's used to specify which macro argument
-// is repeated (i.e. which sub-expression of the macro we are in) but don't need
+// is repeated (i.e., which sub-expression of the macro we are in) but don't need
 // to actually use any of the arguments.
 macro_rules! erase {
     ($x:tt) => ({})
index 96590c1fc72d400c8724e663dd39598da5fad024..3dc6f761ec96141f8452938a97d0ed3e8e7b1d2b 100644 (file)
@@ -47,7 +47,7 @@ trait Foo where Self: Sized {
 We cannot create an object of type `Box<Foo>` or `&Foo` since in this case
 `Self` would not be `Sized`.
 
-Generally, `Self : Sized` is used to indicate that the trait should not be used
+Generally, `Self: Sized` is used to indicate that the trait should not be used
 as a trait object. If the trait comes from your own crate, consider removing
 this restriction.
 
@@ -217,9 +217,9 @@ trait Trait {
 ```
 
 If this is not an option, consider replacing the type parameter with another
-trait object (e.g. if `T: OtherTrait`, use `on: Box<OtherTrait>`). If the number
-of types you intend to feed to this method is limited, consider manually listing
-out the methods of different types.
+trait object (e.g., if `T: OtherTrait`, use `on: Box<OtherTrait>`). If the
+number of types you intend to feed to this method is limited, consider manually
+listing out the methods of different types.
 
 ### Method has no receiver
 
@@ -642,7 +642,7 @@ fn foo<T: MyTransmutableType>(x: Vec<T>) {
 ```
 
 Lang items are already implemented in the standard library. Unless you are
-writing a free-standing application (e.g. a kernel), you do not need to provide
+writing a free-standing application (e.g., a kernel), you do not need to provide
 them yourself.
 
 You can build a free-standing crate by adding `#![no_std]` to the crate
@@ -699,7 +699,7 @@ trait Index<Idx> { /* ... */ }
 match with any of the type parameters or the string `Self`. This might happen
 if you misspelled a type parameter, or if you intended to use literal curly
 braces. If it is the latter, escape the curly braces with a second curly brace
-of the same type; e.g. a literal `{` is `{{`.
+of the same type; e.g., a literal `{` is `{{`.
 "##,
 
 E0231: r##"
@@ -832,7 +832,7 @@ fn foo<'a, 'b, 'a>(x: &'a str, y: &'b str) { }
 
 E0271: r##"
 This is because of a type mismatch between the associated type of some
-trait (e.g. `T::Bar`, where `T` implements `trait Quux { type Bar; }`)
+trait (e.g., `T::Bar`, where `T` implements `trait Quux { type Bar; }`)
 and another type `U` that is required to be equal to `T::Bar`, but is not.
 Examples follow.
 
@@ -1622,7 +1622,7 @@ impl Foo {
 won't work on enums.
 
 `#[repr(simd)]` will give a struct consisting of a homogeneous series of machine
-types (i.e. `u8`, `i32`, etc) a representation that permits vectorization via
+types (i.e., `u8`, `i32`, etc) a representation that permits vectorization via
 SIMD. This doesn't make much sense for enums since they don't consist of a
 single list of data.
 "##,
index 50922ee601daf32d7dbfda2f391624cb08617020..fb3c3dec7c2bec8f570c51b940a8ace3fae17be4 100644 (file)
@@ -46,7 +46,7 @@ pub enum NonMacroAttrKind {
 pub enum Def {
     // Type namespace
     Mod(DefId),
-    Struct(DefId), // DefId refers to NodeId of the struct itself
+    Struct(DefId), // `DefId` refers to `NodeId` of the struct itself
     Union(DefId),
     Enum(DefId),
     Variant(DefId),
@@ -63,27 +63,27 @@ pub enum Def {
     PrimTy(hir::PrimTy),
     TyParam(DefId),
     SelfTy(Option<DefId> /* trait */, Option<DefId> /* impl */),
-    ToolMod, // e.g. `rustfmt` in `#[rustfmt::skip]`
+    ToolMod, // e.g., `rustfmt` in `#[rustfmt::skip]`
 
     // Value namespace
     Fn(DefId),
     Const(DefId),
     Static(DefId, bool /* is_mutbl */),
-    StructCtor(DefId, CtorKind), // DefId refers to NodeId of the struct's constructor
-    VariantCtor(DefId, CtorKind), // DefId refers to the enum variant
-    SelfCtor(DefId /* impl */),  // DefId refers to the impl
+    StructCtor(DefId, CtorKind), // `DefId` refers to `NodeId` of the struct's constructor
+    VariantCtor(DefId, CtorKind), // `DefId` refers to the enum variant
+    SelfCtor(DefId /* impl */),  // `DefId` refers to the impl
     Method(DefId),
     AssociatedConst(DefId),
 
     Local(ast::NodeId),
-    Upvar(ast::NodeId,  // node id of closed over local
-          usize,        // index in the freevars list of the closure
+    Upvar(ast::NodeId,  // `NodeId` of closed over local
+          usize,        // index in the `freevars` list of the closure
           ast::NodeId), // expr node that creates the closure
     Label(ast::NodeId),
 
     // Macro namespace
     Macro(DefId, MacroKind),
-    NonMacroAttr(NonMacroAttrKind), // e.g. `#[inline]` or `#[rustfmt::skip]`
+    NonMacroAttr(NonMacroAttrKind), // e.g., `#[inline]` or `#[rustfmt::skip]`
 
     // Both namespaces
     Err,
@@ -170,6 +170,7 @@ pub fn map<U, F: FnMut(T) -> U>(self, mut f: F) -> PerNS<U> {
 
 impl<T> ::std::ops::Index<Namespace> for PerNS<T> {
     type Output = T;
+
     fn index(&self, ns: Namespace) -> &T {
         match ns {
             ValueNS => &self.value_ns,
@@ -238,6 +239,7 @@ pub fn from_ast(vdata: &ast::VariantData) -> CtorKind {
             ast::VariantData::Struct(..) => CtorKind::Fictive,
         }
     }
+
     pub fn from_hir(vdata: &hir::VariantData) -> CtorKind {
         match *vdata {
             hir::VariantData::Tuple(..) => CtorKind::Fn,
index d9963f23a1593c09aeade3ebb3777b1d42b7bf97..f7e2c7036f6f8c43721280425cde7b61b96aecaf 100644 (file)
@@ -131,7 +131,7 @@ pub fn inter(self) -> Option<&'this Map<'tcx>> {
 /// Each method of the Visitor trait is a hook to be potentially
 /// overridden.  Each method's default implementation recursively visits
 /// the substructure of the input via the corresponding `walk` method;
-/// e.g. the `visit_mod` method by default calls `intravisit::walk_mod`.
+/// e.g., the `visit_mod` method by default calls `intravisit::walk_mod`.
 ///
 /// Note that this visitor does NOT visit nested items by default
 /// (this is why the module is called `intravisit`, to distinguish it
@@ -493,7 +493,7 @@ pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item) {
                              item.id)
         }
         ItemKind::Mod(ref module) => {
-            // visit_mod() takes care of visiting the Item's NodeId
+            // `visit_mod()` takes care of visiting the `Item`'s `NodeId`.
             visitor.visit_mod(module, item.span, item.id)
         }
         ItemKind::ForeignMod(ref foreign_module) => {
@@ -518,7 +518,7 @@ pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item) {
         }
         ItemKind::Enum(ref enum_definition, ref type_parameters) => {
             visitor.visit_generics(type_parameters);
-            // visit_enum_def() takes care of visiting the Item's NodeId
+            // `visit_enum_def()` takes care of visiting the `Item`'s `NodeId`.
             visitor.visit_enum_def(enum_definition, type_parameters, item.id, item.span)
         }
         ItemKind::Impl(
@@ -877,7 +877,7 @@ pub fn walk_trait_item<'v, V: Visitor<'v>>(visitor: &mut V, trait_item: &'v Trai
 }
 
 pub fn walk_trait_item_ref<'v, V: Visitor<'v>>(visitor: &mut V, trait_item_ref: &'v TraitItemRef) {
-    // NB: Deliberately force a compilation error if/when new fields are added.
+    // N.B., deliberately force a compilation error if/when new fields are added.
     let TraitItemRef { id, ident, ref kind, span: _, ref defaultness } = *trait_item_ref;
     visitor.visit_nested_trait_item(id);
     visitor.visit_ident(ident);
@@ -886,7 +886,7 @@ pub fn walk_trait_item_ref<'v, V: Visitor<'v>>(visitor: &mut V, trait_item_ref:
 }
 
 pub fn walk_impl_item<'v, V: Visitor<'v>>(visitor: &mut V, impl_item: &'v ImplItem) {
-    // NB: Deliberately force a compilation error if/when new fields are added.
+    // N.B., deliberately force a compilation error if/when new fields are added.
     let ImplItem {
         id: _,
         hir_id: _,
@@ -932,7 +932,7 @@ pub fn walk_impl_item<'v, V: Visitor<'v>>(visitor: &mut V, impl_item: &'v ImplIt
 }
 
 pub fn walk_impl_item_ref<'v, V: Visitor<'v>>(visitor: &mut V, impl_item_ref: &'v ImplItemRef) {
-    // NB: Deliberately force a compilation error if/when new fields are added.
+    // N.B., deliberately force a compilation error if/when new fields are added.
     let ImplItemRef { id, ident, ref kind, span: _, ref vis, ref defaultness } = *impl_item_ref;
     visitor.visit_nested_impl_item(id);
     visitor.visit_ident(ident);
index a485af0a5eef9fa1a989f0d614660c81b4ba0868..6fd0ccb49b6d7ee7ae952bfb3894fb33fc72f477 100644 (file)
@@ -82,7 +82,7 @@
 pub struct LoweringContext<'a> {
     crate_root: Option<&'static str>,
 
-    // Use to assign ids to hir nodes that do not directly correspond to an ast node
+    // Used to assign ids to HIR nodes that do not directly correspond to an AST node.
     sess: &'a Session,
 
     cstore: &'a dyn CrateStore,
@@ -114,10 +114,10 @@ pub struct LoweringContext<'a> {
     anonymous_lifetime_mode: AnonymousLifetimeMode,
 
     // Used to create lifetime definitions from in-band lifetime usages.
-    // e.g. `fn foo(x: &'x u8) -> &'x u8` to `fn foo<'x>(x: &'x u8) -> &'x u8`
+    // e.g., `fn foo(x: &'x u8) -> &'x u8` to `fn foo<'x>(x: &'x u8) -> &'x u8`
     // When a named lifetime is encountered in a function or impl header and
     // has not been defined
-    // (i.e. it doesn't appear in the in_scope_lifetimes list), it is added
+    // (i.e., it doesn't appear in the in_scope_lifetimes list), it is added
     // to this list. The results of this list are then added to the list of
     // lifetime definitions in the corresponding impl or function generics.
     lifetimes_to_define: Vec<(Span, ParamName)>,
@@ -149,7 +149,7 @@ fn resolve_hir_path(
         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<PathResolution>;
 
     /// Obtain the possible resolutions for the given `use` statement.
@@ -159,8 +159,8 @@ fn resolve_hir_path(
     /// This should only return `None` during testing.
     fn definitions(&mut self) -> &mut Definitions;
 
-    /// Given suffix ["b","c","d"], creates a HIR path for `[::crate_root]::b::c::d` and resolves
-    /// it based on `is_value`.
+    /// Given suffix `["b", "c", "d"]`, creates a HIR path for `[::crate_root]::b::c::d` and
+    /// resolves it based on `is_value`.
     fn resolve_str_path(
         &mut self,
         span: Span,
@@ -185,7 +185,7 @@ enum ImplTraitContext<'a> {
     ///
     /// We optionally store a `DefId` for the parent item here so we can look up necessary
     /// information later. It is `None` when no information about the context should be stored,
-    /// e.g. for consts and statics.
+    /// e.g., for consts and statics.
     Existential(Option<DefId>),
 
     /// `impl Trait` is not accepted in this position.
@@ -358,8 +358,8 @@ impl<'a> LoweringContext<'a> {
     fn lower_crate(mut self, c: &Crate) -> hir::Crate {
         /// Full-crate AST visitor that inserts into a fresh
         /// `LoweringContext` any information that may be
-        /// needed from arbitrary locations in the crate.
-        /// E.g. The number of lifetime generic parameters
+        /// needed from arbitrary locations in the crate,
+        /// e.g., the number of lifetime generic parameters
         /// declared for every type and trait definition.
         struct MiscCollector<'lcx, 'interner: 'lcx> {
             lctx: &'lcx mut LoweringContext<'interner>,
@@ -512,7 +512,7 @@ fn allocate_hir_id_counter<T: Debug>(&mut self, owner: NodeId, debug: &T) -> Low
                 debug
             );
         }
-        // Always allocate the first HirId for the owner itself
+        // Always allocate the first `HirId` for the owner itself.
         self.lower_node_id_with_owner(owner, owner)
     }
 
@@ -536,7 +536,7 @@ fn lower_node_id_generic<F>(&mut self, ast_node_id: NodeId, alloc_hir_id: F) ->
         let existing_hir_id = self.node_id_to_hir_id[ast_node_id];
 
         if existing_hir_id == hir::DUMMY_HIR_ID {
-            // Generate a new HirId
+            // Generate a new `HirId`.
             let hir_id = alloc_hir_id(self);
             self.node_id_to_hir_id[ast_node_id] = hir_id;
             LoweredNodeId {
@@ -573,12 +573,12 @@ fn with_hir_id_owner<F, T>(&mut self, owner: NodeId, f: F) -> T
         ret
     }
 
-    /// This method allocates a new HirId for the given NodeId and stores it in
-    /// the LoweringContext's NodeId => HirId map.
-    /// Take care not to call this method if the resulting HirId is then not
+    /// This method allocates a new `HirId` for the given `NodeId` and stores it in
+    /// the `LoweringContext`'s `NodeId => HirId` map.
+    /// Take care not to call this method if the resulting `HirId` is then not
     /// actually used in the HIR, as that would trigger an assertion in the
-    /// HirIdValidator later on, which makes sure that all NodeIds got mapped
-    /// properly. Calling the method twice with the same NodeId is fine though.
+    /// `HirIdValidator` later on, which makes sure that all `NodeId`s got mapped
+    /// properly. Calling the method twice with the same `NodeId` is fine though.
     fn lower_node_id(&mut self, ast_node_id: NodeId) -> LoweredNodeId {
         self.lower_node_id_generic(ast_node_id, |this| {
             let &mut (def_index, ref mut local_id_counter) =
@@ -743,7 +743,7 @@ fn collect_in_band_defs<T, F>(
                     ),
                 };
 
-                // Add a definition for the in-band lifetime def
+                // Add a definition for the in-band lifetime def.
                 self.resolver.definitions().create_def_with_parent(
                     parent_id.index,
                     def_node_id,
@@ -1067,7 +1067,7 @@ fn lower_attrs(&mut self, attrs: &[Attribute]) -> hir::HirVec<Attribute> {
     fn lower_attr(&mut self, attr: &Attribute) -> Attribute {
         // Note that we explicitly do not walk the path. Since we don't really
         // lower attributes (we use the AST version) there is nowhere to keep
-        // the HirIds. We don't actually need HIR version of attributes anyway.
+        // the `HirId`s. We don't actually need HIR version of attributes anyway.
         Attribute {
             id: attr.id,
             style: attr.style,
@@ -1246,7 +1246,7 @@ fn lower_ty_direct(&mut self, t: &Ty, mut itctx: ImplTraitContext<'_>) -> hir::T
                     }
                     ImplTraitContext::Universal(in_band_ty_params) => {
                         self.lower_node_id(def_node_id);
-                        // Add a definition for the in-band Param
+                        // Add a definition for the in-band `Param`.
                         let def_index = self
                             .resolver
                             .definitions()
@@ -1257,7 +1257,7 @@ fn lower_ty_direct(&mut self, t: &Ty, mut itctx: ImplTraitContext<'_>) -> hir::T
                             bounds,
                             ImplTraitContext::Universal(in_band_ty_params),
                         );
-                        // Set the name to `impl Bound1 + Bound2`
+                        // Set the name to `impl Bound1 + Bound2`.
                         let ident = Ident::from_str(&pprust::ty_to_string(t)).with_span_pos(span);
                         in_band_ty_params.push(hir::GenericParam {
                             id: def_node_id,
@@ -1365,7 +1365,7 @@ fn lower_existential_impl_trait(
                 impl_trait_fn: fn_def_id,
             });
             let exist_ty_id = lctx.lower_node_id(exist_ty_node_id);
-            // Generate an `existential type Foo: Trait;` declaration
+            // Generate an `existential type Foo: Trait;` declaration.
             trace!("creating existential type with id {:#?}", exist_ty_id);
 
             trace!("exist ty def index: {:#?}", exist_ty_def_index);
@@ -1384,7 +1384,7 @@ fn lower_existential_impl_trait(
             // does not actually exist in the AST.
             lctx.items.insert(exist_ty_id.node_id, exist_ty_item);
 
-            // `impl Trait` now just becomes `Foo<'a, 'b, ..>`
+            // `impl Trait` now just becomes `Foo<'a, 'b, ..>`.
             hir::TyKind::Def(hir::ItemId { id: exist_ty_id.node_id }, lifetimes)
         })
     }
@@ -1397,7 +1397,7 @@ fn lifetimes_from_impl_trait_bounds(
     ) -> (HirVec<hir::GenericArg>, HirVec<hir::GenericParam>) {
         // This visitor walks over impl trait bounds and creates defs for all lifetimes which
         // appear in the bounds, excluding lifetimes that are created within the bounds.
-        // e.g. 'a, 'b, but not 'c in `impl for<'c> SomeTrait<'a, 'b, 'c>`
+        // E.g., `'a`, `'b`, but not `'c` in `impl for<'c> SomeTrait<'a, 'b, 'c>`.
         struct ImplTraitLifetimeCollector<'r, 'a: 'r> {
             context: &'r mut LoweringContext<'a>,
             parent: DefIndex,
@@ -1429,7 +1429,7 @@ fn visit_generic_args(&mut self, span: Span, parameters: &'v hir::GenericArgs) {
             }
 
             fn visit_ty(&mut self, t: &'v hir::Ty) {
-                // Don't collect elided lifetimes used inside of `fn()` syntax
+                // Don't collect elided lifetimes used inside of `fn()` syntax.
                 if let hir::TyKind::BareFn(_) = t.node {
                     let old_collect_elided_lifetimes = self.collect_elided_lifetimes;
                     self.collect_elided_lifetimes = false;
@@ -1459,10 +1459,10 @@ fn visit_poly_trait_ref(
             }
 
             fn visit_generic_param(&mut self, param: &'v hir::GenericParam) {
-                // Record the introduction of 'a in `for<'a> ...`
+                // Record the introduction of 'a in `for<'a> ...`.
                 if let hir::GenericParamKind::Lifetime { .. } = param.kind {
                     // Introduce lifetimes one at a time so that we can handle
-                    // cases like `fn foo<'d>() -> impl for<'a, 'b: 'a, 'c: 'b + 'd>`
+                    // cases like `fn foo<'d>() -> impl for<'a, 'b: 'a, 'c: 'b + 'd>`.
                     let lt_name = hir::LifetimeName::Param(param.name);
                     self.currently_bound_lifetimes.push(lt_name);
                 }
@@ -1475,7 +1475,7 @@ fn visit_lifetime(&mut self, lifetime: &'v hir::Lifetime) {
                     hir::LifetimeName::Implicit | hir::LifetimeName::Underscore => {
                         if self.collect_elided_lifetimes {
                             // Use `'_` for both implicit and underscore lifetimes in
-                            // `abstract type Foo<'_>: SomeTrait<'_>;`
+                            // `abstract type Foo<'_>: SomeTrait<'_>;`.
                             hir::LifetimeName::Underscore
                         } else {
                             return;
@@ -1648,7 +1648,7 @@ fn lower_qpath(
                         {
                             ParenthesizedGenericArgs::Ok
                         }
-                        // Avoid duplicated errors
+                        // Avoid duplicated errors.
                         Def::Err => ParenthesizedGenericArgs::Ok,
                         // An error
                         Def::Struct(..)
@@ -1689,7 +1689,7 @@ fn lower_qpath(
         });
 
         // Simple case, either no projections, or only fully-qualified.
-        // E.g. `std::mem::size_of` or `<I as Iterator>::Item`.
+        // E.g., `std::mem::size_of` or `<I as Iterator>::Item`.
         if resolution.unresolved_segments() == 0 {
             return hir::QPath::Resolved(qself, path);
         }
@@ -1697,11 +1697,11 @@ fn lower_qpath(
         // Create the innermost type that we're projecting from.
         let mut ty = if path.segments.is_empty() {
             // If the base path is empty that means there exists a
-            // syntactical `Self`, e.g. `&i32` in `<&i32>::clone`.
+            // syntactical `Self`, e.g., `&i32` in `<&i32>::clone`.
             qself.expect("missing QSelf for <T>::...")
         } else {
             // Otherwise, the base path is an implicit `Self` type path,
-            // e.g. `Vec` in `Vec::new` or `<I as Iterator>::Item` in
+            // e.g., `Vec` in `Vec::new` or `<I as Iterator>::Item` in
             // `<I as Iterator>::Item::default`.
             let new_id = self.next_id();
             P(self.ty_path(new_id, p.span, hir::QPath::Resolved(qself, path)))
@@ -1709,7 +1709,7 @@ fn lower_qpath(
 
         // Anything after the base path are associated "extensions",
         // out of which all but the last one are associated types,
-        // e.g. for `std::vec::Vec::<T>::IntoIter::Item::clone`:
+        // e.g., for `std::vec::Vec::<T>::IntoIter::Item::clone`:
         // * base path is `std::vec::Vec<T>`
         // * "extensions" are `IntoIter`, `Item` and `clone`
         // * type nodes are:
@@ -1739,7 +1739,7 @@ fn lower_qpath(
             ty = P(self.ty_path(new_id, p.span, qpath));
         }
 
-        // Should've returned in the for loop above.
+        // We should've returned in the for loop above.
         span_bug!(
             p.span,
             "lower_qpath: no final extension segment in {}..{}",
@@ -1838,11 +1838,11 @@ fn lower_path_segment(
                 let no_bindings = generic_args.bindings.is_empty();
                 let (incl_angl_brckt, insertion_span, suggestion) = if no_ty_args && no_bindings {
                     // If there are no (non-implicit) generic args or associated-type
-                    // bindings, our suggestion includes the angle brackets
+                    // bindings, our suggestion includes the angle brackets.
                     (true, path_span.shrink_to_hi(), format!("<{}>", anon_lt_suggestion))
                 } else {
                     // Otherwise—sorry, this is kind of gross—we need to infer the
-                    // place to splice in the `'_, ` from the generics that do exist
+                    // place to splice in the `'_, ` from the generics that do exist.
                     let first_generic_span = first_generic_span
                         .expect("already checked that type args or bindings exist");
                     (false, first_generic_span.shrink_to_lo(), format!("{}, ", anon_lt_suggestion))
@@ -2096,14 +2096,15 @@ fn lower_async_fn_ret_ty(
         return_impl_trait_id: NodeId,
     ) -> hir::FunctionRetTy {
         // Get lifetimes used in the input arguments to the function. Our output type must also
-        // have the same lifetime. FIXME(cramertj) multiple different lifetimes are not allowed
-        // because `impl Trait + 'a + 'b` doesn't allow for capture `'a` and `'b` where neither
-        // is a subset of the other. We really want some new lifetime that is a subset of all input
-        // lifetimes, but that doesn't exist at the moment.
+        // have the same lifetime.
+        // FIXME(cramertj): multiple different lifetimes are not allowed because
+        // `impl Trait + 'a + 'b` doesn't allow for capture `'a` and `'b` where neither is a subset
+        // of the other. We really want some new lifetime that is a subset of all input lifetimes,
+        // but that doesn't exist at the moment.
 
         struct AsyncFnLifetimeCollector<'r, 'a: 'r> {
             context: &'r mut LoweringContext<'a>,
-            // Lifetimes bound by HRTB
+            // Lifetimes bound by HRTB.
             currently_bound_lifetimes: Vec<hir::LifetimeName>,
             // Whether to count elided lifetimes.
             // Disabled inside of `Fn` or `fn` syntax.
@@ -2133,7 +2134,7 @@ fn visit_generic_args(&mut self, span: Span, parameters: &'v hir::GenericArgs) {
             }
 
             fn visit_ty(&mut self, t: &'v hir::Ty) {
-                // Don't collect elided lifetimes used inside of `fn()` syntax
+                // Don't collect elided lifetimes used inside of `fn()` syntax.
                 if let &hir::TyKind::BareFn(_) = &t.node {
                     let old_collect_elided_lifetimes = self.collect_elided_lifetimes;
                     self.collect_elided_lifetimes = false;
@@ -2424,7 +2425,7 @@ fn lower_generic_param(&mut self,
             GenericParamKind::Type { ref default, .. } => {
                 // Don't expose `Self` (recovered "keyword used as ident" parse error).
                 // `rustc::ty` expects `Self` to be only used for a trait's `Self`.
-                // Instead, use gensym("Self") to create a distinct name that looks the same.
+                // Instead, use `gensym("Self")` to create a distinct name that looks the same.
                 let ident = if param.ident.name == keywords::SelfUpper.name() {
                     param.ident.gensym()
                 } else {
@@ -2467,7 +2468,7 @@ fn lower_generics(
         -> hir::Generics
     {
         // Collect `?Trait` bounds in where clause and move them to parameter definitions.
-        // FIXME: This could probably be done with less rightward drift. Also looks like two control
+        // FIXME: this could probably be done with less rightward drift. Also looks like two control
         //        paths where report_error is called are also the only paths that advance to after
         //        the match statement, so the error reporting could probably just be moved there.
         let mut add_bounds: NodeMap<Vec<_>> = Default::default();
@@ -2563,7 +2564,7 @@ fn lower_where_predicate(&mut self, pred: &WherePredicate) -> hir::WherePredicat
                                 .iter()
                                 .filter_map(|bound| match *bound {
                                     // Ignore `?Trait` bounds.
-                                    // Tthey were copied into type parameters already.
+                                    // They were copied into type parameters already.
                                     GenericBound::Trait(_, TraitBoundModifier::Maybe) => None,
                                     _ => Some(this.lower_param_bound(
                                         bound,
@@ -2662,7 +2663,7 @@ fn lower_struct_field(&mut self, (index, f): (usize, &StructField)) -> hir::Stru
             id: self.lower_node_id(f.id).node_id,
             ident: match f.ident {
                 Some(ident) => ident,
-                // FIXME(jseyfried) positional field hygiene
+                // FIXME(jseyfried): positional field hygiene
                 None => Ident::new(Symbol::intern(&index.to_string()), f.span),
             },
             vis: self.lower_visibility(&f.vis, None),
@@ -2946,7 +2947,7 @@ fn lower_item_kind(
         }
 
         // [1] `defaultness.has_value()` is never called for an `impl`, always `true` in order to
-        //     not cause an assertion failure inside the `lower_defaultness` function
+        //     not cause an assertion failure inside the `lower_defaultness` function.
     }
 
     fn lower_use_tree(
@@ -3190,7 +3191,7 @@ fn lower_use_tree(
 
     /// 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<hir::Path>) -> P<hir::Path> {
         debug!("renumber_segment_ids(path = {:?})", path);
         let mut path = path.clone();
@@ -3780,7 +3781,7 @@ fn lower_expr(&mut self, e: &Expr) -> hir::Expr {
                 let else_opt = else_opt.as_ref().map(|els| {
                     match els.node {
                         ExprKind::IfLet(..) => {
-                            // wrap the if-let expr in a block
+                            // Wrap the `if let` expr in a block.
                             let span = els.span;
                             let els = P(self.lower_expr(els));
                             let LoweredNodeId { node_id, hir_id } = self.next_id();
@@ -3871,7 +3872,7 @@ fn lower_expr(&mut self, e: &Expr) -> hir::Expr {
                     let fn_decl = self.lower_fn_decl(&outer_decl, None, false, None);
 
                     self.with_new_scopes(|this| {
-                        // FIXME(cramertj) allow `async` non-`move` closures with
+                        // FIXME(cramertj): allow `async` non-`move` closures with arguments.
                         if capture_clause == CaptureBy::Ref &&
                             !decl.inputs.is_empty()
                         {
@@ -3883,13 +3884,13 @@ fn lower_expr(&mut self, e: &Expr) -> hir::Expr {
                                 are not currently supported",
                             )
                                 .help("consider using `let` statements to manually capture \
-                                        variables by reference before entering an \
-                                        `async move` closure")
+                                       variables by reference before entering an \
+                                       `async move` closure")
                                 .emit();
                         }
 
                         // Transform `async |x: u8| -> X { ... }` into
-                        // `|x: u8| future_from_generator(|| -> X { ... })`
+                        // `|x: u8| future_from_generator(|| -> X { ... })`.
                         let body_id = this.lower_body(Some(&outer_decl), |this| {
                             let async_ret_ty = if let FunctionRetTy::Ty(ty) = &decl.output {
                                 Some(&**ty)
@@ -3972,7 +3973,7 @@ fn lower_expr(&mut self, e: &Expr) -> hir::Expr {
             ExprKind::Index(ref el, ref er) => {
                 hir::ExprKind::Index(P(self.lower_expr(el)), P(self.lower_expr(er)))
             }
-            // Desugar `<start>..=<end>` to `std::ops::RangeInclusive::new(<start>, <end>)`
+            // Desugar `<start>..=<end>` into `std::ops::RangeInclusive::new(<start>, <end>)`.
             ExprKind::Range(Some(ref e1), Some(ref e2), RangeLimits::Closed) => {
                 let id = self.next_id();
                 let e1 = self.lower_expr(e1);
@@ -4106,11 +4107,11 @@ fn lower_expr(&mut self, e: &Expr) -> hir::Expr {
             ),
             ExprKind::Paren(ref ex) => {
                 let mut ex = self.lower_expr(ex);
-                // include parens in span, but only if it is a super-span.
+                // Include parens in span, but only if it is a super-span.
                 if e.span.contains(ex.span) {
                     ex.span = e.span;
                 }
-                // merge attributes into the inner expression.
+                // Merge attributes into the inner expression.
                 let mut attrs = e.attrs.clone();
                 attrs.extend::<Vec<_>>(ex.attrs.into());
                 ex.attrs = attrs;
@@ -4128,8 +4129,8 @@ fn lower_expr(&mut self, e: &Expr) -> hir::Expr {
                 hir::ExprKind::Yield(P(expr))
             }
 
-            // Desugar ExprIfLet
-            // From: `if let <pat> = <sub_expr> <body> [<else_opt>]`
+            // Desugar `ExprIfLet`
+            // from: `if let <pat> = <sub_expr> <body> [<else_opt>]`
             ExprKind::IfLet(ref pats, ref sub_expr, ref body, ref else_opt) => {
                 // to:
                 //
@@ -4173,8 +4174,8 @@ fn lower_expr(&mut self, e: &Expr) -> hir::Expr {
                 )
             }
 
-            // Desugar ExprWhileLet
-            // From: `[opt_ident]: while let <pat> = <sub_expr> <body>`
+            // Desugar `ExprWhileLet`
+            // from: `[opt_ident]: while let <pat> = <sub_expr> <body>`
             ExprKind::WhileLet(ref pats, ref sub_expr, ref body, opt_label) => {
                 // to:
                 //
@@ -4223,12 +4224,12 @@ fn lower_expr(&mut self, e: &Expr) -> hir::Expr {
                     self.lower_label(opt_label),
                     hir::LoopSource::WhileLet,
                 );
-                // add attributes to the outer returned expr node
+                // Add attributes to the outer returned expr node.
                 loop_expr
             }
 
-            // Desugar ExprForLoop
-            // From: `[opt_ident]: for <pat> in <head> <body>`
+            // Desugar `ExprForLoop`
+            // from: `[opt_ident]: for <pat> in <head> <body>`
             ExprKind::ForLoop(ref pat, ref head, ref body, opt_label) => {
                 // to:
                 //
@@ -4386,21 +4387,21 @@ fn lower_expr(&mut self, e: &Expr) -> hir::Expr {
                 ));
 
                 // `{ let _result = ...; _result }`
-                // underscore prevents an unused_variables lint if the head diverges
+                // Underscore prevents an `unused_variables` lint if the head diverges.
                 let result_ident = self.str_to_ident("_result");
                 let (let_stmt, let_stmt_binding) =
                     self.stmt_let(e.span, false, result_ident, match_expr);
 
                 let result = P(self.expr_ident(e.span, result_ident, let_stmt_binding));
                 let block = P(self.block_all(e.span, hir_vec![let_stmt], Some(result)));
-                // add the attributes to the outer returned expr node
+                // Add the attributes to the outer returned expr node.
                 return self.expr_block(block, e.attrs.clone());
             }
 
-            // Desugar ExprKind::Try
-            // From: `<expr>?`
+            // Desugar `ExprKind::Try`
+            // from: `<expr>?`
             ExprKind::Try(ref sub_expr) => {
-                // to:
+                // into:
                 //
                 // match Try::into_result(<expr>) {
                 //     Ok(val) => #[allow(unreachable_code)] val,
@@ -4414,7 +4415,7 @@ fn lower_expr(&mut self, e: &Expr) -> hir::Expr {
                 let unstable_span =
                     self.allow_internal_unstable(CompilerDesugaringKind::QuestionMark, e.span);
 
-                // Try::into_result(<expr>)
+                // `Try::into_result(<expr>)`
                 let discr = {
                     // expand <expr>
                     let sub_expr = self.lower_expr(sub_expr);
@@ -4425,9 +4426,9 @@ fn lower_expr(&mut self, e: &Expr) -> hir::Expr {
                     P(self.expr_call(e.span, path, hir_vec![sub_expr]))
                 };
 
-                // #[allow(unreachable_code)]
+                // `#[allow(unreachable_code)]`
                 let attr = {
-                    // allow(unreachable_code)
+                    // `allow(unreachable_code)`
                     let allow = {
                         let allow_ident = Ident::from_str("allow").with_span_pos(e.span);
                         let uc_ident = Ident::from_str("unreachable_code").with_span_pos(e.span);
@@ -4438,7 +4439,7 @@ fn lower_expr(&mut self, e: &Expr) -> hir::Expr {
                 };
                 let attrs = vec![attr];
 
-                // Ok(val) => #[allow(unreachable_code)] val,
+                // `Ok(val) => #[allow(unreachable_code)] val,`
                 let ok_arm = {
                     let val_ident = self.str_to_ident("val");
                     let val_pat = self.pat_ident(e.span, val_ident);
@@ -4453,8 +4454,8 @@ fn lower_expr(&mut self, e: &Expr) -> hir::Expr {
                     self.arm(hir_vec![ok_pat], val_expr)
                 };
 
-                // Err(err) => #[allow(unreachable_code)]
-                //             return Try::from_error(From::from(err)),
+                // `Err(err) => #[allow(unreachable_code)]
+                //              return Try::from_error(From::from(err)),`
                 let err_arm = {
                     let err_ident = self.str_to_ident("err");
                     let err_local = self.pat_ident(e.span, err_ident);
@@ -5014,7 +5015,7 @@ fn new_error_lifetime(&mut self, id: Option<NodeId>, span: Span) -> hir::Lifetim
     /// error, depending on the mode.
     fn elided_path_lifetimes(&mut self, span: Span, count: usize) -> P<[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 then
             // report an error. This is because we don't want to support
             // impl elision for deprecated forms like
index 1ab1c7d3fc5c433655b0c807997c5e1cebe26080..40904eaa5db62905b76d2866f0f8e7f8162431fb 100644 (file)
@@ -13,7 +13,7 @@
 //! 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
-//! inferred).  And all `FnLike` instances have a body, i.e. the code
+//! inferred).  And all `FnLike` instances have a body, i.e., the code
 //! that is run when the function-like thing it represents is invoked.
 //!
 //! With the above abstraction in place, one can treat the program
@@ -34,7 +34,7 @@
 /// More specifically, it is one of either:
 ///
 ///   - A function item,
-///   - A closure expr (i.e. an ExprKind::Closure), or
+///   - A closure expr (i.e., an ExprKind::Closure), or
 ///   - The default implementation for a trait method.
 ///
 /// To construct one, use the `Code::from_node` function.
index eb9bd183fd939a12d8defaa5240d64f4f3d716eb..d5031efae576b86a1708926aed3dceb35632e090 100644 (file)
@@ -150,10 +150,9 @@ fn decode<D: Decoder>(d: &mut D) -> Result<DefPathTable, D::Error> {
     }
 }
 
-
 /// The definition table containing node definitions.
-/// It holds the DefPathTable for local DefIds/DefPaths and it also stores a
-/// mapping from NodeIds to local DefIds.
+/// It holds the `DefPathTable` for local `DefId`s/`DefPath`s and it also stores a
+/// mapping from `NodeId`s to local `DefId`s.
 #[derive(Clone, Default)]
 pub struct Definitions {
     table: DefPathTable,
index 99c92e1e31db19eac169017a75687d22f9c94012..b98e279aef4b964080c76e42e19f3556cf08d4de 100644 (file)
@@ -286,9 +286,7 @@ pub fn describe_def(&self, node_id: NodeId) -> Option<Def> {
 
         match node {
             Node::Item(item) => {
-                let def_id = || {
-                    self.local_def_id(item.id)
-                };
+                let def_id = || self.local_def_id(item.id);
 
                 match item.node {
                     ItemKind::Static(_, m, _) => Some(Def::Static(def_id(), m == MutMutable)),
@@ -383,7 +381,7 @@ pub fn krate(&self) -> &'hir Crate {
     pub fn trait_item(&self, id: TraitItemId) -> &'hir TraitItem {
         self.read(id.node_id);
 
-        // NB: intentionally bypass `self.forest.krate()` so that we
+        // N.B., intentionally bypass `self.forest.krate()` so that we
         // do not trigger a read of the whole krate here
         self.forest.krate.trait_item(id)
     }
@@ -391,7 +389,7 @@ pub fn trait_item(&self, id: TraitItemId) -> &'hir TraitItem {
     pub fn impl_item(&self, id: ImplItemId) -> &'hir ImplItem {
         self.read(id.node_id);
 
-        // NB: intentionally bypass `self.forest.krate()` so that we
+        // N.B., intentionally bypass `self.forest.krate()` so that we
         // do not trigger a read of the whole krate here
         self.forest.krate.impl_item(id)
     }
@@ -399,7 +397,7 @@ pub fn impl_item(&self, id: ImplItemId) -> &'hir ImplItem {
     pub fn body(&self, id: BodyId) -> &'hir Body {
         self.read(id.node_id);
 
-        // NB: intentionally bypass `self.forest.krate()` so that we
+        // N.B., intentionally bypass `self.forest.krate()` so that we
         // do not trigger a read of the whole krate here
         self.forest.krate.body(id)
     }
@@ -413,7 +411,7 @@ pub fn fn_decl(&self, node_id: ast::NodeId) -> Option<FnDecl> {
     }
 
     /// Returns the `NodeId` that corresponds to the definition of
-    /// which this is the body of, i.e. a `fn`, `const` or `static`
+    /// which this is the body of, i.e., a `fn`, `const` or `static`
     /// item (possibly associated), a closure, or a `hir::AnonConst`.
     pub fn body_owner(&self, BodyId { node_id }: BodyId) -> NodeId {
         let parent = self.get_parent_node(node_id);
@@ -484,7 +482,7 @@ pub fn ty_param_name(&self, id: NodeId) -> Name {
     pub fn trait_impls(&self, trait_did: DefId) -> &'hir [NodeId] {
         self.dep_graph.read(DepNode::new_no_params(DepKind::AllLocalTraitImpls));
 
-        // NB: intentionally bypass `self.forest.krate()` so that we
+        // N.B., intentionally bypass `self.forest.krate()` so that we
         // do not trigger a read of the whole krate here
         self.forest.krate.trait_impls.get(&trait_did).map_or(&[], |xs| &xs[..])
     }
@@ -492,7 +490,7 @@ pub fn trait_impls(&self, trait_did: DefId) -> &'hir [NodeId] {
     pub fn trait_auto_impl(&self, trait_did: DefId) -> Option<NodeId> {
         self.dep_graph.read(DepNode::new_no_params(DepKind::AllLocalTraitImpls));
 
-        // NB: intentionally bypass `self.forest.krate()` so that we
+        // N.B., intentionally bypass `self.forest.krate()` so that we
         // do not trigger a read of the whole krate here
         self.forest.krate.trait_auto_impl.get(&trait_did).cloned()
     }
@@ -565,14 +563,14 @@ pub fn find(&self, id: NodeId) -> Option<Node<'hir>> {
         result
     }
 
-    /// Similar to get_parent, returns the parent node id or id if there is no
-    /// parent. Note that the parent may be CRATE_NODE_ID, which is not itself
+    /// 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.
     /// This function returns the immediate parent in the AST, whereas get_parent
     /// returns the enclosing item. Note that this might not be the actual parent
     /// node in the AST - some kinds of nodes are not in the map and these will
-    /// never appear as the parent_node. So you can always walk the parent_nodes
+    /// never appear as the parent_node. So you can always walk the `parent_nodes`
     /// from a node to the root of the ast (unless you get the same id back here
     /// that can happen if the id is not in the map itself or is just weird).
     pub fn get_parent_node(&self, id: NodeId) -> NodeId {
@@ -608,7 +606,7 @@ pub fn is_argument(&self, id: NodeId) -> bool {
 
     /// 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<F, F2>(&self,
@@ -644,7 +642,7 @@ fn walk_parent_nodes<F, F2>(&self,
         }
     }
 
-    /// Retrieve the NodeId for `id`'s enclosing method, unless there's a
+    /// Retrieve the `NodeId` for `id`'s enclosing method, unless there's a
     /// `while` or `loop` before reaching it, as block tail returns are not
     /// available in them.
     ///
@@ -691,7 +689,7 @@ pub fn get_return_block(&self, id: NodeId) -> Option<NodeId> {
         self.walk_parent_nodes(id, match_fn, match_non_returning_block).ok()
     }
 
-    /// Retrieve the NodeId for `id`'s parent item, or `id` itself if no
+    /// Retrieve the `NodeId` for `id`'s parent item, or `id` itself if no
     /// parent item is in this map. The "parent item" is the closest parent node
     /// in the HIR which is recorded by the map and is an item, either an item
     /// in a module, trait, or impl.
@@ -708,13 +706,13 @@ pub fn get_parent(&self, id: NodeId) -> NodeId {
         }
     }
 
-    /// Returns the DefId of `id`'s nearest module parent, or `id` itself if no
+    /// Returns the `DefId` of `id`'s nearest module parent, or `id` itself if no
     /// module parent is in this map.
     pub fn get_module_parent(&self, id: NodeId) -> DefId {
         self.local_def_id(self.get_module_parent_node(id))
     }
 
-    /// Returns the NodeId of `id`'s nearest module parent, or `id` itself if no
+    /// Returns the `NodeId` of `id`'s nearest module parent, or `id` itself if no
     /// module parent is in this map.
     pub fn get_module_parent_node(&self, id: NodeId) -> NodeId {
         match self.walk_parent_nodes(id, |node| match *node {
@@ -727,7 +725,7 @@ pub fn get_module_parent_node(&self, id: NodeId) -> NodeId {
     }
 
     /// Returns the nearest enclosing scope. A scope is an item or block.
-    /// FIXME it is not clear to me that all items qualify as scopes - statics
+    /// FIXME: it is not clear to me that all items qualify as scopes -- statics
     /// and associated types probably shouldn't, for example. Behavior in this
     /// regard should be expected to be highly unstable.
     pub fn get_enclosing_scope(&self, id: NodeId) -> Option<NodeId> {
index 85bf257df237fa3052614cb9431e990ea726adbf..156d55b9e2fe61de4a2e97f9747fba2ed6217357 100644 (file)
@@ -8,7 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// The Rust HIR.
+// HIR datatypes. See the [rustc guide] for more info.
+//!
+//! [rustc guide]: https://rust-lang.github.io/rustc-guide/hir.html
 
 pub use self::BlockCheckMode::*;
 pub use self::CaptureClause::*;
@@ -71,7 +73,7 @@ macro_rules! hir_vec {
 
 /// 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"),
+/// 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
@@ -181,7 +183,7 @@ pub enum ParamName {
     Plain(Ident),
 
     /// Synthetic name generated when user elided a lifetime in an impl header,
-    /// e.g. the lifetimes in cases like these:
+    /// e.g., the lifetimes in cases like these:
     ///
     ///     impl Foo for &u32
     ///     impl Foo<'_> for u32
@@ -197,7 +199,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,
 }
 
@@ -222,7 +224,7 @@ pub enum LifetimeName {
     /// User-given names or fresh (synthetic) names.
     Param(ParamName),
 
-    /// User typed nothing. e.g. the lifetime in `&u32`.
+    /// User typed nothing. e.g., the lifetime in `&u32`.
     Implicit,
 
     /// Indicates an error during lowering (usually `'_` in wrong place)
@@ -351,7 +353,7 @@ pub struct PathSegment {
     /// Whether to infer remaining type parameters, if any.
     /// This only applies to expression and pattern paths, and
     /// out of those only the segments with no type parameters
-    /// to begin with, e.g. `Vec::new` is `<Vec<..>>::new::<..>`.
+    /// to begin with, e.g., `Vec::new` is `<Vec<..>>::new::<..>`.
     pub infer_types: bool,
 }
 
@@ -388,7 +390,7 @@ pub fn new(
     }
 
     // FIXME: hack required because you can't create a static
-    // GenericArgs, so you can't just return a &GenericArgs.
+    // `GenericArgs`, so you can't just return a `&GenericArgs`.
     pub fn with_generic_args<F, R>(&self, f: F) -> R
         where F: FnOnce(&GenericArgs) -> R
     {
@@ -514,17 +516,17 @@ pub fn span(&self) -> Span {
 
 #[derive(Copy, Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Debug)]
 pub enum LifetimeParamKind {
-    // Indicates that the lifetime definition was explicitly declared, like:
-    // `fn foo<'a>(x: &'a u8) -> &'a u8 { x }`
+    // Indicates that the lifetime definition was explicitly declared (e.g., in
+    // `fn foo<'a>(x: &'a u8) -> &'a u8 { x }`).
     Explicit,
 
     // Indicates that the lifetime definition was synthetically added
-    // as a result of an in-band lifetime usage like:
-    // `fn foo(x: &'a u8) -> &'a u8 { x }`
+    // as a result of an in-band lifetime usage (e.g., in
+    // `fn foo(x: &'a u8) -> &'a u8 { x }`).
     InBand,
 
-    // Indication that the lifetime was elided like both cases here:
-    // `fn foo(x: &u8) -> &'_ u8 { x }`
+    // Indication that the lifetime was elided (e.g., in both cases in
+    // `fn foo(x: &u8) -> &'_ u8 { x }`).
     Elided,
 
     // Indication that the lifetime name was somehow in error.
@@ -533,7 +535,7 @@ pub enum LifetimeParamKind {
 
 #[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
 pub enum GenericParamKind {
-    /// A lifetime definition, eg `'a: 'b + 'c + 'd`.
+    /// A lifetime definition (e.g., `'a: 'b + 'c + 'd`).
     Lifetime {
         kind: LifetimeParamKind,
     },
@@ -637,11 +639,11 @@ pub fn span(&self) -> Option<Span> {
 /// A single predicate in a `where` clause
 #[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
 pub enum WherePredicate {
-    /// A type binding, eg `for<'c> Foo: Send+Clone+'c`
+    /// A type binding (e.g., `for<'c> Foo: Send + Clone + 'c`).
     BoundPredicate(WhereBoundPredicate),
-    /// A lifetime predicate, e.g. `'a: 'b+'c`
+    /// A lifetime predicate (e.g., `'a: 'b + 'c`).
     RegionPredicate(WhereRegionPredicate),
-    /// An equality predicate (unsupported)
+    /// An equality predicate (unsupported).
     EqPredicate(WhereEqPredicate),
 }
 
@@ -667,7 +669,7 @@ pub struct WhereBoundPredicate {
     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,
@@ -675,7 +677,7 @@ pub struct WhereRegionPredicate {
     pub bounds: GenericBounds,
 }
 
-/// An equality predicate (unsupported), e.g. `T=int`
+/// An equality predicate (unsupported), e.g., `T=int`
 #[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
 pub struct WhereEqPredicate {
     pub id: NodeId,
@@ -697,7 +699,7 @@ pub struct Crate {
     pub span: Span,
     pub exported_macros: HirVec<MacroDef>,
 
-    // NB: 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
@@ -932,11 +934,11 @@ pub enum PatKind {
 
     /// 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<P<Pat>>),
 
-    /// 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<Spanned<FieldPat>>, bool),
 
@@ -954,11 +956,11 @@ pub enum PatKind {
     Tuple(HirVec<P<Pat>>, Option<usize>),
     /// A `box` pattern
     Box(P<Pat>),
-    /// A reference pattern, e.g. `&mut (a, b)`
+    /// A reference pattern, e.g., `&mut (a, b)`
     Ref(P<Pat>, Mutability),
     /// A literal
     Lit(P<Expr>),
-    /// A range pattern, e.g. `1...2` or `1..2`
+    /// A range pattern, e.g., `1...2` or `1..2`
     Range(P<Expr>, P<Expr>, RangeEnd),
     /// `[a, b, ..i, y, z]` is represented as:
     ///     `PatKind::Slice(box [a, b], Some(i), box [y, z])`
@@ -1319,8 +1321,8 @@ pub enum BodyOwnerKind {
 
 /// A constant (expression) that's not an item or associated item,
 /// but needs its own `DefId` for type-checking, const-eval, etc.
-/// These are usually found nested inside types (e.g. array lengths)
-/// or expressions (e.g. repeat counts), and also used to define
+/// These are usually found nested inside types (e.g., array lengths)
+/// or expressions (e.g., repeat counts), and also used to define
 /// explicit discriminant values for enum variants.
 #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Debug)]
 pub struct AnonConst {
@@ -1541,12 +1543,12 @@ pub enum QPath {
     /// Path to a definition, optionally "fully-qualified" with a `Self`
     /// type, if the path points to an associated item in a trait.
     ///
-    /// E.g. an unqualified path like `Clone::clone` has `None` for `Self`,
+    /// e.g., an unqualified path like `Clone::clone` has `None` for `Self`,
     /// while `<Vec<T> as Clone>::clone` has `Some(Vec<T>)` for `Self`,
     /// even though they both have the same two-segment `Clone::clone` `Path`.
     Resolved(Option<P<Ty>>, P<Path>),
 
-    /// Type-related paths, e.g. `<T>::default` or `<T>::Output`.
+    /// Type-related paths, e.g., `<T>::default` or `<T>::Output`.
     /// Will be resolved by type-checking to an associated item.
     ///
     /// UFCS source paths can desugar into this, with `Vec::new` turning into
@@ -1633,7 +1635,7 @@ pub enum CaptureClause {
     CaptureByRef,
 }
 
-// NB: If you change this, you'll probably want to change the corresponding
+// N.B., if you change this, you'll probably want to change the corresponding
 // type structure in middle/ty.rs as well.
 #[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
 pub struct MutTy {
@@ -1792,14 +1794,14 @@ pub enum TyKind {
     Ptr(MutTy),
     /// A reference (`&'a T` or `&'a mut T`)
     Rptr(Lifetime, MutTy),
-    /// A bare function (e.g. `fn(usize) -> bool`)
+    /// A bare function (e.g., `fn(usize) -> bool`)
     BareFn(P<BareFnTy>),
     /// The never type (`!`)
     Never,
     /// A tuple (`(A, B, C, D,...)`)
     Tup(HirVec<Ty>),
     /// A path to a type definition (`module::module::...::Type`), or an
-    /// associated type, e.g. `<Vec<T> as Trait>::Type` or `<T>::Target`.
+    /// associated type, e.g., `<Vec<T> as Trait>::Type` or `<T>::Target`.
     ///
     /// Type parameters may be stored in each `PathSegment`.
     Path(QPath),
@@ -1814,7 +1816,7 @@ pub enum TyKind {
     TraitObject(HirVec<PolyTraitRef>, Lifetime),
     /// Unused for now
     Typeof(AnonConst),
-    /// TyKind::Infer means the type should be inferred instead of it having been
+    /// `TyKind::Infer` means the type should be inferred instead of it having been
     /// specified. This can appear anywhere in a type.
     Infer,
     /// Placeholder for a type that has failed to be defined.
@@ -2017,7 +2019,7 @@ pub struct VariantKind {
     pub name: Name,
     pub attrs: HirVec<Attribute>,
     pub data: VariantData,
-    /// Explicit discriminant, eg `Foo = 1`
+    /// Explicit discriminant, e.g., `Foo = 1`
     pub disr_expr: Option<AnonConst>,
 }
 
@@ -2025,15 +2027,15 @@ pub struct VariantKind {
 
 #[derive(Copy, Clone, PartialEq, RustcEncodable, RustcDecodable, Debug)]
 pub enum UseKind {
-    /// One import, e.g. `use foo::bar` or `use foo::bar as baz`.
+    /// One import, e.g., `use foo::bar` or `use foo::bar as baz`.
     /// Also produced for each element of a list `use`, e.g.
     // `use foo::{a, b}` lowers to `use foo::a; use foo::b;`.
     Single,
 
-    /// Glob import, e.g. `use foo::*`.
+    /// Glob import, e.g., `use foo::*`.
     Glob,
 
-    /// Degenerate list import, e.g. `use foo::{a, b}` produces
+    /// Degenerate list import, e.g., `use foo::{a, b}` produces
     /// an additional `use foo::{}` for performing checks such as
     /// unstable feature gating. May be removed in the future.
     ListStem,
@@ -2196,7 +2198,7 @@ pub struct FnHeader {
 pub enum ItemKind {
     /// An `extern crate` item, with optional *original* crate name if the crate was renamed.
     ///
-    /// E.g. `extern crate foo` or `extern crate foo_bar as foo`
+    /// e.g., `extern crate foo` or `extern crate foo_bar as foo`
     ExternCrate(Option<Name>),
 
     /// `use foo::bar::*;` or `use foo::bar::baz as quux;`
@@ -2218,15 +2220,15 @@ pub enum ItemKind {
     ForeignMod(ForeignMod),
     /// Module-level inline assembly (from global_asm!)
     GlobalAsm(P<GlobalAsm>),
-    /// A type alias, e.g. `type Foo = Bar<u8>`
+    /// A type alias, e.g., `type Foo = Bar<u8>`
     Ty(P<Ty>, Generics),
-    /// An existential type definition, e.g. `existential type Foo: Bar;`
+    /// An existential type definition, e.g., `existential type Foo: Bar;`
     Existential(ExistTy),
-    /// An enum definition, e.g. `enum Foo<A, B> {C<A>, D<B>}`
+    /// An enum definition, e.g., `enum Foo<A, B> {C<A>, D<B>}`
     Enum(EnumDef, Generics),
-    /// A struct definition, e.g. `struct Foo<A> {x: A}`
+    /// A struct definition, e.g., `struct Foo<A> {x: A}`
     Struct(VariantData, Generics),
-    /// A union definition, e.g. `union Foo<A, B> {x: A, y: B}`
+    /// A union definition, e.g., `union Foo<A, B> {x: A, y: B}`
     Union(VariantData, Generics),
     /// Represents a Trait Declaration
     Trait(IsAuto, Unsafety, Generics, GenericBounds, HirVec<TraitItemRef>),
index 8a714a5fbd847173c8b2eefc82da51cf576dd0e2..d6816d3b81bf79fc2f93e8d5df0ee524532ca29f 100644 (file)
@@ -101,7 +101,7 @@ pub fn each_binding<F>(&self, mut f: F)
     }
 
     /// Checks if the pattern contains any patterns that bind something to
-    /// an ident, e.g. `foo`, or `Foo(foo)` or `foo @ Bar(..)`.
+    /// an ident, e.g., `foo`, or `Foo(foo)` or `foo @ Bar(..)`.
     pub fn contains_bindings(&self) -> bool {
         let mut contains_bindings = false;
         self.walk(|p| {
@@ -116,7 +116,7 @@ pub fn contains_bindings(&self) -> bool {
     }
 
     /// Checks if the pattern contains any patterns that bind something to
-    /// an ident or wildcard, e.g. `foo`, or `Foo(_)`, `foo @ Bar(..)`,
+    /// an ident or wildcard, e.g., `foo`, or `Foo(_)`, `foo @ Bar(..)`,
     pub fn contains_bindings_or_wild(&self) -> bool {
         let mut contains_bindings = false;
         self.walk(|p| {
index 484722f8c131bb04834367253caffa801b11a964..a24f2fa4bc65243b36ce73887ab8587180ed9f2e 100644 (file)
@@ -2448,8 +2448,8 @@ fn bin_op_to_assoc_op(op: hir::BinOpKind) -> AssocOp {
     }
 }
 
-/// Expressions that syntactically contain an "exterior" struct literal i.e. not surrounded by any
-/// parens or other delimiters, e.g. `X { y: 1 }`, `X { y: 1 }.method()`, `foo == X { y: 1 }` and
+/// Expressions that syntactically contain an "exterior" struct literal i.e., not surrounded by any
+/// parens or other delimiters, e.g., `X { y: 1 }`, `X { y: 1 }.method()`, `foo == X { y: 1 }` and
 /// `X { y: 1 } == foo` all do, but `(X { y: 1 }) == foo` does not.
 fn contains_exterior_struct_lit(value: &hir::Expr) -> bool {
     match value.node {
index 7c623a1874e7b4cc7bbf51b05d19eab57294652c..2e56308daf7c25d6ad9796a722e5d13b32bf9099 100644 (file)
@@ -45,7 +45,7 @@ fn compute_ignored_attr_names() -> FxHashSet<Symbol> {
 /// This is the context state available during incr. comp. hashing. It contains
 /// enough information to transform DefIds and HirIds into stable DefPaths (i.e.
 /// a reference to the TyCtxt) and it holds a few caches for speeding up various
-/// things (e.g. each DefId/DefPath is only hashed once).
+/// things (e.g., each DefId/DefPath is only hashed once).
 #[derive(Clone)]
 pub struct StableHashingContext<'a> {
     sess: &'a Session,
index f13210926a79b77361e21c83c2d5f3b814b7d88f..f124623becd93ddd06dd043ee8be273379710716 100644 (file)
@@ -371,7 +371,7 @@ fn relate_item_substs(&mut self,
         if self.ambient_variance == ty::Variance::Invariant {
             // Avoid fetching the variance if we are in an invariant
             // context; no need, and it can induce dependency cycles
-            // (e.g. #41849).
+            // (e.g., #41849).
             relate::relate_substs(self, None, a_subst, b_subst)
         } else {
             let opt_variances = self.tcx().variances_of(item_def_id);
index c7b5ddb83410f6c969a0c088aad262c6d7d6ad3e..27faa4587f3be937c7a3eb5edf1a9c08f78f08b2 100644 (file)
@@ -47,9 +47,9 @@ fn relate_item_substs(&mut self,
                           b_subst: &'tcx Substs<'tcx>)
                           -> RelateResult<'tcx, &'tcx Substs<'tcx>>
     {
-        // NB: Once we are equating types, we don't care about
+        // N.B., once we are equating types, we don't care about
         // variance, so don't try to lookup the variance here. This
-        // also avoids some cycles (e.g. #41849) since looking up
+        // also avoids some cycles (e.g., #41849) since looking up
         // variance requires computing types which can require
         // performing trait matching (which then performs equality
         // unification).
index 38363be48271506059840e85164266950e3892d4..df0dcbed30afa1ce361d1495bd0140550dcc1f39 100644 (file)
@@ -30,7 +30,7 @@ impl<'a, 'gcx, 'tcx> NiceRegionError<'a, 'gcx, 'tcx> {
     ///    { x.push(y); }
     /// ```
     /// The function returns the nested type corresponding to the anonymous region
-    /// for e.g. `&u8` and Vec<`&u8`.
+    /// for e.g., `&u8` and Vec<`&u8`.
     pub(super) fn find_anon_type(
         &self,
         region: Region<'tcx>,
@@ -97,7 +97,7 @@ struct FindNestedTypeVisitor<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> {
     // associated with the anonymous region we are looking for.
     bound_region: ty::BoundRegion,
     // The type where the anonymous lifetime appears
-    // for e.g. Vec<`&u8`> and <`&u8`>
+    // for e.g., Vec<`&u8`> and <`&u8`>
     found_type: Option<&'gcx hir::Ty>,
     current_index: ty::DebruijnIndex,
 }
index cf91b85807632f08ccf1dc24468221c0464c4a2d..c8cd11c8198772cfc3646d58a57aedaaa75c6402 100644 (file)
@@ -542,7 +542,7 @@ pub fn plug_leaks<T>(&self,
     /// Pops the placeholder regions found in `placeholder_map` from the region
     /// inference context. Whenever you create placeholder regions via
     /// `replace_bound_vars_with_placeholders`, they must be popped before you
-    /// commit the enclosing snapshot (if you do not commit, e.g. within a
+    /// commit the enclosing snapshot (if you do not commit, e.g., within a
     /// probe or as a result of an error, then this is not necessary, as
     /// popping happens as part of the rollback).
     ///
index d8beae45b0ad481243db4a8600258f6e699e1c58..b1a13354b7cdbd275ce869bbaf46834a9c5449a8 100644 (file)
@@ -219,7 +219,7 @@ pub struct InferCtxt<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> {
     /// `UniverseIndex::root()` but grows from there as we enter
     /// universal quantifiers.
     ///
-    /// NB: At present, we exclude the universal quantifiers on the
+    /// N.B., at present, we exclude the universal quantifiers on the
     /// item we are type-checking, and just consider those names as
     /// part of the root universe. So this would only get incremented
     /// when we enter into a higher-ranked (`for<..>`) type or trait
@@ -732,7 +732,7 @@ fn start_snapshot(&self) -> CombinedSnapshot<'a, 'tcx> {
             region_obligations_snapshot: self.region_obligations.borrow().len(),
             universe: self.universe(),
             was_in_snapshot: in_snapshot,
-            // Borrow tables "in progress" (i.e. during typeck)
+            // Borrow tables "in progress" (i.e., during typeck)
             // to ban writes from within a snapshot to them.
             _in_progress_tables: self.in_progress_tables.map(|tables| tables.borrow()),
         }
@@ -1047,7 +1047,7 @@ pub fn var_for_def(&self, span: Span, param: &ty::GenericParamDef) -> Kind<'tcx>
                 // type parameter definition. The substitutions are
                 // for actual parameters that may be referred to by
                 // the default of this type parameter, if it exists.
-                // E.g. `struct Foo<A, B, C = (A, B)>(...);` when
+                // e.g., `struct Foo<A, B, C = (A, B)>(...);` when
                 // used in a path such as `Foo::<T, U>::new()` will
                 // use an inference variable for `C` with `[T, U]`
                 // as the substitutions for the default, `(T, U)`.
@@ -1261,7 +1261,7 @@ pub fn resolve_type_vars_if_possible<T>(&self, value: &T) -> T
          * Where possible, replaces type/int/float variables in
          * `value` with their final value. Note that region variables
          * are unaffected. If a type variable has not been unified, it
-         * is left as is.  This is an idempotent operation that does
+         * is left as is. This is an idempotent operation that does
          * not affect inference state in any way and so you can do it
          * at will.
          */
@@ -1298,7 +1298,7 @@ pub fn fully_resolve<T: TypeFoldable<'tcx>>(&self, value: &T) -> FixupResult<T>
         /*!
          * Attempts to resolve all type/region variables in
          * `value`. Region inference must have been run already (e.g.,
-         * by calling `resolve_regions_and_report_errors`).  If some
+         * by calling `resolve_regions_and_report_errors`). If some
          * variable was never unified, an `Err` results.
          *
          * This method is idempotent, but it not typically not invoked
@@ -1331,7 +1331,7 @@ pub fn type_error_struct_with_diag<M>(
         let actual_ty = self.resolve_type_vars_if_possible(&actual_ty);
         debug!("type_error_struct_with_diag({:?}, {:?})", sp, actual_ty);
 
-        // Don't report an error if actual type is Error.
+        // Don't report an error if actual type is `Error`.
         if actual_ty.references_error() {
             return self.tcx.sess.diagnostic().struct_dummy();
         }
index 972ba16f7e2c7e156d5ceb344a32ba1a059bd920..773c7129722cf7f4784a535fa05dac0c00649b27 100644 (file)
@@ -15,7 +15,7 @@
 //!
 //! Here are the key differences:
 //!
-//! - This code may choose to bypass some checks (e.g. the occurs check)
+//! - This code may choose to bypass some checks (e.g., the occurs check)
 //!   in the case where we know that there are no unbound type inference
 //!   variables. This is the case for NLL, because at NLL time types are fully
 //!   inferred up-to regions.
@@ -97,7 +97,7 @@ pub trait TypeRelatingDelegate<'tcx> {
     /// region that is instantiated existentially. This creates an
     /// inference variable, typically.
     ///
-    /// So e.g. if you have `for<'a> fn(..) <: for<'b> fn(..)`, then
+    /// So e.g., if you have `for<'a> fn(..) <: for<'b> fn(..)`, then
     /// we will invoke this method to instantiate `'a` with an
     /// inference variable (though `'b` would be instantiated first,
     /// as a placeholder).
@@ -107,7 +107,7 @@ pub trait TypeRelatingDelegate<'tcx> {
     /// higher-ranked region that is instantiated universally.
     /// This creates a new region placeholder, typically.
     ///
-    /// So e.g. if you have `for<'a> fn(..) <: for<'b> fn(..)`, then
+    /// So e.g., if you have `for<'a> fn(..) <: for<'b> fn(..)`, then
     /// we will invoke this method to instantiate `'b` with a
     /// placeholder region.
     fn next_placeholder_region(&mut self, placeholder: ty::PlaceholderRegion) -> ty::Region<'tcx>;
index 09053118f696123eef07da9b84882d77308aa27d..44c5fe5acaa2b1407aeff4a53af31e56fb0aaa94 100644 (file)
@@ -761,7 +761,7 @@ fn fold_opaque_ty(
         );
 
         // Use the same type variable if the exact same Opaque appears more
-        // than once in the return type (e.g. if it's passed to a type alias).
+        // than once in the return type (e.g., if it's passed to a type alias).
         if let Some(opaque_defn) = self.opaque_types.get(&def_id) {
             return opaque_defn.concrete_ty;
         }
@@ -783,7 +783,7 @@ fn fold_opaque_ty(
         );
 
         // make sure that we are in fact defining the *entire* type
-        // e.g. `existential type Foo<T: Bound>: Bar;` needs to be
+        // e.g., `existential type Foo<T: Bound>: Bar;` needs to be
         // defined by a function like `fn foo<T: Bound>() -> Foo<T>`.
         debug!(
             "instantiate_opaque_types: param_env: {:#?}",
index 502a5828f3ea5c68109a389f4b9e27c38c13c430..7b21a6992a70ebe6cab6d14e2ee268fbe6690328 100644 (file)
@@ -408,7 +408,7 @@ fn projection_must_outlive(
 
         // Remove outlives bounds that we get from the environment but
         // which are also deducable from the trait. This arises (cc
-        // #55756) in cases where you have e.g. `<T as Foo<'a>>::Item:
+        // #55756) in cases where you have e.g., `<T as Foo<'a>>::Item:
         // 'a` in the environment but `trait Foo<'b> { type Item: 'b
         // }` in the trait definition.
         approx_env_bounds.retain(|bound| {
index af1b6964b818967abf4933d2a40c6cc30a2b9b17..9cac73dfab080b13dde0d71901108338c1a1d253 100644 (file)
@@ -60,7 +60,7 @@ pub struct RegionConstraintCollector<'tcx> {
     /// which can never be rolled back.
     undo_log: Vec<UndoLog<'tcx>>,
 
-    /// The number of open snapshots, i.e. those that haven't been committed or
+    /// The number of open snapshots, i.e., those that haven't been committed or
     /// rolled back.
     num_open_snapshots: usize,
 
@@ -607,7 +607,7 @@ fn add_constraint(&mut self, constraint: Constraint<'tcx>, origin: SubregionOrig
 
         // never overwrite an existing (constraint, origin) - only insert one if it isn't
         // present in the map yet. This prevents origins from outside the snapshot being
-        // replaced with "less informative" origins e.g. during calls to `can_eq`
+        // replaced with "less informative" origins e.g., during calls to `can_eq`
         let in_snapshot = self.in_snapshot();
         let undo_log = &mut self.undo_log;
         self.data.constraints.entry(constraint).or_insert_with(|| {
index 5624961ea6e67a23dcf7aa23b22e881e5b3b31e6..b7aac23b955c6a1e03805e72967d4b5d649a43f7 100644 (file)
@@ -175,7 +175,7 @@ pub fn instantiate(&mut self, vid: ty::TyVid, ty: Ty<'tcx>) {
     /// Creates a new type variable.
     ///
     /// - `diverging`: indicates if this is a "diverging" type
-    ///   variable, e.g.  one created as the type of a `return`
+    ///   variable, e.g.,  one created as the type of a `return`
     ///   expression. The code in this module doesn't care if a
     ///   variable is diverging, but the main Rust type-checker will
     ///   sometimes "unify" such variables with the `!` or `()` types.
index ddb0c5bf22ab6410299a4f061c2c3f9fc9cda00b..4324cfc7b5f10424c51586dfdc3f0fde73acbe78 100644 (file)
 #[macro_use]
 mod macros;
 
-// NB: This module needs to be declared first so diagnostics are
+// N.B., this module needs to be declared first so diagnostics are
 // registered before they are used.
 pub mod diagnostics;
 
index 22f2023eefbd874693121105c5deefbe6a9c39e8..a09d167f2173cfc739d705d3ca9a74332247538e 100644 (file)
 declare_lint! {
     pub LEGACY_DIRECTORY_OWNERSHIP,
     Deny,
-    "non-inline, non-`#[path]` modules (e.g. `mod foo;`) were erroneously allowed in some files \
+    "non-inline, non-`#[path]` modules (e.g., `mod foo;`) were erroneously allowed in some files \
      not named `mod.rs`"
 }
 
@@ -366,7 +366,7 @@ pub mod parser {
 }
 
 /// Does nothing as a lint pass, but registers some `Lint`s
-/// which are used by other parts of the compiler.
+/// that are used by other parts of the compiler.
 #[derive(Copy, Clone)]
 pub struct HardwiredLints;
 
index c633c0fb0360af45a71c86c4c01f4a72172f636e..449f8e0a2db67e73e8eefb487cdc29ca231376b7 100644 (file)
@@ -1270,7 +1270,7 @@ pub fn check_ast_crate(
     //
     // 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 {
index cfb9f04c4c6d104a869ed5d839a855695660f8ff..06e3e0bab4f1066a7d4308aab01da9b739baad7e 100644 (file)
@@ -66,7 +66,7 @@ fn process_command_line(&mut self, sess: &Session) {
         for &(ref lint_name, level) in &sess.opts.lint_opts {
             store.check_lint_name_cmdline(sess, &lint_name, level);
 
-            // If the cap is less than this specified level, e.g. if we've got
+            // If the cap is less than this specified level, e.g., if we've got
             // `--cap-lints allow` but we've also got `-D foo` then we ignore
             // this specification as the lint cap will set it to allow anyway.
             let level = cmp::min(level, self.lint_cap);
@@ -191,7 +191,7 @@ pub fn new(sess: &'a Session, sets: LintLevelSets) -> LintLevelsBuilder<'a> {
     /// * It'll validate all lint-related attributes in `attrs`
     /// * It'll mark all lint-related attributes as used
     /// * Lint levels will be updated based on the attributes provided
-    /// * Lint attributes are validated, e.g. a #[forbid] can't be switched to
+    /// * Lint attributes are validated, e.g., a #[forbid] can't be switched to
     ///   #[allow]
     ///
     /// Don't forget to call `pop`!
index f54fdf8b46875d1a7efd34e948431d45e6839de8..7a8aa7e362abbb0339974f986383b4c7a2db33e7 100644 (file)
@@ -67,7 +67,7 @@ pub struct Lint {
     /// `declare_lint!()` invocations to follow the convention of upper-case
     /// statics without repeating the name.
     ///
-    /// The name is written with underscores, e.g. "unused_imports".
+    /// The name is written with underscores, e.g., "unused_imports".
     /// On the command line, underscores become dashes.
     pub name: &'static str,
 
@@ -76,7 +76,7 @@ pub struct Lint {
 
     /// Description of the lint or the issue it detects.
     ///
-    /// e.g. "imports that are never used"
+    /// e.g., "imports that are never used"
     pub desc: &'static str,
 
     /// Starting at the given edition, default to the given lint level. If this is `None`, then use
@@ -173,7 +173,7 @@ macro_rules! lint_array {
 pub trait LintPass {
     /// Get descriptions of the lints this `LintPass` object can emit.
     ///
-    /// NB: there is no enforcement that the object only emits lints it registered.
+    /// N.B., there is no enforcement that the object only emits lints it registered.
     /// And some `rustc` internal `LintPass`es register lints to be emitted by other
     /// parts of the compiler. If you want enforced access restrictions for your
     /// `Lint`, make it a private `static` item in its own module.
index 4720bb2954963a1169ad66f9606b93e03e57d379..c7f93512cd89bf497480943b36e5247093ee77e9 100644 (file)
@@ -59,7 +59,7 @@ pub enum DepKind {
     /// A dependency that is only used for its macros.
     MacrosOnly,
     /// A dependency that is always injected into the dependency list and so
-    /// doesn't need to be linked to an rlib, e.g. the injected allocator.
+    /// doesn't need to be linked to an rlib, e.g., the injected allocator.
     Implicit,
     /// A dependency that is required by an rlib version of this crate.
     /// Ordinary `extern crate`s result in `Explicit` dependencies.
index 807d5a31143d93407a70fbff9b55ed42a6fa39e8..934d7c12be552883565e14c9b6f7dc593e34f04a 100644 (file)
@@ -311,7 +311,7 @@ fn has_allow_dead_code_or_lang_attr(tcx: TyCtxt<'_, '_, '_>,
     let cg_attrs = tcx.codegen_fn_attrs(def_id);
 
     // #[used], #[no_mangle], #[export_name], etc also keeps the item alive
-    // forcefully, e.g. for placing it in a specific section.
+    // forcefully, e.g., for placing it in a specific section.
     if cg_attrs.contains_extern_indicator() ||
         cg_attrs.flags.contains(CodegenFnAttrFlags::USED) {
         return true;
index 549a848a39dc1cdb184d263a7ae21944e29e4664..5e75f119aef9c274f31944dfe2275164ff7c958a 100644 (file)
@@ -201,7 +201,7 @@ fn calculate_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
     // static libraries.
     //
     // If the crate hasn't been included yet and it's not actually required
-    // (e.g. it's an allocator) then we skip it here as well.
+    // (e.g., it's an allocator) then we skip it here as well.
     for &cnum in tcx.crates().iter() {
         let src = tcx.used_crate_source(cnum);
         if src.dylib.is_none() &&
@@ -306,7 +306,7 @@ fn attempt_static<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Option<DependencyLis
 
 // Given a list of how to link upstream dependencies so far, ensure that an
 // injected dependency is activated. This will not do anything if one was
-// transitively included already (e.g. via a dylib or explicitly so).
+// transitively included already (e.g., via a dylib or explicitly so).
 //
 // If an injected dependency was not found then we're guaranteed the
 // metadata::creader module has injected that dependency (not listed as
index 93fe607f5fa1499ca0882b8ffd42ca6a1f89ab90..60ddf60cde2cf766ae196ff33424b0bb1fbd4e73 100644 (file)
@@ -87,7 +87,7 @@ pub fn find_entry_point(session: &Session,
     configure_main(&mut ctxt, crate_name);
 }
 
-// Beware, this is duplicated in libsyntax/entry.rs, make sure to keep
+// Beware, this is duplicated in `libsyntax/entry.rs`, so make sure to keep
 // them in sync.
 fn entry_point_type(item: &Item, at_root: bool) -> EntryPointType {
     match item.node {
@@ -98,7 +98,7 @@ fn entry_point_type(item: &Item, at_root: bool) -> EntryPointType {
                 EntryPointType::MainAttr
             } else if item.name == "main" {
                 if at_root {
-                    // This is a top-level function so can be 'main'
+                    // This is a top-level function so can be 'main'.
                     EntryPointType::MainNamed
                 } else {
                     EntryPointType::OtherMain
index 32e23a67bdc3b9cbb9664f4062fbf0a48e80d913..f1bc37d03e5a1fbaef36ec34b58c6ea998f202c2 100644 (file)
@@ -813,7 +813,7 @@ fn walk_arm(&mut self, discr_cmt: mc::cmt<'tcx>, arm: &hir::Arm, mode: MatchMode
         self.consume_expr(&arm.body);
     }
 
-    /// Walks a pat that occurs in isolation (i.e. top-level of fn
+    /// Walks a pat that occurs in isolation (i.e., top-level of fn
     /// arg or let binding.  *Not* a match arm or nested pat.)
     fn walk_irrefutable_pat(&mut self, cmt_discr: mc::cmt<'tcx>, pat: &hir::Pat) {
         let mut mode = Unknown;
@@ -851,7 +851,7 @@ fn determine_pat_move_mode(&mut self,
     }
 
     /// The core driver for walking a pattern; `match_mode` must be
-    /// established up front, e.g. via `determine_pat_move_mode` (see
+    /// established up front, e.g., via `determine_pat_move_mode` (see
     /// also `walk_irrefutable_pat` for patterns that stand alone).
     fn walk_pat(&mut self, cmt_discr: mc::cmt<'tcx>, pat: &hir::Pat, match_mode: MatchMode) {
         debug!("walk_pat(cmt_discr={:?}, pat={:?})", cmt_discr, pat);
index f0f8124c076f6c7d5eef48fea000c333759857c5..23ec24d71d2ebc889fbf705d6e8c90c2f1c0b4db 100644 (file)
@@ -13,9 +13,9 @@
 // Language items are items that represent concepts intrinsic to the language
 // itself. Examples are:
 //
-// * Traits that specify "kinds"; e.g. "Sync", "Send".
+// * Traits that specify "kinds"; e.g., "Sync", "Send".
 //
-// * Traits that represent operators; e.g. "Add", "Sub", "Index".
+// * Traits that represent operators; e.g., "Add", "Sub", "Index".
 //
 // * Functions called by the compiler itself.
 
index a33ef10a27b76cf73a571ee5fa1f50a8dedbb7a3..8934c7ebb2a6f2e0314f0435fbd857cb992951e7 100644 (file)
@@ -8,9 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// Detecting lib features (i.e. features that are not lang features).
+// Detecting lib features (i.e., features that are not lang features).
 //
-// These are declared using stability attributes (e.g. `#[stable (..)]`
+// These are declared using stability attributes (e.g., `#[stable (..)]`
 // and `#[unstable (..)]`), but are not declared in one single location
 // (unlike lang features), which means we need to collect them instead.
 
@@ -61,7 +61,7 @@ fn new(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> LibFeatureCollector<'a, 'tcx> {
     fn extract(&self, attr: &Attribute) -> Option<(Symbol, Option<Symbol>, Span)> {
         let stab_attrs = vec!["stable", "unstable", "rustc_const_unstable"];
 
-        // Find a stability attribute (i.e. `#[stable (..)]`, `#[unstable (..)]`,
+        // Find a stability attribute (i.e., `#[stable (..)]`, `#[unstable (..)]`,
         // `#[rustc_const_unstable (..)]`).
         if let Some(stab_attr) = stab_attrs.iter().find(|stab_attr| {
             attr.check_name(stab_attr)
index b7cea975e0a229f96e3ca15ba03ebe20d746d3e7..e576951417f93b27026c2dbe17169871dedf5e81 100644 (file)
@@ -554,7 +554,7 @@ struct RWUTable {
     /// 65 bits of data into 32; in the uncommon cases, it expands the 65 bits
     /// in 96.
     ///
-    /// More compact representations are possible -- e.g. use only 2 bits per
+    /// More compact representations are possible -- e.g., use only 2 bits per
     /// packed `RWU` and make the secondary table a HashMap that maps from
     /// indices to `RWU`s -- but this one strikes a good balance between size
     /// and speed.
index c8fd75a6ec9d8f8afb2c2e5ed8f9eeca74651ddc..a04914e9774935f686596764a1046b72e0c7f249 100644 (file)
@@ -127,7 +127,7 @@ pub enum PointerKind<'tcx> {
 }
 
 // We use the term "interior" to mean "something reachable from the
-// base without a pointer dereference", e.g. a field
+// base without a pointer dereference", e.g., a field
 #[derive(Clone, Copy, PartialEq, Eq, Hash)]
 pub enum InteriorKind {
     InteriorField(FieldIndex),
@@ -153,8 +153,8 @@ fn hash<H: Hasher>(&self, h: &mut H) {
 
 #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
 pub enum InteriorOffsetKind {
-    Index,   // e.g. `array_expr[index_expr]`
-    Pattern, // e.g. `fn foo([_, a, _, _]: [A; 4]) { ... }`
+    Index,   // e.g., `array_expr[index_expr]`
+    Pattern, // e.g., `fn foo([_, a, _, _]: [A; 4]) { ... }`
 }
 
 #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
@@ -961,7 +961,7 @@ pub fn cat_rvalue_node(&self,
 
         debug!("cat_rvalue_node: promotable = {:?}", promotable);
 
-        // Always promote `[T; 0]` (even when e.g. borrowed mutably).
+        // Always promote `[T; 0]` (even when e.g., borrowed mutably).
         let promotable = match expr_ty.sty {
             ty::Array(_, len) if len.assert_usize(self.tcx) == Some(0) => true,
             _ => promotable,
index 0a4ddf8b572fc5fc10a1059f8d402a3276755c47..9977faf5b2c9e161c35d22b0b31d73ccb959fb56 100644 (file)
@@ -84,7 +84,7 @@
 ///  (D9.): DestructionScope for temporaries created during M8.
 /// (R10.): Remainder scope for block `'b:`, stmt 1 (let y = ...).
 /// (D11.): DestructionScope for temporaries and bindings from block `'b:`.
-/// (D12.): DestructionScope for temporaries created during M1 (e.g. f()).
+/// (D12.): DestructionScope for temporaries created during M1 (e.g., f()).
 /// ```
 ///
 /// Note that while the above picture shows the destruction scopes
@@ -155,7 +155,7 @@ pub enum ScopeData {
 ///   everything after that first `let`. (If you want a scope that
 ///   includes EXPR_1 as well, then do not use `Scope::Remainder`,
 ///   but instead another `Scope` that encompasses the whole block,
-///   e.g. `Scope::Node`.
+///   e.g., `Scope::Node`.
 ///
 /// * the subscope with `first_statement_index == 1` is scope of `c`,
 ///   and thus does not include EXPR_2, but covers the `...`.
@@ -172,7 +172,7 @@ pub struct FirstStatementIndex { .. }
 impl Scope {
     /// Returns a item-local id associated with this scope.
     ///
-    /// NB: likely to be replaced as API is refined; e.g. pnkfelix
+    /// N.B., likely to be replaced as API is refined; e.g., pnkfelix
     /// anticipates `fn entry_node_id` and `fn each_exit_node_id`.
     pub fn item_local_id(&self) -> hir::ItemLocalId {
         self.id
@@ -770,10 +770,10 @@ fn resolve_block<'a, 'tcx>(visitor: &mut RegionResolutionVisitor<'a, 'tcx>, blk:
     //    }, other_argument());
     //
     // Each of the statements within the block is a terminating
-    // scope, and thus a temporary (e.g. the result of calling
+    // scope, and thus a temporary (e.g., the result of calling
     // `bar()` in the initializer expression for `let inner = ...;`)
     // will be cleaned up immediately after its corresponding
-    // statement (i.e. `let inner = ...;`) executes.
+    // statement (i.e., `let inner = ...;`) executes.
     //
     // On the other hand, temporaries associated with evaluating the
     // tail expression for the block are assigned lifetimes so that
@@ -984,7 +984,7 @@ fn resolve_local<'a, 'tcx>(visitor: &mut RegionResolutionVisitor<'a, 'tcx>,
 
     // As an exception to the normal rules governing temporary
     // lifetimes, initializers in a let have a temporary lifetime
-    // of the enclosing block. This means that e.g. a program
+    // of the enclosing block. This means that e.g., a program
     // like the following is legal:
     //
     //     let ref x = HashMap::new();
@@ -1183,7 +1183,7 @@ fn record_rvalue_scope<'a, 'tcx>(visitor: &mut RegionResolutionVisitor<'a, 'tcx>
         loop {
             // Note: give all the expressions matching `ET` with the
             // extended temporary lifetime, not just the innermost rvalue,
-            // because in codegen if we must compile e.g. `*rvalue()`
+            // because in codegen if we must compile e.g., `*rvalue()`
             // into a temporary, we request the temporary scope of the
             // outer expression.
             visitor.scope_tree.record_rvalue_scope(expr.hir_id.local_id, blk_scope);
@@ -1281,7 +1281,7 @@ fn visit_body(&mut self, body: &'tcx hir::Body) {
             // according to rvalue lifetime semantics, using the same
             // syntactical rules used for let initializers.
             //
-            // E.g. in `let x = &f();`, the temporary holding the result from
+            // e.g., in `let x = &f();`, the temporary holding the result from
             // the `f()` call lives for the entirety of the surrounding block.
             //
             // Similarly, `const X: ... = &f();` would have the result of `f()`
@@ -1292,7 +1292,7 @@ fn visit_body(&mut self, body: &'tcx hir::Body) {
             //
             // However, `const Y: ... = g(&f());`, like `let y = g(&f());`,
             // would *not* let the `f()` temporary escape into an outer scope
-            // (i.e. `'static`), which means that after `g` returns, it drops,
+            // (i.e., `'static`), which means that after `g` returns, it drops,
             // and all the associated destruction scope rules apply.
             self.cx.var_parent = None;
             resolve_local(self, None, Some(&body.value));
index 54d8d169288d1541adcb7fa280185cc8a8dadc55..571f718f905f4b881d7b5729a43745725030f3a8 100644 (file)
@@ -303,14 +303,14 @@ enum Scope<'a> {
     /// Lifetimes introduced by a fn are scoped to the call-site for that fn,
     /// if this is a fn body, otherwise the original definitions are used.
     /// Unspecified lifetimes are inferred, unless an elision scope is nested,
-    /// e.g. `(&T, fn(&T) -> &T);` becomes `(&'_ T, for<'a> fn(&'a T) -> &'a T)`.
+    /// e.g., `(&T, fn(&T) -> &T);` becomes `(&'_ T, for<'a> fn(&'a T) -> &'a T)`.
     Body {
         id: hir::BodyId,
         s: ScopeRef<'a>,
     },
 
     /// A scope which either determines unspecified lifetimes or errors
-    /// on them (e.g. due to ambiguity). For more details, see `Elide`.
+    /// on them (e.g., due to ambiguity). For more details, see `Elide`.
     Elision {
         elide: Elide,
         s: ScopeRef<'a>,
@@ -622,13 +622,13 @@ fn visit_ty(&mut self, ty: &'tcx hir::Ty) {
                     LifetimeName::Implicit => {
                         // If the user does not write *anything*, we
                         // use the object lifetime defaulting
-                        // rules. So e.g. `Box<dyn Debug>` becomes
+                        // rules. So e.g., `Box<dyn Debug>` becomes
                         // `Box<dyn Debug + 'static>`.
                         self.resolve_object_lifetime_default(lifetime)
                     }
                     LifetimeName::Underscore => {
                         // If the user writes `'_`, we use the *ordinary* elision
-                        // rules. So the `'_` in e.g. `Box<dyn Debug + '_>` will be
+                        // rules. So the `'_` in e.g., `Box<dyn Debug + '_>` will be
                         // resolved the same as the `'_` in `&'_ Foo`.
                         //
                         // cc #48468
@@ -1699,7 +1699,7 @@ fn visit_early_late<F>(
     {
         insert_late_bound_lifetimes(self.map, decl, generics);
 
-        // Find the start of nested early scopes, e.g. in methods.
+        // Find the start of nested early scopes, e.g., in methods.
         let mut index = 0;
         if let Some(parent_id) = parent_id {
             let parent = self.tcx.hir().expect_item(parent_id);
index 52a81d9a1c00993131876865aa4a11c226b6ff05..ab379c910f7764b645e45803c875497b2a99c2d4 100644 (file)
 pub use self::StabilityLevel::*;
 
 use lint;
+use hir::{self, Item, Generics, StructField, Variant, HirId};
 use hir::def::Def;
 use hir::def_id::{CrateNum, CRATE_DEF_INDEX, DefId, LOCAL_CRATE};
-use ty::{self, TyCtxt};
+use hir::intravisit::{self, Visitor, NestedVisitorMap};
 use middle::privacy::AccessLevels;
 use session::{DiagnosticMessageId, Session};
 use syntax::symbol::Symbol;
 use syntax::ast::{NodeId, Attribute};
 use syntax::feature_gate::{GateIssue, emit_feature_err};
 use syntax::attr::{self, Stability, Deprecation};
+use ty::{self, TyCtxt};
 use util::nodemap::{FxHashSet, FxHashMap};
 
-use hir;
-use hir::{Item, Generics, StructField, Variant, HirId};
-use hir::intravisit::{self, Visitor, NestedVisitorMap};
-
 use std::mem::replace;
 use std::cmp::Ordering;
 
@@ -474,10 +472,10 @@ pub fn check_unstable_api_usage<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
 }
 
 /// Check whether an item marked with `deprecated(since="X")` is currently
-/// deprecated (i.e. whether X is not greater than the current rustc version).
+/// deprecated (i.e., whether X is not greater than the current rustc version).
 pub fn deprecation_in_effect(since: &str) -> bool {
     fn parse_version(ver: &str) -> Vec<u32> {
-        // We ignore non-integer components of the version (e.g. "nightly").
+        // We ignore non-integer components of the version (e.g., "nightly").
         ver.split(|c| c == '.' || c == '-').flat_map(|s| s.parse()).collect()
     }
 
@@ -518,7 +516,7 @@ pub enum EvalResult {
 }
 
 impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
-    // (See issue #38412)
+    // See issue #38412.
     fn skip_stability_check_due_to_privacy(self, mut def_id: DefId) -> bool {
         // Check if `def_id` is a trait method.
         match self.describe_def(def_id) {
@@ -528,8 +526,8 @@ fn skip_stability_check_due_to_privacy(self, mut def_id: DefId) -> bool {
                 if let ty::TraitContainer(trait_def_id) = self.associated_item(def_id).container {
                     // Trait methods do not declare visibility (even
                     // for visibility info in cstore). Use containing
-                    // trait instead, so methods of pub traits are
-                    // themselves considered pub.
+                    // trait instead, so methods of `pub` traits are
+                    // themselves considered `pub`.
                     def_id = trait_def_id;
                 }
             }
@@ -539,10 +537,10 @@ fn skip_stability_check_due_to_privacy(self, mut def_id: DefId) -> bool {
         let visibility = self.visibility(def_id);
 
         match visibility {
-            // must check stability for pub items.
+            // Must check stability for `pub` items.
             ty::Visibility::Public => false,
 
-            // these are not visible outside crate; therefore
+            // These are not visible outside crate; therefore
             // stability markers are irrelevant, if even present.
             ty::Visibility::Restricted(..) |
             ty::Visibility::Invisible => true,
@@ -628,7 +626,7 @@ pub fn eval_stability(self, def_id: DefId, id: Option<NodeId>, span: Span) -> Ev
             return EvalResult::Allow;
         }
 
-        // Issue 38412: private items lack stability markers.
+        // Issue #38412: private items lack stability markers.
         if self.skip_stability_check_due_to_privacy(def_id) {
             return EvalResult::Allow;
         }
@@ -644,7 +642,7 @@ pub fn eval_stability(self, def_id: DefId, id: Option<NodeId>, span: Span) -> Ev
                 // crates also pulled in from crates.io. We want to ideally be
                 // able to compile everything without requiring upstream
                 // modifications, so in the case that this looks like a
-                // rustc_private crate (e.g. a compiler crate) and we also have
+                // `rustc_private` crate (e.g., a compiler crate) and we also have
                 // the `-Z force-unstable-if-unmarked` flag present (we're
                 // compiling a compiler crate), then let this missing feature
                 // annotation slide.
@@ -794,7 +792,7 @@ pub fn lookup_deprecation(self, id: DefId) -> Option<Deprecation> {
     }
 }
 
-/// Given the list of enabled features that were not language features (i.e. that
+/// Given the list of enabled features that were not language features (i.e., that
 /// were expected to be library features), and the list of features used from
 /// libraries, identify activated features that don't exist and error about them.
 pub fn check_unused_or_stable_features<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
index 503e0abdbf3002a247af861259e2e0f2ff7ea211..289f693df244d0d43728cc2bbd9a6960a598fd42 100644 (file)
@@ -378,7 +378,7 @@ pub fn description(&self) -> &str {
                 "tried to read from foreign (extern) static",
             InvalidPointerMath =>
                 "attempted to do invalid arithmetic on pointers that would leak base addresses, \
-                e.g. comparing pointers into different allocations",
+                e.g., comparing pointers into different allocations",
             ReadUndefBytes(_) =>
                 "attempted to read undefined bytes",
             DeadLocal =>
index 2d503de25f7bca7c681891d20ba37baf1239c105..b7a429520757791f7921827497417b1f23613026 100644 (file)
@@ -556,7 +556,7 @@ pub enum BorrowKind {
     /// Data is mutable and not aliasable.
     Mut {
         /// True if this borrow arose from method-call auto-ref
-        /// (i.e. `adjustment::Adjust::Borrow`)
+        /// (i.e., `adjustment::Adjust::Borrow`)
         allow_two_phase_borrow: bool,
     },
 }
@@ -692,7 +692,7 @@ fn hash_stable<W: StableHasherResult>(
 /// expression; that is, a block like `{ STMT_1; STMT_2; EXPR }`.
 ///
 /// It is used to improve diagnostics when such temporaries are
-/// involved in borrow_check errors, e.g. explanations of where the
+/// involved in borrow_check errors, e.g., explanations of where the
 /// temporaries come from, when their destructors are run, and/or how
 /// one might revise the code to satisfy the borrow checker's rules.
 #[derive(Clone, Debug, RustcEncodable, RustcDecodable)]
@@ -701,7 +701,7 @@ pub struct BlockTailInfo {
     /// expression is ignored by the block's expression context.
     ///
     /// Examples include `{ ...; tail };` and `let _ = { ...; tail };`
-    /// but not e.g. `let _x = { ...; tail };`
+    /// but not e.g., `let _x = { ...; tail };`
     pub tail_result_is_ignored: bool,
 }
 
@@ -756,7 +756,7 @@ pub struct LocalDecl<'tcx> {
     pub ty: Ty<'tcx>,
 
     /// If the user manually ascribed a type to this variable,
-    /// e.g. via `let x: T`, then we carry that type here. The MIR
+    /// e.g., via `let x: T`, then we carry that type here. The MIR
     /// borrow checker needs this information since it can affect
     /// region inference.
     pub user_ty: UserTypeProjections<'tcx>,
@@ -767,7 +767,7 @@ pub struct LocalDecl<'tcx> {
     /// to generate better debuginfo.
     pub name: Option<Name>,
 
-    /// The *syntactic* (i.e. not visibility) source scope the local is defined
+    /// The *syntactic* (i.e., not visibility) source scope the local is defined
     /// in. If the local was defined in a let-statement, this
     /// is *within* the let-statement, rather than outside
     /// of it.
@@ -1745,7 +1745,7 @@ pub enum StatementKind<'tcx> {
     Assign(Place<'tcx>, Box<Rvalue<'tcx>>),
 
     /// This represents all the reading that a pattern match may do
-    /// (e.g. inspecting constants and discriminant values), and the
+    /// (e.g., inspecting constants and discriminant values), and the
     /// kind of pattern it comes from. This is in order to adapt potential
     /// error messages to these specific patterns.
     FakeRead(FakeReadCause, Place<'tcx>),
@@ -2180,7 +2180,7 @@ pub enum Rvalue<'tcx> {
 
     /// Read the discriminant of an ADT.
     ///
-    /// Undefined (i.e. no effort is made to make it defined, but there’s no reason why it cannot
+    /// Undefined (i.e., no effort is made to make it defined, but there’s no reason why it cannot
     /// be defined to return, say, a 0) if ADT is not an enum.
     Discriminant(Place<'tcx>),
 
@@ -2222,7 +2222,7 @@ pub enum AggregateKind<'tcx> {
     /// The second field is the variant index. It's equal to 0 for struct
     /// and union expressions. The fourth field is
     /// active field number and is present only for union expressions
-    /// -- e.g. for a union expression `SomeUnion { c: .. }`, the
+    /// -- e.g., for a union expression `SomeUnion { c: .. }`, the
     /// active field index would identity the field `c`
     Adt(
         &'tcx AdtDef,
index ff2bf3d78070d4b60d19416982bfd92ff300e8ce..c96cbd40efaf817f9013d3d776a4e36d2abd9410 100644 (file)
@@ -272,7 +272,7 @@ pub fn new(tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Self {
     ///
     /// The '.' before `<special-suffix>` makes sure that names with a special
     /// suffix can never collide with a name built out of regular Rust
-    /// identifiers (e.g. module paths).
+    /// identifiers (e.g., module paths).
     pub fn build_cgu_name<I, C, S>(&mut self,
                                    cnum: CrateNum,
                                    components: I,
index f3a0b7de903744eed856192dda2a88f301c05295..4424ba0a4f7a109d2715245241266450f0f631f4 100644 (file)
@@ -253,7 +253,7 @@ fn size_hint(&self) -> (usize, Option<usize>) {
 /// ```
 ///
 /// A reverse postorder traversal of this graph is either `A B C D` or `A C B D`
-/// Note that for a graph containing no loops (i.e. A DAG), this is equivalent to
+/// Note that for a graph containing no loops (i.e., A DAG), this is equivalent to
 /// a topological sort.
 ///
 /// Construction of a `ReversePostorder` traversal requires doing a full
index d40d85a193789e9de6b135bc1a1606723affc689..237f6bc9c7b45b81627c8028895eab5f95269845 100644 (file)
@@ -33,7 +33,7 @@
 // in that circumstance.
 //
 // For the most part, we do not destructure things external to the
-// MIR, e.g. types, spans, etc, but simply visit them and stop. This
+// MIR, e.g., types, spans, etc, but simply visit them and stop. This
 // avoids duplication with other visitors like `TypeFoldable`.
 //
 // ## Updating
@@ -997,7 +997,7 @@ pub enum NonMutatingUseContext<'tcx> {
     ShallowBorrow(Region<'tcx>),
     /// Unique borrow.
     UniqueBorrow(Region<'tcx>),
-    /// Used as base for another place, e.g. `x` in `x.y`. Will not mutate the place.
+    /// Used as base for another place, e.g., `x` in `x.y`. Will not mutate the place.
     /// For example, the projection `x.y` is not marked as a mutation in these cases:
     ///
     ///     z = x.y;
@@ -1020,7 +1020,7 @@ pub enum MutatingUseContext<'tcx> {
     Drop,
     /// Mutable borrow.
     Borrow(Region<'tcx>),
-    /// Used as base for another place, e.g. `x` in `x.y`. Could potentially mutate the place.
+    /// Used as base for another place, e.g., `x` in `x.y`. Could potentially mutate the place.
     /// For example, the projection `x.y` is marked as a mutation in these cases:
     ///
     ///     x.y = ...;
index f1ddcda823ee799927825dccf0834ed610732af6..51855ff6cc82c606842966054f03ae361bd41f4c 100644 (file)
@@ -1280,7 +1280,7 @@ fn parse_cross_lang_lto(slot: &mut CrossLangLto, v: Option<&str>) -> bool {
     dump_mir_exclude_pass_number: bool = (false, parse_bool, [UNTRACKED],
         "if set, exclude the pass number when dumping MIR (used in tests)"),
     mir_emit_retag: bool = (false, parse_bool, [TRACKED],
-        "emit Retagging MIR statements, interpreted e.g. by miri; implies -Zmir-opt-level=0"),
+        "emit Retagging MIR statements, interpreted e.g., by miri; implies -Zmir-opt-level=0"),
     perf_stats: bool = (false, parse_bool, [UNTRACKED],
         "print some performance-related statistics"),
     hir_stats: bool = (false, parse_bool, [UNTRACKED],
@@ -1532,7 +1532,7 @@ pub fn unstable<F>(name: &'static str, f: F) -> RustcOptGroup
 // adds extra rustc-specific metadata to each option; such metadata
 // 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
+// *unstable* options, i.e., options that are only enabled when the
 // user also passes the `-Z unstable-options` debugging flag.
 mod opt {
     // The `fn opt_u` etc below are written so that we can use them
@@ -2380,7 +2380,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
 /// tracking are hashed into a single value that determines whether the
 /// incremental compilation cache can be re-used or not. This hashing is done
 /// via the DepTrackingHash trait defined below, since the standard Hash
-/// implementation might not be suitable (e.g. arguments are stored in a Vec,
+/// implementation might not be suitable (e.g., arguments are stored in a Vec,
 /// the hash of which is order dependent, but we might not want the order of
 /// arguments to make a difference for the hash).
 ///
index e686a1d1275b61a079508a60fe73826b1b3adaf4..8159c65a8bc2d187630dac0746813ed3a7acaffe 100644 (file)
@@ -176,7 +176,7 @@ fn find_libdir(sysroot: &Path) -> Cow<'static, str> {
     // of the directory where librustc is located, rather than where the rustc
     // binary is.
     // If --libdir is set during configuration to the value other than
-    // "lib" (i.e. non-default), this value is used (see issue #16552).
+    // "lib" (i.e., non-default), this value is used (see issue #16552).
 
     #[cfg(target_pointer_width = "64")]
     const PRIMARY_LIB_DIR: &str = "lib64";
index 293cd0c7c546df6df5eda807595ecc76ce26748d..d1dd745add9a4012ef15cfb2d196941fe7e00d35 100644 (file)
@@ -586,7 +586,7 @@ pub fn lto(&self) -> config::Lto {
         // either return `No` or `ThinLocal`.
 
         // If processing command line options determined that we're incompatible
-        // with ThinLTO (e.g. `-C lto --emit llvm-ir`) then return that option.
+        // with ThinLTO (e.g., `-C lto --emit llvm-ir`) then return that option.
         if self.opts.cli_forced_thinlto_off {
             return config::Lto::No;
         }
index a0237348ea6909b459a11829bf9cb45470897d46..fff77816e7535d93727c93a59f2e716002136be3 100644 (file)
@@ -138,7 +138,7 @@ pub fn find_auto_trait_generics<A>(
             // the first evaluate_predicates call.
             //
             // The problem is this: most of rustc, including SelectionContext and traits::project,
-            // are designed to work with a concrete usage of a type (e.g. Vec<u8>
+            // are designed to work with a concrete usage of a type (e.g., Vec<u8>
             // fn<T>() { Vec<T> }. This information will generally never change - given
             // the 'T' in fn<T>() { ... }, we'll never know anything else about 'T'.
             // If we're unable to prove that 'T' implements a particular trait, we're done -
@@ -289,7 +289,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
     //
     // One additional consideration is supertrait bounds. Normally, a ParamEnv is only ever
     // constructed once for a given type. As part of the construction process, the ParamEnv will
-    // have any supertrait bounds normalized - e.g. if we have a type 'struct Foo<T: Copy>', the
+    // have any supertrait bounds normalized - e.g., if we have a type 'struct Foo<T: Copy>', the
     // ParamEnv will contain 'T: Copy' and 'T: Clone', since 'Copy: Clone'. When we construct our
     // own ParamEnv, we need to do this ourselves, through traits::elaborate_predicates, or else
     // SelectionContext will choke on the missing predicates. However, this should never show up in
@@ -343,7 +343,7 @@ pub fn evaluate_predicates<'b, 'gcx, 'c>(
 
             match &result {
                 &Ok(Some(ref vtable)) => {
-                    // If we see an explicit negative impl (e.g. 'impl !Send for MyStruct'),
+                    // If we see an explicit negative impl (e.g., 'impl !Send for MyStruct'),
                     // we immediately bail out, since it's impossible for us to continue.
                     match vtable {
                         Vtable::VtableImpl(VtableImplData { impl_def_id, .. }) => {
@@ -432,11 +432,11 @@ pub fn evaluate_predicates<'b, 'gcx, 'c>(
     // If we put both of these predicates in our computed ParamEnv, we'll
     // confuse SelectionContext, since it will (correctly) view both as being applicable.
     //
-    // To solve this, we pick the 'more strict' lifetime bound - i.e. the HRTB
+    // To solve this, we pick the 'more strict' lifetime bound - i.e., the HRTB
     // Our end goal is to generate a user-visible description of the conditions
     // under which a type implements an auto trait. A trait predicate involving
     // a HRTB means that the type needs to work with any choice of lifetime,
-    // not just one specific lifetime (e.g. 'static).
+    // not just one specific lifetime (e.g., 'static).
     fn add_user_pred<'c>(
         &self,
         user_computed_preds: &mut FxHashSet<ty::Predicate<'c>>,
index 4bf8ba0d6d1c8ef9ed75d3d26ee4d1c563bc0581..f10f523e2b4872e696979c06b16387bd51fb956d 100644 (file)
@@ -256,12 +256,12 @@ pub fn orphan_check<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>,
 /// The current rule is that a trait-ref orphan checks in a crate C:
 ///
 /// 1. Order the parameters in the trait-ref in subst order - Self first,
-///    others linearly (e.g. `<U as Foo<V, W>>` is U < V < W).
+///    others linearly (e.g., `<U as Foo<V, W>>` is U < V < W).
 /// 2. Of these type parameters, there is at least one type parameter
 ///    in which, walking the type as a tree, you can reach a type local
 ///    to C where all types in-between are fundamental types. Call the
 ///    first such parameter the "local key parameter".
-///     - e.g. `Box<LocalType>` is OK, because you can visit LocalType
+///     - e.g., `Box<LocalType>` is OK, because you can visit LocalType
 ///       going through `Box`, which is fundamental.
 ///     - similarly, `FundamentalPair<Vec<()>, Box<LocalType>>` is OK for
 ///       the same reason.
@@ -269,7 +269,7 @@ pub fn orphan_check<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>,
 ///       not local), `Vec<LocalType>` is bad, because `Vec<->` is between
 ///       the local type and the type parameter.
 /// 3. Every type parameter before the local key parameter is fully known in C.
-///     - e.g. `impl<T> T: Trait<LocalType>` is bad, because `T` might be
+///     - e.g., `impl<T> T: Trait<LocalType>` is bad, because `T` might be
 ///       an unknown type.
 ///     - but `impl<T> LocalType: Trait<T>` is OK, because `LocalType`
 ///       occurs before `T`.
@@ -277,7 +277,7 @@ pub fn orphan_check<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>,
 ///    through the parameter's type tree, must appear only as a subtree of
 ///    a type local to C, with only fundamental types between the type
 ///    local to C and the local key parameter.
-///     - e.g. `Vec<LocalType<T>>>` (or equivalently `Box<Vec<LocalType<T>>>`)
+///     - e.g., `Vec<LocalType<T>>>` (or equivalently `Box<Vec<LocalType<T>>>`)
 ///     is bad, because the only local type with `T` as a subtree is
 ///     `LocalType<T>`, and `Vec<->` is between it and the type parameter.
 ///     - similarly, `FundamentalPair<LocalType<T>, T>` is bad, because
@@ -288,7 +288,7 @@ pub fn orphan_check<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>,
 ///
 /// The orphan rules actually serve several different purposes:
 ///
-/// 1. They enable link-safety - i.e. 2 mutually-unknowing crates (where
+/// 1. They enable link-safety - i.e., 2 mutually-unknowing crates (where
 ///    every type local to one crate is unknown in the other) can't implement
 ///    the same trait-ref. This follows because it can be seen that no such
 ///    type can orphan-check in 2 such crates.
index 80634aa3066741a71bbbbb7f5e0fbafba4ed3d9f..4ef4f4571055582ee51dbf2febb2118dff07f1d8 100644 (file)
@@ -128,7 +128,7 @@ struct ErrorDescriptor<'tcx> {
         }
     }
 
-    // returns if `cond` not occurring implies that `error` does not occur - i.e. that
+    // returns if `cond` not occurring implies that `error` does not occur - i.e., that
     // `error` occurring implies that `cond` occurs.
     fn error_implies(&self,
                      cond: &ty::Predicate<'tcx>,
index ab2fa68ab5f8927acb15cd992b53a3fc3160edbf..b259ee011da664be17f24d8a1e2e1d01731c05bc 100644 (file)
@@ -8,34 +8,46 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-//! Trait Resolution. See [rustc guide] for more info on how this works.
+//! Trait Resolution. See the [rustc guide] for more information on how this works.
 //!
 //! [rustc guide]: https://rust-lang.github.io/rustc-guide/traits/resolution.html
 
-pub use self::SelectionError::*;
-pub use self::FulfillmentErrorCode::*;
-pub use self::Vtable::*;
-pub use self::ObligationCauseCode::*;
+#[allow(dead_code)]
+pub mod auto_trait;
+mod coherence;
+pub mod error_reporting;
+mod engine;
+mod fulfill;
+mod project;
+mod object_safety;
+mod on_unimplemented;
+mod select;
+mod specialize;
+mod structural_impls;
+pub mod codegen;
+mod util;
+pub mod query;
 
 use chalk_engine;
 use hir;
 use hir::def_id::DefId;
-use infer::SuppressRegionErrors;
+use infer::{InferCtxt, SuppressRegionErrors};
 use infer::outlives::env::OutlivesEnvironment;
 use middle::region;
 use mir::interpret::ErrorHandled;
+use rustc_data_structures::sync::Lrc;
+use syntax::ast;
+use syntax_pos::{Span, DUMMY_SP};
 use ty::subst::Substs;
 use ty::{self, AdtKind, List, Ty, TyCtxt, GenericParamDefKind, ToPredicate};
 use ty::error::{ExpectedFound, TypeError};
 use ty::fold::{TypeFolder, TypeFoldable, TypeVisitor};
-use infer::{InferCtxt};
 use util::common::ErrorReported;
 
-use rustc_data_structures::sync::Lrc;
-use std::fmt::Debug;
-use std::rc::Rc;
-use syntax::ast;
-use syntax_pos::{Span, DUMMY_SP};
+pub use self::SelectionError::*;
+pub use self::FulfillmentErrorCode::*;
+pub use self::Vtable::*;
+pub use self::ObligationCauseCode::*;
 
 pub use self::coherence::{orphan_check, overlapping_impls, OrphanCheckErr, OverlapResult};
 pub use self::fulfill::{FulfillmentContext, PendingPredicateObligation};
 pub use self::specialize::find_associated_item;
 pub use self::engine::{TraitEngine, TraitEngineExt};
 pub use self::util::{elaborate_predicates, elaborate_trait_ref, elaborate_trait_refs};
-pub use self::util::{supertraits, supertrait_def_ids, Supertraits, SupertraitDefIds};
-pub use self::util::transitive_bounds;
-
-#[allow(dead_code)]
-pub mod auto_trait;
-mod coherence;
-pub mod error_reporting;
-mod engine;
-mod fulfill;
-mod project;
-mod object_safety;
-mod on_unimplemented;
-mod select;
-mod specialize;
-mod structural_impls;
-pub mod codegen;
-mod util;
+pub use self::util::{supertraits, supertrait_def_ids, transitive_bounds,
+                     Supertraits, SupertraitDefIds};
 
-pub mod query;
+pub use self::ObligationCauseCode::*;
+pub use self::FulfillmentErrorCode::*;
+pub use self::SelectionError::*;
+pub use self::Vtable::*;
 
 // Whether to enable bug compatibility with issue #43355
 #[derive(Copy, Clone, PartialEq, Eq, Debug)]
@@ -91,7 +91,7 @@ pub enum TraitQueryMode {
     Canonical,
 }
 
-/// An `Obligation` represents some trait reference (e.g. `int:Eq`) for
+/// 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
@@ -955,7 +955,7 @@ fn substitute_normalize_and_test_predicates<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx
 
 /// Given a trait `trait_ref`, iterates the vtable entries
 /// that come from `trait_ref`, including its supertraits.
-#[inline] // FIXME(#35870) Avoid closures being unexported due to impl Trait.
+#[inline] // FIXME(#35870): avoid closures being unexported due to `impl Trait`.
 fn vtable_methods<'a, 'tcx>(
     tcx: TyCtxt<'a, 'tcx, 'tcx>,
     trait_ref: ty::PolyTraitRef<'tcx>)
index 2909daf22b3bab0933676b4df20e8854174e87c2..4b2f817cfa91ade43a055af24fc8e511fa576090 100644 (file)
@@ -36,7 +36,7 @@ pub enum ObjectSafetyViolation {
     SizedSelf,
 
     /// Supertrait reference references `Self` an in illegal location
-    /// (e.g. `trait Foo : Bar<Self>`)
+    /// (e.g., `trait Foo : Bar<Self>`)
     SupertraitSelf,
 
     /// Method has something illegal
@@ -81,7 +81,7 @@ pub enum MethodViolationCode {
     /// e.g., `fn foo(&self, x: Self)` or `fn foo(&self) -> Self`
     ReferencesSelf,
 
-    /// e.g. `fn foo(&self) where Self: Clone`
+    /// e.g., `fn foo(&self) where Self: Clone`
     WhereClauseReferencesSelf(Span),
 
     /// e.g., `fn foo<A>()`
@@ -343,7 +343,7 @@ fn virtual_call_violation_for_method(self,
                     }
                 };
 
-                // e.g. Rc<()>
+                // e.g., Rc<()>
                 let unit_receiver_ty = self.receiver_for_self_ty(
                     receiver_ty, self.mk_unit(), method.def_id
                 );
@@ -357,7 +357,7 @@ fn virtual_call_violation_for_method(self,
                     trait_def_id, self.mk_region(ty::ReStatic)
                 );
 
-                // e.g. Rc<dyn Trait>
+                // e.g., Rc<dyn Trait>
                 let trait_object_receiver = self.receiver_for_self_ty(
                     receiver_ty, trait_object_ty, method.def_id
                 );
@@ -376,7 +376,7 @@ fn virtual_call_violation_for_method(self,
     }
 
     /// performs a type substitution to produce the version of receiver_ty when `Self = self_ty`
-    /// e.g. for receiver_ty = `Rc<Self>` and self_ty = `Foo`, returns `Rc<Foo>`
+    /// e.g., for receiver_ty = `Rc<Self>` and self_ty = `Foo`, returns `Rc<Foo>`
     fn receiver_for_self_ty(
         self, receiver_ty: Ty<'tcx>, self_ty: Ty<'tcx>, method_def_id: DefId
     ) -> Ty<'tcx> {
@@ -451,7 +451,7 @@ fn object_ty_for_trait(self, trait_def_id: DefId, lifetime: ty::Region<'tcx>) ->
     ///
     /// The only case where the receiver is not dispatchable, but is still a valid receiver
     /// type (just not object-safe), is when there is more than one level of pointer indirection.
-    /// e.g. `self: &&Self`, `self: &Rc<Self>`, `self: Box<Box<Self>>`. In these cases, there
+    /// e.g., `self: &&Self`, `self: &Rc<Self>`, `self: Box<Box<Self>>`. In these cases, there
     /// is no way, or at least no inexpensive way, to coerce the receiver from the version where
     /// `Self = dyn Trait` to the version where `Self = T`, where `T` is the unknown erased type
     /// contained by the trait object, because the object that needs to be coerced is behind
index 1d3d66e82f14cc2048ed1e03fd9a017a2ec906a7..5717a76f1cf0f149fd8339502351f60fa96a2d63 100644 (file)
@@ -70,7 +70,7 @@ pub enum Reveal {
     /// be observable directly by the user, `Reveal::All`
     /// should not be used by checks which may expose
     /// type equality or type contents to the user.
-    /// There are some exceptions, e.g. around OIBITS and
+    /// There are some exceptions, e.g., around OIBITS and
     /// transmute-checking, which expose some details, but
     /// not the whole concrete type of the `impl Trait`.
     All,
@@ -608,7 +608,7 @@ fn opt_normalize_projection_type<'a, 'b, 'gcx, 'tcx>(
             // created (and hence the new ones will quickly be
             // discarded as duplicated). But when doing trait
             // evaluation this is not the case, and dropping the trait
-            // evaluations can causes ICEs (e.g. #43132).
+            // evaluations can causes ICEs (e.g., #43132).
             debug!("opt_normalize_projection_type: \
                     found normalized ty `{:?}`",
                    ty);
@@ -1589,7 +1589,7 @@ fn assoc_ty_def<'cx, 'gcx, 'tcx>(
 /// When working with a fulfillment context, the derived obligations of each
 /// projection cache entry will be registered on the fulfillcx, so any users
 /// that can wait for a fulfillcx fixed point need not care about this. However,
-/// users that don't wait for a fixed point (e.g. trait evaluation) have to
+/// users that don't wait for a fixed point (e.g., trait evaluation) have to
 /// resolve the obligations themselves to make sure the projected result is
 /// ok and avoid issues like #43132.
 ///
@@ -1637,7 +1637,7 @@ enum ProjectionCacheEntry<'tcx> {
     NormalizedTy(NormalizedTy<'tcx>),
 }
 
-// NB: intentionally not Clone
+// N.B., intentionally not Clone
 pub struct ProjectionCacheSnapshot {
     snapshot: Snapshot,
 }
index fb4c9f3bad7154686a13dfe76f72bdaa185f2cfd..c438542106c9e3150777441db11e77c66f19b8ef 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-//! See [rustc guide] for more info on how this works.
+//! Candidate selection. See the [rustc guide] for more information on how this works.
 //!
 //! [rustc guide]: https://rust-lang.github.io/rustc-guide/traits/resolution.html#selection
 
@@ -69,10 +69,10 @@ pub struct SelectionContext<'cx, 'gcx: 'cx + 'tcx, 'tcx: 'cx> {
     /// require themselves.
     freshener: TypeFreshener<'cx, 'gcx, 'tcx>,
 
-    /// If true, indicates that the evaluation should be conservative
+    /// If `true`, indicates that the evaluation should be conservative
     /// and consider the possibility of types outside this crate.
     /// This comes up primarily when resolving ambiguity. Imagine
-    /// there is some trait reference `$0 : Bar` where `$0` is an
+    /// there is some trait reference `$0: Bar` where `$0` is an
     /// inference variable. If `intercrate` is true, then we can never
     /// say for sure that this reference is not implemented, even if
     /// there are *no impls at all for `Bar`*, because `$0` could be
@@ -80,7 +80,7 @@ pub struct SelectionContext<'cx, 'gcx: 'cx + 'tcx, 'tcx: 'cx> {
     /// `Bar`. This is the suitable mode for coherence. Elsewhere,
     /// though, we set this to false, because we are only interested
     /// in types that the user could actually have written --- in
-    /// other words, we consider `$0 : Bar` to be unimplemented if
+    /// other words, we consider `$0: Bar` to be unimplemented if
     /// there is no type that the user could *actually name* that
     /// would satisfy it. This avoids crippling inference, basically.
     intercrate: Option<IntercrateMode>,
@@ -1170,7 +1170,7 @@ fn insert_evaluation_cache(
     //
     // The selection process begins by examining all in-scope impls,
     // caller obligations, and so forth and assembling a list of
-    // candidates. See [rustc guide] for more details.
+    // candidates. See the [rustc guide] for more details.
     //
     // [rustc guide]:
     // https://rust-lang.github.io/rustc-guide/traits/resolution.html#candidate-assembly
@@ -1615,7 +1615,7 @@ fn assemble_candidates<'o>(
         };
 
         if obligation.predicate.skip_binder().self_ty().is_ty_var() {
-            // Self is a type variable (e.g. `_: AsRef<str>`).
+            // Self is a type variable (e.g., `_: AsRef<str>`).
             //
             // This is somewhat problematic, as the current scheme can't really
             // handle it turning to be a projection. This does end up as truly
@@ -1664,7 +1664,7 @@ fn assemble_candidates<'o>(
             self.assemble_candidates_for_unsizing(obligation, &mut candidates);
         } else {
             if lang_items.clone_trait() == Some(def_id) {
-                // Same builtin conditions as `Copy`, i.e. every type which has builtin support
+                // Same builtin conditions as `Copy`, i.e., every type which has builtin support
                 // for `Copy` also has builtin support for `Clone`, + tuples and arrays of `Clone`
                 // types have builtin support for `Clone`.
                 let clone_conditions = self.copy_clone_conditions(obligation);
@@ -2023,7 +2023,7 @@ fn assemble_candidates_from_impls(
                     {
                         candidates.vec.push(ImplCandidate(impl_def_id));
 
-                        // NB: we can safely drop the placeholder map
+                        // N.B., we can safely drop the placeholder map
                         // since we are in a probe.
                         mem::drop(placeholder_map);
                     }
@@ -2069,7 +2069,7 @@ fn assemble_candidates_from_auto_impls(
                     // that this obligation holds. That could be a
                     // where-clause or, in the case of an object type,
                     // it could be that the object type lists the
-                    // trait (e.g. `Foo+Send : Send`). See
+                    // trait (e.g., `Foo+Send : Send`). See
                     // `compile-fail/typeck-default-trait-impl-send-param.rs`
                     // for an example of a test case that exercises
                     // this path.
@@ -2097,7 +2097,7 @@ fn assemble_candidates_from_object_ty(
         );
 
         self.probe(|this, _snapshot| {
-            // the code below doesn't care about regions, and the
+            // The code below doesn't care about regions, and the
             // self-ty here doesn't escape this probe, so just erase
             // any LBR.
             let self_ty = this.tcx().erase_late_bound_regions(&obligation.self_ty());
@@ -2145,7 +2145,7 @@ fn assemble_candidates_from_object_ty(
                 .count();
 
             if upcast_trait_refs > 1 {
-                // can be upcast in many ways; need more type information
+                // Can be upcast in many ways; need more type information.
                 candidates.ambiguous = true;
             } else if upcast_trait_refs == 1 {
                 candidates.vec.push(ObjectCandidate);
@@ -2197,8 +2197,8 @@ fn assemble_candidates_for_unsizing(
             (&ty::Dynamic(ref data_a, ..), &ty::Dynamic(ref data_b, ..)) => {
                 // Upcasts permit two things:
                 //
-                // 1. Dropping builtin bounds, e.g. `Foo+Send` to `Foo`
-                // 2. Tightening the region bound, e.g. `Foo+'a` to `Foo+'b` if `'a : 'b`
+                // 1. Dropping builtin bounds, e.g., `Foo+Send` to `Foo`
+                // 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
@@ -2354,7 +2354,7 @@ fn candidate_should_be_dropped_in_favor_of<'o>(
             ImplCandidate(other_def) => {
                 // See if we can toss out `victim` based on specialization.
                 // This requires us to know *for sure* that the `other` impl applies
-                // i.e. EvaluatedToOk:
+                // i.e., EvaluatedToOk:
                 if other.evaluation == EvaluatedToOk {
                     match victim.candidate {
                         ImplCandidate(victim_def) => {
@@ -2717,7 +2717,7 @@ fn collect_predicates_for_types(
     //
     // Confirmation unifies the output type parameters of the trait
     // with the values found in the obligation, possibly yielding a
-    // type error.  See [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
@@ -3003,7 +3003,7 @@ fn vtable_impl(
         // are sufficient to determine the impl substs, without
         // relying on projections in the impl-trait-ref.
         //
-        // e.g. `impl<U: Tr, V: Iterator<Item=U>> Foo<<U as Tr>::T> for V`
+        // e.g., `impl<U: Tr, V: Iterator<Item=U>> Foo<<U as Tr>::T> for V`
         impl_obligations.append(&mut substs.obligations);
 
         VtableImplData {
index 50d2179c412aa5fac980686b88a85ff393724d15..96bb545f25c643442fb27fde267007515265ea8a 100644 (file)
 //!
 //! [rustc guide]: https://rust-lang.github.io/rustc-guide/traits/specialization.html
 
-use super::{SelectionContext, FulfillmentContext};
-use super::util::impl_trait_ref_and_oblig;
+pub mod specialization_graph;
 
-use rustc_data_structures::fx::FxHashSet;
 use hir::def_id::DefId;
 use infer::{InferCtxt, InferOk};
-use ty::subst::{Subst, Substs};
+use lint;
+use rustc_data_structures::fx::FxHashSet;
+use rustc_data_structures::sync::Lrc;
+use syntax_pos::DUMMY_SP;
 use traits::{self, ObligationCause, TraitEngine};
 use traits::select::IntercrateAmbiguityCause;
 use ty::{self, TyCtxt, TypeFoldable};
-use syntax_pos::DUMMY_SP;
-use rustc_data_structures::sync::Lrc;
-
-use lint;
+use ty::subst::{Subst, Substs};
 
-pub mod specialization_graph;
+use super::{SelectionContext, FulfillmentContext};
+use super::util::impl_trait_ref_and_oblig;
 
 /// Information pertinent to an overlapping impl error.
 pub struct OverlapError {
@@ -184,7 +183,7 @@ pub(super) fn specializes<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
     //
     // See RFC 1210 for more details and justification.
 
-    // Currently we do not allow e.g. a negative impl to specialize a positive one
+    // Currently we do not allow e.g., a negative impl to specialize a positive one
     if tcx.impl_polarity(impl1_def_id) != tcx.impl_polarity(impl2_def_id) {
         return false;
     }
@@ -295,17 +294,18 @@ fn fulfill_implication<'a, 'gcx, 'tcx>(infcx: &InferCtxt<'a, 'gcx, 'tcx>,
 }
 
 // Query provider for `specialization_graph_of`.
-pub(super) fn specialization_graph_provider<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
-                                                      trait_id: DefId)
-                                                      -> Lrc<specialization_graph::Graph> {
+pub(super) fn specialization_graph_provider<'a, 'tcx>(
+    tcx: TyCtxt<'a, 'tcx, 'tcx>,
+    trait_id: DefId,
+) -> Lrc<specialization_graph::Graph> {
     let mut sg = specialization_graph::Graph::new();
 
     let mut trait_impls = tcx.all_impls(trait_id);
 
     // The coherence checking implementation seems to rely on impls being
     // iterated over (roughly) in definition order, so we are sorting by
-    // negated CrateNum (so remote definitions are visited first) and then
-    // by a flattened version of the DefIndex.
+    // negated `CrateNum` (so remote definitions are visited first) and then
+    // by a flattened version of the `DefIndex`.
     trait_impls.sort_unstable_by_key(|def_id| {
         (-(def_id.krate.as_u32() as i64),
          def_id.index.address_space().index(),
index db0302f3a901d594a4ada33dba7b6eab0f0251fa..22221e0a3d93d87dbe182ec68b0652e1ad210539 100644 (file)
@@ -29,7 +29,7 @@
 ///
 /// The graph provides two key services:
 ///
-/// - Construction, which implicitly checks for overlapping impls (i.e., impls
+/// - Construction. This implicitly checks for overlapping impls (i.e., impls
 ///   that overlap but where neither specializes the other -- an artifact of the
 ///   simple "chain" rule.
 ///
 ///   has at most one parent.
 #[derive(RustcEncodable, RustcDecodable)]
 pub struct Graph {
-    // all impls have a parent; the "root" impls have as their parent the def_id
-    // of the trait
+    // All impls have a parent; the "root" impls have as their parent the `def_id`
+    // of the trait.
     parent: DefIdMap<DefId>,
 
-    // the "root" impls are found by looking up the trait's def_id.
+    // The "root" impls are found by looking up the trait's def_id.
     children: DefIdMap<Children>,
 }
 
@@ -81,7 +81,7 @@ enum Inserted {
 }
 
 impl<'a, 'gcx, 'tcx> Children {
-    /// Insert an impl into this set of children without comparing to any existing impls
+    /// Insert an impl into this set of children without comparing to any existing impls.
     fn insert_blindly(&mut self,
                       tcx: TyCtxt<'a, 'gcx, 'tcx>,
                       impl_def_id: DefId) {
@@ -144,13 +144,13 @@ fn insert(&mut self,
             );
 
             let overlap_error = |overlap: traits::coherence::OverlapResult<'_>| {
-                // overlap, but no specialization; error out
+                // Found overlap, but no specialization; error out.
                 let trait_ref = overlap.impl_header.trait_ref.unwrap();
                 let self_ty = trait_ref.self_ty();
                 OverlapError {
                     with_impl: possible_sibling,
                     trait_desc: trait_ref.to_string(),
-                    // only report the Self type if it has at least
+                    // Only report the `Self` type if it has at least
                     // some outer concrete shell; otherwise, it's
                     // not adding much information.
                     self_desc: if self_ty.has_concrete_skeleton() {
@@ -189,7 +189,7 @@ fn insert(&mut self,
                 debug!("descending as child of TraitRef {:?}",
                        tcx.impl_trait_ref(possible_sibling).unwrap());
 
-                // the impl specializes possible_sibling
+                // The impl specializes `possible_sibling`.
                 return Ok(Inserted::ShouldRecurseOn(possible_sibling));
             } else if ge && !le {
                 debug!("placing as parent of TraitRef {:?}",
@@ -216,7 +216,7 @@ fn insert(&mut self,
             return Ok(Inserted::ReplaceChildren(replace_children));
         }
 
-        // no overlap with any potential siblings, so add as a new sibling
+        // No overlap with any potential siblings, so add as a new sibling.
         debug!("placing as new sibling");
         self.insert_blindly(tcx, impl_def_id);
         Ok(Inserted::BecameNewSibling(last_lint))
@@ -256,7 +256,7 @@ pub fn insert(&mut self,
         debug!("insert({:?}): inserting TraitRef {:?} into specialization graph",
                impl_def_id, trait_ref);
 
-        // if the reference itself contains an earlier error (e.g., due to a
+        // If the reference itself contains an earlier error (e.g., due to a
         // resolution failure), then we just insert the impl at the top level of
         // the graph and claim that there's no overlap (in order to suppress
         // bogus errors).
@@ -275,7 +275,7 @@ pub fn insert(&mut self,
         let mut last_lint = None;
         let simplified = fast_reject::simplify_type(tcx, trait_ref.self_ty(), false);
 
-        // Descend the specialization tree, where `parent` is the current parent node
+        // Descend the specialization tree, where `parent` is the current parent node.
         loop {
             use self::Inserted::*;
 
@@ -313,7 +313,7 @@ pub fn insert(&mut self,
                         siblings.insert_blindly(tcx, impl_def_id);
                     }
 
-                    // Set G's parent to N and N's parent to P
+                    // Set G's parent to N and N's parent to P.
                     for &grand_child_to_be in &grand_children_to_be {
                         self.parent.insert(grand_child_to_be, impl_def_id);
                     }
@@ -429,7 +429,8 @@ pub fn map<U, F: FnOnce(T) -> U>(self, f: F) -> NodeItem<U> {
 impl<'a, 'gcx, 'tcx> Ancestors {
     /// Search the items from the given ancestors, returning each definition
     /// with the given name and the given kind.
-    #[inline] // FIXME(#35870) Avoid closures being unexported due to impl Trait.
+    // FIXME(#35870): avoid closures being unexported due to `impl Trait`.
+    #[inline]
     pub fn defs(
         self,
         tcx: TyCtxt<'a, 'gcx, 'tcx>,
index 6d3fc0d4fe405c57b340f8fe35e821521967b8d7..80d8a1d6e5c36413349081222643e89452c5b8dd 100644 (file)
@@ -9,12 +9,11 @@
 // except according to those terms.
 
 use hir::def_id::DefId;
-use ty::subst::{Kind, Subst, Substs};
+use traits::specialize::specialization_graph::NodeItem;
 use ty::{self, Ty, TyCtxt, ToPredicate, ToPolyTraitRef};
 use ty::outlives::Component;
+use ty::subst::{Kind, Subst};
 use util::nodemap::FxHashSet;
-use hir::{self};
-use traits::specialize::specialization_graph::NodeItem;
 
 use super::{Obligation, ObligationCause, PredicateObligation, SelectionContext, Normalized};
 
index 83521c5f7240682064d1c73e9dd6c45da8a8fe35..d91ae7e120f6604ffe2417f547d02977b7fbfd11 100644 (file)
@@ -83,7 +83,7 @@ pub enum Adjust<'tcx> {
     /// Take the address and produce either a `&` or `*` pointer.
     Borrow(AutoBorrow<'tcx>),
 
-    /// Unsize a pointer/reference value, e.g. `&[T; n]` to
+    /// Unsize a pointer/reference value, e.g., `&[T; n]` to
     /// `&[T]`. Note that the source could be a thin or fat pointer.
     /// This will do things like convert thin pointers to fat
     /// pointers, or convert structs containing thin pointers to
index 8738f574148239e37966edc1ef3ef1a90f2f532e..5ad7d247fe4594b9d59e25431926246cde8510ea 100644 (file)
@@ -92,7 +92,7 @@ pub fn encode_with_shorthand<E, T, M>(encoder: &mut E,
     let leb128_bits = len * 7;
 
     // Check that the shorthand is a not longer than the
-    // full encoding itself, i.e. it's an obvious win.
+    // full encoding itself, i.e., it's an obvious win.
     if leb128_bits >= 64 || (shorthand as u64) < (1 << leb128_bits) {
         cache(encoder).insert(value.clone(), shorthand);
     }
index 818b3a31c12d1bfb49a2871701f4e26e5e3fab31..a3db3a02aad92c81572076b1d75bd80b8170898d 100644 (file)
@@ -587,7 +587,7 @@ pub fn pat_ty_opt(&self, pat: &hir::Pat) -> Option<Ty<'tcx>> {
     // 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
+    // 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"
     // instead of "fn(ty) -> T with T = isize".
     pub fn expr_ty(&self, expr: &hir::Expr) -> Ty<'tcx> {
@@ -1654,7 +1654,7 @@ pub fn enter_local<F, R>(
 /// For Ty, None can be returned if either the type interner doesn't
 /// contain the TyKind key or if the address of the interned
 /// pointer differs. The latter case is possible if a primitive type,
-/// e.g. `()` or `u8`, was interned in a different context.
+/// e.g., `()` or `u8`, was interned in a different context.
 pub trait Lift<'tcx>: fmt::Debug {
     type Lifted: fmt::Debug + 'tcx;
     fn lift_to_tcx<'a, 'gcx>(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Option<Self::Lifted>;
@@ -2232,7 +2232,7 @@ fn clone(&self) -> Self {
 }
 impl<'tcx, T: 'tcx+?Sized> Copy for Interned<'tcx, T> {}
 
-// NB: An Interned<Ty> compares and hashes as a sty.
+// N.B., an `Interned<Ty>` compares and hashes as a sty.
 impl<'tcx> PartialEq for Interned<'tcx, TyS<'tcx>> {
     fn eq(&self, other: &Interned<'tcx, TyS<'tcx>>) -> bool {
         self.0.sty == other.0.sty
@@ -2253,7 +2253,7 @@ fn borrow<'a>(&'a self) -> &'a TyKind<'lcx> {
     }
 }
 
-// NB: An Interned<List<T>> compares and hashes as its elements.
+// N.B., an `Interned<List<T>>` compares and hashes as its elements.
 impl<'tcx, T: PartialEq> PartialEq for Interned<'tcx, List<T>> {
     fn eq(&self, other: &Interned<'tcx, List<T>>) -> bool {
         self.0[..] == other.0[..]
@@ -2464,7 +2464,7 @@ pub fn safe_to_unsafe_fn_ty(self, sig: PolyFnSig<'tcx>) -> Ty<'tcx> {
 
     /// Given a closure signature `sig`, returns an equivalent `fn`
     /// type with the same signature. Detuples and so forth -- so
-    /// e.g. if we have a sig with `Fn<(u32, i32)>` then you would get
+    /// e.g., if we have a sig with `Fn<(u32, i32)>` then you would get
     /// a `fn(u32, i32)`.
     pub fn coerce_closure_fn_ty(self, sig: PolyFnSig<'tcx>) -> Ty<'tcx> {
         let converted_sig = sig.map_bound(|s| {
@@ -2869,11 +2869,11 @@ pub fn lint_node<S: Into<MultiSpan>>(self,
     }
 
     pub fn lint_hir_note<S: Into<MultiSpan>>(self,
-                                              lint: &'static Lint,
-                                              hir_id: HirId,
-                                              span: S,
-                                              msg: &str,
-                                              note: &str) {
+                                             lint: &'static Lint,
+                                             hir_id: HirId,
+                                             span: S,
+                                             msg: &str,
+                                             note: &str) {
         let mut err = self.struct_span_lint_hir(lint, hir_id, span.into(), msg);
         err.note(note);
         err.emit()
@@ -3016,9 +3016,9 @@ fn intern_with<I: Iterator<Item=Self>, F: FnOnce(&[T]) -> R>(iter: I, f: F) -> S
 }
 
 pub fn provide(providers: &mut ty::query::Providers<'_>) {
-    // FIXME(#44234) - almost all of these queries have no sub-queries and
+    // FIXME(#44234): almost all of these queries have no sub-queries and
     // therefore no actual inputs, they're just reading tables calculated in
-    // resolve! Does this work? Unsure! That's what the issue is about
+    // resolve! Does this work? Unsure! That's what the issue is about.
     providers.in_scope_traits_map = |tcx, id| tcx.gcx.trait_map.get(&id).cloned();
     providers.module_exports = |tcx, id| tcx.gcx.export_map.get(&id).cloned();
     providers.crate_name = |tcx, id| {
index f53e634a044e7814d857f6b2a275e3af04ca97b0..a361ad057c74a0e8c730c4641fd2205b9f694e1f 100644 (file)
@@ -19,7 +19,7 @@ pub(super) fn provide(providers: &mut ty::query::Providers<'_>) {
 }
 
 fn erase_regions_ty<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, ty: Ty<'tcx>) -> Ty<'tcx> {
-    // NB: use `super_fold_with` here. If we used `fold_with`, it
+    // N.B., use `super_fold_with` here. If we used `fold_with`, it
     // could invoke the `erase_regions_ty` query recursively.
     ty.super_fold_with(&mut RegionEraserVisitor { tcx })
 }
index 8304e363815728a489cd1b5dec2d9d2cb8410dbe..7005e14c26c4245f242e91e9f2fe01a729c830d8 100644 (file)
@@ -110,7 +110,7 @@ pub fn simplify_type<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>,
                 // anything. when lazy normalization happens, this
                 // will change. It would still be nice to have a way
                 // to deal with known-not-to-unify-with-anything
-                // projections (e.g. the likes of <__S as Encoder>::Error).
+                // projections (e.g., the likes of <__S as Encoder>::Error).
                 Some(ParameterSimplifiedType)
             } else {
                 None
index 20f64597b7876fcd7d9c1a6b749f60f7b5fc2b0b..a40e1df14f8e829621517752ec9ef18479f0ab44 100644 (file)
@@ -887,7 +887,7 @@ struct LateBoundRegionsCollector {
 
     /// If true, we only want regions that are known to be
     /// "constrained" when you equate this type with another type. In
-    /// particular, if you have e.g. `&'a u32` and `&'b u32`, equating
+    /// particular, if you have e.g., `&'a u32` and `&'b u32`, equating
     /// them constraints `'a == 'b`.  But if you have `<&'a u32 as
     /// Trait>::Foo` and `<&'b u32 as Trait>::Foo`, normalizing those
     /// types may mean that `'a` and `'b` don't appear in the results,
index e24f9094dd2f5a50824519f1a2b37a955e857e0f..a39eb004fd7864bd711cd998955921968616d35d 100644 (file)
@@ -317,7 +317,7 @@ pub fn push_item_path<T>(self, buffer: &mut T, def_id: DefId, pushed_prelude_cra
 
             // Unclear if there is any value in distinguishing these.
             // Probably eventually (and maybe we would even want
-            // finer-grained distinctions, e.g. between enum/struct).
+            // finer-grained distinctions, e.g., between enum/struct).
             data @ DefPathData::Misc |
             data @ DefPathData::TypeNs(..) |
             data @ DefPathData::Trait(..) |
index 5406495226d798cd041e7fc90d39739991773099..87d745e5cea77200c82b32185b236248215d3402 100644 (file)
@@ -248,7 +248,7 @@ enum StructKind {
             AlwaysSized,
             /// A univariant, the last field of which may be coerced to unsized.
             MaybeUnsized,
-            /// A univariant, but with a prefix of an arbitrary size & alignment (e.g. enum tag).
+            /// A univariant, but with a prefix of an arbitrary size & alignment (e.g., enum tag).
             Prefixed(Size, Align),
         }
 
@@ -748,7 +748,7 @@ enum StructKind {
 
                 // A variant is absent if it's uninhabited and only has ZST fields.
                 // Present uninhabited variants only require space for their fields,
-                // but *not* an encoding of the discriminant (e.g. a tag value).
+                // but *not* an encoding of the discriminant (e.g., a tag value).
                 // See issue #49298 for more details on the need to leave space
                 // for non-ZST uninhabited data (mostly partial initialization).
                 let absent = |fields: &[TyLayout<'_>]| {
@@ -1252,7 +1252,7 @@ fn record_layout_for_printing_outlined(&self, layout: TyLayout<'tcx>) {
             }).collect();
 
             session::VariantInfo {
-                name: n.map(|n|n.to_string()),
+                name: n.map(|n| n.to_string()),
                 kind: if layout.is_unsized() {
                     session::SizeKind::Min
                 } else {
@@ -1311,7 +1311,7 @@ fn record_layout_for_printing_outlined(&self, layout: TyLayout<'tcx>) {
     }
 }
 
-/// Type size "skeleton", i.e. the only information determining a type's size.
+/// Type size "skeleton", i.e., the only information determining a type's size.
 /// While this is conservative, (aside from constant sizes, only pointers,
 /// newtypes thereof and null pointer optimized enums are allowed), it is
 /// enough to statically check common use cases of transmute.
@@ -1522,7 +1522,7 @@ fn layout_of(&self, ty: Ty<'tcx>) -> Self::TyLayout {
             details
         };
 
-        // NB: This recording is normally disabled; when enabled, it
+        // N.B., this recording is normally disabled; when enabled, it
         // can however trigger recursive invocations of `layout_of`.
         // Therefore, we execute it *after* the main query has
         // completed, to avoid problems around recursive structures
@@ -1549,7 +1549,7 @@ fn layout_of(&self, ty: Ty<'tcx>) -> Self::TyLayout {
             details
         };
 
-        // NB: This recording is normally disabled; when enabled, it
+        // N.B., this recording is normally disabled; when enabled, it
         // can however trigger recursive invocations of `layout_of`.
         // Therefore, we execute it *after* the main query has
         // completed, to avoid problems around recursive structures
@@ -1660,7 +1660,7 @@ fn field(this: TyLayout<'tcx>, cx: &C, i: usize) -> C::TyLayout {
                 assert!(i < this.fields.count());
 
                 // Reuse the fat *T type as its own thin pointer data field.
-                // This provides information about e.g. DST struct pointees
+                // This provides information about e.g., DST struct pointees
                 // (which may have no non-DST form), and will work as long
                 // as the `Abi` or `FieldPlacement` is checked by users.
                 if i == 0 {
index 7c819941173d706e88010811bef0a2f1bcfa311b..a1fc949137ddef79016c88f53ad6fe337cd5a4a6 100644 (file)
 /// The complete set of all analyses described in this module. This is
 /// produced by the driver and fed to codegen and later passes.
 ///
-/// NB: These contents are being migrated into queries using the
+/// N.B., these contents are being migrated into queries using the
 /// *on-demand* infrastructure.
 #[derive(Clone)]
 pub struct CrateAnalysis {
@@ -505,15 +505,15 @@ pub struct TyS<'tcx> {
     ///     by some sub-binder.
     ///
     /// So, for a type without any late-bound things, like `u32`, this
-    /// will be INNERMOST, because that is the innermost binder that
+    /// will be *innermost*, because that is the innermost binder that
     /// captures nothing. But for a type `&'D u32`, where `'D` is a
-    /// late-bound region with debruijn index D, this would be D+1 --
-    /// the binder itself does not capture D, but D is captured by an
-    /// inner binder.
+    /// late-bound region with debruijn index `D`, this would be `D + 1`
+    /// -- the binder itself does not capture `D`, but `D` is captured
+    /// by an inner binder.
     ///
-    /// We call this concept an "exclusive" binder D (because all
+    /// We call this concept an "exclusive" binder `D` because all
     /// debruijn indices within the type are contained within `0..D`
-    /// (exclusive)).
+    /// (exclusive).
     outer_exclusive_binder: ty::DebruijnIndex,
 }
 
@@ -900,10 +900,10 @@ pub struct GenericParamCount {
 }
 
 /// Information about the formal type/lifetime parameters associated
-/// with an item or method. Analogous to hir::Generics.
+/// with an item or method. Analogous to `hir::Generics`.
 ///
-/// The ordering of parameters is the same as in Subst (excluding child generics):
-/// Self (optionally), Lifetime params..., Type params...
+/// The ordering of parameters is the same as in `Subst` (excluding child generics):
+/// `Self` (optionally), `Lifetime` params..., `Type` params...
 #[derive(Clone, Debug, RustcEncodable, RustcDecodable)]
 pub struct Generics {
     pub parent: Option<DefId>,
@@ -1681,7 +1681,7 @@ pub fn without_caller_bounds(self) -> Self {
     /// pair it with the empty environment. This improves caching and is generally
     /// invisible.
     ///
-    /// NB: We preserve the environment when type-checking because it
+    /// N.B., we preserve the environment when type-checking because it
     /// is possible for the user to have wacky where-clauses like
     /// `where Box<u32>: Copy`, which are clearly never
     /// satisfiable. We generally want to behave as if they were true,
@@ -1778,8 +1778,8 @@ pub struct VariantFlags: u32 {
 
 #[derive(Debug)]
 pub struct VariantDef {
-    /// The variant's DefId. If this is a tuple-like struct,
-    /// this is the DefId of the struct's ctor.
+    /// The variant's `DefId`. If this is a tuple-like struct,
+    /// this is the `DefId` of the struct's ctor.
     pub did: DefId,
     pub name: Name, // struct's name if this is a struct
     pub discr: VariantDiscr,
@@ -1798,7 +1798,7 @@ impl<'a, 'gcx, 'tcx> VariantDef {
     ///
     /// 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 AdtDefs 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
@@ -1847,7 +1847,7 @@ pub fn is_field_list_non_exhaustive(&self) -> bool {
 
 #[derive(Copy, Clone, Debug, PartialEq, Eq, RustcEncodable, RustcDecodable)]
 pub enum VariantDiscr {
-    /// Explicit value for this variant, i.e. `X = 123`.
+    /// Explicit value for this variant, i.e., `X = 123`.
     /// The `DefId` corresponds to the embedded constant.
     Explicit(DefId),
 
@@ -1865,9 +1865,9 @@ pub struct FieldDef {
     pub vis: Visibility,
 }
 
-/// The definition of an abstract data type - a struct or enum.
+/// The definition of an abstract data type -- a struct or enum.
 ///
-/// These are all interned (by intern_adt_def) into the adt_defs
+/// These are all interned (by `intern_adt_def`) into the `adt_defs`
 /// table.
 pub struct AdtDef {
     pub did: DefId,
@@ -2367,7 +2367,7 @@ pub fn destructor(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Option<Destructor> {
     /// 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,
index 699c2d111c6397aa8acbd77bc6359f35131a0bc7..5cd06fb8a52c015c4418dbd3b0f87974407eda53 100644 (file)
         ) -> Result<DtorckConstraint<'tcx>, 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
+        /// 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 MANUALLY, it is only meant to cache the base data for the `is_const_fn`
-        /// function
+        /// **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
         ///
-        /// 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)
+        /// 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 { ... }`).
         [] fn all_crate_nums: all_crate_nums_node(CrateNum) -> Lrc<Vec<CrateNum>>,
 
         /// A vector of every trait accessible in the whole crate
-        /// (i.e. including those from subcrates). This is used only for
+        /// (i.e., including those from subcrates). This is used only for
         /// error reporting.
         [] fn all_traits: all_traits_node(CrateNum) -> Lrc<Vec<DefId>>,
     },
index 1b64a686794c0a4de2da60fb605b61fc0a3be18c..7ad4fd58273ee679f0554678f4a0b880cfbd6892 100644 (file)
@@ -8,10 +8,11 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-//! Generalized type relating mechanism. A type relation R relates a
-//! pair of values (A, B). A and B are usually types or regions but
-//! can be other things. Examples of type relations are subtyping,
-//! type equality, etc.
+//! Generalized type relating mechanism.
+//!
+//! A type relation `R` relates a pair of values `(A, B)`. `A and B` are usually
+//! types or regions but can be other things. Examples of type relations are
+//! subtyping, type equality, etc.
 
 use hir::def_id::DefId;
 use mir::interpret::ConstValue;
index d861fb367813ae51677d9f38b8d1f13d8510bcbc..f757f48e987d8233f66f3fe152f232a1f528ee36 100644 (file)
@@ -8,8 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-//! This module contains TyKind and its major components
+//! This module contains `TyKind` and its major components.
 
+use hir;
 use hir::def_id::DefId;
 use infer::canonical::Canonical;
 use mir::interpret::ConstValue;
@@ -30,9 +31,6 @@
 use syntax::symbol::{keywords, InternedString};
 
 use serialize;
-
-use hir;
-
 use self::InferTy::*;
 use self::TyKind::*;
 
@@ -91,7 +89,7 @@ pub fn assert_bound_var(&self) -> BoundVar {
     }
 }
 
-/// N.B., If you change this, you'll probably want to change the corresponding
+/// N.B., if you change this, you'll probably want to change the corresponding
 /// AST structure in `libsyntax/ast.rs` as well.
 #[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, RustcEncodable, RustcDecodable)]
 pub enum TyKind<'tcx> {
@@ -531,11 +529,11 @@ impl Iterator<Item=Ty<'tcx>> + 'tcx
 
 #[derive(Debug, Copy, Clone, PartialEq, PartialOrd, Ord, Eq, Hash, RustcEncodable, RustcDecodable)]
 pub enum ExistentialPredicate<'tcx> {
-    /// e.g. Iterator
+    /// e.g., Iterator
     Trait(ExistentialTraitRef<'tcx>),
-    /// e.g. Iterator::Item = T
+    /// e.g., Iterator::Item = T
     Projection(ExistentialProjection<'tcx>),
-    /// e.g. Send
+    /// e.g., Send
     AutoTrait(DefId),
 }
 
@@ -784,7 +782,7 @@ pub fn with_self_ty(&self, tcx: TyCtxt<'_, '_, 'tcx>,
 /// Binder<TraitRef>`). Note that when we instantiate,
 /// erase, or otherwise "discharge" these bound vars, we change the
 /// type from `Binder<T>` to just `T` (see
-/// e.g. `liberate_late_bound_regions`).
+/// e.g., `liberate_late_bound_regions`).
 #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, RustcEncodable, RustcDecodable)]
 pub struct Binder<T>(T);
 
@@ -1099,12 +1097,12 @@ pub struct DebruijnIndex {
 /// with some concrete region before being used. There are 2 kind of
 /// bound regions: early-bound, which are bound in an item's Generics,
 /// and are substituted by a Substs,  and late-bound, which are part of
-/// higher-ranked types (e.g. `for<'a> fn(&'a ())`) and are substituted by
+/// higher-ranked types (e.g., `for<'a> fn(&'a ())`) and are substituted by
 /// the likes of `liberate_late_bound_regions`. The distinction exists
 /// because higher-ranked lifetimes aren't supported in all places. See [1][2].
 ///
 /// Unlike Param-s, bound regions are not supposed to exist "in the wild"
-/// outside their binder, e.g. in types passed to type inference, and
+/// outside their binder, e.g., in types passed to type inference, and
 /// should first be substituted (by placeholder regions, free regions,
 /// or region variables).
 ///
@@ -1160,7 +1158,7 @@ pub enum RegionKind {
     ReFree(FreeRegion),
 
     /// A concrete region naming some statically determined scope
-    /// (e.g. an expression or sequence of statements) within the
+    /// (e.g., an expression or sequence of statements) within the
     /// current function.
     ReScope(region::Scope),
 
@@ -1324,7 +1322,7 @@ pub fn item_def_id(&self) -> DefId {
 
 impl DebruijnIndex {
     /// Returns the resulting index when this value is moved into
-    /// `amount` number of new binders. So e.g. if you had
+    /// `amount` number of new binders. So e.g., if you had
     ///
     ///    for<'a> fn(&'a x)
     ///
@@ -1332,7 +1330,7 @@ impl DebruijnIndex {
     ///
     ///    for<'a> fn(for<'b> fn(&'a x))
     ///
-    /// you would need to shift the index for `'a` into 1 new binder.
+    /// you would need to shift the index for `'a` into a new binder.
     #[must_use]
     pub fn shifted_in(self, amount: u32) -> DebruijnIndex {
         DebruijnIndex::from_u32(self.as_u32() + amount)
@@ -1809,10 +1807,10 @@ pub fn has_concrete_skeleton(&self) -> bool {
         }
     }
 
-    /// Returns the type and mutability of *ty.
+    /// Returns the type and mutability of `*ty`.
     ///
     /// The parameter `explicit` indicates if this is an *explicit* dereference.
-    /// Some types---notably unsafe ptrs---can only be dereferenced explicitly.
+    /// Some types -- notably unsafe ptrs -- can only be dereferenced explicitly.
     pub fn builtin_deref(&self, explicit: bool) -> Option<TypeAndMut<'tcx>> {
         match self.sty {
             Adt(def, _) if def.is_box() => {
index 3425203989891f916f5c341e2beb73d8f430973b..cda281e053a3453013ee90e21b986fa12b9b7ff4 100644 (file)
@@ -316,10 +316,10 @@ pub fn type_for_def(&self, def: &ty::GenericParamDef) -> Kind<'tcx> {
     }
 
     /// Transform from substitutions for a child of `source_ancestor`
-    /// (e.g. a trait or impl) to substitutions for the same child
+    /// (e.g., a trait or impl) to substitutions for the same child
     /// in a different item, with `target_substs` as the base for
     /// the target impl/trait, with the source child-specific
-    /// parameters (e.g. method parameters) on top of that base.
+    /// parameters (e.g., method parameters) on top of that base.
     pub fn rebase_onto(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>,
                        source_ancestor: DefId,
                        target_substs: &Substs<'tcx>)
index 2b9bd91e48a6c94d7e39dcf77ca167edc9b739d5..f9ce228a30c2311150aeeb417d8bbb379e90151c 100644 (file)
@@ -344,7 +344,7 @@ pub fn struct_lockstep_tails(self,
     /// themselves. This should really be a unique type; `FreshTy(0)` is a
     /// popular choice.
     ///
-    /// NB: in some cases, particularly around higher-ranked bounds,
+    /// N.B., in some cases, particularly around higher-ranked bounds,
     /// this function returns a kind of conservative approximation.
     /// That is, all regions returned by this function are definitely
     /// required, but there may be other region bounds that are not
@@ -451,9 +451,9 @@ pub fn destructor_constraints(self, def: &'tcx ty::AdtDef)
         // destructor will not access borrowed data,
         // even if such data is otherwise reachable.
         //
-        // Such access can be in plain sight (e.g. dereferencing
+        // Such access can be in plain sight (e.g., dereferencing
         // `*foo.0` of `Foo<'a>(&'a u32)`) or indirectly hidden
-        // (e.g. calling `foo.0.clone()` of `Foo<T:Clone>`).
+        // (e.g., calling `foo.0.clone()` of `Foo<T:Clone>`).
         if self.has_attr(dtor, "unsafe_destructor_blind_to_params") {
             debug!("destructor_constraint({:?}) - blind", def.did);
             return vec![];
@@ -656,7 +656,7 @@ pub fn is_freeze(&'tcx self,
 
     /// If `ty.needs_drop(...)` returns `true`, then `ty` is definitely
     /// non-copy and *might* have a destructor attached; if it returns
-    /// `false`, then `ty` definitely has no destructor (i.e. no drop glue).
+    /// `false`, then `ty` definitely has no destructor (i.e., no drop glue).
     ///
     /// (Note that this implies that if `ty` has a destructor attached,
     /// then `needs_drop` will definitely return `true` for `ty`.)
index c6ba20de0d3b900377fbd1fb87e1ba77770c5847..68e197849b03e701deaed92afd13465b5c58d6d3 100644 (file)
@@ -342,7 +342,7 @@ pub trait MemoizationMap {
     /// If `key` is present in the map, return the value,
     /// otherwise invoke `op` and store the value in the map.
     ///
-    /// NB: if the receiver is a `DepTrackingMap`, special care is
+    /// N.B., if the receiver is a `DepTrackingMap`, special care is
     /// needed in the `op` to ensure that the correct edges are
     /// added into the dep graph. See the `DepTrackingMap` impl for
     /// more details!
index 2ad83fc93ef75c1c089e077ee3cfde9da9c75392..60ddac1abfd46f10c2efda39c983c1571c772092 100644 (file)
@@ -926,7 +926,7 @@ fn mul_add_r(mut self, multiplicand: Self, addend: Self, round: Round) -> Status
 
         // In case MSB resides at the left-hand side of radix point, shift the
         // mantissa right by some amount to make sure the MSB reside right before
-        // the radix point (i.e. "MSB . rest-significant-bits").
+        // the radix point (i.e., "MSB . rest-significant-bits").
         if omsb > S::PRECISION {
             let bits = omsb - S::PRECISION;
             loss = sig::shift_right(&mut wide_sig, &mut self.exp, bits).combine(loss);
@@ -2674,7 +2674,7 @@ pub(super) fn mul<'a>(
 
         // In case MSB resides at the left-hand side of radix point, shift the
         // mantissa right by some amount to make sure the MSB reside right before
-        // the radix point (i.e. "MSB . rest-significant-bits").
+        // the radix point (i.e., "MSB . rest-significant-bits").
         //
         // Note that the result is not normalized when "omsb < precision". So, the
         // caller needs to call IeeeFloat::normalize() if normalized value is
index 69c9f385409e4a268a1c0d17a39233e64c39bdbf..c90191716010b7d59784b10ef3ff7db2e54941fb 100644 (file)
@@ -26,8 +26,8 @@
 //! Comments have been preserved where possible, only slightly adapted.
 //!
 //! Instead of keeping a pointer to a configuration struct and inspecting it
-//! dynamically on every operation, types (e.g. `ieee::Double`), traits
-//! (e.g. `ieee::Semantics`) and associated constants are employed for
+//! dynamically on every operation, types (e.g., `ieee::Double`), traits
+//! (e.g., `ieee::Semantics`) and associated constants are employed for
 //! increased type safety and performance.
 //!
 //! On-heap bigints are replaced everywhere (except in decimal conversion),
@@ -179,7 +179,7 @@ fn neg(self) -> Round {
 /// implemented operations. Currently implemented operations are add, subtract,
 /// multiply, divide, fused-multiply-add, conversion-to-float,
 /// conversion-to-integer and conversion-from-integer. New rounding modes
-/// (e.g. away from zero) can be added with three or four lines of code.
+/// (e.g., away from zero) can be added with three or four lines of code.
 ///
 /// Four formats are built-in: IEEE single precision, double precision,
 /// quadruple precision, and x87 80-bit extended double (when operating with
@@ -589,7 +589,7 @@ fn frexp(self, exp: &mut ExpInt) -> Self {
 pub trait FloatConvert<T: Float>: Float {
     /// Convert a value of one floating point type to another.
     /// The return value corresponds to the IEEE754 exceptions. *loses_info
-    /// records whether the transformation lost information, i.e. whether
+    /// 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,
     /// but there are edge cases where this is not so).
index e662088e82fb09724338560c36cddb60e7641965..aaf6b29a99e8cb23b4c6485b18423bc1607be7c0 100644 (file)
@@ -288,7 +288,7 @@ fn mul_r(mut self, rhs: Self, round: Round) -> StatusAnd<Self> {
         //   \   /
         //   Normal
         //
-        // e.g. NaN * NaN = NaN
+        // e.g., NaN * NaN = NaN
         //      Zero * Inf = NaN
         //      Normal * Zero = Zero
         //      Normal * Inf = Inf
index 1a9672aa6ce5e6562179764e2780077f90a8391e..7ed4d4910d71d8d130e2a6adc6ee3fa2a0d0c234 100644 (file)
@@ -286,7 +286,7 @@ fn guarantee_assignment_valid(&mut self,
                                                 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.
             }
index 3a0d252137c22d78a869bb9d059e6219bba0a2c7..cb1200f462fb635c894b72a004f63cc2c5872ae3 100644 (file)
@@ -217,7 +217,7 @@ fn build_borrowck_dataflow_data<'a, 'c, 'tcx, F>(this: &mut BorrowckCtxt<'a, 'tc
 }
 
 /// Accessor for introspective clients inspecting `AnalysisData` and
-/// the `BorrowckCtxt` itself , e.g. the flowgraph visualizer.
+/// the `BorrowckCtxt` itself , e.g., the flowgraph visualizer.
 pub fn build_borrowck_dataflow_data_for_fn<'a, 'tcx>(
     tcx: TyCtxt<'a, 'tcx, 'tcx>,
     body_id: hir::BodyId,
index 99df0fa5e471f6b0c3f4f5a34611273c54e40c37..d12c22109c681d3321faaf2fb474af083b0ced9a 100644 (file)
@@ -71,7 +71,7 @@ pub struct DataFlowContext<'a, 'tcx: 'a, O> {
     scope_kills: Vec<usize>,
 
     /// bits killed as we exit the cfg node directly; if it is jumped
-    /// over, e.g. via `break`, the kills are not reflected in the
+    /// over, e.g., via `break`, the kills are not reflected in the
     /// jump's effects. Updated by `add_kill(KillFrom::Execution)`.
     action_kills: Vec<usize>,
 
@@ -172,7 +172,7 @@ fn build_local_id_to_index(body: Option<&hir::Body>,
     let mut index = FxHashMap::default();
 
     // FIXME(#15020) Would it be better to fold formals from decl
-    // into cfg itself?  i.e. introduce a fn-based flow-graph in
+    // into cfg itself?  i.e., introduce a fn-based flow-graph in
     // addition to the current block-based flow-graph, rather than
     // have to put traversals like this here?
     if let Some(body) = body {
@@ -430,7 +430,7 @@ fn each_bit<F>(&self, words: &[usize], mut f: F) -> bool where
                 for offset in 0..usize_bits {
                     let bit = 1 << offset;
                     if (word & bit) != 0 {
-                        // NB: we round up the total number of bits
+                        // 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
                         // means that there may be some stray bits at
index 5b6d157043d864ad6b8195d38acbdb2c395fe941..b8954dee794f7bba2bdcbc60423d0763c44ba6b1 100644 (file)
@@ -185,7 +185,7 @@ fn store_fn_arg(
 
 impl ArgTypeExt<'ll, 'tcx> for ArgType<'tcx, Ty<'tcx>> {
     /// Get the LLVM type for a place of the original Rust type of
-    /// this argument/return, i.e. the result of `type_of::type_of`.
+    /// this argument/return, i.e., the result of `type_of::type_of`.
     fn memory_ty(&self, cx: &CodegenCx<'ll, 'tcx>) -> &'ll Type {
         self.layout.llvm_type(cx)
     }
index 38ab1302cfa7cb5b525749a01fe30c9fedd38176..ffe5e123f9b8b597e697aea2974618d0a038a334 100644 (file)
@@ -71,7 +71,7 @@ pub fn set_optimize_for_size(val: &'ll Value, optimize: bool) {
     Attribute::OptimizeForSize.toggle_llfn(Function, val, optimize);
 }
 
-/// Tell LLVM if this function should be 'naked', i.e. skip the epilogue and prologue.
+/// Tell LLVM if this function should be 'naked', i.e., skip the epilogue and prologue.
 #[inline]
 pub fn naked(val: &'ll Value, is_naked: bool) {
     Attribute::Naked.toggle_llfn(Function, val, is_naked);
@@ -147,7 +147,7 @@ pub fn non_lazy_bind(sess: &Session, llfn: &'ll Value) {
     }
 }
 
-/// Composite function which sets LLVM attributes for function depending on its AST (#[attribute])
+/// Composite function which sets LLVM attributes for function depending on its AST (`#[attribute]`)
 /// attributes.
 pub fn from_fn_attrs(
     cx: &CodegenCx<'ll, '_>,
index 68da14570e4479a04bf583b8352233479fc2e888..9e100a1427fc4179fe4d729a14c30383b1e0eac7 100644 (file)
@@ -994,7 +994,7 @@ fn link_args(cmd: &mut dyn Linker,
     //
     // The rationale behind this ordering is that those items lower down in the
     // list can't depend on items higher up in the list. For example nothing can
-    // depend on what we just generated (e.g. that'd be a circular dependency).
+    // depend on what we just generated (e.g., that'd be a circular dependency).
     // Upstream rust libraries are not allowed to depend on our local native
     // libraries as that would violate the structure of the DAG, in that
     // scenario they are required to link to them as well in a shared fashion.
@@ -1003,7 +1003,7 @@ fn link_args(cmd: &mut dyn Linker,
     // well, but they also can't depend on what we just started to add to the
     // link line. And finally upstream native libraries can't depend on anything
     // in this DAG so far because they're only dylibs and dylibs can only depend
-    // on other dylibs (e.g. other native deps).
+    // on other dylibs (e.g., other native deps).
     add_local_native_libraries(cmd, sess, codegen_results);
     add_upstream_rust_crates(cmd, sess, codegen_results, crate_type, tmpdir);
     add_upstream_native_libraries(cmd, sess, codegen_results, crate_type);
@@ -1205,7 +1205,7 @@ fn add_upstream_rust_crates(cmd: &mut dyn Linker,
     // compiler-builtins are always placed last to ensure that they're
     // linked correctly.
     // We must always link the `compiler_builtins` crate statically. Even if it
-    // was already "included" in a dylib (e.g. `libstd` when `-C prefer-dynamic`
+    // was already "included" in a dylib (e.g., `libstd` when `-C prefer-dynamic`
     // is used)
     if let Some(cnum) = compiler_builtins {
         add_static_crate(cmd, sess, codegen_results, tmpdir, crate_type, cnum);
@@ -1385,7 +1385,7 @@ fn looks_like_rust(s: &str) -> bool {
             // because a `dylib` can be reused as an intermediate artifact.
             //
             // Note, though, that we don't want to include the whole of a
-            // compiler-builtins crate (e.g. compiler-rt) because it'll get
+            // compiler-builtins crate (e.g., compiler-rt) because it'll get
             // repeatedly linked anyway.
             if crate_type == config::CrateType::Dylib &&
                 codegen_results.crate_info.compiler_builtins != Some(cnum) {
index 2ddbd0c299a92c0a1fafe9a09851e7cc555ba1a4..78a3b6907a63d3ac9c06c25066c3feb8976a2272 100644 (file)
@@ -782,7 +782,7 @@ fn create_msvc_imps(
     }
     // The x86 ABI seems to require that leading underscores are added to symbol
     // names, so we need an extra underscore on 32-bit. There's also a leading
-    // '\x01' here which disables LLVM's symbol mangling (e.g. no extra
+    // '\x01' here which disables LLVM's symbol mangling (e.g., no extra
     // underscores added in front).
     let prefix = if cgcx.target_pointer_width == "32" {
         "\x01__imp__"
index fd13421835c12e522a7556ef1acb3efef2f9d091..55f286eb0beed0cdc72658f650fe22719f096e05 100644 (file)
@@ -63,7 +63,7 @@
 ///
 /// Each `Block` may contain an instance of this, indicating whether the block
 /// is part of a landing pad or not. This is used to make decision about whether
-/// to emit `invoke` instructions (e.g. in a landing pad we don't continue to
+/// to emit `invoke` instructions (e.g., in a landing pad we don't continue to
 /// use `invoke`) and also about various function call metadata.
 ///
 /// For GNU exceptions (`landingpad` + `resume` instructions) this structure is
index a4baa332fe2a740dfb11f329307926b0cc592f17..086fb1f5a93ccc9f2407e63247d6c8f10e25426e 100644 (file)
@@ -295,7 +295,7 @@ impl CodegenCx<'ll, 'tcx> {
                             self.tcx.sess.opts.cg.prefer_dynamic));
 
             if needs_dll_storage_attr {
-                // This item is external but not foreign, i.e. it originates from an external Rust
+                // This item is external but not foreign, i.e., it originates from an external Rust
                 // crate. Since we don't know whether this crate will be linked dynamically or
                 // statically in the final application, we always mark such symbols as 'dllimport'.
                 // If final linkage happens to be static, we rely on compiler-emitted __imp_ stubs
@@ -426,7 +426,7 @@ fn codegen_static(
                 //
                 // By default a global's alignment can be freely increased.
                 // This allows LLVM to generate more performant instructions
-                // e.g. using load-aligned into a SIMD register.
+                // e.g., using load-aligned into a SIMD register.
                 //
                 // However, on macOS 10.10 or below, the dynamic linker does not
                 // respect any alignment given on the TLS (radar 24221680).
index 564e424cf6cd728400883195434b0d9b5fee71aa..6c90937de3f9baa897b9dd3d1adcd336d8474bc0 100644 (file)
@@ -233,7 +233,7 @@ impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> {
         // they're not available to be linked against. This poses a few problems
         // for the compiler, some of which are somewhat fundamental, but we use
         // the `use_dll_storage_attrs` variable below to attach the `dllexport`
-        // attribute to all LLVM functions that are exported e.g. they're
+        // attribute to all LLVM functions that are exported e.g., they're
         // already tagged with external linkage). This is suboptimal for a few
         // reasons:
         //
index ce0476b07eb433d20342bca5809b9ec3561ce1a4..5e2476e0918ffaf9a8c474971970ad686ca4e593 100644 (file)
 //!
 //! (3) Tuple-, pointer and function types are structurally identified, which
 //!     means that they are equivalent if their component types are equivalent
-//!     (i.e. (i32, i32) is the same regardless in which crate it is used).
+//!     (i.e., (i32, i32) is the same regardless in which crate it is used).
 //!
 //! 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
index 5a1c62e253647a6209090141f400c08ab0449bfb..d263b4e1237808e6ebd59e2288b721cd49dd3f77 100644 (file)
@@ -509,7 +509,7 @@ pub fn type_metadata(
             },
             None => {
                 // The Ty is not in the TypeMap but maybe we have already seen
-                // an equivalent type (e.g. only differing in region arguments).
+                // an equivalent type (e.g., only differing in region arguments).
                 // In order to find out, generate the unique type id and look
                 // that up.
                 let unique_type_id = type_map.get_unique_type_id_of_type(cx, t);
index e54e180224eec9d2634a861e7eafd132bd8035de..5b65b1fdda64eaa6fa747833d742d2b94941a812 100644 (file)
@@ -488,7 +488,7 @@ fn get_containing_scope<'ll, 'tcx>(
                     );
 
                     // Only "class" methods are generally understood by LLVM,
-                    // so avoid methods on other types (e.g. `<*mut T>::null`).
+                    // so avoid methods on other types (e.g., `<*mut T>::null`).
                     match impl_self_ty.sty {
                         ty::Adt(def, ..) if !def.is_box() => {
                             Some(type_metadata(cx, impl_self_ty, syntax_pos::DUMMY_SP))
index 60545f9e193d130dfda0cb7c40908aebf4c75035..2e827cc6d0601f6e81b3a2aaee94e15dbae26442 100644 (file)
@@ -19,9 +19,9 @@
 use rustc::hir;
 
 // Compute the name of the type as it should be stored in debuginfo. Does not do
-// any caching, i.e. calling the function twice with the same type will also do
+// any caching, i.e., calling the function twice with the same type will also do
 // the work twice. The `qualified` parameter only affects the first level of the
-// type name, further levels (i.e. type parameters) are always fully qualified.
+// type name, further levels (i.e., type parameters) are always fully qualified.
 pub fn compute_debuginfo_type_name<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
                                              t: Ty<'tcx>,
                                              qualified: bool)
index 89262beb356db749ee8299184b663b20d4abd945..4b6ef30b1385c6261546d72ba117ccec77b7a9f4 100644 (file)
@@ -26,7 +26,7 @@
 pub fn is_node_local_to_unit(cx: &CodegenCx, def_id: DefId) -> bool
 {
     // The is_local_to_unit flag indicates whether a function is local to the
-    // current compilation unit (i.e. if it is *static* in the C-sense). The
+    // current compilation unit (i.e., if it is *static* in the C-sense). The
     // *reachable* set should provide a good approximation of this, as it
     // contains everything that might leak out of the current crate (by being
     // externally visible or by being inlined into something externally
index 313aa1751065bd0cd9acffb6b46182132e83471b..59608b119397624313a30fe7dc1228e6b83815e6 100644 (file)
@@ -732,7 +732,7 @@ fn modify_as_needed<'ll, 'tcx>(
                             // We found a tuple that needs squishing! So
                             // run over the tuple and load each field.
                             //
-                            // This assumes the type is "simple", i.e. no
+                            // This assumes the type is "simple", i.e., no
                             // destructors, and the contents are SIMD
                             // etc.
                             assert!(!bx.type_needs_drop(arg.layout.ty));
@@ -997,7 +997,7 @@ fn codegen_msvc_try(
 }
 
 // Definition of the standard "try" function for Rust using the GNU-like model
-// of exceptions (e.g. the normal semantics of LLVM's landingpad and invoke
+// of exceptions (e.g., the normal semantics of LLVM's landingpad and invoke
 // instructions).
 //
 // This codegen is a little surprising because we always call a shim
index fbd5192a63f8e42c1ccc93eec222af882e97c96b..3764c122dea29343083bfe9a125063c7da05ff60 100644 (file)
@@ -125,7 +125,7 @@ pub fn SetFunctionCallConv(fn_: &'a Value, cc: CallConv) {
 // example happen for generics when using multiple codegen units. This function simply uses the
 // value's name as the comdat value to make sure that it is in a 1-to-1 relationship to the
 // function.
-// For more details on COMDAT sections see e.g. http://www.airs.com/blog/archives/52
+// For more details on COMDAT sections see e.g., http://www.airs.com/blog/archives/52
 pub fn SetUniqueComdat(llmod: &Module, val: &'a Value) {
     unsafe {
         LLVMRustSetComdat(llmod, val, LLVMGetValueName(val));
index 9b2d17d65caa30fe5c20c8b26c79ea2ea18d72cb..1d5bcc4ba3986ea97c27b5107b9f381279a3deca 100644 (file)
@@ -63,7 +63,7 @@ fn predefine_fn(&self,
             llvm::SetUniqueComdat(self.llmod, lldecl);
         }
 
-        // If we're compiling the compiler-builtins crate, e.g. the equivalent of
+        // If we're compiling the compiler-builtins crate, e.g., the equivalent of
         // compiler-rt, then we want to implicitly compile everything with hidden
         // visibility as we're going to link this object all over the place but
         // don't want the symbols to get exported.
index b100b6778033845b509c922ecaf0cd807abf177c..313ab1f974fdebff30c357620707ce8a33b05b3b 100644 (file)
@@ -255,7 +255,7 @@ pub fn i8_llcx(llcx: &llvm::Context) -> &Type {
         }
     }
 
-    // Creates an integer type with the given number of bits, e.g. i24
+    // Creates an integer type with the given number of bits, e.g., i24
     pub fn ix_llcx(
         llcx: &llvm::Context,
         num_bits: u64
index 15b5bdeb44d60f63490ae1f989a02d2d83237868..52b560c6625405f3dab9d3af5af57a659f3adea2 100644 (file)
@@ -15,8 +15,8 @@
 use rustc::ty::layout::{self, Align, LayoutOf, Size, TyLayout};
 use rustc_target::abi::FloatTy;
 use rustc_mir::monomorphize::item::DefPathBasedNames;
-use type_::Type;
 use rustc_codegen_ssa::traits::*;
+use type_::Type;
 
 use std::fmt::Write;
 
@@ -84,10 +84,10 @@ fn uncached_llvm_type<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
             let packed = false;
             match name {
                 None => {
-                    cx.type_struct( &[fill], packed)
+                    cx.type_struct(&[fill], packed)
                 }
                 Some(ref name) => {
-                    let llty = cx.type_named_struct( name);
+                    let llty = cx.type_named_struct(name);
                     cx.set_struct_body(llty, &[fill], packed);
                     llty
                 }
@@ -236,7 +236,7 @@ fn is_llvm_scalar_pair<'a>(&self) -> bool {
         }
     }
 
-    /// Get the LLVM type corresponding to a Rust type, i.e. `rustc::ty::Ty`.
+    /// Get the LLVM type corresponding to a Rust type, i.e., `rustc::ty::Ty`.
     /// The pointee type of the pointer in `PlaceRef` is always this type.
     /// For sized types, it is also the right LLVM type for an `alloca`
     /// containing a value of that type, and most immediates (except `bool`).
@@ -470,9 +470,9 @@ fn pointee_info_at<'a>(&self, cx: &CodegenCx<'a, 'tcx>, offset: Size)
                         // (according to its type), or null (which the
                         // niche field's scalar validity range encodes).
                         // This allows using `dereferenceable_or_null`
-                        // for e.g. `Option<&T>`, and this will continue
+                        // for e.g., `Option<&T>`, and this will continue
                         // to work as long as we don't start using more
-                        // niches than just null (e.g. the first page
+                        // niches than just null (e.g., the first page
                         // of the address space, or unaligned pointers).
                         if self.fields.offset(0) == offset {
                             Some(self.for_variant(cx, dataful_variant))
index f3cc344254feaae74ccbb4a261ddcf247f4f24ce..2f92c427f657cdde4595a81427ae1fb829068a2c 100644 (file)
@@ -107,7 +107,7 @@ pub fn to_linker<'a>(
 /// This trait is the total list of requirements needed by `back::link` and
 /// represents the meaning of each option being passed down. This trait is then
 /// used to dispatch on whether a GNU-like linker (generally `ld.exe`) or an
-/// MSVC linker (e.g. `link.exe`) is being used.
+/// MSVC linker (e.g., `link.exe`) is being used.
 pub trait Linker {
     fn link_dylib(&mut self, lib: &str);
     fn link_rust_dylib(&mut self, lib: &str, path: &Path);
index 84b17e31dd4eb479e8e01b7c86a413dc4cec25e7..a17a00ddb29ff7470aeb755a0133b6328e293303 100644 (file)
@@ -85,7 +85,7 @@ fn reachable_non_generics_provider<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
             // categories:
             //
             // 1. Those that are included statically via a static library
-            // 2. Those included otherwise (e.g. dynamically or via a framework)
+            // 2. Those included otherwise (e.g., dynamically or via a framework)
             //
             // Although our LLVM module is not literally emitting code for the
             // statically included symbols, it's an export of our library which
index 76d699d1736926fbd11394627eac2ad4547dba80..8a5b8bd2babbbc439919941aba86d3ee4770414a 100644 (file)
@@ -268,7 +268,7 @@ pub fn coerce_unsized_into<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>(
         let (base, info) = match bx.load_operand(src).val {
             OperandValue::Pair(base, info) => {
                 // fat-ptr to fat-ptr unsize preserves the vtable
-                // i.e. &'a fmt::Debug+Send => &'a fmt::Debug
+                // i.e., &'a fmt::Debug+Send => &'a fmt::Debug
                 // So we need to pointercast the base to ensure
                 // the types match up.
                 let thin_ptr = dst.layout.field(bx.cx(), FAT_PTR_ADDR);
index 8c53129abc315ebd601030ef0f2227dce2ca7937..70b7729b78b40d11323ce86e61233e5abe6005e8 100644 (file)
@@ -158,7 +158,7 @@ pub fn langcall(tcx: TyCtxt,
 }
 
 // To avoid UB from LLVM, these two functions mask RHS with an
-// appropriate mask unconditionally (i.e. the fallback behavior for
+// appropriate mask unconditionally (i.e., the fallback behavior for
 // all shifts). For 32- and 64-bit types, this matches the semantics
 // of Java. (See related discussion on #1877 and #10183.)
 
index 24ede4db6e3df0bc7402cb219b86fac138644894..d0cdb8924dfffcfea7bc63bbb1352c378500a14e 100644 (file)
@@ -61,7 +61,7 @@
 use rustc::middle::cstore::{LibSource, CrateSource, NativeLibrary};
 use syntax_pos::symbol::Symbol;
 
-// NB: This module needs to be declared first so diagnostics are
+// N.B., this module needs to be declared first so diagnostics are
 // registered before they are used.
 mod diagnostics;
 
index c7e2c76c3e503b82ddd288edad10241adfdaed50..81da7f5fb5cac041992bb0d93e56647ef47be451 100644 (file)
@@ -43,7 +43,7 @@ pub fn non_ssa_locals<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>(
             // These sorts of types require an alloca. Note that
             // is_llvm_immediate() may *still* be true, particularly
             // for newtypes, but we currently force some types
-            // (e.g. structs) into an alloca unconditionally, just so
+            // (e.g., structs) into an alloca unconditionally, just so
             // that we don't have to deal with having two pathways
             // (gep vs extractvalue etc).
             analyzer.not_ssa(mir::Local::new(index));
@@ -227,9 +227,9 @@ fn visit_local(&mut self,
 
             PlaceContext::NonMutatingUse(NonMutatingUseContext::Copy) |
             PlaceContext::NonMutatingUse(NonMutatingUseContext::Move) => {
-                // Reads from uninitialized variables (e.g. in dead code, after
+                // Reads from uninitialized variables (e.g., in dead code, after
                 // optimizations) require locals to be in (uninitialized) memory.
-                // NB: there can be uninitialized reads of a local visited after
+                // N.B., there can be uninitialized reads of a local visited after
                 // an assignment to that local, if they happen on disjoint paths.
                 let ssa_read = match self.first_assignment(local) {
                     Some(assignment_location) => {
index a992364959e66734a537a6a2656e992e681790cf..750de1c660cf347c3d411c724a4e3f8993be6e68 100644 (file)
@@ -467,7 +467,7 @@ fn arg_local_refs<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>(
         };
 
         if Some(local) == mir.spread_arg {
-            // This argument (e.g. the last argument in the "rust-call" ABI)
+            // This argument (e.g., the last argument in the "rust-call" ABI)
             // is a tuple that was spread at the ABI level and now we have
             // to reconstruct it into a tuple local variable, from multiple
             // individual LLVM function arguments.
@@ -614,7 +614,7 @@ fn arg_local_refs<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>(
             // because that's what the llvm.dbg.declare intrinsic expects.
 
             // FIXME(eddyb) this shouldn't be necessary but SROA seems to
-            // mishandle DW_OP_plus not preceded by DW_OP_deref, i.e. it
+            // mishandle DW_OP_plus not preceded by DW_OP_deref, i.e., it
             // doesn't actually strip the offset when splitting the closure
             // environment into its components so it ends up out of bounds.
             // (cuviper) It seems to be fine without the alloca on LLVM 6 and later.
index 1aba53255e7a714e55b4b28a8b40437c6a8bcca0..90aa9f6cbc763c7269502a938ae5d0ee8aece15e 100644 (file)
@@ -229,9 +229,9 @@ pub fn codegen_get_discr<Bx: BuilderMethods<'a, 'tcx, Value = V>>(
             layout::Variants::Tagged { ref tag, .. } => {
                 let signed = match tag.value {
                     // We use `i1` for bytes that are always `0` or `1`,
-                    // e.g. `#[repr(i8)] enum E { A, B }`, but we can't
+                    // e.g., `#[repr(i8)] enum E { A, B }`, but we can't
                     // let LLVM interpret the `i1` as signed, because
-                    // then `i1 1` (i.e. E::B) is effectively `i8 -1`.
+                    // then `i1 1` (i.e., E::B) is effectively `i8 -1`.
                     layout::Int(_, signed) => !tag.is_bool() && signed,
                     _ => false
                 };
index dc7b1ec37b23a51db4fcec957ecccc14f97fb69c..c932ffd1c1bdab27489ad1445e0fff4672026def 100644 (file)
@@ -319,9 +319,9 @@ pub fn codegen_rvalue_operand(
                         if let layout::Abi::Scalar(ref scalar) = operand.layout.abi {
                             if let layout::Int(_, s) = scalar.value {
                                 // We use `i1` for bytes that are always `0` or `1`,
-                                // e.g. `#[repr(i8)] enum E { A, B }`, but we can't
+                                // e.g., `#[repr(i8)] enum E { A, B }`, but we can't
                                 // let LLVM interpret the `i1` as signed, because
-                                // then `i1 1` (i.e. E::B) is effectively `i8 -1`.
+                                // then `i1 1` (i.e., E::B) is effectively `i8 -1`.
                                 signed = !scalar.is_bool() && s;
 
                                 let er = scalar.valid_range_exclusive(bx.cx());
index f9a2965284309d290f81549c6f558218a698d017..611e5f758a7811ceeaadf86ad29a96e275bdb036 100644 (file)
@@ -41,7 +41,7 @@ pub trait DeclareMethods<'tcx>: BackendTypes {
     /// Use this function when you intend to define a global. This function will
     /// return None if the name already has a definition associated with it. In that
     /// case an error should be reported to the user, because it usually happens due
-    /// to user’s fault (e.g. misuse of #[no_mangle] or #[export_name] attributes).
+    /// to user’s fault (e.g., misuse of #[no_mangle] or #[export_name] attributes).
     fn define_global(&self, name: &str, ty: Self::Type) -> Option<Self::Value>;
 
     /// Declare a private global
index 1d31bdfa9f0c491aa69748e24b1ece17a04c928b..ed53c8fffa7aa1ad41c4650ab8d5e72a8823c8eb 100644 (file)
@@ -32,7 +32,7 @@ pub trait BaseTypeMethods<'tcx>: Backend<'tcx> {
     fn type_i64(&self) -> Self::Type;
     fn type_i128(&self) -> Self::Type;
 
-    // Creates an integer type with the given number of bits, e.g. i24
+    // Creates an integer type with the given number of bits, e.g., i24
     fn type_ix(&self, num_bits: u64) -> Self::Type;
     fn type_isize(&self) -> Self::Type;
 
index 305c718ff0636557d0cab98ace7a8f0b8cf37ddd..d5b95e77b1a8aa437ab18c46d70493cbd42e23ed 100644 (file)
@@ -71,7 +71,7 @@
 //! order to also avoid inter-crate conflicts two more measures are taken:
 //!
 //! - The name of the crate containing the symbol is prepended to the symbol
-//!   name, i.e. symbols are "crate qualified". For example, a function `foo` in
+//!   name, i.e., symbols are "crate qualified". For example, a function `foo` in
 //!   module `bar` in crate `baz` would get a symbol name like
 //!   `baz::bar::foo::{hash}` instead of just `bar::foo::{hash}`. This avoids
 //!   simple conflicts between functions from different crates.
index c211d888df131b5b62f29fde6d1b98a5cc4496d5..2a1958357e0e6d54393f056a5c6fe4568109ee73 100644 (file)
@@ -531,7 +531,7 @@ fn mark_as_waiting_from(&self, node: &Node<O>) {
     /// indices. Cannot be used during a transaction.
     ///
     /// Beforehand, all nodes must be marked as `Done` and no cycles
-    /// on these nodes may be present. This is done by e.g. `process_cycles`.
+    /// on these nodes may be present. This is done by e.g., `process_cycles`.
     #[inline(never)]
     fn compress(&mut self, do_completed: DoCompleted) -> Option<Vec<O>> {
         let nodes_len = self.nodes.len();
index 27c2f8b718ab8bebb7f955e36cde1c30f515a52c..0b126e5c572ed8453431e9f47875e5aff556c8c9 100644 (file)
@@ -215,7 +215,7 @@ fn main() {
 ## Mutable reference
 
 When the owned container implements `DerefMut`, it is also possible to make
-a _mutable owning reference_. (E.g. with `Box`, `RefMut`, `MutexGuard`)
+a _mutable owning reference_. (e.g., with `Box`, `RefMut`, `MutexGuard`)
 
 ```
 extern crate owning_ref;
@@ -452,7 +452,7 @@ pub fn map_owner_box(self) -> OwningRef<Box<O>, T> {
     /// use owning_ref::{OwningRef, Erased};
     ///
     /// fn main() {
-    ///     // NB: Using the concrete types here for explicitness.
+    ///     // N.B., using the concrete types here for explicitness.
     ///     // For less verbose code type aliases like `BoxRef` are provided.
     ///
     ///     let owning_ref_a: OwningRef<Box<[i32; 4]>, [i32; 4]>
@@ -722,7 +722,7 @@ pub fn map_owner_box(self) -> OwningRefMut<Box<O>, T> {
     /// use owning_ref::{OwningRefMut, Erased};
     ///
     /// fn main() {
-    ///     // NB: Using the concrete types here for explicitness.
+    ///     // N.B., using the concrete types here for explicitness.
     ///     // For less verbose code type aliases like `BoxRef` are provided.
     ///
     ///     let owning_ref_mut_a: OwningRefMut<Box<[i32; 4]>, [i32; 4]>
@@ -1124,8 +1124,8 @@ impl<T: 'static> ToHandleMut for RefCell<T> {
     unsafe fn to_handle_mut(x: *const Self) -> Self::HandleMut { (*x).borrow_mut() }
 }
 
-// NB: Implementing ToHandle{,Mut} for Mutex and RwLock requires a decision
-// about which handle creation to use (i.e. read() vs try_read()) as well as
+// N.B., implementing ToHandle{,Mut} for Mutex and RwLock requires a decision
+// about which handle creation to use (i.e., read() vs try_read()) as well as
 // what to do with error results.
 
 /// Typedef of a owning reference that uses a `Box` as the owner.
index 546686b46b8db4c92f2474b4f64ee354938cbe5a..5b7ea161b289778a2cec70770add3b33594ae7c3 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-/// A vector type optimized for cases where this size is usually 0 (c.f. `SmallVector`).
+/// A vector type optimized for cases where this size is usually 0 (cf. `SmallVector`).
 /// The `Option<Box<..>>` wrapping allows us to represent a zero sized vector with `None`,
 /// which uses only a single (null) pointer.
 #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
index fd5dfab9e61be6702d36a264810f8657e41cbe04..250dad8136e1434530bded1693115018a26be72b 100644 (file)
@@ -304,7 +304,7 @@ pub fn minimal_upper_bounds(&self, a: &T, b: &T) -> Vec<&T> {
     ///
     /// The intuition is that this moves "one step up" through a lattice
     /// (where the relation is encoding the `<=` relation for the lattice).
-    /// So e.g. if the relation is `->` and we have
+    /// So e.g., if the relation is `->` and we have
     ///
     /// ```
     /// a -> b -> d -> f
index 2a1a3b481b3bf51d01bdf5b85f454b826e1c8331..f2edcdc1bac35de2311d6194729609bbde1eaf88 100644 (file)
@@ -9,15 +9,9 @@
 // except according to those terms.
 
 use rustc::dep_graph::DepGraph;
-use rustc::hir::{self, map as hir_map};
+use rustc::hir;
 use rustc::hir::lowering::lower_crate;
-use rustc_data_structures::fingerprint::Fingerprint;
-use rustc_data_structures::stable_hasher::StableHasher;
-use rustc_mir as mir;
-use rustc::session::{CompileResult, CrateDisambiguator, Session};
-use rustc::session::CompileIncomplete;
-use rustc::session::config::{self, Input, OutputFilenames, OutputType};
-use rustc::session::search_paths::PathKind;
+use rustc::hir::map as hir_map;
 use rustc::lint;
 use rustc::middle::{self, reachable, resolve_lifetime, stability};
 use rustc::middle::privacy::AccessLevels;
 use rustc::traits;
 use rustc::util::common::{install_panic_hook, time, ErrorReported};
 use rustc::util::profiling::ProfileCategory;
+use rustc::session::{CompileResult, CrateDisambiguator, Session};
+use rustc::session::CompileIncomplete;
+use rustc::session::config::{self, Input, OutputFilenames, OutputType};
+use rustc::session::search_paths::PathKind;
 use rustc_allocator as allocator;
 use rustc_borrowck as borrowck;
+use rustc_codegen_utils::codegen_backend::CodegenBackend;
+use rustc_data_structures::fingerprint::Fingerprint;
+use rustc_data_structures::stable_hasher::StableHasher;
+use rustc_data_structures::sync::{self, Lrc, Lock};
 use rustc_incremental;
-use rustc_resolve::{MakeGlobMap, Resolver, ResolverArenas};
 use rustc_metadata::creader::CrateLoader;
 use rustc_metadata::cstore::{self, CStore};
+use rustc_mir as mir;
+use rustc_passes::{self, ast_validation, hir_stats, loops, rvalue_promotion};
+use rustc_plugin as plugin;
+use rustc_plugin::registry::Registry;
+use rustc_privacy;
+use rustc_resolve::{MakeGlobMap, Resolver, ResolverArenas};
 use rustc_traits;
-use rustc_codegen_utils::codegen_backend::CodegenBackend;
 use rustc_typeck as typeck;
-use rustc_privacy;
-use rustc_plugin::registry::Registry;
-use rustc_plugin as plugin;
-use rustc_passes::{self, ast_validation, hir_stats, loops, rvalue_promotion};
-use super::Compilation;
+use syntax::{self, ast, attr, diagnostics, visit};
+use syntax::early_buffered_lints::BufferedEarlyLint;
+use syntax::ext::base::ExtCtxt;
+use syntax::fold::Folder;
+use syntax::parse::{self, PResult};
+use syntax::util::node_count::NodeCounter;
+use syntax::util::lev_distance::find_best_match_for_name;
+use syntax::symbol::Symbol;
+use syntax_pos::{FileName, hygiene};
+use syntax_ext;
 
 use serialize::json;
 
 use std::io::{self, Write};
 use std::iter;
 use std::path::{Path, PathBuf};
-use rustc_data_structures::sync::{self, Lrc, Lock};
 use std::sync::mpsc;
-use syntax::{self, ast, attr, diagnostics, visit};
-use syntax::early_buffered_lints::BufferedEarlyLint;
-use syntax::ext::base::ExtCtxt;
-use syntax::fold::Folder;
-use syntax::parse::{self, PResult};
-use syntax::util::node_count::NodeCounter;
-use syntax::util::lev_distance::find_best_match_for_name;
-use syntax::symbol::Symbol;
-use syntax_pos::{FileName, hygiene};
-use syntax_ext;
 
-use proc_macro_decls;
 use pretty::ReplaceBodyWithLoop;
-
+use proc_macro_decls;
 use profile;
+use super::Compilation;
 
 #[cfg(not(parallel_queries))]
 pub fn spawn_thread_pool<F: FnOnce(config::Options) -> R + sync::Send, R: sync::Send>(
index b89c4262024d1deed97558444c15ea8840851ee5..b41b0d081ced978b8368c9c4be0bf0b3c61617dd 100644 (file)
@@ -8,25 +8,21 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-//! The various pretty print routines.
+//! The various pretty-printing routines.
 
-pub use self::UserIdentifiedItem::*;
-pub use self::PpSourceMode::*;
-pub use self::PpMode::*;
-use self::NodesMatchingUII::*;
-
-use {abort_on_err, driver};
-
-use rustc::ty::{self, TyCtxt, Resolutions, AllArenas};
 use rustc::cfg;
 use rustc::cfg::graphviz::LabelledCFG;
+use rustc::hir;
+use rustc::hir::map as hir_map;
+use rustc::hir::map::blocks;
+use rustc::hir::print as pprust_hir;
 use rustc::session::Session;
 use rustc::session::config::{Input, OutputFilenames};
+use rustc::ty::{self, TyCtxt, Resolutions, AllArenas};
 use rustc_borrowck as borrowck;
 use rustc_borrowck::graphviz as borrowck_dot;
 use rustc_data_structures::thin_vec::ThinVec;
 use rustc_metadata::cstore::CStore;
-
 use rustc_mir::util::{write_mir_pretty, write_mir_graphviz};
 
 use syntax::ast::{self, BlockCheckMode};
 use std::str::FromStr;
 use std::mem;
 
-use rustc::hir::map as hir_map;
-use rustc::hir::map::blocks;
-use rustc::hir;
-use rustc::hir::print as pprust_hir;
+pub use self::UserIdentifiedItem::*;
+pub use self::PpSourceMode::*;
+pub use self::PpMode::*;
+use self::NodesMatchingUII::*;
+use {abort_on_err, driver};
 
 #[derive(Copy, Clone, PartialEq, Debug)]
 pub enum PpSourceMode {
index 77bd05cf91988b9e8fc10e6eacd3d6abc3267bda..f9d49f03ee044ff2ed31e6f6814c9b639e3e6954 100644 (file)
 
 //! # Standalone Tests for the Inference Module
 
-use std::path::PathBuf;
-use std::sync::mpsc;
-
 use driver;
 use errors;
 use errors::emitter::Emitter;
 use errors::{DiagnosticBuilder, Level};
+use rustc::hir;
 use rustc::hir::map as hir_map;
 use rustc::infer::outlives::env::OutlivesEnvironment;
 use rustc::infer::type_variable::TypeVariableOrigin;
@@ -40,7 +38,8 @@
 use syntax::symbol::Symbol;
 use syntax_pos::DUMMY_SP;
 
-use rustc::hir;
+use std::path::PathBuf;
+use std::sync::mpsc;
 
 struct Env<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> {
     infcx: &'a infer::InferCtxt<'a, 'gcx, 'tcx>,
@@ -155,7 +154,7 @@ fn test_env_with_pool<F>(
     let arenas = ty::AllArenas::new();
     let hir_map = hir_map::map_crate(&sess, &cstore, &mut hir_forest, &defs);
 
-    // run just enough stuff to build a tcx:
+    // Run just enough stuff to build a tcx.
     let (tx, _rx) = mpsc::channel();
     let outputs = OutputFilenames {
         out_directory: PathBuf::new(),
@@ -228,8 +227,8 @@ pub fn create_region_hierarchy(
     }
 
     pub fn create_simple_region_hierarchy(&mut self) {
-        // creates a region hierarchy where 1 is root, 10 and 11 are
-        // children of 1, etc
+        // Creates a region hierarchy where 1 is root, 10 and 11 are
+        // children of 1, etc.
 
         let dscope = region::Scope {
             id: hir::ItemLocalId::from_u32(1),
@@ -434,7 +433,7 @@ pub fn check_sub(&self, t1: Ty<'tcx>, t2: Ty<'tcx>) {
                 obligations,
                 value: (),
             }) => {
-                // None of these tests should require nested obligations:
+                // None of these tests should require nested obligations.
                 assert!(obligations.is_empty());
             }
             Err(ref e) => {
@@ -476,7 +475,7 @@ fn contravariant_region_ptr_err() {
         env.assert_eq(t_rptr1, t_rptr1);
         env.assert_eq(t_rptr10, t_rptr10);
 
-        // will cause an error when regions are resolved
+        // This will cause an error when regions are resolved.
         env.make_subtype(t_rptr10, t_rptr1);
     })
 }
@@ -487,7 +486,7 @@ fn sub_free_bound_false() {
     //!
     //!     fn(&'a isize) <: for<'b> fn(&'b isize)
     //!
-    //! does NOT hold.
+    //! *does not* hold.
 
     test_env(EMPTY_SOURCE_STR, errors(&[]), |mut env| {
         env.create_simple_region_hierarchy();
@@ -506,7 +505,7 @@ fn sub_bound_free_true() {
     //!
     //!     for<'a> fn(&'a isize) <: fn(&'b isize)
     //!
-    //! DOES hold.
+    //! *does* hold.
 
     test_env(EMPTY_SOURCE_STR, errors(&[]), |mut env| {
         env.create_simple_region_hierarchy();
@@ -578,11 +577,11 @@ fn subst_ty_renumber_bound() {
 fn subst_ty_renumber_some_bounds() {
     test_env(EMPTY_SOURCE_STR, errors(&[]), |env| {
         // Situation:
-        // Theta = [A -> &'a foo]
+        // `Theta = [A -> &'a foo]`
 
         let t_rptr_bound1 = env.t_rptr_late_bound(1);
 
-        // t_source = (A, fn(A))
+        // `t_source = (A, fn(A))`
         let t_source = {
             let t_param = env.t_param(0);
             env.t_pair(t_param, env.t_fn(&[t_param], env.t_nil()))
@@ -591,9 +590,9 @@ fn subst_ty_renumber_some_bounds() {
         let substs = env.infcx.tcx.intern_substs(&[t_rptr_bound1.into()]);
         let t_substituted = t_source.subst(env.infcx.tcx, substs);
 
-        // t_expected = (&'a isize, fn(&'a isize))
+        // `t_expected = (&'a isize, fn(&'a isize))`
         //
-        // but not that the Debruijn index is different in the different cases.
+        // However, note that the Debruijn index is different in the different cases.
         let t_expected = {
             let t_rptr_bound2 = env.t_rptr_late_bound_with_debruijn(1, d2());
             env.t_pair(t_rptr_bound1, env.t_fn(&[t_rptr_bound2], env.t_nil()))
@@ -613,7 +612,7 @@ fn subst_ty_renumber_some_bounds() {
 fn escaping() {
     test_env(EMPTY_SOURCE_STR, errors(&[]), |mut env| {
         // Situation:
-        // Theta = [A -> &'a foo]
+        // `Theta = [A -> &'a foo]`
         env.create_simple_region_hierarchy();
 
         assert!(!env.t_nil().has_escaping_bound_vars());
@@ -627,7 +626,7 @@ fn escaping() {
         let t_rptr_bound2 = env.t_rptr_late_bound_with_debruijn(1, d2());
         assert!(t_rptr_bound2.has_escaping_bound_vars());
 
-        // t_fn = fn(A)
+        // `t_fn = fn(A)`
         let t_param = env.t_param(0);
         assert!(!t_param.has_escaping_bound_vars());
         let t_fn = env.t_fn(&[t_param], env.t_nil());
@@ -642,7 +641,7 @@ fn subst_region_renumber_region() {
     test_env(EMPTY_SOURCE_STR, errors(&[]), |env| {
         let re_bound1 = env.re_late_bound_with_debruijn(1, d1());
 
-        // type t_source<'a> = fn(&'a isize)
+        // `type t_source<'a> = fn(&'a isize)`
         let t_source = {
             let re_early = env.re_early_bound(0, "'a");
             env.t_fn(&[env.t_rptr(re_early)], env.t_nil())
@@ -651,7 +650,7 @@ fn subst_region_renumber_region() {
         let substs = env.infcx.tcx.intern_substs(&[re_bound1.into()]);
         let t_substituted = t_source.subst(env.infcx.tcx, substs);
 
-        // t_expected = fn(&'a isize)
+        // `t_expected = fn(&'a isize)`
         //
         // but not that the Debruijn index is different in the different cases.
         let t_expected = {
index 55a4a63c8f3d5c9c9a266150e326d5d8800316b8..e17663c41e5944385df819fb2febf94ef94977bc 100644 (file)
@@ -78,7 +78,7 @@
 ];
 
 /// DepNodes for MirValidated/Optimized, which is relevant in "executable"
-/// code, i.e. functions+methods
+/// code, i.e., functions+methods
 const BASE_MIR: &[&str] = &[
     label_strs::MirOptimized,
     label_strs::MirValidated,
@@ -364,16 +364,16 @@ fn auto_labels(&mut self, item_id: ast::NodeId, attr: &Attribute) -> (&'static s
                     // Module-level inline assembly (from global_asm!)
                     HirItem::GlobalAsm(..) => ("ItemGlobalAsm", LABELS_HIR_ONLY),
 
-                    // A type alias, e.g. `type Foo = Bar<u8>`
+                    // A type alias, e.g., `type Foo = Bar<u8>`
                     HirItem::Ty(..) => ("ItemTy", LABELS_HIR_ONLY),
 
-                    // An enum definition, e.g. `enum Foo<A, B> {C<A>, D<B>}`
+                    // An enum definition, e.g., `enum Foo<A, B> {C<A>, D<B>}`
                     HirItem::Enum(..) => ("ItemEnum", LABELS_ADT),
 
-                    // A struct definition, e.g. `struct Foo<A> {x: A}`
+                    // A struct definition, e.g., `struct Foo<A> {x: A}`
                     HirItem::Struct(..) => ("ItemStruct", LABELS_ADT),
 
-                    // A union definition, e.g. `union Foo<A, B> {x: A, y: B}`
+                    // A union definition, e.g., `union Foo<A, B> {x: A, y: B}`
                     HirItem::Union(..) => ("ItemUnion", LABELS_ADT),
 
                     // Represents a Trait Declaration
index 9d3dc97552f966fe75cfc12e44c1611bf61d377f..e0e790e9f2302240d5264de111bde89ae350f9cd 100644 (file)
@@ -1573,7 +1573,7 @@ fn check_ident(&mut self, cx: &EarlyContext, ident: ast::Ident) {
                 }
             }
 
-            // no new keywords yet for 2018 edition and beyond
+            // There are no new keywords yet for the 2018 edition and beyond.
             // However, `await` is a "false" keyword in the 2018 edition,
             // and can only be used if the `async_await` feature is enabled.
             // Otherwise, we emit an error.
index 4d709d574c4f1fa2ab9acac14cff87a5bf2970cc..b1e44ea761c8664e4d2d1c72b36328ac4988b78e 100644 (file)
@@ -8,14 +8,14 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-//! Lints in the Rust compiler.
+//! # Lints in the Rust compiler
 //!
 //! This currently only contains the definitions and implementations
 //! of most of the lints that `rustc` supports directly, it does not
 //! contain the infrastructure for defining/registering lints. That is
 //! available in `rustc::lint` and `rustc_plugin` respectively.
 //!
-//! # Note
+//! ## Note
 //!
 //! This API is completely unstable and subject to change.
 
 extern crate syntax_pos;
 extern crate rustc_data_structures;
 
+mod diagnostics;
+mod nonstandard_style;
+pub mod builtin;
+mod types;
+mod unused;
+
 use rustc::lint;
 use rustc::lint::{LateContext, LateLintPass, LintPass, LintArray};
 use rustc::lint::builtin::{
 use rustc::hir;
 
 use syntax::ast;
+use syntax::edition::Edition;
 use syntax_pos::Span;
 
 use session::Session;
-use syntax::edition::Edition;
 use lint::LintId;
 use lint::FutureIncompatibleInfo;
 
-mod diagnostics;
-mod nonstandard_style;
-pub mod builtin;
-mod types;
-mod unused;
-
 use nonstandard_style::*;
 use builtin::*;
 use types::*;
@@ -212,8 +212,7 @@ macro_rules! add_lint_group {
     //   and include the full URL, sort items in ascending order of issue numbers.
     // - Later, change lint to error
     // - Eventually, remove lint
-    store.register_future_incompatible(sess,
-                                       vec![
+    store.register_future_incompatible(sess, vec![
         FutureIncompatibleInfo {
             id: LintId::of(PRIVATE_IN_PUBLIC),
             reference: "issue #34537 <https://github.com/rust-lang/rust/issues/34537>",
@@ -333,7 +332,7 @@ macro_rules! add_lint_group {
         },
         ]);
 
-    // Register renamed and removed lints
+    // Register renamed and removed lints.
     store.register_renamed("single_use_lifetime", "single_use_lifetimes");
     store.register_renamed("elided_lifetime_in_path", "elided_lifetimes_in_paths");
     store.register_renamed("bare_trait_object", "bare_trait_objects");
@@ -344,10 +343,10 @@ macro_rules! add_lint_group {
     store.register_removed("unsigned_negation", "replaced by negate_unsigned feature gate");
     store.register_removed("negate_unsigned", "cast a signed value instead");
     store.register_removed("raw_pointer_derive", "using derive with raw pointers is ok");
-    // Register lint group aliases
+    // Register lint group aliases.
     store.register_group_alias("nonstandard_style", "bad_style");
-    // This was renamed to raw_pointer_derive, which was then removed,
-    // so it is also considered removed
+    // This was renamed to `raw_pointer_derive`, which was then removed,
+    // so it is also considered removed.
     store.register_removed("raw_pointer_deriving", "using derive with raw pointers is ok");
     store.register_removed("drop_with_repr_extern", "drop flags have been removed");
     store.register_removed("fat_ptr_transmutes", "was accidentally removed back in 2014");
index 33250475d10d4fd84a16680acd2a94b6f05ea113..13be50ef01f62433e02f1be394e2658646d9b85f 100644 (file)
@@ -8,19 +8,17 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+use rustc::hir::{self, GenericParamKind, PatKind};
 use rustc::hir::def::Def;
+use rustc::hir::intravisit::FnKind;
 use rustc::ty;
+use rustc_target::spec::abi::Abi;
 use lint::{LateContext, LintContext, LintArray};
 use lint::{LintPass, LateLintPass};
-
-use rustc_target::spec::abi::Abi;
 use syntax::ast;
 use syntax::attr;
 use syntax_pos::Span;
 
-use rustc::hir::{self, GenericParamKind, PatKind};
-use rustc::hir::intravisit::FnKind;
-
 #[derive(PartialEq)]
 pub enum MethodLateContext {
     TraitAutoImpl,
index 1c48d84473921b79c98689c83b73b524e171688b..10f35e5598b2bb5f72650479f31aea1d8e61b922 100644 (file)
@@ -22,7 +22,7 @@
 // NOTE: This crate only exists to allow linking on mingw targets.
 
 /// Initialize targets enabled by the build script via `cfg(llvm_component = "...")`.
-/// NB: this function can't be moved to `rustc_codegen_llvm` because of the `cfg`s.
+/// N.B., this function can't be moved to `rustc_codegen_llvm` because of the `cfg`s.
 pub fn initialize_available_targets() {
     macro_rules! init_target(
         ($cfg:meta, $($method:ident),*) => { {
index 2be9883d03d9b76cd5b6150e5d32c83e5f4f732f..f650db5aafa01c2ade13f7fa3b6b108eba96c048 100644 (file)
@@ -56,7 +56,7 @@ pub struct CrateMetadata {
     /// Original name of the crate.
     pub name: Symbol,
 
-    /// Name of the crate as imported.  I.e. if imported with
+    /// Name of the crate as imported.  I.e., if imported with
     /// `extern crate foo as bar;` this will be `bar`.
     pub imported_name: Symbol,
 
index d0fa63a6163dbeb667d70afc69d8938b0c27cbec..da2ba392c5eb1f48283191b044bac7317cf24cb4 100644 (file)
@@ -307,7 +307,7 @@ pub fn provide<'tcx>(providers: &mut Providers<'tcx>) {
             Lrc::new(link_args::collect(tcx))
         },
 
-        // Returns a map from a sufficiently visible external item (i.e. an
+        // Returns a map from a sufficiently visible external item (i.e., an
         // external item that is visible from at least one local module) to a
         // sufficiently visible parent (considering modules that re-export the
         // external item to be parents).
index d4e51693d7edf818ecaa14291e3d2d810eeaf1fd..1f298f6d2d3a5502b5f2893bb0ec88c3d2789b65 100644 (file)
@@ -661,7 +661,7 @@ fn extract_one(&mut self,
             // Ok so at this point we've determined that `(lib, kind)` above is
             // a candidate crate to load, and that `slot` is either none (this
             // is the first crate of its kind) or if some the previous path has
-            // the exact same hash (e.g. it's the exact same crate).
+            // the exact same hash (e.g., it's the exact same crate).
             //
             // In principle these two candidate crates are exactly the same so
             // we can choose either of them to link. As a stupidly gross hack,
index fc3af6cf2e7320a248b9cb15211142bddf5f797f..1ae3f0a12bdd0ae912a66ab9b9087001eac722e1 100644 (file)
@@ -40,7 +40,7 @@ pub fn rustc_version() -> String {
 }
 
 /// Metadata encoding version.
-/// NB: increment this if you change the format of metadata such that
+/// N.B., increment this if you change the format of metadata such that
 /// the rustc version can't be found to compare with `rustc_version()`.
 pub const METADATA_VERSION: u8 = 4;
 
index b8d0c0b348ffae042e5c922ed85311f098108090..598c2f810beb76958c76a5ffe1180240e7cdd046 100644 (file)
@@ -1249,7 +1249,7 @@ pub(super) fn report_illegal_mutation_of_borrowed(
     /// (part of) a non-`mut` local that occurs potentially after that
     /// local has already been initialized. `place` is the path being
     /// assigned; `err_place` is a place providing a reason why
-    /// `place` is not mutable (e.g. the non-`mut` local `x` in an
+    /// `place` is not mutable (e.g., the non-`mut` local `x` in an
     /// assignment to `x.f`).
     pub(super) fn report_illegal_reassignment(
         &mut self,
index 14c366b76283231cc6ad9d5619269d0a5ab6a17c..e3029c6a19d499d057268af5c690546fcf731554 100644 (file)
@@ -1526,7 +1526,7 @@ fn check_if_full_path_is_moved(
               // ancestors; dataflow recurs on children when parents
               // move (to support partial (re)inits).
               //
-              // (I.e. querying parents breaks scenario 7; but may want
+              // (I.e., querying parents breaks scenario 7; but may want
               // to do such a query based on partial-init feature-gate.)
         }
     }
@@ -1562,7 +1562,7 @@ fn check_if_path_or_subpath_is_moved(
         //
         // (Distinct from handling of scenarios 1+2+4 above because
         // `place` does not interfere with suffixes of its prefixes,
-        // e.g. `a.b.c` does not interfere with `a.b.d`)
+        // e.g., `a.b.c` does not interfere with `a.b.d`)
         //
         // This code covers scenario 1.
 
@@ -1735,7 +1735,7 @@ fn check_parent_of_field<'cx, 'gcx, 'tcx>(
             //
             // This does not use check_if_path_or_subpath_is_moved,
             // because we want to *allow* reinitializations of fields:
-            // e.g. want to allow
+            // e.g., want to allow
             //
             // `let mut s = ...; drop(s.x); s.x=Val;`
             //
@@ -2166,7 +2166,7 @@ enum Overlap {
     /// `u.a.x` and `a.b.y` are.
     Arbitrary,
     /// The places have the same type, and are either completely disjoint
-    /// or equal - i.e. they can't "partially" overlap as can occur with
+    /// or equal - i.e., they can't "partially" overlap as can occur with
     /// unions. This is the "base case" on which we recur for extensions
     /// of the place.
     EqualOrDisjoint,
index 1811333e445b637443ff28327a9785beb6572186..db60017185a95319e45a5da3f351fa817eb100f2 100644 (file)
@@ -40,7 +40,7 @@
 #[derive(Debug)]
 enum GroupedMoveError<'tcx> {
     // Place expression can't be moved from,
-    // e.g. match x[0] { s => (), } where x: &[String]
+    // e.g., match x[0] { s => (), } where x: &[String]
     MovesFromPlace {
         original_path: Place<'tcx>,
         span: Span,
@@ -49,7 +49,7 @@ enum GroupedMoveError<'tcx> {
         binds_to: Vec<Local>,
     },
     // Part of a value expression can't be moved from,
-    // e.g. match &String::new() { &x => (), }
+    // e.g., match &String::new() { &x => (), }
     MovesFromValue {
         original_path: Place<'tcx>,
         span: Span,
index a873af8333a7fb0af867ae6423ed36645e4951d6..bfac33b34c7dccd942cfb3955494906002c9b983 100644 (file)
@@ -40,7 +40,7 @@ impl ConstraintSet {
     /// Constructs a "normal" graph from the constraint set; the graph makes it
     /// easy to find the constraints affecting a particular region.
     ///
-    /// NB: This graph contains a "frozen" view of the current
+    /// N.B., this graph contains a "frozen" view of the current
     /// constraints.  any new constraints added to the `ConstraintSet`
     /// after the graph is built will not be present in the graph.
     crate fn graph(&self, num_region_vars: usize) -> graph::NormalConstraintGraph {
index 5cd3d5fbc73a17d243a86e2fd795092f16665733..0c0504b7b316de94c7fac6a4889b758af9c00662 100644 (file)
@@ -95,7 +95,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
     /// Search the argument types for one that references fr (which should be a free region).
     /// Returns Some(_) with the index of the input if one is found.
     ///
-    /// NB: In the case of a closure, the index is indexing into the signature as seen by the
+    /// N.B., in the case of a closure, the index is indexing into the signature as seen by the
     /// user - in particular, index 0 is not the implicit self parameter.
     crate fn get_argument_index_for_region(
         &self,
index fbde699264b4a485a52c518e2a577abb5982c03a..cbd1e666284cf8aae61de6de2a98ddc41ab2fb9b 100644 (file)
@@ -119,7 +119,7 @@ struct RegionDefinition<'tcx> {
     external_name: Option<ty::Region<'tcx>>,
 }
 
-/// NB: The variants in `Cause` are intentionally ordered. Lower
+/// N.B., the variants in `Cause` are intentionally ordered. Lower
 /// values are preferred when it comes to error messages. Do not
 /// reorder willy nilly.
 #[derive(Copy, Clone, Debug, PartialOrd, Ord, PartialEq, Eq)]
@@ -657,7 +657,7 @@ fn check_type_tests<'gcx>(
                     .buffer(errors_buffer);
             } else {
                 // FIXME. We should handle this case better. It
-                // indicates that we have e.g. some region variable
+                // indicates that we have e.g., some region variable
                 // whose value is like `'a+'b` where `'a` and `'b` are
                 // distinct unrelated univesal regions that are not
                 // known to outlive one another. It'd be nice to have
index c7512f4b67f25a9de67464eded5038486b8d9d0f..4f5829f34069cd6e6783bb26a390c06a431d56f0 100644 (file)
@@ -313,7 +313,7 @@ impl<N: Idx> RegionValues<N> {
         self.points.insert_all_into_row(r);
     }
 
-    /// Add all elements in `r_from` to `r_to` (because e.g. `r_to:
+    /// Add all elements in `r_from` to `r_to` (because e.g., `r_to:
     /// r_from`).
     crate fn add_region(&mut self, r_to: N, r_from: N) -> bool {
         self.points.union_rows(r_from, r_to)
index 85ea39e538f785a6aee3b9969b4da7872d7bef1b..bb890e65b53e6a7ce7d414c589f03dd77073ea2a 100644 (file)
@@ -40,7 +40,7 @@ pub(super) fn equate_inputs_and_outputs(
         // If the user explicitly annotated the input types, extract
         // those.
         //
-        // e.g. `|x: FxHashMap<_, &'static u32>| ...`
+        // e.g., `|x: FxHashMap<_, &'static u32>| ...`
         let user_provided_sig;
         if !self.tcx().is_closure(self.mir_def_id) {
             user_provided_sig = None;
@@ -50,7 +50,7 @@ pub(super) fn equate_inputs_and_outputs(
                 None => None,
                 Some(user_provided_poly_sig) => {
                     // Instantiate the canonicalized variables from
-                    // user-provided signature (e.g. the `_` in the code
+                    // user-provided signature (e.g., the `_` in the code
                     // above) with fresh variables.
                     let (poly_sig, _) = self.infcx.instantiate_canonical_with_fresh_inference_vars(
                         mir.span,
index 4b39d58cd96a82e3c7479aa84429241bb63908f5..320422c9d332298166d9dd92a3d603ae905a2343 100644 (file)
@@ -23,7 +23,7 @@
     liveness_map: &'me NllLivenessMap,
 
     /// Head of a linked list of **definitions** of each variable --
-    /// definition in this context means assignment, e.g. `x` is
+    /// definition in this context means assignment, e.g., `x` is
     /// defined in `x = y` but not `y`; that first def is the head of
     /// a linked list that lets you enumerate all places the variable
     /// is assigned.
index 33346a584e5a47e6f659e93b370ccfa3b3644840..4807abe2bdd19c08dbedbb476ad9b884c2e3311c 100644 (file)
@@ -9,6 +9,7 @@
 // except according to those terms.
 
 //! This pass type-checks the MIR to ensure it is not broken.
+
 #![allow(unreachable_code)]
 
 use borrow_check::borrow_set::BorrowSet;
index 715d6e0c0d1b3685431039b4c0911dd7ee6a13c1..eeac915cff37eb79b6a33619917d96f057016454 100644 (file)
@@ -128,10 +128,10 @@ fn place_components_conflict<'gcx, 'tcx>(
                         //
                         // There is no *easy* way of comparing the fields
                         // further on, because they might have different types
-                        // (e.g. borrows of `u.a.0` and `u.b.y` where `.0` and
+                        // (e.g., borrows of `u.a.0` and `u.b.y` where `.0` and
                         // `.y` come from different structs).
                         //
-                        // We could try to do some things here - e.g. count
+                        // We could try to do some things here - e.g., count
                         // dereferences - but that's probably not a good
                         // idea, at least for now, so just give up and
                         // report a conflict. This is unsafe code anyway so
@@ -175,14 +175,14 @@ fn place_components_conflict<'gcx, 'tcx>(
                         // borrowed place (at least in MIR as it is
                         // currently.)
                         //
-                        // e.g. a (mutable) borrow of `a[5]` while we read the
+                        // e.g., a (mutable) borrow of `a[5]` while we read the
                         // array length of `a`.
                         debug!("borrow_conflicts_with_place: implicit field");
                         return false;
                     }
 
                     (ProjectionElem::Deref, _, Shallow(None)) => {
-                        // e.g. a borrow of `*x.y` while we shallowly access `x.y` or some
+                        // e.g., a borrow of `*x.y` while we shallowly access `x.y` or some
                         // prefix thereof - the shallow access can't touch anything behind
                         // the pointer.
                         debug!("borrow_conflicts_with_place: shallow access behind ptr");
@@ -216,7 +216,7 @@ fn place_components_conflict<'gcx, 'tcx>(
                     | (ProjectionElem::Downcast { .. }, _, _) => {
                         // Recursive case. This can still be disjoint on a
                         // further iteration if this a shallow access and
-                        // there's a deref later on, e.g. a borrow
+                        // there's a deref later on, e.g., a borrow
                         // of `*x.y` while accessing `x`.
                     }
                 }
@@ -251,7 +251,7 @@ fn place_components_conflict<'gcx, 'tcx>(
 /// the place `a` with a "next" pointer to `a.b`).  Created by
 /// `unroll_place`.
 ///
-/// NB: This particular impl strategy is not the most obvious.  It was
+/// N.B., this particular impl strategy is not the most obvious.  It was
 /// chosen because it makes a measurable difference to NLL
 /// performance, as this code (`borrow_conflicts_with_place`) is somewhat hot.
 struct PlaceComponents<'p, 'tcx: 'p> {
@@ -277,7 +277,7 @@ fn iter(&self) -> PlaceComponentsIter<'_, 'tcx> {
 /// Iterator over components; see `PlaceComponents::iter` for more
 /// information.
 ///
-/// NB: This is not a *true* Rust iterator -- the code above just
+/// N.B., this is not a *true* Rust iterator -- the code above just
 /// manually invokes `next`. This is because we (sometimes) want to
 /// keep executing even after `None` has been returned.
 struct PlaceComponentsIter<'p, 'tcx: 'p> {
@@ -384,13 +384,13 @@ fn place_element_conflict<'a, 'gcx: 'tcx, 'tcx>(
         (Place::Projection(pi1), Place::Projection(pi2)) => {
             match (&pi1.elem, &pi2.elem) {
                 (ProjectionElem::Deref, ProjectionElem::Deref) => {
-                    // derefs (e.g. `*x` vs. `*x`) - recur.
+                    // derefs (e.g., `*x` vs. `*x`) - recur.
                     debug!("place_element_conflict: DISJOINT-OR-EQ-DEREF");
                     Overlap::EqualOrDisjoint
                 }
                 (ProjectionElem::Field(f1, _), ProjectionElem::Field(f2, _)) => {
                     if f1 == f2 {
-                        // same field (e.g. `a.y` vs. `a.y`) - recur.
+                        // same field (e.g., `a.y` vs. `a.y`) - recur.
                         debug!("place_element_conflict: DISJOINT-OR-EQ-FIELD");
                         Overlap::EqualOrDisjoint
                     } else {
index 7d583b4f541915589e48cce72a029bc618bf58dc..b759e0416e566509554592cb896247a758300843 100644 (file)
@@ -91,7 +91,7 @@ fn next(&mut self) -> Option<Self::Item> {
 
         // Post-processing `place`: Enqueue any remaining
         // work. Also, `place` may not be a prefix itself, but
-        // may hold one further down (e.g. we never return
+        // may hold one further down (e.g., we never return
         // downcasts here, but may return a base of a downcast).
 
         'cursor: loop {
index 2ef71617b7cb615fd771ed42284d31f37b4f193e..4df8d66e2fb5d6e7966bf4231aa1961d2e9d3774 100644 (file)
@@ -117,7 +117,7 @@ fn ast_block_stmts(&mut self,
                     };
                     this.block_context.push(BlockFrame::Statement { ignores_expr_result });
 
-                    // Enter the remainder scope, i.e. the bindings' destruction scope.
+                    // Enter the remainder scope, i.e., the bindings' destruction scope.
                     this.push_scope((remainder_scope, source_info));
                     let_scope_stack.push(remainder_scope);
 
index 18ce7ae4907085b1d4eb1cd37db59710951dd4a4..a476165462a2fe906cbae884c168cafd9b917d0d 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-//! See docs in build/expr/mod.rs
+//! See docs in `build/expr/mod.rs`.
 
 use rustc_data_structures::fx::FxHashMap;
 use rustc_data_structures::indexed_vec::Idx;
index 8eb46a0483917c69551c03351cf2c5ee6c0d10f1..0e7305e076edeb3f39f3de319b5b8c3787aaa99d 100644 (file)
@@ -414,7 +414,7 @@ pub fn into_expr(
 
                     // must be handled above or else we get an
                     // infinite loop in the builder; see
-                    // e.g. `ExprKind::VarRef` above
+                    // e.g., `ExprKind::VarRef` above
                     Category::Place => false,
 
                     _ => true,
index 45235b31539345a4f4e14a73fa55a938524b45b2..0e9f81bbe95601b22657bb0c2a242c7b2e3fe121 100644 (file)
@@ -16,7 +16,7 @@
 impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
     /// Builds a block of MIR statements to evaluate the HAIR `expr`.
     /// If the original expression was an AST statement,
-    /// (e.g. `some().code(&here());`) then `opt_stmt_span` is the
+    /// (e.g., `some().code(&here());`) then `opt_stmt_span` is the
     /// span of that statement (including its semicolon, if any).
     /// Diagnostics use this span (which may be larger than that of
     /// `expr`) to identify when statement temporaries are dropped.
index 9c8d0b2aeb911e5621849b1fae7c53f6d5c31066..3e57c4acb4288d07d62b00e5a7ee6a282b96e6a4 100644 (file)
@@ -11,7 +11,7 @@
 //! In general, there are a number of things for which it's convenient
 //! to just call `builder.into` and have it emit its result into a
 //! given location. This is basically for expressions or things that can be
-//! wrapped up as expressions (e.g. blocks). To make this ergonomic, we use this
+//! wrapped up as expressions (e.g., blocks). To make this ergonomic, we use this
 //! latter `EvalInto` trait.
 
 use build::{BlockAnd, Builder};
index 243b702060a56b6a12df4f19a848da1b55f4edfb..7e7c0b15555f838fa292cf11089ea5ee238ce781 100644 (file)
@@ -111,7 +111,7 @@ pub fn match_expr(
         // pattern, which means there may be more than one candidate
         // *per arm*. These candidates are kept sorted such that the
         // highest priority candidate comes first in the list.
-        // (i.e. same order as in source)
+        // (i.e., same order as in source)
 
         let candidates: Vec<_> = arms.iter()
             .enumerate()
@@ -1384,7 +1384,7 @@ fn bind_matched_candidate_for_guard(
                     // Tricky business: For `ref id` and `ref mut id`
                     // patterns, we want `id` within the guard to
                     // correspond to a temp of type `& &T` or `& &mut
-                    // T` (i.e. a "borrow of a borrow") that is
+                    // T` (i.e., a "borrow of a borrow") that is
                     // implicitly dereferenced.
                     //
                     // To borrow a borrow, we need that inner borrow
index 9405f43c056b7a6e72352d89e47b192825c4456d..3ac7bd3fc68dc62f6894afb889cb256dfc664ab1 100644 (file)
@@ -22,7 +22,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
     /// Add a new temporary value of type `ty` storing the result of
     /// evaluating `expr`.
     ///
-    /// NB: **No cleanup is scheduled for this temporary.** You should
+    /// N.B., **No cleanup is scheduled for this temporary.** You should
     /// call `schedule_drop` once the temporary is initialized.
     pub fn temp(&mut self, ty: Ty<'tcx>, span: Span) -> Place<'tcx> {
         let temp = self.local_decls.push(LocalDecl::new_temp(ty, span));
index 7388d11ed6c508db9ff78d8a8ea0d3d5f1d6f069..8c948766314e8fb988a6db2d5dfe0e9fd145d5da 100644 (file)
@@ -152,7 +152,7 @@ struct DropData<'tcx> {
 pub(crate) struct CachedBlock {
     /// The cached block for the cleanups-on-diverge path. This block
     /// contains code to run the current drop and all the preceding
-    /// drops (i.e. those having lower index in Drop’s Scope drop
+    /// drops (i.e., those having lower index in Drop’s Scope drop
     /// array)
     unwind: Option<BasicBlock>,
 
@@ -182,7 +182,7 @@ pub struct BreakableScope<'tcx> {
     /// Block to branch into when the loop or block terminates (either by being `break`-en out
     /// from, or by having its condition to become false)
     pub break_block: BasicBlock,
-    /// The destination of the loop/block expression itself (i.e. where to put the result of a
+    /// The destination of the loop/block expression itself (i.e., where to put the result of a
     /// `break` expression)
     pub break_destination: Place<'tcx>,
 }
@@ -737,7 +737,7 @@ pub fn schedule_drop(
             //
             // Note that this code iterates scopes from the inner-most to the outer-most,
             // invalidating caches of each scope visited. This way bare minimum of the
-            // caches gets invalidated. i.e. if a new drop is added into the middle scope, the
+            // caches gets invalidated. i.e., if a new drop is added into the middle scope, the
             // cache of outer scpoe stays intact.
             scope.invalidate_cache(!needs_drop, this_scope);
             if this_scope {
index d815bfedc3713237ea72d6ae3102a50d940d4b1d..52eae5815287425f4f882ed0bbf99ee7bfeb929b 100644 (file)
@@ -67,7 +67,7 @@ pub trait FlowsAtLocation {
 /// effects at any point in the control-flow graph by starting with
 /// the state at the start of the basic block (`reset_to_entry_of`)
 /// and then replaying the effects of statements and terminators
-/// (e.g. via `reconstruct_statement_effect` and
+/// (e.g., via `reconstruct_statement_effect` and
 /// `reconstruct_terminator_effect`; don't forget to call
 /// `apply_local_effect`).
 pub struct FlowAtLocation<BD>
index 3a9e4fc9e4ab949126bc2bfca33e69866d61cc21..5e78ef03c2c6b4e7197699b8c478377f9322bf79 100644 (file)
@@ -267,7 +267,7 @@ fn statement_effect(&self, sets: &mut BlockSets<BorrowIndex>, location: Location
                         Place::Local(..) | Place::Static(..) => {} // okay
                         Place::Projection(..) => {
                             // ... can assign into projections,
-                            // e.g. `box (&mut _)`. Current
+                            // e.g., `box (&mut _)`. Current
                             // conservative solution: force
                             // immediate activation here.
                             sets.gen(*index);
index efdf9c3302374afb370534ea9e6e174eba8851ba..c29a855b1d2ebbc9041b1432443c2dde9b525d84 100644 (file)
@@ -488,7 +488,7 @@ fn statement_effect(&self,
                 //
                 // FIXME(#46525): We *need* to do this for StorageLive as well as
                 // StorageDead, because lifetimes of match bindings with guards are
-                // weird - i.e. this code
+                // weird - i.e., this code
                 //
                 // ```
                 //     fn main() {
index c19145636e6da101b7580299e3fee13c6c7eacb1..bd842669a1f9b4538c3b7ca8693c0c320efa78af 100644 (file)
@@ -290,7 +290,7 @@ fn post_dataflow_instrumentation<P>(&self, p: P) -> io::Result<()>
 /// It abstracts over the FlowState and also completely hides the
 /// underlying flow analysis results, because it needs to handle cases
 /// where we are combining the results of *multiple* flow analyses
-/// (e.g. borrows + inits + uninits).
+/// (e.g., borrows + inits + uninits).
 pub(crate) trait DataflowResultsConsumer<'a, 'tcx: 'a> {
     type FlowState: FlowsAtLocation;
 
@@ -553,7 +553,7 @@ pub fn kill_set_for(&self, block_idx: usize) -> &HybridBitSet<E> {
 /// Parameterization for the precise form of data flow that is used.
 /// `InitialFlow` handles initializing the bitvectors before any
 /// code is inspected by the analysis. Analyses that need more nuanced
-/// initialization (e.g. they need to consult the results of some other
+/// initialization (e.g., they need to consult the results of some other
 /// dataflow analysis to set up the initial bitvectors) should not
 /// implement this.
 pub trait InitialFlow {
@@ -592,7 +592,7 @@ fn accumulates_intrablock_state() -> bool { false }
 
     /// A name describing the dataflow analysis that this
     /// BitDenotation is supporting.  The name should be something
-    /// suitable for plugging in as part of a filename e.g. avoid
+    /// suitable for plugging in as part of a filename e.g., avoid
     /// space-characters or other things that tend to look bad on a
     /// file system, like slashes or periods. It is also better for
     /// the name to be reasonably short, again because it will be
@@ -739,7 +739,7 @@ impl<'a, 'tcx: 'a, D> DataflowAnalysis<'a, 'tcx, D> where D: BitDenotation
     /// To reflect this, the `propagate_call_return` method of the
     /// `BitDenotation` mutates `in_out` when propagating `in_out` via
     /// a call terminator; such mutation is performed *last*, to
-    /// ensure its side-effects do not leak elsewhere (e.g. into
+    /// ensure its side-effects do not leak elsewhere (e.g., into
     /// unwind target).
     fn propagate_bits_into_graph_successors_of(
         &mut self,
index 4d20857bc2ec80ebb70a1ead79ffa485dc99c6cb..186e5f5f5f0ad6d6e47cec940399e9cdfed9a64e 100644 (file)
@@ -10,7 +10,7 @@
 
 //! The move-analysis portion of borrowck needs to work in an abstract
 //! domain of lifted Places.  Most of the Place variants fall into a
-//! one-to-one mapping between the concrete and abstract (e.g. a
+//! one-to-one mapping between the concrete and abstract (e.g., a
 //! field-deref on a local-variable, `x.field`, has the same meaning
 //! in both domains). Indexed-Projections are the exception: `a[x]`
 //! needs to be treated as mapping to the same move path as `a[y]` as
index a772f44673035166aa47d0f090717117833983fe..a1471adac6050dcc92401d93a8c59b67438aa36a 100644 (file)
@@ -181,7 +181,7 @@ fn apply_adjustment<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>,
 
             // To ensure that both implicit and explicit coercions are
             // handled the same way, we insert an extra layer of indirection here.
-            // For explicit casts (e.g. 'foo as *const T'), the source of the 'Use'
+            // For explicit casts (e.g., 'foo as *const T'), the source of the 'Use'
             // will be an ExprKind::Hair with the appropriate cast expression. Here,
             // we make our Use source the generated Cast from the original coercion.
             //
@@ -1212,7 +1212,7 @@ fn capture_freevar<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>,
     }
 }
 
-/// Converts a list of named fields (i.e. for struct-like struct/enum ADTs) into FieldExprRef.
+/// Converts a list of named fields (i.e., for struct-like struct/enum ADTs) into FieldExprRef.
 fn field_refs<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>,
                               fields: &'tcx [hir::Field])
                               -> Vec<FieldExprRef<'tcx>> {
index 5db7b6ceb5db56f263f75af4b161fd2131130836..e80ef38a6170fb3a9fdcc7978cac09cf7a7c9b7f 100644 (file)
@@ -29,9 +29,9 @@
 ///
 /// If we have this predicate, then we can easily compute both exhaustiveness of an
 /// entire set of patterns and the individual usefulness of each one.
-/// (a) the set of patterns is exhaustive iff `U(P, _)` is false (i.e. adding a wildcard
+/// (a) the set of patterns is exhaustive iff `U(P, _)` is false (i.e., adding a wildcard
 /// match doesn't increase the number of values we're matching)
-/// (b) a pattern `p_i` is not useful if `U(P[0..=(i-1), p_i)` is false (i.e. adding a
+/// (b) a pattern `p_i` is not useful if `U(P[0..=(i-1), p_i)` is false (i.e., adding a
 /// pattern to those that have come before it doesn't increase the number of values
 /// we're matching).
 ///
 ///
 /// The algorithm for computing `U`
 /// -------------------------------
-/// The algorithm is inductive (on the number of columns: i.e. components of tuple patterns).
+/// The algorithm is inductive (on the number of columns: i.e., components of tuple patterns).
 /// That means we're going to check the components from left-to-right, so the algorithm
 /// operates principally on the first component of the matrix and new pattern `p_{m + 1}`.
 /// This algorithm is realised in the `is_useful` function.
 ///
-/// Base case. (`n = 0`, i.e. an empty tuple pattern)
-///     - If `P` already contains an empty pattern (i.e. if the number of patterns `m > 0`),
+/// Base case. (`n = 0`, i.e., an empty tuple pattern)
+///     - If `P` already contains an empty pattern (i.e., if the number of patterns `m > 0`),
 ///       then `U(P, p_{m + 1})` is false.
 ///     - Otherwise, `P` must be empty, so `U(P, p_{m + 1})` is true.
 ///
-/// Inductive step. (`n > 0`, i.e. whether there's at least one column
+/// Inductive step. (`n > 0`, i.e., whether there's at least one column
 ///                  [which may then be expanded into further columns later])
 ///     We're going to match on the new pattern, `p_{m + 1}`.
 ///         - If `p_{m + 1} == c(r_1, .., r_a)`, then we have a constructor pattern.
 ///             + All the constructors of the first component of the type exist within
 ///               all the rows (after having expanded OR-patterns). In this case:
 ///               `U(P, p_{m + 1}) := ∨(k ϵ constructors) U(S(k, P), S(k, p_{m + 1}))`
-///               I.e. the pattern `p_{m + 1}` is only useful when all the constructors are
+///               I.e., the pattern `p_{m + 1}` is only useful when all the constructors are
 ///               present *if* its later components are useful for the respective constructors
 ///               covered by `p_{m + 1}` (usually a single constructor, but all in the case of `_`).
 ///             + Some constructors are not present in the existing rows (after having expanded
 /// - When we're testing for usefulness of a pattern and the pattern's first component is a
 ///   wildcard.
 ///     + If all the constructors appear in the matrix, we have a slight complication. By default,
-///       the behaviour (i.e. a disjunction over specialised matrices for each constructor) is
+///       the behaviour (i.e., a disjunction over specialised matrices for each constructor) is
 ///       invalid, because we want a disjunction over every *integer* in each range, not just a
 ///       disjunction over every range. This is a bit more tricky to deal with: essentially we need
 ///       to form equivalence classes of subranges of the constructor range for which the behaviour
 ///       of the matrix `P` and new pattern `p_{m + 1}` are the same. This is described in more
 ///       detail in `split_grouped_constructors`.
 ///     + If some constructors are missing from the matrix, it turns out we don't need to do
-///       anything special (because we know none of the integers are actually wildcards: i.e. we
+///       anything special (because we know none of the integers are actually wildcards: i.e., we
 ///       can't span wildcards using ranges).
 
 use self::Constructor::*;
@@ -371,7 +371,7 @@ fn is_variant_uninhabited(&self,
 #[derive(Clone, Debug, PartialEq)]
 pub enum Constructor<'tcx> {
     /// The constructor of all patterns that don't vary by constructor,
-    /// e.g. struct patterns and fixed-length arrays.
+    /// e.g., struct patterns and fixed-length arrays.
     Single,
     /// Enum variants.
     Variant(DefId),
@@ -488,7 +488,7 @@ fn push_wild_constructor<'a>(
     /// patterns expanded by the specialization step.
     ///
     /// When a pattern P is discovered to be useful, this function is used bottom-up
-    /// to reconstruct a complete witness, e.g. a pattern P' that covers a subset
+    /// to reconstruct a complete witness, e.g., a pattern P' that covers a subset
     /// of values, V, where each value in that set is not covered by any previously
     /// used patterns and is covered by the pattern P'. Examples:
     ///
@@ -763,7 +763,7 @@ fn max_slice_length<'p, 'a: 'p, 'tcx: 'a, I>(
 /// straightforward. See `signed_bias` for details.
 ///
 /// `IntRange` is never used to encode an empty range or a "range" that wraps
-/// around the (offset) space: i.e. `range.lo <= range.hi`.
+/// around the (offset) space: i.e., `range.lo <= range.hi`.
 #[derive(Clone)]
 struct IntRange<'tcx> {
     pub range: RangeInclusive<u128>,
@@ -854,7 +854,7 @@ fn range_to_ctor(
     }
 
     /// Return a collection of ranges that spans the values covered by `ranges`, subtracted
-    /// by the values covered by `self`: i.e. `ranges \ self` (in set notation).
+    /// by the values covered by `self`: i.e., `ranges \ self` (in set notation).
     fn subtract_from(self,
                      tcx: TyCtxt<'_, 'tcx, 'tcx>,
                      ranges: Vec<Constructor<'tcx>>)
@@ -1122,7 +1122,7 @@ pub fn is_useful<'p, 'a: 'p, 'tcx: 'a>(cx: &mut MatchCheckCtxt<'a, 'tcx>,
                     //
                     // There are 2 ways we can report a witness here.
                     // Commonly, we can report all the "free"
-                    // constructors as witnesses, e.g. if we have:
+                    // constructors as witnesses, e.g., if we have:
                     //
                     // ```
                     //     enum Direction { N, S, E, W }
@@ -1137,7 +1137,7 @@ pub fn is_useful<'p, 'a: 'p, 'tcx: 'a>(cx: &mut MatchCheckCtxt<'a, 'tcx>,
                     // 1) If the user is matching against a non-exhaustive
                     // enum, there is no point in enumerating all possible
                     // variants, because the user can't actually match
-                    // against them himself, e.g. in an example like:
+                    // against them himself, e.g., in an example like:
                     // ```
                     //     let err: io::ErrorKind = ...;
                     //     match err {
@@ -1151,7 +1151,7 @@ pub fn is_useful<'p, 'a: 'p, 'tcx: 'a>(cx: &mut MatchCheckCtxt<'a, 'tcx>,
                     // case).
                     //
                     // 2) If the user didn't actually specify a constructor
-                    // in this arm, e.g. in
+                    // in this arm, e.g., in
                     // ```
                     //     let x: (Direction, Direction, bool) = ...;
                     //     let (_, _, false) = x;
@@ -1197,7 +1197,7 @@ pub fn is_useful<'p, 'a: 'p, 'tcx: 'a>(cx: &mut MatchCheckCtxt<'a, 'tcx>,
     }
 }
 
-/// A shorthand for the `U(S(c, P), S(c, q))` operation from the paper. I.e. `is_useful` applied
+/// A shorthand for the `U(S(c, P), S(c, q))` operation from the paper. I.e., `is_useful` applied
 /// to the specialised version of both the pattern matrix `P` and the new pattern `q`.
 fn is_useful_specialized<'p, 'a:'p, 'tcx: 'a>(
     cx: &mut MatchCheckCtxt<'a, 'tcx>,
@@ -1413,7 +1413,7 @@ fn should_treat_range_exhaustively(tcx: TyCtxt<'_, 'tcx, 'tcx>, ctor: &Construct
 /// the groups (the ranges). Thus we need to split the groups up. Splitting them up naïvely would
 /// mean creating a separate constructor for every single value in the range, which is clearly
 /// impractical. However, observe that for some ranges of integers, the specialisation will be
-/// identical across all values in that range (i.e. there are equivalence classes of ranges of
+/// identical across all values in that range (i.e., there are equivalence classes of ranges of
 /// constructors based on their `is_useful_specialized` outcome). These classes are grouped by
 /// the patterns that apply to them (in the matrix `P`). We can split the range whenever the
 /// patterns that apply to that range (specifically: the patterns that *intersect* with that range)
@@ -1422,7 +1422,7 @@ fn should_treat_range_exhaustively(tcx: TyCtxt<'_, 'tcx, 'tcx>, ctor: &Construct
 /// the group of intersecting patterns changes (using the method described below).
 /// And voilà! We're testing precisely those ranges that we need to, without any exhaustive matching
 /// on actual integers. The nice thing about this is that the number of subranges is linear in the
-/// number of rows in the matrix (i.e. the number of cases in the `match` statement), so we don't
+/// number of rows in the matrix (i.e., the number of cases in the `match` statement), so we don't
 /// need to be worried about matching over gargantuan ranges.
 ///
 /// Essentially, given the first column of a matrix representing ranges, looking like the following:
index 4d38d207c478664985f9e4f71b81ca9c5172e455..9fb3a09e3c11e91de327febcff6a37a07ddcbf5e 100644 (file)
@@ -188,7 +188,7 @@ fn check_match(
 
             // Third, perform some lints.
             for pat in &arm.pats {
-                check_for_bindings_named_the_same_as_variants(self, pat);
+                check_for_bindings_named_same_as_variants(self, pat);
             }
         }
 
@@ -309,7 +309,7 @@ fn check_irrefutable(&self, pat: &'tcx Pat, origin: &str) {
     }
 }
 
-fn check_for_bindings_named_the_same_as_variants(cx: &MatchVisitor, pat: &Pat) {
+fn check_for_bindings_named_same_as_variants(cx: &MatchVisitor, pat: &Pat) {
     pat.walk(|p| {
         if let PatKind::Binding(_, _, ident, None) = p.node {
             if let Some(&bm) = cx.tables.pat_binding_modes().get(p.hir_id) {
index 5d2f7ec507b7a31e4546530c3e84101107e58b99..d695a64f62a08e1e2a1a1a211996e5807529cb5f 100644 (file)
@@ -228,7 +228,7 @@ pub enum PatternKind<'tcx> {
 
     /// 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..]`.
+    /// e.g., `&[ref xs..]`.
     Slice {
         prefix: Vec<Pattern<'tcx>>,
         slice: Option<Pattern<'tcx>>,
index f43cfb90fc4a1cf69bb6e24c1b2035419321db74..4c7aa887045c718ef2b2c899e4fc27090ab9fc20 100644 (file)
@@ -81,7 +81,7 @@ pub trait Machine<'a, 'mir, 'tcx>: Sized {
     type FrameExtra;
 
     /// Extra data stored in memory.  A reference to this is available when `AllocExtra`
-    /// gets initialized, so you can e.g. have an `Rc` here if there is global state you
+    /// gets initialized, so you can e.g., have an `Rc` here if there is global state you
     /// need access to in the `AllocExtra` hooks.
     type MemoryExtra: Default;
 
index 97d7e1586b811354abed733e7fc43497180e0395..e32abb92e21157e2fdcf02dfc06c73274870ce87 100644 (file)
@@ -55,7 +55,7 @@ fn may_leak(self) -> bool {
 }
 
 // `Memory` has to depend on the `Machine` because some of its operations
-// (e.g. `get`) call a `Machine` hook.
+// (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
     /// helps ensure that the same mechanism is used for allocation and
index 164a9680c797562e778b41b570d0fbeac8610680..bae670bf2b4b3b1b7e6dc6cc67a55b061430d32b 100644 (file)
@@ -35,7 +35,7 @@ pub struct MemPlace<Tag=(), Id=AllocId> {
     pub align: Align,
     /// 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`).
+    /// (e.g., `extern type`).
     pub meta: Option<Scalar<Tag, Id>>,
 }
 
@@ -236,7 +236,7 @@ pub(super) fn len(self, cx: &impl HasDataLayout) -> EvalResult<'tcx, u64> {
             }
         } else {
             // Go through the layout.  There are lots of types that support a length,
-            // e.g. SIMD types.
+            // e.g., SIMD types.
             match self.layout.fields {
                 layout::FieldPlacement::Array { count, .. } => Ok(count),
                 _ => bug!("len not supported on sized type {:?}", self.layout.ty),
@@ -908,7 +908,7 @@ pub fn force_allocation(
                         // a fake pointer?  Are we even called for ZST?
 
                         // 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 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)?;
                         let ptr = self.allocate(local_layout, MemoryKind::Stack)?;
index 84cc5127f38adb90a3985863f2bd66312597cece..a6835e4f167380ed0cb5c525675cfb2b768cfafc 100644 (file)
@@ -18,7 +18,7 @@
 
 use super::{EvalContext, Machine};
 
-/// Classify whether an operator is "left-homogeneous", i.e. the LHS has the
+/// Classify whether an operator is "left-homogeneous", i.e., the LHS has the
 /// same type as the result.
 #[inline]
 fn binop_left_homogeneous(op: mir::BinOp) -> bool {
@@ -31,7 +31,7 @@ fn binop_left_homogeneous(op: mir::BinOp) -> bool {
             false,
     }
 }
-/// Classify whether an operator is "right-homogeneous", i.e. the RHS has the
+/// Classify whether an operator is "right-homogeneous", i.e., the RHS has the
 /// same type as the LHS.
 #[inline]
 fn binop_right_homogeneous(op: mir::BinOp) -> bool {
@@ -85,7 +85,7 @@ fn statement(&mut self, stmt: &mir::Statement<'tcx>) -> EvalResult<'tcx> {
 
         use rustc::mir::StatementKind::*;
 
-        // Some statements (e.g. box) push new stack frames.
+        // Some statements (e.g., box) push new stack frames.
         // We have to record the stack frame number *before* executing the statement.
         let frame_idx = self.cur_frame();
         self.tcx.span = stmt.source_info.span;
index 300f3d639b5883dd192a6e3bd8fd139308c02130..4a672f195d240cfbf8db53839bf33b68716b707f 100644 (file)
@@ -252,7 +252,7 @@ fn eval_fn_call(
                     return err!(FunctionAbiMismatch(caller_abi, Abi::RustIntrinsic));
                 }
                 // The intrinsic itself cannot diverge, so if we got here without a return
-                // place... (can happen e.g. for transmute returning `!`)
+                // place... (can happen e.g., for transmute returning `!`)
                 let dest = match dest {
                     Some(dest) => dest,
                     None => return err!(Unreachable)
index d98d05bc01b8504905e74987db362b474da3e87d..4f1737354ca62e39da39bdc31465ea1403b753c1 100644 (file)
@@ -408,7 +408,7 @@ fn visit_primitive(&mut self, value: OpTy<'tcx, M::PointerTag>) -> EvalResult<'t
                     // Check if we have encountered this pointer+layout combination
                     // 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).
+                    // but not for others (e.g., `!` is a ZST).
                     let op = place.into();
                     if ref_tracking.seen.insert(op) {
                         trace!("Recursing below ptr {:#?}", *op);
@@ -548,7 +548,7 @@ fn visit_aggregate(
                 // 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
-                // permissive than a per-element check would be, e.g. we accept
+                // 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
                 // to reject those pointers, we just do not have the machinery to
index 81e56f3115d26cfd8aa1b39ef4d88d36e45c7839..4773f5627d716db0238f6b3d9ac616b20d8eb140 100644 (file)
@@ -272,7 +272,7 @@ fn walk_value(&mut self, v: Self::V) -> EvalResult<'tcx>
                 // 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
-                // scalars, we do the same check on every "level" (e.g. first we check
+                // 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 {
                     layout::Abi::Uninhabited => {
index 232468fefe201fce051957bd9c48e7eb5a6e111e..775431e5cbd6bc2902eae5ee17fda11202b989a3 100644 (file)
@@ -39,11 +39,11 @@ fn check_fn_for_unconditional_recursion(tcx: TyCtxt<'a, 'tcx, 'tcx>,
     //FIXME(#54444) rewrite this lint to use the dataflow framework
 
     // Walk through this function (say `f`) looking to see if
-    // every possible path references itself, i.e. the function is
+    // every possible path references itself, i.e., the function is
     // called recursively unconditionally. This is done by trying
     // to find a path from the entry node to the exit node that
     // *doesn't* call `f` by traversing from the entry while
-    // pretending that calls of `f` are sinks (i.e. ignoring any
+    // 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,
@@ -62,7 +62,7 @@ fn check_fn_for_unconditional_recursion(tcx: TyCtxt<'a, 'tcx, 'tcx>,
     // considers this to be an error for two reasons, (a) it is
     // easier to implement, and (b) it seems rare to actually want
     // to have behaviour like the above, rather than
-    // e.g. accidentally recursing after an assert.
+    // e.g., accidentally recursing after an assert.
 
     let basic_blocks = mir.basic_blocks();
     let mut reachable_without_self_call_queue = vec![mir::START_BLOCK];
@@ -135,7 +135,7 @@ fn check_fn_for_unconditional_recursion(tcx: TyCtxt<'a, 'tcx, 'tcx>,
     }
 
     // Check the number of self calls because a function that
-    // doesn't return (e.g. calls a `-> !` function or `loop { /*
+    // doesn't return (e.g., calls a `-> !` function or `loop { /*
     // no break */ }`) shouldn't be linted unless it actually
     // recurs.
     if !reached_exit_without_self_call && !self_call_locations.is_empty() {
index 7890b926948c22b779eea88be3720b4e07a1b553..c962a2416f554f24c7fb4e19e907aa76baeb0810 100644 (file)
@@ -821,7 +821,7 @@ fn is_available_upstream_generic<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
 /// Again, we want this `find_vtable_types_for_unsizing()` to provide the pair
 /// `(SomeStruct, SomeTrait)`.
 ///
-/// Finally, there is also the case of custom unsizing coercions, e.g. for
+/// Finally, there is also the case of custom unsizing coercions, e.g., for
 /// smart pointers such as `Rc` and `Arc`.
 fn find_vtable_types_for_unsizing<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
                                             source_ty: Ty<'tcx>,
index efe6f6dd6fefac9eb68a56c547c6d762580f6550..00974d4a5b250977cc9b9f278528f7739a5a0a85 100644 (file)
@@ -51,7 +51,7 @@
 //!
 //! - There are two codegen units for every source-level module:
 //! - One for "stable", that is non-generic, code
-//! - One for more "volatile" code, i.e. monomorphized instances of functions
+//! - One for more "volatile" code, i.e., monomorphized instances of functions
 //!   defined in that module
 //!
 //! In order to see why this heuristic makes sense, let's take a look at when a
index 660892c0a5f889aee832c1347e475ee498b46952..6af29b74c1c4fab1e535a8b8ee492e47202b66ad 100644 (file)
@@ -497,7 +497,7 @@ fn unsafety_check_result<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId)
 {
     debug!("unsafety_violations({:?})", def_id);
 
-    // NB: this borrow is valid because all the consumers of
+    // N.B., this borrow is valid because all the consumers of
     // `mir_built` force this.
     let mir = &tcx.mir_built(def_id).borrow();
 
index 5e00dea5a0562b625c4c2765f9127fae8320e3f7..acae03f7f94f5ca05ad6046ddba442fd7faeccb5 100644 (file)
@@ -289,7 +289,7 @@ fn eval_place(&mut self, place: &Place<'tcx>, source_info: SourceInfo) -> Option
                     })?;
                     Some((res, span))
                 },
-                // We could get more projections by using e.g. `operand_projection`,
+                // We could get more projections by using e.g., `operand_projection`,
                 // but we do not even have the stack frame set up properly so
                 // an `Index` projection would throw us off-track.
                 _ => None,
index 0348ea5b81976645b30256cf0a6cdc1b8a91e902..afe0066df1f28dbc6e2ca85bd4d2849c480fbf4d 100644 (file)
@@ -575,10 +575,10 @@ fn make_call_args(
             // The `tmp0`, `tmp1`, and `tmp2` in our example abonve.
             let tuple_tmp_args =
                 tuple_tys.iter().enumerate().map(|(i, ty)| {
-                    // This is e.g. `tuple_tmp.0` in our example above.
+                    // This is e.g., `tuple_tmp.0` in our example above.
                     let tuple_field = Operand::Move(tuple.clone().field(Field::new(i), ty));
 
-                    // Spill to a local to make e.g. `tmp0`.
+                    // Spill to a local to make e.g., `tmp0`.
                     self.create_temp_if_necessary(tuple_field, callsite, caller_mir)
                 });
 
index c5add6260789a34e485f5852b45695cc3d093374..7f8dfc111a4bde777ed23af81866d7a21ea859b3 100644 (file)
@@ -123,7 +123,7 @@ fn visit_local(&mut self,
             }
         } else if let TempState::Defined { ref mut uses, .. } = *temp {
             // We always allow borrows, even mutable ones, as we need
-            // to promote mutable borrows of some ZSTs e.g. `&mut []`.
+            // to promote mutable borrows of some ZSTs e.g., `&mut []`.
             let allowed_use = context.is_borrow() || context.is_nonmutating_use();
             debug!("visit_local: allowed_use={:?}", allowed_use);
             if allowed_use {
index 034096fe889a3c11116cc1278f6bf711cea43c5d..5f08dee87285928dc6d7361a9b7d681a741792ba 100644 (file)
@@ -17,6 +17,8 @@
 use rustc_data_structures::bit_set::BitSet;
 use rustc_data_structures::indexed_vec::IndexVec;
 use rustc_data_structures::fx::FxHashSet;
+use rustc_data_structures::sync::Lrc;
+use rustc_target::spec::abi::Abi;
 use rustc::hir;
 use rustc::hir::def_id::DefId;
 use rustc::mir::interpret::ConstValue;
 use rustc::mir::traversal::ReversePostorder;
 use rustc::mir::visit::{PlaceContext, Visitor, MutatingUseContext, NonMutatingUseContext};
 use rustc::middle::lang_items;
-use rustc_target::spec::abi::Abi;
+use rustc::session::config::nightly_options;
 use syntax::ast::LitKind;
 use syntax::feature_gate::{UnstableFeatures, feature_err, emit_feature_err, GateIssue};
 use syntax_pos::{Span, DUMMY_SP};
 
 use std::fmt;
-use rustc_data_structures::sync::Lrc;
 use std::usize;
 
 use transform::{MirPass, MirSource};
@@ -639,7 +640,7 @@ fn visit_operand(&mut self, operand: &Operand<'tcx>, location: Location) {
                         self.add(qualif);
 
                         // Just in case the type is more specific than
-                        // the definition, e.g. impl associated const
+                        // the definition, e.g., impl associated const
                         // with type parameters, take it into account.
                         self.qualif.restrict(constant.literal.ty, self.tcx, self.param_env);
                     }
@@ -952,10 +953,10 @@ fn visit_terminator_kind(&mut self,
                             }
                         }
                         _ => {
-                            // in normal functions we only care about promotion
+                            // In normal functions we only care about promotion.
                             if self.mode == Mode::Fn {
-                                // never promote const fn calls of
-                                // functions without #[rustc_promotable]
+                                // Never promote const fn calls of
+                                // functions without `#[rustc_promotable]`.
                                 if self.tcx.is_promotable_const_fn(def_id) {
                                     is_const_fn = true;
                                     is_promotable_const_fn = true;
@@ -963,19 +964,19 @@ fn visit_terminator_kind(&mut self,
                                     is_const_fn = true;
                                 }
                             } else {
-                                // stable const fn or unstable const fns with their feature gate
+                                // stable const fns or unstable const fns with their feature gate
                                 // active
                                 if self.tcx.is_const_fn(def_id) {
                                     is_const_fn = true;
                                 } else if self.is_const_panic_fn(def_id) {
-                                    // check the const_panic feature gate
+                                    // Check the const_panic feature gate.
                                     // FIXME: cannot allow this inside `allow_internal_unstable`
                                     // because that would make `panic!` insta stable in constants,
-                                    // since the macro is marked with the attr
+                                    // since the macro is marked with the attribute.
                                     if self.tcx.features().const_panic {
                                         is_const_fn = true;
                                     } else {
-                                        // don't allow panics in constants without the feature gate
+                                        // Don't allow panics in constants without the feature gate.
                                         emit_feature_err(
                                             &self.tcx.sess.parse_sess,
                                             "const_panic",
@@ -984,25 +985,28 @@ fn visit_terminator_kind(&mut self,
                                             &format!("panicking in {}s is unstable", self.mode),
                                         );
                                     }
-                                } else if let Some(feat) = self.tcx.is_unstable_const_fn(def_id) {
-                                    // check `#[unstable]` const fns or `#[rustc_const_unstable]`
-                                    // functions without the feature gate active in this crate to
-                                    // report a better error message than the one below
+                                } else if let Some(feature)
+                                              = self.tcx.is_unstable_const_fn(def_id) {
+                                    // Check `#[unstable]` const fns or `#[rustc_const_unstable]`
+                                    // functions without the feature gate active in this crate in
+                                    // order to report a better error message than the one below.
                                     if self.span.allows_unstable() {
-                                        // `allow_internal_unstable` can make such calls stable
+                                        // `allow_internal_unstable` can make such calls stable.
                                         is_const_fn = true;
                                     } else {
                                         let mut err = self.tcx.sess.struct_span_err(self.span,
                                             &format!("`{}` is not yet stable as a const fn",
                                                     self.tcx.item_path_str(def_id)));
-                                        help!(&mut err,
-                                            "in Nightly builds, add `#![feature({})]` \
-                                            to the crate attributes to enable",
-                                            feat);
+                                        if nightly_options::is_nightly_build() {
+                                            help!(&mut err,
+                                                  "add `#![feature({})]` to the \
+                                                   crate attributes to enable",
+                                                  feature);
+                                        }
                                         err.emit();
                                     }
                                 } else {
-                                    // FIXME(#24111) Remove this check when const fn stabilizes
+                                    // FIXME(#24111): remove this check when const fn stabilizes.
                                     let (msg, note) = if let UnstableFeatures::Disallow =
                                             self.tcx.sess.opts.unstable_features {
                                         (format!("calls in {}s are limited to \
@@ -1081,7 +1085,7 @@ fn visit_terminator_kind(&mut self,
                     // we care about constness, not promotability.
                     // If we checked for promotability, we'd miss out on
                     // the results of function calls (which are never promoted
-                    // in runtime code)
+                    // in runtime code).
                     // This is not a problem, because the argument explicitly
                     // requests constness, in contrast to regular promotion
                     // which happens even without the user requesting it.
@@ -1098,7 +1102,7 @@ fn visit_terminator_kind(&mut self,
                 });
             }
 
-            // non-const fn calls.
+            // non-const fn calls
             if !is_const_fn {
                 self.qualif = Qualif::NOT_CONST;
                 if self.mode != Mode::Fn {
@@ -1131,7 +1135,7 @@ fn visit_terminator_kind(&mut self,
 
             // Deny *any* live drops anywhere other than functions.
             if self.mode != Mode::Fn {
-                // HACK(eddyb) Emulate a bit of dataflow analysis,
+                // HACK(eddyb): emulate a bit of dataflow analysis,
                 // conservatively, that drop elaboration will do.
                 let needs_drop = if let Place::Local(local) = *place {
                     if self.local_qualif[local].map_or(true, |q| q.contains(Qualif::NEEDS_DROP)) {
@@ -1259,7 +1263,7 @@ pub fn provide(providers: &mut Providers) {
 fn mir_const_qualif<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
                               def_id: DefId)
                               -> (u8, Lrc<BitSet<Local>>) {
-    // NB: This `borrow()` is guaranteed to be valid (i.e., the value
+    // N.B., this `borrow()` is guaranteed to be valid (i.e., the value
     // cannot yet be stolen), because `mir_validated()`, which steals
     // from `mir_const(), forces this query to execute before
     // performing the steal.
index a31d12baed2b468cf8547d3cc564832946339ba7..81b010e7dcec9ba8f7bad43a4bd95ad102cf351d 100644 (file)
@@ -58,7 +58,7 @@ fn is_nop_landing_pad(
                 }
 
                 StatementKind::Assign(Place::Local(_), box Rvalue::Use(_)) => {
-                    // Writing to a local (e.g. a drop flag) does not
+                    // Writing to a local (e.g., a drop flag) does not
                     // turn a landing pad to a non-nop
                 }
 
index 2c7f337b3b1c0a677595feb39f60ee73db5d5df6..4f381e0a3d23e2eb3c3674959b9c5c81ecf7cbde 100644 (file)
@@ -24,8 +24,8 @@
 
 #[derive(Debug, PartialEq, Eq, Copy, Clone)]
 pub enum DropFlagState {
-    Present, // i.e. initialized
-    Absent, // i.e. deinitialized or "moved"
+    Present, // i.e., initialized
+    Absent, // i.e., deinitialized or "moved"
 }
 
 impl DropFlagState {
index 22cc8ead478a92d0b6d74385df5e730df7782816..22554acc6adaad0486acfd32471f518fc09d4cbf 100644 (file)
@@ -29,7 +29,7 @@
 //! ```
 //!
 //! This means that users of this analysis still have to check whether
-//! pre-existing references can be used to access the value (e.g. at movable
+//! pre-existing references can be used to access the value (e.g., at movable
 //! generator yield points, all pre-existing references are invalidated, so this
 //! doesn't matter).
 
index b878a330ab6490b562e54d0eeae0d97c731176dd..9a35721e3e1c4a6dca9178da02d2c68236dd7dc5 100644 (file)
@@ -404,7 +404,7 @@ fn visit_item(&mut self, item: &'a Item) {
                 }
             }
             ItemKind::Mod(_) => {
-                // Ensure that `path` attributes on modules are recorded as used (c.f. #35584).
+                // Ensure that `path` attributes on modules are recorded as used (cf. issue #35584).
                 attr::first_attr_value_str_by_name(&item.attrs, "path");
                 if attr::contains_name(&item.attrs, "warn_directory_ownership") {
                     let lint = lint::builtin::LEGACY_DIRECTORY_OWNERSHIP;
@@ -529,7 +529,7 @@ fn visit_mac(&mut self, mac: &Spanned<Mac_>) {
     }
 }
 
-// Bans nested `impl Trait`, e.g. `impl Into<impl Debug>`.
+// Bans nested `impl Trait`, e.g., `impl Into<impl Debug>`.
 // Nested `impl Trait` _is_ allowed in associated type position,
 // e.g `impl Iterator<Item=impl Debug>`
 struct NestedImplTraitVisitor<'a> {
index b41a04e354d27fbc3dc8b669306b1f2f8b7cda66..bfe8b677a5e806803ac8072533ab0cda0cc29910 100644 (file)
@@ -383,7 +383,7 @@ fn check_expr_kind<'a, 'tcx>(
                         NotPromotable
                     };
                     // Just in case the type is more specific than the definition,
-                    // e.g. impl associated const with type parameters, check it.
+                    // e.g., impl associated const with type parameters, check it.
                     // Also, trait associated consts are relaxed by this.
                     promotable | v.type_promotability(node_ty)
                 }
index bf59165a9c4614f010e9ca359f3c9bc59d7dc079..ad55672fb47de7d8a3699f74e5dc436342a15c28 100644 (file)
@@ -144,7 +144,7 @@ fn dylink_registrar(&mut self,
 
             // Intentionally leak the dynamic library. We can't ever unload it
             // since the library can make things that will live arbitrarily long
-            // (e.g. an @-box cycle or a thread).
+            // (e.g., an @-box cycle or a thread).
             mem::forget(lib);
 
             registrar
index ccdcfe322b1c246c8c752b9f5dd078cf31285fe8..86e3b231fc7ff3803d53308b263efcb5b19ad625 100644 (file)
@@ -23,8 +23,7 @@
 extern crate syntax_pos;
 extern crate rustc_data_structures;
 
-use rustc::hir::{self, PatKind};
-use hir::Node;
+use rustc::hir::{self, Node, PatKind};
 use rustc::hir::def::Def;
 use rustc::hir::def_id::{CRATE_DEF_INDEX, LOCAL_CRATE, CrateNum, DefId};
 use rustc::hir::intravisit::{self, Visitor, NestedVisitorMap};
 use rustc::ty::query::Providers;
 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::symbol::keywords;
 use syntax_pos::Span;
 
 use std::cmp;
 use std::mem::replace;
-use rustc_data_structures::fx::FxHashSet;
-use rustc_data_structures::sync::Lrc;
 
 mod diagnostics;
 
@@ -74,11 +73,11 @@ fn visit_vis(&mut self, vis: &'tcx hir::Visibility) {
 struct EmbargoVisitor<'a, 'tcx: 'a> {
     tcx: TyCtxt<'a, 'tcx, 'tcx>,
 
-    // Accessibility levels for reachable nodes
+    // Accessibility levels for reachable nodes.
     access_levels: AccessLevels,
-    // Previous accessibility level, None means unreachable
+    // Previous accessibility level; `None` means unreachable.
     prev_level: Option<AccessLevel>,
-    // Have something changed in the level map?
+    // Has something changed in the level map?
     changed: bool,
 }
 
@@ -117,10 +116,10 @@ fn get(&self, id: ast::NodeId) -> Option<AccessLevel> {
         self.access_levels.map.get(&id).cloned()
     }
 
-    // Updates node level and returns the updated level
+    // Updates node level and returns the updated level.
     fn update(&mut self, id: ast::NodeId, level: Option<AccessLevel>) -> Option<AccessLevel> {
         let old_level = self.get(id);
-        // Accessibility levels can only grow
+        // Accessibility levels can only grow.
         if level > old_level {
             self.access_levels.map.insert(id, level.unwrap());
             self.changed = true;
@@ -149,16 +148,16 @@ fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
 
     fn visit_item(&mut self, item: &'tcx hir::Item) {
         let inherited_item_level = match item.node {
-            // Impls inherit level from their types and traits
+            // 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 mods inherit level from parents
+            // Foreign modules inherit level from parents.
             hir::ItemKind::ForeignMod(..) => {
                 self.prev_level
             }
-            // Other `pub` items inherit levels from parents
+            // 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(..) |
             hir::ItemKind::Static(..) | hir::ItemKind::Struct(..) |
@@ -169,10 +168,10 @@ fn visit_item(&mut self, item: &'tcx hir::Item) {
             }
         };
 
-        // Update level of the item itself
+        // Update level of the item itself.
         let item_level = self.update(item.id, inherited_item_level);
 
-        // Update levels of nested things
+        // Update levels of nested things.
         match item.node {
             hir::ItemKind::Enum(ref def, _) => {
                 for variant in &def.variants {
@@ -240,23 +239,23 @@ fn visit_item(&mut self, item: &'tcx hir::Item) {
         // 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
+        // Mark all items in interfaces of reachable items as reachable.
         match item.node {
-            // The interface is empty
+            // The interface is empty.
             hir::ItemKind::ExternCrate(..) => {}
-            // All nested items are checked by visit_item
+            // All nested items are checked by `visit_item`.
             hir::ItemKind::Mod(..) => {}
-            // Re-exports are handled in visit_mod
+            // Re-exports are handled in `visit_mod`.
             hir::ItemKind::Use(..) => {}
-            // The interface is empty
+            // The interface is empty.
             hir::ItemKind::GlobalAsm(..) => {}
             hir::ItemKind::Existential(hir::ExistTy { impl_trait_fn: Some(_), .. }) => {
                 if item_level.is_some() {
-                    // Reach the (potentially private) type and the API being exposed
+                    // Reach the (potentially private) type and the API being exposed.
                     self.reach(item.id).ty().predicates();
                 }
             }
-            // Visit everything
+            // Visit everything.
             hir::ItemKind::Const(..) | hir::ItemKind::Static(..) |
             hir::ItemKind::Existential(..) |
             hir::ItemKind::Fn(..) | hir::ItemKind::Ty(..) => {
@@ -286,7 +285,7 @@ fn visit_item(&mut self, item: &'tcx hir::Item) {
                     self.reach(item.id).generics().predicates();
                 }
             }
-            // Visit everything except for private impl items
+            // Visit everything except for private impl items.
             hir::ItemKind::Impl(.., ref trait_ref, _, ref impl_item_refs) => {
                 if item_level.is_some() {
                     self.reach(item.id).generics().predicates().impl_trait_ref();
@@ -300,7 +299,7 @@ fn visit_item(&mut self, item: &'tcx hir::Item) {
                 }
             }
 
-            // Visit everything, but enum variants have their own levels
+            // Visit everything, but enum variants have their own levels.
             hir::ItemKind::Enum(ref def, _) => {
                 if item_level.is_some() {
                     self.reach(item.id).generics().predicates();
@@ -316,7 +315,7 @@ fn visit_item(&mut self, item: &'tcx hir::Item) {
                     }
                 }
             }
-            // Visit everything, but foreign items have their own levels
+            // Visit everything, but foreign items have their own levels.
             hir::ItemKind::ForeignMod(ref foreign_mod) => {
                 for foreign_item in &foreign_mod.items {
                     if self.get(foreign_item.id).is_some() {
@@ -324,7 +323,7 @@ fn visit_item(&mut self, item: &'tcx hir::Item) {
                     }
                 }
             }
-            // Visit everything except for private fields
+            // Visit everything except for private fields.
             hir::ItemKind::Struct(ref struct_def, _) |
             hir::ItemKind::Union(ref struct_def, _) => {
                 if item_level.is_some() {
@@ -348,7 +347,7 @@ fn visit_block(&mut self, b: &'tcx hir::Block) {
 
         // 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
+        // constant, type, field, etc., in which this block resides.
         intravisit::walk_block(self, b);
 
         self.prev_level = orig_level;
@@ -524,10 +523,10 @@ struct NamePrivacyVisitor<'a, 'tcx: 'a> {
 impl<'a, 'tcx> NamePrivacyVisitor<'a, 'tcx> {
     // Checks that a field in a struct constructor (expression or pattern) is accessible.
     fn check_field(&mut self,
-                   use_ctxt: Span, // Syntax context of the field name at the use site
-                   span: Span, // Span of the field pattern, e.g. `x: 0`
-                   def: &'tcx ty::AdtDef, // Definition of the struct or enum
-                   field: &'tcx ty::FieldDef) { // Definition of the field
+                   use_ctxt: Span, // syntax context of the field name at the use site
+                   span: Span, // span of the field pattern, e.g., `x: 0`
+                   def: &'tcx ty::AdtDef, // definition of the struct or enum
+                   field: &'tcx ty::FieldDef) { // definition of the field
         let ident = Ident::new(keywords::Invalid.name(), use_ctxt);
         let def_id = self.tcx.adjust_ident(ident, def.did, self.current_item).1;
         if !def.is_enum() && !field.vis.is_accessible_from(def_id, self.tcx) {
@@ -539,8 +538,8 @@ fn check_field(&mut self,
     }
 }
 
-// Set the correct TypeckTables for the given `item_id` (or an empty table if
-// there is no TypeckTables for the item).
+// 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>,
@@ -710,7 +709,7 @@ fn item_is_accessible(&self, did: DefId) -> bool {
         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.tables.node_id_to_type(id).visit_with(self) {
@@ -862,7 +861,7 @@ fn visit_qpath(&mut self, qpath: &'tcx hir::QPath, id: hir::HirId, span: Span) {
         intravisit::walk_qpath(self, qpath, id, span);
     }
 
-    // Check types of patterns
+    // Check types of patterns.
     fn visit_pat(&mut self, pattern: &'tcx hir::Pat) {
         if self.check_expr_pat_type(pattern.hir_id, pattern.span) {
             // Do not check nested patterns if the error already happened.
@@ -883,7 +882,7 @@ fn visit_local(&mut self, local: &'tcx hir::Local) {
         intravisit::walk_local(self, local);
     }
 
-    // Check types in item interfaces
+    // Check types in item interfaces.
     fn visit_item(&mut self, item: &'tcx hir::Item) {
         let orig_current_item = self.current_item;
         let orig_tables = update_tables(self.tcx,
@@ -1015,18 +1014,18 @@ struct ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx: 'a> {
     tcx: TyCtxt<'a, 'tcx, 'tcx>,
     access_levels: &'a AccessLevels,
     in_variant: bool,
-    // set of errors produced by this obsolete visitor
+    // Set of errors produced by this obsolete visitor.
     old_error_set: NodeSet,
 }
 
 struct ObsoleteCheckTypeForPrivatenessVisitor<'a, 'b: 'a, 'tcx: 'b> {
     inner: &'a ObsoleteVisiblePrivateTypesVisitor<'b, 'tcx>,
-    /// whether the type refers to private types.
+    /// Whether the type refers to private types.
     contains_private: bool,
-    /// whether we've recurred at all (i.e. if we're pointing at the
-    /// first type on which visit_ty was called).
+    /// Whether we've recurred at all (i.e., if we're pointing at the
+    /// first type on which `visit_ty` was called).
     at_outer_type: bool,
-    // whether that first type is a public path.
+    /// Whether that first type is a public path.
     outer_type_is_public_path: bool,
 }
 
@@ -1041,7 +1040,7 @@ fn path_is_private_type(&self, path: &hir::Path) -> bool {
         // it's in this crate...
         if let Some(node_id) = self.tcx.hir().as_local_node_id(did) {
             // .. and it corresponds to a private type in the AST (this returns
-            // None for type parameters)
+            // `None` for type parameters).
             match self.tcx.hir().find(node_id) {
                 Some(Node::Item(ref item)) => !item.vis.node.is_pub(),
                 Some(_) | None => false,
@@ -1053,7 +1052,7 @@ fn path_is_private_type(&self, path: &hir::Path) -> bool {
 
     fn trait_is_public(&self, trait_id: ast::NodeId) -> bool {
         // FIXME: this would preferably be using `exported_items`, but all
-        // traits are exported currently (see `EmbargoVisitor.exported_trait`)
+        // traits are exported currently (see `EmbargoVisitor.exported_trait`).
         self.access_levels.is_public(trait_id)
     }
 
@@ -1079,8 +1078,7 @@ fn visit_ty(&mut self, ty: &hir::Ty) {
         if let hir::TyKind::Path(hir::QPath::Resolved(_, ref path)) = ty.node {
             if self.inner.path_is_private_type(path) {
                 self.contains_private = true;
-                // found what we're looking for so let's stop
-                // working.
+                // Found what we're looking for, so let's stop working.
                 return
             }
         }
@@ -1093,7 +1091,7 @@ fn visit_ty(&mut self, ty: &hir::Ty) {
         intravisit::walk_ty(self, ty)
     }
 
-    // don't want to recurse into [, .. expr]
+    // Don't want to recurse into `[, .. expr]`.
     fn visit_expr(&mut self, _: &hir::Expr) {}
 }
 
@@ -1106,7 +1104,7 @@ fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
 
     fn visit_item(&mut self, item: &'tcx hir::Item) {
         match item.node {
-            // contents of a private mod can be re-exported, so we need
+            // Contents of a private mod can be re-exported, so we need
             // to check internals.
             hir::ItemKind::Mod(_) => {}
 
@@ -1124,19 +1122,19 @@ fn visit_item(&mut self, item: &'tcx hir::Item) {
                 }
             }
 
-            // impls need some special handling to try to offer useful
+            // Impls need some special handling to try to offer useful
             // error messages without (too many) false positives
-            // (i.e. we could just return here to not check them at
+            // (i.e., we could just return here to not check them at
             // all, or some worse estimation of whether an impl is
             // publicly visible).
             hir::ItemKind::Impl(.., ref g, ref trait_ref, ref self_, ref impl_item_refs) => {
                 // `impl [... for] Private` is never visible.
                 let self_contains_private;
-                // impl [... for] Public<...>, but not `impl [... for]
-                // Vec<Public>` or `(Public,)` etc.
+                // `impl [... for] Public<...>`, but not `impl [... for]
+                // Vec<Public>` or `(Public,)`, etc.
                 let self_is_public_path;
 
-                // check the properties of the Self type:
+                // Check the properties of the `Self` type:
                 {
                     let mut visitor = ObsoleteCheckTypeForPrivatenessVisitor {
                         inner: self,
@@ -1149,7 +1147,7 @@ fn visit_item(&mut self, item: &'tcx hir::Item) {
                     self_is_public_path = visitor.outer_type_is_public_path;
                 }
 
-                // miscellaneous info about the impl
+                // Miscellaneous info about the impl:
 
                 // `true` iff this is `impl Private for ...`.
                 let not_private_trait =
@@ -1242,7 +1240,7 @@ fn visit_item(&mut self, item: &'tcx hir::Item) {
                         }
                     }
                 } else if trait_ref.is_none() && self_is_public_path {
-                    // impl Public<Private> { ... }. Any public static
+                    // `impl Public<Private> { ... }`. Any public static
                     // methods will be visible as `Public::foo`.
                     let mut found_pub_static = false;
                     for impl_item_ref in impl_item_refs {
@@ -1272,7 +1270,7 @@ fn visit_item(&mut self, item: &'tcx hir::Item) {
             // we're introducing a new name.
             hir::ItemKind::Ty(..) => return,
 
-            // not at all public, so we don't care
+            // Not at all public, so we don't care.
             _ if !self.item_is_public(&item.id, &item.vis) => {
                 return;
             }
@@ -1282,7 +1280,7 @@ fn visit_item(&mut self, item: &'tcx hir::Item) {
 
         // We've carefully constructed it so that if we're here, then
         // any `visit_ty`'s will be called on things that are in
-        // public signatures, i.e. things that we're interested in for
+        // public signatures, i.e., things that we're interested in for
         // this visitor.
         intravisit::walk_item(self, item);
     }
@@ -1340,7 +1338,7 @@ fn visit_struct_field(&mut self, s: &'tcx hir::StructField) {
         }
     }
 
-    // we don't need to introspect into these at all: an
+    // 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
     // having to be super careful about our `walk_...` calls above.)
@@ -1359,9 +1357,9 @@ struct SearchInterfaceForPrivateItemsVisitor<'a, 'tcx: 'a> {
     tcx: TyCtxt<'a, 'tcx, 'tcx>,
     item_def_id: DefId,
     span: Span,
-    /// The visitor checks that each component type is at least this visible
+    /// 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
+    /// The visibility of the least visible component that has been visited.
     min_visibility: ty::Visibility,
     has_pub_restricted: bool,
     has_old_errors: bool,
@@ -1384,7 +1382,7 @@ fn generics(&mut self) -> &mut Self {
     }
 
     fn predicates(&mut self) -> &mut Self {
-        // NB: We use `explicit_predicates_of` and not `predicates_of`
+        // N.B., we use `explicit_predicates_of` and not `predicates_of`
         // because we don't want to report privacy errors due to where
         // clauses that the compiler inferred. We only want to
         // consider the ones that the user wrote. This is important
@@ -1429,7 +1427,7 @@ fn impl_trait_ref(&mut self) -> &mut Self {
     }
 
     fn check_trait_ref(&mut self, trait_ref: ty::TraitRef<'tcx>) {
-        // Non-local means public (private items can't leave their crate, modulo bugs)
+        // 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);
@@ -1478,7 +1476,7 @@ fn visit_ty(&mut self, ty: Ty<'tcx>) -> bool {
         };
 
         if let Some(def_id) = ty_def_id {
-            // Non-local means public (private items can't leave their crate, modulo bugs)
+            // 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,
@@ -1579,30 +1577,29 @@ fn visit_item(&mut self, item: &'tcx hir::Item) {
         let item_visibility = ty::Visibility::from_hir(&item.vis, item.id, tcx);
 
         match item.node {
-            // Crates are always public
+            // Crates are always public.
             hir::ItemKind::ExternCrate(..) => {}
-            // All nested items are checked by visit_item
+            // All nested items are checked by `visit_item`.
             hir::ItemKind::Mod(..) => {}
-            // Checked in resolve
+            // Checked in resolve.
             hir::ItemKind::Use(..) => {}
-            // No subitems
+            // 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<Item=T>` has two predicates,
+                // e.g., `impl Iterator<Item=T>` has two predicates,
                 // `X: Iterator` and `<X as Iterator>::Item == T`,
                 // where `X` is the `impl Iterator<Item=T>` itself,
                 // stored in `predicates_of`, not in the `Ty` itself.
-
                 self.check(item.id, item_visibility).predicates();
             }
-            // Subitems of these items have inherited publicity
+            // Subitems of these items have inherited publicity.
             hir::ItemKind::Const(..) | hir::ItemKind::Static(..) | hir::ItemKind::Fn(..) |
             hir::ItemKind::Existential(..) |
             hir::ItemKind::Ty(..) => {
                 self.check(item.id, item_visibility).generics().predicates().ty();
 
-                // Recurse for e.g. `impl Trait` (see `visit_ty`).
+                // Recurse for e.g., `impl Trait` (see `visit_ty`).
                 self.inner_visibility = item_visibility;
                 intravisit::walk_item(self, item);
             }
@@ -1634,14 +1631,14 @@ fn visit_item(&mut self, item: &'tcx hir::Item) {
                     }
                 }
             }
-            // Subitems of foreign modules have their own publicity
+            // Subitems of foreign modules have their own publicity.
             hir::ItemKind::ForeignMod(ref foreign_mod) => {
                 for foreign_item in &foreign_mod.items {
                     let vis = ty::Visibility::from_hir(&foreign_item.vis, item.id, tcx);
                     self.check(foreign_item.id, vis).generics().predicates().ty();
                 }
             }
-            // Subitems of structs and unions have their own publicity
+            // Subitems of structs and unions have their own publicity.
             hir::ItemKind::Struct(ref struct_def, _) |
             hir::ItemKind::Union(ref struct_def, _) => {
                 self.check(item.id, item_visibility).generics().predicates();
@@ -1652,7 +1649,7 @@ fn visit_item(&mut self, item: &'tcx hir::Item) {
                 }
             }
             // An inherent impl is public when its type is public
-            // Subitems of inherent impls have their own publicity
+            // 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;
@@ -1665,13 +1662,13 @@ fn visit_item(&mut self, item: &'tcx hir::Item) {
                     check.in_assoc_ty = impl_item_ref.kind == hir::AssociatedItemKind::Type;
                     check.generics().predicates().ty();
 
-                    // Recurse for e.g. `impl Trait` (see `visit_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
+            // Subitems of trait impls have inherited publicity.
             hir::ItemKind::Impl(.., Some(_), _, ref impl_item_refs) => {
                 let vis = self.check(item.id, ty::Visibility::Invisible)
                               .ty().impl_trait_ref().min_visibility;
@@ -1682,7 +1679,7 @@ fn visit_item(&mut self, item: &'tcx hir::Item) {
                     check.in_assoc_ty = impl_item_ref.kind == hir::AssociatedItemKind::Type;
                     check.generics().predicates().ty();
 
-                    // Recurse for e.g. `impl Trait` (see `visit_ty`).
+                    // Recurse for e.g., `impl Trait` (see `visit_ty`).
                     self.inner_visibility = vis;
                     intravisit::walk_impl_item(self, impl_item);
                 }
@@ -1691,12 +1688,12 @@ fn visit_item(&mut self, item: &'tcx hir::Item) {
     }
 
     fn visit_impl_item(&mut self, _impl_item: &'tcx hir::ImplItem) {
-        // handled in `visit_item` above
+        // Handled in `visit_item` above.
     }
 
-    // Don't recurse into expressions in array sizes or const initializers
+    // 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
+    // Don't recurse into patterns in function arguments.
     fn visit_pat(&mut self, _: &'tcx hir::Pat) {}
 }
 
@@ -1778,7 +1775,7 @@ fn privacy_access_levels<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
             pub_restricted_visitor.has_pub_restricted
         };
 
-        // Check for private types and traits in public interfaces
+        // Check for private types and traits in public interfaces.
         let mut visitor = PrivateItemsInPublicInterfacesVisitor {
             tcx,
             has_pub_restricted,
index 389be3f758e2415253dfcc5c28356c88c52bc151..ebd2c87fa4642e9ff385d26d53a61b630fcae121 100644 (file)
@@ -84,7 +84,7 @@
 use resolve_imports::{ImportDirective, ImportDirectiveSubclass, NameResolution, ImportResolver};
 use macros::{InvocationData, LegacyBinding, ParentScope};
 
-// NB: This module needs to be declared first so diagnostics are
+// N.B., this module needs to be declared first so diagnostics are
 // registered before they are used.
 mod diagnostics;
 mod error_reporting;
@@ -638,7 +638,7 @@ fn error_code(self, has_unexpected_resolution: bool) -> &'static str {
 
 // A minimal representation of a path segment. We use this in resolve because
 // we synthesize 'path segments' which don't have the rest of an AST or HIR
-// PathSegment.
+// `PathSegment`.
 #[derive(Clone, Copy, Debug)]
 pub struct Segment {
     ident: Ident,
@@ -2608,7 +2608,7 @@ fn with_current_self_item<T, F>(&mut self, self_item: &Item, f: F) -> T
         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<T, F>(&mut self, opt_trait_ref: Option<&TraitRef>, f: F) -> T
         where F: FnOnce(&mut Resolver, Option<DefId>) -> T
     {
@@ -2890,7 +2890,7 @@ fn resolve_arm(&mut self, arm: &Arm) {
             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 {
@@ -3032,8 +3032,8 @@ fn resolve_pattern(&mut self,
                             Def::StructCtor(..) | Def::VariantCtor(..) |
                             Def::Const(..) | Def::Static(..) => {
                                 // This is unambiguously a fresh binding, either syntactically
-                                // (e.g. `IDENT @ PAT` or `ref IDENT`) or because `IDENT` resolves
-                                // to something unusable as a pattern (e.g. constructor function),
+                                // (e.g., `IDENT @ PAT` or `ref IDENT`) or because `IDENT` resolves
+                                // to something unusable as a pattern (e.g., constructor function),
                                 // but we still conservatively report an error, see
                                 // issues/33118#issuecomment-233962221 for one reason why.
                                 resolve_error(
@@ -3209,9 +3209,9 @@ fn smart_resolve_path_fragment(&mut self,
                 for (sp, variant_path, enum_path) in enum_candidates {
                     if sp.is_dummy() {
                         let msg = format!("there is an enum variant `{}`, \
-                                        try using `{}`?",
-                                        variant_path,
-                                        enum_path);
+                                           try using `{}`?",
+                                          variant_path,
+                                          enum_path);
                         err.help(&msg);
                     } else {
                         err.span_suggestion_with_applicability(
@@ -3263,7 +3263,7 @@ fn smart_resolve_path_fragment(&mut self,
 
             let mut levenshtein_worked = false;
 
-            // Try Levenshtein.
+            // Try Levenshtein algorithm.
             if let Some(candidate) = this.lookup_typo_candidate(path, ns, is_expected, span) {
                 err.span_label(ident_span, format!("did you mean `{}`?", candidate));
                 levenshtein_worked = true;
@@ -4325,7 +4325,7 @@ fn resolve_expr(&mut self, expr: &Expr, parent: Option<&Expr>) {
                     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();
@@ -4611,7 +4611,7 @@ fn lookup_import_candidates_from_module<FilterFn>(&mut self,
     /// 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,
     /// since we report the definitions (thus, the de-aliased imports).
index 39c4fc587ccc6d75de563a740d013362430b6d75..3f57c74c2c3c58fe52547c511a9db4bbc22f7c0b 100644 (file)
@@ -359,7 +359,7 @@ fn resolve_macro_to_def(
                     }
                 } else {
                     // Not only attributes, but anything in macro namespace can result in
-                    // `Def::NonMacroAttr` definition (e.g. `inline!()`), so we must report
+                    // `Def::NonMacroAttr` definition (e.g., `inline!()`), so we must report
                     // an error for those cases.
                     let msg = format!("expected a macro, found {}", def.kind_name());
                     self.session.span_err(path.span, &msg);
@@ -436,7 +436,7 @@ pub fn resolve_macro_to_def_inner(
     // Resolve an identifier in lexical scope.
     // This is a variation of `fn resolve_ident_in_lexical_scope` that can be run during
     // expansion and import resolution (perhaps they can be merged in the future).
-    // The function is used for resolving initial segments of macro paths (e.g. `foo` in
+    // The function is used for resolving initial segments of macro paths (e.g., `foo` in
     // `foo::bar!(); or `foo!();`) and also for import paths on 2018 edition.
     crate fn early_resolve_ident_in_lexical_scope(
         &mut self,
index 36b6b5296f04e212e9854cbf3328af2c432c1220..f130895e236f51e992f1a4813cc83d627fd7221a 100644 (file)
@@ -430,7 +430,7 @@ pub fn add_import_directive(&mut self,
     crate fn import(&self, binding: &'a NameBinding<'a>, directive: &'a ImportDirective<'a>)
                     -> &'a NameBinding<'a> {
         let vis = if binding.pseudo_vis().is_at_least(directive.vis.get(), self) ||
-                     // c.f. `PUB_USE_OF_PRIVATE_EXTERN_CRATE`
+                     // cf. `PUB_USE_OF_PRIVATE_EXTERN_CRATE`
                      !directive.is_glob() && binding.is_extern_crate() {
             directive.vis.get()
         } else {
@@ -1011,7 +1011,7 @@ fn finalize_import(
                                 NameBindingKind::Import { binding, .. } => {
                                     match binding.kind {
                                         // Never suggest the name that has binding error
-                                        // i.e. the name that cannot be previously resolved
+                                        // i.e., the name that cannot be previously resolved
                                         NameBindingKind::Def(Def::Err, _) => return None,
                                         _ => Some(&i.name),
                                     }
index 85ffd3eb1c277737663bb5c31434c178391d7e46..e0acc150ee39893260889d5f17f3e2633d09d39d 100644 (file)
@@ -110,7 +110,7 @@ fn span_from_span(&self, span: Span) -> SpanData {
         }
     }
 
-    // Returns path to the compilation output (e.g. libfoo-12345678.rmeta)
+    // Returns path to the compilation output (e.g., libfoo-12345678.rmeta)
     pub fn compilation_output(&self, crate_name: &str) -> PathBuf {
         let sess = &self.tcx.sess;
         // Save-analysis is emitted per whole session, not per each crate type
index 489bb37fc26ff9ac8393a41262261a51c621cb9d..1c3763c6e37f455c4d3c85742e691fe876ccada6 100644 (file)
@@ -164,7 +164,7 @@ pub fn align<C: HasDataLayout>(&self, cx: &C) -> Align {
 }
 
 /// An argument passed entirely registers with the
-/// same kind (e.g. HFA / HVA on PPC64 and AArch64).
+/// same kind (e.g., HFA / HVA on PPC64 and AArch64).
 #[derive(Clone, Copy, PartialEq, Eq, Debug)]
 pub struct Uniform {
     pub unit: Reg,
@@ -173,7 +173,7 @@ pub struct Uniform {
     /// * equal to `unit.size` (one scalar/vector)
     /// * a multiple of `unit.size` (an array of scalar/vectors)
     /// * if `unit.kind` is `Integer`, the last element
-    ///   can be shorter, i.e. `{ i64, i64, i32 }` for
+    ///   can be shorter, i.e., `{ i64, i64, i32 }` for
     ///   64-bit integers with a total size of 20 bytes
     pub total: Size,
 }
index d6d8ea719180a20722cfaf405b21fe36ae297bf5..fe1c8751792f4743af4e2f7571ffd8f31a2c2745 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// FIXME: The assumes we're using the non-vector ABI, i.e. compiling
+// 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};
index f091f80924d5937d3e32e10fd82f13ddc2b66da3..0f27300dc3bac869b7eaa5a601921f202fe282a1 100644 (file)
@@ -15,7 +15,7 @@
 use abi::{self, Abi, HasDataLayout, LayoutOf, Size, TyLayout, TyLayoutMethods};
 
 /// Classification of "eightbyte" components.
-// NB: the order of the variants is from general to specific,
+// N.B., the order of the variants is from general to specific,
 // such that `unify(a, b)` is the "smaller" of `a` and `b`.
 #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Debug)]
 enum Class {
index 50ce0ad6915da3c9916c1c99ad1d754932590048..5912da9d3aa2fa3551c41b24e1b1810eaa7f1c7d 100644 (file)
@@ -409,7 +409,7 @@ pub fn bits(self) -> u64 {
     /// Compute the best alignment possible for the given offset
     /// (the largest power of two that the offset is a multiple of).
     ///
-    /// NB: for an offset of `0`, this happens to return `2^64`.
+    /// N.B., for an offset of `0`, this happens to return `2^64`.
     pub fn max_for_offset(offset: Size) -> Align {
         Align {
             pow2: offset.bytes().trailing_zeros() as u8,
@@ -639,7 +639,7 @@ pub struct Scalar {
     ///
     /// This is intended specifically to mirror LLVM’s `!range` metadata,
     /// semantics.
-    // FIXME(eddyb) always use the shortest range, e.g. by finding
+    // FIXME(eddyb) always use the shortest range, e.g., by finding
     // the largest space between two consecutive valid values and
     // taking everything else as the (shortest) valid range.
     pub valid_range: RangeInclusive<u128>,
@@ -887,12 +887,12 @@ pub fn scalar<C: HasDataLayout>(cx: &C, scalar: Scalar) -> Self {
 }
 
 /// The details of the layout of a type, alongside the type itself.
-/// Provides various type traversal APIs (e.g. recursing into fields).
+/// Provides various type traversal APIs (e.g., recursing into fields).
 ///
 /// Note that the details are NOT guaranteed to always be identical
 /// to those obtained from `layout_of(ty)`, as we need to produce
 /// layouts for which Rust types do not exist, such as enum variants
-/// or synthetic fields of enums (i.e. discriminants) and fat pointers.
+/// or synthetic fields of enums (i.e., discriminants) and fat pointers.
 #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
 pub struct TyLayout<'a, Ty> {
     pub ty: Ty,
index 6d8c8eb19f057c25a87815f7c17655446309f4a1..919744fe046e758be63292dd4ee29d5c1b5e3131 100644 (file)
@@ -12,7 +12,7 @@
 
 #[derive(PartialEq, Eq, PartialOrd, Ord, Hash, RustcEncodable, RustcDecodable, Clone, Copy, Debug)]
 pub enum Abi {
-    // NB: This ordering MUST match the AbiDatas array below.
+    // N.B., this ordering MUST match the AbiDatas array below.
     // (This is ensured by the test indices_are_correct().)
 
     // Single platform ABIs
index a9aa721f5c3a7f534f8ba5ce15fe5dbc56203668..d8e8477f3d06b44a067783cdb7c1628f01aacdd6 100644 (file)
@@ -605,7 +605,7 @@ pub struct TargetOptions {
     /// `eh_unwind_resume` lang item.
     pub custom_unwind_resume: bool,
 
-    /// Flag indicating whether ELF TLS (e.g. #[thread_local]) is available for
+    /// Flag indicating whether ELF TLS (e.g., #[thread_local]) is available for
     /// this target.
     pub has_elf_tls: bool,
     // This is mainly for easy compatibility with emscripten.
index a5c4b8925e248e89cac7a7dc1d36d8744bc94df4..d760f5bf1f7ed550e5afea246818a81413274c7b 100644 (file)
@@ -20,7 +20,7 @@
 // - Cortex-M23
 // - Cortex-M33
 //
-// We have opted for these instead of one target per processor (e.g. `cortex-m0`, `cortex-m3`,
+// We have opted for these instead of one target per processor (e.g., `cortex-m0`, `cortex-m3`,
 // etc) because the differences between some processors like the cortex-m0 and cortex-m1 are almost
 // non-existent from the POV of codegen so it doesn't make sense to have separate targets for them.
 // And if differences exist between two processors under the same target, rustc flags can be used to
index 7514c2c18e7ca8f77aec0fbe7fcd15be28e12c8a..d46ce8b10b988b3046efbb2588b81b67d208866c 100644 (file)
@@ -77,7 +77,7 @@ fn compute_implied_outlives_bounds<'tcx>(
         let obligations =
             wf::obligations(infcx, param_env, DUMMY_NODE_ID, ty, DUMMY_SP).unwrap_or(vec![]);
 
-        // NB: All of these predicates *ought* to be easily proven
+        // N.B., all of these predicates *ought* to be easily proven
         // true. In fact, their correctness is (mostly) implied by
         // other parts of the program. However, in #42552, we had
         // an annoying scenario where:
index 8024ec96db0501917fe05c1f61a17f37bb38a1ca..473eebbde78626d9b3d1f461ef6bcb639bd602a7 100644 (file)
@@ -43,7 +43,7 @@
 }
 
 crate trait Lower<T> {
-    /// Lower a rustc construct (e.g. `ty::TraitPredicate`) to a chalk-like type.
+    /// Lower a rustc construct (e.g., `ty::TraitPredicate`) to a chalk-like type.
     fn lower(&self) -> T;
 }
 
@@ -90,9 +90,9 @@ fn lower(&self) -> DomainGoal<'tcx> {
 }
 
 /// `ty::Binder` is used for wrapping a rustc construction possibly containing generic
-/// lifetimes, e.g. `for<'a> T: Fn(&'a i32)`. Instead of representing higher-ranked things
-/// in that leaf-form (i.e. `Holds(Implemented(Binder<TraitPredicate>))` in the previous
-/// example), we model them with quantified domain goals, e.g. as for the previous example:
+/// lifetimes, e.g., `for<'a> T: Fn(&'a i32)`. Instead of representing higher-ranked things
+/// in that leaf-form (i.e., `Holds(Implemented(Binder<TraitPredicate>))` in the previous
+/// example), we model them with quantified domain goals, e.g., as for the previous example:
 /// `forall<'a> { T: Fn(&'a i32) }` which corresponds to something like
 /// `Binder<Holds(Implemented(TraitPredicate))>`.
 impl<'tcx, T> Lower<PolyDomainGoal<'tcx>> for ty::Binder<T>
@@ -248,7 +248,7 @@ fn program_clauses_for_trait<'a, 'tcx>(
                 // and that named bound regions have a def-id, it is safe
                 // to just inject `hypotheses` (which contains 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`
+                // to bind types (e.g., for GATs things), because bound types only use a `BoundVar`
                 // index (no def-id).
                 hypotheses,
 
@@ -560,7 +560,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
-    // ty definition (i.e. in the trait def, as in `type AssocType<T> where T: Sized`).
+    // ty definition (i.e., in the trait def, as in `type AssocType<T> where T: Sized`).
     // ```
     // forall<P0..Pm> {
     //   forall<Pn+1..Pm> {
index 752e0a5fac68bbac9705b6bf2acbc8629aab8963..fc151d51d371fadf0f12ca0b8b20e8a18870a18e 100644 (file)
@@ -8,38 +8,39 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-//! Conversion from AST representation of types to the `ty.rs`
-//! representation.  The main routine here is `ast_ty_to_ty()`: each use
-//! is parameterized by an instance of `AstConv`.
+//! Conversion from AST representation of types to the `ty.rs` representation.
+//! The main routine here is `ast_ty_to_ty()`; each use is is parameterized by
+//! an instance of `AstConv`.
 
-use smallvec::SmallVec;
+use errors::{Applicability, FatalError, DiagnosticId};
 use hir::{self, GenericArg, GenericArgs};
 use hir::def::Def;
 use hir::def_id::DefId;
 use hir::HirVec;
+use lint;
 use middle::resolve_lifetime as rl;
 use namespace::Namespace;
-use rustc::ty::subst::{Kind, Subst, Substs};
-use rustc::traits;
+use rustc::traits::{self, TraitRefExpansionInfoDignosticBuilder};
 use rustc::ty::{self, Ty, TyCtxt, ToPredicate, TypeFoldable};
 use rustc::ty::{GenericParamDef, GenericParamDefKind};
+use rustc::ty::subst::{Kind, Subst, Substs};
 use rustc::ty::wf::object_region_bounds;
 use rustc_data_structures::sync::Lrc;
 use rustc_target::spec::abi;
-use std::collections::BTreeSet;
-use std::slice;
 use require_c_abi_if_variadic;
-use util::common::ErrorReported;
-use util::nodemap::FxHashMap;
-use errors::{Applicability, FatalError, DiagnosticId};
-use lint;
-
-use std::iter;
+use smallvec::SmallVec;
 use syntax::ast;
 use syntax::feature_gate::{GateIssue, emit_feature_err};
 use syntax::ptr::P;
 use syntax::util::lev_distance::find_best_match_for_name;
 use syntax_pos::{DUMMY_SP, Span, MultiSpan};
+use util::common::ErrorReported;
+use util::nodemap::FxHashMap;
+
+use std::collections::BTreeSet;
+use std::iter;
+use std::ops::Range;
+use std::slice;
 
 pub trait AstConv<'gcx, 'tcx> {
     fn tcx<'a>(&'a self) -> TyCtxt<'a, 'gcx, 'tcx>;
@@ -80,7 +81,7 @@ fn projected_ty_from_poly_trait_ref(&self,
     fn normalize_ty(&self, span: Span, ty: Ty<'tcx>) -> Ty<'tcx>;
 
     /// Invoked when we encounter an error from some prior pass
-    /// (e.g. resolve) that is translated into a ty-error. This is
+    /// (e.g., resolve) that is translated into a ty-error. This is
     /// used to help suppress derived errors typeck might otherwise
     /// report.
     fn set_tainted_by_errors(&self);
@@ -97,7 +98,7 @@ struct ConvertedBinding<'tcx> {
 #[derive(PartialEq)]
 enum GenericArgPosition {
     Type,
-    Value, // e.g. functions
+    Value, // e.g., functions
     MethodCall,
 }
 
@@ -106,7 +107,7 @@ enum GenericArgPosition {
 /// This type must not appear anywhere in other converted types.
 const TRAIT_OBJECT_DUMMY_SELF: ty::TyKind<'static> = ty::Infer(ty::FreshTy(0));
 
-impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
+impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o {
     pub fn ast_region_to_region(&self,
         lifetime: &hir::Lifetime,
         def: Option<&ty::GenericParamDef>)
@@ -321,8 +322,8 @@ fn check_generic_arg_count(
                                 provided,
                                 offset| {
             // We enforce the following: `required` <= `provided` <= `permitted`.
-            // For kinds without defaults (i.e. lifetimes), `required == permitted`.
-            // For other kinds (i.e. types), `permitted` may be greater than `required`.
+            // For kinds without defaults (i.e., lifetimes), `required == permitted`.
+            // For other kinds (i.e., types), `permitted` may be greater than `required`.
             if required <= provided && provided <= permitted {
                 return (false, None);
             }
@@ -411,24 +412,24 @@ fn check_generic_arg_count(
     /// creating the substitutions for, and a partial set of
     /// substitutions `parent_substs`. In general, the substitutions
     /// for an item begin with substitutions for all the "parents" of
-    /// that item -- so e.g. for a method it might include the
+    /// that item -- e.g., for a method it might include the
     /// parameters from the impl.
     ///
     /// Therefore, the method begins by walking down these parents,
     /// starting with the outermost parent and proceed inwards until
-    /// it reaches `def_id`. For each parent P, it will check `parent_substs`
+    /// it reaches `def_id`. For each parent `P`, it will check `parent_substs`
     /// first to see if the parent's substitutions are listed in there. If so,
     /// 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 `<T as Foo>::Bar`, the def-id
+    ///   the path; so e.g., if you have `<T as Foo>::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.
     /// - `provided_kind`: given the generic parameter and the value from `args_for_def_id`,
-    ///   instantiate a `Kind`
+    ///   instantiate a `Kind`.
     /// - `inferred_kind`: if no parameter was provided, and inference is enabled, then
     ///   creates a suitable inference variable.
     pub fn create_substs_for_generic_args<'a, 'b>(
@@ -441,7 +442,7 @@ pub fn create_substs_for_generic_args<'a, 'b>(
         provided_kind: impl Fn(&GenericParamDef, &GenericArg) -> Kind<'tcx>,
         inferred_kind: impl Fn(Option<&[Kind<'tcx>]>, &GenericParamDef, bool) -> Kind<'tcx>,
     ) -> &'tcx Substs<'tcx> {
-        // Collect the segments of the path: we need to substitute arguments
+        // Collect the segments of the path; we need to substitute arguments
         // for parameters throughout the entire path (wherever there are
         // generic parameters).
         let mut parent_defs = tcx.generics_of(def_id);
@@ -453,8 +454,8 @@ pub fn create_substs_for_generic_args<'a, 'b>(
         }
 
         // We manually build up the substitution, rather than using convenience
-        // methods in `subst.rs` so that we can iterate over the arguments and
-        // parameters in lock-step linearly, rather than trying to match each pair.
+        // methods in `subst.rs`, so that we can iterate over the arguments and
+        // parameters in lock-step linearly, instead of trying to match each pair.
         let mut substs: SmallVec<[Kind<'tcx>; 8]> = SmallVec::with_capacity(count);
 
         // Iterate over each segment of the path.
@@ -1087,13 +1088,10 @@ fn conv_object_ty_poly_trait_ref(&self,
                 }
             }
             if !suggestions.is_empty() {
-                let msg = if suggestions.len() == 1 {
-                    "if you meant to specify the associated type, write"
-                } else {
-                    "if you meant to specify the associated types, write"
-                };
+                let msg = format!("if you meant to specify the associated {}, write",
+                    if suggestions.len() == 1 { "type" } else { "types" });
                 err.multipart_suggestion_with_applicability(
-                    msg,
+                    &msg,
                     suggestions,
                     Applicability::MaybeIncorrect,
                 );
@@ -1787,8 +1785,8 @@ fn compute_object_lifetime_bound(&self,
     }
 }
 
-/// Divides a list of general trait bounds into two groups: auto traits (e.g. Sync and Send) and the
-/// remaining general trait bounds.
+/// Divides a list of general trait bounds into two groups: auto traits (e.g., Sync and Send) and
+/// the remaining general trait bounds.
 fn split_auto_traits<'a, 'b, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>,
                                          trait_bounds: &'b [hir::PolyTraitRef])
     -> (Vec<DefId>, Vec<&'b hir::PolyTraitRef>)
@@ -1828,7 +1826,7 @@ impl<'a, 'gcx, 'tcx> Bounds<'tcx> {
     pub fn predicates(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>, param_ty: Ty<'tcx>)
                       -> Vec<(ty::Predicate<'tcx>, Span)>
     {
-        // If it could be sized, and is, add the sized predicate
+        // If it could be sized, and is, add the sized predicate.
         let sized_predicate = self.implicitly_sized.and_then(|span| {
             tcx.lang_items().sized_trait().map(|sized| {
                 let trait_ref = ty::TraitRef {
@@ -1841,8 +1839,8 @@ pub fn predicates(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>, param_ty: Ty<'tcx>)
 
         sized_predicate.into_iter().chain(
             self.region_bounds.iter().map(|&(region_bound, span)| {
-                // account for the binder being introduced below; no need to shift `param_ty`
-                // because, at present at least, it can only refer to early-bound regions
+                // Account for the binder being introduced below; no need to shift `param_ty`
+                // because, at present at least, it can only refer to early-bound regions.
                 let region_bound = ty::fold::shift_region(tcx, region_bound, 1);
                 let outlives = ty::OutlivesPredicate(param_ty, region_bound);
                 (ty::Binder::dummy(outlives).to_predicate(), span)
index bc9ba0e0054647712dc04ef491595aa56d22466a..87ee903cf4302534164f84bf196b16045508097d 100644 (file)
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+use check::{FnCtxt, Expectation, Diverges, Needs};
+use check::coercion::CoerceMany;
 use rustc::hir::{self, PatKind};
 use rustc::hir::def::{Def, CtorKind};
 use rustc::hir::pat_util::EnumerateAndAdjustIterator;
 use rustc::infer::type_variable::TypeVariableOrigin;
 use rustc::traits::ObligationCauseCode;
 use rustc::ty::{self, Ty, TypeFoldable};
-use check::{FnCtxt, Expectation, Diverges, Needs};
-use check::coercion::CoerceMany;
-use util::nodemap::FxHashMap;
-
-use std::collections::hash_map::Entry::{Occupied, Vacant};
-use std::cmp;
 use syntax::ast;
 use syntax::source_map::Spanned;
 use syntax::ptr::P;
 use syntax::util::lev_distance::find_best_match_for_name;
 use syntax_pos::Span;
+use util::nodemap::FxHashMap;
+
+use std::collections::hash_map::Entry::{Occupied, Vacant};
+use std::cmp;
 
 impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
     /// The `is_arg` argument indicates whether this pattern is the
@@ -545,7 +545,7 @@ pub fn check_match(&self,
         // the "discriminant type" (issue #23116).
         //
         // arielb1 [writes here in this comment thread][c] that there
-        // is certainly *some* potential danger, e.g. for an example
+        // is certainly *some* potential danger, e.g., for an example
         // like:
         //
         // [c]: https://github.com/rust-lang/rust/pull/43399#discussion_r130223956
@@ -729,10 +729,10 @@ fn check_pat_struct(&self,
             return self.tcx.types.err;
         };
 
-        // Type check the path.
+        // Type-check the path.
         self.demand_eqtype(pat.span, expected, pat_ty);
 
-        // Type check subpatterns.
+        // Type-check subpatterns.
         if self.check_struct_pat_fields(pat_ty, pat.id, pat.span, variant, fields, etc, def_bm) {
             pat_ty
         } else {
@@ -771,7 +771,7 @@ fn check_pat_path(&self,
             _ => bug!("unexpected pattern definition: {:?}", def)
         }
 
-        // Type check the path.
+        // Type-check the path.
         let pat_ty = self.instantiate_value_path(segments, opt_ty, def, pat.span, pat.id).0;
         self.demand_suptype(pat.span, expected, pat_ty);
         pat_ty
@@ -808,7 +808,7 @@ fn check_pat_tuple_struct(&self,
             return self.tcx.types.err;
         }
 
-        // Type check the path.
+        // Type-check the path.
         let (pat_ty, def) = self.instantiate_value_path(segments, opt_ty, def, pat.span, pat.id);
         if !pat_ty.is_fn() {
             report_unexpected_def(def);
@@ -838,7 +838,7 @@ fn check_pat_tuple_struct(&self,
 
         self.demand_eqtype(pat.span, expected, pat_ty);
 
-        // Type check subpatterns.
+        // Type-check subpatterns.
         if subpats.len() == variant.fields.len() ||
                 subpats.len() < variant.fields.len() && ddpos.is_some() {
             let substs = match pat_ty.sty {
index 2cd2bb5064877a2c9502e351bad54216a0b2ac36..1b594342c9a7179944fc9f42c7c2fec7f6a476b5 100644 (file)
@@ -203,7 +203,7 @@ pub fn adjust_steps_as_infer_ok(&self, needs: Needs)
     }
 
     /// also dereference through raw pointer types
-    /// e.g. assuming ptr_to_Foo is the type `*const Foo`
+    /// e.g., assuming ptr_to_Foo is the type `*const Foo`
     /// fcx.autoderef(span, ptr_to_Foo)  => [*const Foo]
     /// fcx.autoderef(span, ptr_to_Foo).include_raw_ptrs() => [*const Foo, Foo]
     pub fn include_raw_pointers(mut self) -> Self {
index ad4afb0d1a37b001d8eb9cdddc60e9dbea157c4c..e4ce04916ce6428322bee28fccd7fd0345e9dccf 100644 (file)
@@ -38,7 +38,7 @@ pub fn check_legal_trait_for_method_call(tcx: TyCtxt, span: Span, trait_id: DefI
 enum CallStep<'tcx> {
     Builtin(Ty<'tcx>),
     DeferredClosure(ty::FnSig<'tcx>),
-    /// e.g. enum variant constructors
+    /// e.g., enum variant constructors
     Overloaded(MethodCallee<'tcx>),
 }
 
index c35aee7883f499af196f8823b863a3eed238d082..51271f0f351202246b74bf1cb974380d269edf99 100644 (file)
@@ -27,7 +27,7 @@
 //!
 //! where `&.T` and `*T` are references of either mutability,
 //! and where pointer_kind(`T`) is the kind of the unsize info
-//! in `T` - the vtable for a trait definition (e.g. `fmt::Display` or
+//! in `T` - the vtable for a trait definition (e.g., `fmt::Display` or
 //! `Iterator`, not `Iterator<Item=u8>`) or a length (or `()` if `T: Sized`).
 //!
 //! Note that lengths are not adjusted when casting raw slices -
index 629a31a7e1f85a80ca121252164a65910d4f7d64..be15503e47906e7e68ba5452b51010627f453628 100644 (file)
@@ -266,7 +266,7 @@ fn deduce_expectations_from_obligations(
                     ty::Predicate::ObjectSafe(..) => None,
                     ty::Predicate::ConstEvaluatable(..) => None,
 
-                    // NB: This predicate is created by breaking down a
+                    // N.B., this predicate is created by breaking down a
                     // `ClosureType: FnFoo()` predicate, where
                     // `ClosureType` represents some `Closure`. It can't
                     // possibly be referring to the current closure,
index f7072a6395b8c089cb982130f3da83a1e6a5eb80..8d844fe3a69e4e18d40fb34aed13b9fd4c958652 100644 (file)
@@ -336,7 +336,7 @@ fn coerce_borrowed_pointer(&self,
             //   the decision to region inference (and regionck, which will add
             //   some more edges to this variable). However, this can wind up
             //   creating a crippling number of variables in some cases --
-            //   e.g. #32278 -- so we optimize one particular case [3].
+            //   e.g., #32278 -- so we optimize one particular case [3].
             //   Let me try to explain with some examples:
             //   - The "running example" above represents the simple case,
             //     where we have one `&` reference at the outer level and
@@ -809,7 +809,7 @@ fn try_find_coercion_lub<E>(&self,
         // Special-case that coercion alone cannot handle:
         // Two function item types of differing IDs or Substs.
         if let (&ty::FnDef(..), &ty::FnDef(..)) = (&prev_ty.sty, &new_ty.sty) {
-            // Don't reify if the function types have a LUB, i.e. they
+            // Don't reify if the function types have a LUB, i.e., they
             // are the same function and their parameters have a LUB.
             let lub_ty = self.commit_if_ok(|_| {
                 self.at(cause, self.param_env)
index fb83d169d39a55d53697eb214043a8b93b48e603..f4f6b3d661697898756ef90e650ec73792118a77 100644 (file)
@@ -91,7 +91,7 @@ pub fn demand_coerce(&self,
 
     // Checks that the type of `expr` can be coerced to `expected`.
     //
-    // NB: This code relies on `self.diverges` to be accurate. In
+    // N.B., this code relies on `self.diverges` to be accurate. In
     // particular, assignments to `!` will be permitted if the
     // diverges flag is currently "always".
     pub fn demand_coerce_diag(&self,
index aae99addfcd769e713c1313dc5a2ac1dd088bd49..f59bc2d0c2dca929b4a06d5bc5362ece131e787c 100644 (file)
@@ -32,7 +32,7 @@
 ///    coherence),
 ///
 /// 2. The generic region/type parameters of the impl's self-type must
-///    all be parameters of the Drop impl itself (i.e. no
+///    all be parameters of the Drop impl itself (i.e., no
 ///    specialization like `impl Drop for Foo<i32>`), and,
 ///
 /// 3. Any bounds on the generic parameters must be reflected in the
@@ -180,7 +180,7 @@ fn ensure_drop_predicates_are_implied_by_item_defn<'a, 'tcx>(
     //
     //     self_to_impl_substs = {'c => 'z, 'b => 'y, 'a => 'x}
     //
-    // Applying this to the predicates (i.e. assumptions) provided by the item
+    // Applying this to the predicates (i.e., assumptions) provided by the item
     // definition yields the instantiated assumptions:
     //
     //     ['y : 'z]
index b1382057c5262fc221d19cca4356e37fe6e72fc0..5c0eef5b1f332818c60c5619379d7c6a1a0ac580 100644 (file)
@@ -505,7 +505,7 @@ pub fn check_platform_intrinsic_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
 }
 
 // walk the expected type and the actual type in lock step, checking they're
-// the same, in a kinda-structural way, i.e. `Vector`s have to be simd structs with
+// the same, in a kinda-structural way, i.e., `Vector`s have to be simd structs with
 // exactly the right element type
 fn match_intrinsic_type_to_type<'a, 'tcx>(
         tcx: TyCtxt<'a, 'tcx, 'tcx>,
index 5144f3e41d4a9ad4a7c8fc32955fcd21354510d9..11fb3889a748df933ec3e656108aeb82abf4662a 100644 (file)
@@ -395,7 +395,7 @@ fn instantiate_method_sig(&mut self,
         // Instantiate late-bound regions and substitute the trait
         // parameters into the method type to get the actual method type.
         //
-        // NB: Instantiate late-bound regions first so that
+        // N.B., instantiate late-bound regions first so that
         // `instantiate_type_scheme` can normalize associated types that
         // may reference those regions.
         let method_sig = self.replace_bound_vars_with_fresh_vars(&sig);
index 209ad45ff34f6d5a4d87c4284bfe8c3050d4e1cf..858d8c742dfd9e11213058bf40cc967b6c3ab4b0 100644 (file)
 //!
 //! [rustc guide]: https://rust-lang.github.io/rustc-guide/method-lookup.html
 
+mod confirm;
+pub mod probe;
+mod suggest;
+
+pub use self::MethodError::*;
+pub use self::CandidateSource::*;
+pub use self::suggest::TraitInfo;
+
 use check::FnCtxt;
-use hir::def::Def;
-use hir::def_id::DefId;
 use namespace::Namespace;
-use rustc::ty::subst::Substs;
+use rustc_data_structures::sync::Lrc;
+use rustc::hir;
+use rustc::hir::def::Def;
+use rustc::hir::def_id::DefId;
 use rustc::traits;
+use rustc::ty::subst::Substs;
 use rustc::ty::{self, Ty, ToPredicate, ToPolyTraitRef, TraitRef, TypeFoldable};
 use rustc::ty::GenericParamDefKind;
 use rustc::ty::subst::Subst;
 use rustc::infer::{self, InferOk};
-
 use syntax::ast;
 use syntax_pos::Span;
 
-use rustc::hir;
-
-use rustc_data_structures::sync::Lrc;
-
-pub use self::MethodError::*;
-pub use self::CandidateSource::*;
-pub use self::suggest::TraitInfo;
-
-mod confirm;
-pub mod probe;
-mod suggest;
-
 use self::probe::{IsSuggestion, ProbeScope};
 
 pub fn provide(providers: &mut ty::query::Providers) {
@@ -50,7 +47,7 @@ pub struct MethodCallee<'tcx> {
     pub def_id: DefId,
     pub substs: &'tcx Substs<'tcx>,
 
-    /// Instantiated method signature, i.e. it has been
+    /// Instantiated method signature, i.e., it has been
     /// substituted, normalized, and has had late-bound
     /// lifetimes replaced with inference variables.
     pub sig: ty::FnSig<'tcx>,
@@ -107,8 +104,7 @@ pub fn new(static_candidates: Vec<CandidateSource>,
 #[derive(Copy, Clone, Debug, Eq, Ord, PartialEq, PartialOrd)]
 pub enum CandidateSource {
     ImplSource(DefId),
-    TraitSource(// trait id
-                DefId),
+    TraitSource(DefId /* trait id */),
 }
 
 impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
@@ -174,7 +170,7 @@ pub fn lookup_method(&self,
             let import_def_id = self.tcx.hir().local_def_id(import_id);
             debug!("used_trait_import: {:?}", import_def_id);
             Lrc::get_mut(&mut self.tables.borrow_mut().used_trait_imports)
-                                        .unwrap().insert(import_def_id);
+                .unwrap().insert(import_def_id);
         }
 
         self.tcx.check_stability(pick.item.def_id, Some(call_expr.id), span);
@@ -239,7 +235,7 @@ fn lookup_probe(&self,
     /// 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
+    /// FIXME(#18741): it seems likely that we can consolidate some of this
     /// code with the other method-lookup code. In particular, the second half
     /// of this method is basically the same as confirmation.
     pub fn lookup_method_in_trait(&self,
@@ -307,7 +303,7 @@ pub fn lookup_method_in_trait(&self,
         // Instantiate late-bound regions and substitute the trait
         // parameters into the method type to get the actual method type.
         //
-        // NB: Instantiate late-bound regions first so that
+        // N.B., instantiate late-bound regions first so that
         // `instantiate_type_scheme` can normalize associated types that
         // may reference those regions.
         let fn_sig = tcx.fn_sig(def_id);
@@ -324,7 +320,7 @@ pub fn lookup_method_in_trait(&self,
             }
         };
 
-        // Register obligations for the parameters.  This will include the
+        // 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
         // used to register `obligation` explicitly, but that resulted in
index c794910e6ef9cb7da76f98dfeb60456cb782c9d6..dd3c022d53bb3ce45c622f2650250382b3b48004 100644 (file)
@@ -41,7 +41,7 @@
 pub use self::PickKind::*;
 
 /// Boolean flag used to indicate if this search is for a suggestion
-/// or not.  If true, we can allow ambiguity and so forth.
+/// or not. If true, we can allow ambiguity and so forth.
 #[derive(Clone, Copy)]
 pub struct IsSuggestion(pub bool);
 
index ab7e71a2870a1e410c21ef095b68da1085c78c8a..79414cba69b1c1e2f4fbdad3a6befd4eda06a7cf 100644 (file)
 //! found or is otherwise invalid.
 
 use check::FnCtxt;
-use rustc::hir::map as hir_map;
-use hir::Node;
-use rustc_data_structures::sync::Lrc;
-use rustc::ty::{self, Ty, TyCtxt, ToPolyTraitRef, ToPredicate, TypeFoldable};
-use rustc::ty::item_path::with_crate_prefix;
-use hir::def::Def;
-use hir::def_id::{CRATE_DEF_INDEX, DefId};
+use errors::{Applicability, DiagnosticBuilder};
 use middle::lang_items::FnOnceTraitLangItem;
 use namespace::Namespace;
+use rustc_data_structures::sync::Lrc;
+use rustc::hir::{self, Node};
+use rustc::hir::def::Def;
+use rustc::hir::def_id::{CRATE_DEF_INDEX, LOCAL_CRATE, DefId};
+use rustc::hir::map as hir_map;
+use rustc::hir::print;
+use rustc::infer::type_variable::TypeVariableOrigin;
 use rustc::traits::Obligation;
+use rustc::ty::{self, Adt, Ty, TyCtxt, ToPolyTraitRef, ToPredicate, TypeFoldable};
+use rustc::ty::item_path::with_crate_prefix;
 use util::nodemap::FxHashSet;
-
+use syntax_pos::{Span, FileName};
 use syntax::ast;
 use syntax::util::lev_distance::find_best_match_for_name;
-use errors::{Applicability, DiagnosticBuilder};
-use syntax_pos::{Span, FileName};
-
-
-use rustc::hir::def_id::LOCAL_CRATE;
-use rustc::hir;
-use rustc::hir::print;
-use rustc::infer::type_variable::TypeVariableOrigin;
-use rustc::ty::Adt;
 
 use std::cmp::Ordering;
 
@@ -45,12 +39,12 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
     fn is_fn_ty(&self, ty: &Ty<'tcx>, span: Span) -> bool {
         let tcx = self.tcx;
         match ty.sty {
-            // Not all of these (e.g. unsafe fns) implement FnOnce
-            // so we look for these beforehand
+            // Not all of these (e.g., unsafe fns) implement `FnOnce`,
+            // so we look for these beforehand.
             ty::Closure(..) |
             ty::FnDef(..) |
             ty::FnPtr(_) => true,
-            // If it's not a simple function, look for things which implement FnOnce
+            // If it's not a simple function, look for things which implement `FnOnce`.
             _ => {
                 let fn_once = match tcx.lang_items().require(FnOnceTraitLangItem) {
                     Ok(fn_once) => fn_once,
@@ -83,7 +77,7 @@ pub fn report_method_error(&self,
                                rcvr_expr: Option<&hir::Expr>,
                                error: MethodError<'tcx>,
                                args: Option<&'gcx [hir::Expr]>) {
-        // avoid suggestions when we don't know what's going on.
+        // Avoid suggestions when we don't know what's going on.
         if rcvr_ty.references_error() {
             return;
         }
@@ -194,7 +188,7 @@ pub fn report_method_error(&self,
                 let tcx = self.tcx;
 
                 let actual = self.resolve_type_vars_if_possible(&rcvr_ty);
-                let ty_string = self.ty_to_string(actual);
+                let ty_str = self.ty_to_string(actual);
                 let is_method = mode == Mode::MethodCall;
                 let mut suggestion = None;
                 let item_kind = if is_method {
@@ -239,7 +233,7 @@ pub fn report_method_error(&self,
                             "can't call {} `{}` on ambiguous numeric type `{}`",
                             item_kind,
                             item_name,
-                            ty_string
+                            ty_str
                         );
                         let concrete_type = if actual.is_integral() {
                             "i32"
@@ -247,7 +241,8 @@ pub fn report_method_error(&self,
                             "f32"
                         };
                         match expr.node {
-                            hir::ExprKind::Lit(ref lit) => { // numeric literal
+                            hir::ExprKind::Lit(ref lit) => {
+                                // numeric literal
                                 let snippet = tcx.sess.source_map().span_to_snippet(lit.span)
                                     .unwrap_or_else(|_| "<numeric literal>".to_owned());
 
@@ -262,7 +257,8 @@ pub fn report_method_error(&self,
                                                     Applicability::MaybeIncorrect,
                                 );
                             }
-                            hir::ExprKind::Path(ref qpath) => {  // local binding
+                            hir::ExprKind::Path(ref qpath) => {
+                                // local binding
                                 if let &hir::QPath::Resolved(_, ref path) = &qpath {
                                     if let hir::def::Def::Local(node_id) = path.def {
                                         let span = tcx.hir().span(node_id);
@@ -339,7 +335,7 @@ pub fn report_method_error(&self,
                 }
 
                 // If the method name is the name of a field with a function or closure type,
-                // give a helping note that it has to be called as (x.f)(...).
+                // give a helping note that it has to be called as `(x.f)(...)`.
                 if let Some(expr) = rcvr_expr {
                     for (ty, _) in self.autoderef(span, rcvr_ty) {
                         if let ty::Adt(def, substs) = ty.sty {
@@ -351,8 +347,8 @@ pub fn report_method_error(&self,
                                     let expr_string = match snippet {
                                         Ok(expr_string) => expr_string,
                                         _ => "s".into(), // Default to a generic placeholder for the
-                                        // expression when we can't generate a
-                                        // string snippet
+                                                         // expression when we can't generate a
+                                                         // string snippet.
                                     };
 
                                     let field_ty = field.ty(tcx, substs);
@@ -380,7 +376,7 @@ pub fn report_method_error(&self,
                         }
                     }
                 } else {
-                    err.span_label(span, format!("{} not found in `{}`", item_kind, ty_string));
+                    err.span_label(span, format!("{} not found in `{}`", item_kind, ty_str));
                 }
 
                 if self.is_fn_ty(&rcvr_ty, span) {
@@ -424,7 +420,6 @@ macro_rules! report_function {
 
                     report_candidates(&mut err, static_sources);
                 } else if static_sources.len() > 1 {
-
                     report_candidates(&mut err, static_sources);
                 }
 
@@ -509,7 +504,7 @@ fn suggest_use_candidates(&self,
         let (span, found_use) = UsePlacementFinder::check(self.tcx, krate, module_id);
         if let Some(span) = span {
             let path_strings = candidates.iter().map(|did| {
-                // 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 {
                     ""
@@ -597,15 +592,15 @@ fn suggest_traits_to_import(&self,
 
         let type_is_local = self.type_derefs_to_local(span, rcvr_ty, rcvr_expr);
 
-        // there's no implemented traits, so lets suggest some traits to
+        // There are no traits implemented, so lets suggest some traits to
         // implement, by finding ones that have the item name, and are
         // legal to implement.
         let mut candidates = all_traits(self.tcx)
             .into_iter()
             .filter(|info| {
-                // we approximate the coherence rules to only suggest
+                // We approximate the coherence rules to only suggest
                 // traits that are legal to implement by requiring that
-                // either the type or trait is local. Multidispatch means
+                // either the type or trait is local. Multi-dispatch means
                 // this isn't perfect (that is, there are cases when
                 // implementing a trait would be legal but is rejected
                 // here).
@@ -620,11 +615,11 @@ fn suggest_traits_to_import(&self,
             .collect::<Vec<_>>();
 
         if !candidates.is_empty() {
-            // sort from most relevant to least relevant
+            // Sort from most relevant to least relevant.
             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");
@@ -656,8 +651,7 @@ fn suggest_traits_to_import(&self,
     fn type_derefs_to_local(&self,
                             span: Span,
                             rcvr_ty: Ty<'tcx>,
-                            rcvr_expr: Option<&hir::Expr>)
-                            -> bool {
+                            source: SelfSource) -> bool {
         fn is_local(ty: Ty) -> bool {
             match ty.sty {
                 ty::Adt(def, _) => def.did.is_local(),
@@ -667,8 +661,8 @@ fn is_local(ty: Ty) -> bool {
 
                 ty::Param(_) => true,
 
-                // everything else (primitive types etc.) is effectively
-                // non-local (there are "edge" cases, e.g. (LocalType,), but
+                // Everything else (primitive types, etc.) is effectively
+                // non-local (there are "edge" cases, e.g., `(LocalType,)`, but
                 // the noise from these sort of types is usually just really
                 // annoying, rather than any sort of help).
                 _ => false,
@@ -703,8 +697,8 @@ fn partial_cmp(&self, other: &TraitInfo) -> Option<Ordering> {
 }
 impl Ord for TraitInfo {
     fn cmp(&self, other: &TraitInfo) -> Ordering {
-        // local crates are more important than remote ones (local:
-        // cnum == 0), and otherwise we throw in the defid for totality
+        // Local crates are more important than remote ones (local:
+        // `cnum == 0`), and otherwise we throw in the defid for totality.
 
         let lhs = (other.def_id.krate, other.def_id);
         let rhs = (self.def_id.krate, self.def_id);
@@ -719,65 +713,65 @@ pub fn all_traits<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Vec<TraitInfo>
 
 /// Compute all traits in this crate and any dependent crates.
 fn compute_all_traits<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Vec<DefId> {
-        use rustc::hir::itemlikevisit;
+    use hir::itemlikevisit;
 
-        let mut traits = vec![];
+    let mut traits = vec![];
 
-        // Crate-local:
-        //
-        // meh.
-        struct Visitor<'a, 'tcx: 'a> {
-            map: &'a hir_map::Map<'tcx>,
-            traits: &'a mut Vec<DefId>,
-        }
-        impl<'v, 'a, 'tcx> itemlikevisit::ItemLikeVisitor<'v> for Visitor<'a, 'tcx> {
-            fn visit_item(&mut self, i: &'v hir::Item) {
-                if let hir::ItemKind::Trait(..) = i.node {
-                    let def_id = self.map.local_def_id(i.id);
-                    self.traits.push(def_id);
-                }
-            }
+    // Crate-local:
 
-            fn visit_trait_item(&mut self, _trait_item: &hir::TraitItem) {
-            }
+    struct Visitor<'a, 'tcx: 'a> {
+        map: &'a hir_map::Map<'tcx>,
+        traits: &'a mut Vec<DefId>,
+    }
 
-            fn visit_impl_item(&mut self, _impl_item: &hir::ImplItem) {
+    impl<'v, 'a, 'tcx> itemlikevisit::ItemLikeVisitor<'v> for Visitor<'a, 'tcx> {
+        fn visit_item(&mut self, i: &'v hir::Item) {
+            if let hir::ItemKind::Trait(..) = i.node {
+                let def_id = self.map.local_def_id(i.id);
+                self.traits.push(def_id);
             }
         }
-        tcx.hir().krate().visit_all_item_likes(&mut Visitor {
-            map: &tcx.hir(),
-            traits: &mut traits,
-        });
-
-        // Cross-crate:
-        let mut external_mods = FxHashSet::default();
-        fn handle_external_def(tcx: TyCtxt,
-                               traits: &mut Vec<DefId>,
-                               external_mods: &mut FxHashSet<DefId>,
-                               def: Def) {
-            let def_id = def.def_id();
-            match def {
-                Def::Trait(..) => {
-                    traits.push(def_id);
+
+        fn visit_trait_item(&mut self, _trait_item: &hir::TraitItem) {}
+
+        fn visit_impl_item(&mut self, _impl_item: &hir::ImplItem) {}
+    }
+
+    tcx.hir().krate().visit_all_item_likes(&mut Visitor {
+        map: &tcx.hir(),
+        traits: &mut traits,
+    });
+
+    // Cross-crate:
+
+    let mut external_mods = FxHashSet::default();
+    fn handle_external_def(tcx: TyCtxt,
+                           traits: &mut Vec<DefId>,
+                           external_mods: &mut FxHashSet<DefId>,
+                           def: Def) {
+        let def_id = def.def_id();
+        match def {
+            Def::Trait(..) => {
+                traits.push(def_id);
+            }
+            Def::Mod(..) => {
+                if !external_mods.insert(def_id) {
+                    return;
                 }
-                Def::Mod(..) => {
-                    if !external_mods.insert(def_id) {
-                        return;
-                    }
-                    for child in tcx.item_children(def_id).iter() {
-                        handle_external_def(tcx, traits, external_mods, child.def)
-                    }
+                for child in tcx.item_children(def_id).iter() {
+                    handle_external_def(tcx, traits, external_mods, child.def)
                 }
-                _ => {}
             }
+            _ => {}
         }
-        for &cnum in tcx.crates().iter() {
-            let def_id = DefId {
-                krate: cnum,
-                index: CRATE_DEF_INDEX,
-            };
-            handle_external_def(tcx, &mut traits, &mut external_mods, Def::Mod(def_id));
-        }
+    }
+    for &cnum in tcx.crates().iter() {
+        let def_id = DefId {
+            krate: cnum,
+            index: CRATE_DEF_INDEX,
+        };
+        handle_external_def(tcx, &mut traits, &mut external_mods, Def::Mod(def_id));
+    }
 
     traits
 }
@@ -827,29 +821,29 @@ fn visit_mod(
             hir::intravisit::walk_mod(self, module, node_id);
             return;
         }
-        // find a use statement
+        // Find a `use` statement.
         for item_id in &module.item_ids {
             let item = self.tcx.hir().expect_item(item_id.id);
             match item.node {
                 hir::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`...
                 hir::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());
@@ -861,6 +855,7 @@ fn visit_mod(
             }
         }
     }
+
     fn nested_visit_map<'this>(
         &'this mut self
     ) -> hir::intravisit::NestedVisitorMap<'this, 'tcx> {
index 3116f1aecfee65c79de95b6901e11eaf607acdb7..8901f4b6b291bdf2f68b08d88e60fb166999d129 100644 (file)
@@ -8,14 +8,13 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-/*
+/*!
 
 # check.rs
 
 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
-function).  Inference is used to supply types wherever they are
-unknown.
+function). Inference is used to supply types wherever they are unknown.
 
 By far the most complex case is checking the body of a function. This
 can be broken down into several distinct phases:
@@ -65,7 +64,7 @@
 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: T)`: while checking the
 function `foo`, the type `ty_param(0)` refers to the type `T`, which
 
 */
 
-pub use self::Expectation::*;
-use self::autoderef::Autoderef;
-use self::callee::DeferredCallResolution;
-use self::coercion::{CoerceMany, DynamicCoerceMany};
-pub use self::compare_method::{compare_impl_method, compare_const_impl};
-use self::method::MethodCallee;
-use self::TupleArgumentsFlag::*;
+mod autoderef;
+pub mod dropck;
+pub mod _match;
+pub mod writeback;
+mod regionck;
+pub mod coercion;
+pub mod demand;
+pub mod method;
+mod upvar;
+mod wfcheck;
+mod cast;
+mod closure;
+mod callee;
+mod compare_method;
+mod generator_interior;
+mod intrinsic;
+mod op;
 
 use astconv::AstConv;
-use hir::GenericArg;
-use hir::def::Def;
-use hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
-use std::slice;
+use errors::{Applicability, DiagnosticBuilder, DiagnosticId};
+use rustc::hir::{self, GenericArg, Node, ItemKind, PatKind};
+use rustc::hir::def::Def;
+use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
+use rustc::hir::intravisit::{self, Visitor, NestedVisitorMap};
+use rustc::hir::itemlikevisit::ItemLikeVisitor;
+use middle::lang_items;
 use namespace::Namespace;
+use rustc_data_structures::indexed_vec::Idx;
+use rustc_data_structures::sync::Lrc;
+use rustc_target::spec::abi::Abi;
 use rustc::infer::{self, InferCtxt, InferOk, RegionVariableOrigin};
 use rustc::infer::opaque_types::OpaqueTypeDecl;
 use rustc::infer::type_variable::{TypeVariableOrigin};
 use rustc::ty::query::Providers;
 use rustc::ty::util::{Representability, IntTypeExt, Discr};
 use rustc::ty::layout::VariantIdx;
-use rustc_data_structures::indexed_vec::Idx;
-use errors::{Applicability, DiagnosticBuilder, DiagnosticId};
-
-use require_c_abi_if_variadic;
-use session::{CompileIncomplete, config, Session};
-use TypeAndSubsts;
-use lint;
-use util::common::{ErrorReported, indenter};
-use util::nodemap::{DefIdMap, DefIdSet, FxHashMap, FxHashSet, NodeMap};
+use syntax_pos::{self, BytePos, Span, MultiSpan};
+use syntax::ast;
+use syntax::attr;
+use syntax::feature_gate::{GateIssue, emit_feature_err};
+use syntax::ptr::P;
+use syntax::source_map::{DUMMY_SP, original_sp};
+use syntax::symbol::{Symbol, LocalInternedString, keywords};
+use syntax::util::lev_distance::find_best_match_for_name;
 
 use std::cell::{Cell, RefCell, Ref, RefMut};
-use rustc_data_structures::sync::Lrc;
 use std::collections::hash_map::Entry;
 use std::cmp;
 use std::fmt::Display;
 use std::iter;
 use std::mem::replace;
 use std::ops::{self, Deref};
-use rustc_target::spec::abi::Abi;
-use syntax::ast;
-use syntax::attr;
-use syntax::source_map::DUMMY_SP;
-use syntax::source_map::original_sp;
-use syntax::feature_gate::{GateIssue, emit_feature_err};
-use syntax::ptr::P;
-use syntax::symbol::{Symbol, LocalInternedString, keywords};
-use syntax::util::lev_distance::find_best_match_for_name;
-use syntax_pos::{self, BytePos, Span, MultiSpan};
+use std::slice;
 
-use rustc::hir::intravisit::{self, Visitor, NestedVisitorMap};
-use rustc::hir::itemlikevisit::ItemLikeVisitor;
-use rustc::hir::Node;
-use rustc::hir::{self, PatKind, ItemKind};
-use rustc::middle::lang_items;
+use require_c_abi_if_variadic;
+use session::{CompileIncomplete, config, Session};
+use TypeAndSubsts;
+use lint;
+use util::common::{ErrorReported, indenter};
+use util::nodemap::{DefIdMap, DefIdSet, FxHashMap, FxHashSet, NodeMap};
 
-mod autoderef;
-pub mod dropck;
-pub mod _match;
-pub mod writeback;
-mod regionck;
-pub mod coercion;
-pub mod demand;
-pub mod method;
-mod upvar;
-mod wfcheck;
-mod cast;
-mod closure;
-mod callee;
-mod compare_method;
-mod generator_interior;
-mod intrinsic;
-mod op;
+pub use self::Expectation::*;
+use self::autoderef::Autoderef;
+use self::callee::DeferredCallResolution;
+use self::coercion::{CoerceMany, DynamicCoerceMany};
+pub use self::compare_method::{compare_impl_method, compare_const_impl};
+use self::method::MethodCallee;
+use self::TupleArgumentsFlag::*;
 
 /// The type of a local binding, including the revealed type for anon types.
 #[derive(Copy, Clone)]
@@ -2858,10 +2853,10 @@ fn check_argument_types(&self,
                formal_tys.iter().map(|t| self.ty_to_string(*t)).collect::<Vec<String>>());
 
         // Check the arguments.
-        // We do this in a pretty awful way: first we typecheck any arguments
-        // that are not closures, then we typecheck the closures. This is so
+        // We do this in a pretty awful way: first we type-check any arguments
+        // that are not closures, then we type-check the closures. This is so
         // that we have more information about the types of arguments when we
-        // typecheck the functions. This isn't really the right way to do this.
+        // type-check the functions. This isn't really the right way to do this.
         for &check_closures in &[false, true] {
             debug!("check_closures={}", check_closures);
 
@@ -2885,7 +2880,7 @@ fn check_argument_types(&self,
             for (i, arg) in args.iter().take(t).enumerate() {
                 // Warn only for the first loop (the "no closures" one).
                 // Closure arguments themselves can't be diverging, but
-                // a previous argument can, e.g. `foo(panic!(), || {})`.
+                // a previous argument can, e.g., `foo(panic!(), || {})`.
                 if !check_closures {
                     self.warn_if_unreachable(arg.id, arg.span, "expression");
                 }
@@ -3092,9 +3087,9 @@ fn check_expr_with_needs(&self, expr: &'gcx hir::Expr, needs: Needs) -> Ty<'tcx>
         self.check_expr_with_expectation_and_needs(expr, NoExpectation, needs)
     }
 
-    // determine the `self` type, using fresh variables for all variables
+    // Determine the `Self` type, using fresh variables for all variables
     // declared on the impl declaration e.g., `impl<A,B> for Vec<(A,B)>`
-    // would return ($0, $1) where $0 and $1 are freshly instantiated type
+    // would return `($0, $1)` where `$0` and `$1` are freshly instantiated type
     // variables.
     pub fn impl_self_ty(&self,
                         span: Span, // (potential) receiver for this impl
@@ -3539,16 +3534,16 @@ fn check_expr_struct_fields(&self,
 
         let mut error_happened = false;
 
-        // Typecheck each field.
+        // Type-check each field.
         for field in ast_fields {
             let ident = tcx.adjust_ident(field.ident, variant.did, self.body_id).0;
             let field_type = if let Some((i, v_field)) = remaining_fields.remove(&ident) {
                 seen_fields.insert(ident, field.span);
                 self.write_field_index(field.id, i);
 
-                // we don't look at stability attributes on
+                // We don't look at stability attributes on
                 // struct-like enums (yet...), but it's definitely not
-                // a bug to have construct one.
+                // a bug to have constructed one.
                 if adt_kind != ty::AdtKind::Enum {
                     tcx.check_stability(v_field.did, Some(expr_id), field.span);
                 }
@@ -3575,7 +3570,7 @@ fn check_expr_struct_fields(&self,
             };
 
             // Make sure to give a type to the field even if there's
-            // an error, so we can continue typechecking
+            // an error, so we can continue type-checking.
             self.check_expr_coercable_to_type(&field.expr, field_type);
         }
 
@@ -3707,7 +3702,7 @@ fn check_expr_struct(&self,
             hir::QPath::TypeRelative(ref qself, _) => qself.span
         };
 
-        // Prohibit struct expressions when non exhaustive flag is set.
+        // Prohibit struct expressions when non-exhaustive flag is set.
         let adt = adt_ty.ty_adt_def().expect("`check_struct_path` returned non-ADT type");
         if !adt.did.is_local() && variant.is_field_list_non_exhaustive() {
             span_err!(self.tcx.sess, expr.span, E0639,
@@ -3760,7 +3755,7 @@ fn check_expr_with_expectation_and_needs(&self,
                                              expr: &'gcx hir::Expr,
                                              expected: Expectation<'tcx>,
                                              needs: Needs) -> Ty<'tcx> {
-        debug!(">> typechecking: expr={:?} expected={:?}",
+        debug!(">> type-checking: expr={:?} expected={:?}",
                expr, expected);
 
         // Warn for expressions after diverging siblings.
@@ -3962,7 +3957,7 @@ fn check_expr_kind(
                     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);
@@ -4086,7 +4081,7 @@ fn check_expr_kind(
                             }
                         }
                     }
-                    // There was an error, make typecheck fail
+                    // There was an error; make type-check fail.
                     tcx.types.err
                 }
 
@@ -4095,7 +4090,7 @@ fn check_expr_kind(
                 if destination.target_id.is_ok() {
                     tcx.types.never
                 } else {
-                    // There was an error, make typecheck fail
+                    // There was an error; make type-check fail.
                     tcx.types.err
                 }
             }
@@ -4413,7 +4408,7 @@ fn check_expr_kind(
                                 }
                                 if needs_note {
                                     err.help("to access tuple elements, use tuple indexing \
-                                              syntax (e.g. `tuple.0`)");
+                                              syntax (e.g., `tuple.0`)");
                                 }
                             }
                             err.emit();
@@ -5249,7 +5244,7 @@ pub fn instantiate_value_path(&self,
         assert!(!substs.has_escaping_bound_vars());
         assert!(!ty.has_escaping_bound_vars());
 
-        // Write the "user substs" down first thing for later.
+        // First, store the "user substs" for later.
         let hir_id = self.tcx.hir().node_to_hir_id(node_id);
         self.write_user_substs_from_substs(hir_id, substs, user_self_ty);
 
index 54f4406b4afc4ed175b4991d1c9b9a55e81be490..c40789ce8bae0b3242f5e462852ea2cd598963f1 100644 (file)
@@ -170,7 +170,7 @@ fn check_overloaded_binop(&self,
                 // Find a suitable supertype of the LHS expression's type, by coercing to
                 // a type variable, to pass as the `Self` to the trait, avoiding invariant
                 // trait matching creating lifetime constraints that are too strict.
-                // E.g. adding `&'a T` and `&'b T`, given `&'x T: Add<&'x T>`, will result
+                // e.g., adding `&'a T` and `&'b T`, given `&'x T: Add<&'x T>`, will result
                 // in `&'a T <: &'x T` and `&'b T <: &'x T`, instead of `'a = 'b = 'x`.
                 let lhs_ty = self.check_expr_with_needs(lhs_expr, Needs::None);
                 let fresh_var = self.next_ty_var(TypeVariableOrigin::MiscVariable(lhs_expr.span));
@@ -186,7 +186,7 @@ fn check_overloaded_binop(&self,
         };
         let lhs_ty = self.resolve_type_vars_with_obligations(lhs_ty);
 
-        // NB: As we have not yet type-checked the RHS, we don't have the
+        // N.B., as we have not yet type-checked the RHS, we don't have the
         // type at hand. Make a variable to represent it. The whole reason
         // for this indirection is so that, below, we can check the expr
         // using this variable as the expected type, which sometimes lets
@@ -318,7 +318,7 @@ fn check_overloaded_binop(&self,
                                     self.check_str_addition(expr, lhs_expr, rhs_expr, lhs_ty,
                                                             rhs_ty, &mut err, true) {
                                     // This has nothing here because it means we did string
-                                    // concatenation (e.g. "Hello " += "World!"). This means
+                                    // concatenation (e.g., "Hello " += "World!"). This means
                                     // we don't want the note in the else clause to be emitted
                                 } else if let ty::Param(_) = lhs_ty.sty {
                                     // FIXME: point to span of param
@@ -392,7 +392,7 @@ fn check_overloaded_binop(&self,
                                     self.check_str_addition(expr, lhs_expr, rhs_expr, lhs_ty,
                                                             rhs_ty, &mut err, false) {
                                     // This has nothing here because it means we did string
-                                    // concatenation (e.g. "Hello " + "World!"). This means
+                                    // concatenation (e.g., "Hello " + "World!"). This means
                                     // we don't want the note in the else clause to be emitted
                                 } else if let ty::Param(_) = lhs_ty.sty {
                                     // FIXME: point to span of param
@@ -682,7 +682,7 @@ enum Op {
     Unary(hir::UnOp, Span),
 }
 
-/// Returns true if this is a built-in arithmetic operation (e.g. u32
+/// Returns true if 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
index bdb2a9a8af13482e612e92891d0812ed734fb8da..2d5dcf0ec1b6dbe311f45260eebcfc5ba9634992 100644 (file)
@@ -469,7 +469,7 @@ pub fn coerce_unsized_info<'a, 'gcx>(gcx: TyCtxt<'a, 'gcx, 'gcx>,
                         // variance where possible. (This is because
                         // we may have to evaluate constraint
                         // expressions in the course of execution.)
-                        // See e.g. #41936.
+                        // See e.g., #41936.
                         if let Ok(ok) = infcx.at(&cause, param_env).eq(a, b) {
                             if ok.obligations.is_empty() {
                                 return None;
@@ -477,7 +477,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::<Vec<_>>();
index b92916d9c81c19acf91b8541604c8d6512e6b090..0360617be3c491776b5f3d94245367e74ff6108d 100644 (file)
@@ -40,7 +40,7 @@ fn check_impl<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, node_id: ast::NodeId) {
                tcx.item_path_str(impl_def_id));
 
         // Skip impls where one of the self type is an error type.
-        // This occurs with e.g. resolve failures (#30589).
+        // This occurs with e.g., resolve failures (#30589).
         if trait_ref.references_error() {
             return;
         }
index 47edf59f0ad9845896c5dba4631d23ea40dd91e6..131413eb402d4ad3fc6d9a99592dc9e39635266a 100644 (file)
@@ -60,7 +60,7 @@ fn visit_item(&mut self, item: &hir::Item) {
                                      sp,
                                      E0210,
                                      "type parameter `{}` must be used as the type parameter \
-                                      for some local type (e.g. `MyStruct<{}>`)",
+                                      for some local type (e.g., `MyStruct<{}>`)",
                                      param_ty,
                                      param_ty)
                         .span_label(sp,
index 9104c15bdd5a25559089d6a59aad3ad8945b9333..3b8b6d47d913085d873533b22e1dbf90200dc374 100644 (file)
@@ -97,7 +97,7 @@ pub fn provide(providers: &mut Providers) {
 /// 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
+/// process. So we can't just store a pointer to e.g., the AST or the
 /// parsed ty form, we have to be more flexible. To this end, the
 /// `ItemCtxt` is parameterized by a `DefId` that it uses to satisfy
 /// `get_type_parameter_bounds` requests, drawing the information from
@@ -704,16 +704,16 @@ 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<Self>` would include `u32: PartialEq<Self>`
+    // so e.g., `trait Foo = where u32: PartialEq<Self>` would include `u32: PartialEq<Self>`
     // as one of its "superpredicates".
     let is_trait_alias = ty::is_trait_alias(tcx, trait_def_id);
     let superbounds2 = icx.type_parameter_bounds_in_generics(
@@ -1715,7 +1715,7 @@ fn extend<I: IntoIterator<Item = (ty::Predicate<'tcx>, Span)>>(&mut self, iter:
                 let substs = Substs::identity_for_item(tcx, def_id);
                 let opaque_ty = tcx.mk_opaque(def_id, substs);
 
-                // Collect the bounds, i.e. the `A+B+'c` in `impl A+B+'c`.
+                // Collect the bounds, i.e., the `A+B+'c` in `impl A+B+'c`.
                 let bounds = compute_bounds(
                     &icx,
                     opaque_ty,
@@ -1760,7 +1760,7 @@ fn extend<I: IntoIterator<Item = (ty::Predicate<'tcx>, Span)>>(&mut self, iter:
                     let substs = Substs::identity_for_item(tcx, def_id);
                     let opaque_ty = tcx.mk_opaque(def_id, substs);
 
-                    // Collect the bounds, i.e. the `A+B+'c` in `impl A+B+'c`.
+                    // Collect the bounds, i.e., the `A+B+'c` in `impl A+B+'c`.
                     let bounds = compute_bounds(
                         &icx,
                         opaque_ty,
index 9299e9b7b8f159ddbfe14c943c1f5f06bde20259..25fa33ef9fa4e5f0467ae6bce22aa4b20a621c89 100644 (file)
@@ -37,7 +37,7 @@ pub fn parameters_for_impl<'tcx>(impl_self_ty: Ty<'tcx>,
 }
 
 /// If `include_projections` is false, returns the list of parameters that are
-/// constrained by `t` - i.e. the value of each parameter in the list is
+/// constrained by `t` - i.e., the value of each parameter in the list is
 /// uniquely determined by `t` (see RFC 447). If it is true, return the list
 /// of parameters whose values are needed in order to constrain `ty` - these
 /// differ, with the latter being a superset, in the presence of projections.
index 084951f4a2c168bf0b0af6d85cdd5da5fbf3a1cc..a0dbaf5ad504bcd60ddf74fa038a3caf94f71628 100644 (file)
@@ -655,7 +655,7 @@ fn foo<F: Fn<(i32,)>>(f: F) -> F::Output { f(3) }
 fn f(a: u16, b: &str) {}
 ```
 
-Must always be called with exactly two arguments, e.g. `f(2, "test")`.
+Must always be called with exactly two arguments, e.g., `f(2, "test")`.
 
 Note that Rust does not have a notion of optional function arguments or
 variadic functions (except for its C-FFI).
@@ -1610,7 +1610,7 @@ fn bar(foo: Foo) -> u32 {
 
 E0185: r##"
 An associated function for a trait was defined to be static, but an
-implementation of the trait declared the same function to be a method (i.e. to
+implementation of the trait declared the same function to be a method (i.e., to
 take a `self` parameter).
 
 Here's an example of this error:
@@ -1631,7 +1631,7 @@ fn foo(&self) {}
 "##,
 
 E0186: r##"
-An associated function for a trait was defined to be a method (i.e. to take a
+An associated function for a trait was defined to be a method (i.e., to take a
 `self` parameter), but an implementation of the trait declared the same function
 to be static.
 
index ae3cfbb9b3716799460cf3b5ee1ab89bcb6bcfa4..8d6fb8b7f39485c43e938887e94391c8afdc40f5 100644 (file)
 
 /*!
 
-typeck.rs, an introduction
+# typeck.rs
 
 The type checker is responsible for:
 
-1. Determining the type of each expression
-2. Resolving methods and traits
-3. Guaranteeing that most type rules are met ("most?", you say, "why most?"
+1. Determining the type of each expression.
+2. Resolving methods and traits.
+3. Guaranteeing that most type rules are met. ("Most?", you say, "why most?"
    Well, dear reader, read on)
 
-The main entry point is `check_crate()`.  Type checking operates in
+The main entry point is `check_crate()`. Type checking operates in
 several major phases:
 
 1. The collect phase first passes over all items and determines their
    type, without examining their "innards".
 
-2. Variance inference then runs to compute the variance of each parameter
+2. Variance inference then runs to compute the variance of each parameter.
 
-3. Coherence checks for overlapping or orphaned impls
+3. Coherence checks for overlapping or orphaned impls.
 
 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
 independently:
 
 - astconv: converts the AST representation of types
-  into the `ty` representation
+  into the `ty` representation.
 
 - collect: computes the types of each top-level item and enters them into
-  the `tcx.types` table for later use
+  the `tcx.types` table for later use.
 
-- coherence: enforces coherence rules, builds some tables
+- coherence: enforces coherence rules, builds some tables.
 
 - variance: variance inference
 
@@ -59,7 +59,7 @@
   all subtyping and assignment constraints are met.  In essence, the check
   module specifies the constraints, and the infer module solves them.
 
-# Note
+## Note
 
 This API is completely unstable and subject to change.
 
 extern crate rustc_target;
 extern crate smallvec;
 
-use rustc::hir;
-use rustc::lint;
-use rustc::middle;
-use rustc::session;
-use rustc::util;
-
-use hir::Node;
-use rustc::infer::InferOk;
-use rustc::ty::subst::Substs;
-use rustc::ty::{self, Ty, TyCtxt};
-use rustc::ty::query::Providers;
-use rustc::traits::{ObligationCause, ObligationCauseCode, TraitEngine, TraitEngineExt};
-use rustc::util::profiling::ProfileCategory;
-use session::{CompileIncomplete, config};
-use util::common::time;
-
-use syntax::ast;
-use rustc_target::spec::abi::Abi;
-use syntax_pos::Span;
-
-use std::iter;
-
-// NB: This module needs to be declared first so diagnostics are
+// N.B., this module needs to be declared first so diagnostics are
 // registered before they are used.
 mod diagnostics;
 
 mod outlives;
 mod variance;
 
+use hir::Node;
+use rustc_target::spec::abi::Abi;
+use rustc::hir;
+use rustc::infer::InferOk;
+use rustc::lint;
+use rustc::middle;
+use rustc::session;
+use rustc::traits::{ObligationCause, ObligationCauseCode, TraitEngine, TraitEngineExt};
+use rustc::ty::subst::Substs;
+use rustc::ty::{self, Ty, TyCtxt};
+use rustc::ty::query::Providers;
+use rustc::util;
+use rustc::util::profiling::ProfileCategory;
+use session::{CompileIncomplete, config};
+use syntax_pos::Span;
+use syntax::ast;
+use util::common::time;
+
+use std::iter;
+
 pub struct TypeAndSubsts<'tcx> {
     substs: &'tcx Substs<'tcx>,
     ty: Ty<'tcx>,
index 5f010875842869e287f757efcf7f832fb6493e9c..315e5feea3fcfb4e55d256d903789b6a0523b7b2 100644 (file)
@@ -314,7 +314,7 @@ pub fn check_explicit_predicates<'tcx>(
         // case that `substs` come from a `dyn Trait` type, our caller will have
         // included `Self = usize` as the value for `Self`. If we were
         // to apply the substs, and not filter this predicate, we might then falsely
-        // conclude that e.g. `X: 'x` was a reasonable inferred requirement.
+        // conclude that e.g., `X: 'x` was a reasonable inferred requirement.
         //
         // Another similar case is where we have a inferred
         // requirement like `<Self as Trait>::Foo: 'b`. We presently
index ee554ee684d128caa978a7877fcbd02d1959ff45..6ea919469e04bf7fe1e5a9f821f2e3d421264d80 100644 (file)
@@ -44,7 +44,7 @@ pub struct Constraint<'a> {
 }
 
 /// To build constraints, we visit one item (type, trait) at a time
-/// and look at its contents. So e.g. if we have
+/// and look at its contents. So e.g., if we have
 ///
 ///     struct Foo<T> {
 ///         b: Bar<T>
index 6d45b1876244eade5820e9b22ed3de022608d3e2..75ff5bb0c5405ebf7e77df274d74af4f2fb147c7 100644 (file)
@@ -125,7 +125,7 @@ fn add_inferreds_for_item(&mut self, id: ast::NodeId) {
         let newly_added = self.inferred_starts.insert(id, InferredIndex(start)).is_none();
         assert!(newly_added);
 
-        // NB: In the code below for writing the results back into the
+        // N.B., in the code below for writing the results back into the
         // `CrateVariancesMap`, we rely on the fact that all inferreds
         // for a particular item are assigned continuous indices.
 
index 543df844cb86ec217fb555fb34568d4ec3b1428d..ac9680b4570c69eaa58b26dc4b878911e5ddfd6b 100644 (file)
@@ -255,7 +255,7 @@ fn region_name(&self, region: Region) -> Option<String> {
     // handle_lifetimes determines what *needs be* true in order for an impl to hold.
     // lexical_region_resolve, along with much of the rest of the compiler, is concerned
     // with determining if a given set up constraints/predicates *are* met, given some
-    // starting conditions (e.g. user-provided code). For this reason, it's easier
+    // starting conditions (e.g., user-provided code). For this reason, it's easier
     // to perform the calculations we need on our own, rather than trying to make
     // existing inference/solver code do what we want.
     fn handle_lifetimes<'cx>(
@@ -274,7 +274,7 @@ fn handle_lifetimes<'cx>(
         // Flattening is done in two parts. First, we insert all of the constraints
         // into a map. Each RegionTarget (either a RegionVid or a Region) maps
         // to its smaller and larger regions. Note that 'larger' regions correspond
-        // to sub-regions in Rust code (e.g. in 'a: 'b, 'a is the larger region).
+        // to sub-regions in Rust code (e.g., in 'a: 'b, 'a is the larger region).
         for constraint in regions.constraints.keys() {
             match constraint {
                 &Constraint::VarSubVar(r1, r2) => {
@@ -524,7 +524,7 @@ fn make_final_bounds<'b, 'c, 'cx>(
     // display on the docs page. Cleaning the Predicates produces sub-optimal WherePredicate's,
     // so we fix them up:
     //
-    // * Multiple bounds for the same type are coalesced into one: e.g. 'T: Copy', 'T: Debug'
+    // * Multiple bounds for the same type are coalesced into one: e.g., 'T: Copy', 'T: Debug'
     // becomes 'T: Copy + Debug'
     // * Fn bounds are handled specially - instead of leaving it as 'T: Fn(), <T as Fn::Output> =
     // K', we use the dedicated syntax 'T: Fn() -> K'
@@ -545,7 +545,7 @@ fn param_env_to_generics<'b, 'c, 'cx>(
         );
 
         // The `Sized` trait must be handled specially, since we only only display it when
-        // it is *not* required (i.e. '?Sized')
+        // it is *not* required (i.e., '?Sized')
         let sized_trait = self.cx
             .tcx
             .require_lang_item(lang_items::SizedTraitLangItem);
@@ -629,7 +629,7 @@ fn param_env_to_generics<'b, 'c, 'cx>(
                         let is_fn = match &mut b {
                             &mut GenericBound::TraitBound(ref mut p, _) => {
                                 // Insert regions into the for_generics hash map first, to ensure
-                                // that we don't end up with duplicate bounds (e.g. for<'b, 'b>)
+                                // that we don't end up with duplicate bounds (e.g., for<'b, 'b>)
                                 for_generics.extend(p.generic_params.clone());
                                 p.generic_params = for_generics.into_iter().collect();
                                 self.is_fn_ty(&tcx, &p.trait_)
@@ -737,7 +737,7 @@ fn param_env_to_generics<'b, 'c, 'cx>(
                                         hir::TraitBoundModifier::None,
                                     ));
 
-                                    // Remove any existing 'plain' bound (e.g. 'T: Iterator`) so
+                                    // Remove any existing 'plain' bound (e.g., 'T: Iterator`) so
                                     // that we don't see a
                                     // duplicate bound like `T: Iterator + Iterator<Item=u8>`
                                     // on the docs page.
@@ -837,7 +837,7 @@ fn sort_where_bounds(&self, mut bounds: &mut Vec<GenericBound>) {
     // auto-trait impls always render in exactly the same way.
     //
     // Using the Debug implementation for sorting prevents us from needing to
-    // write quite a bit of almost entirely useless code (e.g. how should two
+    // write quite a bit of almost entirely useless code (e.g., how should two
     // Types be sorted relative to each other). It also allows us to solve the
     // problem for both WherePredicates and GenericBounds at the same time. This
     // approach is probably somewhat slower, but the small number of items
index f90f1e54da22c375c4f43559e39e492499295c7e..847786d123efc5cd28919880d9534309aeb7f673 100644 (file)
@@ -31,13 +31,13 @@ pub enum Cfg {
     True,
     /// Denies all configurations.
     False,
-    /// A generic configuration option, e.g. `test` or `target_os = "linux"`.
+    /// A generic configuration option, e.g., `test` or `target_os = "linux"`.
     Cfg(Symbol, Option<Symbol>),
-    /// Negate a configuration requirement, i.e. `not(x)`.
+    /// Negate a configuration requirement, i.e., `not(x)`.
     Not(Box<Cfg>),
-    /// Union of a list of configuration requirements, i.e. `any(...)`.
+    /// Union of a list of configuration requirements, i.e., `any(...)`.
     Any(Vec<Cfg>),
-    /// Intersection of a list of configuration requirements, i.e. `all(...)`.
+    /// Intersection of a list of configuration requirements, i.e., `all(...)`.
     All(Vec<Cfg>),
 }
 
@@ -61,7 +61,7 @@ fn parse_nested(nested_cfg: &NestedMetaItem) -> Result<Cfg, InvalidCfgError> {
 
     /// Parses a `MetaItem` into a `Cfg`.
     ///
-    /// The `MetaItem` should be the content of the `#[cfg(...)]`, e.g. `unix` or
+    /// The `MetaItem` should be the content of the `#[cfg(...)]`, e.g., `unix` or
     /// `target_os = "redox"`.
     ///
     /// If the content is not properly formatted, it will return an error indicating what and where
index ce7de0e3128549a09d3475fd8d3539aabe28be47..64f66d55fc63d94fab7ff2c6c1f4bb991efae94f 100644 (file)
 //! This module contains the "cleaned" pieces of the AST, and the functions
 //! that clean them.
 
-pub use self::Type::*;
-pub use self::Mutability::*;
-pub use self::ItemEnum::*;
-pub use self::SelfTy::*;
-pub use self::FunctionRetTy::*;
-pub use self::Visibility::{Public, Inherited};
+pub mod inline;
+pub mod cfg;
+mod simplify;
+mod auto_trait;
+mod blanket_impl;
+pub mod def_ctor;
 
+use rustc_data_structures::indexed_vec::{IndexVec, Idx};
+use rustc_data_structures::sync::Lrc;
 use rustc_target::spec::abi::Abi;
-use syntax::ast::{self, AttrStyle, Ident};
-use syntax::attr;
-use syntax::ext::base::MacroKind;
-use syntax::source_map::{dummy_spanned, Spanned};
-use syntax::ptr::P;
-use syntax::symbol::keywords::{self, Keyword};
-use syntax::symbol::InternedString;
-use syntax_pos::{self, DUMMY_SP, Pos, FileName};
-
+use rustc_typeck::hir_ty_to_ty;
+use rustc::infer::region_constraints::{RegionConstraintData, Constraint};
 use rustc::mir::interpret::ConstValue;
 use rustc::middle::resolve_lifetime as rl;
-use rustc::ty::fold::TypeFolder;
 use rustc::middle::lang_items;
+use rustc::middle::stability;
 use rustc::mir::interpret::GlobalId;
 use rustc::hir::{self, GenericArg, HirVec};
 use rustc::hir::def::{self, Def, CtorKind};
 use rustc::hir::def_id::{CrateNum, DefId, CRATE_DEF_INDEX, LOCAL_CRATE};
 use rustc::ty::subst::Substs;
 use rustc::ty::{self, TyCtxt, Region, RegionVid, Ty, AdtKind};
+use rustc::ty::fold::TypeFolder;
 use rustc::ty::layout::VariantIdx;
-use rustc::middle::stability;
 use rustc::util::nodemap::{FxHashMap, FxHashSet};
-use rustc_typeck::hir_ty_to_ty;
-use rustc::infer::region_constraints::{RegionConstraintData, Constraint};
-use rustc_data_structures::indexed_vec::{IndexVec, Idx};
+use syntax::ast::{self, AttrStyle, Ident};
+use syntax::attr;
+use syntax::ext::base::MacroKind;
+use syntax::source_map::{dummy_spanned, Spanned};
+use syntax::ptr::P;
+use syntax::symbol::keywords::{self, Keyword};
+use syntax::symbol::InternedString;
+use syntax_pos::{self, DUMMY_SP, Pos, FileName};
 
 use std::collections::hash_map::Entry;
 use std::fmt;
@@ -51,7 +51,6 @@
 use std::default::Default;
 use std::{mem, slice, vec};
 use std::iter::{FromIterator, once};
-use rustc_data_structures::sync::Lrc;
 use std::rc::Rc;
 use std::str::FromStr;
 use std::cell::RefCell;
 use html::render::{cache, ExternalLocation};
 use html::item_type::ItemType;
 
-pub mod inline;
-pub mod cfg;
-mod simplify;
-mod auto_trait;
-mod blanket_impl;
-pub mod def_ctor;
-
 use self::cfg::Cfg;
 use self::auto_trait::AutoTraitFinder;
 use self::blanket_impl::BlanketImplFinder;
 
+pub use self::Type::*;
+pub use self::Mutability::*;
+pub use self::ItemEnum::*;
+pub use self::SelfTy::*;
+pub use self::FunctionRetTy::*;
+pub use self::Visibility::{Public, Inherited};
+
 thread_local!(pub static MAX_DEF_ID: RefCell<FxHashMap<CrateNum, DefId>> = Default::default());
 
 const FN_OUTPUT_NAME: &'static str = "Output";
@@ -1621,7 +1620,7 @@ fn clean(&self, cx: &DocContext) -> Generics {
         }
 
         // It would be nice to collect all of the bounds on a type and recombine
-        // them if possible, to avoid e.g. `where T: Foo, T: Bar, T: Sized, T: 'a`
+        // them if possible, to avoid e.g., `where T: Foo, T: Bar, T: Sized, T: 'a`
         // and instead see `where T: Foo + Bar + Sized + 'a`
 
         Generics {
@@ -3899,7 +3898,7 @@ fn clean(&self, _: &DocContext) -> Deprecation {
     }
 }
 
-/// An equality constraint on an associated type, e.g. `A=Bar` in `Foo<A=Bar>`
+/// An equality constraint on an associated type, e.g., `A=Bar` in `Foo<A=Bar>`
 #[derive(Clone, PartialEq, Eq, RustcDecodable, RustcEncodable, Debug, Hash)]
 pub struct TypeBinding {
     pub name: String,
index 635608d140db48d86ecdb70f3be4753f810401ff..81608b380d0576eaf8bf36d603e6080aab78f26a 100644 (file)
@@ -12,7 +12,7 @@
 //! more canonical form.
 //!
 //! Currently all cross-crate-inlined function use `rustc::ty` to reconstruct
-//! the AST (e.g. see all of `clean::inline`), but this is not always a
+//! 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<Foo=Bar>` is encoded as:
index fa5d015e5b72dc494ea7469d0c36567a64013b1e..6ce02c313ee050365ac36fa0703c681046287566 100644 (file)
@@ -130,7 +130,7 @@ pub fn render<T: fmt::Display, S: fmt::Display>(
             <div class=\"infos\">\
                 <h2>Search Tricks</h2>\
                 <p>\
-                    Prefix searches with a type followed by a colon (e.g. \
+                    Prefix searches with a type followed by a colon (e.g., \
                     <code>fn:</code>) to restrict the search to a given type.\
                 </p>\
                 <p>\
@@ -140,11 +140,11 @@ pub fn render<T: fmt::Display, S: fmt::Display>(
                     and <code>const</code>.\
                 </p>\
                 <p>\
-                    Search functions by type signature (e.g. \
+                    Search functions by type signature (e.g., \
                     <code>vec -> usize</code> or <code>* -> vec</code>)\
                 </p>\
                 <p>\
-                    Search multiple things at once by splitting your query with comma (e.g. \
+                    Search multiple things at once by splitting your query with comma (e.g., \
                     <code>str,u8</code> or <code>String,struct:Vec,test</code>)\
                 </p>\
             </div>\
index 30054f66e2fe01f9ce39eb0d6b0ddda4e471e320..79a2f46a74ff8654165b7ee0407d17f1b828d4a1 100644 (file)
@@ -2077,7 +2077,7 @@ fn render_item(&self,
     fn item<F>(&mut self, item: clean::Item, all: &mut AllTypes, mut f: F) -> Result<(), Error>
         where F: FnMut(&mut Context, clean::Item),
     {
-        // Stripped modules survive the rustdoc passes (i.e. `strip-private`)
+        // Stripped modules survive the rustdoc passes (i.e., `strip-private`)
         // if they contain impls for public types. These modules can also
         // contain items such as publicly re-exported structures.
         //
index 88ada5c7f7fc0e51af45eebc8e3ac9f75eebe8f4..45bd6990fabbaec16c6e266d856bfd394c645ea4 100644 (file)
@@ -52,7 +52,7 @@ pub struct TocEntry {
 pub struct TocBuilder {
     top_level: Toc,
     /// The current hierarchy of parent headings, the levels are
-    /// strictly increasing (i.e. chain[0].level < chain[1].level <
+    /// strictly increasing (i.e., chain[0].level < chain[1].level <
     /// ...) with each entry being the most recent occurrence of a
     /// heading with that level (it doesn't include the most recent
     /// occurrences of every level, just, if it *is* in `chain` then
@@ -76,7 +76,7 @@ pub fn into_toc(mut self) -> Toc {
     }
 
     /// Collapse the chain until the first heading more important than
-    /// `level` (i.e. lower level)
+    /// `level` (i.e., lower level)
     ///
     /// Example:
     ///
@@ -91,7 +91,7 @@ pub fn into_toc(mut self) -> Toc {
     /// ### H
     /// ```
     ///
-    /// If we are considering H (i.e. level 3), then A and B are in
+    /// If we are considering H (i.e., level 3), then A and B are in
     /// self.top_level, D is in C.children, and C, E, F, G are in
     /// self.chain.
     ///
@@ -102,7 +102,7 @@ pub fn into_toc(mut self) -> Toc {
     ///
     /// This leaves us looking at E, which does have a smaller level,
     /// and, by construction, it's the most recent thing with smaller
-    /// level, i.e. it's the immediate parent of H.
+    /// level, i.e., it's the immediate parent of H.
     fn fold_until(&mut self, level: u32) {
         let mut this = None;
         loop {
@@ -133,7 +133,7 @@ pub fn push<'a>(&'a mut self, level: u32, name: String, id: String) -> &'a str {
         assert!(level >= 1);
 
         // collapse all previous sections into their parents until we
-        // get to relevant heading (i.e. the first one with a smaller
+        // get to relevant heading (i.e., the first one with a smaller
         // level than us)
         self.fold_until(level);
 
@@ -150,7 +150,7 @@ pub fn push<'a>(&'a mut self, level: u32, name: String, id: String) -> &'a str {
                     (entry.level, &entry.children)
                 }
             };
-            // fill in any missing zeros, e.g. for
+            // fill in any missing zeros, e.g., for
             // # Foo (1)
             // ### Bar (1.0.1)
             for _ in toc_level..level - 1 {
index b21f005c06bff5cc205368cc0ea938d4851e011f..b0045e41f5057bc09fdc62002eff3e210dba5b20 100644 (file)
@@ -276,7 +276,7 @@ fn opts() -> Vec<RustcOptGroup> {
         unstable("resource-suffix", |o| {
             o.optopt("",
                      "resource-suffix",
-                     "suffix to add to CSS and JavaScript files, e.g. \"light.css\" will become \
+                     "suffix to add to CSS and JavaScript files, e.g., \"light.css\" will become \
                       \"light-suffix.css\"",
                      "PATH")
         }),
index 8008f8848d45d054f0c80b68820350005f8a6e98..e0e0be717b284aaaebe249462f969d1e20709770 100644 (file)
@@ -46,8 +46,8 @@ fn extract_leading_metadata<'a>(s: &'a str) -> (Vec<&'a str>, &'a str) {
     (metadata, "")
 }
 
-/// Render `input` (e.g. "foo.md") into an HTML file in `output`
-/// (e.g. output = "bar" => "bar/foo.html").
+/// Render `input` (e.g., "foo.md") into an HTML file in `output`
+/// (e.g., output = "bar" => "bar/foo.html").
 pub fn render(input: PathBuf, options: RenderOptions, diag: &errors::Handler) -> isize {
     let mut output = options.output;
     output.push(input.file_stem().unwrap());
index cbbcf92c6aa9e3ee06c76a062c0208f759a8b408..426d3f3eeeaa2869e02c0c5267a98787e78edeee 100644 (file)
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use clean::*;
-
 use rustc::lint as lint;
 use rustc::hir;
 use rustc::hir::def::Def;
@@ -26,6 +24,7 @@
 use fold::DocFolder;
 use html::markdown::markdown_links;
 
+use clean::*;
 use passes::{look_for_tests, Pass};
 
 pub const COLLECT_INTRA_DOC_LINKS: Pass =
@@ -44,13 +43,13 @@ pub fn collect_intra_doc_links(krate: Crate, cx: &DocContext) -> Crate {
 
 #[derive(Debug)]
 enum PathKind {
-    /// can be either value or type, not a macro
+    /// Either a value or type, but not a macro
     Unknown,
-    /// macro
+    /// Macro
     Macro,
-    /// values, functions, consts, statics, everything in the value namespace
+    /// Values, functions, consts, statics (everything in the value namespace)
     Value,
-    /// types, traits, everything in the type namespace
+    /// Types, traits (everything in the type namespace)
     Type,
 }
 
@@ -71,7 +70,7 @@ fn new(cx: &'a DocContext<'a, 'tcx, 'rcx, 'cstore>) -> Self {
 
     /// Resolve a given string as a path, along with whether or not it is
     /// in the value namespace. Also returns an optional URL fragment in the case
-    /// of variants and methods
+    /// of variants and methods.
     fn resolve(&self,
                path_str: &str,
                is_val: bool,
@@ -82,9 +81,9 @@ fn resolve(&self,
         let cx = self.cx;
 
         // In case we're in a module, try to resolve the relative
-        // path
+        // path.
         if let Some(id) = parent_id.or(self.mod_ids.last().cloned()) {
-            // FIXME: `with_scope` requires the NodeId of a module
+            // FIXME: `with_scope` requires the `NodeId` of a module.
             let result = cx.resolver.borrow_mut()
                                     .with_scope(id,
                 |resolver| {
@@ -94,12 +93,12 @@ fn resolve(&self,
 
             if let Ok(result) = result {
                 // In case this is a trait item, skip the
-                // early return and try looking for the trait
+                // early return and try looking for the trait.
                 let value = match result.def {
                     Def::Method(_) | Def::AssociatedConst(_) => true,
                     Def::AssociatedTy(_) => false,
                     Def::Variant(_) => return handle_variant(cx, result.def),
-                    // not a trait item, just return what we found
+                    // Not a trait item; just return what we found.
                     _ => return Ok((result.def, None))
                 };
 
@@ -111,13 +110,13 @@ fn resolve(&self,
             } else {
                 // If resolution failed, it may still be a method
                 // because methods are not handled by the resolver
-                // If so, bail when we're not looking for a value
+                // If so, bail when we're not looking for a value.
                 if !is_val {
                     return Err(())
                 }
             }
 
-            // Try looking for methods and associated items
+            // Try looking for methods and associated items.
             let mut split = path_str.rsplitn(2, "::");
             let item_name = if let Some(first) = split.next() {
                 first
@@ -137,7 +136,7 @@ fn resolve(&self,
                 }
             }
 
-            // FIXME: `with_scope` requires the NodeId of a module
+            // FIXME: `with_scope` requires the `NodeId` of a module.
             let ty = cx.resolver.borrow_mut()
                                 .with_scope(id,
                 |resolver| {
@@ -227,10 +226,10 @@ fn fold_item(&mut self, mut item: Item) -> Option<Item> {
             None
         };
 
-        // FIXME: get the resolver to work with non-local resolve scopes
+        // FIXME: get the resolver to work with non-local resolve scopes.
         let parent_node = self.cx.as_local_node_id(item.def_id).and_then(|node_id| {
             // FIXME: this fails hard for impls in non-module scope, but is necessary for the
-            // current resolve() implementation
+            // current `resolve()` implementation.
             match self.cx.tcx.hir().get_module_parent_node(node_id) {
                 id if id != node_id => Some(id),
                 _ => None,
@@ -252,7 +251,7 @@ fn fold_item(&mut self, mut item: Item) -> Option<Item> {
                 } else {
                     match parent_node.or(self.mod_ids.last().cloned()) {
                         Some(parent) if parent != NodeId::from_u32(0) => {
-                            //FIXME: can we pull the parent module's name from elsewhere?
+                            // FIXME: can we pull the parent module's name from elsewhere?
                             Some(self.cx.tcx.hir().name(parent).to_string())
                         }
                         _ => None,
@@ -262,7 +261,7 @@ fn fold_item(&mut self, mut item: Item) -> Option<Item> {
             ImplItem(Impl { ref for_, .. }) => {
                 for_.def_id().map(|did| self.cx.tcx.item_name(did).to_string())
             }
-            // we don't display docs on `extern crate` items anyway, so don't process them
+            // we don't display docs on `extern crate` items anyway, so don't process them.
             ExternCrateItem(..) => return self.fold_item_recur(item),
             ImportItem(Import::Simple(ref name, ..)) => Some(name.clone()),
             MacroItem(..) => None,
@@ -283,7 +282,7 @@ fn fold_item(&mut self, mut item: Item) -> Option<Item> {
         }
 
         for (ori_link, link_range) in markdown_links(&dox) {
-            // bail early for real links
+            // Bail early for real links.
             if ori_link.contains('/') {
                 continue;
             }
@@ -327,9 +326,9 @@ fn fold_item(&mut self, mut item: Item) -> Option<Item> {
                             def
                         } else {
                             resolution_failure(cx, &item.attrs, path_str, &dox, link_range);
-                            // this could just be a normal link or a broken link
+                            // This could just be a normal link or a broken link
                             // we could potentially check if something is
-                            // "intra-doc-link-like" and warn in that case
+                            // "intra-doc-link-like" and warn in that case.
                             continue;
                         }
                     }
@@ -338,12 +337,12 @@ fn fold_item(&mut self, mut item: Item) -> Option<Item> {
                             def
                         } else {
                             resolution_failure(cx, &item.attrs, path_str, &dox, link_range);
-                            // this could just be a normal link
+                            // This could just be a normal link.
                             continue;
                         }
                     }
                     PathKind::Unknown => {
-                        // try everything!
+                        // Try everything!
                         if let Some(macro_def) = macro_resolve(cx, path_str) {
                             if let Ok(type_def) =
                                 self.resolve(path_str, false, &current_item, parent_node)
@@ -371,8 +370,8 @@ fn fold_item(&mut self, mut item: Item) -> Option<Item> {
                         {
                             // It is imperative we search for not-a-value first
                             // Otherwise we will find struct ctors for when we are looking
-                            // for structs, and the link won't work.
-                            // if there is something in both namespaces
+                            // for structs, and the link won't work if there is something in
+                            // both namespaces.
                             if let Ok(value_def) =
                                 self.resolve(path_str, true, &current_item, parent_node)
                             {
@@ -432,7 +431,7 @@ fn fold_item(&mut self, mut item: Item) -> Option<Item> {
     }
 }
 
-/// Resolve a string as a macro
+/// Resolve a string as a macro.
 fn macro_resolve(cx: &DocContext, path_str: &str) -> Option<Def> {
     use syntax::ext::base::{MacroKind, SyntaxExtension};
     let segment = ast::PathSegment::from_ident(Ident::from_str(path_str));
@@ -482,19 +481,19 @@ fn resolution_failure(
         let mut diag;
         if dox.lines().count() == code_dox.lines().count() {
             let line_offset = dox[..link_range.start].lines().count();
-            // The span starts in the `///`, so we don't have to account for the leading whitespace
+            // The span starts in the `///`, so we don't have to account for the leading whitespace.
             let code_dox_len = if line_offset <= 1 {
                 doc_comment_padding
             } else {
-                // The first `///`
+                // The first `///`.
                 doc_comment_padding +
-                    // Each subsequent leading whitespace and `///`
+                    // Each subsequent leading whitespace and `///`.
                     code_dox.lines().skip(1).take(line_offset - 1).fold(0, |sum, line| {
                         sum + doc_comment_padding + line.len() - line.trim_start().len()
                     })
             };
 
-            // Extract the specific span
+            // Extract the specific span.
             let sp = sp.from_inner_byte_pos(
                 link_range.start + code_dox_len,
                 link_range.end + code_dox_len,
@@ -514,7 +513,7 @@ fn resolution_failure(
             let last_new_line_offset = dox[..link_range.start].rfind('\n').map_or(0, |n| n + 1);
             let line = dox[last_new_line_offset..].lines().next().unwrap_or("");
 
-            // Print the line containing the `link_range` and manually mark it with '^'s
+            // Print the line containing the `link_range` and manually mark it with '^'s.
             diag.note(&format!(
                 "the link appears in this line:\n\n{line}\n\
                  {indicator: <before$}{indicator:^<found$}",
@@ -555,13 +554,13 @@ fn ambiguity_error(cx: &DocContext, attrs: &Attributes,
 }
 
 /// Given a def, returns its name and disambiguator
-/// for a value namespace
+/// for a value namespace.
 ///
-/// Returns None for things which cannot be ambiguous since
-/// they exist in both namespaces (structs and modules)
+/// Returns `None` for things which cannot be ambiguous since
+/// they exist in both namespaces (structs and modules).
 fn value_ns_kind(def: Def, path_str: &str) -> Option<(&'static str, String)> {
     match def {
-        // structs, variants, and mods exist in both namespaces. skip them
+        // Structs, variants, and mods exist in both namespaces; skip them.
         Def::StructCtor(..) | Def::Mod(..) | Def::Variant(..) |
         Def::VariantCtor(..) | Def::SelfCtor(..)
             => None,
@@ -578,10 +577,10 @@ fn value_ns_kind(def: Def, path_str: &str) -> Option<(&'static str, String)> {
 }
 
 /// Given a def, returns its name, the article to be used, and a disambiguator
-/// for the type namespace
+/// for the type namespace.
 fn type_ns_kind(def: Def, path_str: &str) -> (&'static str, &'static str, String) {
     let (kind, article) = match def {
-        // we can still have non-tuple structs
+        // We can still have non-tuple structs.
         Def::Struct(..) => ("struct", "a"),
         Def::Enum(..) => ("enum", "an"),
         Def::Trait(..) => ("trait", "a"),
@@ -591,7 +590,7 @@ fn type_ns_kind(def: Def, path_str: &str) -> (&'static str, &'static str, String
     (kind, article, format!("{}@{}", kind, path_str))
 }
 
-/// Given an enum variant's def, return the def of its enum and the associated fragment
+/// Given an enum variant's def, return the def of its enum and the associated fragment.
 fn handle_variant(cx: &DocContext, def: Def) -> Result<(Def, Option<String>), ()> {
     use rustc::ty::DefIdTree;
 
index 74583196818b84e4e7ddf80c6712948bc0f58070..be9327ced26e9f3d1fdc4ef69fe9de96d9c9dd02 100644 (file)
@@ -8,38 +8,38 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use std::env;
-use std::ffi::OsString;
-use std::io::prelude::*;
-use std::io;
-use std::path::PathBuf;
-use std::panic::{self, AssertUnwindSafe};
-use std::process::Command;
-use std::str;
+use errors;
+use errors::emitter::ColorConfig;
 use rustc_data_structures::sync::Lrc;
-use std::sync::{Arc, Mutex};
-
-use testing;
 use rustc_lint;
+use rustc_driver::{self, driver, target_features, Compilation};
+use rustc_driver::driver::phase_2_configure_and_expand;
+use rustc_metadata::cstore::CStore;
+use rustc_metadata::dynamic_lib::DynamicLibrary;
+use rustc_resolve::MakeGlobMap;
 use rustc::hir;
 use rustc::hir::intravisit;
 use rustc::session::{self, CompileIncomplete, config};
 use rustc::session::config::{OutputType, OutputTypes, Externs, CodegenOptions};
 use rustc::session::search_paths::{SearchPaths, PathKind};
-use rustc_metadata::dynamic_lib::DynamicLibrary;
-use tempfile::Builder as TempFileBuilder;
-use rustc_driver::{self, driver, target_features, Compilation};
-use rustc_driver::driver::phase_2_configure_and_expand;
-use rustc_metadata::cstore::CStore;
-use rustc_resolve::MakeGlobMap;
 use syntax::ast;
 use syntax::source_map::SourceMap;
 use syntax::edition::Edition;
 use syntax::feature_gate::UnstableFeatures;
 use syntax::with_globals;
 use syntax_pos::{BytePos, DUMMY_SP, Pos, Span, FileName};
-use errors;
-use errors::emitter::ColorConfig;
+use tempfile::Builder as TempFileBuilder;
+use testing;
+
+use std::env;
+use std::ffi::OsString;
+use std::io::prelude::*;
+use std::io;
+use std::path::PathBuf;
+use std::panic::{self, AssertUnwindSafe};
+use std::process::Command;
+use std::str;
+use std::sync::{Arc, Mutex};
 
 use clean::Attributes;
 use config::Options;
@@ -153,7 +153,7 @@ pub fn run(mut options: Options) -> isize {
     })
 }
 
-// Look for #![doc(test(no_crate_inject))], used by crates in the std facade
+// Look for `#![doc(test(no_crate_inject))]`, used by crates in the std facade.
 fn scrape_test_config(krate: &::rustc::hir::Crate) -> TestOptions {
     use syntax::print::pprust;
 
@@ -192,12 +192,11 @@ fn run_test(test: &str, cratename: &str, filename: &FileName, line: usize,
             should_panic: bool, no_run: bool, as_test_harness: bool,
             compile_fail: bool, mut error_codes: Vec<String>, opts: &TestOptions,
             maybe_sysroot: Option<PathBuf>, linker: Option<PathBuf>, edition: Edition) {
-    // the test harness wants its own `main` & top level functions, so
-    // never wrap the test in `fn main() { ... }`
+    // The test harness wants its own `main` and top-level functions, so
+    // never wrap the test in `fn main() { ... }`.
     let (test, line_offset) = make_test(test, Some(cratename), as_test_harness, opts);
     // FIXME(#44940): if doctests ever support path remapping, then this filename
-    // needs to be the result of SourceMap::span_to_unmapped_path
-
+    // needs to be the result of `SourceMap::span_to_unmapped_path`.
     let path = match filename {
         FileName::Real(path) => path.clone(),
         _ => PathBuf::from(r"doctest.rs"),
@@ -408,8 +407,8 @@ pub fn make_test(s: &str,
         let filename = FileName::anon_source_code(s);
         let source = crates + &everything_else;
 
-        // any errors in parsing should also appear when the doctest is compiled for real, so just
-        // send all the errors that libsyntax emits directly into a Sink instead of stderr
+        // Any errors in parsing should also appear when the doctest is compiled for real, so just
+        // send all the errors that libsyntax emits directly into a `Sink` instead of stderr.
         let cm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
         let emitter = EmitterWriter::new(box io::sink(), None, false, false);
         let handler = Handler::with_emitter(false, false, box emitter);
@@ -537,10 +536,10 @@ pub struct Collector {
     // The name of the test displayed to the user, separated by `::`.
     //
     // In tests from Rust source, this is the path to the item
-    // e.g. `["std", "vec", "Vec", "push"]`.
+    // e.g., `["std", "vec", "Vec", "push"]`.
     //
     // In tests from a markdown file, this is the titles of all headers (h1~h6)
-    // of the sections that contain the code block, e.g. if the markdown file is
+    // of the sections that contain the code block, e.g., if the markdown file is
     // written as:
     //
     // ``````markdown
@@ -689,7 +688,7 @@ fn get_line(&self) -> usize {
 
     fn register_header(&mut self, name: &str, level: u32) {
         if self.use_headers {
-            // we use these headings as test names, so it's good if
+            // We use these headings as test names, so it's good if
             // they're valid identifiers.
             let name = name.chars().enumerate().map(|(i, c)| {
                     if (i == 0 && c.is_xid_start()) ||
@@ -703,7 +702,7 @@ fn register_header(&mut self, name: &str, level: u32) {
             // Here we try to efficiently assemble the header titles into the
             // test name in the form of `h1::h2::h3::h4::h5::h6`.
             //
-            // Suppose originally `self.names` contains `[h1, h2, h3]`...
+            // Suppose that originally `self.names` contains `[h1, h2, h3]`...
             let level = level as usize;
             if level <= self.names.len() {
                 // ... Consider `level == 2`. All headers in the lower levels
@@ -752,8 +751,8 @@ fn visit_testable<F: FnOnce(&mut Self)>(&mut self,
 
         attrs.collapse_doc_comments();
         attrs.unindent_doc_comments();
-        // the collapse-docs pass won't combine sugared/raw doc attributes, or included files with
-        // anything else, this will combine them for us
+        // The collapse-docs pass won't combine sugared/raw doc attributes, or included files with
+        // anything else, this will combine them for us.
         if let Some(doc) = attrs.collapsed_doc_value() {
             self.collector.set_position(attrs.span.unwrap_or(DUMMY_SP));
             let res = markdown::find_testable_code(&doc, self.collector, self.codes);
@@ -847,8 +846,8 @@ fn main() {
 
     #[test]
     fn make_test_crate_name_no_use() {
-        //if you give a crate name but *don't* use it within the test, it won't bother inserting
-        //the `extern crate` statement
+        // If you give a crate name but *don't* use it within the test, it won't bother inserting
+        // the `extern crate` statement.
         let opts = TestOptions::default();
         let input =
 "assert_eq!(2+2, 4);";
@@ -863,8 +862,8 @@ fn main() {
 
     #[test]
     fn make_test_crate_name() {
-        //if you give a crate name and use it within the test, it will insert an `extern crate`
-        //statement before `fn main`
+        // If you give a crate name and use it within the test, it will insert an `extern crate`
+        // statement before `fn main`.
         let opts = TestOptions::default();
         let input =
 "use asdf::qwop;
@@ -882,8 +881,8 @@ fn main() {
 
     #[test]
     fn make_test_no_crate_inject() {
-        //even if you do use the crate within the test, setting `opts.no_crate_inject` will skip
-        //adding it anyway
+        // Even if you do use the crate within the test, setting `opts.no_crate_inject` will skip
+        // adding it anyway.
         let opts = TestOptions {
             no_crate_inject: true,
             display_warnings: false,
@@ -904,8 +903,9 @@ fn main() {
 
     #[test]
     fn make_test_ignore_std() {
-        //even if you include a crate name, and use it in the doctest, we still won't include an
-        //`extern crate` statement if the crate is "std" - that's included already by the compiler!
+        // Even if you include a crate name, and use it in the doctest, we still won't include an
+        // `extern crate` statement if the crate is "std" -- that's included already by the
+        // compiler!
         let opts = TestOptions::default();
         let input =
 "use std::*;
@@ -922,8 +922,8 @@ fn main() {
 
     #[test]
     fn make_test_manual_extern_crate() {
-        //when you manually include an `extern crate` statement in your doctest, make_test assumes
-        //you've included one for your own crate too
+        // When you manually include an `extern crate` statement in your doctest, `make_test`
+        // assumes you've included one for your own crate too.
         let opts = TestOptions::default();
         let input =
 "extern crate asdf;
@@ -960,8 +960,8 @@ fn main() {
 
     #[test]
     fn make_test_opts_attrs() {
-        //if you supplied some doctest attributes with #![doc(test(attr(...)))], it will use those
-        //instead of the stock #![allow(unused)]
+        // If you supplied some doctest attributes with `#![doc(test(attr(...)))]`, it will use
+        // those instead of the stock `#![allow(unused)]`.
         let mut opts = TestOptions::default();
         opts.attrs.push("feature(sick_rad)".to_string());
         let input =
@@ -977,7 +977,7 @@ fn main() {
         let output = make_test(input, Some("asdf"), false, &opts);
         assert_eq!(output, (expected, 3));
 
-        //adding more will also bump the returned line offset
+        // Adding more will also bump the returned line offset.
         opts.attrs.push("feature(hella_dope)".to_string());
         let expected =
 "#![feature(sick_rad)]
@@ -993,8 +993,8 @@ fn main() {
 
     #[test]
     fn make_test_crate_attrs() {
-        //including inner attributes in your doctest will apply them to the whole "crate", pasting
-        //them outside the generated main function
+        // Including inner attributes in your doctest will apply them to the whole "crate", pasting
+        // them outside the generated main function.
         let opts = TestOptions::default();
         let input =
 "#![feature(sick_rad)]
@@ -1011,7 +1011,7 @@ fn main() {
 
     #[test]
     fn make_test_with_main() {
-        //including your own `fn main` wrapper lets the test use it verbatim
+        // Including your own `fn main` wrapper lets the test use it verbatim.
         let opts = TestOptions::default();
         let input =
 "fn main() {
@@ -1028,7 +1028,7 @@ fn main() {
 
     #[test]
     fn make_test_fake_main() {
-        //...but putting it in a comment will still provide a wrapper
+        // ... but putting it in a comment will still provide a wrapper.
         let opts = TestOptions::default();
         let input =
 "//Ceci n'est pas une `fn main`
@@ -1045,7 +1045,7 @@ fn main() {
 
     #[test]
     fn make_test_dont_insert_main() {
-        //even with that, if you set `dont_insert_main`, it won't create the `fn main` wrapper
+        // Even with that, if you set `dont_insert_main`, it won't create the `fn main` wrapper.
         let opts = TestOptions::default();
         let input =
 "//Ceci n'est pas une `fn main`
@@ -1060,7 +1060,7 @@ fn make_test_dont_insert_main() {
 
     #[test]
     fn make_test_display_warnings() {
-        //if the user is asking to display doctest warnings, suppress the default allow(unused)
+        // If the user is asking to display doctest warnings, suppress the default `allow(unused)`.
         let mut opts = TestOptions::default();
         opts.display_warnings = true;
         let input =
index fc7e8d72d6997f045176258bb3bd8ca6b6405d71..004be1cfe39c42e0793ac71bdc33264e26181774 100644 (file)
@@ -8,36 +8,33 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-//! Rust AST Visitor. Extracts useful information and massages it into a form
-//! usable for clean
-
-use std::mem;
+//! The Rust AST Visitor. Extracts useful information and massages it into a form
+//! usable for `clean`.
 
+use rustc::hir::{self, Node};
+use rustc::hir::def::Def;
+use rustc::hir::def_id::{DefId, LOCAL_CRATE};
+use rustc::middle::privacy::AccessLevel;
+use rustc::util::nodemap::{FxHashSet, FxHashMap};
 use syntax::ast;
 use syntax::attr;
 use syntax::ext::base::MacroKind;
 use syntax::source_map::Spanned;
 use syntax_pos::{self, Span};
 
-use rustc::hir::Node;
-use rustc::hir::def::Def;
-use rustc::hir::def_id::{DefId, LOCAL_CRATE};
-use rustc::middle::privacy::AccessLevel;
-use rustc::util::nodemap::{FxHashSet, FxHashMap};
-
-use rustc::hir;
+use std::mem;
 
 use core;
 use clean::{self, AttributesExt, NestedAttributesExt, def_id_to_path};
 use doctree::*;
 
-// looks to me like the first two of these are actually
+// Looks to me like the first two of these are actually
 // output parameters, maybe only mutated once; perhaps
 // better simply to have the visit method return a tuple
 // containing them?
 
-// also, is there some reason that this doesn't use the 'visit'
-// framework from syntax?
+// Also, is there some reason that this doesn't use the 'visit'
+// framework from syntax?.
 
 pub struct RustdocVisitor<'a, 'tcx: 'a, 'rcx: 'a, 'cstore: 'rcx> {
     pub module: Module,
@@ -45,7 +42,7 @@ pub struct RustdocVisitor<'a, 'tcx: 'a, 'rcx: 'a, 'cstore: 'rcx> {
     pub cx: &'a core::DocContext<'a, 'tcx, 'rcx, 'cstore>,
     view_item_stack: FxHashSet<ast::NodeId>,
     inlining: bool,
-    /// Is the current module and all of its parents public?
+    /// Are the current module and all of its parents public?
     inside_public_path: bool,
     exact_paths: Option<FxHashMap<DefId, Vec<String>>>,
 }
@@ -69,8 +66,8 @@ pub fn new(
     }
 
     fn store_path(&mut self, did: DefId) {
-        // We can't use the entry api, as that keeps the mutable borrow of self active
-        // when we try to use cx
+        // We can't use the entry API, as that keeps the mutable borrow of `self` active
+        // when we try to use `cx`.
         let exact_paths = self.exact_paths.as_mut().unwrap();
         if exact_paths.get(&did).is_none() {
             let path = def_id_to_path(self.cx, did, self.cx.crate_name.clone());
@@ -98,7 +95,7 @@ pub fn visit(&mut self, krate: &hir::Crate) {
                                               ast::CRATE_NODE_ID,
                                               &krate.module,
                                               None);
-        // attach the crate's exported macros to the top-level module:
+        // Attach the crate's exported macros to the top-level module:
         let macro_exports: Vec<_> =
             krate.exported_macros.iter().map(|def| self.visit_local_macro(def, None)).collect();
         self.module.macros.extend(macro_exports);
@@ -303,14 +300,14 @@ fn inherits_doc_hidden(cx: &core::DocContext, mut node: ast::NodeId) -> bool {
         let def_did = def.def_id();
 
         let use_attrs = tcx.hir().attrs(id);
-        // Don't inline doc(hidden) imports so they can be stripped at a later stage.
+        // Don't inline `doc(hidden)` imports so they can be stripped at a later stage.
         let is_no_inline = use_attrs.lists("doc").has_word("no_inline") ||
                            use_attrs.lists("doc").has_word("hidden");
 
         // For cross-crate impl inlining we need to know whether items are
-        // reachable in documentation - a previously nonreachable item can be
+        // reachable in documentation -- a previously nonreachable item can be
         // made reachable by cross-crate inlining which we're checking here.
-        // (this is done here because we need to know this upfront)
+        // (this is done here because we need to know this upfront).
         if !def_did.is_local() && !is_no_inline {
             let attrs = clean::inline::load_attrs(self.cx, def_did);
             let self_is_hidden = attrs.lists("doc").has_word("hidden");
@@ -342,7 +339,7 @@ fn inherits_doc_hidden(cx: &core::DocContext, mut node: ast::NodeId) -> bool {
         let is_private = !self.cx.renderinfo.borrow().access_levels.is_public(def_did);
         let is_hidden = inherits_doc_hidden(self.cx, def_node_id);
 
-        // Only inline if requested or if the item would otherwise be stripped
+        // Only inline if requested or if the item would otherwise be stripped.
         if (!please_inline && !is_private && !is_hidden) || is_no_inline {
             return false
         }
@@ -366,7 +363,7 @@ fn inherits_doc_hidden(cx: &core::DocContext, mut node: ast::NodeId) -> bool {
                 true
             }
             Node::ForeignItem(it) if !glob => {
-                // generate a fresh `extern {}` block if we want to inline a foreign item.
+                // Generate a fresh `extern {}` block if we want to inline a foreign item.
                 om.foreigns.push(hir::ForeignMod {
                     abi: tcx.hir().get_foreign_abi(it.id),
                     items: vec![hir::ForeignItem {
@@ -427,7 +424,7 @@ pub fn visit_item(&mut self, item: &hir::Item,
             hir::ItemKind::Use(ref path, kind) => {
                 let is_glob = kind == hir::UseKind::Glob;
 
-                // struct and variant constructors always show up alongside their definitions, we've
+                // Struct and variant constructors always show up alongside their definitions, we've
                 // already processed them so just discard these.
                 match path.def {
                     Def::StructCtor(..) | Def::VariantCtor(..) | Def::SelfCtor(..) => return,
@@ -596,7 +593,7 @@ pub fn visit_item(&mut self, item: &hir::Item,
         }
     }
 
-    // convert each exported_macro into a doc item
+    // Convert each `exported_macro` into a doc item.
     fn visit_local_macro(
         &self,
         def: &hir::MacroDef,
index 5d1f42c83f44999867cf7a21aa927856862f2864..f64334a821981ce81bf55851ceed8e7c804d2c44 100644 (file)
@@ -21,7 +21,7 @@
 // FIXME: this may not be exhaustive, but is sufficient for rustdocs current uses
 
 /// Similar to `librustc_privacy::EmbargoVisitor`, but also takes
-/// specific rustdoc annotations into account (i.e. `doc(hidden)`)
+/// specific rustdoc annotations into account (i.e., `doc(hidden)`)
 pub struct LibEmbargoVisitor<'a, 'tcx: 'a, 'rcx: 'a, 'cstore: 'rcx> {
     cx: &'a ::core::DocContext<'a, 'tcx, 'rcx, 'cstore>,
     // Accessibility levels for reachable nodes
index 4bb3ce0cf4489e76b7417cb04a4acbe2e732500b..d3267e4e8015a7fd07d1dc2b9e420a531d4402c9 100644 (file)
@@ -342,7 +342,7 @@ pub fn iter(&self) -> Iter<T> {
     }
 
     /// Visits the values representing the difference,
-    /// i.e. the values that are in `self` but not in `other`.
+    /// i.e., the values that are in `self` but not in `other`.
     ///
     /// # Examples
     ///
@@ -373,7 +373,7 @@ pub fn difference<'a>(&'a self, other: &'a HashSet<T, S>) -> Difference<'a, T, S
     }
 
     /// Visits the values representing the symmetric difference,
-    /// i.e. the values that are in `self` or in `other` but not in both.
+    /// i.e., the values that are in `self` or in `other` but not in both.
     ///
     /// # Examples
     ///
@@ -401,7 +401,7 @@ pub fn symmetric_difference<'a>(&'a self,
     }
 
     /// Visits the values representing the intersection,
-    /// i.e. the values that are both in `self` and `other`.
+    /// i.e., the values that are both in `self` and `other`.
     ///
     /// # Examples
     ///
@@ -427,7 +427,7 @@ pub fn intersection<'a>(&'a self, other: &'a HashSet<T, S>) -> Intersection<'a,
     }
 
     /// Visits the values representing the union,
-    /// i.e. all the values in `self` or `other`, without duplicates.
+    /// i.e., all the values in `self` or `other`, without duplicates.
     ///
     /// # Examples
     ///
@@ -598,7 +598,7 @@ pub fn is_disjoint(&self, other: &HashSet<T, S>) -> bool {
     }
 
     /// Returns `true` if the set is a subset of another,
-    /// i.e. `other` contains at least all the values in `self`.
+    /// i.e., `other` contains at least all the values in `self`.
     ///
     /// # Examples
     ///
@@ -620,7 +620,7 @@ pub fn is_subset(&self, other: &HashSet<T, S>) -> bool {
     }
 
     /// Returns `true` if the set is a superset of another,
-    /// i.e. `self` contains at least all the values in `other`.
+    /// i.e., `self` contains at least all the values in `other`.
     ///
     /// # Examples
     ///
index 7a5353bb60ff634c68c58cb65811abcaea1beda4..a9b27115261a07c9a5aa6cb99a550cf86edeed64 100644 (file)
 use string;
 
 /// `Error` is a trait representing the basic expectations for error values,
-/// i.e. values of type `E` in [`Result<T, E>`]. Errors must describe
+/// i.e., values of type `E` in [`Result<T, E>`]. Errors must describe
 /// themselves through the [`Display`] and [`Debug`] traits, and may provide
 /// cause chain information:
 ///
 /// The [`cause`] method is generally used when errors cross "abstraction
-/// boundaries", i.e.  when a one module must report an error that is "caused"
+/// boundaries", i.e.,  when a one module must report an error that is "caused"
 /// by an error from a lower-level module. This setup makes it possible for the
 /// high-level module to provide its own errors that do not commit to any
 /// particular implementation, but also reveal some of its implementation for
index ecaaf8323ab91a0b1105353a399af7182dca682a..c800763167fcbb40ed42fcc697ecfbf2684da77f 100644 (file)
@@ -888,7 +888,7 @@ pub fn atanh(self) -> f64 {
     }
 
     // Solaris/Illumos requires a wrapper around log, log2, and log10 functions
-    // because of their non-standard behavior (e.g. log(-n) returns -Inf instead
+    // because of their non-standard behavior (e.g., log(-n) returns -Inf instead
     // of expected NaN).
     fn log_wrapper<F: Fn(f64) -> f64>(self, log_fn: F) -> f64 {
         if !cfg!(target_os = "solaris") {
index 7c7f83967e051b206636e9700afe09cd987dfedb..768998b235ee9003b21e565fda97615087042439 100644 (file)
@@ -372,7 +372,7 @@ pub unsafe fn from_vec_unchecked(mut v: Vec<u8>) -> CString {
     /// # Safety
     ///
     /// This should only ever be called with a pointer that was earlier
-    /// obtained by calling [`into_raw`] on a `CString`. Other usage (e.g. trying to take
+    /// obtained by calling [`into_raw`] on a `CString`. Other usage (e.g., trying to take
     /// ownership of a string that was allocated by foreign code) is likely to lead
     /// to undefined behavior or allocator corruption.
     ///
@@ -1167,8 +1167,8 @@ pub fn to_bytes_with_nul(&self) -> &[u8] {
     /// ```
     #[stable(feature = "cstr_to_str", since = "1.4.0")]
     pub fn to_str(&self) -> Result<&str, str::Utf8Error> {
-        // NB: When CStr is changed to perform the length check in .to_bytes()
-        // instead of in from_ptr(), it may be worth considering if this should
+        // N.B., when `CStr` is changed to perform the length check in `.to_bytes()`
+        // instead of in `from_ptr()`, it may be worth considering if this should
         // be rewritten to do the UTF-8 check inline with the length calculation
         // instead of doing it afterwards.
         str::from_utf8(self.to_bytes())
index bd5fc3fa24a851f9948317c017a74db1cecb0188..99da73adc63e97a64e508b09813f82f9253ec2ca 100644 (file)
@@ -21,7 +21,7 @@
 //! Rust represents owned strings with the [`String`] type, and
 //! borrowed slices of strings with the [`str`] primitive. Both are
 //! always in UTF-8 encoding, and may contain nul bytes in the middle,
-//! i.e. if you look at the bytes that make up the string, there may
+//! i.e., if you look at the bytes that make up the string, there may
 //! be a `\0` among them. Both `String` and `str` store their length
 //! explicitly; there are no nul terminators at the end of strings
 //! like in C.
@@ -44,7 +44,7 @@
 //! code point]'.
 //!
 //! * **Nul terminators and implicit string lengths** - Often, C
-//! strings are nul-terminated, i.e. they have a `\0` character at the
+//! strings are nul-terminated, i.e., they have a `\0` character at the
 //! end. The length of a string buffer is not stored, but has to be
 //! calculated; to compute the length of a string, C code must
 //! manually call a function like `strlen()` for `char`-based strings,
index 9c40a31986cea69554febabb678d768cf9211fb4..828972187eefcc533e533a467324345cf0592f63 100644 (file)
@@ -36,7 +36,7 @@
 /// and platform-native string values, and in particular allowing a Rust string
 /// to be converted into an "OS" string with no cost if possible.  A consequence
 /// of this is that `OsString` instances are *not* `NUL` terminated; in order
-/// to pass to e.g. Unix system call, you should create a [`CStr`].
+/// to pass to e.g., Unix system call, you should create a [`CStr`].
 ///
 /// `OsString` is to [`&OsStr`] as [`String`] is to [`&str`]: the former
 /// in each pair are owned strings; the latter are borrowed
index 7d054a347f4c31f5cc5fe051e0ecbf1b7ab20fdf..b6a0ce6372086efe51c523fa96e5cc55792688b2 100644 (file)
@@ -1406,7 +1406,7 @@ fn as_inner(&self) -> &fs_imp::DirEntry { &self.0 }
 /// Removes a file from the filesystem.
 ///
 /// Note that there is no
-/// guarantee that the file is immediately deleted (e.g. depending on
+/// guarantee that the file is immediately deleted (e.g., depending on
 /// platform, other open file descriptors may prevent immediate removal).
 ///
 /// # Platform-specific behavior
index 14f20151dca861c9ef6e3518392fdac9b4e49ce1..f7a90333ef239c2098544a716472e05e29617a90 100644 (file)
@@ -90,7 +90,7 @@ pub struct Cursor<T> {
 impl<T> Cursor<T> {
     /// Creates a new cursor wrapping the provided underlying in-memory buffer.
     ///
-    /// Cursor initial position is `0` even if underlying buffer (e.g. `Vec`)
+    /// Cursor initial position is `0` even if underlying buffer (e.g., `Vec`)
     /// is not empty. So writing to cursor starts with overwriting `Vec`
     /// content, not with appending to it.
     ///
index a413432cdaabc6ba2b0075a2e10e161379ec7578..8c03f355848e2423612a8ce9b8778a543dc851af 100644 (file)
@@ -131,7 +131,7 @@ fn handle_ebadf<T>(r: io::Result<T>, default: T) -> io::Result<T> {
 ///
 /// Each handle is a shared reference to a global buffer of input data to this
 /// process. A handle can be `lock`'d to gain full access to [`BufRead`] methods
-/// (e.g. `.lines()`). Reads to this handle are otherwise locked with respect
+/// (e.g., `.lines()`). Reads to this handle are otherwise locked with respect
 /// to other reads.
 ///
 /// This handle implements the `Read` trait, but beware that concurrent reads
@@ -269,7 +269,7 @@ pub fn lock(&self) -> StdinLock {
     ///
     /// You can run the example one of two ways:
     ///
-    /// - Pipe some text to it, e.g. `printf foo | path/to/executable`
+    /// - Pipe some text to it, e.g., `printf foo | path/to/executable`
     /// - Give it text interactively by running the executable directly,
     ///   in which case it will wait for the Enter key to be pressed before
     ///   continuing
index c1eaf29bb44072e8dc8ea35a5c6837d36c188dd4..12b60313725beb6a81f6252c1918a01f11420a2b 100644 (file)
@@ -188,7 +188,7 @@ mod enum_keyword { }
 /// For external connections in Rust code.
 ///
 /// The `extern` keyword is used in two places in Rust. One is in conjunction with the [`crate`]
-/// keyword to make your Rust code aware of other Rust crates in your project, i.e. `extern crate
+/// keyword to make your Rust code aware of other Rust crates in your project, i.e., `extern crate
 /// lazy_static;`. The other use is in foreign function interfaces (FFI).
 ///
 /// `extern` is used in two different contexts within FFI. The first is in the form of external
index 1ac0bdf922f885a598ef691c3a34ff5ef7d1a82e..21def5d93b76f15c3f916aa6f14d8b16ba9ff04e 100644 (file)
@@ -703,7 +703,7 @@ fn hash<H: hash::Hasher>(&self, s: &mut H) {
 /// the other: for simple uses a string like `"localhost:12345"` is much nicer
 /// than manual construction of the corresponding [`SocketAddr`], but sometimes
 /// [`SocketAddr`] value is *the* main source of the address, and converting it to
-/// some other type (e.g. a string) just for it to be converted back to
+/// some other type (e.g., a string) just for it to be converted back to
 /// [`SocketAddr`] in constructor methods is pointless.
 ///
 /// Addresses returned by the operating system that are not IP addresses are
index be797803233a86123e478acb2da4cf056bcc54c2..5aa043b0fcb2c37769e976b507c4de9453ac7a1a 100644 (file)
@@ -530,7 +530,7 @@ pub fn take_error(&self) -> io::Result<Option<io::Error>> {
     /// Moves this TCP stream into or out of nonblocking mode.
     ///
     /// This will result in `read`, `write`, `recv` and `send` operations
-    /// becoming nonblocking, i.e. immediately returning from their calls.
+    /// becoming nonblocking, i.e., immediately returning from their calls.
     /// If the IO operation is successful, `Ok` is returned and no further
     /// action is required. If the IO operation could not be completed and needs
     /// to be retried, an error with kind [`io::ErrorKind::WouldBlock`] is
@@ -840,7 +840,7 @@ pub fn take_error(&self) -> io::Result<Option<io::Error>> {
     /// Moves this TCP stream into or out of nonblocking mode.
     ///
     /// This will result in the `accept` operation becoming nonblocking,
-    /// i.e. immediately returning from their calls. If the IO operation is
+    /// i.e., immediately returning from their calls. If the IO operation is
     /// successful, `Ok` is returned and no further action is required. If the
     /// IO operation could not be completed and needs to be retried, an error
     /// with kind [`io::ErrorKind::WouldBlock`] is returned.
index fc68abae05a0447078cffdb380de94a86663a215..6c0c636d30c50e949c1680f4510a3cc9a9a62c5e 100644 (file)
@@ -752,7 +752,7 @@ pub fn peek(&self, buf: &mut [u8]) -> io::Result<usize> {
     /// Moves this UDP socket into or out of nonblocking mode.
     ///
     /// This will result in `recv`, `recv_from`, `send`, and `send_to`
-    /// operations becoming nonblocking, i.e. immediately returning from their
+    /// operations becoming nonblocking, i.e., immediately returning from their
     /// calls. If the IO operation is successful, `Ok` is returned and no
     /// further action is required. If the IO operation could not be completed
     /// and needs to be retried, an error with kind
index 4bc18a57e92a6a6319743f8553c9f07c1fa582a9..099b4d6f5777c61e74d6fbc9092064f87b0c42d2 100644 (file)
@@ -80,7 +80,7 @@
 /// Simply put, a type `T` implements `UnwindSafe` if it cannot easily allow
 /// witnessing a broken invariant through the use of `catch_unwind` (catching a
 /// panic). This trait is an auto trait, so it is automatically implemented for
-/// many types, and it is also structurally composed (e.g. a struct is unwind
+/// many types, and it is also structurally composed (e.g., a struct is unwind
 /// safe if all of its components are unwind safe).
 ///
 /// Note, however, that this is not an unsafe trait, so there is not a succinct
index b70d56f9e593d7fc259eb129873e309e10db3770..6b47ba6d1cb8fc56bcfcf8d0abf98275bd2cfb69 100644 (file)
@@ -460,7 +460,7 @@ fn rust_panic_with_hook(payload: &mut dyn BoxMeUp,
 
     let panics = update_panic_count(1);
 
-    // If this is the third nested call (e.g. panics == 2, this is 0-indexed),
+    // If this is the third nested call (e.g., panics == 2, this is 0-indexed),
     // the panic hook probably triggered the last panic, otherwise the
     // double-panic check would have aborted the process. In this case abort the
     // process real quickly as we don't want to try calling it again as it'll
index 9fad40c564944ee378f247d8db26750a532f74fb..b882442dd2f4e272a8bdd87858d19c47fdc1528c 100644 (file)
 // Windows Prefixes
 ////////////////////////////////////////////////////////////////////////////////
 
-/// Windows path prefixes, e.g. `C:` or `\\server\share`.
+/// Windows path prefixes, e.g., `C:` or `\\server\share`.
 ///
 /// Windows uses a variety of path prefix styles, including references to drive
 /// volumes (like `C:`), network shared folders (like `\\server\share`), and
-/// others. In addition, some path prefixes are "verbatim" (i.e. prefixed with
+/// others. In addition, some path prefixes are "verbatim" (i.e., prefixed with
 /// `\\?\`), in which case `/` is *not* treated as a separator and essentially
 /// no normalization is performed.
 ///
 #[derive(Copy, Clone, Debug, Hash, PartialOrd, Ord, PartialEq, Eq)]
 #[stable(feature = "rust1", since = "1.0.0")]
 pub enum Prefix<'a> {
-    /// Verbatim prefix, e.g. `\\?\cat_pics`.
+    /// Verbatim prefix, e.g., `\\?\cat_pics`.
     ///
     /// Verbatim prefixes consist of `\\?\` immediately followed by the given
     /// component.
@@ -156,7 +156,7 @@ pub enum Prefix<'a> {
     Verbatim(#[stable(feature = "rust1", since = "1.0.0")] &'a OsStr),
 
     /// Verbatim prefix using Windows' _**U**niform **N**aming **C**onvention_,
-    /// e.g. `\\?\UNC\server\share`.
+    /// e.g., `\\?\UNC\server\share`.
     ///
     /// Verbatim UNC prefixes consist of `\\?\UNC\` immediately followed by the
     /// server's hostname and a share name.
@@ -166,14 +166,14 @@ pub enum Prefix<'a> {
         #[stable(feature = "rust1", since = "1.0.0")] &'a OsStr,
     ),
 
-    /// Verbatim disk prefix, e.g. `\\?\C:\`.
+    /// Verbatim disk prefix, e.g., `\\?\C:\`.
     ///
     /// Verbatim disk prefixes consist of `\\?\` immediately followed by the
     /// drive letter and `:\`.
     #[stable(feature = "rust1", since = "1.0.0")]
     VerbatimDisk(#[stable(feature = "rust1", since = "1.0.0")] u8),
 
-    /// Device namespace prefix, e.g. `\\.\COM42`.
+    /// Device namespace prefix, e.g., `\\.\COM42`.
     ///
     /// Device namespace prefixes consist of `\\.\` immediately followed by the
     /// device name.
@@ -227,7 +227,7 @@ fn os_str_len(s: &OsStr) -> usize {
 
     }
 
-    /// Determines if the prefix is verbatim, i.e. begins with `\\?\`.
+    /// Determines if the prefix is verbatim, i.e., begins with `\\?\`.
     ///
     /// # Examples
     ///
@@ -509,7 +509,7 @@ fn hash<H: Hasher>(&self, h: &mut H) {
 #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
 #[stable(feature = "rust1", since = "1.0.0")]
 pub enum Component<'a> {
-    /// A Windows path prefix, e.g. `C:` or `\\server\share`.
+    /// A Windows path prefix, e.g., `C:` or `\\server\share`.
     ///
     /// There is a large variety of prefix types, see [`Prefix`]'s documentation
     /// for more.
@@ -528,15 +528,15 @@ pub enum Component<'a> {
     #[stable(feature = "rust1", since = "1.0.0")]
     RootDir,
 
-    /// A reference to the current directory, i.e. `.`.
+    /// A reference to the current directory, i.e., `.`.
     #[stable(feature = "rust1", since = "1.0.0")]
     CurDir,
 
-    /// A reference to the parent directory, i.e. `..`.
+    /// A reference to the parent directory, i.e., `..`.
     #[stable(feature = "rust1", since = "1.0.0")]
     ParentDir,
 
-    /// A normal component, e.g. `a` and `b` in `a/b`.
+    /// A normal component, e.g., `a` and `b` in `a/b`.
     ///
     /// This variant is the most common one, it represents references to files
     /// or directories.
@@ -615,7 +615,7 @@ pub struct Components<'a> {
 
     // true if path *physically* has a root separator; for most Windows
     // prefixes, it may have a "logical" rootseparator for the purposes of
-    // normalization, e.g.  \\server\share == \\server\share\.
+    // normalization, e.g.,  \\server\share == \\server\share\.
     has_physical_root: bool,
 
     // The iterator is double-ended, and these two states keep track of what has
@@ -798,7 +798,7 @@ fn parse_next_component_back(&self) -> (usize, Option<Component<'a>>) {
         (comp.len() + extra, self.parse_single_component(comp))
     }
 
-    // trim away repeated separators (i.e. empty components) on the left
+    // trim away repeated separators (i.e., empty components) on the left
     fn trim_left(&mut self) {
         while !self.path.is_empty() {
             let (size, comp) = self.parse_next_component();
@@ -810,7 +810,7 @@ fn trim_left(&mut self) {
         }
     }
 
-    // trim away repeated separators (i.e. empty components) on the right
+    // trim away repeated separators (i.e., empty components) on the right
     fn trim_right(&mut self) {
         while self.path.len() > self.len_before_body() {
             let (size, comp) = self.parse_next_component_back();
@@ -1178,7 +1178,7 @@ pub fn as_path(&self) -> &Path {
     ///
     /// On Windows:
     ///
-    /// * if `path` has a root but no prefix (e.g. `\windows`), it
+    /// * if `path` has a root but no prefix (e.g., `\windows`), it
     ///   replaces everything except for the prefix (if any) of `self`.
     /// * if `path` has a prefix but no root, it replaces `self`.
     ///
@@ -1225,7 +1225,7 @@ fn _push(&mut self, path: &Path) {
         if path.is_absolute() || path.prefix().is_some() {
             self.as_mut_vec().truncate(0);
 
-        // `path` has a root but no prefix, e.g. `\windows` (Windows only)
+        // `path` has a root but no prefix, e.g., `\windows` (Windows only)
         } else if path.has_root() {
             let prefix_len = self.components().prefix_remaining();
             self.as_mut_vec().truncate(prefix_len);
@@ -1810,7 +1810,7 @@ pub fn to_path_buf(&self) -> PathBuf {
         PathBuf::from(self.inner.to_os_string())
     }
 
-    /// Returns `true` if the `Path` is absolute, i.e. if it is independent of
+    /// Returns `true` if 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
@@ -1839,7 +1839,7 @@ pub fn is_absolute(&self) -> bool {
         }
     }
 
-    /// Returns `true` if the `Path` is relative, i.e. not absolute.
+    /// Returns `true` if the `Path` is relative, i.e., not absolute.
     ///
     /// See [`is_absolute`]'s documentation for more details.
     ///
@@ -1866,9 +1866,9 @@ fn prefix(&self) -> Option<Prefix> {
     /// * On Unix, a path has a root if it begins with `/`.
     ///
     /// * On Windows, a path has a root if it:
-    ///     * has no prefix and begins with a separator, e.g. `\windows`
-    ///     * has a prefix followed by a separator, e.g. `c:\windows` but not `c:windows`
-    ///     * has any non-disk prefix, e.g. `\\server\share`
+    ///     * has no prefix and begins with a separator, e.g., `\windows`
+    ///     * has a prefix followed by a separator, e.g., `c:\windows` but not `c:windows`
+    ///     * has any non-disk prefix, e.g., `\\server\share`
     ///
     /// # Examples
     ///
@@ -1980,7 +1980,7 @@ pub fn file_name(&self) -> Option<&OsStr> {
     ///
     /// # Errors
     ///
-    /// If `base` is not a prefix of `self` (i.e. [`starts_with`]
+    /// If `base` is not a prefix of `self` (i.e., [`starts_with`]
     /// returns `false`), returns [`Err`].
     ///
     /// [`starts_with`]: #method.starts_with
@@ -2406,7 +2406,7 @@ pub fn read_dir(&self) -> io::Result<fs::ReadDir> {
     /// This function will traverse symbolic links to query information about the
     /// destination file. In case of broken symbolic links this will return `false`.
     ///
-    /// If you cannot access the directory containing the file, e.g. because of a
+    /// If you cannot access the directory containing the file, e.g., because of a
     /// permission error, this will return `false`.
     ///
     /// # Examples
@@ -2432,7 +2432,7 @@ pub fn exists(&self) -> bool {
     /// This function will traverse symbolic links to query information about the
     /// destination file. In case of broken symbolic links this will return `false`.
     ///
-    /// If you cannot access the directory containing the file, e.g. because of a
+    /// If you cannot access the directory containing the file, e.g., because of a
     /// permission error, this will return `false`.
     ///
     /// # Examples
@@ -2461,7 +2461,7 @@ pub fn is_file(&self) -> bool {
     /// This function will traverse symbolic links to query information about the
     /// destination file. In case of broken symbolic links this will return `false`.
     ///
-    /// If you cannot access the directory containing the file, e.g. because of a
+    /// If you cannot access the directory containing the file, e.g., because of a
     /// permission error, this will return `false`.
     ///
     /// # Examples
index 48acc1096a6811494b721d3931e0cfd857fda393..3b2366a9eca9dee0a331d6c50410074a9160ca29 100644 (file)
@@ -462,7 +462,7 @@ mod prim_pointer { }
 ///
 /// There are two syntactic forms for creating an array:
 ///
-/// * A list with each element, i.e. `[x, y, z]`.
+/// * A list with each element, i.e., `[x, y, z]`.
 /// * A repeat expression `[x; N]`, which produces an array with `N` copies of `x`.
 ///   The type of `x` must be [`Copy`][copy].
 ///
index 2d0848252be6d9d689fa02dc84b921bf9b25a3cd..b42ad29034c88173df3b6fd8b00f2e089774f535 100644 (file)
@@ -628,7 +628,7 @@ pub fn env_clear(&mut self) -> &mut Command {
     ///
     /// # Platform-specific behavior
     ///
-    /// If the program path is relative (e.g. `"./script.sh"`), it's ambiguous
+    /// If the program path is relative (e.g., `"./script.sh"`), it's ambiguous
     /// whether it should be interpreted relative to the parent's working
     /// directory or relative to `current_dir`. The behavior in this case is
     /// platform specific and unstable, and it's recommended to use
index a7db372a0e20a86a42cf326c78d4949f4531fc2c..81356e68bc0b81d88224d8edcb974b82b39440e4 100644 (file)
@@ -89,7 +89,7 @@
 //!
 //! - A **single processor** executing instructions [out-of-order]:
 //!   Modern CPUs are capable of [superscalar] execution,
-//!   i.e. multiple instructions might be executing at the same time,
+//!   i.e., multiple instructions might be executing at the same time,
 //!   even though the machine code describes a sequential process.
 //!
 //!   This kind of reordering is handled transparently by the CPU.
index 90f12c826d68e52417fcf1423e15a9b10b22f7b0..dc80f561f7a3a2ca63ee54b289bbba966530ac11 100644 (file)
@@ -292,7 +292,7 @@ pub fn recv(&self, deadline: Option<Instant>) -> Result<T, Failure> {
             }
         }
 
-        // NB: Channel could be disconnected while waiting, so the order of
+        // N.B., channel could be disconnected while waiting, so the order of
         // these conditionals is important.
         if guard.disconnected && guard.buf.size() == 0 {
             return Err(Disconnected);
index cf9698cb2a9712b6a2439314503c0aef40e63ffd..13e0d2edb8375735536a0504688327eb217923c5 100644 (file)
@@ -189,7 +189,7 @@ pub const fn new() -> Once {
     /// static INIT: Once = Once::new();
     ///
     /// // Accessing a `static mut` is unsafe much of the time, but if we do so
-    /// // in a synchronized fashion (e.g. write once or read all) then we're
+    /// // in a synchronized fashion (e.g., write once or read all) then we're
     /// // good to go!
     /// //
     /// // This function will only call `expensive_computation` once, and will
@@ -232,7 +232,7 @@ pub fn call_once<F>(&self, f: F) where F: FnOnce() {
 
     /// Performs the same function as [`call_once`] except ignores poisoning.
     ///
-    /// Unlike [`call_once`], if this `Once` has been poisoned (i.e. a previous
+    /// Unlike [`call_once`], if this `Once` has been poisoned (i.e., a previous
     /// call to `call_once` or `call_once_force` caused a panic), calling
     /// `call_once_force` will still invoke the closure `f` and will _not_
     /// result in an immediate panic. If `f` panics, the `Once` will remain
index 10436723a81d0d108f2c65da6c19497addea584d..462eab56664f689e074a04a11105105016fc33e9 100644 (file)
@@ -15,7 +15,7 @@
 //! always work with the most recent version of Android, but we also want to
 //! work with older versions of Android for whenever projects need to.
 //!
-//! Our current minimum supported Android version is `android-9`, e.g. Android
+//! Our current minimum supported Android version is `android-9`, e.g., Android
 //! with API level 9. We then in theory want to work on that and all future
 //! versions of Android!
 //!
index 737437c76b7c439daff85a09f11fdf773de37939..bcf0d440ebadcf15a75b3232a6b4e76d0ff48fe3 100644 (file)
@@ -132,7 +132,7 @@ fn from_parts(addr: libc::sockaddr_un, mut len: libc::socklen_t) -> io::Result<S
         if len == 0 {
             // When there is a datagram from unnamed unix socket
             // linux returns zero bytes of address
-            len = sun_path_offset() as libc::socklen_t;  // i.e. zero-length address
+            len = sun_path_offset() as libc::socklen_t;  // i.e., zero-length address
         } else if addr.sun_family != libc::AF_UNIX as libc::sa_family_t {
             return Err(io::Error::new(io::ErrorKind::InvalidInput,
                                       "file descriptor did not correspond to a Unix socket"));
index 2d10541752c83b3ca21b1ab5cfdfebf91d340250..d922be520d4be988538b1bb95855474124c83e4e 100644 (file)
@@ -26,7 +26,7 @@
 pub type wrlen_t = size_t;
 
 // See below for the usage of SOCK_CLOEXEC, but this constant is only defined on
-// Linux currently (e.g. support doesn't exist on other platforms). In order to
+// Linux currently (e.g., support doesn't exist on other platforms). In order to
 // get name resolution to work and things to compile we just define a dummy
 // SOCK_CLOEXEC here for other platforms. Note that the dummy constant isn't
 // actually ever used (the blocks below are wrapped in `if cfg!` as well.
index a06c73ee263c29178e8e17c4601428b0d41f05f4..0335c1e914c6f7f7ee94bd32b123ab13f9e2452d 100644 (file)
@@ -215,7 +215,7 @@ pub fn fdio_spawn_etc(job: zx_handle_t, flags: u32, path: *const c_char,
 // and has a closed remote end will return ERR_REMOTE_CLOSED.
 #[allow(unused)] pub const ERR_SHOULD_WAIT: zx_status_t = -22;
 
-// ERR_CANCELED: The in-progress operation (e.g. a wait) has been
+// ERR_CANCELED: The in-progress operation (e.g., a wait) has been
 // // canceled.
 #[allow(unused)] pub const ERR_CANCELED: zx_status_t = -23;
 
index bae0d02786a092dd8134a428fb2ab7a2fbf0cbd5..0a13aeabe8452f3574d5f1f558898df8937ea64a 100644 (file)
@@ -117,7 +117,7 @@ fn from_wide(wide: &[u16]) -> OsString {
 /// [`OsStr`]: ../../../../std/ffi/struct.OsStr.html
 #[stable(feature = "rust1", since = "1.0.0")]
 pub trait OsStrExt {
-    /// Re-encodes an `OsStr` as a wide character sequence, i.e. potentially
+    /// Re-encodes an `OsStr` as a wide character sequence, i.e., potentially
     /// ill-formed UTF-16.
     ///
     /// This is lossless: calling [`OsString::from_wide`] and then
index 082d4689c7ba8ef16e60f3597d7e263ab40128b4..949060b34dda24b7b8744f611834f82c0e80fc0f 100644 (file)
@@ -443,7 +443,7 @@ fn from_inner(handle: c::HANDLE) -> File {
 
 impl fmt::Debug for File {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        // FIXME(#24570): add more info here (e.g. mode)
+        // FIXME(#24570): add more info here (e.g., mode)
         let mut b = f.debug_struct("File");
         b.field("handle", &self.handle.raw());
         if let Ok(path) = get_path(&self) {
index 4d7b7236c59c64b0e60dbbed5d0c7b878f593102..2be30e68d24c2c14977f84263a519d5eb0e5f236 100644 (file)
@@ -67,7 +67,7 @@ pub fn error_string(mut errnum: i32) -> String {
                                     buf.len() as c::DWORD,
                                     ptr::null()) as usize;
         if res == 0 {
-            // Sometimes FormatMessageW can fail e.g. system doesn't like langId,
+            // Sometimes FormatMessageW can fail e.g., system doesn't like langId,
             let fm_err = errno();
             return format!("OS Error {} (FormatMessageW() returned error {})",
                            errnum, fm_err);
index 4b19519a57a876cc94ed430e640e89544833aa46..f9eed31f0e0e3319fc730db3d9e07ab324d5fc88 100644 (file)
@@ -100,23 +100,23 @@ pub fn anon_pipe(ours_readable: bool) -> io::Result<Pipes> {
                                              0,
                                              ptr::null_mut());
 
-            // We pass the FILE_FLAG_FIRST_PIPE_INSTANCE flag above, and we're
+            // We pass the `FILE_FLAG_FIRST_PIPE_INSTANCE` flag above, and we're
             // also just doing a best effort at selecting a unique name. If
-            // ERROR_ACCESS_DENIED is returned then it could mean that we
+            // `ERROR_ACCESS_DENIED` is returned then it could mean that we
             // accidentally conflicted with an already existing pipe, so we try
             // again.
             //
             // Don't try again too much though as this could also perhaps be a
             // legit error.
-            // If ERROR_INVALID_PARAMETER is returned, this probably means we're
-            // running on pre-Vista version where PIPE_REJECT_REMOTE_CLIENTS is
+            // If `ERROR_INVALID_PARAMETER` is returned, this probably means we're
+            // running on pre-Vista version where `PIPE_REJECT_REMOTE_CLIENTS` is
             // not supported, so we continue retrying without it. This implies
             // reduced security on Windows versions older than Vista by allowing
             // connections to this pipe from remote machines.
             // 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 https://github.com/rust-lang/rust/pull/37677.
             if handle == c::INVALID_HANDLE_VALUE {
                 let err = io::Error::last_os_error();
                 let raw_os_err = err.raw_os_error();
index 6ad3af6aee1d5cf42d329694e7b1257a2d2c6224..c2589d477ee0d26246180ada6c6e52adc1ab1978 100644 (file)
@@ -23,7 +23,7 @@ pub fn foreach_symbol_fileline<F>(frame: Frame,
 where F: FnMut(&[u8], u32) -> io::Result<()>
 {
     // pcinfo may return an arbitrary number of file:line pairs,
-    // in the order of stack trace (i.e. inlined calls first).
+    // in the order of stack trace (i.e., inlined calls first).
     // in order to avoid allocation, we stack-allocate a fixed size of entries.
     const FILELINE_SIZE: usize = 32;
     let mut fileline_buf = [(ptr::null(), !0); FILELINE_SIZE];
index 4df4751117244451299281594de09ec169aa75b4..8bb990960618e78d43a32b9488a5f5b53c6abf3f 100644 (file)
@@ -269,7 +269,7 @@ unsafe fn init(&self, slot: &UnsafeCell<Option<T>>) -> &T {
         //      ptr::write(ptr, Some(value))
         //
         // Due to this pattern it's possible for the destructor of the value in
-        // `ptr` (e.g. if this is being recursively initialized) to re-access
+        // `ptr` (e.g., if this is being recursively initialized) to re-access
         // TLS, in which case there will be a `&` and `&mut` pointer to the same
         // value (an aliasing violation). To avoid setting the "I'm running a
         // destructor" flag we just use `mem::replace` which should sequence the
index d15b49024121b9d1f618034d3aa93a1215668efe..194e2881df34609971891a9d2c50a5259dc89bef 100644 (file)
@@ -93,7 +93,7 @@
 //! Threads are represented via the [`Thread`] type, which you can get in one of
 //! two ways:
 //!
-//! * By spawning a new thread, e.g. using the [`thread::spawn`][`spawn`]
+//! * By spawning a new thread, e.g., using the [`thread::spawn`][`spawn`]
 //!   function, and calling [`thread`][`JoinHandle::thread`] on the [`JoinHandle`].
 //! * By requesting the current thread, using the [`thread::current`] function.
 //!
 //! thread, use [`Thread::name`]. A couple examples of where the name of a thread gets used:
 //!
 //! * If a panic occurs in a named thread, the thread name will be printed in the panic message.
-//! * The thread name is provided to the OS where applicable (e.g. `pthread_setname_np` in
+//! * The thread name is provided to the OS where applicable (e.g., `pthread_setname_np` in
 //!   unix-like platforms).
 //!
 //! ## Stack size
@@ -422,7 +422,7 @@ pub fn spawn<F, T>(self, f: F) -> io::Result<JoinHandle<T>> where
     ///
     /// - ensure that [`join`][`JoinHandle::join`] is called before any referenced
     /// data is dropped
-    /// - use only types with `'static` lifetime bounds, i.e. those with no or only
+    /// - use only types with `'static` lifetime bounds, i.e., those with no or only
     /// `'static` references (both [`thread::Builder::spawn`][`Builder::spawn`]
     /// and [`thread::spawn`][`spawn`] enforce this property statically)
     ///
@@ -692,7 +692,7 @@ pub fn yield_now() {
 /// already poison themselves when a thread panics while holding the lock.
 ///
 /// This can also be used in multithreaded applications, in order to send a
-/// message to other threads warning that a thread has panicked (e.g. for
+/// message to other threads warning that a thread has panicked (e.g., for
 /// monitoring purposes).
 ///
 /// # Examples
@@ -1078,7 +1078,7 @@ struct Inner {
 /// Threads are represented via the `Thread` type, which you can get in one of
 /// two ways:
 ///
-/// * By spawning a new thread, e.g. using the [`thread::spawn`][`spawn`]
+/// * By spawning a new thread, e.g., using the [`thread::spawn`][`spawn`]
 ///   function, and calling [`thread`][`JoinHandle::thread`] on the
 ///   [`JoinHandle`].
 /// * By requesting the current thread, using the [`thread::current`] function.
index 5d0d501615f56b4d19a5d531b8474f4497c5cc04..667810485ee39d004f5aade433e402c299677cab 100644 (file)
@@ -330,7 +330,7 @@ pub fn duration_since(&self, earlier: SystemTime)
     /// Returns the amount of time elapsed since this system time was created.
     ///
     /// This function may fail as the underlying system clock is susceptible to
-    /// drift and updates (e.g. the system clock could go backwards), so this
+    /// drift and updates (e.g., the system clock could go backwards), so this
     /// function may not always succeed. If successful, [`Ok`]`(`[`Duration`]`)` is
     /// returned where the duration represents the amount of time elapsed from
     /// this time measurement to the current time.
index 872257118714e55930bd45ad21bb76319a7cd006..f25f456e3ae40de0015443b7abd4a81e3324b9c1 100644 (file)
@@ -68,7 +68,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
 /// It's represented as a sequence of identifiers,
 /// along with a bunch of supporting information.
 ///
-/// E.g. `std::cmp::PartialEq`
+/// E.g., `std::cmp::PartialEq`.
 #[derive(Clone, RustcEncodable, RustcDecodable)]
 pub struct Path {
     pub span: Span,
@@ -96,8 +96,8 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
 }
 
 impl Path {
-    // convert a span and an identifier to the corresponding
-    // 1-segment path
+    // Convert a span and an identifier to the corresponding
+    // one-segment path.
     pub fn from_ident(ident: Ident) -> Path {
         Path {
             segments: vec![PathSegment::from_ident(ident)],
@@ -112,7 +112,7 @@ pub fn is_global(&self) -> bool {
 
 /// A segment of a path: an identifier, an optional lifetime, and a set of types.
 ///
-/// E.g. `std`, `String` or `Box<T>`
+/// E.g., `std`, `String` or `Box<T>`.
 #[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
 pub struct PathSegment {
     /// The identifier portion of this path segment.
@@ -140,7 +140,7 @@ pub fn path_root(span: Span) -> Self {
 
 /// Arguments of a path segment.
 ///
-/// E.g. `<A, B>` as in `Foo<A, B>` or `(A, B)` as in `Foo(A, B)`
+/// E.g., `<A, B>` as in `Foo<A, B>` or `(A, B)` as in `Foo(A, B)`.
 #[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
 pub enum GenericArgs {
     /// The `<'a, A,B,C>` in `foo::bar::baz::<'a, A,B,C>`
@@ -282,7 +282,7 @@ pub fn span(&self) -> Span {
 
 #[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
 pub enum GenericParamKind {
-    /// A lifetime definition, e.g. `'a: 'b+'c+'d`.
+    /// A lifetime definition (e.g., `'a: 'b + 'c + 'd`).
     Lifetime,
     Type {
         default: Option<P<Ty>>,
@@ -334,11 +334,11 @@ pub struct WhereClause {
 /// 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`
+    /// A type binding (e.g., `for<'c> Foo: Send + Clone + 'c`).
     BoundPredicate(WhereBoundPredicate),
-    /// A lifetime predicate, e.g. `'a: 'b+'c`
+    /// A lifetime predicate (e.g., `'a: 'b + 'c`).
     RegionPredicate(WhereRegionPredicate),
-    /// An equality predicate (unsupported)
+    /// An equality predicate (unsupported).
     EqPredicate(WhereEqPredicate),
 }
 
@@ -354,7 +354,7 @@ pub fn span(&self) -> Span {
 
 /// A type bound.
 ///
-/// E.g. `for<'c> Foo: Send+Clone+'c`
+/// E.g., `for<'c> Foo: Send + Clone + 'c`.
 #[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
 pub struct WhereBoundPredicate {
     pub span: Span,
@@ -368,7 +368,7 @@ pub struct WhereBoundPredicate {
 
 /// A lifetime predicate.
 ///
-/// E.g. `'a: 'b+'c`
+/// E.g., `'a: 'b + 'c`.
 #[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
 pub struct WhereRegionPredicate {
     pub span: Span,
@@ -378,7 +378,7 @@ pub struct WhereRegionPredicate {
 
 /// An equality predicate (unsupported).
 ///
-/// E.g. `T=int`
+/// E.g., `T = int`.
 #[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
 pub struct WhereEqPredicate {
     pub id: NodeId,
@@ -387,8 +387,8 @@ pub struct WhereEqPredicate {
     pub rhs_ty: P<Ty>,
 }
 
-/// The set of MetaItems that define the compilation environment of the crate,
-/// used to drive conditional compilation
+/// The set of `MetaItem`s that define the compilation environment of the crate,
+/// used to drive conditional compilation.
 pub type CrateConfig = FxHashSet<(Name, Option<Symbol>)>;
 
 #[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
@@ -403,20 +403,20 @@ pub struct Crate {
 
 /// Possible values inside of compile-time attribute lists.
 ///
-/// E.g. the '..' in `#[name(..)]`.
+/// E.g., the '..' in `#[name(..)]`.
 #[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
 pub enum NestedMetaItemKind {
     /// A full MetaItem, for recursive meta items.
     MetaItem(MetaItem),
     /// A literal.
     ///
-    /// E.g. "foo", 64, true
+    /// E.g., `"foo"`, `64`, `true`.
     Literal(Lit),
 }
 
 /// A spanned compile-time attribute item.
 ///
-/// E.g. `#[test]`, `#[derive(..)]`, `#[rustfmt::skip]` or `#[feature = "foo"]`
+/// E.g., `#[test]`, `#[derive(..)]`, `#[rustfmt::skip]` or `#[feature = "foo"]`.
 #[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
 pub struct MetaItem {
     pub ident: Path,
@@ -426,26 +426,26 @@ pub struct MetaItem {
 
 /// A compile-time attribute item.
 ///
-/// E.g. `#[test]`, `#[derive(..)]` or `#[feature = "foo"]`
+/// E.g., `#[test]`, `#[derive(..)]` or `#[feature = "foo"]`.
 #[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
 pub enum MetaItemKind {
     /// Word meta item.
     ///
-    /// E.g. `test` as in `#[test]`
+    /// E.g., `test` as in `#[test]`.
     Word,
     /// List meta item.
     ///
-    /// E.g. `derive(..)` as in `#[derive(..)]`
+    /// E.g., `derive(..)` as in `#[derive(..)]`.
     List(Vec<NestedMetaItem>),
     /// Name value meta item.
     ///
-    /// E.g. `feature = "foo"` as in `#[feature = "foo"]`
+    /// E.g., `feature = "foo"` as in `#[feature = "foo"]`.
     NameValue(Lit),
 }
 
 /// A Block (`{ .. }`).
 ///
-/// E.g. `{ .. }` as in `fn foo() { .. }`
+/// E.g., `{ .. }` as in `fn foo() { .. }`.
 #[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
 pub struct Block {
     /// Statements in a block
@@ -568,7 +568,7 @@ pub enum RangeSyntax {
 
 #[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
 pub enum PatKind {
-    /// Represents a wildcard pattern (`_`)
+    /// Represents a wildcard pattern (`_`).
     Wild,
 
     /// A `PatKind::Ident` may either be a new bound variable (`ref mut binding @ OPT_SUBPATTERN`),
@@ -577,13 +577,13 @@ pub enum PatKind {
     /// during name resolution.
     Ident(BindingMode, Ident, Option<P<Pat>>),
 
-    /// 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(Path, Vec<Spanned<FieldPat>>, bool),
 
-    /// A tuple struct/variant pattern `Variant(x, y, .., z)`.
+    /// A tuple struct/variant pattern (`Variant(x, y, .., z)`).
     /// If the `..` pattern fragment is present, then `Option<usize>` denotes its position.
-    /// 0 <= position <= subpats.len()
+    /// `0 <= position <= subpats.len()`.
     TupleStruct(Path, Vec<P<Pat>>, Option<usize>),
 
     /// A possibly qualified path pattern.
@@ -592,24 +592,24 @@ pub enum PatKind {
     /// only legally refer to associated constants.
     Path(Option<QSelf>, Path),
 
-    /// A tuple pattern `(a, b)`.
+    /// A tuple pattern (`(a, b)`).
     /// If the `..` pattern fragment is present, then `Option<usize>` denotes its position.
-    /// 0 <= position <= subpats.len()
+    /// `0 <= position <= subpats.len()`.
     Tuple(Vec<P<Pat>>, Option<usize>),
-    /// A `box` pattern
+    /// A `box` pattern.
     Box(P<Pat>),
-    /// A reference pattern, e.g. `&mut (a, b)`
+    /// A reference pattern (e.g., `&mut (a, b)`).
     Ref(P<Pat>, Mutability),
-    /// A literal
+    /// A literal.
     Lit(P<Expr>),
-    /// A range pattern, e.g. `1...2`, `1..=2` or `1..2`
+    /// A range pattern (e.g., `1...2`, `1..=2` or `1..2`).
     Range(P<Expr>, P<Expr>, Spanned<RangeEnd>),
     /// `[a, b, ..i, y, z]` is represented as:
     ///     `PatKind::Slice(box [a, b], Some(i), box [y, z])`
     Slice(Vec<P<Pat>>, Option<P<Pat>>, Vec<P<Pat>>),
-    /// Parentheses in patterns used for grouping, i.e. `(PAT)`.
+    /// Parentheses in patterns used for grouping (i.e., `(PAT)`).
     Paren(P<Pat>),
-    /// A macro pattern; pre-expansion
+    /// A macro pattern; pre-expansion.
     Mac(Mac),
 }
 
@@ -807,23 +807,23 @@ pub enum StmtKind {
 
 #[derive(Clone, Copy, PartialEq, RustcEncodable, RustcDecodable, Debug)]
 pub enum MacStmtStyle {
-    /// The macro statement had a trailing semicolon, e.g. `foo! { ... };`
-    /// `foo!(...);`, `foo![...];`
+    /// The macro statement had a trailing semicolon (e.g., `foo! { ... };`
+    /// `foo!(...);`, `foo![...];`).
     Semicolon,
-    /// The macro statement had braces; e.g. foo! { ... }
+    /// The macro statement had braces (e.g., `foo! { ... }`).
     Braces,
-    /// The macro statement had parentheses or brackets and no semicolon; e.g.
-    /// `foo!(...)`. All of these will end up being converted into macro
+    /// The macro statement had parentheses or brackets and no semicolon (e.g.,
+    /// `foo!(...)`). All of these will end up being converted into macro
     /// expressions.
     NoBraces,
 }
 
-/// Local represents a `let` statement, e.g., `let <pat>:<ty> = <expr>;`
+/// Local represents a `let` statement, e.g., `let <pat>:<ty> = <expr>;`.
 #[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
 pub struct Local {
     pub pat: P<Pat>,
     pub ty: Option<P<Ty>>,
-    /// Initializer expression to set the value, if any
+    /// Initializer expression to set the value, if any.
     pub init: Option<P<Expr>>,
     pub id: NodeId,
     pub span: Span,
@@ -832,7 +832,7 @@ pub struct Local {
 
 /// An arm of a 'match'.
 ///
-/// E.g. `0..=10 => { println!("match!") }` as in
+/// E.g., `0..=10 => { println!("match!") }` as in
 ///
 /// ```
 /// match 123 {
@@ -878,8 +878,8 @@ pub enum UnsafeSource {
 
 /// A constant (expression) that's not an item or associated item,
 /// but needs its own `DefId` for type-checking, const-eval, etc.
-/// These are usually found nested inside types (e.g. array lengths)
-/// or expressions (e.g. repeat counts), and also used to define
+/// These are usually found nested inside types (e.g., array lengths)
+/// or expressions (e.g., repeat counts), and also used to define
 /// explicit discriminant values for enum variants.
 #[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
 pub struct AnonConst {
@@ -901,7 +901,7 @@ pub struct Expr {
 static_assert!(MEM_SIZE_OF_EXPR: std::mem::size_of::<Expr>() == 88);
 
 impl Expr {
-    /// Whether this expression would be valid somewhere that expects a value, for example, an `if`
+    /// Whether this expression would be valid somewhere that expects a value; for example, an `if`
     /// condition.
     pub fn returns(&self) -> bool {
         if let ExprKind::Block(ref block, _) = self.node {
@@ -1049,24 +1049,24 @@ pub enum ExprKind {
     ///
     /// The `PathSegment` represents the method name and its generic arguments
     /// (within the angle brackets).
-    /// The first element of the vector of `Expr`s is the expression that evaluates
+    /// The first element of the vector of an `Expr` is the expression that evaluates
     /// to the object on which the method is being called on (the receiver),
     /// and the remaining elements are the rest of the arguments.
     /// Thus, `x.foo::<Bar, Baz>(a, b, c, d)` is represented as
     /// `ExprKind::MethodCall(PathSegment { foo, [Bar, Baz] }, [x, a, b, c, d])`.
     MethodCall(PathSegment, Vec<P<Expr>>),
-    /// A tuple (`(a, b, c ,d)`)
+    /// A tuple (e.g., `(a, b, c, d)`).
     Tup(Vec<P<Expr>>),
-    /// A binary operation (For example: `a + b`, `a * b`)
+    /// A binary operation (e.g., `a + b`, `a * b`).
     Binary(BinOp, P<Expr>, P<Expr>),
-    /// A unary operation (For example: `!x`, `*x`)
+    /// A unary operation (e.g., `!x`, `*x`).
     Unary(UnOp, P<Expr>),
-    /// A literal (For example: `1`, `"foo"`)
+    /// A literal (e.g., `1`, `"foo"`).
     Lit(Lit),
-    /// A cast (`foo as f64`)
+    /// A cast (e.g., `foo as f64`).
     Cast(P<Expr>, P<Ty>),
     Type(P<Expr>, P<Ty>),
-    /// An `if` block, with an optional else block
+    /// An `if` block, with an optional `else` block.
     ///
     /// `if expr { block } else { expr }`
     If(P<Expr>, P<Block>, Option<P<Expr>>),
@@ -1080,31 +1080,31 @@ pub enum ExprKind {
     ///
     /// `'label: while expr { block }`
     While(P<Expr>, P<Block>, Option<Label>),
-    /// A while-let loop, with an optional label
+    /// A `while let` loop, with an optional label.
     ///
     /// `'label: while let pat = expr { block }`
     ///
     /// This is desugared to a combination of `loop` and `match` expressions.
     WhileLet(Vec<P<Pat>>, P<Expr>, P<Block>, Option<Label>),
-    /// A for loop, with an optional label
+    /// A `for` loop, with an optional label.
     ///
     /// `'label: for pat in expr { block }`
     ///
     /// This is desugared to a combination of `loop` and `match` expressions.
     ForLoop(P<Pat>, P<Expr>, P<Block>, Option<Label>),
-    /// Conditionless loop (can be exited with break, continue, or return)
+    /// Conditionless loop (can be exited with `break`, `continue`, or `return`).
     ///
     /// `'label: loop { block }`
     Loop(P<Block>, Option<Label>),
     /// A `match` block.
     Match(P<Expr>, Vec<Arm>),
-    /// A closure (for example, `move |a, b, c| a + b + c`)
+    /// A closure (e.g., `move |a, b, c| a + b + c`).
     ///
-    /// The final span is the span of the argument block `|...|`
+    /// The final span is the span of the argument block `|...|`.
     Closure(CaptureBy, IsAsync, Movability, P<FnDecl>, P<Expr>, Span),
-    /// A block (`'label: { ... }`)
+    /// A block (`'label: { ... }`).
     Block(P<Block>, Option<Label>),
-    /// An async block (`async move { ... }`)
+    /// An async block (`async move { ... }`).
     ///
     /// The `NodeId` is the `NodeId` for the closure that results from
     /// desugaring an async block, just like the NodeId field in the
@@ -1113,70 +1113,69 @@ pub enum ExprKind {
     /// created during lowering cannot be made the parent of any other
     /// preexisting defs.
     Async(CaptureBy, NodeId, P<Block>),
-    /// A try block (`try { ... }`)
+    /// A try block (`try { ... }`).
     TryBlock(P<Block>),
 
-    /// An assignment (`a = foo()`)
+    /// An assignment (`a = foo()`).
     Assign(P<Expr>, P<Expr>),
-    /// An assignment with an operator
+    /// An assignment with an operator.
     ///
-    /// For example, `a += 1`.
+    /// E.g., `a += 1`.
     AssignOp(BinOp, P<Expr>, P<Expr>),
-    /// Access of a named (`obj.foo`) or unnamed (`obj.0`) struct field
+    /// Access of a named (e.g., `obj.foo`) or unnamed (e.g., `obj.0`) struct field.
     Field(P<Expr>, Ident),
-    /// An indexing operation (`foo[2]`)
+    /// An indexing operation (e.g., `foo[2]`).
     Index(P<Expr>, P<Expr>),
-    /// A range (`1..2`, `1..`, `..2`, `1...2`, `1...`, `...2`)
+    /// A range (e.g., `1..2`, `1..`, `..2`, `1...2`, `1...`, `...2`).
     Range(Option<P<Expr>>, Option<P<Expr>>, RangeLimits),
 
     /// Variable reference, possibly containing `::` and/or type
-    /// parameters, e.g. foo::bar::<baz>.
+    /// parameters (e.g., `foo::bar::<baz>`).
     ///
-    /// Optionally "qualified",
-    /// E.g. `<Vec<T> as SomeTrait>::SomeType`.
+    /// Optionally "qualified" (e.g., `<Vec<T> as SomeTrait>::SomeType`).
     Path(Option<QSelf>, Path),
 
-    /// A referencing operation (`&a` or `&mut a`)
+    /// A referencing operation (`&a` or `&mut a`).
     AddrOf(Mutability, P<Expr>),
-    /// A `break`, with an optional label to break, and an optional expression
+    /// A `break`, with an optional label to break, and an optional expression.
     Break(Option<Label>, Option<P<Expr>>),
-    /// A `continue`, with an optional label
+    /// A `continue`, with an optional label.
     Continue(Option<Label>),
-    /// A `return`, with an optional value to be returned
+    /// A `return`, with an optional value to be returned.
     Ret(Option<P<Expr>>),
 
-    /// Output of the `asm!()` macro
+    /// Output of the `asm!()` macro.
     InlineAsm(P<InlineAsm>),
 
-    /// A macro invocation; pre-expansion
+    /// A macro invocation; pre-expansion.
     Mac(Mac),
 
     /// A struct literal expression.
     ///
-    /// For example, `Foo {x: 1, y: 2}`, or
-    /// `Foo {x: 1, .. base}`, where `base` is the `Option<Expr>`.
+    /// E.g., `Foo {x: 1, y: 2}`, or `Foo {x: 1, .. base}`,
+    /// where `base` is the `Option<Expr>`.
     Struct(Path, Vec<Field>, Option<P<Expr>>),
 
     /// An array literal constructed from one repeated element.
     ///
-    /// For example, `[1; 5]`. The expression is the element to be
+    /// E.g., `[1; 5]`. The expression is the element to be
     /// repeated; the constant is the number of times to repeat it.
     Repeat(P<Expr>, AnonConst),
 
-    /// No-op: used solely so we can pretty-print faithfully
+    /// No-op: used solely so we can pretty-print faithfully.
     Paren(P<Expr>),
 
-    /// `expr?`
+    /// A try expression (`expr?`).
     Try(P<Expr>),
 
-    /// A `yield`, with an optional value to be yielded
+    /// A `yield`, with an optional value to be yielded.
     Yield(Option<P<Expr>>),
 }
 
-/// The explicit Self type in a "qualified path". The actual
+/// The explicit `Self` type in a "qualified path". The actual
 /// path, including the trait and the associated item, is stored
 /// separately. `position` represents the index of the associated
-/// item qualified with this Self type.
+/// item qualified with this `Self` type.
 ///
 /// ```ignore (only-for-syntax-highlight)
 /// <Vec<T> as a::b::Trait>::AssociatedItem
@@ -1198,14 +1197,14 @@ pub struct QSelf {
     pub position: usize,
 }
 
-/// A capture clause
+/// A capture clause.
 #[derive(Clone, Copy, PartialEq, RustcEncodable, RustcDecodable, Debug)]
 pub enum CaptureBy {
     Value,
     Ref,
 }
 
-/// The movability of a generator / closure literal
+/// The movability of a generator / closure literal.
 #[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Debug, Copy)]
 pub enum Movability {
     Static,
@@ -1214,12 +1213,12 @@ pub enum Movability {
 
 pub type Mac = Spanned<Mac_>;
 
-/// Represents a macro invocation. The Path indicates which macro
+/// Represents a macro invocation. The `Path` indicates which macro
 /// is being invoked, and the vector of token-trees contains the source
 /// of the macro invocation.
 ///
-/// NB: the additional ident for a macro_rules-style macro is actually
-/// stored in the enclosing item. Oog.
+/// N.B., the additional ident for a `macro_rules`-style macro is actually
+/// stored in the enclosing item.
 #[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
 pub struct Mac_ {
     pub path: Path,
@@ -1254,15 +1253,15 @@ pub fn stream(&self) -> TokenStream {
 
 #[derive(Clone, RustcEncodable, RustcDecodable, Debug, Copy, Hash, PartialEq)]
 pub enum StrStyle {
-    /// A regular string, like `"foo"`
+    /// A regular string, like `"foo"`.
     Cooked,
-    /// A raw string, like `r##"foo"##`
+    /// A raw string, like `r##"foo"##`.
     ///
     /// The value is the number of `#` symbols used.
     Raw(u16),
 }
 
-/// A literal
+/// A literal.
 pub type Lit = Spanned<LitKind>;
 
 #[derive(Clone, RustcEncodable, RustcDecodable, Debug, Copy, Hash, PartialEq)]
@@ -1274,29 +1273,29 @@ pub enum LitIntType {
 
 /// Literal kind.
 ///
-/// E.g. `"foo"`, `42`, `12.34` or `bool`
+/// E.g., `"foo"`, `42`, `12.34`, or `bool`.
 #[derive(Clone, RustcEncodable, RustcDecodable, Debug, Hash, PartialEq)]
 pub enum LitKind {
-    /// A string literal (`"foo"`)
+    /// A string literal (`"foo"`).
     Str(Symbol, StrStyle),
-    /// A byte string (`b"foo"`)
+    /// A byte string (`b"foo"`).
     ByteStr(Lrc<Vec<u8>>),
-    /// A byte char (`b'f'`)
+    /// A byte char (`b'f'`).
     Byte(u8),
-    /// A character literal (`'a'`)
+    /// A character literal (`'a'`).
     Char(char),
-    /// An integer literal (`1`)
+    /// An integer literal (`1`).
     Int(u128, LitIntType),
-    /// A float literal (`1f64` or `1E10f64`)
+    /// A float literal (`1f64` or `1E10f64`).
     Float(Symbol, FloatTy),
-    /// A float literal without a suffix (`1.0 or 1.0E10`)
+    /// A float literal without a suffix (`1.0 or 1.0E10`).
     FloatUnsuffixed(Symbol),
-    /// A boolean literal
+    /// A boolean literal.
     Bool(bool),
 }
 
 impl LitKind {
-    /// Returns true if this literal is a string and false otherwise.
+    /// Returns `true` if this literal is a string.
     pub fn is_str(&self) -> bool {
         match *self {
             LitKind::Str(..) => true,
@@ -1304,7 +1303,7 @@ pub fn is_str(&self) -> bool {
         }
     }
 
-    /// Returns true if this literal is byte literal string false otherwise.
+    /// Returns `true` if this literal is byte literal string.
     pub fn is_bytestr(&self) -> bool {
         match self {
             LitKind::ByteStr(_) => true,
@@ -1312,7 +1311,7 @@ pub fn is_bytestr(&self) -> bool {
         }
     }
 
-    /// Returns true if this is a numeric literal.
+    /// Returns `true` if this is a numeric literal.
     pub fn is_numeric(&self) -> bool {
         match *self {
             LitKind::Int(..) | LitKind::Float(..) | LitKind::FloatUnsuffixed(..) => true,
@@ -1320,8 +1319,8 @@ pub fn is_numeric(&self) -> bool {
         }
     }
 
-    /// Returns true if this literal has no suffix. Note: this will return true
-    /// for literals with prefixes such as raw strings and byte strings.
+    /// Returns `true` if 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 {
             // unsuffixed variants
@@ -1339,14 +1338,14 @@ pub fn is_unsuffixed(&self) -> bool {
         }
     }
 
-    /// Returns true if this literal has a suffix.
+    /// Returns `true` if this literal has a suffix.
     pub fn is_suffixed(&self) -> bool {
         !self.is_unsuffixed()
     }
 }
 
-// NB: If you change this, you'll probably want to change the corresponding
-// type structure in middle/ty.rs as well.
+// N.B., If you change this, you'll probably want to change the corresponding
+// type structure in `middle/ty.rs` as well.
 #[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
 pub struct MutTy {
     pub ty: P<Ty>,
@@ -1373,7 +1372,7 @@ pub struct TraitItem {
     pub generics: Generics,
     pub node: TraitItemKind,
     pub span: Span,
-    /// See `Item::tokens` for what this is
+    /// See `Item::tokens` for what this is.
     pub tokens: Option<TokenStream>,
 }
 
@@ -1395,7 +1394,7 @@ pub struct ImplItem {
     pub generics: Generics,
     pub node: ImplItemKind,
     pub span: Span,
-    /// See `Item::tokens` for what this is
+    /// See `Item::tokens` for what this is.
     pub tokens: Option<TokenStream>,
 }
 
@@ -1443,8 +1442,8 @@ pub fn ty_to_string(&self) -> &'static str {
     }
 
     pub fn val_to_string(&self, val: i128) -> String {
-        // cast to a u128 so we can correctly print INT128_MIN. All integral types
-        // are parsed as u128, so we wouldn't want to print an extra negative
+        // Cast to a `u128` so we can correctly print `INT128_MIN`. All integral types
+        // are parsed as `u128`, so we wouldn't want to print an extra negative
         // sign.
         format!("{}{}", val as u128, self.ty_to_string())
     }
@@ -1511,7 +1510,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
     }
 }
 
-// Bind a type to an associated type: `A=Foo`.
+// Bind a type to an associated type: `A = Foo`.
 #[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
 pub struct TypeBinding {
     pub id: NodeId,
@@ -1541,27 +1540,27 @@ pub struct BareFnTy {
     pub decl: P<FnDecl>,
 }
 
-/// The different kinds of types recognized by the compiler
+/// The different kinds of types recognized by the compiler.
 #[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
 pub enum TyKind {
-    /// A variable-length slice (`[T]`)
+    /// A variable-length slice (`[T]`).
     Slice(P<Ty>),
-    /// A fixed length array (`[T; n]`)
+    /// A fixed length array (`[T; n]`).
     Array(P<Ty>, AnonConst),
-    /// A raw pointer (`*const T` or `*mut T`)
+    /// A raw pointer (`*const T` or `*mut T`).
     Ptr(MutTy),
-    /// A reference (`&'a T` or `&'a mut T`)
+    /// A reference (`&'a T` or `&'a mut T`).
     Rptr(Option<Lifetime>, MutTy),
-    /// A bare function (e.g. `fn(usize) -> bool`)
+    /// A bare function (e.g., `fn(usize) -> bool`).
     BareFn(P<BareFnTy>),
-    /// The never type (`!`)
+    /// The never type (`!`).
     Never,
-    /// A tuple (`(A, B, C, D,...)`)
+    /// A tuple (`(A, B, C, D,...)`).
     Tup(Vec<P<Ty>>),
     /// A path (`module::module::...::Type`), optionally
-    /// "qualified", e.g. `<Vec<T> as SomeTrait>::SomeType`.
+    /// "qualified", e.g., `<Vec<T> as SomeTrait>::SomeType`.
     ///
-    /// Type parameters are stored in the Path itself
+    /// Type parameters are stored in the `Path` itself.
     Path(Option<QSelf>, Path),
     /// A trait object type `Bound1 + Bound2 + Bound3`
     /// where `Bound` is a trait or a lifetime.
@@ -1571,18 +1570,18 @@ pub enum TyKind {
     ///
     /// The `NodeId` exists to prevent lowering from having to
     /// generate `NodeId`s on the fly, which would complicate
-    /// the generation of `existential type` items significantly
+    /// the generation of `existential type` items significantly.
     ImplTrait(NodeId, GenericBounds),
-    /// No-op; kept solely so that we can pretty-print faithfully
+    /// No-op; kept solely so that we can pretty-print faithfully.
     Paren(P<Ty>),
-    /// Unused for now
+    /// Unused for now.
     Typeof(AnonConst),
-    /// TyKind::Infer means the type should be inferred instead of it having been
+    /// This means the type should be inferred instead of it having been
     /// specified. This can appear anywhere in a type.
     Infer,
     /// Inferred type of a `self` or `&self` argument in a method.
     ImplicitSelf,
-    // A macro in the type position.
+    /// A macro in the type position.
     Mac(Mac),
     /// Placeholder for a kind that has failed to be defined.
     Err,
@@ -1615,7 +1614,7 @@ pub enum TraitObjectSyntax {
 
 /// Inline assembly dialect.
 ///
-/// E.g. `"intel"` as in `asm!("mov eax, 2" : "={eax}"(result) : : : "intel")`
+/// E.g., `"intel"` as in `asm!("mov eax, 2" : "={eax}"(result) : : : "intel")`.
 #[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Debug, Copy)]
 pub enum AsmDialect {
     Att,
@@ -1624,7 +1623,7 @@ pub enum AsmDialect {
 
 /// Inline assembly.
 ///
-/// E.g. `"={eax}"(result)` as in `asm!("mov eax, 2" : "={eax}"(result) : : : "intel")`
+/// E.g., `"={eax}"(result)` as in `asm!("mov eax, 2" : "={eax}"(result) : : : "intel")`.
 #[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
 pub struct InlineAsmOutput {
     pub constraint: Symbol,
@@ -1635,7 +1634,7 @@ pub struct InlineAsmOutput {
 
 /// Inline assembly.
 ///
-/// E.g. `asm!("NOP");`
+/// E.g., `asm!("NOP");`.
 #[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
 pub struct InlineAsm {
     pub asm: Symbol,
@@ -1651,7 +1650,7 @@ pub struct InlineAsm {
 
 /// An argument in a function header.
 ///
-/// E.g. `bar: usize` as in `fn foo(bar: usize)`
+/// E.g., `bar: usize` as in `fn foo(bar: usize)`.
 #[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
 pub struct Arg {
     pub ty: P<Ty>,
@@ -1661,7 +1660,7 @@ pub struct Arg {
 
 /// Alternative representation for `Arg`s describing `self` parameter of methods.
 ///
-/// E.g. `&mut self` as in `fn foo(&mut self)`
+/// E.g., `&mut self` as in `fn foo(&mut self)`.
 #[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
 pub enum SelfKind {
     /// `self`, `mut self`
@@ -1740,7 +1739,7 @@ pub fn from_self(eself: ExplicitSelf, eself_ident: Ident) -> Arg {
 
 /// Header (not the body) of a function declaration.
 ///
-/// E.g. `fn foo(bar: baz)`
+/// E.g., `fn foo(bar: baz)`.
 #[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
 pub struct FnDecl {
     pub inputs: Vec<Arg>,
@@ -1787,7 +1786,8 @@ pub fn is_async(self) -> bool {
             false
         }
     }
-    /// In case this is an `Async` return the `NodeId` for the generated impl Trait item
+
+    /// In ths case this is an `async` return, the `NodeId` for the generated `impl Trait` item.
     pub fn opt_return_id(self) -> Option<NodeId> {
         match self {
             IsAsync::Async {
@@ -1844,11 +1844,10 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
 pub enum FunctionRetTy {
     /// Return type is not specified.
     ///
-    /// Functions default to `()` and
-    /// closures default to inference. Span points to where return
-    /// type would be inserted.
+    /// Functions default to `()` and closures default to inference.
+    /// Span points to where return type would be inserted.
     Default(Span),
-    /// Everything else
+    /// Everything else.
     Ty(P<Ty>),
 }
 
@@ -1863,7 +1862,7 @@ pub fn span(&self) -> Span {
 
 /// Module declaration.
 ///
-/// E.g. `mod foo;` or `mod foo { .. }`
+/// E.g., `mod foo;` or `mod foo { .. }`.
 #[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
 pub struct Mod {
     /// A span from the first token past `{` to the last token until `}`.
@@ -1871,22 +1870,22 @@ pub struct Mod {
     /// to the last token in the external file.
     pub inner: Span,
     pub items: Vec<P<Item>>,
-    /// For `mod foo;` inline is false, for `mod foo { .. }` it is true.
+    /// `true` for `mod foo { .. }`; `false` for `mod foo;`.
     pub inline: bool,
 }
 
 /// Foreign module declaration.
 ///
-/// E.g. `extern { .. }` or `extern C { .. }`
+/// E.g., `extern { .. }` or `extern C { .. }`.
 #[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
 pub struct ForeignMod {
     pub abi: Abi,
     pub items: Vec<ForeignItem>,
 }
 
-/// Global inline assembly
+/// Global inline assembly.
 ///
-/// aka module-level assembly or file-scoped assembly
+/// Also known as "module-level assembly" or "file-scoped assembly".
 #[derive(Clone, RustcEncodable, RustcDecodable, Debug, Copy)]
 pub struct GlobalAsm {
     pub asm: Symbol,
@@ -1903,7 +1902,7 @@ pub struct Variant_ {
     pub ident: Ident,
     pub attrs: Vec<Attribute>,
     pub data: VariantData,
-    /// Explicit discriminant, e.g. `Foo = 1`
+    /// Explicit discriminant, e.g., `Foo = 1`.
     pub disr_expr: Option<AnonConst>,
 }
 
@@ -1948,7 +1947,7 @@ pub fn ident(&self) -> Ident {
     }
 }
 
-/// Distinguishes between Attributes that decorate items and Attributes that
+/// Distinguishes between `Attribute`s that decorate items and Attributes that
 /// are contained as statements within items. These two cases need to be
 /// distinguished for pretty-printing.
 #[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Debug, Copy)]
@@ -1971,8 +1970,8 @@ fn index(self) -> usize {
     }
 }
 
-/// Meta-data associated with an item
-/// Doc-comments are promoted to attributes that have is_sugared_doc = true
+/// Metadata associated with an item.
+/// Doc-comments are promoted to attributes that have `is_sugared_doc = true`.
 #[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
 pub struct Attribute {
     pub id: AttrId,
@@ -1983,12 +1982,12 @@ pub struct Attribute {
     pub span: Span,
 }
 
-/// TraitRef's appear in impls.
+/// `TraitRef`s appear in impls.
 ///
-/// 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).
+/// 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).
 #[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
 pub struct TraitRef {
     pub path: Path,
@@ -2021,10 +2020,10 @@ pub fn new(generic_params: Vec<GenericParam>, path: Path, span: Span) -> Self {
 
 #[derive(Copy, Clone, RustcEncodable, RustcDecodable, Debug)]
 pub enum CrateSugar {
-    /// Source is `pub(crate)`
+    /// Source is `pub(crate)`.
     PubCrate,
 
-    /// Source is (just) `crate`
+    /// Source is (just) `crate`.
     JustCrate,
 }
 
@@ -2050,7 +2049,7 @@ pub fn is_pub(&self) -> bool {
 
 /// Field of a struct.
 ///
-/// E.g. `bar: usize` as in `struct Foo { bar: usize }`
+/// E.g., `bar: usize` as in `struct Foo { bar: usize }`.
 #[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
 pub struct StructField {
     pub span: Span,
@@ -2076,15 +2075,15 @@ pub struct StructField {
 pub enum VariantData {
     /// Struct variant.
     ///
-    /// E.g. `Bar { .. }` as in `enum Foo { Bar { .. } }`
+    /// E.g., `Bar { .. }` as in `enum Foo { Bar { .. } }`.
     Struct(Vec<StructField>, NodeId),
     /// Tuple variant.
     ///
-    /// E.g. `Bar(..)` as in `enum Foo { Bar(..) }`
+    /// E.g., `Bar(..)` as in `enum Foo { Bar(..) }`.
     Tuple(Vec<StructField>, NodeId),
     /// Unit variant.
     ///
-    /// E.g. `Bar = ..` as in `enum Foo { Bar = .. }`
+    /// E.g., `Bar = ..` as in `enum Foo { Bar = .. }`.
     Unit(NodeId),
 }
 
@@ -2123,9 +2122,9 @@ pub fn is_unit(&self) -> bool {
     }
 }
 
-/// An item
+/// An item.
 ///
-/// The name might be a dummy name in case of anonymous items
+/// The name might be a dummy name in case of anonymous items.
 #[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
 pub struct Item {
     pub ident: Ident,
@@ -2145,10 +2144,10 @@ pub struct Item {
     pub tokens: Option<TokenStream>,
 }
 
-/// A function header
+/// A function header.
 ///
-/// All the information between the visibility & the name of the function is
-/// included in this struct (e.g. `async unsafe fn` or `const extern "C" fn`)
+/// All the information between the visibility and the name of the function is
+/// included in this struct (e.g., `async unsafe fn` or `const extern "C" fn`).
 #[derive(Clone, Copy, RustcEncodable, RustcDecodable, Debug)]
 pub struct FnHeader {
     pub unsafety: Unsafety,
@@ -2172,65 +2171,65 @@ fn default() -> FnHeader {
 pub enum ItemKind {
     /// An `extern crate` item, with optional *original* crate name if the crate was renamed.
     ///
-    /// E.g. `extern crate foo` or `extern crate foo_bar as foo`
+    /// E.g., `extern crate foo` or `extern crate foo_bar as foo`.
     ExternCrate(Option<Name>),
     /// A use declaration (`use` or `pub use`) item.
     ///
-    /// E.g. `use foo;`, `use foo::bar;` or `use foo::bar as FooBar;`
+    /// E.g., `use foo;`, `use foo::bar;` or `use foo::bar as FooBar;`.
     Use(P<UseTree>),
     /// A static item (`static` or `pub static`).
     ///
-    /// E.g. `static FOO: i32 = 42;` or `static FOO: &'static str = "bar";`
+    /// E.g., `static FOO: i32 = 42;` or `static FOO: &'static str = "bar";`.
     Static(P<Ty>, Mutability, P<Expr>),
     /// A constant item (`const` or `pub const`).
     ///
-    /// E.g. `const FOO: i32 = 42;`
+    /// E.g., `const FOO: i32 = 42;`.
     Const(P<Ty>, P<Expr>),
     /// A function declaration (`fn` or `pub fn`).
     ///
-    /// E.g. `fn foo(bar: usize) -> usize { .. }`
+    /// E.g., `fn foo(bar: usize) -> usize { .. }`.
     Fn(P<FnDecl>, FnHeader, Generics, P<Block>),
     /// A module declaration (`mod` or `pub mod`).
     ///
-    /// E.g. `mod foo;` or `mod foo { .. }`
+    /// E.g., `mod foo;` or `mod foo { .. }`.
     Mod(Mod),
     /// An external module (`extern` or `pub extern`).
     ///
-    /// E.g. `extern {}` or `extern "C" {}`
+    /// E.g., `extern {}` or `extern "C" {}`.
     ForeignMod(ForeignMod),
-    /// Module-level inline assembly (from `global_asm!()`)
+    /// Module-level inline assembly (from `global_asm!()`).
     GlobalAsm(P<GlobalAsm>),
     /// A type alias (`type` or `pub type`).
     ///
-    /// E.g. `type Foo = Bar<u8>;`
+    /// E.g., `type Foo = Bar<u8>;`.
     Ty(P<Ty>, Generics),
     /// An existential type declaration (`existential type`).
     ///
-    /// E.g. `existential type Foo: Bar + Boo;`
+    /// E.g., `existential type Foo: Bar + Boo;`.
     Existential(GenericBounds, Generics),
     /// An enum definition (`enum` or `pub enum`).
     ///
-    /// E.g. `enum Foo<A, B> { C<A>, D<B> }`
+    /// E.g., `enum Foo<A, B> { C<A>, D<B> }`.
     Enum(EnumDef, Generics),
     /// A struct definition (`struct` or `pub struct`).
     ///
-    /// E.g. `struct Foo<A> { x: A }`
+    /// E.g., `struct Foo<A> { x: A }`.
     Struct(VariantData, Generics),
     /// A union definition (`union` or `pub union`).
     ///
-    /// E.g. `union Foo<A, B> { x: A, y: B }`
+    /// E.g., `union Foo<A, B> { x: A, y: B }`.
     Union(VariantData, Generics),
     /// A Trait declaration (`trait` or `pub trait`).
     ///
-    /// E.g. `trait Foo { .. }`, `trait Foo<T> { .. }` or `auto trait Foo {}`
+    /// E.g., `trait Foo { .. }`, `trait Foo<T> { .. }` or `auto trait Foo {}`.
     Trait(IsAuto, Unsafety, Generics, GenericBounds, Vec<TraitItem>),
     /// Trait alias
     ///
-    /// E.g. `trait Foo = Bar + Quux;`
+    /// E.g., `trait Foo = Bar + Quux;`.
     TraitAlias(Generics, GenericBounds),
     /// An implementation.
     ///
-    /// E.g. `impl<A> Foo<A> { .. }` or `impl<A> Trait for Foo<A> { .. }`
+    /// E.g., `impl<A> Foo<A> { .. }` or `impl<A> Trait for Foo<A> { .. }`.
     Impl(
         Unsafety,
         ImplPolarity,
@@ -2242,7 +2241,7 @@ pub enum ItemKind {
     ),
     /// A macro invocation.
     ///
-    /// E.g. `macro_rules! foo { .. }` or `foo!(..)`
+    /// E.g., `macro_rules! foo { .. }` or `foo!(..)`.
     Mac(Mac),
 
     /// A macro definition.
@@ -2282,17 +2281,17 @@ 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<FnDecl>, Generics),
-    /// A foreign static item (`static ext: u8`), with optional mutability
-    /// (the boolean is true when mutable)
+    /// A foreign static item (`static ext: u8`), with optional mutability.
+    /// (The boolean is `true` for mutable items).
     Static(P<Ty>, bool),
-    /// A foreign type
+    /// A foreign type.
     Ty,
-    /// A macro invocation
+    /// A macro invocation.
     Macro(Mac),
 }
 
@@ -2312,7 +2311,7 @@ mod tests {
     use super::*;
     use serialize;
 
-    // are ASTs encodable?
+    // Are ASTs encodable?
     #[test]
     fn check_asts_encodable() {
         fn assert_encodable<T: serialize::Encodable>() {}
index 518b34eefa8533737e966805da3d5992bcdccb97..7e8384bec6807eca31d43e6e6e44d3cbb321c272 100644 (file)
@@ -96,7 +96,7 @@ pub fn check_name(&self, name: &str) -> bool {
         self.meta_item().map_or(false, |meta_item| meta_item.check_name(name))
     }
 
-    /// Returns the name of the meta item, e.g. `foo` in `#[foo]`,
+    /// Returns the name of the meta item, e.g., `foo` in `#[foo]`,
     /// `#[foo="bar"]` and `#[foo(bar)]`, if self is a MetaItem
     pub fn name(&self) -> Option<Name> {
         self.meta_item().and_then(|meta_item| Some(meta_item.name()))
@@ -180,7 +180,7 @@ pub fn check_name(&self, name: &str) -> bool {
     }
 
     /// Returns the **last** segment of the name of this attribute.
-    /// E.g. `foo` for `#[foo]`, `skip` for `#[rustfmt::skip]`.
+    /// e.g., `foo` for `#[foo]`, `skip` for `#[rustfmt::skip]`.
     pub fn name(&self) -> Name {
         name_from_path(&self.path)
     }
index d8fb20d425008e44fbec4d40019a0e77f9eb34a7..41307175ade0934942e2fc9252e2503de4b2317d 100644 (file)
@@ -328,7 +328,7 @@ pub fn configure_expr(&mut self, expr: P<ast::Expr>) -> P<ast::Expr> {
         // Anything else is always required, and thus has to error out
         // in case of a cfg attr.
         //
-        // NB: This is intentionally not part of the fold_expr() function
+        // N.B., this is intentionally not part of the fold_expr() function
         //     in order for fold_opt_expr() to be able to avoid this check
         if let Some(attr) = expr.attrs().iter().find(|a| is_cfg(a)) {
             let msg = "removing an expression is not supported in this position";
@@ -421,7 +421,7 @@ fn fold_opt_expr(&mut self, expr: P<ast::Expr>) -> Option<P<ast::Expr>> {
     }
 
     fn fold_mac(&mut self, mac: ast::Mac) -> ast::Mac {
-        // Don't configure interpolated AST (c.f. #34171).
+        // Don't configure interpolated AST (cf. issue #34171).
         // Interpolated AST will get configured once the surrounding tokens are parsed.
         mac
     }
index b898696d349754784e724638498dc3d5c7206283..310cf27689bc51c13856537f01ddba972b8aedaf 100644 (file)
@@ -670,7 +670,7 @@ pub enum SyntaxExtension {
     /// An attribute-like procedural macro that derives a builtin trait.
     BuiltinDerive(BuiltinDeriveFn),
 
-    /// A declarative macro, e.g. `macro m() {}`.
+    /// A declarative macro, e.g., `macro m() {}`.
     DeclMacro {
         expander: Box<dyn TTMacroExpander + sync::Sync + sync::Send>,
         def_info: Option<(ast::NodeId, Span)>,
@@ -908,7 +908,7 @@ pub fn struct_span_fatal<S: Into<MultiSpan>>(&self,
     /// `span_err` should be strongly preferred where-ever possible:
     /// this should *only* be used when:
     ///
-    /// - continuing has a high risk of flow-on errors (e.g. errors in
+    /// - continuing has a high risk of flow-on errors (e.g., errors in
     ///   declaring a macro would cause all uses of that macro to
     ///   complain about "undefined macro"), or
     /// - there is literally nothing else that can be done (however,
@@ -995,7 +995,7 @@ pub fn expr_to_spanned_string<'a>(
         expr
     });
 
-    // we want to be able to handle e.g. `concat!("foo", "bar")`
+    // we want to be able to handle e.g., `concat!("foo", "bar")`
     let expr = cx.expander().fold_expr(expr);
     Err(match expr.node {
         ast::ExprKind::Lit(ref l) => match l.node {
index 14f19c493b33f965259a9ba820852221247d3e14..0244e1428e47b4a0c48706c415d445cbd87a5c1e 100644 (file)
@@ -1351,7 +1351,7 @@ fn fold_block(&mut self, block: P<Block>) -> P<Block> {
                 module.mod_path.push(item.ident);
 
                 // Detect if this is an inline module (`mod m { ... }` as opposed to `mod m;`).
-                // In the non-inline case, `inner` is never the dummy span (c.f. `parse_item_mod`).
+                // In the non-inline case, `inner` is never the dummy span (cf. `parse_item_mod`).
                 // Thus, if `inner` is the dummy span, we know the module is inline.
                 let inline_module = item.span.contains(inner) || inner.is_dummy();
 
index 68d94b43dba2c8e6d0813d2bbf3b567b92646997..26348d5ec82ec05699c2b4e1a59cd54b23ba08e8 100644 (file)
@@ -214,10 +214,10 @@ struct MatcherPos<'root, 'tt: 'root> {
     up: Option<MatcherPosHandle<'root, 'tt>>,
 
     /// Specifically used to "unzip" token trees. By "unzip", we mean to unwrap the delimiters from
-    /// a delimited token tree (e.g. something wrapped in `(` `)`) or to get the contents of a doc
+    /// a delimited token tree (e.g., something wrapped in `(` `)`) or to get the contents of a doc
     /// comment...
     ///
-    /// When matching against matchers with nested delimited submatchers (e.g. `pat ( pat ( .. )
+    /// When matching against matchers with nested delimited submatchers (e.g., `pat ( pat ( .. )
     /// pat ) pat`), we need to keep track of the matchers we are descending into. This stack does
     /// that where the bottom of the stack is the outermost matcher.
     /// Also, throughout the comments, this "descent" is often referred to as "unzipping"...
@@ -373,7 +373,7 @@ fn nameize<I: Iterator<Item = NamedMatch>>(
     ms: &[TokenTree],
     mut res: I,
 ) -> NamedParseResult {
-    // Recursively descend into each type of matcher (e.g. sequences, delimited, metavars) and make
+    // Recursively descend into each type of matcher (e.g., sequences, delimited, metavars) and make
     // sure that each metavar has _exactly one_ binding. If a metavar does not have exactly one
     // binding, then there is an error. If it does, then we insert the binding into the
     // `NamedParseResult`.
@@ -895,7 +895,7 @@ fn may_be_ident(nt: &token::Nonterminal) -> bool {
 ///
 /// - `p`: the "black-box" parser to use
 /// - `sp`: the `Span` we want to parse
-/// - `name`: the name of the metavar _matcher_ we want to match (e.g. `tt`, `ident`, `block`,
+/// - `name`: the name of the metavar _matcher_ we want to match (e.g., `tt`, `ident`, `block`,
 ///   etc...)
 ///
 /// # Returns
index ff622b0c18fac18c79045e903578ea6b186b06ca..30322ff523d6c13891b32661a00ad67e9fb276b2 100644 (file)
@@ -77,9 +77,9 @@ pub fn make(mut self: Box<ParserAnyMacro<'a>>, kind: AstFragmentKind) -> AstFrag
             e
         }));
 
-        // We allow semicolons at the end of expressions -- e.g. the semicolon in
+        // We allow semicolons at the end of expressions -- e.g., the semicolon in
         // `macro_rules! m { () => { panic!(); } }` isn't parsed by `.parse_expr()`,
-        // but `m!()` is allowed in expression positions (c.f. issue #34706).
+        // but `m!()` is allowed in expression positions (cf. issue #34706).
         if kind == AstFragmentKind::Expr && parser.token == token::Semi {
             parser.bump();
         }
@@ -482,15 +482,15 @@ fn check_matcher(sess: &ParseSess,
     err == sess.span_diagnostic.err_count()
 }
 
-// The FirstSets for a matcher is a mapping from subsequences in the
+// `The FirstSets` for a matcher is a mapping from subsequences in the
 // matcher to the FIRST set for that subsequence.
 //
 // This mapping is partially precomputed via a backwards scan over the
 // token trees of the matcher, which provides a mapping from each
-// repetition sequence to its FIRST set.
+// repetition sequence to its *first* set.
 //
-// (Hypothetically sequences should be uniquely identifiable via their
-// spans, though perhaps that is false e.g. for macro-generated macros
+// (Hypothetically, sequences should be uniquely identifiable via their
+// spans, though perhaps that is false, e.g., for macro-generated macros
 // that do not try to inject artificial span information. My plan is
 // to try to catch such cases ahead of time and not include them in
 // the precomputed mapping.)
index a7415e845cae398b45aad0311139c9ab678b8b2b..1dab02978548104edff35eb928df2ab484e857f8 100644 (file)
@@ -93,9 +93,9 @@ pub enum TokenTree {
     Delimited(DelimSpan, Lrc<Delimited>),
     /// A kleene-style repetition sequence
     Sequence(DelimSpan, Lrc<SequenceRepetition>),
-    /// E.g. `$var`
+    /// e.g., `$var`
     MetaVar(Span, ast::Ident),
-    /// E.g. `$var:expr`. This is only used in the left hand side of MBE macros.
+    /// e.g., `$var:expr`. This is only used in the left hand side of MBE macros.
     MetaVarDecl(
         Span,
         ast::Ident, /* name to bind */
@@ -199,7 +199,7 @@ pub fn parse(
     let mut trees = input.trees().peekable();
     while let Some(tree) = trees.next() {
         // Given the parsed tree, if there is a metavar and we are expecting matchers, actually
-        // parse out the matcher (i.e. in `$id:ident` this would parse the `:` and `ident`).
+        // parse out the matcher (i.e., in `$id:ident` this would parse the `:` and `ident`).
         let tree = parse_tree(
             tree,
             &mut trees,
@@ -280,7 +280,7 @@ fn parse_tree<I>(
         // `tree` is a `$` token. Look at the next token in `trees`
         tokenstream::TokenTree::Token(span, token::Dollar) => match trees.next() {
             // `tree` is followed by a delimited set of token trees. This indicates the beginning
-            // of a repetition sequence in the macro (e.g. `$(pat)*`).
+            // of a repetition sequence in the macro (e.g., `$(pat)*`).
             Some(tokenstream::TokenTree::Delimited(span, delimited)) => {
                 // Must have `(` not `{` or `[`
                 if delimited.delim != token::Paren {
@@ -309,7 +309,7 @@ fn parse_tree<I>(
                         edition,
                         macro_node_id,
                     );
-                // Count the number of captured "names" (i.e. named metavars)
+                // Count the number of captured "names" (i.e., named metavars)
                 let name_captures = macro_parser::count_names(&sequence);
                 TokenTree::Sequence(
                     span,
@@ -352,7 +352,7 @@ fn parse_tree<I>(
         // `tree` is an arbitrary token. Keep it.
         tokenstream::TokenTree::Token(span, tok) => TokenTree::Token(span, tok),
 
-        // `tree` is the beginning of a delimited set of tokens (e.g. `(` or `{`). We need to
+        // `tree` is the beginning of a delimited set of tokens (e.g., `(` or `{`). We need to
         // descend into the delimited set and further parse it.
         tokenstream::TokenTree::Delimited(span, delimited) => TokenTree::Delimited(
             span,
index 1aea31348a7b937640447f7a7abd32e41eb70d32..e038f4dc677d20fcc87ed26e9e1eea5a1cf44d81 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-//! Feature gating
+//! Feature gating
 //!
 //! This module implements the gating necessary for preventing certain compiler
 //! features from being used by default. This module will crawl a pre-expanded
@@ -105,7 +105,7 @@ pub fn walk_feature_fields<F>(&self, mut f: F)
     }
 }
 
-// If you change this, please modify src/doc/unstable-book as well.
+// If you change this, please modify `src/doc/unstable-book` as well.
 //
 // Don't ever remove anything from this list; set them to 'Removed'.
 //
@@ -113,7 +113,7 @@ pub fn walk_feature_fields<F>(&self, mut f: F)
 // was set. This is most important for knowing when a particular feature became
 // stable (active).
 //
-// NB: tools/tidy/src/features.rs parses this information directly out of the
+// N.B., `tools/tidy/src/features.rs` parses this information directly out of the
 // source, so take care when modifying it.
 
 declare_features! (
@@ -152,62 +152,61 @@ pub fn walk_feature_fields<F>(&self, mut f: F)
     (active, panic_runtime, "1.10.0", Some(32837), None),
     (active, needs_panic_runtime, "1.10.0", Some(32837), None),
 
-    // OIBIT specific features
+    // Features specific to OIBIT (auto traits)
     (active, optin_builtin_traits, "1.0.0", Some(13231), None),
 
-    // Allows use of #[staged_api]
+    // Allows `#[staged_api]`.
     //
     // rustc internal
     (active, staged_api, "1.0.0", None, None),
 
-    // Allows using #![no_core]
+    // Allows `#![no_core]`.
     (active, no_core, "1.3.0", Some(29639), None),
 
-    // Allows using `box` in patterns; RFC 469
+    // Allows the use of `box` in patterns (RFC 469).
     (active, box_patterns, "1.0.0", Some(29641), None),
 
-    // Allows using the unsafe_destructor_blind_to_params attribute;
-    // RFC 1238
+    // Allows the use of the `unsafe_destructor_blind_to_params` attribute (RFC 1238).
     (active, dropck_parametricity, "1.3.0", Some(28498), None),
 
-    // Allows using the may_dangle attribute; RFC 1327
+    // Allows using the `may_dangle` attribute (RFC 1327).
     (active, dropck_eyepatch, "1.10.0", Some(34761), None),
 
-    // Allows the use of custom attributes; RFC 572
+    // Allows the use of custom attributes (RFC 572).
     (active, custom_attribute, "1.0.0", Some(29642), None),
 
-    // Allows the use of rustc_* attributes; RFC 572
+    // Allows the use of `rustc_*` attributes (RFC 572).
     (active, rustc_attrs, "1.0.0", Some(29642), None),
 
-    // Allows the use of non lexical lifetimes; RFC 2094
+    // Allows the use of non lexical lifetimes (RFC 2094).
     (active, nll, "1.0.0", Some(43234), None),
 
-    // Allows the use of #[allow_internal_unstable]. This is an
-    // attribute on macro_rules! and can't use the attribute handling
+    // Allows the use of `#[allow_internal_unstable]`. This is an
+    // attribute on `macro_rules!` and can't use the attribute handling
     // below (it has to be checked before expansion possibly makes
     // macros disappear).
     //
     // rustc internal
     (active, allow_internal_unstable, "1.0.0", None, None),
 
-    // Allows the use of #[allow_internal_unsafe]. This is an
-    // attribute on macro_rules! and can't use the attribute handling
+    // Allows the use of `#[allow_internal_unsafe]`. This is an
+    // attribute on `macro_rules!` and can't use the attribute handling
     // below (it has to be checked before expansion possibly makes
     // macros disappear).
     //
     // rustc internal
     (active, allow_internal_unsafe, "1.0.0", None, None),
 
-    // #23121. Array patterns have some hazards yet.
+    // Allows the use of slice patterns (RFC 23121).
     (active, slice_patterns, "1.0.0", Some(23121), None),
 
-    // Allows the definition of `const fn` functions with some advanced features.
+    // Allows the definition of `const` functions with some advanced features.
     (active, const_fn, "1.2.0", Some(24111), None),
 
-    // Allows let bindings and destructuring in `const fn` functions and constants.
+    // Allows let bindings and destructuring in `const` functions and constants.
     (active, const_let, "1.22.1", Some(48821), None),
 
-    // Allows accessing fields of unions inside const fn.
+    // Allows accessing fields of unions inside `const` functions.
     (active, const_fn_union, "1.27.0", Some(51909), None),
 
     // Allows casting raw pointers to `usize` during const eval.
@@ -222,10 +221,10 @@ pub fn walk_feature_fields<F>(&self, mut f: F)
     // Allows comparing raw pointers during const eval.
     (active, const_compare_raw_pointers, "1.27.0", Some(53020), None),
 
-    // Allows panicking during const eval (produces compile-time errors)
+    // Allows panicking during const eval (producing compile-time errors).
     (active, const_panic, "1.30.0", Some(51999), None),
 
-    // Allows using #[prelude_import] on glob `use` items.
+    // Allows using `#[prelude_import]` on glob `use` items.
     //
     // rustc internal
     (active, prelude_import, "1.2.0", None, None),
@@ -233,117 +232,121 @@ pub fn walk_feature_fields<F>(&self, mut f: F)
     // Allows default type parameters to influence type inference.
     (active, default_type_parameter_fallback, "1.3.0", Some(27336), None),
 
-    // Allows associated type defaults
+    // Allows associated type defaults.
     (active, associated_type_defaults, "1.2.0", Some(29661), None),
 
-    // Allows `repr(simd)`, and importing the various simd intrinsics
+    // Allows `repr(simd)` and importing the various simd intrinsics.
     (active, repr_simd, "1.4.0", Some(27731), None),
 
-    // Allows `extern "platform-intrinsic" { ... }`
+    // Allows `extern "platform-intrinsic" { ... }`.
     (active, platform_intrinsics, "1.4.0", Some(27731), None),
 
-    // Allows `#[unwind(..)]`
+    // Allows `#[unwind(..)]`.
+    //
     // rustc internal for rust runtime
     (active, unwind_attributes, "1.4.0", None, None),
 
     // Allows the use of `#[naked]` on functions.
     (active, naked_functions, "1.9.0", Some(32408), None),
 
-    // Allows `#[no_debug]`
+    // Allows `#[no_debug]`.
     (active, no_debug, "1.5.0", Some(29721), None),
 
-    // Allows `#[omit_gdb_pretty_printer_section]`
+    // Allows `#[omit_gdb_pretty_printer_section]`.
     //
     // rustc internal
     (active, omit_gdb_pretty_printer_section, "1.5.0", None, None),
 
-    // Allows cfg(target_vendor = "...").
+    // Allows `cfg(target_vendor = "...")`.
     (active, cfg_target_vendor, "1.5.0", Some(29718), None),
 
-    // Allow attributes on expressions and non-item statements
+    // Allows attributes on expressions and non-item statements.
     (active, stmt_expr_attributes, "1.6.0", Some(15701), None),
 
-    // allow using type ascription in expressions
+    // Allows the use of type ascription in expressions.
     (active, type_ascription, "1.6.0", Some(23416), None),
 
-    // Allows cfg(target_thread_local)
+    // Allows `cfg(target_thread_local)`.
     (active, cfg_target_thread_local, "1.7.0", Some(29594), None),
 
     // rustc internal
     (active, abi_vectorcall, "1.7.0", None, None),
 
-    // X..Y patterns
+    // Allows `X..Y` patterns.
     (active, exclusive_range_pattern, "1.11.0", Some(37854), None),
 
     // impl specialization (RFC 1210)
     (active, specialization, "1.7.0", Some(31844), None),
 
-    // Allows cfg(target_has_atomic = "...").
+    // Allows `cfg(target_has_atomic = "...")`.
     (active, cfg_target_has_atomic, "1.9.0", Some(32976), None),
 
-    // The `!` type. Does not imply exhaustive_patterns (below) any more.
+    // The `!` type. Does not imply 'exhaustive_patterns' (below) any more.
     (active, never_type, "1.13.0", Some(35121), None),
 
-    // Allows exhaustive pattern matching on types that contain uninhabited types
+    // Allows exhaustive pattern matching on types that contain uninhabited types.
     (active, exhaustive_patterns, "1.13.0", Some(51085), None),
 
-    // Allows untagged unions `union U { ... }`
+    // Allows untagged unions `union U { ... }`.
     (active, untagged_unions, "1.13.0", Some(32836), None),
 
-    // Used to identify the `compiler_builtins` crate
-    // rustc internal
+    // Used to identify the `compiler_builtins` crate.
+    //
+    // rustc internal.
     (active, compiler_builtins, "1.13.0", None, None),
 
-    // Allows #[link(..., cfg(..))]
+    // Allows `#[link(..., cfg(..))]`.
     (active, link_cfg, "1.14.0", Some(37406), None),
 
-    // `extern "ptx-*" fn()`
+    // Allows `extern "ptx-*" fn()`.
     (active, abi_ptx, "1.15.0", Some(38788), None),
 
-    // The `repr(i128)` annotation for enums
+    // The `repr(i128)` annotation for enums.
     (active, repr128, "1.16.0", Some(35118), None),
 
-    // The `unadjusted` ABI. Perma unstable.
+    // The `unadjusted` ABI; perma-unstable.
+    //
     // rustc internal
     (active, abi_unadjusted, "1.16.0", None, None),
 
     // Declarative macros 2.0 (`macro`).
     (active, decl_macro, "1.17.0", Some(39412), None),
 
-    // Allows #[link(kind="static-nobundle"...)]
+    // Allows `#[link(kind="static-nobundle"...)]`.
     (active, static_nobundle, "1.16.0", Some(37403), None),
 
-    // `extern "msp430-interrupt" fn()`
+    // Allows `extern "msp430-interrupt" fn()`.
     (active, abi_msp430_interrupt, "1.16.0", Some(38487), None),
 
-    // Used to identify crates that contain sanitizer runtimes
+    // Used to identify crates that contain sanitizer runtimes.
+    //
     // rustc internal
     (active, sanitizer_runtime, "1.17.0", None, None),
 
-    // Used to identify crates that contain the profiler runtime
+    // Used to identify crates that contain the profiler runtime.
     //
     // rustc internal
     (active, profiler_runtime, "1.18.0", None, None),
 
-    // `extern "x86-interrupt" fn()`
+    // Allows `extern "x86-interrupt" fn()`.
     (active, abi_x86_interrupt, "1.17.0", Some(40180), None),
 
-    // Allows the `try {...}` expression
+    // Allows the `try {...}` expression.
     (active, try_blocks, "1.29.0", Some(31436), None),
 
-    // Allows module-level inline assembly by way of global_asm!()
+    // Allows module-level inline assembly by way of `global_asm!()`.
     (active, global_asm, "1.18.0", Some(35119), None),
 
-    // Allows overlapping impls of marker traits
+    // Allows overlapping impls of marker traits.
     (active, overlapping_marker_traits, "1.18.0", Some(29864), None),
 
-    // Trait attribute to allow overlapping impls
+    // Trait attribute to allow overlapping impls.
     (active, marker_trait_attr, "1.30.0", Some(29864), None),
 
     // rustc internal
     (active, abi_thiscall, "1.19.0", None, None),
 
-    // Allows a test to fail without failing the whole suite
+    // Allows a test to fail without failing the whole suite.
     (active, allow_fail, "1.19.0", Some(46488), None),
 
     // Allows unsized tuple coercion.
@@ -358,28 +361,28 @@ pub fn walk_feature_fields<F>(&self, mut f: F)
     // rustc internal
     (active, allocator_internals, "1.20.0", None, None),
 
-    // #[doc(cfg(...))]
+    // `#[doc(cfg(...))]`
     (active, doc_cfg, "1.21.0", Some(43781), None),
-    // #[doc(masked)]
+    // `#[doc(masked)]`
     (active, doc_masked, "1.21.0", Some(44027), None),
-    // #[doc(spotlight)]
+    // `#[doc(spotlight)]`
     (active, doc_spotlight, "1.22.0", Some(45040), None),
-    // #[doc(include="some-file")]
+    // `#[doc(include = "some-file")]`
     (active, external_doc, "1.22.0", Some(44732), None),
 
-    // Future-proofing enums/structs with #[non_exhaustive] attribute (RFC 2008)
+    // Future-proofing enums/structs with `#[non_exhaustive]` attribute (RFC 2008).
     (active, non_exhaustive, "1.22.0", Some(44109), None),
 
-    // `crate` as visibility modifier, synonymous to `pub(crate)`
+    // Adds `crate` as visibility modifier, synonymous with `pub(crate)`.
     (active, crate_visibility_modifier, "1.23.0", Some(53120), None),
 
     // extern types
     (active, extern_types, "1.23.0", Some(43467), None),
 
-    // Allows trait methods with arbitrary self types
+    // Allows trait methods with arbitrary self types.
     (active, arbitrary_self_types, "1.23.0", Some(44874), None),
 
-    // In-band lifetime bindings (e.g. `fn foo(x: &'a u8) -> &'a u8`)
+    // In-band lifetime bindings (e.g., `fn foo(x: &'a u8) -> &'a u8`).
     (active, in_band_lifetimes, "1.23.0", Some(44524), None),
 
     // Generic associated types (RFC 1598)
@@ -388,25 +391,25 @@ pub fn walk_feature_fields<F>(&self, mut f: F)
     // `extern` in paths
     (active, extern_in_paths, "1.23.0", Some(55600), None),
 
-    // Infer static outlives requirements; RFC 2093
+    // Infer static outlives requirements (RFC 2093).
     (active, infer_static_outlives_requirements, "1.26.0", Some(54185), None),
 
-    // Multiple patterns with `|` in `if let` and `while let`
+    // Multiple patterns with `|` in `if let` and `while let`.
     (active, if_while_or_patterns, "1.26.0", Some(48215), None),
 
-    // Allows `#[repr(packed)]` attribute on structs
+    // Allows `#[repr(packed)]` attribute on structs.
     (active, repr_packed, "1.26.0", Some(33158), None),
 
-    // `use path as _;` and `extern crate c as _;`
+    // Allows `use path as _;` and `extern crate c as _;`.
     (active, underscore_imports, "1.26.0", Some(48216), None),
 
-    // Allows macro invocations in `extern {}` blocks
+    // Allows macro invocations in `extern {}` blocks.
     (active, macros_in_extern, "1.27.0", Some(49476), None),
 
     // `existential type`
     (active, existential_type, "1.28.0", Some(34511), None),
 
-    // unstable #[target_feature] directives
+    // unstable `#[target_feature]` directives
     (active, arm_target_feature, "1.27.0", Some(44839), None),
     (active, aarch64_target_feature, "1.27.0", Some(44839), None),
     (active, hexagon_target_feature, "1.27.0", Some(44839), None),
@@ -422,64 +425,64 @@ pub fn walk_feature_fields<F>(&self, mut f: F)
     // procedural macros to expand to non-items.
     (active, proc_macro_hygiene, "1.30.0", Some(54727), None),
 
-    // #[doc(alias = "...")]
+    // `#[doc(alias = "...")]`
     (active, doc_alias, "1.27.0", Some(50146), None),
 
-    // Allows irrefutable patterns in if-let and while-let statements (RFC 2086)
+    // Allows irrefutable patterns in `if let` and `while let` statements (RFC 2086).
     (active, irrefutable_let_patterns, "1.27.0", Some(44495), None),
 
     // inconsistent bounds in where clauses
     (active, trivial_bounds, "1.28.0", Some(48214), None),
 
-    // 'a: { break 'a; }
+    // `'a: { break 'a; }`
     (active, label_break_value, "1.28.0", Some(48594), None),
 
     // Exhaustive pattern matching on `usize` and `isize`.
     (active, precise_pointer_size_matching, "1.32.0", Some(56354), None),
 
-    // #[doc(keyword = "...")]
+    // `#[doc(keyword = "...")]`
     (active, doc_keyword, "1.28.0", Some(51315), None),
 
-    // Allows async and await syntax
+    // Allows async and await syntax.
     (active, async_await, "1.28.0", Some(50547), None),
 
-    // #[alloc_error_handler]
+    // `#[alloc_error_handler]`
     (active, alloc_error_handler, "1.29.0", Some(51540), None),
 
     (active, abi_amdgpu_kernel, "1.29.0", Some(51575), None),
 
-    // Perma-unstable; added for testing E0705
+    // Added for testing E0705; perma-unstable.
     (active, test_2018_feature, "1.31.0", Some(0), Some(Edition::Edition2018)),
 
-    // Support for arbitrary delimited token streams in non-macro attributes
+    // support for arbitrary delimited token streams in non-macro attributes
     (active, unrestricted_attribute_tokens, "1.30.0", Some(55208), None),
 
-    // Allows `use x::y;` to resolve through `self::x`, not just `::x`
+    // Allows `use x::y;` to resolve through `self::x`, not just `::x`.
     (active, uniform_paths, "1.30.0", Some(53130), None),
 
-    // Allows unsized rvalues at arguments and parameters
+    // Allows unsized rvalues at arguments and parameters.
     (active, unsized_locals, "1.30.0", Some(48055), None),
 
-    // #![test_runner]
-    // #[test_case]
+    // `#![test_runner]`
+    // `#[test_case]`
     (active, custom_test_frameworks, "1.30.0", Some(50297), None),
 
-    // Non-builtin attributes in inner attribute position
+    // non-builtin attributes in inner attribute position
     (active, custom_inner_attributes, "1.30.0", Some(54726), None),
 
-    // allow mixing of bind-by-move in patterns and references to
+    // Allow mixing of bind-by-move in patterns and references to
     // those identifiers in guards, *if* we are using MIR-borrowck
-    // (aka NLL). Essentially this means you need to be on
-    // edition:2018 or later.
+    // (aka NLL). Essentially this means you need to be using the
+    // 2018 edition or later.
     (active, bind_by_move_pattern_guards, "1.30.0", Some(15287), None),
 
-    // Allows `impl Trait` in bindings (`let`, `const`, `static`)
+    // Allows `impl Trait` in bindings (`let`, `const`, `static`).
     (active, impl_trait_in_bindings, "1.30.0", Some(34511), None),
 
-    // #[cfg_attr(predicate, multiple, attributes, here)]
+    // `#[cfg_attr(predicate, multiple, attributes, here)]`
     (active, cfg_attr_multi, "1.31.0", Some(54881), None),
 
-    // Allows `const _: TYPE = VALUE`
+    // Allows `const _: TYPE = VALUE`.
     (active, underscore_const_names, "1.31.0", Some(54912), None),
 
     // `reason = ` in lint attributes and `expect` lint attribute
@@ -495,7 +498,7 @@ pub fn walk_feature_fields<F>(&self, mut f: F)
 declare_features! (
     (removed, import_shadowing, "1.0.0", None, None, None),
     (removed, managed_boxes, "1.0.0", None, None, None),
-    // Allows use of unary negate on unsigned integers, e.g. -e for e: u8
+    // Allows use of unary negate on unsigned integers, e.g., -e for e: u8
     (removed, negate_unsigned, "1.0.0", Some(29645), None, None),
     (removed, reflect, "1.0.0", Some(27749), None, None),
     // A way to temporarily opt out of opt in copy. This will *never* be accepted.
@@ -537,9 +540,9 @@ pub fn walk_feature_fields<F>(&self, mut f: F)
 
 declare_features! (
     (accepted, associated_types, "1.0.0", None, None),
-    // allow overloading augmented assignment operations like `a += b`
+    // Allows overloading augmented assignment operations like `a += b`.
     (accepted, augmented_assignments, "1.8.0", Some(28235), None),
-    // allow empty structs and enum variants with braces
+    // Allows empty structs and enum variants with braces.
     (accepted, braced_empty_structs, "1.8.0", Some(29720), None),
     // Allows indexing into constant arrays.
     (accepted, const_indexing, "1.26.0", Some(29947), None),
@@ -550,69 +553,68 @@ pub fn walk_feature_fields<F>(&self, mut f: F)
     // to bootstrap fix for #5723.
     (accepted, issue_5723_bootstrap, "1.0.0", None, None),
     (accepted, macro_rules, "1.0.0", None, None),
-    // Allows using #![no_std]
+    // Allows using `#![no_std]`.
     (accepted, no_std, "1.6.0", None, None),
     (accepted, slicing_syntax, "1.0.0", None, None),
     (accepted, struct_variant, "1.0.0", None, None),
     // These are used to test this portion of the compiler, they don't actually
-    // mean anything
+    // mean anything.
     (accepted, test_accepted_feature, "1.0.0", None, None),
     (accepted, tuple_indexing, "1.0.0", None, None),
     // Allows macros to appear in the type position.
     (accepted, type_macros, "1.13.0", Some(27245), None),
     (accepted, while_let, "1.0.0", None, None),
-    // Allows `#[deprecated]` attribute
+    // Allows `#[deprecated]` attribute.
     (accepted, deprecated, "1.9.0", Some(29935), None),
     // `expr?`
     (accepted, question_mark, "1.13.0", Some(31436), None),
-    // Allows `..` in tuple (struct) patterns
+    // Allows `..` in tuple (struct) patterns.
     (accepted, dotdot_in_tuple_patterns, "1.14.0", Some(33627), None),
     (accepted, item_like_imports, "1.15.0", Some(35120), None),
     // Allows using `Self` and associated types in struct expressions and patterns.
     (accepted, more_struct_aliases, "1.16.0", Some(37544), None),
-    // elide `'static` lifetimes in `static`s and `const`s
+    // elide `'static` lifetimes in `static`s and `const`s.
     (accepted, static_in_const, "1.17.0", Some(35897), None),
     // Allows field shorthands (`x` meaning `x: x`) in struct literal expressions.
     (accepted, field_init_shorthand, "1.17.0", Some(37340), None),
     // Allows the definition recursive static items.
     (accepted, static_recursion, "1.17.0", Some(29719), None),
-    // pub(restricted) visibilities (RFC 1422)
+    // `pub(restricted)` visibilities (RFC 1422)
     (accepted, pub_restricted, "1.18.0", Some(32409), None),
-    // The #![windows_subsystem] attribute
+    // `#![windows_subsystem]`
     (accepted, windows_subsystem, "1.18.0", Some(37499), None),
     // Allows `break {expr}` with a value inside `loop`s.
     (accepted, loop_break_value, "1.19.0", Some(37339), None),
     // Permits numeric fields in struct expressions and patterns.
     (accepted, relaxed_adts, "1.19.0", Some(35626), None),
-    // Coerces non capturing closures to function pointers
+    // Coerces non capturing closures to function pointers.
     (accepted, closure_to_fn_coercion, "1.19.0", Some(39817), None),
     // Allows attributes on struct literal fields.
     (accepted, struct_field_attributes, "1.20.0", Some(38814), None),
-    // Allows the definition of associated constants in `trait` or `impl`
-    // blocks.
+    // Allows the definition of associated constants in `trait` or `impl` blocks.
     (accepted, associated_consts, "1.20.0", Some(29646), None),
-    // Usage of the `compile_error!` macro
+    // Usage of the `compile_error!` macro.
     (accepted, compile_error, "1.20.0", Some(40872), None),
     // See rust-lang/rfcs#1414. Allows code like `let x: &'static u32 = &42` to work.
     (accepted, rvalue_static_promotion, "1.21.0", Some(38865), None),
-    // Allow Drop types in constants (RFC 1440)
+    // Allows `Drop` types in constants (RFC 1440).
     (accepted, drop_types_in_const, "1.22.0", Some(33156), None),
     // Allows the sysV64 ABI to be specified on all platforms
-    // instead of just the platforms on which it is the C ABI
+    // instead of just the platforms on which it is the C ABI.
     (accepted, abi_sysv64, "1.24.0", Some(36167), None),
-    // Allows `repr(align(16))` struct attribute (RFC 1358)
+    // Allows `repr(align(16))` struct attribute (RFC 1358).
     (accepted, repr_align, "1.25.0", Some(33626), None),
-    // allow '|' at beginning of match arms (RFC 1925)
+    // Allows '|' at beginning of match arms (RFC 1925).
     (accepted, match_beginning_vert, "1.25.0", Some(44101), None),
     // Nested groups in `use` (RFC 2128)
     (accepted, use_nested_groups, "1.25.0", Some(44494), None),
-    // a..=b and ..=b
+    // `a..=b` and `..=b`
     (accepted, inclusive_range_syntax, "1.26.0", Some(28237), None),
-    // allow `..=` in patterns (RFC 1192)
+    // Allows `..=` in patterns (RFC 1192).
     (accepted, dotdoteq_in_patterns, "1.26.0", Some(28237), None),
     // Termination trait in main (RFC 1937)
     (accepted, termination_trait, "1.26.0", Some(43301), None),
-    // Copy/Clone closures (RFC 2132)
+    // `Copy`/`Clone` closures (RFC 2132).
     (accepted, clone_closures, "1.26.0", Some(44490), None),
     (accepted, copy_closures, "1.26.0", Some(44490), None),
     // Allows `impl Trait` in function arguments.
@@ -623,70 +625,70 @@ pub fn walk_feature_fields<F>(&self, mut f: F)
     (accepted, i128_type, "1.26.0", Some(35118), None),
     // Default match binding modes (RFC 2005)
     (accepted, match_default_bindings, "1.26.0", Some(42640), None),
-    // allow `'_` placeholder lifetimes
+    // Allows `'_` placeholder lifetimes.
     (accepted, underscore_lifetimes, "1.26.0", Some(44524), None),
-    // Allows attributes on lifetime/type formal parameters in generics (RFC 1327)
+    // Allows attributes on lifetime/type formal parameters in generics (RFC 1327).
     (accepted, generic_param_attrs, "1.27.0", Some(48848), None),
-    // Allows cfg(target_feature = "...").
+    // Allows `cfg(target_feature = "...")`.
     (accepted, cfg_target_feature, "1.27.0", Some(29717), None),
-    // Allows #[target_feature(...)]
+    // Allows `#[target_feature(...)]`.
     (accepted, target_feature, "1.27.0", None, None),
     // Trait object syntax with `dyn` prefix
     (accepted, dyn_trait, "1.27.0", Some(44662), None),
-    // allow `#[must_use]` on functions; and, must-use operators (RFC 1940)
+    // Allows `#[must_use]` on functions, and introduces must-use operators (RFC 1940).
     (accepted, fn_must_use, "1.27.0", Some(43302), None),
-    // Allows use of the :lifetime macro fragment specifier
+    // Allows use of the `:lifetime` macro fragment specifier.
     (accepted, macro_lifetime_matcher, "1.27.0", Some(34303), None),
     // Termination trait in tests (RFC 1937)
     (accepted, termination_trait_test, "1.27.0", Some(48854), None),
-    // The #[global_allocator] attribute
+    // The `#[global_allocator]` attribute
     (accepted, global_allocator, "1.28.0", Some(27389), None),
-    // Allows `#[repr(transparent)]` attribute on newtype structs
+    // Allows `#[repr(transparent)]` attribute on newtype structs.
     (accepted, repr_transparent, "1.28.0", Some(43036), None),
-    // Defining procedural macros in `proc-macro` crates
+    // Procedural macros in `proc-macro` crates
     (accepted, proc_macro, "1.29.0", Some(38356), None),
     // `foo.rs` as an alternative to `foo/mod.rs`
     (accepted, non_modrs_mods, "1.30.0", Some(44660), None),
-    // Allows use of the :vis macro fragment specifier
+    // Allows use of the `:vis` macro fragment specifier
     (accepted, macro_vis_matcher, "1.30.0", Some(41022), None),
     // Allows importing and reexporting macros with `use`,
     // enables macro modularization in general.
     (accepted, use_extern_macros, "1.30.0", Some(35896), None),
-    // Allows keywords to be escaped for use as identifiers
+    // Allows keywords to be escaped for use as identifiers.
     (accepted, raw_identifiers, "1.30.0", Some(48589), None),
-    // Attributes scoped to tools
+    // Attributes scoped to tools.
     (accepted, tool_attributes, "1.30.0", Some(44690), None),
-    // Allows multi-segment paths in attributes and derives
+    // Allows multi-segment paths in attributes and derives.
     (accepted, proc_macro_path_invoc, "1.30.0", Some(38356), None),
     // Allows all literals in attribute lists and values of key-value pairs.
     (accepted, attr_literals, "1.30.0", Some(34981), None),
-    // Infer outlives requirements; RFC 2093
+    // Infer outlives requirements (RFC 2093).
     (accepted, infer_outlives_requirements, "1.30.0", Some(44493), None),
     (accepted, panic_handler, "1.30.0", Some(44489), None),
-    // Used to preserve symbols (see llvm.used)
+    // Used to preserve symbols (see llvm.used).
     (accepted, used, "1.30.0", Some(40289), None),
     // `crate` in paths
     (accepted, crate_in_paths, "1.30.0", Some(45477), None),
-    // Resolve absolute paths as paths from other crates
+    // Resolve absolute paths as paths from other crates.
     (accepted, extern_absolute_paths, "1.30.0", Some(44660), None),
-    // Access to crate names passed via `--extern` through prelude
+    // Access to crate names passed via `--extern` through prelude.
     (accepted, extern_prelude, "1.30.0", Some(44660), None),
     // Parentheses in patterns
     (accepted, pattern_parentheses, "1.31.0", Some(51087), None),
-    // Allows the definition of `const fn` functions
+    // Allows the definition of `const fn` functions.
     (accepted, min_const_fn, "1.31.0", Some(53555), None),
     // Scoped lints
     (accepted, tool_lints, "1.31.0", Some(44690), None),
-    // impl<I:Iterator> Iterator for &mut Iterator
-    // impl Debug for Foo<'_>
+    // `impl<I:Iterator> Iterator for &mut Iterator`
+    // `impl Debug for Foo<'_>`
     (accepted, impl_header_lifetime_elision, "1.31.0", Some(15872), None),
-    // `extern crate foo as bar;` puts `bar` into extern prelude
+    // `extern crate foo as bar;` puts `bar` into extern prelude.
     (accepted, extern_crate_item_prelude, "1.31.0", Some(55599), None),
-    // Allows use of the :literal macro fragment specifier (RFC 1576)
+    // Allows use of the `:literal` macro fragment specifier (RFC 1576).
     (accepted, macro_literal_matcher, "1.31.0", Some(35625), None),
     // Integer match exhaustiveness checking (RFC 2591)
     (accepted, exhaustive_integer_patterns, "1.32.0", Some(50907), None),
-    // Use `?` as the Kleene "at most one" operator
+    // Use `?` as the Kleene "at most one" operator.
     (accepted, macro_at_most_once_rep, "1.32.0", Some(48075), None),
     // `Self` struct constructor (RFC 2302)
     (accepted, self_struct_ctor, "1.32.0", Some(51994), None),
@@ -1276,7 +1278,7 @@ fn check_attribute(&self, attr: &ast::Attribute, is_macro: bool) {
             if attr.path == &**n {
                 // Plugins can't gate attributes, so we don't check for it
                 // unlike the code above; we only use this loop to
-                // short-circuit to avoid the checks below
+                // short-circuit to avoid the checks below.
                 debug!("check_attribute: {:?} is registered by a plugin, {:?}", attr.path, ty);
                 return;
             }
@@ -1287,10 +1289,9 @@ fn check_attribute(&self, attr: &ast::Attribute, is_macro: bool) {
                            with the prefix `rustc_` \
                            are reserved for internal compiler diagnostics");
         } else if !attr::is_known(attr) {
-            // Only run the custom attribute lint during regular
-            // feature gate checking. Macro gating runs
-            // before the plugin attributes are registered
-            // so we skip this then
+            // Only run the custom attribute lint during regular feature gate
+            // checking. Macro gating runs before the plugin attributes are
+            // registered, so we skip this in that case.
             if !is_macro {
                 let msg = format!("The attribute `{}` is currently unknown to the compiler and \
                                    may have meaning added to it in the future", attr.path);
@@ -1788,14 +1789,13 @@ fn visit_fn(&mut self,
                 _node_id: NodeId) {
         match fn_kind {
             FnKind::ItemFn(_, header, _, _) => {
-                // check for const fn and async fn declarations
+                // Check for const fn and async fn declarations.
                 if header.asyncness.is_async() {
                     gate_feature_post!(&self, async_await, span, "async fn is unstable");
                 }
-                // stability of const fn methods are covered in
-                // visit_trait_item and visit_impl_item below; this is
-                // because default methods don't pass through this
-                // point.
+                // Stability of const fn methods are covered in
+                // `visit_trait_item` and `visit_impl_item` below; this is
+                // because default methods don't pass through this point.
 
                 self.check_abi(header.abi, span);
             }
@@ -1872,7 +1872,7 @@ fn visit_impl_item(&mut self, ii: &'a ast::ImplItem) {
 
     fn visit_path(&mut self, path: &'a ast::Path, _id: NodeId) {
         for segment in &path.segments {
-            // Identifiers we are going to check could come from a legacy macro (e.g. `#[test]`).
+            // Identifiers we are going to check could come from a legacy macro (e.g., `#[test]`).
             // For such macros identifiers must have empty context, because this context is
             // used during name resolution and produced names must be unhygienic for compatibility.
             // On the other hand, we need the actual non-empty context for feature gate checking
@@ -1919,7 +1919,7 @@ fn feature_removed(span_handler: &Handler, span: Span, reason: Option<&str>) {
     for &edition in ALL_EDITIONS {
         if edition <= crate_edition {
             // The `crate_edition` implies its respective umbrella feature-gate
-            // (i.e. `#![feature(rust_20XX_preview)]` isn't needed on edition 20XX).
+            // (i.e., `#![feature(rust_20XX_preview)]` isn't needed on edition 20XX).
             edition_enabled_features.insert(Symbol::intern(edition.feature_name()), edition);
         }
     }
@@ -2079,7 +2079,7 @@ pub enum UnstableFeatures {
 
 impl UnstableFeatures {
     pub fn from_environment() -> UnstableFeatures {
-        // Whether this is a feature-staged build, i.e. on the beta or stable channel
+        // 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();
         // Whether we should enable unstable features for bootstrapping
         let bootstrap = env::var("RUSTC_BOOTSTRAP").is_ok();
index 0e6e2f90693cf54861abc1ada9fd6d50a84670d5..82f52931cad7cf8536bfbe1d9a0bfd868a4e5cca 100644 (file)
@@ -229,7 +229,7 @@ fn fold_local(&mut self, l: P<Local>) -> P<Local> {
 
     fn fold_mac(&mut self, _mac: Mac) -> Mac {
         panic!("fold_mac disabled by default");
-        // NB: see note about macros above.
+        // N.B., see note about macros above.
         // if you really want a folder that
         // works on macros, use this
         // definition in your trait impl:
@@ -637,7 +637,7 @@ pub fn noop_fold_token<T: Folder>(t: token::Token, fld: &mut T) -> token::Token
 
 /// apply folder to elements of interpolated nodes
 //
-// NB: this can occur only when applying a fold to partially expanded code, where
+// N.B., this can occur only when applying a fold to partially expanded code, where
 // parsed pieces have gotten implanted ito *other* macro invocations. This is relevant
 // for macro hygiene, but possibly not elsewhere.
 //
index 3c66db082cc412d0b1a4aa62690aaf2b33c22a9c..0c24c20554acc35dc1656b45d8451a51e08b99e0 100644 (file)
@@ -134,7 +134,7 @@ pub mod diagnostics {
     pub mod metadata;
 }
 
-// NB: This module needs to be declared first so diagnostics are
+// N.B., this module needs to be declared first so diagnostics are
 // registered before they are used.
 pub mod diagnostic_list;
 
index 80227fdf82dd6b69e6db8c55c4f2f1aa8bb0ee32..4be54e5bacc2f109d0116d7b3bb9450bd510114c 100644 (file)
@@ -1127,7 +1127,7 @@ fn scan_float_exponent(&mut self) {
                     "expected at least one digit in exponent"
                 );
                 if let Some(ch) = self.ch {
-                    // check for e.g. Unicode minus '−' (Issue #49746)
+                    // check for e.g., Unicode minus '−' (Issue #49746)
                     if unicode_chars::check_for_substitution(self, ch, &mut err) {
                         self.bump();
                         self.scan_digits(10, 10);
index c7eaf4d1eeeb7af8d3f3281d2cd5414329e013e5..9a9b615233b696a049c6805f014deec9bfdf2d88 100644 (file)
@@ -92,12 +92,12 @@ pub enum PathStyle {
     /// `x<y>` - comparisons, `x::<y>` - unambiguously a path.
     Expr,
     /// In other contexts, notably in types, no ambiguity exists and paths can be written
-    /// without the disambiguator, e.g. `x<y>` - unambiguously a path.
+    /// without the disambiguator, e.g., `x<y>` - unambiguously a path.
     /// Paths with disambiguators are still accepted, `x::<Y>` - unambiguously a path too.
     Type,
-    /// A path with generic arguments disallowed, e.g. `foo::bar::Baz`, used in imports,
+    /// A path with generic arguments disallowed, e.g., `foo::bar::Baz`, used in imports,
     /// visibilities or attributes.
-    /// Technically, this variant is unnecessary and e.g. `Expr` can be used instead
+    /// Technically, this variant is unnecessary and e.g., `Expr` can be used instead
     /// (paths in "mod" contexts have to be checked later for absence of generic arguments
     /// anyway, due to macros), but it is used to avoid weird suggestions about expected
     /// tokens when something goes wrong.
@@ -1917,7 +1917,7 @@ fn parse_arg_general(&mut self, require_name: bool) -> PResult<'a, Arg> {
         self.parse_arg_general(true)
     }
 
-    /// Parse an argument in a lambda header e.g. |arg, arg|
+    /// Parse 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) {
@@ -2334,7 +2334,7 @@ fn expect_delimited_token_tree(&mut self) -> PResult<'a, (MacDelimiter, ThinToke
     /// parse things like parenthesized exprs,
     /// macros, return, etc.
     ///
-    /// NB: This does not parse outer attributes,
+    /// 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<Expr>> {
@@ -3732,7 +3732,7 @@ fn parse_expr_res(&mut self, r: Restrictions,
         self.with_res(r, |this| this.parse_assoc_expr(already_parsed_attrs))
     }
 
-    /// Parse the RHS of a local variable declaration (e.g. '= 14;')
+    /// Parse the RHS of a local variable declaration (e.g., '= 14;')
     fn parse_initializer(&mut self, skip_eq: bool) -> PResult<'a, Option<P<Expr>>> {
         if self.eat(&token::Eq) {
             Ok(Some(self.parse_expr()?))
@@ -4114,7 +4114,7 @@ pub fn parse_pat(&mut self, expected: Option<&'static str>) -> PResult<'a, P<Pat
         self.parse_pat_with_range_pat(true, expected)
     }
 
-    /// Parse a pattern, with a setting whether modern range patterns e.g. `a..=b`, `a..b` are
+    /// Parse a pattern, with a setting whether modern range patterns e.g., `a..=b`, `a..b` are
     /// allowed.
     fn parse_pat_with_range_pat(
         &mut self,
@@ -4456,7 +4456,7 @@ fn expected_item_err(&self, attrs: &[Attribute]) {
     }
 
     /// Parse a statement. This stops just before trailing semicolons on everything but items.
-    /// e.g. a `StmtKind::Semi` parses to a `StmtKind::Expr`, leaving the trailing `;` unconsumed.
+    /// e.g., a `StmtKind::Semi` parses to a `StmtKind::Expr`, leaving the trailing `;` unconsumed.
     pub fn parse_stmt(&mut self) -> PResult<'a, Option<Stmt>> {
         Ok(self.parse_stmt_(true))
     }
@@ -5053,9 +5053,9 @@ fn err_dotdotdot_syntax(&self, span: Span) {
 
     // Parse bounds of a type parameter `BOUND + BOUND + BOUND`, possibly with trailing `+`.
     // BOUND = TY_BOUND | LT_BOUND
-    // LT_BOUND = LIFETIME (e.g. `'a`)
+    // LT_BOUND = LIFETIME (e.g., `'a`)
     // TY_BOUND = TY_BOUND_NOPAREN | (TY_BOUND_NOPAREN)
-    // TY_BOUND_NOPAREN = [?] [for<LT_PARAM_DEFS>] SIMPLE_PATH (e.g. `?for<'a: 'b> m::Trait<'a>`)
+    // TY_BOUND_NOPAREN = [?] [for<LT_PARAM_DEFS>] SIMPLE_PATH (e.g., `?for<'a: 'b> m::Trait<'a>`)
     fn parse_generic_bounds_common(&mut self, allow_plus: bool) -> PResult<'a, GenericBounds> {
         let mut bounds = Vec::new();
         loop {
@@ -5110,7 +5110,7 @@ fn parse_generic_bounds(&mut self) -> PResult<'a, GenericBounds> {
     }
 
     // Parse bounds of a lifetime parameter `BOUND + BOUND + BOUND`, possibly with trailing `+`.
-    // BOUND = LT_BOUND (e.g. `'a`)
+    // BOUND = LT_BOUND (e.g., `'a`)
     fn parse_lt_param_bounds(&mut self) -> GenericBounds {
         let mut lifetimes = Vec::new();
         while self.check_lifetime() {
@@ -6293,7 +6293,7 @@ fn parse_struct_decl_field(&mut self) -> PResult<'a, StructField> {
 
     /// Parse `pub`, `pub(crate)` and `pub(in path)` plus shortcuts `crate` for `pub(crate)`,
     /// `pub(self)` for `pub(in self)` and `pub(super)` for `pub(in super)`.
-    /// If the following element can't be a tuple (i.e. it's a function definition,
+    /// If the following element can't be a tuple (i.e., it's a function definition,
     /// it's not a tuple struct field) and the contents within the parens
     /// isn't valid, emit a proper diagnostic.
     pub fn parse_visibility(&mut self, can_take_tuple: bool) -> PResult<'a, Visibility> {
index 04a791fbcb9c46269d7a5fe38984cb8c7e2202b6..6b9cc2f9792e3d3f0a1f0d579350003b8d74f8c6 100644 (file)
@@ -550,7 +550,7 @@ pub fn interpolated_to_tokenstream(&self, sess: &ParseSess, span: Span)
         });
 
         // During early phases of the compiler the AST could get modified
-        // directly (e.g. attributes added or removed) and the internal cache
+        // directly (e.g., attributes added or removed) and the internal cache
         // of tokens my not be invalidated or updated. Consequently if the
         // "lossless" token stream disagrees with our actual stringification
         // (which has historically been much more battle-tested) then we go
index aaed56da29d5f5e5173a7b150084cc0d94d5d88b..0890be728f37b083d15165f68296711d763c22b1 100644 (file)
 //! The buffered tokens go through a ring-buffer, 'tokens'. The 'left' and
 //! 'right' indices denote the active portion of the ring buffer as well as
 //! describing hypothetical points-in-the-infinite-stream at most 3N tokens
-//! apart (i.e. "not wrapped to ring-buffer boundaries"). The paper will switch
+//! apart (i.e., "not wrapped to ring-buffer boundaries"). The paper will switch
 //! between using 'left' and 'right' terms to denote the wrapped-to-ring-buffer
 //! and point-in-infinite-stream senses freely.
 //!
index 9fbc64758da4dc773cfd5dbf57d2d52e1863c1d2..17e7730120fd3fe384690b4a94e446b304dda021 100644 (file)
 //! # Motivations and benefits
 //!
 //! * **Identity**: sharing AST nodes is problematic for the various analysis
-//!   passes (e.g. one may be able to bypass the borrow checker with a shared
+//!   passes (e.g., one may be able to bypass the borrow checker with a shared
 //!   `ExprKind::AddrOf` node taking a mutable borrow). The only reason `@T` in the
 //!   AST hasn't caused issues is because of inefficient folding passes which
 //!   would always deduplicate any such shared nodes. Even if the AST were to
-//!   switch to an arena, this would still hold, i.e. it couldn't use `&'a T`,
+//!   switch to an arena, this would still hold, i.e., it couldn't use `&'a T`,
 //!   but rather a wrapper like `P<'a, T>`.
 //!
 //! * **Immutability**: `P<T>` disallows mutating its inner `T`, unlike `Box<T>`
@@ -34,7 +34,7 @@
 //! * **Maintainability**: `P<T>` provides a fixed interface - `Deref`,
 //!   `and_then` and `map` - which can remain fully functional even if the
 //!   implementation changes (using a special thread-local heap, for example).
-//!   Moreover, a switch to, e.g. `P<'a, T>` would be easy and mostly automated.
+//!   Moreover, a switch to, e.g., `P<'a, T>` would be easy and mostly automated.
 
 use std::fmt::{self, Display, Debug};
 use std::iter::FromIterator;
index 8ff4b0d025c8d340c5e82bc05d2e8ad7b03f61a6..436a167e6a06356ecb2757dffe9a09e6ff8eee35 100644 (file)
@@ -281,7 +281,7 @@ fn generate_test_harness(sess: &ParseSess,
         path: Vec::new(),
         test_cases: Vec::new(),
         reexport_test_harness_main,
-        // NB: doesn't consider the value of `--crate-name` passed on the command line.
+        // N.B., doesn't consider the value of `--crate-name` passed on the command line.
         is_libtest: attr::find_crate_name(&krate.attrs).map(|s| s == "test").unwrap_or(false),
         toplevel_reexport: None,
         ctxt: SyntaxContext::empty().apply_mark(mark),
index 6866806cd7c669d0f19af0ce25c8efb3855cfed1..b7cd2acf8a5912b1b812b607dbabec26a9819d78 100644 (file)
@@ -340,8 +340,8 @@ pub fn order(self) -> i8 {
 }
 
 
-/// Expressions that syntactically contain an "exterior" struct literal i.e. not surrounded by any
-/// parens or other delimiters, e.g. `X { y: 1 }`, `X { y: 1 }.method()`, `foo == X { y: 1 }` and
+/// Expressions that syntactically contain an "exterior" struct literal i.e., not surrounded by any
+/// parens or other delimiters, e.g., `X { y: 1 }`, `X { y: 1 }.method()`, `foo == X { y: 1 }` and
 /// `X { y: 1 } == foo` all do, but `(X { y: 1 }) == foo` does not.
 pub fn contains_exterior_struct_lit(value: &ast::Expr) -> bool {
     match value.node {
index 77311bf53fd1e84e5c0b1e5f9fc190993e0ed133..4be831a0b3f6bebf79357c74b1d26939f1b4eb2b 100644 (file)
@@ -43,7 +43,7 @@ pub enum FnKind<'a> {
 /// Each method of the Visitor trait is a hook to be potentially
 /// overridden.  Each method's default implementation recursively visits
 /// the substructure of the input via the corresponding `walk` method;
-/// e.g. the `visit_mod` method by default calls `visit::walk_mod`.
+/// e.g., the `visit_mod` method by default calls `visit::walk_mod`.
 ///
 /// If you want to ensure that your code handles every variant
 /// explicitly, you need to override each method.  (And you also need
@@ -110,7 +110,7 @@ fn visit_lifetime(&mut self, lifetime: &'ast Lifetime) {
     }
     fn visit_mac(&mut self, _mac: &'ast Mac) {
         panic!("visit_mac disabled by default");
-        // NB: see note about macros above.
+        // N.B., see note about macros above.
         // if you really want a visitor that
         // works on macros, use this
         // definition in your trait impl:
index 32a58de3529fdeab3e3fb187c5684eaf3421bd5f..196cfa5fe351b223600bf35b0632ad6611b2cc43 100644 (file)
@@ -227,7 +227,7 @@ fn cs_op(less: bool,
     let fold = cs_fold1(false, // need foldr
         |cx, span, subexpr, self_f, other_fs| {
             // build up a series of `partial_cmp`s from the inside
-            // out (hence foldr) to get lexical ordering, i.e. for op ==
+            // out (hence foldr) to get lexical ordering, i.e., for op ==
             // `ast::lt`
             //
             // ```
index c0c11f64bc3b88b722e65f96846e96fa15ed63c1..443fd48120edb5a5fbe341d0da628b9c5ebedae3 100644 (file)
@@ -18,7 +18,7 @@
 //! - Methods taking any number of parameters of any type, and returning
 //!   any type, other than vectors, bottom and closures.
 //! - Generating `impl`s for types with type parameters and lifetimes
-//!   (e.g. `Option<T>`), the parameters are automatically given the
+//!   (e.g., `Option<T>`), the parameters are automatically given the
 //!   current trait as a bound. (This includes separate type parameters
 //!   and lifetimes for methods.)
 //! - Additional bounds on the type parameters (`TraitDef.additional_bounds`)
@@ -30,9 +30,9 @@
 //! - `Struct`, when `Self` is a struct (including tuple structs, e.g
 //!   `struct T(i32, char)`).
 //! - `EnumMatching`, when `Self` is an enum and all the arguments are the
-//!   same variant of the enum (e.g. `Some(1)`, `Some(3)` and `Some(4)`)
+//!   same variant of the enum (e.g., `Some(1)`, `Some(3)` and `Some(4)`)
 //! - `EnumNonMatchingCollapsed` when `Self` is an enum and the arguments
-//!   are not the same variant (e.g. `None`, `Some(1)` and `None`).
+//!   are not the same variant (e.g., `None`, `Some(1)` and `None`).
 //! - `StaticEnum` and `StaticStruct` for static methods, where the type
 //!   being derived upon is either an enum or struct respectively. (Any
 //!   argument with type Self is just grouped among the non-self
@@ -224,7 +224,7 @@ pub struct TraitDef<'a> {
     /// other than the current trait
     pub additional_bounds: Vec<Ty<'a>>,
 
-    /// Any extra lifetimes and/or bounds, e.g. `D: serialize::Decoder`
+    /// Any extra lifetimes and/or bounds, e.g., `D: serialize::Decoder`
     pub generics: LifetimeBounds<'a>,
 
     /// Is it an `unsafe` trait?
@@ -242,10 +242,10 @@ pub struct TraitDef<'a> {
 pub struct MethodDef<'a> {
     /// name of the method
     pub name: &'a str,
-    /// List of generics, e.g. `R: rand::Rng`
+    /// List of generics, e.g., `R: rand::Rng`
     pub generics: LifetimeBounds<'a>,
 
-    /// Whether there is a self argument (outer Option) i.e. whether
+    /// Whether there is a self argument (outer Option) i.e., whether
     /// this is a static function, and whether it is a pointer (inner
     /// Option)
     pub explicit_self: Option<Option<PtrTy<'a>>>,
@@ -1371,7 +1371,7 @@ fn build_enum_match_tuple<'b>(&self,
             // that type.  Otherwise casts to `i32` (the default repr
             // type).
             //
-            // i.e. for `enum E<T> { A, B(1), C(T, T) }`, and a deriving
+            // i.e., for `enum E<T> { A, B(1), C(T, T) }`, and a deriving
             // with three Self args, builds three statements:
             //
             // ```
@@ -1489,8 +1489,8 @@ fn build_enum_match_tuple<'b>(&self,
             //
             // (See also #4499 and #12609; note that some of the
             // discussions there influence what choice we make here;
-            // e.g. if we feature-gate `match x { ... }` when x refers
-            // to an uninhabited type (e.g. a zero-variant enum or a
+            // e.g., if we feature-gate `match x { ... }` when x refers
+            // to an uninhabited type (e.g., a zero-variant enum or a
             // type holding such an enum), but do not feature-gate
             // zero-variant enums themselves, then attempting to
             // derive Debug on such a type could here generate code
index fa284f4ab0e17bb7623aca19a56f05af614bbafd..11689a98a79119beac6306b294ddd043024136a0 100644 (file)
@@ -32,7 +32,7 @@ pub enum PtrTy<'a> {
     Raw(ast::Mutability),
 }
 
-/// A path, e.g. `::std::option::Option::<i32>` (global). Has support
+/// A path, e.g., `::std::option::Option::<i32>` (global). Has support
 /// for type parameters and a lifetime.
 #[derive(Clone)]
 pub struct Path<'a> {
index 31e608de1f840d282eb777af314db5b3acfe097f..24108a30fdce27f294f00358c455bdf0442d4351 100644 (file)
@@ -209,7 +209,7 @@ fn parse_args(ecx: &mut ExtCtxt,
 impl<'a, 'b> Context<'a, 'b> {
     fn resolve_name_inplace(&self, p: &mut parse::Piece) {
         // NOTE: the `unwrap_or` branch is needed in case of invalid format
-        // arguments, e.g. `format_args!("{foo}")`.
+        // arguments, e.g., `format_args!("{foo}")`.
         let lookup = |s| *self.names.get(s).unwrap_or(&0);
 
         match *p {
index b8a171b52adf2c49deadf58c747c6e2e70f08052..1f2e6fc81c8b7285e0cec7ff147297580a1f9b36 100644 (file)
@@ -318,7 +318,7 @@ fn has_test_signature(cx: &ExtCtxt, i: &ast::Item) -> bool {
 
 fn has_bench_signature(cx: &ExtCtxt, i: &ast::Item) -> bool {
     let has_sig = if let ast::ItemKind::Fn(ref decl, _, _, _) = i.node {
-        // NB: inadequate check, but we're running
+        // N.B., inadequate check, but we're running
         // well before resolve, can't get too deep.
         decl.inputs.len() == 1
     } else {
index 074687fc726e8fd209d4e5c69df09d15a8d128e0..74f63b5e2c6045394fd6242f4966fd08cf36f1cc 100644 (file)
@@ -308,11 +308,11 @@ pub fn apply_mark_with_transparency(self, mark: Mark, transparency: Transparency
         }
 
         // Otherwise, `mark` is a macros 1.0 definition and the call site is in a
-        // macros 2.0 expansion, i.e. a macros 1.0 invocation is in a macros 2.0 definition.
+        // macros 2.0 expansion, i.e., a macros 1.0 invocation is in a macros 2.0 definition.
         //
         // In this case, the tokens from the macros 1.0 definition inherit the hygiene
         // at their invocation. That is, we pretend that the macros 1.0 definition
-        // was defined at its invocation (i.e. inside the macros 2.0 definition)
+        // was defined at its invocation (i.e., inside the macros 2.0 definition)
         // so that the macros 2.0 definition remains hygienic.
         //
         // See the example at `test/run-pass/hygiene/legacy_interaction.rs`.
@@ -438,7 +438,7 @@ pub fn marks(mut self) -> Vec<(Mark, Transparency)> {
     /// }
     /// ```
     /// This returns the expansion whose definition scope we use to privacy check the resolution,
-    /// or `None` if we privacy check as usual (i.e. not w.r.t. a macro definition scope).
+    /// or `None` if we privacy check as usual (i.e., not w.r.t. a macro definition scope).
     pub fn adjust(&mut self, expansion: Mark) -> Option<Mark> {
         let mut scope = None;
         while !expansion.is_descendant_of(self.outer()) {
@@ -540,7 +540,7 @@ pub struct ExpnInfo {
     /// The location of the actual macro invocation or syntax sugar , e.g.
     /// `let x = foo!();` or `if let Some(y) = x {}`
     ///
-    /// This may recursively refer to other macro invocations, e.g. if
+    /// This may recursively refer to other macro invocations, e.g., if
     /// `foo!()` invoked `bar!()` internally, and there was an
     /// expression inside `bar!`; the call_site of the expression in
     /// the expansion would point to the `bar!` invocation; that
@@ -548,7 +548,7 @@ pub struct ExpnInfo {
     /// pointing to the `foo!` invocation.
     pub call_site: Span,
     /// The span of the macro definition itself. The macro may not
-    /// have a sensible definition span (e.g. something defined
+    /// have a sensible definition span (e.g., something defined
     /// completely inside libsyntax) in which case this is None.
     /// This span serves only informational purpose and is not used for resolution.
     pub def_site: Option<Span>,
@@ -571,9 +571,9 @@ pub struct ExpnInfo {
 /// The source of expansion.
 #[derive(Clone, Hash, Debug, PartialEq, Eq, RustcEncodable, RustcDecodable)]
 pub enum ExpnFormat {
-    /// e.g. #[derive(...)] <item>
+    /// e.g., #[derive(...)] <item>
     MacroAttribute(Symbol),
-    /// e.g. `format!()`
+    /// e.g., `format!()`
     MacroBang(Symbol),
     /// Desugaring done by the compiler during HIR lowering.
     CompilerDesugaring(CompilerDesugaringKind)
index 4e3d1e89a72194b1a72fa0f0f91a6f055293e19b..8b7ffa499cd71761213adf579eb3cbd9e65a3c25 100644 (file)
@@ -8,9 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-//! The source positions and related helper functions
+//! The source positions and related helper functions.
 //!
-//! # Note
+//! ## Note
 //!
 //! This API is completely unstable and subject to change.
 
 #![feature(specialization)]
 #![cfg_attr(not(stage0), feature(stdsimd))]
 
-use std::borrow::Cow;
-use std::cell::Cell;
-use std::cmp::{self, Ordering};
-use std::fmt;
-use std::hash::{Hasher, Hash};
-use std::ops::{Add, Sub};
-use std::path::PathBuf;
-
-use rustc_data_structures::stable_hasher::StableHasher;
-use rustc_data_structures::sync::{Lrc, Lock};
-
 extern crate arena;
 extern crate rustc_data_structures;
 
 
 mod analyze_source_file;
 
+use rustc_data_structures::stable_hasher::StableHasher;
+use rustc_data_structures::sync::{Lrc, Lock};
+
+use std::borrow::Cow;
+use std::cell::Cell;
+use std::cmp::{self, Ordering};
+use std::fmt;
+use std::hash::{Hasher, Hash};
+use std::ops::{Add, Sub};
+use std::path::PathBuf;
+
 pub struct Globals {
     symbol_interner: Lock<symbol::Interner>,
     span_interner: Lock<span_encoding::SpanInterner>,
@@ -83,25 +83,25 @@ pub fn new() -> Globals {
 
 scoped_thread_local!(pub static GLOBALS: Globals);
 
-/// Differentiates between real files and common virtual files
+/// Differentiates between real files and common virtual files.
 #[derive(Debug, Eq, PartialEq, Clone, Ord, PartialOrd, Hash, RustcDecodable, RustcEncodable)]
 pub enum FileName {
     Real(PathBuf),
     /// A macro.  This includes the full name of the macro, so that there are no clashes.
     Macros(String),
-    /// call to `quote!`
+    /// Call to `quote!`.
     QuoteExpansion(u64),
-    /// Command line
+    /// Command line.
     Anon(u64),
-    /// Hack in src/libsyntax/parse.rs
-    /// FIXME(jseyfried)
+    /// Hack in `src/libsyntax/parse.rs`.
+    // FIXME(jseyfried)
     MacroExpansion(u64),
     ProcMacroSourceCode(u64),
-    /// Strings provided as --cfg [cfgspec] stored in a crate_cfg
+    /// Strings provided as `--cfg [cfgspec]` stored in a `crate_cfg`.
     CfgSpec(u64),
-    /// Strings provided as crate attributes in the CLI
+    /// Strings provided as crate attributes in the CLI.
     CliCrateAttr(u64),
-    /// Custom sources for explicit parser calls from plugins and drivers
+    /// Custom sources for explicit parser calls from plugins and drivers.
     Custom(String),
     DocTest(PathBuf, isize),
 }
@@ -208,11 +208,11 @@ pub fn doc_test_source_code(path: PathBuf, line: isize) -> FileName{
 
 /// Spans represent a region of code, used for error reporting. Positions in spans
 /// are *absolute* positions from the beginning of the source_map, not positions
-/// relative to SourceFiles. Methods on the SourceMap can be used to relate spans back
+/// relative to `SourceFile`s. Methods on the `SourceMap` can be used to relate spans back
 /// to the original source.
 /// You must be careful if the span crosses more than one file - you will not be
 /// able to use many of the functions on spans in source_map and you cannot assume
-/// that the length of the span = hi - lo; there may be space in the BytePos
+/// that the length of the `span = hi - lo`; there may be space in the `BytePos`
 /// range between files.
 ///
 /// `SpanData` is public because `Span` uses a thread-local interner and can't be
@@ -243,7 +243,7 @@ pub fn with_ctxt(&self, ctxt: SyntaxContext) -> Span {
 }
 
 // The interner is pointed to by a thread local value which is only set on the main thread
-// with parallelization is disabled. So we don't allow Span to transfer between threads
+// with parallelization is disabled. So we don't allow `Span` to transfer between threads
 // to avoid panics and other errors, even though it would be memory safe to do so.
 #[cfg(not(parallel_queries))]
 impl !Send for Span {}
@@ -263,9 +263,9 @@ fn cmp(&self, rhs: &Self) -> Ordering {
 
 /// A collection of spans. Spans have two orthogonal attributes:
 ///
-/// - they can be *primary spans*. In this case they are the locus of
+/// - They can be *primary spans*. In this case they are the locus of
 ///   the error, and would be rendered with `^^^`.
-/// - they can have a *label*. In this case, the label is written next
+/// - They can have a *label*. In this case, the label is written next
 ///   to the mark in the snippet when we render.
 #[derive(Clone, Debug, Hash, PartialEq, Eq, RustcEncodable, RustcDecodable)]
 pub struct MultiSpan {
@@ -312,7 +312,7 @@ pub fn shrink_to_lo(self) -> Span {
         let span = self.data();
         span.with_hi(span.lo)
     }
-    /// Returns a new span representing an empty span at the end of this span
+    /// Returns a new span representing an empty span at the end of this span.
     #[inline]
     pub fn shrink_to_hi(self) -> Span {
         let span = self.data();
@@ -324,7 +324,7 @@ pub fn substitute_dummy(self, other: Span) -> Span {
         if self.is_dummy() { other } else { self }
     }
 
-    /// Return true if `self` fully encloses `other`.
+    /// Return `true` if `self` fully encloses `other`.
     pub fn contains(self, other: Span) -> bool {
         let span = self.data();
         let other = other.data();
@@ -341,7 +341,7 @@ pub fn source_equal(&self, other: &Span) -> bool {
         span.lo == other.lo && span.hi == other.hi
     }
 
-    /// Returns `Some(span)`, where the start is trimmed by the end of `other`
+    /// Returns `Some(span)`, where the start is trimmed by the end of `other`.
     pub fn trim_start(self, other: Span) -> Option<Span> {
         let span = self.data();
         let other = other.data();
@@ -352,14 +352,14 @@ pub fn trim_start(self, other: Span) -> Option<Span> {
         }
     }
 
-    /// Return the source span - this is either the supplied span, or the span for
+    /// Return the source span -- this is either the supplied span, or the span for
     /// the macro callsite that expanded to it.
     pub fn source_callsite(self) -> Span {
         self.ctxt().outer().expn_info().map(|info| info.call_site.source_callsite()).unwrap_or(self)
     }
 
     /// The `Span` for the tokens in the previous macro expansion from which `self` was generated,
-    /// if any
+    /// if any.
     pub fn parent(self) -> Option<Span> {
         self.ctxt().outer().expn_info().map(|i| i.call_site)
     }
@@ -395,7 +395,7 @@ fn source_callee(info: ExpnInfo) -> ExpnInfo {
         self.ctxt().outer().expn_info().map(source_callee)
     }
 
-    /// Check if a span is "internal" to a macro in which #[unstable]
+    /// Check if a span is "internal" to a macro in which `#[unstable]`
     /// items can be used (that is, a macro marked with
     /// `#[allow_internal_unstable]`).
     pub fn allows_unstable(&self) -> bool {
@@ -416,7 +416,7 @@ pub fn is_compiler_desugaring(&self, kind: CompilerDesugaringKind) -> bool {
         }
     }
 
-    /// Return the compiler desugaring that created this span, or None
+    /// Return the compiler desugaring that created this span, or `None`
     /// if this span is not from a desugaring.
     pub fn compiler_desugaring_kind(&self) -> Option<CompilerDesugaringKind> {
         match self.ctxt().outer().expn_info() {
@@ -442,7 +442,7 @@ pub fn macro_backtrace(mut self) -> Vec<MacroBacktrace> {
         let mut prev_span = DUMMY_SP;
         let mut result = vec![];
         while let Some(info) = self.ctxt().outer().expn_info() {
-            // Don't print recursive invocations
+            // Don't print recursive invocations.
             if !info.call_site.source_equal(&prev_span) {
                 let (pre, post) = match info.format {
                     ExpnFormat::MacroAttribute(..) => ("#[", "]"),
@@ -466,7 +466,7 @@ pub fn macro_backtrace(mut self) -> Vec<MacroBacktrace> {
     pub fn to(self, end: Span) -> Span {
         let span_data = self.data();
         let end_data = end.data();
-        // FIXME(jseyfried): self.ctxt should always equal end.ctxt here (c.f. issue #23480)
+        // FIXME(jseyfried): `self.ctxt` should always equal `end.ctxt` here (cf. issue #23480).
         // Return the macro span on its own to avoid weird diagnostic output. It is preferable to
         // have an incomplete span than a completely nonsensical one.
         if span_data.ctxt != end_data.ctxt {
@@ -475,8 +475,8 @@ pub fn to(self, end: Span) -> Span {
             } else if end_data.ctxt == SyntaxContext::empty() {
                 return self;
             }
-            // both span fall within a macro
-            // FIXME(estebank) check if it is the *same* macro
+            // Both spans fall within a macro.
+            // FIXME(estebank): check if it is the *same* macro.
         }
         Span::new(
             cmp::min(span_data.lo, end_data.lo),
@@ -658,7 +658,7 @@ pub fn push_span_label(&mut self, span: Span, label: String) {
         self.span_labels.push((span, label));
     }
 
-    /// Selects the first primary span (if any)
+    /// Selects the first primary span (if any).
     pub fn primary_span(&self) -> Option<Span> {
         self.primary_spans.first().cloned()
     }
@@ -679,7 +679,7 @@ pub fn is_dummy(&self) -> bool {
         is_dummy
     }
 
-    /// Replaces all occurrences of one Span with another. Used to move Spans in areas that don't
+    /// 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.
     pub fn replace(&mut self, before: Span, after: Span) -> bool {
         let mut replacements_occurred = false;
@@ -700,7 +700,7 @@ pub fn replace(&mut self, before: Span, after: Span) -> bool {
 
     /// Returns the strings to highlight. We always ensure that there
     /// is an entry for each of the primary spans -- for each primary
-    /// span P, if there is at least one label with span P, we return
+    /// span `P`, if there is at least one label with span `P`, we return
     /// those labels (marked as primary). But otherwise we return
     /// `SpanLabel` instances with empty labels.
     pub fn span_labels(&self) -> Vec<SpanLabel> {
@@ -742,23 +742,23 @@ fn from(spans: Vec<Span>) -> MultiSpan {
 
 pub const NO_EXPANSION: SyntaxContext = SyntaxContext::empty();
 
-/// Identifies an offset of a multi-byte character in a SourceFile
+/// Identifies an offset of a multi-byte character in a `SourceFile`.
 #[derive(Copy, Clone, RustcEncodable, RustcDecodable, Eq, PartialEq, Debug)]
 pub struct MultiByteChar {
-    /// The absolute offset of the character in the SourceMap
+    /// The absolute offset of the character in the `SourceMap`.
     pub pos: BytePos,
-    /// The number of bytes, >=2
+    /// The number of bytes, `>= 2`.
     pub bytes: u8,
 }
 
-/// Identifies an offset of a non-narrow character in a SourceFile
+/// Identifies an offset of a non-narrow character in a `SourceFile`.
 #[derive(Copy, Clone, RustcEncodable, RustcDecodable, Eq, PartialEq, Debug)]
 pub enum NonNarrowChar {
-    /// Represents a zero-width character
+    /// Represents a zero-width character.
     ZeroWidth(BytePos),
-    /// Represents a wide (fullwidth) character
+    /// Represents a wide (full-width) character.
     Wide(BytePos),
-    /// Represents a tab character, represented visually with a width of 4 characters
+    /// Represents a tab character, represented visually with a width of 4 characters.
     Tab(BytePos),
 }
 
@@ -772,7 +772,7 @@ fn new(pos: BytePos, width: usize) -> Self {
         }
     }
 
-    /// Returns the absolute offset of the character in the SourceMap
+    /// Returns the absolute offset of the character in the `SourceMap`.
     pub fn pos(&self) -> BytePos {
         match *self {
             NonNarrowChar::ZeroWidth(p) |
@@ -781,7 +781,7 @@ pub fn pos(&self) -> BytePos {
         }
     }
 
-    /// Returns the width of the character, 0 (zero-width) or 2 (wide)
+    /// Returns the width of the character, 0 (zero-width) or 2 (wide).
     pub fn width(&self) -> usize {
         match *self {
             NonNarrowChar::ZeroWidth(_) => 0,
@@ -815,7 +815,7 @@ fn sub(self, rhs: BytePos) -> Self {
     }
 }
 
-/// The state of the lazy external source loading mechanism of a SourceFile.
+/// The state of the lazy external source loading mechanism of a `SourceFile`.
 #[derive(PartialEq, Eq, Clone)]
 pub enum ExternalSource {
     /// The external source has been loaded already.
@@ -824,7 +824,7 @@ pub enum ExternalSource {
     AbsentOk,
     /// A failed attempt has been made to load the external source.
     AbsentErr,
-    /// No external source has to be loaded, since the SourceFile represents a local crate.
+    /// No external source has to be loaded, since the `SourceFile` represents a local crate.
     Unneeded,
 }
 
@@ -844,38 +844,38 @@ pub fn get_source(&self) -> Option<&str> {
     }
 }
 
-/// A single source in the SourceMap.
+/// A single source in the `SourceMap`.
 #[derive(Clone)]
 pub struct SourceFile {
     /// The name of the file that the source came from, source that doesn't
-    /// originate from files has names between angle brackets by convention,
-    /// e.g. `<anon>`
+    /// originate from files has names between angle brackets by convention
+    /// (e.g., `<anon>`).
     pub name: FileName,
-    /// True if the `name` field above has been modified by --remap-path-prefix
+    /// True if the `name` field above has been modified by `--remap-path-prefix`.
     pub name_was_remapped: bool,
     /// The unmapped path of the file that the source came from.
-    /// Set to `None` if the SourceFile was imported from an external crate.
+    /// Set to `None` if the `SourceFile` was imported from an external crate.
     pub unmapped_path: Option<FileName>,
-    /// Indicates which crate this SourceFile was imported from.
+    /// Indicates which crate this `SourceFile` was imported from.
     pub crate_of_origin: u32,
-    /// The complete source code
+    /// The complete source code.
     pub src: Option<Lrc<String>>,
-    /// The source code's hash
+    /// The source code's hash.
     pub src_hash: u128,
     /// The external source code (used for external crates, which will have a `None`
     /// value as `self.src`.
     pub external_src: Lock<ExternalSource>,
-    /// The start position of this source in the SourceMap
+    /// The start position of this source in the `SourceMap`.
     pub start_pos: BytePos,
-    /// The end position of this source in the SourceMap
+    /// The end position of this source in the `SourceMap`.
     pub end_pos: BytePos,
-    /// Locations of lines beginnings in the source code
+    /// Locations of lines beginnings in the source code.
     pub lines: Vec<BytePos>,
-    /// Locations of multi-byte characters in the source code
+    /// Locations of multi-byte characters in the source code.
     pub multibyte_chars: Vec<MultiByteChar>,
-    /// Width of characters that are not narrow in the source code
+    /// Width of characters that are not narrow in the source code.
     pub non_narrow_chars: Vec<NonNarrowChar>,
-    /// A hash of the filename, used for speeding up the incr. comp. hashing.
+    /// A hash of the filename, used for speeding up hashing in incremental compilation.
     pub name_hash: u128,
 }
 
@@ -889,7 +889,7 @@ fn encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
             s.emit_struct_field("end_pos", 5, |s| self.end_pos.encode(s))?;
             s.emit_struct_field("lines", 6, |s| {
                 let lines = &self.lines[..];
-                // store the length
+                // Store the length.
                 s.emit_u32(lines.len() as u32)?;
 
                 if !lines.is_empty() {
@@ -1060,7 +1060,7 @@ pub fn new(name: FileName,
         }
     }
 
-    /// Return the BytePos of the beginning of the current line.
+    /// Return the `BytePos` of the beginning of the current line.
     pub fn line_begin_pos(&self, pos: BytePos) -> BytePos {
         let line_index = self.lookup_line(pos).unwrap();
         self.lines[line_index]
@@ -1148,9 +1148,9 @@ pub fn count_lines(&self) -> usize {
     }
 
     /// Find the line containing the given position. The return value is the
-    /// index into the `lines` array of this SourceFile, not the 1-based line
+    /// index into the `lines` array of this `SourceFile`, not the 1-based line
     /// number. If the source_file is empty or the position is located before the
-    /// first line, None is returned.
+    /// first line, `None` is returned.
     pub fn lookup_line(&self, pos: BytePos) -> Option<usize> {
         if self.lines.len() == 0 {
             return None;
@@ -1207,14 +1207,14 @@ pub trait Pos {
 #[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Debug)]
 pub struct BytePos(pub u32);
 
-/// A character offset. Because of multibyte utf8 characters, a byte offset
-/// is not equivalent to a character offset. The SourceMap will convert BytePos
-/// values to CharPos values as necessary.
+/// A character offset. Because of multibyte UTF-8 characters, a byte offset
+/// is not equivalent to a character offset. The `SourceMap` will convert `BytePos`
+/// values to `CharPos` values as necessary.
 #[derive(Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, Debug)]
 pub struct CharPos(pub usize);
 
-// FIXME: Lots of boilerplate in these impls, but so far my attempts to fix
-// have been unsuccessful
+// FIXME: lots of boilerplate in these impls, but so far my attempts to fix
+// have been unsuccessful.
 
 impl Pos for BytePos {
     #[inline(always)]
@@ -1296,20 +1296,20 @@ fn sub(self, rhs: CharPos) -> CharPos {
 // Loc, LocWithOpt, SourceFileAndLine, SourceFileAndBytePos
 //
 
-/// A source code location used for error reporting
+/// A source code location used for error reporting.
 #[derive(Debug, Clone)]
 pub struct Loc {
-    /// Information about the original source
+    /// Information about the original source.
     pub file: Lrc<SourceFile>,
-    /// The (1-based) line number
+    /// The (1-based) line number.
     pub line: usize,
-    /// The (0-based) column offset
+    /// The (0-based) column offset.
     pub col: CharPos,
-    /// The (0-based) column offset when displayed
+    /// The (0-based) column offset when displayed.
     pub col_display: usize,
 }
 
-/// A source code location used as the result of lookup_char_pos_adj
+/// A source code location used as the result of `lookup_char_pos_adj`.
 // Actually, *none* of the clients use the filename *or* file field;
 // perhaps they should just be removed.
 #[derive(Debug)]
@@ -1320,7 +1320,7 @@ pub struct LocWithOpt {
     pub file: Option<Lrc<SourceFile>>,
 }
 
-// used to be structural records. Better names, anyone?
+// Used to be structural records.
 #[derive(Debug)]
 pub struct SourceFileAndLine { pub sf: Lrc<SourceFile>, pub line: usize }
 #[derive(Debug)]
index 847bf60cefb9616d3ad5557cd137d26c9d543390..05c53878e70042cbcdc306c69b7f99d8c80b4a51 100644 (file)
@@ -9,20 +9,21 @@
 // except according to those terms.
 
 //! An "interner" is a data structure that associates values with usize tags and
-//! allows bidirectional lookup; i.e. given a value, one can easily find the
+//! allows bidirectional lookup; i.e., given a value, one can easily find the
 //! type, and vice versa.
 
-use hygiene::SyntaxContext;
-use {Span, DUMMY_SP, GLOBALS};
-
-use rustc_data_structures::fx::FxHashMap;
 use arena::DroplessArena;
+use rustc_data_structures::fx::FxHashMap;
 use serialize::{Decodable, Decoder, Encodable, Encoder};
+
 use std::fmt;
 use std::str;
 use std::cmp::{PartialEq, Ordering, PartialOrd, Ord};
 use std::hash::{Hash, Hasher};
 
+use hygiene::SyntaxContext;
+use {Span, DUMMY_SP, GLOBALS};
+
 #[derive(Copy, Clone, Eq)]
 pub struct Ident {
     pub name: Symbol,
@@ -34,6 +35,7 @@ impl Ident {
     pub const fn new(name: Symbol, span: Span) -> Ident {
         Ident { name, span }
     }
+
     #[inline]
     pub const fn with_empty_ctxt(name: Symbol) -> Ident {
         Ident::new(name, DUMMY_SP)
@@ -60,7 +62,7 @@ pub fn without_first_quote(self) -> Ident {
 
     /// "Normalize" ident for use in comparisons using "item hygiene".
     /// Identifiers with same string value become same if they came from the same "modern" macro
-    /// (e.g. `macro` item, but not `macro_rules` item) and stay different if they came from
+    /// (e.g., `macro` item, but not `macro_rules` item) and stay different if they came from
     /// different "modern" macros.
     /// Technically, this operation strips all non-opaque marks from ident's syntactic context.
     pub fn modern(self) -> Ident {
@@ -69,7 +71,7 @@ pub fn modern(self) -> Ident {
 
     /// "Normalize" ident for use in comparisons using "local variable hygiene".
     /// Identifiers with same string value become same if they came from the same non-transparent
-    /// macro (e.g. `macro` or `macro_rules!` items) and stay different if they came from different
+    /// macro (e.g., `macro` or `macro_rules!` items) and stay different if they came from different
     /// non-transparent macros.
     /// Technically, this operation strips all transparent marks from ident's syntactic context.
     pub fn modern_and_legacy(self) -> Ident {
@@ -122,7 +124,7 @@ impl Encodable for Ident {
     fn encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
         if self.span.ctxt().modern() == SyntaxContext::empty() {
             s.emit_str(&self.as_str())
-        } else { // FIXME(jseyfried) intercrate hygiene
+        } else { // FIXME(jseyfried): intercrate hygiene
             let mut string = "#".to_owned();
             string.push_str(&self.as_str());
             s.emit_str(&string)
@@ -135,7 +137,7 @@ fn decode<D: Decoder>(d: &mut D) -> Result<Ident, D::Error> {
         let string = d.read_str()?;
         Ok(if !string.starts_with('#') {
             Ident::from_str(&string)
-        } else { // FIXME(jseyfried) intercrate hygiene
+        } else { // FIXME(jseyfried): intercrate hygiene
             Ident::with_empty_ctxt(Symbol::gensym(&string[1..]))
         })
     }
@@ -146,7 +148,7 @@ fn decode<D: Decoder>(d: &mut D) -> Result<Ident, D::Error> {
 pub struct Symbol(u32);
 
 // The interner is pointed to by a thread local value which is only set on the main thread
-// with parallelization is disabled. So we don't allow Symbol to transfer between threads
+// with parallelization is disabled. So we don't allow `Symbol` to transfer between threads
 // to avoid panics and other errors, even though it would be memory safe to do so.
 #[cfg(not(parallel_queries))]
 impl !Send for Symbol { }
@@ -163,7 +165,7 @@ pub fn interned(self) -> Self {
         with_interner(|interner| interner.interned(self))
     }
 
-    /// gensym's a new usize, using the current interner.
+    /// Gensyms a new usize, using the current interner.
     pub fn gensym(string: &str) -> Self {
         with_interner(|interner| interner.gensym(string))
     }
@@ -226,7 +228,7 @@ fn eq(&self, other: &T) -> bool {
     }
 }
 
-// The &'static strs in this type actually point into the arena
+// The `&'static str`s in this type actually point into the arena.
 #[derive(Default)]
 pub struct Interner {
     arena: DroplessArena,
@@ -240,7 +242,7 @@ fn prefill(init: &[&str]) -> Self {
         let mut this = Interner::default();
         for &string in init {
             if string == "" {
-                // We can't allocate empty strings in the arena, so handle this here
+                // We can't allocate empty strings in the arena, so handle this here.
                 let name = Symbol(this.strings.len() as u32);
                 this.names.insert("", name);
                 this.strings.push("");
@@ -258,12 +260,13 @@ pub fn intern(&mut self, string: &str) -> Symbol {
 
         let name = Symbol(self.strings.len() as u32);
 
-        // from_utf8_unchecked is safe since we just allocated a &str which is known to be utf8
+        // `from_utf8_unchecked` is safe since we just allocated a `&str` which is known to be
+        // UTF-8.
         let string: &str = unsafe {
             str::from_utf8_unchecked(self.arena.alloc_slice(string.as_bytes()))
         };
-        // It is safe to extend the arena allocation to 'static because we only access
-        // these while the arena is still alive
+        // It is safe to extend the arena allocation to `'static` because we only access
+        // these while the arena is still alive.
         let string: &'static str =  unsafe {
             &*(string as *const str)
         };
@@ -344,7 +347,7 @@ pub fn fresh() -> Self {
     }
 }}
 
-// NB: leaving holes in the ident table is bad! a different ident will get
+// N.B., leaving holes in the ident table is bad! a different ident will get
 // interned with the id from the hole, but it will be between the min and max
 // of the reserved words, and thus tagged as "reserved".
 // After modifying this list adjust `is_special`, `is_used_keyword`/`is_unused_keyword`,
@@ -438,7 +441,7 @@ fn is_unused_keyword_2018(self) -> bool {
 }
 
 impl Ident {
-    // Returns true for reserved identifiers used internally for elided lifetimes,
+    // Returns `true` for reserved identifiers used internally for elided lifetimes,
     // unnamed method parameters, crate root module, error recovery etc.
     pub fn is_special(self) -> bool {
         self.name <= keywords::Underscore.name()
@@ -491,8 +494,8 @@ fn with_interner<T, F: FnOnce(&mut Interner) -> T>(f: F) -> T {
 /// Represents a string stored in the interner. Because the interner outlives any thread
 /// which uses this type, we can safely treat `string` which points to interner data,
 /// as an immortal string, as long as this type never crosses between threads.
-// FIXME: Ensure that the interner outlives any thread which uses LocalInternedString,
-//        by creating a new thread right after constructing the interner
+// FIXME: ensure that the interner outlives any thread which uses `LocalInternedString`,
+// by creating a new thread right after constructing the interner.
 #[derive(Clone, Copy, Hash, PartialOrd, Eq, Ord)]
 pub struct LocalInternedString {
     string: &'static str,
@@ -581,7 +584,7 @@ fn encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
     }
 }
 
-/// Represents a string stored in the string interner
+/// Represents a string stored in the string interner.
 #[derive(Clone, Copy, Eq)]
 pub struct InternedString {
     symbol: Symbol,
index 5ac46c2c5ebdc8cb6fdd32399fba239be8958248..b28e62f16fd9bcfa64c08a7bbb938613c551bc5d 100644 (file)
@@ -198,7 +198,7 @@ pub trait Terminal: Write {
     /// *Note: This does not flush.*
     ///
     /// That means the reset command may get buffered so, if you aren't planning on doing anything
-    /// else that might flush stdout's buffer (e.g. writing a line of text), you should flush after
+    /// else that might flush stdout's buffer (e.g., writing a line of text), you should flush after
     /// calling reset.
     fn reset(&mut self) -> io::Result<bool>;
 
index 492d26e625cbed84dfbbf5dea8316966b8fd6ddf..426dc4db87b54d84a3f3adc7043d188071166bc1 100644 (file)
@@ -64,7 +64,7 @@ pub fn get_dbpath_for_term(term: &str) -> Option<PathBuf> {
             p.pop();
 
             // on some installations the dir is named after the hex of the char
-            // (e.g. macOS)
+            // (e.g., macOS)
             p.push(&format!("{:x}", first_char as usize));
             p.push(term);
             if fs::metadata(&p).is_ok() {
@@ -79,7 +79,7 @@ pub fn get_dbpath_for_term(term: &str) -> Option<PathBuf> {
 #[ignore(reason = "buildbots don't have ncurses installed and I can't mock everything I need")]
 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)
+    // 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
     fn x(t: &str) -> String {
index 6f7dfee53facc423fa5919c854be3c9c00a26043..cf15c89fac24199c168920a7349c09f809c33c9d 100644 (file)
@@ -66,7 +66,7 @@ pub fn write_short_result(
         self.write_pretty(result, color)?;
         if self.test_count % QUIET_MODE_MAX_COLUMN == QUIET_MODE_MAX_COLUMN - 1 {
             // we insert a new line every 100 dots in order to flush the
-            // screen when dealing with line-buffered output (e.g. piping to
+            // screen when dealing with line-buffered output (e.g., piping to
             // `stamp` in the rust CI).
             let out = format!(" {}/{}\n", self.test_count+1, self.total_test_count);
             self.write_plain(&out)?;
index b8711a691477bccd63467fadca5f3c237a118efd..bca98881db4500925a7a9645b61a1f867c107cfa 100644 (file)
@@ -23,7 +23,7 @@
 // running tests while providing a base that other test frameworks may
 // build off of.
 
-// NB: this is also specified in this crate's Cargo.toml, but libsyntax contains logic specific to
+// N.B., this is also specified in this crate's Cargo.toml, but libsyntax contains logic specific to
 // this crate, which relies on this attribute (rather than the value of `--crate-name` passed by
 // cargo) to detect this crate.
 
@@ -100,7 +100,7 @@ pub mod test {
 use formatters::{JsonFormatter, OutputFormatter, PrettyFormatter, TerseFormatter};
 
 // The name of a test. By convention this follows the rules for rust
-// paths; i.e. it should be a series of identifiers separated by double
+// paths; i.e., it should be a series of identifiers separated by double
 // colons. This way if some test runner wants to arrange the tests
 // hierarchically it may.
 
@@ -515,7 +515,7 @@ fn usage(binary: &str, options: &getopts::Options) {
 
 // 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
+    // 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();
     // Whether we should enable unstable features for bootstrapping
     let bootstrap = env::var("RUSTC_BOOTSTRAP").is_ok();
@@ -1614,7 +1614,7 @@ pub fn iter<T, F>(inner: &mut F) -> stats::Summary
     // be left doing 0 iterations on every loop. The unfortunate
     // side effect of not being able to do as many runs is
     // automatically handled by the statistical analysis below
-    // (i.e. larger error bars).
+    // (i.e., larger error bars).
     n = cmp::max(1, n);
 
     let mut total_run = Duration::new(0, 0);
index 9a8749712c355122f874648dc060eec333100920..1fad612b946b456e01e95891ddc534a07d9ce531 100644 (file)
@@ -224,7 +224,7 @@ fn var(&self) -> f64 {
                 let x = *s - mean;
                 v = v + x * x;
             }
-            // NB: this is _supposed to be_ len-1, not len. If you
+            // N.B., this is _supposed to be_ len-1, not len. If you
             // change it back to len, you will be calculating a
             // population variance, not a sample variance.
             let denom = (self.len() - 1) as f64;
index 8ff401164c1353e7f4088bd485fefe12b30a06e0..4ec0857f051313222d34214133a53ee6d198424f 100644 (file)
@@ -96,7 +96,7 @@ unsafe fn uninit() {
     pub mod ms_init {
         // .CRT$X?? sections are roughly analogous to ELF's .init_array and .fini_array,
         // except that they exploit the fact that linker will sort them alphabitically,
-        // so e.g. sections with names between .CRT$XIA and .CRT$XIZ are guaranteed to be
+        // so e.g., sections with names between .CRT$XIA and .CRT$XIZ are guaranteed to be
         // placed between those two, without requiring any ordering of objects on the linker
         // command line.
         // Note that ordering of same-named sections from different objects is not guaranteed.
index 829b4fbf3c92b70b96280e0580974fed1ecc6690..28c1f0a54bf01f715d02a5716a0053bb55abb507 100644 (file)
@@ -11,7 +11,7 @@
 // ignore-tidy-linelength
 // compile-flags:-Zprint-mono-items=lazy
 
-// NB: We do not expect *any* monomorphization to be generated here.
+// N.B., we do not expect *any* monomorphization to be generated here.
 
 #![deny(dead_code)]
 #![crate_type = "rlib"]
index 58232852596021081d8b7d1048eb8f3217f006e8..e6b952ec9f6aefb5a82207d8caa23af93abee759 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 // compile-flags: -C no-prepopulate-passes
-// `#[no_mangle]`d functions always have external linkage, i.e. no `internal` in their `define`s
+// `#[no_mangle]`d functions always have external linkage, i.e., no `internal` in their `define`s
 
 #![crate_type = "lib"]
 #![no_std]
index 59d829633e55c497c87be79c04eed3f0bfc88133..b1488e3b8d0b2126bde99753c1dd42f957600ad7 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 // compile-flags: -O
-// `#[no_mangle]`d static variables always have external linkage, i.e. no `internal` in their
+// `#[no_mangle]`d static variables always have external linkage, i.e., no `internal` in their
 // definitions
 
 #![crate_type = "lib"]
index 3ec8b048b12bfe5892609543d8305b265db40439..8b4b10ad23c9052009895116cf7238bc0905e798 100644 (file)
@@ -280,7 +280,7 @@ fn generic_function<T>(x: T) -> T { x }
 }
 
 // In many of the cases below, the type that is actually under test is wrapped
-// in a tuple, e.g. Box<T>, references, raw pointers, fixed-size vectors, ...
+// in a tuple, e.g., Box<T>, references, raw pointers, fixed-size vectors, ...
 // This is because GDB will not print the type name from DWARF debuginfo for
 // some kinds of types (pointers, arrays, functions, ...)
 // Since tuples are structs as far as GDB is concerned, their name will be
index ffb66c29219d3454896a11d50a62c193fd449eff..f2d610c1ade63dea24e6bf735c536467f8e8f574 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 // This test case tests the incremental compilation hash (ICH) implementation
-// for exprs that can panic at runtime (e.g. because of bounds checking). For
+// for exprs that can panic at runtime (e.g., because of bounds checking). For
 // these expressions an error message containing their source location is
 // generated, so their hash must always depend on their location in the source
 // code, not just when debuginfo is enabled.
index 10b1beb04133fbc31663064d33368350c891673e..06842e3c6c493bf0a2dd1a81ac20c9743099851c 100644 (file)
@@ -340,7 +340,7 @@ struct AddTypeParameterBoundWhereClause<T>(
 
 // Empty struct ----------------------------------------------------------------
 // Since we cannot change anything in this case, we just make sure that the
-// fingerprint is stable (i.e. that there are no random influences like memory
+// fingerprint is stable (i.e., that there are no random influences like memory
 // addresses taken into account by the hashing algorithm).
 // Note: there is no #[cfg(...)], so this is ALWAYS compiled
 #[rustc_clean(label="Hir", cfg="cfail2")]
index c645a66b70efcb26370bd3058d9479fec3fe154b..aed34bf35851d3a2bd7441683547965980b120dc 100644 (file)
@@ -11,7 +11,7 @@
 // compile-flags: --crate-type=lib
 
 // A bunch of tests for syntactic forms involving blocks that were
-// previously ambiguous (e.g. 'if true { } *val;' gets parsed as a
+// previously ambiguous (e.g., 'if true { } *val;' gets parsed as a
 // binop)
 
 
index a040c0f858d78d85a566c3c2d03a749240fd4023..c8c8bb1c8507d6d89c15de34c0e45ad780d0043d 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 // This test case makes sure that two identical invocations of the compiler
-// (i.e. same code base, same compile-flags, same compiler-versions, etc.)
+// (i.e., same code base, same compile-flags, same compiler-versions, etc.)
 // produce the same output. In the past, symbol names of monomorphized functions
 // were not deterministic (which we want to avoid).
 //
index 575d672e092a043c51e1188a9e83bd1d16d32b92..bfcdf5b143f1271ca10b5ef3a2a85c92c781a2cc 100644 (file)
@@ -47,7 +47,7 @@ macro_rules! check3 {
         check2!($b, $c);
         check2!($a, $c);
 
-        // Check the remaining cases, i.e. permutations of ($a, $b, $c).
+        // Check the remaining cases, i.e., permutations of ($a, $b, $c).
         check!($a, $b, $c);
         check!($a, $c, $b);
         check!($b, $a, $c);
index 068b010da1ee1e3c5815c0e5e486b1e0142ac199..088d10f8d63d0b1982f056d320517f24c9b87ad8 100644 (file)
@@ -32,7 +32,7 @@ fn lub_short<'a, T>(_: &[&'a T], _: &[&'a T]) {}
 }
 
 // LUB-coercion (if-else/match/array) coerces `xs: &'b [&'static T: N]`
-// to a subtype of the LUB of `xs` and `ys` (i.e. `&'b [&'a T]`),
+// to a subtype of the LUB of `xs` and `ys` (i.e., `&'b [&'a T]`),
 // regardless of the order they appear (in if-else/match/array).
 fn long_and_short_lub1<'a, 'b, T>(xs: &'b [&'static T; 1], ys: &'b [&'a T]) {
     let _order1 = [xs, ys];
@@ -40,7 +40,7 @@ fn lub_short<'a, T>(_: &[&'a T], _: &[&'a T]) {}
 }
 
 // LUB-coercion should also have the exact same effect when `&'b [&'a T; N]`
-// needs to be coerced, i.e. the resulting type is not &'b [&'static T], but
+// needs to be coerced, i.e., the resulting type is not &'b [&'static T], but
 // rather the `&'b [&'a T]` LUB.
 fn long_and_short_lub2<'a, 'b, T>(xs: &'b [&'static T], ys: &'b [&'a T; 1]) {
     let _order1 = [xs, ys];
index aaf017c0ad37438b6c290cf1628dd14e4f893554..51e26ff68de7e183d908d04eb3cffcc386d3da7e 100644 (file)
@@ -16,7 +16,7 @@
 // ignore-cloudabi no processes
 // ignore-emscripten no processes
 
-// NB: These tests kill child processes. Valgrind sees these children as leaking
+// N.B., these tests kill child processes. Valgrind sees these children as leaking
 // memory, which makes for some *confusing* logs. That's why these are here
 // instead of in std.
 
index fb9af09a7ce97faee05f4c824b7cffb3b9ea63e2..97820ac7ea8de2b3d892cbe93563a9694396e0e3 100644 (file)
@@ -32,7 +32,7 @@
 // - D means "I implement Drop"
 //
 // - P means "I implement Drop but guarantee my (first) parameter is
-//     pure, i.e. not accessed from the destructor"; no other parameters
+//     pure, i.e., not accessed from the destructor"; no other parameters
 //     are pure.
 //
 // - S means "I do not implement Drop"
index 2c88cfd5c8f93d37613115decc3ed2fcfe244476..89d70da32cf200112114dfe1235ce5683d907a4a 100644 (file)
 //    of all-zeroes.
 //
 // 6. assert that the context confirms that it actually saw a cycle (since a traversal
-//    might have terminated, e.g. on a tree structure that contained no cycles).
+//    might have terminated, e.g., on a tree structure that contained no cycles).
 
 use std::cell::{Cell, RefCell};
 use std::cmp::Ordering;
index 95bb8e8aa64d7c99dca6fff11e80968e3c5d3cef..7bc4dccdcced5802938a7e3f5b7af1d0c4574d0c 100644 (file)
@@ -15,7 +15,7 @@
 // Ensure S is moved, not copied, on assignment.
 impl Drop for S { fn drop(&mut self) { } }
 
-// user-defined function "returning" bottom (i.e. no return at all).
+// user-defined function "returning" bottom (i.e., no return at all).
 fn my_panic() -> ! { loop {} }
 
 pub fn step(f: bool) {
index 7373828427e98adf5ff0824189794f8bc85b7024..d622fd6171a894640d2b5d31a9a1b6fb66e76198 100644 (file)
@@ -86,7 +86,7 @@ pub fn isoweekdate(&self) -> (i32, u32, Weekday) {
         let weeks_in_year = self.last_week_number();
 
         // Work out the final result.
-        // If the week is -1 or >= weeks_in_year, we will need to adjust the year.
+        // If the week is `-1` or `>= weeks_in_year`, we will need to adjust the year.
         let year = self.year();
         let wd = self.weekday();
 
@@ -234,7 +234,7 @@ pub fn num_days_from_sunday(&self) -> u32 {
     }
 }
 
-/// GroupBy implementation.
+/// `GroupBy` implementation.
 struct GroupBy<It: Iterator, F> {
     it: std::iter::Peekable<It>,
     f: F,
@@ -319,7 +319,7 @@ fn join(mut self, sep: &str) -> String
         s
     }
 
-    // HACK(eddyb) Only needed because `impl Trait` can't be
+    // HACK(eddyb): only needed because `impl Trait` can't be
     // used with trait methods: `.foo()` becomes `.__(foo)`.
     fn __<F, R>(self, f: F) -> R
     where F: FnOnce(Self) -> R {
@@ -329,9 +329,7 @@ fn __<F, R>(self, f: F) -> R
 
 impl<It> IteratorExt for It where It: Iterator {}
 
-///
-/// Generates an iterator that yields exactly n spaces.
-///
+/// Generates an iterator that yields exactly `n` spaces.
 fn spaces(n: usize) -> std::iter::Take<std::iter::Repeat<char>> {
     std::iter::repeat(' ').take(n)
 }
@@ -341,9 +339,7 @@ fn test_spaces() {
     assert_eq!(spaces(10).collect::<String>(), "          ")
 }
 
-///
 /// Returns an iterator of dates in a given year.
-///
 fn dates_in_year(year: i32) -> impl Iterator<Item=NaiveDate>+Clone {
     InGroup {
         it: NaiveDate::from_ymd(year, 1, 1)..,
@@ -357,10 +353,10 @@ fn test_dates_in_year() {
         let mut dates = dates_in_year(2013);
         assert_eq!(dates.next(), Some(NaiveDate::from_ymd(2013, 1, 1)));
 
-        // Check increment
+        // Check increment.
         assert_eq!(dates.next(), Some(NaiveDate::from_ymd(2013, 1, 2)));
 
-        // Check monthly rollover
+        // Check monthly roll-over.
         for _ in 3..31 {
             assert!(dates.next() != None);
         }
@@ -370,7 +366,7 @@ fn test_dates_in_year() {
     }
 
     {
-        // Check length of year
+        // Check length of year.
         let mut dates = dates_in_year(2013);
         for _ in 0..365 {
             assert!(dates.next() != None);
@@ -379,7 +375,7 @@ fn test_dates_in_year() {
     }
 
     {
-        // Check length of leap year
+        // Check length of leap year.
         let mut dates = dates_in_year(1984);
         for _ in 0..366 {
             assert!(dates.next() != None);
@@ -388,10 +384,8 @@ fn test_dates_in_year() {
     }
 }
 
-///
 /// Convenience trait for verifying that a given type iterates over
 /// `NaiveDate`s.
-///
 trait DateIterator: Iterator<Item=NaiveDate> + Clone {}
 impl<It> DateIterator for It where It: Iterator<Item=NaiveDate> + Clone {}
 
@@ -427,11 +421,9 @@ fn test_group_by() {
     }
 }
 
-///
 /// Groups an iterator of dates by month.
-///
 fn by_month(it: impl Iterator<Item=NaiveDate> + Clone)
-           ->  impl Iterator<Item=(u32, impl Iterator<Item=NaiveDate> + Clone)> + Clone
+            ->  impl Iterator<Item=(u32, impl Iterator<Item=NaiveDate> + Clone)> + Clone
 {
     it.group_by(|d| d.month())
 }
@@ -444,9 +436,7 @@ fn test_by_month() {
     assert!(months.next().is_none());
 }
 
-///
 /// Groups an iterator of dates by week.
-///
 fn by_week(it: impl DateIterator)
           -> impl Iterator<Item=(u32, impl DateIterator)> + Clone
 {
@@ -518,9 +508,7 @@ fn test_by_week() {
 /// The number of columns per week in the formatted output.
 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<Item = impl DateIterator>) -> impl Iterator<Item=String> {
     it.map(|week| {
         let mut buf = String::with_capacity((COLS_PER_DAY * COLS_PER_WEEK + 2) as usize);
@@ -541,7 +529,7 @@ fn format_weeks(it: impl Iterator<Item = impl DateIterator>) -> impl Iterator<It
         }
 
         // Insert more filler at the end to fill up the remainder of the week,
-        // if its a short week (e.g. at the end of the month).
+        // if its a short week (e.g., at the end of the month).
         buf.extend(spaces((COLS_PER_DAY * (6 - last_day)) as usize));
         buf
     })
@@ -567,9 +555,7 @@ fn test_format_weeks() {
     );
 }
 
-///
-/// Formats the name of a month, centered on COLS_PER_WEEK.
-///
+/// Formats the name of a month, centered on `COLS_PER_WEEK`.
 fn month_title(month: u32) -> String {
     const MONTH_NAMES: &'static [&'static str] = &[
         "January", "February", "March", "April", "May", "June",
@@ -584,7 +570,7 @@ fn month_title(month: u32) -> String {
     let before = (COLS_PER_WEEK as usize - name.len()) / 2;
     let after = COLS_PER_WEEK as usize - name.len() - before;
 
-    // NOTE: Being slightly more verbose to avoid extra allocations.
+    // Note: being slightly more verbose to avoid extra allocations.
     let mut result = String::with_capacity(COLS_PER_WEEK as usize);
     result.extend(spaces(before));
     result.push_str(name);
@@ -596,9 +582,7 @@ fn test_month_title() {
     assert_eq!(month_title(1).len(), COLS_PER_WEEK as usize);
 }
 
-///
 /// Formats a month.
-///
 fn format_month(it: impl DateIterator) -> impl Iterator<Item=String> {
     let mut month_days = it.peekable();
     let title = month_title(month_days.peek().unwrap().month());
@@ -627,22 +611,17 @@ fn test_format_month() {
     );
 }
 
-
-///
 /// Formats an iterator of months.
-///
 fn format_months(it: impl Iterator<Item = impl DateIterator>)
                 -> impl Iterator<Item=impl Iterator<Item=String>>
 {
     it.map(format_month)
 }
 
-///
 /// Takes an iterator of iterators of strings; the sub-iterators are consumed
 /// in lock-step, with their elements joined together.
-///
 trait PasteBlocks: Iterator + Sized
-where Self::Item: Iterator<Item=String> {
+where Self::Item: Iterator<Item = String> {
     fn paste_blocks(self, sep_width: usize) -> PasteBlocksIter<Self::Item> {
         PasteBlocksIter {
             iters: self.collect(),
@@ -721,9 +700,7 @@ fn test_paste_blocks() {
     );
 }
 
-///
 /// Produces an iterator that yields `n` elements at a time.
-///
 trait Chunks: Iterator + Sized {
     fn chunks(self, n: usize) -> ChunksIter<Self> {
         assert!(n > 0);
@@ -742,7 +719,7 @@ struct ChunksIter<It>
     n: usize,
 }
 
-// NOTE: `chunks` in Rust is more-or-less impossible without overhead of some kind.
+// Note: `chunks` in Rust is more-or-less impossible without overhead of some kind.
 // Aliasing rules mean you need to add dynamic borrow checking, and the design of
 // `Iterator` means that you need to have the iterator's state kept in an allocation
 // that is jointly owned by the iterator itself and the sub-iterator.
@@ -769,9 +746,7 @@ fn test_chunks() {
     assert_eq!(&*c, &[vec![1, 2, 3], vec![4, 5, 6], vec![7]]);
 }
 
-///
 /// Formats a year.
-///
 fn format_year(year: i32, months_per_row: usize) -> String {
     const COL_SPACING: usize = 1;
 
@@ -784,17 +759,17 @@ fn format_year(year: i32, months_per_row: usize) -> String {
         // Group the months into horizontal rows.
         .chunks(months_per_row)
 
-        // Format each row
+        // Format each row...
         .map(|r| r.into_iter()
-            // By formatting each month
+            // ... by formatting each month ...
             .__(format_months)
 
-            // Horizontally pasting each respective month's lines together.
+            // ... and horizontally pasting each respective month's lines together.
             .paste_blocks(COL_SPACING)
             .join("\n")
         )
 
-        // Insert a blank line between each row
+        // Insert a blank line between each row.
         .join("\n\n")
 }
 
index 133da00ffaa125ba5ac34b953a237f123182f279..59c3e395cf97bfd96c1bb369a372b92dfcba37e9 100644 (file)
@@ -9,6 +9,7 @@
 // except according to those terms.
 
 // run-pass
+
 #![deny(dead_code)]
 
 // use different types / traits to test all combinations
index 1d1bd21075bf468f27c744c7cac019d2ac6d8098..b9d2523cd79273c56104f0c138a6331941ad34ad 100644 (file)
@@ -23,7 +23,7 @@ trait UserDefined { }
 impl UserDefined for i32 { }
 impl<'a, T> UserDefined for &'a T { }
 
-// e.g. `impl_drop!(Send, D_Send)` expands to:
+// e.g., `impl_drop!(Send, D_Send)` expands to:
 //   ```rust
 //   struct D_Send<T:Send>(T);
 //   impl<T:Send> Drop for D_Send<T> { fn drop(&mut self) { } }
index 83445c6657e934c32a94b532148059187396165a..61ac665caf64f21a63767ec5c2d3a39f9ceb6f50 100644 (file)
@@ -10,7 +10,7 @@
 
 // run-pass
 
-// This test is bogus (i.e. should be compile-fail) during the period
+// This test is bogus (i.e., should be compile-fail) during the period
 // where #54986 is implemented and #54987 is *not* implemented. For
 // now: just ignore it under nll
 //
index dbad8556aeb2305b0f031ab05452189a7682c9f4..21e4568a520b378fb3b5e66704eb63b12ddc16e3 100644 (file)
@@ -10,7 +10,7 @@
 
 // run-pass
 
-// This test is bogus (i.e. should be compile-fail) during the period
+// This test is bogus (i.e., should be compile-fail) during the period
 // where #54986 is implemented and #54987 is *not* implemented. For
 // now: just ignore it under nll
 //
index 13d74be89d8ed167b63b3441957758834f001761..6ba1a7b8dfa9b07df6d4dd4d8152e619277975b3 100644 (file)
@@ -128,7 +128,7 @@ fn add_points(&mut self, shapes: &[Point]) {
 }
 
 // Here we provide an implementation of the Canvas methods for AsciiArt.
-// Other implementations could also be provided (e.g. for PDF or Apple's Quartz)
+// Other implementations could also be provided (e.g., for PDF or Apple's Quartz)
 // and code can use them polymorphically via the Canvas trait.
 impl Canvas for AsciiArt {
     fn add_point(&mut self, shape: Point) {
index db3c9792f3560fc532fabb9ac96db07908ea62ce..42cfb6f61760dad2b9babb3b5046b6a596ec8392 100644 (file)
@@ -12,7 +12,7 @@
 #![feature(test)]
 #![allow(unused_mut)] // under NLL we get warning about `x` below: rust-lang/rust#54499
 
-// This test is bogus (i.e. should be compile-fail) during the period
+// This test is bogus (i.e., should be compile-fail) during the period
 // where #54986 is implemented and #54987 is *not* implemented. For
 // now: just ignore it under nll
 //
index 88883821073d3b616f8574e32918964a7b445f52..94aaa631bc1c88c33ae1f355300d58e4f1bc2566 100644 (file)
@@ -18,7 +18,7 @@
 #[inline(never)]
 fn tuple_field() -> &'static u32 {
     // This test is MIR-borrowck-only because the old borrowck
-    // doesn't agree that borrows of "frozen" (i.e. without any
+    // doesn't agree that borrows of "frozen" (i.e., without any
     // interior mutability) fields of non-frozen temporaries,
     // should be promoted, while MIR promotion does promote them.
     &(FIVE, 42).1
index 05f1f1bfea0fb03318f47a1b52d566aa5479140c..77b6ba1e4f812f3e276474c65756ebf0bb259dd3 100644 (file)
@@ -12,7 +12,7 @@
 // option. This file may not be copied, modified, or distributed\r
 // except according to those terms.\r
 \r
-// NB: this file needs CRLF line endings. The .gitattributes file in\r
+// N.B., this file needs CRLF line endings. The .gitattributes file in\r
 // this directory should enforce it.\r
 \r
 // ignore-pretty issue #37195\r
index 14ef8c1f51f7d6a32426053d83ba63c9930ae452..71f39c1295711f34c4cadc66d1580a9e81a7a396 100644 (file)
@@ -15,7 +15,7 @@
 #![forbid(non_upper_case_globals)]
 #![feature(non_ascii_idents)]
 
-// Some scripts (e.g. hiragana) don't have a concept of
+// Some scripts (e.g., hiragana) don't have a concept of
 // upper/lowercase
 
 struct ヒ;
index 95774cad229a0d0ad19f903c53646814a3ee2715..b245fe1107bba839fc43b0ba8d4a0abc278bdd3f 100644 (file)
@@ -15,7 +15,7 @@
 //
 // This checks the behavior of macros with trailing commas in key
 // places where regressions in behavior seem highly possible (due
-// to it being e.g. a place where the addition of an argument
+// to it being e.g., a place where the addition of an argument
 // causes it to go down a code path with subtly different behavior).
 //
 // There is a companion test in compile-fail.
index e22e8c26fe5deb26e256f4e1fd13089c9de21262..98772778010be3cddc43647d61634815fb1c23b0 100644 (file)
@@ -34,12 +34,12 @@ fn main() {
 
     // In #46769, `Option<(Packed<&()>, bool)>` was found to have
     // pointer alignment, without actually being aligned in size.
-    // E.g. on 64-bit platforms, it had alignment `8` but size `9`.
+    // e.g., on 64-bit platforms, it had alignment `8` but size `9`.
     type PackedRefAndBool<'a> = (Packed<&'a ()>, bool);
     sanity_check_size::<Option<PackedRefAndBool>>(Some((Packed(&()), true)));
 
     // Make sure we don't pay for the enum optimization in size,
-    // e.g. we shouldn't need extra padding after the packed data.
+    // e.g., we shouldn't need extra padding after the packed data.
     assert_eq!(std::mem::align_of::<Option<PackedRefAndBool>>(), 1);
     assert_eq!(std::mem::size_of::<Option<PackedRefAndBool>>(),
                std::mem::size_of::<PackedRefAndBool>());
index 220614c9203e41d3469513286807fca317c2282d..70cb4bcbd6fcdbf53e97f2aaf88da034e48e78ed 100644 (file)
@@ -131,7 +131,7 @@ pub fn main() {
     // for details.
     assert_eq!(object_invoke2(&*m), 5);
 
-    // The RefMakerTrait above is pretty strange (i.e. it is strange
+    // The RefMakerTrait above is pretty strange (i.e., it is strange
     // 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.
index f0fb24b5832b5babc15cb5cf06221676f018631e..df5f72e378da09c3ea93c7844e82f6258ffcc69f 100644 (file)
@@ -94,9 +94,9 @@ macro_rules! test {
             // there are platform differences for some out of range
             // casts, so we just normalize such things: it's OK for
             // "invalid" calculations to result in nonsense answers.
-            // (E.g. negative float to unsigned integer goes through a
+            // (e.g., negative float to unsigned integer goes through a
             // library routine on the default i686 platforms, and the
-            // implementation of that routine differs on e.g. Linux
+            // implementation of that routine differs on e.g., Linux
             // vs. macOS, resulting in different answers.)
             if $from::is_float() {
                 if !$to::in_range(A) { from.0 = 0 as $to; to.0 = 0 as $to; }
index 045a8a503203253b153703256a7be8c6441858c1..2771ab4233f9618ce4f4336d9f59265ea8c616c7 100644 (file)
@@ -17,7 +17,7 @@
 //     Err(err) => return Err(From::from(err)),
 // }
 //
-// This test verifies that the expansion is hygienic, i.e. it's not affected by other `val` and
+// This test verifies that the expansion is hygienic, i.e., it's not affected by other `val` and
 // `err` bindings that may be in scope.
 
 use std::num::ParseIntError;
index a0256187dbba8e5f5eb03d49a7f505e2bbf8955d..c6a95ba4089bf883818bea14a5bcdc15dd467e4d 100644 (file)
@@ -41,7 +41,7 @@ mod std {
 mod bar {
     // Also test the unqualified external crate import in a nested module,
     // to show that the above import doesn't resolve through a local `std`
-    // item, e.g. the automatically injected `extern crate std;`, which in
+    // item, e.g., the automatically injected `extern crate std;`, which in
     // the Rust 2018 should no longer be visible through `crate::std`.
     pub use std::io;
 
index 373734345fc34d230334eae5c1a77f5f7c4594f6..f22113df80e894e847dc8276ded3bb46885cae9b 100644 (file)
@@ -50,7 +50,7 @@ mod std {
 mod bar {
     // Also test the unqualified external crate import in a nested module,
     // to show that the above import doesn't resolve through a local `std`
-    // item, e.g. the automatically injected `extern crate std;`, which in
+    // item, e.g., the automatically injected `extern crate std;`, which in
     // the Rust 2018 should no longer be visible through `crate::std`.
     pub use std::io;
 }
index a09c04ea0b2fda629206e30e1c5676416cdcf7aa..31f9683ca0f13154f8f82c7b5724f666e2c59189 100644 (file)
@@ -1,8 +1,10 @@
 error[E0599]: no associated item named `ID` found for type `i32` in the current scope
-  --> $DIR/associated-const-no-item.rs:16:16
+  --> $DIR/associated-const-no-item.rs:16:23
    |
 LL | const X: i32 = <i32>::ID;
-   |                ^^^^^^^^^ associated item not found in `i32`
+   |                -------^^
+   |                |
+   |                associated item not found in `i32`
    |
    = help: items from traits can only be used if the trait is implemented and in scope
    = note: the following trait defines an item `ID`, perhaps you need to implement it:
index f9917b07f070b172737b2059c6b28413bfbe5cd1..36ed28c345a0b36a26197baa6f2f6e911d6d9d40 100644 (file)
@@ -1,11 +1,11 @@
 error[E0599]: no variant named `hsl` found for type `color` in the current scope
-  --> $DIR/bogus-tag.rs:18:7
+  --> $DIR/bogus-tag.rs:18:14
    |
 LL | enum color { rgb(isize, isize, isize), rgba(isize, isize, isize, isize), }
    | ---------- variant `hsl` not found here
 ...
 LL |       color::hsl(h, s, l) => { println!("hsl"); }
-   |       ^^^^^^^^^^^^^^^^^^^ variant not found in `color`
+   |       -------^^^--------- variant not found in `color`
 
 error: aborting due to previous error
 
index 30752e8ddb1086018331e639f246697998710027..fd4c108b594708ca06f4cbe8def17a06d98a0ca5 100644 (file)
@@ -49,7 +49,7 @@ fn deref_coercion(x: &mut u32) {
 //
 // - [x] Resolving overloaded_call_traits (call, call_mut, call_once)
 // - [x] deref_coercion (shown above)
-// - [x] coerce_unsized e.g. `&[T; n]`, `&mut [T; n] -> &[T]`,
+// - [x] coerce_unsized e.g., `&[T; n]`, `&mut [T; n] -> &[T]`,
 //                      `&mut [T; n] -> &mut [T]`, `&Concrete -> &Trait`
 // - [x] Method Call Receivers (the case we want to support!)
 // - [x] ExprKind::Index and ExprKind::Unary Deref; only need to handle coerce_index_op
index 1f71969989bda702ee547bd55df24066ade58a69..718ab3dedc4ecd32103feaece3cec2f7c839acf2 100644 (file)
@@ -1,4 +1,4 @@
-error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g. `MyStruct<T>`)
+error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
   --> $DIR/coherence-all-remote.rs:16:1
    |
 LL | impl<T> Remote1<T> for isize { }
index 7d2796ee6905cc82c3d44a7114a1c09ed9d2a029..a5d9f5a403fe4dd7195543384b01a386db7c1cc5 100644 (file)
@@ -1,4 +1,4 @@
-error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g. `MyStruct<T>`)
+error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
   --> $DIR/coherence-bigint-param.rs:18:1
    |
 LL | impl<T> Remote1<BigInt> for T { }
index f05333348ec3aa444644490911bd6d2d0a25ecb4..368935f4cfb78f638eb526cc6214a08e7316ada9 100644 (file)
@@ -1,4 +1,4 @@
-error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g. `MyStruct<T>`)
+error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
   --> $DIR/coherence-cow.rs:26:1
    |
 LL | impl<T> Remote for Pair<T,Cover<T>> { } //[a]~ ERROR E0210
index 269bcd576af5a4ae205678eb93ae6507486fe055..74ad8502add0bb672421e5af716da860fdd01b52 100644 (file)
@@ -1,4 +1,4 @@
-error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g. `MyStruct<T>`)
+error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
   --> $DIR/coherence-cow.rs:29:1
    |
 LL | impl<T> Remote for Pair<Cover<T>,T> { } //[b]~ ERROR E0210
index e89308db054ffea41436abe95014b32ab7b17d8c..2e3a6b54e846bcd487e8da5aeb9e49fbe8c4764a 100644 (file)
@@ -1,4 +1,4 @@
-error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g. `MyStruct<T>`)
+error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
   --> $DIR/coherence-cow.rs:32:1
    |
 LL | impl<T,U> Remote for Pair<Cover<T>,U> { }
index ee11967cc0d3aa60b2fb1c27f92f3dd8a1e68286..31c41ab7234e1c4323cdeeba6ba785878d80a586 100644 (file)
@@ -7,7 +7,7 @@ LL | impl<A> Foo for A {
    = note: conflicting implementation in crate `trait_impl_conflict`:
            - impl trait_impl_conflict::Foo for isize;
 
-error[E0210]: type parameter `A` must be used as the type parameter for some local type (e.g. `MyStruct<A>`)
+error[E0210]: type parameter `A` must be used as the type parameter for some local type (e.g., `MyStruct<A>`)
   --> $DIR/coherence-cross-crate-conflict.rs:18:1
    |
 LL | impl<A> Foo for A {
index 6389bc0e7aba749919d5c06087412704783dec69..e3a7722963480a83e0f75179a7e4d03c5accd3cb 100644 (file)
@@ -1,4 +1,4 @@
-error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g. `MyStruct<T>`)
+error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
   --> $DIR/coherence-lone-type-parameter.rs:16:1
    |
 LL | impl<T> Remote for T { }
index 41d478885549f8e2725ccdccce6cb2627915e3aa..286ebefba1507a47e8717a357942a08fc4d0594c 100644 (file)
@@ -1,4 +1,4 @@
-error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g. `MyStruct<T>`)
+error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
   --> $DIR/coherence-overlapping-pairs.rs:18:1
    |
 LL | impl<T> Remote for lib::Pair<T,Foo> { }
index 3545593fb6d5c6aa20eedf674090c92db17829fb..80ab0cc09f96a3e46483d6e39afa0867a4854328 100644 (file)
@@ -1,4 +1,4 @@
-error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g. `MyStruct<T>`)
+error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
   --> $DIR/coherence-pair-covered-uncovered-1.rs:21:1
    |
 LL | impl<T, U> Remote1<Pair<T, Local<U>>> for i32 { }
index f58cb4648cbfcc1dd553ed7ada5a42ab7c48d738..25b4948e083197ec22f819f0abc31d55ce7db69e 100644 (file)
@@ -1,4 +1,4 @@
-error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g. `MyStruct<T>`)
+error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
   --> $DIR/coherence-pair-covered-uncovered.rs:18:1
    |
 LL | impl<T,U> Remote for Pair<T,Local<U>> { }
index 2980d4a3392c5d8de0a9555806bd9e0c4d8a3477..0ccd938e90027afa49da472b447f9a30ddb17bd0 100644 (file)
@@ -1,4 +1,4 @@
-error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g. `MyStruct<T>`)
+error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
   --> $DIR/coherence-vec-local-2.rs:21:1
    |
 LL | impl<T> Remote for Vec<Local<T>> { } //~ ERROR E0210
index 1fe50cfebbac364c2e75add17a3f9e36685007ae..a03599ada1c2e7ab1022f4599426a1635856c2c0 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 // All lifetime parameters in struct constructors are currently considered early bound,
-// i.e. `S::<ARGS>` is interpreted kinda like an associated item `S::<ARGS>::ctor`.
+// i.e., `S::<ARGS>` is interpreted kinda like an associated item `S::<ARGS>::ctor`.
 // This behavior is a bit weird, because if equivalent constructor were written manually
 // it would get late bound lifetime parameters.
 // Variant constructors behave in the same way, lifetime parameters are considered
index 8e094a7f7dcc77d1c21722d9585374f6c4652f6b..7819cafdb0f5ca087b4b90772b8e1f754ab26f09 100644 (file)
@@ -11,7 +11,7 @@
 #![allow(unused_imports)]
 
 // Note: the relevant lint pass here runs before some of the constant
-// evaluation below (e.g. that performed by codegen and llvm), so if you
+// evaluation below (e.g., that performed by codegen and llvm), so if you
 // change this warn to a deny, then the compiler will exit before
 // those errors are detected.
 
index c69d03071e756969702093b9de64abc7ad065dd0..475a5117685dff11681a80f0ba6bb913736909e0 100644 (file)
@@ -11,7 +11,7 @@
 #![allow(unused_imports)]
 
 // Note: the relevant lint pass here runs before some of the constant
-// evaluation below (e.g. that performed by codegen and llvm), so if you
+// evaluation below (e.g., that performed by codegen and llvm), so if you
 // change this warn to a deny, then the compiler will exit before
 // those errors are detected.
 
index f442661ec630b78dc02694b48c070f34623eecc5..039e6b251cdaabe6ad9bb593317c10a1f0b676eb 100644 (file)
@@ -11,7 +11,7 @@
 #![allow(unused_imports)]
 
 // Note: the relevant lint pass here runs before some of the constant
-// evaluation below (e.g. that performed by codegen and llvm), so if you
+// evaluation below (e.g., that performed by codegen and llvm), so if you
 // change this warn to a deny, then the compiler will exit before
 // those errors are detected.
 
index b3d7ba3e5c47a73e9ab9e6575f9a517e78fa71b9..85b63f5c4713e2d4630220bd82d135dbee5adbc5 100644 (file)
@@ -4,7 +4,7 @@ error: `foo` is not yet stable as a const fn
 LL | const fn bar() -> u32 { foo() } //~ ERROR `foo` is not yet stable as a const fn
    |                         ^^^^^
    |
-   = help: in Nightly builds, add `#![feature(foo)]` to the crate attributes to enable
+   = help: add `#![feature(foo)]` to the crate attributes to enable
 
 error[E0597]: borrowed value does not live long enough
   --> $DIR/dont_promote_unstable_const_fn.rs:28:28
index 278864d6de9ec292fe336a7f5a1c619c70f91578..2f08d124848787a4721b6fad7aac02e84d19b383 100644 (file)
@@ -22,5 +22,5 @@ fn main() {
     let a = 4; //~ ERROR refutable pattern in local binding: `0u8..=1u8` not covered
     let c = 4; //~ ERROR refutable pattern in local binding: `0u8..=1u8` not covered
     let d = 4; //~ ERROR refutable pattern in local binding: `0u8..=1u8` not covered
-    fn f() {} // Check that the `NOTE`s still work with an item here (c.f. issue #35115).
+    fn f() {} // Check that the `NOTE`s still work with an item here (cf. issue #35115).
 }
index d13ced9a10a0a17c874b015088e6547ebd2651d5..ba5f65988e288d326e99586c168dba87f283f2b6 100644 (file)
@@ -4,7 +4,7 @@ error: `std::any::TypeId::of` is not yet stable as a const fn
 LL |     const A_ID: TypeId = TypeId::of::<A>();
    |                          ^^^^^^^^^^^^^^^^^
    |
-   = help: in Nightly builds, add `#![feature(const_type_id)]` to the crate attributes to enable
+   = help: add `#![feature(const_type_id)]` to the crate attributes to enable
 
 error: aborting due to previous error
 
index 10ee175a97e16bd41eeb1f36a617fe25fe313755..a7b3846a8f634a4ab419afc0510980aba370ef64 100644 (file)
@@ -23,28 +23,36 @@ LL |         &(u8,)::AssocItem => {}
    |          ^^^^^^^^^^^^^^^^ help: try: `<(u8,)>::AssocItem`
 
 error[E0599]: no associated item named `AssocItem` found for type `[u8]` in the current scope
-  --> $DIR/bad-assoc-pat.rs:13:9
+  --> $DIR/bad-assoc-pat.rs:13:15
    |
 LL |         [u8]::AssocItem => {}
-   |         ^^^^^^^^^^^^^^^ associated item not found in `[u8]`
+   |         ------^^^^^^^^^
+   |         |
+   |         associated item not found in `[u8]`
 
 error[E0599]: no associated item named `AssocItem` found for type `(u8, u8)` in the current scope
-  --> $DIR/bad-assoc-pat.rs:16:9
+  --> $DIR/bad-assoc-pat.rs:16:19
    |
 LL |         (u8, u8)::AssocItem => {}
-   |         ^^^^^^^^^^^^^^^^^^^ associated item not found in `(u8, u8)`
+   |         ----------^^^^^^^^^
+   |         |
+   |         associated item not found in `(u8, u8)`
 
 error[E0599]: no associated item named `AssocItem` found for type `_` in the current scope
-  --> $DIR/bad-assoc-pat.rs:19:9
+  --> $DIR/bad-assoc-pat.rs:19:12
    |
 LL |         _::AssocItem => {}
-   |         ^^^^^^^^^^^^ associated item not found in `_`
+   |         ---^^^^^^^^^
+   |         |
+   |         associated item not found in `_`
 
 error[E0599]: no associated item named `AssocItem` found for type `(u8,)` in the current scope
-  --> $DIR/bad-assoc-pat.rs:24:10
+  --> $DIR/bad-assoc-pat.rs:24:17
    |
 LL |         &(u8,)::AssocItem => {}
-   |          ^^^^^^^^^^^^^^^^ associated item not found in `(u8,)`
+   |          -------^^^^^^^^^
+   |          |
+   |          associated item not found in `(u8,)`
 
 error: aborting due to 8 previous errors
 
index 81ecc546a6dee275a7f2b128d77b47777cd89fe8..c2f21606e2133752017a96095ff48dcc7ca6d65f 100644 (file)
@@ -1,11 +1,13 @@
 error[E0599]: no function or associated item named `new` found for type `T` in the current scope
-  --> $DIR/dont-suggest-private-trait-method.rs:14:5
+  --> $DIR/dont-suggest-private-trait-method.rs:14:8
    |
 LL | struct T;
    | --------- function or associated item `new` not found for this
 ...
 LL |     T::new();
-   |     ^^^^^^ function or associated item not found in `T`
+   |     ---^^^
+   |     |
+   |     function or associated item not found in `T`
 
 error: aborting due to previous error
 
index d7a671fd33c2c62713325081c71edbe326b16556..fb1c03b6786320628527de2ed8e0ea348808ca4b 100644 (file)
@@ -31,7 +31,7 @@
 // - D means "I implement Drop"
 //
 // - P means "I implement Drop but guarantee my (first) parameter is
-//     pure, i.e. not accessed from the destructor"; no other parameters
+//     pure, i.e., not accessed from the destructor"; no other parameters
 //     are pure.
 //
 // - S means "I do not implement Drop"
index 1fc4c28d67c5d915ffe56548120ead49b9d28702..d60f9c4e6a8f7ecf8f74a227e19a7d6c61b9e7a7 100644 (file)
@@ -8,7 +8,7 @@ LL | impl<R> External for (Q, R) {} //~ ERROR must be used
            - impl<'a, 'b, 'c, T, U, V, W> complex_impl_support::External for (T, complex_impl_support::M<'a, 'b, 'c, std::boxed::Box<U>, V, W>)
              where <U as std::ops::FnOnce<(T,)>>::Output == V, <V as std::iter::Iterator>::Item == T, 'b : 'a, T : 'a, U: std::ops::FnOnce<(T,)>, U : 'static, V: std::iter::Iterator, V: std::clone::Clone, W: std::ops::Add, <W as std::ops::Add>::Output: std::marker::Copy;
 
-error[E0210]: type parameter `R` must be used as the type parameter for some local type (e.g. `MyStruct<R>`)
+error[E0210]: type parameter `R` must be used as the type parameter for some local type (e.g., `MyStruct<R>`)
   --> $DIR/complex-impl.rs:19:1
    |
 LL | impl<R> External for (Q, R) {} //~ ERROR must be used
index 76ff88d6cc62346b52412741cd1026668d7b5627..b5ec1c8454b9eb6d1c880cf8fbe422f4a87e1a08 100644 (file)
@@ -8,7 +8,7 @@ LL | impl<Foo> Deref for Foo { } //~ ERROR must be used
            - impl<T> std::ops::Deref for &T
              where T: ?Sized;
 
-error[E0210]: type parameter `Foo` must be used as the type parameter for some local type (e.g. `MyStruct<Foo>`)
+error[E0210]: type parameter `Foo` must be used as the type parameter for some local type (e.g., `MyStruct<Foo>`)
   --> $DIR/issue-28981.rs:15:1
    |
 LL | impl<Foo> Deref for Foo { } //~ ERROR must be used
index 9b6114875e2e5df61e75ea80ab0cda0e8bef9873..3252d0db4dca24092b98ab5e2335463ca1bff1be 100644 (file)
@@ -47,20 +47,24 @@ LL |     let xe1 = XEmpty1(); //~ ERROR expected function, found struct `XEmpty1
    |               did you mean `XEmpty1 { /* fields */ }`?
 
 error[E0599]: no variant named `Empty3` found for type `empty_struct::XE` in the current scope
-  --> $DIR/empty-struct-braces-expr.rs:32:15
+  --> $DIR/empty-struct-braces-expr.rs:32:19
    |
 LL |     let xe3 = XE::Empty3; //~ ERROR no variant named `Empty3` found for type
-   |               ^^^^^^^^^^ variant not found in `empty_struct::XE`
+   |               ----^^^^^^
+   |               |
+   |               variant not found in `empty_struct::XE`
    |
-   = note: did you mean `empty_struct::XE::XEmpty3`?
+   = help: did you mean `XEmpty3`?
 
 error[E0599]: no variant named `Empty3` found for type `empty_struct::XE` in the current scope
-  --> $DIR/empty-struct-braces-expr.rs:33:15
+  --> $DIR/empty-struct-braces-expr.rs:33:19
    |
 LL |     let xe3 = XE::Empty3(); //~ ERROR no variant named `Empty3` found for type
-   |               ^^^^^^^^^^ variant not found in `empty_struct::XE`
+   |               ----^^^^^^
+   |               |
+   |               variant not found in `empty_struct::XE`
    |
-   = note: did you mean `empty_struct::XE::XEmpty3`?
+   = help: did you mean `XEmpty3`?
 
 error: aborting due to 8 previous errors
 
index d118939d17a15e62a5b745ac193637cfca6b811d..f6bdc8b8579dca73dbdf2afe1e585fb2c2d08111 100644 (file)
@@ -1,11 +1,11 @@
 error[E0599]: no associated item named `NotEvenReal` found for type `Foo` in the current scope
-  --> $DIR/E0599.rs:14:15
+  --> $DIR/E0599.rs:14:20
    |
 LL | struct Foo;
    | ----------- associated item `NotEvenReal` not found for this
 ...
 LL |     || if let Foo::NotEvenReal() = Foo {}; //~ ERROR E0599
-   |               ^^^^^^^^^^^^^^^^^^ associated item not found in `Foo`
+   |               -----^^^^^^^^^^^-- associated item not found in `Foo`
 
 error: aborting due to previous error
 
index 1eb756fe9e4ec2bd258f9725c2e440bbc90e7b7d..d241ab6297624e955afa5d3db22f9d2d529434d4 100644 (file)
@@ -23,7 +23,7 @@ mod m2 {
     }
 
     mod m3 {
-        pub(super) use super::f; // Check that this is counted as used (c.f. #36249).
+        pub(super) use super::f; // Check that this is counted as used (cf. issue #36249).
     }
 
     pub mod m4 {
index 9214800b93a59607218b46cfb3bb79ffdf74e85f..47fb717d0ca8a69dd0e032d355ba3a834962dce5 100644 (file)
@@ -1,8 +1,10 @@
 error[E0599]: no associated item named `DOESNOTEXIST` found for type `u32` in the current scope
-  --> $DIR/invalid-path-in-const.rs:12:18
+  --> $DIR/invalid-path-in-const.rs:12:23
    |
 LL |     fn f(a: [u8; u32::DOESNOTEXIST]) {}
-   |                  ^^^^^^^^^^^^^^^^^ associated item not found in `u32`
+   |                  -----^^^^^^^^^^^^
+   |                  |
+   |                  associated item not found in `u32`
 
 error: aborting due to previous error
 
index bb4dbdcd0cba7793b892ab29c586720df444f3e1..0330ac658d8687b5d77045a6891773d5cd39127e 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 fn main() {
-    // NB: this (almost) typechecks when default binding modes are enabled.
+    // N.B., this (almost) typechecks when default binding modes are enabled.
     for (ref i,) in [].iter() {
         i.clone();
         //~^ ERROR type annotations needed
index 435a89b716f96e4cad44701b91e578ea0551659b..97445b609658d37ff6acf828bdf6fc1723d1a279 100644 (file)
@@ -1,11 +1,13 @@
 error[E0599]: no variant named `PIE` found for type `Delicious` in the current scope
-  --> $DIR/issue-22933-2.rs:14:44
+  --> $DIR/issue-22933-2.rs:14:55
    |
 LL | enum Delicious {
    | -------------- variant `PIE` not found here
 ...
 LL |     ApplePie = Delicious::Apple as isize | Delicious::PIE as isize,
-   |                                            ^^^^^^^^^^^^^^ variant not found in `Delicious`
+   |                                            -----------^^^
+   |                                            |
+   |                                            variant not found in `Delicious`
 
 error: aborting due to previous error
 
index 3d4d2df4d322aea3a53f319eec69fa002100e8cb..d3ea39b2adbbbe4a59d834de145bfdf36a385943 100644 (file)
@@ -1,8 +1,10 @@
 error[E0599]: no associated item named `MIN` found for type `u8` in the current scope
-  --> $DIR/issue-22933-3.rs:11:18
+  --> $DIR/issue-22933-3.rs:11:22
    |
 LL | const FOO: [u32; u8::MIN as usize] = [];
-   |                  ^^^^^^^ associated item not found in `u8`
+   |                  ----^^^
+   |                  |
+   |                  associated item not found in `u8`
 
 error: aborting due to previous error
 
index d58a4d2b8f8a9b4791f4b3fa9f7f8644e71a6b80..14a1188710f4bb6db5d2caac39c5ab8d7b9b9fe4 100644 (file)
@@ -1,38 +1,46 @@
 error[E0599]: no variant named `Homura` found for type `Token` in the current scope
-  --> $DIR/issue-23173.rs:19:16
+  --> $DIR/issue-23173.rs:19:23
    |
 LL | enum Token { LeftParen, RightParen, Plus, Minus, /* etc */ }
    | ---------- variant `Homura` not found here
 ...
 LL |     use_token(&Token::Homura);
-   |                ^^^^^^^^^^^^^ variant not found in `Token`
+   |                -------^^^^^^
+   |                |
+   |                variant not found in `Token`
 
 error[E0599]: no function or associated item named `method` found for type `Struct` in the current scope
-  --> $DIR/issue-23173.rs:21:5
+  --> $DIR/issue-23173.rs:21:13
    |
 LL | struct Struct {
    | ------------- function or associated item `method` not found for this
 ...
 LL |     Struct::method();
-   |     ^^^^^^^^^^^^^^ function or associated item not found in `Struct`
+   |     --------^^^^^^
+   |     |
+   |     function or associated item not found in `Struct`
 
 error[E0599]: no function or associated item named `method` found for type `Struct` in the current scope
-  --> $DIR/issue-23173.rs:23:5
+  --> $DIR/issue-23173.rs:23:13
    |
 LL | struct Struct {
    | ------------- function or associated item `method` not found for this
 ...
 LL |     Struct::method;
-   |     ^^^^^^^^^^^^^^ function or associated item not found in `Struct`
+   |     --------^^^^^^
+   |     |
+   |     function or associated item not found in `Struct`
 
 error[E0599]: no associated item named `Assoc` found for type `Struct` in the current scope
-  --> $DIR/issue-23173.rs:25:5
+  --> $DIR/issue-23173.rs:25:13
    |
 LL | struct Struct {
    | ------------- associated item `Assoc` not found for this
 ...
 LL |     Struct::Assoc;
-   |     ^^^^^^^^^^^^^ associated item not found in `Struct`
+   |     --------^^^^^
+   |     |
+   |     associated item not found in `Struct`
 
 error: aborting due to 4 previous errors
 
index d87f239bca6906e865613569637a5ece0d89c80c..1ba8f276cc9cea807bc5b4101aebb5346b235ba5 100644 (file)
@@ -1,12 +1,14 @@
 error[E0599]: no variant named `A` found for type `SomeEnum` in the current scope
-  --> $DIR/issue-23217.rs:12:9
+  --> $DIR/issue-23217.rs:12:19
    |
 LL | pub enum SomeEnum {
    | ----------------- variant `A` not found here
 LL |     B = SomeEnum::A,
-   |         ^^^^^^^^^^^ variant not found in `SomeEnum`
+   |         ----------^
+   |         |
+   |         variant not found in `SomeEnum`
    |
-   = note: did you mean `SomeEnum::B`?
+   = help: did you mean `B`?
 
 error: aborting due to previous error
 
index 026594811e4791e71be596a4afd3a0be5ef3d306..dea7acd9bf85b4e6fdca08788c533874d203f312 100644 (file)
@@ -10,7 +10,7 @@ error[E0608]: cannot index into a value of type `({integer}, {integer}, {integer
 LL |     let _ = tup[i];
    |             ^^^^^^
    |
-   = help: to access tuple elements, use tuple indexing syntax (e.g. `tuple.0`)
+   = help: to access tuple elements, use tuple indexing syntax (e.g., `tuple.0`)
 
 error: aborting due to 2 previous errors
 
index 734c761d0b7bc1d75f3a07ca87b004db54a1e822..bd4f4b88d32ba8b833b1e48beaed2c7f50c099a7 100644 (file)
@@ -5,10 +5,12 @@ LL |     let x: u8 = BitXor::bitor(0 as u8, 0 as u8);
    |                 ^^^^^^^^^^^^^ associated type `Output` must be specified
 
 error[E0599]: no function or associated item named `bitor` found for type `dyn std::ops::BitXor<_>` in the current scope
-  --> $DIR/issue-28344.rs:14:17
+  --> $DIR/issue-28344.rs:14:25
    |
 LL |     let x: u8 = BitXor::bitor(0 as u8, 0 as u8);
-   |                 ^^^^^^^^^^^^^ function or associated item not found in `dyn std::ops::BitXor<_>`
+   |                 --------^^^^^
+   |                 |
+   |                 function or associated item not found in `dyn std::ops::BitXor<_>`
    |
    = help: did you mean `bitxor`?
 
@@ -19,10 +21,12 @@ LL |     let g = BitXor::bitor;
    |             ^^^^^^^^^^^^^ associated type `Output` must be specified
 
 error[E0599]: no function or associated item named `bitor` found for type `dyn std::ops::BitXor<_>` in the current scope
-  --> $DIR/issue-28344.rs:18:13
+  --> $DIR/issue-28344.rs:18:21
    |
 LL |     let g = BitXor::bitor;
-   |             ^^^^^^^^^^^^^ function or associated item not found in `dyn std::ops::BitXor<_>`
+   |             --------^^^^^
+   |             |
+   |             function or associated item not found in `dyn std::ops::BitXor<_>`
    |
    = help: did you mean `bitxor`?
 
index 9820d64909edd9b4da27508484cc2b3e08a3d572..e48e642301ed6f40d23604b73e4710a6e0986c7b 100644 (file)
@@ -1,8 +1,10 @@
 error[E0599]: no associated item named `BYTES` found for type `usize` in the current scope
-  --> $DIR/issue-28586.rs:14:19
+  --> $DIR/issue-28586.rs:14:26
    |
 LL | impl Foo for [u8; usize::BYTES] {}
-   |                   ^^^^^^^^^^^^ associated item not found in `usize`
+   |                   -------^^^^^
+   |                   |
+   |                   associated item not found in `usize`
 
 error: aborting due to previous error
 
index c04e21f7c58572d7e6e63bd10dfc3ed01317e62b..77aac975768be00da8151470b16aeb44766195e2 100644 (file)
@@ -1,13 +1,13 @@
 error[E0599]: no variant named `Baz` found for type `Foo` in the current scope
-  --> $DIR/issue-28971.rs:19:13
+  --> $DIR/issue-28971.rs:19:18
    |
 LL | enum Foo {
    | -------- variant `Baz` not found here
 ...
 LL |             Foo::Baz(..) => (),
-   |             ^^^^^^^^^^^^ variant not found in `Foo`
+   |             -----^^^---- variant not found in `Foo`
    |
-   = note: did you mean `Foo::Bar`?
+   = help: did you mean `Bar`?
 
 error: aborting due to previous error
 
index 094c962de29ecf726086238943cbb2ba6088ca67..a08c1d678d8c775c97f4f70d70a664d41fe16fd1 100644 (file)
@@ -1,8 +1,10 @@
 error[E0599]: no function or associated item named `new_undirected` found for type `issue_30123_aux::Graph<i32, i32>` in the current scope
-  --> $DIR/issue-30123.rs:17:14
+  --> $DIR/issue-30123.rs:17:33
    |
 LL |     let ug = Graph::<i32, i32>::new_undirected();
-   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function or associated item not found in `issue_30123_aux::Graph<i32, i32>`
+   |              -------------------^^^^^^^^^^^^^^
+   |              |
+   |              function or associated item not found in `issue_30123_aux::Graph<i32, i32>`
 
 error: aborting due to previous error
 
index 8a47ebbd0a899267b16b68dcb5f6f39915b38c16..c15840090ea40840dae3c86b9a5cd944079f82bc 100644 (file)
@@ -11,7 +11,7 @@
 // compile-pass
 // Tests for an LLVM abort when storing a lifetime-parametric fn into
 // context that is expecting one that is not lifetime-parametric
-// (i.e. has no `for <'_>`).
+// (i.e., has no `for <'_>`).
 
 pub struct A<'a>(&'a ());
 pub struct S<T>(T);
index b80367d7c6cff1006f45b4d3d2866a345aa603d0..398a38877d27e95f7f892cda6605f8cd89ca8090 100644 (file)
@@ -1,8 +1,10 @@
 error[E0599]: no associated item named `Item` found for type `T` in the current scope
-  --> $DIR/issue-38919.rs:12:5
+  --> $DIR/issue-38919.rs:12:8
    |
 LL |     T::Item; //~ ERROR no associated item named `Item` found for type `T` in the current scope
-   |     ^^^^^^^ associated item not found in `T`
+   |     ---^^^^
+   |     |
+   |     associated item not found in `T`
 
 error: aborting due to previous error
 
index 2ce6dfdbe44cdcc2d7adc0d172bf4b6d666839dc..83af9d82e0bee741ee2212145584f1918f3cc3e2 100644 (file)
@@ -1,8 +1,10 @@
 error[E0599]: no function or associated item named `dim` found for type `D` in the current scope
-  --> $DIR/issue-39559.rs:24:18
+  --> $DIR/issue-39559.rs:24:21
    |
 LL |     entries: [T; D::dim()],
-   |                  ^^^^^^ function or associated item not found in `D`
+   |                  ---^^^
+   |                  |
+   |                  function or associated item not found in `D`
    |
    = help: items from traits can only be used if the trait is implemented and in scope
    = note: the following trait defines an item `dim`, perhaps you need to implement it:
index 9be07614ec176099dc8edb55777b75343f24d80c..1389dcd2a039bdbe7d4f1481246784d5c1829fd9 100644 (file)
@@ -8,13 +8,15 @@ LL | |     }
    | |_____^ not a member of trait `ToString_`
 
 error[E0599]: no function or associated item named `new` found for type `Point` in the current scope
-  --> $DIR/issue-3973.rs:32:13
+  --> $DIR/issue-3973.rs:32:20
    |
 LL | struct Point {
    | ------------ function or associated item `new` not found for this
 ...
 LL |     let p = Point::new(0.0, 0.0);
-   |             ^^^^^^^^^^ function or associated item not found in `Point`
+   |             -------^^^
+   |             |
+   |             function or associated item not found in `Point`
 
 error: aborting due to 2 previous errors
 
index dbde40fb25e06335bb969d15e9b553e4e25b92c0..660f0ff70737354da1f80de75061a34cf42fec0e 100644 (file)
@@ -4,7 +4,7 @@ error[E0608]: cannot index into a value of type `()`
 LL |     ()[f(&[1.0])];
    |     ^^^^^^^^^^^^^
    |
-   = help: to access tuple elements, use tuple indexing syntax (e.g. `tuple.0`)
+   = help: to access tuple elements, use tuple indexing syntax (e.g., `tuple.0`)
 
 error: aborting due to previous error
 
index eca40ed43557d276cbb5ab96f571cd8bb9c95719..d6d4f7b55151f62ca614ebefc7a0f2d0aee68bc2 100644 (file)
@@ -15,7 +15,7 @@ error[E0120]: the Drop trait may only be implemented on structures
 LL | impl<T> Drop for T where T: A { //~ ERROR E0119
    |                  ^ implementing Drop requires a struct
 
-error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g. `MyStruct<T>`)
+error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
   --> $DIR/issue-41974.rs:17:1
    |
 LL | impl<T> Drop for T where T: A { //~ ERROR E0119
index cf1c3022a227398f46ec73d1b14e044b911da147..1087e5a014e9dbc5fc7bd15cfb21d2f454371022 100644 (file)
@@ -1,8 +1,8 @@
 error[E0599]: no associated item named `String` found for type `std::string::String` in the current scope
-  --> $DIR/issue-42880.rs:14:15
+  --> $DIR/issue-42880.rs:14:22
    |
 LL |     let f = |&Value::String(_)| (); //~ ERROR no associated item named
-   |               ^^^^^^^^^^^^^^^^ associated item not found in `std::string::String`
+   |               -------^^^^^^--- associated item not found in `std::string::String`
 
 error: aborting due to previous error
 
index 988bfd480e6add84fde91a482dd2aafb86cebee9..7c3f7695549f0e43e5947e5fbbbe85a0adeb3302 100644 (file)
@@ -10,7 +10,7 @@ error: `core::slice::<impl [T]>::len` is not yet stable as a const fn
 LL | static B: [u32; 1] = [0; A.len()];
    |                          ^^^^^^^
    |
-   = help: in Nightly builds, add `#![feature(const_slice_len)]` to the crate attributes to enable
+   = help: add `#![feature(const_slice_len)]` to the crate attributes to enable
 
 error: aborting due to 2 previous errors
 
index 750127981b1cc84bcdba4596a00e62bb6f61a788..bd0b9454c7f443e008168add1224037842c7b50d 100644 (file)
@@ -1,11 +1,13 @@
 error[E0599]: no function or associated item named `bar` found for type `Foo` in the current scope
-  --> $DIR/issue-7950.rs:16:5
+  --> $DIR/issue-7950.rs:16:10
    |
 LL | struct Foo;
    | ----------- function or associated item `bar` not found for this
 ...
 LL |     Foo::bar();
-   |     ^^^^^^^^ function or associated item not found in `Foo`
+   |     -----^^^
+   |     |
+   |     function or associated item not found in `Foo`
 
 error: aborting due to previous error
 
index 3a6ae52c68dc6860adc72f9fab3a9e2a0e10d3d0..666666c2100a488fd84df5d31b0e0feaaf3b5816 100644 (file)
@@ -9,10 +9,12 @@ LL | use T;
    |
 
 error[E0599]: no function or associated item named `f` found for type `Foo` in the current scope
-  --> $DIR/lexical-scopes.rs:20:5
+  --> $DIR/lexical-scopes.rs:20:10
    |
 LL |     Foo::f(); //~ ERROR no function or associated item named `f`
-   |     ^^^^^^ function or associated item not found in `Foo`
+   |     -----^
+   |     |
+   |     function or associated item not found in `Foo`
 
 error: aborting due to 2 previous errors
 
index 5bb2ab75c53fd42a8fadd9b43920b94e87e0d216..64a48511bac684e006a80ed1b13b5be9011693ad 100644 (file)
@@ -81,7 +81,7 @@ fn f() {
     }
 }
 
-// c.f. issue #35135
+// cf. issue #35135.
 #[allow(unused_variables)]
 fn h() {
     use test2::foo; //~ ERROR unused import: `test2::foo`
index c1c724fc431c7c30e497b3daf456b9731bdf97cf..22a9da8d9a678c1bb6caa2d85f0313faeed9dd06 100644 (file)
@@ -26,7 +26,7 @@ pub enum E {
     pub struct Item;
 }
 
-// Use something emitting the type argument name, e.g. unsatisfied bound.
+// Use something emitting the type argument name, e.g., unsatisfied bound.
 trait Impossible {}
 fn check<T: Impossible>(_: T) {}
 
index 186ecc54827208e0634c7edbbd6c3b02efa784de..633cbdba2d40ee62ebf12feed8e4ab981600b554 100644 (file)
@@ -61,7 +61,7 @@ impl<F> R<F> { fn new(f: F) -> Self { R { w: 0, f } } }
 // As a shorthand for the cases above, adding a numeric summary to
 // each test's fn name to denote each point on each axis.
 //
-// E.g. 1000 = field fully init struct; 0211 = local void reinit tuple
+// e.g., 1000 = field fully init struct; 0211 = local void reinit tuple
 
 // It got pretty monotonous writing the same code over and over, and I
 // feared I would forget details. So I abstracted some desiderata into
index c64839ad0deb1882023c38cec783d7e0abd2200c..0250cf529eeac3d96fffb3a6fd7cc481c8e57cdc 100644 (file)
@@ -10,7 +10,7 @@
 
 // Test that things from the prelude aren't in scope. Use many of them
 // so that renaming some things won't magically make this test fail
-// for the wrong reason (e.g. if `Add` changes to `Addition`, and
+// for the wrong reason (e.g., if `Add` changes to `Addition`, and
 // `no_implicit_prelude` stops working, then the `impl Add` will still
 // fail with the same error message).
 
index 0e39d9ebdc12b7abbc1fdbd0e21526b230f68c53..8a4a0aef0699db59a88e1a53345c260292b095de 100644 (file)
@@ -12,7 +12,7 @@
 
 // Test that things from the prelude aren't in scope. Use many of them
 // so that renaming some things won't magically make this test fail
-// for the wrong reason (e.g. if `Add` changes to `Addition`, and
+// for the wrong reason (e.g., if `Add` changes to `Addition`, and
 // `no_implicit_prelude` stops working, then the `impl Add` will still
 // fail with the same error message).
 
index dc134dd8d6f54354a49f39c146d5f59317d4ad25..22422f154041e9eaac1e0fc82a42c99456b83519 100644 (file)
@@ -1,4 +1,4 @@
-error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g. `MyStruct<T>`)
+error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
   --> $DIR/orphan-check-diagnostics.rs:20:1
    |
 LL | impl<T> RemoteTrait for T where T: LocalTrait {}
index 63408b76b153e3095843dfaa176939fd981565dd..866d7423f1483df6c85848c65a9252f60f50f1cc 100644 (file)
@@ -15,7 +15,7 @@ fn that_odd_parse() {
     x = if c { a } else { b }();
     x = if true { 1 } else { 0 } as *mut _;
     // however this does not parse and probably should fail to retain compat?
-    // NB: `..` here is arbitrary, failure happens/should happen ∀ops that aren’t `=`
+    // N.B., `..` here is arbitrary, failure happens/should happen ∀ops that aren’t `=`
     // see assoc-oddities-2 and assoc-oddities-3
     ..if c { a } else { b }[n]; //~ ERROR expected one of
 }
index fa5921cfb13439cc032ff25c4d8eb773672982af..5b6918d41b51f17da3a82c07139b214235574447 100644 (file)
@@ -30,7 +30,7 @@
 //     Copy.
 //
 //     (I suspect this reflect some naivety within the rust compiler
-//      itself; it should be checking for drop glue, i.e. a destructor
+//      itself; it should be checking for drop glue, i.e., a destructor
 //      somewhere in the monomorphized types. It should not matter whether
 //      the type is Copy.)
 #[derive(Copy, Clone)]
index 9cb61c24922eed25c1404f9274b77aab1bf98734..250800262dbb871ef6d3334a7595dcc011cdd673 100644 (file)
 
 // Test that free regions ordering only goes one way. That is,
 // we have `&'a Node<'b, T>`, which implies that `'a <= 'b`,
-// but not `'b <= 'a`. Hence returning `&self.val` (which has lifetime
+// but not `'b <= 'a`. Hence, returning `&self.val` (which has lifetime
 // `'a`) where `'b` is expected yields an error.
 //
 // This test began its life as a test for issue #4325.
 
-struct Node<'b, T:'b> {
-  val: T,
-  next: Option<&'b Node<'b, T>>
+struct Node<'b, T: 'b> {
+    val: T,
+    next: Option<&'b Node<'b, T>>
 }
 
 impl<'b, T> Node<'b, T> {
-  fn get<'a>(&'a self) -> &'b T {
-    match self.next {
-      Some(ref next) => next.get(),
-      None => &self.val //~ ERROR cannot infer
+    fn get<'a>(&'a self) -> &'b T {
+        match self.next {
+            Some(ref next) => next.get(),
+            None => &self.val //~ ERROR cannot infer
+        }
     }
-  }
 }
 
 fn main() {}
index 3dce04e2452add6fd24f8580f98f5cb4b855d77c..6b28ab4004f7e44c8250f3cf4d145101ce2cd538 100644 (file)
@@ -1,32 +1,32 @@
 error[E0495]: cannot infer an appropriate lifetime for borrow expression due to conflicting requirements
-  --> $DIR/regions-free-region-ordering-incorrect.rs:27:15
+  --> $DIR/regions-free-region-ordering-incorrect.rs:27:21
    |
-LL |       None => &self.val //~ ERROR cannot infer
-   |               ^^^^^^^^^
+LL |             None => &self.val //~ ERROR cannot infer
+   |                     ^^^^^^^^^
    |
-note: first, the lifetime cannot outlive the lifetime 'a as defined on the method body at 24:10...
-  --> $DIR/regions-free-region-ordering-incorrect.rs:24:10
+note: first, the lifetime cannot outlive the lifetime 'a as defined on the method body at 24:12...
+  --> $DIR/regions-free-region-ordering-incorrect.rs:24:12
    |
-LL |   fn get<'a>(&'a self) -> &'b T {
-   |          ^^
+LL |     fn get<'a>(&'a self) -> &'b T {
+   |            ^^
 note: ...so that reference does not outlive borrowed content
-  --> $DIR/regions-free-region-ordering-incorrect.rs:27:15
+  --> $DIR/regions-free-region-ordering-incorrect.rs:27:21
    |
-LL |       None => &self.val //~ ERROR cannot infer
-   |               ^^^^^^^^^
+LL |             None => &self.val //~ ERROR cannot infer
+   |                     ^^^^^^^^^
 note: but, the lifetime must be valid for the lifetime 'b as defined on the impl at 23:6...
   --> $DIR/regions-free-region-ordering-incorrect.rs:23:6
    |
 LL | impl<'b, T> Node<'b, T> {
    |      ^^
 note: ...so that reference does not outlive borrowed content
-  --> $DIR/regions-free-region-ordering-incorrect.rs:25:5
+  --> $DIR/regions-free-region-ordering-incorrect.rs:25:9
    |
-LL | /     match self.next {
-LL | |       Some(ref next) => next.get(),
-LL | |       None => &self.val //~ ERROR cannot infer
-LL | |     }
-   | |_____^
+LL | /         match self.next {
+LL | |             Some(ref next) => next.get(),
+LL | |             None => &self.val //~ ERROR cannot infer
+LL | |         }
+   | |_________^
 
 error: aborting due to previous error
 
index e9b50dddd30d14573440618083b9dc39fc6259a8..3ed41c6999f139a3be75edd3246d1260eb75a27c 100644 (file)
@@ -14,6 +14,6 @@ impl K for isize {} //~ ERROR expected trait, found type alias `K`
 
 use ImportError; //~ ERROR unresolved import `ImportError` [E0432]
                  //~^ no `ImportError` in the root
-impl ImportError for () {} // check that this is not an additional error (c.f. #35142)
+impl ImportError for () {} // check that this is not an additional error (cf. issue #35142)
 
 fn main() {}
index e3a613f926110e6280101e8300741b6e020370b2..b5cc7d4aefaab307a7dcf3ec627bfafd3e44561a 100644 (file)
@@ -1,8 +1,10 @@
 error[E0599]: no associated item named `XXX` found for type `u32` in the current scope
-  --> $DIR/no-double-error.rs:18:9
+  --> $DIR/no-double-error.rs:18:14
    |
 LL |         u32::XXX => { } //~ ERROR no associated item named
-   |         ^^^^^^^^ associated item not found in `u32`
+   |         -----^^^
+   |         |
+   |         associated item not found in `u32`
 
 error: aborting due to previous error
 
index 499a322593c60353a1a10f4f0d30560dbfca3470..004c4a002317bfae6fb6395ca7efb9b937a5c12b 100644 (file)
@@ -11,7 +11,7 @@
 // edition:2018
 
 // Tests that `meta` is whitelisted, even if the crate doesn't exist
-// yet (i.e. it causes a different error than `not-whitelisted.rs`).
+// yet (i.e., it causes a different error than `not-whitelisted.rs`).
 use meta; //~ ERROR can't find crate for `meta`
 
 fn main() {}
index d5d996e27eeb4b03b5d6b8d65a2a278aabc00abd..72a0fc694c06e453cfc4955c7c99f203d6bcf3eb 100644 (file)
@@ -27,10 +27,12 @@ LL |     x.baz(); //~ ERROR no method named `baz`
    |       ^^^
 
 error[E0599]: no function or associated item named `from_str` found for type `u32` in the current scope
-  --> $DIR/trait-import-suggestions.rs:40:13
+  --> $DIR/trait-import-suggestions.rs:40:18
    |
 LL |     let y = u32::from_str("33"); //~ ERROR no function or associated item named `from_str`
-   |             ^^^^^^^^^^^^^ function or associated item not found in `u32`
+   |             -----^^^^^^^^
+   |             |
+   |             function or associated item not found in `u32`
    |
    = help: items from traits can only be used if the trait is in scope
 help: the following trait is implemented but not in scope, perhaps add a `use` for it:
index 0d0bf240f720a2f117367c394485974b4fd4ce26..5e009ea4431b71ef41687c0d711397d1a7544f5f 100644 (file)
@@ -16,7 +16,7 @@
 struct B(i16, i16, i16, i16, i16, i16, i16, i16);
 
 // each intrinsic definition has to use the same nominal type for any
-// vector structure throughout that declaration (i.e. every instance
+// vector structure throughout that declaration (i.e., every instance
 // of i16x8 in each `fn ...;` needs to be either A or B)
 
 extern "platform-intrinsic" {
index 75523386931c091f79609917a38973b2ab23f1d9..b9e4ffa84cdea1d6b21b61b0f3fa3d2b333e0386 100644 (file)
@@ -25,7 +25,7 @@ impl<'a,T> HasSelfMethod for &'a T { }
 impl<'a,T> HasMethodWithSelfArg for &'a T { }
 impl<'a,T> HasType for &'a T { type Something = (); }
 
-// e.g. `impl_drop!(Send, D_Send)` expands to:
+// e.g., `impl_drop!(Send, D_Send)` expands to:
 //   ```rust
 //   struct D_Send<T:Send>(T);
 //   impl<T:Send> Drop for D_Send<T> { fn drop(&mut self) { } }
index 4ede83d5d73627e3a68e20777e9ce401abc7c153..01719bc4047d171520b89e8c5968508c83ab5baa 100644 (file)
@@ -33,26 +33,30 @@ LL |     c.a(); //~ ERROR method `a` is private
    |       ^
 
 error[E0599]: no function or associated item named `a` found for type `S` in the current scope
-  --> $DIR/trait-item-privacy.rs:88:5
+  --> $DIR/trait-item-privacy.rs:88:8
    |
 LL | struct S;
    | --------- function or associated item `a` not found for this
 ...
 LL |     S::a(&S);
-   |     ^^^^ function or associated item not found in `S`
+   |     ---^
+   |     |
+   |     function or associated item not found in `S`
    |
    = help: items from traits can only be used if the trait is implemented and in scope
    = note: the following trait defines an item `a`, perhaps you need to implement it:
            candidate #1: `method::A`
 
 error[E0599]: no function or associated item named `b` found for type `S` in the current scope
-  --> $DIR/trait-item-privacy.rs:90:5
+  --> $DIR/trait-item-privacy.rs:90:8
    |
 LL | struct S;
    | --------- function or associated item `b` not found for this
 ...
 LL |     S::b(&S);
-   |     ^^^^ function or associated item not found in `S`
+   |     ---^
+   |     |
+   |     function or associated item not found in `S`
    |
    = help: items from traits can only be used if the trait is in scope
 help: the following trait is implemented but not in scope, perhaps add a `use` for it:
@@ -67,26 +71,30 @@ LL |     C::a(&S); //~ ERROR method `a` is private
    |     ^^^^
 
 error[E0599]: no associated item named `A` found for type `S` in the current scope
-  --> $DIR/trait-item-privacy.rs:107:5
+  --> $DIR/trait-item-privacy.rs:107:8
    |
 LL | struct S;
    | --------- associated item `A` not found for this
 ...
 LL |     S::A; //~ ERROR no associated item named `A` found for type `S` in the current scope
-   |     ^^^^ associated item not found in `S`
+   |     ---^
+   |     |
+   |     associated item not found in `S`
    |
    = help: items from traits can only be used if the trait is implemented and in scope
    = note: the following trait defines an item `A`, perhaps you need to implement it:
            candidate #1: `assoc_const::A`
 
 error[E0599]: no associated item named `B` found for type `S` in the current scope
-  --> $DIR/trait-item-privacy.rs:108:5
+  --> $DIR/trait-item-privacy.rs:108:8
    |
 LL | struct S;
    | --------- associated item `B` not found for this
 ...
 LL |     S::B; //~ ERROR no associated item named `B` found for type `S` in the current scope
-   |     ^^^^ associated item not found in `S`
+   |     ---^
+   |     |
+   |     associated item not found in `S`
    |
    = help: items from traits can only be used if the trait is in scope
 help: the following trait is implemented but not in scope, perhaps add a `use` for it:
index a17bb9e952d3c067743de217f800caee1d0c7b59..41f260aba5597000615f24a85e8026488afff5c2 100644 (file)
@@ -48,7 +48,7 @@ fn foo<'a>(y: &'a i32) {
     x.1.push(y); // &'a i32: 'static does not hold
 }
 
-// Bounds are not checked either, i.e. the definition is not necessarily well-formed
+// Bounds are not checked either, i.e., the definition is not necessarily well-formed
 struct Sendable<T: Send>(T);
 type MySendable<T> = Sendable<T>; // no error here!
 
index cb571be661d6ae0aa5e7d6c2e0bd7b619d4ac3fe..940e00738d92ddd90c0b2dcf068023825af81641 100644 (file)
@@ -187,16 +187,20 @@ LL |     let _: <u8 as Tr>::Y::NN; //~ ERROR ambiguous associated type
    |            ^^^^^^^^^^^^^^^^^ help: use fully-qualified syntax: `<<u8 as Tr>::Y as Trait>::NN`
 
 error[E0599]: no associated item named `NN` found for type `<u8 as Tr>::Y` in the current scope
-  --> $DIR/ufcs-partially-resolved.rs:48:5
+  --> $DIR/ufcs-partially-resolved.rs:48:20
    |
 LL |     <u8 as Tr>::Y::NN; //~ ERROR no associated item named `NN` found for type `<u8 as Tr>::Y`
-   |     ^^^^^^^^^^^^^^^^^ associated item not found in `<u8 as Tr>::Y`
+   |     ---------------^^
+   |     |
+   |     associated item not found in `<u8 as Tr>::Y`
 
 error[E0599]: no associated item named `N` found for type `<u8 as Dr>::X` in the current scope
-  --> $DIR/ufcs-partially-resolved.rs:65:5
+  --> $DIR/ufcs-partially-resolved.rs:65:20
    |
 LL |     <u8 as Dr>::X::N; //~ ERROR no associated item named `N` found for type `<u8 as Dr>::X`
-   |     ^^^^^^^^^^^^^^^^ associated item not found in `<u8 as Dr>::X`
+   |     ---------------^
+   |     |
+   |     associated item not found in `<u8 as Dr>::X`
 
 error: aborting due to 32 previous errors
 
index c036540068b0b1f5552baafdee399a0c3ecc0d2a..005d7bfedd0e40d8759b5843c443d19f2a6d76bd 100644 (file)
@@ -1,26 +1,34 @@
 error[E0599]: no function or associated item named `lol` found for type `dyn Foo<_>` in the current scope
-  --> $DIR/unspecified-self-in-trait-ref.rs:20:13
+  --> $DIR/unspecified-self-in-trait-ref.rs:20:18
    |
 LL |     let a = Foo::lol();
-   |             ^^^^^^^^ function or associated item not found in `dyn Foo<_>`
+   |             -----^^^
+   |             |
+   |             function or associated item not found in `dyn Foo<_>`
 
 error[E0599]: no function or associated item named `lol` found for type `dyn Foo<_>` in the current scope
-  --> $DIR/unspecified-self-in-trait-ref.rs:22:13
+  --> $DIR/unspecified-self-in-trait-ref.rs:22:23
    |
 LL |     let b = Foo::<_>::lol();
-   |             ^^^^^^^^^^^^^ function or associated item not found in `dyn Foo<_>`
+   |             ----------^^^
+   |             |
+   |             function or associated item not found in `dyn Foo<_>`
 
 error[E0599]: no function or associated item named `lol` found for type `dyn Bar<_, _>` in the current scope
-  --> $DIR/unspecified-self-in-trait-ref.rs:24:13
+  --> $DIR/unspecified-self-in-trait-ref.rs:24:18
    |
 LL |     let c = Bar::lol();
-   |             ^^^^^^^^ function or associated item not found in `dyn Bar<_, _>`
+   |             -----^^^
+   |             |
+   |             function or associated item not found in `dyn Bar<_, _>`
 
 error[E0599]: no function or associated item named `lol` found for type `dyn Bar<usize, _>` in the current scope
-  --> $DIR/unspecified-self-in-trait-ref.rs:26:13
+  --> $DIR/unspecified-self-in-trait-ref.rs:26:30
    |
 LL |     let d = Bar::<usize, _>::lol();
-   |             ^^^^^^^^^^^^^^^^^^^^ function or associated item not found in `dyn Bar<usize, _>`
+   |             -----------------^^^
+   |             |
+   |             function or associated item not found in `dyn Bar<usize, _>`
 
 error[E0393]: the type parameter `A` must be explicitly specified
   --> $DIR/unspecified-self-in-trait-ref.rs:28:13
index 8d20a9e2717051dfd15ec7cd15615db737ecb858..7b967a10c8701e97a7cdd8b21b37b623df07fdfa 100644 (file)
@@ -56,7 +56,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
 #[derive(Debug)]
 pub struct Error {
     pub line_num: usize,
-    /// What kind of message we expect (e.g. warning, error, suggestion).
+    /// What kind of message we expect (e.g., warning, error, suggestion).
     /// `None` if not specified or unknown message kind.
     pub kind: Option<ErrorKind>,
     pub msg: String,
index f4a82aeb307dc86410f8b4605525bd733dc918f1..003839982429ff467bdfc3331731149096cb94b9 100644 (file)
@@ -715,7 +715,7 @@ fn parse_custom_normalization(&self, mut line: &str, prefix: &str) -> Option<(St
         }
     }
 
-    /// Parses a name-value directive which contains config-specific information, e.g. `ignore-x86`
+    /// Parses a name-value directive which contains config-specific information, e.g., `ignore-x86`
     /// or `normalize-stderr-32bit`.
     fn parse_cfg_name_directive(&self, line: &str, prefix: &str) -> ParsedNameDirective {
         if line.starts_with(prefix) && line.as_bytes().get(prefix.len()) == Some(&b'-') {