Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
c4a3be6b
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,发现更多精彩内容 >>
提交
c4a3be6b
编写于
11月 20, 2014
作者:
N
Niko Matsakis
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Rote changes due to the fact that ast paths no longer carry this extraneous bounds.
上级
f4e29e7e
变更
17
显示空白变更内容
内联
并排
Showing
17 changed file
with
60 addition
and
75 deletion
+60
-75
src/librustc/lint/builtin.rs
src/librustc/lint/builtin.rs
+1
-1
src/librustc/metadata/encoder.rs
src/librustc/metadata/encoder.rs
+1
-2
src/librustc/middle/privacy.rs
src/librustc/middle/privacy.rs
+5
-5
src/librustc/middle/resolve.rs
src/librustc/middle/resolve.rs
+8
-7
src/librustc/middle/resolve_lifetime.rs
src/librustc/middle/resolve_lifetime.rs
+1
-8
src/librustc/middle/typeck/infer/error_reporting.rs
src/librustc/middle/typeck/infer/error_reporting.rs
+2
-2
src/librustc_trans/save/mod.rs
src/librustc_trans/save/mod.rs
+2
-2
src/libsyntax/ast_util.rs
src/libsyntax/ast_util.rs
+1
-1
src/libsyntax/ext/build.rs
src/libsyntax/ext/build.rs
+15
-8
src/libsyntax/ext/deriving/generic/mod.rs
src/libsyntax/ext/deriving/generic/mod.rs
+1
-1
src/libsyntax/ext/deriving/generic/ty.rs
src/libsyntax/ext/deriving/generic/ty.rs
+2
-2
src/libsyntax/ext/format.rs
src/libsyntax/ext/format.rs
+1
-1
src/libsyntax/ext/tt/macro_parser.rs
src/libsyntax/ext/tt/macro_parser.rs
+2
-2
src/libsyntax/fold.rs
src/libsyntax/fold.rs
+6
-4
src/libsyntax/print/pprust.rs
src/libsyntax/print/pprust.rs
+6
-20
src/libsyntax/test.rs
src/libsyntax/test.rs
+1
-2
src/libsyntax/visit.rs
src/libsyntax/visit.rs
+5
-7
未找到文件。
src/librustc/lint/builtin.rs
浏览文件 @
c4a3be6b
...
...
@@ -421,7 +421,7 @@ fn check_def(&mut self, sp: Span, ty_id: ast::NodeId, path_id: ast::NodeId) {
impl
<
'a
,
'tcx
,
'v
>
Visitor
<
'v
>
for
ImproperCTypesVisitor
<
'a
,
'tcx
>
{
fn
visit_ty
(
&
mut
self
,
ty
:
&
ast
::
Ty
)
{
match
ty
.node
{
ast
::
TyPath
(
_
,
_
,
id
)
=>
self
.check_def
(
ty
.span
,
ty
.id
,
id
),
ast
::
TyPath
(
_
,
id
)
=>
self
.check_def
(
ty
.span
,
ty
.id
,
id
),
_
=>
(),
}
visit
::
walk_ty
(
self
,
ty
);
...
...
src/librustc/metadata/encoder.rs
浏览文件 @
c4a3be6b
...
...
@@ -1230,10 +1230,9 @@ fn add_to_index(item: &ast::Item, rbml_w: &Encoder,
encode_name
(
rbml_w
,
item
.ident.name
);
encode_attributes
(
rbml_w
,
item
.attrs
.as_slice
());
match
ty
.node
{
ast
::
TyPath
(
ref
path
,
ref
bounds
,
_
)
if
path
.segments
ast
::
TyPath
(
ref
path
,
_
)
if
path
.segments
.len
()
==
1
=>
{
let
ident
=
path
.segments
.last
()
.unwrap
()
.identifier
;
assert
!
(
bounds
.is_none
());
encode_impl_type_basename
(
rbml_w
,
ident
);
}
_
=>
{}
...
...
src/librustc/middle/privacy.rs
浏览文件 @
c4a3be6b
...
...
@@ -243,7 +243,7 @@ fn visit_item(&mut self, item: &ast::Item) {
// * Private trait impls for private types can be completely ignored
ast
::
ItemImpl
(
_
,
_
,
ref
ty
,
ref
impl_items
)
=>
{
let
public_ty
=
match
ty
.node
{
ast
::
TyPath
(
_
,
_
,
id
)
=>
{
ast
::
TyPath
(
_
,
id
)
=>
{
match
self
.tcx.def_map
.borrow
()[
id
]
.clone
()
{
def
::
DefPrimTy
(
..
)
=>
true
,
def
=>
{
...
...
@@ -311,7 +311,7 @@ fn visit_item(&mut self, item: &ast::Item) {
ast
::
ItemTy
(
ref
ty
,
_
)
if
public_first
=>
{
match
ty
.node
{
ast
::
TyPath
(
_
,
_
,
id
)
=>
{
ast
::
TyPath
(
_
,
id
)
=>
{
match
self
.tcx.def_map
.borrow
()[
id
]
.clone
()
{
def
::
DefPrimTy
(
..
)
|
def
::
DefTyParam
(
..
)
=>
{},
def
=>
{
...
...
@@ -616,7 +616,7 @@ fn ensure_public(&self, span: Span, to_check: ast::DefId,
// was private.
ast
::
ItemImpl
(
_
,
_
,
ref
ty
,
_
)
=>
{
let
id
=
match
ty
.node
{
ast
::
TyPath
(
_
,
_
,
id
)
=>
id
,
ast
::
TyPath
(
_
,
id
)
=>
id
,
_
=>
return
Some
((
err_span
,
err_msg
,
None
)),
};
let
def
=
self
.tcx.def_map
.borrow
()[
id
]
.clone
();
...
...
@@ -1292,7 +1292,7 @@ fn check_ty_param_bound(&self,
impl
<
'a
,
'b
,
'tcx
,
'v
>
Visitor
<
'v
>
for
CheckTypeForPrivatenessVisitor
<
'a
,
'b
,
'tcx
>
{
fn
visit_ty
(
&
mut
self
,
ty
:
&
ast
::
Ty
)
{
match
ty
.node
{
ast
::
TyPath
(
_
,
_
,
path_id
)
=>
{
ast
::
TyPath
(
_
,
path_id
)
=>
{
if
self
.inner
.path_is_private_type
(
path_id
)
{
self
.contains_private
=
true
;
// found what we're looking for so let's stop
...
...
@@ -1493,7 +1493,7 @@ fn visit_fn(&mut self, fk: visit::FnKind<'v>, fd: &'v ast::FnDecl,
fn
visit_ty
(
&
mut
self
,
t
:
&
ast
::
Ty
)
{
match
t
.node
{
ast
::
TyPath
(
ref
p
,
_
,
path_id
)
=>
{
ast
::
TyPath
(
ref
p
,
path_id
)
=>
{
if
!
self
.tcx.sess.features
.borrow
()
.visible_private_types
&&
self
.path_is_private_type
(
path_id
)
{
self
.tcx.sess
.span_err
(
p
.span
,
...
...
src/librustc/middle/resolve.rs
浏览文件 @
c4a3be6b
...
...
@@ -63,7 +63,7 @@
use
syntax
::
ast
::{
RegionTyParamBound
,
StmtDecl
,
StructField
};
use
syntax
::
ast
::{
StructVariantKind
,
TraitRef
,
TraitTyParamBound
};
use
syntax
::
ast
::{
TupleVariantKind
,
Ty
,
TyBool
,
TyChar
,
TyClosure
,
TyF32
};
use
syntax
::
ast
::{
TyF64
,
TyFloat
,
TyI
,
TyI8
,
TyI16
,
TyI32
,
TyI64
,
TyInt
};
use
syntax
::
ast
::{
TyF64
,
TyFloat
,
TyI
,
TyI8
,
TyI16
,
TyI32
,
TyI64
,
TyInt
,
TyObjectSum
};
use
syntax
::
ast
::{
TyParam
,
TyParamBound
,
TyPath
,
TyPtr
,
TyPolyTraitRef
,
TyProc
,
TyQPath
};
use
syntax
::
ast
::{
TyRptr
,
TyStr
,
TyU
,
TyU8
,
TyU16
,
TyU32
,
TyU64
,
TyUint
};
use
syntax
::
ast
::{
TypeImplItem
,
UnnamedField
};
...
...
@@ -4742,7 +4742,7 @@ fn resolve_implementation(&mut self,
// type, the result will be that the type name resolves to a module but not
// a type (shadowing any imported modules or types with this name), leading
// to weird user-visible bugs. So we ward this off here. See #15060.
TyPath
(
ref
path
,
_
,
path_id
)
=>
{
TyPath
(
ref
path
,
path_id
)
=>
{
match
self
.def_map
.borrow
()
.get
(
&
path_id
)
{
// FIXME: should we catch other options and give more precise errors?
Some
(
&
DefMod
(
_
))
=>
{
...
...
@@ -4908,7 +4908,7 @@ fn resolve_type(&mut self, ty: &Ty) {
// Like path expressions, the interpretation of path types depends
// on whether the path has multiple elements in it or not.
TyPath
(
ref
path
,
ref
bounds
,
path_id
)
=>
{
TyPath
(
ref
path
,
path_id
)
=>
{
// This is a path in the type namespace. Walk through scopes
// looking for it.
let
mut
result_def
=
None
;
...
...
@@ -4978,11 +4978,12 @@ fn resolve_type(&mut self, ty: &Ty) {
self
.resolve_error
(
ty
.span
,
msg
.as_slice
());
}
}
}
bounds
.as_ref
()
.map
(|
bound_vec
|
{
TyObjectSum
(
ref
ty
,
ref
bound_vec
)
=>
{
self
.resolve_type
(
&**
ty
);
self
.resolve_type_parameter_bounds
(
ty
.id
,
bound_vec
,
TraitBoundingTypeParameter
);
});
}
TyQPath
(
ref
qpath
)
=>
{
...
...
@@ -5619,7 +5620,7 @@ fn find_fallback_in_self_type(&mut self, name: Name) -> FallbackSuggestion {
fn
extract_path_and_node_id
(
t
:
&
Ty
,
allow
:
FallbackChecks
)
->
Option
<
(
Path
,
NodeId
,
FallbackChecks
)
>
{
match
t
.node
{
TyPath
(
ref
path
,
_
,
node_id
)
=>
Some
((
path
.clone
(),
node_id
,
allow
)),
TyPath
(
ref
path
,
node_id
)
=>
Some
((
path
.clone
(),
node_id
,
allow
)),
TyPtr
(
ref
mut_ty
)
=>
extract_path_and_node_id
(
&*
mut_ty
.ty
,
OnlyTraitAndStatics
),
TyRptr
(
_
,
ref
mut_ty
)
=>
extract_path_and_node_id
(
&*
mut_ty
.ty
,
allow
),
// This doesn't handle the remaining `Ty` variants as they are not
...
...
src/librustc/middle/resolve_lifetime.rs
浏览文件 @
c4a3be6b
...
...
@@ -162,7 +162,7 @@ fn visit_ty(&mut self, ty: &ast::Ty) {
visit
::
walk_ty
(
this
,
ty
);
});
}
ast
::
TyPath
(
ref
path
,
ref
opt_bounds
,
id
)
=>
{
ast
::
TyPath
(
ref
path
,
id
)
=>
{
// if this path references a trait, then this will resolve to
// a trait ref, which introduces a binding scope.
match
self
.def_map
.borrow
()
.get
(
&
id
)
{
...
...
@@ -170,13 +170,6 @@ fn visit_ty(&mut self, ty: &ast::Ty) {
self
.with
(
LateScope
(
&
Vec
::
new
(),
self
.scope
),
|
this
|
{
this
.visit_path
(
path
,
id
);
});
match
*
opt_bounds
{
Some
(
ref
bounds
)
=>
{
visit
::
walk_ty_param_bounds_helper
(
self
,
bounds
);
}
None
=>
{
}
}
}
_
=>
{
visit
::
walk_ty
(
self
,
ty
);
...
...
src/librustc/middle/typeck/infer/error_reporting.rs
浏览文件 @
c4a3be6b
...
...
@@ -1249,7 +1249,7 @@ fn rebuild_arg_ty_or_output(&self,
}
ty_queue
.push
(
&*
mut_ty
.ty
);
}
ast
::
TyPath
(
ref
path
,
ref
bounds
,
id
)
=>
{
ast
::
TyPath
(
ref
path
,
id
)
=>
{
let
a_def
=
match
self
.tcx.def_map
.borrow
()
.get
(
&
id
)
{
None
=>
{
self
.tcx
...
...
@@ -1296,7 +1296,7 @@ fn rebuild_arg_ty_or_output(&self,
let
new_path
=
self
.rebuild_path
(
rebuild_info
,
lifetime
);
let
to
=
ast
::
Ty
{
id
:
cur_ty
.id
,
node
:
ast
::
TyPath
(
new_path
,
bounds
.clone
(),
id
),
node
:
ast
::
TyPath
(
new_path
,
id
),
span
:
cur_ty
.span
};
new_ty
=
self
.rebuild_ty
(
new_ty
,
P
(
to
));
...
...
src/librustc_trans/save/mod.rs
浏览文件 @
c4a3be6b
...
...
@@ -651,7 +651,7 @@ fn process_impl(&mut self,
typ
:
&
ast
::
Ty
,
impl_items
:
&
Vec
<
ast
::
ImplItem
>
)
{
match
typ
.node
{
ast
::
TyPath
(
ref
path
,
_
,
id
)
=>
{
ast
::
TyPath
(
ref
path
,
id
)
=>
{
match
self
.lookup_type_ref
(
id
)
{
Some
(
id
)
=>
{
let
sub_span
=
self
.span
.sub_span_for_type_name
(
path
.span
);
...
...
@@ -1256,7 +1256,7 @@ fn visit_ty(&mut self, t: &ast::Ty) {
}
match
t
.node
{
ast
::
TyPath
(
ref
path
,
_
,
id
)
=>
{
ast
::
TyPath
(
ref
path
,
id
)
=>
{
match
self
.lookup_type_ref
(
id
)
{
Some
(
id
)
=>
{
let
sub_span
=
self
.span
.sub_span_for_type_name
(
t
.span
);
...
...
src/libsyntax/ast_util.rs
浏览文件 @
c4a3be6b
...
...
@@ -454,7 +454,7 @@ fn visit_expr(&mut self, expression: &Expr) {
fn
visit_ty
(
&
mut
self
,
typ
:
&
Ty
)
{
self
.operation
.visit_id
(
typ
.id
);
match
typ
.node
{
TyPath
(
_
,
_
,
id
)
=>
self
.operation
.visit_id
(
id
),
TyPath
(
_
,
id
)
=>
self
.operation
.visit_id
(
id
),
_
=>
{}
}
visit
::
walk_ty
(
self
,
typ
)
...
...
src/libsyntax/ext/build.rs
浏览文件 @
c4a3be6b
...
...
@@ -44,7 +44,8 @@ fn path_all(&self, sp: Span,
fn
ty_mt
(
&
self
,
ty
:
P
<
ast
::
Ty
>
,
mutbl
:
ast
::
Mutability
)
->
ast
::
MutTy
;
fn
ty
(
&
self
,
span
:
Span
,
ty
:
ast
::
Ty_
)
->
P
<
ast
::
Ty
>
;
fn
ty_path
(
&
self
,
ast
::
Path
,
Option
<
OwnedSlice
<
ast
::
TyParamBound
>>
)
->
P
<
ast
::
Ty
>
;
fn
ty_path
(
&
self
,
ast
::
Path
)
->
P
<
ast
::
Ty
>
;
fn
ty_sum
(
&
self
,
ast
::
Path
,
OwnedSlice
<
ast
::
TyParamBound
>
)
->
P
<
ast
::
Ty
>
;
fn
ty_ident
(
&
self
,
span
:
Span
,
idents
:
ast
::
Ident
)
->
P
<
ast
::
Ty
>
;
fn
ty_rptr
(
&
self
,
span
:
Span
,
...
...
@@ -344,17 +345,21 @@ fn ty(&self, span: Span, ty: ast::Ty_) -> P<ast::Ty> {
})
}
fn
ty_path
(
&
self
,
path
:
ast
::
Path
,
bounds
:
Option
<
OwnedSlice
<
ast
::
TyParamBound
>>
)
->
P
<
ast
::
Ty
>
{
fn
ty_path
(
&
self
,
path
:
ast
::
Path
)
->
P
<
ast
::
Ty
>
{
self
.ty
(
path
.span
,
ast
::
TyPath
(
path
,
ast
::
DUMMY_NODE_ID
))
}
fn
ty_sum
(
&
self
,
path
:
ast
::
Path
,
bounds
:
OwnedSlice
<
ast
::
TyParamBound
>
)
->
P
<
ast
::
Ty
>
{
self
.ty
(
path
.span
,
ast
::
TyPath
(
path
,
bounds
,
ast
::
DUMMY_NODE_ID
))
ast
::
TyObjectSum
(
self
.ty_path
(
path
),
bounds
))
}
// Might need to take bounds as an argument in the future, if you ever want
// to generate a bounded existential trait type.
fn
ty_ident
(
&
self
,
span
:
Span
,
ident
:
ast
::
Ident
)
->
P
<
ast
::
Ty
>
{
self
.ty_path
(
self
.path_ident
(
span
,
ident
)
,
None
)
self
.ty_path
(
self
.path_ident
(
span
,
ident
))
}
fn
ty_rptr
(
&
self
,
...
...
@@ -386,7 +391,7 @@ fn ty_option(&self, ty: P<ast::Ty>) -> P<ast::Ty> {
self
.ident_of
(
"Option"
)
),
Vec
::
new
(),
vec!
(
ty
))
,
None
)
vec!
(
ty
)))
}
fn
ty_field_imm
(
&
self
,
span
:
Span
,
name
:
Ident
,
ty
:
P
<
ast
::
Ty
>
)
->
ast
::
TypeField
{
...
...
@@ -425,8 +430,10 @@ fn ty_vars(&self, ty_params: &OwnedSlice<ast::TyParam>) -> Vec<P<ast::Ty>> {
}
fn
ty_vars_global
(
&
self
,
ty_params
:
&
OwnedSlice
<
ast
::
TyParam
>
)
->
Vec
<
P
<
ast
::
Ty
>>
{
ty_params
.iter
()
.map
(|
p
|
self
.ty_path
(
self
.path_global
(
DUMMY_SP
,
vec!
(
p
.ident
)),
None
))
.collect
()
ty_params
.iter
()
.map
(|
p
|
self
.ty_path
(
self
.path_global
(
DUMMY_SP
,
vec!
(
p
.ident
))))
.collect
()
}
fn
trait_ref
(
&
self
,
path
:
ast
::
Path
)
->
ast
::
TraitRef
{
...
...
src/libsyntax/ext/deriving/generic/mod.rs
浏览文件 @
c4a3be6b
...
...
@@ -444,7 +444,7 @@ fn create_derived_impl(&self,
// Create the type of `self`.
let
self_type
=
cx
.ty_path
(
cx
.path_all
(
self
.span
,
false
,
vec!
(
type_ident
),
self_lifetimes
,
self_ty_params
.into_vec
())
,
None
);
self_ty_params
.into_vec
()));
let
attr
=
cx
.attribute
(
self
.span
,
...
...
src/libsyntax/ext/deriving/generic/ty.rs
浏览文件 @
c4a3be6b
...
...
@@ -70,7 +70,7 @@ pub fn to_ty(&self,
self_ty
:
Ident
,
self_generics
:
&
Generics
)
->
P
<
ast
::
Ty
>
{
cx
.ty_path
(
self
.to_path
(
cx
,
span
,
self_ty
,
self_generics
)
,
None
)
cx
.ty_path
(
self
.to_path
(
cx
,
span
,
self_ty
,
self_generics
))
}
pub
fn
to_path
(
&
self
,
cx
:
&
ExtCtxt
,
...
...
@@ -152,7 +152,7 @@ pub fn to_ty(&self,
}
Literal
(
ref
p
)
=>
{
p
.to_ty
(
cx
,
span
,
self_ty
,
self_generics
)
}
Self
=>
{
cx
.ty_path
(
self
.to_path
(
cx
,
span
,
self_ty
,
self_generics
)
,
None
)
cx
.ty_path
(
self
.to_path
(
cx
,
span
,
self_ty
,
self_generics
))
}
Tuple
(
ref
fields
)
=>
{
let
ty
=
ast
::
TyTup
(
fields
.iter
()
...
...
src/libsyntax/ext/format.rs
浏览文件 @
c4a3be6b
...
...
@@ -531,7 +531,7 @@ fn to_expr(mut self, invocation: Invocation) -> P<ast::Expr> {
true
,
Context
::
rtpath
(
self
.ecx
,
"Argument"
),
vec!
[
static_lifetime
],
vec!
[]
)
,
None
);
));
lets
.push
(
Context
::
item_static_array
(
self
.ecx
,
static_args_name
,
piece_ty
,
...
...
src/libsyntax/ext/tt/macro_parser.rs
浏览文件 @
c4a3be6b
...
...
@@ -514,7 +514,7 @@ pub fn parse_nt(p: &mut Parser, name: &str) -> Nonterminal {
"stmt"
=>
token
::
NtStmt
(
p
.parse_stmt
(
Vec
::
new
())),
"pat"
=>
token
::
NtPat
(
p
.parse_pat
()),
"expr"
=>
token
::
NtExpr
(
p
.parse_expr
()),
"ty"
=>
token
::
NtTy
(
p
.parse_ty
(
false
/* no need to disambiguate*/
)),
"ty"
=>
token
::
NtTy
(
p
.parse_ty
()),
// this could be handled like a token, since it is one
"ident"
=>
match
p
.token
{
token
::
Ident
(
sn
,
b
)
=>
{
p
.bump
();
token
::
NtIdent
(
box
sn
,
b
)
}
...
...
@@ -525,7 +525,7 @@ pub fn parse_nt(p: &mut Parser, name: &str) -> Nonterminal {
}
},
"path"
=>
{
token
::
NtPath
(
box
p
.parse_path
(
LifetimeAndTypesWithoutColons
)
.path
)
token
::
NtPath
(
box
p
.parse_path
(
LifetimeAndTypesWithoutColons
))
}
"meta"
=>
token
::
NtMeta
(
p
.parse_meta_item
()),
"tt"
=>
{
...
...
src/libsyntax/fold.rs
浏览文件 @
c4a3be6b
...
...
@@ -433,11 +433,13 @@ pub fn noop_fold_ty<T: Folder>(t: P<Ty>, fld: &mut T) -> P<Ty> {
}
TyTup
(
tys
)
=>
TyTup
(
tys
.move_map
(|
ty
|
fld
.fold_ty
(
ty
))),
TyParen
(
ty
)
=>
TyParen
(
fld
.fold_ty
(
ty
)),
TyPath
(
path
,
bounds
,
id
)
=>
{
TyPath
(
path
,
id
)
=>
{
let
id
=
fld
.new_id
(
id
);
TyPath
(
fld
.fold_path
(
path
),
fld
.fold_opt_bounds
(
bounds
),
id
)
TyPath
(
fld
.fold_path
(
path
),
id
)
}
TyObjectSum
(
ty
,
bounds
)
=>
{
TyObjectSum
(
fld
.fold_ty
(
ty
),
fld
.fold_bounds
(
bounds
))
}
TyQPath
(
qpath
)
=>
{
TyQPath
(
fld
.fold_qpath
(
qpath
))
...
...
src/libsyntax/print/pprust.rs
浏览文件 @
c4a3be6b
...
...
@@ -1916,11 +1916,11 @@ pub fn print_for_decl(&mut self, loc: &ast::Local,
self
.print_expr
(
coll
)
}
fn
print_path
_
(
&
mut
self
,
fn
print_path
(
&
mut
self
,
path
:
&
ast
::
Path
,
colons_before_params
:
bool
,
opt_bounds
:
&
Option
<
OwnedSlice
<
ast
::
TyParamBound
>>
)
->
IoResult
<
()
>
{
colons_before_params
:
bool
)
->
IoResult
<
()
>
{
try!
(
self
.maybe_print_comment
(
path
.span.lo
));
if
path
.global
{
try!
(
word
(
&
mut
self
.s
,
"::"
));
...
...
@@ -1939,10 +1939,7 @@ fn print_path_(&mut self,
try!
(
self
.print_path_parameters
(
&
segment
.parameters
,
colons_before_params
));
}
match
*
opt_bounds
{
None
=>
Ok
(()),
Some
(
ref
bounds
)
=>
self
.print_bounds
(
"+"
,
bounds
)
}
Ok
(())
}
fn
print_path_parameters
(
&
mut
self
,
...
...
@@ -2005,17 +2002,6 @@ fn print_path_parameters(&mut self,
Ok
(())
}
fn
print_path
(
&
mut
self
,
path
:
&
ast
::
Path
,
colons_before_params
:
bool
)
->
IoResult
<
()
>
{
self
.print_path_
(
path
,
colons_before_params
,
&
None
)
}
fn
print_bounded_path
(
&
mut
self
,
path
:
&
ast
::
Path
,
bounds
:
&
Option
<
OwnedSlice
<
ast
::
TyParamBound
>>
)
->
IoResult
<
()
>
{
self
.print_path_
(
path
,
false
,
bounds
)
}
pub
fn
print_pat
(
&
mut
self
,
pat
:
&
ast
::
Pat
)
->
IoResult
<
()
>
{
try!
(
self
.maybe_print_comment
(
pat
.span.lo
));
try!
(
self
.ann
.pre
(
self
,
NodePat
(
pat
)));
...
...
src/libsyntax/test.rs
浏览文件 @
c4a3be6b
...
...
@@ -482,8 +482,7 @@ fn mk_tests(cx: &TestCtxt) -> P<ast::Item> {
let
ecx
=
&
cx
.ext_cx
;
let
struct_type
=
ecx
.ty_path
(
ecx
.path
(
sp
,
vec!
[
ecx
.ident_of
(
"self"
),
ecx
.ident_of
(
"test"
),
ecx
.ident_of
(
"TestDescAndFn"
)]),
None
);
ecx
.ident_of
(
"TestDescAndFn"
)]));
let
static_lt
=
ecx
.lifetime
(
sp
,
token
::
special_idents
::
static_lifetime
.name
);
// &'static [self::test::TestDescAndFn]
let
static_type
=
ecx
.ty_rptr
(
sp
,
...
...
src/libsyntax/visit.rs
浏览文件 @
c4a3be6b
...
...
@@ -404,14 +404,12 @@ pub fn walk_ty<'v, V: Visitor<'v>>(visitor: &mut V, typ: &'v Ty) {
walk_fn_ret_ty
(
visitor
,
&
function_declaration
.decl.output
);
walk_lifetime_decls_helper
(
visitor
,
&
function_declaration
.lifetimes
);
}
TyPath
(
ref
path
,
ref
opt_bounds
,
id
)
=>
{
TyPath
(
ref
path
,
id
)
=>
{
visitor
.visit_path
(
path
,
id
);
match
*
opt_bounds
{
Some
(
ref
bounds
)
=>
{
walk_ty_param_bounds_helper
(
visitor
,
bounds
);
}
None
=>
{
}
}
TyObjectSum
(
ref
ty
,
ref
bounds
)
=>
{
visitor
.visit_ty
(
&**
ty
);
walk_ty_param_bounds_helper
(
visitor
,
bounds
);
}
TyQPath
(
ref
qpath
)
=>
{
visitor
.visit_ty
(
&*
qpath
.self_type
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录