Skip to content

Commit 9f48c02

Browse files
committed
---
yaml --- r: 234774 b: refs/heads/tmp c: 0418a43 h: refs/heads/master v: v3
1 parent 1f56749 commit 9f48c02

File tree

28 files changed

+1068
-960
lines changed

28 files changed

+1068
-960
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
2626
refs/heads/beta: d2e13e822a73e0ea46ae9e21afdd3155fc997f6d
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
28-
refs/heads/tmp: 856f97a15e581357b31c76bf2be749ca71a93631
28+
refs/heads/tmp: 0418a43fa3ce430d18e87c66afb2185395f354d6
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: ab792abf1fcc28afbd315426213f6428da25c085
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828

branches/tmp/mk/platform.mk

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,14 @@ define CFG_MAKE_TOOLCHAIN
208208

209209
ifeq ($$(findstring $(HOST_$(1)),arm aarch64 mips mipsel powerpc),)
210210

211+
# On OpenBSD, we need to pass the path of libstdc++.so to the linker
212+
# (use path of libstdc++.a which is a known name for the same path)
213+
ifeq ($(OSTYPE_$(1)),unknown-openbsd)
214+
RUSTC_FLAGS_$(1)=-L "$$(dir $$(shell $$(CC_$(1)) $$(CFG_GCCISH_CFLAGS_$(1)) \
215+
-print-file-name=lib$(CFG_STDCPP_NAME).a))" \
216+
$(RUSTC_FLAGS_$(1))
217+
endif
218+
211219
# On Bitrig, we need the relocation model to be PIC for everything
212220
ifeq (,$(filter $(OSTYPE_$(1)),bitrig))
213221
LLVM_MC_RELOCATION_MODEL="pic"

