mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-24 15:54:15 +00:00
Auto merge of #117875 - Mark-Simulacrum:bootstrap-bump, r=clubby789
Bootstrap bump Bumps bootstrap compiler to just-released beta. https://forge.rust-lang.org/release/process.html#master-bootstrap-update-t-2-day-tuesday
This commit is contained in:
commit
1be1e84872
@ -1,7 +1,7 @@
|
||||
#![cfg_attr(feature = "nightly", feature(step_trait))]
|
||||
#![cfg_attr(feature = "nightly", allow(internal_features))]
|
||||
#![cfg_attr(all(not(bootstrap), feature = "nightly"), doc(rust_logo))]
|
||||
#![cfg_attr(all(not(bootstrap), feature = "nightly"), feature(rustdoc_internals))]
|
||||
#![cfg_attr(feature = "nightly", doc(rust_logo))]
|
||||
#![cfg_attr(feature = "nightly", feature(rustdoc_internals))]
|
||||
|
||||
use std::fmt;
|
||||
use std::num::{NonZeroUsize, ParseIntError};
|
||||
|
@ -11,8 +11,8 @@
|
||||
html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/",
|
||||
test(no_crate_inject, attr(deny(warnings)))
|
||||
)]
|
||||
#![cfg_attr(not(bootstrap), doc(rust_logo))]
|
||||
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
|
||||
#![doc(rust_logo)]
|
||||
#![feature(rustdoc_internals)]
|
||||
#![feature(core_intrinsics)]
|
||||
#![feature(dropck_eyepatch)]
|
||||
#![feature(new_uninit)]
|
||||
|
@ -8,9 +8,9 @@
|
||||
html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/",
|
||||
test(attr(deny(warnings)))
|
||||
)]
|
||||
#![cfg_attr(not(bootstrap), doc(rust_logo))]
|
||||
#![cfg_attr(not(bootstrap), allow(internal_features))]
|
||||
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
|
||||
#![doc(rust_logo)]
|
||||
#![allow(internal_features)]
|
||||
#![feature(rustdoc_internals)]
|
||||
#![feature(associated_type_bounds)]
|
||||
#![feature(box_patterns)]
|
||||
#![feature(const_trait_impl)]
|
||||
|
@ -30,9 +30,9 @@
|
||||
//! get confused if the spans from leaf AST nodes occur in multiple places
|
||||
//! in the HIR, especially for multiple identifiers.
|
||||
|
||||
#![cfg_attr(not(bootstrap), allow(internal_features))]
|
||||
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
|
||||
#![cfg_attr(not(bootstrap), doc(rust_logo))]
|
||||
#![allow(internal_features)]
|
||||
#![feature(rustdoc_internals)]
|
||||
#![doc(rust_logo)]
|
||||
#![feature(box_patterns)]
|
||||
#![feature(let_chains)]
|
||||
#![feature(never_type)]
|
||||
|
@ -1213,8 +1213,12 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
|
||||
DisallowTildeConstContext::Fn(FnKind::Fn(_, ident, ..)) => {
|
||||
errors::TildeConstReason::Function { ident: ident.span }
|
||||
}
|
||||
&DisallowTildeConstContext::Trait(span) => errors::TildeConstReason::Trait { span },
|
||||
&DisallowTildeConstContext::Impl(span) => errors::TildeConstReason::Impl { span },
|
||||
&DisallowTildeConstContext::Trait(span) => {
|
||||
errors::TildeConstReason::Trait { span }
|
||||
}
|
||||
&DisallowTildeConstContext::Impl(span) => {
|
||||
errors::TildeConstReason::Impl { span }
|
||||
}
|
||||
DisallowTildeConstContext::TraitObject => {
|
||||
errors::TildeConstReason::TraitObject
|
||||
}
|
||||
@ -1446,9 +1450,7 @@ fn deny_equality_constraints(
|
||||
id: rustc_ast::node_id::DUMMY_NODE_ID,
|
||||
ident: *ident,
|
||||
gen_args,
|
||||
kind: AssocConstraintKind::Equality {
|
||||
term: predicate.rhs_ty.clone().into(),
|
||||
},
|
||||
kind: AssocConstraintKind::Equality { term: predicate.rhs_ty.clone().into() },
|
||||
span: ident.span,
|
||||
});
|
||||
// Add `<Bar = RhsTy>` to `Foo`.
|
||||
@ -1461,11 +1463,7 @@ fn deny_equality_constraints(
|
||||
},
|
||||
empty_args => {
|
||||
*empty_args = Some(
|
||||
AngleBracketedArgs {
|
||||
span: ident.span,
|
||||
args: thin_vec![arg],
|
||||
}
|
||||
.into(),
|
||||
AngleBracketedArgs { span: ident.span, args: thin_vec![arg] }.into(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -4,9 +4,9 @@
|
||||
//!
|
||||
//! The crate also contains other misc AST visitors, e.g. `node_count` and `show_span`.
|
||||
|
||||
#![cfg_attr(not(bootstrap), allow(internal_features))]
|
||||
#![cfg_attr(not(bootstrap), doc(rust_logo))]
|
||||
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
|
||||
#![allow(internal_features)]
|
||||
#![doc(rust_logo)]
|
||||
#![feature(rustdoc_internals)]
|
||||
#![feature(box_patterns)]
|
||||
#![feature(if_let_guard)]
|
||||
#![feature(iter_is_partitioned)]
|
||||
|
@ -1,6 +1,6 @@
|
||||
#![cfg_attr(not(bootstrap), allow(internal_features))]
|
||||
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
|
||||
#![cfg_attr(not(bootstrap), doc(rust_logo))]
|
||||
#![allow(internal_features)]
|
||||
#![feature(rustdoc_internals)]
|
||||
#![doc(rust_logo)]
|
||||
#![deny(rustc::untranslatable_diagnostic)]
|
||||
#![deny(rustc::diagnostic_outside_of_impl)]
|
||||
#![feature(associated_type_bounds)]
|
||||
|
@ -4,9 +4,9 @@
|
||||
//! The goal is to move the definition of `MetaItem` and things that don't need to be in `syntax`
|
||||
//! to this crate.
|
||||
|
||||
#![cfg_attr(not(bootstrap), allow(internal_features))]
|
||||
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
|
||||
#![cfg_attr(not(bootstrap), doc(rust_logo))]
|
||||
#![allow(internal_features)]
|
||||
#![feature(rustdoc_internals)]
|
||||
#![doc(rust_logo)]
|
||||
#![feature(let_chains)]
|
||||
#![deny(rustc::untranslatable_diagnostic)]
|
||||
#![deny(rustc::diagnostic_outside_of_impl)]
|
||||
|
@ -20,9 +20,9 @@
|
||||
//! --cldr-tag latest --icuexport-tag latest -o src/data
|
||||
//! ```
|
||||
|
||||
#![cfg_attr(not(bootstrap), allow(internal_features))]
|
||||
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
|
||||
#![cfg_attr(not(bootstrap), doc(rust_logo))]
|
||||
#![allow(internal_features)]
|
||||
#![feature(rustdoc_internals)]
|
||||
#![doc(rust_logo)]
|
||||
#![allow(elided_lifetimes_in_paths)]
|
||||
|
||||
mod data {
|
||||
|
@ -607,7 +607,8 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
|
||||
|
||||
if let Some(adt) = local_ty.ty_adt_def()
|
||||
&& adt.repr().packed()
|
||||
&& let ExpnKind::Macro(MacroKind::Derive, name) = self.body.span.ctxt().outer_expn_data().kind
|
||||
&& let ExpnKind::Macro(MacroKind::Derive, name) =
|
||||
self.body.span.ctxt().outer_expn_data().kind
|
||||
{
|
||||
err.note(format!("`#[derive({name})]` triggers a move because taking references to the fields of a packed struct is undefined behaviour"));
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
//! This query borrow-checks the MIR to (further) ensure it is not broken.
|
||||
|
||||
#![allow(internal_features)]
|
||||
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
|
||||
#![cfg_attr(not(bootstrap), doc(rust_logo))]
|
||||
#![feature(rustdoc_internals)]
|
||||
#![doc(rust_logo)]
|
||||
#![feature(associated_type_bounds)]
|
||||
#![feature(box_patterns)]
|
||||
#![feature(let_chains)]
|
||||
|
@ -617,10 +617,17 @@ fn report_missing_placeholders(
|
||||
let placeholders = pieces
|
||||
.iter()
|
||||
.filter_map(|piece| {
|
||||
if let parse::Piece::NextArgument(argument) = piece && let ArgumentNamed(binding) = argument.position {
|
||||
let span = fmt_span.from_inner(InnerSpan::new(argument.position_span.start, argument.position_span.end));
|
||||
if let parse::Piece::NextArgument(argument) = piece
|
||||
&& let ArgumentNamed(binding) = argument.position
|
||||
{
|
||||
let span = fmt_span.from_inner(InnerSpan::new(
|
||||
argument.position_span.start,
|
||||
argument.position_span.end,
|
||||
));
|
||||
Some((span, binding))
|
||||
} else { None }
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
//! This crate contains implementations of built-in macros and other code generating facilities
|
||||
//! injecting code into the crate before it is lowered to HIR.
|
||||
|
||||
#![cfg_attr(not(bootstrap), allow(internal_features))]
|
||||
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
|
||||
#![cfg_attr(not(bootstrap), doc(rust_logo))]
|
||||
#![allow(internal_features)]
|
||||
#![feature(rustdoc_internals)]
|
||||
#![doc(rust_logo)]
|
||||
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
|
||||
#![feature(array_windows)]
|
||||
#![feature(box_patterns)]
|
||||
|
@ -457,6 +457,8 @@ impl<'a> TestRunner<'a> {
|
||||
cmd.arg("--target");
|
||||
cmd.arg(&self.target_compiler.triple);
|
||||
cmd.arg("-Cpanic=abort");
|
||||
cmd.arg("--check-cfg=cfg(no_unstable_features)");
|
||||
cmd.arg("--check-cfg=cfg(jit)");
|
||||
cmd.args(args);
|
||||
cmd
|
||||
}
|
||||
|
@ -12,9 +12,9 @@
|
||||
* TODO(antoyo): remove the patches.
|
||||
*/
|
||||
|
||||
#![cfg_attr(not(bootstrap), allow(internal_features))]
|
||||
#![cfg_attr(not(bootstrap), doc(rust_logo))]
|
||||
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
|
||||
#![allow(internal_features)]
|
||||
#![doc(rust_logo)]
|
||||
#![feature(rustdoc_internals)]
|
||||
#![feature(
|
||||
rustc_private,
|
||||
decl_macro,
|
||||
|
@ -4,9 +4,9 @@
|
||||
//!
|
||||
//! This API is completely unstable and subject to change.
|
||||
|
||||
#![cfg_attr(not(bootstrap), allow(internal_features))]
|
||||
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
|
||||
#![cfg_attr(not(bootstrap), doc(rust_logo))]
|
||||
#![allow(internal_features)]
|
||||
#![feature(rustdoc_internals)]
|
||||
#![doc(rust_logo)]
|
||||
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
|
||||
#![feature(exact_size_is_empty)]
|
||||
#![feature(extern_types)]
|
||||
|
@ -1,7 +1,7 @@
|
||||
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
|
||||
#![cfg_attr(not(bootstrap), doc(rust_logo))]
|
||||
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
|
||||
#![cfg_attr(not(bootstrap), allow(internal_features))]
|
||||
#![doc(rust_logo)]
|
||||
#![feature(rustdoc_internals)]
|
||||
#![allow(internal_features)]
|
||||
#![feature(associated_type_bounds)]
|
||||
#![feature(box_patterns)]
|
||||
#![feature(if_let_guard)]
|
||||
|
@ -114,9 +114,8 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
|
||||
use rustc_middle::mir::BinOp::*;
|
||||
|
||||
// Performs appropriate non-deterministic adjustments of NaN results.
|
||||
let adjust_nan = |f: F| -> F {
|
||||
if f.is_nan() { M::generate_nan(self, &[l, r]) } else { f }
|
||||
};
|
||||
let adjust_nan =
|
||||
|f: F| -> F { if f.is_nan() { M::generate_nan(self, &[l, r]) } else { f } };
|
||||
|
||||
let val = match bin_op {
|
||||
Eq => ImmTy::from_bool(l == r, *self.tcx),
|
||||
|
@ -4,9 +4,9 @@ Rust MIR: a lowered representation of Rust.
|
||||
|
||||
*/
|
||||
|
||||
#![cfg_attr(not(bootstrap), allow(internal_features))]
|
||||
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
|
||||
#![cfg_attr(not(bootstrap), doc(rust_logo))]
|
||||
#![allow(internal_features)]
|
||||
#![feature(rustdoc_internals)]
|
||||
#![doc(rust_logo)]
|
||||
#![deny(rustc::untranslatable_diagnostic)]
|
||||
#![feature(assert_matches)]
|
||||
#![feature(box_patterns)]
|
||||
|
@ -10,12 +10,11 @@
|
||||
#![allow(internal_features)]
|
||||
#![allow(rustc::default_hash_types)]
|
||||
#![allow(rustc::potential_query_instability)]
|
||||
#![cfg_attr(not(bootstrap), doc(rust_logo))]
|
||||
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
|
||||
#![deny(rustc::diagnostic_outside_of_impl)]
|
||||
#![deny(rustc::untranslatable_diagnostic)]
|
||||
#![deny(unsafe_op_in_unsafe_fn)]
|
||||
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
|
||||
#![doc(rust_logo)]
|
||||
#![feature(allocator_api)]
|
||||
#![feature(array_windows)]
|
||||
#![feature(auto_traits)]
|
||||
@ -34,6 +33,7 @@
|
||||
#![feature(never_type)]
|
||||
#![feature(ptr_alignment_type)]
|
||||
#![feature(rustc_attrs)]
|
||||
#![feature(rustdoc_internals)]
|
||||
#![feature(strict_provenance)]
|
||||
#![feature(test)]
|
||||
#![feature(thread_id_value)]
|
||||
|
@ -1,8 +1,8 @@
|
||||
// This crate is intentionally empty and a re-export of `rustc_driver_impl` to allow the code in
|
||||
// `rustc_driver_impl` to be compiled in parallel with other crates.
|
||||
|
||||
#![cfg_attr(not(bootstrap), allow(internal_features))]
|
||||
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
|
||||
#![cfg_attr(not(bootstrap), doc(rust_logo))]
|
||||
#![allow(internal_features)]
|
||||
#![feature(rustdoc_internals)]
|
||||
#![doc(rust_logo)]
|
||||
|
||||
pub use rustc_driver_impl::*;
|
||||
|
@ -5,9 +5,9 @@
|
||||
//! This API is completely unstable and subject to change.
|
||||
|
||||
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
|
||||
#![cfg_attr(not(bootstrap), doc(rust_logo))]
|
||||
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
|
||||
#![cfg_attr(not(bootstrap), allow(internal_features))]
|
||||
#![doc(rust_logo)]
|
||||
#![feature(rustdoc_internals)]
|
||||
#![allow(internal_features)]
|
||||
#![feature(decl_macro)]
|
||||
#![feature(lazy_cell)]
|
||||
#![feature(let_chains)]
|
||||
|
@ -1,6 +1,6 @@
|
||||
#![cfg_attr(not(bootstrap), allow(internal_features))]
|
||||
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
|
||||
#![cfg_attr(not(bootstrap), doc(rust_logo))]
|
||||
#![allow(internal_features)]
|
||||
#![feature(rustdoc_internals)]
|
||||
#![doc(rust_logo)]
|
||||
#![deny(rustdoc::invalid_codeblock_attributes)]
|
||||
#![deny(rustc::untranslatable_diagnostic)]
|
||||
#![deny(rustc::diagnostic_outside_of_impl)]
|
||||
|
@ -1,5 +1,5 @@
|
||||
#![cfg_attr(not(bootstrap), doc(rust_logo))]
|
||||
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
|
||||
#![doc(rust_logo)]
|
||||
#![feature(rustdoc_internals)]
|
||||
#![feature(let_chains)]
|
||||
#![feature(lazy_cell)]
|
||||
#![feature(rustc_attrs)]
|
||||
|
@ -3,8 +3,8 @@
|
||||
//! This module contains the code for creating and emitting diagnostics.
|
||||
|
||||
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
|
||||
#![cfg_attr(not(bootstrap), doc(rust_logo))]
|
||||
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
|
||||
#![doc(rust_logo)]
|
||||
#![feature(rustdoc_internals)]
|
||||
#![feature(array_windows)]
|
||||
#![feature(extract_if)]
|
||||
#![feature(if_let_guard)]
|
||||
|
@ -74,7 +74,9 @@ pub fn features(sess: &Session, krate_attrs: &[Attribute], crate_name: Symbol) -
|
||||
// - E.g. enable `test_2018_feature` if `features_edition` is 2018 or higher
|
||||
let mut edition_enabled_features = FxHashSet::default();
|
||||
for f in UNSTABLE_FEATURES {
|
||||
if let Some(edition) = f.feature.edition && edition <= features_edition {
|
||||
if let Some(edition) = f.feature.edition
|
||||
&& edition <= features_edition
|
||||
{
|
||||
// FIXME(Manishearth) there is currently no way to set lib features by
|
||||
// edition.
|
||||
edition_enabled_features.insert(f.feature.name);
|
||||
@ -251,8 +253,7 @@ impl<'a> StripUnconfigured<'a> {
|
||||
let trees: Vec<_> = stream
|
||||
.0
|
||||
.iter()
|
||||
.flat_map(|tree| {
|
||||
match tree.clone() {
|
||||
.flat_map(|tree| match tree.clone() {
|
||||
AttrTokenTree::Attributes(mut data) => {
|
||||
data.attrs.flat_map_in_place(|attr| self.process_cfg_attr(&attr));
|
||||
|
||||
@ -277,7 +278,6 @@ impl<'a> StripUnconfigured<'a> {
|
||||
AttrTokenTree::Token(token, spacing) => {
|
||||
Some(AttrTokenTree::Token(token, spacing)).into_iter()
|
||||
}
|
||||
}
|
||||
})
|
||||
.collect();
|
||||
AttrTokenStream::new(trees)
|
||||
|
@ -1,5 +1,5 @@
|
||||
#![cfg_attr(not(bootstrap), doc(rust_logo))]
|
||||
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
|
||||
#![doc(rust_logo)]
|
||||
#![feature(rustdoc_internals)]
|
||||
#![feature(array_windows)]
|
||||
#![feature(associated_type_bounds)]
|
||||
#![feature(associated_type_defaults)]
|
||||
|
@ -65,7 +65,7 @@ declare_features! (
|
||||
/// Allows free and inherent `async fn`s, `async` blocks, and `<expr>.await` expressions.
|
||||
(accepted, async_await, "1.39.0", Some(50547), None),
|
||||
/// Allows async functions to be declared, implemented, and used in traits.
|
||||
(accepted, async_fn_in_trait, "CURRENT_RUSTC_VERSION", Some(91611), None),
|
||||
(accepted, async_fn_in_trait, "1.75.0", Some(91611), None),
|
||||
/// Allows all literals in attribute lists and values of key-value pairs.
|
||||
(accepted, attr_literals, "1.30.0", Some(34981), None),
|
||||
/// Allows overloading augmented assignment operations like `a += b`.
|
||||
@ -306,7 +306,7 @@ declare_features! (
|
||||
/// Allows `#[repr(transparent)]` attribute on newtype structs.
|
||||
(accepted, repr_transparent, "1.28.0", Some(43036), None),
|
||||
/// Allows return-position `impl Trait` in traits.
|
||||
(accepted, return_position_impl_trait_in_trait, "CURRENT_RUSTC_VERSION", Some(91611), None),
|
||||
(accepted, return_position_impl_trait_in_trait, "1.75.0", Some(91611), None),
|
||||
/// Allows code like `let x: &'static u32 = &42` to work (RFC 1414).
|
||||
(accepted, rvalue_static_promotion, "1.21.0", Some(38865), None),
|
||||
/// Allows `Self` in type definitions (RFC 2300).
|
||||
|
@ -11,9 +11,9 @@
|
||||
//! even if it is stabilized or removed, *do not remove it*. Instead, move the
|
||||
//! symbol to the `accepted` or `removed` modules respectively.
|
||||
|
||||
#![cfg_attr(not(bootstrap), allow(internal_features))]
|
||||
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
|
||||
#![cfg_attr(not(bootstrap), doc(rust_logo))]
|
||||
#![allow(internal_features)]
|
||||
#![feature(rustdoc_internals)]
|
||||
#![doc(rust_logo)]
|
||||
#![feature(lazy_cell)]
|
||||
#![deny(rustc::untranslatable_diagnostic)]
|
||||
#![deny(rustc::diagnostic_outside_of_impl)]
|
||||
|
@ -153,7 +153,7 @@ declare_features! (
|
||||
(removed, panic_implementation, "1.28.0", Some(44489), None,
|
||||
Some("subsumed by `#[panic_handler]`")),
|
||||
/// Allows using `#![plugin(myplugin)]`.
|
||||
(removed, plugin, "CURRENT_RUSTC_VERSION", Some(29597), None,
|
||||
(removed, plugin, "1.75.0", Some(29597), None,
|
||||
Some("plugins are no longer supported")),
|
||||
/// Allows using `#[plugin_registrar]` on functions.
|
||||
(removed, plugin_registrar, "1.54.0", Some(29597), None,
|
||||
|
@ -457,7 +457,7 @@ declare_features! (
|
||||
/// Allows using `#[repr(align(...))]` on function items
|
||||
(unstable, fn_align, "1.53.0", Some(82232), None),
|
||||
/// Allows defining gen blocks and `gen fn`.
|
||||
(unstable, gen_blocks, "CURRENT_RUSTC_VERSION", Some(117078), None),
|
||||
(unstable, gen_blocks, "1.75.0", Some(117078), None),
|
||||
/// Infer generic args for both consts and types.
|
||||
(unstable, generic_arg_infer, "1.55.0", Some(85077), None),
|
||||
/// An extension to the `generic_associated_types` feature, allowing incomplete features.
|
||||
@ -527,7 +527,7 @@ declare_features! (
|
||||
/// casts in safe Rust to `dyn Trait` for such a `Trait` is also forbidden.
|
||||
(unstable, object_safe_for_dispatch, "1.40.0", Some(43561), None),
|
||||
/// Allows using enums in offset_of!
|
||||
(unstable, offset_of_enum, "CURRENT_RUSTC_VERSION", Some(106655), None),
|
||||
(unstable, offset_of_enum, "1.75.0", Some(106655), None),
|
||||
/// Allows using `#[optimize(X)]`.
|
||||
(unstable, optimize_attribute, "1.34.0", Some(54882), None),
|
||||
/// Allows exhaustive integer pattern matching on `usize` and `isize`.
|
||||
|
@ -1,7 +1,7 @@
|
||||
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
|
||||
#![cfg_attr(not(bootstrap), doc(rust_logo))]
|
||||
#![cfg_attr(not(bootstrap), allow(internal_features))]
|
||||
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
|
||||
#![doc(rust_logo)]
|
||||
#![allow(internal_features)]
|
||||
#![feature(rustdoc_internals)]
|
||||
#![feature(proc_macro_diagnostic)]
|
||||
#![feature(proc_macro_span)]
|
||||
#![deny(rustc::untranslatable_diagnostic)]
|
||||
|
@ -273,9 +273,9 @@
|
||||
html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/",
|
||||
test(attr(allow(unused_variables), deny(warnings)))
|
||||
)]
|
||||
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
|
||||
#![cfg_attr(not(bootstrap), doc(rust_logo))]
|
||||
#![cfg_attr(not(bootstrap), allow(internal_features))]
|
||||
#![feature(rustdoc_internals)]
|
||||
#![doc(rust_logo)]
|
||||
#![allow(internal_features)]
|
||||
#![deny(rustc::untranslatable_diagnostic)]
|
||||
#![deny(rustc::diagnostic_outside_of_impl)]
|
||||
|
||||
|
@ -194,8 +194,7 @@ impl<'tcx> dyn AstConv<'tcx> + '_ {
|
||||
|
||||
self.add_bounds(
|
||||
param_ty,
|
||||
ast_bounds.iter().filter(|bound| {
|
||||
match filter {
|
||||
ast_bounds.iter().filter(|bound| match filter {
|
||||
PredicateFilter::All
|
||||
| PredicateFilter::SelfOnly
|
||||
| PredicateFilter::SelfAndAssociatedTypeBounds => true,
|
||||
@ -209,7 +208,6 @@ impl<'tcx> dyn AstConv<'tcx> + '_ {
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
}),
|
||||
&mut bounds,
|
||||
ty::List::empty(),
|
||||
|
@ -206,15 +206,14 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
&& let parent = hir.get_parent_item(hir.local_def_id_to_hir_id(def_id))
|
||||
&& let Some(generics) = hir.get_generics(parent.def_id)
|
||||
{
|
||||
if generics.bounds_for_param(def_id)
|
||||
.flat_map(|pred| pred.bounds.iter())
|
||||
.any(|b| match b {
|
||||
if generics.bounds_for_param(def_id).flat_map(|pred| pred.bounds.iter()).any(
|
||||
|b| match b {
|
||||
hir::GenericBound::Trait(t, ..) => {
|
||||
t.trait_ref.trait_def_id().as_ref() == Some(best_trait)
|
||||
}
|
||||
_ => false,
|
||||
})
|
||||
{
|
||||
},
|
||||
) {
|
||||
// The type param already has a bound for `trait_name`, we just need to
|
||||
// change the associated type.
|
||||
err.span_suggestion_verbose(
|
||||
@ -227,15 +226,14 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
Applicability::MaybeIncorrect,
|
||||
);
|
||||
} else if suggest_constraining_type_param(
|
||||
self.tcx(),
|
||||
generics,
|
||||
&mut err,
|
||||
&ty_param_name,
|
||||
&trait_name,
|
||||
None,
|
||||
None,
|
||||
)
|
||||
&& suggested_name != assoc_name.name
|
||||
self.tcx(),
|
||||
generics,
|
||||
&mut err,
|
||||
&ty_param_name,
|
||||
&trait_name,
|
||||
None,
|
||||
None,
|
||||
) && suggested_name != assoc_name.name
|
||||
{
|
||||
// We suggested constraining a type parameter, but the associated type on it
|
||||
// was also not an exact match, so we also suggest changing it.
|
||||
|
@ -57,9 +57,9 @@ This API is completely unstable and subject to change.
|
||||
|
||||
#![allow(rustc::potential_query_instability)]
|
||||
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
|
||||
#![cfg_attr(not(bootstrap), doc(rust_logo))]
|
||||
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
|
||||
#![cfg_attr(not(bootstrap), allow(internal_features))]
|
||||
#![doc(rust_logo)]
|
||||
#![feature(rustdoc_internals)]
|
||||
#![allow(internal_features)]
|
||||
#![feature(box_patterns)]
|
||||
#![feature(control_flow_enum)]
|
||||
#![feature(if_let_guard)]
|
||||
|
@ -3185,19 +3185,22 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
sym::offset_of_enum,
|
||||
ident.span,
|
||||
"using enums in offset_of is experimental",
|
||||
).emit();
|
||||
)
|
||||
.emit();
|
||||
}
|
||||
|
||||
let Some((index, variant)) = container_def.variants()
|
||||
let Some((index, variant)) = container_def
|
||||
.variants()
|
||||
.iter_enumerated()
|
||||
.find(|(_, v)| v.ident(self.tcx).normalize_to_macros_2_0() == ident) else {
|
||||
.find(|(_, v)| v.ident(self.tcx).normalize_to_macros_2_0() == ident)
|
||||
else {
|
||||
let mut err = type_error_struct!(
|
||||
self.tcx().sess,
|
||||
ident.span,
|
||||
container,
|
||||
E0599,
|
||||
"no variant named `{ident}` found for enum `{container}`",
|
||||
);
|
||||
);
|
||||
err.span_label(field.span, "variant not found");
|
||||
err.emit();
|
||||
break;
|
||||
@ -3209,7 +3212,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
container,
|
||||
E0795,
|
||||
"`{ident}` is an enum variant; expected field at end of `offset_of`",
|
||||
);
|
||||
);
|
||||
err.span_label(field.span, "enum variant");
|
||||
err.emit();
|
||||
break;
|
||||
@ -3217,16 +3220,18 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
let (subident, sub_def_scope) =
|
||||
self.tcx.adjust_ident_and_get_scope(subfield, variant.def_id, block);
|
||||
|
||||
let Some((subindex, field)) = variant.fields
|
||||
let Some((subindex, field)) = variant
|
||||
.fields
|
||||
.iter_enumerated()
|
||||
.find(|(_, f)| f.ident(self.tcx).normalize_to_macros_2_0() == subident) else {
|
||||
.find(|(_, f)| f.ident(self.tcx).normalize_to_macros_2_0() == subident)
|
||||
else {
|
||||
let mut err = type_error_struct!(
|
||||
self.tcx().sess,
|
||||
ident.span,
|
||||
container,
|
||||
E0609,
|
||||
"no field named `{subfield}` on enum variant `{container}::{ident}`",
|
||||
);
|
||||
);
|
||||
err.span_label(field.span, "this enum variant...");
|
||||
err.span_label(subident.span, "...does not have this field");
|
||||
err.emit();
|
||||
|
@ -1864,35 +1864,42 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
&& let ExprBindingObligation(_, _, hir_id, ..) = code
|
||||
&& !fn_sig.output().is_unit()
|
||||
{
|
||||
let mut block_num = 0;
|
||||
let mut found_semi = false;
|
||||
for (_, node) in self.tcx.hir().parent_iter(hir_id) {
|
||||
match node {
|
||||
hir::Node::Stmt(stmt) => if let hir::StmtKind::Semi(ref expr) = stmt.kind {
|
||||
let mut block_num = 0;
|
||||
let mut found_semi = false;
|
||||
for (_, node) in self.tcx.hir().parent_iter(hir_id) {
|
||||
match node {
|
||||
hir::Node::Stmt(stmt) => {
|
||||
if let hir::StmtKind::Semi(ref expr) = stmt.kind {
|
||||
let expr_ty = self.typeck_results.borrow().expr_ty(expr);
|
||||
let return_ty = fn_sig.output();
|
||||
if !matches!(expr.kind, hir::ExprKind::Ret(..)) &&
|
||||
self.can_coerce(expr_ty, return_ty) {
|
||||
if !matches!(expr.kind, hir::ExprKind::Ret(..))
|
||||
&& self.can_coerce(expr_ty, return_ty)
|
||||
{
|
||||
found_semi = true;
|
||||
}
|
||||
},
|
||||
hir::Node::Block(_block) => if found_semi {
|
||||
}
|
||||
}
|
||||
hir::Node::Block(_block) => {
|
||||
if found_semi {
|
||||
block_num += 1;
|
||||
}
|
||||
hir::Node::Item(item) => if let hir::ItemKind::Fn(..) = item.kind {
|
||||
}
|
||||
hir::Node::Item(item) => {
|
||||
if let hir::ItemKind::Fn(..) = item.kind {
|
||||
break;
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
if block_num > 1 && found_semi {
|
||||
diag.span_suggestion_verbose(
|
||||
span.shrink_to_lo(),
|
||||
"you might have meant to return this to infer its type parameters",
|
||||
"return ",
|
||||
Applicability::MaybeIncorrect,
|
||||
);
|
||||
}
|
||||
}
|
||||
if block_num > 1 && found_semi {
|
||||
diag.span_suggestion_verbose(
|
||||
span.shrink_to_lo(),
|
||||
"you might have meant to return this to infer its type parameters",
|
||||
"return ",
|
||||
Applicability::MaybeIncorrect,
|
||||
);
|
||||
}
|
||||
}
|
||||
diag.emit();
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
//! Give useful errors and suggestions to users when an item can't be
|
||||
//! found or is otherwise invalid.
|
||||
|
||||
// ignore-tidy-filelength
|
||||
|
||||
use crate::errors;
|
||||
use crate::errors::{CandidateTraitNote, NoAssociatedItem};
|
||||
use crate::Expectation;
|
||||
@ -369,25 +371,23 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
tcx.is_diagnostic_item(sym::write_macro, def_id)
|
||||
|| tcx.is_diagnostic_item(sym::writeln_macro, def_id)
|
||||
}) && item_name.name == Symbol::intern("write_fmt");
|
||||
let mut err =
|
||||
if is_write && let SelfSource::MethodCall(rcvr_expr) = source
|
||||
{
|
||||
self.suggest_missing_writer(rcvr_ty, rcvr_expr)
|
||||
} else {
|
||||
tcx.sess.create_err(NoAssociatedItem {
|
||||
span,
|
||||
item_kind,
|
||||
item_name,
|
||||
ty_prefix: if trait_missing_method {
|
||||
// FIXME(mu001999) E0599 maybe not suitable here because it is for types
|
||||
Cow::from("trait")
|
||||
} else {
|
||||
rcvr_ty.prefix_string(self.tcx)
|
||||
},
|
||||
ty_str: ty_str_reported,
|
||||
trait_missing_method,
|
||||
})
|
||||
};
|
||||
let mut err = if is_write && let SelfSource::MethodCall(rcvr_expr) = source {
|
||||
self.suggest_missing_writer(rcvr_ty, rcvr_expr)
|
||||
} else {
|
||||
tcx.sess.create_err(NoAssociatedItem {
|
||||
span,
|
||||
item_kind,
|
||||
item_name,
|
||||
ty_prefix: if trait_missing_method {
|
||||
// FIXME(mu001999) E0599 maybe not suitable here because it is for types
|
||||
Cow::from("trait")
|
||||
} else {
|
||||
rcvr_ty.prefix_string(self.tcx)
|
||||
},
|
||||
ty_str: ty_str_reported,
|
||||
trait_missing_method,
|
||||
})
|
||||
};
|
||||
if tcx.sess.source_map().is_multiline(sugg_span) {
|
||||
err.span_label(sugg_span.with_hi(span.lo()), "");
|
||||
}
|
||||
@ -1240,20 +1240,27 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
}
|
||||
}
|
||||
// If an appropriate error source is not found, check method chain for possible candiates
|
||||
if unsatisfied_predicates.is_empty() && let Mode::MethodCall = mode && let SelfSource::MethodCall(mut source_expr) = source {
|
||||
if unsatisfied_predicates.is_empty()
|
||||
&& let Mode::MethodCall = mode
|
||||
&& let SelfSource::MethodCall(mut source_expr) = source
|
||||
{
|
||||
let mut stack_methods = vec![];
|
||||
while let hir::ExprKind::MethodCall(_path_segment, rcvr_expr, _args, method_span) =
|
||||
source_expr.kind
|
||||
source_expr.kind
|
||||
{
|
||||
// Pop the matching receiver, to align on it's notional span
|
||||
if let Some(prev_match) = stack_methods.pop() {
|
||||
err.span_label(method_span, format!("{item_kind} `{item_name}` is available on `{prev_match}`"));
|
||||
// Pop the matching receiver, to align on it's notional span
|
||||
if let Some(prev_match) = stack_methods.pop() {
|
||||
err.span_label(
|
||||
method_span,
|
||||
format!("{item_kind} `{item_name}` is available on `{prev_match}`"),
|
||||
);
|
||||
}
|
||||
let rcvr_ty = self.resolve_vars_if_possible(
|
||||
self.typeck_results
|
||||
.borrow()
|
||||
.expr_ty_adjusted_opt(rcvr_expr)
|
||||
.unwrap_or(Ty::new_misc_error(self.tcx)),);
|
||||
.unwrap_or(Ty::new_misc_error(self.tcx)),
|
||||
);
|
||||
|
||||
for _matched_method in self.probe_for_name_many(
|
||||
Mode::MethodCall,
|
||||
@ -1262,15 +1269,19 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
IsSuggestion(true),
|
||||
rcvr_ty,
|
||||
source_expr.hir_id,
|
||||
ProbeScope::TraitsInScope,) {
|
||||
// found a match, push to stack
|
||||
stack_methods.push(rcvr_ty);
|
||||
ProbeScope::TraitsInScope,
|
||||
) {
|
||||
// found a match, push to stack
|
||||
stack_methods.push(rcvr_ty);
|
||||
}
|
||||
source_expr = rcvr_expr;
|
||||
}
|
||||
// If there is a match at the start of the chain, add a label for it too!
|
||||
if let Some(prev_match) = stack_methods.pop() {
|
||||
err.span_label(source_expr.span, format!("{item_kind} `{item_name}` is available on `{prev_match}`"));
|
||||
err.span_label(
|
||||
source_expr.span,
|
||||
format!("{item_kind} `{item_name}` is available on `{prev_match}`"),
|
||||
);
|
||||
}
|
||||
}
|
||||
self.note_derefed_ty_has_method(&mut err, source, rcvr_ty, item_name, expected);
|
||||
@ -1357,10 +1368,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
err,
|
||||
self_source,
|
||||
args,
|
||||
trait_ref.instantiate(
|
||||
self.tcx,
|
||||
self.fresh_args_for_item(sugg_span, impl_did)
|
||||
).with_self_ty(self.tcx, rcvr_ty),
|
||||
trait_ref
|
||||
.instantiate(
|
||||
self.tcx,
|
||||
self.fresh_args_for_item(sugg_span, impl_did),
|
||||
)
|
||||
.with_self_ty(self.tcx, rcvr_ty),
|
||||
idx,
|
||||
sugg_span,
|
||||
item,
|
||||
@ -1397,8 +1410,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
ty::TraitRef::new(
|
||||
self.tcx,
|
||||
trait_did,
|
||||
self.fresh_args_for_item(sugg_span, trait_did)
|
||||
).with_self_ty(self.tcx, rcvr_ty),
|
||||
self.fresh_args_for_item(sugg_span, trait_did),
|
||||
)
|
||||
.with_self_ty(self.tcx, rcvr_ty),
|
||||
idx,
|
||||
sugg_span,
|
||||
item,
|
||||
@ -1409,7 +1423,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
}
|
||||
}
|
||||
}
|
||||
if !suggs.is_empty() && let Some(span) = sugg_span {
|
||||
if !suggs.is_empty()
|
||||
&& let Some(span) = sugg_span
|
||||
{
|
||||
err.span_suggestions(
|
||||
span.with_hi(item_name.span.lo()),
|
||||
"use fully-qualified syntax to disambiguate",
|
||||
@ -1585,39 +1601,39 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
};
|
||||
let mut applicability = Applicability::MachineApplicable;
|
||||
let args = if let SelfSource::MethodCall(receiver) = source
|
||||
&& let Some(args) = args
|
||||
{
|
||||
// The first arg is the same kind as the receiver
|
||||
let explicit_args = if first_arg.is_some() {
|
||||
std::iter::once(receiver).chain(args.iter()).collect::<Vec<_>>()
|
||||
} else {
|
||||
// There is no `Self` kind to infer the arguments from
|
||||
if has_unsuggestable_args {
|
||||
applicability = Applicability::HasPlaceholders;
|
||||
}
|
||||
args.iter().collect()
|
||||
};
|
||||
format!(
|
||||
"({}{})",
|
||||
first_arg.unwrap_or(""),
|
||||
explicit_args
|
||||
.iter()
|
||||
.map(|arg| self
|
||||
.tcx
|
||||
.sess
|
||||
.source_map()
|
||||
.span_to_snippet(arg.span)
|
||||
.unwrap_or_else(|_| {
|
||||
applicability = Applicability::HasPlaceholders;
|
||||
"_".to_owned()
|
||||
}))
|
||||
.collect::<Vec<_>>()
|
||||
.join(", "),
|
||||
)
|
||||
&& let Some(args) = args
|
||||
{
|
||||
// The first arg is the same kind as the receiver
|
||||
let explicit_args = if first_arg.is_some() {
|
||||
std::iter::once(receiver).chain(args.iter()).collect::<Vec<_>>()
|
||||
} else {
|
||||
applicability = Applicability::HasPlaceholders;
|
||||
"(...)".to_owned()
|
||||
// There is no `Self` kind to infer the arguments from
|
||||
if has_unsuggestable_args {
|
||||
applicability = Applicability::HasPlaceholders;
|
||||
}
|
||||
args.iter().collect()
|
||||
};
|
||||
format!(
|
||||
"({}{})",
|
||||
first_arg.unwrap_or(""),
|
||||
explicit_args
|
||||
.iter()
|
||||
.map(|arg| self
|
||||
.tcx
|
||||
.sess
|
||||
.source_map()
|
||||
.span_to_snippet(arg.span)
|
||||
.unwrap_or_else(|_| {
|
||||
applicability = Applicability::HasPlaceholders;
|
||||
"_".to_owned()
|
||||
}))
|
||||
.collect::<Vec<_>>()
|
||||
.join(", "),
|
||||
)
|
||||
} else {
|
||||
applicability = Applicability::HasPlaceholders;
|
||||
"(...)".to_owned()
|
||||
};
|
||||
err.span_suggestion(
|
||||
sugg_span,
|
||||
"use associated function syntax instead",
|
||||
@ -3296,7 +3312,8 @@ fn print_disambiguation_help<'tcx>(
|
||||
{
|
||||
let def_kind_descr = tcx.def_kind_descr(item.kind.as_def_kind(), item.def_id);
|
||||
let item_name = item.ident(tcx);
|
||||
let rcvr_ref = tcx.fn_sig(item.def_id)
|
||||
let rcvr_ref = tcx
|
||||
.fn_sig(item.def_id)
|
||||
.skip_binder()
|
||||
.skip_binder()
|
||||
.inputs()
|
||||
|
@ -2,9 +2,9 @@
|
||||
|
||||
#![deny(missing_docs)]
|
||||
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
|
||||
#![cfg_attr(not(bootstrap), doc(rust_logo))]
|
||||
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
|
||||
#![cfg_attr(not(bootstrap), allow(internal_features))]
|
||||
#![doc(rust_logo)]
|
||||
#![feature(rustdoc_internals)]
|
||||
#![allow(internal_features)]
|
||||
#![recursion_limit = "256"]
|
||||
#![deny(rustc::untranslatable_diagnostic)]
|
||||
#![deny(rustc::diagnostic_outside_of_impl)]
|
||||
|
@ -87,7 +87,8 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
||||
| (ty::Alias(ty::Projection, proj), ty::Param(p))
|
||||
if !tcx.is_impl_trait_in_trait(proj.def_id) =>
|
||||
{
|
||||
let parent = tcx.generics_of(body_owner_def_id)
|
||||
let parent = tcx
|
||||
.generics_of(body_owner_def_id)
|
||||
.opt_type_param(p, tcx)
|
||||
.and_then(|param| {
|
||||
let p_def_id = param.def_id;
|
||||
|
@ -112,7 +112,9 @@ where
|
||||
};
|
||||
|
||||
for (idx, s) in args.iter().enumerate() {
|
||||
if variances.map(|variances| variances[idx]) != Some(ty::Variance::Bivariant) {
|
||||
if variances.map(|variances| variances[idx])
|
||||
!= Some(ty::Variance::Bivariant)
|
||||
{
|
||||
s.visit_with(self)?;
|
||||
}
|
||||
}
|
||||
|
@ -13,9 +13,9 @@
|
||||
//! This API is completely unstable and subject to change.
|
||||
|
||||
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
|
||||
#![cfg_attr(not(bootstrap), doc(rust_logo))]
|
||||
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
|
||||
#![cfg_attr(not(bootstrap), allow(internal_features))]
|
||||
#![doc(rust_logo)]
|
||||
#![feature(rustdoc_internals)]
|
||||
#![allow(internal_features)]
|
||||
#![feature(associated_type_bounds)]
|
||||
#![feature(box_patterns)]
|
||||
#![feature(control_flow_enum)]
|
||||
|
@ -178,7 +178,9 @@ pub(crate) fn parse_check_cfg(handler: &EarlyErrorHandler, specs: Vec<String>) -
|
||||
|
||||
check_cfg.exhaustive_names = true;
|
||||
for arg in args {
|
||||
if arg.is_word() && let Some(ident) = arg.ident() {
|
||||
if arg.is_word()
|
||||
&& let Some(ident) = arg.ident()
|
||||
{
|
||||
check_cfg.expecteds.entry(ident.name).or_insert(ExpectedValues::Any);
|
||||
} else {
|
||||
error!("`names()` arguments must be simple identifiers");
|
||||
@ -188,7 +190,9 @@ pub(crate) fn parse_check_cfg(handler: &EarlyErrorHandler, specs: Vec<String>) -
|
||||
set_old_syntax();
|
||||
|
||||
if let Some((name, values)) = args.split_first() {
|
||||
if name.is_word() && let Some(ident) = name.ident() {
|
||||
if name.is_word()
|
||||
&& let Some(ident) = name.ident()
|
||||
{
|
||||
let expected_values = check_cfg
|
||||
.expecteds
|
||||
.entry(ident.name)
|
||||
@ -236,12 +240,16 @@ pub(crate) fn parse_check_cfg(handler: &EarlyErrorHandler, specs: Vec<String>) -
|
||||
let mut values_any_specified = false;
|
||||
|
||||
for arg in args {
|
||||
if arg.is_word() && let Some(ident) = arg.ident() {
|
||||
if arg.is_word()
|
||||
&& let Some(ident) = arg.ident()
|
||||
{
|
||||
if values_specified {
|
||||
error!("`cfg()` names cannot be after values");
|
||||
}
|
||||
names.push(ident);
|
||||
} else if arg.has_name(sym::any) && let Some(args) = arg.meta_item_list() {
|
||||
} else if arg.has_name(sym::any)
|
||||
&& let Some(args) = arg.meta_item_list()
|
||||
{
|
||||
if any_specified {
|
||||
error!("`any()` cannot be specified multiple times");
|
||||
}
|
||||
@ -249,7 +257,9 @@ pub(crate) fn parse_check_cfg(handler: &EarlyErrorHandler, specs: Vec<String>) -
|
||||
if !args.is_empty() {
|
||||
error!("`any()` must be empty");
|
||||
}
|
||||
} else if arg.has_name(sym::values) && let Some(args) = arg.meta_item_list() {
|
||||
} else if arg.has_name(sym::values)
|
||||
&& let Some(args) = arg.meta_item_list()
|
||||
{
|
||||
if names.is_empty() {
|
||||
error!("`values()` cannot be specified before the names");
|
||||
} else if values_specified {
|
||||
@ -260,7 +270,9 @@ pub(crate) fn parse_check_cfg(handler: &EarlyErrorHandler, specs: Vec<String>) -
|
||||
for arg in args {
|
||||
if let Some(LitKind::Str(s, _)) = arg.lit().map(|lit| &lit.kind) {
|
||||
values.insert(Some(*s));
|
||||
} else if arg.has_name(sym::any) && let Some(args) = arg.meta_item_list() {
|
||||
} else if arg.has_name(sym::any)
|
||||
&& let Some(args) = arg.meta_item_list()
|
||||
{
|
||||
if values_any_specified {
|
||||
error!("`any()` in `values()` cannot be specified multiple times");
|
||||
}
|
||||
|
@ -415,7 +415,9 @@ pub fn collect_crate_types(session: &Session, attrs: &[ast::Attribute]) -> Vec<C
|
||||
let mut base = session.opts.crate_types.clone();
|
||||
if base.is_empty() {
|
||||
let attr_types = attrs.iter().filter_map(|a| {
|
||||
if a.has_name(sym::crate_type) && let Some(s) = a.value_str() {
|
||||
if a.has_name(sym::crate_type)
|
||||
&& let Some(s) = a.value_str()
|
||||
{
|
||||
categorize_crate_type(s)
|
||||
} else {
|
||||
None
|
||||
|
@ -27,8 +27,8 @@
|
||||
|
||||
#![allow(rustc::potential_query_instability)]
|
||||
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
|
||||
#![cfg_attr(not(bootstrap), doc(rust_logo))]
|
||||
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
|
||||
#![doc(rust_logo)]
|
||||
#![feature(rustdoc_internals)]
|
||||
#![feature(array_windows)]
|
||||
#![feature(box_patterns)]
|
||||
#![feature(control_flow_enum)]
|
||||
|
@ -1,9 +1,9 @@
|
||||
#![deny(rustc::untranslatable_diagnostic)]
|
||||
#![deny(rustc::diagnostic_outside_of_impl)]
|
||||
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
|
||||
#![cfg_attr(not(bootstrap), doc(rust_logo))]
|
||||
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
|
||||
#![cfg_attr(not(bootstrap), allow(internal_features))]
|
||||
#![doc(rust_logo)]
|
||||
#![feature(rustdoc_internals)]
|
||||
#![allow(internal_features)]
|
||||
|
||||
// NOTE: This crate only exists to allow linking on mingw targets.
|
||||
|
||||
|
@ -85,7 +85,9 @@ impl Parse for Value {
|
||||
}
|
||||
}
|
||||
Expr::Macro(expr) => {
|
||||
if expr.mac.path.is_ident("env") && let Ok(lit) = expr.mac.parse_body() {
|
||||
if expr.mac.path.is_ident("env")
|
||||
&& let Ok(lit) = expr.mac.parse_body()
|
||||
{
|
||||
return Ok(Value::Env(lit, expr.mac.clone()));
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,10 @@
|
||||
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
|
||||
#![cfg_attr(not(bootstrap), doc(rust_logo))]
|
||||
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
|
||||
#![cfg_attr(not(bootstrap), allow(internal_features))]
|
||||
#![doc(rust_logo)]
|
||||
#![feature(rustdoc_internals)]
|
||||
#![allow(internal_features)]
|
||||
#![feature(decl_macro)]
|
||||
#![feature(extract_if)]
|
||||
#![cfg_attr(bootstrap, feature(generators))]
|
||||
#![cfg_attr(not(bootstrap), feature(coroutines))]
|
||||
#![feature(coroutines)]
|
||||
#![feature(iter_from_coroutine)]
|
||||
#![feature(let_chains)]
|
||||
#![feature(if_let_guard)]
|
||||
|
@ -2396,8 +2396,10 @@ pub fn rendered_const<'tcx>(tcx: TyCtxt<'tcx>, body: hir::BodyId) -> String {
|
||||
// * character escapes
|
||||
//
|
||||
// FIXME: This passes through `-/*spacer*/0` verbatim.
|
||||
Literal if !value.span.from_expansion()
|
||||
&& let Ok(snippet) = tcx.sess.source_map().span_to_snippet(value.span) => {
|
||||
Literal
|
||||
if !value.span.from_expansion()
|
||||
&& let Ok(snippet) = tcx.sess.source_map().span_to_snippet(value.span) =>
|
||||
{
|
||||
snippet
|
||||
}
|
||||
|
||||
@ -2408,10 +2410,12 @@ pub fn rendered_const<'tcx>(tcx: TyCtxt<'tcx>, body: hir::BodyId) -> String {
|
||||
// FIXME: Omit the curly braces if the enclosing expression is an array literal
|
||||
// with a repeated element (an `ExprKind::Repeat`) as in such case it
|
||||
// would not actually need any disambiguation.
|
||||
Complex => if tcx.def_kind(hir.body_owner_def_id(body).to_def_id()) == DefKind::AnonConst {
|
||||
"{ _ }".to_owned()
|
||||
} else {
|
||||
"_".to_owned()
|
||||
Complex => {
|
||||
if tcx.def_kind(hir.body_owner_def_id(body).to_def_id()) == DefKind::AnonConst {
|
||||
"{ _ }".to_owned()
|
||||
} else {
|
||||
"_".to_owned()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -23,8 +23,8 @@
|
||||
//! This API is completely unstable and subject to change.
|
||||
|
||||
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
|
||||
#![cfg_attr(not(bootstrap), doc(rust_logo))]
|
||||
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
|
||||
#![doc(rust_logo)]
|
||||
#![feature(rustdoc_internals)]
|
||||
#![feature(allocator_api)]
|
||||
#![feature(array_windows)]
|
||||
#![feature(assert_matches)]
|
||||
@ -32,8 +32,7 @@
|
||||
#![feature(core_intrinsics)]
|
||||
#![feature(discriminant_kind)]
|
||||
#![feature(exhaustive_patterns)]
|
||||
#![cfg_attr(bootstrap, feature(generators))]
|
||||
#![cfg_attr(not(bootstrap), feature(coroutines))]
|
||||
#![feature(coroutines)]
|
||||
#![feature(get_mut_unchecked)]
|
||||
#![feature(if_let_guard)]
|
||||
#![feature(inline_const)]
|
||||
|
@ -507,11 +507,7 @@ fn write_span<W>(
|
||||
where
|
||||
W: Write,
|
||||
{
|
||||
let maybe_alt_class = if layer > 0 {
|
||||
if alt { " odd" } else { " even" }
|
||||
} else {
|
||||
""
|
||||
};
|
||||
let maybe_alt_class = if layer > 0 { if alt { " odd" } else { " even" } } else { "" };
|
||||
let maybe_title_attr = if !tooltip.is_empty() {
|
||||
format!(" title=\"{}\"", escape_attr(tooltip))
|
||||
} else {
|
||||
|
@ -28,7 +28,9 @@ impl SwitchTargets {
|
||||
|
||||
/// Inverse of `SwitchTargets::static_if`.
|
||||
pub fn as_static_if(&self) -> Option<(u128, BasicBlock, BasicBlock)> {
|
||||
if let &[value] = &self.values[..] && let &[then, else_] = &self.targets[..] {
|
||||
if let &[value] = &self.values[..]
|
||||
&& let &[then, else_] = &self.targets[..]
|
||||
{
|
||||
Some((value, then, else_))
|
||||
} else {
|
||||
None
|
||||
|
@ -655,7 +655,9 @@ impl<'tcx> Pat<'tcx> {
|
||||
pub fn pat_error_reported(&self) -> Result<(), ErrorGuaranteed> {
|
||||
let mut error = None;
|
||||
self.walk(|pat| {
|
||||
if let PatKind::Error(e) = pat.kind && error.is_none() {
|
||||
if let PatKind::Error(e) = pat.kind
|
||||
&& error.is_none()
|
||||
{
|
||||
error = Some(e);
|
||||
}
|
||||
error.is_none()
|
||||
|
@ -192,10 +192,10 @@ impl<'tcx> Cx<'tcx> {
|
||||
cast: PointerCoercion::ArrayToPointer,
|
||||
}
|
||||
} else if let hir::ExprKind::Path(ref qpath) = source.kind
|
||||
&& let res = self.typeck_results().qpath_res(qpath, source.hir_id)
|
||||
&& let ty = self.typeck_results().node_type(source.hir_id)
|
||||
&& let ty::Adt(adt_def, args) = ty.kind()
|
||||
&& let Res::Def(DefKind::Ctor(CtorOf::Variant, CtorKind::Const), variant_ctor_id) = res
|
||||
&& let res = self.typeck_results().qpath_res(qpath, source.hir_id)
|
||||
&& let ty = self.typeck_results().node_type(source.hir_id)
|
||||
&& let ty::Adt(adt_def, args) = ty.kind()
|
||||
&& let Res::Def(DefKind::Ctor(CtorOf::Variant, CtorKind::Const), variant_ctor_id) = res
|
||||
{
|
||||
// Check whether this is casting an enum variant discriminant.
|
||||
// To prevent cycles, we refer to the discriminant initializer,
|
||||
|
@ -200,7 +200,9 @@ impl<'tcx> ConstToPat<'tcx> {
|
||||
// We errored. Signal that in the pattern, so that follow up errors can be silenced.
|
||||
let kind = PatKind::Error(e);
|
||||
return Box::new(Pat { span: self.span, ty: cv.ty(), kind });
|
||||
} else if let ty::Adt(..) = cv.ty().kind() && matches!(cv, mir::Const::Val(..)) {
|
||||
} else if let ty::Adt(..) = cv.ty().kind()
|
||||
&& matches!(cv, mir::Const::Val(..))
|
||||
{
|
||||
// This branch is only entered when the current `cv` is `mir::Const::Val`.
|
||||
// This is because `mir::Const::ty` has already been handled by `Self::recur`
|
||||
// and the invalid types may be ignored.
|
||||
|
@ -69,7 +69,9 @@ impl<'tcx> Visitor<'tcx> for CostChecker<'_, 'tcx> {
|
||||
}
|
||||
TerminatorKind::Call { func: Operand::Constant(ref f), unwind, .. } => {
|
||||
let fn_ty = self.instantiate_ty(f.const_.ty());
|
||||
self.cost += if let ty::FnDef(def_id, _) = *fn_ty.kind() && tcx.is_intrinsic(def_id) {
|
||||
self.cost += if let ty::FnDef(def_id, _) = *fn_ty.kind()
|
||||
&& tcx.is_intrinsic(def_id)
|
||||
{
|
||||
// Don't give intrinsics the extra penalty for calls
|
||||
INSTR_COST
|
||||
} else {
|
||||
|
@ -138,7 +138,9 @@ impl CoverageCounters {
|
||||
// If the BCB has an edge counter (to be injected into a new `BasicBlock`), it can also
|
||||
// have an expression (to be injected into an existing `BasicBlock` represented by this
|
||||
// `BasicCoverageBlock`).
|
||||
if let Some(node_counter) = self.bcb_counter(to_bcb) && !node_counter.is_expression() {
|
||||
if let Some(node_counter) = self.bcb_counter(to_bcb)
|
||||
&& !node_counter.is_expression()
|
||||
{
|
||||
bug!(
|
||||
"attempt to add an incoming edge counter from {from_bcb:?} \
|
||||
when the target BCB already has {node_counter:?}"
|
||||
|
@ -475,7 +475,9 @@ impl<'a> CoverageSpansGenerator<'a> {
|
||||
}
|
||||
while let Some(curr) = self.sorted_spans_iter.next() {
|
||||
debug!("FOR curr={:?}", curr);
|
||||
if let Some(prev) = &self.some_prev && prev.span.lo() > curr.span.lo() {
|
||||
if let Some(prev) = &self.some_prev
|
||||
&& prev.span.lo() > curr.span.lo()
|
||||
{
|
||||
// Skip curr because prev has already advanced beyond the end of curr.
|
||||
// This can only happen if a prior iteration updated `prev` to skip past
|
||||
// a region of code, such as skipping past a closure.
|
||||
|
@ -597,7 +597,9 @@ fn propagatable_scalar(
|
||||
state: &State<FlatSet<Scalar>>,
|
||||
map: &Map,
|
||||
) -> Option<Scalar> {
|
||||
if let FlatSet::Elem(value) = state.get_idx(place, map) && value.try_to_int().is_ok() {
|
||||
if let FlatSet::Elem(value) = state.get_idx(place, map)
|
||||
&& value.try_to_int().is_ok()
|
||||
{
|
||||
// Do not attempt to propagate pointers, as we may fail to preserve their identity.
|
||||
Some(value)
|
||||
} else {
|
||||
@ -836,7 +838,8 @@ impl<'tcx> Visitor<'tcx> for OperandCollector<'tcx, '_, '_, '_> {
|
||||
location: Location,
|
||||
) {
|
||||
if let PlaceElem::Index(local) = elem
|
||||
&& let Some(value) = self.visitor.try_make_constant(self.ecx, local.into(), self.state, self.map)
|
||||
&& let Some(value) =
|
||||
self.visitor.try_make_constant(self.ecx, local.into(), self.state, self.map)
|
||||
{
|
||||
self.visitor.patch.before_effect.insert((location, local.into()), value);
|
||||
}
|
||||
|
@ -461,7 +461,9 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
|
||||
}
|
||||
NullaryOp(null_op, ty) => {
|
||||
let layout = self.ecx.layout_of(ty).ok()?;
|
||||
if let NullOp::SizeOf | NullOp::AlignOf = null_op && layout.is_unsized() {
|
||||
if let NullOp::SizeOf | NullOp::AlignOf = null_op
|
||||
&& layout.is_unsized()
|
||||
{
|
||||
return None;
|
||||
}
|
||||
let val = match null_op {
|
||||
@ -865,7 +867,9 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
|
||||
.collect();
|
||||
let fields = fields?;
|
||||
|
||||
if let AggregateTy::Array = ty && fields.len() > 4 {
|
||||
if let AggregateTy::Array = ty
|
||||
&& fields.len() > 4
|
||||
{
|
||||
let first = fields[0];
|
||||
if fields.iter().all(|&v| v == first) {
|
||||
let len = ty::Const::from_target_usize(self.tcx, fields.len().try_into().unwrap());
|
||||
@ -1008,8 +1012,7 @@ impl<'tcx> MutVisitor<'tcx> for VnState<'_, 'tcx> {
|
||||
// Do not try to simplify a constant, it's already in canonical shape.
|
||||
&& !matches!(rvalue, Rvalue::Use(Operand::Constant(_)))
|
||||
{
|
||||
if let Some(value) = self.simplify_rvalue(rvalue, location)
|
||||
{
|
||||
if let Some(value) = self.simplify_rvalue(rvalue, location) {
|
||||
if let Some(const_) = self.try_as_constant(value) {
|
||||
*rvalue = Rvalue::Use(Operand::Constant(Box::new(const_)));
|
||||
} else if let Some(local) = self.try_as_local(value, location)
|
||||
|
@ -247,7 +247,9 @@ impl<'tcx, 'a> TOFinder<'tcx, 'a> {
|
||||
let last_non_rec = self.opportunities.len();
|
||||
|
||||
let predecessors = &self.body.basic_blocks.predecessors()[bb];
|
||||
if let &[pred] = &predecessors[..] && bb != START_BLOCK {
|
||||
if let &[pred] = &predecessors[..]
|
||||
&& bb != START_BLOCK
|
||||
{
|
||||
let term = self.body.basic_blocks[pred].terminator();
|
||||
match term.kind {
|
||||
TerminatorKind::SwitchInt { ref discr, ref targets } => {
|
||||
@ -419,8 +421,10 @@ impl<'tcx, 'a> TOFinder<'tcx, 'a> {
|
||||
// Do not support unions.
|
||||
AggregateKind::Adt(.., Some(_)) => return None,
|
||||
AggregateKind::Adt(_, variant_index, ..) if agg_ty.is_enum() => {
|
||||
if let Some(discr_target) = self.map.apply(lhs, TrackElem::Discriminant)
|
||||
&& let Some(discr_value) = discriminant_for_variant(agg_ty, *variant_index)
|
||||
if let Some(discr_target) =
|
||||
self.map.apply(lhs, TrackElem::Discriminant)
|
||||
&& let Some(discr_value) =
|
||||
discriminant_for_variant(agg_ty, *variant_index)
|
||||
{
|
||||
self.process_operand(bb, discr_target, &discr_value, state);
|
||||
}
|
||||
|
@ -506,7 +506,9 @@ impl<'a> Parser<'a> {
|
||||
if expected.contains(&TokenType::Token(token::Semi)) {
|
||||
// If the user is trying to write a ternary expression, recover it and
|
||||
// return an Err to prevent a cascade of irrelevant diagnostics
|
||||
if self.prev_token == token::Question && let Err(e) = self.maybe_recover_from_ternary_operator() {
|
||||
if self.prev_token == token::Question
|
||||
&& let Err(e) = self.maybe_recover_from_ternary_operator()
|
||||
{
|
||||
return Err(e);
|
||||
}
|
||||
|
||||
|
@ -107,15 +107,15 @@ macro_rules! maybe_whole {
|
||||
macro_rules! maybe_recover_from_interpolated_ty_qpath {
|
||||
($self: expr, $allow_qpath_recovery: expr) => {
|
||||
if $allow_qpath_recovery
|
||||
&& $self.may_recover()
|
||||
&& $self.look_ahead(1, |t| t == &token::ModSep)
|
||||
&& let token::Interpolated(nt) = &$self.token.kind
|
||||
&& let token::NtTy(ty) = &**nt
|
||||
{
|
||||
let ty = ty.clone();
|
||||
$self.bump();
|
||||
return $self.maybe_recover_from_bad_qpath_stage_2($self.prev_token.span, ty);
|
||||
}
|
||||
&& $self.may_recover()
|
||||
&& $self.look_ahead(1, |t| t == &token::ModSep)
|
||||
&& let token::Interpolated(nt) = &$self.token.kind
|
||||
&& let token::NtTy(ty) = &**nt
|
||||
{
|
||||
let ty = ty.clone();
|
||||
$self.bump();
|
||||
return $self.maybe_recover_from_bad_qpath_stage_2($self.prev_token.span, ty);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -6,9 +6,9 @@
|
||||
|
||||
#![allow(rustc::potential_query_instability)]
|
||||
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
|
||||
#![cfg_attr(not(bootstrap), doc(rust_logo))]
|
||||
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
|
||||
#![cfg_attr(not(bootstrap), allow(internal_features))]
|
||||
#![doc(rust_logo)]
|
||||
#![feature(rustdoc_internals)]
|
||||
#![allow(internal_features)]
|
||||
#![feature(iter_intersperse)]
|
||||
#![feature(let_chains)]
|
||||
#![feature(map_try_insert)]
|
||||
|
@ -196,7 +196,10 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
if let Some((depr, span)) = &depr && depr.is_since_rustc_version() && stab.is_none() {
|
||||
if let Some((depr, span)) = &depr
|
||||
&& depr.is_since_rustc_version()
|
||||
&& stab.is_none()
|
||||
{
|
||||
self.tcx.sess.emit_err(errors::DeprecatedAttribute { span: *span });
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
|
||||
#![cfg_attr(not(bootstrap), doc(rust_logo))]
|
||||
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
|
||||
#![cfg_attr(not(bootstrap), allow(internal_features))]
|
||||
#![doc(rust_logo)]
|
||||
#![feature(rustdoc_internals)]
|
||||
#![allow(internal_features)]
|
||||
#![feature(associated_type_defaults)]
|
||||
#![feature(rustc_private)]
|
||||
#![feature(try_blocks)]
|
||||
|
@ -1,8 +1,8 @@
|
||||
//! Support for serializing the dep-graph and reloading it.
|
||||
|
||||
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
|
||||
#![cfg_attr(not(bootstrap), doc(rust_logo))]
|
||||
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
|
||||
#![doc(rust_logo)]
|
||||
#![feature(rustdoc_internals)]
|
||||
// this shouldn't be necessary, but the check for `&mut _` is too naive and denies returning a function pointer that takes a mut ref
|
||||
#![feature(const_mut_refs)]
|
||||
#![feature(const_refs_to_cell)]
|
||||
|
@ -7,8 +7,8 @@
|
||||
//! Type-relative name resolution (methods, fields, associated items) happens in `rustc_hir_analysis`.
|
||||
|
||||
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
|
||||
#![cfg_attr(not(bootstrap), doc(rust_logo))]
|
||||
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
|
||||
#![doc(rust_logo)]
|
||||
#![feature(rustdoc_internals)]
|
||||
#![feature(assert_matches)]
|
||||
#![feature(box_patterns)]
|
||||
#![feature(extract_if)]
|
||||
|
@ -5,9 +5,9 @@
|
||||
html_playground_url = "https://play.rust-lang.org/",
|
||||
test(attr(allow(unused_variables), deny(warnings)))
|
||||
)]
|
||||
#![cfg_attr(not(bootstrap), doc(rust_logo))]
|
||||
#![cfg_attr(not(bootstrap), allow(internal_features))]
|
||||
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
|
||||
#![doc(rust_logo)]
|
||||
#![allow(internal_features)]
|
||||
#![feature(rustdoc_internals)]
|
||||
#![feature(allocator_api)]
|
||||
#![feature(associated_type_bounds)]
|
||||
#![feature(const_option)]
|
||||
|
@ -10,9 +10,9 @@
|
||||
html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/",
|
||||
test(attr(allow(unused_variables), deny(warnings)))
|
||||
)]
|
||||
#![cfg_attr(not(bootstrap), doc(rust_logo))]
|
||||
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
|
||||
#![cfg_attr(not(bootstrap), allow(internal_features))]
|
||||
#![doc(rust_logo)]
|
||||
#![feature(rustdoc_internals)]
|
||||
#![allow(internal_features)]
|
||||
#![allow(rustc::usage_of_ty_tykind)]
|
||||
|
||||
pub mod rustc_internal;
|
||||
|
@ -17,11 +17,10 @@
|
||||
|
||||
// tidy-alphabetical-start
|
||||
#![allow(internal_features)]
|
||||
#![cfg_attr(not(bootstrap), doc(rust_logo))]
|
||||
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
|
||||
#![deny(rustc::diagnostic_outside_of_impl)]
|
||||
#![deny(rustc::untranslatable_diagnostic)]
|
||||
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
|
||||
#![doc(rust_logo)]
|
||||
#![feature(array_windows)]
|
||||
#![feature(cfg_match)]
|
||||
#![feature(core_io_borrowed_buf)]
|
||||
@ -33,6 +32,7 @@
|
||||
#![feature(read_buf)]
|
||||
#![feature(round_char_boundary)]
|
||||
#![feature(rustc_attrs)]
|
||||
#![feature(rustdoc_internals)]
|
||||
// tidy-alphabetical-end
|
||||
|
||||
#[macro_use]
|
||||
|
@ -88,9 +88,9 @@
|
||||
//! DefPaths which are much more robust in the face of changes to the code base.
|
||||
|
||||
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
|
||||
#![cfg_attr(not(bootstrap), doc(rust_logo))]
|
||||
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
|
||||
#![cfg_attr(not(bootstrap), allow(internal_features))]
|
||||
#![doc(rust_logo)]
|
||||
#![feature(rustdoc_internals)]
|
||||
#![allow(internal_features)]
|
||||
#![feature(never_type)]
|
||||
#![recursion_limit = "256"]
|
||||
#![allow(rustc::potential_query_instability)]
|
||||
|
@ -8,8 +8,8 @@
|
||||
//! LLVM.
|
||||
|
||||
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
|
||||
#![cfg_attr(not(bootstrap), doc(rust_logo))]
|
||||
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
|
||||
#![doc(rust_logo)]
|
||||
#![feature(rustdoc_internals)]
|
||||
#![feature(assert_matches)]
|
||||
#![feature(associated_type_bounds)]
|
||||
#![feature(exhaustive_patterns)]
|
||||
|
@ -11,9 +11,9 @@
|
||||
//! This API is completely unstable and subject to change.
|
||||
|
||||
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
|
||||
#![cfg_attr(not(bootstrap), doc(rust_logo))]
|
||||
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
|
||||
#![cfg_attr(not(bootstrap), allow(internal_features))]
|
||||
#![doc(rust_logo)]
|
||||
#![feature(rustdoc_internals)]
|
||||
#![allow(internal_features)]
|
||||
#![feature(associated_type_bounds)]
|
||||
#![feature(box_patterns)]
|
||||
#![feature(control_flow_enum)]
|
||||
|
@ -187,11 +187,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
if let Some(kind) = self.tcx.fn_trait_kind_from_def_id(trait_ref.def_id)
|
||||
&& let ty::Tuple(args) = trait_ref.args.type_at(1).kind()
|
||||
{
|
||||
let args = args
|
||||
.iter()
|
||||
.map(|ty| ty.to_string())
|
||||
.collect::<Vec<_>>()
|
||||
.join(", ");
|
||||
let args = args.iter().map(|ty| ty.to_string()).collect::<Vec<_>>().join(", ");
|
||||
flags.push((sym::Trait, Some(format!("{}({args})", kind.as_str()))));
|
||||
} else {
|
||||
flags.push((sym::Trait, Some(trait_ref.print_only_trait_path().to_string())));
|
||||
@ -636,7 +632,9 @@ impl<'tcx> OnUnimplementedDirective {
|
||||
let value = cfg.value.map(|v| {
|
||||
// `with_no_visible_paths` is also used when generating the options,
|
||||
// so we need to match it here.
|
||||
ty::print::with_no_visible_paths!(OnUnimplementedFormatString(v).format(tcx, trait_ref, &options_map))
|
||||
ty::print::with_no_visible_paths!(
|
||||
OnUnimplementedFormatString(v).format(tcx, trait_ref, &options_map)
|
||||
)
|
||||
});
|
||||
|
||||
options.contains(&(cfg.name, value))
|
||||
|
@ -2723,11 +2723,14 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
.collect::<Vec<_>>();
|
||||
if !impls.is_empty() {
|
||||
let len = impls.len();
|
||||
let mut types = impls.iter()
|
||||
.map(|t| with_no_trimmed_paths!(format!(
|
||||
" {}",
|
||||
tcx.type_of(*t).instantiate_identity(),
|
||||
)))
|
||||
let mut types = impls
|
||||
.iter()
|
||||
.map(|t| {
|
||||
with_no_trimmed_paths!(format!(
|
||||
" {}",
|
||||
tcx.type_of(*t).instantiate_identity(),
|
||||
))
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
let post = if types.len() > 9 {
|
||||
types.truncate(8);
|
||||
@ -2769,30 +2772,47 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
));
|
||||
}
|
||||
}
|
||||
ObligationCauseCode::RepeatElementCopy { is_constable, elt_type, elt_span, elt_stmt_span } => {
|
||||
ObligationCauseCode::RepeatElementCopy {
|
||||
is_constable,
|
||||
elt_type,
|
||||
elt_span,
|
||||
elt_stmt_span,
|
||||
} => {
|
||||
err.note(
|
||||
"the `Copy` trait is required because this value will be copied for each element of the array",
|
||||
);
|
||||
let value_kind = match is_constable {
|
||||
IsConstable::Fn => Some("the result of the function call"),
|
||||
IsConstable::Ctor => Some("the result of the constructor"),
|
||||
_ => None
|
||||
_ => None,
|
||||
};
|
||||
let sm = tcx.sess.source_map();
|
||||
if let Some(value_kind) = value_kind &&
|
||||
let Ok(snip) = sm.span_to_snippet(elt_span)
|
||||
if let Some(value_kind) = value_kind
|
||||
&& let Ok(snip) = sm.span_to_snippet(elt_span)
|
||||
{
|
||||
let help_msg = format!(
|
||||
"consider creating a new `const` item and initializing it with {value_kind} \
|
||||
to be used in the repeat position");
|
||||
to be used in the repeat position"
|
||||
);
|
||||
let indentation = sm.indentation_before(elt_stmt_span).unwrap_or_default();
|
||||
err.multipart_suggestion(help_msg, vec![
|
||||
(elt_stmt_span.shrink_to_lo(), format!("const ARRAY_REPEAT_VALUE: {elt_type} = {snip};\n{indentation}")),
|
||||
(elt_span, "ARRAY_REPEAT_VALUE".to_string())
|
||||
], Applicability::MachineApplicable);
|
||||
err.multipart_suggestion(
|
||||
help_msg,
|
||||
vec![
|
||||
(
|
||||
elt_stmt_span.shrink_to_lo(),
|
||||
format!(
|
||||
"const ARRAY_REPEAT_VALUE: {elt_type} = {snip};\n{indentation}"
|
||||
),
|
||||
),
|
||||
(elt_span, "ARRAY_REPEAT_VALUE".to_string()),
|
||||
],
|
||||
Applicability::MachineApplicable,
|
||||
);
|
||||
}
|
||||
|
||||
if self.tcx.sess.is_nightly_build() && matches!(is_constable, IsConstable::Fn|IsConstable::Ctor) {
|
||||
if self.tcx.sess.is_nightly_build()
|
||||
&& matches!(is_constable, IsConstable::Fn | IsConstable::Ctor)
|
||||
{
|
||||
err.help(
|
||||
"create an inline `const` block, see RFC #2920 \
|
||||
<https://github.com/rust-lang/rfcs/pull/2920> for more information",
|
||||
@ -2957,7 +2977,9 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
}
|
||||
ObligationCauseCode::SizedCoroutineInterior(coroutine_def_id) => {
|
||||
let what = match self.tcx.coroutine_kind(coroutine_def_id) {
|
||||
None | Some(hir::CoroutineKind::Coroutine) | Some(hir::CoroutineKind::Gen(_)) => "yield",
|
||||
None
|
||||
| Some(hir::CoroutineKind::Coroutine)
|
||||
| Some(hir::CoroutineKind::Gen(_)) => "yield",
|
||||
Some(hir::CoroutineKind::Async(..)) => "await",
|
||||
};
|
||||
err.note(format!(
|
||||
@ -3519,7 +3541,8 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
{
|
||||
if let hir::Expr { kind: hir::ExprKind::Block(block, _), .. } = expr {
|
||||
let inner_expr = expr.peel_blocks();
|
||||
let ty = typeck_results.expr_ty_adjusted_opt(inner_expr)
|
||||
let ty = typeck_results
|
||||
.expr_ty_adjusted_opt(inner_expr)
|
||||
.unwrap_or(Ty::new_misc_error(tcx));
|
||||
let span = inner_expr.span;
|
||||
if Some(span) != err.span.primary_span() {
|
||||
@ -3538,14 +3561,13 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
tcx.lang_items().fn_once_trait(),
|
||||
tcx.lang_items().fn_mut_trait(),
|
||||
tcx.lang_items().fn_trait(),
|
||||
].contains(&Some(pred.def_id()))
|
||||
]
|
||||
.contains(&Some(pred.def_id()))
|
||||
{
|
||||
if let [stmt, ..] = block.stmts
|
||||
&& let hir::StmtKind::Semi(value) = stmt.kind
|
||||
&& let hir::ExprKind::Closure(hir::Closure {
|
||||
body,
|
||||
fn_decl_span,
|
||||
..
|
||||
body, fn_decl_span, ..
|
||||
}) = value.kind
|
||||
&& let body = hir.body(*body)
|
||||
&& !matches!(body.value.kind, hir::ExprKind::Block(..))
|
||||
@ -3568,9 +3590,11 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
"you might have meant to create the closure instead of a block",
|
||||
format!(
|
||||
"|{}| ",
|
||||
(0..pred.trait_ref.args.len() - 1).map(|_| "_")
|
||||
(0..pred.trait_ref.args.len() - 1)
|
||||
.map(|_| "_")
|
||||
.collect::<Vec<_>>()
|
||||
.join(", ")),
|
||||
.join(", ")
|
||||
),
|
||||
Applicability::MaybeIncorrect,
|
||||
);
|
||||
}
|
||||
|
@ -928,10 +928,8 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
}
|
||||
|
||||
fn fn_arg_obligation(&self, obligation: &PredicateObligation<'tcx>) -> bool {
|
||||
if let ObligationCauseCode::FunctionArgumentObligation {
|
||||
arg_hir_id,
|
||||
..
|
||||
} = obligation.cause.code()
|
||||
if let ObligationCauseCode::FunctionArgumentObligation { arg_hir_id, .. } =
|
||||
obligation.cause.code()
|
||||
&& let Some(Node::Expr(arg)) = self.tcx.hir().find(*arg_hir_id)
|
||||
&& let arg = arg.peel_borrows()
|
||||
&& let hir::ExprKind::Path(hir::QPath::Resolved(
|
||||
|
@ -5,9 +5,9 @@
|
||||
//! This API is completely unstable and subject to change.
|
||||
|
||||
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
|
||||
#![cfg_attr(not(bootstrap), doc(rust_logo))]
|
||||
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
|
||||
#![cfg_attr(not(bootstrap), allow(internal_features))]
|
||||
#![doc(rust_logo)]
|
||||
#![feature(rustdoc_internals)]
|
||||
#![allow(internal_features)]
|
||||
#![feature(assert_matches)]
|
||||
#![feature(associated_type_defaults)]
|
||||
#![feature(iterator_try_collect)]
|
||||
|
@ -203,11 +203,7 @@ impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for ImplTraitInTraitFinder<'_, 'tcx> {
|
||||
"we shouldn't walk non-predicate binders with `impl Trait`...",
|
||||
);
|
||||
}
|
||||
ty::Region::new_bound(
|
||||
self.tcx,
|
||||
index.shifted_out_to_binder(self.depth),
|
||||
bv,
|
||||
)
|
||||
ty::Region::new_bound(self.tcx, index.shifted_out_to_binder(self.depth), bv)
|
||||
} else {
|
||||
re
|
||||
}
|
||||
|
@ -78,8 +78,8 @@
|
||||
not(no_sync),
|
||||
target_has_atomic = "ptr"
|
||||
))]
|
||||
#![cfg_attr(not(bootstrap), doc(rust_logo))]
|
||||
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
|
||||
#![doc(rust_logo)]
|
||||
#![feature(rustdoc_internals)]
|
||||
#![no_std]
|
||||
#![needs_allocator]
|
||||
// Lints:
|
||||
|
@ -285,9 +285,7 @@ impl<T, A: Allocator> Iterator for IntoIter<T, A> {
|
||||
// Also note the implementation of `Self: TrustedRandomAccess` requires
|
||||
// that `T: Copy` so reading elements from the buffer doesn't invalidate
|
||||
// them for `Drop`.
|
||||
unsafe {
|
||||
if T::IS_ZST { mem::zeroed() } else { ptr::read(self.ptr.add(i)) }
|
||||
}
|
||||
unsafe { if T::IS_ZST { mem::zeroed() } else { ptr::read(self.ptr.add(i)) } }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -106,7 +106,7 @@ impl<I: Iterator<Item = u16>> Iterator for DecodeUtf16<I> {
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "decode_utf16_fused_iterator", since = "CURRENT_RUSTC_VERSION")]
|
||||
#[stable(feature = "decode_utf16_fused_iterator", since = "1.75.0")]
|
||||
impl<I: Iterator<Item = u16> + FusedIterator> FusedIterator for DecodeUtf16<I> {}
|
||||
|
||||
impl DecodeUtf16Error {
|
||||
|
@ -21,12 +21,16 @@ pub(crate) fn escape_ascii_into(output: &mut [ascii::Char; 4], byte: u8) -> Rang
|
||||
b'\\' => backslash(ascii::Char::ReverseSolidus),
|
||||
b'\'' => backslash(ascii::Char::Apostrophe),
|
||||
b'\"' => backslash(ascii::Char::QuotationMark),
|
||||
_ => if let Some(a) = byte.as_ascii() && !byte.is_ascii_control() {
|
||||
([a, ascii::Char::Null, ascii::Char::Null, ascii::Char::Null], 1)
|
||||
} else {
|
||||
let hi = HEX_DIGITS[usize::from(byte >> 4)];
|
||||
let lo = HEX_DIGITS[usize::from(byte & 0xf)];
|
||||
([ascii::Char::ReverseSolidus, ascii::Char::SmallX, hi, lo], 4)
|
||||
_ => {
|
||||
if let Some(a) = byte.as_ascii()
|
||||
&& !byte.is_ascii_control()
|
||||
{
|
||||
([a, ascii::Char::Null, ascii::Char::Null, ascii::Char::Null], 1)
|
||||
} else {
|
||||
let hi = HEX_DIGITS[usize::from(byte >> 4)];
|
||||
let lo = HEX_DIGITS[usize::from(byte & 0xf)];
|
||||
([ascii::Char::ReverseSolidus, ascii::Char::SmallX, hi, lo], 4)
|
||||
}
|
||||
}
|
||||
};
|
||||
*output = data;
|
||||
|
@ -1072,7 +1072,7 @@ extern "rust-intrinsic" {
|
||||
/// zero-initialization: This will statically either panic, or do nothing.
|
||||
///
|
||||
/// This intrinsic does not have a stable counterpart.
|
||||
#[rustc_const_stable(feature = "const_assert_type2", since = "CURRENT_RUSTC_VERSION")]
|
||||
#[rustc_const_stable(feature = "const_assert_type2", since = "1.75.0")]
|
||||
#[rustc_safe_intrinsic]
|
||||
#[rustc_nounwind]
|
||||
pub fn assert_zero_valid<T>();
|
||||
@ -1080,7 +1080,7 @@ extern "rust-intrinsic" {
|
||||
/// A guard for `std::mem::uninitialized`. This will statically either panic, or do nothing.
|
||||
///
|
||||
/// This intrinsic does not have a stable counterpart.
|
||||
#[rustc_const_stable(feature = "const_assert_type2", since = "CURRENT_RUSTC_VERSION")]
|
||||
#[rustc_const_stable(feature = "const_assert_type2", since = "1.75.0")]
|
||||
#[rustc_safe_intrinsic]
|
||||
#[rustc_nounwind]
|
||||
pub fn assert_mem_uninitialized_valid<T>();
|
||||
@ -2279,7 +2279,7 @@ extern "rust-intrinsic" {
|
||||
/// any safety invariants.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is [`core::mem::discriminant`].
|
||||
#[rustc_const_stable(feature = "const_discriminant", since = "CURRENT_RUSTC_VERSION")]
|
||||
#[rustc_const_stable(feature = "const_discriminant", since = "1.75.0")]
|
||||
#[rustc_safe_intrinsic]
|
||||
#[rustc_nounwind]
|
||||
pub fn discriminant_value<T>(v: &T) -> <T as DiscriminantKind>::Discriminant;
|
||||
|
@ -83,11 +83,7 @@ where
|
||||
// last element. Used in the `DoubleEndedIterator` implementation.
|
||||
fn next_back_index(&self) -> usize {
|
||||
let rem = self.iter.len() % (self.step + 1);
|
||||
if self.first_take {
|
||||
if rem == 0 { self.step } else { rem - 1 }
|
||||
} else {
|
||||
rem
|
||||
}
|
||||
if self.first_take { if rem == 0 { self.step } else { rem - 1 } } else { rem }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11,8 +11,7 @@ use crate::pin::Pin;
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// #![cfg_attr(bootstrap, feature(generators))]
|
||||
/// #![cfg_attr(not(bootstrap), feature(coroutines))]
|
||||
/// #![feature(coroutines)]
|
||||
/// #![feature(iter_from_coroutine)]
|
||||
///
|
||||
/// let it = std::iter::from_coroutine(|| {
|
||||
|
@ -69,7 +69,7 @@ fn _assert_is_object_safe(_: &dyn Iterator<Item = ()>) {}
|
||||
message = "`{Self}` is not an iterator"
|
||||
)]
|
||||
#[doc(notable_trait)]
|
||||
#[cfg_attr(not(bootstrap), lang = "iterator")]
|
||||
#[lang = "iterator"]
|
||||
#[rustc_diagnostic_item = "Iterator"]
|
||||
#[must_use = "iterators are lazy and do nothing unless consumed"]
|
||||
pub trait Iterator {
|
||||
|
@ -69,7 +69,7 @@
|
||||
test(no_crate_inject, attr(deny(warnings))),
|
||||
test(attr(allow(dead_code, deprecated, unused_variables, unused_mut)))
|
||||
)]
|
||||
#![cfg_attr(not(bootstrap), doc(rust_logo))]
|
||||
#![doc(rust_logo)]
|
||||
#![doc(cfg_hide(
|
||||
not(test),
|
||||
any(not(feature = "miri-test-libstd"), test, doctest),
|
||||
|
@ -398,7 +398,7 @@ impl<T> MaybeUninit<T> {
|
||||
#[rustc_allow_const_fn_unstable(const_mut_refs)]
|
||||
#[rustc_allow_const_fn_unstable(const_ptr_write)]
|
||||
#[rustc_allow_const_fn_unstable(const_maybe_uninit_as_mut_ptr)]
|
||||
#[rustc_const_stable(feature = "const_maybe_uninit_zeroed", since = "CURRENT_RUSTC_VERSION")]
|
||||
#[rustc_const_stable(feature = "const_maybe_uninit_zeroed", since = "1.75.0")]
|
||||
pub const fn zeroed() -> MaybeUninit<T> {
|
||||
let mut u = MaybeUninit::<T>::uninit();
|
||||
// SAFETY: `u.as_mut_ptr()` points to allocated memory.
|
||||
@ -691,10 +691,7 @@ impl<T> MaybeUninit<T> {
|
||||
/// // they both get dropped!
|
||||
/// ```
|
||||
#[stable(feature = "maybe_uninit_extra", since = "1.60.0")]
|
||||
#[rustc_const_stable(
|
||||
feature = "const_maybe_uninit_assume_init_read",
|
||||
since = "CURRENT_RUSTC_VERSION"
|
||||
)]
|
||||
#[rustc_const_stable(feature = "const_maybe_uninit_assume_init_read", since = "1.75.0")]
|
||||
#[inline(always)]
|
||||
#[track_caller]
|
||||
pub const unsafe fn assume_init_read(&self) -> T {
|
||||
|
@ -647,7 +647,7 @@ pub const fn needs_drop<T: ?Sized>() -> bool {
|
||||
#[allow(deprecated)]
|
||||
#[rustc_diagnostic_item = "mem_zeroed"]
|
||||
#[track_caller]
|
||||
#[rustc_const_stable(feature = "const_mem_zeroed", since = "CURRENT_RUSTC_VERSION")]
|
||||
#[rustc_const_stable(feature = "const_mem_zeroed", since = "1.75.0")]
|
||||
pub const unsafe fn zeroed<T>() -> T {
|
||||
// SAFETY: the caller must guarantee that an all-zero value is valid for `T`.
|
||||
unsafe {
|
||||
@ -1208,7 +1208,7 @@ impl<T> fmt::Debug for Discriminant<T> {
|
||||
/// // assert_eq!(0, unsafe { std::mem::transmute::<_, u8>(std::mem::discriminant(&unit_like)) });
|
||||
/// ```
|
||||
#[stable(feature = "discriminant_value", since = "1.21.0")]
|
||||
#[rustc_const_stable(feature = "const_discriminant", since = "CURRENT_RUSTC_VERSION")]
|
||||
#[rustc_const_stable(feature = "const_discriminant", since = "1.75.0")]
|
||||
#[cfg_attr(not(test), rustc_diagnostic_item = "mem_discriminant")]
|
||||
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
|
||||
pub const fn discriminant<T>(v: &T) -> Discriminant<T> {
|
||||
@ -1358,7 +1358,7 @@ impl<T> SizedTypeProperties for T {}
|
||||
///
|
||||
/// ```
|
||||
/// #![feature(offset_of)]
|
||||
/// # #![cfg_attr(not(bootstrap), feature(offset_of_enum))]
|
||||
/// # #![feature(offset_of_enum)]
|
||||
///
|
||||
/// use std::mem;
|
||||
/// #[repr(C)]
|
||||
@ -1388,12 +1388,9 @@ impl<T> SizedTypeProperties for T {}
|
||||
/// B { one: u8, two: u16 },
|
||||
/// }
|
||||
///
|
||||
/// # #[cfg(not(bootstrap))]
|
||||
/// assert_eq!(mem::offset_of!(Enum, A.0), 1);
|
||||
/// # #[cfg(not(bootstrap))]
|
||||
/// assert_eq!(mem::offset_of!(Enum, B.two), 2);
|
||||
///
|
||||
/// # #[cfg(not(bootstrap))]
|
||||
/// assert_eq!(mem::offset_of!(Option<&u8>, Some.0), 0);
|
||||
/// ```
|
||||
#[unstable(feature = "offset_of", issue = "106655")]
|
||||
|
@ -425,8 +425,8 @@ impl IpAddr {
|
||||
#[inline]
|
||||
#[must_use = "this returns the result of the operation, \
|
||||
without modifying the original"]
|
||||
#[stable(feature = "ip_to_canonical", since = "CURRENT_RUSTC_VERSION")]
|
||||
#[rustc_const_stable(feature = "ip_to_canonical", since = "CURRENT_RUSTC_VERSION")]
|
||||
#[stable(feature = "ip_to_canonical", since = "1.75.0")]
|
||||
#[rustc_const_stable(feature = "ip_to_canonical", since = "1.75.0")]
|
||||
pub const fn to_canonical(&self) -> IpAddr {
|
||||
match self {
|
||||
IpAddr::V4(_) => *self,
|
||||
@ -1757,7 +1757,7 @@ impl Ipv6Addr {
|
||||
#[must_use = "this returns the result of the operation, \
|
||||
without modifying the original"]
|
||||
#[stable(feature = "ipv6_to_ipv4_mapped", since = "1.63.0")]
|
||||
#[rustc_const_stable(feature = "const_ipv6_to_ipv4_mapped", since = "CURRENT_RUSTC_VERSION")]
|
||||
#[rustc_const_stable(feature = "const_ipv6_to_ipv4_mapped", since = "1.75.0")]
|
||||
pub const fn to_ipv4_mapped(&self) -> Option<Ipv4Addr> {
|
||||
match self.octets() {
|
||||
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff, a, b, c, d] => {
|
||||
@ -1825,8 +1825,8 @@ impl Ipv6Addr {
|
||||
#[inline]
|
||||
#[must_use = "this returns the result of the operation, \
|
||||
without modifying the original"]
|
||||
#[stable(feature = "ip_to_canonical", since = "CURRENT_RUSTC_VERSION")]
|
||||
#[rustc_const_stable(feature = "ip_to_canonical", since = "CURRENT_RUSTC_VERSION")]
|
||||
#[stable(feature = "ip_to_canonical", since = "1.75.0")]
|
||||
#[rustc_const_stable(feature = "ip_to_canonical", since = "1.75.0")]
|
||||
pub const fn to_canonical(&self) -> IpAddr {
|
||||
if let Some(mapped) = self.to_ipv4_mapped() {
|
||||
return IpAddr::V4(mapped);
|
||||
@ -2128,7 +2128,7 @@ impl From<[u16; 8]> for IpAddr {
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "ip_bitops", since = "CURRENT_RUSTC_VERSION")]
|
||||
#[stable(feature = "ip_bitops", since = "1.75.0")]
|
||||
impl Not for Ipv4Addr {
|
||||
type Output = Ipv4Addr;
|
||||
|
||||
@ -2141,7 +2141,7 @@ impl Not for Ipv4Addr {
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "ip_bitops", since = "CURRENT_RUSTC_VERSION")]
|
||||
#[stable(feature = "ip_bitops", since = "1.75.0")]
|
||||
impl Not for &'_ Ipv4Addr {
|
||||
type Output = Ipv4Addr;
|
||||
|
||||
@ -2151,7 +2151,7 @@ impl Not for &'_ Ipv4Addr {
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "ip_bitops", since = "CURRENT_RUSTC_VERSION")]
|
||||
#[stable(feature = "ip_bitops", since = "1.75.0")]
|
||||
impl Not for Ipv6Addr {
|
||||
type Output = Ipv6Addr;
|
||||
|
||||
@ -2164,7 +2164,7 @@ impl Not for Ipv6Addr {
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "ip_bitops", since = "CURRENT_RUSTC_VERSION")]
|
||||
#[stable(feature = "ip_bitops", since = "1.75.0")]
|
||||
impl Not for &'_ Ipv6Addr {
|
||||
type Output = Ipv6Addr;
|
||||
|
||||
@ -2246,13 +2246,13 @@ macro_rules! bitop_impls {
|
||||
}
|
||||
|
||||
bitop_impls! {
|
||||
#[stable(feature = "ip_bitops", since = "CURRENT_RUSTC_VERSION")]
|
||||
#[stable(feature = "ip_bitops", since = "1.75.0")]
|
||||
impl (BitAnd, BitAndAssign) for Ipv4Addr = (bitand, bitand_assign);
|
||||
#[stable(feature = "ip_bitops", since = "CURRENT_RUSTC_VERSION")]
|
||||
#[stable(feature = "ip_bitops", since = "1.75.0")]
|
||||
impl (BitOr, BitOrAssign) for Ipv4Addr = (bitor, bitor_assign);
|
||||
|
||||
#[stable(feature = "ip_bitops", since = "CURRENT_RUSTC_VERSION")]
|
||||
#[stable(feature = "ip_bitops", since = "1.75.0")]
|
||||
impl (BitAnd, BitAndAssign) for Ipv6Addr = (bitand, bitand_assign);
|
||||
#[stable(feature = "ip_bitops", since = "CURRENT_RUSTC_VERSION")]
|
||||
#[stable(feature = "ip_bitops", since = "1.75.0")]
|
||||
impl (BitOr, BitOrAssign) for Ipv6Addr = (bitor, bitor_assign);
|
||||
}
|
||||
|
@ -7,8 +7,7 @@ use crate::pin::Pin;
|
||||
/// possible return values of a coroutine. Currently this corresponds to either
|
||||
/// a suspension point (`Yielded`) or a termination point (`Complete`).
|
||||
#[derive(Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Debug, Hash)]
|
||||
#[cfg_attr(bootstrap, lang = "generator_state")]
|
||||
#[cfg_attr(not(bootstrap), lang = "coroutine_state")]
|
||||
#[lang = "coroutine_state"]
|
||||
#[unstable(feature = "coroutine_trait", issue = "43122")]
|
||||
pub enum CoroutineState<Y, R> {
|
||||
/// The coroutine suspended with a value.
|
||||
@ -40,8 +39,7 @@ pub enum CoroutineState<Y, R> {
|
||||
/// closure-like:
|
||||
///
|
||||
/// ```rust
|
||||
/// #![cfg_attr(bootstrap, feature(generators))]
|
||||
/// #![cfg_attr(not(bootstrap), feature(coroutines))]
|
||||
/// #![feature(coroutines)]
|
||||
/// #![feature(coroutine_trait)]
|
||||
///
|
||||
/// use std::ops::{Coroutine, CoroutineState};
|
||||
@ -68,8 +66,7 @@ pub enum CoroutineState<Y, R> {
|
||||
///
|
||||
/// [RFC 2033]: https://github.com/rust-lang/rfcs/pull/2033
|
||||
/// [unstable book]: ../../unstable-book/language-features/coroutines.html
|
||||
#[cfg_attr(bootstrap, lang = "generator")]
|
||||
#[cfg_attr(not(bootstrap), lang = "coroutine")]
|
||||
#[lang = "coroutine"]
|
||||
#[unstable(feature = "coroutine_trait", issue = "43122")]
|
||||
#[fundamental]
|
||||
pub trait Coroutine<R = ()> {
|
||||
|
@ -56,7 +56,7 @@ use crate::marker::Tuple;
|
||||
#[lang = "fn"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_paren_sugar]
|
||||
#[cfg_attr(not(bootstrap), rustc_on_unimplemented(
|
||||
#[rustc_on_unimplemented(
|
||||
on(
|
||||
Args = "()",
|
||||
note = "wrap the `{Self}` in a closure with no arguments: `|| {{ /* code */ }}`"
|
||||
@ -69,7 +69,7 @@ use crate::marker::Tuple;
|
||||
),
|
||||
message = "expected a `{Trait}` closure, found `{Self}`",
|
||||
label = "expected an `{Trait}` closure, found `{Self}`"
|
||||
))]
|
||||
)]
|
||||
#[fundamental] // so that regex can rely that `&str: !FnMut`
|
||||
#[must_use = "closures are lazy and do nothing unless called"]
|
||||
// FIXME(effects) #[const_trait]
|
||||
@ -143,7 +143,7 @@ pub trait Fn<Args: Tuple>: FnMut<Args> {
|
||||
#[lang = "fn_mut"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_paren_sugar]
|
||||
#[cfg_attr(not(bootstrap), rustc_on_unimplemented(
|
||||
#[rustc_on_unimplemented(
|
||||
on(
|
||||
Args = "()",
|
||||
note = "wrap the `{Self}` in a closure with no arguments: `|| {{ /* code */ }}`"
|
||||
@ -156,7 +156,7 @@ pub trait Fn<Args: Tuple>: FnMut<Args> {
|
||||
),
|
||||
message = "expected a `{Trait}` closure, found `{Self}`",
|
||||
label = "expected an `{Trait}` closure, found `{Self}`"
|
||||
))]
|
||||
)]
|
||||
#[fundamental] // so that regex can rely that `&str: !FnMut`
|
||||
#[must_use = "closures are lazy and do nothing unless called"]
|
||||
// FIXME(effects) #[const_trait]
|
||||
@ -222,7 +222,7 @@ pub trait FnMut<Args: Tuple>: FnOnce<Args> {
|
||||
#[lang = "fn_once"]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[rustc_paren_sugar]
|
||||
#[cfg_attr(not(bootstrap), rustc_on_unimplemented(
|
||||
#[rustc_on_unimplemented(
|
||||
on(
|
||||
Args = "()",
|
||||
note = "wrap the `{Self}` in a closure with no arguments: `|| {{ /* code */ }}`"
|
||||
@ -235,7 +235,7 @@ pub trait FnMut<Args: Tuple>: FnOnce<Args> {
|
||||
),
|
||||
message = "expected a `{Trait}` closure, found `{Self}`",
|
||||
label = "expected an `{Trait}` closure, found `{Self}`"
|
||||
))]
|
||||
)]
|
||||
#[fundamental] // so that regex can rely that `&str: !FnMut`
|
||||
#[must_use = "closures are lazy and do nothing unless called"]
|
||||
// FIXME(effects) #[const_trait]
|
||||
|
@ -765,7 +765,7 @@ impl<T> Option<T> {
|
||||
/// ```
|
||||
#[inline]
|
||||
#[must_use]
|
||||
#[stable(feature = "option_as_slice", since = "CURRENT_RUSTC_VERSION")]
|
||||
#[stable(feature = "option_as_slice", since = "1.75.0")]
|
||||
pub fn as_slice(&self) -> &[T] {
|
||||
// SAFETY: When the `Option` is `Some`, we're using the actual pointer
|
||||
// to the payload, with a length of 1, so this is equivalent to
|
||||
@ -819,7 +819,7 @@ impl<T> Option<T> {
|
||||
/// ```
|
||||
#[inline]
|
||||
#[must_use]
|
||||
#[stable(feature = "option_as_slice", since = "CURRENT_RUSTC_VERSION")]
|
||||
#[stable(feature = "option_as_slice", since = "1.75.0")]
|
||||
pub fn as_mut_slice(&mut self) -> &mut [T] {
|
||||
// SAFETY: When the `Option` is `Some`, we're using the actual pointer
|
||||
// to the payload, with a length of 1, so this is equivalent to
|
||||
|
@ -47,7 +47,7 @@ pub macro panic_2015 {
|
||||
#[allow_internal_unstable(core_panic, const_format_args)]
|
||||
#[rustc_diagnostic_item = "core_panic_2021_macro"]
|
||||
#[rustc_macro_transparency = "semitransparent"]
|
||||
#[cfg(any(bootstrap, feature = "panic_immediate_abort"))]
|
||||
#[cfg(feature = "panic_immediate_abort")]
|
||||
pub macro panic_2021 {
|
||||
() => (
|
||||
$crate::panicking::panic("explicit panic")
|
||||
@ -75,7 +75,7 @@ pub macro panic_2021 {
|
||||
)]
|
||||
#[rustc_diagnostic_item = "core_panic_2021_macro"]
|
||||
#[rustc_macro_transparency = "semitransparent"]
|
||||
#[cfg(not(any(bootstrap, feature = "panic_immediate_abort")))]
|
||||
#[cfg(not(feature = "panic_immediate_abort"))]
|
||||
pub macro panic_2021 {
|
||||
() => ({
|
||||
// Create a function so that the argument for `track_caller`
|
||||
|
@ -170,9 +170,8 @@ pub fn unreachable_display<T: fmt::Display>(x: &T) -> ! {
|
||||
#[inline]
|
||||
#[track_caller]
|
||||
#[rustc_do_not_const_check] // hooked by const-eval
|
||||
#[cfg_attr(bootstrap, lang = "panic_display")]
|
||||
// enforce a &&str argument in const-check and hook this by const-eval
|
||||
#[cfg_attr(not(bootstrap), rustc_const_panic_str)]
|
||||
#[rustc_const_panic_str]
|
||||
#[rustc_const_unstable(feature = "core_panic", issue = "none")]
|
||||
pub const fn panic_display<T: fmt::Display>(x: &T) -> ! {
|
||||
panic_fmt(format_args!("{}", *x));
|
||||
|
@ -1088,8 +1088,7 @@ impl<P, U> DispatchFromDyn<Pin<U>> for Pin<P> where P: DispatchFromDyn<U> {}
|
||||
/// ### With `Coroutine`s
|
||||
///
|
||||
/// ```rust
|
||||
/// #![cfg_attr(bootstrap, feature(generators))]
|
||||
/// #![cfg_attr(not(bootstrap), feature(coroutines))]
|
||||
/// #![feature(coroutines)]
|
||||
/// #![feature(coroutine_trait)]
|
||||
/// use core::{
|
||||
/// ops::{Coroutine, CoroutineState},
|
||||
|
@ -480,8 +480,8 @@ impl<T: ?Sized> *const T {
|
||||
/// leaving the metadata untouched.
|
||||
#[must_use]
|
||||
#[inline(always)]
|
||||
#[stable(feature = "pointer_byte_offsets", since = "CURRENT_RUSTC_VERSION")]
|
||||
#[rustc_const_stable(feature = "const_pointer_byte_offsets", since = "CURRENT_RUSTC_VERSION")]
|
||||
#[stable(feature = "pointer_byte_offsets", since = "1.75.0")]
|
||||
#[rustc_const_stable(feature = "const_pointer_byte_offsets", since = "1.75.0")]
|
||||
#[rustc_allow_const_fn_unstable(set_ptr_value)]
|
||||
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
|
||||
pub const unsafe fn byte_offset(self, count: isize) -> Self {
|
||||
@ -561,8 +561,8 @@ impl<T: ?Sized> *const T {
|
||||
/// leaving the metadata untouched.
|
||||
#[must_use]
|
||||
#[inline(always)]
|
||||
#[stable(feature = "pointer_byte_offsets", since = "CURRENT_RUSTC_VERSION")]
|
||||
#[rustc_const_stable(feature = "const_pointer_byte_offsets", since = "CURRENT_RUSTC_VERSION")]
|
||||
#[stable(feature = "pointer_byte_offsets", since = "1.75.0")]
|
||||
#[rustc_const_stable(feature = "const_pointer_byte_offsets", since = "1.75.0")]
|
||||
#[rustc_allow_const_fn_unstable(set_ptr_value)]
|
||||
pub const fn wrapping_byte_offset(self, count: isize) -> Self {
|
||||
self.cast::<u8>().wrapping_offset(count).with_metadata_of(self)
|
||||
@ -728,8 +728,8 @@ impl<T: ?Sized> *const T {
|
||||
/// For non-`Sized` pointees this operation considers only the data pointers,
|
||||
/// ignoring the metadata.
|
||||
#[inline(always)]
|
||||
#[stable(feature = "pointer_byte_offsets", since = "CURRENT_RUSTC_VERSION")]
|
||||
#[rustc_const_stable(feature = "const_pointer_byte_offsets", since = "CURRENT_RUSTC_VERSION")]
|
||||
#[stable(feature = "pointer_byte_offsets", since = "1.75.0")]
|
||||
#[rustc_const_stable(feature = "const_pointer_byte_offsets", since = "1.75.0")]
|
||||
#[rustc_allow_const_fn_unstable(set_ptr_value)]
|
||||
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
|
||||
pub const unsafe fn byte_offset_from<U: ?Sized>(self, origin: *const U) -> isize {
|
||||
@ -955,8 +955,8 @@ impl<T: ?Sized> *const T {
|
||||
/// leaving the metadata untouched.
|
||||
#[must_use]
|
||||
#[inline(always)]
|
||||
#[stable(feature = "pointer_byte_offsets", since = "CURRENT_RUSTC_VERSION")]
|
||||
#[rustc_const_stable(feature = "const_pointer_byte_offsets", since = "CURRENT_RUSTC_VERSION")]
|
||||
#[stable(feature = "pointer_byte_offsets", since = "1.75.0")]
|
||||
#[rustc_const_stable(feature = "const_pointer_byte_offsets", since = "1.75.0")]
|
||||
#[rustc_allow_const_fn_unstable(set_ptr_value)]
|
||||
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
|
||||
pub const unsafe fn byte_add(self, count: usize) -> Self {
|
||||
@ -1049,8 +1049,8 @@ impl<T: ?Sized> *const T {
|
||||
/// leaving the metadata untouched.
|
||||
#[must_use]
|
||||
#[inline(always)]
|
||||
#[stable(feature = "pointer_byte_offsets", since = "CURRENT_RUSTC_VERSION")]
|
||||
#[rustc_const_stable(feature = "const_pointer_byte_offsets", since = "CURRENT_RUSTC_VERSION")]
|
||||
#[stable(feature = "pointer_byte_offsets", since = "1.75.0")]
|
||||
#[rustc_const_stable(feature = "const_pointer_byte_offsets", since = "1.75.0")]
|
||||
#[rustc_allow_const_fn_unstable(set_ptr_value)]
|
||||
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
|
||||
pub const unsafe fn byte_sub(self, count: usize) -> Self {
|
||||
@ -1130,8 +1130,8 @@ impl<T: ?Sized> *const T {
|
||||
/// leaving the metadata untouched.
|
||||
#[must_use]
|
||||
#[inline(always)]
|
||||
#[stable(feature = "pointer_byte_offsets", since = "CURRENT_RUSTC_VERSION")]
|
||||
#[rustc_const_stable(feature = "const_pointer_byte_offsets", since = "CURRENT_RUSTC_VERSION")]
|
||||
#[stable(feature = "pointer_byte_offsets", since = "1.75.0")]
|
||||
#[rustc_const_stable(feature = "const_pointer_byte_offsets", since = "1.75.0")]
|
||||
#[rustc_allow_const_fn_unstable(set_ptr_value)]
|
||||
pub const fn wrapping_byte_add(self, count: usize) -> Self {
|
||||
self.cast::<u8>().wrapping_add(count).with_metadata_of(self)
|
||||
@ -1209,8 +1209,8 @@ impl<T: ?Sized> *const T {
|
||||
/// leaving the metadata untouched.
|
||||
#[must_use]
|
||||
#[inline(always)]
|
||||
#[stable(feature = "pointer_byte_offsets", since = "CURRENT_RUSTC_VERSION")]
|
||||
#[rustc_const_stable(feature = "const_pointer_byte_offsets", since = "CURRENT_RUSTC_VERSION")]
|
||||
#[stable(feature = "pointer_byte_offsets", since = "1.75.0")]
|
||||
#[rustc_const_stable(feature = "const_pointer_byte_offsets", since = "1.75.0")]
|
||||
#[rustc_allow_const_fn_unstable(set_ptr_value)]
|
||||
pub const fn wrapping_byte_sub(self, count: usize) -> Self {
|
||||
self.cast::<u8>().wrapping_sub(count).with_metadata_of(self)
|
||||
|
@ -495,8 +495,8 @@ impl<T: ?Sized> *mut T {
|
||||
/// leaving the metadata untouched.
|
||||
#[must_use]
|
||||
#[inline(always)]
|
||||
#[stable(feature = "pointer_byte_offsets", since = "CURRENT_RUSTC_VERSION")]
|
||||
#[rustc_const_stable(feature = "const_pointer_byte_offsets", since = "CURRENT_RUSTC_VERSION")]
|
||||
#[stable(feature = "pointer_byte_offsets", since = "1.75.0")]
|
||||
#[rustc_const_stable(feature = "const_pointer_byte_offsets", since = "1.75.0")]
|
||||
#[rustc_allow_const_fn_unstable(set_ptr_value)]
|
||||
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
|
||||
pub const unsafe fn byte_offset(self, count: isize) -> Self {
|
||||
@ -575,8 +575,8 @@ impl<T: ?Sized> *mut T {
|
||||
/// leaving the metadata untouched.
|
||||
#[must_use]
|
||||
#[inline(always)]
|
||||
#[stable(feature = "pointer_byte_offsets", since = "CURRENT_RUSTC_VERSION")]
|
||||
#[rustc_const_stable(feature = "const_pointer_byte_offsets", since = "CURRENT_RUSTC_VERSION")]
|
||||
#[stable(feature = "pointer_byte_offsets", since = "1.75.0")]
|
||||
#[rustc_const_stable(feature = "const_pointer_byte_offsets", since = "1.75.0")]
|
||||
#[rustc_allow_const_fn_unstable(set_ptr_value)]
|
||||
pub const fn wrapping_byte_offset(self, count: isize) -> Self {
|
||||
self.cast::<u8>().wrapping_offset(count).with_metadata_of(self)
|
||||
@ -900,8 +900,8 @@ impl<T: ?Sized> *mut T {
|
||||
/// For non-`Sized` pointees this operation considers only the data pointers,
|
||||
/// ignoring the metadata.
|
||||
#[inline(always)]
|
||||
#[stable(feature = "pointer_byte_offsets", since = "CURRENT_RUSTC_VERSION")]
|
||||
#[rustc_const_stable(feature = "const_pointer_byte_offsets", since = "CURRENT_RUSTC_VERSION")]
|
||||
#[stable(feature = "pointer_byte_offsets", since = "1.75.0")]
|
||||
#[rustc_const_stable(feature = "const_pointer_byte_offsets", since = "1.75.0")]
|
||||
#[rustc_allow_const_fn_unstable(set_ptr_value)]
|
||||
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
|
||||
pub const unsafe fn byte_offset_from<U: ?Sized>(self, origin: *const U) -> isize {
|
||||
@ -1056,8 +1056,8 @@ impl<T: ?Sized> *mut T {
|
||||
/// leaving the metadata untouched.
|
||||
#[must_use]
|
||||
#[inline(always)]
|
||||
#[stable(feature = "pointer_byte_offsets", since = "CURRENT_RUSTC_VERSION")]
|
||||
#[rustc_const_stable(feature = "const_pointer_byte_offsets", since = "CURRENT_RUSTC_VERSION")]
|
||||
#[stable(feature = "pointer_byte_offsets", since = "1.75.0")]
|
||||
#[rustc_const_stable(feature = "const_pointer_byte_offsets", since = "1.75.0")]
|
||||
#[rustc_allow_const_fn_unstable(set_ptr_value)]
|
||||
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
|
||||
pub const unsafe fn byte_add(self, count: usize) -> Self {
|
||||
@ -1150,8 +1150,8 @@ impl<T: ?Sized> *mut T {
|
||||
/// leaving the metadata untouched.
|
||||
#[must_use]
|
||||
#[inline(always)]
|
||||
#[stable(feature = "pointer_byte_offsets", since = "CURRENT_RUSTC_VERSION")]
|
||||
#[rustc_const_stable(feature = "const_pointer_byte_offsets", since = "CURRENT_RUSTC_VERSION")]
|
||||
#[stable(feature = "pointer_byte_offsets", since = "1.75.0")]
|
||||
#[rustc_const_stable(feature = "const_pointer_byte_offsets", since = "1.75.0")]
|
||||
#[rustc_allow_const_fn_unstable(set_ptr_value)]
|
||||
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
|
||||
pub const unsafe fn byte_sub(self, count: usize) -> Self {
|
||||
@ -1231,8 +1231,8 @@ impl<T: ?Sized> *mut T {
|
||||
/// leaving the metadata untouched.
|
||||
#[must_use]
|
||||
#[inline(always)]
|
||||
#[stable(feature = "pointer_byte_offsets", since = "CURRENT_RUSTC_VERSION")]
|
||||
#[rustc_const_stable(feature = "const_pointer_byte_offsets", since = "CURRENT_RUSTC_VERSION")]
|
||||
#[stable(feature = "pointer_byte_offsets", since = "1.75.0")]
|
||||
#[rustc_const_stable(feature = "const_pointer_byte_offsets", since = "1.75.0")]
|
||||
#[rustc_allow_const_fn_unstable(set_ptr_value)]
|
||||
pub const fn wrapping_byte_add(self, count: usize) -> Self {
|
||||
self.cast::<u8>().wrapping_add(count).with_metadata_of(self)
|
||||
@ -1310,8 +1310,8 @@ impl<T: ?Sized> *mut T {
|
||||
/// leaving the metadata untouched.
|
||||
#[must_use]
|
||||
#[inline(always)]
|
||||
#[stable(feature = "pointer_byte_offsets", since = "CURRENT_RUSTC_VERSION")]
|
||||
#[rustc_const_stable(feature = "const_pointer_byte_offsets", since = "CURRENT_RUSTC_VERSION")]
|
||||
#[stable(feature = "pointer_byte_offsets", since = "1.75.0")]
|
||||
#[rustc_const_stable(feature = "const_pointer_byte_offsets", since = "1.75.0")]
|
||||
#[rustc_allow_const_fn_unstable(set_ptr_value)]
|
||||
pub const fn wrapping_byte_sub(self, count: usize) -> Self {
|
||||
self.cast::<u8>().wrapping_sub(count).with_metadata_of(self)
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user