Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
5f3841ca
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,发现更多精彩内容 >>
提交
5f3841ca
编写于
12月 07, 2018
作者:
E
Eduard-Mihai Burtescu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rustc: rename PrintContext to PrintCx.
上级
c6848141
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
17 addition
and
17 deletion
+17
-17
src/librustc/infer/error_reporting/mod.rs
src/librustc/infer/error_reporting/mod.rs
+1
-1
src/librustc/ty/print.rs
src/librustc/ty/print.rs
+9
-9
src/librustc/util/ppaux.rs
src/librustc/util/ppaux.rs
+7
-7
未找到文件。
src/librustc/infer/error_reporting/mod.rs
浏览文件 @
5f3841ca
...
...
@@ -683,7 +683,7 @@ fn push_comma(
}
/// For generic types with parameters with defaults, remove the parameters corresponding to
/// the defaults. This repeats a lot of the logic found in `PrintC
ontext
::parameterized`.
/// the defaults. This repeats a lot of the logic found in `PrintC
x
::parameterized`.
fn
strip_generic_default_params
(
&
self
,
def_id
:
DefId
,
...
...
src/librustc/ty/print.rs
浏览文件 @
5f3841ca
...
...
@@ -22,7 +22,7 @@ fn visit_region(&mut self, r: ty::Region<'tcx>) -> bool {
}
#[derive(Debug)]
pub
struct
PrintC
ontext
{
pub
struct
PrintC
x
{
pub
(
crate
)
is_debug
:
bool
,
pub
(
crate
)
is_verbose
:
bool
,
pub
(
crate
)
identify_regions
:
bool
,
...
...
@@ -31,12 +31,12 @@ pub struct PrintContext {
pub
(
crate
)
binder_depth
:
usize
,
}
impl
PrintC
ontext
{
impl
PrintC
x
{
pub
(
crate
)
fn
new
()
->
Self
{
ty
::
tls
::
with
(|
tcx
|
{
let
(
is_verbose
,
identify_regions
)
=
(
tcx
.sess
.verbose
(),
tcx
.sess.opts.debugging_opts.identify_regions
);
PrintC
ontext
{
PrintC
x
{
is_debug
:
false
,
is_verbose
:
is_verbose
,
identify_regions
:
identify_regions
,
...
...
@@ -57,32 +57,32 @@ pub(crate) fn prepare_late_bound_region_info<'tcx, T>(&mut self, value: &ty::Bin
}
pub
trait
Print
<
'tcx
>
{
fn
print
<
F
:
fmt
::
Write
>
(
&
self
,
f
:
&
mut
F
,
cx
:
&
mut
PrintC
ontext
)
->
fmt
::
Result
;
fn
print_to_string
(
&
self
,
cx
:
&
mut
PrintC
ontext
)
->
String
{
fn
print
<
F
:
fmt
::
Write
>
(
&
self
,
f
:
&
mut
F
,
cx
:
&
mut
PrintC
x
)
->
fmt
::
Result
;
fn
print_to_string
(
&
self
,
cx
:
&
mut
PrintC
x
)
->
String
{
let
mut
result
=
String
::
new
();
let
_
=
self
.print
(
&
mut
result
,
cx
);
result
}
fn
print_display
<
F
:
fmt
::
Write
>
(
&
self
,
f
:
&
mut
F
,
cx
:
&
mut
PrintC
ontext
)
->
fmt
::
Result
{
fn
print_display
<
F
:
fmt
::
Write
>
(
&
self
,
f
:
&
mut
F
,
cx
:
&
mut
PrintC
x
)
->
fmt
::
Result
{
let
old_debug
=
cx
.is_debug
;
cx
.is_debug
=
false
;
let
result
=
self
.print
(
f
,
cx
);
cx
.is_debug
=
old_debug
;
result
}
fn
print_display_to_string
(
&
self
,
cx
:
&
mut
PrintC
ontext
)
->
String
{
fn
print_display_to_string
(
&
self
,
cx
:
&
mut
PrintC
x
)
->
String
{
let
mut
result
=
String
::
new
();
let
_
=
self
.print_display
(
&
mut
result
,
cx
);
result
}
fn
print_debug
<
F
:
fmt
::
Write
>
(
&
self
,
f
:
&
mut
F
,
cx
:
&
mut
PrintC
ontext
)
->
fmt
::
Result
{
fn
print_debug
<
F
:
fmt
::
Write
>
(
&
self
,
f
:
&
mut
F
,
cx
:
&
mut
PrintC
x
)
->
fmt
::
Result
{
let
old_debug
=
cx
.is_debug
;
cx
.is_debug
=
true
;
let
result
=
self
.print
(
f
,
cx
);
cx
.is_debug
=
old_debug
;
result
}
fn
print_debug_to_string
(
&
self
,
cx
:
&
mut
PrintC
ontext
)
->
String
{
fn
print_debug_to_string
(
&
self
,
cx
:
&
mut
PrintC
x
)
->
String
{
let
mut
result
=
String
::
new
();
let
_
=
self
.print_debug
(
&
mut
result
,
cx
);
result
...
...
src/librustc/util/ppaux.rs
浏览文件 @
5f3841ca
...
...
@@ -9,7 +9,7 @@
use
crate
::
ty
::{
Closure
,
Generator
,
GeneratorWitness
,
Foreign
,
Projection
,
Opaque
};
use
crate
::
ty
::{
Placeholder
,
UnnormalizedProjection
,
Dynamic
,
Int
,
Uint
,
Infer
};
use
crate
::
ty
::{
self
,
Ty
,
TyCtxt
,
TypeFoldable
,
GenericParamCount
,
GenericParamDefKind
,
ParamConst
};
use
crate
::
ty
::
print
::{
PrintC
ontext
,
Print
};
use
crate
::
ty
::
print
::{
PrintC
x
,
Print
};
use
crate
::
mir
::
interpret
::
ConstValue
;
use
std
::
cell
::
Cell
;
...
...
@@ -182,7 +182,7 @@ pub fn placeholder_highlight(&self, p: ty::PlaceholderRegion) -> Option<usize> {
macro_rules!
gen_display_debug_body
{
(
$with:path
)
=>
{
fn
fmt
(
&
self
,
f
:
&
mut
fmt
::
Formatter
<
'_
>
)
->
fmt
::
Result
{
let
mut
cx
=
PrintC
ontext
::
new
();
let
mut
cx
=
PrintC
x
::
new
();
$with
(
self
,
f
,
&
mut
cx
)
}
};
...
...
@@ -213,7 +213,7 @@ impl fmt::Debug for $target {
macro_rules!
gen_print_impl
{
(
(
$
(
$x:tt
)
+
)
$target:ty
,
(
$self:ident
,
$f:ident
,
$cx:ident
)
$disp:block
$dbg:block
)
=>
{
impl
<
$
(
$x
)
+>
Print
<
'tcx
>
for
$target
{
fn
print
<
F
:
fmt
::
Write
>
(
&
$self
,
$f
:
&
mut
F
,
$cx
:
&
mut
PrintC
ontext
)
->
fmt
::
Result
{
fn
print
<
F
:
fmt
::
Write
>
(
&
$self
,
$f
:
&
mut
F
,
$cx
:
&
mut
PrintC
x
)
->
fmt
::
Result
{
if
$cx
.is_debug
$dbg
else
$disp
}
...
...
@@ -221,7 +221,7 @@ fn print<F: fmt::Write>(&$self, $f: &mut F, $cx: &mut PrintContext) -> fmt::Resu
};
(
()
$target:ty
,
(
$self:ident
,
$f:ident
,
$cx:ident
)
$disp:block
$dbg:block
)
=>
{
impl
Print
<
'tcx
>
for
$target
{
fn
print
<
F
:
fmt
::
Write
>
(
&
$self
,
$f
:
&
mut
F
,
$cx
:
&
mut
PrintC
ontext
)
->
fmt
::
Result
{
fn
print
<
F
:
fmt
::
Write
>
(
&
$self
,
$f
:
&
mut
F
,
$cx
:
&
mut
PrintC
x
)
->
fmt
::
Result
{
if
$cx
.is_debug
$dbg
else
$disp
}
...
...
@@ -275,7 +275,7 @@ fn print<F: fmt::Write>(&$self, $f: &mut F, $cx: &mut PrintContext) -> fmt::Resu
};
}
impl
PrintC
ontext
{
impl
PrintC
x
{
fn
fn_sig
<
F
:
fmt
::
Write
>
(
&
mut
self
,
f
:
&
mut
F
,
inputs
:
&
[
Ty
<
'_
>
],
...
...
@@ -618,11 +618,11 @@ pub fn parameterized<F: fmt::Write>(f: &mut F,
did
:
DefId
,
projections
:
&
[
ty
::
ProjectionPredicate
<
'_
>
])
->
fmt
::
Result
{
PrintC
ontext
::
new
()
.parameterized
(
f
,
substs
,
did
,
projections
)
PrintC
x
::
new
()
.parameterized
(
f
,
substs
,
did
,
projections
)
}
impl
<
'a
,
'tcx
,
T
:
Print
<
'tcx
>>
Print
<
'tcx
>
for
&
'a
T
{
fn
print
<
F
:
fmt
::
Write
>
(
&
self
,
f
:
&
mut
F
,
cx
:
&
mut
PrintC
ontext
)
->
fmt
::
Result
{
fn
print
<
F
:
fmt
::
Write
>
(
&
self
,
f
:
&
mut
F
,
cx
:
&
mut
PrintC
x
)
->
fmt
::
Result
{
(
*
self
)
.print
(
f
,
cx
)
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录