]> git.lizzy.rs Git - rust.git/log
rust.git
10 years agohandle zero-size allocations correctly
Daniel Micay [Sat, 18 Jan 2014 01:45:48 +0000 (20:45 -0500)]
handle zero-size allocations correctly

The `malloc` family of functions may return a null pointer for a
zero-size allocation, which should not be interpreted as an
out-of-memory error.

If the implementation does not return a null pointer, then handling
this will result in memory savings for zero-size types.

This also switches some code to `malloc_raw` in order to maintain a
centralized point for handling out-of-memory in `rt::global_heap`.

Closes #11634

10 years agoauto merge of #11604 : alexcrichton/rust/issue-11162, r=brson
bors [Fri, 17 Jan 2014 21:36:43 +0000 (13:36 -0800)]
auto merge of #11604 : alexcrichton/rust/issue-11162, r=brson

Apparently this isn't necessary, and it's just causing problems.

Closes #11162

10 years agoauto merge of #11598 : alexcrichton/rust/io-export, r=brson
bors [Fri, 17 Jan 2014 20:02:07 +0000 (12:02 -0800)]
auto merge of #11598 : alexcrichton/rust/io-export, r=brson

* Reexport io::mem and io::buffered structs directly under io, make mem/buffered
  private modules
* Remove with_mem_writer
* Remove DEFAULT_CAPACITY and use DEFAULT_BUF_SIZE (in io::buffered)

cc #11119

10 years agoTweak the interface of std::io
Alex Crichton [Wed, 15 Jan 2014 21:25:09 +0000 (13:25 -0800)]
Tweak the interface of std::io

* Reexport io::mem and io::buffered structs directly under io, make mem/buffered
  private modules
* Remove with_mem_writer
* Remove DEFAULT_CAPACITY and use DEFAULT_BUF_SIZE (in io::buffered)

10 years agoauto merge of #11585 : nikomatsakis/rust/issue-3511-rvalue-lifetimes, r=pcwalton
bors [Fri, 17 Jan 2014 15:56:45 +0000 (07:56 -0800)]
auto merge of #11585 : nikomatsakis/rust/issue-3511-rvalue-lifetimes, r=pcwalton

Major changes:

- Define temporary scopes in a syntax-based way that basically defaults
  to the innermost statement or conditional block, except for in
  a `let` initializer, where we default to the innermost block. Rules
  are documented in the code, but not in the manual (yet).
  See new test run-pass/cleanup-value-scopes.rs for examples.
- Refactors Datum to better define cleanup roles.
- Refactor cleanup scopes to not be tied to basic blocks, permitting
  us to have a very large number of scopes (one per AST node).
- Introduce nascent documentation in trans/doc.rs covering datums and
  cleanup in a more comprehensive way.

r? @pcwalton

10 years agoAdjust comments in test case
Niko Matsakis [Fri, 17 Jan 2014 15:47:29 +0000 (10:47 -0500)]
Adjust comments in test case

10 years agoUpdate years on more license headers
Niko Matsakis [Fri, 17 Jan 2014 15:18:39 +0000 (10:18 -0500)]
Update years on more license headers

10 years agoUpdate year on license header
Niko Matsakis [Fri, 17 Jan 2014 15:13:53 +0000 (10:13 -0500)]
Update year on license header

10 years agoauto merge of #11479 : khodzha/rust/peekable_empty, r=brson
bors [Fri, 17 Jan 2014 14:32:01 +0000 (06:32 -0800)]
auto merge of #11479 : khodzha/rust/peekable_empty, r=brson

to fix https://github.com/mozilla/rust/issues/11218

10 years agoChange expansion of `for` loop to use a `match` statement
Niko Matsakis [Fri, 17 Jan 2014 13:30:06 +0000 (08:30 -0500)]
Change expansion of `for` loop to use a `match` statement
so that the "innermost enclosing statement" used for rvalue
temporaries matches up with user expectations

10 years agoExtend temporary lifetimes if there is a ref in an enum binding
Niko Matsakis [Fri, 17 Jan 2014 13:10:42 +0000 (08:10 -0500)]
Extend temporary lifetimes if there is a ref in an enum binding
too.

Previously I had omitted this case since function calls don't get the same
treatment on the RHS, but it's different on the pattern and is more consistent
-- the goal is to identify `let` statements where `ref` bindings create
interior pointers.

10 years agoLink lifetimes in `let` patterns just as we do for `match` patterns
Niko Matsakis [Fri, 17 Jan 2014 13:03:43 +0000 (08:03 -0500)]
Link lifetimes in `let` patterns just as we do for `match` patterns

10 years agoauto merge of #11601 : dguenther/rust/fix_test_summary, r=brson
bors [Fri, 17 Jan 2014 12:11:46 +0000 (04:11 -0800)]
auto merge of #11601 : dguenther/rust/fix_test_summary, r=brson

The test run summary currently prints the wrong number of tests run. This PR fixes it by adding a newline to the log output, and also adds support for counting bench runs.

Closes #11381

