]> git.lizzy.rs Git - rust.git/log
rust.git
10 years agoauto merge of #12059 : thestinger/rust/glue, r=pcwalton
bors [Sat, 8 Feb 2014 03:31:31 +0000 (19:31 -0800)]
auto merge of #12059 : thestinger/rust/glue, r=pcwalton

A follow-up from the work I started with 383e3fd13b99827b5dbb107da7433bd0a70dea80.

10 years agoadd a hack to fix debug-info tests under gdb 7.7
Daniel Micay [Sat, 8 Feb 2014 02:22:47 +0000 (21:22 -0500)]
add a hack to fix debug-info tests under gdb 7.7

10 years agorm out-of-date comment from std::unstable::raw
Daniel Micay [Thu, 30 Jan 2014 22:30:29 +0000 (17:30 -0500)]
rm out-of-date comment from std::unstable::raw

10 years agoallow generating drop glue without the TyDesc
Daniel Micay [Thu, 6 Feb 2014 06:07:06 +0000 (01:07 -0500)]
allow generating drop glue without the TyDesc

Reflection is now the only user of type descriptors. Uses of drop glue
no longer cause a type descriptor to be generated.

10 years agoremove type descriptors from proc and @T
Daniel Micay [Thu, 6 Feb 2014 04:05:30 +0000 (23:05 -0500)]
remove type descriptors from proc and @T

This also drops support for the managed pointer POISON_ON_FREE feature
as it's not worth adding back the support for it. After a snapshot, the
leftovers can be removed.

10 years agoauto merge of #12094 : adridu59/rust/licensing, r=brson
bors [Sat, 8 Feb 2014 00:16:35 +0000 (16:16 -0800)]
auto merge of #12094 : adridu59/rust/licensing, r=brson

Closes #12069.

cc @brson

10 years agoauto merge of #12029 : zkamsler/rust/merge-sort-allocations, r=huonw
bors [Fri, 7 Feb 2014 22:21:30 +0000 (14:21 -0800)]
auto merge of #12029 : zkamsler/rust/merge-sort-allocations, r=huonw

This pull request:
1) Changes the initial insertion sort to be in-place, and defers allocation of working set until merge is needed.
2) Increases the increases the maximum run length to use insertion sort for from 8 to 32 elements. This increases the size of vectors that will not allocate, and reduces the number of merge passes by two. It seemed to be the sweet spot in the benchmarks that I ran.

Here are the results of some benchmarks. Note that they are sorting u64s, so types that are more expensive to compare or copy may have different behaviors.
Before changes:
```
test vec::bench::sort_random_large      bench:    719753 ns/iter (+/- 130173) = 111 MB/s
test vec::bench::sort_random_medium     bench:      4726 ns/iter (+/- 742) = 169 MB/s
test vec::bench::sort_random_small      bench:       344 ns/iter (+/- 76) = 116 MB/s
test vec::bench::sort_sorted            bench:    437244 ns/iter (+/- 70043) = 182 MB/s
```

Deferred allocation (8 element insertion sort):
```
test vec::bench::sort_random_large      bench:    702630 ns/iter (+/- 88158) = 113 MB/s
test vec::bench::sort_random_medium     bench:      4529 ns/iter (+/- 497) = 176 MB/s
test vec::bench::sort_random_small      bench:       185 ns/iter (+/- 49) = 216 MB/s
test vec::bench::sort_sorted            bench:    425853 ns/iter (+/- 60907) = 187 MB/s
```

Deferred allocation (16 element insertion sort):
```
test vec::bench::sort_random_large      bench:    692783 ns/iter (+/- 165837) = 115 MB/s
test vec::bench::sort_random_medium     bench:      4434 ns/iter (+/- 722) = 180 MB/s
test vec::bench::sort_random_small      bench:       187 ns/iter (+/- 38) = 213 MB/s
test vec::bench::sort_sorted            bench:    393783 ns/iter (+/- 85548) = 203 MB/s
```

Deferred allocation (32 element insertion sort):
```
test vec::bench::sort_random_large      bench:    682556 ns/iter (+/- 131008) = 117 MB/s
test vec::bench::sort_random_medium     bench:      4370 ns/iter (+/- 1369) = 183 MB/s
test vec::bench::sort_random_small      bench:       179 ns/iter (+/- 32) = 223 MB/s
test vec::bench::sort_sorted            bench:    358353 ns/iter (+/- 65423) = 223 MB/s
```

Deferred allocation (64 element insertion sort):
```
test vec::bench::sort_random_large      bench:    712040 ns/iter (+/- 132454) = 112 MB/s
test vec::bench::sort_random_medium     bench:      4425 ns/iter (+/- 784) = 180 MB/s
test vec::bench::sort_random_small      bench:       179 ns/iter (+/- 81) = 223 MB/s
test vec::bench::sort_sorted            bench:    317812 ns/iter (+/- 62675) = 251 MB/s
```

This is the best I could manage with the basic merge sort while keeping the invariant that the original vector must contain each element exactly once when the comparison function is called. If one is not married to a stable sort, an in-place n*log(n) sorting algorithm may have better performance in some cases.

for #12011
cc @huonw

10 years agoReduced allocations in merge_sort for short vectors
Zach Kamsler [Tue, 4 Feb 2014 17:56:13 +0000 (12:56 -0500)]
Reduced allocations in merge_sort for short vectors

Added a seperate in-place insertion sort for short vectors.
Increased threshold for insertion short for 8 to 32 elements
for small types and 16 for larger types. Added benchmarks
for sorting larger types.

10 years agoauto merge of #12073 : alexcrichton/rust/doc-examples, r=cmr
bors [Fri, 7 Feb 2014 20:41:35 +0000 (12:41 -0800)]
auto merge of #12073 : alexcrichton/rust/doc-examples, r=cmr

