Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
1c35634e
R
Rust
项目概览
int
/
Rust
12 个月 前同步成功
通知
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,发现更多精彩内容 >>
提交
1c35634e
编写于
7月 31, 2023
作者:
M
Michael Goulet
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Suppress unnecessary outlives
上级
9295817b
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
11 addition
and
22 deletion
+11
-22
compiler/rustc_hir_analysis/src/check/wfcheck.rs
compiler/rustc_hir_analysis/src/check/wfcheck.rs
+5
-4
compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs
compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs
+4
-0
tests/ui/impl-trait/in-trait/missing-lt-outlives-in-rpitit-114274.rs
...pl-trait/in-trait/missing-lt-outlives-in-rpitit-114274.rs
+0
-1
tests/ui/impl-trait/in-trait/missing-lt-outlives-in-rpitit-114274.stderr
...rait/in-trait/missing-lt-outlives-in-rpitit-114274.stderr
+2
-17
未找到文件。
compiler/rustc_hir_analysis/src/check/wfcheck.rs
浏览文件 @
1c35634e
...
...
@@ -552,8 +552,8 @@ fn gather_gat_bounds<'tcx, T: TypeFoldable<TyCtxt<'tcx>>>(
for
(
region_a
,
region_a_idx
)
in
&
regions
{
// Ignore `'static` lifetimes for the purpose of this lint: it's
// because we know it outlives everything and so doesn't give meaningful
// clues
if
let
ty
::
ReStatic
=
**
region_a
{
// clues
. Also ignore `ReError`, to avoid knock-down errors.
if
let
ty
::
ReStatic
|
ty
::
ReError
(
_
)
=
**
region_a
{
continue
;
}
// For each region argument (e.g., `'a` in our example), check for a
...
...
@@ -596,8 +596,9 @@ fn gather_gat_bounds<'tcx, T: TypeFoldable<TyCtxt<'tcx>>>(
// on the GAT itself.
for
(
region_b
,
region_b_idx
)
in
&
regions
{
// Again, skip `'static` because it outlives everything. Also, we trivially
// know that a region outlives itself.
if
ty
::
ReStatic
==
**
region_b
||
region_a
==
region_b
{
// know that a region outlives itself. Also ignore `ReError`, to avoid
// knock-down errors.
if
matches!
(
**
region_b
,
ty
::
ReStatic
|
ty
::
ReError
(
_
))
||
region_a
==
region_b
{
continue
;
}
if
region_known_to_outlive
(
...
...
compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs
浏览文件 @
1c35634e
...
...
@@ -942,6 +942,10 @@ fn bound_is_met(
generic_ty
:
Ty
<
'tcx
>
,
min
:
ty
::
Region
<
'tcx
>
,
)
->
bool
{
if
let
ty
::
ReError
(
_
)
=
*
min
{
return
true
;
}
match
bound
{
VerifyBound
::
IfEq
(
verify_if_eq_b
)
=>
{
let
verify_if_eq_b
=
var_values
.normalize
(
self
.region_rels.tcx
,
*
verify_if_eq_b
);
...
...
tests/ui/impl-trait/in-trait/missing-lt-outlives-in-rpitit-114274.rs
浏览文件 @
1c35634e
...
...
@@ -7,7 +7,6 @@ trait Iterable {
fn
iter
(
&
self
)
->
impl
Iterator
<
Item
=
Self
::
Item
<
'missing
>>
;
//~^ ERROR use of undeclared lifetime name `'missing`
//~| ERROR the parameter type `Self` may not live long enough
}
fn
main
()
{}
tests/ui/impl-trait/in-trait/missing-lt-outlives-in-rpitit-114274.stderr
浏览文件 @
1c35634e
...
...
@@ -18,21 +18,6 @@ help: consider introducing lifetime `'missing` here
LL | trait Iterable<'missing> {
| ++++++++++
error[E0311]: the parameter type `Self` may not live long enough
--> $DIR/missing-lt-outlives-in-rpitit-114274.rs:8:37
|
LL | fn iter(&self) -> impl Iterator<Item = Self::Item<'missing>>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: consider adding an explicit lifetime bound `Self: 'a`...
= note: ...so that the type `Self` will meet its required lifetime bounds...
note: ...that is required by this bound
--> $DIR/missing-lt-outlives-in-rpitit-114274.rs:6:15
|
LL | Self: 'a;
| ^^
error: aborting due to 2 previous errors
error: aborting due to previous error
Some errors have detailed explanations: E0261, E0311.
For more information about an error, try `rustc --explain E0261`.
For more information about this error, try `rustc --explain E0261`.
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录