Skip to content

A strange processing methods visibility #22684

Closed
@bozaro

Description

@bozaro

rustc 1.0.0-nightly (2b01a37 2015-02-21) (built 2015-02-22)

I create file with content:

use std::hash::SipHasher;
use std::hash::Hasher;

fn main() {
}

fn compile_fail() {
    let hasher = SipHasher::new();
    hasher.write(&[0, 1, 2]);
}

fn compile_work() {
    let sip_hasher = SipHasher::new();
    let hasher: &mut Hasher = &mut sip_hasher;
    hasher.write(&[0, 1, 2]);
}

And have compilation errors:

private.rs:9:2: 9:26 error: method `write` is private
private.rs:9    hasher.write(&[0, 1, 2]);
                ^~~~~~~~~~~~~~~~~~~~~~~~
error: aborting due to previous error

I do not understand what is happening due to this error, because this cast is essentially doing nothing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-type-systemArea: Type systemP-mediumMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.T-langRelevant to the language team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions