about summary refs log tree commit diff
path: root/src/test/run-pass
AgeCommit message (Collapse)AuthorLines
2018-11-15Auto merge of #54906 - qnighy:fix-issue-50452, r=nikomatsakisbors-0/+29
Reattach all grandchildren when constructing specialization graph. Specialization graphs are constructed by incrementally adding impls in the order of declaration. If the impl being added has its specializations in the graph already, they should be reattached under the impl. However, the current implementation only reattaches the one found first. Therefore, in the following specialization graph, ``` Tr1 | I3 / \ I1 I2 ``` If `I1`, `I2`, and `I3` are declared in this order, the compiler mistakenly constructs the following graph: ``` Tr1 / \ I3 I2 | I1 ``` This patch fixes the reattach procedure to include all specializing grandchildren-to-be. Fixes #50452.
2018-11-14std: Synchronize access to global env during `exec`Alex Crichton-0/+36
This commit, after reverting #55359, applies a different fix for #46775 while also fixing #55775. The basic idea was to go back to pre-#55359 libstd, and then fix #46775 in a way that doesn't expose #55775. The issue described in #46775 boils down to two problems: * First, the global environment is reset during `exec` but, but if the `exec` call fails then the global environment was a dangling pointer into free'd memory as the block of memory was deallocated when `Command` is dropped. This is fixed in this commit by installing a `Drop` stack object which ensures that the `environ` pointer is preserved on a failing `exec`. * Second, the global environment was accessed in an unsynchronized fashion during `exec`. This was fixed by ensuring that the Rust-specific environment lock is acquired for these system-level operations. Thanks to Alex Gaynor for pioneering the solution here! Closes #55775 Co-authored-by: Alex Gaynor <alex.gaynor@gmail.com>
2018-11-14Revert "Fixes #46775 -- don't mutate the process's environment in Command::exec"Alex Crichton-12/+0
This reverts commit 36fe3b605a7a7143a14565272140ba1b43c1b041.
2018-11-11Rollup merge of #55687 - alexreg:fix-24010, r=scalexmPietro Albini-3/+40
Take supertraits into account when calculating associated types Fixes #24010 and #23856. Applies to trait aliases too. As a by-product, this PR also makes repeated bindings of the same associated item in the same definition a hard error. This was previously a warning with a note about it becoming a hard error in the future. See #50589 for more info. I talked about this with @nikomatsakis recently, but only very superficially, so this shouldn't stop anyone from assigning it to themself to review and r+. N.B. The "WIP" commits represent imperfect attempts to solve the problem just for trait objects, but I've left them in for reference for the sake of whomever is reviewing this. CC @carllerche @theemathas @durka @mbrubeck
2018-11-10Auto merge of #55626 - nikic:update-emscripten, r=alexcrichtonbors-1/+1
Update emscripten This updates emscripten to 1.38.15, which is based on LLVM 6.0.1 and would allow us to drop code for handling LLVM 4. The main issue I ran into is that exporting statics through `EXPORTED_FUNCTIONS` no longer works. As far as I understand exporting non-functions doesn't really make sense under emscripten anyway, so I've modified the symbol export code to not even try. Closes #52323.
2018-11-08Deprecate channel selectionStjepan Glavina-0/+1
2018-11-08Fix some tests for wasm32-unknown-emscriptenNikita Popov-1/+1
2018-11-07Only do check for trait objects, not trait or trait alias definitions.Alexander Regueiro-0/+16
2018-11-07Added error for duplicate bindings of associated type.Alexander Regueiro-1/+1
2018-11-07Added tests.Alexander Regueiro-3/+24
2018-11-07Rollup merge of #55495 - wesleywiser:opt_fuel_rustbuild, r=nikomatsakiskennytm-2/+4
Don't print opt fuel messages to stdout because it breaks Rustbuild Rustbuild passes `--message-format json` to the compiler invocations which causes JSON to be emitted on stdout. Printing optimization fuel messages to stdout breaks the json and causes Rustbuild to fail. Work around this by emitting optimization fuel related messages on stderr instead.
2018-11-06Add explcit `--error-format` options to tests of print-fuel to sidestep ↵Felix S. Klock II-2/+4
compiletests presumption of JSON. As a driveby, rename the stdout files to stderr, which should have been part of the earlier commit.
2018-11-06Rollup merge of #55597 - alexcrichton:thread-local-inner, r=KodrAuskennytm-0/+18
std: Enable usage of `thread_local!` through imports The `thread_local!` macro delegated to an internal macro but it didn't do so in a macros-and-the-module-system compatible fashion, meaning if a `#![no_std]` crate imported `std` and tried to use `thread_local!` it would fail due to missing a lookup of an internal macro. This commit switches the macro to instead use `$crate` to invoke other macros, ensuring that it'll work when `thread_local!` is imported alone.
2018-11-05Auto merge of #55410 - nagisa:atomic-align, r=pnkfelixbors-0/+46
Correct alignment of atomic types and (re)add Atomic{I,U}128 This is a updated https://github.com/rust-lang/rust/pull/53514 to also make atomic types `repr(C)` as per comment in https://github.com/rust-lang/rust/pull/53514#issuecomment-431042767. Fixes #39590 Closes #53514 r? @pnkfelix
2018-11-04Auto merge of #55569 - durka:must-use-external-macro, r=alexcrichtonbors-7/+7
enforce unused-must-use lint in macros Fixes #55516 by turning on the UNUSED_MUST_USE lint within macros.
2018-11-03Auto merge of #55101 - alexreg:trait-aliases, r=nikomatsakisbors-0/+124
Implement trait aliases (RFC 1733) Extends groundwork done in https://github.com/rust-lang/rust/pull/45047, and fully implements https://github.com/rust-lang/rfcs/pull/1733. CC @durka @nikomatsakis
2018-11-03fix test falloutAlex Burka-7/+7
2018-11-03Fixed bug with Self type param coming before lifetimes.Alexander Regueiro-20/+33
2018-11-03Add more tests.Alexander Regueiro-7/+53
2018-11-03Added tests.Alexander Regueiro-13/+50
2018-11-03Added support for trait aliases as object types.Alexander Regueiro-2/+8
2018-11-03Added support for trait aliases as bounds.Alexander Regueiro-0/+22
2018-11-03Auto merge of #54383 - mikeyhew:custom-receivers-object-safety, r=nikomatsakisbors-0/+132
Take 2: Implement object-safety and dynamic dispatch for arbitrary_self_types This replaces #50173. Over the months that that PR was open, we made a lot of changes to the way this was going to be implemented, and the long, meandering comment thread and commit history would have been confusing to people reading it in the future. So I decided to package everything up with new, straighforward commits and open a new PR. Here are the main points. Please read the commit messages for details. - To simplify codegen, we only support receivers that have the ABI of a pointer. That means they are builtin pointer types, or newtypes thereof. - We introduce a new trait: `DispatchFromDyn<T>`, similar to `CoerceUnsized<T>`. `DispatchFromDyn` has extra requirements that `CoerceUnsized` does not: when you implement `DispatchFromDyn` for a struct, there cannot be any extra fields besides the field being coerced and `PhantomData` fields. This ensures that the struct's ABI is the same as a pointer. - For a method's receiver (e.g. `self: Rc<Self>`) to be object-safe, it needs to have the following property: - let `DynReceiver` be the receiver when `Self = dyn Trait` - let `ConcreteReceiver` be the receiver when `Self = T`, where `T` is some unknown `Sized` type that implements `Trait`, and is the erased type of the trait object. - `ConcreteReceiver` must implement `DispatchFromDyn<DynReceiver>` In the case of `Rc<Self>`, this requires `Rc<T>: DispatchFromDyn<Rc<dyn Trait>>` These rules are explained more thoroughly in the doc comment on `receiver_is_dispatchable` in object_safety.rs. r? @nikomatsakis and @eddyb cc @arielb1 @cramertj @withoutboats Special thanks to @nikomatsakis for getting me un-stuck when implementing the object-safety checks, and @eddyb for helping with the codegen parts. EDIT 2018-11-01: updated because CoerceSized has been replaced with DispatchFromDyn
2018-11-02Auto merge of #55359 - alex:command-exec-uaf, r=alexcrichtonbors-0/+12
Fixes #46775 -- don't mutate the process's environment in Command::exec Instead, pass the environment to execvpe, so the kernel can apply it directly to the new process. This avoids a use-after-free in the case where exec'ing the new process fails for any reason, as well as a race condition if there are other threads alive during the exec. Fixes #46775
2018-11-01Replace CoerceSized trait with DispatchFromDynMichael Hewson-10/+7
Rename `CoerceSized` to `DispatchFromDyn`, and reverse the direction so that, for example, you write ``` impl<T: Unsize<U>, U> DispatchFromDyn<*const U> for *const T {} ``` instead of ``` impl<T: Unsize<U>, U> DispatchFromDyn<*const T> for *const U {} ``` this way the trait is really just a subset of `CoerceUnsized`. The checks in object_safety.rs are updated for the new trait, and some documentation and method names in there are updated for the new trait name — e.g. `receiver_is_coercible` is now called `receiver_is_dispatchable`. Since the trait now works in the opposite direction, some code had to updated here for that too. I did not update the error messages for invalid `CoerceSized` (now `DispatchFromDyn`) implementations, except to find/replace `CoerceSized` with `DispatchFromDyn`. Will ask for suggestions in the PR thread.
2018-11-01Add new tests and update existing for object-safe custom receiversMichael Hewson-0/+135
2018-11-01std: Enable usage of `thread_local!` through importsAlex Crichton-0/+18
The `thread_local!` macro delegated to an internal macro but it didn't do so in a macros-and-the-module-system compatible fashion, meaning if a `#![no_std]` crate imported `std` and tried to use `thread_local!` it would fail due to missing a lookup of an internal macro. This commit switches the macro to instead use `$crate` to invoke other macros, ensuring that it'll work when `thread_local!` is imported alone.
2018-11-01Rollup merge of #55575 - parched:trap, r=RalfJungPietro Albini-0/+1
Fix invalid_const_promotion test on some archs On at least AArch64 `llvm.trap` raises SIGTRAP. r? @RalfJung
2018-11-01Fixes #46775 -- don't mutate the process's environment in Command::execAlex Gaynor-0/+12
Instead, pass the environment to execvpe, so the kernel can apply it directly to the new process. This avoids a use-after-free in the case where exec'ing the new process fails for any reason, as well as a race condition if there are other threads alive during the exec.
2018-11-01Rollup merge of #55469 - pnkfelix:issue-54477-regression-tests, r=nikomatsakisPietro Albini-0/+25
Regression tests for issue #54477. At some point someone may want to revisit PR #53564 it would be really good to have regression tests for #54477 before that happens. :)
2018-10-31Fix invalid_const_promotion test on some archsJames Duley-0/+1
On at least AArch64 `llvm.trap` raises SIGTRAP.
2018-10-30Rollup merge of #55487 - nrc:path-fix, r=petrochenkovkennytm-0/+25
Adjust Ids of path segments in visibility modifiers Fixes #55376 (nightly regression) r? @petrochenkov
2018-10-30Regression test for issue #54477.Felix S. Klock II-0/+25
I removed the original file that more completely captured the original crate's tests, as its source crate (https://crates.io/crates/collection) is licensed under GPL3, and I suspect that license is not loose enough for me to put into our repo under our MIT/Apache licensing. (Would it be an option to attach the GPL3 licesne to just the one test? Probably. But do I want to bother with it that that point? Nope!)
2018-10-29Rename other occs of (Code/File)Map to Source(Map/File) #51574David Lavati-3/+3
2018-10-30Adjust Ids of path segments in visibility modifiersNick Cameron-0/+25
Fixes #55376
2018-10-28resolve: Refactor away `legacy_macro_imports`/`LegacyMacroImports`Vadim Petrochenkov-0/+8
2018-10-27Auto merge of #54183 - qnighy:by-value-object-safety, r=oli-obkbors-40/+91
Implement by-value object safety This PR implements **by-value object safety**, which is part of unsized rvalues #48055. That means, with `#![feature(unsized_locals)]`, you can call a method `fn foo(self, ...)` on trait objects. One aim of this is to enable `Box<FnOnce>` in the near future. The difficulty here is this: when constructing a vtable for a trait `Foo`, we can't just put the function `<T as Foo>::foo` into the table. If `T` is no larger than `usize`, `self` is usually passed directly. However, as the caller of the vtable doesn't know the concrete `Self` type, we want a variant of `<T as Foo>::foo` where `self` is always passed by reference. Therefore, when the compiler encounters such a method to be generated as a vtable entry, it produces a newly introduced instance called `InstanceDef::VtableShim(def_id)` (that wraps the original instance). the shim just derefs the receiver and calls the original method. We give different symbol names for the shims by appending `::{{vtable-shim}}` to the symbol path (and also adding vtable-shimness as an ingredient to the symbol hash). r? @eddyb
2018-10-27Correct alignment of atomic types and (re)add Atomic{I,U}128Oliver Middleton-0/+46
LLVM requires that atomic loads and stores be aligned to at least the size of the type.
2018-10-27Add more tests on unsized locals autoderef and borrowck.Masaki Hara-0/+47
2018-10-25Rollup merge of #55269 - matthiaskrgr:typos_oct, r=zackmdavisPietro Albini-1/+1
fix typos in various places
2018-10-25Rollup merge of #54977 - estebank:macro-arg-parse, r=pnkfelixPietro Albini-0/+16
Accept `Option<Box<$t:ty>>` in macro argument Given the following code, compile successfuly: ``` macro_rules! test { ( fn fun() -> Option<Box<$t:ty>>; ) => { fn fun(x: $t) -> Option<Box<$t>> { Some(Box::new(x)) } } } test! { fn fun() -> Option<Box<i32>>; } ``` Fix #25274.
2018-10-24Remove license headers from unsized-locals tests.Masaki Hara-60/+0
2018-10-24Add autoderef tests for by-value trait objects.Masaki Hara-0/+8
2018-10-24Add tests for unsized-locals.Masaki Hara-0/+56
2018-10-23fix typos in various placesMatthias Krüger-1/+1
2018-10-18Rollup merge of #55102 - petrochenkov:trextra, r=nikomatsakiskennytm-1/+1
resolve: Do not skip extern prelude during speculative resolution Fixes https://github.com/rust-lang/rust/issues/54665
2018-10-17resolve: Do not skip extern prelude during speculative resolutionVadim Petrochenkov-1/+1
2018-10-16Add ignore-compare-mode-nll to some run-pass tests that become compile-fail ↵Felix S. Klock II-0/+46
under #54986.
2018-10-15Rollup merge of #54820 - kleimkuhler:issue-54538-unused_patterns-lint, ↵Manish Goregaokar-0/+1
r=nikomatsakis Closes #54538: `unused_patterns` lint Closes #54538 r? @nikomatsakis
2018-10-12`#[must_use]` for associated functions is supposed to actually workZack M. Davis-1/+1
In the comments of (closed, defunct) pull request #54884, Mazdak "Centril" Farrokhzad noted that must-use annotations didn't work on an associated function (what other communities might call a "static method"). Subsequent logging revealed that in this case we have a `Def::Method`, whereas the lint pass was only matching on `Def::Fn`. (One could argue that those def-names are thereby misleading—must-use for self-ful methods have always worked—but documenting or reworking that can be left to another day.)