From cd0f80e4008baf456ca2c435d9fb67b01d58586a Mon Sep 17 00:00:00 2001 From: sd234678 Date: Wed, 7 Aug 2019 09:44:23 +0100 Subject: [PATCH 1/4] Remove meaningless comment decoration from code --- src/grammar/parser-lalr.y | 10 -------- src/liballoc/slice.rs | 8 ------- src/liballoc/vec.rs | 10 -------- src/libcore/any.rs | 6 ----- src/libcore/convert.rs | 6 ----- src/libcore/option.rs | 24 ------------------- src/libcore/result.rs | 20 ---------------- src/libcore/slice/mod.rs | 4 ---- src/libcore/str/pattern.rs | 16 ------------- src/librustc/hir/intravisit.rs | 3 --- src/librustc/infer/combine.rs | 1 - .../nice_region_error/placeholder_error.rs | 2 -- src/librustc/infer/resolve.rs | 3 --- src/librustc/infer/type_variable.rs | 2 -- src/librustc/macros.rs | 1 - src/librustc/middle/expr_use_visitor.rs | 2 -- src/librustc/mir/interpret/allocation.rs | 2 -- src/librustc/mir/interpret/mod.rs | 4 ---- src/librustc/mir/interpret/pointer.rs | 2 -- src/librustc/mir/mod.rs | 10 -------- src/librustc/traits/select.rs | 8 ------- src/librustc/traits/structural_impls.rs | 2 -- src/librustc/traits/util.rs | 12 ---------- src/librustc/ty/fold.rs | 4 ---- src/librustc/ty/relate.rs | 2 -- src/librustc/ty/structural_impls.rs | 3 --- src/librustc/ty/subst.rs | 2 -- .../borrowck/gather_loans/lifetime.rs | 1 - .../borrowck/gather_loans/restrictions.rs | 1 - src/librustc_ast_borrowck/borrowck/mod.rs | 2 -- src/librustc_codegen_ssa/meth.rs | 2 -- src/librustc_codegen_ssa/mir/mod.rs | 2 -- .../owning_ref/mod.rs | 8 ------- src/librustc_mir/build/matches/mod.rs | 2 -- src/librustc_mir/build/mod.rs | 4 ---- src/librustc_mir/hair/mod.rs | 1 - src/librustc_mir/interpret/eval_context.rs | 6 ----- src/librustc_mir/interpret/traits.rs | 2 -- src/librustc_mir/util/liveness.rs | 3 --- src/librustc_privacy/lib.rs | 20 ---------------- src/librustc_typeck/check/method/confirm.rs | 3 --- src/librustc_typeck/check/method/probe.rs | 3 --- src/librustc_typeck/check/regionck.rs | 2 -- src/librustc_typeck/check/wfcheck.rs | 1 - src/librustc_typeck/check/writeback.rs | 5 ---- src/librustc_typeck/collect.rs | 6 ----- src/libstd/path.rs | 14 ----------- src/libstd/sync/mpsc/mod.rs | 6 ----- src/libstd/sync/mpsc/oneshot.rs | 2 -- src/libstd/sync/mpsc/shared.rs | 2 -- src/libstd/sync/mpsc/stream.rs | 2 -- src/libstd/sync/mpsc/sync.rs | 4 ---- src/libstd/sys/cloudabi/shims/process.rs | 2 -- src/libstd/sys/sgx/process.rs | 2 -- src/libstd/sys/unix/pipe.rs | 2 -- src/libstd/sys/unix/process/process_common.rs | 1 - .../sys/unix/process/process_fuchsia.rs | 4 ---- src/libstd/sys/unix/process/process_unix.rs | 4 ---- .../sys/vxworks/process/process_common.rs | 2 -- .../sys/vxworks/process/process_vxworks.rs | 4 ---- src/libstd/sys/wasi/process.rs | 2 -- src/libstd/sys/wasm/process.rs | 2 -- src/libstd/sys/windows/pipe.rs | 2 -- src/libstd/sys/windows/process.rs | 4 ---- src/libstd/sys_common/net.rs | 10 -------- src/libstd/thread/mod.rs | 14 ----------- 66 files changed, 328 deletions(-) diff --git a/src/grammar/parser-lalr.y b/src/grammar/parser-lalr.y index 5585c95a5a63a..b57c71cfeb0d9 100644 --- a/src/grammar/parser-lalr.y +++ b/src/grammar/parser-lalr.y @@ -202,9 +202,7 @@ extern char *yytext; %% -//////////////////////////////////////////////////////////////////////// // Part 1: Items and attributes -//////////////////////////////////////////////////////////////////////// crate : maybe_shebang inner_attrs maybe_mod_items { mk_node("crate", 2, $2, $3); } @@ -941,9 +939,7 @@ maybe_bindings | %empty { $$ = mk_none(); } ; -//////////////////////////////////////////////////////////////////////// // Part 2: Patterns -//////////////////////////////////////////////////////////////////////// pat : UNDERSCORE { $$ = mk_atom("PatWild"); } @@ -1049,9 +1045,7 @@ pat_vec_elts | pat_vec_elts ',' pat { $$ = ext_node($1, 1, $3); } ; -//////////////////////////////////////////////////////////////////////// // Part 3: Types -//////////////////////////////////////////////////////////////////////// ty : ty_prim @@ -1266,9 +1260,7 @@ trait_ref | %prec IDENT MOD_SEP path_generic_args_without_colons { $$ = $2; } ; -//////////////////////////////////////////////////////////////////////// // Part 4: Blocks, statements, and expressions -//////////////////////////////////////////////////////////////////////// inner_attrs_and_block : '{' maybe_inner_attrs maybe_stmts '}' { $$ = mk_node("ExprBlock", 2, $2, $3); } @@ -1784,9 +1776,7 @@ let : LET pat maybe_ty_ascription maybe_init_expr ';' { $$ = mk_node("DeclLocal", 3, $2, $3, $4); } ; -//////////////////////////////////////////////////////////////////////// // Part 5: Macros and misc. rules -//////////////////////////////////////////////////////////////////////// lit : LIT_BYTE { $$ = mk_node("LitByte", 1, mk_atom(yytext)); } diff --git a/src/liballoc/slice.rs b/src/liballoc/slice.rs index 881d499c0745b..4241cd3b85180 100644 --- a/src/liballoc/slice.rs +++ b/src/liballoc/slice.rs @@ -118,9 +118,7 @@ pub use core::slice::{ChunksExact, ChunksExactMut}; #[stable(feature = "rchunks", since = "1.31.0")] pub use core::slice::{RChunks, RChunksMut, RChunksExact, RChunksExactMut}; -//////////////////////////////////////////////////////////////////////////////// // Basic slice extension methods -//////////////////////////////////////////////////////////////////////////////// // HACK(japaric) needed for the implementation of `vec!` macro during testing // N.B., see the `hack` module in this file for more details. @@ -575,9 +573,7 @@ impl [u8] { } } -//////////////////////////////////////////////////////////////////////////////// // Extension traits for slices over specific kinds of data -//////////////////////////////////////////////////////////////////////////////// /// Helper trait for [`[T]::concat`](../../std/primitive.slice.html#method.concat). /// @@ -690,9 +686,7 @@ impl> Join<&[T]> for [V] { } } -//////////////////////////////////////////////////////////////////////////////// // Standard trait implementations for slices -//////////////////////////////////////////////////////////////////////////////// #[stable(feature = "rust1", since = "1.0.0")] impl Borrow<[T]> for Vec { @@ -735,9 +729,7 @@ impl ToOwned for [T] { } } -//////////////////////////////////////////////////////////////////////////////// // Sorting -//////////////////////////////////////////////////////////////////////////////// /// Inserts `v[0]` into pre-sorted sequence `v[1..]` so that whole `v[..]` becomes sorted. /// diff --git a/src/liballoc/vec.rs b/src/liballoc/vec.rs index d2798955c46a9..07dea4aa036e0 100644 --- a/src/liballoc/vec.rs +++ b/src/liballoc/vec.rs @@ -296,9 +296,7 @@ pub struct Vec { len: usize, } -//////////////////////////////////////////////////////////////////////////////// // Inherent methods -//////////////////////////////////////////////////////////////////////////////// impl Vec { /// Constructs a new, empty `Vec`. @@ -1639,9 +1637,7 @@ impl Vec { } } -//////////////////////////////////////////////////////////////////////////////// // Internal methods and functions -//////////////////////////////////////////////////////////////////////////////// #[doc(hidden)] #[stable(feature = "rust1", since = "1.0.0")] @@ -1745,9 +1741,7 @@ unsafe impl IsZero for *mut T { } -//////////////////////////////////////////////////////////////////////////////// // Common trait implementations for Vec -//////////////////////////////////////////////////////////////////////////////// #[stable(feature = "rust1", since = "1.0.0")] impl Clone for Vec { @@ -2334,9 +2328,7 @@ impl From<&str> for Vec { } } -//////////////////////////////////////////////////////////////////////////////// // Clone-on-write -//////////////////////////////////////////////////////////////////////////////// #[stable(feature = "cow_from_vec", since = "1.8.0")] impl<'a, T: Clone> From<&'a [T]> for Cow<'a, [T]> { @@ -2366,9 +2358,7 @@ impl<'a, T> FromIterator for Cow<'a, [T]> where T: Clone { } } -//////////////////////////////////////////////////////////////////////////////// // Iterators -//////////////////////////////////////////////////////////////////////////////// /// An iterator that moves out of a vector. /// diff --git a/src/libcore/any.rs b/src/libcore/any.rs index e8a0a88f12a7e..d415c21a68d7c 100644 --- a/src/libcore/any.rs +++ b/src/libcore/any.rs @@ -64,9 +64,7 @@ use crate::fmt; use crate::intrinsics; -/////////////////////////////////////////////////////////////////////////////// // Any trait -/////////////////////////////////////////////////////////////////////////////// /// A type to emulate dynamic typing. /// @@ -101,9 +99,7 @@ impl Any for T { fn type_id(&self) -> TypeId { TypeId::of::() } } -/////////////////////////////////////////////////////////////////////////////// // Extension methods for Any trait objects. -/////////////////////////////////////////////////////////////////////////////// #[stable(feature = "rust1", since = "1.0.0")] impl fmt::Debug for dyn Any { @@ -402,9 +398,7 @@ impl dyn Any+Send+Sync { } } -/////////////////////////////////////////////////////////////////////////////// // TypeID and its methods -/////////////////////////////////////////////////////////////////////////////// /// A `TypeId` represents a globally unique identifier for a type. /// diff --git a/src/libcore/convert.rs b/src/libcore/convert.rs index 641621f492baf..d11bac6a50c29 100644 --- a/src/libcore/convert.rs +++ b/src/libcore/convert.rs @@ -489,9 +489,7 @@ pub trait TryFrom: Sized { fn try_from(value: T) -> Result; } -//////////////////////////////////////////////////////////////////////////////// // GENERIC IMPLS -//////////////////////////////////////////////////////////////////////////////// // As lifts over & #[stable(feature = "rust1", since = "1.0.0")] @@ -574,9 +572,7 @@ impl TryFrom for T where U: Into { } } -//////////////////////////////////////////////////////////////////////////////// // CONCRETE IMPLS -//////////////////////////////////////////////////////////////////////////////// #[stable(feature = "rust1", since = "1.0.0")] impl AsRef<[T]> for [T] { @@ -600,9 +596,7 @@ impl AsRef for str { } } -//////////////////////////////////////////////////////////////////////////////// // THE NO-ERROR ERROR TYPE -//////////////////////////////////////////////////////////////////////////////// /// The error type for errors that can never happen. /// diff --git a/src/libcore/option.rs b/src/libcore/option.rs index 259ed36c57885..8d2ea9a08a6b3 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -156,14 +156,10 @@ pub enum Option { Some(#[stable(feature = "rust1", since = "1.0.0")] T), } -///////////////////////////////////////////////////////////////////////////// // Type implementation -///////////////////////////////////////////////////////////////////////////// impl Option { - ///////////////////////////////////////////////////////////////////////// // Querying the contained values - ///////////////////////////////////////////////////////////////////////// /// Returns `true` if the option is a [`Some`] value. /// @@ -235,9 +231,7 @@ impl Option { } } - ///////////////////////////////////////////////////////////////////////// // Adapter for working with references - ///////////////////////////////////////////////////////////////////////// /// Converts from `&Option` to `Option<&T>`. /// @@ -312,9 +306,7 @@ impl Option { } } - ///////////////////////////////////////////////////////////////////////// // Getting to contained values - ///////////////////////////////////////////////////////////////////////// /// Unwraps an option, yielding the content of a [`Some`]. /// @@ -420,9 +412,7 @@ impl Option { } } - ///////////////////////////////////////////////////////////////////////// // Transforming contained values - ///////////////////////////////////////////////////////////////////////// /// Maps an `Option` to `Option` by applying a function to a contained value. /// @@ -552,9 +542,7 @@ impl Option { } } - ///////////////////////////////////////////////////////////////////////// // Iterator constructors - ///////////////////////////////////////////////////////////////////////// /// Returns an iterator over the possibly contained value. /// @@ -594,9 +582,7 @@ impl Option { IterMut { inner: Item { opt: self.as_mut() } } } - ///////////////////////////////////////////////////////////////////////// // Boolean operations on the values, eager and lazy - ///////////////////////////////////////////////////////////////////////// /// Returns [`None`] if the option is [`None`], otherwise returns `optb`. /// @@ -786,9 +772,7 @@ impl Option { } } - ///////////////////////////////////////////////////////////////////////// // Entry-like operations to insert if None and return a reference - ///////////////////////////////////////////////////////////////////////// /// Inserts `v` into the option if it is [`None`], then /// returns a mutable reference to the contained value. @@ -848,9 +832,7 @@ impl Option { } } - ///////////////////////////////////////////////////////////////////////// // Misc - ///////////////////////////////////////////////////////////////////////// /// Takes the value out of the option, leaving a [`None`] in its place. /// @@ -1173,9 +1155,7 @@ fn expect_none_failed(msg: &str, value: &dyn fmt::Debug) -> ! { panic!("{}: {:?}", msg, value) } -///////////////////////////////////////////////////////////////////////////// // Trait implementations -///////////////////////////////////////////////////////////////////////////// #[stable(feature = "rust1", since = "1.0.0")] impl Clone for Option { @@ -1268,9 +1248,7 @@ impl<'a, T> From<&'a mut Option> for Option<&'a mut T> { } } -///////////////////////////////////////////////////////////////////////////// // The Option Iterators -///////////////////////////////////////////////////////////////////////////// #[derive(Clone, Debug)] struct Item { @@ -1426,9 +1404,7 @@ impl FusedIterator for IntoIter {} #[unstable(feature = "trusted_len", issue = "37572")] unsafe impl TrustedLen for IntoIter {} -///////////////////////////////////////////////////////////////////////////// // FromIterator -///////////////////////////////////////////////////////////////////////////// #[stable(feature = "rust1", since = "1.0.0")] impl> FromIterator> for Option { diff --git a/src/libcore/result.rs b/src/libcore/result.rs index 8c60a9c1b501d..41ec54a7c0f12 100644 --- a/src/libcore/result.rs +++ b/src/libcore/result.rs @@ -253,14 +253,10 @@ pub enum Result { Err(#[stable(feature = "rust1", since = "1.0.0")] E), } -///////////////////////////////////////////////////////////////////////////// // Type implementation -///////////////////////////////////////////////////////////////////////////// impl Result { - ///////////////////////////////////////////////////////////////////////// // Querying the contained values - ///////////////////////////////////////////////////////////////////////// /// Returns `true` if the result is [`Ok`]. /// @@ -361,9 +357,7 @@ impl Result { } } - ///////////////////////////////////////////////////////////////////////// // Adapter for each variant - ///////////////////////////////////////////////////////////////////////// /// Converts from `Result` to [`Option`]. /// @@ -419,9 +413,7 @@ impl Result { } } - ///////////////////////////////////////////////////////////////////////// // Adapter for working with references - ///////////////////////////////////////////////////////////////////////// /// Converts from `&Result` to `Result<&T, &E>`. /// @@ -479,9 +471,7 @@ impl Result { } } - ///////////////////////////////////////////////////////////////////////// // Transforming contained values - ///////////////////////////////////////////////////////////////////////// /// Maps a `Result` to `Result` by applying a function to a /// contained [`Ok`] value, leaving an [`Err`] value untouched. @@ -575,9 +565,7 @@ impl Result { } } - ///////////////////////////////////////////////////////////////////////// // Iterator constructors - ///////////////////////////////////////////////////////////////////////// /// Returns an iterator over the possibly contained value. /// @@ -625,9 +613,7 @@ impl Result { IterMut { inner: self.as_mut().ok() } } - //////////////////////////////////////////////////////////////////////// // Boolean operations on the values, eager and lazy - ///////////////////////////////////////////////////////////////////////// /// Returns `res` if the result is [`Ok`], otherwise returns the [`Err`] value of `self`. /// @@ -1084,9 +1070,7 @@ fn unwrap_failed(msg: &str, error: &dyn fmt::Debug) -> ! { panic!("{}: {:?}", msg, error) } -///////////////////////////////////////////////////////////////////////////// // Trait implementations -///////////////////////////////////////////////////////////////////////////// #[stable(feature = "rust1", since = "1.0.0")] impl Clone for Result { @@ -1157,9 +1141,7 @@ impl<'a, T, E> IntoIterator for &'a mut Result { } } -///////////////////////////////////////////////////////////////////////////// // The Result Iterators -///////////////////////////////////////////////////////////////////////////// /// An iterator over a reference to the [`Ok`] variant of a [`Result`]. /// @@ -1290,9 +1272,7 @@ impl FusedIterator for IntoIter {} #[unstable(feature = "trusted_len", issue = "37572")] unsafe impl TrustedLen for IntoIter {} -///////////////////////////////////////////////////////////////////////////// // FromIterator -///////////////////////////////////////////////////////////////////////////// #[stable(feature = "rust1", since = "1.0.0")] impl> FromIterator> for Result { diff --git a/src/libcore/slice/mod.rs b/src/libcore/slice/mod.rs index bfbbb15c8d488..5096ed0436da6 100644 --- a/src/libcore/slice/mod.rs +++ b/src/libcore/slice/mod.rs @@ -2963,9 +2963,7 @@ impl SliceIndex<[T]> for ops::RangeToInclusive { } } -//////////////////////////////////////////////////////////////////////////////// // Common traits -//////////////////////////////////////////////////////////////////////////////// #[stable(feature = "rust1", since = "1.0.0")] impl Default for &[T] { @@ -2979,9 +2977,7 @@ impl Default for &mut [T] { fn default() -> Self { &mut [] } } -// // Iterators -// #[stable(feature = "rust1", since = "1.0.0")] impl<'a, T> IntoIterator for &'a [T] { diff --git a/src/libcore/str/pattern.rs b/src/libcore/str/pattern.rs index ad9d956fda1c8..7aecb358575d4 100644 --- a/src/libcore/str/pattern.rs +++ b/src/libcore/str/pattern.rs @@ -234,9 +234,7 @@ pub unsafe trait ReverseSearcher<'a>: Searcher<'a> { pub trait DoubleEndedSearcher<'a>: ReverseSearcher<'a> {} -///////////////////////////////////////////////////////////////////////////// // Impl for char -///////////////////////////////////////////////////////////////////////////// /// Associated type for `>::Searcher`. #[derive(Clone, Debug)] @@ -466,9 +464,7 @@ impl<'a> Pattern<'a> for char { } } -///////////////////////////////////////////////////////////////////////////// // Impl for a MultiCharEq wrapper -///////////////////////////////////////////////////////////////////////////// #[doc(hidden)] trait MultiCharEq { @@ -556,8 +552,6 @@ unsafe impl<'a, C: MultiCharEq> ReverseSearcher<'a> for MultiCharEqSearcher<'a, impl<'a, C: MultiCharEq> DoubleEndedSearcher<'a> for MultiCharEqSearcher<'a, C> {} -///////////////////////////////////////////////////////////////////////////// - macro_rules! pattern_methods { ($t:ty, $pmap:expr, $smap:expr) => { type Searcher = $t; @@ -621,9 +615,7 @@ macro_rules! searcher_methods { } } -///////////////////////////////////////////////////////////////////////////// // Impl for &[char] -///////////////////////////////////////////////////////////////////////////// // Todo: Change / Remove due to ambiguity in meaning. @@ -646,9 +638,7 @@ impl<'a, 'b> Pattern<'a> for &'b [char] { pattern_methods!(CharSliceSearcher<'a, 'b>, MultiCharEqPattern, CharSliceSearcher); } -///////////////////////////////////////////////////////////////////////////// // Impl for F: FnMut(char) -> bool -///////////////////////////////////////////////////////////////////////////// /// Associated type for `>::Searcher`. #[derive(Clone)] @@ -685,18 +675,14 @@ impl<'a, F> Pattern<'a> for F where F: FnMut(char) -> bool { pattern_methods!(CharPredicateSearcher<'a, F>, MultiCharEqPattern, CharPredicateSearcher); } -///////////////////////////////////////////////////////////////////////////// // Impl for &&str -///////////////////////////////////////////////////////////////////////////// /// Delegates to the `&str` impl. impl<'a, 'b, 'c> Pattern<'a> for &'c &'b str { pattern_methods!(StrSearcher<'a, 'b>, |&s| s, |s| s); } -///////////////////////////////////////////////////////////////////////////// // Impl for &str -///////////////////////////////////////////////////////////////////////////// /// Non-allocating substring search. /// @@ -727,9 +713,7 @@ impl<'a, 'b> Pattern<'a> for &'b str { } -///////////////////////////////////////////////////////////////////////////// // Two Way substring searcher -///////////////////////////////////////////////////////////////////////////// #[derive(Clone, Debug)] /// Associated type for `<&str as Pattern<'a>>::Searcher`. diff --git a/src/librustc/hir/intravisit.rs b/src/librustc/hir/intravisit.rs index fa274f831b795..ba85bdf2f4a14 100644 --- a/src/librustc/hir/intravisit.rs +++ b/src/librustc/hir/intravisit.rs @@ -140,7 +140,6 @@ impl<'this, 'tcx> NestedVisitorMap<'this, 'tcx> { /// to monitor future changes to `Visitor` in case a new method with a /// new default implementation gets introduced.) pub trait Visitor<'v> : Sized { - /////////////////////////////////////////////////////////////////////////// // Nested items. /// The default versions of the `visit_nested_XXX` routines invoke @@ -234,8 +233,6 @@ pub trait Visitor<'v> : Sized { DeepVisitor::new(self) } - /////////////////////////////////////////////////////////////////////////// - fn visit_id(&mut self, _hir_id: HirId) { // Nothing to do. } diff --git a/src/librustc/infer/combine.rs b/src/librustc/infer/combine.rs index 4a9b68f24371d..120381697d70f 100644 --- a/src/librustc/infer/combine.rs +++ b/src/librustc/infer/combine.rs @@ -1,4 +1,3 @@ -/////////////////////////////////////////////////////////////////////////// // # Type combining // // There are four type combiners: equate, sub, lub, and glb. Each diff --git a/src/librustc/infer/error_reporting/nice_region_error/placeholder_error.rs b/src/librustc/infer/error_reporting/nice_region_error/placeholder_error.rs index b4fb018920647..33f30aad8663e 100644 --- a/src/librustc/infer/error_reporting/nice_region_error/placeholder_error.rs +++ b/src/librustc/infer/error_reporting/nice_region_error/placeholder_error.rs @@ -18,13 +18,11 @@ impl NiceRegionError<'me, 'tcx> { /// an anonymous region, emit a descriptive diagnostic error. pub(super) fn try_report_placeholder_conflict(&self) -> Option> { match &self.error { - /////////////////////////////////////////////////////////////////////////// // NB. The ordering of cases in this match is very // sensitive, because we are often matching against // specific cases and then using an `_` to match all // others. - /////////////////////////////////////////////////////////////////////////// // Check for errors from comparing trait failures -- first // with two placeholders, then with one. Some(RegionResolutionError::SubSupConflict( diff --git a/src/librustc/infer/resolve.rs b/src/librustc/infer/resolve.rs index 7e553d7666b22..0fcf36b4088dd 100644 --- a/src/librustc/infer/resolve.rs +++ b/src/librustc/infer/resolve.rs @@ -4,7 +4,6 @@ use crate::mir::interpret::ConstValue; use crate::ty::{self, Ty, Const, TyCtxt, TypeFoldable, InferConst, TypeFlags}; use crate::ty::fold::{TypeFolder, TypeVisitor}; -/////////////////////////////////////////////////////////////////////////// // OPPORTUNISTIC VAR RESOLVER /// The opportunistic resolver can be used at any time. It simply replaces @@ -94,7 +93,6 @@ impl<'a, 'tcx> TypeFolder<'tcx> for OpportunisticTypeAndRegionResolver<'a, 'tcx> } } -/////////////////////////////////////////////////////////////////////////// // UNRESOLVED TYPE FINDER /// The unresolved type **finder** walks a type searching for @@ -151,7 +149,6 @@ impl<'a, 'tcx> TypeVisitor<'tcx> for UnresolvedTypeFinder<'a, 'tcx> { } -/////////////////////////////////////////////////////////////////////////// // FULL TYPE RESOLUTION /// Full type resolution replaces all type and region variables with diff --git a/src/librustc/infer/type_variable.rs b/src/librustc/infer/type_variable.rs index e30e86998a8c6..580fd0b0256fc 100644 --- a/src/librustc/infer/type_variable.rs +++ b/src/librustc/infer/type_variable.rs @@ -382,8 +382,6 @@ impl sv::SnapshotVecDelegate for Delegate { } } -/////////////////////////////////////////////////////////////////////////// - /// These structs (a newtyped TyVid) are used as the unification key /// for the `eq_relations`; they carry a `TypeVariableValue` along /// with them. diff --git a/src/librustc/macros.rs b/src/librustc/macros.rs index 09fa924efc7ab..5856c8a7cfaaa 100644 --- a/src/librustc/macros.rs +++ b/src/librustc/macros.rs @@ -183,7 +183,6 @@ macro_rules! impl_stable_hash_for_spanned { ); } -/////////////////////////////////////////////////////////////////////////// // Lift and TypeFoldable macros // // When possible, use one of these (relatively) convenient macros to write diff --git a/src/librustc/middle/expr_use_visitor.rs b/src/librustc/middle/expr_use_visitor.rs index a274d7bbee5f7..172d58d862337 100644 --- a/src/librustc/middle/expr_use_visitor.rs +++ b/src/librustc/middle/expr_use_visitor.rs @@ -22,7 +22,6 @@ use std::rc::Rc; use syntax_pos::Span; use crate::util::nodemap::ItemLocalSet; -/////////////////////////////////////////////////////////////////////////// // The Delegate trait /// This trait defines the callbacks you can expect to receive when @@ -225,7 +224,6 @@ impl OverloadedCallType { } } -/////////////////////////////////////////////////////////////////////////// // The ExprUseVisitor type // // This is the code that actually walks the tree. diff --git a/src/librustc/mir/interpret/allocation.rs b/src/librustc/mir/interpret/allocation.rs index 84b4cd914563e..8703fe4556d82 100644 --- a/src/librustc/mir/interpret/allocation.rs +++ b/src/librustc/mir/interpret/allocation.rs @@ -566,9 +566,7 @@ impl DerefMut for Relocations { } } -//////////////////////////////////////////////////////////////////////////////// // Undefined byte tracking -//////////////////////////////////////////////////////////////////////////////// type Block = u64; diff --git a/src/librustc/mir/interpret/mod.rs b/src/librustc/mir/interpret/mod.rs index 1ec95c29a4a6f..6941c95050e56 100644 --- a/src/librustc/mir/interpret/mod.rs +++ b/src/librustc/mir/interpret/mod.rs @@ -484,9 +484,7 @@ impl<'tcx> AllocMap<'tcx> { } } -//////////////////////////////////////////////////////////////////////////////// // Methods to access integers in the target endianness -//////////////////////////////////////////////////////////////////////////////// #[inline] pub fn write_target_uint( @@ -509,9 +507,7 @@ pub fn read_target_uint(endianness: layout::Endian, mut source: &[u8]) -> Result } } -//////////////////////////////////////////////////////////////////////////////// // Methods to facilitate working with signed integers stored in a u128 -//////////////////////////////////////////////////////////////////////////////// /// Truncate `value` to `size` bits and then sign-extend it to 128 bits /// (i.e., if it is negative, fill with 1's on the left). diff --git a/src/librustc/mir/interpret/pointer.rs b/src/librustc/mir/interpret/pointer.rs index b55e6bc54bc5f..294539de400c3 100644 --- a/src/librustc/mir/interpret/pointer.rs +++ b/src/librustc/mir/interpret/pointer.rs @@ -28,9 +28,7 @@ impl Display for CheckInAllocMsg { } } -//////////////////////////////////////////////////////////////////////////////// // Pointer arithmetic -//////////////////////////////////////////////////////////////////////////////// pub trait PointerArithmetic: layout::HasDataLayout { // These are not supposed to be overridden. diff --git a/src/librustc/mir/mod.rs b/src/librustc/mir/mod.rs index 11701a6637744..ee6e0601f752d 100644 --- a/src/librustc/mir/mod.rs +++ b/src/librustc/mir/mod.rs @@ -479,7 +479,6 @@ pub struct SourceInfo { pub scope: SourceScope, } -/////////////////////////////////////////////////////////////////////////// // Mutability and borrow kinds #[derive(Copy, Clone, Debug, PartialEq, Eq, RustcEncodable, RustcDecodable, HashStable)] @@ -579,7 +578,6 @@ impl BorrowKind { } } -/////////////////////////////////////////////////////////////////////////// // Variables and temps newtype_index! { @@ -996,7 +994,6 @@ pub struct UpvarDebuginfo { pub by_ref: bool, } -/////////////////////////////////////////////////////////////////////////// // BasicBlock newtype_index! { @@ -1013,7 +1010,6 @@ impl BasicBlock { } } -/////////////////////////////////////////////////////////////////////////// // BasicBlockData and Terminator #[derive(Clone, Debug, RustcEncodable, RustcDecodable, HashStable)] @@ -1542,7 +1538,6 @@ impl<'tcx> TerminatorKind<'tcx> { } } -/////////////////////////////////////////////////////////////////////////// // Statements #[derive(Clone, RustcEncodable, RustcDecodable, HashStable)] @@ -1710,7 +1705,6 @@ impl<'tcx> Debug for Statement<'tcx> { } } -/////////////////////////////////////////////////////////////////////////// // Places /// A path to a value; something that can be evaluated without @@ -2124,7 +2118,6 @@ impl Debug for PlaceBase<'_> { } } -/////////////////////////////////////////////////////////////////////////// // Scopes newtype_index! { @@ -2149,7 +2142,6 @@ pub struct SourceScopeLocalData { pub safety: Safety, } -/////////////////////////////////////////////////////////////////////////// // Operands /// These are values that can appear inside an rvalue. They are intentionally @@ -2210,7 +2202,6 @@ impl<'tcx> Operand<'tcx> { } } -/////////////////////////////////////////////////////////////////////////// /// Rvalues #[derive(Clone, RustcEncodable, RustcDecodable, HashStable)] @@ -2465,7 +2456,6 @@ impl<'tcx> Debug for Rvalue<'tcx> { } } -/////////////////////////////////////////////////////////////////////////// /// Constants /// /// Two constants are equal if they are the same constant. Note that diff --git a/src/librustc/traits/select.rs b/src/librustc/traits/select.rs index d4ae366262cbf..d7b1029579a5b 100644 --- a/src/librustc/traits/select.rs +++ b/src/librustc/traits/select.rs @@ -600,7 +600,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { self.infcx } - /////////////////////////////////////////////////////////////////////////// // Selection // // The selection phase tries to identify *how* an obligation will @@ -653,7 +652,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { } } - /////////////////////////////////////////////////////////////////////////// // EVALUATION // // Tests whether an obligation can be selected or whether an impl @@ -1256,7 +1254,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { Ok(()) } - /////////////////////////////////////////////////////////////////////////// // CANDIDATE ASSEMBLY // // The selection process begins by examining all in-scope impls, @@ -2363,7 +2360,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { Ok(()) } - /////////////////////////////////////////////////////////////////////////// // WINNOW // // Winnowing is the process of attempting to resolve ambiguity by @@ -2494,7 +2490,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { } } - /////////////////////////////////////////////////////////////////////////// // BUILTIN BOUNDS // // These cover the traits that are built-in to the language @@ -2810,7 +2805,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { .collect() } - /////////////////////////////////////////////////////////////////////////// // CONFIRMATION // // Confirmation unifies the output type parameters of the trait @@ -3648,7 +3642,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { Ok(VtableBuiltinData { nested }) } - /////////////////////////////////////////////////////////////////////////// // Matching // // Matching is a common path used for both evaluation and @@ -3792,7 +3785,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { .map_err(|_| ()) } - /////////////////////////////////////////////////////////////////////////// // Miscellany fn match_fresh_trait_refs( diff --git a/src/librustc/traits/structural_impls.rs b/src/librustc/traits/structural_impls.rs index 05b698eb4c4ea..b6b664178fd38 100644 --- a/src/librustc/traits/structural_impls.rs +++ b/src/librustc/traits/structural_impls.rs @@ -441,7 +441,6 @@ impl<'tcx> fmt::Display for traits::Clause<'tcx> { } } -/////////////////////////////////////////////////////////////////////////// // Lift implementations impl<'a, 'tcx> Lift<'tcx> for traits::SelectionError<'a> { @@ -750,7 +749,6 @@ where } } -/////////////////////////////////////////////////////////////////////////// // TypeFoldable implementations. impl<'tcx, O: TypeFoldable<'tcx>> TypeFoldable<'tcx> for traits::Obligation<'tcx, O> { diff --git a/src/librustc/traits/util.rs b/src/librustc/traits/util.rs index 07d6f633143a2..83999ad131fe1 100644 --- a/src/librustc/traits/util.rs +++ b/src/librustc/traits/util.rs @@ -76,9 +76,7 @@ impl>> Extend for PredicateSet<'tcx> { } } -/////////////////////////////////////////////////////////////////////////// // `Elaboration` iterator -/////////////////////////////////////////////////////////////////////////// /// "Elaboration" is the process of identifying all the predicates that /// are implied by a source predicate. Currently this basically means @@ -245,9 +243,7 @@ impl Iterator for Elaborator<'tcx> { } } -/////////////////////////////////////////////////////////////////////////// // Supertrait iterator -/////////////////////////////////////////////////////////////////////////// pub type Supertraits<'tcx> = FilterToTraits>; @@ -265,9 +261,7 @@ pub fn transitive_bounds<'tcx>( elaborate_trait_refs(tcx, bounds).filter_to_traits() } -/////////////////////////////////////////////////////////////////////////// // `TraitAliasExpander` iterator -/////////////////////////////////////////////////////////////////////////// /// "Trait alias expansion" is the process of expanding a sequence of trait /// references into another sequence by transitively following all trait @@ -407,9 +401,7 @@ impl<'tcx> Iterator for TraitAliasExpander<'tcx> { } } -/////////////////////////////////////////////////////////////////////////// // Iterator over def-IDs of supertraits -/////////////////////////////////////////////////////////////////////////// pub struct SupertraitDefIds<'tcx> { tcx: TyCtxt<'tcx>, @@ -442,9 +434,7 @@ impl Iterator for SupertraitDefIds<'tcx> { } } -/////////////////////////////////////////////////////////////////////////// // Other -/////////////////////////////////////////////////////////////////////////// /// A filter around an iterator of predicates that makes it yield up /// just trait references. @@ -476,9 +466,7 @@ impl<'tcx, I: Iterator>> Iterator for FilterToTraits< } } -/////////////////////////////////////////////////////////////////////////// // Other -/////////////////////////////////////////////////////////////////////////// /// Instantiate all bound parameters of the impl with the given substs, /// returning the resulting trait ref and all obligations that arise. diff --git a/src/librustc/ty/fold.rs b/src/librustc/ty/fold.rs index 4b30412b41954..6dc6126bdb418 100644 --- a/src/librustc/ty/fold.rs +++ b/src/librustc/ty/fold.rs @@ -195,7 +195,6 @@ pub trait TypeVisitor<'tcx> : Sized { } } -/////////////////////////////////////////////////////////////////////////// // Some sample folders pub struct BottomUpFolder<'tcx, F, G, H> @@ -236,7 +235,6 @@ where } } -/////////////////////////////////////////////////////////////////////////// // Region folder impl<'tcx> TyCtxt<'tcx> { @@ -426,7 +424,6 @@ impl<'a, 'tcx> TypeFolder<'tcx> for RegionFolder<'a, 'tcx> { } } -/////////////////////////////////////////////////////////////////////////// // Bound vars replacer /// Replaces the escaping bound vars (late bound regions or bound types) in a type. @@ -709,7 +706,6 @@ impl<'tcx> TyCtxt<'tcx> { } } -/////////////////////////////////////////////////////////////////////////// // Shifter // // Shifts the De Bruijn indices on all escaping bound vars by a diff --git a/src/librustc/ty/relate.rs b/src/librustc/ty/relate.rs index 945e3e158eafb..03a38bf6c877f 100644 --- a/src/librustc/ty/relate.rs +++ b/src/librustc/ty/relate.rs @@ -103,7 +103,6 @@ pub trait Relate<'tcx>: TypeFoldable<'tcx> { ) -> RelateResult<'tcx, Self>; } -/////////////////////////////////////////////////////////////////////////// // Relate impls impl<'tcx> Relate<'tcx> for ty::TypeAndMut<'tcx> { @@ -1010,7 +1009,6 @@ where } } -/////////////////////////////////////////////////////////////////////////// // Error handling pub fn expected_found(relation: &mut R, a: &T, b: &T) -> ExpectedFound diff --git a/src/librustc/ty/structural_impls.rs b/src/librustc/ty/structural_impls.rs index 649a5244728ba..a2ac91a18b928 100644 --- a/src/librustc/ty/structural_impls.rs +++ b/src/librustc/ty/structural_impls.rs @@ -284,7 +284,6 @@ impl fmt::Debug for ty::Predicate<'tcx> { } } -/////////////////////////////////////////////////////////////////////////// // Atomic structs // // For things that don't carry any arena-allocated data (and are @@ -332,7 +331,6 @@ CloneTypeFoldableAndLiftImpls! { ::syntax_pos::Span, } -/////////////////////////////////////////////////////////////////////////// // Lift implementations // FIXME(eddyb) replace all the uses of `Option::map` with `?`. @@ -797,7 +795,6 @@ BraceStructLiftImpl! { } } -/////////////////////////////////////////////////////////////////////////// // TypeFoldable implementations. // // Ideally, each type should invoke `folder.fold_foo(self)` and diff --git a/src/librustc/ty/subst.rs b/src/librustc/ty/subst.rs index ea829da783e9b..304ba623099df 100644 --- a/src/librustc/ty/subst.rs +++ b/src/librustc/ty/subst.rs @@ -401,7 +401,6 @@ impl<'tcx> TypeFoldable<'tcx> for SubstsRef<'tcx> { impl<'tcx> rustc_serialize::UseSpecializedDecodable for SubstsRef<'tcx> {} -/////////////////////////////////////////////////////////////////////////// // Public trait `Subst` // // Just call `foo.subst(tcx, substs)` to perform a substitution across @@ -428,7 +427,6 @@ impl<'tcx, T: TypeFoldable<'tcx>> Subst<'tcx> for T { } } -/////////////////////////////////////////////////////////////////////////// // The actual substitution engine itself is a type folder. struct SubstFolder<'a, 'tcx> { diff --git a/src/librustc_ast_borrowck/borrowck/gather_loans/lifetime.rs b/src/librustc_ast_borrowck/borrowck/gather_loans/lifetime.rs index ff7dd66793d18..037febaf18a16 100644 --- a/src/librustc_ast_borrowck/borrowck/gather_loans/lifetime.rs +++ b/src/librustc_ast_borrowck/borrowck/gather_loans/lifetime.rs @@ -26,7 +26,6 @@ pub fn guarantee_lifetime<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>, ctxt.check(cmt, None) } -/////////////////////////////////////////////////////////////////////////// // Private struct GuaranteeLifetimeContext<'a, 'tcx> { diff --git a/src/librustc_ast_borrowck/borrowck/gather_loans/restrictions.rs b/src/librustc_ast_borrowck/borrowck/gather_loans/restrictions.rs index 545c27b17bd58..24a2e5c1fa143 100644 --- a/src/librustc_ast_borrowck/borrowck/gather_loans/restrictions.rs +++ b/src/librustc_ast_borrowck/borrowck/gather_loans/restrictions.rs @@ -25,7 +25,6 @@ pub fn compute_restrictions<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>, ctxt.restrict(cmt) } -/////////////////////////////////////////////////////////////////////////// // Private struct RestrictionsContext<'a, 'tcx> { diff --git a/src/librustc_ast_borrowck/borrowck/mod.rs b/src/librustc_ast_borrowck/borrowck/mod.rs index 3bbd7ae5c352f..5bf8289c8ee5f 100644 --- a/src/librustc_ast_borrowck/borrowck/mod.rs +++ b/src/librustc_ast_borrowck/borrowck/mod.rs @@ -232,7 +232,6 @@ impl<'a, 'tcx: 'a> BorrowckCtxt<'a, 'tcx> { } } -/////////////////////////////////////////////////////////////////////////// // Loans and loan paths /// Record of a loan that was issued. @@ -421,7 +420,6 @@ pub fn opt_loan_path<'tcx>(cmt: &mc::cmt_<'tcx>) -> Option>> { opt_loan_path_is_field(cmt).0 } -/////////////////////////////////////////////////////////////////////////// // Misc impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> { diff --git a/src/librustc_codegen_ssa/meth.rs b/src/librustc_codegen_ssa/meth.rs index 7fe9f5f25130a..ab47a0c9df5f2 100644 --- a/src/librustc_codegen_ssa/meth.rs +++ b/src/librustc_codegen_ssa/meth.rs @@ -97,10 +97,8 @@ pub fn get_vtable<'tcx, Cx: CodegenMethods<'tcx>>( }); let layout = cx.layout_of(ty); - // ///////////////////////////////////////////////////////////////////////////////////////////// // If you touch this code, be sure to also make the corresponding changes to // `get_vtable` in rust_mir/interpret/traits.rs - // ///////////////////////////////////////////////////////////////////////////////////////////// let components: Vec<_> = [ cx.get_fn(Instance::resolve_drop_in_place(cx.tcx(), ty)), cx.const_usize(layout.size.bytes()), diff --git a/src/librustc_codegen_ssa/mir/mod.rs b/src/librustc_codegen_ssa/mir/mod.rs index 32bcdebc1c467..4677dc0791db4 100644 --- a/src/librustc_codegen_ssa/mir/mod.rs +++ b/src/librustc_codegen_ssa/mir/mod.rs @@ -183,8 +183,6 @@ impl<'a, 'tcx, V: CodegenObject> LocalRef<'tcx, V> { } } -/////////////////////////////////////////////////////////////////////////// - pub fn codegen_mir<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( cx: &'a Bx::CodegenCx, llfn: Bx::Value, diff --git a/src/librustc_data_structures/owning_ref/mod.rs b/src/librustc_data_structures/owning_ref/mod.rs index b835b1706b85f..bb946e3600894 100644 --- a/src/librustc_data_structures/owning_ref/mod.rs +++ b/src/librustc_data_structures/owning_ref/mod.rs @@ -314,9 +314,7 @@ pub unsafe trait IntoErasedSendSync<'a> { fn into_erased_send_sync(self) -> Self::Erased; } -///////////////////////////////////////////////////////////////////////////// // OwningRef -///////////////////////////////////////////////////////////////////////////// impl OwningRef { /// Creates a new owning reference from a owner @@ -773,9 +771,7 @@ impl OwningRefMut { } } -///////////////////////////////////////////////////////////////////////////// // OwningHandle -///////////////////////////////////////////////////////////////////////////// use std::ops::{Deref, DerefMut}; @@ -910,9 +906,7 @@ impl OwningHandle } } -///////////////////////////////////////////////////////////////////////////// // std traits -///////////////////////////////////////////////////////////////////////////// use std::convert::From; use std::fmt::{self, Debug}; @@ -1113,9 +1107,7 @@ impl Hash for OwningRefMut where T: Hash { } } -///////////////////////////////////////////////////////////////////////////// // std types integration and convenience type defs -///////////////////////////////////////////////////////////////////////////// use std::boxed::Box; use std::rc::Rc; diff --git a/src/librustc_mir/build/matches/mod.rs b/src/librustc_mir/build/matches/mod.rs index 94323b15b696f..ec830e12675e8 100644 --- a/src/librustc_mir/build/matches/mod.rs +++ b/src/librustc_mir/build/matches/mod.rs @@ -778,7 +778,6 @@ pub struct Test<'tcx> { #[derive(Copy, Clone, Debug)] pub(crate) struct ArmHasGuard(pub bool); -/////////////////////////////////////////////////////////////////////////// // Main matching algorithm impl<'a, 'tcx> Builder<'a, 'tcx> { @@ -1336,7 +1335,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { } } -/////////////////////////////////////////////////////////////////////////// // Pattern binding - used for `let` and function parameters as well. impl<'a, 'tcx> Builder<'a, 'tcx> { diff --git a/src/librustc_mir/build/mod.rs b/src/librustc_mir/build/mod.rs index 4e970aee42cf4..221c6c44d0bb6 100644 --- a/src/librustc_mir/build/mod.rs +++ b/src/librustc_mir/build/mod.rs @@ -168,7 +168,6 @@ pub fn mir_build(tcx: TyCtxt<'_>, def_id: DefId) -> Body<'_> { }) } -/////////////////////////////////////////////////////////////////////////// // BuildMir -- walks a crate, looking for fn items and methods to build MIR from fn liberated_closure_env_ty( @@ -442,7 +441,6 @@ newtype_index! { pub struct ScopeId { .. } } -/////////////////////////////////////////////////////////////////////////// /// The `BlockAnd` "monad" packages up the new basic block along with a /// produced value (sometimes just unit, of course). The `unpack!` /// macro (and methods below) makes working with `BlockAnd` much more @@ -508,7 +506,6 @@ fn should_abort_on_panic(tcx: TyCtxt<'_>, fn_def_id: DefId, abi: Abi) -> bool { } } -/////////////////////////////////////////////////////////////////////////// /// the main entry point for building MIR for a function struct ArgInfo<'tcx>(Ty<'tcx>, Option, Option<&'tcx hir::Arg>, Option); @@ -924,7 +921,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { } } -/////////////////////////////////////////////////////////////////////////// // Builder methods are broken up into modules, depending on what kind // of thing is being lowered. Note that they use the `unpack` macro // above extensively. diff --git a/src/librustc_mir/hair/mod.rs b/src/librustc_mir/hair/mod.rs index 0638cb462f73b..401be35891768 100644 --- a/src/librustc_mir/hair/mod.rs +++ b/src/librustc_mir/hair/mod.rs @@ -321,7 +321,6 @@ impl<'tcx> ExprRef<'tcx> { } } -/////////////////////////////////////////////////////////////////////////// // The Mirror trait /// "Mirroring" is the process of converting from a HIR type into one diff --git a/src/librustc_mir/interpret/eval_context.rs b/src/librustc_mir/interpret/eval_context.rs index 6f48396cdd7cf..44e08abaefe2c 100644 --- a/src/librustc_mir/interpret/eval_context.rs +++ b/src/librustc_mir/interpret/eval_context.rs @@ -49,9 +49,7 @@ pub struct InterpCx<'mir, 'tcx, M: Machine<'mir, 'tcx>> { /// A stack frame. #[derive(Clone)] pub struct Frame<'mir, 'tcx, Tag=(), Extra=()> { - //////////////////////////////////////////////////////////////////////////////// // Function and callsite information - //////////////////////////////////////////////////////////////////////////////// /// The MIR for the function called on this frame. pub body: &'mir mir::Body<'tcx>, @@ -61,9 +59,7 @@ pub struct Frame<'mir, 'tcx, Tag=(), Extra=()> { /// The span of the call site. pub span: source_map::Span, - //////////////////////////////////////////////////////////////////////////////// // Return place and locals - //////////////////////////////////////////////////////////////////////////////// /// Work to perform when returning from this function. pub return_to_block: StackPopCleanup, @@ -78,9 +74,7 @@ pub struct Frame<'mir, 'tcx, Tag=(), Extra=()> { /// can either directly contain `Scalar` or refer to some part of an `Allocation`. pub locals: IndexVec>, - //////////////////////////////////////////////////////////////////////////////// // Current position within the function - //////////////////////////////////////////////////////////////////////////////// /// The block that is currently executed (or will be executed after the above call stacks /// return). pub block: mir::BasicBlock, diff --git a/src/librustc_mir/interpret/traits.rs b/src/librustc_mir/interpret/traits.rs index a2fc75739ffa0..01514b4730b17 100644 --- a/src/librustc_mir/interpret/traits.rs +++ b/src/librustc_mir/interpret/traits.rs @@ -49,10 +49,8 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { let ptr_size = self.pointer_size(); let ptr_align = self.tcx.data_layout.pointer_align.abi; - // ///////////////////////////////////////////////////////////////////////////////////////// // If you touch this code, be sure to also make the corresponding changes to // `get_vtable` in rust_codegen_llvm/meth.rs - // ///////////////////////////////////////////////////////////////////////////////////////// let vtable = self.memory.allocate( ptr_size * (3 + methods.len() as u64), ptr_align, diff --git a/src/librustc_mir/util/liveness.rs b/src/librustc_mir/util/liveness.rs index b42eebc7ee3be..07e21696b1c5b 100644 --- a/src/librustc_mir/util/liveness.rs +++ b/src/librustc_mir/util/liveness.rs @@ -126,7 +126,6 @@ pub enum DefUse { pub fn categorize(context: PlaceContext) -> Option { match context { - /////////////////////////////////////////////////////////////////////////// // DEFS PlaceContext::MutatingUse(MutatingUseContext::Store) | @@ -147,7 +146,6 @@ pub fn categorize(context: PlaceContext) -> Option { PlaceContext::NonUse(NonUseContext::StorageLive) | PlaceContext::NonUse(NonUseContext::StorageDead) => Some(DefUse::Def), - /////////////////////////////////////////////////////////////////////////// // REGULAR USES // // These are uses that occur *outside* of a drop. For the @@ -173,7 +171,6 @@ pub fn categorize(context: PlaceContext) -> Option { PlaceContext::MutatingUse(MutatingUseContext::Retag) => Some(DefUse::Use), - /////////////////////////////////////////////////////////////////////////// // DROP USES // // These are uses that occur in a DROP (a MIR drop, not a diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs index bca77621e553e..4c8953420e487 100644 --- a/src/librustc_privacy/lib.rs +++ b/src/librustc_privacy/lib.rs @@ -33,9 +33,7 @@ use std::marker::PhantomData; mod error_codes; -//////////////////////////////////////////////////////////////////////////////// /// Generic infrastructure used to implement specific visitors below. -//////////////////////////////////////////////////////////////////////////////// /// Implemented to visit all `DefId`s in a type. /// Visiting `DefId`s is useful because visibilities and reachabilities are attached to them. @@ -345,12 +343,10 @@ fn min(vis1: ty::Visibility, vis2: ty::Visibility, tcx: TyCtxt<'_>) -> ty::Visib if vis1.is_at_least(vis2, tcx) { vis2 } else { vis1 } } -//////////////////////////////////////////////////////////////////////////////// /// Visitor used to determine if pub(restricted) is used anywhere in the crate. /// /// This is done so that `private_in_public` warnings can be turned into hard errors /// in crates that have been updated to use pub(restricted). -//////////////////////////////////////////////////////////////////////////////// struct PubRestrictedVisitor<'tcx> { tcx: TyCtxt<'tcx>, has_pub_restricted: bool, @@ -365,9 +361,7 @@ impl Visitor<'tcx> for PubRestrictedVisitor<'tcx> { } } -//////////////////////////////////////////////////////////////////////////////// /// Visitor used to determine impl visibility and reachability. -//////////////////////////////////////////////////////////////////////////////// struct FindMin<'a, 'tcx, VL: VisibilityLike> { tcx: TyCtxt<'tcx>, @@ -433,9 +427,7 @@ impl VisibilityLike for Option { } } -//////////////////////////////////////////////////////////////////////////////// /// The embargo visitor, used to determine the exports of the AST. -//////////////////////////////////////////////////////////////////////////////// struct EmbargoVisitor<'tcx> { tcx: TyCtxt<'tcx>, @@ -959,13 +951,10 @@ impl DefIdVisitor<'tcx> for ReachEverythingInTheInterfaceVisitor<'_, 'tcx> { } } -////////////////////////////////////////////////////////////////////////////////////// /// Name privacy visitor, checks privacy and reports violations. /// Most of name privacy checks are performed during the main resolution phase, /// or later in type checking when field accesses and associated items are resolved. /// This pass performs remaining checks for fields in struct expressions and patterns. -////////////////////////////////////////////////////////////////////////////////////// - struct NamePrivacyVisitor<'a, 'tcx> { tcx: TyCtxt<'tcx>, tables: &'a ty::TypeckTables<'tcx>, @@ -1087,12 +1076,9 @@ impl<'a, 'tcx> Visitor<'tcx> for NamePrivacyVisitor<'a, 'tcx> { } } -//////////////////////////////////////////////////////////////////////////////////////////// /// Type privacy visitor, checks types for privacy and reports violations. /// Both explicitly written types and inferred types of expressions and patters are checked. /// Checks are performed on "semantic" types regardless of names and their hygiene. -//////////////////////////////////////////////////////////////////////////////////////////// - struct TypePrivacyVisitor<'a, 'tcx> { tcx: TyCtxt<'tcx>, tables: &'a ty::TypeckTables<'tcx>, @@ -1324,13 +1310,10 @@ impl DefIdVisitor<'tcx> for TypePrivacyVisitor<'a, 'tcx> { } } -/////////////////////////////////////////////////////////////////////////////// /// Obsolete visitors for checking for private items in public interfaces. /// These visitors are supposed to be kept in frozen state and produce an /// "old error node set". For backward compatibility the new visitor reports /// warnings instead of hard errors when the erroneous node is not in this old set. -/////////////////////////////////////////////////////////////////////////////// - struct ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> { tcx: TyCtxt<'tcx>, access_levels: &'a AccessLevels, @@ -1668,13 +1651,10 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> { fn visit_expr(&mut self, _: &'tcx hir::Expr) {} } -/////////////////////////////////////////////////////////////////////////////// /// SearchInterfaceForPrivateItemsVisitor traverses an item's interface and /// finds any private components in it. /// PrivateItemsInPublicInterfacesVisitor ensures there are no private types /// and traits in public interfaces. -/////////////////////////////////////////////////////////////////////////////// - struct SearchInterfaceForPrivateItemsVisitor<'tcx> { tcx: TyCtxt<'tcx>, item_id: hir::HirId, diff --git a/src/librustc_typeck/check/method/confirm.rs b/src/librustc_typeck/check/method/confirm.rs index 5df0010b63eb2..2eecfbb1a01b8 100644 --- a/src/librustc_typeck/check/method/confirm.rs +++ b/src/librustc_typeck/check/method/confirm.rs @@ -138,7 +138,6 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> { ConfirmResult { callee, illegal_sized_bound } } - /////////////////////////////////////////////////////////////////////////// // ADJUSTMENTS fn adjust_self_ty(&mut self, @@ -425,7 +424,6 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> { self.register_wf_obligation(fty, self.span, traits::MiscObligation); } - /////////////////////////////////////////////////////////////////////////// // RECONCILIATION /// When we select a method with a mutable autoref, we have to go convert any @@ -572,7 +570,6 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> { } } - /////////////////////////////////////////////////////////////////////////// // MISCELLANY fn predicates_require_illegal_sized_bound(&self, diff --git a/src/librustc_typeck/check/method/probe.rs b/src/librustc_typeck/check/method/probe.rs index 1c01c8408be6c..468986a9f66e6 100644 --- a/src/librustc_typeck/check/method/probe.rs +++ b/src/librustc_typeck/check/method/probe.rs @@ -503,7 +503,6 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> { self.private_candidate = None; } - /////////////////////////////////////////////////////////////////////////// // CANDIDATE ASSEMBLY fn push_candidate(&mut self, @@ -958,7 +957,6 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> { names } - /////////////////////////////////////////////////////////////////////////// // THE ACTUAL SEARCH fn pick(mut self) -> PickResult<'tcx> { @@ -1478,7 +1476,6 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> { }) } - /////////////////////////////////////////////////////////////////////////// // MISCELLANY fn has_applicable_self(&self, item: &ty::AssocItem) -> bool { // "Fast track" -- check for usage of sugar when in method call diff --git a/src/librustc_typeck/check/regionck.rs b/src/librustc_typeck/check/regionck.rs index 3f9e662c6f412..1aa8e38269728 100644 --- a/src/librustc_typeck/check/regionck.rs +++ b/src/librustc_typeck/check/regionck.rs @@ -104,7 +104,6 @@ macro_rules! ignore_err { }; } -/////////////////////////////////////////////////////////////////////////// // PUBLIC ENTRY POINTS impl<'a, 'tcx> FnCtxt<'a, 'tcx> { @@ -188,7 +187,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } } -/////////////////////////////////////////////////////////////////////////// // INTERNALS pub struct RegionCtxt<'a, 'tcx> { diff --git a/src/librustc_typeck/check/wfcheck.rs b/src/librustc_typeck/check/wfcheck.rs index 9c6ea7d30ccf9..dc584a0fc96c7 100644 --- a/src/librustc_typeck/check/wfcheck.rs +++ b/src/librustc_typeck/check/wfcheck.rs @@ -1062,7 +1062,6 @@ impl ParItemLikeVisitor<'tcx> for CheckTypeWellFormedVisitor<'tcx> { } } -/////////////////////////////////////////////////////////////////////////// // ADT struct AdtVariant<'tcx> { diff --git a/src/librustc_typeck/check/writeback.rs b/src/librustc_typeck/check/writeback.rs index a88e32eb34dcd..2a751b2a43d66 100644 --- a/src/librustc_typeck/check/writeback.rs +++ b/src/librustc_typeck/check/writeback.rs @@ -17,7 +17,6 @@ use std::mem; use syntax::symbol::sym; use syntax_pos::Span; -/////////////////////////////////////////////////////////////////////////// // Entry point // During type inference, partially inferred types are @@ -86,7 +85,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } } -/////////////////////////////////////////////////////////////////////////// // The Writeback context. This visitor walks the AST, checking the // fn-specific tables to find references to types or regions. It // resolves those regions to remove inference variables and writes the @@ -223,7 +221,6 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> { } } -/////////////////////////////////////////////////////////////////////////// // Impl of Visitor for Resolver // // This is the master code which walks the AST. It delegates most of @@ -660,7 +657,6 @@ impl Locatable for hir::HirId { } } -/////////////////////////////////////////////////////////////////////////// // The Resolver. This is the type folding engine that detects // unresolved types and so forth. @@ -735,7 +731,6 @@ impl<'cx, 'tcx> TypeFolder<'tcx> for Resolver<'cx, 'tcx> { } } -/////////////////////////////////////////////////////////////////////////// // During type check, we store promises with the result of trait // lookup rather than the actual results (because the results are not // necessarily available immediately). These routines unwind the diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index 312a598af02bf..4c03d06495aef 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -50,7 +50,6 @@ use errors::{Applicability, DiagnosticId}; struct OnlySelfBounds(bool); -/////////////////////////////////////////////////////////////////////////// // Main entry point fn collect_mod_item_types(tcx: TyCtxt<'_>, module_def_id: DefId) { @@ -82,8 +81,6 @@ pub fn provide(providers: &mut Providers<'_>) { }; } -/////////////////////////////////////////////////////////////////////////// - /// Context specific to some particular item. This is what implements /// `AstConv`. It has information about the predicates that are defined /// on the trait. Unfortunately, this predicate information is @@ -98,8 +95,6 @@ pub struct ItemCtxt<'tcx> { item_def_id: DefId, } -/////////////////////////////////////////////////////////////////////////// - struct CollectItemTypesVisitor<'tcx> { tcx: TyCtxt<'tcx>, } @@ -154,7 +149,6 @@ impl Visitor<'tcx> for CollectItemTypesVisitor<'tcx> { } } -/////////////////////////////////////////////////////////////////////////// // Utility types and common code for the above passes. fn bad_placeholder_type(tcx: TyCtxt<'tcx>, span: Span) -> errors::DiagnosticBuilder<'tcx> { diff --git a/src/libstd/path.rs b/src/libstd/path.rs index fd6ff1032bb81..a295ba14db048 100644 --- a/src/libstd/path.rs +++ b/src/libstd/path.rs @@ -86,9 +86,7 @@ use crate::ffi::{OsStr, OsString}; use crate::sys::path::{is_sep_byte, is_verbatim_sep, MAIN_SEP_STR, parse_prefix}; -//////////////////////////////////////////////////////////////////////////////// // GENERAL NOTES -//////////////////////////////////////////////////////////////////////////////// // // Parsing in this module is done by directly transmuting OsStr to [u8] slices, // taking advantage of the fact that OsStr always encodes ASCII characters @@ -96,9 +94,7 @@ use crate::sys::path::{is_sep_byte, is_verbatim_sep, MAIN_SEP_STR, parse_prefix} // OsStr APIs for parsing, but it will take a while for those to become // available. -//////////////////////////////////////////////////////////////////////////////// // Windows Prefixes -//////////////////////////////////////////////////////////////////////////////// /// Windows path prefixes, e.g., `C:` or `\\server\share`. /// @@ -257,9 +253,7 @@ impl<'a> Prefix<'a> { } } -//////////////////////////////////////////////////////////////////////////////// // Exposed parsing helpers -//////////////////////////////////////////////////////////////////////////////// /// Determines whether the character is one of the permitted path /// separators for the current platform. @@ -283,9 +277,7 @@ pub fn is_separator(c: char) -> bool { #[stable(feature = "rust1", since = "1.0.0")] pub const MAIN_SEPARATOR: char = crate::sys::path::MAIN_SEP; -//////////////////////////////////////////////////////////////////////////////// // Misc helpers -//////////////////////////////////////////////////////////////////////////////// // Iterate through `iter` while it matches `prefix`; return `None` if `prefix` // is not a prefix of `iter`, otherwise return `Some(iter_after_prefix)` giving @@ -320,9 +312,7 @@ fn has_redox_scheme(s: &[u8]) -> bool { cfg!(target_os = "redox") && s.contains(&b':') } -//////////////////////////////////////////////////////////////////////////////// // Cross-platform, iterator-independent parsing -//////////////////////////////////////////////////////////////////////////////// /// Says whether the first byte after the prefix is a separator. fn has_physical_root(s: &[u8], prefix: Option>) -> bool { @@ -358,9 +348,7 @@ fn split_file_at_dot(file: &OsStr) -> (Option<&OsStr>, Option<&OsStr>) { } } -//////////////////////////////////////////////////////////////////////////////// // The core iterators -//////////////////////////////////////////////////////////////////////////////// /// Component parsing works by a double-ended state machine; the cursors at the /// front and back of the path each keep track of what parts of the path have @@ -1066,9 +1054,7 @@ impl<'a> Iterator for Ancestors<'a> { #[stable(feature = "path_ancestors", since = "1.28.0")] impl FusedIterator for Ancestors<'_> {} -//////////////////////////////////////////////////////////////////////////////// // Basic types and traits -//////////////////////////////////////////////////////////////////////////////// /// An owned, mutable path (akin to [`String`]). /// diff --git a/src/libstd/sync/mpsc/mod.rs b/src/libstd/sync/mpsc/mod.rs index 69ecd201063b0..40091e1762bc3 100644 --- a/src/libstd/sync/mpsc/mod.rs +++ b/src/libstd/sync/mpsc/mod.rs @@ -766,9 +766,7 @@ pub fn sync_channel(bound: usize) -> (SyncSender, Receiver) { (SyncSender::new(a.clone()), Receiver::new(Flavor::Sync(a))) } -//////////////////////////////////////////////////////////////////////////////// // Sender -//////////////////////////////////////////////////////////////////////////////// impl Sender { fn new(inner: Flavor) -> Sender { @@ -912,9 +910,7 @@ impl fmt::Debug for Sender { } } -//////////////////////////////////////////////////////////////////////////////// // SyncSender -//////////////////////////////////////////////////////////////////////////////// impl SyncSender { fn new(inner: Arc>) -> SyncSender { @@ -1042,9 +1038,7 @@ impl fmt::Debug for SyncSender { } } -//////////////////////////////////////////////////////////////////////////////// // Receiver -//////////////////////////////////////////////////////////////////////////////// impl Receiver { fn new(inner: Flavor) -> Receiver { diff --git a/src/libstd/sync/mpsc/oneshot.rs b/src/libstd/sync/mpsc/oneshot.rs index e7a5cc46b31a8..fc7a3fcef332f 100644 --- a/src/libstd/sync/mpsc/oneshot.rs +++ b/src/libstd/sync/mpsc/oneshot.rs @@ -253,9 +253,7 @@ impl Packet { } } - //////////////////////////////////////////////////////////////////////////// // select implementation - //////////////////////////////////////////////////////////////////////////// // Remove a previous selecting thread from this port. This ensures that the // blocked thread will no longer be visible to any other threads. diff --git a/src/libstd/sync/mpsc/shared.rs b/src/libstd/sync/mpsc/shared.rs index dbcdcdac93268..2a83f2859e9aa 100644 --- a/src/libstd/sync/mpsc/shared.rs +++ b/src/libstd/sync/mpsc/shared.rs @@ -395,9 +395,7 @@ impl Packet { unsafe { SignalToken::cast_from_usize(ptr) } } - //////////////////////////////////////////////////////////////////////////// // select implementation - //////////////////////////////////////////////////////////////////////////// // increment the count on the channel (used for selection) fn bump(&self, amt: isize) -> isize { diff --git a/src/libstd/sync/mpsc/stream.rs b/src/libstd/sync/mpsc/stream.rs index 4087728276179..9ac73c06f7842 100644 --- a/src/libstd/sync/mpsc/stream.rs +++ b/src/libstd/sync/mpsc/stream.rs @@ -327,9 +327,7 @@ impl Packet { // details in the sending methods that see DISCONNECTED } - //////////////////////////////////////////////////////////////////////////// // select implementation - //////////////////////////////////////////////////////////////////////////// // increment the count on the channel (used for selection) fn bump(&self, amt: isize) -> isize { diff --git a/src/libstd/sync/mpsc/sync.rs b/src/libstd/sync/mpsc/sync.rs index 58a4b716afb81..8501e49f4ef71 100644 --- a/src/libstd/sync/mpsc/sync.rs +++ b/src/libstd/sync/mpsc/sync.rs @@ -417,9 +417,7 @@ impl Drop for Packet { } -//////////////////////////////////////////////////////////////////////////////// // Buffer, a simple ring buffer backed by Vec -//////////////////////////////////////////////////////////////////////////////// impl Buffer { fn enqueue(&mut self, t: T) { @@ -441,9 +439,7 @@ impl Buffer { fn capacity(&self) -> usize { self.buf.len() } } -//////////////////////////////////////////////////////////////////////////////// // Queue, a simple queue to enqueue threads with (stack-allocated nodes) -//////////////////////////////////////////////////////////////////////////////// impl Queue { fn enqueue(&mut self, node: &mut Node) -> WaitToken { diff --git a/src/libstd/sys/cloudabi/shims/process.rs b/src/libstd/sys/cloudabi/shims/process.rs index e719b362cbf55..af6a01e93b782 100644 --- a/src/libstd/sys/cloudabi/shims/process.rs +++ b/src/libstd/sys/cloudabi/shims/process.rs @@ -6,9 +6,7 @@ use crate::sys::pipe::AnonPipe; use crate::sys::{unsupported, Void}; use crate::sys_common::process::{CommandEnv, DefaultEnvKey}; -//////////////////////////////////////////////////////////////////////////////// // Command -//////////////////////////////////////////////////////////////////////////////// pub struct Command { env: CommandEnv, diff --git a/src/libstd/sys/sgx/process.rs b/src/libstd/sys/sgx/process.rs index a02e009d95356..51cd316863271 100644 --- a/src/libstd/sys/sgx/process.rs +++ b/src/libstd/sys/sgx/process.rs @@ -6,9 +6,7 @@ use crate::sys::pipe::AnonPipe; use crate::sys::{unsupported, Void}; use crate::sys_common::process::{CommandEnv, DefaultEnvKey}; -//////////////////////////////////////////////////////////////////////////////// // Command -//////////////////////////////////////////////////////////////////////////////// pub struct Command { env: CommandEnv diff --git a/src/libstd/sys/unix/pipe.rs b/src/libstd/sys/unix/pipe.rs index 029f4216b7e57..98552c5b73753 100644 --- a/src/libstd/sys/unix/pipe.rs +++ b/src/libstd/sys/unix/pipe.rs @@ -6,9 +6,7 @@ use crate::sys::{cvt, cvt_r}; use libc::c_int; -//////////////////////////////////////////////////////////////////////////////// // Anonymous pipes -//////////////////////////////////////////////////////////////////////////////// pub struct AnonPipe(FileDesc); diff --git a/src/libstd/sys/unix/process/process_common.rs b/src/libstd/sys/unix/process/process_common.rs index 21fca23a8fe9e..6e528e7c54a4e 100644 --- a/src/libstd/sys/unix/process/process_common.rs +++ b/src/libstd/sys/unix/process/process_common.rs @@ -46,7 +46,6 @@ cfg_if::cfg_if! { //////////////////////////////////////////////////////////////////////////////// // Command -//////////////////////////////////////////////////////////////////////////////// pub struct Command { // Currently we try hard to ensure that the call to `.exec()` doesn't diff --git a/src/libstd/sys/unix/process/process_fuchsia.rs b/src/libstd/sys/unix/process/process_fuchsia.rs index 7c6be9b0a6047..b0f583bb61e5b 100644 --- a/src/libstd/sys/unix/process/process_fuchsia.rs +++ b/src/libstd/sys/unix/process/process_fuchsia.rs @@ -7,9 +7,7 @@ use crate::sys::process::process_common::*; use libc::size_t; -//////////////////////////////////////////////////////////////////////////////// // Command -//////////////////////////////////////////////////////////////////////////////// impl Command { pub fn spawn(&mut self, default: Stdio, needs_stdin: bool) @@ -96,9 +94,7 @@ impl Command { } } -//////////////////////////////////////////////////////////////////////////////// // Processes -//////////////////////////////////////////////////////////////////////////////// pub struct Process { handle: Handle, diff --git a/src/libstd/sys/unix/process/process_unix.rs b/src/libstd/sys/unix/process/process_unix.rs index a9711c71b7aa3..1c47e53d004a8 100644 --- a/src/libstd/sys/unix/process/process_unix.rs +++ b/src/libstd/sys/unix/process/process_unix.rs @@ -6,9 +6,7 @@ use crate::sys; use libc::{c_int, gid_t, pid_t, uid_t}; -//////////////////////////////////////////////////////////////////////////////// // Command -//////////////////////////////////////////////////////////////////////////////// impl Command { pub fn spawn(&mut self, default: Stdio, needs_stdin: bool) @@ -388,9 +386,7 @@ impl Command { } } -//////////////////////////////////////////////////////////////////////////////// // Processes -//////////////////////////////////////////////////////////////////////////////// /// The unique ID of the process (this should never be negative). pub struct Process { diff --git a/src/libstd/sys/vxworks/process/process_common.rs b/src/libstd/sys/vxworks/process/process_common.rs index ba797354a7380..b4e65d65066ea 100644 --- a/src/libstd/sys/vxworks/process/process_common.rs +++ b/src/libstd/sys/vxworks/process/process_common.rs @@ -12,9 +12,7 @@ use crate::collections::BTreeMap; use libc::{c_int, gid_t, uid_t, c_char, EXIT_SUCCESS, EXIT_FAILURE}; -//////////////////////////////////////////////////////////////////////////////// // Command -//////////////////////////////////////////////////////////////////////////////// pub struct Command { // Currently we try hard to ensure that the call to `.exec()` doesn't diff --git a/src/libstd/sys/vxworks/process/process_vxworks.rs b/src/libstd/sys/vxworks/process/process_vxworks.rs index b07966fa20626..08565d18ed23f 100644 --- a/src/libstd/sys/vxworks/process/process_vxworks.rs +++ b/src/libstd/sys/vxworks/process/process_vxworks.rs @@ -6,9 +6,7 @@ use crate::sys::cvt; use crate::sys::process::rtp; use crate::sys::process::process_common::*; -//////////////////////////////////////////////////////////////////////////////// // Command -//////////////////////////////////////////////////////////////////////////////// impl Command { pub fn spawn(&mut self, default: Stdio, needs_stdin: bool) @@ -100,9 +98,7 @@ impl Command { } } -//////////////////////////////////////////////////////////////////////////////// // Processes -//////////////////////////////////////////////////////////////////////////////// /// The unique id of the process (this should never be negative). pub struct Process { diff --git a/src/libstd/sys/wasi/process.rs b/src/libstd/sys/wasi/process.rs index 788b829f4bac9..aa5c7c73679a0 100644 --- a/src/libstd/sys/wasi/process.rs +++ b/src/libstd/sys/wasi/process.rs @@ -6,9 +6,7 @@ use crate::sys::pipe::AnonPipe; use crate::sys::{unsupported, Void}; use crate::sys_common::process::{CommandEnv, DefaultEnvKey}; -//////////////////////////////////////////////////////////////////////////////// // Command -//////////////////////////////////////////////////////////////////////////////// pub struct Command { env: CommandEnv diff --git a/src/libstd/sys/wasm/process.rs b/src/libstd/sys/wasm/process.rs index a02e009d95356..51cd316863271 100644 --- a/src/libstd/sys/wasm/process.rs +++ b/src/libstd/sys/wasm/process.rs @@ -6,9 +6,7 @@ use crate::sys::pipe::AnonPipe; use crate::sys::{unsupported, Void}; use crate::sys_common::process::{CommandEnv, DefaultEnvKey}; -//////////////////////////////////////////////////////////////////////////////// // Command -//////////////////////////////////////////////////////////////////////////////// pub struct Command { env: CommandEnv diff --git a/src/libstd/sys/windows/pipe.rs b/src/libstd/sys/windows/pipe.rs index 041d5385eb69b..aaa6367c288c0 100644 --- a/src/libstd/sys/windows/pipe.rs +++ b/src/libstd/sys/windows/pipe.rs @@ -13,9 +13,7 @@ use crate::sys::fs::{File, OpenOptions}; use crate::sys::handle::Handle; use crate::sys::hashmap_random_keys; -//////////////////////////////////////////////////////////////////////////////// // Anonymous pipes -//////////////////////////////////////////////////////////////////////////////// pub struct AnonPipe { inner: Handle, diff --git a/src/libstd/sys/windows/process.rs b/src/libstd/sys/windows/process.rs index 05e0ca6706453..f6a9c81598206 100644 --- a/src/libstd/sys/windows/process.rs +++ b/src/libstd/sys/windows/process.rs @@ -24,9 +24,7 @@ use crate::borrow::Borrow; use libc::{c_void, EXIT_SUCCESS, EXIT_FAILURE}; -//////////////////////////////////////////////////////////////////////////////// // Command -//////////////////////////////////////////////////////////////////////////////// #[derive(Clone, Debug, Eq, PartialEq, Ord, PartialOrd)] #[doc(hidden)] @@ -310,9 +308,7 @@ impl From for Stdio { } } -//////////////////////////////////////////////////////////////////////////////// // Processes -//////////////////////////////////////////////////////////////////////////////// /// A value representing a child process. /// diff --git a/src/libstd/sys_common/net.rs b/src/libstd/sys_common/net.rs index 391f670346f2a..270acdb5e209b 100644 --- a/src/libstd/sys_common/net.rs +++ b/src/libstd/sys_common/net.rs @@ -45,9 +45,7 @@ use libc::MSG_NOSIGNAL; target_os = "haiku")))] const MSG_NOSIGNAL: c_int = 0x0; -//////////////////////////////////////////////////////////////////////////////// // sockaddr and misc bindings -//////////////////////////////////////////////////////////////////////////////// pub fn setsockopt(sock: &Socket, opt: c_int, val: c_int, payload: T) -> io::Result<()> { @@ -114,9 +112,7 @@ fn to_ipv6mr_interface(value: u32) -> libc::c_uint { value as libc::c_uint } -//////////////////////////////////////////////////////////////////////////////// // get_host_addresses -//////////////////////////////////////////////////////////////////////////////// pub struct LookupHost { original: *mut c::addrinfo, @@ -199,9 +195,7 @@ impl<'a> TryFrom<(&'a str, u16)> for LookupHost { } } -//////////////////////////////////////////////////////////////////////////////// // TCP streams -//////////////////////////////////////////////////////////////////////////////// pub struct TcpStream { inner: Socket, @@ -345,9 +339,7 @@ impl fmt::Debug for TcpStream { } } -//////////////////////////////////////////////////////////////////////////////// // TCP listeners -//////////////////////////////////////////////////////////////////////////////// pub struct TcpListener { inner: Socket, @@ -448,9 +440,7 @@ impl fmt::Debug for TcpListener { } } -//////////////////////////////////////////////////////////////////////////////// // UDP -//////////////////////////////////////////////////////////////////////////////// pub struct UdpSocket { inner: Socket, diff --git a/src/libstd/thread/mod.rs b/src/libstd/thread/mod.rs index 764041d2f4239..08b8db03ab4b2 100644 --- a/src/libstd/thread/mod.rs +++ b/src/libstd/thread/mod.rs @@ -176,9 +176,7 @@ use crate::sys_common::thread; use crate::sys_common::{AsInner, IntoInner}; use crate::time::Duration; -//////////////////////////////////////////////////////////////////////////////// // Thread-local storage -//////////////////////////////////////////////////////////////////////////////// #[macro_use] mod local; @@ -203,9 +201,7 @@ pub use self::local::{LocalKey, AccessError}; #[unstable(feature = "libstd_thread_internals", issue = "0")] #[doc(hidden)] pub use self::local::os::Key as __OsLocalKeyInner; -//////////////////////////////////////////////////////////////////////////////// // Builder -//////////////////////////////////////////////////////////////////////////////// /// Thread factory, which can be used in order to configure the properties of /// a new thread. @@ -498,9 +494,7 @@ impl Builder { } } -//////////////////////////////////////////////////////////////////////////////// // Free functions -//////////////////////////////////////////////////////////////////////////////// /// Spawns a new thread, returning a [`JoinHandle`] for it. /// @@ -1011,9 +1005,7 @@ pub fn park_timeout(dur: Duration) { } } -//////////////////////////////////////////////////////////////////////////////// // ThreadId -//////////////////////////////////////////////////////////////////////////////// /// A unique identifier for a running thread. /// @@ -1066,9 +1058,7 @@ impl ThreadId { } } -//////////////////////////////////////////////////////////////////////////////// // Thread -//////////////////////////////////////////////////////////////////////////////// /// The internal representation of a `Thread` handle struct Inner { @@ -1266,9 +1256,7 @@ impl fmt::Debug for Thread { } } -//////////////////////////////////////////////////////////////////////////////// // JoinHandle -//////////////////////////////////////////////////////////////////////////////// /// A specialized [`Result`] type for threads. /// @@ -1482,9 +1470,7 @@ fn _assert_sync_and_send() { _assert_both::(); } -//////////////////////////////////////////////////////////////////////////////// // Tests -//////////////////////////////////////////////////////////////////////////////// #[cfg(all(test, not(target_os = "emscripten")))] mod tests { From 07dfd9aa21d6317e732c4e2e198348a0217fe3ff Mon Sep 17 00:00:00 2001 From: sd234678 Date: Fri, 9 Aug 2019 15:34:15 +0100 Subject: [PATCH 2/4] Replace comments in librustc_privacy --- src/grammar/parser-lalr.y | 10 ++++++++++ src/librustc_privacy/lib.rs | 20 ++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/src/grammar/parser-lalr.y b/src/grammar/parser-lalr.y index b57c71cfeb0d9..5585c95a5a63a 100644 --- a/src/grammar/parser-lalr.y +++ b/src/grammar/parser-lalr.y @@ -202,7 +202,9 @@ extern char *yytext; %% +//////////////////////////////////////////////////////////////////////// // Part 1: Items and attributes +//////////////////////////////////////////////////////////////////////// crate : maybe_shebang inner_attrs maybe_mod_items { mk_node("crate", 2, $2, $3); } @@ -939,7 +941,9 @@ maybe_bindings | %empty { $$ = mk_none(); } ; +//////////////////////////////////////////////////////////////////////// // Part 2: Patterns +//////////////////////////////////////////////////////////////////////// pat : UNDERSCORE { $$ = mk_atom("PatWild"); } @@ -1045,7 +1049,9 @@ pat_vec_elts | pat_vec_elts ',' pat { $$ = ext_node($1, 1, $3); } ; +//////////////////////////////////////////////////////////////////////// // Part 3: Types +//////////////////////////////////////////////////////////////////////// ty : ty_prim @@ -1260,7 +1266,9 @@ trait_ref | %prec IDENT MOD_SEP path_generic_args_without_colons { $$ = $2; } ; +//////////////////////////////////////////////////////////////////////// // Part 4: Blocks, statements, and expressions +//////////////////////////////////////////////////////////////////////// inner_attrs_and_block : '{' maybe_inner_attrs maybe_stmts '}' { $$ = mk_node("ExprBlock", 2, $2, $3); } @@ -1776,7 +1784,9 @@ let : LET pat maybe_ty_ascription maybe_init_expr ';' { $$ = mk_node("DeclLocal", 3, $2, $3, $4); } ; +//////////////////////////////////////////////////////////////////////// // Part 5: Macros and misc. rules +//////////////////////////////////////////////////////////////////////// lit : LIT_BYTE { $$ = mk_node("LitByte", 1, mk_atom(yytext)); } diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs index 4c8953420e487..bca77621e553e 100644 --- a/src/librustc_privacy/lib.rs +++ b/src/librustc_privacy/lib.rs @@ -33,7 +33,9 @@ use std::marker::PhantomData; mod error_codes; +//////////////////////////////////////////////////////////////////////////////// /// Generic infrastructure used to implement specific visitors below. +//////////////////////////////////////////////////////////////////////////////// /// Implemented to visit all `DefId`s in a type. /// Visiting `DefId`s is useful because visibilities and reachabilities are attached to them. @@ -343,10 +345,12 @@ fn min(vis1: ty::Visibility, vis2: ty::Visibility, tcx: TyCtxt<'_>) -> ty::Visib if vis1.is_at_least(vis2, tcx) { vis2 } else { vis1 } } +//////////////////////////////////////////////////////////////////////////////// /// Visitor used to determine if pub(restricted) is used anywhere in the crate. /// /// This is done so that `private_in_public` warnings can be turned into hard errors /// in crates that have been updated to use pub(restricted). +//////////////////////////////////////////////////////////////////////////////// struct PubRestrictedVisitor<'tcx> { tcx: TyCtxt<'tcx>, has_pub_restricted: bool, @@ -361,7 +365,9 @@ impl Visitor<'tcx> for PubRestrictedVisitor<'tcx> { } } +//////////////////////////////////////////////////////////////////////////////// /// Visitor used to determine impl visibility and reachability. +//////////////////////////////////////////////////////////////////////////////// struct FindMin<'a, 'tcx, VL: VisibilityLike> { tcx: TyCtxt<'tcx>, @@ -427,7 +433,9 @@ impl VisibilityLike for Option { } } +//////////////////////////////////////////////////////////////////////////////// /// The embargo visitor, used to determine the exports of the AST. +//////////////////////////////////////////////////////////////////////////////// struct EmbargoVisitor<'tcx> { tcx: TyCtxt<'tcx>, @@ -951,10 +959,13 @@ impl DefIdVisitor<'tcx> for ReachEverythingInTheInterfaceVisitor<'_, 'tcx> { } } +////////////////////////////////////////////////////////////////////////////////////// /// Name privacy visitor, checks privacy and reports violations. /// Most of name privacy checks are performed during the main resolution phase, /// or later in type checking when field accesses and associated items are resolved. /// This pass performs remaining checks for fields in struct expressions and patterns. +////////////////////////////////////////////////////////////////////////////////////// + struct NamePrivacyVisitor<'a, 'tcx> { tcx: TyCtxt<'tcx>, tables: &'a ty::TypeckTables<'tcx>, @@ -1076,9 +1087,12 @@ impl<'a, 'tcx> Visitor<'tcx> for NamePrivacyVisitor<'a, 'tcx> { } } +//////////////////////////////////////////////////////////////////////////////////////////// /// Type privacy visitor, checks types for privacy and reports violations. /// Both explicitly written types and inferred types of expressions and patters are checked. /// Checks are performed on "semantic" types regardless of names and their hygiene. +//////////////////////////////////////////////////////////////////////////////////////////// + struct TypePrivacyVisitor<'a, 'tcx> { tcx: TyCtxt<'tcx>, tables: &'a ty::TypeckTables<'tcx>, @@ -1310,10 +1324,13 @@ impl DefIdVisitor<'tcx> for TypePrivacyVisitor<'a, 'tcx> { } } +/////////////////////////////////////////////////////////////////////////////// /// Obsolete visitors for checking for private items in public interfaces. /// These visitors are supposed to be kept in frozen state and produce an /// "old error node set". For backward compatibility the new visitor reports /// warnings instead of hard errors when the erroneous node is not in this old set. +/////////////////////////////////////////////////////////////////////////////// + struct ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> { tcx: TyCtxt<'tcx>, access_levels: &'a AccessLevels, @@ -1651,10 +1668,13 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> { fn visit_expr(&mut self, _: &'tcx hir::Expr) {} } +/////////////////////////////////////////////////////////////////////////////// /// SearchInterfaceForPrivateItemsVisitor traverses an item's interface and /// finds any private components in it. /// PrivateItemsInPublicInterfacesVisitor ensures there are no private types /// and traits in public interfaces. +/////////////////////////////////////////////////////////////////////////////// + struct SearchInterfaceForPrivateItemsVisitor<'tcx> { tcx: TyCtxt<'tcx>, item_id: hir::HirId, From ff8e1b1385aecfbfedd34754fdd64fccf6de90c7 Mon Sep 17 00:00:00 2001 From: sd234678 Date: Mon, 19 Aug 2019 14:00:38 +0100 Subject: [PATCH 3/4] Reinsert some separators where separation was not obvious --- src/liballoc/slice.rs | 8 ++++++++ src/liballoc/vec.rs | 10 ++++++++++ src/libcore/any.rs | 6 ++++++ src/librustc/traits/select.rs | 2 +- src/librustc/traits/util.rs | 12 ++++++++++++ .../borrowck/gather_loans/mod.rs | 1 - src/librustc_ast_borrowck/borrowck/mod.rs | 1 - src/librustc_codegen_ssa/mir/mod.rs | 2 ++ src/librustc_mir/build/matches/mod.rs | 2 ++ src/librustc_mir/interpret/eval_context.rs | 6 ++++++ src/librustc_typeck/collect.rs | 1 + src/libstd/path.rs | 14 ++++++++++++++ src/libstd/sync/mpsc/mod.rs | 6 ++++++ src/libstd/sync/mpsc/oneshot.rs | 2 ++ src/libstd/sync/mpsc/shared.rs | 2 ++ src/libstd/sync/mpsc/stream.rs | 2 ++ src/libstd/sync/mpsc/sync.rs | 4 ++++ src/libstd/sys/cloudabi/shims/process.rs | 2 ++ src/libstd/sys/sgx/process.rs | 2 ++ src/libstd/sys/unix/pipe.rs | 2 ++ src/libstd/sys/unix/process/process_common.rs | 1 + src/libstd/sys/unix/process/process_fuchsia.rs | 4 ++++ src/libstd/sys/unix/process/process_unix.rs | 4 ++++ src/libstd/sys/vxworks/process/process_common.rs | 2 ++ src/libstd/sys/vxworks/process/process_vxworks.rs | 4 ++++ src/libstd/sys/wasi/process.rs | 2 ++ src/libstd/sys/wasm/process.rs | 2 ++ src/libstd/sys/windows/pipe.rs | 2 ++ src/libstd/sys/windows/process.rs | 4 ++++ src/libstd/thread/mod.rs | 14 ++++++++++++++ 30 files changed, 123 insertions(+), 3 deletions(-) diff --git a/src/liballoc/slice.rs b/src/liballoc/slice.rs index 4241cd3b85180..881d499c0745b 100644 --- a/src/liballoc/slice.rs +++ b/src/liballoc/slice.rs @@ -118,7 +118,9 @@ pub use core::slice::{ChunksExact, ChunksExactMut}; #[stable(feature = "rchunks", since = "1.31.0")] pub use core::slice::{RChunks, RChunksMut, RChunksExact, RChunksExactMut}; +//////////////////////////////////////////////////////////////////////////////// // Basic slice extension methods +//////////////////////////////////////////////////////////////////////////////// // HACK(japaric) needed for the implementation of `vec!` macro during testing // N.B., see the `hack` module in this file for more details. @@ -573,7 +575,9 @@ impl [u8] { } } +//////////////////////////////////////////////////////////////////////////////// // Extension traits for slices over specific kinds of data +//////////////////////////////////////////////////////////////////////////////// /// Helper trait for [`[T]::concat`](../../std/primitive.slice.html#method.concat). /// @@ -686,7 +690,9 @@ impl> Join<&[T]> for [V] { } } +//////////////////////////////////////////////////////////////////////////////// // Standard trait implementations for slices +//////////////////////////////////////////////////////////////////////////////// #[stable(feature = "rust1", since = "1.0.0")] impl Borrow<[T]> for Vec { @@ -729,7 +735,9 @@ impl ToOwned for [T] { } } +//////////////////////////////////////////////////////////////////////////////// // Sorting +//////////////////////////////////////////////////////////////////////////////// /// Inserts `v[0]` into pre-sorted sequence `v[1..]` so that whole `v[..]` becomes sorted. /// diff --git a/src/liballoc/vec.rs b/src/liballoc/vec.rs index 07dea4aa036e0..d2798955c46a9 100644 --- a/src/liballoc/vec.rs +++ b/src/liballoc/vec.rs @@ -296,7 +296,9 @@ pub struct Vec { len: usize, } +//////////////////////////////////////////////////////////////////////////////// // Inherent methods +//////////////////////////////////////////////////////////////////////////////// impl Vec { /// Constructs a new, empty `Vec`. @@ -1637,7 +1639,9 @@ impl Vec { } } +//////////////////////////////////////////////////////////////////////////////// // Internal methods and functions +//////////////////////////////////////////////////////////////////////////////// #[doc(hidden)] #[stable(feature = "rust1", since = "1.0.0")] @@ -1741,7 +1745,9 @@ unsafe impl IsZero for *mut T { } +//////////////////////////////////////////////////////////////////////////////// // Common trait implementations for Vec +//////////////////////////////////////////////////////////////////////////////// #[stable(feature = "rust1", since = "1.0.0")] impl Clone for Vec { @@ -2328,7 +2334,9 @@ impl From<&str> for Vec { } } +//////////////////////////////////////////////////////////////////////////////// // Clone-on-write +//////////////////////////////////////////////////////////////////////////////// #[stable(feature = "cow_from_vec", since = "1.8.0")] impl<'a, T: Clone> From<&'a [T]> for Cow<'a, [T]> { @@ -2358,7 +2366,9 @@ impl<'a, T> FromIterator for Cow<'a, [T]> where T: Clone { } } +//////////////////////////////////////////////////////////////////////////////// // Iterators +//////////////////////////////////////////////////////////////////////////////// /// An iterator that moves out of a vector. /// diff --git a/src/libcore/any.rs b/src/libcore/any.rs index d415c21a68d7c..e8a0a88f12a7e 100644 --- a/src/libcore/any.rs +++ b/src/libcore/any.rs @@ -64,7 +64,9 @@ use crate::fmt; use crate::intrinsics; +/////////////////////////////////////////////////////////////////////////////// // Any trait +/////////////////////////////////////////////////////////////////////////////// /// A type to emulate dynamic typing. /// @@ -99,7 +101,9 @@ impl Any for T { fn type_id(&self) -> TypeId { TypeId::of::() } } +/////////////////////////////////////////////////////////////////////////////// // Extension methods for Any trait objects. +/////////////////////////////////////////////////////////////////////////////// #[stable(feature = "rust1", since = "1.0.0")] impl fmt::Debug for dyn Any { @@ -398,7 +402,9 @@ impl dyn Any+Send+Sync { } } +/////////////////////////////////////////////////////////////////////////////// // TypeID and its methods +/////////////////////////////////////////////////////////////////////////////// /// A `TypeId` represents a globally unique identifier for a type. /// diff --git a/src/librustc/traits/select.rs b/src/librustc/traits/select.rs index d7b1029579a5b..3cc9b9efc5d51 100644 --- a/src/librustc/traits/select.rs +++ b/src/librustc/traits/select.rs @@ -600,7 +600,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { self.infcx } - // Selection + // SELECTION // // The selection phase tries to identify *how* an obligation will // be resolved. For example, it will identify which impl or diff --git a/src/librustc/traits/util.rs b/src/librustc/traits/util.rs index 83999ad131fe1..07d6f633143a2 100644 --- a/src/librustc/traits/util.rs +++ b/src/librustc/traits/util.rs @@ -76,7 +76,9 @@ impl>> Extend for PredicateSet<'tcx> { } } +/////////////////////////////////////////////////////////////////////////// // `Elaboration` iterator +/////////////////////////////////////////////////////////////////////////// /// "Elaboration" is the process of identifying all the predicates that /// are implied by a source predicate. Currently this basically means @@ -243,7 +245,9 @@ impl Iterator for Elaborator<'tcx> { } } +/////////////////////////////////////////////////////////////////////////// // Supertrait iterator +/////////////////////////////////////////////////////////////////////////// pub type Supertraits<'tcx> = FilterToTraits>; @@ -261,7 +265,9 @@ pub fn transitive_bounds<'tcx>( elaborate_trait_refs(tcx, bounds).filter_to_traits() } +/////////////////////////////////////////////////////////////////////////// // `TraitAliasExpander` iterator +/////////////////////////////////////////////////////////////////////////// /// "Trait alias expansion" is the process of expanding a sequence of trait /// references into another sequence by transitively following all trait @@ -401,7 +407,9 @@ impl<'tcx> Iterator for TraitAliasExpander<'tcx> { } } +/////////////////////////////////////////////////////////////////////////// // Iterator over def-IDs of supertraits +/////////////////////////////////////////////////////////////////////////// pub struct SupertraitDefIds<'tcx> { tcx: TyCtxt<'tcx>, @@ -434,7 +442,9 @@ impl Iterator for SupertraitDefIds<'tcx> { } } +/////////////////////////////////////////////////////////////////////////// // Other +/////////////////////////////////////////////////////////////////////////// /// A filter around an iterator of predicates that makes it yield up /// just trait references. @@ -466,7 +476,9 @@ impl<'tcx, I: Iterator>> Iterator for FilterToTraits< } } +/////////////////////////////////////////////////////////////////////////// // Other +/////////////////////////////////////////////////////////////////////////// /// Instantiate all bound parameters of the impl with the given substs, /// returning the resulting trait ref and all obligations that arise. diff --git a/src/librustc_ast_borrowck/borrowck/gather_loans/mod.rs b/src/librustc_ast_borrowck/borrowck/gather_loans/mod.rs index 16fef705ec953..c0331c78efe60 100644 --- a/src/librustc_ast_borrowck/borrowck/gather_loans/mod.rs +++ b/src/librustc_ast_borrowck/borrowck/gather_loans/mod.rs @@ -1,4 +1,3 @@ -// ---------------------------------------------------------------------- // Gathering loans // // The borrow check proceeds in two phases. In phase one, we gather the full diff --git a/src/librustc_ast_borrowck/borrowck/mod.rs b/src/librustc_ast_borrowck/borrowck/mod.rs index 5bf8289c8ee5f..8e8125d4f7716 100644 --- a/src/librustc_ast_borrowck/borrowck/mod.rs +++ b/src/librustc_ast_borrowck/borrowck/mod.rs @@ -206,7 +206,6 @@ pub fn build_borrowck_dataflow_data_for_fn<'a, 'tcx>( (bccx, dataflow_data.unwrap()) } -// ---------------------------------------------------------------------- // Type definitions pub struct BorrowckCtxt<'a, 'tcx> { diff --git a/src/librustc_codegen_ssa/mir/mod.rs b/src/librustc_codegen_ssa/mir/mod.rs index 4677dc0791db4..32bcdebc1c467 100644 --- a/src/librustc_codegen_ssa/mir/mod.rs +++ b/src/librustc_codegen_ssa/mir/mod.rs @@ -183,6 +183,8 @@ impl<'a, 'tcx, V: CodegenObject> LocalRef<'tcx, V> { } } +/////////////////////////////////////////////////////////////////////////// + pub fn codegen_mir<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>( cx: &'a Bx::CodegenCx, llfn: Bx::Value, diff --git a/src/librustc_mir/build/matches/mod.rs b/src/librustc_mir/build/matches/mod.rs index ec830e12675e8..94323b15b696f 100644 --- a/src/librustc_mir/build/matches/mod.rs +++ b/src/librustc_mir/build/matches/mod.rs @@ -778,6 +778,7 @@ pub struct Test<'tcx> { #[derive(Copy, Clone, Debug)] pub(crate) struct ArmHasGuard(pub bool); +/////////////////////////////////////////////////////////////////////////// // Main matching algorithm impl<'a, 'tcx> Builder<'a, 'tcx> { @@ -1335,6 +1336,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { } } +/////////////////////////////////////////////////////////////////////////// // Pattern binding - used for `let` and function parameters as well. impl<'a, 'tcx> Builder<'a, 'tcx> { diff --git a/src/librustc_mir/interpret/eval_context.rs b/src/librustc_mir/interpret/eval_context.rs index 44e08abaefe2c..6f48396cdd7cf 100644 --- a/src/librustc_mir/interpret/eval_context.rs +++ b/src/librustc_mir/interpret/eval_context.rs @@ -49,7 +49,9 @@ pub struct InterpCx<'mir, 'tcx, M: Machine<'mir, 'tcx>> { /// A stack frame. #[derive(Clone)] pub struct Frame<'mir, 'tcx, Tag=(), Extra=()> { + //////////////////////////////////////////////////////////////////////////////// // Function and callsite information + //////////////////////////////////////////////////////////////////////////////// /// The MIR for the function called on this frame. pub body: &'mir mir::Body<'tcx>, @@ -59,7 +61,9 @@ pub struct Frame<'mir, 'tcx, Tag=(), Extra=()> { /// The span of the call site. pub span: source_map::Span, + //////////////////////////////////////////////////////////////////////////////// // Return place and locals + //////////////////////////////////////////////////////////////////////////////// /// Work to perform when returning from this function. pub return_to_block: StackPopCleanup, @@ -74,7 +78,9 @@ pub struct Frame<'mir, 'tcx, Tag=(), Extra=()> { /// can either directly contain `Scalar` or refer to some part of an `Allocation`. pub locals: IndexVec>, + //////////////////////////////////////////////////////////////////////////////// // Current position within the function + //////////////////////////////////////////////////////////////////////////////// /// The block that is currently executed (or will be executed after the above call stacks /// return). pub block: mir::BasicBlock, diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index 4c03d06495aef..a30cfc2eb3c3e 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -149,6 +149,7 @@ impl Visitor<'tcx> for CollectItemTypesVisitor<'tcx> { } } +////////////////////////////////////////////////////// // Utility types and common code for the above passes. fn bad_placeholder_type(tcx: TyCtxt<'tcx>, span: Span) -> errors::DiagnosticBuilder<'tcx> { diff --git a/src/libstd/path.rs b/src/libstd/path.rs index a295ba14db048..fd6ff1032bb81 100644 --- a/src/libstd/path.rs +++ b/src/libstd/path.rs @@ -86,7 +86,9 @@ use crate::ffi::{OsStr, OsString}; use crate::sys::path::{is_sep_byte, is_verbatim_sep, MAIN_SEP_STR, parse_prefix}; +//////////////////////////////////////////////////////////////////////////////// // GENERAL NOTES +//////////////////////////////////////////////////////////////////////////////// // // Parsing in this module is done by directly transmuting OsStr to [u8] slices, // taking advantage of the fact that OsStr always encodes ASCII characters @@ -94,7 +96,9 @@ use crate::sys::path::{is_sep_byte, is_verbatim_sep, MAIN_SEP_STR, parse_prefix} // OsStr APIs for parsing, but it will take a while for those to become // available. +//////////////////////////////////////////////////////////////////////////////// // Windows Prefixes +//////////////////////////////////////////////////////////////////////////////// /// Windows path prefixes, e.g., `C:` or `\\server\share`. /// @@ -253,7 +257,9 @@ impl<'a> Prefix<'a> { } } +//////////////////////////////////////////////////////////////////////////////// // Exposed parsing helpers +//////////////////////////////////////////////////////////////////////////////// /// Determines whether the character is one of the permitted path /// separators for the current platform. @@ -277,7 +283,9 @@ pub fn is_separator(c: char) -> bool { #[stable(feature = "rust1", since = "1.0.0")] pub const MAIN_SEPARATOR: char = crate::sys::path::MAIN_SEP; +//////////////////////////////////////////////////////////////////////////////// // Misc helpers +//////////////////////////////////////////////////////////////////////////////// // Iterate through `iter` while it matches `prefix`; return `None` if `prefix` // is not a prefix of `iter`, otherwise return `Some(iter_after_prefix)` giving @@ -312,7 +320,9 @@ fn has_redox_scheme(s: &[u8]) -> bool { cfg!(target_os = "redox") && s.contains(&b':') } +//////////////////////////////////////////////////////////////////////////////// // Cross-platform, iterator-independent parsing +//////////////////////////////////////////////////////////////////////////////// /// Says whether the first byte after the prefix is a separator. fn has_physical_root(s: &[u8], prefix: Option>) -> bool { @@ -348,7 +358,9 @@ fn split_file_at_dot(file: &OsStr) -> (Option<&OsStr>, Option<&OsStr>) { } } +//////////////////////////////////////////////////////////////////////////////// // The core iterators +//////////////////////////////////////////////////////////////////////////////// /// Component parsing works by a double-ended state machine; the cursors at the /// front and back of the path each keep track of what parts of the path have @@ -1054,7 +1066,9 @@ impl<'a> Iterator for Ancestors<'a> { #[stable(feature = "path_ancestors", since = "1.28.0")] impl FusedIterator for Ancestors<'_> {} +//////////////////////////////////////////////////////////////////////////////// // Basic types and traits +//////////////////////////////////////////////////////////////////////////////// /// An owned, mutable path (akin to [`String`]). /// diff --git a/src/libstd/sync/mpsc/mod.rs b/src/libstd/sync/mpsc/mod.rs index 40091e1762bc3..69ecd201063b0 100644 --- a/src/libstd/sync/mpsc/mod.rs +++ b/src/libstd/sync/mpsc/mod.rs @@ -766,7 +766,9 @@ pub fn sync_channel(bound: usize) -> (SyncSender, Receiver) { (SyncSender::new(a.clone()), Receiver::new(Flavor::Sync(a))) } +//////////////////////////////////////////////////////////////////////////////// // Sender +//////////////////////////////////////////////////////////////////////////////// impl Sender { fn new(inner: Flavor) -> Sender { @@ -910,7 +912,9 @@ impl fmt::Debug for Sender { } } +//////////////////////////////////////////////////////////////////////////////// // SyncSender +//////////////////////////////////////////////////////////////////////////////// impl SyncSender { fn new(inner: Arc>) -> SyncSender { @@ -1038,7 +1042,9 @@ impl fmt::Debug for SyncSender { } } +//////////////////////////////////////////////////////////////////////////////// // Receiver +//////////////////////////////////////////////////////////////////////////////// impl Receiver { fn new(inner: Flavor) -> Receiver { diff --git a/src/libstd/sync/mpsc/oneshot.rs b/src/libstd/sync/mpsc/oneshot.rs index fc7a3fcef332f..e7a5cc46b31a8 100644 --- a/src/libstd/sync/mpsc/oneshot.rs +++ b/src/libstd/sync/mpsc/oneshot.rs @@ -253,7 +253,9 @@ impl Packet { } } + //////////////////////////////////////////////////////////////////////////// // select implementation + //////////////////////////////////////////////////////////////////////////// // Remove a previous selecting thread from this port. This ensures that the // blocked thread will no longer be visible to any other threads. diff --git a/src/libstd/sync/mpsc/shared.rs b/src/libstd/sync/mpsc/shared.rs index 2a83f2859e9aa..dbcdcdac93268 100644 --- a/src/libstd/sync/mpsc/shared.rs +++ b/src/libstd/sync/mpsc/shared.rs @@ -395,7 +395,9 @@ impl Packet { unsafe { SignalToken::cast_from_usize(ptr) } } + //////////////////////////////////////////////////////////////////////////// // select implementation + //////////////////////////////////////////////////////////////////////////// // increment the count on the channel (used for selection) fn bump(&self, amt: isize) -> isize { diff --git a/src/libstd/sync/mpsc/stream.rs b/src/libstd/sync/mpsc/stream.rs index 9ac73c06f7842..4087728276179 100644 --- a/src/libstd/sync/mpsc/stream.rs +++ b/src/libstd/sync/mpsc/stream.rs @@ -327,7 +327,9 @@ impl Packet { // details in the sending methods that see DISCONNECTED } + //////////////////////////////////////////////////////////////////////////// // select implementation + //////////////////////////////////////////////////////////////////////////// // increment the count on the channel (used for selection) fn bump(&self, amt: isize) -> isize { diff --git a/src/libstd/sync/mpsc/sync.rs b/src/libstd/sync/mpsc/sync.rs index 8501e49f4ef71..58a4b716afb81 100644 --- a/src/libstd/sync/mpsc/sync.rs +++ b/src/libstd/sync/mpsc/sync.rs @@ -417,7 +417,9 @@ impl Drop for Packet { } +//////////////////////////////////////////////////////////////////////////////// // Buffer, a simple ring buffer backed by Vec +//////////////////////////////////////////////////////////////////////////////// impl Buffer { fn enqueue(&mut self, t: T) { @@ -439,7 +441,9 @@ impl Buffer { fn capacity(&self) -> usize { self.buf.len() } } +//////////////////////////////////////////////////////////////////////////////// // Queue, a simple queue to enqueue threads with (stack-allocated nodes) +//////////////////////////////////////////////////////////////////////////////// impl Queue { fn enqueue(&mut self, node: &mut Node) -> WaitToken { diff --git a/src/libstd/sys/cloudabi/shims/process.rs b/src/libstd/sys/cloudabi/shims/process.rs index af6a01e93b782..e719b362cbf55 100644 --- a/src/libstd/sys/cloudabi/shims/process.rs +++ b/src/libstd/sys/cloudabi/shims/process.rs @@ -6,7 +6,9 @@ use crate::sys::pipe::AnonPipe; use crate::sys::{unsupported, Void}; use crate::sys_common::process::{CommandEnv, DefaultEnvKey}; +//////////////////////////////////////////////////////////////////////////////// // Command +//////////////////////////////////////////////////////////////////////////////// pub struct Command { env: CommandEnv, diff --git a/src/libstd/sys/sgx/process.rs b/src/libstd/sys/sgx/process.rs index 51cd316863271..a02e009d95356 100644 --- a/src/libstd/sys/sgx/process.rs +++ b/src/libstd/sys/sgx/process.rs @@ -6,7 +6,9 @@ use crate::sys::pipe::AnonPipe; use crate::sys::{unsupported, Void}; use crate::sys_common::process::{CommandEnv, DefaultEnvKey}; +//////////////////////////////////////////////////////////////////////////////// // Command +//////////////////////////////////////////////////////////////////////////////// pub struct Command { env: CommandEnv diff --git a/src/libstd/sys/unix/pipe.rs b/src/libstd/sys/unix/pipe.rs index 98552c5b73753..029f4216b7e57 100644 --- a/src/libstd/sys/unix/pipe.rs +++ b/src/libstd/sys/unix/pipe.rs @@ -6,7 +6,9 @@ use crate::sys::{cvt, cvt_r}; use libc::c_int; +//////////////////////////////////////////////////////////////////////////////// // Anonymous pipes +//////////////////////////////////////////////////////////////////////////////// pub struct AnonPipe(FileDesc); diff --git a/src/libstd/sys/unix/process/process_common.rs b/src/libstd/sys/unix/process/process_common.rs index 6e528e7c54a4e..21fca23a8fe9e 100644 --- a/src/libstd/sys/unix/process/process_common.rs +++ b/src/libstd/sys/unix/process/process_common.rs @@ -46,6 +46,7 @@ cfg_if::cfg_if! { //////////////////////////////////////////////////////////////////////////////// // Command +//////////////////////////////////////////////////////////////////////////////// pub struct Command { // Currently we try hard to ensure that the call to `.exec()` doesn't diff --git a/src/libstd/sys/unix/process/process_fuchsia.rs b/src/libstd/sys/unix/process/process_fuchsia.rs index b0f583bb61e5b..7c6be9b0a6047 100644 --- a/src/libstd/sys/unix/process/process_fuchsia.rs +++ b/src/libstd/sys/unix/process/process_fuchsia.rs @@ -7,7 +7,9 @@ use crate::sys::process::process_common::*; use libc::size_t; +//////////////////////////////////////////////////////////////////////////////// // Command +//////////////////////////////////////////////////////////////////////////////// impl Command { pub fn spawn(&mut self, default: Stdio, needs_stdin: bool) @@ -94,7 +96,9 @@ impl Command { } } +//////////////////////////////////////////////////////////////////////////////// // Processes +//////////////////////////////////////////////////////////////////////////////// pub struct Process { handle: Handle, diff --git a/src/libstd/sys/unix/process/process_unix.rs b/src/libstd/sys/unix/process/process_unix.rs index 1c47e53d004a8..a9711c71b7aa3 100644 --- a/src/libstd/sys/unix/process/process_unix.rs +++ b/src/libstd/sys/unix/process/process_unix.rs @@ -6,7 +6,9 @@ use crate::sys; use libc::{c_int, gid_t, pid_t, uid_t}; +//////////////////////////////////////////////////////////////////////////////// // Command +//////////////////////////////////////////////////////////////////////////////// impl Command { pub fn spawn(&mut self, default: Stdio, needs_stdin: bool) @@ -386,7 +388,9 @@ impl Command { } } +//////////////////////////////////////////////////////////////////////////////// // Processes +//////////////////////////////////////////////////////////////////////////////// /// The unique ID of the process (this should never be negative). pub struct Process { diff --git a/src/libstd/sys/vxworks/process/process_common.rs b/src/libstd/sys/vxworks/process/process_common.rs index b4e65d65066ea..ba797354a7380 100644 --- a/src/libstd/sys/vxworks/process/process_common.rs +++ b/src/libstd/sys/vxworks/process/process_common.rs @@ -12,7 +12,9 @@ use crate::collections::BTreeMap; use libc::{c_int, gid_t, uid_t, c_char, EXIT_SUCCESS, EXIT_FAILURE}; +//////////////////////////////////////////////////////////////////////////////// // Command +//////////////////////////////////////////////////////////////////////////////// pub struct Command { // Currently we try hard to ensure that the call to `.exec()` doesn't diff --git a/src/libstd/sys/vxworks/process/process_vxworks.rs b/src/libstd/sys/vxworks/process/process_vxworks.rs index 08565d18ed23f..b07966fa20626 100644 --- a/src/libstd/sys/vxworks/process/process_vxworks.rs +++ b/src/libstd/sys/vxworks/process/process_vxworks.rs @@ -6,7 +6,9 @@ use crate::sys::cvt; use crate::sys::process::rtp; use crate::sys::process::process_common::*; +//////////////////////////////////////////////////////////////////////////////// // Command +//////////////////////////////////////////////////////////////////////////////// impl Command { pub fn spawn(&mut self, default: Stdio, needs_stdin: bool) @@ -98,7 +100,9 @@ impl Command { } } +//////////////////////////////////////////////////////////////////////////////// // Processes +//////////////////////////////////////////////////////////////////////////////// /// The unique id of the process (this should never be negative). pub struct Process { diff --git a/src/libstd/sys/wasi/process.rs b/src/libstd/sys/wasi/process.rs index aa5c7c73679a0..788b829f4bac9 100644 --- a/src/libstd/sys/wasi/process.rs +++ b/src/libstd/sys/wasi/process.rs @@ -6,7 +6,9 @@ use crate::sys::pipe::AnonPipe; use crate::sys::{unsupported, Void}; use crate::sys_common::process::{CommandEnv, DefaultEnvKey}; +//////////////////////////////////////////////////////////////////////////////// // Command +//////////////////////////////////////////////////////////////////////////////// pub struct Command { env: CommandEnv diff --git a/src/libstd/sys/wasm/process.rs b/src/libstd/sys/wasm/process.rs index 51cd316863271..a02e009d95356 100644 --- a/src/libstd/sys/wasm/process.rs +++ b/src/libstd/sys/wasm/process.rs @@ -6,7 +6,9 @@ use crate::sys::pipe::AnonPipe; use crate::sys::{unsupported, Void}; use crate::sys_common::process::{CommandEnv, DefaultEnvKey}; +//////////////////////////////////////////////////////////////////////////////// // Command +//////////////////////////////////////////////////////////////////////////////// pub struct Command { env: CommandEnv diff --git a/src/libstd/sys/windows/pipe.rs b/src/libstd/sys/windows/pipe.rs index aaa6367c288c0..041d5385eb69b 100644 --- a/src/libstd/sys/windows/pipe.rs +++ b/src/libstd/sys/windows/pipe.rs @@ -13,7 +13,9 @@ use crate::sys::fs::{File, OpenOptions}; use crate::sys::handle::Handle; use crate::sys::hashmap_random_keys; +//////////////////////////////////////////////////////////////////////////////// // Anonymous pipes +//////////////////////////////////////////////////////////////////////////////// pub struct AnonPipe { inner: Handle, diff --git a/src/libstd/sys/windows/process.rs b/src/libstd/sys/windows/process.rs index f6a9c81598206..05e0ca6706453 100644 --- a/src/libstd/sys/windows/process.rs +++ b/src/libstd/sys/windows/process.rs @@ -24,7 +24,9 @@ use crate::borrow::Borrow; use libc::{c_void, EXIT_SUCCESS, EXIT_FAILURE}; +//////////////////////////////////////////////////////////////////////////////// // Command +//////////////////////////////////////////////////////////////////////////////// #[derive(Clone, Debug, Eq, PartialEq, Ord, PartialOrd)] #[doc(hidden)] @@ -308,7 +310,9 @@ impl From for Stdio { } } +//////////////////////////////////////////////////////////////////////////////// // Processes +//////////////////////////////////////////////////////////////////////////////// /// A value representing a child process. /// diff --git a/src/libstd/thread/mod.rs b/src/libstd/thread/mod.rs index 08b8db03ab4b2..764041d2f4239 100644 --- a/src/libstd/thread/mod.rs +++ b/src/libstd/thread/mod.rs @@ -176,7 +176,9 @@ use crate::sys_common::thread; use crate::sys_common::{AsInner, IntoInner}; use crate::time::Duration; +//////////////////////////////////////////////////////////////////////////////// // Thread-local storage +//////////////////////////////////////////////////////////////////////////////// #[macro_use] mod local; @@ -201,7 +203,9 @@ pub use self::local::{LocalKey, AccessError}; #[unstable(feature = "libstd_thread_internals", issue = "0")] #[doc(hidden)] pub use self::local::os::Key as __OsLocalKeyInner; +//////////////////////////////////////////////////////////////////////////////// // Builder +//////////////////////////////////////////////////////////////////////////////// /// Thread factory, which can be used in order to configure the properties of /// a new thread. @@ -494,7 +498,9 @@ impl Builder { } } +//////////////////////////////////////////////////////////////////////////////// // Free functions +//////////////////////////////////////////////////////////////////////////////// /// Spawns a new thread, returning a [`JoinHandle`] for it. /// @@ -1005,7 +1011,9 @@ pub fn park_timeout(dur: Duration) { } } +//////////////////////////////////////////////////////////////////////////////// // ThreadId +//////////////////////////////////////////////////////////////////////////////// /// A unique identifier for a running thread. /// @@ -1058,7 +1066,9 @@ impl ThreadId { } } +//////////////////////////////////////////////////////////////////////////////// // Thread +//////////////////////////////////////////////////////////////////////////////// /// The internal representation of a `Thread` handle struct Inner { @@ -1256,7 +1266,9 @@ impl fmt::Debug for Thread { } } +//////////////////////////////////////////////////////////////////////////////// // JoinHandle +//////////////////////////////////////////////////////////////////////////////// /// A specialized [`Result`] type for threads. /// @@ -1470,7 +1482,9 @@ fn _assert_sync_and_send() { _assert_both::(); } +//////////////////////////////////////////////////////////////////////////////// // Tests +//////////////////////////////////////////////////////////////////////////////// #[cfg(all(test, not(target_os = "emscripten")))] mod tests { From c89d9c7c9ae9c398878b4af1ec119a4f46c754bb Mon Sep 17 00:00:00 2001 From: sd234678 Date: Mon, 19 Aug 2019 14:22:31 +0100 Subject: [PATCH 4/4] Remove some decorators with dashes where they seem to add no value --- src/librustc_ast_borrowck/borrowck/check_loans.rs | 1 - src/librustc_data_structures/indexed_vec.rs | 4 ++-- src/librustc_resolve/resolve_imports.rs | 4 ++-- src/libserialize/opaque.rs | 4 ---- 4 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/librustc_ast_borrowck/borrowck/check_loans.rs b/src/librustc_ast_borrowck/borrowck/check_loans.rs index 3d824ee6ce1e8..1fdc2833f7b8f 100644 --- a/src/librustc_ast_borrowck/borrowck/check_loans.rs +++ b/src/librustc_ast_borrowck/borrowck/check_loans.rs @@ -1,4 +1,3 @@ -// ---------------------------------------------------------------------- // Checking loans // // Phase 2 of check: we walk down the tree and check that: diff --git a/src/librustc_data_structures/indexed_vec.rs b/src/librustc_data_structures/indexed_vec.rs index 6f40d059be27f..1d877f0088976 100644 --- a/src/librustc_data_structures/indexed_vec.rs +++ b/src/librustc_data_structures/indexed_vec.rs @@ -59,7 +59,7 @@ impl Idx for u32 { #[macro_export] #[allow_internal_unstable(step_trait, rustc_attrs)] macro_rules! newtype_index { - // ---- public rules ---- + // public rules // Use default constants ($(#[$attrs:meta])* $v:vis struct $name:ident { .. }) => ( @@ -86,7 +86,7 @@ macro_rules! newtype_index { $($tokens)+); ); - // ---- private rules ---- + // private rules // Base case, user-defined constants (if any) have already been defined (@derives [$($derives:ident,)*] diff --git a/src/librustc_resolve/resolve_imports.rs b/src/librustc_resolve/resolve_imports.rs index fd222a132a3f8..aac8f70e53c62 100644 --- a/src/librustc_resolve/resolve_imports.rs +++ b/src/librustc_resolve/resolve_imports.rs @@ -312,7 +312,7 @@ impl<'a> Resolver<'a> { } } - // --- From now on we either have a glob resolution or no resolution. --- + // From now on we either have a glob resolution or no resolution. // Check if one of single imports can still define the name, // if it can then our result is not determined and can be invalidated. @@ -357,7 +357,7 @@ impl<'a> Resolver<'a> { } } - // --- From now on we have no resolution. --- + // From now on we have no resolution. // Now we are in situation when new item/import can appear only from a glob or a macro // expansion. With restricted shadowing names from globs and macro expansions cannot diff --git a/src/libserialize/opaque.rs b/src/libserialize/opaque.rs index 75988198eb9b5..a599b31b167c8 100644 --- a/src/libserialize/opaque.rs +++ b/src/libserialize/opaque.rs @@ -2,9 +2,7 @@ use crate::leb128::{self, read_signed_leb128, write_signed_leb128}; use crate::serialize; use std::borrow::Cow; -// ----------------------------------------------------------------------------- // Encoder -// ----------------------------------------------------------------------------- pub type EncodeResult = Result<(), !>; @@ -152,9 +150,7 @@ impl Encoder { } } -// ----------------------------------------------------------------------------- // Decoder -// ----------------------------------------------------------------------------- pub struct Decoder<'a> { pub data: &'a [u8],