diff --git a/compiler/rustc_driver/src/lib.rs b/compiler/rustc_driver/src/lib.rs index 3f50c68e3ebf5..066a61a7a7b53 100644 --- a/compiler/rustc_driver/src/lib.rs +++ b/compiler/rustc_driver/src/lib.rs @@ -155,8 +155,7 @@ pub fn run_compiler( ), } } - let diagnostic_output = - emitter.map(|emitter| DiagnosticOutput::Raw(emitter)).unwrap_or(DiagnosticOutput::Default); + let diagnostic_output = emitter.map_or(DiagnosticOutput::Default, DiagnosticOutput::Raw); let matches = match handle_options(&args) { Some(matches) => matches, None => return Ok(()), diff --git a/compiler/rustc_interface/src/util.rs b/compiler/rustc_interface/src/util.rs index 7ace707cc88e9..c1b359c7d0de5 100644 --- a/compiler/rustc_interface/src/util.rs +++ b/compiler/rustc_interface/src/util.rs @@ -187,7 +187,7 @@ pub fn setup_callbacks_and_run_in_thread_pool_with_globals R + Se config = config.stack_size(size); } - let with_pool = move |pool: &rayon::ThreadPool| pool.install(move || f()); + let with_pool = move |pool: &rayon::ThreadPool| pool.install(f); rustc_span::with_session_globals(edition, || { rustc_span::SESSION_GLOBALS.with(|session_globals| { diff --git a/config.toml.example b/config.toml.example index c5efb8ed5e51c..6dc9eccbdfceb 100644 --- a/config.toml.example +++ b/config.toml.example @@ -382,6 +382,10 @@ changelog-seen = 1 # Overrides the `debug-assertions` option, if defined. # # Defaults to rust.debug-assertions value +# +# If you see a message from `tracing` saying +# `max_level_info` is enabled and means logging won't be shown, +# set this value to `true`. #debug-logging = debug-assertions # Debuginfo level for most of Rust code, corresponds to the `-C debuginfo=N` option of `rustc`. diff --git a/library/alloc/src/collections/btree/map.rs b/library/alloc/src/collections/btree/map.rs index 04f317401f15d..606bf94f99867 100644 --- a/library/alloc/src/collections/btree/map.rs +++ b/library/alloc/src/collections/btree/map.rs @@ -1783,6 +1783,10 @@ impl<'a, K: 'a, V: 'a> DrainFilterInner<'a, K, V> { /// Implementation of a typical `DrainFilter::size_hint` method. pub(super) fn size_hint(&self) -> (usize, Option) { + // In most of the btree iterators, `self.length` is the number of elements + // yet to be visited. Here, it includes elements that were visited and that + // the predicate decided not to drain. Making this upper bound more accurate + // requires maintaining an extra field and is not worth while. (0, Some(*self.length)) } } diff --git a/library/core/src/fmt/mod.rs b/library/core/src/fmt/mod.rs index 54772ebb523a3..0963c6d6cd7ea 100644 --- a/library/core/src/fmt/mod.rs +++ b/library/core/src/fmt/mod.rs @@ -92,18 +92,14 @@ pub type Result = result::Result<(), Error>; #[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] pub struct Error; -/// A collection of methods that are required to format a message into a stream. +/// A trait for writing or formatting into Unicode-accepting buffers or streams. /// -/// This trait is the type which this modules requires when formatting -/// information. This is similar to the standard library's [`io::Write`] trait, -/// but it is only intended for use in libcore. +/// This trait only accepts UTF-8–encoded data and is not [flushable]. If you only +/// want to accept Unicode and you don't need flushing, you should implement this trait; +/// otherwise you should implement [`std::io::Write`]. /// -/// This trait should generally not be implemented by consumers of the standard -/// library. The [`write!`] macro accepts an instance of [`io::Write`], and the -/// [`io::Write`] trait is favored over implementing this trait. -/// -/// [`write!`]: crate::write! -/// [`io::Write`]: ../../std/io/trait.Write.html +/// [`std::io::Write`]: ../../std/io/trait.Write.html +/// [flushable]: ../../std/io/trait.Write.html#tymethod.flush #[stable(feature = "rust1", since = "1.0.0")] pub trait Write { /// Writes a string slice into this writer, returning whether the write diff --git a/library/std/src/sync/mutex.rs b/library/std/src/sync/mutex.rs index e8f5a6f429486..a01ebb316e886 100644 --- a/library/std/src/sync/mutex.rs +++ b/library/std/src/sync/mutex.rs @@ -276,7 +276,7 @@ impl Mutex { /// # Errors /// /// If another user of this mutex panicked while holding the mutex, then - /// this call will return failure if the mutex would otherwise be + /// this call will return an error if the mutex would otherwise be /// acquired. /// /// # Examples diff --git a/src/llvm-project b/src/llvm-project index e8b556b6a8836..3adf16e0cb1a0 160000 --- a/src/llvm-project +++ b/src/llvm-project @@ -1 +1 @@ -Subproject commit e8b556b6a8836147429abe391d6ed18806867b45 +Subproject commit 3adf16e0cb1a0d9d7216883ac47857a6d1ee6581 diff --git a/src/test/compile-fail/issue-27675-unchecked-bounds.rs b/src/test/compile-fail/issue-27675-unchecked-bounds.rs new file mode 100644 index 0000000000000..1cfc230453120 --- /dev/null +++ b/src/test/compile-fail/issue-27675-unchecked-bounds.rs @@ -0,0 +1,19 @@ +/// The compiler previously did not properly check the bound of `From` when it was used from type +/// of the dyn trait object (use in `copy_any` below). Since the associated type is under user +/// control in this usage, the compiler could be tricked to believe any type implemented any trait. +/// This would ICE, except for pure marker traits like `Copy`. It did not require providing an +/// instance of the dyn trait type, only name said type. +trait Setup { + type From: Copy; +} + +fn copy(from: &U::From) -> U::From { + *from +} + +pub fn copy_any(t: &T) -> T { + copy::>(t) + //~^ ERROR the trait bound `T: Copy` is not satisfied +} + +fn main() {}