Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
1ab45ec7
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,发现更多精彩内容 >>
提交
1ab45ec7
编写于
10月 24, 2018
作者:
E
Esteban Küber
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Point to macro def span instead of whole body
上级
8227a938
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
107 addition
and
179 deletion
+107
-179
src/libsyntax/ext/tt/macro_rules.rs
src/libsyntax/ext/tt/macro_rules.rs
+1
-1
src/test/ui/empty/empty-comment.stderr
src/test/ui/empty/empty-comment.stderr
+4
-6
src/test/ui/issues/issue-7970a.stderr
src/test/ui/issues/issue-7970a.stderr
+4
-6
src/test/ui/macros/macro-at-most-once-rep-2018-feature-gate.stderr
...ui/macros/macro-at-most-once-rep-2018-feature-gate.stderr
+12
-24
src/test/ui/macros/macro-at-most-once-rep-2018.stderr
src/test/ui/macros/macro-at-most-once-rep-2018.stderr
+44
-66
src/test/ui/macros/macro-non-lifetime.stderr
src/test/ui/macros/macro-non-lifetime.stderr
+1
-1
src/test/ui/macros/missing-comma.stderr
src/test/ui/macros/missing-comma.stderr
+22
-46
src/test/ui/macros/trace_faulty_macros.stderr
src/test/ui/macros/trace_faulty_macros.stderr
+7
-9
src/test/ui/parser/macro/macro-doc-comments-1.stderr
src/test/ui/parser/macro/macro-doc-comments-1.stderr
+4
-6
src/test/ui/parser/macro/macro-doc-comments-2.stderr
src/test/ui/parser/macro/macro-doc-comments-2.stderr
+4
-6
src/test/ui/underscore-ident-matcher.stderr
src/test/ui/underscore-ident-matcher.stderr
+4
-8
未找到文件。
src/libsyntax/ext/tt/macro_rules.rs
浏览文件 @
1ab45ec7
...
...
@@ -187,7 +187,7 @@ fn generic_extension<'cx>(cx: &'cx mut ExtCtxt,
err
.span_label
(
span
,
best_fail_msg
);
if
let
Some
(
sp
)
=
def_span
{
if
cx
.source_map
()
.span_to_filename
(
sp
)
.is_real
()
&&
!
sp
.is_dummy
()
{
err
.span_label
(
sp
,
"when calling this macro"
);
err
.span_label
(
cx
.source_map
()
.def_span
(
sp
)
,
"when calling this macro"
);
}
}
...
...
src/test/ui/empty/empty-comment.stderr
浏览文件 @
1ab45ec7
error: unexpected end of macro invocation
--> $DIR/empty-comment.rs:20:5
|
LL | / macro_rules! one_arg_macro {
LL | | ($fmt:expr) => (print!(concat!($fmt, "/n")));
LL | | }
| |_- when calling this macro
LL | macro_rules! one_arg_macro {
| -------------------------- when calling this macro
...
LL |
one_arg_macro!(/**/); //~ ERROR unexpected end
|
^^^^^^^^^^^^^^^^^^^^^ unexpected end of macro invocation
LL | one_arg_macro!(/**/); //~ ERROR unexpected end
| ^^^^^^^^^^^^^^^^^^^^^ unexpected end of macro invocation
error: aborting due to previous error
src/test/ui/issues/issue-7970a.stderr
浏览文件 @
1ab45ec7
error: unexpected end of macro invocation
--> $DIR/issue-7970a.rs:16:5
|
LL | / macro_rules! one_arg_macro {
LL | | ($fmt:expr) => (print!(concat!($fmt, "/n")));
LL | | }
| |_- when calling this macro
LL | macro_rules! one_arg_macro {
| -------------------------- when calling this macro
...
LL |
one_arg_macro!();
|
^^^^^^^^^^^^^^^^^ unexpected end of macro invocation
LL | one_arg_macro!();
| ^^^^^^^^^^^^^^^^^ unexpected end of macro invocation
error: aborting due to previous error
src/test/ui/macros/macro-at-most-once-rep-2018-feature-gate.stderr
浏览文件 @
1ab45ec7
...
...
@@ -51,41 +51,29 @@ LL | ($(a)?*) => {}
error: no rules expected the token `?`
--> $DIR/macro-at-most-once-rep-2018-feature-gate.rs:41:11
|
LL | / macro_rules! foo {
LL | | ($(a)?) => {}
LL | | //~^ERROR using the `?` macro Kleene operator for
LL | | //~|ERROR expected `*` or `+`
LL | | }
| |_- when calling this macro
LL | macro_rules! foo {
| ---------------- when calling this macro
...
LL |
foo!(a?); //~ ERROR no rules expected the token `?`
|
^ no rules expected the token `?`
LL | foo!(a?); //~ ERROR no rules expected the token `?`
| ^ no rules expected the token `?`
error: no rules expected the token `?`
--> $DIR/macro-at-most-once-rep-2018-feature-gate.rs:42:11
|
LL | / macro_rules! foo {
LL | | ($(a)?) => {}
LL | | //~^ERROR using the `?` macro Kleene operator for
LL | | //~|ERROR expected `*` or `+`
LL | | }
| |_- when calling this macro
LL | macro_rules! foo {
| ---------------- when calling this macro
...
LL |
foo!(a?a); //~ ERROR no rules expected the token `?`
|
^ no rules expected the token `?`
LL | foo!(a?a); //~ ERROR no rules expected the token `?`
| ^ no rules expected the token `?`
error: no rules expected the token `?`
--> $DIR/macro-at-most-once-rep-2018-feature-gate.rs:43:11
|
LL | / macro_rules! foo {
LL | | ($(a)?) => {}
LL | | //~^ERROR using the `?` macro Kleene operator for
LL | | //~|ERROR expected `*` or `+`
LL | | }
| |_- when calling this macro
LL | macro_rules! foo {
| ---------------- when calling this macro
...
LL |
foo!(a?a?a); //~ ERROR no rules expected the token `?`
|
^ no rules expected the token `?`
LL | foo!(a?a?a); //~ ERROR no rules expected the token `?`
| ^ no rules expected the token `?`
error: aborting due to 10 previous errors
...
...
src/test/ui/macros/macro-at-most-once-rep-2018.stderr
浏览文件 @
1ab45ec7
...
...
@@ -7,123 +7,101 @@ LL | ($(a),?) => {} //~ERROR the `?` macro repetition operator
error: no rules expected the token `?`
--> $DIR/macro-at-most-once-rep-2018.rs:36:11
|
LL | / macro_rules! foo {
LL | | ($(a)?) => {}
LL | | }
| |_- when calling this macro
LL | macro_rules! foo {
| ---------------- when calling this macro
...
LL |
foo!(a?); //~ ERROR no rules expected the token `?`
|
^ no rules expected the token `?`
LL | foo!(a?); //~ ERROR no rules expected the token `?`
| ^ no rules expected the token `?`
error: no rules expected the token `?`
--> $DIR/macro-at-most-once-rep-2018.rs:37:11
|
LL | / macro_rules! foo {
LL | | ($(a)?) => {}
LL | | }
| |_- when calling this macro
LL | macro_rules! foo {
| ---------------- when calling this macro
...
LL |
foo!(a?a); //~ ERROR no rules expected the token `?`
|
^ no rules expected the token `?`
LL | foo!(a?a); //~ ERROR no rules expected the token `?`
| ^ no rules expected the token `?`
error: no rules expected the token `?`
--> $DIR/macro-at-most-once-rep-2018.rs:38:11
|
LL | / macro_rules! foo {
LL | | ($(a)?) => {}
LL | | }
| |_- when calling this macro
LL | macro_rules! foo {
| ---------------- when calling this macro
...
LL |
foo!(a?a?a); //~ ERROR no rules expected the token `?`
|
^ no rules expected the token `?`
LL | foo!(a?a?a); //~ ERROR no rules expected the token `?`
| ^ no rules expected the token `?`
error: unexpected end of macro invocation
--> $DIR/macro-at-most-once-rep-2018.rs:40:5
|
LL | / macro_rules! barplus {
LL | | ($(a)?+) => {} // ok. matches "a+" and "+"
LL | | }
| |_- when calling this macro
LL | macro_rules! barplus {
| -------------------- when calling this macro
...
LL |
barplus!(); //~ERROR unexpected end of macro invocation
|
^^^^^^^^^^^ unexpected end of macro invocation
LL | barplus!(); //~ERROR unexpected end of macro invocation
| ^^^^^^^^^^^ unexpected end of macro invocation
error: unexpected end of macro invocation
--> $DIR/macro-at-most-once-rep-2018.rs:41:14
|
LL | / macro_rules! barplus {
LL | | ($(a)?+) => {} // ok. matches "a+" and "+"
LL | | }
| |_- when calling this macro
LL | macro_rules! barplus {
| -------------------- when calling this macro
...
LL |
barplus!(a); //~ERROR unexpected end of macro invocation
|
^ unexpected end of macro invocation
LL | barplus!(a); //~ERROR unexpected end of macro invocation
| ^ unexpected end of macro invocation
error: no rules expected the token `?`
--> $DIR/macro-at-most-once-rep-2018.rs:42:15
|
LL | / macro_rules! barplus {
LL | | ($(a)?+) => {} // ok. matches "a+" and "+"
LL | | }
| |_- when calling this macro
LL | macro_rules! barplus {
| -------------------- when calling this macro
...
LL |
barplus!(a?); //~ ERROR no rules expected the token `?`
|
^ no rules expected the token `?`
LL | barplus!(a?); //~ ERROR no rules expected the token `?`
| ^ no rules expected the token `?`
error: no rules expected the token `?`
--> $DIR/macro-at-most-once-rep-2018.rs:43:15
|
LL | / macro_rules! barplus {
LL | | ($(a)?+) => {} // ok. matches "a+" and "+"
LL | | }
| |_- when calling this macro
LL | macro_rules! barplus {
| -------------------- when calling this macro
...
LL |
barplus!(a?a); //~ ERROR no rules expected the token `?`
|
^ no rules expected the token `?`
LL | barplus!(a?a); //~ ERROR no rules expected the token `?`
| ^ no rules expected the token `?`
error: unexpected end of macro invocation
--> $DIR/macro-at-most-once-rep-2018.rs:47:5
|
LL | / macro_rules! barstar {
LL | | ($(a)?*) => {} // ok. matches "a*" and "*"
LL | | }
| |_- when calling this macro
LL | macro_rules! barstar {
| -------------------- when calling this macro
...
LL |
barstar!(); //~ERROR unexpected end of macro invocation
|
^^^^^^^^^^^ unexpected end of macro invocation
LL | barstar!(); //~ERROR unexpected end of macro invocation
| ^^^^^^^^^^^ unexpected end of macro invocation
error: unexpected end of macro invocation
--> $DIR/macro-at-most-once-rep-2018.rs:48:14
|
LL | / macro_rules! barstar {
LL | | ($(a)?*) => {} // ok. matches "a*" and "*"
LL | | }
| |_- when calling this macro
LL | macro_rules! barstar {
| -------------------- when calling this macro
...
LL |
barstar!(a); //~ERROR unexpected end of macro invocation
|
^ unexpected end of macro invocation
LL | barstar!(a); //~ERROR unexpected end of macro invocation
| ^ unexpected end of macro invocation
error: no rules expected the token `?`
--> $DIR/macro-at-most-once-rep-2018.rs:49:15
|
LL | / macro_rules! barstar {
LL | | ($(a)?*) => {} // ok. matches "a*" and "*"
LL | | }
| |_- when calling this macro
LL | macro_rules! barstar {
| -------------------- when calling this macro
...
LL |
barstar!(a?); //~ ERROR no rules expected the token `?`
|
^ no rules expected the token `?`
LL | barstar!(a?); //~ ERROR no rules expected the token `?`
| ^ no rules expected the token `?`
error: no rules expected the token `?`
--> $DIR/macro-at-most-once-rep-2018.rs:50:15
|
LL | / macro_rules! barstar {
LL | | ($(a)?*) => {} // ok. matches "a*" and "*"
LL | | }
| |_- when calling this macro
LL | macro_rules! barstar {
| -------------------- when calling this macro
...
LL |
barstar!(a?a); //~ ERROR no rules expected the token `?`
|
^ no rules expected the token `?`
LL | barstar!(a?a); //~ ERROR no rules expected the token `?`
| ^ no rules expected the token `?`
error: aborting due to 12 previous errors
src/test/ui/macros/macro-non-lifetime.stderr
浏览文件 @
1ab45ec7
...
...
@@ -2,7 +2,7 @@ error: no rules expected the token `a`
--> $DIR/macro-non-lifetime.rs:18:8
|
LL | macro_rules! m { ($x:lifetime) => { } }
| --------------
-------------------------
when calling this macro
| -------------- when calling this macro
...
LL | m!(a);
| ^ no rules expected the token `a`
...
...
src/test/ui/macros/missing-comma.stderr
浏览文件 @
1ab45ec7
...
...
@@ -7,68 +7,44 @@ LL | println!("{}" a);
error: no rules expected the token `b`
--> $DIR/missing-comma.rs:22:12
|
LL | / macro_rules! foo {
LL | | ($a:ident) => ();
LL | | ($a:ident, $b:ident) => ();
LL | | ($a:ident, $b:ident, $c:ident) => ();
LL | | ($a:ident, $b:ident, $c:ident, $d:ident) => ();
LL | | ($a:ident, $b:ident, $c:ident, $d:ident, $e:ident) => ();
LL | | }
| |_- when calling this macro
LL | macro_rules! foo {
| ---------------- when calling this macro
...
LL |
foo!(a b);
|
-^ no rules expected the token `b`
|
|
|
help: missing comma here
LL | foo!(a b);
| -^ no rules expected the token `b`
| |
| help: missing comma here
error: no rules expected the token `e`
--> $DIR/missing-comma.rs:24:21
|
LL | / macro_rules! foo {
LL | | ($a:ident) => ();
LL | | ($a:ident, $b:ident) => ();
LL | | ($a:ident, $b:ident, $c:ident) => ();
LL | | ($a:ident, $b:ident, $c:ident, $d:ident) => ();
LL | | ($a:ident, $b:ident, $c:ident, $d:ident, $e:ident) => ();
LL | | }
| |_- when calling this macro
LL | macro_rules! foo {
| ---------------- when calling this macro
...
LL |
foo!(a, b, c, d e);
|
-^ no rules expected the token `e`
|
|
|
help: missing comma here
LL | foo!(a, b, c, d e);
| -^ no rules expected the token `e`
| |
| help: missing comma here
error: no rules expected the token `d`
--> $DIR/missing-comma.rs:26:18
|
LL | / macro_rules! foo {
LL | | ($a:ident) => ();
LL | | ($a:ident, $b:ident) => ();
LL | | ($a:ident, $b:ident, $c:ident) => ();
LL | | ($a:ident, $b:ident, $c:ident, $d:ident) => ();
LL | | ($a:ident, $b:ident, $c:ident, $d:ident, $e:ident) => ();
LL | | }
| |_- when calling this macro
LL | macro_rules! foo {
| ---------------- when calling this macro
...
LL |
foo!(a, b, c d, e);
|
-^ no rules expected the token `d`
|
|
|
help: missing comma here
LL | foo!(a, b, c d, e);
| -^ no rules expected the token `d`
| |
| help: missing comma here
error: no rules expected the token `d`
--> $DIR/missing-comma.rs:28:18
|
LL | / macro_rules! foo {
LL | | ($a:ident) => ();
LL | | ($a:ident, $b:ident) => ();
LL | | ($a:ident, $b:ident, $c:ident) => ();
LL | | ($a:ident, $b:ident, $c:ident, $d:ident) => ();
LL | | ($a:ident, $b:ident, $c:ident, $d:ident, $e:ident) => ();
LL | | }
| |_- when calling this macro
LL | macro_rules! foo {
| ---------------- when calling this macro
...
LL |
foo!(a, b, c d e);
|
^ no rules expected the token `d`
LL | foo!(a, b, c d e);
| ^ no rules expected the token `d`
error: aborting due to 5 previous errors
src/test/ui/macros/trace_faulty_macros.stderr
浏览文件 @
1ab45ec7
error: no rules expected the token `bcd`
--> $DIR/trace_faulty_macros.rs:17:26
|
LL | / macro_rules! my_faulty_macro {
LL | | () => {
LL | | my_faulty_macro!(bcd); //~ ERROR no rules
| | ^^^ no rules expected the token `bcd`
LL | | };
LL | | }
| |_- when calling this macro
LL | macro_rules! my_faulty_macro {
| ---------------------------- when calling this macro
LL | () => {
LL | my_faulty_macro!(bcd); //~ ERROR no rules
| ^^^ no rules expected the token `bcd`
...
LL |
my_faulty_macro!();
|
------------------- in this macro invocation
LL | my_faulty_macro!();
| ------------------- in this macro invocation
note: trace_macro
--> $DIR/trace_faulty_macros.rs:43:5
...
...
src/test/ui/parser/macro/macro-doc-comments-1.stderr
浏览文件 @
1ab45ec7
error: no rules expected the token `!`
--> $DIR/macro-doc-comments-1.rs:16:5
|
LL | / macro_rules! outer {
LL | | (#[$outer:meta]) => ()
LL | | }
| |_- when calling this macro
LL | macro_rules! outer {
| ------------------ when calling this macro
...
LL |
//! Inner
|
^^^^^^^^^ no rules expected the token `!`
LL | //! Inner
| ^^^^^^^^^ no rules expected the token `!`
error: aborting due to previous error
src/test/ui/parser/macro/macro-doc-comments-2.stderr
浏览文件 @
1ab45ec7
error: no rules expected the token `[`
--> $DIR/macro-doc-comments-2.rs:16:5
|
LL | / macro_rules! inner {
LL | | (#![$inner:meta]) => ()
LL | | }
| |_- when calling this macro
LL | macro_rules! inner {
| ------------------ when calling this macro
...
LL |
/// Outer
|
^ no rules expected the token `[`
LL | /// Outer
| ^ no rules expected the token `[`
error: aborting due to previous error
src/test/ui/underscore-ident-matcher.stderr
浏览文件 @
1ab45ec7
error: no rules expected the token `_`
--> $DIR/underscore-ident-matcher.rs:18:19
|
LL | / macro_rules! identity {
LL | | ($i: ident) => (
LL | | $i
LL | | )
LL | | }
| |_- when calling this macro
LL | macro_rules! identity {
| --------------------- when calling this macro
...
LL |
let identity!(_) = 10; //~ ERROR no rules expected the token `_`
|
^ no rules expected the token `_`
LL | let identity!(_) = 10; //~ ERROR no rules expected the token `_`
| ^ no rules expected the token `_`
error: aborting due to previous error
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录