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..3cc9b9efc5d51 100644 --- a/src/librustc/traits/select.rs +++ b/src/librustc/traits/select.rs @@ -600,8 +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 @@ -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/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/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_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/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/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..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> { @@ -232,7 +231,6 @@ impl<'a, 'tcx: 'a> BorrowckCtxt<'a, 'tcx> { } } -/////////////////////////////////////////////////////////////////////////// // Loans and loan paths /// Record of a loan that was issued. @@ -421,7 +419,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_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_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/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/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_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/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..a30cfc2eb3c3e 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,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/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], 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,