Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
b6d522a1
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,发现更多精彩内容 >>
提交
b6d522a1
编写于
6月 23, 2019
作者:
V
Vadim Petrochenkov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
syntax: Pre-intern names of all built-in macros
They always end up interned anyway
上级
1ee0ce82
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
45 addition
and
27 deletion
+45
-27
src/libsyntax/ext/derive.rs
src/libsyntax/ext/derive.rs
+3
-3
src/libsyntax/parse/lexer/mod.rs
src/libsyntax/parse/lexer/mod.rs
+1
-1
src/libsyntax_ext/deriving/mod.rs
src/libsyntax_ext/deriving/mod.rs
+17
-17
src/libsyntax_ext/lib.rs
src/libsyntax_ext/lib.rs
+3
-3
src/libsyntax_ext/proc_macro_server.rs
src/libsyntax_ext/proc_macro_server.rs
+2
-2
src/libsyntax_pos/symbol.rs
src/libsyntax_pos/symbol.rs
+19
-1
未找到文件。
src/libsyntax/ext/derive.rs
浏览文件 @
b6d522a1
...
...
@@ -63,11 +63,11 @@ pub fn add_derived_markers<T>(cx: &mut ExtCtxt<'_>, span: Span, traits: &[ast::P
let
span
=
span
.with_ctxt
(
cx
.backtrace
());
item
.visit_attrs
(|
attrs
|
{
if
names
.contains
(
&
Symbol
::
intern
(
"Eq"
))
&&
names
.contains
(
&
Symbol
::
intern
(
"PartialEq"
)
)
{
let
meta
=
cx
.meta_word
(
span
,
Symbol
::
intern
(
"structural_match"
)
);
if
names
.contains
(
&
sym
::
Eq
)
&&
names
.contains
(
&
sym
::
PartialEq
)
{
let
meta
=
cx
.meta_word
(
span
,
sym
::
structural_match
);
attrs
.push
(
cx
.attribute
(
span
,
meta
));
}
if
names
.contains
(
&
Symbol
::
intern
(
"Copy"
)
)
{
if
names
.contains
(
&
sym
::
Copy
)
{
let
meta
=
cx
.meta_word
(
span
,
sym
::
rustc_copy_clone_marker
);
attrs
.push
(
cx
.attribute
(
span
,
meta
));
}
...
...
src/libsyntax/parse/lexer/mod.rs
浏览文件 @
b6d522a1
...
...
@@ -613,7 +613,7 @@ fn scan_number(&mut self, c: char) -> (token::LitKind, Symbol) {
if
num_digits
==
0
{
self
.err_span_
(
start_bpos
,
self
.pos
,
"no valid digits found for number"
);
return
(
token
::
Integer
,
Symbol
::
intern
(
"0"
));
return
(
token
::
Integer
,
sym
::
integer
(
0
));
}
// might be a float, but don't be greedy if this is actually an
...
...
src/libsyntax_ext/deriving/mod.rs
浏览文件 @
b6d522a1
...
...
@@ -61,10 +61,10 @@ fn expand(&self,
}
macro_rules!
derive_traits
{
(
$
(
[
$deprecation:expr
]
$name:
expr
=>
$func:path
,
)
+
)
=>
{
(
$
(
[
$deprecation:expr
]
$name:
ident
=>
$func:path
,
)
+
)
=>
{
pub
fn
is_builtin_trait
(
name
:
ast
::
Name
)
->
bool
{
match
&*
name
.as_str
()
{
$
(
$name
)|
+
=>
true
,
match
name
{
$
(
sym
::
$name
)|
+
=>
true
,
_
=>
false
,
}
}
...
...
@@ -80,7 +80,7 @@ pub fn register_builtin_derives(resolver: &mut dyn Resolver, edition: Edition) {
$
(
resolver
.add_builtin
(
ast
::
Ident
::
with_empty_ctxt
(
Symbol
::
intern
(
$name
)
),
ast
::
Ident
::
with_empty_ctxt
(
sym
::
$name
),
Lrc
::
new
(
SyntaxExtension
{
deprecation
:
$deprecation
.map
(|
msg
|
Deprecation
{
since
:
Some
(
Symbol
::
intern
(
"1.0.0"
)),
...
...
@@ -100,40 +100,40 @@ pub fn register_builtin_derives(resolver: &mut dyn Resolver, edition: Edition) {
derive_traits!
{
[
None
]
"Clone"
=>
clone
::
expand_deriving_clone
,
Clone
=>
clone
::
expand_deriving_clone
,
[
None
]
"Hash"
=>
hash
::
expand_deriving_hash
,
Hash
=>
hash
::
expand_deriving_hash
,
[
None
]
"RustcEncodable"
=>
encodable
::
expand_deriving_rustc_encodable
,
RustcEncodable
=>
encodable
::
expand_deriving_rustc_encodable
,
[
None
]
"RustcDecodable"
=>
decodable
::
expand_deriving_rustc_decodable
,
RustcDecodable
=>
decodable
::
expand_deriving_rustc_decodable
,
[
None
]
"PartialEq"
=>
partial_eq
::
expand_deriving_partial_eq
,
PartialEq
=>
partial_eq
::
expand_deriving_partial_eq
,
[
None
]
"Eq"
=>
eq
::
expand_deriving_eq
,
Eq
=>
eq
::
expand_deriving_eq
,
[
None
]
"PartialOrd"
=>
partial_ord
::
expand_deriving_partial_ord
,
PartialOrd
=>
partial_ord
::
expand_deriving_partial_ord
,
[
None
]
"Ord"
=>
ord
::
expand_deriving_ord
,
Ord
=>
ord
::
expand_deriving_ord
,
[
None
]
"Debug"
=>
debug
::
expand_deriving_debug
,
Debug
=>
debug
::
expand_deriving_debug
,
[
None
]
"Default"
=>
default
::
expand_deriving_default
,
Default
=>
default
::
expand_deriving_default
,
[
None
]
"Copy"
=>
bounds
::
expand_deriving_copy
,
Copy
=>
bounds
::
expand_deriving_copy
,
// deprecated
[
Some
(
"derive(Encodable) is deprecated in favor of derive(RustcEncodable)"
)]
"Encodable"
=>
encodable
::
expand_deriving_encodable
,
Encodable
=>
encodable
::
expand_deriving_encodable
,
[
Some
(
"derive(Decodable) is deprecated in favor of derive(RustcDecodable)"
)]
"Decodable"
=>
decodable
::
expand_deriving_decodable
,
Decodable
=>
decodable
::
expand_deriving_decodable
,
}
/// Construct a name for the inner type parameter that can't collide with any type parameters of
...
...
src/libsyntax_ext/lib.rs
浏览文件 @
b6d522a1
...
...
@@ -74,14 +74,14 @@ pub fn register_builtins(resolver: &mut dyn syntax::ext::base::Resolver,
};
macro_rules!
register
{
(
$
(
$name:ident
:
$f:expr
,
)
*
)
=>
{
$
(
register
(
Symbol
::
intern
(
stringify!
(
$name
))
,
SyntaxExtension
::
default
(
register
(
sym
::
$name
,
SyntaxExtension
::
default
(
SyntaxExtensionKind
::
LegacyBang
(
Box
::
new
(
$f
as
MacroExpanderFn
)),
edition
));
)
*
}
}
macro_rules!
register_unstable
{
(
$
(
[
$feature:expr
,
$reason:expr
,
$issue:expr
]
$name:ident
:
$f:expr
,
)
*
)
=>
{
$
(
register
(
Symbol
::
intern
(
stringify!
(
$name
))
,
SyntaxExtension
{
register
(
sym
::
$name
,
SyntaxExtension
{
stability
:
Some
(
Stability
::
unstable
(
$feature
,
Some
(
Symbol
::
intern
(
$reason
)),
$issue
)),
...
...
@@ -144,7 +144,7 @@ pub fn register_builtins(resolver: &mut dyn syntax::ext::base::Resolver,
// format_args uses `unstable` things internally.
let
allow_internal_unstable
=
Some
([
sym
::
fmt_internals
][
..
]
.into
());
register
(
Symbol
::
intern
(
"format_args"
)
,
SyntaxExtension
{
register
(
sym
::
format_args
,
SyntaxExtension
{
allow_internal_unstable
:
allow_internal_unstable
.clone
(),
..
SyntaxExtension
::
default
(
SyntaxExtensionKind
::
LegacyBang
(
Box
::
new
(
format
::
expand_format_args
)),
edition
...
...
src/libsyntax_ext/proc_macro_server.rs
浏览文件 @
b6d522a1
...
...
@@ -548,10 +548,10 @@ fn float(&mut self, n: &str) -> Self::Literal {
self
.lit
(
token
::
Float
,
Symbol
::
intern
(
n
),
None
)
}
fn
f32
(
&
mut
self
,
n
:
&
str
)
->
Self
::
Literal
{
self
.lit
(
token
::
Float
,
Symbol
::
intern
(
n
),
Some
(
Symbol
::
intern
(
"f32"
)
))
self
.lit
(
token
::
Float
,
Symbol
::
intern
(
n
),
Some
(
sym
::
f32
))
}
fn
f64
(
&
mut
self
,
n
:
&
str
)
->
Self
::
Literal
{
self
.lit
(
token
::
Float
,
Symbol
::
intern
(
n
),
Some
(
Symbol
::
intern
(
"f64"
)
))
self
.lit
(
token
::
Float
,
Symbol
::
intern
(
n
),
Some
(
sym
::
f64
))
}
fn
string
(
&
mut
self
,
string
:
&
str
)
->
Self
::
Literal
{
let
mut
escaped
=
String
::
new
();
...
...
src/libsyntax_pos/symbol.rs
浏览文件 @
b6d522a1
...
...
@@ -141,6 +141,7 @@
ArgumentV1
,
arm_target_feature
,
asm
,
assert
,
associated_consts
,
associated_type_bounds
,
associated_type_defaults
,
...
...
@@ -184,8 +185,10 @@
cmp
,
cmpxchg16b_target_feature
,
cold
,
column
,
compile_error
,
compiler_builtins
,
concat
,
concat_idents
,
conservative_impl_trait
,
console
,
...
...
@@ -203,6 +206,7 @@
contents
,
context
,
convert
,
Copy
,
copy_closures
,
core
,
core_intrinsics
,
...
...
@@ -217,8 +221,10 @@
custom_inner_attributes
,
custom_test_frameworks
,
c_variadic
,
Debug
,
declare_lint_pass
,
decl_macro
,
Decodable
,
Default
,
default_lib_allocator
,
default_type_parameter_fallback
,
...
...
@@ -253,9 +259,12 @@
eh_personality
,
eh_unwind_resume
,
enable
,
Encodable
,
env
,
eq
,
err
,
Err
,
Eq
,
Equal
,
except
,
exclusive_range_pattern
,
...
...
@@ -284,6 +293,7 @@
fmt_internals
,
fn_must_use
,
forbid
,
format_args
,
format_args_nl
,
from
,
From
,
...
...
@@ -335,6 +345,8 @@
index_mut
,
in_band_lifetimes
,
include
,
include_bytes
,
include_str
,
inclusive_range_syntax
,
infer_outlives_requirements
,
infer_static_outlives_requirements
,
...
...
@@ -363,6 +375,7 @@
lhs
,
lib
,
lifetime
,
line
,
link
,
linkage
,
link_args
,
...
...
@@ -402,6 +415,7 @@
mips_target_feature
,
mmx_target_feature
,
module
,
module_path
,
more_struct_aliases
,
movbe_target_feature
,
must_use
,
...
...
@@ -447,6 +461,7 @@
optin_builtin_traits
,
option
,
Option
,
option_env
,
opt_out_copy
,
or
,
Ord
,
...
...
@@ -462,6 +477,7 @@
parent_trait
,
partial_cmp
,
param_attrs
,
PartialEq
,
PartialOrd
,
passes
,
pat
,
...
...
@@ -532,6 +548,8 @@
rust_2018_preview
,
rust_begin_unwind
,
rustc
,
RustcDecodable
,
RustcEncodable
,
rustc_allocator
,
rustc_allocator_nounwind
,
rustc_allow_const_fn_ptr
,
...
...
@@ -591,7 +609,6 @@
_
Self
,
self_in_typedefs
,
self_struct_ctor
,
Send
,
should_panic
,
simd
,
simd_ffi
,
...
...
@@ -613,6 +630,7 @@
static_recursion
,
std
,
str
,
stringify
,
stmt
,
stmt_expr_attributes
,
stop_after_dataflow
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录