branches/tmp/src/doc/style/errors/ergonomics.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ fn write_info(info: &Info) -> Result<(), IoError> {
5757
```
5858

5959
See
60-
[the `result` module documentation](https://doc.rust-lang.org/stable/std/result/index.html#the-try!-macro)
60+
[the `result` module documentation](https://doc.rust-lang.org/stable/std/result/index.html#the-try-macro)
6161
for more details.
6262

6363
### The `Result`-`impl` pattern [FIXME]

branches/tmp/src/doc/style/features/traits/generics.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ explicitly implement to be used by this generic function.
2727
* _Inference_. Since the type parameters to generic functions can usually be
2828
inferred, generic functions can help cut down on verbosity in code where
2929
explicit conversions or other method calls would usually be necessary. See the
30-
[overloading/implicits use case](#use-case:-limited-overloading-and/or-implicit-conversions)
30+
[overloading/implicits use case](#use-case-limited-overloading-andor-implicit-conversions)
3131
below.
3232
* _Precise types_. Because generics give a _name_ to the specific type
3333
implementing a trait, it is possible to be precise about places where that
@@ -51,7 +51,7 @@ explicitly implement to be used by this generic function.
5151
a `Vec<T>` contains elements of a single concrete type (and, indeed, the
5252
vector representation is specialized to lay these out in line). Sometimes
5353
heterogeneous collections are useful; see
54-
[trait objects](#use-case:-trait-objects) below.
54+
[trait objects](#use-case-trait-objects) below.
5555
* _Signature verbosity_. Heavy use of generics can bloat function signatures.
5656
**[Ed. note]** This problem may be mitigated by some language improvements; stay tuned.
5757

branches/tmp/src/doc/trpl/error-handling.md

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -24,28 +24,28 @@ systems may want to jump around.
2424
* [The Basics](#the-basics)
2525
* [Unwrapping explained](#unwrapping-explained)
2626
* [The `Option` type](#the-option-type)
27-
* [Composing `Option<T>` values](#composing-option<t>-values)
27+
* [Composing `Option<T>` values](#composing-optiont-values)
2828
* [The `Result` type](#the-result-type)
2929
* [Parsing integers](#parsing-integers)
3030
* [The `Result` type alias idiom](#the-result-type-alias-idiom)
31-
* [A brief interlude: unwrapping isn't evil](#a-brief-interlude:-unwrapping-isn't-evil)
31+
* [A brief interlude: unwrapping isn't evil](#a-brief-interlude-unwrapping-isn't-evil)
3232
* [Working with multiple error types](#working-with-multiple-error-types)
3333
* [Composing `Option` and `Result`](#composing-option-and-result)
3434
* [The limits of combinators](#the-limits-of-combinators)
3535
* [Early returns](#early-returns)
36-
* [The `try!` macro](#the-try!-macro)
36+
* [The `try!` macro](#the-try-macro)
3737
* [Defining your own error type](#defining-your-own-error-type)
3838
* [Standard library traits used for error handling](#standard-library-traits-used-for-error-handling)
3939
* [The `Error` trait](#the-error-trait)
4040
* [The `From` trait](#the-from-trait)
41-
* [The real `try!` macro](#the-real-try!-macro)
41+
* [The real `try!` macro](#the-real-try-macro)
4242
* [Composing custom error types](#composing-custom-error-types)
4343
* [Advice for library writers](#advice-for-library-writers)
44-
* [Case study: A program to read population data](#case-study:-a-program-to-read-population-data)
44+
* [Case study: A program to read population data](#case-study-a-program-to-read-population-data)
4545
* [Initial setup](#initial-setup)
4646
* [Argument parsing](#argument-parsing)
4747
* [Writing the logic](#writing-the-logic)
48-
* [Error handling with `Box<Error>`](#error-handling-with-box%3Cerror%3E)
48+
* [Error handling with `Box<Error>`](#error-handling-with-boxerror)
4949
* [Reading from stdin](#reading-from-stdin)
5050
* [Error handling with a custom type](#error-handling-with-a-custom-type)
5151
* [Adding functionality](#adding-functionality)
@@ -87,7 +87,7 @@ thread '<main>' panicked at 'Invalid number: 11', src/bin/panic-simple.rs:5
8787
Here's another example that is slightly less contrived. A program that accepts
8888
an integer as an argument, doubles it and prints it.
8989

90-
<a name="code-unwrap-double"></a>
90+
<span id="code-unwrap-double"></span>
9191

9292
```rust,should_panic
9393
use std::env;
@@ -139,7 +139,7 @@ system is an important concept because it will cause the compiler to force the
139139
programmer to handle that absence. Let's take a look at an example that tries
140140
to find a character in a string:
141141

142-
<a name="code-option-ex-string-find"></a>
142+
<span id="code-option-ex-string-find"></span>
143143

144144
```rust
145145
// Searches `haystack` for the Unicode character `needle`. If one is found, the
@@ -186,7 +186,7 @@ But wait, what about `unwrap` used in [`unwrap-double`](#code-unwrap-double)?
186186
There was no case analysis there! Instead, the case analysis was put inside the
187187
`unwrap` method for you. You could define it yourself if you want:
188188

189-
<a name="code-option-def-unwrap"></a>
189+
<span id="code-option-def-unwrap"></span>
190190

191191
```rust
192192
enum Option<T> {
@@ -253,7 +253,7 @@ option is `None`, in which case, just return `None`.
253253
Rust has parametric polymorphism, so it is very easy to define a combinator
254254
that abstracts this pattern:
255255

256-
<a name="code-option-map"></a>
256+
<span id="code-option-map"></span>
257257

258258
```rust
259259
fn map<F, T, A>(option: Option<T>, f: F) -> Option<A> where F: FnOnce(T) -> A {
@@ -394,7 +394,7 @@ remove choices because they will panic if `Option<T>` is `None`.
394394
The `Result` type is also
395395
[defined in the standard library][6]:
396396

397-
<a name="code-result-def-1"></a>
397+
<span id="code-result-def"></span>
398398

399399
```rust
400400
enum Result<T, E> {
@@ -562,7 +562,7 @@ combinators that affect only the error type, such as
562562
### The `Result` type alias idiom
563563

564564
In the standard library, you may frequently see types like
565-
`Result<i32>`. But wait, [we defined `Result`](#code-result-def-1) to
565+
`Result<i32>`. But wait, [we defined `Result`](#code-result-def) to
566566
have two type parameters. How can we get away with only specifying
567567
one? The key is to define a `Result` type alias that *fixes* one of
568568
the type parameters to a particular type. Usually the fixed type is
@@ -672,7 +672,7 @@ with both an `Option` and a `Result`, the solution is *usually* to convert the
672672
(from `env::args()`) means the user didn't invoke the program correctly. We
673673
could just use a `String` to describe the error. Let's try:
674674

675-
<a name="code-error-double-string"></a>
675+
<span id="code-error-double-string"></span>
676676

677677
```rust
678678
use std::env;
@@ -906,7 +906,7 @@ seen above.
906906

907907
Here is a simplified definition of a `try!` macro:
908908

909-
<a nama name="code-try-def-simple"></a>
909+
<span id="code-try-def-simple"></span>
910910

911911
```rust
912912
macro_rules! try {
@@ -1168,7 +1168,7 @@ The `std::convert::From` trait is
11681168
[defined in the standard
11691169
library](../std/convert/trait.From.html):
11701170

1171-
<a name="code-from-def"></a>
1171+
<span id="code-from-def"></span>
11721172

11731173
```rust
11741174
trait From<T> {
@@ -1250,7 +1250,7 @@ macro_rules! try {
12501250
This is not its real definition. Its real definition is
12511251
[in the standard library](../std/macro.try!.html):
12521252

1253-
<a name="code-try-def"></a>
1253+
<span id="code-try-def"></span>
12541254

12551255
```rust
12561256
macro_rules! try {
@@ -1515,7 +1515,7 @@ and [`rustc-serialize`](https://crates.io/crates/rustc-serialize) crates.
15151515

15161516
We're not going to spend a lot of time on setting up a project with
15171517
Cargo because it is already covered well in [the Cargo
1518-
chapter](../book/hello-cargo) and [Cargo's documentation][14].
1518+
chapter](../book/hello-cargo.html) and [Cargo's documentation][14].
15191519

15201520
To get started from scratch, run `cargo new --bin city-pop` and make sure your
15211521
`Cargo.toml` looks something like this:
@@ -1573,7 +1573,7 @@ fn main() {
15731573
15741574
let mut opts = Options::new();
15751575
opts.optflag("h", "help", "Show this usage message.");
1576-
1576+
15771577
let matches = match opts.parse(&args[1..]) {
15781578
Ok(m) => { m }
15791579
Err(e) => { panic!(e.to_string()) }
@@ -1584,7 +1584,7 @@ fn main() {
15841584
}
15851585
let data_path = args[1].clone();
15861586
let city = args[2].clone();
1587-
1587+
15881588
// Do stuff with information
15891589
}
15901590
```
@@ -1647,27 +1647,27 @@ fn main() {
16471647
16481648
let mut opts = Options::new();
16491649
opts.optflag("h", "help", "Show this usage message.");
1650-
1650+
16511651
let matches = match opts.parse(&args[1..]) {
16521652
Ok(m) => { m }
16531653
Err(e) => { panic!(e.to_string()) }
16541654
};
1655-
1655+
16561656
if matches.opt_present("h") {
16571657
print_usage(&program, opts);
16581658
return;
16591659
}
1660-
1660+
16611661
let data_file = args[1].clone();
16621662
let data_path = Path::new(&data_file);
16631663
let city = args[2].clone();
1664-
1664+
16651665
let file = fs::File::open(data_path).unwrap();
16661666
let mut rdr = csv::Reader::from_reader(file);
1667-
1667+
16681668
for row in rdr.decode::<Row>() {
16691669
let row = row.unwrap();
1670-
1670+
16711671
if row.city == city {
16721672
println!("{}, {}: {:?}",
16731673
row.city, row.country,
@@ -1773,7 +1773,7 @@ fn main() {
17731773
print_usage(&program, opts);
17741774
return;
17751775
}
1776-
1776+
17771777
let data_file = args[1].clone();
17781778
let data_path = Path::new(&data_file);
17791779
let city = args[2].clone();
@@ -1882,7 +1882,7 @@ opts.optflag("h", "help", "Show this usage message.");
18821882
...
18831883
let file = matches.opt_str("f");
18841884
let data_file = file.as_ref().map(Path::new);
1885-
1885+
18861886
let city = if !matches.free.is_empty() {
18871887
matches.free[0].clone()
18881888
} else {

branches/tmp/src/libcore/num/flt2dec/bignum.rs renamed to branches/tmp/src/libcore/num/bignum.rs

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@
1919
//! inputs, but we don't do so to avoid the code bloat. Each bignum is still
2020
//! tracked for the actual usages, so it normally doesn't matter.
2121
22+
// This module is only for dec2flt and flt2dec, and only public because of libcoretest.
23+
// It is not intended to ever be stabilized.
24+
#![doc(hidden)]
25+
#![unstable(feature = "core_private_bignum",
26+
reason = "internal routines only exposed for testing",
27+
issue = "0")]
2228
#![macro_use]
2329

2430
use prelude::v1::*;
@@ -194,7 +200,7 @@ macro_rules! define_bignum {
194200
/// Adds `other` to itself and returns its own mutable reference.
195201
pub fn add<'a>(&'a mut self, other: &$name) -> &'a mut $name {
196202
use cmp;
197-
use num::flt2dec::bignum::FullOps;
203+
use num::bignum::FullOps;
198204

199205
let mut sz = cmp::max(self.size, other.size);
200206
let mut carry = false;
@@ -212,7 +218,7 @@ macro_rules! define_bignum {
212218
}
213219

214220
pub fn add_small(&mut self, other: $ty) -> &mut $name {
215-
use num::flt2dec::bignum::FullOps;
221+
use num::bignum::FullOps;
216222

217223
let (mut carry, v) = self.base[0].full_add(other, false);
218224
self.base[0] = v;
@@ -232,7 +238,7 @@ macro_rules! define_bignum {
232238
/// Subtracts `other` from itself and returns its own mutable reference.
233239
pub fn sub<'a>(&'a mut self, other: &$name) -> &'a mut $name {
234240
use cmp;
235-
use num::flt2dec::bignum::FullOps;
241+
use num::bignum::FullOps;
236242

237243
let sz = cmp::max(self.size, other.size);
238244
let mut noborrow = true;
@@ -249,7 +255,7 @@ macro_rules! define_bignum {
249255
/// Multiplies itself by a digit-sized `other` and returns its own
250256
/// mutable reference.
251257
pub fn mul_small(&mut self, other: $ty) -> &mut $name {
252-
use num::flt2dec::bignum::FullOps;
258+
use num::bignum::FullOps;
253259

254260
let mut sz = self.size;
255261
let mut carry = 0;
@@ -310,7 +316,7 @@ macro_rules! define_bignum {
310316
/// Multiplies itself by `5^e` and returns its own mutable reference.
311317
pub fn mul_pow5(&mut self, mut e: usize) -> &mut $name {
312318
use mem;
313-
use num::flt2dec::bignum::SMALL_POW5;
319+
use num::bignum::SMALL_POW5;
314320

315321
// There are exactly n trailing zeros on 2^n, and the only relevant digit sizes
316322
// are consecutive powers of two, so this is well suited index for the table.
@@ -341,7 +347,7 @@ macro_rules! define_bignum {
341347
pub fn mul_digits<'a>(&'a mut self, other: &[$ty]) -> &'a mut $name {
342348
// the internal routine. works best when aa.len() <= bb.len().
343349
fn mul_inner(ret: &mut [$ty; $n], aa: &[$ty], bb: &[$ty]) -> usize {
344-
use num::flt2dec::bignum::FullOps;
350+
use num::bignum::FullOps;
345351

346352
let mut retsz = 0;
347353
for (i, &a) in aa.iter().enumerate() {
@@ -378,7 +384,7 @@ macro_rules! define_bignum {
378384
/// Divides itself by a digit-sized `other` and returns its own
379385
/// mutable reference *and* the remainder.
380386
pub fn div_rem_small(&mut self, other: $ty) -> (&mut $name, $ty) {
381-
use num::flt2dec::bignum::FullOps;
387+
use num::bignum::FullOps;
382388

383389
assert!(other > 0);
384390

branches/tmp/src/libcore/num/dec2flt/algorithm.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010

1111
//! The various algorithms from the paper.
1212
13-
use num::flt2dec::strategy::grisu::Fp;
1413
use prelude::v1::*;
1514
use cmp::min;
1615
use cmp::Ordering::{Less, Equal, Greater};
17-
use super::table;
18-
use super::rawfp::{self, Unpacked, RawFloat, fp_to_float, next_float, prev_float};
19-
use super::num::{self, Big};
16+
use num::diy_float::Fp;
17+
use num::dec2flt::table;
18+
use num::dec2flt::rawfp::{self, Unpacked, RawFloat, fp_to_float, next_float, prev_float};
19+
use num::dec2flt::num::{self, Big};
2020

2121
/// Number of significand bits in Fp
2222
const P: u32 = 64;

branches/tmp/src/libcore/num/dec2flt/mod.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,6 @@
8686
//! "such that the exponent +/- the number of decimal digits fits into a 64 bit integer".
8787
//! Larger exponents are accepted, but we don't do arithmetic with them, they are immediately
8888
//! turned into {positive,negative} {zero,infinity}.
89-
//!
90-
//! FIXME: this uses several things from core::num::flt2dec, which is nonsense. Those things
91-
//! should be moved into core::num::<something else>.
9289
9390
#![doc(hidden)]
9491
#![unstable(feature = "dec2flt",

branches/tmp/src/libcore/num/dec2flt/num.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@
1414

1515
use prelude::v1::*;
1616
use cmp::Ordering::{self, Less, Equal, Greater};
17-
use num::flt2dec::bignum::Big32x40;
1817

19-
pub type Big = Big32x40;
18+
pub use num::bignum::Big32x40 as Big;
2019

2120
/// Test whether truncating all bits less significant than `ones_place` introduces
2221
/// a relative error less, equal, or greater than 0.5 ULP.

branches/tmp/src/libcore/num/dec2flt/rawfp.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ use cmp::Ordering::{Less, Equal, Greater};
3333
use ops::{Mul, Div, Neg};
3434
use fmt::{Debug, LowerExp};
3535
use mem::transmute;
36-
use num::flt2dec::strategy::grisu::Fp;
36+
use num::diy_float::Fp;
3737
use num::FpCategory::{Infinite, Zero, Subnormal, Normal, Nan};
3838
use num::Float;
39-
use super::num::{self, Big};
39+
use num::dec2flt::num::{self, Big};
4040

4141
#[derive(Copy, Clone, Debug)]
4242
pub struct Unpacked {

0 commit comments

Comments
 (0)