about summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
2018-03-26Auto merge of #48346 - emilio:pgo, r=alexcrichtonbors-0/+38
Add basic PGO support. This PR adds two mutually exclusive options for profile usage and generation using LLVM's instruction profile generation (the same as clang uses), `-C pgo-use` and `-C pgo-gen`. See each commit for details.
2018-03-26Auto merge of #49255 - cramertj:stable-impl-trait, r=nikomatsakisbors-171/+52
Stabilize impl Trait Blocked on: - [x] https://github.com/rust-lang/rust/pull/49041 and - [ ] completion of FCP in https://github.com/rust-lang/rust/issues/34511#issuecomment-373207183 (3 days from now). I have not yet done any docs work for this-- I probably won't get to it until this weekend (might be a project for the flight to the all-hands).
2018-03-26Stabilize conservative_impl_traitTaylor Cramer-117/+46
2018-03-26Stabilize universal_impl_traitTaylor Cramer-59/+11
2018-03-26Auto merge of #49351 - pthariensflame:patch-1, r=oli-obkbors-2/+2
Minor message/label formatting consistency fix. The unimplemented label for `Termination` was missing some backticks for consistency with the message.
2018-03-26Auto merge of #49297 - scottmcm:offset-from, r=dtolnaybors-0/+30
Introduce unsafe offset_from on pointers Adds intrinsics::exact_div to take advantage of the unsafe, which reduces the implementation from ```asm sub rcx, rdx mov rax, rcx sar rax, 63 shr rax, 62 lea rax, [rax + rcx] sar rax, 2 ret ``` down to ```asm sub rcx, rdx sar rcx, 2 mov rax, rcx ret ``` (for `*const i32`) See discussion on the `offset_to` tracking issue https://github.com/rust-lang/rust/issues/41079 Some open questions - Would you rather I split the intrinsic PR from the library PR? - Do we even want the safe version of the API? https://github.com/rust-lang/rust/issues/41079#issuecomment-374426786 I've added some text to its documentation that even if it's not UB, it's useless to use it between pointers into different objects. and todos - [x] ~~I need to make a codegen test~~ Done - [x] ~~Can the subtraction use nsw/nuw?~~ No, it can't https://github.com/rust-lang/rust/pull/49297#discussion_r176697574 - [x] ~~Should there be `usize` variants of this, like there are now `add` and `sub` that you almost always want over `offset`? For example, I imagine `sub_ptr` that returns `usize` and where it's UB if the distance is negative.~~ Can wait for later; C gives a signed result https://github.com/rust-lang/rust/issues/41079#issuecomment-375842235, so we might as well, and this existing to go with `offset` makes sense.
2018-03-25Modify testsAlexander Ronald Altman-2/+2
2018-03-25pgo: Move the tests to run-make-fulldeps, and make the profile file be in ↵Emilio Cobos Álvarez-2/+2
the tmp directory properly.
2018-03-25librustc_trans: Mark some profiler symbols as exported to avoid LTO removing ↵Emilio Cobos Álvarez-0/+19
them.
2018-03-25librustc: Convert -C pgo-gen and -C pgo-use into -Z flags.Emilio Cobos Álvarez-1/+1
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2018-03-25Test that pgo-gen works properly.Emilio Cobos Álvarez-0/+19
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2018-03-25Auto merge of #49141 - gnzlbg:simd_select, r=alexcrichtonbors-0/+237
adds simd_select intrinsic The select SIMD intrinsic is used to select elements from two SIMD vectors using a mask: ```rust let mask = b8x4::new(true, false, false, true); let a = f32x4::new(1., 2., 3., 4.); let b = f32x4::new(5., 6., 7., 8.); assert_eq!(simd_select(mask, a, b), f32x4::new(1., 6., 7., 4.)); ``` The number of lanes between the mask and the vectors must match, but the vector width of the mask does not need to match that of the vectors. The mask is required to be a vector of signed integers. Note: this intrinsic will be exposed via `std::simd`'s vector masks - users are not expected to use it directly.
2018-03-25Rollup merge of #49299 - SimonSapin:ubiquity, r=nikomatsakiskennytm-98/+8
Stabilize the copy_closures and clone_closures features In addition to the `Fn*` family of traits, closures now implement `Copy` (and similarly `Clone`) if all of the captures do. Tracking issue: https://github.com/rust-lang/rust/issues/44490
2018-03-25Rollup merge of #49268 - ordovicia:dotdot-pattern-diag, r=petrochenkovkennytm-0/+37
Better diagnostics for '..' pattern fragment not in the last position Fixes #49257.
2018-03-25Rollup merge of #49194 - Zoxc:unsafe-generator, r=cramertjkennytm-94/+70
Make resuming generators unsafe instead of the creation of immovable generators cc @withoutboats Fixes #47787
2018-03-25Rollup merge of #49162 - tmandry:stabilize-termination-trait, r=nikomatsakiskennytm-19/+40
Stabilize termination_trait, split out termination_trait_test For #48453. First time contribution, so I'd really appreciate any feedback on how this PR can be better. Not sure exactly what kind of documentation update is needed. If there is no PR to update the reference, I can try doing that this week as I have time.
2018-03-25Rollup merge of #49046 - Zoxc:error-summary, r=michaelwoeristerkennytm-15/+68
Always print `aborting due to n previous error(s)` r? @michaelwoerister
2018-03-24Auto merge of #49251 - nikomatsakis:issue-15872-elision-impl-header, r=cramertjbors-0/+399
support elision in impl headers You can now do things like: ``` impl MyTrait<'_> for &u32 { ... } ``` Each `'_` or elided lifetime is a fresh parameter. `'_` and elision are still not permitted in associated type values. (Plausibly we could support that if there is a single input lifetime.) The original lifetime elision RFC was a bit unclear on this point: [as documented here, I think this is the correct interpretation, both because it fits existing impls and it's most analogous to the behavior in fns](https://github.com/rust-lang/rust/issues/15872#issuecomment-338700138). We do not support elision with deprecated forms: ``` impl MyTrait for std::cell::Ref<u32> { } // ERROR ``` Builds on the in-band lifetime stuff. r? @cramertj Fixes #15872
2018-03-23Add a codegen test for exact_div intrinsicScott McMurray-0/+30
2018-03-24Auto merge of #48552 - kennytm:lower-unstable-priority, r=nikomatsakisbors-9/+157
Lower the priority of unstable methods when picking a candidate. Previously, when searching for the impl of a method, we do not consider the stability of the impl. This leads to lots of insta-inference-regressions due to method ambiguity when a popular name is chosen. This has happened multiple times in Rust's history e.g. * `f64::from_bits` #40470 * `Ord::{min, max}` #42496 * `Ord::clamp` #44095 (eventually got reverted due to these breakages) * `Iterator::flatten` #48115 (recently added) This PR changes the probing order so that unstable items are considered last. If a stable item is found, the unstable items will not be considered (but a future-incompatible warning will still be emitted), thus allowing stable code continue to function without using qualified names. Once the unstable feature is stabilized, the ambiguity error will still be emitted, but the user can also use newly stable std methods, while the current situation is that downstream user is forced to update the code without any immediate benefit. (I hope that we could bring back `Ord::clamp` if this PR is merged.)
2018-03-24Auto merge of #48482 - davidtwco:issue-47184, r=nikomatsakisbors-3/+37
NLL should identify and respect the lifetime annotations that the user wrote Part of #47184. r? @nikomatsakis
2018-03-24Fix test for PR #49268Hidehito Yabuuchi-11/+4
2018-03-24Filed a proper tracking issue.kennytm-1/+1
2018-03-24Specialize future-incompatibility warning for UNSTABLE_NAME_COLLISION.kennytm-4/+4
2018-03-24When picking a candidate, consider the unstable ones last.kennytm-0/+154
If there is potential ambiguity after stabilizing those candidates, a warning will be emitted.
2018-03-24Provide a proper span when demanding for the return type of `box x`.kennytm-9/+3
2018-03-24Fix error annotations in testHidehito Yabuuchi-2/+2
2018-03-24Better diagnostics for '..' pattern fragment not in the last positionHidehito Yabuuchi-0/+44
2018-03-23Test fixesAlex Crichton-0/+8
2018-03-23Merge branch '49001_epoch' of https://github.com/klnusbaum/rust into rollupAlex Crichton-7/+7
2018-03-23Merge branch 'master' of https://github.com/Lymia/rust into rollupAlex Crichton-2/+269
2018-03-23Rollup merge of #49295 - csmoe:nll_test_48238, r=alexcrichtonAlex Crichton-0/+30
Add test for issue-48238 Fixes #48238 test case made from comments in #48238
2018-03-23Rollup merge of #49262 - oli-obk:fixed_size_array_len, r=estebankAlex Crichton-1/+41
Produce nice array lengths on a best effort basis fixes #49208 r? @estebank
2018-03-23Rollup merge of #49169 - sanxiyn:doc-only, r=aturonAlex Crichton-0/+2
Document only-X test header This was added in #47487 without documentation.
2018-03-23Rollup merge of #49160 - estebank:issue-47457-missing-fields, r=oli-obkAlex Crichton-9/+44
Reduce the diagnostic spam when multiple fields are missing in pattern Fix #47457.
2018-03-23Rollup merge of #49030 - Zoxc:misc, r=michaelwoeristerAlex Crichton-2/+1
Misc changes from my parallel rustc branch r? @michaelwoerister
2018-03-23Rollup merge of #48909 - RalfJung:type_alias_bounds, r=petrochenkovAlex Crichton-65/+164
Improve lint for type alias bounds First of all, I learned just today that I was wrong assuming that the bounds in type aliases are entirely ignored: It turns out they are used to resolve associated types in type aliases. So: ```rust type T1<U: Bound> = U::Assoc; // compiles type T2<U> = U::Assoc; // fails type T3<U> = <U as Bound>::Assoc; // "correct" way to write this, maybe? ``` I am sorry for creating this mess. This PR changes the wording of the lint accordingly. Moreover, since just removing the bound is no longer always a possible fix, I tried to detect cases like `T1` above and show a helpful message to the user: ``` warning: bounds on generic parameters are not enforced in type aliases --> $DIR/type-alias-bounds.rs:57:12 | LL | type T1<U: Bound> = U::Assoc; //~ WARN not enforced in type aliases | ^^^^^ | = help: the bound will not be checked when the type alias is used, and should be removed help: use absolute paths (i.e., <T as Trait>::Assoc) to refer to associated types in type aliases --> $DIR/type-alias-bounds.rs:57:21 | LL | type T1<U: Bound> = U::Assoc; //~ WARN not enforced in type aliases | ^^^^^^^^ ``` I am not sure if I got this entirely right. Ideally, we could provide a suggestion involving the correct trait and type name -- however, while I have access to the HIR in the lint, I do not know how to get access to the resolved name information, like which trait `Assoc` belongs to above. The lint does not even run if that resolution fails, so I assume that information is available *somewhere*... This is a follow-up for (parts of) https://github.com/rust-lang/rust/pull/48326. Also see https://github.com/rust-lang/rust/issues/21903. This changes the name of a lint, but that lint was just merged to master yesterday and has never even been on beta.
2018-03-23Rollup merge of #48883 - alexcrichton:wasm-custom-sections, r=nikomatsakisAlex Crichton-0/+411
rustc: Add a `#[wasm_custom_section]` attribute This commit is an implementation of adding custom sections to wasm artifacts in rustc. The intention here is to expose the ability of the wasm binary format to contain custom sections with arbitrary user-defined data. Currently neither our version of LLVM nor LLD supports this so the implementation is currently custom to rustc itself. The implementation here is to attach a `#[wasm_custom_section = "foo"]` attribute to any `const` which has a type like `[u8; N]`. Other types of constants aren't supported yet but may be added one day! This should hopefully be enough to get off the ground with *some* custom section support. The current semantics are that any constant tagged with `#[wasm_custom_section]` section will be *appended* to the corresponding section in the final output wasm artifact (and this affects dependencies linked in as well, not just the final crate). This means that whatever is interpreting the contents must be able to interpret binary-concatenated sections (or each constant needs to be in its own custom section). To test this change the existing `run-make` test suite was moved to a `run-make-fulldeps` folder and a new `run-make` test suite was added which applies to all targets by default. This test suite currently only has one test which only runs for the wasm target (using a node.js script to use `WebAssembly` in JS to parse the wasm output).
2018-03-23Rollup merge of #48624 - bdrewery:freebsd-posix-spawn, r=alexcrichtonAlex Crichton-0/+23
Command: Support posix_spawn() on FreeBSD/OSX/GNU Linux
2018-03-23Rollup merge of #48265 - SimonSapin:nonzero, r=KodrAusAlex Crichton-30/+22
Add 12 num::NonZero* types for primitive integers, deprecate core::nonzero RFC: https://github.com/rust-lang/rfcs/pull/2307 Tracking issue: ~~https://github.com/rust-lang/rust/issues/27730~~ https://github.com/rust-lang/rust/issues/49137 Fixes https://github.com/rust-lang/rust/issues/27730
2018-03-23Fixed issues with incremental tests.David Wood-1/+1
2018-03-23Updated MIR with UserAssertTy in mir-opt tests.David Wood-2/+5
2018-03-23Stabilize the copy_closures and clone_closures featuresSimon Sapin-98/+8
In addition to the `Fn*` family of traits, closures now implement `Copy` (and similarly `Clone`) if all of the captures do.
2018-03-23add test for issue-48238csmoe-0/+30
2018-03-22Added flag to disable user type assertion.David Wood-0/+1
2018-03-22Updated test with expected error message.David Wood-2/+16
2018-03-22Added initial test for #47184David Wood-0/+16
2018-03-22permit `'_` and `&T` in impl headersNiko Matsakis-0/+357
Deprecated forms of elision are not supported.
2018-03-22add new test for `dyn<Trait + '_>` used in a structNiko Matsakis-0/+42
`'_` is illegal in structs; this currently gets a duplicate error
2018-03-22rustc: Add a `#[wasm_import_module]` attributeAlex Crichton-2/+147
This commit adds a new attribute to the Rust compiler specific to the wasm target (and no other targets). The `#[wasm_import_module]` attribute is used to specify the module that a name is imported from, and is used like so: #[wasm_import_module = "./foo.js"] extern { fn some_js_function(); } Here the import of the symbol `some_js_function` is tagged with the `./foo.js` module in the wasm output file. Wasm-the-format includes two fields on all imports, a module and a field. The field is the symbol name (`some_js_function` above) and the module has historically unconditionally been `"env"`. I'm not sure if this `"env"` convention has asm.js or LLVM roots, but regardless we'd like the ability to configure it! The proposed ES module integration with wasm (aka a wasm module is "just another ES module") requires that the import module of wasm imports is interpreted as an ES module import, meaning that you'll need to encode paths, NPM packages, etc. As a result, we'll need this to be something other than `"env"`! Unfortunately neither our version of LLVM nor LLD supports custom import modules (aka anything not `"env"`). My hope is that by the time LLVM 7 is released both will have support, but in the meantime this commit adds some primitive encoding/decoding of wasm files to the compiler. This way rustc postprocesses the wasm module that LLVM emits to ensure it's got all the imports we'd like to have in it. Eventually I'd ideally like to unconditionally require this attribute to be placed on all `extern { ... }` blocks. For now though it seemed prudent to add it as an unstable attribute, so for now it's not required (as that'd force usage of a feature gate). Hopefully it doesn't take too long to "stabilize" this! cc rust-lang-nursery/rust-wasm#29