10 years agoauto merge of #11498 : c-a/rust/optimize_vuint_at, r=alexcrichton
bors [Fri, 17 Jan 2014 08:01:56 +0000 (00:01 -0800)]
auto merge of #11498 : c-a/rust/optimize_vuint_at, r=alexcrichton

Use a lookup table, SHIFT_MASK_TABLE, that for every possible four
bit prefix holds the number of times the value should be right shifted and what
the right shifted value should be masked with. This way we can get rid of the
branches which in my testing gives approximately a 2x speedup.

Timings on Intel(R) Core(TM) i5-3570K CPU @ 3.40GHz

-- Before --
running 5 tests
test ebml::tests::test_vuint_at ... ok
test ebml::bench::vuint_at_A_aligned          ... bench:       494 ns/iter (+/- 3)
test ebml::bench::vuint_at_A_unaligned        ... bench:       494 ns/iter (+/- 4)
test ebml::bench::vuint_at_D_aligned          ... bench:       467 ns/iter (+/- 5)
test ebml::bench::vuint_at_D_unaligned        ... bench:       467 ns/iter (+/- 5)

-- After --
running 5 tests
test ebml::tests::test_vuint_at ... ok
test ebml::bench::vuint_at_A_aligned ... bench: 181 ns/iter (+/- 2)
test ebml::bench::vuint_at_A_unaligned ... bench: 192 ns/iter (+/- 1)
test ebml::bench::vuint_at_D_aligned ... bench: 181 ns/iter (+/- 3)
test ebml::bench::vuint_at_D_unaligned ... bench: 197 ns/iter (+/- 6)

10 years agoMake main() public in uninit-empty-types
Niko Matsakis [Fri, 17 Jan 2014 06:02:16 +0000 (01:02 -0500)]
Make main() public in uninit-empty-types

10 years agoauto merge of #11553 : klutzy/rust/rustc-cleanups, r=alexcrichton
bors [Fri, 17 Jan 2014 04:56:45 +0000 (20:56 -0800)]
auto merge of #11553 : klutzy/rust/rustc-cleanups, r=alexcrichton

10 years agosyntax::ast: Remove/Recover tests
klutzy [Tue, 14 Jan 2014 09:47:29 +0000 (18:47 +0900)]
syntax::ast: Remove/Recover tests

`xorpush_test` and `test_marksof` are at `syntax::ast_util`.

Fixes #7952

10 years agorustc::metadata: Remove trait FileSearch
klutzy [Mon, 13 Jan 2014 16:31:57 +0000 (01:31 +0900)]
rustc::metadata: Remove trait FileSearch

10 years agorustc::driver: Capitalize structs and enums
klutzy [Mon, 13 Jan 2014 16:31:05 +0000 (01:31 +0900)]
rustc::driver: Capitalize structs and enums

driver::session::crate_metadata is unused; removed.

10 years agoauto merge of #11584 : alexcrichton/rust/issue-3862, r=brson
bors [Fri, 17 Jan 2014 03:21:45 +0000 (19:21 -0800)]
auto merge of #11584 : alexcrichton/rust/issue-3862, r=brson

Turns out there is no documentation of a block expression in the rust manual currently! I deleted the "record expressions" section to make room for a "block expressions" section.

Closes #3862

10 years agoauto merge of #11151 : sfackler/rust/ext-crate, r=alexcrichton
bors [Fri, 17 Jan 2014 00:36:53 +0000 (16:36 -0800)]
auto merge of #11151 : sfackler/rust/ext-crate, r=alexcrichton

This is a first pass on support for procedural macros that aren't hardcoded into libsyntax. It is **not yet ready to merge** but I've opened a PR to have a chance to discuss some open questions and implementation issues.

Example
=======
Here's a silly example showing off the basics:

my_synext.rs
```rust
#[feature(managed_boxes, globs, macro_registrar, macro_rules)];

extern mod syntax;

use syntax::ast::{Name, token_tree};
use syntax::codemap::Span;
use syntax::ext::base::*;
use syntax::parse::token;

#[macro_export]
macro_rules! exported_macro (() => (2))

#[macro_registrar]
pub fn macro_registrar(register: |Name, SyntaxExtension|) {
    register(token::intern(&"make_a_1"),
        NormalTT(@SyntaxExpanderTT {
            expander: SyntaxExpanderTTExpanderWithoutContext(expand_make_a_1),
            span: None,
        } as @SyntaxExpanderTTTrait,
        None));
}

pub fn expand_make_a_1(cx: &mut ExtCtxt, sp: Span, tts: &[token_tree]) -> MacResult {
    if !tts.is_empty() {
        cx.span_fatal(sp, "make_a_1 takes no arguments");
    }
    MRExpr(quote_expr!(cx, 1i))
}
```

main.rs:
```rust
#[feature(phase)];

#[phase(syntax)]
extern mod my_synext;

fn main() {
    assert_eq!(1, make_a_1!());
    assert_eq!(2, exported_macro!());
}
```

