From e9b0ce8afa5635d3825b5e76e0b3593d9086778a Mon Sep 17 00:00:00 2001 From: Aaron Hill Date: Sat, 13 Jun 2020 20:19:52 -0400 Subject: [PATCH] Add test for overflow when finding auto-trait impls in Rustdoc --- src/test/rustdoc/synthetic_auto/overflow.rs | 35 +++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 src/test/rustdoc/synthetic_auto/overflow.rs diff --git a/src/test/rustdoc/synthetic_auto/overflow.rs b/src/test/rustdoc/synthetic_auto/overflow.rs new file mode 100644 index 0000000000000..546b3e07793e1 --- /dev/null +++ b/src/test/rustdoc/synthetic_auto/overflow.rs @@ -0,0 +1,35 @@ +// Tests that we don't fail with an overflow error for certain +// strange types +// See https://github.com/rust-lang/rust/pull/72936#issuecomment-643676915 + +pub trait Interner { + type InternedType; +} + +struct RustInterner<'tcx> { + foo: &'tcx () +} + +impl<'tcx> Interner for RustInterner<'tcx> { + type InternedType = Box>; +} + +enum TyData { + FnDef(I::InternedType) +} + +struct VariableKind(I::InternedType); + +// @has overflow/struct.BoundVarsCollector.html +// @has - '//code' "impl<'tcx> Send for BoundVarsCollector<'tcx>" +pub struct BoundVarsCollector<'tcx> { + val: VariableKind> +} + +fn is_send() {} + +struct MyInterner<'tcx> { + val: &'tcx () +} + +fn main() {}