about summary refs log tree commit diff
path: root/src/test/run-pass
AgeCommit message (Collapse)AuthorLines
2019-04-02Rollup merge of #59446 - Aaron1011:fix/debuginfo-overflow, r=oli-obkMazdak Farrokhzad-0/+8
Fix stack overflow when generating debuginfo for 'recursive' type By using 'impl trait', it's possible to create a self-referential type as follows: fn foo() -> impl Copy { foo } This is a function which returns itself. Normally, the signature of this function would be impossible to write - it would look like 'fn foo() -> fn() -> fn() ...' e.g. a function which returns a function, which returns a function... Using 'impl trait' allows us to avoid writing this infinitely long type. While it's useless for practical purposes, it does compile and run However, issues arise when we try to generate llvm debuginfo for such a type. All 'impl trait' types (e.g. ty::Opaque) are resolved when we generate debuginfo, which can lead to us recursing back to the original 'fn' type when we try to process its return type. To resolve this, I've modified debuginfo generation to account for these kinds of weird types. Unfortunately, there's no 'correct' debuginfo that we can generate - 'impl trait' does not exist in debuginfo, and this kind of recursive type is impossible to directly represent. To ensure that we emit *something*, this commit emits dummy debuginfo/type names whenever it encounters a self-reference. In practice, this should never happen - it's just to ensure that we can emit some kind of debuginfo, even if it's not particularly meaningful Fixes #58463
2019-04-02Rollup merge of #59166 - seanmonstar:trait-alias-import, r=alexregMazdak Farrokhzad-0/+65
resolve: collect trait aliases along with traits It seems trait aliases weren't being collected as `TraitCandidates` in resolve, this should change that. (I can't compile the full compiler locally, so relying on CI...) Fixes https://github.com/rust-lang/rust/issues/56485 r? @alexreg
2019-04-01Refactor async fn return type loweringTaylor Cramer-4/+16
async fn now lowers directly to an existential type declaration rather than reusing the `impl Trait` return type lowering. As part of this, it lowers all argument-position elided lifetimes using the in-band-lifetimes machinery, creating fresh parameter names for each of them, using each lifetime parameter as a generic argument to the generated existential type. This doesn't currently successfully allow multiple argument-position elided lifetimes since `existential type` doesn't yet support multiple lifetimes where neither outlive the other. This requires a separate fix.
2019-04-01resolve all in scope trait aliases, then elaborate their boundsSean McArthur-1/+43
2019-03-31Fix stack overflow when generating debuginfo for 'recursive' typeAaron Hill-0/+8
By using 'impl trait', it's possible to create a self-referential type as follows: fn foo() -> impl Copy { foo } This is a function which returns itself. Normally, the signature of this function would be impossible to write - it would look like 'fn foo() -> fn() -> fn() ...' e.g. a function which returns a function, which returns a function... Using 'impl trait' allows us to avoid writing this infinitely long type. While it's useless for practical purposes, it does compile and run However, issues arise when we try to generate llvm debuginfo for such a type. All 'impl trait' types (e.g. ty::Opaque) are resolved when we generate debuginfo, which can lead to us recursing back to the original 'fn' type when we try to process its return type. To resolve this, I've modified debuginfo generation to account for these kinds of weird types. Unfortunately, there's no 'correct' debuginfo that we can generate - 'impl trait' does not exist in debuginfo, and this kind of recursive type is impossible to directly represent. To ensure that we emit *something*, this commit emits dummy debuginfo/type names whenever it encounters a self-reference. In practice, this should never happen - it's just to ensure that we can emit some kind of debuginfo, even if it's not particularly meaningful Fixes #58463
2019-03-31Rollup merge of #59583 - oberien:patch-1, r=CentrilMazdak Farrokhzad-0/+16
match match match match match
2019-03-31Rollup merge of #59580 - taiki-e:coerce-closure, r=oli-obkMazdak Farrokhzad-0/+7
Allow closure to unsafe fn coercion Closes #57883
2019-04-01Allow closure to unsafe fn coercionTaiki Endo-0/+7
2019-03-31match match match match matchJaro Fietz-0/+16
2019-03-30Restore testFabian Drinck-0/+3
2019-03-30Fix more testsFabian Drinck-10/+0
2019-03-30Rollup merge of #59376 - davidtwco:finally-rfc-2008-variants, ↵Mazdak Farrokhzad-204/+0
r=petrochenkov,QuietMisdreavus RFC 2008: Enum Variants Part of #44109. See [Zulip topic](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/rfc-2008/near/132663140) for previous discussion. r? @petrochenkov cc @nikomatsakis
2019-03-29Rollup merge of #59462 - taiki-e:no-core, r=petrochenkovMazdak Farrokhzad-0/+18
Fix error in Rust 2018 + no_core environment Minimized reproduction: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=5b9f6c3026ec9d856699fa6dbd4361f0 This is a fix for the error that occurred in #58702. r? @Centril
2019-03-28Implement `#[non_exhaustive]` on variants.David Wood-204/+0
This commit removes the check that disallows the `#[non_exhaustive]` attribute from being placed on enum variants and removes the associated tests. Further, this commit lowers the visibility of enum variant constructors when the variant is marked as non-exhaustive.
2019-03-28Rollup merge of #58803 - haraldh:fs_copy_fix, r=alexcrichtonMazdak Farrokhzad-4/+9
fs::copy() unix: set file mode early A convenience method like fs::copy() should try to prevent pitfalls a normal user doesn't think about. In case of an empty umask, setting the file mode early prevents temporarily world readable or even writeable files, because the default mode is 0o666. In case the target is a named pipe or special device node, setting the file mode can lead to unwanted side effects, like setting permissons on `/dev/stdout` or for root setting permissions on `/dev/null`. copy_file_range() returns EINVAL, if the destination is a FIFO/pipe or a device like "/dev/null", so fallback to io::copy, too. Fixes: https://github.com/rust-lang/rust/issues/26933 Fixed: https://github.com/rust-lang/rust/issues/37885
2019-03-27Rollup merge of #59284 - RalfJung:maybe-uninit, r=sfacklerJosh Stone-3/+3
adjust MaybeUninit API to discussions uninitialized -> uninit into_initialized -> assume_init read_initialized -> read set -> write
2019-03-27Rollup merge of #57565 - petrochenkov:turbowarn, r=CentrilJosh Stone-42/+6
syntax: Remove warning for unnecessary path disambiguators `rustfmt` is now stable and it removes unnecessary turbofishes, so removing the warning as discussed in https://github.com/rust-lang/rust/pull/43540 (where it was introduced). One hardcoded warning less. Closes https://github.com/rust-lang/rust/issues/58055 r? @nikomatsakis
2019-03-27Add a testTaiki Endo-0/+18
2019-03-27Auto merge of #55780 - ogoffart:span_source_text, r=petrochenkovbors-2/+43
Introduce proc_macro::Span::source_text A function to extract the actual source behind a Span. Background: I would like to use `syn` in a `build.rs` script to parse the rust code, and extract part of the source code. However, `syn` only gives access to proc_macro2::Span, and i would like to get the source code behind that. I opened an issue on proc_macro2 bug tracker for this feature https://github.com/alexcrichton/proc-macro2/issues/110 and @alexcrichton said the feature should first go upstream in proc_macro. So there it is! Since most of the Span API is unstable anyway, this is guarded by the same `proc_macro_span` feature as everything else.
2019-03-26fix some uses I missedRalf Jung-3/+3
2019-03-23syntax: Remove warning for unnecessary path disambiguatorsVadim Petrochenkov-42/+6
2019-03-23fs::copy() set file mode earlyHarald Hoyer-4/+9
A convenience method like fs::copy() should try to prevent pitfalls a normal user doesn't think about. In case of an empty umask, setting the file mode early prevents temporarily world readable or even writeable files, because the default mode is 0o666. In case the target is a named pipe or special device node, setting the file mode can lead to unwanted side effects, like setting permissons on `/dev/stdout` or for root setting permissions on `/dev/null`. copy_file_range() returns EINVAL, if the destination is a FIFO/pipe or a device like "/dev/null", so fallback to io::copy, too. Use `fcopyfile` on MacOS instead of `copyfile`. Fixes: https://github.com/rust-lang/rust/issues/26933 Fixed: https://github.com/rust-lang/rust/issues/37885
2019-03-23resolve: collect trait aliases along with traitsSean McArthur-0/+23
2019-03-16Rollup merge of #59206 - sntdevco:master, r=dtolnaykennytm-4/+4
Improved test output
2019-03-16Rollup merge of #59201 - lambda:remove-repr-simd-isize-usize-restriction, ↵kennytm-0/+32
r=alexcrichton Remove restriction on isize/usize in repr(simd) As discussed in #55078, there's no known reason for this restriction. It's unlikely that repr(simd) will be stabilized in its current form, but might as well remove some restrictions on it. This removes the branch in `is_machine` which returns false for these types. `is_machine` is only used for the repr(simd) type validation check.
2019-03-16Rollup merge of #59156 - davidtwco:issue-55809, r=nikomatsakiskennytm-0/+30
[wg-async-await] Add regression test for #55809. Fixes #55809. This PR adds a regression test for #55809 which checks that a overflow does not occur when evaluating a requirement for async functions and `&mut` arguments in some specific circumstances.
2019-03-16Rollup merge of #59025 - aoikonomopoulos:issue-57924, r=varkorkennytm-0/+9
Fix generic argument lookup for Self Rewrite the SelfCtor early and use the replacement Def when calculating the path_segs. Note that this also changes which def is seen by the code that computes user_self_ty and is_alias_variant_ctor; I don't see a immediate issue with that, but I'm not 100% clear on the implications. Fixes #57924 r? @eddyb
2019-03-15Remove restriction on isize/usize in repr(simd)Brian Campbell-0/+32
As discussed in #55078, there's no known reason for this restriction. It's unlikely that repr(simd) will be stabilized in its current form, but might as well remove some restrictions on it. This removes the branch in `is_machine` which returns false for these types. `is_machine` is only used for the repr(simd) type validation check.
2019-03-15Improved test output for estr-slicesntdevco-4/+4
2019-03-14Moved issue tests to subdirs and normalised names.Alexander Regueiro-49/+56
2019-03-13Fix generic argument lookup for SelfAngelos Oikonomopoulos-0/+9
Rewrite the SelfCtor early and use the replacement Def when calculating the path_segs. Note that this also changes which def is seen by the code that computes user_self_ty and is_alias_variant_ctor; I don't see a immediate issue with that, but I'm not 100% clear on the implications. Fixes #57924
2019-03-13Add test for #55809.David Wood-0/+30
This commit adds a regression test for #55809 which checks that a overflow does not occur when evaluating a requirement for async functions and `&mut` arguments in some specific circumstances.
2019-03-09Rollup merge of #58750 - TimDiekmann:master, r=oli-obkMazdak Farrokhzad-0/+32
Make `Unique::as_ptr`, `NonNull::dangling` and `NonNull::cast` const
2019-03-08Rollup merge of #58918 - gilescope:async-await-issue-testcase, r=petrochenkovPietro Albini-0/+28
Regression test added for an async ICE. Regression test for #57084 (as suggested in issue).
2019-03-08Rollup merge of #58911 - pnkfelix:issue-58435-regression-test, r=alexcrichtonPietro Albini-0/+17
Regression test for #58435. Fix #58435
2019-03-08Rollup merge of #58906 - Nemo157:generator-state-debug-info, r=ZoxcPietro Albini-0/+27
Monomorphize generator field types for debuginfo Fixes #58888 r? @Zoxc
2019-03-08Rollup merge of #58369 - nox:sync-hash-map-entry, r=AmanieuPietro Albini-0/+1
Make the Entry API of HashMap<K, V> Sync and Send Fixes #45219
2019-03-06Desugared asyncs into generators and minimised.Giles Cope-12/+13
2019-03-05Removed whitespaceGiles Cope-1/+1
2019-03-05Unrolled await macro.Giles Cope-6/+6
Was then able to the minimise the reproduction a little further.
2019-03-04Regression test added for an async ICE.Giles Cope-0/+27
2019-03-04Regression test for #58435.Felix S. Klock II-0/+17
2019-03-04Make the Entry API of HashMap<K, V> Sync and Send (fixes #45219)Anthony Ramine-0/+1
2019-03-04Monomorphize generator field types for debuginfoWim Looman-0/+27
2019-02-28Make `Unique::as_ptr`, `NonNull::dangling` and `NonNull::cast` constTim-0/+32
Make `Unique::as_ptr` const without feature attribute as it's unstable Make `NonNull::dangling` and `NonNull::cast` const with `feature = "const_ptr_nonnull"`
2019-02-26Normalize the type Self resolves to in an implAngelos Oikonomopoulos-0/+13
This is required at the very least in order to evaluate associated constants for arrays (see #58212).
2019-02-25Auto merge of #57367 - petrochenkov:unrestab, r=Centrilbors-2/+0
Stabilize `unrestricted_attribute_tokens` In accordance with a plan described in https://internals.rust-lang.org/t/unrestricted-attribute-tokens-feature-status/8561/3. Delimited non-macro non-builtin attributes now support the same syntax as macro attributes: ``` PATH PATH `(` TOKEN_STREAM `)` PATH `[` TOKEN_STREAM `]` PATH `{` TOKEN_STREAM `}` ``` Such attributes mostly serve as inert proc macro helpers or tool attributes. To some extent these attributes are de-facto stable due to a hole in feature gate checking (feature gating is done too late - after macro expansion.) So if macro *removes* such helper attributes during expansion (and it must remove them, unless it's a derive macro), then the code will work on stable. Key-value non-macro non-builtin attributes are now restricted to bare minimum required to support what we support on stable - unsuffixed literals (https://github.com/rust-lang/rust/issues/34981). ``` PATH `=` LITERAL ``` (Key-value macro attributes are not supported at all right now.) Crater run in https://github.com/rust-lang/rust/pull/57321 found no regressions for this change. There are multiple possible ways to extend key-value attributes (https://github.com/rust-lang/rust/pull/57321#issuecomment-451574065), but I'd expect an RFC for that and it's not a pressing enough issue to block stabilization of delimited attributes. Built-in attributes are still restricted to the "classic" meta-item syntax, nothing changes here. https://github.com/rust-lang/rust/pull/57321 goes further and adds some additional restrictions (more consistent input checking) to built-in attributes. Closes https://github.com/rust-lang/rust/issues/55208
2019-02-25Auto merge of #58302 - SimonSapin:tryfrom, r=alexcrichtonbors-4/+3
Stabilize TryFrom and TryInto with a convert::Infallible empty enum This is the plan proposed in https://github.com/rust-lang/rust/issues/33417#issuecomment-423073898
2019-02-25Stabilize `unrestricted_attribute_tokens`Vadim Petrochenkov-2/+0
2019-02-25Test that binop subtyping in rustc_typeck fixes #27949Jamie Turner-0/+41