Overview
=======
Crates that contain syntax extensions need to define a function with the following signature and annotation:
```rust
#[macro_registrar]
pub fn registrar(register: |ast::Name, ext::base::SyntaxExtension|) { ... }
```
that should call the `register` closure with each extension it defines. `macro_rules!` style macros can be tagged with `#[macro_export]` to be exported from the crate as well.

Crates that wish to use externally loadable syntax extensions load them by adding the `#[phase(syntax)]` attribute to an `extern mod`. All extensions registered by the specified crate are loaded with the same scoping rules as `macro_rules!` macros. If you want to use a crate both for syntax extensions and normal linkage, you can use `#[phase(syntax, link)]`.

Open questions
===========
* ~~Does the `macro_crate` syntax make sense? It wraps an entire `extern mod` declaration which looks a bit weird but is nice in the sense that the crate lookup logic can be identical between normal external crates and external macro crates. If the `extern mod` syntax, changes, this will get it for free, etc.~~ Changed to a `phase` attribute.
* ~~Is the magic name `macro_crate_registration` the right way to handle extension registration? It could alternatively be handled by a function annotated with `#[macro_registration]` I guess.~~ Switched to an attribute.
* The crate loading logic lives inside of librustc, which means that the syntax extension infrastructure can't directly access it. I've worked around this by passing a `CrateLoader` trait object from the driver to libsyntax that can call back into the crate loading logic. It should be possible to pull things apart enough that this isn't necessary anymore, but it will be an enormous refactoring project. I think we'll need to create a couple of new libraries: libsynext libmetadata/ty and libmiddle.
* Item decorator extensions can be loaded but the `deriving` decorator itself can't be extended so you'd need to do e.g. `#[deriving_MyTrait] #[deriving(Clone)]` instead of `#[deriving(MyTrait, Clone)]`. Is this something worth bothering with for now?

Remaining work
===========
- [x] ~~There is not yet support for rustdoc downloading and compiling referenced macro crates as it does for other referenced crates. This shouldn't be too hard I think.~~
- [x] ~~This is not testable at stage1 and sketchily testable at stages above that. The stage *n* rustc links against the stage *n-1* libsyntax and librustc. Unfortunately, crates in the test/auxiliary directory link against the stage *n* libstd, libextra, libsyntax, etc. This causes macro crates to fail to properly dynamically link into rustc since names end up being mangled slightly differently. In addition, when rustc is actually installed onto a system, there are actually do copies of libsyntax, libstd, etc: the ones that user code links against and a separate set from the previous stage that rustc itself uses. By this point in the bootstrap process, the two library versions *should probably* be binary compatible, but it doesn't seem like a sure thing. Fixing this is apparently hard, but necessary to properly cross compile as well and is being tracked in #11145.~~ The offending tests are ignored during `check-stage1-rpass` and `check-stage1-cfail`. When we get a snapshot that has this commit, I'll look into how feasible it'll be to get them working on stage1.
- [x] ~~`macro_rules!` style macros aren't being exported. Now that the crate loading infrastructure is there, this should just require serializing the AST of the macros into the crate metadata and yanking them out again, but I'm not very familiar with that part of the compiler.~~
- [x] ~~The `macro_crate_registration` function isn't type-checked when it's loaded. I poked around in the `csearch` infrastructure a bit but didn't find any super obvious ways of checking the type of an item with a certain name. Fixing this may also eliminate the need to `#[no_mangle]` the registration function.~~ Now that the registration function is identified by an attribute, typechecking this will be like typechecking other annotated functions.
- [x] ~~The dynamic libraries that are loaded are never unloaded. It shouldn't require too much work to tie the lifetime of the `DynamicLibrary` object to the `MapChain` that its extensions are loaded into.~~
- [x] ~~The compiler segfaults sometimes when loading external crates. The `DynamicLibrary` reference and code objects from that library are both put into the same hash table. When the table drops, due to the random ordering the library sometimes drops before the objects do. Once #11228 lands it'll be easy to fix this.~~

10 years agoDistinguish zero-size types from those that we return as void
Niko Matsakis [Fri, 17 Jan 2014 00:10:17 +0000 (19:10 -0500)]
Distinguish zero-size types from those that we return as void

10 years agoFix uninit() intrinsic when used with empty types
Niko Matsakis [Thu, 16 Jan 2014 23:47:42 +0000 (18:47 -0500)]
Fix uninit() intrinsic when used with empty types

10 years agoFix test to account for new temporary lifetime rules, which cause the channel to...
Niko Matsakis [Thu, 16 Jan 2014 23:47:22 +0000 (18:47 -0500)]
Fix test to account for new temporary lifetime rules, which cause the channel to be dropped prematurely.

10 years agoLoad macros from external modules
Steven Fackler [Wed, 25 Dec 2013 18:10:33 +0000 (11:10 -0700)]
Load macros from external modules

10 years agoFurther refine treatment of voidish arrays
Niko Matsakis [Thu, 16 Jan 2014 21:18:46 +0000 (16:18 -0500)]
Further refine treatment of voidish arrays

