Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
8bb7dba9
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,发现更多精彩内容 >>
未验证
提交
8bb7dba9
编写于
9月 02, 2017
作者:
B
bjorn3
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Dont abort on first macro error
上级
878013cd
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
139 addition
and
1 deletion
+139
-1
src/libsyntax/ext/tt/macro_rules.rs
src/libsyntax/ext/tt/macro_rules.rs
+3
-1
src/test/ui/macros/assert_eq_trailing_comma.stderr
src/test/ui/macros/assert_eq_trailing_comma.stderr
+2
-0
src/test/ui/macros/assert_ne_trailing_comma.stderr
src/test/ui/macros/assert_ne_trailing_comma.stderr
+2
-0
src/test/ui/macros/trace_faulty_macros.rs
src/test/ui/macros/trace_faulty_macros.rs
+55
-0
src/test/ui/macros/trace_faulty_macros.stderr
src/test/ui/macros/trace_faulty_macros.stderr
+77
-0
未找到文件。
src/libsyntax/ext/tt/macro_rules.rs
浏览文件 @
8bb7dba9
...
...
@@ -172,7 +172,9 @@ fn generic_extension<'cx>(cx: &'cx mut ExtCtxt,
}
let
best_fail_msg
=
parse_failure_msg
(
best_fail_tok
.expect
(
"ran no matchers"
));
cx
.span_fatal
(
best_fail_spot
.substitute_dummy
(
sp
),
&
best_fail_msg
);
cx
.span_err
(
best_fail_spot
.substitute_dummy
(
sp
),
&
best_fail_msg
);
cx
.trace_macros_diag
();
DummyResult
::
any
(
sp
)
}
// Note that macro-by-example's input is also matched against a token tree:
...
...
src/test/ui/macros/assert_eq_trailing_comma.stderr
浏览文件 @
8bb7dba9
...
...
@@ -4,3 +4,5 @@ error: unexpected end of macro invocation
12 | assert_eq!(1, 1,);
| ^
error: aborting due to previous error
src/test/ui/macros/assert_ne_trailing_comma.stderr
浏览文件 @
8bb7dba9
...
...
@@ -4,3 +4,5 @@ error: unexpected end of macro invocation
12 | assert_ne!(1, 2,);
| ^
error: aborting due to previous error
src/test/ui/macros/trace_faulty_macros.rs
0 → 100644
浏览文件 @
8bb7dba9
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// compile-flags: -Z trace-macros
#![recursion_limit=
"4"
]
macro_rules!
my_faulty_macro
{
()
=>
{
my_faulty_macro!
(
bcd
);
};
}
macro_rules!
nested_pat_macro
{
()
=>
{
nested_pat_macro!
(
inner
);
};
(
inner
)
=>
{
a
|
b
|
1
...
3
|
_
}
}
macro_rules!
my_recursive_macro
{
()
=>
{
my_recursive_macro!
();
};
}
macro_rules!
my_macro
{
()
=>
{
};
}
fn
main
()
{
my_faulty_macro!
();
nested_pat_macro!
();
my_recursive_macro!
();
test!
();
non_exisiting!
();
derive!
(
Debug
);
}
#[my_macro]
fn
use_bang_macro_as_attr
(){}
#[derive(Debug)]
fn
use_derive_macro_as_attr
(){}
src/test/ui/macros/trace_faulty_macros.stderr
0 → 100644
浏览文件 @
8bb7dba9
error: no rules expected the token `bcd`
--> $DIR/trace_faulty_macros.rs:17:26
|
17 | my_faulty_macro!(bcd);
| ^^^
...
43 | my_faulty_macro!();
| ------------------- in this macro invocation
note: trace_macro
--> $DIR/trace_faulty_macros.rs:43:5
|
43 | my_faulty_macro!();
| ^^^^^^^^^^^^^^^^^^^
|
= note: expanding `my_faulty_macro! { }`
= note: to `my_faulty_macro ! ( bcd ) ;`
= note: expanding `my_faulty_macro! { bcd }`
error: expected expression, found `_`
--> $DIR/trace_faulty_macros.rs:26:27
|
26 | a | b | 1 ... 3 | _
| ^
...
44 | nested_pat_macro!();
| -------------------- in this macro invocation
error: recursion limit reached while expanding the macro `my_recursive_macro`
--> $DIR/trace_faulty_macros.rs:32:9
|
32 | my_recursive_macro!();
| ^^^^^^^^^^^^^^^^^^^^^^
...
45 | my_recursive_macro!();
| ---------------------- in this macro invocation
|
= help: consider adding a `#![recursion_limit="8"]` attribute to your crate
note: trace_macro
--> $DIR/trace_faulty_macros.rs:45:5
|
45 | my_recursive_macro!();
| ^^^^^^^^^^^^^^^^^^^^^^
|
= note: expanding `my_recursive_macro! { }`
= note: to `my_recursive_macro ! ( ) ;`
= note: expanding `my_recursive_macro! { }`
= note: to `my_recursive_macro ! ( ) ;`
= note: expanding `my_recursive_macro! { }`
= note: to `my_recursive_macro ! ( ) ;`
= note: expanding `my_recursive_macro! { }`
= note: to `my_recursive_macro ! ( ) ;`
= note: expanding `my_recursive_macro! { }`
= note: to `my_recursive_macro ! ( ) ;`
note: trace_macro
--> $DIR/trace_faulty_macros.rs:43:5
|
43 | my_faulty_macro!();
| ^^^^^^^^^^^^^^^^^^^
|
= note: expanding `my_faulty_macro! { }`
= note: to `my_faulty_macro ! ( bcd ) ;`
= note: expanding `my_faulty_macro! { bcd }`
note: trace_macro
--> $DIR/trace_faulty_macros.rs:44:5
|
44 | nested_pat_macro!();
| ^^^^^^^^^^^^^^^^^^^^
|
= note: expanding `nested_pat_macro! { }`
= note: to `nested_pat_macro ! ( inner ) ;`
= note: expanding `nested_pat_macro! { inner }`
= note: to `a | b | 1 ... 3 | _`
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录