about summary refs log tree commit diff
path: root/src/test/auxiliary
AgeCommit message (Collapse)AuthorLines
2014-05-27rustc: Account for typedefs in privacyAlex Crichton-0/+68
This ensures that a public typedef to a private item is ensured to be public in terms of linkage. This affects both the visibility of the library's symbols as well as other lints based on privacy (dead_code for example). Closes #14421 Closes #14422
2014-05-27rustc: Use rust strings for failure argumentsAlex Crichton-1/+1
This avoids having to perform conversions from `*u8` to `&'static str` which can suck in a good deal of code. Closes #14442
2014-05-24core: rename strbuf::StrBuf to string::StringRicho Healey-22/+22
[breaking-change]
2014-05-19rustc: Add official support for weak failureAlex Crichton-2/+42
This commit is part of the ongoing libstd facade efforts (cc #13851). The compiler now recognizes some language items as "extern { fn foo(...); }" and will automatically perform the following actions: 1. The foreign function has a pre-defined name. 2. The crate and downstream crates can only be built as rlibs until a crate defines the lang item itself. 3. The actual lang item has a pre-defined name. This is essentially nicer compiler support for the hokey core-depends-on-std-failure scheme today, but it is implemented the same way. The details are a little more hidden under the covers. In addition to failure, this commit promotes the eh_personality and rust_stack_exhausted functions to official lang items. The compiler can generate calls to these functions, causing linkage errors if they are left undefined. The checking for these items is not as precise as it could be. Crates compiling with `-Z no-landing-pads` will not need the eh_personality lang item, and crates compiling with no split stacks won't need the stack exhausted lang item. For ease, however, these items are checked for presence in all final outputs of the compiler. It is quite easy to define dummy versions of the functions necessary: #[lang = "stack_exhausted"] extern fn stack_exhausted() { /* ... */ } #[lang = "eh_personality"] extern fn eh_personality() { /* ... */ } cc #11922, rust_stack_exhausted is now a lang item cc #13851, libcollections is blocked on eh_personality becoming weak
2014-05-15Updates with core::fmt changesAlex Crichton-1/+1
1. Wherever the `buf` field of a `Formatter` was used, the `Formatter` is used instead. 2. The usage of `write_fmt` is minimized as much as possible, the `write!` macro is preferred wherever possible. 3. Usage of `fmt::write` is minimized, favoring the `write!` macro instead.
2014-05-15auto merge of #13954 : aturon/rust/issue-11650, r=alexcrichtonbors-1/+2
## Process API The existing APIs for spawning processes took strings for the command and arguments, but the underlying system may not impose utf8 encoding, so this is overly limiting. The assumption we actually want to make is just that the command and arguments are viewable as [u8] slices with no interior NULLs, i.e., as CStrings. The ToCStr trait is a handy bound for types that meet this requirement (such as &str and Path). However, since the commands and arguments are often a mixture of strings and paths, it would be inconvenient to take a slice with a single T: ToCStr bound. So this patch revamps the process creation API to instead use a builder-style interface, called `Command`, allowing arguments to be added one at a time with differing ToCStr implementations for each. The initial cut of the builder API has some drawbacks that can be addressed once issue #13851 (libstd as a facade) is closed. These are detailed as FIXMEs. ## Dynamic library API `std::unstable::dynamic_library::open_external` currently takes a `Path`, but because `Paths` produce normalized strings, this can change the semantics of lookups in a given environment. This patch generalizes the function to take a `ToCStr`-bounded type, which includes both `Path`s and `str`s. ## ToCStr API Adds ToCStr impl for &Path and ~str. This is a stopgap until DST (#12938) lands. Until DST lands, we cannot decompose &str into & and str, so we cannot usefully take ToCStr arguments by reference (without forcing an additional & around &str). So we are instead temporarily adding an instance for &Path and ~str, so that we can take ToCStr as owned. When DST lands, the &Path instance should be removed, the string instances should be revisted, and arguments bound by ToCStr should be passed by reference. FIXMEs have been added accordingly. ## Tickets closed Closes #11650. Closes #7928.
2014-05-15Added tests checking that changes in type sig are recognized in SVH.Felix S. Klock II-0/+111
(Only after adding the tests did I realize that this is not really a special case at the AST level; as far as the visitor is concerned, `int` and `i32` and `i64` are just idents.)
2014-05-15A test case for a bug I found in the new SVH while reviewing it.Felix S. Klock II-0/+86
Namely: non-pub `use` declarations *are* significant to the SVH computation, since they can change which traits are part of the method resolution step, and thus affect which methods get called from the (potentially inlined) code.
2014-05-15Some basic acceptance tests for better SVH.Felix S. Klock II-0/+405
2014-05-14Process::new etc should support non-utf8 commands/argsAaron Turon-1/+2
The existing APIs for spawning processes took strings for the command and arguments, but the underlying system may not impose utf8 encoding, so this is overly limiting. The assumption we actually want to make is just that the command and arguments are viewable as [u8] slices with no interior NULLs, i.e., as CStrings. The ToCStr trait is a handy bound for types that meet this requirement (such as &str and Path). However, since the commands and arguments are often a mixture of strings and paths, it would be inconvenient to take a slice with a single T: ToCStr bound. So this patch revamps the process creation API to instead use a builder-style interface, called `Command`, allowing arguments to be added one at a time with differing ToCStr implementations for each. The initial cut of the builder API has some drawbacks that can be addressed once issue #13851 (libstd as a facade) is closed. These are detailed as FIXMEs. Closes #11650. [breaking-change]
2014-05-14test: Remove all uses of `~str` from the test suite.Patrick Walton-27/+29
2014-05-13Allow blocks in const expressionsMarvin Löbel-0/+16
Only blocks with tail expressions that are const expressions and items are allowed.
2014-05-12Add the patch number to version strings. Closes #13289Brian Anderson-2/+2
2014-05-11core: Remove the cast moduleAlex Crichton-2/+2
This commit revisits the `cast` module in libcore and libstd, and scrutinizes all functions inside of it. The result was to remove the `cast` module entirely, folding all functionality into the `mem` module. Specifically, this is the fate of each function in the `cast` module. * transmute - This function was moved to `mem`, but it is now marked as #[unstable]. This is due to planned changes to the `transmute` function and how it can be invoked (see the #[unstable] comment). For more information, see RFC 5 and #12898 * transmute_copy - This function was moved to `mem`, with clarification that is is not an error to invoke it with T/U that are different sizes, but rather that it is strongly discouraged. This function is now #[stable] * forget - This function was moved to `mem` and marked #[stable] * bump_box_refcount - This function was removed due to the deprecation of managed boxes as well as its questionable utility. * transmute_mut - This function was previously deprecated, and removed as part of this commit. * transmute_mut_unsafe - This function doesn't serve much of a purpose when it can be achieved with an `as` in safe code, so it was removed. * transmute_lifetime - This function was removed because it is likely a strong indication that code is incorrect in the first place. * transmute_mut_lifetime - This function was removed for the same reasons as `transmute_lifetime` * copy_lifetime - This function was moved to `mem`, but it is marked `#[unstable]` now due to the likelihood of being removed in the future if it is found to not be very useful. * copy_mut_lifetime - This function was also moved to `mem`, but had the same treatment as `copy_lifetime`. * copy_lifetime_vec - This function was removed because it is not used today, and its existence is not necessary with DST (copy_lifetime will suffice). In summary, the cast module was stripped down to these functions, and then the functions were moved to the `mem` module. transmute - #[unstable] transmute_copy - #[stable] forget - #[stable] copy_lifetime - #[unstable] copy_mut_lifetime - #[unstable] [breaking-change]
2014-05-08auto merge of #14001 : alexcrichton/rust/issue-11680, r=pcwaltonbors-0/+19
The code in resolve erroneously assumed that private enums weren't visited, so the logic was adjusted to check to see if the enum definition itself was public. Closes #11680
2014-05-07std: Modernize the local_data apiAlex Crichton-2/+1
This commit brings the local_data api up to modern rust standards with a few key improvements: * The `pop` and `set` methods have been combined into one method, `replace` * The `get_mut` method has been removed. All interior mutability should be done through `RefCell`. * All functionality is now exposed as a method on the keys themselves. Instead of importing std::local_data, you now use "key.replace()" and "key.get()". * All closures have been removed in favor of RAII functionality. This means that get() and get_mut() no long require closures, but rather return Option<SmartPointer> where the smart pointer takes care of relinquishing the borrow and also implements the necessary Deref traits * The modify() function was removed to cut the local_data interface down to its bare essentials (similarly to how RefCell removed set/get). [breaking-change]
2014-05-06librustc: Remove `~EXPR`, `~TYPE`, and `~PAT` from the language, exceptPatrick Walton-9/+12
for `~str`/`~[]`. Note that `~self` still remains, since I forgot to add support for `Box<self>` before the snapshot. How to update your code: * Instead of `~EXPR`, you should write `box EXPR`. * Instead of `~TYPE`, you should write `Box<Type>`. * Instead of `~PATTERN`, you should write `box PATTERN`. [breaking-change]
2014-05-06auto merge of #13892 : alexcrichton/rust/mixing-rlib-dylib-deps, r=brsonbors-0/+17
Currently, rustc requires that a linkage be a product of 100% rlibs or 100% dylibs. This is to satisfy the requirement that each object appear at most once in the final output products. This is a bit limiting, and the upcoming libcore library cannot exist as a dylib, so these rules must change. The goal of this commit is to enable *some* use cases for mixing rlibs and dylibs, primarily libcore's use case. It is not targeted at allowing an exhaustive number of linkage flavors. There is a new dependency_format module in rustc which calculates what format each upstream library should be linked as in each output type of the current unit of compilation. The module itself contains many gory details about what's going on here. cc #10729
2014-05-06rustc: Fix enum variant privacy across cratesAlex Crichton-0/+19
The code in resolve erroneously assumed that private enums weren't visited, so the logic was adjusted to check to see if the enum definition itself was public. Closes #11680
2014-05-02rustc: Crawl static initializers for reachabilityAlex Crichton-0/+32
This ensures that private functions exported through static initializers will actually end up being public in the object file (so other objects can continue to reference the function). Closes #13620
2014-05-02rustc: Add some suppot for mixing rlibs and dylibsAlex Crichton-0/+17
Currently, rustc requires that a linkage be a product of 100% rlibs or 100% dylibs. This is to satisfy the requirement that each object appear at most once in the final output products. This is a bit limiting, and the upcoming libcore library cannot exist as a dylib, so these rules must change. The goal of this commit is to enable *some* use cases for mixing rlibs and dylibs, primarily libcore's use case. It is not targeted at allowing an exhaustive number of linkage flavors. There is a new dependency_format module in rustc which calculates what format each upstream library should be linked as in each output type of the current unit of compilation. The module itself contains many gory details about what's going on here. cc #10729
2014-04-30rustc: Fix def ids of xcrate-reexported itemsAlex Crichton-0/+43
This was just a typo in the decoder using the source crate's number rather than the destination crate's number of a reexport. Closes #13872
2014-04-29rustc: Add search paths to dylib load pathsAlex Crichton-0/+56
When a syntax extension is loaded by the compiler, the dylib that is opened may have other dylibs that it depends on. The dynamic linker must be able to find these libraries on the system or else the library will fail to load. Currently, unix gets by with the use of rpaths. This relies on the dylib not moving around too drastically relative to its dependencies. For windows, however, this is no rpath available, and in theory unix should work without rpaths as well. This modifies the compiler to add all -L search directories to the dynamic linker's set of load paths. This is currently managed through environment variables for each platform. Closes #13848
2014-04-27test: Add tests for closed issuesAlex Crichton-0/+14
Closes #5518 Closes #7320 Closes #8391 Closes #8827 Closes #8983 Closes #10683 Closes #10802 Closes #11515
2014-04-20Allow inheritance between structs.Nick Cameron-0/+27
No subtyping, no interaction with traits. Partially addresses #9912.
2014-04-18Replace all ~"" with "".to_owned()Richo Healey-5/+5
2014-04-17auto merge of #13565 : alexcrichton/rust/issue-13560, r=brsonbors-0/+44
Syntax-only crates are no longer registered with the cstore, so there's no need to allocate crate numbers to them. This ends up leaving gaps in the crate numbering scheme which is not expected in the rest of the compiler. Closes #13560
2014-04-16rustc: Don't allocate a cnum to syntax cratesAlex Crichton-0/+44
Syntax-only crates are no longer registered with the cstore, so there's no need to allocate crate numbers to them. This ends up leaving gaps in the crate numbering scheme which is not expected in the rest of the compiler. Closes #13560
2014-04-16auto merge of #13547 : alexcrichton/rust/remove-priv, r=huonwbors-15/+1
See [RFC 6](https://github.com/rust-lang/rfcs/blob/e0c741f1c6e372d0fd31c5978fcf8c7bd7c3e973/active/0006-remove-priv.md)
2014-04-16rustc: Remove private enum variantsAlex Crichton-15/+1
This removes the `priv` keyword from the language and removes private enum variants as a result. The remaining use cases of private enum variants were all updated to be a struct with one private field that is a private enum. RFC: 0006-remove-priv Closes #13535
2014-04-16auto merge of #13527 : huonw/rust/macro-expander-trait, r=sfacklerbors-2/+2
There's now one unified way to return things from a macro, instead of being able to choose the `AnyMacro` trait or the `MRItem`/`MRExpr` variants of the `MacResult` enum. This does simplify the logic handling the expansions, but the biggest value of this is it makes macros in (for example) type position easier to implement, as there's this single thing to modify. By my measurements (using `-Z time-passes` on libstd and librustc etc.), this appears to have little-to-no impact on expansion speed. There are presumably larger costs than the small number of extra allocations and virtual calls this adds (notably, all `macro_rules!`-defined macros have not changed in behaviour, since they had to use the `AnyMacro` trait anyway). --- Summary of changes for dynamic syntax extension maintainers: - `MacResult` is now a trait, and is returned as `~MacResult` - `MRExpr` & `MRItem` are now `MacExpr::new` and `MacItem:new` respectively (which return `~MacResult`s) - `MacResult::dummy_...` is `DummyResult::any` or `DummyResult::expr`
2014-04-16syntax: unify all MacResult's into a single trait.Huon Wilson-2/+2
There's now one unified way to return things from a macro, instead of being able to choose the `AnyMacro` trait or the `MRItem`/`MRExpr` variants of the `MacResult` enum. This does simplify the logic handling the expansions, but the biggest value of this is it makes macros in (for example) type position easier to implement, as there's this single thing to modify. By my measurements (using `-Z time-passes` on libstd and librustc etc.), this appears to have little-to-no impact on expansion speed. There are presumably larger costs than the small number of extra allocations and virtual calls this adds (notably, all `macro_rules!`-defined macros have not changed in behaviour, since they had to use the `AnyMacro` trait anyway).
2014-04-15auto merge of #13511 : Meyermagic/rust/enum_typeid, r=alexcrichtonbors-0/+100
Fixes #13507. I haven't familiarized myself with this part of the rust compiler, so hopefully there are no mistakes (despite the simplicity of the commit). It is also 5am.
2014-04-14Fixes #13507Meyer S. Jacobs-0/+100
Fixes hashing of DefId for ty_enum. Adds tests for cross-crate TypeId equivalence for various types.
2014-04-14Use new attribute syntax in python files in src/etc too (#13478)Manish Goregaokar-106/+106
2014-04-10rustc: Disallow importing through use statementsAlex Crichton-0/+24
Resolve is currently erroneously allowing imports through private `use` statements in some circumstances, even across module boundaries. For example, this code compiles successfully today: use std::c_str; mod test { use c_str::CString; } This should not be allowed because it was explicitly decided that private `use` statements are purely bringing local names into scope, they are not participating further in name resolution. As a consequence of this patch, this code, while valid today, is now invalid: mod test { use std::c_str; unsafe fn foo() { ::test::c_str::CString::new(0 as *u8, false); } } While plausibly acceptable, I found it to be more consistent if private imports were only considered candidates to resolve the first component in a path, and no others. Closes #12612
2014-04-10debuginfo: Don't create debuginfo for statics inlined from other crates.Michael Woerister-0/+27
Fixes issue #13213, that is linker errors when the inlined static has been optimized out of the exporting crate.
2014-04-08Register new snapshotsAlex Crichton-1/+1
2014-04-07Fix some windows rpass testsAlex Crichton-1/+1
2014-04-06Remove check-fast. Closes #4193, #8844, #6330, #7416Brian Anderson-3/+0
2014-04-06auto merge of #13346 : ben0x539/rust/priv-field-in, r=alexcrichtonbors-0/+17
In the error message for when a private field is used, include the name of the struct, or if it's a struct-like enum variant, the names of the variant and the enum. This fixes #13341.
2014-04-06auto merge of #13315 : alexcrichton/rust/libc, r=alexcrichton,mebors-6/+6
Rebasing of #12526 with a very obscure bug fixed on windows.
2014-04-06name struct in "field `...` is private" errorBenjamin Herr-0/+17
2014-04-04Test fixes from rollupAlex Crichton-1/+1
2014-04-04Fix inner attribute syntax from `#[foo];` to `#![foo]`Timothée Ravier-4/+4
From the 0.10 changelog: * The inner attribute syntax has changed from `#[foo];` to `#![foo]`.
2014-04-04Fix fallout from std::libc separationCorey Richardson-6/+6
2014-04-04auto merge of #13301 : erickt/rust/remove-refcell-get, r=huonwbors-1/+1
`RefCell::get` can be a bit surprising, because it actually clones the wrapped value. This removes `RefCell::get` and replaces all the users with `RefCell::borrow()` when it can, and `RefCell::borrow().clone()` when it can't. It removes `RefCell::set` for consistency. This closes #13182. It also fixes an infinite loop in a test when debugging is on.
2014-04-03std: Remove `RefCell::get()`Erick Tryzelaar-1/+1
It's surprising that `RefCell::get()` is implicitly doing a clone on a value. This patch removes it and replaces all users with either `.borrow()` when we can autoderef, or `.borrow().clone()` when we cannot.
2014-04-03auto merge of #13296 : brson/rust/0.11-pre, r=alexcrichtonbors-2/+2
This also changes some of the download links in the documentation to 'nightly'.
2014-04-03auto merge of #13237 : alexcrichton/rust/private-tuple-structs, r=brsonbors-13/+27
This is the final commit need to implement [RFC #4](https://github.com/rust-lang/rfcs/blob/master/active/0004-private-fields.md), it makes all tuple struct fields private by default, overridable with the `pub` keyword. I'll note one divergence from the original RFC which is outlined in the first commit.