10 years agoDon't run 'ar s' on OSX
Alex Crichton [Thu, 16 Jan 2014 20:18:22 +0000 (12:18 -0800)]
Don't run 'ar s' on OSX

Apparently this isn't necessary, and it's just causing problems.

Closes #11162

10 years agoConsider all zero-sized data structures to be voidish, bypassing some "quirky" parts...
Niko Matsakis [Thu, 16 Jan 2014 20:11:22 +0000 (15:11 -0500)]
Consider all zero-sized data structures to be voidish, bypassing some "quirky" parts of LLVM (see e.g. LLVM bug 9900) but also generating better code

10 years agoauto merge of #11571 : derekchiang/rust/fix-task-docs, r=alexcrichton
bors [Thu, 16 Jan 2014 19:26:40 +0000 (11:26 -0800)]
auto merge of #11571 : derekchiang/rust/fix-task-docs, r=alexcrichton

There might be a reason, but I failed to see why these comments couldn't be proper rust docs.

10 years agoDocument blocks and use statements a little more
Alex Crichton [Wed, 15 Jan 2014 22:44:47 +0000 (14:44 -0800)]
Document blocks and use statements a little more

Closes #3862

10 years agoauto merge of #11599 : sanxiyn/rust/accurate-span-3, r=luqmana
bors [Thu, 16 Jan 2014 17:01:49 +0000 (09:01 -0800)]
auto merge of #11599 : sanxiyn/rust/accurate-span-3, r=luqmana

10 years agoUpdate test run summary
Derek Guenther [Thu, 16 Jan 2014 15:35:47 +0000 (09:35 -0600)]
Update test run summary

10 years agoauto merge of #11597 : sfackler/rust/err-enums, r=alexcrichton
bors [Thu, 16 Jan 2014 15:06:58 +0000 (07:06 -0800)]
auto merge of #11597 : sfackler/rust/err-enums, r=alexcrichton

An enum allows callers to deal with errors in a more reasonable way.

10 years agoauto merge of #11596 : derekchiang/rust/fix-libnative-docs, r=alexcrichton
bors [Thu, 16 Jan 2014 13:51:44 +0000 (05:51 -0800)]
auto merge of #11596 : derekchiang/rust/fix-libnative-docs, r=alexcrichton

10 years agoCorrect span for ExprCall and ExprIndex
Seo Sanghyeon [Thu, 16 Jan 2014 13:45:01 +0000 (22:45 +0900)]
Correct span for ExprCall and ExprIndex

10 years agoauto merge of #11590 : vadimcn/rust/llvm-tools, r=alexcrichton
bors [Thu, 16 Jan 2014 12:31:52 +0000 (04:31 -0800)]
auto merge of #11590 : vadimcn/rust/llvm-tools, r=alexcrichton

Closes #10893 - because we'll no longer build llvm-c-test

10 years agoauto merge of #11588 : am0d/rust/dox, r=brson
bors [Thu, 16 Jan 2014 11:06:48 +0000 (03:06 -0800)]
auto merge of #11588 : am0d/rust/dox, r=brson

This is a bit cleaner and means we don't need whitespace at the end of each line to force line breaks.

10 years agoRemove typo
Niko Matsakis [Thu, 16 Jan 2014 10:56:56 +0000 (05:56 -0500)]
Remove typo

10 years agoauto merge of #11579 : kballard/rust/windows-path-join, r=erickt
bors [Thu, 16 Jan 2014 08:51:44 +0000 (00:51 -0800)]
auto merge of #11579 : kballard/rust/windows-path-join, r=erickt

WindowsPath::new("C:").join("a") produces r"C:\a". This is incorrect.
It should produce "C:a".

10 years agoStop returning error strings in From{Base64,Hex}
Steven Fackler [Thu, 16 Jan 2014 07:15:04 +0000 (23:15 -0800)]
Stop returning error strings in From{Base64,Hex}

An enum allows callers to deal with errors in a more reasonable way.

10 years agoFix some docs in std::rt::task
Derek Chiang [Wed, 15 Jan 2014 17:34:05 +0000 (01:34 +0800)]
Fix some docs in std::rt::task

10 years agoFixing a typo: bookeeping -> bookkeeping
Derek Chiang [Wed, 15 Jan 2014 18:24:42 +0000 (02:24 +0800)]
Fixing a typo: bookeeping -> bookkeeping

10 years agoauto merge of #11575 : pcwalton/rust/parse-substrs, r=alexcrichton
bors [Thu, 16 Jan 2014 05:51:42 +0000 (21:51 -0800)]
auto merge of #11575 : pcwalton/rust/parse-substrs, r=alexcrichton

This was used by the quasiquoter.

r? @alexcrichton

10 years agoauto merge of #11548 : bjz/rust/bitwise, r=alexcrichton
bors [Thu, 16 Jan 2014 04:36:48 +0000 (20:36 -0800)]
auto merge of #11548 : bjz/rust/bitwise, r=alexcrichton

