about summary refs log tree commit diff
path: root/src/test/run-pass
AgeCommit message (Collapse)AuthorLines
2013-09-26auto merge of #9490 : alexcrichton/rust/issue-9487, r=cmrbors-0/+20
If there's no TLS key just yet, then there's nothing to unsafely borrow, so continue returning None. This prevents causing the runtime to abort itself when logging before the runtime is fully initialized. Closes #9487 r? @brson
2013-09-25rustdoc: Change all code-blocks with a scriptAlex Crichton-5/+5
find src -name '*.rs' | xargs sed -i '' 's/~~~.*{\.rust}/```rust/g' find src -name '*.rs' | xargs sed -i '' 's/ ~~~$/ ```/g' find src -name '*.rs' | xargs sed -i '' 's/^~~~$/ ```/g'
2013-09-25Don't die in try_unsafe_borrow if tls isn't readyAlex Crichton-0/+20
If there's no TLS key just yet, then there's nothing to unsafely borrow, so continue returning None. This prevents causing the runtime to abort itself when logging before the runtime is fully initialized. Closes #9487
2013-09-25auto merge of #9432 : alexcrichton/rust/correct-item-visibility, r=pcwaltonbors-143/+143
This fixes private statics and functions from being usable cross-crates, along with some bad privacy error messages. This is a reopening of #8365 with all the privacy checks in privacy.rs instead of resolve.rs (where they should be anyway). These maps of exported items will hopefully get used for generating documentation by rustdoc Closes #8592
2013-09-25Fix run-pass tests to have 'pub fn main'Alex Crichton-143/+143
This is required by the check-fast target because each test is slurped up into a submodule.
2013-09-24auto merge of #9336 : alexcrichton/rust/issue-7981, r=catamorphismbors-10/+10
Progress on #7981 This doesn't completely close the issue because `struct A;` is still allowed, and it's a much larger change to disallow that. I'm also not entirely sure that we want to disallow that. Regardless, punting that discussion to the issue instead.
2013-09-24Stop accepting 'impl ...;', require {} insteadAlex Crichton-10/+10
Progress on #7981
2013-09-23auto merge of #9454 : alexcrichton/rust/snapshot, r=thestingerbors-26/+1
2013-09-23Register new snapshotsAlex Crichton-26/+1
2013-09-23librustc: Fix merge fallout.Patrick Walton-24/+16
2013-09-23test: Fix rustdoc and tests.Patrick Walton-426/+145
2013-09-23auto merge of #9301 : luqmana/rust/ncm, r=brsonbors-1/+26
Get rid of the crate_map arg! r? @brson
2013-09-21Update version numbers to 0.8Brian Anderson-1/+1
2013-09-20auto merge of #9350 : ↵bors-0/+101
pnkfelix/rust/fsk-issue-4691-catch-bad-fsu-during-compute-moves, r=nikomatsakis Resolves third bullet of #4691: if the functional-struct-update (FSU) expression `{ a: b, ..s }` causes `s` to move and `s` has a destructor, then the expression is illegal. r? @nikomatsakis
2013-09-20Invert --cfg debug to --cfg ndebugAlex Crichton-3/+3
Many people will be very confused that their debug! statements aren't working when they first use rust only to learn that they should have been building with `--cfg debug` the entire time. This inverts the meaning of the flag to instead of enabling debug statements, now it disables debug statements. This way the default behavior is a bit more reasonable, and requires less end-user configuration. Furthermore, this turns on debug by default when building the rustc compiler.
2013-09-20auto merge of #9332 : eugals/rust/master, r=alexcrichtonbors-0/+1
It is intended to optimize/beautify the code generated in a few trivial trait operations. Let's take the following code as an example: ``` trait Stuff { fn bar(&self); } fn callBar(s: &Stuff) { s.bar(); } struct Foo; impl Stuff for Foo { fn bar(&self) { } } pub fn main() { let o = Foo; callBar(&o as &Stuff); } ``` At present it is translated into something like: ``` define void @_ZN7callBar_UUID.0E({ i32, %tydesc*, i8*, i8*, i8 }*, { %tydesc*, i8* }*) #4 { "function top level": %__trait_callee = alloca { %tydesc*, i8* } %__auto_borrow_obj = alloca { %tydesc*, i8* } %2 = getelementptr inbounds { %tydesc*, i8* }* %1, i32 0, i32 0 %3 = load %tydesc** %2 %4 = getelementptr inbounds { %tydesc*, i8* }* %__auto_borrow_obj, i32 0, i32 0 store %tydesc* %3, %tydesc** %4 %5 = getelementptr inbounds { %tydesc*, i8* }* %1, i32 0, i32 1 %6 = load i8** %5 %7 = getelementptr inbounds { %tydesc*, i8* }* %__auto_borrow_obj, i32 0, i32 1 store i8* %6, i8** %7 %8 = bitcast { %tydesc*, i8* }* %__auto_borrow_obj to i8* %9 = bitcast { %tydesc*, i8* }* %__trait_callee to i8* call void @llvm.memcpy.p0i8.p0i8.i32(i8* %9, i8* %8, i32 8, i32 4, i1 false) %10 = getelementptr inbounds { %tydesc*, i8* }* %__trait_callee, i32 0, i32 1 %11 = load i8** %10 %12 = bitcast i8* %11 to { i32, %tydesc*, i8*, i8*, i8 }* %13 = getelementptr inbounds { %tydesc*, i8* }* %__trait_callee, i32 0, i32 0 %14 = bitcast %tydesc** %13 to [1 x i8*]** %15 = load [1 x i8*]** %14 %16 = getelementptr inbounds [1 x i8*]* %15, i32 0, i32 1 %17 = load i8** %16 %18 = bitcast i8* %17 to void ({ i32, %tydesc*, i8*, i8*, i8 }*)* call void %18({ i32, %tydesc*, i8*, i8*, i8 }* %12) ret void } ... define void @_ZN4main_UUID.0E({ i32, %tydesc*, i8*, i8*, i8 }*) #4 { "function top level": %o = alloca %struct.Foo %1 = alloca { %tydesc*, i8* } %__auto_borrow_obj = alloca { %tydesc*, i8* } %2 = getelementptr inbounds { %tydesc*, i8* }* %1, i32 0, i32 1 %3 = bitcast i8** %2 to %struct.Foo** store %struct.Foo* %o, %struct.Foo** %3 %4 = getelementptr inbounds { %tydesc*, i8* }* %1, i32 0, i32 0 %5 = bitcast %tydesc** %4 to { %tydesc*, void ({ i32, %tydesc*, i8*, i8*, i8 }*)* }** store { %tydesc*, void ({ i32, %tydesc*, i8*, i8*, i8 }*)* }* @vtable1081, { %tydesc*, void ({ i32, %tydesc*, i8*, i8*, i8 }*)* }** %5 %6 = getelementptr inbounds { %tydesc*, i8* }* %1, i32 0, i32 0 %7 = load %tydesc** %6 %8 = getelementptr inbounds { %tydesc*, i8* }* %__auto_borrow_obj, i32 0, i32 0 store %tydesc* %7, %tydesc** %8 %9 = getelementptr inbounds { %tydesc*, i8* }* %1, i32 0, i32 1 %10 = load i8** %9 %11 = getelementptr inbounds { %tydesc*, i8* }* %__auto_borrow_obj, i32 0, i32 1 store i8* %10, i8** %11 call void @_ZN7callBar_UUID.0E({ i32, %tydesc*, i8*, i8*, i8 }* undef, { %tydesc*, i8* }* %__auto_borrow_obj) ret void } ``` If you apply my patch, it would become way shorter and cleaner: ``` define void @_ZN7callBar_UUID.0E({ i32, %tydesc*, i8*, i8*, i8 }*, { %tydesc*, i8* }*) #4 { "function top level": %2 = getelementptr inbounds { %tydesc*, i8* }* %1, i32 0, i32 1 %3 = load i8** %2 %4 = bitcast i8* %3 to { i32, %tydesc*, i8*, i8*, i8 }* %5 = getelementptr inbounds { %tydesc*, i8* }* %1, i32 0, i32 0 %6 = bitcast %tydesc** %5 to [1 x i8*]** %7 = load [1 x i8*]** %6 %8 = getelementptr inbounds [1 x i8*]* %7, i32 0, i32 1 %9 = load i8** %8 %10 = bitcast i8* %9 to void ({ i32, %tydesc*, i8*, i8*, i8 }*)* call void %10({ i32, %tydesc*, i8*, i8*, i8 }* %4) ret void } ... define void @_ZN4main_UUID.0E({ i32, %tydesc*, i8*, i8*, i8 }*) #4 { "function top level": %o = alloca %struct.Foo %1 = alloca { %tydesc*, i8* } %2 = getelementptr inbounds { %tydesc*, i8* }* %1, i32 0, i32 1 %3 = bitcast i8** %2 to %struct.Foo** store %struct.Foo* %o, %struct.Foo** %3 %4 = getelementptr inbounds { %tydesc*, i8* }* %1, i32 0, i32 0 %5 = bitcast %tydesc** %4 to { %tydesc*, void ({ i32, %tydesc*, i8*, i8*, i8 }*)* }** store { %tydesc*, void ({ i32, %tydesc*, i8*, i8*, i8 }*)* }* @vtable1081, { %tydesc*, void ({ i32, %tydesc*, i8*, i8*, i8 }*)* }** %5 call void @_ZN7callBar_UUID.0E({ i32, %tydesc*, i8*, i8*, i8 }* undef, { %tydesc*, i8* }* %1) ret void } ``` Although this change doesn't increase the compilation speed much (I mentioned only about 1-2% boost on "rustc -O -Z time-passes syntax.rs"), but I still think it's a good thing to do as it greatly simplifies/clarifies LL generated in some cases which would definitely help in the future code generation investigations. I don't provide any new test cases in this patch as it is merely an optimization. Sorry guys, I somehow messed my previous PR and I don't see any better way to fix as to recreate it here.
2013-09-20auto merge of #9321 : chris-morgan/rust/lowercase-nan-methods, r=brsonbors-19/+19
This is for consistency in naming conventions. - ``std::num::Float::NaN()`` is changed to ``nan()``; - ``std::num::Float.is_NaN()`` is changed to ``is_nan()``; and - ``std::num::strconv::NumStrConv::NaN()`` is changed to ``nan()``. Fixes #9319.
2013-09-20auto merge of #9320 : ↵bors-9/+9
chris-morgan/rust/unreachable-macro-part-two-of-two-containing-the-destruction-of-the-unreachable-function, r=alexcrichton This is the second of two parts of #8991, now possible as a new snapshot has been made. (The first part implemented the unreachable!() macro; it was #8992, 6b7b8f2682.) ``std::util::unreachable()`` is removed summarily; any code which used it should now use the ``unreachable!()`` macro. Closes #9312. Closes #8991.
2013-09-20fix bug in test.Felix S. Klock II-2/+2
2013-09-20Resolves third bullet of #4691, and adds tests for it. Fix #4691.Felix S. Klock II-0/+101
2013-09-19pacified test/run-pass/core-run-destroy on Win7x64Evgeny Sologubov-0/+1
2013-09-19auto merge of #9299 : alexcrichton/rust/fmt-trailing-comma, r=huonwbors-0/+4
This is more consistent with other parts of the language and it also makes it easier to use in situations where format string is massive.
2013-09-19Rename the NaN and is_NaN methods to lowercase.Chris Morgan-19/+19
This is for consistency in naming conventions. - ``std::num::Float::NaN()`` is changed to ``nan()``; - ``std::num::Float.is_NaN()`` is changed to ``is_nan()``; and - ``std::num::strconv::NumStrConv::NaN()`` is changed to ``nan()``. Fixes #9319.
2013-09-19auto merge of #9267 : Kimundi/rust/master, r=huonwbors-2/+2
2013-09-19Turned extra::getopts functions into methodsMarvin Löbel-2/+2
Some minor api and doc adjustments
2013-09-19auto merge of #9291 : jzelinskie/rust/remove-cond, r=alexcrichtonbors-46/+0
This is my first contribution, so please point out anything that I may have missed. I consulted IRC and settled on `match () { ... }` for most of the replacements.
2013-09-19Replace unreachable() calls with unreachable!().Chris Morgan-9/+9
This is the second of two parts of #8991, now possible as a new snapshot has been made. (The first part implemented the unreachable!() macro; it was #8992, 6b7b8f2682.) ``std::util::unreachable()`` is removed summarily; any code which used it should now use the ``unreachable!()`` macro. Closes #9312. Closes #8991.
2013-09-18tests: Remove crate_map from start.Luqman Aden-1/+26
2013-09-18Allow trailing commas in format!Alex Crichton-0/+4
This is more consistent with other parts of the language and it also makes it easier to use in situations where format string is massive.
2013-09-18Remove and replace cond! Closes #9282.Jimmy Zelinskie-46/+0
2013-09-18auto merge of #9264 : ben0x539/rust/pp-work, r=alexcrichtonbors-2/+0
Since 3b6314c the pretty printer seems to only print trait bounds for `ast::ty_path(...)`s that have a generics arguments list. That seems wrong, so let's always print them. Closes #9253, un-xfails test for #7673.
2013-09-18auto merge of #9254 : vadimcn/rust/fix-mingw-v4, r=brsonbors-0/+6
Fix Rust build on mingw v4.0 See #9246 for details.
2013-09-17Added support for a `\0` escape sequence.Daniel Rosenwasser-0/+44
This commit adds support for `\0` escapes in character and string literals. Since `\0` is equivalent to `\x00`, this is a direct translation to the latter escape sequence. Future builds will be able to compile using `\0` directly. Also updated the grammar specification and added a test for NUL characters.
2013-09-17pp: also print bounds in paths with no generic paramsBenjamin Herr-2/+0
Since 3b6314c3 the pretty printer seems to only print trait bounds for `ast::ty_path(...)`s that have a generics arguments list. That seems wrong, so let's always print them. Closes #9253, un-xfails test for #7673.
2013-09-17Prevent a rare linkage issue with an xcrate staticAlex Crichton-0/+18
If a static is flagged as address_insignificant, then for LLVM to actually perform the relevant optimization it must have an internal linkage type. What this means, though, is that the static will not be available to other crates. Hence, if you have a generic function with an inner static, it will fail to link when built as a library because other crates will attempt to use the inner static externally. This gets around the issue by inlining the static into the metadata. The same relevant optimization is then applied separately in the external crate. What this ends up meaning is that all statics tagged with #[address_insignificant] will appear at most once per crate (by value), but they could appear in multiple crates. This should be the last blocker for using format! ...
2013-09-17auto merge of #9244 : thestinger/rust/drop, r=catamorphismbors-42/+42
This doesn't close any bugs as the goal is to convert the parameter to by-value, but this is a step towards being able to make guarantees about `&T` pointers (where T is Freeze) to LLVM.
2013-09-17auto merge of #9225 : huonw/rust/closing-time, r=alexcrichtonbors-0/+166
Closes #2074. Closes #5008. Closes #7519. Closes #7673. Closes #7770. Closes #8171.
2013-09-17Disabled tests which now fail on Windows+mingw4.0 due to GCC 4.8 ABI change ↵Vadim Chugunov-0/+6
(#9205). These really should have been marked xfail-win32, but that doesn't exist, so xfail-fast it is.
2013-09-17Tests for fixed issues.Huon Wilson-0/+166
Closes #2074. Closes #5008. Closes #7519. Closes #7673. Closes #7770. Closes #8171.
2013-09-16auto merge of #9130 : alexcrichton/rust/inline-globals, r=thestingerbors-0/+1
In #8185 cross-crate condition handlers were fixed by ensuring that globals didn't start appearing in different crates with different addressed. An unfortunate side effect of that pull request is that constants weren't inlined across crates (uint::bits is unknown to everything but libstd). This commit fixes this inlining by using the `available_eternally` linkage provided by LLVM. It partially reverts #8185, and then adds support for this linkage type. The main caveat is that not all statics could be inlined into other crates. Before this patch, all statics were considered "inlineable items", but an unfortunate side effect of how we deal with `&static` and `&[static]` means that these two cases cannot be inlined across crates. The translation of constants was modified to propogate this condition of whether a constant should be considered inlineable into other crates. Closes #9036
2013-09-16switch Drop to `&mut self`Daniel Micay-42/+42
2013-09-16testsuite: Add test for #4208Tim Chevalier-0/+19
Closes #4208
2013-09-16auto merge of #9192 : Kimundi/rust/master, r=huonwbors-0/+153
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. This basically reimplements #7599 and has a use case for replacing an similar type in `std::rt::logging` ( Added in #9180).
2013-09-16Corrected a few small style issuesMarvin Löbel-1/+1
Split up test function a bit
2013-09-16Add an SendStr typeMarvin Löbel-0/+153
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-16auto merge of #9121 : sanxiyn/rust/arm, r=alexcrichtonbors-0/+2
Ignore failing tests on Android to prepare for #9120.
2013-09-16Resume inlining globals across cratesAlex Crichton-0/+1
In #8185 cross-crate condition handlers were fixed by ensuring that globals didn't start appearing in different crates with different addressed. An unfortunate side effect of that pull request is that constants weren't inlined across crates (uint::bits is unknown to everything but libstd). This commit fixes this inlining by using the `available_eternally` linkage provided by LLVM. It partially reverts #8185, and then adds support for this linkage type. The main caveat is that not all statics could be inlined into other crates. Before this patch, all statics were considered "inlineable items", but an unfortunate side effect of how we deal with `&static` and `&[static]` means that these two cases cannot be inlined across crates. The translation of constants was modified to propogate this condition of whether a constant should be considered inlineable into other crates. Closes #9036
2013-09-16Ignore failing tests on AndroidSeo Sanghyeon-0/+2
2013-09-16auto merge of #9206 : alexcrichton/rust/issue-9188, r=catamorphismbors-0/+21
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-15Remove {uint,int,u64,i64,...}::from_str,from_str_radixblake2-ppc-4/+4
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.