Skip to content

Split up files with // ignore-tidy-filelength #75701

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions library/alloc/src/vec.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// ignore-tidy-filelength

//! A contiguous growable array type with heap-allocated contents, written
//! `Vec<T>`.
//!
Expand Down Expand Up @@ -75,9 +77,9 @@ use crate::boxed::Box;
use crate::collections::TryReserveError;
use crate::raw_vec::RawVec;

#[stable(feature="drain", since="1.6.0")]
#[stable(feature = "drain", since = "1.6.0")]
mod drain;
#[stable(feature="drain", since="1.6.0")]
#[stable(feature = "drain", since = "1.6.0")]
pub use drain::Drain;

/// A contiguous growable array type, written `Vec<T>` but pronounced 'vector'.
Expand Down
5 changes: 3 additions & 2 deletions library/alloc/src/vec/drain.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
use core::slice;
use core::fmt;
use core::iter::{FusedIterator, TrustedLen};
use core::mem::{self};
use core::ptr::{self, NonNull};
use core::slice;

use crate::vec::Vec;

/// A draining iterator for `Vec<T>`.
///
/// This `struct` is created by [`Vec::drain`].
Expand Down Expand Up @@ -131,4 +132,4 @@ impl<T> ExactSizeIterator for Drain<'_, T> {
unsafe impl<T> TrustedLen for Drain<'_, T> {}

#[stable(feature = "fused", since = "1.26.0")]
impl<T> FusedIterator for Drain<'_, T> {}
impl<T> FusedIterator for Drain<'_, T> {}
2 changes: 1 addition & 1 deletion library/core/src/str/indices.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,4 @@ impl<'a> CharIndices<'a> {
pub fn as_str(&self) -> &'a str {
self.iter.as_str()
}
}
}
42 changes: 0 additions & 42 deletions library/core/src/str/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,46 +173,6 @@ impl fmt::Display for ParseBoolError {
Section: Creating a string
*/

/// Errors which can occur when attempting to interpret a sequence of [`u8`]
/// as a string.
///
/// As such, the `from_utf8` family of functions and methods for both [`String`]s
/// and [`&str`]s make use of this error, for example.
///
/// [`String`]: ../../std/string/struct.String.html#method.from_utf8
/// [`&str`]: from_utf8
///
/// # Examples
///
/// This error type’s methods can be used to create functionality
/// similar to `String::from_utf8_lossy` without allocating heap memory:
///
/// ```
/// fn from_utf8_lossy<F>(mut input: &[u8], mut push: F) where F: FnMut(&str) {
/// loop {
/// match std::str::from_utf8(input) {
/// Ok(valid) => {
/// push(valid);
/// break
/// }
/// Err(error) => {
/// let (valid, after_valid) = input.split_at(error.valid_up_to());
/// unsafe {
/// push(std::str::from_utf8_unchecked(valid))
/// }
/// push("\u{FFFD}");
///
/// if let Some(invalid_sequence_length) = error.error_len() {
/// input = &after_valid[invalid_sequence_length..]
/// } else {
/// break
/// }
/// }
/// }
/// }
/// }
/// ```

/// Converts a slice of bytes to a string slice.
///
/// A string slice ([`&str`]) is made of bytes ([`u8`]), and a byte slice
Expand Down Expand Up @@ -625,8 +585,6 @@ impl<'a> Chars<'a> {
}
}



/// An iterator over the bytes of a string slice.
///
/// This struct is created by the [`bytes`] method on [`str`].
Expand Down
42 changes: 41 additions & 1 deletion library/core/src/str/utf8.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,43 @@
/// Errors which can occur when attempting to interpret a sequence of [`u8`]
/// as a string.
///
/// As such, the `from_utf8` family of functions and methods for both [`String`]s
/// and [`&str`]s make use of this error, for example.
///
/// [`String`]: ../../std/string/struct.String.html#method.from_utf8
/// [`&str`]: from_utf8
///
/// # Examples
///
/// This error type’s methods can be used to create functionality
/// similar to `String::from_utf8_lossy` without allocating heap memory:
///
/// ```
/// fn from_utf8_lossy<F>(mut input: &[u8], mut push: F) where F: FnMut(&str) {
/// loop {
/// match std::str::from_utf8(input) {
/// Ok(valid) => {
/// push(valid);
/// break
/// }
/// Err(error) => {
/// let (valid, after_valid) = input.split_at(error.valid_up_to());
/// unsafe {
/// push(std::str::from_utf8_unchecked(valid))
/// }
/// push("\u{FFFD}");
///
/// if let Some(invalid_sequence_length) = error.error_len() {
/// input = &after_valid[invalid_sequence_length..]
/// } else {
/// break
/// }
/// }
/// }
/// }
/// }
/// ```

#[derive(Copy, Eq, PartialEq, Clone, Debug)]
#[stable(feature = "rust1", since = "1.0.0")]
pub struct Utf8Error {
Expand Down Expand Up @@ -52,4 +92,4 @@ impl Utf8Error {
pub fn error_len(&self) -> Option<usize> {
self.error_len.map(|len| len as usize)
}
}
}
8 changes: 4 additions & 4 deletions src/librustc_resolve/binding_error.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::collections::BTreeSet;
use std::cmp;
use rustc_span::Span;
use rustc_span::symbol::Symbol;
use rustc_span::Span;
use std::cmp;
use std::collections::BTreeSet;

#[derive(Eq)]
pub struct BindingError {
Expand All @@ -27,4 +27,4 @@ impl Ord for BindingError {
fn cmp(&self, other: &BindingError) -> cmp::Ordering {
self.name.cmp(&other.name)
}
}
}
6 changes: 2 additions & 4 deletions src/librustc_resolve/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,11 @@ use rustc_span::symbol::{kw, sym, Ident, Symbol};
use rustc_span::{BytePos, MultiSpan, Span};
use tracing::debug;

use crate::binding_error::BindingError;
use crate::imports::{Import, ImportKind, ImportResolver};
use crate::path_names_to_string;
use crate::{AmbiguityError, AmbiguityErrorMisc, AmbiguityKind};
use crate::{
CrateLint, HasGenericParams, MacroRulesScope, Module, ModuleOrUniformRoot,
};
use crate::binding_error::BindingError;
use crate::{CrateLint, HasGenericParams, MacroRulesScope, Module, ModuleOrUniformRoot};
use crate::{NameBinding, NameBindingKind, PrivacyError, VisResolutionError};
use crate::{ParentScope, PathResult, ResolutionError, Resolver, Scope, ScopeSet, Segment};

Expand Down
2 changes: 1 addition & 1 deletion src/librustc_resolve/late.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

use RibKind::*;

use crate::{path_names_to_string, CrateLint, LexicalScopeBinding};
use crate::binding_error::BindingError;
use crate::{path_names_to_string, CrateLint, LexicalScopeBinding};
use crate::{Module, ModuleOrUniformRoot, NameBindingKind, ParentScope, PathResult};
use crate::{ResolutionError, Resolver, Segment, UseError};

Expand Down
2 changes: 1 addition & 1 deletion src/librustc_resolve/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,14 @@ use macros::{MacroRulesBinding, MacroRulesScope};

type Res = def::Res<NodeId>;

mod binding_error;
mod build_reduced_graph;
mod check_unused;
mod def_collector;
mod diagnostics;
mod imports;
mod late;
mod macros;
mod binding_error;

use binding_error::BindingError;

Expand Down