"How do I start in libX" is a common question that I've seen, so I figured
putting the examples in as many places as possible is probably a good idea.

10 years agodoc: add license information for gen. files
Adrien Tétar [Fri, 7 Feb 2014 19:46:39 +0000 (20:46 +0100)]
doc: add license information for gen. files

10 years agoauto merge of #12055 : dguenther/rust/tidy_test, r=alexcrichton
bors [Fri, 7 Feb 2014 19:26:29 +0000 (11:26 -0800)]
auto merge of #12055 : dguenther/rust/tidy_test, r=alexcrichton

This PR extends the tidy formatting check to rust files in the test folder. To facilitate this, a few flags were added to tidy:

* `xfail-tidy-cr` - Disables the check for CR characters for all following lines in the file
* `xfail-tidy-tab` - Disables the check for tab characters for all following lines in the file
* `xfail-tidy-linelength` - Disables the line length check for all following lines in the file

Checks should not have to be disabled often. I disabled line length checks in `debug-info` tests that use `debugger:` checks, but aside from that, there were relatively few exclusions. Running tidy on all the tests does slow down the formatting check, so it may be worth investigating further optimization.

cc #4534

10 years agoAdded tests to make tidy
Derek Guenther [Wed, 5 Feb 2014 22:33:10 +0000 (16:33 -0600)]
Added tests to make tidy

10 years agoauto merge of #12075 : chromatic/rust/gh_11983_deglob_std, r=alexcrichton
bors [Fri, 7 Feb 2014 18:11:29 +0000 (10:11 -0800)]
auto merge of #12075 : chromatic/rust/gh_11983_deglob_std, r=alexcrichton

This replaces the imports from the prelude with the re-exported symbols.

10 years agoCleaned up imports per coding standards.
chromatic [Fri, 7 Feb 2014 00:00:49 +0000 (16:00 -0800)]
Cleaned up imports per coding standards.

No functional changes; just style.

10 years agoRemoved prelude::* from libstd files.
chromatic [Mon, 3 Feb 2014 00:32:52 +0000 (16:32 -0800)]
Removed prelude::* from libstd files.

This replaces the imports from the prelude with the re-exported symbols.

10 years agoauto merge of #12087 : sanxiyn/rust/show-span, r=huonw
bors [Fri, 7 Feb 2014 11:26:34 +0000 (03:26 -0800)]
auto merge of #12087 : sanxiyn/rust/show-span, r=huonw

10 years agoAdd comments to span debugger
Seo Sanghyeon [Fri, 7 Feb 2014 11:13:07 +0000 (20:13 +0900)]
Add comments to span debugger

10 years agoCorrect span for ExprFnBlock, ExprMethodCall, ExprParen
Seo Sanghyeon [Fri, 7 Feb 2014 10:52:12 +0000 (19:52 +0900)]
Correct span for ExprFnBlock, ExprMethodCall, ExprParen

10 years agoSpan debugger
Seo Sanghyeon [Fri, 7 Feb 2014 10:50:07 +0000 (19:50 +0900)]
Span debugger

10 years agoauto merge of #12083 : bjz/rust/semver, r=huonw
bors [Fri, 7 Feb 2014 10:11:30 +0000 (02:11 -0800)]
auto merge of #12083 : bjz/rust/semver, r=huonw

10 years agoauto merge of #12062 : kballard/rust/from_utf8_lossy, r=huonw
bors [Fri, 7 Feb 2014 08:56:31 +0000 (00:56 -0800)]
auto merge of #12062 : kballard/rust/from_utf8_lossy, r=huonw

`from_utf8_lossy()` takes a byte vector and produces a `~str`, converting
any invalid UTF-8 sequence into the U+FFFD REPLACEMENT CHARACTER.

The replacement follows the guidelines in §5.22 Best Practice for U+FFFD
Substitution from the Unicode Standard (Version 6.2)[1], which also
matches the WHATWG rules for utf-8 decoding[2].

[1]: http://www.unicode.org/versions/Unicode6.2.0/ch05.pdf
[2]: http://encoding.spec.whatwg.org/#utf-8

Closes #9516.

10 years agoauto merge of #12010 : HeroesGrave/rust/libcollection, r=alexcrichton
bors [Fri, 7 Feb 2014 07:46:35 +0000 (23:46 -0800)]
auto merge of #12010 : HeroesGrave/rust/libcollection, r=alexcrichton

Part of #8784

Changes:
- Everything labeled under collections in libextra has been moved into a new crate 'libcollection'.
- Renamed container.rs to deque.rs, since it was no longer 'container traits for extra', just a deque trait.
- Crates that depend on the collections have been updated and dependencies sorted.
- I think I changed all the imports in the tests to make sure it works. I'm not entirely sure, as near the end of the tests there was yet another `use` that I forgot to change, and when I went to try again, it started rebuilding everything, which I don't currently have time for.

There will probably be incompatibility between this and the other pull requests that are splitting up libextra. I'm happy to rebase once those have been merged.

The tests I didn't get to run should pass. But I can redo them another time if they don't.

10 years agoHoist path::Display on top of from_utf8_lossy()
Kevin Ballard [Thu, 6 Feb 2014 08:02:59 +0000 (00:02 -0800)]
Hoist path::Display on top of from_utf8_lossy()

10 years agoAdd new function str::from_utf8_lossy()
Kevin Ballard [Thu, 6 Feb 2014 07:56:27 +0000 (23:56 -0800)]
Add new function str::from_utf8_lossy()

from_utf8_lossy() takes a byte vector and produces a ~str, converting
any invalid UTF-8 sequence into the U+FFFD REPLACEMENT CHARACTER.

The replacement follows the guidelines in §5.22 Best Practice for U+FFFD
Substitution from the Unicode Standard (Version 6.2)[1], which also
matches the WHATWG rules for utf-8 decoding[2].