One less trait in `std::num` and three less exported in the prelude.

cc. #10387

10 years agoauto merge of #11574 : neeee/rust/master, r=alexcrichton
bors [Thu, 16 Jan 2014 03:06:45 +0000 (19:06 -0800)]
auto merge of #11574 : neeee/rust/master, r=alexcrichton

Reverted according to https://github.com/mozilla/rust/issues/11458#issuecomment-32269477. Fixes #11458.

10 years agoUpdate docs index to use lists
a_m0d [Thu, 16 Jan 2014 01:19:36 +0000 (20:19 -0500)]
Update docs index to use lists

Also include a missing link to the rustdoc manual

10 years agoOnly build LLVM tools Rust needs.
Vadim Chugunov [Thu, 16 Jan 2014 01:47:48 +0000 (17:47 -0800)]
Only build LLVM tools Rust needs.

10 years agoauto merge of #11565 : mozilla/rust/snapshot, r=huonw
bors [Thu, 16 Jan 2014 01:46:42 +0000 (17:46 -0800)]
auto merge of #11565 : mozilla/rust/snapshot, r=huonw

10 years agoCleanup trait callees
Niko Matsakis [Thu, 16 Jan 2014 01:31:20 +0000 (20:31 -0500)]
Cleanup trait callees

10 years agoMerge Bitwise and BitCount traits and remove from prelude, along with Bounded
Brendan Zabarauskas [Wed, 15 Jan 2014 00:32:04 +0000 (11:32 +1100)]
Merge Bitwise and BitCount traits and remove from prelude, along with Bounded

One less trait in std::num, and three less exported in the prelude.

10 years agoRemove FIXMEs and add license
Niko Matsakis [Thu, 16 Jan 2014 00:44:38 +0000 (19:44 -0500)]
Remove FIXMEs and add license

10 years agoUse as_slice() method on option
Niko Matsakis [Thu, 16 Jan 2014 00:35:38 +0000 (19:35 -0500)]
Use as_slice() method on option

10 years agoauto merge of #11568 : FlaPer87/rust/even, r=alexcrichton
bors [Thu, 16 Jan 2014 00:02:01 +0000 (16:02 -0800)]
auto merge of #11568 : FlaPer87/rust/even, r=alexcrichton

This implementation should be a bit more optimal than calling `self.is_multiple_of(&2)`

10 years agoIssue #3511 - Rationalize temporary lifetimes.
Niko Matsakis [Wed, 15 Jan 2014 19:39:08 +0000 (14:39 -0500)]
Issue #3511 - Rationalize temporary lifetimes.

Major changes:

- Define temporary scopes in a syntax-based way that basically defaults
  to the innermost statement or conditional block, except for in
  a `let` initializer, where we default to the innermost block. Rules
  are documented in the code, but not in the manual (yet).
  See new test run-pass/cleanup-value-scopes.rs for examples.
- Refactors Datum to better define cleanup roles.
- Refactor cleanup scopes to not be tied to basic blocks, permitting
  us to have a very large number of scopes (one per AST node).
- Introduce nascent documentation in trans/doc.rs covering datums and
  cleanup in a more comprehensive way.

10 years agoauto merge of #11550 : alexcrichton/rust/noinline, r=thestinger
bors [Wed, 15 Jan 2014 21:51:50 +0000 (13:51 -0800)]
auto merge of #11550 : alexcrichton/rust/noinline, r=thestinger

The failure functions are generic, meaning they're candidates for getting
inlined across crates. This has been happening, leading to monstrosities like
that found in #11549. I have verified that the codegen is *much* better now that
we're not inlining the failure path (the slow path).

10 years agopath: Fix joining Windows path when the receiver is "C:"
Kevin Ballard [Wed, 15 Jan 2014 20:53:56 +0000 (12:53 -0800)]
path: Fix joining Windows path when the receiver is "C:"

WindowsPath::new("C:").join("a") produces r"C:\a". This is incorrect.
It should produce "C:a".

10 years agoauto merge of #11112 : alexcrichton/rust/issue-11087, r=brson
bors [Wed, 15 Jan 2014 20:37:00 +0000 (12:37 -0800)]
auto merge of #11112 : alexcrichton/rust/issue-11087, r=brson

This should allow callers to know whether the channel was empty or disconnected
without having to block.

Closes #11087

10 years agofixup! ebml::extra: Optimize reader::vuint_at()
Carl-Anton Ingmarsson [Wed, 15 Jan 2014 19:58:41 +0000 (20:58 +0100)]
fixup! ebml::extra: Optimize reader::vuint_at()

10 years agoAllow more "error" values in try_recv()
Alex Crichton [Sun, 22 Dec 2013 06:15:04 +0000 (22:15 -0800)]
Allow more "error" values in try_recv()

This should allow callers to know whether the channel was empty or disconnected
without having to block.

Closes #11087

10 years agoauto merge of #11543 : thestinger/rust/gc, r=cmr
bors [Wed, 15 Jan 2014 19:21:45 +0000 (11:21 -0800)]
auto merge of #11543 : thestinger/rust/gc, r=cmr

