Skip to content

Commit 0a6c636

Browse files
committed
Auto merge of rust-lang#87156 - JohnTitor:rollup-osuhe53, r=JohnTitor
Rollup of 8 pull requests Successful merges: - rust-lang#85579 (Added Arc::try_pin) - rust-lang#86478 (Add -Zfuture-incompat-test to assist with testing future-incompat reports.) - rust-lang#86947 (Move assert_matches to an inner module) - rust-lang#87081 (Add tracking issue number to `wasi_ext`) - rust-lang#87127 (Add safety comments in private core::slice::rotate::ptr_rotate function) - rust-lang#87134 (Make SelfInTyParamDefault wording not be specific to type defaults) - rust-lang#87147 (Update cargo) - rust-lang#87154 (Fix misuse of rev attribute on <a> tag) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents b919797 + 262a4f9 commit 0a6c636

File tree

29 files changed

+197
-63
lines changed

29 files changed

+197
-63
lines changed

compiler/rustc_interface/src/tests.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,7 @@ fn test_debugging_options_tracking_hash() {
633633
untracked!(dump_mir_graphviz, true);
634634
untracked!(emit_future_incompat_report, true);
635635
untracked!(emit_stack_sizes, true);
636+
untracked!(future_incompat_test, true);
636637
untracked!(hir_stats, true);
637638
untracked!(identify_regions, true);
638639
untracked!(incremental_ignore_spans, true);

compiler/rustc_middle/src/ich/impls_syntax.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use crate::ich::StableHashingContext;
66
use rustc_ast as ast;
77
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
88
use rustc_span::{BytePos, NormalizedPos, SourceFile};
9+
use std::assert::assert_matches;
910

1011
use smallvec::SmallVec;
1112

compiler/rustc_middle/src/lint.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use rustc_hir::HirId;
88
use rustc_index::vec::IndexVec;
99
use rustc_session::lint::{
1010
builtin::{self, FORBIDDEN_LINT_GROUPS},
11-
FutureIncompatibilityReason, FutureIncompatibleInfo, Level, Lint, LintId,
11+
FutureIncompatibilityReason, Level, Lint, LintId,
1212
};
1313
use rustc_session::{DiagnosticMessageId, Session};
1414
use rustc_span::hygiene::MacroKind;
@@ -223,12 +223,12 @@ pub fn struct_lint_level<'s, 'd>(
223223
let lint_id = LintId::of(lint);
224224
let future_incompatible = lint.future_incompatible;
225225

226-
let has_future_breakage = matches!(
227-
future_incompatible,
228-
Some(FutureIncompatibleInfo {
229-
reason: FutureIncompatibilityReason::FutureReleaseErrorReportNow,
230-
..
231-
})
226+
let has_future_breakage = future_incompatible.map_or(
227+
// Default allow lints trigger too often for testing.
228+
sess.opts.debugging_opts.future_incompat_test && lint.default_level != Level::Allow,
229+
|incompat| {
230+
matches!(incompat.reason, FutureIncompatibilityReason::FutureReleaseErrorReportNow)
231+
},
232232
);
233233

234234
let mut err = match (level, span) {

compiler/rustc_mir/src/interpret/memory.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
//! integer. It is crucial that these operations call `check_align` *before*
77
//! short-circuiting the empty case!
88
9+
use std::assert::assert_matches;
910
use std::borrow::Cow;
1011
use std::collections::VecDeque;
1112
use std::convert::{TryFrom, TryInto};

compiler/rustc_resolve/src/diagnostics.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -502,14 +502,14 @@ impl<'a> Resolver<'a> {
502502

503503
err
504504
}
505-
ResolutionError::SelfInTyParamDefault => {
505+
ResolutionError::SelfInGenericParamDefault => {
506506
let mut err = struct_span_err!(
507507
self.session,
508508
span,
509509
E0735,
510-
"type parameters cannot use `Self` in their defaults"
510+
"generic parameters cannot use `Self` in their defaults"
511511
);
512-
err.span_label(span, "`Self` in type parameter default".to_string());
512+
err.span_label(span, "`Self` in generic parameter default".to_string());
513513
err
514514
}
515515
ResolutionError::UnreachableLabel { name, definition_span, suggestion } => {

compiler/rustc_resolve/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ enum ResolutionError<'a> {
249249
/// This error is only emitted when using `min_const_generics`.
250250
ParamInNonTrivialAnonConst { name: Symbol, is_type: bool },
251251
/// Error E0735: generic parameters with a default cannot use `Self`
252-
SelfInTyParamDefault,
252+
SelfInGenericParamDefault,
253253
/// Error E0767: use of unreachable label
254254
UnreachableLabel { name: Symbol, definition_span: Span, suggestion: Option<LabelSuggestion> },
255255
}
@@ -2643,7 +2643,7 @@ impl<'a> Resolver<'a> {
26432643
if let ForwardGenericParamBanRibKind = all_ribs[rib_index].kind {
26442644
if record_used {
26452645
let res_error = if rib_ident.name == kw::SelfUpper {
2646-
ResolutionError::SelfInTyParamDefault
2646+
ResolutionError::SelfInGenericParamDefault
26472647
} else {
26482648
ResolutionError::ForwardDeclaredGenericParam
26492649
};

compiler/rustc_session/src/options.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,6 +1084,8 @@ options! {
10841084
"set the optimization fuel quota for a crate"),
10851085
function_sections: Option<bool> = (None, parse_opt_bool, [TRACKED],
10861086
"whether each function should go in its own section"),
1087+
future_incompat_test: bool = (false, parse_bool, [UNTRACKED],
1088+
"forces all lints to be future incompatible, used for internal testing (default: no)"),
10871089
gcc_ld: Option<LdImpl> = (None, parse_gcc_ld, [TRACKED], "implementation of ld used by cc"),
10881090
graphviz_dark_mode: bool = (false, parse_bool, [UNTRACKED],
10891091
"use dark-themed colors in graphviz output (default: no)"),

library/alloc/src/sync.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ use core::marker::{PhantomData, Unpin, Unsize};
1919
use core::mem::size_of_val;
2020
use core::mem::{self, align_of_val_raw};
2121
use core::ops::{CoerceUnsized, Deref, DispatchFromDyn, Receiver};
22-
#[cfg(not(no_global_oom_handling))]
2322
use core::pin::Pin;
2423
use core::ptr::{self, NonNull};
2524
#[cfg(not(no_global_oom_handling))]
@@ -494,6 +493,13 @@ impl<T> Arc<T> {
494493
unsafe { Pin::new_unchecked(Arc::new(data)) }
495494
}
496495

496+
/// Constructs a new `Pin<Arc<T>>`, return an error if allocation fails.
497+
#[unstable(feature = "allocator_api", issue = "32838")]
498+
#[inline]
499+
pub fn try_pin(data: T) -> Result<Pin<Arc<T>>, AllocError> {
500+
unsafe { Ok(Pin::new_unchecked(Arc::try_new(data)?)) }
501+
}
502+
497503
/// Constructs a new `Arc<T>`, returning an error if allocation fails.
498504
///
499505
/// # Examples

library/core/src/lib.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,16 @@ use prelude::v1::*;
179179
#[macro_use]
180180
mod macros;
181181

182+
// We don't export this through #[macro_export] for now, to avoid breakage.
183+
// See https://github.com/rust-lang/rust/issues/82913
184+
#[cfg(not(test))]
185+
#[unstable(feature = "assert_matches", issue = "82775")]
186+
/// Unstable module containing the unstable `assert_matches` macro.
187+
pub mod assert {
188+
#[unstable(feature = "assert_matches", issue = "82775")]
189+
pub use crate::macros::{assert_matches, debug_assert_matches};
190+
}
191+
182192
#[macro_use]
183193
mod internal_macros;
184194

library/core/src/macros/mod.rs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ macro_rules! assert_ne {
127127
/// ```
128128
/// #![feature(assert_matches)]
129129
///
130+
/// use std::assert::assert_matches;
131+
///
130132
/// let a = 1u32.checked_add(2);
131133
/// let b = 1u32.checked_sub(2);
132134
/// assert_matches!(a, Some(_));
@@ -135,10 +137,10 @@ macro_rules! assert_ne {
135137
/// let c = Ok("abc".to_string());
136138
/// assert_matches!(c, Ok(x) | Err(x) if x.len() < 100);
137139
/// ```
138-
#[macro_export]
139140
#[unstable(feature = "assert_matches", issue = "82775")]
140141
#[allow_internal_unstable(core_panic)]
141-
macro_rules! assert_matches {
142+
#[rustc_macro_transparency = "semitransparent"]
143+
pub macro assert_matches {
142144
($left:expr, $( $pattern:pat_param )|+ $( if $guard: expr )? $(,)?) => ({
143145
match $left {
144146
$( $pattern )|+ $( if $guard )? => {}
@@ -150,7 +152,7 @@ macro_rules! assert_matches {
150152
);
151153
}
152154
}
153-
});
155+
}),
154156
($left:expr, $( $pattern:pat_param )|+ $( if $guard: expr )?, $($arg:tt)+) => ({
155157
match $left {
156158
$( $pattern )|+ $( if $guard )? => {}
@@ -162,7 +164,7 @@ macro_rules! assert_matches {
162164
);
163165
}
164166
}
165-
});
167+
}),
166168
}
167169

168170
/// Asserts that a boolean expression is `true` at runtime.
@@ -284,6 +286,8 @@ macro_rules! debug_assert_ne {
284286
/// ```
285287
/// #![feature(assert_matches)]
286288
///
289+
/// use std::assert::debug_assert_matches;
290+
///
287291
/// let a = 1u32.checked_add(2);
288292
/// let b = 1u32.checked_sub(2);
289293
/// debug_assert_matches!(a, Some(_));
@@ -295,8 +299,9 @@ macro_rules! debug_assert_ne {
295299
#[macro_export]
296300
#[unstable(feature = "assert_matches", issue = "82775")]
297301
#[allow_internal_unstable(assert_matches)]
298-
macro_rules! debug_assert_matches {
299-
($($arg:tt)*) => (if $crate::cfg!(debug_assertions) { $crate::assert_matches!($($arg)*); })
302+
#[rustc_macro_transparency = "semitransparent"]
303+
pub macro debug_assert_matches($($arg:tt)*) {
304+
if $crate::cfg!(debug_assertions) { $crate::assert::assert_matches!($($arg)*); }
300305
}
301306

302307
/// Returns whether the given expression matches any of the given patterns.

0 commit comments

Comments
 (0)