Skip to content

Commit 5a20f84

Browse files
committed
---
yaml --- r: 63131 b: refs/heads/snap-stage3 c: fe3ad0a h: refs/heads/master i: 63129: 65175ab 63127: 849790a v: v3
1 parent f7e539e commit 5a20f84

File tree

13 files changed

+71
-193
lines changed

13 files changed

+71
-193
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 2d28d645422c1617be58c8ca7ad9a457264ca850
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 53b83525521960b4ae6f9dc90b82429013346708
4+
refs/heads/snap-stage3: fe3ad0a204656b43ecec7605161603d2943b0582
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/libextra/arc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ impl Drop for PoisonOnFail {
263263

264264
fn PoisonOnFail<'r>(failed: &'r mut bool) -> PoisonOnFail {
265265
PoisonOnFail {
266-
failed: ptr::to_mut_unsafe_ptr(failed)
266+
failed: failed
267267
}
268268
}
269269

branches/snap-stage3/src/librustc/lib/llvm.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2117,8 +2117,7 @@ pub fn struct_tys(struct_ty: TypeRef) -> ~[TypeRef] {
21172117
return ~[];
21182118
}
21192119
let mut elts = vec::from_elem(n_elts, ptr::null());
2120-
llvm::LLVMGetStructElementTypes(
2121-
struct_ty, ptr::to_mut_unsafe_ptr(&mut elts[0]));
2120+
llvm::LLVMGetStructElementTypes(struct_ty, &mut elts[0]);
21222121
return elts;
21232122
}
21242123
}

branches/snap-stage3/src/librustc/middle/trans/cabi_mips.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ fn struct_tys(ty: TypeRef) -> ~[TypeRef] {
3838
return ~[];
3939
}
4040
let mut elts = vec::from_elem(n as uint, ptr::null());
41-
llvm::LLVMGetStructElementTypes(ty,
42-
ptr::to_mut_unsafe_ptr(&mut elts[0]));
41+
llvm::LLVMGetStructElementTypes(ty, &mut elts[0]);
4342
return elts;
4443
}
4544
}

branches/snap-stage3/src/librustc/middle/trans/common.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -964,9 +964,7 @@ pub fn T_tydesc_field(cx: @CrateContext, field: uint) -> TypeRef {
964964
let mut tydesc_elts: ~[TypeRef] =
965965
vec::from_elem::<TypeRef>(abi::n_tydesc_fields,
966966
T_nil());
967-
llvm::LLVMGetStructElementTypes(
968-
cx.tydesc_type,
969-
ptr::to_mut_unsafe_ptr(&mut tydesc_elts[0]));
967+
llvm::LLVMGetStructElementTypes(cx.tydesc_type, &mut tydesc_elts[0]);
970968
let t = llvm::LLVMGetElementType(tydesc_elts[field]);
971969
return t;
972970
}

branches/snap-stage3/src/librustpkg/package_id.rs

Lines changed: 60 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ pub use package_path::{RemotePath, LocalPath, normalize, hash};
1212
use extra::semver;
1313
use core::prelude::*;
1414
use core::result;
15-
use core::prelude::*;
16-
use version::{default_version, try_getting_version, Version};
15+
16+
/// Placeholder
17+
pub fn default_version() -> Version { ExactRevision(0.1) }
1718

1819
/// Path-fragment identifier of a package such as
1920
/// 'github.com/graydon/test'; path must be a relative
@@ -48,17 +49,11 @@ impl PkgId {
4849
let remote_path = RemotePath(p);
4950
let local_path = normalize(copy remote_path);
5051
let short_name = (copy local_path).filestem().expect(fmt!("Strange path! %s", s));
51-
52-
let version = match try_getting_version(remote_path) {
53-
Some(v) => v,
54-
None => default_version()
55-
};
56-
5752
PkgId {
5853
local_path: local_path,
5954
remote_path: remote_path,
6055
short_name: short_name,
61-
version: version
56+
version: default_version()
6257
}
6358
}
6459

@@ -79,3 +74,59 @@ impl ToStr for PkgId {
7974
fmt!("%s-%s", self.local_path.to_str(), self.version.to_str())
8075
}
8176
}
77+
78+
/// A version is either an exact revision,
79+
/// or a semantic version
80+
pub enum Version {
81+
ExactRevision(float),
82+
SemVersion(semver::Version)
83+
}
84+
85+
86+
impl Ord for Version {
87+
fn lt(&self, other: &Version) -> bool {
88+
match (self, other) {
89+
(&ExactRevision(f1), &ExactRevision(f2)) => f1 < f2,
90+
(&SemVersion(ref v1), &SemVersion(ref v2)) => v1 < v2,
91+
_ => false // incomparable, really
92+
}
93+
}
94+
fn le(&self, other: &Version) -> bool {
95+
match (self, other) {
96+
(&ExactRevision(f1), &ExactRevision(f2)) => f1 <= f2,
97+
(&SemVersion(ref v1), &SemVersion(ref v2)) => v1 <= v2,
98+
_ => false // incomparable, really
99+
}
100+
}
101+
fn ge(&self, other: &Version) -> bool {
102+
match (self, other) {
103+
(&ExactRevision(f1), &ExactRevision(f2)) => f1 > f2,
104+
(&SemVersion(ref v1), &SemVersion(ref v2)) => v1 > v2,
105+
_ => false // incomparable, really
106+
}
107+
}
108+
fn gt(&self, other: &Version) -> bool {
109+
match (self, other) {
110+
(&ExactRevision(f1), &ExactRevision(f2)) => f1 >= f2,
111+
(&SemVersion(ref v1), &SemVersion(ref v2)) => v1 >= v2,
112+
_ => false // incomparable, really
113+
}
114+
}
115+
116+
}
117+
118+
impl ToStr for Version {
119+
fn to_str(&self) -> ~str {
120+
match *self {
121+
ExactRevision(ref n) => n.to_str(),
122+
SemVersion(ref v) => v.to_str()
123+
}
124+
}
125+
}
126+
127+
pub fn parse_vers(vers: ~str) -> result::Result<semver::Version, ~str> {
128+
match semver::parse(vers) {
129+
Some(vers) => result::Ok(vers),
130+
None => result::Err(~"could not parse version: invalid")
131+
}
132+
}

branches/snap-stage3/src/librustpkg/rustpkg.rc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#[license = "MIT/ASL2"];
1919
#[crate_type = "lib"];
2020

21-
#[no_core];
2221
#[no_std];
2322

2423
extern mod core(name = "std");
@@ -54,7 +53,6 @@ mod target;
5453
#[cfg(test)]
5554
mod tests;
5655
mod util;
57-
mod version;
5856
mod workspace;
5957

6058
pub mod usage;

branches/snap-stage3/src/librustpkg/tests.rs

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ use core::prelude::*;
1818
use core::result;
1919
use extra::tempfile::mkdtemp;
2020
use package_path::*;
21-
use package_id::PkgId;
22-
use version::{default_version, ExactRevision};
21+
use package_id::{PkgId, default_version};
2322
use path_util::{target_executable_in_workspace, target_library_in_workspace,
2423
target_test_in_workspace, target_bench_in_workspace,
2524
make_dir_rwx, u_rwx,
@@ -54,16 +53,6 @@ fn remote_pkg() -> PkgId {
5453
}
5554
}
5655

57-
fn remote_versioned_pkg() -> PkgId {
58-
let remote = RemotePath(Path("github.com/catamorphism/test_pkg_version"));
59-
PkgId {
60-
local_path: normalize(copy remote),
61-
remote_path: remote,
62-
short_name: ~"test_pkg_version",
63-
version: default_version()
64-
}
65-
}
66-
6756
fn writeFile(file_path: &Path, contents: &str) {
6857
let out: @io::Writer =
6958
result::get(&io::file_writer(file_path,
@@ -253,18 +242,3 @@ fn test_package_ids_must_be_relative_path_like() {
253242
}
254243

255244
}
256-
257-
#[test]
258-
fn test_package_version() {
259-
let workspace = mkdtemp(&os::tmpdir(), "test").expect("couldn't create temp dir");
260-
let sysroot = test_sysroot();
261-
debug!("sysroot = %s", sysroot.to_str());
262-
let ctxt = fake_ctxt(Some(@sysroot));
263-
let temp_pkg_id = PkgId::new("github.com/catamorphism/test_pkg_version");
264-
match temp_pkg_id.version {
265-
ExactRevision(0.2) => (),
266-
_ => fail!(fmt!("test_package_version: package version was %?, expected Some(0.2)",
267-
temp_pkg_id.version))
268-
}
269-
// also check that file paths are right
270-
}

branches/snap-stage3/src/librustpkg/version.rs

Lines changed: 0 additions & 140 deletions
This file was deleted.

branches/snap-stage3/src/libstd/num/float.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ pub static neg_infinity: float = -1.0/0.0;
4747
/* Module: consts */
4848
pub mod consts {
4949
// FIXME (requires Issue #1433 to fix): replace with mathematical
50-
// constants from cmath.
50+
// staticants from cmath.
5151
/// Archimedes' constant
5252
pub static pi: float = 3.14159265358979323846264338327950288;
5353

branches/snap-stage3/src/libstd/os.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1179,7 +1179,7 @@ pub fn real_args() -> ~[~str] {
11791179
#[cfg(windows)]
11801180
pub fn real_args() -> ~[~str] {
11811181
let mut nArgs: c_int = 0;
1182-
let lpArgCount = ptr::to_mut_unsafe_ptr(&mut nArgs);
1182+
let lpArgCount: *mut c_int = &mut nArgs;
11831183
let lpCmdLine = unsafe { GetCommandLineW() };
11841184
let szArgList = unsafe { CommandLineToArgvW(lpCmdLine, lpArgCount) };
11851185

branches/snap-stage3/src/libstd/vec.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1315,8 +1315,8 @@ pub fn swap<T>(v: &mut [T], a: uint, b: uint) {
13151315
unsafe {
13161316
// Can't take two mutable loans from one vector, so instead just cast
13171317
// them to their raw pointers to do the swap
1318-
let pa: *mut T = ptr::to_mut_unsafe_ptr(&mut v[a]);
1319-
let pb: *mut T = ptr::to_mut_unsafe_ptr(&mut v[b]);
1318+
let pa: *mut T = &mut v[a];
1319+
let pb: *mut T = &mut v[b];
13201320
ptr::swap_ptr(pa, pb);
13211321
}
13221322
}

branches/snap-stage3/src/test/run-pass/swap-overlapping.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ pub fn main() {
2626

2727
fn do_swap(test: &mut TestDescAndFn) {
2828
unsafe {
29-
ptr::swap_ptr(ptr::to_mut_unsafe_ptr(test),
30-
ptr::to_mut_unsafe_ptr(test));
29+
ptr::swap_ptr(test, test);
3130
}
3231
}
3332

0 commit comments

Comments
 (0)