This type isn't yet very useful since it only pretends cycles won't be
a problem. Anyone using it should be made aware that they're going to
leak.

10 years agolibsyntax: Remove the obsolete ability to parse from substrings.
Patrick Walton [Wed, 15 Jan 2014 18:58:29 +0000 (10:58 -0800)]
libsyntax: Remove the obsolete ability to parse from substrings.

This was used by the quasiquoter.

10 years agoUse the least significant beat to determine if int/uint is even
Flavio Percoco [Wed, 15 Jan 2014 16:42:23 +0000 (17:42 +0100)]
Use the least significant beat to determine if int/uint is even

10 years agoauto merge of #11523 : alexcrichton/rust/stage3, r=brson
bors [Wed, 15 Jan 2014 17:51:46 +0000 (09:51 -0800)]
auto merge of #11523 : alexcrichton/rust/stage3, r=brson

This should go back to the old behavior while preserving the snapshot ease.

10 years agoRevert "show options for -W help and -W". Fixes #11458.
lucy [Wed, 15 Jan 2014 17:31:48 +0000 (18:31 +0100)]
Revert "show options for -W help and -W". Fixes #11458.

This reverts commit 1009c21ad7b1db366a5c600946652cc490598ec1.

10 years agoAdd a configure to disable libstd version injection
Alex Crichton [Tue, 14 Jan 2014 01:29:50 +0000 (17:29 -0800)]
Add a configure to disable libstd version injection

We'll use this when building snapshots so we can upgrade freely, but all
compilers will inject a version by default.

10 years agoauto merge of #11564 : am0d/rust/dox, r=huonw
bors [Wed, 15 Jan 2014 15:46:37 +0000 (07:46 -0800)]
auto merge of #11564 : am0d/rust/dox, r=huonw

Needs a line break here for readability.

10 years agoauto merge of #11561 : eddyb/rust/moar-inlines, r=pcwalton
bors [Wed, 15 Jan 2014 14:26:38 +0000 (06:26 -0800)]
auto merge of #11561 : eddyb/rust/moar-inlines, r=pcwalton

10 years agoremove the concept of managed-unique from libstd
Daniel Micay [Wed, 15 Jan 2014 12:47:37 +0000 (07:47 -0500)]
remove the concept of managed-unique from libstd

Closes #11545

10 years agoregister snapshots
Daniel Micay [Wed, 15 Jan 2014 12:18:40 +0000 (07:18 -0500)]
register snapshots

10 years agoauto merge of #11556 : am0d/rust/docs, r=huonw
bors [Wed, 15 Jan 2014 13:01:47 +0000 (05:01 -0800)]
auto merge of #11556 : am0d/rust/docs, r=huonw

10 years agoFix formatting in rust-guide document.
a_m0d [Wed, 15 Jan 2014 12:20:04 +0000 (07:20 -0500)]
Fix formatting in rust-guide document.

10 years agoauto merge of #11557 : brson/rust/anotherandroidfix, r=thestinger
bors [Wed, 15 Jan 2014 11:36:43 +0000 (03:36 -0800)]
auto merge of #11557 : brson/rust/anotherandroidfix, r=thestinger

10 years agolibstd: Added more #[inline] annotations and replaced uses of `libc::abort` with...
Eduard Burtescu [Wed, 15 Jan 2014 09:45:12 +0000 (11:45 +0200)]
libstd: Added more #[inline] annotations and replaced uses of `libc::abort` with the intrinsic.

10 years agoauto merge of #11535 : thestinger/rust/header, r=alexcrichton
bors [Wed, 15 Jan 2014 07:01:51 +0000 (23:01 -0800)]
auto merge of #11535 : thestinger/rust/header, r=alexcrichton

Unique pointers and vectors currently contain a reference counting
header when containing a managed pointer.

This `{ ref_count, type_desc, prev, next }` header is not necessary and
not a sensible foundation for tracing. It adds needless complexity to
library code and is responsible for breakage in places where the branch
 has been left out.

The `borrow_offset` field can now be removed from `TyDesc` along with
the associated handling in the compiler.

Closes #9510
Closes #11533

10 years agoFlag failure functions as inline(never)
Alex Crichton [Wed, 15 Jan 2014 02:02:19 +0000 (18:02 -0800)]
Flag failure functions as inline(never)

The failure functions are generic, meaning they're candidates for getting
inlined across crates. This has been happening, leading to monstrosities like
that found in #11549. I have verified that the codegen is *much* better now that
we're not inlining the failure path (the slow path).

10 years agoauto merge of #11547 : b1nd/rust/rust-doc, r=alexcrichton
bors [Wed, 15 Jan 2014 04:56:39 +0000 (20:56 -0800)]
auto merge of #11547 : b1nd/rust/rust-doc, r=alexcrichton

closes #10535

