Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
9cd8bb04
R
Rust
项目概览
int
/
Rust
12 个月 前同步成功
通知
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,发现更多精彩内容 >>
提交
9cd8bb04
编写于
3月 15, 2022
作者:
B
b-naber
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
use ParamConst in ExprKind::ConstParam
上级
e2496b3c
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
15 addition
and
15 deletion
+15
-15
compiler/rustc_middle/src/thir.rs
compiler/rustc_middle/src/thir.rs
+1
-1
compiler/rustc_middle/src/thir/visit.rs
compiler/rustc_middle/src/thir/visit.rs
+1
-1
compiler/rustc_mir_build/src/build/expr/as_constant.rs
compiler/rustc_mir_build/src/build/expr/as_constant.rs
+4
-2
compiler/rustc_mir_build/src/thir/cx/expr.rs
compiler/rustc_mir_build/src/thir/cx/expr.rs
+3
-9
compiler/rustc_trait_selection/src/traits/const_evaluatable.rs
...ler/rustc_trait_selection/src/traits/const_evaluatable.rs
+6
-2
未找到文件。
compiler/rustc_middle/src/thir.rs
浏览文件 @
9cd8bb04
...
@@ -424,7 +424,7 @@ pub enum ExprKind<'tcx> {
...
@@ -424,7 +424,7 @@ pub enum ExprKind<'tcx> {
user_ty
:
Option
<
Canonical
<
'tcx
,
UserType
<
'tcx
>>>
,
user_ty
:
Option
<
Canonical
<
'tcx
,
UserType
<
'tcx
>>>
,
},
},
ConstParam
{
ConstParam
{
literal
:
ty
::
Const
<
'tcx
>
,
param
:
ty
::
ParamConst
,
def_id
:
DefId
,
def_id
:
DefId
,
},
},
// FIXME improve docs for `StaticRef` by distinguishing it from `NamedConst`
// FIXME improve docs for `StaticRef` by distinguishing it from `NamedConst`
...
...
compiler/rustc_middle/src/thir/visit.rs
浏览文件 @
9cd8bb04
...
@@ -121,7 +121,7 @@ pub fn walk_expr<'a, 'tcx: 'a, V: Visitor<'a, 'tcx>>(visitor: &mut V, expr: &Exp
...
@@ -121,7 +121,7 @@ pub fn walk_expr<'a, 'tcx: 'a, V: Visitor<'a, 'tcx>>(visitor: &mut V, expr: &Exp
Literal
{
lit
:
_
,
neg
:
_
}
=>
{}
Literal
{
lit
:
_
,
neg
:
_
}
=>
{}
ScalarLiteral
{
lit
:
_
,
user_ty
:
_
}
=>
{}
ScalarLiteral
{
lit
:
_
,
user_ty
:
_
}
=>
{}
NamedConst
{
def_id
:
_
,
substs
:
_
,
user_ty
:
_
}
=>
{}
NamedConst
{
def_id
:
_
,
substs
:
_
,
user_ty
:
_
}
=>
{}
ConstParam
{
literal
:
_
,
def_id
:
_
}
=>
{}
ConstParam
{
param
:
_
,
def_id
:
_
}
=>
{}
StaticRef
{
alloc_id
:
_
,
ty
:
_
,
def_id
:
_
}
=>
{}
StaticRef
{
alloc_id
:
_
,
ty
:
_
,
def_id
:
_
}
=>
{}
InlineAsm
{
ref
operands
,
template
:
_
,
options
:
_
,
line_spans
:
_
}
=>
{
InlineAsm
{
ref
operands
,
template
:
_
,
options
:
_
,
line_spans
:
_
}
=>
{
for
op
in
&**
operands
{
for
op
in
&**
operands
{
...
...
compiler/rustc_mir_build/src/build/expr/as_constant.rs
浏览文件 @
9cd8bb04
...
@@ -70,8 +70,10 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
...
@@ -70,8 +70,10 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
Constant
{
user_ty
,
span
,
literal
}
Constant
{
user_ty
,
span
,
literal
}
}
}
ExprKind
::
ConstParam
{
literal
,
def_id
:
_
}
=>
{
ExprKind
::
ConstParam
{
param
,
def_id
:
_
}
=>
{
let
literal
=
ConstantKind
::
Ty
(
literal
);
let
const_param
=
tcx
.mk_const
(
ty
::
ConstS
{
val
:
ty
::
ConstKind
::
Param
(
param
),
ty
:
expr
.ty
});
let
literal
=
ConstantKind
::
Ty
(
const_param
);
Constant
{
user_ty
:
None
,
span
,
literal
}
Constant
{
user_ty
:
None
,
span
,
literal
}
}
}
...
...
compiler/rustc_mir_build/src/thir/cx/expr.rs
浏览文件 @
9cd8bb04
...
@@ -869,15 +869,9 @@ fn convert_path_expr(&mut self, expr: &'tcx hir::Expr<'tcx>, res: Res) -> ExprKi
...
@@ -869,15 +869,9 @@ fn convert_path_expr(&mut self, expr: &'tcx hir::Expr<'tcx>, res: Res) -> ExprKi
let
generics
=
self
.tcx
.generics_of
(
item_def_id
);
let
generics
=
self
.tcx
.generics_of
(
item_def_id
);
let
index
=
generics
.param_def_id_to_index
[
&
def_id
];
let
index
=
generics
.param_def_id_to_index
[
&
def_id
];
let
name
=
self
.tcx
.hir
()
.name
(
hir_id
);
let
name
=
self
.tcx
.hir
()
.name
(
hir_id
);
let
val
=
ty
::
ConstKind
::
Param
(
ty
::
ParamConst
::
new
(
index
,
name
));
let
param
=
ty
::
ParamConst
::
new
(
index
,
name
);
ExprKind
::
ConstParam
{
ExprKind
::
ConstParam
{
param
,
def_id
}
literal
:
self
.tcx
.mk_const
(
ty
::
ConstS
{
val
,
ty
:
self
.typeck_results
()
.node_type
(
expr
.hir_id
),
}),
def_id
,
}
}
}
Res
::
Def
(
DefKind
::
Const
,
def_id
)
|
Res
::
Def
(
DefKind
::
AssocConst
,
def_id
)
=>
{
Res
::
Def
(
DefKind
::
Const
,
def_id
)
|
Res
::
Def
(
DefKind
::
AssocConst
,
def_id
)
=>
{
...
...
compiler/rustc_trait_selection/src/traits/const_evaluatable.rs
浏览文件 @
9cd8bb04
...
@@ -459,8 +459,12 @@ fn recurse_build(&mut self, node: thir::ExprId) -> Result<NodeId, ErrorGuarantee
...
@@ -459,8 +459,12 @@ fn recurse_build(&mut self, node: thir::ExprId) -> Result<NodeId, ErrorGuarantee
self
.nodes
.push
(
Node
::
Leaf
(
constant
))
self
.nodes
.push
(
Node
::
Leaf
(
constant
))
}
}
ExprKind
::
ConstParam
{
literal
,
..
}
=>
{
ExprKind
::
ConstParam
{
param
,
..
}
=>
{
self
.nodes
.push
(
Node
::
Leaf
(
*
literal
))
let
const_param
=
self
.tcx
.mk_const
(
ty
::
ConstS
{
val
:
ty
::
ConstKind
::
Param
(
*
param
),
ty
:
node
.ty
,
});
self
.nodes
.push
(
Node
::
Leaf
(
const_param
))
}
}
ExprKind
::
Call
{
fun
,
args
,
..
}
=>
{
ExprKind
::
Call
{
fun
,
args
,
..
}
=>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录