Skip to content

Commit 285fc7d

Browse files
committed
Auto merge of #76804 - tmandry:rollup-nwntt3q, r=tmandry
Rollup of 16 pull requests Successful merges: - #75026 (Add array_windows fn) - #76642 (Do not lint ignored private doc tests) - #76719 (Change error message for ty param in const) - #76721 (Use intra-doc links in `core::mem`) - #76728 (Add a comment why `extern crate` is necessary for rustdoc) - #76735 (Remove unnecessary `clone()`s in bootstrap) - #76741 (Avoid printing dry run timings) - #76747 (Add missing code examples in libcore) - #76756 (fix a couple of stylistic clippy warnings) - #76758 ([fuchsia] Propagate the userspace UTC clock) - #76759 (Fix stabilization marker for future_readiness_fns) - #76760 (don't lazily evaluate some trivial values for Option::None replacements (clippy::unnecessary_lazy_evaluations)) - #76764 (Update books) - #76775 (Strip a single leading tab when rendering dataflow diffs) - #76778 (Simplify iter fuse struct doc) - #76794 (Make graphviz font configurable) Failed merges: r? `@ghost`
2 parents ff806b8 + 3bf66ae commit 285fc7d

File tree

54 files changed

+450
-164
lines changed

Some content is hidden

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

54 files changed

+450
-164
lines changed

compiler/rustc_graphviz/src/lib.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -591,14 +591,14 @@ pub trait GraphWalk<'a> {
591591
fn target(&'a self, edge: &Self::Edge) -> Self::Node;
592592
}
593593

594-
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
594+
#[derive(Clone, PartialEq, Eq, Debug)]
595595
pub enum RenderOption {
596596
NoEdgeLabels,
597597
NoNodeLabels,
598598
NoEdgeStyles,
599599
NoNodeStyles,
600600

601-
Monospace,
601+
Fontname(String),
602602
DarkTheme,
603603
}
604604