10 years agoextra: Ignore time tests on android correctly
Brian Anderson [Wed, 15 Jan 2014 03:57:59 +0000 (19:57 -0800)]
extra: Ignore time tests on android correctly

10 years agoMark LineIterator as public so its docs get generated.
a_m0d [Wed, 15 Jan 2014 03:13:54 +0000 (22:13 -0500)]
Mark LineIterator as public so its docs get generated.

10 years agoadd implementation of `Repr` for `~[T]`
Daniel Micay [Tue, 14 Jan 2014 21:33:08 +0000 (16:33 -0500)]
add implementation of `Repr` for `~[T]`

10 years agoremove `borrow_offset` as ~ is now free of headers
Daniel Micay [Tue, 14 Jan 2014 21:20:09 +0000 (16:20 -0500)]
remove `borrow_offset` as ~ is now free of headers

10 years agoremove reference counting headers from ~
Daniel Micay [Tue, 14 Jan 2014 07:46:58 +0000 (02:46 -0500)]
remove reference counting headers from ~

Unique pointers and vectors currently contain a reference counting
header when containing a managed pointer.

This `{ ref_count, type_desc, prev, next }` header is not necessary and
not a sensible foundation for tracing. It adds needless complexity to
library code and is responsible for breakage in places where the branch
has been left out.

The `borrow_offset` field can now be removed from `TyDesc` along with
the associated handling in the compiler.

Closes #9510
Closes #11533

10 years agoauto merge of #11546 : huonw/rust/trie-insert, r=alexcrichton
bors [Wed, 15 Jan 2014 02:56:36 +0000 (18:56 -0800)]
auto merge of #11546 : huonw/rust/trie-insert, r=alexcrichton

This reduces the number of moves/memcpy's we do, which makes insert
faster, especially in cases of keys with long equal prefixes (the
\_low_bits tests):

Before:

    bench_insert_large                ... bench:    553966 ns/iter (+/- 64050)
    bench_insert_large_low_bits       ... bench:   1048151 ns/iter (+/- 92484)
    bench_insert_small                ... bench:    168840 ns/iter (+/- 22410)
    bench_insert_small_low_bits       ... bench:    185069 ns/iter (+/- 38332)

After:

    bench_insert_large                ... bench:    422132 ns/iter (+/- 35112)
    bench_insert_large_low_bits       ... bench:    339083 ns/iter (+/- 34421)
    bench_insert_small                ... bench:    134539 ns/iter (+/- 15254)
    bench_insert_small_low_bits       ... bench:     88775 ns/iter (+/- 5746)

Notably: no unsafe code.

10 years agoRemoved redundant code, improve performance
b1nd [Wed, 15 Jan 2014 01:09:50 +0000 (12:09 +1100)]
Removed redundant code, improve performance

closes #10535

10 years agostd::trie: optimise insert slightly.
Huon Wilson [Wed, 15 Jan 2014 00:58:02 +0000 (11:58 +1100)]
std::trie: optimise insert slightly.

This reduces the number of moves/memcpy's we do, which makes insert
faster, especially in cases of keys with long equal prefixes (the
_low_bits tests):

Before:

    bench_insert_large                ... bench:    553966 ns/iter (+/- 64050)
    bench_insert_large_low_bits       ... bench:   1048151 ns/iter (+/- 92484)
    bench_insert_small                ... bench:    168840 ns/iter (+/- 22410)
    bench_insert_small_low_bits       ... bench:    185069 ns/iter (+/- 38332)

After:

    bench_insert_large                ... bench:    422132 ns/iter (+/- 35112)
    bench_insert_large_low_bits       ... bench:    339083 ns/iter (+/- 34421)
    bench_insert_small                ... bench:    134539 ns/iter (+/- 15254)
    bench_insert_small_low_bits       ... bench:     88775 ns/iter (+/- 5746)

10 years agostd::trie: add benchmarks for insert.
Huon Wilson [Wed, 15 Jan 2014 00:32:53 +0000 (11:32 +1100)]
std::trie: add benchmarks for insert.

10 years agoauto merge of #11521 : dguenther/rust/hide_libdir_relative, r=alexcrichton
bors [Tue, 14 Jan 2014 23:11:30 +0000 (15:11 -0800)]
auto merge of #11521 : dguenther/rust/hide_libdir_relative, r=alexcrichton

Renamed `LIBDIR_RELATIVE` to `CFG_LIBDIR_RELATIVE`. It's not a configurable variable, but it looks out of place without the `CFG_` prefix.

Fixes #11420

10 years agoadd an experimental tag for Gc<T> due to cycles
Daniel Micay [Tue, 14 Jan 2014 10:17:19 +0000 (05:17 -0500)]
add an experimental tag for Gc<T> due to cycles

This type isn't yet very useful since it only pretends cycles won't be
a problem. Anyone using it should be made aware that they're going to
leak.

10 years agoRenamed LIBDIR_RELATIVE to CFG_LIBDIR_RELATIVE
Derek Guenther [Tue, 14 Jan 2014 00:45:33 +0000 (18:45 -0600)]
Renamed LIBDIR_RELATIVE to CFG_LIBDIR_RELATIVE

