Skip to content

Commit 245062c

Browse files
committed
some fixes
1 parent 4d22e75 commit 245062c

File tree

3 files changed

+6
-20
lines changed

3 files changed

+6
-20
lines changed

src/librustc/ty/context.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1518,13 +1518,10 @@ impl<'tcx> TyCtxt<'tcx> {
15181518
&self,
15191519
def_id: crate::hir::def_id::DefId,
15201520
) -> (&'static str, &'static str) {
1521-
self.def_kind(def_id).map_or_else(
1522-
|| {
1523-
// TODO: is it a problem to try to use the ty here?
1524-
self.type_of(def_id).kind.article_and_description()
1525-
},
1526-
|def_kind| (def_kind.article(), def_kind.descr(def_id)),
1527-
)
1521+
match self.def_kind(def_id) {
1522+
Some(def_kind) => (def_kind.article(), def_kind.descr(def_id)),
1523+
None => self.type_of(def_id).kind.article_and_description(),
1524+
}
15281525
}
15291526
}
15301527

src/librustc_mir/borrow_check/diagnostics/conflict_errors.rs

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1275,18 +1275,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
12751275
) -> DiagnosticBuilder<'cx> {
12761276
let tcx = self.infcx.tcx;
12771277

1278-
let escapes_from = if tcx.is_closure(self.mir_def_id) {
1279-
let tables = tcx.typeck_tables_of(self.mir_def_id);
1280-
let mir_hir_id = tcx.hir().def_index_to_hir_id(self.mir_def_id.index);
1281-
match tables.node_type(mir_hir_id).kind {
1282-
ref kind @ ty::Closure(..) | ref kind @ ty::Generator(..) => {
1283-
kind.article_and_description().1
1284-
}
1285-
_ => bug!("Closure body doesn't have a closure or generator type"),
1286-
}
1287-
} else {
1288-
"function"
1289-
};
1278+
let (_, escapes_from) = tcx.article_and_description(self.mir_def_id);
12901279

12911280
let mut err =
12921281
borrowck_errors::borrowed_data_escapes_closure(tcx, escape_span, escapes_from);

src/librustc_mir/borrow_check/diagnostics/region_errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
435435
if (fr_name_and_span.is_none() && outlived_fr_name_and_span.is_none())
436436
|| (*category == ConstraintCategory::Assignment
437437
&& self.universal_regions.defining_ty.is_fn_def())
438-
|| self.universal_regions.defining_ty.is_closure()
438+
|| self.universal_regions.defining_ty.is_const()
439439
{
440440
return self.report_general_error(&ErrorConstraintInfo {
441441
fr_is_local: true,

0 commit comments

Comments
 (0)