Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
b6ac9c0d
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,发现更多精彩内容 >>
提交
b6ac9c0d
编写于
8月 08, 2017
作者:
E
est31
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Avoid calling the column!() macro in panic
上级
7c4e1a50
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
50 addition
and
4 deletion
+50
-4
src/libcore/macros.rs
src/libcore/macros.rs
+12
-2
src/libstd/macros.rs
src/libstd/macros.rs
+14
-2
src/libsyntax_ext/lib.rs
src/libsyntax_ext/lib.rs
+1
-0
src/test/run-pass/issue-43057.rs
src/test/run-pass/issue-43057.rs
+23
-0
未找到文件。
src/libcore/macros.rs
浏览文件 @
b6ac9c0d
...
...
@@ -8,6 +8,16 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[macro_export]
// This stability attribute is totally useless.
#[stable(feature
=
"rust1"
,
since
=
"1.0.0"
)]
#[cfg(stage0)]
macro_rules!
__
rust_unstable_column
{
()
=>
{
column!
()
}
}
/// Entry point of thread panic, for details, see std::macros
#[macro_export]
#[allow_internal_unstable]
...
...
@@ -18,7 +28,7 @@
);
(
$msg:expr
)
=>
({
static
_
MSG_FILE_LINE_COL
:
(
&
'static
str
,
&
'static
str
,
u32
,
u32
)
=
(
$msg
,
file!
(),
line!
(),
column!
());
(
$msg
,
file!
(),
line!
(),
__
rust_unstable_
column!
());
$crate
::
panicking
::
panic
(
&
_
MSG_FILE_LINE_COL
)
});
(
$fmt:expr
,
$
(
$arg:tt
)
*
)
=>
({
...
...
@@ -27,7 +37,7 @@
// insufficient, since the user may have
// `#[forbid(dead_code)]` and which cannot be overridden.
static
_
MSG_FILE_LINE_COL
:
(
&
'static
str
,
u32
,
u32
)
=
(
file!
(),
line!
(),
column!
());
(
file!
(),
line!
(),
__
rust_unstable_
column!
());
$crate
::
panicking
::
panic_fmt
(
format_args!
(
$fmt
,
$
(
$arg
)
*
),
&
_
MSG_FILE_LINE_COL
)
});
}
...
...
src/libstd/macros.rs
浏览文件 @
b6ac9c0d
...
...
@@ -14,6 +14,16 @@
//! library. Each macro is available for use when linking against the standard
//! library.
#[macro_export]
// This stability attribute is totally useless.
#[stable(feature
=
"rust1"
,
since
=
"1.0.0"
)]
#[cfg(stage0)]
macro_rules!
__
rust_unstable_column
{
()
=>
{
column!
()
}
}
/// The entry point for panic of Rust threads.
///
/// This macro is used to inject panic into a Rust thread, causing the thread to
...
...
@@ -48,7 +58,8 @@
(
$msg:expr
)
=>
({
$crate
::
rt
::
begin_panic
(
$msg
,
{
// static requires less code at runtime, more constant data
static
_
FILE_LINE_COL
:
(
&
'static
str
,
u32
,
u32
)
=
(
file!
(),
line!
(),
column!
());
static
_
FILE_LINE_COL
:
(
&
'static
str
,
u32
,
u32
)
=
(
file!
(),
line!
(),
__
rust_unstable_column!
());
&
_
FILE_LINE_COL
})
});
...
...
@@ -58,7 +69,8 @@
// used inside a dead function. Just `#[allow(dead_code)]` is
// insufficient, since the user may have
// `#[forbid(dead_code)]` and which cannot be overridden.
static
_
FILE_LINE_COL
:
(
&
'static
str
,
u32
,
u32
)
=
(
file!
(),
line!
(),
column!
());
static
_
FILE_LINE_COL
:
(
&
'static
str
,
u32
,
u32
)
=
(
file!
(),
line!
(),
__
rust_unstable_column!
());
&
_
FILE_LINE_COL
})
});
...
...
src/libsyntax_ext/lib.rs
浏览文件 @
b6ac9c0d
...
...
@@ -89,6 +89,7 @@ pub fn register_builtins(resolver: &mut syntax::ext::base::Resolver,
use
syntax
::
ext
::
source_util
::
*
;
register!
{
line
:
expand_line
,
__
rust_unstable_column
:
expand_column
,
column
:
expand_column
,
file
:
expand_file
,
stringify
:
expand_stringify
,
...
...
src/test/run-pass/issue-43057.rs
0 → 100644
浏览文件 @
b6ac9c0d
// Copyright 2017 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.
#![allow(unused)]
macro_rules!
column
{
(
$i:ident
)
=>
{
$i
};
}
fn
foo
()
->
!
{
panic!
();
}
fn
main
()
{}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录