10 years agoauto merge of #11538 : eddyb/rust/llvm-attributes, r=alexcrichton
bors [Tue, 14 Jan 2014 21:51:34 +0000 (13:51 -0800)]
auto merge of #11538 : eddyb/rust/llvm-attributes, r=alexcrichton

10 years agoauto merge of #11485 : eddyb/rust/sweep-old-rust, r=nikomatsakis
bors [Tue, 14 Jan 2014 20:32:11 +0000 (12:32 -0800)]
auto merge of #11485 : eddyb/rust/sweep-old-rust, r=nikomatsakis

10 years agoauto merge of #11539 : dotdash/rust/void_type_fixup, r=alexcrichton
bors [Tue, 14 Jan 2014 19:16:38 +0000 (11:16 -0800)]
auto merge of #11539 : dotdash/rust/void_type_fixup, r=alexcrichton

Currently, we have c_void defined to be represented as an empty struct,
but LLVM expects C's void* to be represented as i8*. That means we
currently generate code in which LLVM doesn't recognize malloc() and
free() and can't apply certain optimization that would remove calls to
those functions.

10 years agoFix the representation of C void pointers in LLVM IR
Björn Steinbrink [Tue, 14 Jan 2014 17:01:24 +0000 (18:01 +0100)]
Fix the representation of C void pointers in LLVM IR

Currently, we have c_void defined to be represented as an empty struct,
but LLVM expects C's void* to be represented as i8*. That means we
currently generate code in which LLVM doesn't recognize malloc() and
free() and can't apply certain optimization that would remove calls to
those functions.

10 years agoauto merge of #11507 : omasanori/rust/reduce-po, r=alexcrichton
bors [Tue, 14 Jan 2014 17:56:39 +0000 (09:56 -0800)]
auto merge of #11507 : omasanori/rust/reduce-po, r=alexcrichton

This work is done by execute these commands manually:

    $ po4a --copyright-holders="The Rust Project Developers" \
        --package-name="Rust" \
        --package-version="0.10-pre" \
        -M UTF-8 -L UTF-8 \
        doc/po4a.conf
    $ for f in doc/po/**/*.po; do
    >   msgattrib --untranslated $f -o $f.strip
    >   if [ -e $f.strip ]; then
    >       mv $f.strip $f
    >   else
    >       rm $f
    >   fi
    > done

It should be managed by the build system automatically to use in our
translation workflow, but I've not yet done that.

At least one mostly-translated (over 80% translation rate) document is needed to test the translation workflow, so I'll working on Japanese translation.

10 years agoAdd noalias and noreturn attributes in more cases.
Eduard Burtescu [Tue, 14 Jan 2014 17:17:38 +0000 (19:17 +0200)]
Add noalias and noreturn attributes in more cases.

10 years agoauto merge of #11438 : b1nd/rust/rust-doc, r=alexcrichton
bors [Tue, 14 Jan 2014 16:41:38 +0000 (08:41 -0800)]
auto merge of #11438 : b1nd/rust/rust-doc, r=alexcrichton

cc @cmr

Temporary change to issue #10535. Requires significant re-factoring to search completely based on the index paths. For example searching for "File::" in this fix will return no results. Still need to search completely based on path (rather than name's + types) to completely fix. Will continue to work this

10 years agorenamed empty() to is_empty()
Shamir Khodzha [Tue, 14 Jan 2014 14:38:06 +0000 (18:38 +0400)]
renamed empty() to is_empty()

10 years agoNote that translation workflow is WIP now.
OGINO Masanori [Tue, 14 Jan 2014 12:30:15 +0000 (21:30 +0900)]
Note that translation workflow is WIP now.

Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
10 years agoAdd notes for translators.
OGINO Masanori [Mon, 13 Jan 2014 06:18:04 +0000 (15:18 +0900)]
Add notes for translators.

Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
10 years agoUpdate .po and strip down untranslated entries.
OGINO Masanori [Mon, 13 Jan 2014 03:18:17 +0000 (12:18 +0900)]
Update .po and strip down untranslated entries.

This work is done by execute these commands manually:

$ po4a --copyright-holder="The Rust Project Developers" \
    --package-name="Rust" \
    --package-version="0.10-pre" \
    -M UTF-8 -L UTF-8 \
    doc/po4a.conf
$ for f in doc/po/**/*.po; do
>   msgattrib --translated $f -o $f.strip
>   if [ -e $f.strip ]; then
>       mv $f.strip $f
>   else
>       rm $f
>   fi
> done

It should be managed by the build system automatically to use in our
translation workflow, but I've not yet done that.

Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
10 years agoCompleted patch searching for rust docs
b1nd [Fri, 10 Jan 2014 04:59:53 +0000 (15:59 +1100)]
Completed patch searching for rust docs
Made temporary changes to include multiple keywords in rustdoc search

Implemented search based on multiple keywords

Added some commenting and house cleaning

Added path searching to rustdoc