forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create a FreshFloatTy separate from FreshIntTy
There is no subtyping relationship between the types (or their non-freshened variants), so they can not be merged. Fixes rust-lang#22645 Fixes rust-lang#24352 Fixes rust-lang#23825 Should fix rust-lang#25235 (no test in issue). Should fix rust-lang#19976 (test is outdated).
- Loading branch information
Ariel Ben-Yehuda
committed
May 12, 2015
1 parent
2a5a320
commit 36eb09f
Showing
8 changed files
with
90 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
use std::ops::Add; | ||
|
||
trait Scalar {} | ||
impl Scalar for f64 {} | ||
|
||
struct Bob; | ||
|
||
impl<RHS: Scalar> Add <RHS> for Bob { | ||
type Output = Bob; | ||
fn add(self, rhs : RHS) -> Bob {} | ||
} | ||
|
||
fn main() { | ||
let b = Bob + 3.5; | ||
b + 3 //~ ERROR: is not implemented | ||
//~^ ERROR: is not implemented | ||
//~^^ ERROR: is not implemented | ||
//~^^^ ERROR: mismatched types | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
fn main() { | ||
1.0f64 - 1.0; | ||
1.0f64 - 1 //~ ERROR: is not implemented | ||
//~^ ERROR: is not implemented | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
trait Stringify { | ||
fn to_string(&self) -> String; | ||
} | ||
|
||
impl Stringify for u32 { | ||
fn to_string(&self) -> String { format!("u32: {}", *self) } | ||
} | ||
|
||
impl Stringify for f32 { | ||
fn to_string(&self) -> String { format!("f32: {}", *self) } | ||
} | ||
|
||
fn print<T: Stringify>(x: T) -> String { | ||
x.to_string() | ||
} | ||
|
||
fn main() { | ||
assert_eq!(&print(5), "u32: 5"); | ||
assert_eq!(&print(5.0), "f32: 5"); | ||
} |