mirror of
https://github.com/rust-lang/rust.git
synced 2025-09-26 20:21:59 +00:00
Compare commits
43 Commits
383731785f
...
f65cc8e92b
Author | SHA1 | Date | |
---|---|---|---|
![]() |
f65cc8e92b | ||
![]() |
6f34f4ee07 | ||
![]() |
7cfd7d328b | ||
![]() |
57ee169ff2 | ||
![]() |
d10d6bfb02 | ||
![]() |
6618ac7bb1 | ||
![]() |
6351a63486 | ||
![]() |
7a4ac48345 | ||
![]() |
0ab93860ed | ||
![]() |
8073b6f169 | ||
![]() |
92859e98ee | ||
![]() |
a9554b4d5f | ||
![]() |
4e62715541 | ||
![]() |
5a4e536036 | ||
![]() |
30289353e8 | ||
![]() |
a875f7779e | ||
![]() |
2886ca496a | ||
![]() |
32d24f9efa | ||
![]() |
aa537824c4 | ||
![]() |
df215cc120 | ||
![]() |
291babd633 | ||
![]() |
ee92beb8c4 | ||
![]() |
a107b63bdb | ||
![]() |
20869c2f70 | ||
![]() |
0bf1ef5aec | ||
![]() |
6379facf9e | ||
![]() |
ea3bdcf7eb | ||
![]() |
3618358dcd | ||
![]() |
2e87034850 | ||
![]() |
4e669126b2 | ||
![]() |
2ba82ac4d9 | ||
![]() |
ff2018f81c | ||
![]() |
8ba902d972 | ||
![]() |
dcd0350aaa | ||
![]() |
01d2ee24f2 | ||
![]() |
8f55882536 | ||
![]() |
f13adf3cc3 | ||
![]() |
fb8f8b0f15 | ||
![]() |
788b94182b | ||
![]() |
819cf49ced | ||
![]() |
62d369bee7 | ||
![]() |
87b0a80451 | ||
![]() |
6ac6445aa1 |
@ -43,7 +43,7 @@ pub fn inject(
|
||||
|
||||
let item = cx.item(
|
||||
span,
|
||||
thin_vec![cx.attr_word(sym::macro_use, span)],
|
||||
ast::AttrVec::new(),
|
||||
ast::ItemKind::ExternCrate(None, Ident::new(name, ident_span)),
|
||||
);
|
||||
|
||||
|
@ -1003,8 +1003,10 @@ impl<'cx, 'tcx> TypeFolder<TyCtxt<'tcx>> for Resolver<'cx, 'tcx> {
|
||||
}
|
||||
|
||||
fn fold_region(&mut self, r: ty::Region<'tcx>) -> ty::Region<'tcx> {
|
||||
debug_assert!(!r.is_bound(), "Should not be resolving bound region.");
|
||||
self.fcx.tcx.lifetimes.re_erased
|
||||
match r.kind() {
|
||||
ty::ReBound(..) => r,
|
||||
_ => self.fcx.tcx.lifetimes.re_erased,
|
||||
}
|
||||
}
|
||||
|
||||
fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> {
|
||||
|
@ -3177,8 +3177,7 @@ define_print! {
|
||||
write!(p, "` can be evaluated")?;
|
||||
}
|
||||
ty::ClauseKind::UnstableFeature(symbol) => {
|
||||
write!(p, "unstable feature: ")?;
|
||||
write!(p, "`{symbol}`")?;
|
||||
write!(p, "feature({symbol}) is enabled")?;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1305,8 +1305,8 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
|
||||
{
|
||||
if ty.is_structural_eq_shallow(self.tcx) {
|
||||
diag.span_suggestion(
|
||||
span,
|
||||
"add `#[derive(ConstParamTy)]` to the struct",
|
||||
span.shrink_to_lo(),
|
||||
format!("add `#[derive(ConstParamTy)]` to the {}", def.descr()),
|
||||
"#[derive(ConstParamTy)]\n",
|
||||
Applicability::MachineApplicable,
|
||||
);
|
||||
@ -1314,8 +1314,11 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
|
||||
// FIXME(adt_const_params): We should check there's not already an
|
||||
// overlapping `Eq`/`PartialEq` impl.
|
||||
diag.span_suggestion(
|
||||
span,
|
||||
"add `#[derive(ConstParamTy, PartialEq, Eq)]` to the struct",
|
||||
span.shrink_to_lo(),
|
||||
format!(
|
||||
"add `#[derive(ConstParamTy, PartialEq, Eq)]` to the {}",
|
||||
def.descr()
|
||||
),
|
||||
"#[derive(ConstParamTy, PartialEq, Eq)]\n",
|
||||
Applicability::MachineApplicable,
|
||||
);
|
||||
|
@ -100,9 +100,9 @@ where
|
||||
} else if let Err(guar) = infcx.tcx.check_potentially_region_dependent_goals(root_def_id) {
|
||||
Err(guar)
|
||||
} else {
|
||||
Err(infcx
|
||||
.dcx()
|
||||
.delayed_bug(format!("errors selecting obligation during MIR typeck: {errors:?}")))
|
||||
Err(infcx.dcx().delayed_bug(format!(
|
||||
"errors selecting obligation during MIR typeck: {name} {root_def_id:?} {errors:?}"
|
||||
)))
|
||||
}
|
||||
})?;
|
||||
|
||||
|
@ -970,17 +970,14 @@ impl Default for Rc<CStr> {
|
||||
/// This may or may not share an allocation with other Rcs on the same thread.
|
||||
#[inline]
|
||||
fn default() -> Self {
|
||||
let rc = Rc::<[u8]>::from(*b"\0");
|
||||
// `[u8]` has the same layout as `CStr`, and it is `NUL` terminated.
|
||||
unsafe { Rc::from_raw(Rc::into_raw(rc) as *const CStr) }
|
||||
Rc::from(c"")
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "default_box_extra", since = "1.17.0")]
|
||||
impl Default for Box<CStr> {
|
||||
fn default() -> Box<CStr> {
|
||||
let boxed: Box<[u8]> = Box::from([0]);
|
||||
unsafe { Box::from_raw(Box::into_raw(boxed) as *mut CStr) }
|
||||
Box::from(c"")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -56,6 +56,7 @@
|
||||
#![feature(negative_impls)]
|
||||
#![feature(never_type)]
|
||||
#![feature(optimize_attribute)]
|
||||
#![feature(prelude_import)]
|
||||
#![feature(rustc_allow_const_fn_unstable)]
|
||||
#![feature(rustc_attrs)]
|
||||
#![feature(staged_api)]
|
||||
@ -65,11 +66,17 @@
|
||||
|
||||
// Allow testing this library
|
||||
extern crate alloc as realalloc;
|
||||
#[macro_use]
|
||||
|
||||
// This is needed to provide macros to the directly imported alloc modules below.
|
||||
extern crate std;
|
||||
#[prelude_import]
|
||||
#[allow(unused_imports)]
|
||||
use std::prelude::rust_2024::*;
|
||||
|
||||
#[cfg(test)]
|
||||
extern crate test;
|
||||
mod testing;
|
||||
|
||||
use realalloc::*;
|
||||
|
||||
// We are directly including collections, raw_vec, and wtf8 here as they use non-public
|
||||
@ -93,8 +100,7 @@ pub(crate) mod test_helpers {
|
||||
let mut hasher = std::hash::RandomState::new().build_hasher();
|
||||
std::panic::Location::caller().hash(&mut hasher);
|
||||
let hc64 = hasher.finish();
|
||||
let seed_vec =
|
||||
hc64.to_le_bytes().into_iter().chain(0u8..8).collect::<crate::vec::Vec<u8>>();
|
||||
let seed_vec = hc64.to_le_bytes().into_iter().chain(0u8..8).collect::<std::vec::Vec<u8>>();
|
||||
let seed: [u8; 16] = seed_vec.as_slice().try_into().unwrap();
|
||||
rand::SeedableRng::from_seed(seed)
|
||||
}
|
||||
|
@ -16,13 +16,19 @@ use crate::fmt::{self, Debug, Display, Formatter};
|
||||
/// assert_eq!(err.to_string(), "invalid digit found in string");
|
||||
/// ```
|
||||
///
|
||||
/// # Error source
|
||||
///
|
||||
/// Errors may provide cause information. [`Error::source()`] is generally
|
||||
/// used when errors cross "abstraction boundaries". If one module must report
|
||||
/// an error that is caused by an error from a lower-level module, it can allow
|
||||
/// accessing that error via [`Error::source()`]. This makes it possible for the
|
||||
/// accessing that error via `Error::source()`. This makes it possible for the
|
||||
/// high-level module to provide its own errors while also revealing some of the
|
||||
/// implementation for debugging.
|
||||
///
|
||||
/// In error types that wrap an underlying error, the underlying error
|
||||
/// should be either returned by the outer error's `Error::source()`, or rendered
|
||||
/// by the outer error's `Display` implementation, but not both.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// Implementing the `Error` trait only requires that `Debug` and `Display` are implemented too.
|
||||
|
@ -179,9 +179,7 @@ impl fmt::Debug for CStr {
|
||||
impl Default for &CStr {
|
||||
#[inline]
|
||||
fn default() -> Self {
|
||||
const SLICE: &[c_char] = &[0];
|
||||
// SAFETY: `SLICE` is indeed pointing to a valid nul-terminated string.
|
||||
unsafe { CStr::from_ptr(SLICE.as_ptr()) }
|
||||
c""
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -59,12 +59,29 @@ pub use crate::hash::macros::Hash;
|
||||
|
||||
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
|
||||
#[doc(no_inline)]
|
||||
#[allow(deprecated)]
|
||||
pub use crate::{
|
||||
assert, cfg, column, compile_error, concat, env, file, format_args,
|
||||
format_args_nl, include, include_bytes, include_str, line, log_syntax, module_path, option_env,
|
||||
stringify, trace_macros,
|
||||
assert, assert_eq, assert_ne, cfg, column, compile_error, concat, debug_assert, debug_assert_eq, debug_assert_ne, file, format_args, include, include_bytes, include_str, line, matches, module_path, option_env, stringify, todo, r#try, unimplemented, unreachable, write, writeln,
|
||||
};
|
||||
|
||||
// These macros needs special handling, so that we don't export it *and* the modules of the same
|
||||
// name. We only want the macro in the prelude.
|
||||
mod ambiguous_macro_only {
|
||||
#[allow(hidden_glob_reexports)]
|
||||
mod env {}
|
||||
#[allow(hidden_glob_reexports)]
|
||||
mod panic {}
|
||||
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
|
||||
pub use crate::*;
|
||||
}
|
||||
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
|
||||
#[doc(no_inline)]
|
||||
pub use self::ambiguous_macro_only::{env, panic};
|
||||
|
||||
#[unstable(feature = "cfg_select", issue = "115585")]
|
||||
#[doc(no_inline)]
|
||||
pub use crate::cfg_select;
|
||||
|
||||
#[unstable(
|
||||
feature = "concat_bytes",
|
||||
issue = "87555",
|
||||
@ -73,6 +90,30 @@ pub use crate::{
|
||||
#[doc(no_inline)]
|
||||
pub use crate::concat_bytes;
|
||||
|
||||
#[unstable(feature = "const_format_args", issue = "none")]
|
||||
#[doc(no_inline)]
|
||||
pub use crate::const_format_args;
|
||||
|
||||
#[unstable(
|
||||
feature = "log_syntax",
|
||||
issue = "29598",
|
||||
reason = "`log_syntax!` is not stable enough for use and is subject to change"
|
||||
)]
|
||||
#[doc(no_inline)]
|
||||
pub use crate::log_syntax;
|
||||
|
||||
#[unstable(feature = "pattern_type_macro", issue = "123646")]
|
||||
#[doc(no_inline)]
|
||||
pub use crate::pattern_type;
|
||||
|
||||
#[unstable(
|
||||
feature = "trace_macros",
|
||||
issue = "29598",
|
||||
reason = "`trace_macros` is not stable enough for use and is subject to change"
|
||||
)]
|
||||
#[doc(no_inline)]
|
||||
pub use crate::trace_macros;
|
||||
|
||||
// Do not `doc(no_inline)` so that they become doc items on their own
|
||||
// (no public module for them to be re-exported from).
|
||||
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
|
||||
|
@ -11,9 +11,12 @@
|
||||
|
||||
use std::cell::RefCell;
|
||||
use std::num::NonZero;
|
||||
use std::str;
|
||||
use std::{fmt, str};
|
||||
|
||||
use super::*;
|
||||
// Explicit import to avoid macro namespace collision.
|
||||
use super::{
|
||||
DecodeMut, Encode, Mark, Marked, Reader, Unmark, Writer, arena, client, fxhash, server,
|
||||
};
|
||||
|
||||
/// Handle for a symbol string stored within the Interner.
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Hash)]
|
||||
|
@ -2107,7 +2107,7 @@ impl PartialEq for PathBuf {
|
||||
impl cmp::PartialEq<str> for PathBuf {
|
||||
#[inline]
|
||||
fn eq(&self, other: &str) -> bool {
|
||||
Path::eq(self, other)
|
||||
self.as_path() == other
|
||||
}
|
||||
}
|
||||
|
||||
@ -2115,7 +2115,7 @@ impl cmp::PartialEq<str> for PathBuf {
|
||||
impl cmp::PartialEq<PathBuf> for str {
|
||||
#[inline]
|
||||
fn eq(&self, other: &PathBuf) -> bool {
|
||||
other == self
|
||||
self == other.as_path()
|
||||
}
|
||||
}
|
||||
|
||||
@ -2123,7 +2123,7 @@ impl cmp::PartialEq<PathBuf> for str {
|
||||
impl cmp::PartialEq<String> for PathBuf {
|
||||
#[inline]
|
||||
fn eq(&self, other: &String) -> bool {
|
||||
**self == **other
|
||||
self.as_path() == other.as_str()
|
||||
}
|
||||
}
|
||||
|
||||
@ -2131,7 +2131,7 @@ impl cmp::PartialEq<String> for PathBuf {
|
||||
impl cmp::PartialEq<PathBuf> for String {
|
||||
#[inline]
|
||||
fn eq(&self, other: &PathBuf) -> bool {
|
||||
other == self
|
||||
self.as_str() == other.as_path()
|
||||
}
|
||||
}
|
||||
|
||||
@ -3426,7 +3426,7 @@ impl cmp::PartialEq<Path> for str {
|
||||
impl cmp::PartialEq<String> for Path {
|
||||
#[inline]
|
||||
fn eq(&self, other: &String) -> bool {
|
||||
self == &*other
|
||||
self == other.as_str()
|
||||
}
|
||||
}
|
||||
|
||||
@ -3434,7 +3434,7 @@ impl cmp::PartialEq<String> for Path {
|
||||
impl cmp::PartialEq<Path> for String {
|
||||
#[inline]
|
||||
fn eq(&self, other: &Path) -> bool {
|
||||
other == self
|
||||
self.as_str() == other
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -145,6 +145,11 @@ pub mod rust_2021 {
|
||||
#[stable(feature = "prelude_2021", since = "1.55.0")]
|
||||
#[doc(no_inline)]
|
||||
pub use core::prelude::rust_2021::*;
|
||||
|
||||
// There are two different panic macros, one in `core` and one in `std`. They are slightly
|
||||
// different. For `std` we explicitly want the one defined in `std`.
|
||||
#[stable(feature = "prelude_2021", since = "1.55.0")]
|
||||
pub use super::v1::panic;
|
||||
}
|
||||
|
||||
/// The 2024 version of the prelude of The Rust Standard Library.
|
||||
@ -159,6 +164,11 @@ pub mod rust_2024 {
|
||||
#[stable(feature = "prelude_2024", since = "1.85.0")]
|
||||
#[doc(no_inline)]
|
||||
pub use core::prelude::rust_2024::*;
|
||||
|
||||
// There are two different panic macros, one in `core` and one in `std`. They are slightly
|
||||
// different. For `std` we explicitly want the one defined in `std`.
|
||||
#[stable(feature = "prelude_2024", since = "1.85.0")]
|
||||
pub use super::v1::panic;
|
||||
}
|
||||
|
||||
/// The Future version of the prelude of The Rust Standard Library.
|
||||
@ -174,4 +184,9 @@ pub mod rust_future {
|
||||
#[unstable(feature = "prelude_next", issue = "none")]
|
||||
#[doc(no_inline)]
|
||||
pub use core::prelude::rust_future::*;
|
||||
|
||||
// There are two different panic macros, one in `core` and one in `std`. They are slightly
|
||||
// different. For `std` we explicitly want the one defined in `std`.
|
||||
#[unstable(feature = "prelude_next", issue = "none")]
|
||||
pub use super::v1::panic;
|
||||
}
|
||||
|
@ -43,15 +43,44 @@ pub use crate::option::Option::{self, None, Some};
|
||||
#[doc(no_inline)]
|
||||
pub use crate::result::Result::{self, Err, Ok};
|
||||
|
||||
// Re-exported built-in macros
|
||||
// Re-exported built-in macros and traits
|
||||
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
|
||||
#[doc(no_inline)]
|
||||
#[allow(deprecated)]
|
||||
pub use core::prelude::v1::{
|
||||
assert, cfg, column, compile_error, concat, env, file, format_args,
|
||||
format_args_nl, include, include_bytes, include_str, line, log_syntax, module_path, option_env,
|
||||
stringify, trace_macros, Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd,
|
||||
assert, assert_eq, assert_ne, cfg, column, compile_error, concat, debug_assert, debug_assert_eq, debug_assert_ne, env, file, format_args, include, include_bytes, include_str, line, matches,
|
||||
module_path, option_env, stringify, todo, r#try, unimplemented, unreachable, write,
|
||||
writeln, Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd,
|
||||
};
|
||||
|
||||
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
|
||||
#[doc(no_inline)]
|
||||
pub use crate::{
|
||||
dbg, eprint, eprintln, format, is_x86_feature_detected, print, println, thread_local, hash_map
|
||||
};
|
||||
|
||||
// These macros needs special handling, so that we don't export it *and* the modules of the same
|
||||
// name. We only want the macro in the prelude.
|
||||
mod ambiguous_macro_only_std {
|
||||
#[allow(hidden_glob_reexports)]
|
||||
mod vec {}
|
||||
#[allow(hidden_glob_reexports)]
|
||||
mod panic {}
|
||||
// Building std without the allow exported_private_dependencies will create warnings, but then
|
||||
// clippy claims its a useless_attribute. So silence both.
|
||||
#[allow(clippy::useless_attribute)]
|
||||
#[allow(exported_private_dependencies)]
|
||||
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
|
||||
pub use crate::*;
|
||||
}
|
||||
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
|
||||
#[doc(no_inline)]
|
||||
pub use self::ambiguous_macro_only_std::{vec, panic};
|
||||
|
||||
#[unstable(feature = "cfg_select", issue = "115585")]
|
||||
#[doc(no_inline)]
|
||||
pub use core::prelude::v1::cfg_select;
|
||||
|
||||
#[unstable(
|
||||
feature = "concat_bytes",
|
||||
issue = "87555",
|
||||
@ -60,6 +89,26 @@ pub use core::prelude::v1::{
|
||||
#[doc(no_inline)]
|
||||
pub use core::prelude::v1::concat_bytes;
|
||||
|
||||
#[unstable(feature = "const_format_args", issue = "none")]
|
||||
#[doc(no_inline)]
|
||||
pub use core::prelude::v1::const_format_args;
|
||||
|
||||
#[unstable(
|
||||
feature = "log_syntax",
|
||||
issue = "29598",
|
||||
reason = "`log_syntax!` is not stable enough for use and is subject to change"
|
||||
)]
|
||||
#[doc(no_inline)]
|
||||
pub use core::prelude::v1::log_syntax;
|
||||
|
||||
#[unstable(
|
||||
feature = "trace_macros",
|
||||
issue = "29598",
|
||||
reason = "`trace_macros` is not stable enough for use and is subject to change"
|
||||
)]
|
||||
#[doc(no_inline)]
|
||||
pub use core::prelude::v1::trace_macros;
|
||||
|
||||
// Do not `doc(no_inline)` so that they become doc items on their own
|
||||
// (no public module for them to be re-exported from).
|
||||
#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
|
||||
|
@ -169,7 +169,7 @@ use crate::path::Path;
|
||||
use crate::sys::pipe::{AnonPipe, read2};
|
||||
use crate::sys::process as imp;
|
||||
use crate::sys_common::{AsInner, AsInnerMut, FromInner, IntoInner};
|
||||
use crate::{fmt, fs, str};
|
||||
use crate::{fmt, format_args_nl, fs, str};
|
||||
|
||||
/// Representation of a running or exited child process.
|
||||
///
|
||||
|
@ -26,15 +26,22 @@ impl Timespec {
|
||||
}
|
||||
|
||||
fn sub_timespec(&self, other: &Timespec) -> Result<Duration, Duration> {
|
||||
fn sub_ge_to_unsigned(a: i64, b: i64) -> u64 {
|
||||
debug_assert!(a >= b);
|
||||
a.wrapping_sub(b).cast_unsigned()
|
||||
}
|
||||
|
||||
if self >= other {
|
||||
// Logic here is identical to Unix version of `Timestamp::sub_timespec`,
|
||||
// check comments there why operations do not overflow.
|
||||
Ok(if self.t.tv_nsec >= other.t.tv_nsec {
|
||||
Duration::new(
|
||||
(self.t.tv_sec - other.t.tv_sec) as u64,
|
||||
sub_ge_to_unsigned(self.t.tv_sec, other.t.tv_sec),
|
||||
(self.t.tv_nsec - other.t.tv_nsec) as u32,
|
||||
)
|
||||
} else {
|
||||
Duration::new(
|
||||
(self.t.tv_sec - 1 - other.t.tv_sec) as u64,
|
||||
sub_ge_to_unsigned(self.t.tv_sec - 1, other.t.tv_sec),
|
||||
(self.t.tv_nsec + NSEC_PER_SEC - other.t.tv_nsec) as u32,
|
||||
)
|
||||
})
|
||||
|
@ -134,28 +134,25 @@ impl Timespec {
|
||||
}
|
||||
|
||||
pub fn sub_timespec(&self, other: &Timespec) -> Result<Duration, Duration> {
|
||||
// When a >= b, the difference fits in u64.
|
||||
fn sub_ge_to_unsigned(a: i64, b: i64) -> u64 {
|
||||
debug_assert!(a >= b);
|
||||
a.wrapping_sub(b).cast_unsigned()
|
||||
}
|
||||
|
||||
if self >= other {
|
||||
// NOTE(eddyb) two aspects of this `if`-`else` are required for LLVM
|
||||
// to optimize it into a branchless form (see also #75545):
|
||||
//
|
||||
// 1. `self.tv_sec - other.tv_sec` shows up as a common expression
|
||||
// in both branches, i.e. the `else` must have its `- 1`
|
||||
// subtraction after the common one, not interleaved with it
|
||||
// (it used to be `self.tv_sec - 1 - other.tv_sec`)
|
||||
//
|
||||
// 2. the `Duration::new` call (or any other additional complexity)
|
||||
// is outside of the `if`-`else`, not duplicated in both branches
|
||||
//
|
||||
// Ideally this code could be rearranged such that it more
|
||||
// directly expresses the lower-cost behavior we want from it.
|
||||
let (secs, nsec) = if self.tv_nsec.as_inner() >= other.tv_nsec.as_inner() {
|
||||
(
|
||||
(self.tv_sec - other.tv_sec) as u64,
|
||||
sub_ge_to_unsigned(self.tv_sec, other.tv_sec),
|
||||
self.tv_nsec.as_inner() - other.tv_nsec.as_inner(),
|
||||
)
|
||||
} else {
|
||||
// Following sequence of assertions explain why `self.tv_sec - 1` does not underflow.
|
||||
debug_assert!(self.tv_nsec < other.tv_nsec);
|
||||
debug_assert!(self.tv_sec > other.tv_sec);
|
||||
debug_assert!(self.tv_sec > i64::MIN);
|
||||
(
|
||||
(self.tv_sec - other.tv_sec - 1) as u64,
|
||||
sub_ge_to_unsigned(self.tv_sec - 1, other.tv_sec),
|
||||
self.tv_nsec.as_inner() + (NSEC_PER_SEC as u32) - other.tv_nsec.as_inner(),
|
||||
)
|
||||
};
|
||||
|
@ -2528,7 +2528,17 @@ fn normalize_lexically() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
/// See issue#146183
|
||||
fn compare_path_to_str() {
|
||||
assert!(&PathBuf::from("x") == "x");
|
||||
/// See issue#146183 and issue#146940
|
||||
fn compare_path_like_to_str_like() {
|
||||
let path_buf = PathBuf::from("x");
|
||||
let path = Path::new("x");
|
||||
let s = String::from("x");
|
||||
assert!(path == "x");
|
||||
assert!("x" == path);
|
||||
assert!(path == &s);
|
||||
assert!(&s == path);
|
||||
assert!(&path_buf == "x");
|
||||
assert!("x" == &path_buf);
|
||||
assert!(path_buf == s);
|
||||
assert!(s == path_buf);
|
||||
}
|
||||
|
@ -227,3 +227,19 @@ fn big_math() {
|
||||
check(instant.checked_add(Duration::from_secs(100)), Instant::checked_sub);
|
||||
check(instant.checked_add(Duration::from_secs(i64::MAX as _)), Instant::checked_sub);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(unix)]
|
||||
fn system_time_duration_since_max_range_on_unix() {
|
||||
// Repro regression https://github.com/rust-lang/rust/issues/146228
|
||||
|
||||
// Min and max values of `SystemTime` on Unix.
|
||||
let min = SystemTime::UNIX_EPOCH - (Duration::new(i64::MAX as u64 + 1, 0));
|
||||
let max = SystemTime::UNIX_EPOCH + (Duration::new(i64::MAX as u64, 999_999_999));
|
||||
|
||||
let delta_a = max.duration_since(min).expect("duration_since overflow");
|
||||
let delta_b = min.duration_since(max).expect_err("duration_since overflow").duration();
|
||||
|
||||
assert_eq!(Duration::MAX, delta_a);
|
||||
assert_eq!(Duration::MAX, delta_b);
|
||||
}
|
||||
|
@ -1,27 +0,0 @@
|
||||
//@ known-bug: #117808
|
||||
//@ edition:2021
|
||||
//@ needs-rustc-debug-assertions
|
||||
|
||||
use std::future::Future;
|
||||
|
||||
fn hrc<R, F: for<'a> AsyncClosure<'a, (), R>>(f: F) -> F {
|
||||
f
|
||||
}
|
||||
|
||||
fn main() {
|
||||
hrc(|x| async {});
|
||||
}
|
||||
|
||||
trait AsyncClosure<'a, I, R>
|
||||
where
|
||||
I: 'a,
|
||||
{
|
||||
}
|
||||
|
||||
impl<'a, I, R, Fut, F> AsyncClosure<'a, I, R> for F
|
||||
where
|
||||
I: 'a,
|
||||
F: Fn(&'a I) -> Fut,
|
||||
Fut: Future<Output = R> + Send + 'a,
|
||||
{
|
||||
}
|
@ -1,6 +1,5 @@
|
||||
#![feature(prelude_import)]
|
||||
#![no_std]
|
||||
#[macro_use]
|
||||
extern crate std;
|
||||
#[prelude_import]
|
||||
use ::std::prelude::rust_2015::*;
|
||||
|
@ -3,7 +3,8 @@
|
||||
//@ needs-enzyme
|
||||
|
||||
#![feature(autodiff)]
|
||||
#[macro_use]
|
||||
#[prelude_import]
|
||||
use ::std::prelude::rust_2015::*;
|
||||
extern crate std;
|
||||
#[prelude_import]
|
||||
use ::std::prelude::rust_2015::*;
|
||||
|
@ -3,7 +3,8 @@
|
||||
//@ needs-enzyme
|
||||
|
||||
#![feature(autodiff)]
|
||||
#[macro_use]
|
||||
#[prelude_import]
|
||||
use ::std::prelude::rust_2015::*;
|
||||
extern crate std;
|
||||
#[prelude_import]
|
||||
use ::std::prelude::rust_2015::*;
|
||||
|
@ -3,7 +3,8 @@
|
||||
//@ needs-enzyme
|
||||
|
||||
#![feature(autodiff)]
|
||||
#[macro_use]
|
||||
#[prelude_import]
|
||||
use ::std::prelude::rust_2015::*;
|
||||
extern crate std;
|
||||
#[prelude_import]
|
||||
use ::std::prelude::rust_2015::*;
|
||||
|
@ -1,6 +1,5 @@
|
||||
#![feature(prelude_import)]
|
||||
#![no_std]
|
||||
#[macro_use]
|
||||
extern crate std;
|
||||
#[prelude_import]
|
||||
use ::std::prelude::rust_2015::*;
|
||||
|
@ -1,6 +1,5 @@
|
||||
#![feature(prelude_import)]
|
||||
#![no_std]
|
||||
#[macro_use]
|
||||
extern crate std;
|
||||
#[prelude_import]
|
||||
use ::std::prelude::rust_2015::*;
|
||||
|
@ -1,6 +1,5 @@
|
||||
#![feature(prelude_import)]
|
||||
#![no_std]
|
||||
#[macro_use]
|
||||
extern crate std;
|
||||
#[prelude_import]
|
||||
use ::std::prelude::rust_2015::*;
|
||||
|
@ -1,6 +1,5 @@
|
||||
#![feature(prelude_import)]
|
||||
#![no_std]
|
||||
#[macro_use]
|
||||
extern crate std;
|
||||
#[prelude_import]
|
||||
use ::std::prelude::rust_2015::*;
|
||||
|
@ -4,7 +4,6 @@
|
||||
|
||||
#![allow(incomplete_features)]
|
||||
#![feature(fn_delegation)]
|
||||
#[attr = MacroUse {arguments: UseAll}]
|
||||
extern crate std;
|
||||
#[prelude_import]
|
||||
use ::std::prelude::rust_2015::*;
|
||||
|
@ -1,4 +1,3 @@
|
||||
#[attr = MacroUse {arguments: UseAll}]
|
||||
extern crate std;
|
||||
#[prelude_import]
|
||||
use ::std::prelude::rust_2015::*;
|
||||
|
@ -3,7 +3,6 @@
|
||||
//@ pp-exact:hir-fn-variadic.pp
|
||||
|
||||
#![feature(c_variadic)]
|
||||
#[attr = MacroUse {arguments: UseAll}]
|
||||
extern crate std;
|
||||
#[prelude_import]
|
||||
use ::std::prelude::rust_2015::*;
|
||||
|
@ -1,4 +1,3 @@
|
||||
#[attr = MacroUse {arguments: UseAll}]
|
||||
extern crate std;
|
||||
#[prelude_import]
|
||||
use ::std::prelude::rust_2015::*;
|
||||
|
@ -5,7 +5,6 @@
|
||||
// This tests the pretty-printing of lifetimes in lots of ways.
|
||||
|
||||
#![allow(unused)]
|
||||
#[attr = MacroUse {arguments: UseAll}]
|
||||
extern crate std;
|
||||
#[prelude_import]
|
||||
use ::std::prelude::rust_2015::*;
|
||||
|
@ -1,4 +1,3 @@
|
||||
#[attr = MacroUse {arguments: UseAll}]
|
||||
extern crate std;
|
||||
#[prelude_import]
|
||||
use ::std::prelude::rust_2015::*;
|
||||
|
@ -1,4 +1,3 @@
|
||||
#[attr = MacroUse {arguments: UseAll}]
|
||||
extern crate std;
|
||||
#[prelude_import]
|
||||
use ::std::prelude::rust_2015::*;
|
||||
|
@ -1,4 +1,3 @@
|
||||
#[attr = MacroUse {arguments: UseAll}]
|
||||
extern crate std;
|
||||
#[prelude_import]
|
||||
use ::std::prelude::rust_2015::*;
|
||||
|
@ -1,6 +1,5 @@
|
||||
#![feature(prelude_import)]
|
||||
#![no_std]
|
||||
#[macro_use]
|
||||
extern crate std;
|
||||
#[prelude_import]
|
||||
use ::std::prelude::rust_2015::*;
|
||||
|
@ -1,6 +1,5 @@
|
||||
#![feature(prelude_import)]
|
||||
#![no_std]
|
||||
#[macro_use]
|
||||
extern crate std;
|
||||
#[prelude_import]
|
||||
use ::std::prelude::rust_2015::*;
|
||||
|
@ -1,4 +1,3 @@
|
||||
#[attr = MacroUse {arguments: UseAll}]
|
||||
extern crate std;
|
||||
#[prelude_import]
|
||||
use ::std::prelude::rust_2015::*;
|
||||
|
@ -1,4 +1,3 @@
|
||||
#[attr = MacroUse {arguments: UseAll}]
|
||||
extern crate std;
|
||||
#[prelude_import]
|
||||
use ::std::prelude::rust_2015::*;
|
||||
|
@ -7,7 +7,6 @@
|
||||
#![allow(incomplete_features)]
|
||||
#![feature(never_patterns)]
|
||||
#![feature(never_type)]
|
||||
#[macro_use]
|
||||
extern crate std;
|
||||
#[prelude_import]
|
||||
use ::std::prelude::rust_2015::*;
|
||||
|
@ -4,7 +4,6 @@
|
||||
|
||||
#![feature(pin_ergonomics)]
|
||||
#![allow(dead_code, incomplete_features)]
|
||||
#[attr = MacroUse {arguments: UseAll}]
|
||||
extern crate std;
|
||||
#[prelude_import]
|
||||
use ::std::prelude::rust_2015::*;
|
||||
|
@ -1,7 +1,6 @@
|
||||
#![feature(prelude_import)]
|
||||
#![no_std]
|
||||
#![feature(postfix_match)]
|
||||
#[macro_use]
|
||||
extern crate std;
|
||||
#[prelude_import]
|
||||
use ::std::prelude::rust_2015::*;
|
||||
|
@ -1,7 +1,6 @@
|
||||
#!/usr/bin/env rust
|
||||
#![feature(prelude_import)]
|
||||
#![no_std]
|
||||
#[macro_use]
|
||||
extern crate std;
|
||||
#[prelude_import]
|
||||
use ::std::prelude::rust_2015::*;
|
||||
|
@ -1,6 +1,5 @@
|
||||
#![feature(prelude_import)]
|
||||
#![no_std]
|
||||
#[macro_use]
|
||||
extern crate std;
|
||||
#[prelude_import]
|
||||
use ::std::prelude::rust_2015::*;
|
||||
|
@ -6,7 +6,10 @@ const EXPECTED = {
|
||||
'query': 'prinltn',
|
||||
'others': [
|
||||
{ 'path': 'std', 'name': 'println' },
|
||||
{ 'path': 'std::prelude::v1', 'name': 'println' },
|
||||
{ 'path': 'std', 'name': 'print' },
|
||||
{ 'path': 'std::prelude::v1', 'name': 'print' },
|
||||
{ 'path': 'std', 'name': 'eprintln' },
|
||||
{ 'path': 'std::prelude::v1', 'name': 'eprintln' },
|
||||
],
|
||||
};
|
||||
|
@ -1,6 +1,5 @@
|
||||
#![feature(prelude_import)]
|
||||
#![no_std]
|
||||
#[macro_use]
|
||||
extern crate std;
|
||||
#[prelude_import]
|
||||
use ::std::prelude::rust_2015::*;
|
||||
|
@ -1,5 +1,4 @@
|
||||
#![feature(prelude_import)]
|
||||
#[macro_use]
|
||||
extern crate std;
|
||||
#[prelude_import]
|
||||
use std::prelude::rust_2021::*;
|
||||
|
@ -1,6 +1,5 @@
|
||||
#![feature(prelude_import)]
|
||||
#![no_std]
|
||||
#[macro_use]
|
||||
extern crate std;
|
||||
#[prelude_import]
|
||||
use ::std::prelude::rust_2015::*;
|
||||
|
@ -7,7 +7,7 @@ LL |
|
||||
LL | struct A([u8]);
|
||||
| ---- this field does not implement `ConstParamTy_`
|
||||
|
|
||||
note: the `ConstParamTy_` impl for `[u8]` requires that `unstable feature: `unsized_const_params``
|
||||
note: the `ConstParamTy_` impl for `[u8]` requires that `feature(unsized_const_params) is enabled`
|
||||
--> $DIR/unsized_field-1.rs:10:10
|
||||
|
|
||||
LL | struct A([u8]);
|
||||
@ -22,7 +22,7 @@ LL |
|
||||
LL | struct B(&'static [u8]);
|
||||
| ------------- this field does not implement `ConstParamTy_`
|
||||
|
|
||||
note: the `ConstParamTy_` impl for `&'static [u8]` requires that `unstable feature: `unsized_const_params``
|
||||
note: the `ConstParamTy_` impl for `&'static [u8]` requires that `feature(unsized_const_params) is enabled`
|
||||
--> $DIR/unsized_field-1.rs:14:10
|
||||
|
|
||||
LL | struct B(&'static [u8]);
|
||||
@ -37,7 +37,7 @@ LL |
|
||||
LL | struct D(unsized_const_param::GenericNotUnsizedParam<&'static [u8]>);
|
||||
| ---------------------------------------------------------- this field does not implement `ConstParamTy_`
|
||||
|
|
||||
note: the `ConstParamTy_` impl for `GenericNotUnsizedParam<&'static [u8]>` requires that `unstable feature: `unsized_const_params``
|
||||
note: the `ConstParamTy_` impl for `GenericNotUnsizedParam<&'static [u8]>` requires that `feature(unsized_const_params) is enabled`
|
||||
--> $DIR/unsized_field-1.rs:21:10
|
||||
|
|
||||
LL | struct D(unsized_const_param::GenericNotUnsizedParam<&'static [u8]>);
|
||||
|
@ -6,7 +6,6 @@
|
||||
//@ edition: 2015
|
||||
|
||||
#![crate_type = "lib"]
|
||||
#[macro_use]
|
||||
extern crate std;
|
||||
#[prelude_import]
|
||||
use ::std::prelude::rust_2015::*;
|
||||
|
@ -6,8 +6,8 @@ LL | struct D<const X: C>;
|
||||
|
|
||||
help: add `#[derive(ConstParamTy, PartialEq, Eq)]` to the struct
|
||||
|
|
||||
LL - struct C;
|
||||
LL + #[derive(ConstParamTy, PartialEq, Eq)]
|
||||
LL | struct C;
|
||||
|
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
@ -4,10 +4,10 @@ error[E0741]: `Nat` must implement `ConstParamTy` to be used as the type of a co
|
||||
LL | fn foo<const N: Nat>() {}
|
||||
| ^^^
|
||||
|
|
||||
help: add `#[derive(ConstParamTy)]` to the struct
|
||||
help: add `#[derive(ConstParamTy)]` to the enum
|
||||
|
|
||||
LL - enum Nat {
|
||||
LL + #[derive(ConstParamTy)]
|
||||
LL | enum Nat {
|
||||
|
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
@ -4,10 +4,10 @@ error[E0741]: `Bar` must implement `ConstParamTy` to be used as the type of a co
|
||||
LL | fn test<const BAR: Bar>() {}
|
||||
| ^^^
|
||||
|
|
||||
help: add `#[derive(ConstParamTy)]` to the struct
|
||||
help: add `#[derive(ConstParamTy)]` to the enum
|
||||
|
|
||||
LL - enum Bar {
|
||||
LL + #[derive(ConstParamTy)]
|
||||
LL | enum Bar {
|
||||
|
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
@ -15,8 +15,8 @@ LL | struct Foo<const T: CompileTimeSettings>;
|
||||
|
|
||||
help: add `#[derive(ConstParamTy)]` to the struct
|
||||
|
|
||||
LL - struct CompileTimeSettings {
|
||||
LL + #[derive(ConstParamTy)]
|
||||
LL | struct CompileTimeSettings {
|
||||
|
|
||||
|
||||
error[E0741]: `CompileTimeSettings` must implement `ConstParamTy` to be used as the type of a const generic parameter
|
||||
@ -27,8 +27,8 @@ LL | impl<const T: CompileTimeSettings> Foo<T> {
|
||||
|
|
||||
help: add `#[derive(ConstParamTy)]` to the struct
|
||||
|
|
||||
LL - struct CompileTimeSettings {
|
||||
LL + #[derive(ConstParamTy)]
|
||||
LL | struct CompileTimeSettings {
|
||||
|
|
||||
|
||||
error: aborting due to 2 previous errors; 1 warning emitted
|
||||
|
@ -6,7 +6,6 @@
|
||||
//@ edition:2015
|
||||
|
||||
#![feature(derive_coerce_pointee)]
|
||||
#[macro_use]
|
||||
extern crate std;
|
||||
#[prelude_import]
|
||||
use ::std::prelude::rust_2015::*;
|
||||
|
@ -18,7 +18,6 @@
|
||||
#![allow(dead_code)]
|
||||
#![allow(deprecated)]
|
||||
#![feature(derive_from)]
|
||||
#[macro_use]
|
||||
extern crate std;
|
||||
#[prelude_import]
|
||||
use std::prelude::rust_2021::*;
|
||||
|
@ -4,7 +4,6 @@
|
||||
//@ compile-flags: -Zunpretty=expanded
|
||||
//@ edition: 2015
|
||||
#![feature(derive_coerce_pointee)]
|
||||
#[macro_use]
|
||||
extern crate std;
|
||||
#[prelude_import]
|
||||
use ::std::prelude::rust_2015::*;
|
||||
|
@ -12,7 +12,6 @@
|
||||
//@ edition: 2015
|
||||
|
||||
#![feature(derive_coerce_pointee)]
|
||||
#[macro_use]
|
||||
extern crate std;
|
||||
#[prelude_import]
|
||||
use ::std::prelude::rust_2015::*;
|
||||
|
@ -1,3 +1,5 @@
|
||||
use std::format_args_nl; //~ ERROR `format_args_nl` is only for internal language use
|
||||
|
||||
fn main() {
|
||||
format_args_nl!(""); //~ ERROR `format_args_nl` is only for internal language use
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
error[E0658]: use of unstable library feature `format_args_nl`: `format_args_nl` is only for internal language use and is subject to change
|
||||
--> $DIR/feature-gate-format_args_nl.rs:2:5
|
||||
--> $DIR/feature-gate-format_args_nl.rs:4:5
|
||||
|
|
||||
LL | format_args_nl!("");
|
||||
| ^^^^^^^^^^^^^^
|
||||
@ -7,6 +7,15 @@ LL | format_args_nl!("");
|
||||
= help: add `#![feature(format_args_nl)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
error[E0658]: use of unstable library feature `format_args_nl`: `format_args_nl` is only for internal language use and is subject to change
|
||||
--> $DIR/feature-gate-format_args_nl.rs:1:5
|
||||
|
|
||||
LL | use std::format_args_nl;
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: add `#![feature(format_args_nl)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
||||
|
@ -3,6 +3,8 @@
|
||||
#![allow(non_upper_case_globals)]
|
||||
#![feature(format_args_nl)]
|
||||
|
||||
use std::format_args_nl;
|
||||
|
||||
static arg0: () = ();
|
||||
|
||||
fn main() {
|
||||
|
@ -5,14 +5,15 @@ LL | let x = env!("PATH");
|
||||
| ^^^ ambiguous name
|
||||
|
|
||||
= note: ambiguous because of a conflict between a name from a glob import and an outer scope during import or macro resolution
|
||||
= note: `env` could refer to a macro from prelude
|
||||
note: `env` could also refer to the macro imported here
|
||||
note: `env` could refer to the macro imported here
|
||||
--> $DIR/glob-shadowing.rs:9:9
|
||||
|
|
||||
LL | use crate::m::*;
|
||||
| ^^^^^^^^^^^
|
||||
= help: consider adding an explicit import of `env` to disambiguate
|
||||
= help: or use `self::env` to refer to this macro unambiguously
|
||||
note: `env` could also refer to a macro from prelude
|
||||
--> $SRC_DIR/std/src/prelude/mod.rs:LL:COL
|
||||
|
||||
error[E0659]: `env` is ambiguous
|
||||
--> $DIR/glob-shadowing.rs:19:21
|
||||
@ -21,13 +22,14 @@ LL | let x = env!("PATH");
|
||||
| ^^^ ambiguous name
|
||||
|
|
||||
= note: ambiguous because of a conflict between a name from a glob import and an outer scope during import or macro resolution
|
||||
= note: `env` could refer to a macro from prelude
|
||||
note: `env` could also refer to the macro imported here
|
||||
note: `env` could refer to the macro imported here
|
||||
--> $DIR/glob-shadowing.rs:17:13
|
||||
|
|
||||
LL | use crate::m::*;
|
||||
| ^^^^^^^^^^^
|
||||
= help: consider adding an explicit import of `env` to disambiguate
|
||||
note: `env` could also refer to a macro from prelude
|
||||
--> $SRC_DIR/std/src/prelude/mod.rs:LL:COL
|
||||
|
||||
error[E0659]: `fenv` is ambiguous
|
||||
--> $DIR/glob-shadowing.rs:29:21
|
||||
|
@ -30,8 +30,7 @@ LL | panic!();
|
||||
| ^^^^^ ambiguous name
|
||||
|
|
||||
= note: ambiguous because of a conflict between a macro-expanded name and a less macro-expanded name from outer scope during import or macro resolution
|
||||
= note: `panic` could refer to a macro from prelude
|
||||
note: `panic` could also refer to the macro defined here
|
||||
note: `panic` could refer to the macro defined here
|
||||
--> $DIR/local-modularized-tricky-fail-1.rs:12:5
|
||||
|
|
||||
LL | / macro_rules! panic {
|
||||
@ -42,6 +41,8 @@ LL | | }
|
||||
LL | define_panic!();
|
||||
| --------------- in this macro invocation
|
||||
= help: use `crate::panic` to refer to this macro unambiguously
|
||||
note: `panic` could also refer to a macro from prelude
|
||||
--> $SRC_DIR/std/src/prelude/mod.rs:LL:COL
|
||||
= note: this error originates in the macro `define_panic` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0659]: `include` is ambiguous
|
||||
@ -51,8 +52,7 @@ LL | include!();
|
||||
| ^^^^^^^ ambiguous name
|
||||
|
|
||||
= note: ambiguous because of a conflict between a macro-expanded name and a less macro-expanded name from outer scope during import or macro resolution
|
||||
= note: `include` could refer to a macro from prelude
|
||||
note: `include` could also refer to the macro defined here
|
||||
note: `include` could refer to the macro defined here
|
||||
--> $DIR/local-modularized-tricky-fail-1.rs:18:5
|
||||
|
|
||||
LL | / macro_rules! include {
|
||||
@ -63,6 +63,8 @@ LL | | }
|
||||
LL | define_include!();
|
||||
| ----------------- in this macro invocation
|
||||
= help: use `crate::include` to refer to this macro unambiguously
|
||||
note: `include` could also refer to a macro from prelude
|
||||
--> $SRC_DIR/std/src/prelude/mod.rs:LL:COL
|
||||
= note: this error originates in the macro `define_include` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
@ -5,14 +5,15 @@ LL | fn f() { panic!(); }
|
||||
| ^^^^^ ambiguous name
|
||||
|
|
||||
= note: ambiguous because of a conflict between a name from a glob import and an outer scope during import or macro resolution
|
||||
= note: `panic` could refer to a macro from prelude
|
||||
note: `panic` could also refer to the macro imported here
|
||||
note: `panic` could refer to the macro imported here
|
||||
--> $DIR/shadow_builtin_macros.rs:14:9
|
||||
|
|
||||
LL | use crate::foo::*;
|
||||
| ^^^^^^^^^^^^^
|
||||
= help: consider adding an explicit import of `panic` to disambiguate
|
||||
= help: or use `self::panic` to refer to this macro unambiguously
|
||||
note: `panic` could also refer to a macro from prelude
|
||||
--> $SRC_DIR/std/src/prelude/mod.rs:LL:COL
|
||||
|
||||
error[E0659]: `panic` is ambiguous
|
||||
--> $DIR/shadow_builtin_macros.rs:33:5
|
||||
@ -21,8 +22,7 @@ LL | panic!();
|
||||
| ^^^^^ ambiguous name
|
||||
|
|
||||
= note: ambiguous because of a conflict between a macro-expanded name and a less macro-expanded name from outer scope during import or macro resolution
|
||||
= note: `panic` could refer to a macro from prelude
|
||||
note: `panic` could also refer to the macro defined here
|
||||
note: `panic` could refer to the macro defined here
|
||||
--> $DIR/shadow_builtin_macros.rs:30:9
|
||||
|
|
||||
LL | macro_rules! panic { () => {} }
|
||||
@ -30,6 +30,8 @@ LL | macro_rules! panic { () => {} }
|
||||
LL | } }
|
||||
LL | m!();
|
||||
| ---- in this macro invocation
|
||||
note: `panic` could also refer to a macro from prelude
|
||||
--> $SRC_DIR/std/src/prelude/mod.rs:LL:COL
|
||||
= note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0659]: `n` is ambiguous
|
||||
@ -59,13 +61,14 @@ LL | fn f() { panic!(); }
|
||||
| ^^^^^ ambiguous name
|
||||
|
|
||||
= note: ambiguous because of a conflict between a macro-expanded name and a less macro-expanded name from outer scope during import or macro resolution
|
||||
= note: `panic` could refer to a macro from prelude
|
||||
note: `panic` could also refer to the macro imported here
|
||||
note: `panic` could refer to the macro imported here
|
||||
--> $DIR/shadow_builtin_macros.rs:19:26
|
||||
|
|
||||
LL | ::two_macros::m!(use crate::foo::panic;);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
= help: use `self::panic` to refer to this macro unambiguously
|
||||
note: `panic` could also refer to a macro from prelude
|
||||
--> $SRC_DIR/std/src/prelude/mod.rs:LL:COL
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
#![deny(dead_code)]
|
||||
#![allow(unreachable_code)]
|
||||
|
||||
#[macro_use]
|
||||
extern crate core;
|
||||
|
||||
fn foo() { //~ ERROR function `foo` is never used
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: function `foo` is never used
|
||||
--> $DIR/with-core-crate.rs:7:4
|
||||
--> $DIR/with-core-crate.rs:6:4
|
||||
|
|
||||
LL | fn foo() {
|
||||
| ^^^
|
||||
|
@ -1,6 +1,5 @@
|
||||
#![feature(prelude_import)]
|
||||
#![no_std]
|
||||
#[macro_use]
|
||||
extern crate std;
|
||||
#[prelude_import]
|
||||
use ::std::prelude::rust_2015::*;
|
||||
|
@ -1,4 +1,3 @@
|
||||
#[attr = MacroUse {arguments: UseAll}]
|
||||
extern crate std;
|
||||
#[prelude_import]
|
||||
use ::std::prelude::rust_2015::*;
|
||||
|
@ -5,7 +5,6 @@
|
||||
//@ edition: 2015
|
||||
|
||||
#![feature(core_intrinsics, generic_assert)]
|
||||
#[macro_use]
|
||||
extern crate std;
|
||||
#[prelude_import]
|
||||
use ::std::prelude::rust_2015::*;
|
||||
|
@ -1,4 +1,3 @@
|
||||
#[attr = MacroUse {arguments: UseAll}]
|
||||
extern crate std;
|
||||
#[prelude_import]
|
||||
use ::std::prelude::rust_2015::*;
|
||||
|
@ -16,7 +16,6 @@ Respanned: TokenStream [Ident { ident: "$crate", span: $DIR/auxiliary/make-macro
|
||||
// in the stdout
|
||||
|
||||
#![no_std /* 0#0 */]
|
||||
#[macro_use /* 0#1 */]
|
||||
extern crate core /* 0#1 */;
|
||||
#[prelude_import /* 0#1 */]
|
||||
use core /* 0#1 */::prelude /* 0#1 */::rust_2018 /* 0#1 */::*;
|
||||
|
@ -36,7 +36,6 @@ PRINT-BANG INPUT (DEBUG): TokenStream [
|
||||
|
||||
#![feature /* 0#0 */(decl_macro)]
|
||||
#![no_std /* 0#0 */]
|
||||
#[macro_use /* 0#1 */]
|
||||
extern crate core /* 0#2 */;
|
||||
#[prelude_import /* 0#1 */]
|
||||
use ::core /* 0#1 */::prelude /* 0#1 */::rust_2015 /* 0#1 */::*;
|
||||
|
@ -12,7 +12,6 @@
|
||||
|
||||
#![feature(proc_macro_quote)]
|
||||
#![crate_type = "proc-macro"]
|
||||
#[macro_use]
|
||||
extern crate std;
|
||||
#[prelude_import]
|
||||
use ::std::prelude::rust_2015::*;
|
||||
|
@ -1,6 +1,5 @@
|
||||
#![feature(prelude_import)]
|
||||
#![no_std]
|
||||
#[macro_use]
|
||||
extern crate std;
|
||||
#[prelude_import]
|
||||
use ::std::prelude::rust_2015::*;
|
||||
|
@ -15,7 +15,7 @@ ast-stats - Ptr 64 (NN.N%) 1
|
||||
ast-stats - Ref 64 (NN.N%) 1
|
||||
ast-stats - ImplicitSelf 128 (NN.N%) 2
|
||||
ast-stats - Path 640 (NN.N%) 10
|
||||
ast-stats PathSegment 888 (NN.N%) 37 24
|
||||
ast-stats PathSegment 864 (NN.N%) 36 24
|
||||
ast-stats Expr 648 (NN.N%) 9 72
|
||||
ast-stats - InlineAsm 72 (NN.N%) 1
|
||||
ast-stats - Match 72 (NN.N%) 1
|
||||
@ -41,9 +41,9 @@ ast-stats - Let 32 (NN.N%) 1
|
||||
ast-stats - Semi 32 (NN.N%) 1
|
||||
ast-stats - Expr 96 (NN.N%) 3
|
||||
ast-stats Param 160 (NN.N%) 4 40
|
||||
ast-stats Attribute 160 (NN.N%) 5 32
|
||||
ast-stats Attribute 128 (NN.N%) 4 32
|
||||
ast-stats - DocComment 32 (NN.N%) 1
|
||||
ast-stats - Normal 128 (NN.N%) 4
|
||||
ast-stats - Normal 96 (NN.N%) 3
|
||||
ast-stats InlineAsm 120 (NN.N%) 1 120
|
||||
ast-stats FnDecl 120 (NN.N%) 5 24
|
||||
ast-stats Local 96 (NN.N%) 1 96
|
||||
@ -57,7 +57,7 @@ ast-stats GenericArgs 40 (NN.N%) 1 40
|
||||
ast-stats - AngleBracketed 40 (NN.N%) 1
|
||||
ast-stats Crate 40 (NN.N%) 1 40
|
||||
ast-stats ----------------------------------------------------------------
|
||||
ast-stats Total 7_528 129
|
||||
ast-stats Total 7_472 127
|
||||
ast-stats ================================================================
|
||||
hir-stats ================================================================
|
||||
hir-stats HIR STATS: input_stats
|
||||
@ -93,7 +93,7 @@ hir-stats GenericParam 400 (NN.N%) 5 80
|
||||
hir-stats Block 288 (NN.N%) 6 48
|
||||
hir-stats GenericBound 256 (NN.N%) 4 64
|
||||
hir-stats - Trait 256 (NN.N%) 4
|
||||
hir-stats Attribute 200 (NN.N%) 5 40
|
||||
hir-stats Attribute 160 (NN.N%) 4 40
|
||||
hir-stats Variant 144 (NN.N%) 2 72
|
||||
hir-stats GenericArgs 144 (NN.N%) 3 48
|
||||
hir-stats FieldDef 128 (NN.N%) 2 64
|
||||
@ -119,5 +119,5 @@ hir-stats TraitItemId 8 (NN.N%) 2 4
|
||||
hir-stats ImplItemId 8 (NN.N%) 2 4
|
||||
hir-stats ForeignItemId 4 (NN.N%) 1 4
|
||||
hir-stats ----------------------------------------------------------------
|
||||
hir-stats Total 8_624 173
|
||||
hir-stats Total 8_584 172
|
||||
hir-stats ================================================================
|
||||
|
@ -0,0 +1,14 @@
|
||||
//@ edition: 2024
|
||||
//@ check-pass
|
||||
//@ compile-flags: -Znext-solver
|
||||
|
||||
// This previously ICE'd during writeback when resolving
|
||||
// the stalled coroutine predicate due to its bound lifetime.
|
||||
|
||||
trait Trait<'a> {}
|
||||
impl<'a, T: Send> Trait<'a> for T {}
|
||||
|
||||
fn is_trait<T: for<'a> Trait<'a>>(_: T) {}
|
||||
fn main() {
|
||||
is_trait(async {})
|
||||
}
|
@ -3,7 +3,6 @@
|
||||
//@ edition: 2015
|
||||
|
||||
#![feature(type_alias_impl_trait)]
|
||||
#[attr = MacroUse {arguments: UseAll}]
|
||||
extern crate std;
|
||||
#[prelude_import]
|
||||
use ::std::prelude::rust_2015::*;
|
||||
|
@ -1,4 +1,3 @@
|
||||
#[attr = MacroUse {arguments: UseAll}]
|
||||
extern crate std;
|
||||
#[prelude_import]
|
||||
use ::std::prelude::rust_2015::*;
|
||||
|
@ -1,4 +1,3 @@
|
||||
#[attr = MacroUse {arguments: UseAll}]
|
||||
extern crate std;
|
||||
#[prelude_import]
|
||||
use ::std::prelude::rust_2015::*;
|
||||
|
@ -1,4 +1,3 @@
|
||||
#[attr = MacroUse {arguments: UseAll}]
|
||||
extern crate std;
|
||||
#[prelude_import]
|
||||
use ::std::prelude::rust_2015::*;
|
||||
|
@ -1,4 +1,3 @@
|
||||
#[attr = MacroUse {arguments: UseAll}]
|
||||
extern crate std;
|
||||
#[prelude_import]
|
||||
use ::std::prelude::rust_2015::*;
|
||||
|
@ -1,5 +1,4 @@
|
||||
#![feature(prelude_import)]
|
||||
#[macro_use]
|
||||
extern crate std;
|
||||
#[prelude_import]
|
||||
use std::prelude::rust_2024::*;
|
||||
|
@ -1,4 +1,3 @@
|
||||
#[attr = MacroUse {arguments: UseAll}]
|
||||
extern crate std;
|
||||
#[prelude_import]
|
||||
use std::prelude::rust_2024::*;
|
||||
|
@ -30,7 +30,6 @@
|
||||
#![feature(try_blocks)]
|
||||
#![feature(yeet_expr)]
|
||||
#![allow(incomplete_features)]
|
||||
#[macro_use]
|
||||
extern crate std;
|
||||
#[prelude_import]
|
||||
use std::prelude::rust_2024::*;
|
||||
|
@ -29,7 +29,6 @@
|
||||
#![feature(try_blocks)]
|
||||
#![feature(yeet_expr)]
|
||||
#![allow(incomplete_features)]
|
||||
#[attr = MacroUse {arguments: UseAll}]
|
||||
extern crate std;
|
||||
#[prelude_import]
|
||||
use std::prelude::rust_2024::*;
|
||||
|
@ -1,4 +1,3 @@
|
||||
#[attr = MacroUse {arguments: UseAll}]
|
||||
extern crate std;
|
||||
#[prelude_import]
|
||||
use ::std::prelude::rust_2015::*;
|
||||
|
@ -10,7 +10,6 @@
|
||||
// synthesizing parentheses indiscriminately; only where necessary.
|
||||
|
||||
#![feature(if_let_guard)]
|
||||
#[macro_use]
|
||||
extern crate std;
|
||||
#[prelude_import]
|
||||
use std::prelude::rust_2024::*;
|
||||
|
@ -1,4 +1,3 @@
|
||||
#[attr = MacroUse {arguments: UseAll}]
|
||||
extern crate std;
|
||||
#[prelude_import]
|
||||
use ::std::prelude::rust_2015::*;
|
||||
|
@ -1,4 +1,3 @@
|
||||
#[attr = MacroUse {arguments: UseAll}]
|
||||
extern crate std;
|
||||
#[prelude_import]
|
||||
use ::std::prelude::rust_2015::*;
|
||||
|
@ -8,7 +8,6 @@
|
||||
//@ compile-flags: -Zunpretty=hir,typed
|
||||
//@ edition: 2015
|
||||
#![allow(dead_code)]
|
||||
#[attr = MacroUse {arguments: UseAll}]
|
||||
extern crate std;
|
||||
#[prelude_import]
|
||||
use ::std::prelude::rust_2015::*;
|
||||
|
@ -6,7 +6,7 @@ LL | impl aux::Trait for LocalTy {}
|
||||
|
|
||||
= note: conflicting implementation in crate `unstable_impl_coherence_aux`:
|
||||
- impl<T> Trait for T
|
||||
where unstable feature: `foo`;
|
||||
where feature(foo) is enabled;
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
|
@ -6,7 +6,7 @@ LL | impl aux::Trait for LocalTy {}
|
||||
|
|
||||
= note: conflicting implementation in crate `unstable_impl_coherence_aux`:
|
||||
- impl<T> Trait for T
|
||||
where unstable feature: `foo`;
|
||||
where feature(foo) is enabled;
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
|
@ -7,7 +7,7 @@ LL | vec![].foo();
|
||||
= note: multiple `impl`s satisfying `Vec<_>: Trait` found in the `unstable_impl_method_selection_aux` crate:
|
||||
- impl Trait for Vec<u32>;
|
||||
- impl Trait for Vec<u64>
|
||||
where unstable feature: `bar`;
|
||||
where feature(bar) is enabled;
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user