Skip to content

Commit 890803d

Browse files
committed
Auto merge of #85199 - JohnTitor:rollup-gz5m06c, r=JohnTitor
Rollup of 8 pull requests Successful merges: - #83501 (rustdoc: Add unstable CLI option to show basic type layout information) - #85018 (shrinking the deprecated method span) - #85124 (rustdoc: remove explicit boolean comparisons.) - #85136 (Change param name (k to key and v to value) in std::env module) - #85162 (Fix typo in variable name) - #85187 (Use .name_str() to format primitive types in error messages) - #85191 (Improve rustdoc gui tester) - #85196 (Revert "Auto merge of #84797 - richkadel:cover-unreachable-statements…) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 5c02926 + e27f20a commit 890803d

File tree

65 files changed

+552
-314
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+552
-314
lines changed

compiler/rustc_middle/src/middle/stability.rs

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,13 @@ impl<'tcx> TyCtxt<'tcx> {
281281
/// If `id` is `Some(_)`, this function will also check if the item at `def_id` has been
282282
/// deprecated. If the item is indeed deprecated, we will emit a deprecation lint attached to
283283
/// `id`.
284-
pub fn eval_stability(self, def_id: DefId, id: Option<HirId>, span: Span) -> EvalResult {
284+
pub fn eval_stability(
285+
self,
286+
def_id: DefId,
287+
id: Option<HirId>,
288+
span: Span,
289+
method_span: Option<Span>,
290+
) -> EvalResult {
285291
// Deprecated attributes apply in-crate and cross-crate.
286292
if let Some(id) = id {
287293
if let Some(depr_entry) = self.lookup_deprecation_entry(def_id) {
@@ -300,6 +306,7 @@ impl<'tcx> TyCtxt<'tcx> {
300306
let path = &with_no_trimmed_paths(|| self.def_path_str(def_id));
301307
let kind = self.def_kind(def_id).descr(def_id);
302308
let (message, lint) = deprecation_message(&depr_entry.attr, kind, path);
309+
let span = method_span.unwrap_or(span);
303310
late_report_deprecation(
304311
self,
305312
&message,
@@ -382,8 +389,14 @@ impl<'tcx> TyCtxt<'tcx> {
382389
///
383390
/// This function will also check if the item is deprecated.
384391
/// If so, and `id` is not `None`, a deprecated lint attached to `id` will be emitted.
385-
pub fn check_stability(self, def_id: DefId, id: Option<HirId>, span: Span) {
386-
self.check_optional_stability(def_id, id, span, |span, def_id| {
392+
pub fn check_stability(
393+
self,
394+
def_id: DefId,
395+
id: Option<HirId>,
396+
span: Span,
397+
method_span: Option<Span>,
398+
) {
399+
self.check_optional_stability(def_id, id, span, method_span, |span, def_id| {
387400
// The API could be uncallable for other reasons, for example when a private module
388401
// was referenced.
389402
self.sess.delay_span_bug(span, &format!("encountered unmarked API: {:?}", def_id));
@@ -399,14 +412,15 @@ impl<'tcx> TyCtxt<'tcx> {
399412
def_id: DefId,
400413
id: Option<HirId>,
401414
span: Span,
415+
method_span: Option<Span>,
402416
unmarked: impl FnOnce(Span, DefId),
403417
) {
404418
let soft_handler = |lint, span, msg: &_| {
405419
self.struct_span_lint_hir(lint, id.unwrap_or(hir::CRATE_HIR_ID), span, |lint| {
406420
lint.build(msg).emit()
407421
})
408422
};
409-
match self.eval_stability(def_id, id, span) {
423+
match self.eval_stability(def_id, id, span, method_span) {
410424
EvalResult::Allow => {}
411425
EvalResult::Deny { feature, reason, issue, is_soft } => {
412426
report_unstable(self.sess, feature, reason, issue, is_soft, span, soft_handler)

compiler/rustc_middle/src/ty/error.rs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,23 @@ impl<'tcx> fmt::Display for TypeError<'tcx> {
159159
)
160160
}),
161161
IntMismatch(ref values) => {
162-
write!(f, "expected `{:?}`, found `{:?}`", values.expected, values.found)
162+
let expected = match values.expected {
163+
ty::IntVarValue::IntType(ty) => ty.name_str(),
164+
ty::IntVarValue::UintType(ty) => ty.name_str(),
165+
};
166+
let found = match values.found {
167+
ty::IntVarValue::IntType(ty) => ty.name_str(),
168+
ty::IntVarValue::UintType(ty) => ty.name_str(),
169+
};
170+
write!(f, "expected `{}`, found `{}`", expected, found)
163171
}
164172
FloatMismatch(ref values) => {
165-
write!(f, "expected `{:?}`, found `{:?}`", values.expected, values.found)
173+
write!(
174+
f,
175+
"expected `{}`, found `{}`",
176+
values.expected.name_str(),
177+
values.found.name_str()
178+
)
166179
}
167180
VariadicMismatch(ref values) => write!(
168181
f,

compiler/rustc_mir/src/transform/const_goto.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ impl<'tcx> MirPass<'tcx> for ConstGoto {
4747
// if we applied optimizations, we potentially have some cfg to cleanup to
4848
// make it easier for further passes
4949
if should_simplify {
50-
simplify_cfg(tcx, body);
50+
simplify_cfg(body);
5151
simplify_locals(body, tcx);
5252
}
5353
}

compiler/rustc_mir/src/transform/deduplicate_blocks.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ impl<'tcx> MirPass<'tcx> for DeduplicateBlocks {
2626
if has_opts_to_apply {
2727
let mut opt_applier = OptApplier { tcx, duplicates };
2828
opt_applier.visit_body(body);
29-
simplify_cfg(tcx, body);
29+
simplify_cfg(body);
3030
}
3131
}
3232
}

compiler/rustc_mir/src/transform/early_otherwise_branch.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ impl<'tcx> MirPass<'tcx> for EarlyOtherwiseBranch {
164164
// Since this optimization adds new basic blocks and invalidates others,
165165
// clean up the cfg to make it nicer for other passes
166166
if should_cleanup {
167-
simplify_cfg(tcx, body);
167+
simplify_cfg(body);
168168
}
169169
}
170170
}

compiler/rustc_mir/src/transform/generator.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -964,7 +964,7 @@ fn create_generator_drop_shim<'tcx>(
964964

965965
// Make sure we remove dead blocks to remove
966966
// unrelated code from the resume part of the function
967-
simplify::remove_dead_blocks(tcx, &mut body);
967+
simplify::remove_dead_blocks(&mut body);
968968

969969
dump_mir(tcx, None, "generator_drop", &0, &body, |_, _| Ok(()));
970970

@@ -1137,7 +1137,7 @@ fn create_generator_resume_function<'tcx>(
11371137

11381138
// Make sure we remove dead blocks to remove
11391139
// unrelated code from the drop part of the function
1140-
simplify::remove_dead_blocks(tcx, body);
1140+
simplify::remove_dead_blocks(body);
11411141

11421142
dump_mir(tcx, None, "generator_resume", &0, body, |_, _| Ok(()));
11431143
}

compiler/rustc_mir/src/transform/inline.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ impl<'tcx> MirPass<'tcx> for Inline {
5757
if inline(tcx, body) {
5858
debug!("running simplify cfg on {:?}", body.source);
5959
CfgSimplifier::new(body).simplify();
60-
remove_dead_blocks(tcx, body);
60+
remove_dead_blocks(body);
6161
}
6262
}
6363
}

compiler/rustc_mir/src/transform/match_branches.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ impl<'tcx> MirPass<'tcx> for MatchBranchSimplification {
167167
}
168168

169169
if should_cleanup {
170-
simplify_cfg(tcx, body);
170+
simplify_cfg(body);
171171
}
172172
}
173173
}

compiler/rustc_mir/src/transform/multiple_return_terminators.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,6 @@ impl<'tcx> MirPass<'tcx> for MultipleReturnTerminators {
3838
}
3939
}
4040

41-
simplify::remove_dead_blocks(tcx, body)
41+
simplify::remove_dead_blocks(body)
4242
}
4343
}

compiler/rustc_mir/src/transform/remove_unneeded_drops.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ impl<'tcx> MirPass<'tcx> for RemoveUnneededDrops {
3636
// if we applied optimizations, we potentially have some cfg to cleanup to
3737
// make it easier for further passes
3838
if should_simplify {
39-
simplify_cfg(tcx, body);
39+
simplify_cfg(body);
4040
}
4141
}
4242
}

0 commit comments

Comments
 (0)