Skip to content

Commit 285fc7d

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

+10-7
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

+1-1
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

+1-1
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

+2-2
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

+2-2
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

+1-1
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

+2-1
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

+1-1
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

+1-1
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

+3-3
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 {

compiler/rustc_resolve/src/diagnostics.rs

+12-4
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ impl<'a> Resolver<'a> {
466466
);
467467
err
468468
}
469-
ResolutionError::ParamInNonTrivialAnonConst(name) => {
469+
ResolutionError::ParamInNonTrivialAnonConst { name, is_type } => {
470470
let mut err = self.session.struct_span_err(
471471
span,
472472
"generic parameters must not be used inside of non trivial constant values",
@@ -478,9 +478,17 @@ impl<'a> Resolver<'a> {
478478
name
479479
),
480480
);
481-
err.help(
482-
&format!("it is currently only allowed to use either `{0}` or `{{ {0} }}` as generic constants", name)
483-
);
481+
482+
if is_type {
483+
err.note("type parameters are currently not permitted in anonymous constants");
484+
} else {
485+
err.help(
486+
&format!("it is currently only allowed to use either `{0}` or `{{ {0} }}` as generic constants",
487+
name
488+
)
489+
);
490+
}
491+
484492
err
485493
}
486494
ResolutionError::SelfInTyParamDefault => {

compiler/rustc_resolve/src/late/diagnostics.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1534,7 +1534,7 @@ impl<'tcx> LifetimeContext<'_, 'tcx> {
15341534
}
15351535
};
15361536

