Skip to content

Commit 8a84c4f

Browse files
committed
Auto merge of #77723 - jonas-schievink:rollup-htz44r4, r=jonas-schievink
Rollup of 8 pull requests Successful merges: - #76750 (Don't discourage implementing `core::fmt::Write`) - #77449 (BTreeMap: comment why drain_filter's size_hint is somewhat pessimistic) - #77660 ((docs): make mutex error comment consistent with codebase) - #77663 (Add compile fail test for issue 27675) - #77673 (Remove unnecessary lamda on emitter map.) - #77701 (Make `max_log_info` easily greppable (for figuring out why debug logging is disabled)) - #77702 (Remove not needed lambda.) - #77710 (Update submodule llvm to get LVI bugfix) Failed merges: r? `@ghost`
2 parents 3525087 + d252848 commit 8a84c4f

File tree

8 files changed

+37
-15
lines changed

8 files changed

+37
-15
lines changed

Diff for: compiler/rustc_driver/src/lib.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,7 @@ pub fn run_compiler(
155155
),
156156
}
157157
}
158-
let diagnostic_output =
159-
emitter.map(|emitter| DiagnosticOutput::Raw(emitter)).unwrap_or(DiagnosticOutput::Default);
158+
let diagnostic_output = emitter.map_or(DiagnosticOutput::Default, DiagnosticOutput::Raw);
160159
let matches = match handle_options(&args) {
161160
Some(matches) => matches,
162161
None => return Ok(()),

Diff for: compiler/rustc_interface/src/util.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ pub fn setup_callbacks_and_run_in_thread_pool_with_globals<F: FnOnce() -> R + Se
187187
config = config.stack_size(size);
188188
}
189189

190-
let with_pool = move |pool: &rayon::ThreadPool| pool.install(move || f());
190+
let with_pool = move |pool: &rayon::ThreadPool| pool.install(f);
191191

192192
rustc_span::with_session_globals(edition, || {
193193
rustc_span::SESSION_GLOBALS.with(|session_globals| {

Diff for: config.toml.example

+4
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,10 @@ changelog-seen = 1
382382
# Overrides the `debug-assertions` option, if defined.
383383
#
384384
# Defaults to rust.debug-assertions value
385+
#
386+
# If you see a message from `tracing` saying
387+
# `max_level_info` is enabled and means logging won't be shown,
388+
# set this value to `true`.
385389
#debug-logging = debug-assertions
386390

387391
# Debuginfo level for most of Rust code, corresponds to the `-C debuginfo=N` option of `rustc`.

Diff for: library/alloc/src/collections/btree/map.rs

+4
Original file line numberDiff line numberDiff line change
@@ -1783,6 +1783,10 @@ impl<'a, K: 'a, V: 'a> DrainFilterInner<'a, K, V> {
17831783

17841784
/// Implementation of a typical `DrainFilter::size_hint` method.
17851785
pub(super) fn size_hint(&self) -> (usize, Option<usize>) {
1786+
// In most of the btree iterators, `self.length` is the number of elements
1787+
// yet to be visited. Here, it includes elements that were visited and that
1788+
// the predicate decided not to drain. Making this upper bound more accurate
1789+
// requires maintaining an extra field and is not worth while.
17861790
(0, Some(*self.length))
17871791
}
17881792
}

Diff for: library/core/src/fmt/mod.rs

+6-10
Original file line numberDiff line numberDiff line change
@@ -92,18 +92,14 @@ pub type Result = result::Result<(), Error>;
9292
#[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
9393
pub struct Error;
9494

95-
/// A collection of methods that are required to format a message into a stream.
95+
/// A trait for writing or formatting into Unicode-accepting buffers or streams.
9696
///
97-
/// This trait is the type which this modules requires when formatting
98-
/// information. This is similar to the standard library's [`io::Write`] trait,
99-
/// but it is only intended for use in libcore.
97+
/// This trait only accepts UTF-8–encoded data and is not [flushable]. If you only
98+
/// want to accept Unicode and you don't need flushing, you should implement this trait;
99+
/// otherwise you should implement [`std::io::Write`].
100100
///
101-
/// This trait should generally not be implemented by consumers of the standard
102-
/// library. The [`write!`] macro accepts an instance of [`io::Write`], and the
103-
/// [`io::Write`] trait is favored over implementing this trait.
104-
///
105-
/// [`write!`]: crate::write!
106-
/// [`io::Write`]: ../../std/io/trait.Write.html
101+
/// [`std::io::Write`]: ../../std/io/trait.Write.html
102+
/// [flushable]: ../../std/io/trait.Write.html#tymethod.flush
107103
#[stable(feature = "rust1", since = "1.0.0")]
108104
pub trait Write {
109105
/// Writes a string slice into this writer, returning whether the write

Diff for: library/std/src/sync/mutex.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ impl<T: ?Sized> Mutex<T> {
276276
/// # Errors
277277
///
278278
/// If another user of this mutex panicked while holding the mutex, then
279-
/// this call will return failure if the mutex would otherwise be
279+
/// this call will return an error if the mutex would otherwise be
280280
/// acquired.
281281
///
282282
/// # Examples
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/// The compiler previously did not properly check the bound of `From` when it was used from type
2+
/// of the dyn trait object (use in `copy_any` below). Since the associated type is under user
3+
/// control in this usage, the compiler could be tricked to believe any type implemented any trait.
4+
/// This would ICE, except for pure marker traits like `Copy`. It did not require providing an
5+
/// instance of the dyn trait type, only name said type.
6+
trait Setup {
7+
type From: Copy;
8+
}
9+
10+
fn copy<U: Setup + ?Sized>(from: &U::From) -> U::From {
11+
*from
12+
}
13+
14+
pub fn copy_any<T>(t: &T) -> T {
15+
copy::<dyn Setup<From=T>>(t)
16+
//~^ ERROR the trait bound `T: Copy` is not satisfied
17+
}
18+
19+
fn main() {}

0 commit comments

Comments
 (0)