diff --git a/compiler/rustc_errors/src/diagnostic_builder.rs b/compiler/rustc_errors/src/diagnostic_builder.rs index 74e0f74294613..d218040847704 100644 --- a/compiler/rustc_errors/src/diagnostic_builder.rs +++ b/compiler/rustc_errors/src/diagnostic_builder.rs @@ -255,19 +255,6 @@ impl EmissionGuarantee for ! { /// instead of a `&DiagnosticBuilder<'a>`. This `forward!` macro makes /// it easy to declare such methods on the builder. macro_rules! forward { - // Forward pattern for &self -> &Self - ( - $(#[$attrs:meta])* - pub fn $n:ident(&self, $($name:ident: $ty:ty),* $(,)?) -> &Self - ) => { - $(#[$attrs])* - #[doc = concat!("See [`Diagnostic::", stringify!($n), "()`].")] - pub fn $n(&self, $($name: $ty),*) -> &Self { - self.diagnostic.$n($($name),*); - self - } - }; - // Forward pattern for &mut self -> &mut Self ( $(#[$attrs:meta])* diff --git a/compiler/rustc_middle/src/ty/codec.rs b/compiler/rustc_middle/src/ty/codec.rs index 7fcc46cc7c206..23c377651cc6c 100644 --- a/compiler/rustc_middle/src/ty/codec.rs +++ b/compiler/rustc_middle/src/ty/codec.rs @@ -453,9 +453,6 @@ macro_rules! impl_arena_allocatable_decoder { } } }; - ([$ignore:ident $(, $attrs:ident)*]$args:tt) => { - impl_arena_allocatable_decoder!([$($attrs),*]$args); - }; } macro_rules! impl_arena_allocatable_decoders { diff --git a/compiler/rustc_parse/src/parser/diagnostics.rs b/compiler/rustc_parse/src/parser/diagnostics.rs index ed2640451705b..acc0d7a6ee05e 100644 --- a/compiler/rustc_parse/src/parser/diagnostics.rs +++ b/compiler/rustc_parse/src/parser/diagnostics.rs @@ -431,10 +431,11 @@ impl<'a> Parser<'a> { return Ok(true); } else if self.look_ahead(0, |t| { t == &token::CloseDelim(token::Brace) - || ( - t.can_begin_expr() && t != &token::Semi && t != &token::Pound - // Avoid triggering with too many trailing `#` in raw string. - ) + || (t.can_begin_expr() && t != &token::Semi && t != &token::Pound) + // Avoid triggering with too many trailing `#` in raw string. + || (sm.is_multiline( + self.prev_token.span.shrink_to_hi().until(self.token.span.shrink_to_lo()) + ) && t == &token::Pound) }) { // Missing semicolon typo. This is triggered if the next token could either start a // new statement or is a block close. For example: @@ -508,7 +509,12 @@ impl<'a> Parser<'a> { } if self.check_too_many_raw_str_terminators(&mut err) { - return Err(err); + if expected.contains(&TokenType::Token(token::Semi)) && self.eat(&token::Semi) { + err.emit(); + return Ok(true); + } else { + return Err(err); + } } if self.prev_token.span == DUMMY_SP { @@ -538,6 +544,7 @@ impl<'a> Parser<'a> { } fn check_too_many_raw_str_terminators(&mut self, err: &mut Diagnostic) -> bool { + let sm = self.sess.source_map(); match (&self.prev_token.kind, &self.token.kind) { ( TokenKind::Literal(Lit { @@ -545,15 +552,33 @@ impl<'a> Parser<'a> { .. }), TokenKind::Pound, - ) => { + ) if !sm.is_multiline( + self.prev_token.span.shrink_to_hi().until(self.token.span.shrink_to_lo()), + ) => + { + let n_hashes: u8 = *n_hashes; err.set_primary_message("too many `#` when terminating raw string"); + let str_span = self.prev_token.span; + let mut span = self.token.span; + let mut count = 0; + while self.token.kind == TokenKind::Pound + && !sm.is_multiline(span.shrink_to_hi().until(self.token.span.shrink_to_lo())) + { + span = span.with_hi(self.token.span.hi()); + self.bump(); + count += 1; + } + err.set_span(span); err.span_suggestion( - self.token.span, - "remove the extra `#`", + span, + &format!("remove the extra `#`{}", pluralize!(count)), String::new(), Applicability::MachineApplicable, ); - err.note(&format!("the raw string started with {n_hashes} `#`s")); + err.span_label( + str_span, + &format!("this raw string started with {n_hashes} `#`{}", pluralize!(n_hashes)), + ); true } _ => false, diff --git a/compiler/rustc_serialize/src/serialize.rs b/compiler/rustc_serialize/src/serialize.rs index d5053034ed882..7d6b8c760ff6a 100644 --- a/compiler/rustc_serialize/src/serialize.rs +++ b/compiler/rustc_serialize/src/serialize.rs @@ -498,7 +498,6 @@ macro_rules! peel { /// Therefore, the recursion depth is the binary logarithm of the number of /// tokens to count, and the expanded tree is likewise very small. macro_rules! count { - () => (0usize); ($one:tt) => (1usize); ($($pairs:tt $_p:tt)*) => (count!($($pairs)*) << 1usize); ($odd:tt $($rest:tt)*) => (count!($($rest)*) | 1usize); diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs index bd5b712c143c5..965a3c109832b 100644 --- a/compiler/rustc_target/src/spec/mod.rs +++ b/compiler/rustc_target/src/spec/mod.rs @@ -2249,10 +2249,6 @@ impl ToJson for Target { let name = (stringify!($attr)).replace("_", "-"); d.insert(name, self.$attr.to_json()); }}; - ($attr:ident, $key_name:expr) => {{ - let name = $key_name; - d.insert(name.into(), self.$attr.to_json()); - }}; } macro_rules! target_option_val { diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs index 50e4fafdd6c82..082402a38e3f5 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs @@ -1727,6 +1727,7 @@ impl<'a, 'tcx> InferCtxtPrivExt<'a, 'tcx> for InferCtxt<'a, 'tcx> { } else if cat_a == cat_b { match (a.kind(), b.kind()) { (ty::Adt(def_a, _), ty::Adt(def_b, _)) => def_a == def_b, + (ty::Foreign(def_a), ty::Foreign(def_b)) => def_a == def_b, // Matching on references results in a lot of unhelpful // suggestions, so let's just not do that for now. // diff --git a/compiler/rustc_typeck/src/check/expr.rs b/compiler/rustc_typeck/src/check/expr.rs index e88082dbb9744..76ac356efd6d5 100644 --- a/compiler/rustc_typeck/src/check/expr.rs +++ b/compiler/rustc_typeck/src/check/expr.rs @@ -78,10 +78,18 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // While we don't allow *arbitrary* coercions here, we *do* allow // coercions from ! to `expected`. if ty.is_never() { - assert!( - !self.typeck_results.borrow().adjustments().contains_key(expr.hir_id), - "expression with never type wound up being adjusted" - ); + if let Some(adjustments) = self.typeck_results.borrow().adjustments().get(expr.hir_id) { + self.tcx().sess.delay_span_bug( + expr.span, + "expression with never type wound up being adjusted", + ); + return if let [Adjustment { kind: Adjust::NeverToAny, target }] = &adjustments[..] { + target.to_owned() + } else { + self.tcx().ty_error() + }; + } + let adj_ty = self.next_ty_var(TypeVariableOrigin { kind: TypeVariableOriginKind::AdjustmentType, span: expr.span, diff --git a/library/alloc/src/collections/linked_list.rs b/library/alloc/src/collections/linked_list.rs index d81f24e72024d..736b38370ab87 100644 --- a/library/alloc/src/collections/linked_list.rs +++ b/library/alloc/src/collections/linked_list.rs @@ -645,7 +645,7 @@ impl LinkedList { /// Returns `true` if the `LinkedList` contains an element equal to the /// given value. /// - /// This operation should compute in *O*(*n*) time. + /// This operation should compute linearly in *O*(*n*) time. /// /// # Examples /// @@ -1569,7 +1569,7 @@ impl<'a, T> CursorMut<'a, T> { /// Appends an element to the front of the cursor's parent list. The node /// that the cursor points to is unchanged, even if it is the "ghost" node. /// - /// This operation should compute in O(1) time. + /// This operation should compute in *O*(1) time. // `push_front` continues to point to "ghost" when it addes a node to mimic // the behavior of `insert_before` on an empty list. #[unstable(feature = "linked_list_cursors", issue = "58533")] @@ -1584,7 +1584,7 @@ impl<'a, T> CursorMut<'a, T> { /// Appends an element to the back of the cursor's parent list. The node /// that the cursor points to is unchanged, even if it is the "ghost" node. /// - /// This operation should compute in O(1) time. + /// This operation should compute in *O*(1) time. #[unstable(feature = "linked_list_cursors", issue = "58533")] pub fn push_back(&mut self, elt: T) { // Safety: We know that `push_back` does not change the position in @@ -1603,7 +1603,7 @@ impl<'a, T> CursorMut<'a, T> { /// unchanged, unless it was pointing to the front element. In that case, it /// points to the new front element. /// - /// This operation should compute in O(1) time. + /// This operation should compute in *O*(1) time. #[unstable(feature = "linked_list_cursors", issue = "58533")] pub fn pop_front(&mut self) -> Option { // We can't check if current is empty, we must check the list directly. @@ -1630,7 +1630,7 @@ impl<'a, T> CursorMut<'a, T> { /// unchanged, unless it was pointing to the back element. In that case, it /// points to the "ghost" element. /// - /// This operation should compute in O(1) time. + /// This operation should compute in *O*(1) time. #[unstable(feature = "linked_list_cursors", issue = "58533")] pub fn pop_back(&mut self) -> Option { if self.list.is_empty() { diff --git a/library/alloc/src/collections/vec_deque/mod.rs b/library/alloc/src/collections/vec_deque/mod.rs index 488671d8d8d19..ab14a43fb9379 100644 --- a/library/alloc/src/collections/vec_deque/mod.rs +++ b/library/alloc/src/collections/vec_deque/mod.rs @@ -1342,6 +1342,12 @@ impl VecDeque { /// Returns `true` if the deque contains an element equal to the /// given value. /// + /// This operation is *O*(*n*). + /// + /// Note that if you have a sorted `VecDeque`, [`binary_search`] may be faster. + /// + /// [`binary_search`]: VecDeque::binary_search + /// /// # Examples /// /// ``` @@ -2560,7 +2566,8 @@ impl VecDeque { } } - /// Binary searches the sorted deque for a given element. + /// Binary searches this `VecDeque` for a given element. + /// This behaves similarly to [`contains`] if this `VecDeque` is sorted. /// /// If the value is found then [`Result::Ok`] is returned, containing the /// index of the matching element. If there are multiple matches, then any @@ -2570,6 +2577,7 @@ impl VecDeque { /// /// See also [`binary_search_by`], [`binary_search_by_key`], and [`partition_point`]. /// + /// [`contains`]: VecDeque::contains /// [`binary_search_by`]: VecDeque::binary_search_by /// [`binary_search_by_key`]: VecDeque::binary_search_by_key /// [`partition_point`]: VecDeque::partition_point @@ -2614,7 +2622,8 @@ impl VecDeque { self.binary_search_by(|e| e.cmp(x)) } - /// Binary searches the sorted deque with a comparator function. + /// Binary searches this `VecDeque` with a comparator function. + /// This behaves similarly to [`contains`] if this `VecDeque` is sorted. /// /// The comparator function should implement an order consistent /// with the sort order of the deque, returning an order code that @@ -2629,6 +2638,7 @@ impl VecDeque { /// /// See also [`binary_search`], [`binary_search_by_key`], and [`partition_point`]. /// + /// [`contains`]: VecDeque::contains /// [`binary_search`]: VecDeque::binary_search /// [`binary_search_by_key`]: VecDeque::binary_search_by_key /// [`partition_point`]: VecDeque::partition_point @@ -2667,7 +2677,8 @@ impl VecDeque { } } - /// Binary searches the sorted deque with a key extraction function. + /// Binary searches this `VecDeque` with a key extraction function. + /// This behaves similarly to [`contains`] if this `VecDeque` is sorted. /// /// Assumes that the deque is sorted by the key, for instance with /// [`make_contiguous().sort_by_key()`] using the same key extraction function. @@ -2680,6 +2691,7 @@ impl VecDeque { /// /// See also [`binary_search`], [`binary_search_by`], and [`partition_point`]. /// + /// [`contains`]: VecDeque::contains /// [`make_contiguous().sort_by_key()`]: VecDeque::make_contiguous /// [`binary_search`]: VecDeque::binary_search /// [`binary_search_by`]: VecDeque::binary_search_by diff --git a/library/core/src/internal_macros.rs b/library/core/src/internal_macros.rs index 417ed51c6b6a2..7ef78e0b48af1 100644 --- a/library/core/src/internal_macros.rs +++ b/library/core/src/internal_macros.rs @@ -1,10 +1,6 @@ // implements the unary operator "op &T" // based on "op T" where T is expected to be `Copy`able macro_rules! forward_ref_unop { - (impl $imp:ident, $method:ident for $t:ty) => { - forward_ref_unop!(impl $imp, $method for $t, - #[stable(feature = "rust1", since = "1.0.0")]); - }; (impl const $imp:ident, $method:ident for $t:ty) => { forward_ref_unop!(impl const $imp, $method for $t, #[stable(feature = "rust1", since = "1.0.0")]); @@ -38,10 +34,6 @@ macro_rules! forward_ref_unop { // implements binary operators "&T op U", "T op &U", "&T op &U" // based on "T op U" where T and U are expected to be `Copy`able macro_rules! forward_ref_binop { - (impl $imp:ident, $method:ident for $t:ty, $u:ty) => { - forward_ref_binop!(impl $imp, $method for $t, $u, - #[stable(feature = "rust1", since = "1.0.0")]); - }; (impl const $imp:ident, $method:ident for $t:ty, $u:ty) => { forward_ref_binop!(impl const $imp, $method for $t, $u, #[stable(feature = "rust1", since = "1.0.0")]); @@ -230,22 +222,6 @@ macro_rules! cfg_if { } }; - // match if/else chains lacking a final `else` - ( - if #[cfg( $i_meta:meta )] { $( $i_tokens:tt )* } - $( - else if #[cfg( $e_meta:meta )] { $( $e_tokens:tt )* } - )* - ) => { - cfg_if! { - @__items () ; - (( $i_meta ) ( $( $i_tokens )* )) , - $( - (( $e_meta ) ( $( $e_tokens )* )) , - )* - } - }; - // Internal and recursive macro to emit all the items // // Collects all the previous cfgs in a list at the beginning, so they can be diff --git a/library/core/src/slice/mod.rs b/library/core/src/slice/mod.rs index 2a4030de00b4e..a226dea54a4f2 100644 --- a/library/core/src/slice/mod.rs +++ b/library/core/src/slice/mod.rs @@ -2139,6 +2139,12 @@ impl [T] { /// Returns `true` if the slice contains an element with the given value. /// + /// This operation is *O*(*n*). + /// + /// Note that if you have a sorted slice, [`binary_search`] may be faster. + /// + /// [`binary_search`]: slice::binary_search + /// /// # Examples /// /// ``` @@ -2298,7 +2304,8 @@ impl [T] { None } - /// Binary searches this sorted slice for a given element. + /// Binary searches this slice for a given element. + /// This behaves similary to [`contains`] if this slice is sorted. /// /// If the value is found then [`Result::Ok`] is returned, containing the /// index of the matching element. If there are multiple matches, then any @@ -2310,6 +2317,7 @@ impl [T] { /// /// See also [`binary_search_by`], [`binary_search_by_key`], and [`partition_point`]. /// + /// [`contains`]: slice::contains /// [`binary_search_by`]: slice::binary_search_by /// [`binary_search_by_key`]: slice::binary_search_by_key /// [`partition_point`]: slice::partition_point @@ -2349,7 +2357,8 @@ impl [T] { self.binary_search_by(|p| p.cmp(x)) } - /// Binary searches this sorted slice with a comparator function. + /// Binary searches this slice with a comparator function. + /// This behaves similarly to [`contains`] if this slice is sorted. /// /// The comparator function should implement an order consistent /// with the sort order of the underlying slice, returning an @@ -2366,6 +2375,7 @@ impl [T] { /// /// See also [`binary_search`], [`binary_search_by_key`], and [`partition_point`]. /// + /// [`contains`]: slice::contains /// [`binary_search`]: slice::binary_search /// [`binary_search_by_key`]: slice::binary_search_by_key /// [`partition_point`]: slice::partition_point @@ -2424,7 +2434,8 @@ impl [T] { Err(left) } - /// Binary searches this sorted slice with a key extraction function. + /// Binary searches this slice with a key extraction function. + /// This behaves similarly to [`contains`] if this slice is sorted. /// /// Assumes that the slice is sorted by the key, for instance with /// [`sort_by_key`] using the same key extraction function. @@ -2439,6 +2450,7 @@ impl [T] { /// /// See also [`binary_search`], [`binary_search_by`], and [`partition_point`]. /// + /// [`contains`]: slice::contains /// [`sort_by_key`]: slice::sort_by_key /// [`binary_search`]: slice::binary_search /// [`binary_search_by`]: slice::binary_search_by diff --git a/library/core/tests/num/ops.rs b/library/core/tests/num/ops.rs index 9979cc8fde434..ae8b938250ec9 100644 --- a/library/core/tests/num/ops.rs +++ b/library/core/tests/num/ops.rs @@ -43,18 +43,6 @@ macro_rules! impls_defined { } macro_rules! test_op { - ($fn_name:ident, $op:ident::$method:ident($lhs:literal, $rhs:literal), $result:literal, $($t:ty),+) => { - #[test] - fn $fn_name() { - impls_defined!($op, $method($lhs, $rhs), $result, $($t),+); - } - }; - ($fn_name:ident, $op:ident::$method:ident(&mut $lhs:literal, $rhs:literal), $result:literal, $($t:ty),+) => { - #[test] - fn $fn_name() { - impls_defined!($op, $method(&mut $lhs, $rhs), $result, $($t),+); - } - }; ($fn_name:ident, $op:ident::$method:ident($lhs:literal), $result:literal, $($t:ty),+) => { #[test] fn $fn_name() { diff --git a/library/proc_macro/src/quote.rs b/library/proc_macro/src/quote.rs index 1fd59889709b2..04fa696d5e6be 100644 --- a/library/proc_macro/src/quote.rs +++ b/library/proc_macro/src/quote.rs @@ -12,7 +12,6 @@ macro_rules! quote_tt { ({$($t:tt)*}) => { Group::new(Delimiter::Brace, quote!($($t)*)) }; (,) => { Punct::new(',', Spacing::Alone) }; (.) => { Punct::new('.', Spacing::Alone) }; - (:) => { Punct::new(':', Spacing::Alone) }; (;) => { Punct::new(';', Spacing::Alone) }; (!) => { Punct::new('!', Spacing::Alone) }; (<) => { Punct::new('<', Spacing::Alone) }; diff --git a/src/librustdoc/html/render/write_shared.rs b/src/librustdoc/html/render/write_shared.rs index 371d0e8408754..7c202e471adbe 100644 --- a/src/librustdoc/html/render/write_shared.rs +++ b/src/librustdoc/html/render/write_shared.rs @@ -21,27 +21,18 @@ use crate::{try_err, try_none}; static FILES_UNVERSIONED: Lazy> = Lazy::new(|| { map! { - "FiraSans-Regular.woff2" => static_files::fira_sans::REGULAR2, - "FiraSans-Medium.woff2" => static_files::fira_sans::MEDIUM2, - "FiraSans-Regular.woff" => static_files::fira_sans::REGULAR, - "FiraSans-Medium.woff" => static_files::fira_sans::MEDIUM, + "FiraSans-Regular.woff2" => static_files::fira_sans::REGULAR, + "FiraSans-Medium.woff2" => static_files::fira_sans::MEDIUM, "FiraSans-LICENSE.txt" => static_files::fira_sans::LICENSE, - "SourceSerif4-Regular.ttf.woff2" => static_files::source_serif_4::REGULAR2, - "SourceSerif4-Bold.ttf.woff2" => static_files::source_serif_4::BOLD2, - "SourceSerif4-It.ttf.woff2" => static_files::source_serif_4::ITALIC2, - "SourceSerif4-Regular.ttf.woff" => static_files::source_serif_4::REGULAR, - "SourceSerif4-Bold.ttf.woff" => static_files::source_serif_4::BOLD, - "SourceSerif4-It.ttf.woff" => static_files::source_serif_4::ITALIC, + "SourceSerif4-Regular.ttf.woff2" => static_files::source_serif_4::REGULAR, + "SourceSerif4-Bold.ttf.woff2" => static_files::source_serif_4::BOLD, + "SourceSerif4-It.ttf.woff2" => static_files::source_serif_4::ITALIC, "SourceSerif4-LICENSE.md" => static_files::source_serif_4::LICENSE, - "SourceCodePro-Regular.ttf.woff2" => static_files::source_code_pro::REGULAR2, - "SourceCodePro-Semibold.ttf.woff2" => static_files::source_code_pro::SEMIBOLD2, - "SourceCodePro-It.ttf.woff2" => static_files::source_code_pro::ITALIC2, - "SourceCodePro-Regular.ttf.woff" => static_files::source_code_pro::REGULAR, - "SourceCodePro-Semibold.ttf.woff" => static_files::source_code_pro::SEMIBOLD, - "SourceCodePro-It.ttf.woff" => static_files::source_code_pro::ITALIC, + "SourceCodePro-Regular.ttf.woff2" => static_files::source_code_pro::REGULAR, + "SourceCodePro-Semibold.ttf.woff2" => static_files::source_code_pro::SEMIBOLD, + "SourceCodePro-It.ttf.woff2" => static_files::source_code_pro::ITALIC, "SourceCodePro-LICENSE.txt" => static_files::source_code_pro::LICENSE, - "NanumBarunGothic.ttf.woff2" => static_files::nanum_barun_gothic::REGULAR2, - "NanumBarunGothic.ttf.woff" => static_files::nanum_barun_gothic::REGULAR, + "NanumBarunGothic.ttf.woff2" => static_files::nanum_barun_gothic::REGULAR, "NanumBarunGothic-LICENSE.txt" => static_files::nanum_barun_gothic::LICENSE, "LICENSE-MIT.txt" => static_files::LICENSE_MIT, "LICENSE-APACHE.txt" => static_files::LICENSE_APACHE, diff --git a/src/librustdoc/html/static/COPYRIGHT.txt b/src/librustdoc/html/static/COPYRIGHT.txt index c2629a83f7092..34e48134cc34c 100644 --- a/src/librustdoc/html/static/COPYRIGHT.txt +++ b/src/librustdoc/html/static/COPYRIGHT.txt @@ -2,8 +2,7 @@ These documentation pages include resources by third parties. This copyright file applies only to those resources. The following third party resources are included, and carry their own copyright notices and license terms: -* Fira Sans (FiraSans-Regular.woff2, FiraSans-Medium.woff2, - FiraSans-Regular.woff, FiraSans-Medium.woff): +* Fira Sans (FiraSans-Regular.woff2, FiraSans-Medium.woff2): Copyright (c) 2014, Mozilla Foundation https://mozilla.org/ with Reserved Font Name Fira Sans. @@ -25,9 +24,7 @@ included, and carry their own copyright notices and license terms: Licensed under the MIT license (see LICENSE-MIT.txt). * Source Code Pro (SourceCodePro-Regular.ttf.woff2, - SourceCodePro-Semibold.ttf.woff2, SourceCodePro-It.ttf.woff2, - SourceCodePro-Regular.ttf.woff, SourceCodePro-Semibold.ttf.woff, - SourceCodePro-It.ttf.woff): + SourceCodePro-Semibold.ttf.woff2, SourceCodePro-It.ttf.woff2): Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark @@ -37,8 +34,7 @@ included, and carry their own copyright notices and license terms: See SourceCodePro-LICENSE.txt. * Source Serif 4 (SourceSerif4-Regular.ttf.woff2, SourceSerif4-Bold.ttf.woff2, - SourceSerif4-It.ttf.woff2, SourceSerif4-Regular.ttf.woff, - SourceSerif4-Bold.ttf.woff, SourceSerif4-It.ttf.woff): + SourceSerif4-It.ttf.woff2): Copyright 2014-2021 Adobe (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe in the United diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index 48cb0a46ad627..81c12be8e83c0 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -4,8 +4,7 @@ font-style: normal; font-weight: 400; src: local('Fira Sans'), - url("FiraSans-Regular.woff2") format("woff2"), - url("FiraSans-Regular.woff") format('woff'); + url("FiraSans-Regular.woff2") format("woff2"); font-display: swap; } @font-face { @@ -13,8 +12,7 @@ font-style: normal; font-weight: 500; src: local('Fira Sans Medium'), - url("FiraSans-Medium.woff2") format("woff2"), - url("FiraSans-Medium.woff") format('woff'); + url("FiraSans-Medium.woff2") format("woff2"); font-display: swap; } @@ -24,8 +22,7 @@ font-style: normal; font-weight: 400; src: local('Source Serif 4'), - url("SourceSerif4-Regular.ttf.woff2") format("woff2"), - url("SourceSerif4-Regular.ttf.woff") format("woff"); + url("SourceSerif4-Regular.ttf.woff2") format("woff2"); font-display: swap; } @font-face { @@ -33,8 +30,7 @@ font-style: italic; font-weight: 400; src: local('Source Serif 4 Italic'), - url("SourceSerif4-It.ttf.woff2") format("woff2"), - url("SourceSerif4-It.ttf.woff") format("woff"); + url("SourceSerif4-It.ttf.woff2") format("woff2"); font-display: swap; } @font-face { @@ -42,8 +38,7 @@ font-style: normal; font-weight: 700; src: local('Source Serif 4 Bold'), - url("SourceSerif4-Bold.ttf.woff2") format("woff2"), - url("SourceSerif4-Bold.ttf.woff") format("woff"); + url("SourceSerif4-Bold.ttf.woff2") format("woff2"); font-display: swap; } @@ -54,32 +49,28 @@ font-weight: 400; /* Avoid using locally installed font because bad versions are in circulation: * see https://github.com/rust-lang/rust/issues/24355 */ - src: url("SourceCodePro-Regular.ttf.woff2") format("woff2"), - url("SourceCodePro-Regular.ttf.woff") format("woff"); + src: url("SourceCodePro-Regular.ttf.woff2") format("woff2"); font-display: swap; } @font-face { font-family: 'Source Code Pro'; font-style: italic; font-weight: 400; - src: url("SourceCodePro-It.ttf.woff2") format("woff2"), - url("SourceCodePro-It.ttf.woff") format("woff"); + src: url("SourceCodePro-It.ttf.woff2") format("woff2"); font-display: swap; } @font-face { font-family: 'Source Code Pro'; font-style: normal; font-weight: 600; - src: url("SourceCodePro-Semibold.ttf.woff2") format("woff2"), - url("SourceCodePro-Semibold.ttf.woff") format("woff"); + src: url("SourceCodePro-Semibold.ttf.woff2") format("woff2"); font-display: swap; } /* Avoid using legacy CJK serif fonts in Windows like Batang. */ @font-face { font-family: 'NanumBarunGothic'; - src: url("NanumBarunGothic.ttf.woff2") format("woff2"), - url("NanumBarunGothic.ttf.woff") format("woff"); + src: url("NanumBarunGothic.ttf.woff2") format("woff2"); font-display: swap; unicode-range: U+AC00-D7AF, U+1100-11FF, U+3130-318F, U+A960-A97F, U+D7B0-D7FF; } diff --git a/src/librustdoc/html/static/fonts/FiraSans-Medium.woff b/src/librustdoc/html/static/fonts/FiraSans-Medium.woff deleted file mode 100644 index 7d742c5fb7d45..0000000000000 Binary files a/src/librustdoc/html/static/fonts/FiraSans-Medium.woff and /dev/null differ diff --git a/src/librustdoc/html/static/fonts/FiraSans-Regular.woff b/src/librustdoc/html/static/fonts/FiraSans-Regular.woff deleted file mode 100644 index d8e0363f4e1a0..0000000000000 Binary files a/src/librustdoc/html/static/fonts/FiraSans-Regular.woff and /dev/null differ diff --git a/src/librustdoc/html/static/fonts/NanumBarunGothic.ttf.woff b/src/librustdoc/html/static/fonts/NanumBarunGothic.ttf.woff deleted file mode 100644 index fb063e8fb7dc5..0000000000000 Binary files a/src/librustdoc/html/static/fonts/NanumBarunGothic.ttf.woff and /dev/null differ diff --git a/src/librustdoc/html/static/fonts/SourceCodePro-It.ttf.woff b/src/librustdoc/html/static/fonts/SourceCodePro-It.ttf.woff deleted file mode 100644 index 8d68f2febddb0..0000000000000 Binary files a/src/librustdoc/html/static/fonts/SourceCodePro-It.ttf.woff and /dev/null differ diff --git a/src/librustdoc/html/static/fonts/SourceCodePro-Regular.ttf.woff b/src/librustdoc/html/static/fonts/SourceCodePro-Regular.ttf.woff deleted file mode 100644 index 7be076e1fca99..0000000000000 Binary files a/src/librustdoc/html/static/fonts/SourceCodePro-Regular.ttf.woff and /dev/null differ diff --git a/src/librustdoc/html/static/fonts/SourceCodePro-Semibold.ttf.woff b/src/librustdoc/html/static/fonts/SourceCodePro-Semibold.ttf.woff deleted file mode 100644 index 61bc67b80252d..0000000000000 Binary files a/src/librustdoc/html/static/fonts/SourceCodePro-Semibold.ttf.woff and /dev/null differ diff --git a/src/librustdoc/html/static/fonts/SourceSerif4-Bold.ttf.woff b/src/librustdoc/html/static/fonts/SourceSerif4-Bold.ttf.woff deleted file mode 100644 index 8ad41888e6e3f..0000000000000 Binary files a/src/librustdoc/html/static/fonts/SourceSerif4-Bold.ttf.woff and /dev/null differ diff --git a/src/librustdoc/html/static/fonts/SourceSerif4-It.ttf.woff b/src/librustdoc/html/static/fonts/SourceSerif4-It.ttf.woff deleted file mode 100644 index 2a34b5c42a8aa..0000000000000 Binary files a/src/librustdoc/html/static/fonts/SourceSerif4-It.ttf.woff and /dev/null differ diff --git a/src/librustdoc/html/static/fonts/SourceSerif4-Regular.ttf.woff b/src/librustdoc/html/static/fonts/SourceSerif4-Regular.ttf.woff deleted file mode 100644 index 45a5521ab0c77..0000000000000 Binary files a/src/librustdoc/html/static/fonts/SourceSerif4-Regular.ttf.woff and /dev/null differ diff --git a/src/librustdoc/html/static_files.rs b/src/librustdoc/html/static_files.rs index 1837e4a3b650a..bec5c083fed22 100644 --- a/src/librustdoc/html/static_files.rs +++ b/src/librustdoc/html/static_files.rs @@ -92,17 +92,11 @@ crate mod themes { /// Files related to the Fira Sans font. crate mod fira_sans { - /// The file `FiraSans-Regular.woff`, the Regular variant of the Fira Sans font. - crate static REGULAR: &[u8] = include_bytes!("static/fonts/FiraSans-Regular.woff"); - /// The file `FiraSans-Regular.woff2`, the Regular variant of the Fira Sans font in woff2. - crate static REGULAR2: &[u8] = include_bytes!("static/fonts/FiraSans-Regular.woff2"); - - /// The file `FiraSans-Medium.woff`, the Medium variant of the Fira Sans font. - crate static MEDIUM: &[u8] = include_bytes!("static/fonts/FiraSans-Medium.woff"); + crate static REGULAR: &[u8] = include_bytes!("static/fonts/FiraSans-Regular.woff2"); /// The file `FiraSans-Medium.woff2`, the Medium variant of the Fira Sans font in woff2. - crate static MEDIUM2: &[u8] = include_bytes!("static/fonts/FiraSans-Medium.woff2"); + crate static MEDIUM: &[u8] = include_bytes!("static/fonts/FiraSans-Medium.woff2"); /// The file `FiraSans-LICENSE.txt`, the license text for the Fira Sans font. crate static LICENSE: &[u8] = include_bytes!("static/fonts/FiraSans-LICENSE.txt"); @@ -110,26 +104,17 @@ crate mod fira_sans { /// Files related to the Source Serif 4 font. crate mod source_serif_4 { - /// The file `SourceSerif4-Regular.ttf.woff`, the Regular variant of the Source Serif 4 font. - crate static REGULAR: &[u8] = include_bytes!("static/fonts/SourceSerif4-Regular.ttf.woff"); - /// The file `SourceSerif4-Regular.ttf.woff2`, the Regular variant of the Source Serif 4 font in /// woff2. - crate static REGULAR2: &[u8] = include_bytes!("static/fonts/SourceSerif4-Regular.ttf.woff2"); - - /// The file `SourceSerif4-Bold.ttf.woff`, the Bold variant of the Source Serif 4 font. - crate static BOLD: &[u8] = include_bytes!("static/fonts/SourceSerif4-Bold.ttf.woff"); + crate static REGULAR: &[u8] = include_bytes!("static/fonts/SourceSerif4-Regular.ttf.woff2"); /// The file `SourceSerif4-Bold.ttf.woff2`, the Bold variant of the Source Serif 4 font in /// woff2. - crate static BOLD2: &[u8] = include_bytes!("static/fonts/SourceSerif4-Bold.ttf.woff2"); - - /// The file `SourceSerif4-It.ttf.woff`, the Italic variant of the Source Serif 4 font. - crate static ITALIC: &[u8] = include_bytes!("static/fonts/SourceSerif4-It.ttf.woff"); + crate static BOLD: &[u8] = include_bytes!("static/fonts/SourceSerif4-Bold.ttf.woff2"); /// The file `SourceSerif4-It.ttf.woff2`, the Italic variant of the Source Serif 4 font in /// woff2. - crate static ITALIC2: &[u8] = include_bytes!("static/fonts/SourceSerif4-It.ttf.woff2"); + crate static ITALIC: &[u8] = include_bytes!("static/fonts/SourceSerif4-It.ttf.woff2"); /// The file `SourceSerif4-LICENSE.txt`, the license text for the Source Serif 4 font. crate static LICENSE: &[u8] = include_bytes!("static/fonts/SourceSerif4-LICENSE.md"); @@ -137,27 +122,17 @@ crate mod source_serif_4 { /// Files related to the Source Code Pro font. crate mod source_code_pro { - /// The file `SourceCodePro-Regular.ttf.woff`, the Regular variant of the Source Code Pro font. - crate static REGULAR: &[u8] = include_bytes!("static/fonts/SourceCodePro-Regular.ttf.woff"); - /// The file `SourceCodePro-Regular.ttf.woff2`, the Regular variant of the Source Code Pro font /// in woff2. - crate static REGULAR2: &[u8] = include_bytes!("static/fonts/SourceCodePro-Regular.ttf.woff2"); - - /// The file `SourceCodePro-Semibold.ttf.woff`, the Semibold variant of the Source Code Pro - /// font. - crate static SEMIBOLD: &[u8] = include_bytes!("static/fonts/SourceCodePro-Semibold.ttf.woff"); + crate static REGULAR: &[u8] = include_bytes!("static/fonts/SourceCodePro-Regular.ttf.woff2"); /// The file `SourceCodePro-Semibold.ttf.woff2`, the Semibold variant of the Source Code Pro /// font in woff2. - crate static SEMIBOLD2: &[u8] = include_bytes!("static/fonts/SourceCodePro-Semibold.ttf.woff2"); - - /// The file `SourceCodePro-It.ttf.woff`, the Italic variant of the Source Code Pro font. - crate static ITALIC: &[u8] = include_bytes!("static/fonts/SourceCodePro-It.ttf.woff"); + crate static SEMIBOLD: &[u8] = include_bytes!("static/fonts/SourceCodePro-Semibold.ttf.woff2"); /// The file `SourceCodePro-It.ttf.woff2`, the Italic variant of the Source Code Pro font in /// woff2. - crate static ITALIC2: &[u8] = include_bytes!("static/fonts/SourceCodePro-It.ttf.woff2"); + crate static ITALIC: &[u8] = include_bytes!("static/fonts/SourceCodePro-It.ttf.woff2"); /// The file `SourceCodePro-LICENSE.txt`, the license text of the Source Code Pro font. crate static LICENSE: &[u8] = include_bytes!("static/fonts/SourceCodePro-LICENSE.txt"); @@ -176,19 +151,11 @@ crate mod source_code_pro { /// ```sh /// pyftsubset NanumBarunGothic.ttf \ /// --unicodes=U+AC00-D7AF,U+1100-11FF,U+3130-318F,U+A960-A97F,U+D7B0-D7FF \ -/// --output-file=NanumBarunGothic.ttf.woff --flavor=woff -/// ``` -/// ```sh -/// pyftsubset NanumBarunGothic.ttf \ -/// --unicodes=U+AC00-D7AF,U+1100-11FF,U+3130-318F,U+A960-A97F,U+D7B0-D7FF \ /// --output-file=NanumBarunGothic.ttf.woff2 --flavor=woff2 /// ``` crate mod nanum_barun_gothic { - /// The file `NanumBarunGothic.ttf.woff`, the Regular variant of the Nanum Barun Gothic font. - crate static REGULAR: &[u8] = include_bytes!("static/fonts/NanumBarunGothic.ttf.woff"); - /// The file `NanumBarunGothic.ttf.woff2`, the Regular variant of the Nanum Barun Gothic font. - crate static REGULAR2: &[u8] = include_bytes!("static/fonts/NanumBarunGothic.ttf.woff2"); + crate static REGULAR: &[u8] = include_bytes!("static/fonts/NanumBarunGothic.ttf.woff2"); /// The file `NanumBarunGothic-LICENSE.txt`, the license text of the Nanum Barun Gothic font. crate static LICENSE: &[u8] = include_bytes!("static/fonts/NanumBarunGothic-LICENSE.txt"); diff --git a/src/test/run-make/emit-shared-files/Makefile b/src/test/run-make/emit-shared-files/Makefile index d89b526d4303f..9f46883beaacc 100644 --- a/src/test/run-make/emit-shared-files/Makefile +++ b/src/test/run-make/emit-shared-files/Makefile @@ -14,7 +14,7 @@ invocation-only: [ -e $(INVOCATION_ONLY)/x/index.html ] [ -e $(INVOCATION_ONLY)/theme-xxx.css ] # generated from z.css ! [ -e $(INVOCATION_ONLY)/storage-xxx.js ] - ! [ -e $(INVOCATION_ONLY)/SourceSerif4-It.ttf.woff ] + ! [ -e $(INVOCATION_ONLY)/SourceSerif4-It.ttf.woff2 ] # FIXME: this probably shouldn't have a suffix [ -e $(INVOCATION_ONLY)/y-xxx.css ] @@ -24,7 +24,7 @@ invocation-only: toolchain-only: $(RUSTDOC) -Z unstable-options --emit=toolchain-shared-resources --output $(TOOLCHAIN_ONLY) --resource-suffix=-xxx --extend-css z.css x.rs [ -e $(TOOLCHAIN_ONLY)/storage-xxx.js ] - ! [ -e $(TOOLCHAIN_ONLY)/SourceSerif4-It.ttf.woff ] + ! [ -e $(TOOLCHAIN_ONLY)/SourceSerif4-It.ttf.woff2 ] ! [ -e $(TOOLCHAIN_ONLY)/search-index-xxx.js ] ! [ -e $(TOOLCHAIN_ONLY)/x/index.html ] ! [ -e $(TOOLCHAIN_ONLY)/theme.css ] @@ -35,7 +35,7 @@ toolchain-only: all-shared: $(RUSTDOC) -Z unstable-options --emit=toolchain-shared-resources,unversioned-shared-resources --output $(ALL_SHARED) --resource-suffix=-xxx --extend-css z.css x.rs [ -e $(ALL_SHARED)/storage-xxx.js ] - [ -e $(ALL_SHARED)/SourceSerif4-It.ttf.woff ] + [ -e $(ALL_SHARED)/SourceSerif4-It.ttf.woff2 ] ! [ -e $(ALL_SHARED)/search-index-xxx.js ] ! [ -e $(ALL_SHARED)/settings.html ] ! [ -e $(ALL_SHARED)/x ] diff --git a/src/test/ui/extern/extern-type-diag-not-similar.rs b/src/test/ui/extern/extern-type-diag-not-similar.rs new file mode 100644 index 0000000000000..39d00a6c1bc31 --- /dev/null +++ b/src/test/ui/extern/extern-type-diag-not-similar.rs @@ -0,0 +1,22 @@ +// We previously mentioned other extern types in the error message here. +// +// Two extern types shouldn't really be considered similar just +// because they are both extern types. + +#![feature(extern_types)] +extern { + type ShouldNotBeMentioned; +} + +extern { + type Foo; +} + +unsafe impl Send for ShouldNotBeMentioned {} + +fn assert_send() {} + +fn main() { + assert_send::() + //~^ ERROR `Foo` cannot be sent between threads safely +} diff --git a/src/test/ui/extern/extern-type-diag-not-similar.stderr b/src/test/ui/extern/extern-type-diag-not-similar.stderr new file mode 100644 index 0000000000000..75836f7eca19c --- /dev/null +++ b/src/test/ui/extern/extern-type-diag-not-similar.stderr @@ -0,0 +1,16 @@ +error[E0277]: `Foo` cannot be sent between threads safely + --> $DIR/extern-type-diag-not-similar.rs:20:19 + | +LL | assert_send::() + | ^^^ `Foo` cannot be sent between threads safely + | + = help: the trait `Send` is not implemented for `Foo` +note: required by a bound in `assert_send` + --> $DIR/extern-type-diag-not-similar.rs:17:19 + | +LL | fn assert_send() {} + | ^^^^ required by this bound in `assert_send` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/never_type/issue-96335.rs b/src/test/ui/never_type/issue-96335.rs new file mode 100644 index 0000000000000..411a7c9df657b --- /dev/null +++ b/src/test/ui/never_type/issue-96335.rs @@ -0,0 +1,5 @@ +fn main() { + 0.....{loop{}1}; + //~^ ERROR unexpected token + //~| ERROR mismatched types +} diff --git a/src/test/ui/never_type/issue-96335.stderr b/src/test/ui/never_type/issue-96335.stderr new file mode 100644 index 0000000000000..168cf2f83535d --- /dev/null +++ b/src/test/ui/never_type/issue-96335.stderr @@ -0,0 +1,35 @@ +error: unexpected token: `...` + --> $DIR/issue-96335.rs:2:6 + | +LL | 0.....{loop{}1}; + | ^^^ + | +help: use `..` for an exclusive range + | +LL | 0....{loop{}1}; + | ~~ +help: or `..=` for an inclusive range + | +LL | 0..=..{loop{}1}; + | ~~~ + +error[E0308]: mismatched types + --> $DIR/issue-96335.rs:2:9 + | +LL | 0.....{loop{}1}; + | ----^^^^^^^^^^^ + | | | + | | expected integer, found struct `RangeTo` + | arguments to this function are incorrect + | + = note: expected type `{integer}` + found struct `RangeTo<{integer}>` +note: associated function defined here + --> $SRC_DIR/core/src/ops/range.rs:LL:COL + | +LL | pub const fn new(start: Idx, end: Idx) -> Self { + | ^^^ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/parser/raw/raw-str-unbalanced.rs b/src/test/ui/parser/raw/raw-str-unbalanced.rs index 35f118f5ce6ee..38537f8b31e64 100644 --- a/src/test/ui/parser/raw/raw-str-unbalanced.rs +++ b/src/test/ui/parser/raw/raw-str-unbalanced.rs @@ -1,4 +1,22 @@ static s: &'static str = + r#""## //~ ERROR too many `#` when terminating raw string +; + +static s2: &'static str = r#" - "## //~ too many `#` when terminating raw string + "#### //~ ERROR too many `#` when terminating raw string ; + +const A: &'static str = r"" //~ ERROR expected `;`, found `#` + +// Test +#[test] +fn test() {} + +const B: &'static str = r""## //~ ERROR too many `#` when terminating raw string + +// Test +#[test] +fn test2() {} + +fn main() {} diff --git a/src/test/ui/parser/raw/raw-str-unbalanced.stderr b/src/test/ui/parser/raw/raw-str-unbalanced.stderr index bf8f3a7a5a4bd..eac8c06c1df5c 100644 --- a/src/test/ui/parser/raw/raw-str-unbalanced.stderr +++ b/src/test/ui/parser/raw/raw-str-unbalanced.stderr @@ -1,10 +1,36 @@ error: too many `#` when terminating raw string - --> $DIR/raw-str-unbalanced.rs:3:9 + --> $DIR/raw-str-unbalanced.rs:2:10 | -LL | "## - | ^ help: remove the extra `#` +LL | r#""## + | -----^ help: remove the extra `#` + | | + | this raw string started with 1 `#` + +error: too many `#` when terminating raw string + --> $DIR/raw-str-unbalanced.rs:7:9 + | +LL | / r#" +LL | | "#### + | | -^^^ help: remove the extra `#`s + | |________| + | this raw string started with 1 `#` + +error: expected `;`, found `#` + --> $DIR/raw-str-unbalanced.rs:10:28 + | +LL | const A: &'static str = r"" + | ^ help: add `;` here +... +LL | #[test] + | - unexpected token + +error: too many `#` when terminating raw string + --> $DIR/raw-str-unbalanced.rs:16:28 | - = note: the raw string started with 1 `#`s +LL | const B: &'static str = r""## + | ---^^ help: remove the extra `#`s + | | + | this raw string started with 0 `#`s -error: aborting due to previous error +error: aborting due to 4 previous errors