Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
3e1cef70
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,发现更多精彩内容 >>
提交
3e1cef70
编写于
12月 19, 2018
作者:
E
Eduard-Mihai Burtescu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rustc: pass Option<&Substs> and Namespace around in ty::item_path.
上级
ed2be6fa
变更
26
隐藏空白更改
内联
并排
Showing
26 changed file
with
159 addition
and
94 deletion
+159
-94
src/librustc/ty/item_path.rs
src/librustc/ty/item_path.rs
+103
-34
src/librustc/util/ppaux.rs
src/librustc/util/ppaux.rs
+6
-14
src/librustc_codegen_utils/symbol_names.rs
src/librustc_codegen_utils/symbol_names.rs
+4
-1
src/librustdoc/clean/mod.rs
src/librustdoc/clean/mod.rs
+3
-2
src/test/pretty/issue-4264.pp
src/test/pretty/issue-4264.pp
+17
-17
src/test/ui/bad/bad-sized.stderr
src/test/ui/bad/bad-sized.stderr
+1
-1
src/test/ui/consts/miri_unleashed/feature-gate-unleash_the_miri_inside_of_you.stderr
...eashed/feature-gate-unleash_the_miri_inside_of_you.stderr
+1
-1
src/test/ui/hygiene/impl_items.rs
src/test/ui/hygiene/impl_items.rs
+1
-1
src/test/ui/hygiene/impl_items.stderr
src/test/ui/hygiene/impl_items.stderr
+1
-1
src/test/ui/issues/issue-17651.stderr
src/test/ui/issues/issue-17651.stderr
+1
-1
src/test/ui/issues/issue-22638.rs
src/test/ui/issues/issue-22638.rs
+1
-1
src/test/ui/issues/issue-22638.stderr
src/test/ui/issues/issue-22638.stderr
+1
-1
src/test/ui/issues/issue-24322.stderr
src/test/ui/issues/issue-24322.stderr
+1
-1
src/test/ui/issues/issue-29124.rs
src/test/ui/issues/issue-29124.rs
+1
-1
src/test/ui/issues/issue-29124.stderr
src/test/ui/issues/issue-29124.stderr
+1
-1
src/test/ui/issues/issue-37311-type-length-limit/issue-37311.stderr
...i/issues/issue-37311-type-length-limit/issue-37311.stderr
+1
-1
src/test/ui/issues/issue-39559-2.stderr
src/test/ui/issues/issue-39559-2.stderr
+2
-2
src/test/ui/privacy/associated-item-privacy-inherent.rs
src/test/ui/privacy/associated-item-privacy-inherent.rs
+3
-3
src/test/ui/privacy/associated-item-privacy-inherent.stderr
src/test/ui/privacy/associated-item-privacy-inherent.stderr
+3
-3
src/test/ui/privacy/private-inferred-type-3.rs
src/test/ui/privacy/private-inferred-type-3.rs
+1
-1
src/test/ui/privacy/private-inferred-type-3.stderr
src/test/ui/privacy/private-inferred-type-3.stderr
+1
-1
src/test/ui/privacy/private-inferred-type.rs
src/test/ui/privacy/private-inferred-type.rs
+1
-1
src/test/ui/privacy/private-inferred-type.stderr
src/test/ui/privacy/private-inferred-type.stderr
+1
-1
src/test/ui/qualified/qualified-path-params.stderr
src/test/ui/qualified/qualified-path-params.stderr
+1
-1
src/test/ui/symbol-names/impl1.rs
src/test/ui/symbol-names/impl1.rs
+1
-1
src/test/ui/symbol-names/impl1.stderr
src/test/ui/symbol-names/impl1.stderr
+1
-1
未找到文件。
src/librustc/ty/item_path.rs
浏览文件 @
3e1cef70
use
crate
::
hir
::
def
::
Namespace
;
use
crate
::
hir
::
map
::
DefPathData
;
use
crate
::
hir
::
def_id
::{
CrateNum
,
DefId
,
CRATE_DEF_INDEX
,
LOCAL_CRATE
};
use
crate
::
ty
::{
self
,
DefIdTree
,
Ty
,
TyCtxt
};
use
crate
::
ty
::
print
::
PrintCx
;
use
crate
::
ty
::
subst
::{
Subst
,
Substs
};
use
crate
::
middle
::
cstore
::{
ExternCrate
,
ExternCrateSource
};
use
ty
::
print
::
PrintCx
;
use
syntax
::
ast
;
use
syntax
::
symbol
::{
keywords
,
Symbol
};
...
...
@@ -54,18 +56,48 @@ pub fn with_crate_prefix<F: FnOnce() -> R, R>(f: F) -> R {
}
impl
<
'a
,
'gcx
,
'tcx
>
TyCtxt
<
'a
,
'gcx
,
'tcx
>
{
// HACK(eddyb) get rid of `item_path_str` and/or pass `Namespace` explicitly always
// (but also some things just print a `DefId` generally so maybe we need this?)
fn
guess_def_namespace
(
self
,
def_id
:
DefId
)
->
Namespace
{
match
self
.def_key
(
def_id
)
.disambiguated_data.data
{
DefPathData
::
ValueNs
(
..
)
|
DefPathData
::
EnumVariant
(
..
)
|
DefPathData
::
Field
(
..
)
|
DefPathData
::
AnonConst
|
DefPathData
::
ClosureExpr
|
DefPathData
::
StructCtor
=>
Namespace
::
ValueNS
,
DefPathData
::
MacroDef
(
..
)
=>
Namespace
::
MacroNS
,
_
=>
Namespace
::
TypeNS
,
}
}
/// Returns a string identifying this `DefId`. This string is
/// suitable for user output. It is relative to the current crate
/// root, unless with_forced_absolute_paths was used.
pub
fn
item_path_str
(
self
,
def_id
:
DefId
)
->
String
{
debug!
(
"item_path_str: def_id={:?}"
,
def_id
);
pub
fn
item_path_str_with_substs_and_ns
(
self
,
def_id
:
DefId
,
substs
:
Option
<&
Substs
<
'tcx
>>
,
ns
:
Namespace
,
)
->
String
{
debug!
(
"item_path_str: def_id={:?}, substs={:?}, ns={:?}"
,
def_id
,
substs
,
ns
);
if
FORCE_ABSOLUTE
.with
(|
force
|
force
.get
())
{
PrintCx
::
new
(
self
,
AbsolutePathPrinter
)
.print_item_path
(
def_id
)
PrintCx
::
new
(
self
,
AbsolutePathPrinter
)
.print_item_path
(
def_id
,
substs
,
ns
)
}
else
{
PrintCx
::
new
(
self
,
LocalPathPrinter
)
.print_item_path
(
def_id
)
PrintCx
::
new
(
self
,
LocalPathPrinter
)
.print_item_path
(
def_id
,
substs
,
ns
)
}
}
/// Returns a string identifying this def-id. This string is
/// suitable for user output. It is relative to the current crate
/// root, unless with_forced_absolute_paths was used.
pub
fn
item_path_str
(
self
,
def_id
:
DefId
)
->
String
{
let
ns
=
self
.guess_def_namespace
(
def_id
);
self
.item_path_str_with_substs_and_ns
(
def_id
,
None
,
ns
)
}
/// Returns a string identifying this local node-id.
pub
fn
node_path_str
(
self
,
id
:
ast
::
NodeId
)
->
String
{
self
.item_path_str
(
self
.hir
()
.local_def_id
(
id
))
...
...
@@ -75,13 +107,19 @@ pub fn node_path_str(self, id: ast::NodeId) -> String {
/// suitable for user output. It always begins with a crate identifier.
pub
fn
absolute_item_path_str
(
self
,
def_id
:
DefId
)
->
String
{
debug!
(
"absolute_item_path_str: def_id={:?}"
,
def_id
);
PrintCx
::
new
(
self
,
AbsolutePathPrinter
)
.print_item_path
(
def_id
)
let
ns
=
self
.guess_def_namespace
(
def_id
);
PrintCx
::
new
(
self
,
AbsolutePathPrinter
)
.print_item_path
(
def_id
,
None
,
ns
)
}
}
impl
<
P
:
ItemPathPrinter
>
PrintCx
<
'a
,
'gcx
,
'tcx
,
P
>
{
pub
fn
default_print_item_path
(
&
mut
self
,
def_id
:
DefId
)
->
P
::
Path
{
debug!
(
"default_print_item_path: def_id={:?}"
,
def_id
);
pub
fn
default_print_item_path
(
&
mut
self
,
def_id
:
DefId
,
substs
:
Option
<&
Substs
<
'tcx
>>
,
ns
:
Namespace
,
)
->
P
::
Path
{
debug!
(
"default_print_item_path: def_id={:?}, substs={:?}, ns={:?}"
,
def_id
,
substs
,
ns
);
let
key
=
self
.tcx
.def_key
(
def_id
);
debug!
(
"default_print_item_path: key={:?}"
,
key
);
match
key
.disambiguated_data.data
{
...
...
@@ -91,7 +129,7 @@ pub fn default_print_item_path(&mut self, def_id: DefId) -> P::Path {
}
DefPathData
::
Impl
=>
{
self
.print_impl_path
(
def_id
)
self
.print_impl_path
(
def_id
,
substs
,
ns
)
}
// Unclear if there is any value in distinguishing these.
...
...
@@ -117,18 +155,23 @@ pub fn default_print_item_path(&mut self, def_id: DefId) -> P::Path {
data
@
DefPathData
::
ImplTrait
|
data
@
DefPathData
::
GlobalMetaData
(
..
)
=>
{
let
parent_did
=
self
.tcx
.parent_def_id
(
def_id
)
.unwrap
();
let
path
=
self
.print_item_path
(
parent_did
);
let
path
=
self
.print_item_path
(
parent_did
,
None
,
ns
);
self
.path_append
(
path
,
&
data
.as_interned_str
()
.as_symbol
()
.as_str
())
},
DefPathData
::
StructCtor
=>
{
// present `X` instead of `X::{{constructor}}`
let
parent_def_id
=
self
.tcx
.parent_def_id
(
def_id
)
.unwrap
();
self
.print_item_path
(
parent_def_id
)
self
.print_item_path
(
parent_def_id
,
substs
,
ns
)
}
}
}
fn
default_print_impl_path
(
&
mut
self
,
impl_def_id
:
DefId
)
->
P
::
Path
{
fn
default_print_impl_path
(
&
mut
self
,
impl_def_id
:
DefId
,
substs
:
Option
<&
Substs
<
'tcx
>>
,
ns
:
Namespace
,
)
->
P
::
Path
{
debug!
(
"default_print_impl_path: impl_def_id={:?}"
,
impl_def_id
);
let
parent_def_id
=
self
.tcx
.parent_def_id
(
impl_def_id
)
.unwrap
();
...
...
@@ -137,13 +180,19 @@ fn default_print_impl_path(&mut self, impl_def_id: DefId) -> P::Path {
// users may find it useful. Currently, we omit the parent if
// the impl is either in the same module as the self-type or
// as the trait.
let
self_ty
=
self
.tcx
.type_of
(
impl_def_id
);
let
mut
self_ty
=
self
.tcx
.type_of
(
impl_def_id
);
if
let
Some
(
substs
)
=
substs
{
self_ty
=
self_ty
.subst
(
self
.tcx
,
substs
);
}
let
in_self_mod
=
match
characteristic_def_id_of_type
(
self_ty
)
{
None
=>
false
,
Some
(
ty_def_id
)
=>
self
.tcx
.parent_def_id
(
ty_def_id
)
==
Some
(
parent_def_id
),
};
let
impl_trait_ref
=
self
.tcx
.impl_trait_ref
(
impl_def_id
);
let
mut
impl_trait_ref
=
self
.tcx
.impl_trait_ref
(
impl_def_id
);
if
let
Some
(
substs
)
=
substs
{
impl_trait_ref
=
impl_trait_ref
.subst
(
self
.tcx
,
substs
);
}
let
in_trait_mod
=
match
impl_trait_ref
{
None
=>
false
,
Some
(
trait_ref
)
=>
self
.tcx
.parent_def_id
(
trait_ref
.def_id
)
==
Some
(
parent_def_id
),
...
...
@@ -153,7 +202,7 @@ fn default_print_impl_path(&mut self, impl_def_id: DefId) -> P::Path {
// If the impl is not co-located with either self-type or
// trait-type, then fallback to a format that identifies
// the module more clearly.
let
path
=
self
.print_item_path
(
parent_def_id
);
let
path
=
self
.print_item_path
(
parent_def_id
,
None
,
ns
);
if
let
Some
(
trait_ref
)
=
impl_trait_ref
{
return
self
.path_append
(
path
,
&
format!
(
"<impl {} for {}>"
,
trait_ref
,
self_ty
));
}
else
{
...
...
@@ -174,15 +223,14 @@ fn default_print_impl_path(&mut self, impl_def_id: DefId) -> P::Path {
// anything other than a simple path.
match
self_ty
.sty
{
ty
::
Adt
(
adt_def
,
substs
)
=>
{
// FIXME(eddyb) always print without <> here.
if
substs
.types
()
.next
()
.is_none
()
{
// ignore regions
self
.print_item_path
(
adt_def
.did
)
}
else
{
self
.path_impl
(
&
format!
(
"<{}>"
,
self_ty
))
}
// FIXME(eddyb) this should recurse to build the path piecewise.
// self.print_item_path(adt_def.did, Some(substs), ns)
let
mut
s
=
String
::
new
();
crate
::
util
::
ppaux
::
parameterized
(
&
mut
s
,
adt_def
.did
,
substs
,
ns
)
.unwrap
();
self
.path_impl
(
&
s
)
}
ty
::
Foreign
(
did
)
=>
self
.print_item_path
(
did
),
ty
::
Foreign
(
did
)
=>
self
.print_item_path
(
did
,
None
,
ns
),
ty
::
Bool
|
ty
::
Char
|
...
...
@@ -263,11 +311,21 @@ pub fn characteristic_def_id_of_type(ty: Ty<'_>) -> Option<DefId> {
pub
trait
ItemPathPrinter
:
Sized
{
type
Path
;
fn
print_item_path
(
self
:
&
mut
PrintCx
<
'_
,
'_
,
'_
,
Self
>
,
def_id
:
DefId
)
->
Self
::
Path
{
self
.default_print_item_path
(
def_id
)
fn
print_item_path
(
self
:
&
mut
PrintCx
<
'_
,
'_
,
'tcx
,
Self
>
,
def_id
:
DefId
,
substs
:
Option
<&
Substs
<
'tcx
>>
,
ns
:
Namespace
,
)
->
Self
::
Path
{
self
.default_print_item_path
(
def_id
,
substs
,
ns
)
}
fn
print_impl_path
(
self
:
&
mut
PrintCx
<
'_
,
'_
,
'_
,
Self
>
,
impl_def_id
:
DefId
)
->
Self
::
Path
{
self
.default_print_impl_path
(
impl_def_id
)
fn
print_impl_path
(
self
:
&
mut
PrintCx
<
'_
,
'_
,
'tcx
,
Self
>
,
impl_def_id
:
DefId
,
substs
:
Option
<&
Substs
<
'tcx
>>
,
ns
:
Namespace
,
)
->
Self
::
Path
{
self
.default_print_impl_path
(
impl_def_id
,
substs
,
ns
)
}
fn
path_crate
(
self
:
&
mut
PrintCx
<
'_
,
'_
,
'_
,
Self
>
,
cnum
:
CrateNum
)
->
Self
::
Path
;
...
...
@@ -312,6 +370,7 @@ impl LocalPathPrinter {
fn
try_print_visible_item_path
(
self
:
&
mut
PrintCx
<
'_
,
'_
,
'_
,
Self
>
,
def_id
:
DefId
,
ns
:
Namespace
,
)
->
Option
<<
Self
as
ItemPathPrinter
>
::
Path
>
{
debug!
(
"try_print_visible_item_path: def_id={:?}"
,
def_id
);
...
...
@@ -343,7 +402,7 @@ fn try_print_visible_item_path(
})
=>
{
debug!
(
"try_print_visible_item_path: def_id={:?}"
,
def_id
);
let
path
=
if
!
span
.is_dummy
()
{
self
.print_item_path
(
def_id
)
self
.print_item_path
(
def_id
,
None
,
ns
)
}
else
{
self
.path_crate
(
cnum
)
};
...
...
@@ -376,7 +435,7 @@ fn try_print_visible_item_path(
}
let
visible_parent
=
visible_parent_map
.get
(
&
def_id
)
.cloned
()
?
;
let
path
=
self
.try_print_visible_item_path
(
visible_parent
)
?
;
let
path
=
self
.try_print_visible_item_path
(
visible_parent
,
ns
)
?
;
let
actual_parent
=
self
.tcx
.parent
(
def_id
);
let
data
=
cur_def_key
.disambiguated_data.data
;
...
...
@@ -444,11 +503,21 @@ fn try_print_visible_item_path(
impl
ItemPathPrinter
for
LocalPathPrinter
{
type
Path
=
String
;
fn
print_item_path
(
self
:
&
mut
PrintCx
<
'_
,
'_
,
'_
,
Self
>
,
def_id
:
DefId
)
->
Self
::
Path
{
self
.try_print_visible_item_path
(
def_id
)
.unwrap_or_else
(||
self
.default_print_item_path
(
def_id
))
fn
print_item_path
(
self
:
&
mut
PrintCx
<
'_
,
'_
,
'tcx
,
Self
>
,
def_id
:
DefId
,
substs
:
Option
<&
Substs
<
'tcx
>>
,
ns
:
Namespace
,
)
->
Self
::
Path
{
self
.try_print_visible_item_path
(
def_id
,
ns
)
.unwrap_or_else
(||
self
.default_print_item_path
(
def_id
,
substs
,
ns
))
}
fn
print_impl_path
(
self
:
&
mut
PrintCx
<
'_
,
'_
,
'_
,
Self
>
,
impl_def_id
:
DefId
)
->
Self
::
Path
{
fn
print_impl_path
(
self
:
&
mut
PrintCx
<
'_
,
'_
,
'tcx
,
Self
>
,
impl_def_id
:
DefId
,
substs
:
Option
<&
Substs
<
'tcx
>>
,
ns
:
Namespace
,
)
->
Self
::
Path
{
// Always use types for non-local impls, where types are always
// available, and filename/line-number is mostly uninteresting.
let
use_types
=
!
impl_def_id
.is_local
()
||
{
...
...
@@ -463,12 +532,12 @@ fn print_impl_path(self: &mut PrintCx<'_, '_, '_, Self>, impl_def_id: DefId) ->
// only occur very early in the compiler pipeline.
// FIXME(eddyb) this should just be using `tcx.def_span(impl_def_id)`
let
parent_def_id
=
self
.tcx
.parent_def_id
(
impl_def_id
)
.unwrap
();
let
path
=
self
.print_item_path
(
parent_def_id
);
let
path
=
self
.print_item_path
(
parent_def_id
,
None
,
ns
);
let
span
=
self
.tcx
.def_span
(
impl_def_id
);
return
self
.path_append
(
path
,
&
format!
(
"<impl at {:?}>"
,
span
));
}
self
.default_print_impl_path
(
impl_def_id
)
self
.default_print_impl_path
(
impl_def_id
,
substs
,
ns
)
}
fn
path_crate
(
self
:
&
mut
PrintCx
<
'_
,
'_
,
'_
,
Self
>
,
cnum
:
CrateNum
)
->
Self
::
Path
{
...
...
src/librustc/util/ppaux.rs
浏览文件 @
3e1cef70
...
...
@@ -317,23 +317,15 @@ fn parameterized(
}
}
}
else
{
// Try to print `impl`s more like how you'd refer to their associated items.
// FIXME(eddyb) recurse through printing a path via `self`, instead
// instead of using the `tcx` method that produces a `String`.
print!
(
self
,
write
(
"{}"
,
self
.tcx
.item_path_str_with_substs_and_ns
(
def_id
,
Some
(
substs
),
ns
)))
?
;
// For impls, the above call already prints relevant generics args.
if
let
DefPathData
::
Impl
=
key
.disambiguated_data.data
{
if
let
Some
(
trait_ref
)
=
self
.tcx
.impl_trait_ref
(
def_id
)
{
// HACK(eddyb) this is in lieu of more specific disambiguation.
print!
(
self
,
write
(
"{}"
,
self
.tcx
.item_path_str
(
def_id
)))
?
;
let
trait_ref
=
trait_ref
.subst
(
self
.tcx
,
substs
);
print!
(
self
,
print_debug
(
trait_ref
))
?
;
}
else
{
let
self_ty
=
self
.tcx
.type_of
(
def_id
)
.subst
(
self
.tcx
,
substs
);
// FIXME(eddyb) omit the <> where possible.
print!
(
self
,
write
(
"<"
),
print
(
self_ty
),
write
(
">"
))
?
;
}
return
Ok
(());
}
print!
(
self
,
write
(
"{}"
,
self
.tcx
.item_path_str
(
def_id
)))
?
;
}
let
mut
empty
=
true
;
...
...
src/librustc_codegen_utils/symbol_names.rs
浏览文件 @
3e1cef70
...
...
@@ -87,6 +87,7 @@
//! virtually impossible. Thus, symbol hash generation exclusively relies on
//! DefPaths which are much more robust in the face of changes to the code base.
use
rustc
::
hir
::
def
::
Namespace
;
use
rustc
::
hir
::
def_id
::{
CrateNum
,
DefId
,
LOCAL_CRATE
};
use
rustc
::
hir
::
Node
;
use
rustc
::
hir
::
CodegenFnAttrFlags
;
...
...
@@ -225,7 +226,9 @@ fn get_symbol_hash<'a, 'tcx>(
fn
def_symbol_name
<
'a
,
'tcx
>
(
tcx
:
TyCtxt
<
'a
,
'tcx
,
'tcx
>
,
def_id
:
DefId
)
->
ty
::
SymbolName
{
item_path
::
with_forced_absolute_paths
(||
{
PrintCx
::
new
(
tcx
,
SymbolPathPrinter
)
.print_item_path
(
def_id
)
.into_interned
()
PrintCx
::
new
(
tcx
,
SymbolPathPrinter
)
.print_item_path
(
def_id
,
None
,
Namespace
::
ValueNS
)
.into_interned
()
})
}
...
...
src/librustdoc/clean/mod.rs
浏览文件 @
3e1cef70
...
...
@@ -18,7 +18,7 @@
use
rustc
::
middle
::
stability
;
use
rustc
::
mir
::
interpret
::
GlobalId
;
use
rustc
::
hir
::{
self
,
GenericArg
,
HirVec
};
use
rustc
::
hir
::
def
::{
self
,
Def
,
CtorKind
};
use
rustc
::
hir
::
def
::{
self
,
Def
,
CtorKind
,
Namespace
};
use
rustc
::
hir
::
def_id
::{
CrateNum
,
DefId
,
CRATE_DEF_INDEX
,
LOCAL_CRATE
};
use
rustc
::
ty
::
subst
::{
InternalSubsts
,
SubstsRef
};
use
rustc
::
ty
::{
self
,
TyCtxt
,
Region
,
RegionVid
,
Ty
,
AdtKind
};
...
...
@@ -4249,7 +4249,8 @@ fn path_append(
}
}
let
names
=
PrintCx
::
new
(
tcx
,
AbsolutePathPrinter
)
.print_item_path
(
def_id
);
let
names
=
PrintCx
::
new
(
tcx
,
AbsolutePathPrinter
)
.print_item_path
(
def_id
,
None
,
Namespace
::
TypeNS
);
hir
::
Path
{
span
:
DUMMY_SP
,
...
...
src/test/pretty/issue-4264.pp
浏览文件 @
3e1cef70
...
...
@@ -32,27 +32,27 @@ pub fn bar() ({
((
$crate::fmt::format
as
for
<
'r> fn(std::fmt::Arguments<'
r
>
)
->
std::string::String
{
std::fmt::format
})(((
<
$crate::fmt::Arguments
>
::
new_v1
as
fn
(
&
[
&
str
],
&
[
std::fmt::ArgumentV1
<
'_>]) -> std::fmt::Arguments<'
_
>
{
std::fmt::Arguments
<
'_>::new_v1})((&([("test"
fn
(
&
[
&
str
],
&
[
std::fmt::ArgumentV1
<
'_>]) -> std::fmt::Arguments<'
_
>
{
std::fmt::Arguments
::
<
'_>::new_v1})((&([("test"
as
&'
static
str
)]
as
&'
static
str
)]
[
&
str
;
1
])
as
[
&
str
;
1
])
as
&
[
&
str
;
1
]),
(
&
(
match
(()
&
[
&
str
;
1
]),
(
&
(
match
(()
as
())
{
()
=>
([]
as
())
{
()
=>
([]
as
[
std::fmt::ArgumentV1
<
'_>; 0]),
}
[
std::fmt::ArgumentV1
<
'_>; 0]),
}
as
[std::fmt::ArgumentV1<'
_
>
;
0
])
as
[std::fmt::ArgumentV1<'
_
>
;
0
])
as
&
[
std::fmt::ArgumentV1
<
'_>; 0]))
&
[
std::fmt::ArgumentV1
<
'_>; 0]))
as
std::fmt::Arguments<'
_
>
))
as
std::string::String
);
...
...
src/test/ui/bad/bad-sized.stderr
浏览文件 @
3e1cef70
...
...
@@ -22,7 +22,7 @@ LL | let x: Vec<Trait + Sized> = Vec::new();
|
= help: the trait `std::marker::Sized` is not implemented for `dyn Trait`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: required by `
<std::vec::Vec<T>
>::new`
= note: required by `
std::vec::Vec::<T
>::new`
error: aborting due to 3 previous errors
...
...
src/test/ui/consts/miri_unleashed/feature-gate-unleash_the_miri_inside_of_you.stderr
浏览文件 @
3e1cef70
...
...
@@ -4,7 +4,7 @@ error[E0493]: destructors cannot be evaluated at compile-time
LL | const F: u32 = (U::X, 42).1;
| ^^^^^^^^^^ constants cannot evaluate destructors
error: `
<std::vec::Vec<T>
>::new` is not yet stable as a const fn
error: `
std::vec::Vec::<T
>::new` is not yet stable as a const fn
--> $DIR/feature-gate-unleash_the_miri_inside_of_you.rs:18:25
|
LL | const X: Vec<u32> = Vec::new();
...
...
src/test/ui/hygiene/impl_items.rs
浏览文件 @
3e1cef70
...
...
@@ -9,7 +9,7 @@ fn f(&self) {}
}
pub
macro
m
()
{
let
_
:
()
=
S
.f
();
//~ ERROR type `for<'r> fn(&'r foo::S) {
<foo::S>
::f}` is private
let
_
:
()
=
S
.f
();
//~ ERROR type `for<'r> fn(&'r foo::S) {
foo::S
::f}` is private
}
}
...
...
src/test/ui/hygiene/impl_items.stderr
浏览文件 @
3e1cef70
error: type `for<'r> fn(&'r foo::S) {
<foo::S>
::f}` is private
error: type `for<'r> fn(&'r foo::S) {
foo::S
::f}` is private
--> $DIR/impl_items.rs:12:23
|
LL | let _: () = S.f();
...
...
src/test/ui/issues/issue-17651.stderr
浏览文件 @
3e1cef70
...
...
@@ -6,7 +6,7 @@ LL | (|| Box::new(*(&[0][..])))();
|
= help: the trait `std::marker::Sized` is not implemented for `[{integer}]`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: required by `
<std::boxed::Box<T>
>::new`
= note: required by `
std::boxed::Box::<T
>::new`
error: aborting due to previous error
...
...
src/test/ui/issues/issue-22638.rs
浏览文件 @
3e1cef70
...
...
@@ -50,7 +50,7 @@ pub fn matches<F: Fn()>(&self, f: &F) {
impl
D
{
pub
fn
matches
<
F
:
Fn
()
>
(
&
self
,
f
:
&
F
)
{
//~^ ERROR reached the type-length limit while instantiating `
<D>
::matches::<[closure
//~^ ERROR reached the type-length limit while instantiating `
D
::matches::<[closure
let
&
D
(
ref
a
)
=
self
;
a
.matches
(
f
)
}
...
...
src/test/ui/issues/issue-22638.stderr
浏览文件 @
3e1cef70
error: reached the type-length limit while instantiating `
<D>
::matches::$CLOSURE`
error: reached the type-length limit while instantiating `
D
::matches::$CLOSURE`
--> $DIR/issue-22638.rs:52:5
|
LL | / pub fn matches<F: Fn()>(&self, f: &F) {
...
...
src/test/ui/issues/issue-24322.stderr
浏览文件 @
3e1cef70
...
...
@@ -5,7 +5,7 @@ LL | let x: &fn(&B) -> u32 = &B::func;
| ^^^^^^^^ expected fn pointer, found fn item
|
= note: expected type `&for<'r> fn(&'r B) -> u32`
found type `&for<'r> fn(&'r B) -> u32 {
<B>
::func}`
found type `&for<'r> fn(&'r B) -> u32 {
B
::func}`
error: aborting due to previous error
...
...
src/test/ui/issues/issue-29124.rs
浏览文件 @
3e1cef70
...
...
@@ -13,7 +13,7 @@ fn func() -> Ret {
fn
main
()
{
Obj
::
func
.x
();
//~^ ERROR no method named `x` found for type `fn() -> Ret {
<Obj>
::func}` in the current scope
//~^ ERROR no method named `x` found for type `fn() -> Ret {
Obj
::func}` in the current scope
func
.x
();
//~^ ERROR no method named `x` found for type `fn() -> Ret {func}` in the current scope
}
src/test/ui/issues/issue-29124.stderr
浏览文件 @
3e1cef70
error[E0599]: no method named `x` found for type `fn() -> Ret {
<Obj>
::func}` in the current scope
error[E0599]: no method named `x` found for type `fn() -> Ret {
Obj
::func}` in the current scope
--> $DIR/issue-29124.rs:15:15
|
LL | Obj::func.x();
...
...
src/test/ui/issues/issue-37311-type-length-limit/issue-37311.stderr
浏览文件 @
3e1cef70
error: reached the type-length limit while instantiating `<
T as Foo><(&(&(&(&(&(&(&(&(&(&(&(&(&(&(&(&(&(&(&(), &()), &(&()
...`
error: reached the type-length limit while instantiating `<
(&(&(&(&(&(&(&(&(&(&(&(&(&(&(&(&(&(&(&(), &()), &(&(), &())), &
...`
--> $DIR/issue-37311.rs:13:5
|
LL | / fn recurse(&self) {
...
...
src/test/ui/issues/issue-39559-2.stderr
浏览文件 @
3e1cef70
...
...
@@ -8,7 +8,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/issue-39559-2.rs:14:24
|
LL | let array: [usize; Dim3::dim()]
| ^^^^^^^^^^^ calling non-const function `<Dim3 as Dim>
<Dim3 as Dim>
::dim`
| ^^^^^^^^^^^ calling non-const function `<Dim3 as Dim>::dim`
error[E0015]: calls in constants are limited to constant functions, tuple structs and tuple variants
--> $DIR/issue-39559-2.rs:17:15
...
...
@@ -20,7 +20,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/issue-39559-2.rs:17:15
|
LL | = [0; Dim3::dim()];
| ^^^^^^^^^^^ calling non-const function `<Dim3 as Dim>
<Dim3 as Dim>
::dim`
| ^^^^^^^^^^^ calling non-const function `<Dim3 as Dim>::dim`
error: aborting due to 4 previous errors
...
...
src/test/ui/privacy/associated-item-privacy-inherent.rs
浏览文件 @
3e1cef70
...
...
@@ -11,11 +11,11 @@ fn method(&self) {}
pub
macro
mac
()
{
let
value
=
Pub
::
method
;
//~^ ERROR type `for<'r> fn(&'r priv_nominal::Pub) {
<priv_nominal::Pub>
::method}` is private
//~^ ERROR type `for<'r> fn(&'r priv_nominal::Pub) {
priv_nominal::Pub
::method}` is private
value
;
//~^ ERROR type `for<'r> fn(&'r priv_nominal::Pub) {
<priv_nominal::Pub>
::method}` is private
//~^ ERROR type `for<'r> fn(&'r priv_nominal::Pub) {
priv_nominal::Pub
::method}` is private
Pub
.method
();
//~^ ERROR type `for<'r> fn(&'r priv_nominal::Pub) {
<priv_nominal::Pub>
::method}` is private
//~^ ERROR type `for<'r> fn(&'r priv_nominal::Pub) {
priv_nominal::Pub
::method}` is private
Pub
::
CONST
;
//~^ ERROR associated constant `CONST` is private
// let _: Pub::AssocTy;
...
...
src/test/ui/privacy/associated-item-privacy-inherent.stderr
浏览文件 @
3e1cef70
error: type `for<'r> fn(&'r priv_nominal::Pub) {
<priv_nominal::Pub>
::method}` is private
error: type `for<'r> fn(&'r priv_nominal::Pub) {
priv_nominal::Pub
::method}` is private
--> $DIR/associated-item-privacy-inherent.rs:13:21
|
LL | let value = Pub::method;
...
...
@@ -7,7 +7,7 @@ LL | let value = Pub::method;
LL | priv_nominal::mac!();
| --------------------- in this macro invocation
error: type `for<'r> fn(&'r priv_nominal::Pub) {
<priv_nominal::Pub>
::method}` is private
error: type `for<'r> fn(&'r priv_nominal::Pub) {
priv_nominal::Pub
::method}` is private
--> $DIR/associated-item-privacy-inherent.rs:15:9
|
LL | value;
...
...
@@ -16,7 +16,7 @@ LL | value;
LL | priv_nominal::mac!();
| --------------------- in this macro invocation
error: type `for<'r> fn(&'r priv_nominal::Pub) {
<priv_nominal::Pub>
::method}` is private
error: type `for<'r> fn(&'r priv_nominal::Pub) {
priv_nominal::Pub
::method}` is private
--> $DIR/associated-item-privacy-inherent.rs:17:13
|
LL | Pub.method();
...
...
src/test/ui/privacy/private-inferred-type-3.rs
浏览文件 @
3e1cef70
...
...
@@ -6,7 +6,7 @@
// error-pattern:type `fn() {<u8 as ext::PrivTrait>::method}` is private
// error-pattern:type `fn(u8) -> ext::PrivTupleStruct {ext::PrivTupleStruct}` is private
// error-pattern:type `fn(u8) -> ext::PubTupleStruct {ext::PubTupleStruct}` is private
// error-pattern:type `for<'r> fn(&'r ext::Pub<u8>) {
<ext::Pub<u8>
>::priv_method}` is private
// error-pattern:type `for<'r> fn(&'r ext::Pub<u8>) {
ext::Pub::<u8
>::priv_method}` is private
#![feature(decl_macro)]
...
...
src/test/ui/privacy/private-inferred-type-3.stderr
浏览文件 @
3e1cef70
...
...
@@ -46,7 +46,7 @@ LL | ext::m!();
|
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
error: type `for<'r> fn(&'r ext::Pub<u8>) {
<ext::Pub<u8>
>::priv_method}` is private
error: type `for<'r> fn(&'r ext::Pub<u8>) {
ext::Pub::<u8
>::priv_method}` is private
--> $DIR/private-inferred-type-3.rs:16:5
|
LL | ext::m!();
...
...
src/test/ui/privacy/private-inferred-type.rs
浏览文件 @
3e1cef70
...
...
@@ -47,7 +47,7 @@ impl TraitWithAssocConst for Priv {}
PubTupleStruct
;
//~^ ERROR type `fn(u8) -> m::PubTupleStruct {m::PubTupleStruct}` is private
Pub
(
0u8
)
.priv_method
();
//~^ ERROR type `for<'r> fn(&'r m::Pub<u8>) {
<m::Pub<u8>
>::priv_method}` is private
//~^ ERROR type `for<'r> fn(&'r m::Pub<u8>) {
m::Pub::<u8
>::priv_method}` is private
}
trait
Trait
{}
...
...
src/test/ui/privacy/private-inferred-type.stderr
浏览文件 @
3e1cef70
...
...
@@ -151,7 +151,7 @@ LL | PubTupleStruct;
LL | m::m!();
| -------- in this macro invocation
error: type `for<'r> fn(&'r m::Pub<u8>) {
<m::Pub<u8>
>::priv_method}` is private
error: type `for<'r> fn(&'r m::Pub<u8>) {
m::Pub::<u8
>::priv_method}` is private
--> $DIR/private-inferred-type.rs:49:18
|
LL | Pub(0u8).priv_method();
...
...
src/test/ui/qualified/qualified-path-params.stderr
浏览文件 @
3e1cef70
...
...
@@ -11,7 +11,7 @@ LL | 0 ..= <S as Tr>::A::f::<u8> => {}
| ^^^^^^^^^^^^^^^^^^^^^ ranges require char or numeric types
|
= note: start type: {integer}
= note: end type: fn() {
<S>
::f::<u8>}
= note: end type: fn() {
S
::f::<u8>}
error: aborting due to 2 previous errors
...
...
src/test/ui/symbol-names/impl1.rs
浏览文件 @
3e1cef70
...
...
@@ -5,7 +5,7 @@ mod foo {
pub
struct
Foo
{
x
:
u32
}
impl
Foo
{
#[rustc_symbol_name]
//~ ERROR _ZN
5impl13foo3
Foo3bar
#[rustc_symbol_name]
//~ ERROR _ZN
15impl1..foo..
Foo3bar
#[rustc_item_path]
//~ ERROR item-path(foo::Foo::bar)
fn
bar
()
{
}
}
...
...
src/test/ui/symbol-names/impl1.stderr
浏览文件 @
3e1cef70
error: symbol-name(_ZN
5impl13foo3
Foo3bar17hc487d6ec13fe9124E)
error: symbol-name(_ZN
15impl1..foo..
Foo3bar17hc487d6ec13fe9124E)
--> $DIR/impl1.rs:8:9
|
LL | #[rustc_symbol_name]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录