Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
13a05a27
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,发现更多精彩内容 >>
提交
13a05a27
编写于
4月 11, 2019
作者:
E
Esteban Küber
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Continue evaluating after missing main
上级
96d700f1
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
55 addition
and
3 deletion
+55
-3
src/librustc/middle/entry.rs
src/librustc/middle/entry.rs
+0
-1
src/librustc_interface/passes.rs
src/librustc_interface/passes.rs
+6
-2
src/test/ui/continue-after-missing-main.rs
src/test/ui/continue-after-missing-main.rs
+32
-0
src/test/ui/continue-after-missing-main.stderr
src/test/ui/continue-after-missing-main.stderr
+17
-0
未找到文件。
src/librustc/middle/entry.rs
浏览文件 @
13a05a27
...
...
@@ -163,7 +163,6 @@ fn configure_main(
err
.span_note
(
span
,
"here is a function named 'main'"
);
}
err
.emit
();
tcx
.sess
.abort_if_errors
();
}
else
{
if
let
Some
(
ref
filename
)
=
tcx
.sess.local_crate_source_file
{
err
.note
(
&
format!
(
"consider adding a `main` function to `{}`"
,
filename
.display
()));
...
...
src/librustc_interface/passes.rs
浏览文件 @
13a05a27
...
...
@@ -888,10 +888,11 @@ fn analysis<'tcx>(
assert_eq!
(
cnum
,
LOCAL_CRATE
);
let
sess
=
tcx
.sess
;
let
mut
entry_point
=
None
;
time
(
sess
,
"misc checking 1"
,
||
{
parallel!
({
time
(
sess
,
"looking for entry point"
,
||
{
entry_point
=
time
(
sess
,
"looking for entry point"
,
||
{
middle
::
entry
::
find_entry_point
(
tcx
)
});
...
...
@@ -939,7 +940,10 @@ fn analysis<'tcx>(
// Abort so we don't try to construct MIR with liveness errors.
// We also won't want to continue with errors from rvalue promotion
tcx
.sess
.abort_if_errors
();
// We only do so if the only error found so far *isn't* a missing `fn main()`
if
!
(
entry_point
.is_none
()
&&
sess
.err_count
()
==
1
)
{
tcx
.sess
.abort_if_errors
();
}
time
(
sess
,
"borrow checking"
,
||
{
if
tcx
.use_ast_borrowck
()
{
...
...
src/test/ui/continue-after-missing-main.rs
0 → 100644
浏览文件 @
13a05a27
#![allow(dead_code)]
// error-pattern:`main` function not found in crate
struct
Tableau
<
'a
,
MP
>
{
provider
:
&
'a
MP
,
}
impl
<
'adapted_matrix_provider
,
'original_data
,
MP
>
Tableau
<
'adapted_matrix_provider
,
AdaptedMatrixProvider
<
'original_data
,
MP
>>
{
fn
provider
(
&
self
)
->
&
'adapted_matrix_provider
AdaptedMatrixProvider
<
/*'original_data,*/
MP
>
{
self
.provider
}
}
struct
AdaptedMatrixProvider
<
'a
,
T
>
{
original_problem
:
&
'a
T
,
}
impl
<
'a
,
T
>
AdaptedMatrixProvider
<
'a
,
T
>
{
fn
clone_with_extra_bound
(
&
self
)
->
Self
{
AdaptedMatrixProvider
{
original_problem
:
self
.original_problem
}
}
}
fn
create_and_solve_subproblems
<
'data_provider
,
'original_data
,
MP
>
(
tableau
:
Tableau
<
'data_provider
,
AdaptedMatrixProvider
<
'original_data
,
MP
>>
,
)
{
let
_
:
AdaptedMatrixProvider
<
'original_data
,
MP
>
=
tableau
.provider
()
.clone_with_extra_bound
();
//~^ ERROR lifetime mismatch
}
src/test/ui/continue-after-missing-main.stderr
0 → 100644
浏览文件 @
13a05a27
error[E0601]: `main` function not found in crate `continue_after_missing_main`
|
= note: consider adding a `main` function to `$DIR/continue-after-missing-main.rs`
error[E0623]: lifetime mismatch
--> $DIR/continue-after-missing-main.rs:30:56
|
LL | tableau: Tableau<'data_provider, AdaptedMatrixProvider<'original_data, MP>>,
| ------------------------------------------------------------------ these two types are declared with different lifetimes...
LL | ) {
LL | let _: AdaptedMatrixProvider<'original_data, MP> = tableau.provider().clone_with_extra_bound();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...but data from `tableau` flows into `tableau` here
error: aborting due to 2 previous errors
Some errors occurred: E0601, E0623.
For more information about an error, try `rustc --explain E0601`.
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录