[1]: http://www.unicode.org/versions/Unicode6.2.0/ch05.pdf
[2]: http://encoding.spec.whatwg.org/#utf-8

10 years agoImplement std::fmt::Show for semver::{Identifier, Version}
Brendan Zabarauskas [Fri, 7 Feb 2014 06:20:35 +0000 (17:20 +1100)]
Implement std::fmt::Show for semver::{Identifier, Version}

10 years agomoved collections from libextra into libcollections
HeroesGrave [Mon, 3 Feb 2014 05:56:49 +0000 (18:56 +1300)]
moved collections from libextra into libcollections

10 years agoauto merge of #12078 : colemickens/rust/patch-2, r=alexcrichton
bors [Fri, 7 Feb 2014 06:31:33 +0000 (22:31 -0800)]
auto merge of #12078 : colemickens/rust/patch-2, r=alexcrichton

10 years agoMake semver::Version fields public
Brendan Zabarauskas [Fri, 7 Feb 2014 06:19:21 +0000 (17:19 +1100)]
Make semver::Version fields public

10 years agoauto merge of #12077 : colemickens/rust/patch-1, r=alexcrichton
bors [Fri, 7 Feb 2014 05:11:34 +0000 (21:11 -0800)]
auto merge of #12077 : colemickens/rust/patch-1, r=alexcrichton

10 years agoauto merge of #12076 : alexcrichton/rust/rpath-makefile-dep, r=thestinger
bors [Fri, 7 Feb 2014 03:16:34 +0000 (19:16 -0800)]
auto merge of #12076 : alexcrichton/rust/rpath-makefile-dep, r=thestinger

The rpath variable should only be used when executing commands, if it leaks into
a dependency list is causes havoc with the dependencies.

10 years agoauto merge of #12039 : alexcrichton/rust/no-conditions, r=brson
bors [Fri, 7 Feb 2014 01:11:33 +0000 (17:11 -0800)]
auto merge of #12039 : alexcrichton/rust/no-conditions, r=brson

This has been a long time coming. Conditions in rust were initially envisioned
as being a good alternative to error code return pattern. The idea is that all
errors are fatal-by-default, and you can opt-in to handling the error by
registering an error handler.

While sounding nice, conditions ended up having some unforseen shortcomings:

* Actually handling an error has some very awkward syntax:

        let mut result = None;
        let mut answer = None;
        io::io_error::cond.trap(|e| { result = Some(e) }).inside(|| {
            answer = Some(some_io_operation());
        });
        match result {
            Some(err) => { /* hit an I/O error */ }
            None => {
                let answer = answer.unwrap();
                /* deal with the result of I/O */
            }
        }

  This pattern can certainly use functions like io::result, but at its core
  actually handling conditions is fairly difficult

* The "zero value" of a function is often confusing. One of the main ideas
  behind using conditions was to change the signature of I/O functions. Instead
  of read_be_u32() returning a result, it returned a u32. Errors were notified
  via a condition, and if you caught the condition you understood that the "zero
  value" returned is actually a garbage value. These zero values are often
  difficult to understand, however.

  One case of this is the read_bytes() function. The function takes an integer
  length of the amount of bytes to read, and returns an array of that size. The
  array may actually be shorter, however, if an error occurred.

  Another case is fs::stat(). The theoretical "zero value" is a blank stat
  struct, but it's a little awkward to create and return a zero'd out stat
  struct on a call to stat().

  In general, the return value of functions that can raise error are much more
  natural when using a Result as opposed to an always-usable zero-value.

* Conditions impose a necessary runtime requirement on *all* I/O. In theory I/O
  is as simple as calling read() and write(), but using conditions imposed the
  restriction that a rust local task was required if you wanted to catch errors
  with I/O. While certainly an surmountable difficulty, this was always a bit of
  a thorn in the side of conditions.

* Functions raising conditions are not always clear that they are raising
  conditions. This suffers a similar problem to exceptions where you don't
  actually know whether a function raises a condition or not. The documentation
  likely explains, but if someone retroactively adds a condition to a function
  there's nothing forcing upstream users to acknowledge a new point of task
  failure.

* Libaries using I/O are not guaranteed to correctly raise on conditions when an
  error occurs. In developing various I/O libraries, it's much easier to just
  return `None` from a read rather than raising an error. The silent contract of
  "don't raise on EOF" was a little difficult to understand and threw a wrench
  into the answer of the question "when do I raise a condition?"

Many of these difficulties can be overcome through documentation, examples, and
general practice. In the end, all of these difficulties added together ended up
being too overwhelming and improving various aspects didn't end up helping that
much.

A result-based I/O error handling strategy also has shortcomings, but the
cognitive burden is much smaller. The tooling necessary to make this strategy as
usable as conditions were is much smaller than the tooling necessary for
conditions.

Perhaps conditions may manifest themselves as a future entity, but for now
we're going to remove them from the standard library.

Closes #9795
Closes #8968

10 years agoAdd some doc examples to lib{green,native}
Alex Crichton [Thu, 6 Feb 2014 21:02:06 +0000 (13:02 -0800)]
Add some doc examples to lib{green,native}

"How do I start in libX" is a common question that I've seen, so I figured
putting the examples in as many places as possible is probably a good idea.

10 years agoDon't include rpath lines in dependency lists
Alex Crichton [Thu, 6 Feb 2014 23:43:27 +0000 (15:43 -0800)]
Don't include rpath lines in dependency lists

The rpath variable should only be used when executing commands, if it leaks into
a dependency list is causes havoc with the dependencies.

