Auto merge of #87156 - JohnTitor:rollup-osuhe53, r=JohnTitor
Rollup of 8 pull requests Successful merges: - #85579 (Added Arc::try_pin) - #86478 (Add -Zfuture-incompat-test to assist with testing future-incompat reports.) - #86947 (Move assert_matches to an inner module) - #87081 (Add tracking issue number to `wasi_ext`) - #87127 (Add safety comments in private core::slice::rotate::ptr_rotate function) - #87134 (Make SelfInTyParamDefault wording not be specific to type defaults) - #87147 (Update cargo) - #87154 (Fix misuse of rev attribute on <a> tag) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
0a6c636c40
@ -633,6 +633,7 @@ macro_rules! untracked {
|
||||
untracked!(dump_mir_graphviz, true);
|
||||
untracked!(emit_future_incompat_report, true);
|
||||
untracked!(emit_stack_sizes, true);
|
||||
untracked!(future_incompat_test, true);
|
||||
untracked!(hir_stats, true);
|
||||
untracked!(identify_regions, true);
|
||||
untracked!(incremental_ignore_spans, true);
|
||||
|
@ -6,6 +6,7 @@
|
||||
use rustc_ast as ast;
|
||||
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
|
||||
use rustc_span::{BytePos, NormalizedPos, SourceFile};
|
||||
use std::assert::assert_matches;
|
||||
|
||||
use smallvec::SmallVec;
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
use rustc_index::vec::IndexVec;
|
||||
use rustc_session::lint::{
|
||||
builtin::{self, FORBIDDEN_LINT_GROUPS},
|
||||
FutureIncompatibilityReason, FutureIncompatibleInfo, Level, Lint, LintId,
|
||||
FutureIncompatibilityReason, Level, Lint, LintId,
|
||||
};
|
||||
use rustc_session::{DiagnosticMessageId, Session};
|
||||
use rustc_span::hygiene::MacroKind;
|
||||
@ -223,12 +223,12 @@ fn struct_lint_level_impl(
|
||||
let lint_id = LintId::of(lint);
|
||||
let future_incompatible = lint.future_incompatible;
|
||||
|
||||
let has_future_breakage = matches!(
|
||||
future_incompatible,
|
||||
Some(FutureIncompatibleInfo {
|
||||
reason: FutureIncompatibilityReason::FutureReleaseErrorReportNow,
|
||||
..
|
||||
})
|
||||
let has_future_breakage = future_incompatible.map_or(
|
||||
// Default allow lints trigger too often for testing.
|
||||
sess.opts.debugging_opts.future_incompat_test && lint.default_level != Level::Allow,
|
||||
|incompat| {
|
||||
matches!(incompat.reason, FutureIncompatibilityReason::FutureReleaseErrorReportNow)
|
||||
},
|
||||
);
|
||||
|
||||
let mut err = match (level, span) {
|
||||
|
@ -6,6 +6,7 @@
|
||||
//! integer. It is crucial that these operations call `check_align` *before*
|
||||
//! short-circuiting the empty case!
|
||||
|
||||
use std::assert::assert_matches;
|
||||
use std::borrow::Cow;
|
||||
use std::collections::VecDeque;
|
||||
use std::convert::{TryFrom, TryInto};
|
||||
|
@ -502,14 +502,14 @@ impl<'a> Resolver<'a> {
|
||||
|
||||
err
|
||||
}
|
||||
ResolutionError::SelfInTyParamDefault => {
|
||||
ResolutionError::SelfInGenericParamDefault => {
|
||||
let mut err = struct_span_err!(
|
||||
self.session,
|
||||
span,
|
||||
E0735,
|
||||
"type parameters cannot use `Self` in their defaults"
|
||||
"generic parameters cannot use `Self` in their defaults"
|
||||
);
|
||||
err.span_label(span, "`Self` in type parameter default".to_string());
|
||||
err.span_label(span, "`Self` in generic parameter default".to_string());
|
||||
err
|
||||
}
|
||||
ResolutionError::UnreachableLabel { name, definition_span, suggestion } => {
|
||||
|
@ -249,7 +249,7 @@ enum ResolutionError<'a> {
|
||||
/// This error is only emitted when using `min_const_generics`.
|
||||
ParamInNonTrivialAnonConst { name: Symbol, is_type: bool },
|
||||
/// Error E0735: generic parameters with a default cannot use `Self`
|
||||
SelfInTyParamDefault,
|
||||
SelfInGenericParamDefault,
|
||||
/// Error E0767: use of unreachable label
|
||||
UnreachableLabel { name: Symbol, definition_span: Span, suggestion: Option<LabelSuggestion> },
|
||||
}
|
||||
@ -2643,7 +2643,7 @@ fn validate_res_from_ribs(
|
||||
if let ForwardGenericParamBanRibKind = all_ribs[rib_index].kind {
|
||||
if record_used {
|
||||
let res_error = if rib_ident.name == kw::SelfUpper {
|
||||
ResolutionError::SelfInTyParamDefault
|
||||
ResolutionError::SelfInGenericParamDefault
|
||||
} else {
|
||||
ResolutionError::ForwardDeclaredGenericParam
|
||||
};
|
||||
|
@ -1084,6 +1084,8 @@ mod parse {
|
||||
"set the optimization fuel quota for a crate"),
|
||||
function_sections: Option<bool> = (None, parse_opt_bool, [TRACKED],
|
||||
"whether each function should go in its own section"),
|
||||
future_incompat_test: bool = (false, parse_bool, [UNTRACKED],
|
||||
"forces all lints to be future incompatible, used for internal testing (default: no)"),
|
||||
gcc_ld: Option<LdImpl> = (None, parse_gcc_ld, [TRACKED], "implementation of ld used by cc"),
|
||||
graphviz_dark_mode: bool = (false, parse_bool, [UNTRACKED],
|
||||
"use dark-themed colors in graphviz output (default: no)"),
|
||||
|
@ -19,7 +19,6 @@
|
||||
use core::mem::size_of_val;
|
||||
use core::mem::{self, align_of_val_raw};
|
||||
use core::ops::{CoerceUnsized, Deref, DispatchFromDyn, Receiver};
|
||||
#[cfg(not(no_global_oom_handling))]
|
||||
use core::pin::Pin;
|
||||
use core::ptr::{self, NonNull};
|
||||
#[cfg(not(no_global_oom_handling))]
|
||||
@ -494,6 +493,13 @@ pub fn pin(data: T) -> Pin<Arc<T>> {
|
||||
unsafe { Pin::new_unchecked(Arc::new(data)) }
|
||||
}
|
||||
|
||||
/// Constructs a new `Pin<Arc<T>>`, return an error if allocation fails.
|
||||
#[unstable(feature = "allocator_api", issue = "32838")]
|
||||
#[inline]
|
||||
pub fn try_pin(data: T) -> Result<Pin<Arc<T>>, AllocError> {
|
||||
unsafe { Ok(Pin::new_unchecked(Arc::try_new(data)?)) }
|
||||
}
|
||||
|
||||
/// Constructs a new `Arc<T>`, returning an error if allocation fails.
|
||||
///
|
||||
/// # Examples
|
||||
|
@ -179,6 +179,16 @@
|
||||
#[macro_use]
|
||||
mod macros;
|
||||
|
||||
// We don't export this through #[macro_export] for now, to avoid breakage.
|
||||
// See https://github.com/rust-lang/rust/issues/82913
|
||||
#[cfg(not(test))]
|
||||
#[unstable(feature = "assert_matches", issue = "82775")]
|
||||
/// Unstable module containing the unstable `assert_matches` macro.
|
||||
pub mod assert {
|
||||
#[unstable(feature = "assert_matches", issue = "82775")]
|
||||
pub use crate::macros::{assert_matches, debug_assert_matches};
|
||||
}
|
||||
|
||||
#[macro_use]
|
||||
mod internal_macros;
|
||||
|
||||
|
@ -127,6 +127,8 @@ macro_rules! assert_ne {
|
||||
/// ```
|
||||
/// #![feature(assert_matches)]
|
||||
///
|
||||
/// use std::assert::assert_matches;
|
||||
///
|
||||
/// let a = 1u32.checked_add(2);
|
||||
/// let b = 1u32.checked_sub(2);
|
||||
/// assert_matches!(a, Some(_));
|
||||
@ -135,10 +137,10 @@ macro_rules! assert_ne {
|
||||
/// let c = Ok("abc".to_string());
|
||||
/// assert_matches!(c, Ok(x) | Err(x) if x.len() < 100);
|
||||
/// ```
|
||||
#[macro_export]
|
||||
#[unstable(feature = "assert_matches", issue = "82775")]
|
||||
#[allow_internal_unstable(core_panic)]
|
||||
macro_rules! assert_matches {
|
||||
#[rustc_macro_transparency = "semitransparent"]
|
||||
pub macro assert_matches {
|
||||
($left:expr, $( $pattern:pat_param )|+ $( if $guard: expr )? $(,)?) => ({
|
||||
match $left {
|
||||
$( $pattern )|+ $( if $guard )? => {}
|
||||
@ -150,7 +152,7 @@ macro_rules! assert_matches {
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
}),
|
||||
($left:expr, $( $pattern:pat_param )|+ $( if $guard: expr )?, $($arg:tt)+) => ({
|
||||
match $left {
|
||||
$( $pattern )|+ $( if $guard )? => {}
|
||||
@ -162,7 +164,7 @@ macro_rules! assert_matches {
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
}),
|
||||
}
|
||||
|
||||
/// Asserts that a boolean expression is `true` at runtime.
|
||||
@ -284,6 +286,8 @@ macro_rules! debug_assert_ne {
|
||||
/// ```
|
||||
/// #![feature(assert_matches)]
|
||||
///
|
||||
/// use std::assert::debug_assert_matches;
|
||||
///
|
||||
/// let a = 1u32.checked_add(2);
|
||||
/// let b = 1u32.checked_sub(2);
|
||||
/// debug_assert_matches!(a, Some(_));
|
||||
@ -295,8 +299,9 @@ macro_rules! debug_assert_ne {
|
||||
#[macro_export]
|
||||
#[unstable(feature = "assert_matches", issue = "82775")]
|
||||
#[allow_internal_unstable(assert_matches)]
|
||||
macro_rules! debug_assert_matches {
|
||||
($($arg:tt)*) => (if $crate::cfg!(debug_assertions) { $crate::assert_matches!($($arg)*); })
|
||||
#[rustc_macro_transparency = "semitransparent"]
|
||||
pub macro debug_assert_matches($($arg:tt)*) {
|
||||
if $crate::cfg!(debug_assertions) { $crate::assert::assert_matches!($($arg)*); }
|
||||
}
|
||||
|
||||
/// Returns whether the given expression matches any of the given patterns.
|
||||
|
@ -1,5 +1,3 @@
|
||||
// ignore-tidy-undocumented-unsafe
|
||||
|
||||
use crate::cmp;
|
||||
use crate::mem::{self, MaybeUninit};
|
||||
use crate::ptr;
|
||||
@ -79,8 +77,10 @@ pub unsafe fn ptr_rotate<T>(mut left: usize, mut mid: *mut T, mut right: usize)
|
||||
// the way until about `left + right == 32`, but the worst case performance breaks even
|
||||
// around 16. 24 was chosen as middle ground. If the size of `T` is larger than 4
|
||||
// `usize`s, this algorithm also outperforms other algorithms.
|
||||
// SAFETY: callers must ensure `mid - left` is valid for reading and writing.
|
||||
let x = unsafe { mid.sub(left) };
|
||||
// beginning of first round
|
||||
// SAFETY: see previous comment.
|
||||
let mut tmp: T = unsafe { x.read() };
|
||||
let mut i = right;
|
||||
// `gcd` can be found before hand by calculating `gcd(left + right, right)`,
|
||||
@ -92,6 +92,21 @@ pub unsafe fn ptr_rotate<T>(mut left: usize, mut mid: *mut T, mut right: usize)
|
||||
// the very end. This is possibly due to the fact that swapping or replacing temporaries
|
||||
// uses only one memory address in the loop instead of needing to manage two.
|
||||
loop {
|
||||
// [long-safety-expl]
|
||||
// SAFETY: callers must ensure `[left, left+mid+right)` are all valid for reading and
|
||||
// writing.
|
||||
//
|
||||
// - `i` start with `right` so `mid-left <= x+i = x+right = mid-left+right < mid+right`
|
||||
// - `i <= left+right-1` is always true
|
||||
// - if `i < left`, `right` is added so `i < left+right` and on the next
|
||||
// iteration `left` is removed from `i` so it doesn't go further
|
||||
// - if `i >= left`, `left` is removed immediately and so it doesn't go further.
|
||||
// - overflows cannot happen for `i` since the function's safety contract ask for
|
||||
// `mid+right-1 = x+left+right` to be valid for writing
|
||||
// - underflows cannot happen because `i` must be bigger or equal to `left` for
|
||||
// a substraction of `left` to happen.
|
||||
//
|
||||
// So `x+i` is valid for reading and writing if the caller respected the contract
|
||||
tmp = unsafe { x.add(i).replace(tmp) };
|
||||
// instead of incrementing `i` and then checking if it is outside the bounds, we
|
||||
// check if `i` will go outside the bounds on the next increment. This prevents
|
||||
@ -100,6 +115,8 @@ pub unsafe fn ptr_rotate<T>(mut left: usize, mut mid: *mut T, mut right: usize)
|
||||
i -= left;
|
||||
if i == 0 {
|
||||
// end of first round
|
||||
// SAFETY: tmp has been read from a valid source and x is valid for writing
|
||||
// according to the caller.
|
||||
unsafe { x.write(tmp) };
|
||||
break;
|
||||
}
|
||||
@ -113,13 +130,24 @@ pub unsafe fn ptr_rotate<T>(mut left: usize, mut mid: *mut T, mut right: usize)
|
||||
}
|
||||
// finish the chunk with more rounds
|
||||
for start in 1..gcd {
|
||||
// SAFETY: `gcd` is at most equal to `right` so all values in `1..gcd` are valid for
|
||||
// reading and writing as per the function's safety contract, see [long-safety-expl]
|
||||
// above
|
||||
tmp = unsafe { x.add(start).read() };
|
||||
// [safety-expl-addition]
|
||||
//
|
||||
// Here `start < gcd` so `start < right` so `i < right+right`: `right` being the
|
||||
// greatest common divisor of `(left+right, right)` means that `left = right` so
|
||||
// `i < left+right` so `x+i = mid-left+i` is always valid for reading and writing
|
||||
// according to the function's safety contract.
|
||||
i = start + right;
|
||||
loop {
|
||||
// SAFETY: see [long-safety-expl] and [safety-expl-addition]
|
||||
tmp = unsafe { x.add(i).replace(tmp) };
|
||||
if i >= left {
|
||||
i -= left;
|
||||
if i == start {
|
||||
// SAFETY: see [long-safety-expl] and [safety-expl-addition]
|
||||
unsafe { x.add(start).write(tmp) };
|
||||
break;
|
||||
}
|
||||
@ -135,14 +163,30 @@ pub unsafe fn ptr_rotate<T>(mut left: usize, mut mid: *mut T, mut right: usize)
|
||||
// The `[T; 0]` here is to ensure this is appropriately aligned for T
|
||||
let mut rawarray = MaybeUninit::<(BufType, [T; 0])>::uninit();
|
||||
let buf = rawarray.as_mut_ptr() as *mut T;
|
||||
// SAFETY: `mid-left <= mid-left+right < mid+right`
|
||||
let dim = unsafe { mid.sub(left).add(right) };
|
||||
if left <= right {
|
||||
// SAFETY:
|
||||
//
|
||||
// 1) The `else if` condition about the sizes ensures `[mid-left; left]` will fit in
|
||||
// `buf` without overflow and `buf` was created just above and so cannot be
|
||||
// overlapped with any value of `[mid-left; left]`
|
||||
// 2) [mid-left, mid+right) are all valid for reading and writing and we don't care
|
||||
// about overlaps here.
|
||||
// 3) The `if` condition about `left <= right` ensures writing `left` elements to
|
||||
// `dim = mid-left+right` is valid because:
|
||||
// - `buf` is valid and `left` elements were written in it in 1)
|
||||
// - `dim+left = mid-left+right+left = mid+right` and we write `[dim, dim+left)`
|
||||
unsafe {
|
||||
// 1)
|
||||
ptr::copy_nonoverlapping(mid.sub(left), buf, left);
|
||||
// 2)
|
||||
ptr::copy(mid, mid.sub(left), right);
|
||||
// 3)
|
||||
ptr::copy_nonoverlapping(buf, dim, left);
|
||||
}
|
||||
} else {
|
||||
// SAFETY: same reasoning as above but with `left` and `right` reversed
|
||||
unsafe {
|
||||
ptr::copy_nonoverlapping(mid, buf, right);
|
||||
ptr::copy(mid.sub(left), dim, left);
|
||||
@ -156,6 +200,10 @@ pub unsafe fn ptr_rotate<T>(mut left: usize, mut mid: *mut T, mut right: usize)
|
||||
// of this algorithm would be, and swapping using that last chunk instead of swapping
|
||||
// adjacent chunks like this algorithm is doing, but this way is still faster.
|
||||
loop {
|
||||
// SAFETY:
|
||||
// `left >= right` so `[mid-right, mid+right)` is valid for reading and writing
|
||||
// Substracting `right` from `mid` each turn is counterbalanced by the addition and
|
||||
// check after it.
|
||||
unsafe {
|
||||
ptr::swap_nonoverlapping(mid.sub(right), mid, right);
|
||||
mid = mid.sub(right);
|
||||
@ -168,6 +216,10 @@ pub unsafe fn ptr_rotate<T>(mut left: usize, mut mid: *mut T, mut right: usize)
|
||||
} else {
|
||||
// Algorithm 3, `left < right`
|
||||
loop {
|
||||
// SAFETY: `[mid-left, mid+left)` is valid for reading and writing because
|
||||
// `left < right` so `mid+left < mid+right`.
|
||||
// Adding `left` to `mid` each turn is counterbalanced by the substraction and check
|
||||
// after it.
|
||||
unsafe {
|
||||
ptr::swap_nonoverlapping(mid.sub(left), mid, left);
|
||||
mid = mid.add(left);
|
||||
|
@ -548,8 +548,8 @@ pub mod task {
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[allow(deprecated, deprecated_in_future)]
|
||||
pub use core::{
|
||||
assert_eq, assert_matches, assert_ne, debug_assert, debug_assert_eq, debug_assert_matches,
|
||||
debug_assert_ne, matches, r#try, todo, unimplemented, unreachable, write, writeln,
|
||||
assert_eq, assert_ne, debug_assert, debug_assert_eq, debug_assert_ne, matches, r#try, todo,
|
||||
unimplemented, unreachable, write, writeln,
|
||||
};
|
||||
|
||||
// Re-export built-in macros defined through libcore.
|
||||
|
@ -1,7 +1,7 @@
|
||||
//! WASI-specific extensions to primitives in the `std::fs` module.
|
||||
|
||||
#![deny(unsafe_op_in_unsafe_fn)]
|
||||
#![unstable(feature = "wasi_ext", issue = "none")]
|
||||
#![unstable(feature = "wasi_ext", issue = "71213")]
|
||||
|
||||
use crate::ffi::OsStr;
|
||||
use crate::fs::{self, File, Metadata, OpenOptions};
|
||||
|
@ -1,7 +1,7 @@
|
||||
//! WASI-specific extensions to general I/O primitives
|
||||
|
||||
#![deny(unsafe_op_in_unsafe_fn)]
|
||||
#![unstable(feature = "wasi_ext", issue = "none")]
|
||||
#![unstable(feature = "wasi_ext", issue = "71213")]
|
||||
|
||||
use crate::fs;
|
||||
use crate::io;
|
||||
|
@ -621,8 +621,7 @@ fn next(&mut self) -> Option<Self::Item> {
|
||||
is_paragraph = true;
|
||||
}
|
||||
html::push_html(&mut ret, content.into_iter());
|
||||
write!(ret, " <a href=\"#fnref{}\" rev=\"footnote\">↩</a>", id)
|
||||
.unwrap();
|
||||
write!(ret, " <a href=\"#fnref{}\">↩</a>", id).unwrap();
|
||||
if is_paragraph {
|
||||
ret.push_str("</p>");
|
||||
}
|
||||
|
@ -0,0 +1,16 @@
|
||||
#![feature(const_generics_defaults)]
|
||||
|
||||
struct Struct<const N: usize = { Self; 10 }>;
|
||||
//~^ ERROR generic parameters cannot use `Self` in their defaults [E0735]
|
||||
|
||||
enum Enum<const N: usize = { Self; 10 }> { }
|
||||
//~^ ERROR generic parameters cannot use `Self` in their defaults [E0735]
|
||||
|
||||
union Union<const N: usize = { Self; 10 }> { not_empty: () }
|
||||
//~^ ERROR generic parameters cannot use `Self` in their defaults [E0735]
|
||||
|
||||
fn main() {
|
||||
let _: Struct;
|
||||
let _: Enum;
|
||||
let _: Union;
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
error[E0735]: generic parameters cannot use `Self` in their defaults
|
||||
--> $DIR/default-const-param-cannot-reference-self.rs:3:34
|
||||
|
|
||||
LL | struct Struct<const N: usize = { Self; 10 }>;
|
||||
| ^^^^ `Self` in generic parameter default
|
||||
|
||||
error[E0735]: generic parameters cannot use `Self` in their defaults
|
||||
--> $DIR/default-const-param-cannot-reference-self.rs:6:30
|
||||
|
|
||||
LL | enum Enum<const N: usize = { Self; 10 }> { }
|
||||
| ^^^^ `Self` in generic parameter default
|
||||
|
||||
error[E0735]: generic parameters cannot use `Self` in their defaults
|
||||
--> $DIR/default-const-param-cannot-reference-self.rs:9:32
|
||||
|
|
||||
LL | union Union<const N: usize = { Self; 10 }> { not_empty: () }
|
||||
| ^^^^ `Self` in generic parameter default
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0735`.
|
@ -11,25 +11,25 @@
|
||||
// compatibility concern.
|
||||
|
||||
struct Snobound<'a, P = Self> { x: Option<&'a P> }
|
||||
//~^ ERROR type parameters cannot use `Self` in their defaults [E0735]
|
||||
//~^ ERROR generic parameters cannot use `Self` in their defaults [E0735]
|
||||
|
||||
enum Enobound<'a, P = Self> { A, B(Option<&'a P>) }
|
||||
//~^ ERROR type parameters cannot use `Self` in their defaults [E0735]
|
||||
//~^ ERROR generic parameters cannot use `Self` in their defaults [E0735]
|
||||
|
||||
union Unobound<'a, P = Self> { x: i32, y: Option<&'a P> }
|
||||
//~^ ERROR type parameters cannot use `Self` in their defaults [E0735]
|
||||
//~^ ERROR generic parameters cannot use `Self` in their defaults [E0735]
|
||||
|
||||
// Disallowing `Self` in defaults sidesteps need to check the bounds
|
||||
// on the defaults in cases like these.
|
||||
|
||||
struct Ssized<'a, P: Sized = [Self]> { x: Option<&'a P> }
|
||||
//~^ ERROR type parameters cannot use `Self` in their defaults [E0735]
|
||||
//~^ ERROR generic parameters cannot use `Self` in their defaults [E0735]
|
||||
|
||||
enum Esized<'a, P: Sized = [Self]> { A, B(Option<&'a P>) }
|
||||
//~^ ERROR type parameters cannot use `Self` in their defaults [E0735]
|
||||
//~^ ERROR generic parameters cannot use `Self` in their defaults [E0735]
|
||||
|
||||
union Usized<'a, P: Sized = [Self]> { x: i32, y: Option<&'a P> }
|
||||
//~^ ERROR type parameters cannot use `Self` in their defaults [E0735]
|
||||
//~^ ERROR generic parameters cannot use `Self` in their defaults [E0735]
|
||||
|
||||
fn demo_usages() {
|
||||
// An ICE means you only get the error from the first line of the
|
||||
|
@ -1,38 +1,38 @@
|
||||
error[E0735]: type parameters cannot use `Self` in their defaults
|
||||
error[E0735]: generic parameters cannot use `Self` in their defaults
|
||||
--> $DIR/issue-61631-default-type-param-cannot-reference-self.rs:13:25
|
||||
|
|
||||
LL | struct Snobound<'a, P = Self> { x: Option<&'a P> }
|
||||
| ^^^^ `Self` in type parameter default
|
||||
| ^^^^ `Self` in generic parameter default
|
||||
|
||||
error[E0735]: type parameters cannot use `Self` in their defaults
|
||||
error[E0735]: generic parameters cannot use `Self` in their defaults
|
||||
--> $DIR/issue-61631-default-type-param-cannot-reference-self.rs:16:23
|
||||
|
|
||||
LL | enum Enobound<'a, P = Self> { A, B(Option<&'a P>) }
|
||||
| ^^^^ `Self` in type parameter default
|
||||
| ^^^^ `Self` in generic parameter default
|
||||
|
||||
error[E0735]: type parameters cannot use `Self` in their defaults
|
||||
error[E0735]: generic parameters cannot use `Self` in their defaults
|
||||
--> $DIR/issue-61631-default-type-param-cannot-reference-self.rs:19:24
|
||||
|
|
||||
LL | union Unobound<'a, P = Self> { x: i32, y: Option<&'a P> }
|
||||
| ^^^^ `Self` in type parameter default
|
||||
| ^^^^ `Self` in generic parameter default
|
||||
|
||||
error[E0735]: type parameters cannot use `Self` in their defaults
|
||||
error[E0735]: generic parameters cannot use `Self` in their defaults
|
||||
--> $DIR/issue-61631-default-type-param-cannot-reference-self.rs:25:31
|
||||
|
|
||||
LL | struct Ssized<'a, P: Sized = [Self]> { x: Option<&'a P> }
|
||||
| ^^^^ `Self` in type parameter default
|
||||
| ^^^^ `Self` in generic parameter default
|
||||
|
||||
error[E0735]: type parameters cannot use `Self` in their defaults
|
||||
error[E0735]: generic parameters cannot use `Self` in their defaults
|
||||
--> $DIR/issue-61631-default-type-param-cannot-reference-self.rs:28:29
|
||||
|
|
||||
LL | enum Esized<'a, P: Sized = [Self]> { A, B(Option<&'a P>) }
|
||||
| ^^^^ `Self` in type parameter default
|
||||
| ^^^^ `Self` in generic parameter default
|
||||
|
||||
error[E0735]: type parameters cannot use `Self` in their defaults
|
||||
error[E0735]: generic parameters cannot use `Self` in their defaults
|
||||
--> $DIR/issue-61631-default-type-param-cannot-reference-self.rs:31:30
|
||||
|
|
||||
LL | union Usized<'a, P: Sized = [Self]> { x: i32, y: Option<&'a P> }
|
||||
| ^^^^ `Self` in type parameter default
|
||||
| ^^^^ `Self` in generic parameter default
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
|
10
src/test/ui/lint/future-incompat-test.rs
Normal file
10
src/test/ui/lint/future-incompat-test.rs
Normal file
@ -0,0 +1,10 @@
|
||||
// compile-flags: -Zfuture-incompat-test -Zemit-future-incompat-report
|
||||
// check-pass
|
||||
|
||||
// The `-Zfuture-incompat-test flag causes any normal warning to be included
|
||||
// in the future-incompatible report. The stderr output here should mention
|
||||
// the future incompatible report (as extracted by compiletest).
|
||||
|
||||
fn main() {
|
||||
let x = 1;
|
||||
}
|
9
src/test/ui/lint/future-incompat-test.stderr
Normal file
9
src/test/ui/lint/future-incompat-test.stderr
Normal file
@ -0,0 +1,9 @@
|
||||
Future incompatibility report: Future breakage diagnostic:
|
||||
warning: unused variable: `x`
|
||||
--> $DIR/future-incompat-test.rs:9:9
|
||||
|
|
||||
LL | let x = 1;
|
||||
| ^ help: if this is intentional, prefix it with an underscore: `_x`
|
||||
|
|
||||
= note: `-A unused-variables` implied by `-A unused`
|
||||
|
@ -6,6 +6,8 @@
|
||||
|
||||
#![feature(assert_matches)]
|
||||
|
||||
use std::assert::assert_matches;
|
||||
|
||||
fn main() {
|
||||
assert_matches!(1 + 1, 3, "1 + 1 definitely should be 3");
|
||||
}
|
||||
|
@ -6,6 +6,8 @@
|
||||
|
||||
#![feature(assert_matches)]
|
||||
|
||||
use std::assert::assert_matches;
|
||||
|
||||
fn main() {
|
||||
assert!(matches!((), ()));
|
||||
assert_matches!((), ());
|
||||
|
@ -81,7 +81,7 @@ LL | tuple_from_req!(Foo);
|
||||
|
||||
warning: 5 warnings emitted
|
||||
|
||||
Future incompatibility report: Future breakage date: None, diagnostic:
|
||||
Future incompatibility report: Future breakage diagnostic:
|
||||
warning: using an old version of `time-macros-impl`
|
||||
--> $DIR/time-macros-impl/src/lib.rs:5:32
|
||||
|
|
||||
@ -99,7 +99,7 @@ LL | impl_macros!(Foo);
|
||||
= note: the `time-macros-impl` crate will stop compiling in futures version of Rust. Please update to the latest version of the `time` crate to avoid breakage
|
||||
= note: this warning originates in the macro `impl_macros` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
Future breakage date: None, diagnostic:
|
||||
Future breakage diagnostic:
|
||||
warning: using an old version of `time-macros-impl`
|
||||
--> $DIR/time-macros-impl-0.1.0/src/lib.rs:5:32
|
||||
|
|
||||
@ -116,7 +116,7 @@ LL | impl_macros!(Foo);
|
||||
= note: the `time-macros-impl` crate will stop compiling in futures version of Rust. Please update to the latest version of the `time` crate to avoid breakage
|
||||
= note: this warning originates in the macro `impl_macros` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
Future breakage date: None, diagnostic:
|
||||
Future breakage diagnostic:
|
||||
warning: using an old version of `js-sys`
|
||||
--> $DIR/js-sys-0.3.17/src/lib.rs:5:32
|
||||
|
|
||||
@ -133,7 +133,7 @@ LL | arrays!(Foo);
|
||||
= note: older versions of the `js-sys` crate will stop compiling in future versions of Rust; please update to `js-sys` v0.3.40 or above
|
||||
= note: this warning originates in the macro `arrays` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
Future breakage date: None, diagnostic:
|
||||
Future breakage diagnostic:
|
||||
warning: using an old version of `actix-web`
|
||||
--> $DIR/actix-web/src/extract.rs:5:34
|
||||
|
|
||||
@ -150,7 +150,7 @@ LL | tuple_from_req!(Foo);
|
||||
= note: the version of `actix-web` you are using might stop compiling in future versions of Rust; please update to the latest version of the `actix-web` crate to avoid breakage
|
||||
= note: this warning originates in the macro `tuple_from_req` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
Future breakage date: None, diagnostic:
|
||||
Future breakage diagnostic:
|
||||
warning: using an old version of `actix-web`
|
||||
--> $DIR/actix-web-2.0.0/src/extract.rs:5:34
|
||||
|
|
||||
|
@ -11,7 +11,7 @@ LL | enum ProceduralMasqueradeDummyType {
|
||||
|
||||
warning: 1 warning emitted
|
||||
|
||||
Future incompatibility report: Future breakage date: None, diagnostic:
|
||||
Future incompatibility report: Future breakage diagnostic:
|
||||
warning: using `procedural-masquerade` crate
|
||||
--> $DIR/issue-73933-procedural-masquerade.rs:8:6
|
||||
|
|
||||
|
@ -1,4 +1,4 @@
|
||||
fn main() {
|
||||
assert(true);
|
||||
//~^ ERROR expected function, found macro `assert`
|
||||
assert_eq(1, 1);
|
||||
//~^ ERROR expected function, found macro `assert_eq`
|
||||
}
|
||||
|
@ -1,13 +1,13 @@
|
||||
error[E0423]: expected function, found macro `assert`
|
||||
error[E0423]: expected function, found macro `assert_eq`
|
||||
--> $DIR/resolve-hint-macro.rs:2:5
|
||||
|
|
||||
LL | assert(true);
|
||||
| ^^^^^^ not a function
|
||||
LL | assert_eq(1, 1);
|
||||
| ^^^^^^^^^ not a function
|
||||
|
|
||||
help: use `!` to invoke the macro
|
||||
|
|
||||
LL | assert!(true);
|
||||
| ^
|
||||
LL | assert_eq!(1, 1);
|
||||
| ^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 3ebb5f15a940810f250b68821149387af583a79e
|
||||
Subproject commit 66a6737a0c9f3a974af2dd032a65d3e409c77aac
|
@ -43,7 +43,6 @@ struct FutureIncompatReport {
|
||||
|
||||
#[derive(Deserialize)]
|
||||
struct FutureBreakageItem {
|
||||
future_breakage_date: Option<String>,
|
||||
diagnostic: Diagnostic,
|
||||
}
|
||||
|
||||
@ -104,9 +103,7 @@ pub fn extract_rendered(output: &str) -> String {
|
||||
.into_iter()
|
||||
.map(|item| {
|
||||
format!(
|
||||
"Future breakage date: {}, diagnostic:\n{}",
|
||||
item.future_breakage_date
|
||||
.unwrap_or_else(|| "None".to_string()),
|
||||
"Future breakage diagnostic:\n{}",
|
||||
item.diagnostic
|
||||
.rendered
|
||||
.unwrap_or_else(|| "Not rendered".to_string())
|
||||
|
Loading…
Reference in New Issue
Block a user