Commit Graph

22304 Commits

Author SHA1 Message Date
Marvin Löbel
76c3e8a38c Add an SendStr type
A SendStr is a string that can hold either a ~str or a &'static str.
This can be useful as an optimization when an allocation is sometimes needed but the common case is statically known.

Possible use cases include Maps with both static and owned keys, or propagating error messages across task boundaries.

SendStr implements most basic traits in a way that hides the fact that it is an enum; in particular things like order and equality are only determined by the content of the wrapped strings.

Replaced std::rt:logging::SendableString with SendStr
Added tests for using an SendStr as key in Hash- and Treemaps
2013-09-16 16:57:50 +02:00
bors
3e1803f3af auto merge of #8540 : cmr/rust/rustdoc_ng, r=catamorphism
This doesn't enable it by default yet, or include the frontend. But the tool
is pretty much done, and it'd be nice to stave off bitrot.

I couldn't get it to actually build with the Makefile though. I don't really
understand what is going on in that makefile at all. Could @graydon or
@pnkfelix lend a hand?
2013-09-16 04:40:47 -07:00
Corey Richardson
0298c3ca10 rustdoc_ng: add licenses and issue numbers to appease tidy 2013-09-16 07:28:44 -04:00
Corey Richardson
c1d977a638 Update rustdoc_ng to syntax and metadata changes 2013-09-16 07:26:50 -04:00
Corey Richardson
be2f85e24f Update rustdoc_ng to new ast naming 2013-09-16 07:26:49 -04:00
Felix S. Klock II
136900fdbb Finish addition of rustdoc_ng to Makefiles. 2013-09-16 07:26:49 -04:00
Corey Richardson
268f3f0ff5 Add rustdoc_ng 2013-09-16 07:26:48 -04:00
bors
d87078be72 auto merge of #9206 : alexcrichton/rust/issue-9188, r=catamorphism
While they may have the same name within various scopes, this changes static
names to use path_pretty_name to append some hash information at the end of the
symbol. We're then guaranteed that each static has a unique NodeId, so this
NodeId is as the "hash" of the pretty name.

Closes #9188
2013-09-16 02:45:49 -07:00
bors
610c0cdf11 auto merge of #9196 : alexcrichton/rust/attempting-9055, r=cmr
Beforehand it was assumed that the standard cdecl abi was used for all extern
fns of extern crates, but this reads the abi of the extern fn type and declares
the function in the local crate with the appropriate type.

