about summary refs log tree commit diff
path: root/src/test/auxiliary
AgeCommit message (Collapse)AuthorLines
2013-09-25auto merge of #9432 : alexcrichton/rust/correct-item-visibility, r=pcwaltonbors-4/+61
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-24auto merge of #9336 : alexcrichton/rust/issue-7981, r=catamorphismbors-1/+1
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-1/+1
Progress on #7981
2013-09-24Correctly encode item visibility in metadataAlex Crichton-4/+61
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-23test: Fix rustdoc and tests.Patrick Walton-15/+1
2013-09-17Prevent a rare linkage issue with an xcrate staticAlex Crichton-0/+19
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-5/+5
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-16auto merge of #9130 : alexcrichton/rust/inline-globals, r=thestingerbors-0/+9
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-5/+5
2013-09-16testsuite: Add test for #4208Tim Chevalier-0/+21
Closes #4208
2013-09-16Resume inlining globals across cratesAlex Crichton-0/+9
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-16auto merge of #9206 : alexcrichton/rust/issue-9188, r=catamorphismbors-0/+24
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-1/+1
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-14Guarantee that statics have unique namesAlex Crichton-0/+24
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-13Translate nested items in default methodsAlex Crichton-0/+19
Closes #9123
2013-09-11Fix whitespace in testsSiegeLord-1/+1
2013-09-11Replace dashes in the filenames of the new tests with underscores to avoid ↵SiegeLord-0/+0
issues with Windows
2013-09-11Add a test for cross-crate struct variantsSiegeLord-0/+17
2013-09-09rename `std::iterator` to `std::iter`Daniel Micay-1/+1
The trait will keep the `Iterator` naming, but a more concise module name makes using the free functions less verbose. The module will define iterables in addition to iterators, as it deals with iteration in general.
2013-09-04auto merge of #8875 : alexcrichton/rust/fix-inner-static-library-bug, r=huonwbors-0/+61
These commits fix bugs related to identically named statics in functions of implementations in various situations. The commit messages have most of the information about what bugs are being fixed and why. As a bonus, while I was messing around with name mangling, I improved the backtraces we'll get in gdb by removing `__extensions__` for the trait/type being implemented and by adding the method name as well. Yay!
2013-09-03auto merge of #8963 : jmgrosen/rust/issue-8881, r=alexcrichtonbors-2/+1
2013-09-03Fixes #8881. condition! imports parent's pub identifiersjmgrosen-2/+1
2013-09-04Implement support for indicating the stability of items.Huon Wilson-0/+162
There are 6 new compiler recognised attributes: deprecated, experimental, unstable, stable, frozen, locked (these levels are taken directly from Node's "stability index"[1]). These indicate the stability of the item to which they are attached; e.g. `#[deprecated] fn foo() { .. }` says that `foo` is deprecated. This comes with 3 lints for the first 3 levels (with matching names) that will detect the use of items marked with them (the `unstable` lint includes items with no stability attribute). The attributes can be given a short text note that will be displayed by the lint. An example: #[warn(unstable)]; // `allow` by default #[deprecated="use `bar`"] fn foo() { } #[stable] fn bar() { } fn baz() { } fn main() { foo(); // "warning: use of deprecated item: use `bar`" bar(); // all fine baz(); // "warning: use of unmarked item" } The lints currently only check the "edges" of the AST: i.e. functions, methods[2], structs and enum variants. Any stability attributes on modules, enums, traits and impls are not checked. [1]: http://nodejs.org/api/documentation.html [2]: the method check is currently incorrect and doesn't work.
2013-09-02Remove __extensions__ in names for a "pretty name"Alex Crichton-2/+35
As with the previous commit, this is targeted at removing the possibility of collisions between statics. The main use case here is when there's a type-parametric function with an inner static that's compiled as a library. Before this commit, any impl would generate a path item of "__extensions__". This changes this identifier to be a "pretty name", which is either the last element of the path of the trait implemented or the last element of the type's path that's being implemented. That doesn't quite cut it though, so the (trait, type) pair is hashed and again used to append information to the symbol. Essentially, __extensions__ was removed for something nicer for debugging, and then some more information was added to symbol name by including a hash of the trait being implemented and type it's being implemented for. This should prevent colliding names for inner statics in regular functions with similar names.
2013-09-02Fix inner statics having the same symbol nameAlex Crichton-0/+28
Before, the path name for all items defined in methods of traits and impls never took into account the name of the method. This meant that if you had two statics of the same name in two different methods the statics would end up having the same symbol named (even after mangling) because the path components leading to the symbol were exactly the same (just __extensions__ and the static name). It turns out that if you add the symbol "A" twice to LLVM, it automatically makes the second one "A1" instead of "A". What this meant is that in local crate compilations we never found this bug. Even across crates, this was never a problem. The problem arises when you have generic methods that don't get generated at compile-time of a library. If the statics were re-added to LLVM by a client crate of a library in a different order, you would reference different constants (the integer suffixes wouldn't be guaranteed to be the same). This fixes the problem by adding the method name to symbol path when building the ast_map. In doing so, two symbols in two different methods are disambiguated against.
2013-08-29Fix a bug with statics inside blocks in generic fnsAlex Crichton-0/+40
Whenever a generic function was encountered, only the top-level items were recursed upon, even though the function could contain items inside blocks or nested inside of other expressions. This fixes the existing code from traversing just the top level items to using a Visitor to deeply recurse and find any items which need to be translated. This was uncovered when building code with --lib, because the encode_symbol function would panic once it found that an item hadn't been translated. Closes #8134
2013-08-22auto merge of #8666 : nikomatsakis/rust/issue-3678-extern-fn-types, r=pcwaltonbors-1/+2
Change the type of crust fns like this one: extern fn foo() { ... } from `*u8` to `extern "C" fn()`. r? @pcwalton (or whomever)
2013-08-21auto merge of #8562 : bblum/rust/superkinds, r=nikomatsakisbors-0/+17
For #7083. The metadata issue with the old version is now fixed. Ready for review. This is also not the full solution to #7083, because this is not supported yet: ``` trait Foo : Send { } impl <T: Send> Foo for T { } fn foo<T: Foo>(val: T, chan: std::comm::Chan<T>) { chan.send(val); } ``` cc @nikomatsakis
2013-08-21auto merge of #8594 : bytewiseand/rust/static-fn-ptr, r=pcwaltonbors-0/+14
Fixes #8588
2013-08-21Split cross-crate test into own test and xfail-fast itAndreas Martens-2/+2
2013-08-21Change type of extern fns from `*u8` to `extern "ABI" fn`Niko Matsakis-1/+2
cc #3678
2013-08-20Fixup style of test cases for #7083Ben Blum-2/+5
2013-08-20Add tests for #7083.Ben Blum-0/+14
2013-08-19Add tests for cross-crate condition handling. Close #5446.Graydon Hoare-0/+84
2013-08-19Add externfn macro and correctly label fixed_stack_segmentsNiko Matsakis-0/+1
2013-08-18Add assertions and cross crate testsAndreas Martens-0/+14
2013-08-17Fix warnings it testsErick Tryzelaar-15/+9
2013-08-15Add even more testsAlex Crichton-0/+25
Closes #8248 Closes #8249 Closes #8398 Closes #8401
2013-08-15Fix a typo in the ifmt doxAlex Crichton-1/+1
2013-08-13Add a bunch of tests for closed issuesAlex Crichton-0/+37
Closes #3907 Closes #5493 Closes #4464 Closes #4759 Closes #5666 Closes #5884 Closes #5926 Closes #6318 Closes #6557 Closes #6898 Closes #6919 Closes #7222
2013-08-12Forbid pub/priv where it has no effectAlex Crichton-5/+5
Closes #5495
2013-08-10Merge branch 'enum-method-privacy' of ↵Erick Tryzelaar-3/+27
https://github.com/michaelwoerister/rust into rollup Conflicts: src/libsyntax/opt_vec.rs
2013-08-07Fix falloutCorey Richardson-1/+1
2013-08-07Fix unit structs in cross-crate situtationsAlex Crichton-0/+31
2013-08-07Enable privacy check for enum methods.Michael Woerister-3/+27
2013-08-03remove obsolete `foreach` keywordDaniel Micay-1/+1
this has been replaced by `for`
2013-08-01auto merge of #8216 : thestinger/rust/range, r=huonwbors-1/+1
2013-08-02replace `range` with an external iteratorDaniel Micay-1/+1
2013-08-01auto merge of #8185 : alexcrichton/rust/issue-8179, r=pcwaltonbors-0/+23
* All globals marked as `pub` won't have the `internal` linkage type set * All global references across crates are forced to use the address of the global in the other crate via an external reference. r? @graydon Closes #8179
2013-08-01migrate many `for` loops to `foreach`Daniel Micay-1/+1