Don't allow newtype structs to be dereferenced. #6246

This commit is contained in:
Brian Anderson
2013-11-01 18:06:31 -07:00
parent 18cef3fad4
commit 3b1862a82f
78 changed files with 594 additions and 674 deletions

View File

@@ -4042,7 +4042,8 @@ mod bench {
struct NotAscii(char);
impl CharEq for NotAscii {
fn matches(&self, c: char) -> bool {
**self == c
let NotAscii(cc) = *self;
cc == c
}
fn only_ascii(&self) -> bool { false }
}
@@ -4065,7 +4066,10 @@ mod bench {
struct NotAscii(char);
impl CharEq for NotAscii {
#[inline]
fn matches(&self, c: char) -> bool { **self == c }
fn matches(&self, c: char) -> bool {
let NotAscii(cc) = *self;
cc == c
}
fn only_ascii(&self) -> bool { false }
}
let s = "Mary had a little lamb, Little lamb, little-lamb.";