rust/src/test/run-pass
Mazdak Farrokhzad 57a4f17b6e
Rollup merge of #59446 - Aaron1011:fix/debuginfo-overflow, r=oli-obk
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-02 18:25:15 +02:00
..
allocator
array-slice-vec Improved test output for estr-slice 2019-03-15 16:38:51 +05:30
associated-consts
associated-types
autoref-autoderef
auxiliary Moved issue tests to subdirs and normalised names. 2019-03-14 01:00:49 +00:00
bench
binding Fix more tests 2019-03-30 22:37:02 +01:00
borrowck
cfg
chalkify
coerce
coherence
consts Make Unique::as_ptr, NonNull::dangling and NonNull::cast const 2019-02-28 07:32:13 +01:00
cross-crate
ctfe
deriving
drop
dynamically-sized-types
extern
for-loop-while
foreign
functions-closures
generator Rollup merge of #58918 - gilescope:async-await-issue-testcase, r=petrochenkov 2019-03-08 09:41:58 +01:00
generics
higher-rank-trait-bounds
hygiene
impl-trait
imports
intrinsics
issues Fix stack overflow when generating debuginfo for 'recursive' type 2019-03-31 20:09:29 -04:00
iterators
macros
methods
mir
modules
moves
nll
non_modrs_mods
numbers-arithmetic
overloaded
packed syntax: Remove warning for unnecessary path disambiguators 2019-03-23 17:20:11 +03:00
panic-runtime
panics
privacy
proc-macro Auto merge of #55780 - ogoffart:span_source_text, r=petrochenkov 2019-03-27 08:58:40 +00:00
process
regions
rfcs Restore test 2019-03-30 22:37:02 +01:00
self
sepcomp
simd Remove restriction on isize/usize in repr(simd) 2019-03-15 09:42:02 -04:00
specialization
statics
structs-enums
thinlto
threads-sendsync Rollup merge of #58369 - nox:sync-hash-map-entry, r=Amanieu 2019-03-08 09:41:42 +01:00
traits Rollup merge of #59166 - seanmonstar:trait-alias-import, r=alexreg 2019-04-02 18:25:12 +02:00
unboxed-closures
uniform-paths
union
unique
unsized-locals
where-clauses
zero-sized
.gitattributes
abi-sysv64-arg-passing.rs
abi-sysv64-register-usage.rs
abort-on-c-abi.rs
alias-uninit-value.rs
align-with-extern-c-fn.rs
alignment-gep-tup-like-1.rs
alloca-from-derived-tydesc.rs
allocator-alloc-one.rs
anon-extern-mod.rs
arbitrary_self_types_pointers_and_wrappers.rs
arbitrary_self_types_stdlib_pointers.rs
argument-passing.rs
artificial-block.rs
as-precedence.rs
asm-concat-src.rs
asm-in-moved.rs
asm-in-out-operand.rs
asm-indirect-memory.rs
asm-out-assign.rs
assert-eq-trailing-comma.rs
assert-escape.rs
assert-ne-trailing-comma.rs
assign-assign.rs
assoc-oddities-3.rs
associated-item-long-paths.rs
async-await.rs Refactor async fn return type lowering 2019-04-01 18:25:57 -07:00
atomic-access-bool.rs
atomic-alignment.rs
atomic-compare_exchange.rs
atomic-print.rs
attr-before-view-item2.rs
attr-before-view-item.rs
attr-main-2.rs
attr-main.rs
attr-mix-new.rs
attr-on-generic-formals.rs
attr-shebang.rs
attr-start.rs
attr.rs
augmented-assignments-feature-gate-cross.rs
augmented-assignments-feature-gate.rs
augmented-assignments.rs
auto-instantiate.rs
auto-is-contextual.rs
autobind.rs
backtrace-debuginfo-aux.rs
backtrace-debuginfo.rs
backtrace.rs
bare-fn-implements-fn-mut.rs
bare-static-string.rs
big-literals.rs
binary-minus-without-space.rs
bind-by-move.rs
binops-issue-22743.rs
binops.rs
bitwise.rs
blind-item-local-shadow.rs
blind-item-mixed-crate-use-item.rs
blind-item-mixed-use-item.rs
block-arg-call-as.rs
block-arg.rs
block-explicit-types.rs
block-expr-precedence.rs
block-fn-coerce.rs
block-iter-1.rs
block-iter-2.rs
bool-not.rs
bool.rs
borrow-by-val-method-receiver.rs
box-new.rs
bug-7183-generics.rs
bug-7295.rs
builtin-clone-unwind.rs
builtin-clone.rs
builtin-superkinds-capabilities-transitive.rs
builtin-superkinds-capabilities-xc.rs
builtin-superkinds-capabilities.rs
builtin-superkinds-in-metadata.rs
builtin-superkinds-phantom-typaram.rs
builtin-superkinds-simple.rs
builtin-superkinds-typaram.rs
byte-literals.rs
c-stack-as-value.rs
c-stack-returning-int64.rs
cabi-int-widening.rs
can-copy-pod.rs
cancel-clean-via-immediate-rvalue-ref.rs
cast-does-fallback.rs
cast-region-to-uint.rs
cast-rfc0401-vtable-kinds.rs
cast-rfc0401.rs
cast-to-infer-ty.rs
cast.rs
catch-unwind-bang.rs
cell-does-not-clone.rs
char_unicode.rs
char.rs
check_const-feature-gated.rs
check-static-recursion-foreign.rs
child-outlives-parent.rs
cleanup-arm-conditional.rs
cleanup-rvalue-during-if-and-while.rs
cleanup-rvalue-for-scope.rs
cleanup-rvalue-scopes.rs
cleanup-rvalue-temp-during-incomplete-alloc.rs
cleanup-shortcircuit.rs
clone-with-exterior.rs
close-over-big-then-small-data.rs
cmp-default.rs
codegen-object-shim.rs
collections-const-new.rs
command-exec.rs
command-pre-exec.rs
compiletest-skip-codegen.rs
complex.rs
concat.rs
const-int-conversion.rs
const-int-overflowing.rs
const-int-rotate.rs
const-int-saturating-arith.rs
const-int-sign.rs
const-int-wrapping.rs
const-needs_drop.rs
core-run-destroy.rs
crate-leading-sep.rs
crate-method-reexport-grrrrrrr.rs
crate-name-attr-used.rs
crt-static-off-works.rs
crt-static-on-works.rs
cycle-generic-bound.rs
dead-code-alias-in-pat.rs
dead-code-leading-underscore.rs
debuginfo-lto.rs
deep.rs
default-alloc-error-hook.rs
default-associated-types.rs
default-method-parsing.rs
default-method-simple.rs
defaults-well-formedness.rs
deprecation-in-force-unstable.rs
deref-lval.rs
deref-mut-on-ref.rs
deref-on-ref.rs
deref-rc.rs
deref.rs
discriminant_value-wrapper.rs
discriminant_value.rs
diverging-fallback-control-flow.rs
diverging-fallback-method-chain.rs
diverging-fallback-option.rs
double-ref.rs
dupe-first-attr.rc
duplicated-external-mods.rs
early-ret-binop-add.rs
early-vtbl-resolution.rs
edition-keywords-2015-2015.rs
edition-keywords-2015-2018.rs
edition-keywords-2018-2015.rs
edition-keywords-2018-2018.rs
else-if.rs
empty_global_asm.rs
empty-allocation-non-null.rs
empty-allocation-rvalue-non-null.rs
empty-type-parameter-list.rs
env-args-reverse-iterator.rs
env-funky-keys.rs
env-home-dir.rs
env-null-vars.rs
env-vars.rs
epoch-gate-feature.rs
eq-multidispatch.rs
estr-uniq.rs
exec-env.rs
existential_type.rs
explicit-i-suffix.rs
export-glob-imports-target.rs
export-multi.rs
export-non-interference2.rs
export-non-interference3.rs
expr-block-fn.rs
expr-block-generic-unique1.rs
expr-block-generic-unique2.rs
expr-block-generic.rs
expr-block-slot.rs
expr-block-unique.rs
expr-block.rs
expr-copy.rs
expr-empty-ret.rs
expr-fn.rs
expr-if-generic.rs
expr-if-panic-all.rs
expr-if-panic.rs
expr-if-unique.rs
expr-if.rs
expr-scope.rs
ext-expand-inner-exprs.rs
extend-for-unit.rs
exterior.rs
extoption_env-not-defined.rs
fact.rs
fat-lto.rs
fat-ptr-cast.rs
fds-are-cloexec.rs
filter-block-view-items.rs
fixup-deref-mut.rs
format-hygiene.rs
format-nan.rs
format-no-std.rs
format-ref-cell.rs
fsu-moves-and-copies.rs
fun-call-variants.rs
fun-indirect-call.rs
futures-api.rs
global-scope.rs
guards-not-exhaustive.rs
guards.rs
hashmap-memory.rs
hello.rs
html-literals.rs
if-bot.rs
if-check.rs
if-ret.rs
ifmt.rs Fix more tests 2019-03-30 22:37:02 +01:00
ignore-all-the-things.rs
impl-for-never.rs
impl-inherent-non-conflict.rs
impl-not-adjacent-to-type.rs
impl-privacy-xc-1.rs
impl-privacy-xc-2.rs
impl-trait-in-bindings.rs
in-band-lifetimes.rs
inc-range-pat.rs
infer-fn-tail-expr.rs
inherit-env.rs
init-large-type.rs
init-res-into-things.rs
inlined-main.rs
inner-attrs-on-impl.rs
inner-module.rs
inner-static.rs
instantiable.rs
invalid_const_promotion.rs Fix more tests 2019-03-30 22:37:02 +01:00
invoke-external-foreign.rs
irrefutable-unit.rs
issue-55809.rs Add test for #55809. 2019-03-13 12:38:10 +01:00
istr.rs
item-attributes.rs
item-name-overload.rs
keyword-changes-2012-07-31.rs
kindck-implicit-close-over-mut-var.rs
kinds-in-metadata.rs
lambda-infer-unresolved.rs
lambda-var-hygiene.rs
large-records.rs
last-use-in-block.rs
last-use-in-cap-clause.rs
last-use-is-capture.rs
lazy-and-or.rs
lazy-init.rs
leak-unique-as-tydesc.rs
lex-bare-cr-nondoc-comment.rs
lexer-crlf-line-endings-string-literal-doc-comment.rs
lexical-scoping.rs
lib-defaults.rs
link-cfg-works.rs
link-section.rs
linkage1.rs
lint-cap.rs
lint-dead-code-associated-type.rs
lint-dead-code-variant.rs
lint-expr-stmt-attrs-for-early-lints.rs
lint-unknown-lints-at-crate-level.rs
list.rs
liveness-assign-imm-local-after-ret.rs
llvm-pr32379.rs
log-err-phi.rs
log-knows-the-names-of-variants-in-std.rs
log-knows-the-names-of-variants.rs
log-poly.rs
logging_before_rt_started.rs
logging-only-prints-once.rs
long-while.rs
lto-many-codegen-units.rs
lto-still-runs-thread-dtors.rs
lub-glb-with-unbound-infer-var.rs
macro-quote-cond.rs
macro-quote-test.rs
max-min-classes.rs
mid-path-type-params.rs
minmax-stability-issue-23687.rs
monad.rs
monomorphize-abi-alignment.rs
monomorphized-callees-with-ty-params-3314.rs
mpsc_stress.rs
msvc-data-only.rs
multi-panic.rs
multibyte.rs
multidispatch1.rs
multidispatch2.rs
multidispatch-conditional-impl-not-considered.rs
multiline-comment.rs
multiple-reprs.rs
mut-function-arguments.rs
mut-vstore-expr.rs
mutual-recursion-group.rs
native-print-no-runtime.rs
negative.rs
nested_item_main.rs
nested-block-comment.rs
nested-class.rs
nested-function-names-issue-8587.rs
never_coercions.rs
never-result.rs
never-type-rvalues.rs
new-box-syntax.rs
new-box.rs
new-impl-syntax.rs
new-import-syntax.rs
new-style-constants.rs
new-unicode-escapes.rs
new-unsafe-pointers.rs
newlambdas-ret-infer2.rs
newlambdas-ret-infer.rs
newlambdas.rs
newtype-polymorphic.rs
newtype-temporary.rs
newtype.rs
nil-decl-in-foreign.rs
no-core-1.rs
no-core-2.rs Add a test 2019-03-27 22:48:39 +09:00
no-landing-pads.rs
no-std-1.rs
no-std-2.rs
no-std-3.rs
no-stdio.rs
non-built-in-quote.rs
non-legacy-modes.rs
nul-characters.rs
nullable-pointer-ffi-compat.rs
nullable-pointer-iotareduction.rs
nullable-pointer-size.rs
object-lifetime-default-default-to-static.rs
object-lifetime-default-from-rptr-box.rs
object-lifetime-default-from-rptr-mut.rs
object-lifetime-default-from-rptr.rs
object-method-numbering.rs
objects-coerce-freeze-borrored.rs
objects-owned-object-borrowed-method-headerless.rs
objects-owned-object-owned-method.rs
once-move-out-on-heap.rs
one-tuple.rs
op-assign-builtins-by-ref.rs
opeq.rs
operator-associativity.rs
operator-multidispatch.rs
operator-overloading.rs
optimization-fuel-0.rs
optimization-fuel-0.stderr
optimization-fuel-1.rs
optimization-fuel-1.stderr
option-ext.rs
option-unwrap.rs
out-of-stack.rs Fix more tests 2019-03-30 22:37:02 +01:00
out-pointer-aliasing.rs
output-slot-variants.rs
over-constrained-vregs.rs
overlap-doesnt-conflict-with-specialization.rs
overlap-permitted-for-annotated-marker-traits.rs
owned-implies-static.rs
panic-uninitialized-zeroed.rs fix some uses I missed 2019-03-26 09:23:19 +01:00
paren-free.rs
parse-assoc-type-lt.rs
parse-panic.rs
parser-unicode-whitespace.rs
path.rs
paths-containing-nul.rs fs::copy() set file mode early 2019-03-23 07:36:27 +01:00
print-stdout-eprint-stderr.rs
proc_macro.rs
project-cache-issue-31849.rs
project-cache-issue-37154.rs
project-defer-unification.rs
ptr-coercion.rs
pure-sum.rs
purity-infer.rs
range_inclusive_gate.rs
range_inclusive.rs
range-type-infer.rs
range.rs
ranges-precedence.rs
raw-fat-ptr.rs
raw-str.rs
rcvr-borrowed-to-region.rs
reachable-unnameable-items.rs
reachable-unnameable-type-alias.rs
readalias.rs
realloc-16687.rs
reexport-should-still-link.rs
reexport-star.rs
reexport-test-harness-main.rs
refer-to-other-statics-by-value.rs
repeat-expr-in-static.rs
repr_c_int_align.rs
resolve-issue-2428.rs
resolve-pseudo-shadowing.rs
resource-assign-is-not-copy.rs
resource-destruct.rs
result-opt-conversions.rs
ret-bang.rs
ret-none.rs
return-nil.rs
rmeta.rs Moved issue tests to subdirs and normalised names. 2019-03-14 01:00:49 +00:00
running-with-no-runtime.rs
rustc-rust-log.rs
rvalue-static-promotion.rs
segfault-no-out-of-stack.rs
semistatement-in-lambda.rs
seq-compare.rs
shadow.rs
shadowed-use-visibility.rs
shebang.rs
signal-alternate-stack-cleanup.rs
signal-exit-status.rs
sigpipe-should-be-ignored.rs
simple_global_asm.rs
simple-infer.rs
size-and-align.rs
sized-borrowed-pointer.rs
sized-owned-pointer.rs
sleep.rs
slowparse-bstring.rs
slowparse-string.rs
sse2.rs
stable-addr-of.rs
stack-probes-lto.rs
stack-probes.rs
stdio-is-blocking.rs
str-concat.rs
str-multiline.rs
string-box-error.rs
string-escapes.rs
structured-compare.rs
super-fast-paren-parsing.rs
super.rs
supported-cast.rs
svh-add-nothing.rs
swap-1.rs
swap-2.rs
swap-overlapping.rs
tail-call-arg-leak.rs
tail-cps.rs
tail-direct.rs
tcp-stress.rs
terminate-in-initializer.rs
test-allow-dead-extern-static-no-warning.rs
test-allow-fail-attr.rs
test-fn-signature-verification-for-explicit-return-type.rs
test-main-not-dead-attr.rs
test-main-not-dead.rs
test-runner-hides-buried-main.rs
test-runner-hides-main.rs
test-runner-hides-start.rs
test-should-fail-good-message.rs
test-vs-cfg-test.rs
thin-lto-global-allocator.rs
thread-local-not-in-prelude.rs
tool_attributes.rs
tool_lints_2018_preview.rs
tool_lints.rs
trailing-comma.rs
transmute-non-immediate-to-immediate.rs
transmute-specialization.rs
trivial_casts.rs
trivial-message.rs
try_from.rs
try-block.rs
try-from-int-error-partial-eq.rs
try-is-identifier-edition2015.rs
try-operator-custom.rs
try-operator-hygiene.rs
try-operator.rs
try-wait.rs
tup.rs
tuple-index-fat-types.rs
tuple-index.rs
tydesc-name.rs
type-alias-enum-variants-2.rs
type-alias-enum-variants.rs
type-ascription.rs
type-id-higher-rank-2.rs
type-id-higher-rank.rs
type-in-nested-module.rs
type-infer-generalize-ty-var.rs
type-namespace.rs
type-param-constraints.rs
type-param.rs
type-params-in-for-each.rs
type-ptr.rs
type-sizes.rs
type-use-i1-versus-i8.rs
typeck_type_placeholder_1.rs
typeck-closure-to-unsafe-fn-ptr.rs Allow closure to unsafe fn coercion 2019-04-01 00:00:43 +09:00
typeck-fn-to-unsafe-fn-ptr.rs
typeclasses-eq-example-static.rs
typeclasses-eq-example.rs
typeid-intrinsic.rs
typestate-cfg-nesting.rs
typestate-multi-decl.rs
ufcs-polymorphic-paths.rs
ufcs-type-params.rs
unary-minus-suffix-inference.rs
underscore-lifetimes.rs
underscore-method-after-integer.rs
unify-return-ty.rs
uninit-empty-types.rs
unit.rs
unnamed_argument_mode.rs
unreachable-code-1.rs
unreachable-code.rs
unsafe-coercion.rs
unsafe-fn-called-from-unsafe-blk.rs
unsafe-fn-called-from-unsafe-fn.rs
unsafe-pointer-assignability.rs
unsized2.rs
unsized3.rs
unsized-tuple-impls.rs
unsized.rs
unused-move-capture.rs
unused-move.rs
unwind-resource.rs
unwind-unique.rs
use_inline_dtor.rs
use-crate-name-alias.rs
use-import-export.rs
use-keyword-2.rs
use-mod.rs
use-nested-groups.rs
use.rs
using-target-feature-unstable.rs
utf8_chars.rs
utf8_idents.rs
utf8-bom.rs
utf8.rs
variadic-ffi.rs
variance-intersection-of-ref-and-opt-ref.rs
variance-iterators-in-libcore.rs
variant-attributes.rs
volatile-fat-ptr.rs
wait-forked-but-failed-child.rs
warn-ctypes-inhibit.rs
weak-lang-item.rs
weak-new-uninhabited-issue-48493.rs
weird-exit-code.rs
weird-exprs.rs match match match match match 2019-03-31 15:20:10 +02:00
wf-bound-region-in-object-type.rs
wrapping-int-api.rs
write-fmt-errors.rs
writealias.rs
wrong-hashset-issue-42918.rs
x86stdcall2.rs
x86stdcall.rs
yield1.rs
yield2.rs
yield.rs
z-crate-attr.rs