10 years agoUpdate link_name=... -> link(name=...
Cole Mickens [Thu, 6 Feb 2014 23:54:25 +0000 (15:54 -0800)]
Update link_name=... -> link(name=...

10 years agoRemove std::condition
Alex Crichton [Wed, 5 Feb 2014 03:02:10 +0000 (19:02 -0800)]
Remove std::condition

This has been a long time coming. Conditions in rust were initially envisioned
as being a good alternative to error code return pattern. The idea is that all
errors are fatal-by-default, and you can opt-in to handling the error by
registering an error handler.

While sounding nice, conditions ended up having some unforseen shortcomings:

* Actually handling an error has some very awkward syntax:

    let mut result = None;
    let mut answer = None;
    io::io_error::cond.trap(|e| { result = Some(e) }).inside(|| {
        answer = Some(some_io_operation());
    });
    match result {
        Some(err) => { /* hit an I/O error */ }
        None => {
            let answer = answer.unwrap();
            /* deal with the result of I/O */
        }
    }

  This pattern can certainly use functions like io::result, but at its core
  actually handling conditions is fairly difficult

* The "zero value" of a function is often confusing. One of the main ideas
  behind using conditions was to change the signature of I/O functions. Instead
  of read_be_u32() returning a result, it returned a u32. Errors were notified
  via a condition, and if you caught the condition you understood that the "zero
  value" returned is actually a garbage value. These zero values are often
  difficult to understand, however.

  One case of this is the read_bytes() function. The function takes an integer
  length of the amount of bytes to read, and returns an array of that size. The
  array may actually be shorter, however, if an error occurred.

  Another case is fs::stat(). The theoretical "zero value" is a blank stat
  struct, but it's a little awkward to create and return a zero'd out stat
  struct on a call to stat().

  In general, the return value of functions that can raise error are much more
  natural when using a Result as opposed to an always-usable zero-value.

* Conditions impose a necessary runtime requirement on *all* I/O. In theory I/O
  is as simple as calling read() and write(), but using conditions imposed the
  restriction that a rust local task was required if you wanted to catch errors
  with I/O. While certainly an surmountable difficulty, this was always a bit of
  a thorn in the side of conditions.

* Functions raising conditions are not always clear that they are raising
  conditions. This suffers a similar problem to exceptions where you don't
  actually know whether a function raises a condition or not. The documentation
  likely explains, but if someone retroactively adds a condition to a function
  there's nothing forcing upstream users to acknowledge a new point of task
  failure.

* Libaries using I/O are not guaranteed to correctly raise on conditions when an
  error occurs. In developing various I/O libraries, it's much easier to just
  return `None` from a read rather than raising an error. The silent contract of
  "don't raise on EOF" was a little difficult to understand and threw a wrench
  into the answer of the question "when do I raise a condition?"

Many of these difficulties can be overcome through documentation, examples, and
general practice. In the end, all of these difficulties added together ended up
being too overwhelming and improving various aspects didn't end up helping that
much.

A result-based I/O error handling strategy also has shortcomings, but the
cognitive burden is much smaller. The tooling necessary to make this strategy as
usable as conditions were is much smaller than the tooling necessary for
conditions.

Perhaps conditions may manifest themselves as a future entity, but for now
we're going to remove them from the standard library.

Closes #9795
Closes #8968

10 years agoFix a dead URL
Cole Mickens [Thu, 6 Feb 2014 23:48:15 +0000 (15:48 -0800)]
Fix a dead URL

10 years agoauto merge of #12030 : eddyb/rust/kill-at-self-and-trait, r=cmr
bors [Thu, 6 Feb 2014 22:51:30 +0000 (14:51 -0800)]
auto merge of #12030 : eddyb/rust/kill-at-self-and-trait, r=cmr

10 years agoRemoved @self and @Trait.
Eduard Burtescu [Thu, 6 Feb 2014 22:38:33 +0000 (00:38 +0200)]
Removed @self and @Trait.

10 years agoauto merge of #12020 : alexcrichton/rust/output-flags, r=brson
bors [Thu, 6 Feb 2014 20:41:30 +0000 (12:41 -0800)]
auto merge of #12020 : alexcrichton/rust/output-flags, r=brson

This commit removes the -c, --emit-llvm, -s, --rlib, --dylib, --staticlib,
--lib, and --bin flags from rustc, adding the following flags:

* --emit=[asm,ir,bc,obj,link]
* --crate-type=[dylib,rlib,staticlib,bin,lib]

The -o option has also been redefined to be used for *all* flavors of outputs.
This means that we no longer ignore it for libraries. The --out-dir remains the
same as before.

The new logic for files that rustc emits is as follows:

1. Output types are dictated by the --emit flag. The default value is
   --emit=link, and this option can be passed multiple times and have all options
   stacked on one another.
2. Crate types are dictated by the --crate-type flag and the #[crate_type]
   attribute. The flags can be passed many times and stack with the crate
   attribute.
3. If the -o flag is specified, and only one output type is specified, the
   output will be emitted at this location. If more than one output type is
   specified, then the filename of -o is ignored, and all output goes in the
   directory that -o specifies. The -o option always ignores the --out-dir
   option.
4. If the --out-dir flag is specified, all output goes in this directory.
5. If -o and --out-dir are both not present, all output goes in the directory of
   the crate file.
6. When multiple output types are specified, the filestem of all output is the
   same as the name of the CrateId (derived from a crate attribute or from the
   filestem of the crate file).

Closes #7791
Closes #11056
Closes #11667

10 years agoauto merge of #12007 : Arcterus/rust/libgetopts, r=cmr
bors [Thu, 6 Feb 2014 19:16:33 +0000 (11:16 -0800)]
auto merge of #12007 : Arcterus/rust/libgetopts, r=cmr

Should help towards finishing #8784.

10 years agoRedesign output flags for rustc
Alex Crichton [Mon, 3 Feb 2014 23:27:54 +0000 (15:27 -0800)]
Redesign output flags for rustc

This commit removes the -c, --emit-llvm, -s, --rlib, --dylib, --staticlib,
--lib, and --bin flags from rustc, adding the following flags:

* --emit=[asm,ir,bc,obj,link]
* --crate-type=[dylib,rlib,staticlib,bin,lib]

The -o option has also been redefined to be used for *all* flavors of outputs.
This means that we no longer ignore it for libraries. The --out-dir remains the
same as before.

The new logic for files that rustc emits is as follows:

1. Output types are dictated by the --emit flag. The default value is
   --emit=link, and this option can be passed multiple times and have all
   options stacked on one another.
2. Crate types are dictated by the --crate-type flag and the #[crate_type]
   attribute. The flags can be passed many times and stack with the crate
   attribute.
3. If the -o flag is specified, and only one output type is specified, the
   output will be emitted at this location. If more than one output type is
   specified, then the filename of -o is ignored, and all output goes in the
   directory that -o specifies. The -o option always ignores the --out-dir
   option.
4. If the --out-dir flag is specified, all output goes in this directory.
5. If -o and --out-dir are both not present, all output goes in the current
   directory of the process.
6. When multiple output types are specified, the filestem of all output is the
   same as the name of the CrateId (derived from a crate attribute or from the
   filestem of the crate file).

Closes #7791
Closes #11056
Closes #11667

10 years agogetopts: fixed a failing test
Arcterus [Thu, 6 Feb 2014 03:51:22 +0000 (19:51 -0800)]
getopts: fixed a failing test

10 years agogetopts: unify tests
Arcterus [Wed, 5 Feb 2014 00:15:03 +0000 (16:15 -0800)]
getopts: unify tests

10 years agogetopts: replaced base functions with those from group
Arcterus [Tue, 4 Feb 2014 03:14:40 +0000 (19:14 -0800)]
getopts: replaced base functions with those from group

10 years agoMove getopts out of extra
Arcterus [Sun, 2 Feb 2014 23:20:32 +0000 (15:20 -0800)]
Move getopts out of extra

10 years agoauto merge of #12053 : fhahn/rust/remove-str-in-comment, r=alexcrichton
bors [Thu, 6 Feb 2014 17:21:31 +0000 (09:21 -0800)]
auto merge of #12053 : fhahn/rust/remove-str-in-comment, r=alexcrichton

This tiny pull request updates a comment referring to `@str` which was replaced by `(InternedString,StrStyle)` .

related to #10516

10 years agoauto merge of #12048 : sanxiyn/rust/crate-config, r=alexcrichton
bors [Thu, 6 Feb 2014 16:06:33 +0000 (08:06 -0800)]
auto merge of #12048 : sanxiyn/rust/crate-config, r=alexcrichton

10 years agoFix expansion tests
Seo Sanghyeon [Thu, 6 Feb 2014 15:28:50 +0000 (00:28 +0900)]
Fix expansion tests

10 years agoauto merge of #12051 : luqmana/rust/arm-fix, r=alexcrichton
bors [Thu, 6 Feb 2014 14:06:35 +0000 (06:06 -0800)]
auto merge of #12051 : luqmana/rust/arm-fix, r=alexcrichton

Fix building for arm/Linux.

10 years agoauto merge of #12047 : huonw/rust/cyclic-rc, r=thestinger
bors [Thu, 6 Feb 2014 11:11:39 +0000 (03:11 -0800)]
auto merge of #12047 : huonw/rust/cyclic-rc, r=thestinger

A weak pointer inside itself will have its destructor run when the last
strong pointer to that data disappears, so we need to make sure that the
Weak and Rc destructors don't duplicate work (i.e. freeing).

By making the Rcs effectively take a weak pointer, we ensure that no
Weak destructor will free the pointer while still ensuring that Weak
pointers can't be upgraded to strong ones as the destructors run.

This approach of starting weak at 1 is what libstdc++ does.

Fixes #12046.

10 years agoauto merge of #12001 : yuriks/rust/getopts-tweaks, r=brson
bors [Thu, 6 Feb 2014 08:01:34 +0000 (00:01 -0800)]
auto merge of #12001 : yuriks/rust/getopts-tweaks, r=brson

This complements `usage` by auto-generating a short one-liner summary
of the options.

(First timer here, be gentle... :)

10 years agoauto merge of #12054 : alexcrichton/rust/less-flaky-udp, r=brson
bors [Thu, 6 Feb 2014 06:46:33 +0000 (22:46 -0800)]
auto merge of #12054 : alexcrichton/rust/less-flaky-udp, r=brson

I have a hunch this just deadlocked the windows bots. Due to UDP being a lossy
protocol, I don't think we can guarantee that the server can receive both
packets, so just listen for one of them.

10 years agoMake a double-write UDP test more robust
Alex Crichton [Thu, 6 Feb 2014 00:09:59 +0000 (16:09 -0800)]
Make a double-write UDP test more robust

I have a hunch this just deadlocked the windows bots. Due to UDP being a lossy
protocol, I don't think we can guarantee that the server can receive both
packets, so just listen for one of them.

10 years agoauto merge of #11989 : adridu59/rust/tidy, r=alexcrichton
bors [Thu, 6 Feb 2014 02:31:36 +0000 (18:31 -0800)]
auto merge of #11989 : adridu59/rust/tidy, r=alexcrichton

Closes #11985
Closes #4533

@huonw, @alexcrichton

10 years agoRemove reference to @str in comment
Florian Hahn [Thu, 6 Feb 2014 00:02:10 +0000 (01:02 +0100)]
Remove reference to @str in comment

10 years agolibstd: Add missing constants for arm/linux.
Luqman Aden [Wed, 5 Feb 2014 22:11:28 +0000 (17:11 -0500)]
libstd: Add missing constants for arm/linux.

10 years agoEnsure an Rc isn't freed while running its own destructor.
Huon Wilson [Wed, 5 Feb 2014 10:41:26 +0000 (21:41 +1100)]
Ensure an Rc isn't freed while running its own destructor.

A weak pointer inside itself will have its destructor run when the last
strong pointer to that data disappears, so we need to make sure that the
Weak and Rc destructors don't duplicate work (i.e. freeing).

By making the Rcs effectively take a weak pointer, we ensure that no
Weak destructor will free the pointer while still ensuring that Weak
pointers can't be upgraded to strong ones as the destructors run.

This approach of starting weak at 1 is what libstdc++ does.

Fixes #12046.

10 years agoauto merge of #11894 : alexcrichton/rust/io-clone, r=brson
bors [Wed, 5 Feb 2014 20:56:34 +0000 (12:56 -0800)]
auto merge of #11894 : alexcrichton/rust/io-clone, r=brson

This is part of the overall strategy I would like to take when approaching
issue #11165. The only two I/O objects that reasonably want to be "split" are
the network stream objects. Everything else can be "split" by just creating
another version.

The initial idea I had was the literally split the object into a reader and a
writer half, but that would just introduce lots of clutter with extra interfaces
that were a little unnnecssary, or it would return a ~Reader and a ~Writer which
means you couldn't access things like the remote peer name or local socket name.

The solution I found to be nicer was to just clone the stream itself. The clone
is just a clone of the handle, nothing fancy going on at the kernel level.
Conceptually I found this very easy to wrap my head around (everything else
supports clone()), and it solved the "split" problem at the same time.

The cloning support is pretty specific per platform/lib combination:

* native/win32 - uses some specific WSA apis to clone the SOCKET handle
* native/unix - uses dup() to get another file descriptor
* green/all - This is where things get interesting. When we support full clones
              of a handle, this implies that we're allowing simultaneous writes
              and reads to happen. It turns out that libuv doesn't support two
              simultaneous reads or writes of the same object. It does support
              *one* read and *one* write at the same time, however. Some extra
              infrastructure was added to just block concurrent writers/readers
              until the previous read/write operation was completed.

I've added tests to the tcp/unix modules to make sure that this functionality is
supported everywhere.

10 years agoImplement clone() for TCP/UDP/Unix sockets
Alex Crichton [Thu, 23 Jan 2014 03:32:16 +0000 (19:32 -0800)]
Implement clone() for TCP/UDP/Unix sockets

This is part of the overall strategy I would like to take when approaching
issue #11165. The only two I/O objects that reasonably want to be "split" are
the network stream objects. Everything else can be "split" by just creating
another version.

The initial idea I had was the literally split the object into a reader and a
writer half, but that would just introduce lots of clutter with extra interfaces
that were a little unnnecssary, or it would return a ~Reader and a ~Writer which
means you couldn't access things like the remote peer name or local socket name.

The solution I found to be nicer was to just clone the stream itself. The clone
is just a clone of the handle, nothing fancy going on at the kernel level.
Conceptually I found this very easy to wrap my head around (everything else
supports clone()), and it solved the "split" problem at the same time.

The cloning support is pretty specific per platform/lib combination:

* native/win32 - uses some specific WSA apis to clone the SOCKET handle
* native/unix - uses dup() to get another file descriptor
* green/all - This is where things get interesting. When we support full clones
              of a handle, this implies that we're allowing simultaneous writes
              and reads to happen. It turns out that libuv doesn't support two
              simultaneous reads or writes of the same object. It does support
              *one* read and *one* write at the same time, however. Some extra
              infrastructure was added to just block concurrent writers/readers
              until the previous read/write operation was completed.

I've added tests to the tcp/unix modules to make sure that this functionality is
supported everywhere.

10 years agorustdoc: update deps
Adrien Tétar [Sun, 2 Feb 2014 10:54:07 +0000 (11:54 +0100)]
rustdoc: update deps

10 years agoetc: add missing license boilerplates
Adrien Tétar [Sun, 2 Feb 2014 10:47:02 +0000 (11:47 +0100)]
etc: add missing license boilerplates

10 years agoetc/tidy: don't check SNAP against triple
Adrien Tétar [Sun, 2 Feb 2014 10:24:43 +0000 (11:24 +0100)]
etc/tidy: don't check SNAP against triple

10 years agoauto merge of #11984 : olsonjeffery/rust/libserialize, r=alexcrichton
bors [Wed, 5 Feb 2014 18:41:34 +0000 (10:41 -0800)]
auto merge of #11984 : olsonjeffery/rust/libserialize, r=alexcrichton

- `extra::json` didn't make the cut, because of `extra::json`'s required
   dep on `extra::TreeMap`. If/when `extra::TreeMap` moves out of `extra`,
   then `extra::json` could move into `libserialize`
- `libextra`, `libsyntax` and `librustc` depend on the newly created
  `libserialize`
- The extensions to various `extra` types like `DList`, `RingBuf`, `TreeMap`
  and `TreeSet` for `Encodable`/`Decodable` were moved into the respective
  modules in `extra`
- There is some trickery, evident in `src/libextra/lib.rs` where a stub
  of `extra::serialize` is set up (in `src/libextra/serialize.rs`) for
  use in the stage0 build, where the snapshot rustc is still making
  deriving for `Encodable` and `Decodable` point at extra. Big props to
  @huonw for help working out the re-export solution for this
- @pcwalton's change in 449a7a8 didn't sneak back in

10 years agopull extra::{serialize, ebml} into a separate libserialize crate
Jeff Olson [Wed, 5 Feb 2014 16:52:54 +0000 (08:52 -0800)]
pull extra::{serialize, ebml} into a separate libserialize crate

- `extra::json` didn't make the cut, because of `extra::json` required
   dep on `extra::TreeMap`. If/when `extra::TreeMap` moves out of `extra`,
   then `extra::json` could move into `serialize`
- `libextra`, `libsyntax` and `librustc` depend on the newly created
  `libserialize`
- The extensions to various `extra` types like `DList`, `RingBuf`, `TreeMap`
  and `TreeSet` for `Encodable`/`Decodable` were moved into the respective
  modules in `extra`
- There is some trickery, evident in `src/libextra/lib.rs` where a stub
  of `extra::serialize` is set up (in `src/libextra/serialize.rs`) for
  use in the stage0 build, where the snapshot rustc is still making
  deriving for `Encodable` and `Decodable` point at extra. Big props to
  @huonw for help working out the re-export solution for this

extra: inline extra::serialize stub

fix stuff clobbered in rebase + don't reexport serialize::serialize

no more globs in libserialize

syntax: fix import of libserialize traits

librustc: fix bad imports in encoder/decoder

add serialize dep to librustdoc

fix failing run-pass tests w/ serialize dep

adjust uuid dep

more rebase de-clobbering for libserialize

fixing tests, pushing libextra dep into cfg(test)

fix doc code in extra::json

adjust index.md links to serialize and uuid library

10 years agoAvoid cloning ast::CrateConfig
Seo Sanghyeon [Wed, 5 Feb 2014 17:16:44 +0000 (02:16 +0900)]
Avoid cloning ast::CrateConfig

10 years agoauto merge of #11939 : JeremyLetang/rust/move-libsync, r=alexcrichton
bors [Wed, 5 Feb 2014 17:21:34 +0000 (09:21 -0800)]
auto merge of #11939 : JeremyLetang/rust/move-libsync, r=alexcrichton

This time everything should be okay, No break due to a failed merge or rebase...

Sorry for the abuse of pull request.

So this move extra::sync, extra::arc, extra::future, extra::comm and extra::task_pool to libsync.

10 years agomove concurrent stuff from libextra to libsync
JeremyLetang [Thu, 30 Jan 2014 20:04:47 +0000 (15:04 -0500)]
move concurrent stuff from libextra to libsync

10 years agoauto merge of #12045 : thestinger/rust/glue, r=pcwalton
bors [Wed, 5 Feb 2014 16:06:37 +0000 (08:06 -0800)]
auto merge of #12045 : thestinger/rust/glue, r=pcwalton

A solid step towards fixing #11998. Eventually, the size may always be
passed to `exchange_free` but this will not be required to fix the bug.

10 years agoauto merge of #12035 : chromatic/rust/tutorial_improvements, r=alexcrichton
bors [Wed, 5 Feb 2014 11:16:35 +0000 (03:16 -0800)]
auto merge of #12035 : chromatic/rust/tutorial_improvements, r=alexcrichton

This cleans up a warning about an unused variable and explains the code
further.

10 years agoauto merge of #12025 : lilac/rust/feature-gate-quote, r=brson
bors [Wed, 5 Feb 2014 09:06:32 +0000 (01:06 -0800)]
auto merge of #12025 : lilac/rust/feature-gate-quote, r=brson

Closes #11630.

10 years agostop calling `exchange_free` on 0-size types
Daniel Micay [Wed, 5 Feb 2014 07:11:06 +0000 (02:11 -0500)]
stop calling `exchange_free` on 0-size types

A solid step towards fixing #11998. Eventually, the size may always be
passed to `exchange_free` but this will not be required to fix the bug.

10 years agoauto merge of #12023 : nick29581/rust/err_res, r=alexcrichton
bors [Wed, 5 Feb 2014 07:46:37 +0000 (23:46 -0800)]
auto merge of #12023 : nick29581/rust/err_res, r=alexcrichton

closes #3512

10 years agoauto merge of #12018 : alexcrichton/rust/triage, r=sfackler
bors [Wed, 5 Feb 2014 05:46:35 +0000 (21:46 -0800)]
auto merge of #12018 : alexcrichton/rust/triage, r=sfackler

Mostly just test suite modifications.

10 years agoauto merge of #12014 : eddyb/rust/less-copies, r=cmr
bors [Wed, 5 Feb 2014 02:41:38 +0000 (18:41 -0800)]
auto merge of #12014 : eddyb/rust/less-copies, r=cmr

10 years agoRun all target crate tests on the windows/try bots
Alex Crichton [Mon, 3 Feb 2014 23:53:43 +0000 (15:53 -0800)]
Run all target crate tests on the windows/try bots

Previously, the check-fast and check-lite test suites weren't picking up all
target crates, rather just std/extra. In order to ensure that all of our crates
work on windows, I've modified these rules to build the test suites for all
TARGET_CRATES members. Note that this still excludes rustc/syntax/rustdoc.

10 years agoMake cfail test error messages more precise
Alex Crichton [Mon, 3 Feb 2014 18:25:12 +0000 (10:25 -0800)]
Make cfail test error messages more precise

Closes #3192

10 years agoAdding tests for closed issues
Alex Crichton [Mon, 3 Feb 2014 18:12:26 +0000 (10:12 -0800)]
Adding tests for closed issues

Closes #5521
Closes #9396
Closes #10714

10 years agoImproved pattern-match code and explanation.
chromatic [Wed, 5 Feb 2014 00:06:41 +0000 (16:06 -0800)]
Improved pattern-match code and explanation.

This cleans up a warning about an unused variable and explains the code
further.

10 years agoauto merge of #11230 : csherratt/rust/cow, r=alexcrichton
bors [Tue, 4 Feb 2014 22:41:36 +0000 (14:41 -0800)]
auto merge of #11230 : csherratt/rust/cow, r=alexcrichton

This allows patch adds a new arc type that allows for creation of copy-on-write data structures. The idea is that it is safe to mutate any data structure as long as it has only one reference to it. If there are multiple, it requires cloning of the data structure before mutation is possible.

10 years agoCheck for trait impl conflicts across crates
Nick Cameron [Tue, 4 Feb 2014 01:31:00 +0000 (14:31 +1300)]
Check for trait impl conflicts across crates

10 years agoDon't copy arguments passed by value with indirection to allocas.
Eduard Burtescu [Tue, 4 Feb 2014 18:53:58 +0000 (20:53 +0200)]
Don't copy arguments passed by value with indirection to allocas.

10 years agoauto merge of #12026 : alexcrichton/rust/snapshots, r=cmr
bors [Tue, 4 Feb 2014 14:31:34 +0000 (06:31 -0800)]
auto merge of #12026 : alexcrichton/rust/snapshots, r=cmr

10 years agoauto merge of #11951 : dmanescu/rust/reserve-rename, r=huonw
bors [Tue, 4 Feb 2014 12:31:34 +0000 (04:31 -0800)]
auto merge of #11951 : dmanescu/rust/reserve-rename, r=huonw

Changes in std::{str,vec,hashmap} and extra::{priority_queue,ringbuf}.
Fixes #11949

10 years agoReplaced with a single "quote" feature gate.
James Deng [Tue, 4 Feb 2014 11:03:00 +0000 (22:03 +1100)]
Replaced with a single "quote" feature gate.

10 years agoauto merge of #11717 : DiamondLovesYou/rust/master, r=alexcrichton
bors [Tue, 4 Feb 2014 09:11:34 +0000 (01:11 -0800)]
auto merge of #11717 : DiamondLovesYou/rust/master, r=alexcrichton

Note that it still doesn't allow generic types to be marked with #[simd].

10 years agoAdded missing xfail-fast.
Richard Diamond [Tue, 4 Feb 2014 08:26:02 +0000 (02:26 -0600)]
Added missing xfail-fast.

10 years agoRegister new snapshots
Alex Crichton [Tue, 4 Feb 2014 08:06:08 +0000 (00:06 -0800)]
Register new snapshots

10 years agoSimd feature gating + Win32/64 fixes.
Richard Diamond [Tue, 4 Feb 2014 07:04:19 +0000 (01:04 -0600)]
Simd feature gating + Win32/64 fixes.

10 years agoFeature gate all quasi-quoting macros.
James Deng [Tue, 4 Feb 2014 05:35:57 +0000 (16:35 +1100)]
Feature gate all quasi-quoting macros.

10 years agoauto merge of #11912 : poiru/rust/8784-libuuid, r=alexcrichton
bors [Tue, 4 Feb 2014 05:21:32 +0000 (21:21 -0800)]
auto merge of #11912 : poiru/rust/8784-libuuid, r=alexcrichton

cc #8784

10 years agoextra: Move uuid to libuuid
Birunthan Mohanathas [Mon, 3 Feb 2014 18:02:47 +0000 (20:02 +0200)]
extra: Move uuid to libuuid
cc #8784

10 years agoauto merge of #12022 : alexcrichton/rust/unblock-snapshot, r=thestinger
bors [Tue, 4 Feb 2014 03:41:31 +0000 (19:41 -0800)]
auto merge of #12022 : alexcrichton/rust/unblock-snapshot, r=thestinger

cc #12021

10 years agoauto merge of #11999 : joaoxsouls/rust/master, r=cmr
bors [Tue, 4 Feb 2014 01:46:37 +0000 (17:46 -0800)]
auto merge of #11999 : joaoxsouls/rust/master, r=cmr

10 years agoRename reserve to reserve_exact and reserve_at_least to reserve
David Manescu [Fri, 31 Jan 2014 13:03:20 +0000 (00:03 +1100)]
Rename reserve to reserve_exact and reserve_at_least to reserve

Changes in std::{str,vec,hashmap} and extra::{priority_queue,ringbuf}.
Fixes #11949

10 years agoxfail a test to unblock the snapshot
Alex Crichton [Tue, 4 Feb 2014 01:12:52 +0000 (17:12 -0800)]
xfail a test to unblock the snapshot

cc #12021

10 years agoauto merge of #12016 : FlaPer87/rust/remove-non-copyable, r=alexcrichton
bors [Tue, 4 Feb 2014 00:31:33 +0000 (16:31 -0800)]
auto merge of #12016 : FlaPer87/rust/remove-non-copyable, r=alexcrichton

cc #10834

10 years agodoc: update boxes section on Manual, remove managed pointers references
joaoxsouls [Sun, 2 Feb 2014 17:33:00 +0000 (17:33 +0000)]
doc: update boxes section on Manual, remove managed pointers references

10 years agoReplace NonCopyable usage with NoPod
Flavio Percoco [Sun, 26 Jan 2014 10:42:46 +0000 (11:42 +0100)]
Replace NonCopyable usage with NoPod

cc #10834

10 years agoauto merge of #12012 : omasanori/rust/semver, r=alexcrichton
bors [Mon, 3 Feb 2014 23:11:44 +0000 (15:11 -0800)]
auto merge of #12012 : omasanori/rust/semver, r=alexcrichton

Done as a part of #8784.

10 years agoauto merge of #11866 : alexcrichton/rust/atomic-u64, r=brson
bors [Mon, 3 Feb 2014 21:11:35 +0000 (13:11 -0800)]
auto merge of #11866 : alexcrichton/rust/atomic-u64, r=brson

Let's try this again.

This is an implementation of mutexes which I believe is free from undefined behavior of OS mutexes (the pitfall of the previous implementation).

This implementation is not ideal. There's a yield-loop spot, and it's not particularly fair with respect to lockers who steal without going through the normal code paths. That being said, I believe that this is a correct implementation which is a stepping stone to move from.

I haven't done rigorous benchmarking of this mutex, but preliminary results show that it's about 25% slower in the uncontended case on linux (same runtime on OSX), and it's actually faster than a pthreads mutex on high contention (again, not rigorous benchmarking, I just saw these numbers come up).