Skip to content

Remove MethodMatchResult and MethodMatchedData. #41320

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

Merged
merged 1 commit into from
Apr 16, 2017
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 0 additions & 2 deletions src/librustc/traits/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ pub use self::project::{ProjectionCache, ProjectionCacheSnapshot, Reveal};
pub use self::object_safety::ObjectSafetyViolation;
pub use self::object_safety::MethodViolationCode;
pub use self::select::{EvaluationCache, SelectionContext, SelectionCache};
pub use self::select::{MethodMatchResult, MethodMatched, MethodAmbiguous, MethodDidNotMatch};
pub use self::select::{MethodMatchedData}; // intentionally don't export variants
pub use self::specialize::{OverlapError, specialization_graph, specializes, translate_substs};
pub use self::specialize::{SpecializesCache, find_associated_item};
pub use self::util::elaborate_predicates;
Expand Down
29 changes: 0 additions & 29 deletions src/librustc/traits/select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

//! See `README.md` for high-level documentation

pub use self::MethodMatchResult::*;
pub use self::MethodMatchedData::*;
use self::SelectionCandidate::*;
use self::EvaluationResult::*;

Expand Down Expand Up @@ -110,23 +108,6 @@ pub struct SelectionCache<'tcx> {
SelectionResult<'tcx, SelectionCandidate<'tcx>>>>,
}

pub enum MethodMatchResult {
MethodMatched(MethodMatchedData),
MethodAmbiguous(/* list of impls that could apply */ Vec<DefId>),
MethodDidNotMatch,
}

#[derive(Copy, Clone, Debug)]
pub enum MethodMatchedData {
// In the case of a precise match, we don't really need to store
// how the match was found. So don't.
PreciseMethodMatch,

// In the case of a coercion, we need to know the precise impl so
// that we can determine the type to which things were coerced.
CoerciveMethodMatch(/* impl we matched */ DefId)
}

/// The selection process begins by considering all impls, where
/// clauses, and so forth that might resolve an obligation. Sometimes
/// we'll be able to say definitively that (e.g.) an impl does not
Expand Down Expand Up @@ -2982,13 +2963,3 @@ impl EvaluationResult {
}
}
}

impl MethodMatchResult {
pub fn may_apply(&self) -> bool {
match *self {
MethodMatched(_) => true,
MethodAmbiguous(_) => true,
MethodDidNotMatch => false,
}
}
}