@@ -633,11 +633,14 @@ where
633633
// Global graph properties
634634
let mut graph_attrs = Vec::new();
635635
let mut content_attrs = Vec::new();
636-
if options.contains(&RenderOption::Monospace) {
637-
let font = r#"fontname="Courier, monospace""#;
638-
graph_attrs.push(font);
639-
content_attrs.push(font);
640-
};
636+
let font;
637+
if let Some(fontname) = options.iter().find_map(|option| {
638+
if let RenderOption::Fontname(fontname) = option { Some(fontname) } else { None }
639+
}) {
640+
font = format!(r#"fontname="{}""#, fontname);
641+
graph_attrs.push(&font[..]);
642+
content_attrs.push(&font[..]);
643+
}
641644
if options.contains(&RenderOption::DarkTheme) {
642645
graph_attrs.push(r#"bgcolor="black""#);
643646
content_attrs.push(r#"color="white""#);

compiler/rustc_infer/src/infer/error_reporting/nice_region_error/named_anon_conflict.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
8585

8686
debug!("try_report_named_anon_conflict: ret ty {:?}", ty);
8787
if sub == &ty::ReStatic
88-
&& v.0.into_iter().find(|t| t.span.desugaring_kind().is_none()).is_some()
88+
&& v.0.into_iter().any(|t| t.span.desugaring_kind().is_none())
8989
{
9090
// If the failure is due to a `'static` requirement coming from a `dyn` or
9191
// `impl` Trait that *isn't* caused by `async fn` desugaring, handle this case

compiler/rustc_lint/src/builtin.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -961,7 +961,7 @@ fn warn_if_doc(cx: &EarlyContext<'_>, node_span: Span, node_kind: &str, attrs: &
961961
continue;
962962
}
963963

964-
let span = sugared_span.take().unwrap_or_else(|| attr.span);
964+
let span = sugared_span.take().unwrap_or(attr.span);
965965

966966
if attr.is_doc_comment() || cx.sess().check_name(attr, sym::doc) {
967967
cx.struct_span_lint(UNUSED_DOC_COMMENTS, span, |lint| {

compiler/rustc_metadata/src/native_libs.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ impl Collector<'tcx> {
170170
feature_err(
171171
&self.tcx.sess.parse_sess,
172172
sym::static_nobundle,
173-
span.unwrap_or_else(|| rustc_span::DUMMY_SP),
173+
span.unwrap_or(rustc_span::DUMMY_SP),
174174
"kind=\"static-nobundle\" is unstable",
175175
)
176176
.emit();
@@ -179,7 +179,7 @@ impl Collector<'tcx> {
179179
feature_err(
180180
&self.tcx.sess.parse_sess,
181181
sym::raw_dylib,
182-
span.unwrap_or_else(|| rustc_span::DUMMY_SP),
182+
span.unwrap_or(rustc_span::DUMMY_SP),
183183
"kind=\"raw-dylib\" is unstable",
184184
)
185185
.emit();

compiler/rustc_middle/src/ty/print/pretty.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,10 +273,10 @@ pub trait PrettyPrinter<'tcx>:
273273
}
274274

275275
match self.tcx().trimmed_def_paths(LOCAL_CRATE).get(&def_id) {
276-
None => return Ok((self, false)),
276+
None => Ok((self, false)),
277277
Some(symbol) => {
278278
self.write_str(&symbol.as_str())?;
279-
return Ok((self, true));
279+
Ok((self, true))
280280
}
281281
}
282282
}

compiler/rustc_mir/src/borrow_check/diagnostics/region_errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
387387
if let ReturnConstraint::ClosureUpvar(upvar) = kind {
388388
let def_id = match self.regioncx.universal_regions().defining_ty {
389389
DefiningTy::Closure(def_id, _) => def_id,
390-
ty @ _ => bug!("unexpected DefiningTy {:?}", ty),
390+
ty => bug!("unexpected DefiningTy {:?}", ty),
391391
};
392392

393393
let upvar_def_span = self.infcx.tcx.hir().span(upvar);

compiler/rustc_mir/src/dataflow/framework/engine.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,8 @@ where
306306
let mut buf = Vec::new();
307307

308308
let graphviz = graphviz::Formatter::new(body, def_id, results, style);
309-
let mut render_opts = vec![dot::RenderOption::Monospace];
309+
let mut render_opts =
310+
vec![dot::RenderOption::Fontname(tcx.sess.opts.debugging_opts.graphviz_font.clone())];
310311
if tcx.sess.opts.debugging_opts.graphviz_dark_mode {
311312
render_opts.push(dot::RenderOption::DarkTheme);
312313
}

compiler/rustc_mir/src/dataflow/framework/graphviz.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ where
578578
return String::new();
579579
}
580580

581-
let re = Regex::new("\u{001f}([+-])").unwrap();
581+
let re = Regex::new("\t?\u{001f}([+-])").unwrap();
582582

583583
let raw_diff = format!("{:#?}", DebugDiffWithAdapter { new, old, ctxt });
584584

compiler/rustc_mir/src/transform/instcombine.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ impl OptimizationFinder<'b, 'tcx> {
126126
}
127127
}
128128

129-
return None;
129+
None
130130
}
131131
}
132132

compiler/rustc_mir/src/util/graphviz.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ where
5555
writeln!(w, "{} {}Mir_{} {{", kind, cluster, def_name)?;
5656

5757
// Global graph properties
58-
let font = r#"fontname="Courier, monospace""#;
59-
let mut graph_attrs = vec![font];
60-
let mut content_attrs = vec![font];
58+
let font = format!(r#"fontname="{}""#, tcx.sess.opts.debugging_opts.graphviz_font);
59+
let mut graph_attrs = vec![&font[..]];
60+
let mut content_attrs = vec![&font[..]];
6161

6262
let dark_mode = tcx.sess.opts.debugging_opts.graphviz_dark_mode;
6363
if dark_mode {

0 commit comments

Comments
 (0)