Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
60f969a4
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,发现更多精彩内容 >>
提交
60f969a4
编写于
2月 15, 2022
作者:
E
est31
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Adopt let_else in even more places
上级
3cfa4def
变更
26
隐藏空白更改
内联
并排
Showing
26 changed file
with
50 addition
and
104 deletion
+50
-104
compiler/rustc_borrowck/src/diagnostics/bound_region_errors.rs
...ler/rustc_borrowck/src/diagnostics/bound_region_errors.rs
+2
-4
compiler/rustc_borrowck/src/diagnostics/mod.rs
compiler/rustc_borrowck/src/diagnostics/mod.rs
+3
-4
compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs
compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs
+2
-4
compiler/rustc_builtin_macros/src/concat_bytes.rs
compiler/rustc_builtin_macros/src/concat_bytes.rs
+1
-3
compiler/rustc_builtin_macros/src/lib.rs
compiler/rustc_builtin_macros/src/lib.rs
+1
-0
compiler/rustc_codegen_ssa/src/back/link.rs
compiler/rustc_codegen_ssa/src/back/link.rs
+11
-10
compiler/rustc_codegen_ssa/src/back/metadata.rs
compiler/rustc_codegen_ssa/src/back/metadata.rs
+2
-6
compiler/rustc_index/src/bit_set.rs
compiler/rustc_index/src/bit_set.rs
+1
-5
compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs
...r/rustc_infer/src/infer/error_reporting/need_type_info.rs
+2
-4
compiler/rustc_metadata/src/rmeta/encoder.rs
compiler/rustc_metadata/src/rmeta/encoder.rs
+1
-1
compiler/rustc_middle/src/dep_graph/mod.rs
compiler/rustc_middle/src/dep_graph/mod.rs
+1
-1
compiler/rustc_mir_transform/src/generator.rs
compiler/rustc_mir_transform/src/generator.rs
+1
-3
compiler/rustc_mir_transform/src/normalize_array_len.rs
compiler/rustc_mir_transform/src/normalize_array_len.rs
+1
-6
compiler/rustc_monomorphize/src/collector.rs
compiler/rustc_monomorphize/src/collector.rs
+1
-3
compiler/rustc_monomorphize/src/util.rs
compiler/rustc_monomorphize/src/util.rs
+2
-4
compiler/rustc_parse/src/lexer/mod.rs
compiler/rustc_parse/src/lexer/mod.rs
+2
-6
compiler/rustc_parse/src/lib.rs
compiler/rustc_parse/src/lib.rs
+1
-0
compiler/rustc_resolve/src/late/diagnostics.rs
compiler/rustc_resolve/src/late/diagnostics.rs
+4
-8
compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs
...trait_selection/src/traits/error_reporting/suggestions.rs
+3
-7
compiler/rustc_typeck/src/check/expr.rs
compiler/rustc_typeck/src/check/expr.rs
+1
-4
src/librustdoc/clean/simplify.rs
src/librustdoc/clean/simplify.rs
+1
-3
src/librustdoc/html/markdown.rs
src/librustdoc/html/markdown.rs
+1
-3
src/librustdoc/html/render/print_item.rs
src/librustdoc/html/render/print_item.rs
+1
-3
src/librustdoc/passes/collect_intra_doc_links.rs
src/librustdoc/passes/collect_intra_doc_links.rs
+2
-6
src/librustdoc/scrape_examples.rs
src/librustdoc/scrape_examples.rs
+1
-3
src/librustdoc/visit_ast.rs
src/librustdoc/visit_ast.rs
+1
-3
未找到文件。
compiler/rustc_borrowck/src/diagnostics/bound_region_errors.rs
浏览文件 @
60f969a4
...
...
@@ -142,11 +142,9 @@ fn report_error(
let
tcx
=
mbcx
.infcx.tcx
;
let
base_universe
=
self
.base_universe
();
let
adjusted_universe
=
if
let
Some
(
adjusted
)
=
let
Some
(
adjusted_universe
)
=
placeholder
.universe
.as_u32
()
.checked_sub
(
base_universe
.as_u32
())
{
adjusted
}
else
{
else
{
mbcx
.buffer_error
(
self
.fallback_error
(
tcx
,
cause
.span
));
return
;
};
...
...
compiler/rustc_borrowck/src/diagnostics/mod.rs
浏览文件 @
60f969a4
...
...
@@ -892,15 +892,14 @@ pub(super) fn move_spans(
kind
:
TerminatorKind
::
Call
{
fn_span
,
from_hir_call
,
..
},
..
})
=
&
self
.body
[
location
.block
]
.terminator
{
let
(
method_did
,
method_substs
)
=
if
let
Some
(
info
)
=
let
Some
((
method_did
,
method_substs
)
)
=
rustc_const_eval
::
util
::
find_self_call
(
self
.infcx.tcx
,
&
self
.body
,
target_temp
,
location
.block
,
)
{
info
}
else
{
)
else
{
return
normal_ret
;
};
...
...
compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs
浏览文件 @
60f969a4
...
...
@@ -639,11 +639,9 @@ fn is_error_in_trait(&self, local: Local) -> (bool, Option<Span>) {
let
hir_map
=
self
.infcx.tcx
.hir
();
let
my_def
=
self
.body.source
.def_id
();
let
my_hir
=
hir_map
.local_def_id_to_hir_id
(
my_def
.as_local
()
.unwrap
());
let
td
=
if
let
Some
(
a
)
=
let
Some
(
td
)
=
self
.infcx.tcx
.impl_of_method
(
my_def
)
.and_then
(|
x
|
self
.infcx.tcx
.trait_id_of_impl
(
x
))
{
a
}
else
{
else
{
return
(
false
,
None
);
};
(
...
...
compiler/rustc_builtin_macros/src/concat_bytes.rs
浏览文件 @
60f969a4
...
...
@@ -6,9 +6,7 @@
/// Emits errors for literal expressions that are invalid inside and outside of an array.
fn
invalid_type_err
(
cx
:
&
mut
base
::
ExtCtxt
<
'_
>
,
expr
:
&
P
<
rustc_ast
::
Expr
>
,
is_nested
:
bool
)
{
let
lit
=
if
let
ast
::
ExprKind
::
Lit
(
lit
)
=
&
expr
.kind
{
lit
}
else
{
let
ast
::
ExprKind
::
Lit
(
lit
)
=
&
expr
.kind
else
{
unreachable!
();
};
match
lit
.kind
{
...
...
compiler/rustc_builtin_macros/src/lib.rs
浏览文件 @
60f969a4
...
...
@@ -9,6 +9,7 @@
#![feature(decl_macro)]
#![feature(is_sorted)]
#![feature(nll)]
#![feature(let_else)]
#![feature(proc_macro_internals)]
#![feature(proc_macro_quote)]
#![recursion_limit
=
"256"
]
...
...
compiler/rustc_codegen_ssa/src/back/link.rs
浏览文件 @
60f969a4
...
...
@@ -216,17 +216,18 @@ pub fn each_linked_rlib(
}
let
name
=
&
info
.crate_name
[
&
cnum
];
let
used_crate_source
=
&
info
.used_crate_source
[
&
cnum
];
let
path
=
if
let
Some
((
path
,
_
))
=
&
used_crate_source
.rlib
{
path
}
else
if
used_crate_source
.rmeta
.is_some
()
{
return
Err
(
format!
(
"could not find rlib for: `{}`, found rmeta (metadata) file"
,
name
));
if
let
Some
((
path
,
_
))
=
&
used_crate_source
.rlib
{
f
(
cnum
,
&
path
);
}
else
{
return
Err
(
format!
(
"could not find rlib for: `{}`"
,
name
));
};
f
(
cnum
,
&
path
);
if
used_crate_source
.rmeta
.is_some
()
{
return
Err
(
format!
(
"could not find rlib for: `{}`, found rmeta (metadata) file"
,
name
));
}
else
{
return
Err
(
format!
(
"could not find rlib for: `{}`"
,
name
));
}
}
}
Ok
(())
}
...
...
compiler/rustc_codegen_ssa/src/back/metadata.rs
浏览文件 @
60f969a4
...
...
@@ -200,9 +200,7 @@ fn create_object_file(sess: &Session) -> Option<write::Object<'static>> {
// `SHF_EXCLUDE` flag we can set on sections in an object file to get
// automatically removed from the final output.
pub
fn
create_rmeta_file
(
sess
:
&
Session
,
metadata
:
&
[
u8
])
->
Vec
<
u8
>
{
let
mut
file
=
if
let
Some
(
file
)
=
create_object_file
(
sess
)
{
file
}
else
{
let
Some
(
mut
file
)
=
create_object_file
(
sess
)
else
{
// This is used to handle all "other" targets. This includes targets
// in two categories:
//
...
...
@@ -262,9 +260,7 @@ pub fn create_compressed_metadata_file(
)
->
Vec
<
u8
>
{
let
mut
compressed
=
rustc_metadata
::
METADATA_HEADER
.to_vec
();
FrameEncoder
::
new
(
&
mut
compressed
)
.write_all
(
metadata
.raw_data
())
.unwrap
();
let
mut
file
=
if
let
Some
(
file
)
=
create_object_file
(
sess
)
{
file
}
else
{
let
Some
(
mut
file
)
=
create_object_file
(
sess
)
else
{
return
compressed
.to_vec
();
};
let
section
=
file
.add_section
(
...
...
compiler/rustc_index/src/bit_set.rs
浏览文件 @
60f969a4
...
...
@@ -852,11 +852,7 @@ pub fn insert_range(&mut self, elems: impl RangeBounds<T>) {
Bound
::
Excluded
(
end
)
=>
end
.index
(),
Bound
::
Unbounded
=>
self
.domain_size
()
-
1
,
};
let
len
=
if
let
Some
(
l
)
=
end
.checked_sub
(
start
)
{
l
}
else
{
return
;
};
let
Some
(
len
)
=
end
.checked_sub
(
start
)
else
{
return
};
match
self
{
HybridBitSet
::
Sparse
(
sparse
)
if
sparse
.len
()
+
len
<
SPARSE_MAX
=>
{
// The set is sparse and has space for `elems`.
...
...
compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs
浏览文件 @
60f969a4
...
...
@@ -553,8 +553,7 @@ pub fn emit_inference_failure_err(
let
ty_msg
=
match
(
local_visitor
.found_node_ty
,
local_visitor
.found_exact_method_call
)
{
(
_
,
Some
(
_
))
=>
String
::
new
(),
(
Some
(
ty
),
_
)
if
ty
.is_closure
()
=>
{
let
substs
=
if
let
ty
::
Closure
(
_
,
substs
)
=
*
ty
.kind
()
{
substs
}
else
{
unreachable!
()
};
let
ty
::
Closure
(
_
,
substs
)
=
*
ty
.kind
()
else
{
unreachable!
()
};
let
fn_sig
=
substs
.as_closure
()
.sig
();
let
args
=
closure_args
(
&
fn_sig
);
let
ret
=
fn_sig
.output
()
.skip_binder
()
.to_string
();
...
...
@@ -597,8 +596,7 @@ pub fn emit_inference_failure_err(
let
param_type
=
arg_data
.kind
.descr
();
let
suffix
=
match
local_visitor
.found_node_ty
{
Some
(
ty
)
if
ty
.is_closure
()
=>
{
let
substs
=
if
let
ty
::
Closure
(
_
,
substs
)
=
*
ty
.kind
()
{
substs
}
else
{
unreachable!
()
};
let
ty
::
Closure
(
_
,
substs
)
=
*
ty
.kind
()
else
{
unreachable!
()
};
let
fn_sig
=
substs
.as_closure
()
.sig
();
let
ret
=
fn_sig
.output
()
.skip_binder
()
.to_string
();
...
...
compiler/rustc_metadata/src/rmeta/encoder.rs
浏览文件 @
60f969a4
...
...
@@ -982,7 +982,7 @@ fn encode_def_ids(&mut self) {
for
local_id
in
hir
.iter_local_def_id
()
{
let
def_id
=
local_id
.to_def_id
();
let
def_kind
=
tcx
.opt_def_kind
(
local_id
);
let
def_kind
=
if
let
Some
(
def_kind
)
=
def_kind
{
def_kind
}
else
{
continue
};
let
Some
(
def_kind
)
=
def_kind
else
{
continue
};
record!
(
self
.tables.def_kind
[
def_id
]
<-
match
def_kind
{
// Replace Ctor by the enclosing object to avoid leaking details in children crates.
DefKind
::
Ctor
(
CtorOf
::
Struct
,
_
)
=>
DefKind
::
Struct
,
...
...
compiler/rustc_middle/src/dep_graph/mod.rs
浏览文件 @
60f969a4
...
...
@@ -61,7 +61,7 @@ fn read_deps<OP>(op: OP)
OP
:
for
<
'a
>
FnOnce
(
TaskDepsRef
<
'a
>
),
{
ty
::
tls
::
with_context_opt
(|
icx
|
{
let
icx
=
if
let
Some
(
icx
)
=
icx
{
icx
}
else
{
return
};
let
Some
(
icx
)
=
icx
else
{
return
};
op
(
icx
.task_deps
)
})
}
...
...
compiler/rustc_mir_transform/src/generator.rs
浏览文件 @
60f969a4
...
...
@@ -1241,9 +1241,7 @@ fn phase_change(&self) -> Option<MirPhase> {
}
fn
run_pass
(
&
self
,
tcx
:
TyCtxt
<
'tcx
>
,
body
:
&
mut
Body
<
'tcx
>
)
{
let
yield_ty
=
if
let
Some
(
yield_ty
)
=
body
.yield_ty
()
{
yield_ty
}
else
{
let
Some
(
yield_ty
)
=
body
.yield_ty
()
else
{
// This only applies to generators
return
;
};
...
...
compiler/rustc_mir_transform/src/normalize_array_len.rs
浏览文件 @
60f969a4
...
...
@@ -211,12 +211,7 @@ fn normalize_array_len_call<'tcx>(
let
Some
(
local
)
=
place
.as_local
()
else
{
return
};
match
operand
{
Operand
::
Copy
(
place
)
|
Operand
::
Move
(
place
)
=>
{
let
operand_local
=
if
let
Some
(
local
)
=
place
.local_or_deref_local
()
{
local
}
else
{
return
;
};
let
Some
(
operand_local
)
=
place
.local_or_deref_local
()
else
{
return
;
};
if
!
interesting_locals
.contains
(
operand_local
)
{
return
;
}
...
...
compiler/rustc_monomorphize/src/collector.rs
浏览文件 @
60f969a4
...
...
@@ -947,9 +947,7 @@ fn visit_instance_use<'tcx>(
/// Returns `true` if we should codegen an instance in the local crate, or returns `false` if we
/// can just link to the upstream crate and therefore don't need a mono item.
fn
should_codegen_locally
<
'tcx
>
(
tcx
:
TyCtxt
<
'tcx
>
,
instance
:
&
Instance
<
'tcx
>
)
->
bool
{
let
def_id
=
if
let
Some
(
def_id
)
=
instance
.def
.def_id_if_not_guaranteed_local_codegen
()
{
def_id
}
else
{
let
Some
(
def_id
)
=
instance
.def
.def_id_if_not_guaranteed_local_codegen
()
else
{
return
true
;
};
...
...
compiler/rustc_monomorphize/src/util.rs
浏览文件 @
60f969a4
...
...
@@ -8,13 +8,11 @@
/// During the same compile all closures dump the information in the same file
/// "closure_profile_XXXXX.csv", which is created in the directory where the compiler is invoked.
crate
fn
dump_closure_profile
<
'tcx
>
(
tcx
:
TyCtxt
<
'tcx
>
,
closure_instance
:
Instance
<
'tcx
>
)
{
let
mut
file
=
if
let
Ok
(
file
)
=
OpenOptions
::
new
()
let
Ok
(
mut
file
)
=
OpenOptions
::
new
()
.create
(
true
)
.append
(
true
)
.open
(
&
format!
(
"closure_profile_{}.csv"
,
std
::
process
::
id
()))
{
file
}
else
{
else
{
eprintln!
(
"Cound't open file for writing closure profile"
);
return
;
};
...
...
compiler/rustc_parse/src/lexer/mod.rs
浏览文件 @
60f969a4
...
...
@@ -158,9 +158,7 @@ fn cook_lexer_token(&self, token: rustc_lexer::TokenKind, start: BytePos) -> Opt
Some
(
match
token
{
rustc_lexer
::
TokenKind
::
LineComment
{
doc_style
}
=>
{
// Skip non-doc comments
let
doc_style
=
if
let
Some
(
doc_style
)
=
doc_style
{
doc_style
}
else
{
let
Some
(
doc_style
)
=
doc_style
else
{
self
.lint_unicode_text_flow
(
start
);
return
None
;
};
...
...
@@ -185,9 +183,7 @@ fn cook_lexer_token(&self, token: rustc_lexer::TokenKind, start: BytePos) -> Opt
}
// Skip non-doc comments
let
doc_style
=
if
let
Some
(
doc_style
)
=
doc_style
{
doc_style
}
else
{
let
Some
(
doc_style
)
=
doc_style
else
{
self
.lint_unicode_text_flow
(
start
);
return
None
;
};
...
...
compiler/rustc_parse/src/lib.rs
浏览文件 @
60f969a4
...
...
@@ -4,6 +4,7 @@
#![feature(crate_visibility_modifier)]
#![feature(if_let_guard)]
#![feature(box_patterns)]
#![feature(let_else)]
#![recursion_limit
=
"256"
]
#[macro_use]
...
...
compiler/rustc_resolve/src/late/diagnostics.rs
浏览文件 @
60f969a4
...
...
@@ -704,7 +704,7 @@ fn restrict_assoc_type_in_where_clause(
)
=
&
bounded_ty
.kind
{
// use this to verify that ident is a type param.
let
partial_res
=
if
let
Ok
(
Some
(
partial_res
))
=
self
.resolve_qpath_anywhere
(
let
Ok
(
Some
(
partial_res
))
=
self
.resolve_qpath_anywhere
(
bounded_ty
.id
,
None
,
&
Segment
::
from_path
(
path
),
...
...
@@ -712,9 +712,7 @@ fn restrict_assoc_type_in_where_clause(
span
,
true
,
CrateLint
::
No
,
)
{
partial_res
}
else
{
)
else
{
return
false
;
};
if
!
(
matches!
(
...
...
@@ -731,7 +729,7 @@ fn restrict_assoc_type_in_where_clause(
if
let
ast
::
TyKind
::
Path
(
None
,
type_param_path
)
=
&
ty
.peel_refs
()
.kind
{
// Confirm that the `SelfTy` is a type parameter.
let
partial_res
=
if
let
Ok
(
Some
(
partial_res
))
=
self
.resolve_qpath_anywhere
(
let
Ok
(
Some
(
partial_res
))
=
self
.resolve_qpath_anywhere
(
bounded_ty
.id
,
None
,
&
Segment
::
from_path
(
type_param_path
),
...
...
@@ -739,9 +737,7 @@ fn restrict_assoc_type_in_where_clause(
span
,
true
,
CrateLint
::
No
,
)
{
partial_res
}
else
{
)
else
{
return
false
;
};
if
!
(
matches!
(
...
...
compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs
浏览文件 @
60f969a4
...
...
@@ -1099,9 +1099,7 @@ fn suggest_impl_trait(
_
=>
return
false
,
};
let
ret_ty
=
if
let
hir
::
FnRetTy
::
Return
(
ret_ty
)
=
sig
.decl.output
{
ret_ty
}
else
{
let
hir
::
FnRetTy
::
Return
(
ret_ty
)
=
sig
.decl.output
else
{
return
false
;
};
...
...
@@ -1168,7 +1166,7 @@ fn suggest_impl_trait(
};
let
sm
=
self
.tcx.sess
.source_map
();
let
snippet
=
if
let
(
true
,
hir
::
TyKind
::
TraitObject
(
..
),
Ok
(
snippet
),
true
)
=
(
let
(
true
,
hir
::
TyKind
::
TraitObject
(
..
),
Ok
(
snippet
),
true
)
=
(
// Verify that we're dealing with a return `dyn Trait`
ret_ty
.span
.overlaps
(
span
),
&
ret_ty
.kind
,
...
...
@@ -1176,9 +1174,7 @@ fn suggest_impl_trait(
// If any of the return types does not conform to the trait, then we can't
// suggest `impl Trait` nor trait objects: it is a type mismatch error.
all_returns_conform_to_trait
,
)
{
snippet
}
else
{
)
else
{
return
false
;
};
err
.code
(
error_code!
(
E0746
));
...
...
compiler/rustc_typeck/src/check/expr.rs
浏览文件 @
60f969a4
...
...
@@ -1318,10 +1318,7 @@ fn check_expr_struct(
base_expr
:
&
'tcx
Option
<&
'tcx
hir
::
Expr
<
'tcx
>>
,
)
->
Ty
<
'tcx
>
{
// Find the relevant variant
let
(
variant
,
adt_ty
)
=
if
let
Some
(
variant_ty
)
=
self
.check_struct_path
(
qpath
,
expr
.hir_id
)
{
variant_ty
}
else
{
let
Some
((
variant
,
adt_ty
))
=
self
.check_struct_path
(
qpath
,
expr
.hir_id
)
else
{
self
.check_struct_fields_on_error
(
fields
,
base_expr
);
return
self
.tcx
.ty_error
();
};
...
...
src/librustdoc/clean/simplify.rs
浏览文件 @
60f969a4
...
...
@@ -51,9 +51,7 @@
// Look for equality predicates on associated types that can be merged into
// general bound predicates
equalities
.retain
(|
&
(
ref
lhs
,
ref
rhs
)|
{
let
(
self_
,
trait_did
,
name
)
=
if
let
Some
(
p
)
=
lhs
.projection
()
{
p
}
else
{
let
Some
((
self_
,
trait_did
,
name
))
=
lhs
.projection
()
else
{
return
true
;
};
let
generic
=
match
self_
{
...
...
src/librustdoc/html/markdown.rs
浏览文件 @
60f969a4
...
...
@@ -236,9 +236,7 @@ fn next(&mut self) -> Option<Self::Item> {
let
should_panic
;
let
ignore
;
let
edition
;
let
kind
=
if
let
Some
(
Event
::
Start
(
Tag
::
CodeBlock
(
kind
)))
=
event
{
kind
}
else
{
let
Some
(
Event
::
Start
(
Tag
::
CodeBlock
(
kind
)))
=
event
else
{
return
event
;
};
...
...
src/librustdoc/html/render/print_item.rs
浏览文件 @
60f969a4
...
...
@@ -1752,9 +1752,7 @@ fn write_size_of_layout(w: &mut Buffer, layout: &Layout, tag_size: u64) {
<ul>"
,
);
let
adt
=
if
let
Adt
(
adt
,
_
)
=
ty_layout
.ty
.kind
()
{
adt
}
else
{
let
Adt
(
adt
,
_
)
=
ty_layout
.ty
.kind
()
else
{
span_bug!
(
tcx
.def_span
(
ty_def_id
),
"not an adt"
)
};
...
...
src/librustdoc/passes/collect_intra_doc_links.rs
浏览文件 @
60f969a4
...
...
@@ -1226,9 +1226,7 @@ fn resolve_link(
let
base_node
=
if
item
.is_mod
()
&&
inner_docs
{
self
.mod_ids
.last
()
.copied
()
}
else
{
parent_node
};
let
mut
module_id
=
if
let
Some
(
id
)
=
base_node
{
id
}
else
{
let
Some
(
mut
module_id
)
=
base_node
else
{
// This is a bug.
debug!
(
"attempting to resolve item without parent module: {}"
,
path_str
);
resolution_failure
(
...
...
@@ -1977,9 +1975,7 @@ fn split(path: &str) -> Option<(&str, &str)> {
// If so, report it and say the first which failed; if not, say the first path segment didn't resolve.
let
mut
name
=
path_str
;
'outer
:
loop
{
let
(
start
,
end
)
=
if
let
Some
(
x
)
=
split
(
name
)
{
x
}
else
{
let
Some
((
start
,
end
))
=
split
(
name
)
else
{
// avoid bug that marked [Quux::Z] as missing Z, not Quux
if
partial_res
.is_none
()
{
*
unresolved
=
name
.into
();
...
...
src/librustdoc/scrape_examples.rs
浏览文件 @
60f969a4
...
...
@@ -152,9 +152,7 @@ fn visit_expr(&mut self, ex: &'tcx hir::Expr<'tcx>) {
}
hir
::
ExprKind
::
MethodCall
(
_
,
_
,
span
)
=>
{
let
types
=
tcx
.typeck
(
ex
.hir_id.owner
);
let
def_id
=
if
let
Some
(
def_id
)
=
types
.type_dependent_def_id
(
ex
.hir_id
)
{
def_id
}
else
{
let
Some
(
def_id
)
=
types
.type_dependent_def_id
(
ex
.hir_id
)
else
{
trace!
(
"type_dependent_def_id({}) = None"
,
ex
.hir_id
);
return
;
};
...
...
src/librustdoc/visit_ast.rs
浏览文件 @
60f969a4
...
...
@@ -188,9 +188,7 @@ fn maybe_inline_local(
debug!
(
"maybe_inline_local res: {:?}"
,
res
);
let
tcx
=
self
.cx.tcx
;
let
res_did
=
if
let
Some
(
did
)
=
res
.opt_def_id
()
{
did
}
else
{
let
Some
(
res_did
)
=
res
.opt_def_id
()
else
{
return
false
;
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录