I was trying to think of how to write a test for this, but I was just drawing up blanks :(. Are there standard functions in libc which are not of the cdecl abi? If so we could try linking to them and make sure that the cal completes successfully.

Otherwise, I manually verified that the function was declared correctly by looking at the llvm assembly.

cc #9055 (I'm not sure if this will fix that issue)
2013-09-16 01:30:52 -07:00
bors
b05dccacae auto merge of #9187 : lkuper/rust/no-simplevisitor, r=catamorphism
We don't seem to be using `SimpleVisitor` anywhere in rustc.  Is there any reason to keep it around?

r? anyone
2013-09-16 00:15:52 -07:00
bors
3fbfab03d2 auto merge of #9118 : alexcrichton/rust/llvm-fix, r=sanxiyn
I created a new branch  rust-llvm-2013-09-11 in my llvm repo to mark this momentous occasion
2013-09-15 22:30:55 -07:00
bors
2de2fb1c91 auto merge of #9219 : thestinger/rust/function-split, r=alexcrichton 2013-09-15 21:00:54 -07:00
Alex Crichton
297ac739d8 When declaring extern fns from external crates, use the correct abi
Beforehand it was assumed that the standard cdecl abi was used for all extern
fns of extern crates, but this reads the abi of the extern fn type and declares
the function in the local crate with the appropriate type.
2013-09-15 20:42:06 -07:00
Daniel Micay
6d0a847c3a teach Call/CallWithConv to set attributes 2013-09-15 23:34:11 -04:00
Alex Crichton
3cb0bc6523 Upgrade LLVM to close #9117 2013-09-15 20:26:40 -07:00
Daniel Micay
137eb346f6 remove unused FastCall wrapper
this can just be done using CallWithConv
2013-09-15 23:26:25 -04:00
bors
72f62abebf auto merge of #9213 : dcrewi/rust/rust-test-arguments, r=catamorphism
The arguments after `rust test filename.rs` should be passed through
to the test binary. This allows the `rust` command to be used to run a
subset of tests, to run ignored tests, and to run benchmarks.
2013-09-15 14:00:52 -07:00
David Creswick
c6788411da rust test: pass the remaining arguments through
The arguments after `rust test filename.rs` should be passed through
to the test binary. This allows the `rust` command to be used to run a
subset of tests, to run ignored tests, and to run benchmarks.
2013-09-15 15:42:40 -05:00
bors
29032cda8c auto merge of #9168 : michaelwoerister/rust/traits, r=jdm
This pull request finally adds support for recursive type definitions and provides a stub implementation for object pointers.
2013-09-15 11:55:49 -07:00
bors
c8c3c3bdd6 auto merge of #9150 : catamorphism/rust/rustpkg-cleanup, r=catamorphism
Just refactoring in tests.rs.
2013-09-15 10:25:48 -07:00
Tim Chevalier
84f2d33973 rustpkg: Cleanup 2013-09-15 09:55:11 -07:00
Michael Woerister
2ffe083631 debuginfo: Added LLVMDICompositeTypeSetTypeArray to rustllvm.def.in 2013-09-15 17:52:56 +02:00
bors
e0528a5077 auto merge of #9209 : blake2-ppc/rust/from-str, r=thestinger
Remove these in favor of the two traits themselves and the wrapper
function std::from_str::from_str.

Add the function std::num::from_str_radix in the corresponding role for
the FromStrRadix trait.

With `from_str` in the prelude, and `from_str_radix` in `std::num`, the feature is unfied under the type annotation of these functions instead of using the modules-named-as-types (std::uint and others):

What was before:

    let n = std::uint::from_str("1");
    let m = std::i32::from_str_radix("10", 16);

is now:

    let n = from_str::<uint>("1");
    let m = std::num::from_str_radix::<i32>("10", 16);
2013-09-15 08:35:50 -07:00
blake2-ppc
8522341274 Remove {uint,int,u64,i64,...}::from_str,from_str_radix
Remove these in favor of the two traits themselves and the wrapper
function std::from_str::from_str.

Add the function std::num::from_str_radix in the corresponding role for
the FromStrRadix trait.
2013-09-15 14:29:16 +02:00
Michael Woerister
a2d5d093e0 debuginfo: Some namespace-related cleanup. 2013-09-15 12:28:25 +02:00
Michael Woerister
c3ffbc3151 debuginfo: Fix style nits for pull request. 2013-09-15 12:28:25 +02:00
Michael Woerister
ccb721a58d debuginfo: Added description of algorithm for handling recursive types.
Also fixed nasty bug caused by calling LLVMDIBuilderCreateStructType() with a null pointer where an empty array was expected (which would trigger an unintelligable assertion somewhere down the line).
2013-09-15 12:28:25 +02:00
Michael Woerister
1ce02e7144 debuginfo: Added test cases for recursive structs. 2013-09-15 12:28:25 +02:00
Michael Woerister
f85da506a8 debuginfo: Support for recursive types. 2013-09-15 12:28:25 +02:00
Michael Woerister
206cc59f46 debuginfo: Implement DI for ty_opaque_box. 2013-09-15 12:28:25 +02:00
Michael Woerister
bf37de9fc6 debuginfo: Basic support for trait objects. 2013-09-15 12:28:25 +02:00
bors
4ecb0a372d auto merge of #9153 : alexcrichton/rust/simplify-format, r=huonw
This follows from the discussion in #9012.

* All macros are now defined in terms of `format_args!` allowing for removal of a good bit of code in the syntax extension
* The syntax extension is now in a more aptly-named file, `format.rs`
* Documentation was added for the `format!`-related macros.
2013-09-15 01:50:50 -07:00
Alex Crichton
640613892f Fix expand_stmt as well as expand_expr to use the correct span
The same fix as before is still relevant, I just forgot to update the
expand_stmt macro expansion site. The tests for format!() suffice as tests for
this change.
2013-09-15 01:47:02 -07:00
Alex Crichton
fd8c05ccc9 Document all of the format! related macros 2013-09-15 01:09:00 -07:00
Alex Crichton
cfe3db810b Reduce the amount of complexity in format!
This renames the syntax-extension file to format from ifmt, and it also reduces
the amount of complexity inside by defining all other macros in terms of
format_args!
2013-09-15 01:09:00 -07:00
Alex Crichton
1da4488d87 Guarantee that statics have unique names
While they may have the same name within various scopes, this changes static
names to use path_pretty_name to append some hash information at the end of the
symbol. We're then guaranteed that each static has a unique NodeId, so this
NodeId is as the "hash" of the pretty name.

Closes #9188
2013-09-14 23:19:11 -07:00
bors
36872e4180 auto merge of #9203 : thestinger/rust/range_step, r=huonw 2013-09-14 23:00:52 -07:00
Daniel Micay
48f61ecbf9 iter: add the edge case tests for range too 2013-09-15 00:54:32 -04:00
bors
ccadbd3b7c auto merge of #9179 : catamorphism/rust/rustpkg-package-id, r=catamorphism,metajack
r? @metajack - This solves the problem you were having earlier with things like ```extern mod geom = "rust-geom";``` (or something like that).
2013-09-14 21:45:49 -07:00
Daniel Micay
8149e5c99f rm some uses of the advance iterator method 2013-09-15 00:45:34 -04:00
Daniel Micay
a05c4a1e5f remove old internal iterator range tests
The cases they test are well covered in the `std::iter` tests.
2013-09-15 00:44:48 -04:00
Tim Chevalier
a7e49d6e83 rustpkg: Always write a package_id attribute into the link metadata
For some reason, I thought it wasn't necessary to write the package_id
attribute (which rustc's filesearch checks when searching for a package)
if the package ID had a single component (like "foo") as opposed to multiple
components (like "foo/bar/quux"). This meant that
`extern mod quux = "an-awesome-library";` didn't work, even if an-awesome-library
existed in the RUST_PATH.

Fixed it.
2013-09-14 21:42:19 -07:00
blake2-ppc
6e3d5c62e7 std::num: Remove range_step for each numeric type
Replaced by `std::iter::range_step`
2013-09-15 00:41:41 -04:00
blake2-ppc
ad74fde62f Use std::iter::range_step
Use the iterator version instead of the old uint::/int::range_step
functions.
2013-09-15 00:41:34 -04:00
Daniel Micay
66c2965b04 iter: fix RangeInclusive's DoubleEndedIterator 2013-09-15 00:39:34 -04:00
Daniel Micay
bf7587f551 iter: fix range_inclusive when start > stop 2013-09-15 00:32:15 -04:00
Daniel Micay
1f961c74c4 fix range_step{,_inclusive} with negative step 2013-09-15 00:32:07 -04:00
bors
a2231dce92 auto merge of #9200 : lkuper/rust/libsyntax-cleanup, r=luqmana 2013-09-14 18:25:49 -07:00
bors
0dbd509e0f auto merge of #9199 : thestinger/rust/range_step, r=cmr
My focus was on getting these to be correct in all cases by handling overflow properly. I'll clean them up and work on the performance later.
2013-09-14 17:10:51 -07:00
Lindsey Kuper
6ba2cb88a6 These impls, at least, can be avoided by deriving Ord. 2013-09-14 19:38:22 -04:00