Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
ef2da4a4
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,发现更多精彩内容 >>
提交
ef2da4a4
编写于
8月 13, 2023
作者:
B
bjorn3
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove reached_eof from ParseSess
It was only ever set in a function which isn't called anywhere.
上级
5f3abbc5
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
1 addition
and
24 deletion
+1
-24
compiler/rustc_parse/src/lexer/mod.rs
compiler/rustc_parse/src/lexer/mod.rs
+0
-1
compiler/rustc_parse/src/parser/mod.rs
compiler/rustc_parse/src/parser/mod.rs
+0
-13
compiler/rustc_passes/src/entry.rs
compiler/rustc_passes/src/entry.rs
+0
-6
compiler/rustc_session/src/parse.rs
compiler/rustc_session/src/parse.rs
+1
-4
未找到文件。
compiler/rustc_parse/src/lexer/mod.rs
浏览文件 @
ef2da4a4
...
@@ -74,7 +74,6 @@ pub(crate) fn parse_token_trees<'a>(
...
@@ -74,7 +74,6 @@ pub(crate) fn parse_token_trees<'a>(
// because the delimiter mismatch is more likely to be the root cause of error
// because the delimiter mismatch is more likely to be the root cause of error
let
mut
buffer
=
Vec
::
with_capacity
(
1
);
let
mut
buffer
=
Vec
::
with_capacity
(
1
);
// Not using `emit_unclosed_delims` to use `db.buffer`
for
unmatched
in
unmatched_delims
{
for
unmatched
in
unmatched_delims
{
if
let
Some
(
err
)
=
make_unclosed_delims_error
(
unmatched
,
&
sess
)
{
if
let
Some
(
err
)
=
make_unclosed_delims_error
(
unmatched
,
&
sess
)
{
err
.buffer
(
&
mut
buffer
);
err
.buffer
(
&
mut
buffer
);
...
...
compiler/rustc_parse/src/parser/mod.rs
浏览文件 @
ef2da4a4
...
@@ -29,7 +29,6 @@
...
@@ -29,7 +29,6 @@
use
rustc_ast
::{
HasAttrs
,
HasTokens
,
Unsafe
,
Visibility
,
VisibilityKind
};
use
rustc_ast
::{
HasAttrs
,
HasTokens
,
Unsafe
,
Visibility
,
VisibilityKind
};
use
rustc_ast_pretty
::
pprust
;
use
rustc_ast_pretty
::
pprust
;
use
rustc_data_structures
::
fx
::
FxHashMap
;
use
rustc_data_structures
::
fx
::
FxHashMap
;
use
rustc_data_structures
::
sync
::
Ordering
;
use
rustc_errors
::
PResult
;
use
rustc_errors
::
PResult
;
use
rustc_errors
::{
use
rustc_errors
::{
Applicability
,
DiagnosticBuilder
,
ErrorGuaranteed
,
FatalError
,
IntoDiagnostic
,
MultiSpan
,
Applicability
,
DiagnosticBuilder
,
ErrorGuaranteed
,
FatalError
,
IntoDiagnostic
,
MultiSpan
,
...
@@ -1455,18 +1454,6 @@ pub(crate) fn make_unclosed_delims_error(
...
@@ -1455,18 +1454,6 @@ pub(crate) fn make_unclosed_delims_error(
Some
(
err
)
Some
(
err
)
}
}
pub
fn
emit_unclosed_delims
(
unclosed_delims
:
&
mut
Vec
<
UnmatchedDelim
>
,
sess
:
&
ParseSess
)
{
let
_
=
sess
.reached_eof
.fetch_or
(
unclosed_delims
.iter
()
.any
(|
unmatched_delim
|
unmatched_delim
.found_delim
.is_none
()),
Ordering
::
Relaxed
,
);
for
unmatched
in
unclosed_delims
.drain
(
..
)
{
if
let
Some
(
mut
e
)
=
make_unclosed_delims_error
(
unmatched
,
sess
)
{
e
.emit
();
}
}
}
/// A helper struct used when building an `AttrTokenStream` from
/// A helper struct used when building an `AttrTokenStream` from
/// a `LazyAttrTokenStream`. Both delimiter and non-delimited tokens
/// a `LazyAttrTokenStream`. Both delimiter and non-delimited tokens
/// are stored as `FlatToken::Token`. A vector of `FlatToken`s
/// are stored as `FlatToken::Token`. A vector of `FlatToken`s
...
...
compiler/rustc_passes/src/entry.rs
浏览文件 @
ef2da4a4
...
@@ -187,12 +187,6 @@ fn sigpipe(tcx: TyCtxt<'_>, def_id: DefId) -> u8 {
...
@@ -187,12 +187,6 @@ fn sigpipe(tcx: TyCtxt<'_>, def_id: DefId) -> u8 {
fn
no_main_err
(
tcx
:
TyCtxt
<
'_
>
,
visitor
:
&
EntryContext
<
'_
>
)
{
fn
no_main_err
(
tcx
:
TyCtxt
<
'_
>
,
visitor
:
&
EntryContext
<
'_
>
)
{
let
sp
=
tcx
.def_span
(
CRATE_DEF_ID
);
let
sp
=
tcx
.def_span
(
CRATE_DEF_ID
);
if
tcx
.sess.parse_sess.reached_eof
.load
(
rustc_data_structures
::
sync
::
Ordering
::
Relaxed
)
{
// There's an unclosed brace that made the parser reach `Eof`, we shouldn't complain about
// the missing `fn main()` then as it might have been hidden inside an unclosed block.
tcx
.sess
.delay_span_bug
(
sp
,
"`main` not found, but expected unclosed brace error"
);
return
;
}
// There is no main function.
// There is no main function.
let
mut
has_filename
=
true
;
let
mut
has_filename
=
true
;
...
...
compiler/rustc_session/src/parse.rs
浏览文件 @
ef2da4a4
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
};
};
use
rustc_ast
::
node_id
::
NodeId
;
use
rustc_ast
::
node_id
::
NodeId
;
use
rustc_data_structures
::
fx
::{
FxHashMap
,
FxHashSet
,
FxIndexSet
};
use
rustc_data_structures
::
fx
::{
FxHashMap
,
FxHashSet
,
FxIndexSet
};
use
rustc_data_structures
::
sync
::{
AppendOnlyVec
,
AtomicBool
,
Lock
,
Lrc
};
use
rustc_data_structures
::
sync
::{
AppendOnlyVec
,
Lock
,
Lrc
};
use
rustc_errors
::{
emitter
::
SilentEmitter
,
Handler
};
use
rustc_errors
::{
emitter
::
SilentEmitter
,
Handler
};
use
rustc_errors
::{
use
rustc_errors
::{
fallback_fluent_bundle
,
Diagnostic
,
DiagnosticBuilder
,
DiagnosticId
,
DiagnosticMessage
,
fallback_fluent_bundle
,
Diagnostic
,
DiagnosticBuilder
,
DiagnosticId
,
DiagnosticMessage
,
...
@@ -204,8 +204,6 @@ pub struct ParseSess {
...
@@ -204,8 +204,6 @@ pub struct ParseSess {
pub
ambiguous_block_expr_parse
:
Lock
<
FxHashMap
<
Span
,
Span
>>
,
pub
ambiguous_block_expr_parse
:
Lock
<
FxHashMap
<
Span
,
Span
>>
,
pub
gated_spans
:
GatedSpans
,
pub
gated_spans
:
GatedSpans
,
pub
symbol_gallery
:
SymbolGallery
,
pub
symbol_gallery
:
SymbolGallery
,
/// The parser has reached `Eof` due to an unclosed brace. Used to silence unnecessary errors.
pub
reached_eof
:
AtomicBool
,
/// Environment variables accessed during the build and their values when they exist.
/// Environment variables accessed during the build and their values when they exist.
pub
env_depinfo
:
Lock
<
FxHashSet
<
(
Symbol
,
Option
<
Symbol
>
)
>>
,
pub
env_depinfo
:
Lock
<
FxHashSet
<
(
Symbol
,
Option
<
Symbol
>
)
>>
,
/// File paths accessed during the build.
/// File paths accessed during the build.
...
@@ -242,7 +240,6 @@ pub fn with_span_handler(handler: Handler, source_map: Lrc<SourceMap>) -> Self {
...
@@ -242,7 +240,6 @@ pub fn with_span_handler(handler: Handler, source_map: Lrc<SourceMap>) -> Self {
ambiguous_block_expr_parse
:
Lock
::
new
(
FxHashMap
::
default
()),
ambiguous_block_expr_parse
:
Lock
::
new
(
FxHashMap
::
default
()),
gated_spans
:
GatedSpans
::
default
(),
gated_spans
:
GatedSpans
::
default
(),
symbol_gallery
:
SymbolGallery
::
default
(),
symbol_gallery
:
SymbolGallery
::
default
(),
reached_eof
:
AtomicBool
::
new
(
false
),
env_depinfo
:
Default
::
default
(),
env_depinfo
:
Default
::
default
(),
file_depinfo
:
Default
::
default
(),
file_depinfo
:
Default
::
default
(),
assume_incomplete_release
:
false
,
assume_incomplete_release
:
false
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录