Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
202ede19
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,发现更多精彩内容 >>
提交
202ede19
编写于
11月 02, 2014
作者:
A
Alex Crichton
浏览文件
操作
浏览文件
下载
差异文件
rollup merge of #18523 : bkoropoff/issue-18501
上级
b3f8b8f2
949dbc11
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
61 addition
and
11 deletion
+61
-11
src/librustc/middle/astencode.rs
src/librustc/middle/astencode.rs
+5
-11
src/librustc/middle/def.rs
src/librustc/middle/def.rs
+9
-0
src/test/auxiliary/issue-18501.rs
src/test/auxiliary/issue-18501.rs
+27
-0
src/test/run-pass/issue-18501.rs
src/test/run-pass/issue-18501.rs
+20
-0
未找到文件。
src/librustc/middle/astencode.rs
浏览文件 @
202ede19
...
...
@@ -441,19 +441,13 @@ impl tr for def::Def {
fn
tr
(
&
self
,
dcx
:
&
DecodeContext
)
->
def
::
Def
{
match
*
self
{
def
::
DefFn
(
did
,
is_ctor
)
=>
def
::
DefFn
(
did
.tr
(
dcx
),
is_ctor
),
def
::
DefStaticMethod
(
did
,
wrapped_did2
)
=>
{
def
::
DefStaticMethod
(
did
.tr
(
dcx
),
match
wrapped_did2
{
def
::
FromTrait
(
did2
)
=>
{
def
::
FromTrait
(
did2
.tr
(
dcx
))
}
def
::
FromImpl
(
did2
)
=>
{
def
::
FromImpl
(
did2
.tr
(
dcx
))
}
})
def
::
DefStaticMethod
(
did
,
p
)
=>
{
def
::
DefStaticMethod
(
did
.tr
(
dcx
),
p
.map
(|
did2
|
did2
.tr
(
dcx
)))
}
def
::
DefMethod
(
did0
,
did1
,
p
)
=>
{
def
::
DefMethod
(
did0
.tr
(
dcx
),
did1
.map
(|
did1
|
did1
.tr
(
dcx
)),
p
)
def
::
DefMethod
(
did0
.tr
(
dcx
),
did1
.map
(|
did1
|
did1
.tr
(
dcx
)),
p
.map
(|
did2
|
did2
.tr
(
dcx
)))
}
def
::
DefSelfTy
(
nid
)
=>
{
def
::
DefSelfTy
(
dcx
.tr_id
(
nid
))
}
def
::
DefMod
(
did
)
=>
{
def
::
DefMod
(
did
.tr
(
dcx
))
}
...
...
src/librustc/middle/def.rs
浏览文件 @
202ede19
...
...
@@ -55,6 +55,15 @@ pub enum MethodProvenance {
FromImpl
(
ast
::
DefId
),
}
impl
MethodProvenance
{
pub
fn
map
(
self
,
f
:
|
ast
::
DefId
|
->
ast
::
DefId
)
->
MethodProvenance
{
match
self
{
FromTrait
(
did
)
=>
FromTrait
(
f
(
did
)),
FromImpl
(
did
)
=>
FromImpl
(
f
(
did
))
}
}
}
impl
Def
{
pub
fn
def_id
(
&
self
)
->
ast
::
DefId
{
match
*
self
{
...
...
src/test/auxiliary/issue-18501.rs
0 → 100644
浏览文件 @
202ede19
// 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.
#![crate_type
=
"rlib"
]
struct
Foo
;
trait
Tr
{
fn
tr
(
&
self
);
}
impl
Tr
for
Foo
{
fn
tr
(
&
self
)
{}
}
fn
take_method
<
T
>
(
f
:
fn
(
&
T
),
t
:
&
T
)
{}
#[inline]
pub
fn
pass_method
()
{
take_method
(
Tr
::
tr
,
&
Foo
);
}
src/test/run-pass/issue-18501.rs
0 → 100644
浏览文件 @
202ede19
// 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.
// Test that we don't ICE when inlining a function from another
// crate that uses a trait method as a value due to incorrectly
// translating the def ID of the trait during AST decoding.
// aux-build:issue-18501.rs
extern
crate
"issue-18501"
as
issue
;
fn
main
()
{
issue
::
pass_method
();
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录