1537-
let lifetime_names: Vec<_> = lifetime_names.into_iter().collect();
1537+
let lifetime_names: Vec<_> = lifetime_names.iter().collect();
15381538
match (&lifetime_names[..], snippet.as_deref()) {
15391539
([name], Some("&")) => {
15401540
suggest_existing(err, &name.as_str()[..], &|name| format!("&{} ", name));

compiler/rustc_resolve/src/lib.rs

+9-5
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ enum ResolutionError<'a> {
221221
/// generic parameters must not be used inside of non trivial constant values.
222222
///
223223
/// This error is only emitted when using `min_const_generics`.
224-
ParamInNonTrivialAnonConst(Symbol),
224+
ParamInNonTrivialAnonConst { name: Symbol, is_type: bool },
225225
/// Error E0735: type parameters with a default cannot use `Self`
226226
SelfInTyParamDefault,
227227
/// Error E0767: use of unreachable label
@@ -2638,9 +2638,10 @@ impl<'a> Resolver<'a> {
26382638
if record_used {
26392639
self.report_error(
26402640
span,
2641-
ResolutionError::ParamInNonTrivialAnonConst(
2642-
rib_ident.name,
2643-
),
2641+
ResolutionError::ParamInNonTrivialAnonConst {
2642+
name: rib_ident.name,
2643+
is_type: true,
2644+
},
26442645
);
26452646
}
26462647
return Res::Err;
@@ -2718,7 +2719,10 @@ impl<'a> Resolver<'a> {
27182719
if record_used {
27192720
self.report_error(
27202721
span,
2721-
ResolutionError::ParamInNonTrivialAnonConst(rib_ident.name),
2722+
ResolutionError::ParamInNonTrivialAnonConst {
2723+
name: rib_ident.name,
2724+
is_type: false,
2725+
},
27222726
);
27232727
}
27242728
return Res::Err;

compiler/rustc_session/src/config.rs

+4
Original file line numberDiff line numberDiff line change
@@ -1762,6 +1762,10 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
17621762
debugging_opts.symbol_mangling_version = SymbolManglingVersion::V0;
17631763
}
17641764

1765+
if let Ok(graphviz_font) = std::env::var("RUSTC_GRAPHVIZ_FONT") {
1766+
debugging_opts.graphviz_font = graphviz_font;
1767+
}
1768+
17651769
if !cg.embed_bitcode {
17661770
match cg.lto {
17671771
LtoCli::No | LtoCli::Unspecified => {}

compiler/rustc_session/src/options.rs

+3
Original file line numberDiff line numberDiff line change
@@ -911,6 +911,9 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
911911
"set the optimization fuel quota for a crate"),
912912
graphviz_dark_mode: bool = (false, parse_bool, [UNTRACKED],
913913
"use dark-themed colors in graphviz output (default: no)"),
914+
graphviz_font: String = ("Courier, monospace".to_string(), parse_string, [UNTRACKED],
915+
"use the given `fontname` in graphviz output; can be overridden by setting \
916+
environment variable `RUSTC_GRAPHVIZ_FONT` (default: `Courier, monospace`)"),
914917
hir_stats: bool = (false, parse_bool, [UNTRACKED],
915918
"print some statistics about AST and HIR (default: no)"),
916919
human_readable_cgu_names: bool = (false, parse_bool, [TRACKED],

compiler/rustc_trait_selection/src/traits/coherence.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ fn overlap_within_probe(
182182
}
183183

184184
if !skip_leak_check.is_yes() {
185-
if let Err(_) = infcx.leak_check(true, snapshot) {
185+
if infcx.leak_check(true, snapshot).is_err() {
186186
debug!("overlap: leak check failed");
187187
return None;
188188
}

compiler/rustc_typeck/src/check/_match.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
164164
}
165165
// If all the obligations hold (or there are no obligations) the tail expression
166166
// we can suggest to return a boxed trait object instead of an opaque type.
167-
if suggest_box { self.ret_type_span.clone() } else { None }
167+
if suggest_box { self.ret_type_span } else { None }
168168
}
169169
_ => None,
170170
};

compiler/rustc_typeck/src/check/expr.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1243,10 +1243,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
12431243
} else if check_completeness && !error_happened && !remaining_fields.is_empty() {
12441244
let no_accessible_remaining_fields = remaining_fields
12451245
.iter()
1246-
.filter(|(_, (_, field))| {
1246+
.find(|(_, (_, field))| {
12471247
field.vis.is_accessible_from(tcx.parent_module(expr_id).to_def_id(), tcx)
12481248
})
1249-
.next()
12501249
.is_none();
12511250

12521251
if no_accessible_remaining_fields {

compiler/rustc_typeck/src/check/pat.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1141,10 +1141,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
11411141
} else if !etc && !unmentioned_fields.is_empty() {
11421142
let no_accessible_unmentioned_fields = unmentioned_fields
11431143
.iter()
1144-
.filter(|(field, _)| {
1144+
.find(|(field, _)| {
11451145
field.vis.is_accessible_from(tcx.parent_module(pat.hir_id).to_def_id(), tcx)
11461146
})
1147-
.next()
11481147
.is_none();
11491148

11501149
if no_accessible_unmentioned_fields {

library/alloc/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
#![cfg_attr(test, feature(test))]
7777
#![feature(allocator_api)]
7878
#![feature(array_chunks)]
79+
#![feature(array_windows)]
7980
#![feature(allow_internal_unstable)]
8081
#![feature(arbitrary_self_types)]
8182
#![feature(box_patterns)]

library/alloc/src/slice.rs

+2
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ pub use core::slice::check_range;
9797
pub use core::slice::ArrayChunks;
9898
#[unstable(feature = "array_chunks", issue = "74985")]
9999
pub use core::slice::ArrayChunksMut;
100+
#[unstable(feature = "array_windows", issue = "75027")]
101+
pub use core::slice::ArrayWindows;
100102
#[stable(feature = "slice_get_slice", since = "1.28.0")]
101103
pub use core::slice::SliceIndex;
102104
#[stable(feature = "from_ref", since = "1.28.0")]

library/core/src/future/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ pub use self::future::Future;
2121
#[unstable(feature = "into_future", issue = "67644")]
2222
pub use into_future::IntoFuture;
2323

24-
#[stable(feature = "future_readiness_fns", since = "1.47.0")]
24+
#[stable(feature = "future_readiness_fns", since = "1.48.0")]
2525
pub use pending::{pending, Pending};
26-
#[stable(feature = "future_readiness_fns", since = "1.47.0")]
26+
#[stable(feature = "future_readiness_fns", since = "1.48.0")]
2727
pub use ready::{ready, Ready};
2828

2929
#[unstable(feature = "future_poll_fn", issue = "72302")]

library/core/src/future/pending.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use crate::task::{Context, Poll};
1111
/// documentation for more.
1212
///
1313
/// [`pending`]: fn.pending.html
14-
#[stable(feature = "future_readiness_fns", since = "1.47.0")]
14+
#[stable(feature = "future_readiness_fns", since = "1.48.0")]
1515
#[must_use = "futures do nothing unless you `.await` or poll them"]
1616
pub struct Pending<T> {
1717
_data: marker::PhantomData<T>,
@@ -31,12 +31,12 @@ pub struct Pending<T> {
3131
/// unreachable!();
3232
/// # }
3333
/// ```
34-
#[stable(feature = "future_readiness_fns", since = "1.47.0")]
34+
#[stable(feature = "future_readiness_fns", since = "1.48.0")]
3535
pub fn pending<T>() -> Pending<T> {
3636
Pending { _data: marker::PhantomData }
3737
}
3838

39-
#[stable(feature = "future_readiness_fns", since = "1.47.0")]
39+
#[stable(feature = "future_readiness_fns", since = "1.48.0")]
4040
impl<T> Future for Pending<T> {
4141
type Output = T;
4242

@@ -45,17 +45,17 @@ impl<T> Future for Pending<T> {
4545
}
4646
}
4747

48-
#[stable(feature = "future_readiness_fns", since = "1.47.0")]
48+
#[stable(feature = "future_readiness_fns", since = "1.48.0")]
4949
impl<T> Unpin for Pending<T> {}
5050

51-
#[stable(feature = "future_readiness_fns", since = "1.47.0")]
51+
#[stable(feature = "future_readiness_fns", since = "1.48.0")]
5252
impl<T> Debug for Pending<T> {
5353
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
5454
f.debug_struct("Pending").finish()
5555
}
5656
}
5757

58-
#[stable(feature = "future_readiness_fns", since = "1.47.0")]
58+
#[stable(feature = "future_readiness_fns", since = "1.48.0")]
5959
impl<T> Clone for Pending<T> {
6060
fn clone(&self) -> Self {
6161
pending()

library/core/src/future/ready.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ use crate::task::{Context, Poll};
88
/// documentation for more.
99
///
1010
/// [`ready`]: fn.ready.html
11-
#[stable(feature = "future_readiness_fns", since = "1.47.0")]
11+
#[stable(feature = "future_readiness_fns", since = "1.48.0")]
1212
#[derive(Debug, Clone)]
1313
#[must_use = "futures do nothing unless you `.await` or poll them"]
1414
pub struct Ready<T>(Option<T>);
1515

16-
#[stable(feature = "future_readiness_fns", since = "1.47.0")]
16+
#[stable(feature = "future_readiness_fns", since = "1.48.0")]
1717
impl<T> Unpin for Ready<T> {}
1818

19-
#[stable(feature = "future_readiness_fns", since = "1.47.0")]
19+
#[stable(feature = "future_readiness_fns", since = "1.48.0")]
2020
impl<T> Future for Ready<T> {
2121
type Output = T;
2222

@@ -42,7 +42,7 @@ impl<T> Future for Ready<T> {
4242
/// assert_eq!(a.await, 1);
4343
/// # }
4444
/// ```
45-
#[stable(feature = "future_readiness_fns", since = "1.47.0")]
45+
#[stable(feature = "future_readiness_fns", since = "1.48.0")]
4646
pub fn ready<T>(t: T) -> Ready<T> {
4747
Ready(Some(t))
4848
}

library/core/src/iter/adapters/fuse.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,8 @@ use crate::ops::Try;
99
/// An iterator that yields `None` forever after the underlying iterator
1010
/// yields `None` once.
1111
///
12-
/// This `struct` is created by the [`fuse`] method on [`Iterator`]. See its
13-
/// documentation for more.
14-
///
15-
/// [`fuse`]: trait.Iterator.html#method.fuse
16-
/// [`Iterator`]: trait.Iterator.html
12+
/// This `struct` is created by [`Iterator::fuse`]. See its documentation
13+
/// for more.
1714
#[derive(Clone, Debug)]
1815
#[must_use = "iterators are lazy and do nothing unless consumed"]
1916
#[stable(feature = "rust1", since = "1.0.0")]

0 commit comments

Comments
 (0)