Skip to content
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
1 change: 1 addition & 0 deletions library/core/src/str/indices.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
///! A module for working with iterators and string slices.
use crate::iter::FusedIterator;
use crate::str::Chars;

Expand Down
4 changes: 0 additions & 4 deletions library/core/src/str/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,13 @@ use crate::ops::Try;
use crate::option;
use crate::slice::{self, SliceIndex, Split as SliceSplit};

#[allow(missing_docs)]
#[stable(feature = "rust1", since = "1.0.0")]
pub mod utf8;

#[allow(missing_docs)]
#[stable(feature = "rust1", since = "1.0.0")]
pub mod indices;

#[stable(feature = "rust1", since = "1.0.0")]
pub use indices::CharIndices;
#[stable(feature = "rust1", since = "1.0.0")]
pub use utf8::Utf8Error;

pub mod pattern;
Expand Down
3 changes: 2 additions & 1 deletion library/core/src/str/utf8.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
///! A module for working with Utf8 errors

/// Errors which can occur when attempting to interpret a sequence of [`u8`]
/// as a string.
///
Expand Down Expand Up @@ -37,7 +39,6 @@
/// }
/// }
/// ```

#[derive(Copy, Eq, PartialEq, Clone, Debug)]
#[stable(feature = "rust1", since = "1.0.0")]
pub struct Utf8Error {
Expand Down
30 changes: 0 additions & 30 deletions src/librustc_resolve/binding_error.rs

This file was deleted.

5 changes: 3 additions & 2 deletions src/librustc_resolve/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@ 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::{
BindingError, CrateLint, HasGenericParams, MacroRulesScope, Module, ModuleOrUniformRoot,
};
use crate::{NameBinding, NameBindingKind, PrivacyError, VisResolutionError};
use crate::{ParentScope, PathResult, ResolutionError, Resolver, Scope, ScopeSet, Segment};

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

use RibKind::*;

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

Expand Down
31 changes: 27 additions & 4 deletions src/librustc_resolve/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ use rustc_span::{Span, DUMMY_SP};

use std::cell::{Cell, RefCell};
use std::collections::BTreeSet;
use std::{fmt, iter, ptr};
use std::{cmp, fmt, iter, ptr};
use tracing::debug;

use diagnostics::{extend_span_to_previous_binding, find_span_of_binding_until_next_binding};
Expand All @@ -67,7 +67,6 @@ use macros::{MacroRulesBinding, MacroRulesScope};

type Res = def::Res<NodeId>;

mod binding_error;
mod build_reduced_graph;
mod check_unused;
mod def_collector;
Expand All @@ -76,8 +75,6 @@ mod imports;
mod late;
mod macros;

use binding_error::BindingError;

enum Weak {
Yes,
No,
Expand Down Expand Up @@ -152,6 +149,32 @@ impl<'a> ParentScope<'a> {
}
}

#[derive(Eq)]
struct BindingError {
name: Symbol,
origin: BTreeSet<Span>,
target: BTreeSet<Span>,
could_be_path: bool,
}

impl PartialOrd for BindingError {
fn partial_cmp(&self, other: &BindingError) -> Option<cmp::Ordering> {
Some(self.cmp(other))
}
}

impl PartialEq for BindingError {
fn eq(&self, other: &BindingError) -> bool {
self.name == other.name
}
}

impl Ord for BindingError {
fn cmp(&self, other: &BindingError) -> cmp::Ordering {
self.name.cmp(&other.name)
}
}

enum ResolutionError<'a> {
/// Error E0401: can't use type or const parameters from outer function.
GenericParamsFromOuterFunction(Res, HasGenericParams),
Expand Down