Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
d97e8ca3
R
Rust
项目概览
int
/
Rust
接近 1 年 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
Rust
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
d97e8ca3
编写于
6月 15, 2020
作者:
R
Ralf Jung
提交者:
GitHub
6月 15, 2020
浏览文件
操作
浏览文件
下载
差异文件
Rollup merge of #72740 - estebank:recursive-indirection, r=matthewjasper
On recursive ADT, provide indirection structured suggestion
上级
eef9356e
03552ec3
变更
28
隐藏空白更改
内联
并排
Showing
28 changed file
with
202 addition
and
67 deletion
+202
-67
src/librustc_errors/diagnostic.rs
src/librustc_errors/diagnostic.rs
+23
-0
src/librustc_errors/diagnostic_builder.rs
src/librustc_errors/diagnostic_builder.rs
+13
-0
src/librustc_middle/ty/util.rs
src/librustc_middle/ty/util.rs
+9
-1
src/librustc_trait_selection/traits/error_reporting/mod.rs
src/librustc_trait_selection/traits/error_reporting/mod.rs
+31
-14
src/librustc_typeck/check/mod.rs
src/librustc_typeck/check/mod.rs
+1
-5
src/test/ui/infinite/infinite-tag-type-recursion.stderr
src/test/ui/infinite/infinite-tag-type-recursion.stderr
+4
-1
src/test/ui/issues/issue-17431-1.stderr
src/test/ui/issues/issue-17431-1.stderr
+5
-2
src/test/ui/issues/issue-17431-2.stderr
src/test/ui/issues/issue-17431-2.stderr
+10
-4
src/test/ui/issues/issue-17431-3.stderr
src/test/ui/issues/issue-17431-3.stderr
+5
-2
src/test/ui/issues/issue-17431-4.stderr
src/test/ui/issues/issue-17431-4.stderr
+5
-2
src/test/ui/issues/issue-17431-5.stderr
src/test/ui/issues/issue-17431-5.stderr
+5
-2
src/test/ui/issues/issue-17431-6.stderr
src/test/ui/issues/issue-17431-6.stderr
+4
-1
src/test/ui/issues/issue-17431-7.stderr
src/test/ui/issues/issue-17431-7.stderr
+4
-1
src/test/ui/issues/issue-2718-a.stderr
src/test/ui/issues/issue-2718-a.stderr
+4
-1
src/test/ui/issues/issue-3008-1.stderr
src/test/ui/issues/issue-3008-1.stderr
+4
-1
src/test/ui/issues/issue-3008-2.stderr
src/test/ui/issues/issue-3008-2.stderr
+5
-2
src/test/ui/issues/issue-3008-3.stderr
src/test/ui/issues/issue-3008-3.stderr
+4
-1
src/test/ui/issues/issue-32326.stderr
src/test/ui/issues/issue-32326.stderr
+4
-1
src/test/ui/issues/issue-3779.stderr
src/test/ui/issues/issue-3779.stderr
+5
-2
src/test/ui/issues/issue-57271.stderr
src/test/ui/issues/issue-57271.stderr
+8
-2
src/test/ui/issues/issue-72554.stderr
src/test/ui/issues/issue-72554.stderr
+4
-1
src/test/ui/recursion/recursive-enum.stderr
src/test/ui/recursion/recursive-enum.stderr
+4
-1
src/test/ui/sized-cycle-note.stderr
src/test/ui/sized-cycle-note.stderr
+10
-4
src/test/ui/span/E0072.stderr
src/test/ui/span/E0072.stderr
+5
-2
src/test/ui/span/multiline-span-E0072.stderr
src/test/ui/span/multiline-span-E0072.stderr
+5
-2
src/test/ui/span/recursive-type-field.stderr
src/test/ui/span/recursive-type-field.stderr
+11
-8
src/test/ui/type/type-recursive.stderr
src/test/ui/type/type-recursive.stderr
+5
-2
src/test/ui/union/union-nonrepresentable.stderr
src/test/ui/union/union-nonrepresentable.stderr
+5
-2
未找到文件。
src/librustc_errors/diagnostic.rs
浏览文件 @
d97e8ca3
...
...
@@ -296,6 +296,29 @@ pub fn multipart_suggestion(
self
}
pub
fn
multipart_suggestions
(
&
mut
self
,
msg
:
&
str
,
suggestions
:
Vec
<
Vec
<
(
Span
,
String
)
>>
,
applicability
:
Applicability
,
)
->
&
mut
Self
{
self
.suggestions
.push
(
CodeSuggestion
{
substitutions
:
suggestions
.into_iter
()
.map
(|
suggestion
|
Substitution
{
parts
:
suggestion
.into_iter
()
.map
(|(
span
,
snippet
)|
SubstitutionPart
{
snippet
,
span
})
.collect
(),
})
.collect
(),
msg
:
msg
.to_owned
(),
style
:
SuggestionStyle
::
ShowCode
,
applicability
,
});
self
}
/// Prints out a message with for a multipart suggestion without showing the suggested code.
///
/// This is intended to be used for suggestions that are obvious in what the changes need to
...
...
src/librustc_errors/diagnostic_builder.rs
浏览文件 @
d97e8ca3
...
...
@@ -260,6 +260,19 @@ pub fn multipart_suggestion(
self
}
pub
fn
multipart_suggestions
(
&
mut
self
,
msg
:
&
str
,
suggestions
:
Vec
<
Vec
<
(
Span
,
String
)
>>
,
applicability
:
Applicability
,
)
->
&
mut
Self
{
if
!
self
.0
.allow_suggestions
{
return
self
;
}
self
.0
.diagnostic
.multipart_suggestions
(
msg
,
suggestions
,
applicability
);
self
}
pub
fn
tool_only_multipart_suggestion
(
&
mut
self
,
msg
:
&
str
,
...
...
src/librustc_middle/ty/util.rs
浏览文件 @
d97e8ca3
...
...
@@ -878,7 +878,15 @@ fn are_inner_types_recursive<'tcx>(
// Find non representable fields with their spans
fold_repr
(
def
.all_fields
()
.map
(|
field
|
{
let
ty
=
field
.ty
(
tcx
,
substs
);
let
span
=
tcx
.hir
()
.span_if_local
(
field
.did
)
.unwrap_or
(
sp
);
let
span
=
match
field
.did
.as_local
()
.map
(|
id
|
tcx
.hir
()
.as_local_hir_id
(
id
))
.and_then
(|
id
|
tcx
.hir
()
.find
(
id
))
{
Some
(
hir
::
Node
::
Field
(
field
))
=>
field
.ty.span
,
_
=>
sp
,
};
match
is_type_structurally_recursive
(
tcx
,
span
,
...
...
src/librustc_trait_selection/traits/error_reporting/mod.rs
浏览文件 @
d97e8ca3
...
...
@@ -1747,24 +1747,41 @@ fn is_recursive_obligation(
pub
fn
recursive_type_with_infinite_size_error
(
tcx
:
TyCtxt
<
'tcx
>
,
type_def_id
:
DefId
,
)
->
DiagnosticBuilder
<
'tcx
>
{
spans
:
Vec
<
Span
>
,
)
{
assert
!
(
type_def_id
.is_local
());
let
span
=
tcx
.hir
()
.span_if_local
(
type_def_id
)
.unwrap
();
let
span
=
tcx
.sess
.source_map
()
.guess_head_span
(
span
);
let
mut
err
=
struct_span_err!
(
tcx
.sess
,
span
,
E0072
,
"recursive type `{}` has infinite size"
,
tcx
.def_path_str
(
type_def_id
)
);
let
path
=
tcx
.def_path_str
(
type_def_id
);
let
mut
err
=
struct_span_err!
(
tcx
.sess
,
span
,
E0072
,
"recursive type `{}` has infinite size"
,
path
);
err
.span_label
(
span
,
"recursive type has infinite size"
);
err
.help
(
&
format!
(
"insert indirection (e.g., a `Box`, `Rc`, or `&`)
\
at some point to make `{}` representable"
,
tcx
.def_path_str
(
type_def_id
)
));
err
for
&
span
in
&
spans
{
err
.span_label
(
span
,
"recursive without indirection"
);
}
let
msg
=
format!
(
"insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `{}` representable"
,
path
,
);
if
spans
.len
()
<=
4
{
err
.multipart_suggestion
(
&
msg
,
spans
.iter
()
.flat_map
(|
&
span
|
{
vec!
[
(
span
.shrink_to_lo
(),
"Box<"
.to_string
()),
(
span
.shrink_to_hi
(),
">"
.to_string
()),
]
.into_iter
()
})
.collect
(),
Applicability
::
HasPlaceholders
,
);
}
else
{
err
.help
(
&
msg
);
}
err
.emit
();
}
/// Summarizes information
...
...
src/librustc_typeck/check/mod.rs
浏览文件 @
d97e8ca3
...
...
@@ -2387,11 +2387,7 @@ fn check_representable(tcx: TyCtxt<'_>, sp: Span, item_def_id: LocalDefId) -> bo
// caught by case 1.
match
rty
.is_representable
(
tcx
,
sp
)
{
Representability
::
SelfRecursive
(
spans
)
=>
{
let
mut
err
=
recursive_type_with_infinite_size_error
(
tcx
,
item_def_id
.to_def_id
());
for
span
in
spans
{
err
.span_label
(
span
,
"recursive without indirection"
);
}
err
.emit
();
recursive_type_with_infinite_size_error
(
tcx
,
item_def_id
.to_def_id
(),
spans
);
return
false
;
}
Representability
::
Representable
|
Representability
::
ContainsRecursive
=>
(),
...
...
src/test/ui/infinite/infinite-tag-type-recursion.stderr
浏览文件 @
d97e8ca3
...
...
@@ -6,7 +6,10 @@ LL | enum MList { Cons(isize, MList), Nil }
| |
| recursive type has infinite size
|
= help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `MList` representable
help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `MList` representable
|
LL | enum MList { Cons(isize, Box<MList>), Nil }
| ^^^^ ^
error[E0391]: cycle detected when computing drop-check constraints for `MList`
--> $DIR/infinite-tag-type-recursion.rs:1:1
...
...
src/test/ui/issues/issue-17431-1.stderr
浏览文件 @
d97e8ca3
...
...
@@ -2,11 +2,14 @@ error[E0072]: recursive type `Foo` has infinite size
--> $DIR/issue-17431-1.rs:1:1
|
LL | struct Foo { foo: Option<Option<Foo>> }
| ^^^^^^^^^^
-----
------------------- recursive without indirection
| ^^^^^^^^^^
------------------- recursive without indirection
| |
| recursive type has infinite size
|
= help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `Foo` representable
help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `Foo` representable
|
LL | struct Foo { foo: Box<Option<Option<Foo>>> }
| ^^^^ ^
error: aborting due to previous error
...
...
src/test/ui/issues/issue-17431-2.stderr
浏览文件 @
d97e8ca3
...
...
@@ -2,21 +2,27 @@ error[E0072]: recursive type `Baz` has infinite size
--> $DIR/issue-17431-2.rs:1:1
|
LL | struct Baz { q: Option<Foo> }
| ^^^^^^^^^^
---
----------- recursive without indirection
| ^^^^^^^^^^
----------- recursive without indirection
| |
| recursive type has infinite size
|
= help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `Baz` representable
help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `Baz` representable
|
LL | struct Baz { q: Box<Option<Foo>> }
| ^^^^ ^
error[E0072]: recursive type `Foo` has infinite size
--> $DIR/issue-17431-2.rs:4:1
|
LL | struct Foo { q: Option<Baz> }
| ^^^^^^^^^^
---
----------- recursive without indirection
| ^^^^^^^^^^
----------- recursive without indirection
| |
| recursive type has infinite size
|
= help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `Foo` representable
help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `Foo` representable
|
LL | struct Foo { q: Box<Option<Baz>> }
| ^^^^ ^
error: aborting due to 2 previous errors
...
...
src/test/ui/issues/issue-17431-3.stderr
浏览文件 @
d97e8ca3
...
...
@@ -2,11 +2,14 @@ error[E0072]: recursive type `Foo` has infinite size
--> $DIR/issue-17431-3.rs:3:1
|
LL | struct Foo { foo: Mutex<Option<Foo>> }
| ^^^^^^^^^^
-----
------------------ recursive without indirection
| ^^^^^^^^^^
------------------ recursive without indirection
| |
| recursive type has infinite size
|
= help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `Foo` representable
help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `Foo` representable
|
LL | struct Foo { foo: Box<Mutex<Option<Foo>>> }
| ^^^^ ^
error: aborting due to previous error
...
...
src/test/ui/issues/issue-17431-4.stderr
浏览文件 @
d97e8ca3
...
...
@@ -2,11 +2,14 @@ error[E0072]: recursive type `Foo` has infinite size
--> $DIR/issue-17431-4.rs:3:1
|
LL | struct Foo<T> { foo: Option<Option<Foo<T>>>, marker: marker::PhantomData<T> }
| ^^^^^^^^^^^^^
-----
---------------------- recursive without indirection
| ^^^^^^^^^^^^^
---------------------- recursive without indirection
| |
| recursive type has infinite size
|
= help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `Foo` representable
help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `Foo` representable
|
LL | struct Foo<T> { foo: Box<Option<Option<Foo<T>>>>, marker: marker::PhantomData<T> }
| ^^^^ ^
error: aborting due to previous error
...
...
src/test/ui/issues/issue-17431-5.stderr
浏览文件 @
d97e8ca3
...
...
@@ -2,11 +2,14 @@ error[E0072]: recursive type `Bar` has infinite size
--> $DIR/issue-17431-5.rs:5:1
|
LL | struct Bar<T> { x: Bar<Foo> , marker: marker::PhantomData<T> }
| ^^^^^^^^^^^^^
---
-------- recursive without indirection
| ^^^^^^^^^^^^^
-------- recursive without indirection
| |
| recursive type has infinite size
|
= help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `Bar` representable
help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `Bar` representable
|
LL | struct Bar<T> { x: Box<Bar<Foo>> , marker: marker::PhantomData<T> }
| ^^^^ ^
error: aborting due to previous error
...
...
src/test/ui/issues/issue-17431-6.stderr
浏览文件 @
d97e8ca3
...
...
@@ -6,7 +6,10 @@ LL | enum Foo { X(Mutex<Option<Foo>>) }
| |
| recursive type has infinite size
|
= help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `Foo` representable
help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `Foo` representable
|
LL | enum Foo { X(Box<Mutex<Option<Foo>>>) }
| ^^^^ ^
error: aborting due to previous error
...
...
src/test/ui/issues/issue-17431-7.stderr
浏览文件 @
d97e8ca3
...
...
@@ -6,7 +6,10 @@ LL | enum Foo { Voo(Option<Option<Foo>>) }
| |
| recursive type has infinite size
|
= help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `Foo` representable
help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `Foo` representable
|
LL | enum Foo { Voo(Box<Option<Option<Foo>>>) }
| ^^^^ ^
error: aborting due to previous error
...
...
src/test/ui/issues/issue-2718-a.stderr
浏览文件 @
d97e8ca3
...
...
@@ -7,7 +7,10 @@ LL | pub struct Pong(SendPacket<Ping>);
| | recursive without indirection
| recursive type has infinite size
|
= help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `pingpong::Pong` representable
help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `pingpong::Pong` representable
|
LL | pub struct Pong(Box<SendPacket<Ping>>);
| ^^^^ ^
error: aborting due to previous error
...
...
src/test/ui/issues/issue-3008-1.stderr
浏览文件 @
d97e8ca3
...
...
@@ -7,7 +7,10 @@ LL | enum Bar {
LL | BarSome(Bar)
| --- recursive without indirection
|
= help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `Bar` representable
help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `Bar` representable
|
LL | BarSome(Box<Bar>)
| ^^^^ ^
error: aborting due to previous error
...
...
src/test/ui/issues/issue-3008-2.stderr
浏览文件 @
d97e8ca3
...
...
@@ -2,11 +2,14 @@ error[E0072]: recursive type `Bar` has infinite size
--> $DIR/issue-3008-2.rs:2:1
|
LL | struct Bar { x: Bar }
| ^^^^^^^^^^
---
--- recursive without indirection
| ^^^^^^^^^^
--- recursive without indirection
| |
| recursive type has infinite size
|
= help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `Bar` representable
help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `Bar` representable
|
LL | struct Bar { x: Box<Bar> }
| ^^^^ ^
error: aborting due to previous error
...
...
src/test/ui/issues/issue-3008-3.stderr
浏览文件 @
d97e8ca3
...
...
@@ -6,7 +6,10 @@ LL | enum E2<T> { V2(E2<E1>, marker::PhantomData<T>), }
| |
| recursive type has infinite size
|
= help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `E2` representable
help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `E2` representable
|
LL | enum E2<T> { V2(Box<E2<E1>>, marker::PhantomData<T>), }
| ^^^^ ^
error: aborting due to previous error
...
...
src/test/ui/issues/issue-32326.stderr
浏览文件 @
d97e8ca3
...
...
@@ -8,7 +8,10 @@ LL | Plus(Expr, Expr),
| |
| recursive without indirection
|
= help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `Expr` representable
help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `Expr` representable
|
LL | Plus(Box<Expr>, Box<Expr>),
| ^^^^ ^ ^^^^ ^
error: aborting due to previous error
...
...
src/test/ui/issues/issue-3779.stderr
浏览文件 @
d97e8ca3
...
...
@@ -5,9 +5,12 @@ LL | struct S {
| ^^^^^^^^ recursive type has infinite size
LL |
LL | element: Option<S>
|
---------
--------- recursive without indirection
|
--------- recursive without indirection
|
= help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `S` representable
help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `S` representable
|
LL | element: Box<Option<S>>
| ^^^^ ^
error: aborting due to previous error
...
...
src/test/ui/issues/issue-57271.stderr
浏览文件 @
d97e8ca3
...
...
@@ -7,7 +7,10 @@ LL | Class(ClassTypeSignature),
LL | Array(TypeSignature),
| ------------- recursive without indirection
|
= help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `ObjectType` representable
help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `ObjectType` representable
|
LL | Array(Box<TypeSignature>),
| ^^^^ ^
error[E0072]: recursive type `TypeSignature` has infinite size
--> $DIR/issue-57271.rs:19:1
...
...
@@ -18,7 +21,10 @@ LL | Base(BaseType),
LL | Object(ObjectType),
| ---------- recursive without indirection
|
= help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `TypeSignature` representable
help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `TypeSignature` representable
|
LL | Object(Box<ObjectType>),
| ^^^^ ^
error: aborting due to 2 previous errors
...
...
src/test/ui/issues/issue-72554.stderr
浏览文件 @
d97e8ca3
...
...
@@ -6,7 +6,10 @@ LL | pub enum ElemDerived {
LL | A(ElemDerived)
| ----------- recursive without indirection
|
= help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `ElemDerived` representable
help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `ElemDerived` representable
|
LL | A(Box<ElemDerived>)
| ^^^^ ^
error: aborting due to previous error
...
...
src/test/ui/recursion/recursive-enum.stderr
浏览文件 @
d97e8ca3
...
...
@@ -6,7 +6,10 @@ LL | enum List<T> { Cons(T, List<T>), Nil }
| |
| recursive type has infinite size
|
= help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `List` representable
help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `List` representable
|
LL | enum List<T> { Cons(T, Box<List<T>>), Nil }
| ^^^^ ^
error: aborting due to previous error
...
...
src/test/ui/sized-cycle-note.stderr
浏览文件 @
d97e8ca3
...
...
@@ -2,21 +2,27 @@ error[E0072]: recursive type `Baz` has infinite size
--> $DIR/sized-cycle-note.rs:9:1
|
LL | struct Baz { q: Option<Foo> }
| ^^^^^^^^^^
---
----------- recursive without indirection
| ^^^^^^^^^^
----------- recursive without indirection
| |
| recursive type has infinite size
|
= help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `Baz` representable
help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `Baz` representable
|
LL | struct Baz { q: Box<Option<Foo>> }
| ^^^^ ^
error[E0072]: recursive type `Foo` has infinite size
--> $DIR/sized-cycle-note.rs:11:1
|
LL | struct Foo { q: Option<Baz> }
| ^^^^^^^^^^
---
----------- recursive without indirection
| ^^^^^^^^^^
----------- recursive without indirection
| |
| recursive type has infinite size
|
= help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `Foo` representable
help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `Foo` representable
|
LL | struct Foo { q: Box<Option<Baz>> }
| ^^^^ ^
error: aborting due to 2 previous errors
...
...
src/test/ui/span/E0072.stderr
浏览文件 @
d97e8ca3
...
...
@@ -5,9 +5,12 @@ LL | struct ListNode {
| ^^^^^^^^^^^^^^^ recursive type has infinite size
LL | head: u8,
LL | tail: Option<ListNode>,
|
------
---------------- recursive without indirection
|
---------------- recursive without indirection
|
= help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `ListNode` representable
help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `ListNode` representable
|
LL | tail: Box<Option<ListNode>>,
| ^^^^ ^
error: aborting due to previous error
...
...
src/test/ui/span/multiline-span-E0072.stderr
浏览文件 @
d97e8ca3
...
...
@@ -6,11 +6,14 @@ LL | | ListNode
LL | | {
LL | | head: u8,
LL | | tail: Option<ListNode>,
| |
------
---------------- recursive without indirection
| |
---------------- recursive without indirection
LL | | }
| |_^ recursive type has infinite size
|
= help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `ListNode` representable
help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `ListNode` representable
|
LL | tail: Box<Option<ListNode>>,
| ^^^^ ^
error: aborting due to previous error
...
...
src/test/ui/span/recursive-type-field.stderr
浏览文件 @
d97e8ca3
...
...
@@ -4,9 +4,12 @@ error[E0072]: recursive type `Foo` has infinite size
LL | struct Foo<'a> {
| ^^^^^^^^^^^^^^ recursive type has infinite size
LL | bar: Bar<'a>,
|
-----
------- recursive without indirection
|
------- recursive without indirection
|
= help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `Foo` representable
help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `Foo` representable
|
LL | bar: Box<Bar<'a>>,
| ^^^^ ^
error[E0072]: recursive type `Bar` has infinite size
--> $DIR/recursive-type-field.rs:8:1
...
...
@@ -14,18 +17,18 @@ error[E0072]: recursive type `Bar` has infinite size
LL | struct Bar<'a> {
| ^^^^^^^^^^^^^^ recursive type has infinite size
LL | y: (Foo<'a>, Foo<'a>),
|
---
------------------ recursive without indirection
|
------------------ recursive without indirection
LL | z: Option<Bar<'a>>,
|
---
--------------- recursive without indirection
|
--------------- recursive without indirection
...
LL | d: [Bar<'a>; 1],
|
---
------------ recursive without indirection
|
------------ recursive without indirection
LL | e: Foo<'a>,
|
---
------- recursive without indirection
|
------- recursive without indirection
LL | x: Bar<'a>,
|
---
------- recursive without indirection
|
------- recursive without indirection
|
= help: insert
indirection (e.g., a `Box`, `Rc`, or `&`) at some point
to make `Bar` representable
= help: insert
some indirection (e.g., a `Box`, `Rc`, or `&`)
to make `Bar` representable
error: aborting due to 2 previous errors
...
...
src/test/ui/type/type-recursive.stderr
浏览文件 @
d97e8ca3
...
...
@@ -5,9 +5,12 @@ LL | struct T1 {
| ^^^^^^^^^ recursive type has infinite size
LL | foo: isize,
LL | foolish: T1
|
---------
-- recursive without indirection
|
-- recursive without indirection
|
= help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `T1` representable
help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `T1` representable
|
LL | foolish: Box<T1>
| ^^^^ ^
error: aborting due to previous error
...
...
src/test/ui/union/union-nonrepresentable.stderr
浏览文件 @
d97e8ca3
...
...
@@ -5,9 +5,12 @@ LL | union U {
| ^^^^^^^ recursive type has infinite size
LL | a: u8,
LL | b: U,
|
---
- recursive without indirection
|
- recursive without indirection
|
= help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `U` representable
help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to make `U` representable
|
LL | b: Box<U>,
| ^^^^ ^
error: aborting due to previous error
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录