mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 23:04:33 +00:00
Auto merge of #121790 - jhpratt:rollup-yocg203, r=jhpratt
Rollup of 10 pull requests Successful merges: - #119748 (Increase visibility of `join_path` and `split_paths`) - #120291 (Have `String` use `SliceIndex` impls from `str`) - #121723 (Two diagnostic things) - #121740 (Changing some attributes to only_local.) - #121745 (Deeply normalize obligations in `refining_impl_trait`) - #121748 (Restore the standard library review rotation to its former glory) - #121768 (Implement unwind safety for Condvar on all platforms ) - #121777 (Fix typo in `rustc_passes/messages.ftl`) - #121778 (Document potential memory leak in unbounded channel) - #121779 (Remove unused diagnostic struct) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
71a7b66f20
@ -136,27 +136,6 @@ pub(crate) struct BenchSig {
|
||||
pub(crate) span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(builtin_macros_test_arg_non_lifetime)]
|
||||
pub(crate) struct TestArgNonLifetime {
|
||||
#[primary_span]
|
||||
pub(crate) span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(builtin_macros_should_panic)]
|
||||
pub(crate) struct ShouldPanic {
|
||||
#[primary_span]
|
||||
pub(crate) span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(builtin_macros_test_args)]
|
||||
pub(crate) struct TestArgs {
|
||||
#[primary_span]
|
||||
pub(crate) span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(builtin_macros_alloc_must_statics)]
|
||||
pub(crate) struct AllocMustStatics {
|
||||
|
@ -108,6 +108,25 @@ impl EmissionGuarantee for rustc_span::fatal_error::FatalError {
|
||||
|
||||
/// Trait implemented by error types. This is rarely implemented manually. Instead, use
|
||||
/// `#[derive(Diagnostic)]` -- see [rustc_macros::Diagnostic].
|
||||
///
|
||||
/// When implemented manually, it should be generic over the emission
|
||||
/// guarantee, i.e.:
|
||||
/// ```ignore (fragment)
|
||||
/// impl<'a, G: EmissionGuarantee> IntoDiagnostic<'a, G> for Foo { ... }
|
||||
/// ```
|
||||
/// rather than being specific:
|
||||
/// ```ignore (fragment)
|
||||
/// impl<'a> IntoDiagnostic<'a> for Bar { ... } // the default type param is `ErrorGuaranteed`
|
||||
/// impl<'a> IntoDiagnostic<'a, ()> for Baz { ... }
|
||||
/// ```
|
||||
/// There are two reasons for this.
|
||||
/// - A diagnostic like `Foo` *could* be emitted at any level -- `level` is
|
||||
/// passed in to `into_diagnostic` from outside. Even if in practice it is
|
||||
/// always emitted at a single level, we let the diagnostic creation/emission
|
||||
/// site determine the level (by using `create_err`, `emit_warn`, etc.)
|
||||
/// rather than the `IntoDiagnostic` impl.
|
||||
/// - Derived impls are always generic, and it's good for the hand-written
|
||||
/// impls to be consistent with them.
|
||||
#[rustc_diagnostic_item = "IntoDiagnostic"]
|
||||
pub trait IntoDiagnostic<'a, G: EmissionGuarantee = ErrorGuaranteed> {
|
||||
/// Write out as a diagnostic out of `DiagCtxt`.
|
||||
|
@ -1498,14 +1498,26 @@ impl DiagCtxtInner {
|
||||
let bugs: Vec<_> =
|
||||
std::mem::take(&mut self.delayed_bugs).into_iter().map(|(b, _)| b).collect();
|
||||
|
||||
// If backtraces are enabled, also print the query stack
|
||||
let backtrace = std::env::var_os("RUST_BACKTRACE").map_or(true, |x| &x != "0");
|
||||
for (i, bug) in bugs.into_iter().enumerate() {
|
||||
if let Some(file) = self.ice_file.as_ref()
|
||||
&& let Ok(mut out) = std::fs::File::options().create(true).append(true).open(file)
|
||||
{
|
||||
let _ = write!(
|
||||
&mut out,
|
||||
let decorate = backtrace || self.ice_file.is_none();
|
||||
let mut out = self
|
||||
.ice_file
|
||||
.as_ref()
|
||||
.and_then(|file| std::fs::File::options().create(true).append(true).open(file).ok());
|
||||
|
||||
// Put the overall explanation before the `DelayedBug`s, to frame them
|
||||
// better (e.g. separate warnings from them). Also, use notes, which
|
||||
// don't count as errors, to avoid possibly triggering
|
||||
// `-Ztreat-err-as-bug`, which we don't want.
|
||||
let note1 = "no errors encountered even though delayed bugs were created";
|
||||
let note2 = "those delayed bugs will now be shown as internal compiler errors";
|
||||
self.emit_diagnostic(DiagInner::new(Note, note1));
|
||||
self.emit_diagnostic(DiagInner::new(Note, note2));
|
||||
|
||||
for bug in bugs {
|
||||
if let Some(out) = &mut out {
|
||||
_ = write!(
|
||||
out,
|
||||
"delayed bug: {}\n{}\n",
|
||||
bug.inner
|
||||
.messages
|
||||
@ -1516,21 +1528,9 @@ impl DiagCtxtInner {
|
||||
);
|
||||
}
|
||||
|
||||
if i == 0 {
|
||||
// Put the overall explanation before the `DelayedBug`s, to
|
||||
// frame them better (e.g. separate warnings from them). Also,
|
||||
// make it a note so it doesn't count as an error, because that
|
||||
// could trigger `-Ztreat-err-as-bug`, which we don't want.
|
||||
let note1 = "no errors encountered even though delayed bugs were created";
|
||||
let note2 = "those delayed bugs will now be shown as internal compiler errors";
|
||||
self.emit_diagnostic(DiagInner::new(Note, note1));
|
||||
self.emit_diagnostic(DiagInner::new(Note, note2));
|
||||
}
|
||||
let mut bug = if decorate { bug.decorate(self) } else { bug.inner };
|
||||
|
||||
let mut bug =
|
||||
if backtrace || self.ice_file.is_none() { bug.decorate(self) } else { bug.inner };
|
||||
|
||||
// "Undelay" the delayed bugs (into plain `Bug`s).
|
||||
// "Undelay" the delayed bugs into plain bugs.
|
||||
if bug.level != DelayedBug {
|
||||
// NOTE(eddyb) not panicking here because we're already producing
|
||||
// an ICE, and the more information the merrier.
|
||||
|
@ -555,16 +555,19 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
|
||||
),
|
||||
gated!(
|
||||
rustc_allow_const_fn_unstable, Normal,
|
||||
template!(Word, List: "feat1, feat2, ..."), DuplicatesOk,
|
||||
template!(Word, List: "feat1, feat2, ..."), DuplicatesOk, @only_local: true,
|
||||
"rustc_allow_const_fn_unstable side-steps feature gating and stability checks"
|
||||
),
|
||||
gated!(
|
||||
allow_internal_unsafe, Normal, template!(Word), WarnFollowing,
|
||||
"allow_internal_unsafe side-steps the unsafe_code lint",
|
||||
@only_local: true, "allow_internal_unsafe side-steps the unsafe_code lint",
|
||||
),
|
||||
rustc_attr!(
|
||||
rustc_allowed_through_unstable_modules, Normal, template!(Word),
|
||||
WarnFollowing, @only_local: true,
|
||||
"rustc_allowed_through_unstable_modules special cases accidental stabilizations of stable items \
|
||||
through unstable paths"
|
||||
),
|
||||
rustc_attr!(rustc_allowed_through_unstable_modules, Normal, template!(Word), WarnFollowing,
|
||||
"rustc_allowed_through_unstable_modules special cases accidental stabilizations of stable items \
|
||||
through unstable paths"),
|
||||
|
||||
// ==========================================================================
|
||||
// Internal attributes: Type system related:
|
||||
@ -572,7 +575,8 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
|
||||
|
||||
gated!(fundamental, Normal, template!(Word), WarnFollowing, experimental!(fundamental)),
|
||||
gated!(
|
||||
may_dangle, Normal, template!(Word), WarnFollowing, dropck_eyepatch,
|
||||
may_dangle, Normal, template!(Word), WarnFollowing,
|
||||
@only_local: true, dropck_eyepatch,
|
||||
"`may_dangle` has unstable semantics and may be removed in the future",
|
||||
),
|
||||
|
||||
@ -580,31 +584,51 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
|
||||
// Internal attributes: Runtime related:
|
||||
// ==========================================================================
|
||||
|
||||
rustc_attr!(rustc_allocator, Normal, template!(Word), WarnFollowing, IMPL_DETAIL),
|
||||
rustc_attr!(rustc_nounwind, Normal, template!(Word), WarnFollowing, IMPL_DETAIL),
|
||||
rustc_attr!(rustc_reallocator, Normal, template!(Word), WarnFollowing, IMPL_DETAIL),
|
||||
rustc_attr!(rustc_deallocator, Normal, template!(Word), WarnFollowing, IMPL_DETAIL),
|
||||
rustc_attr!(rustc_allocator_zeroed, Normal, template!(Word), WarnFollowing, IMPL_DETAIL),
|
||||
gated!(
|
||||
default_lib_allocator, Normal, template!(Word), WarnFollowing, allocator_internals,
|
||||
experimental!(default_lib_allocator),
|
||||
rustc_attr!(
|
||||
rustc_allocator, Normal, template!(Word), WarnFollowing,
|
||||
@only_local: true, IMPL_DETAIL
|
||||
),
|
||||
rustc_attr!(
|
||||
rustc_nounwind, Normal, template!(Word), WarnFollowing,
|
||||
@only_local: true, IMPL_DETAIL
|
||||
),
|
||||
rustc_attr!(
|
||||
rustc_reallocator, Normal, template!(Word), WarnFollowing,
|
||||
@only_local: true, IMPL_DETAIL
|
||||
),
|
||||
rustc_attr!(
|
||||
rustc_deallocator, Normal, template!(Word), WarnFollowing,
|
||||
@only_local: true, IMPL_DETAIL
|
||||
),
|
||||
rustc_attr!(
|
||||
rustc_allocator_zeroed, Normal, template!(Word), WarnFollowing,
|
||||
@only_local: true, IMPL_DETAIL
|
||||
),
|
||||
gated!(
|
||||
needs_allocator, Normal, template!(Word), WarnFollowing, allocator_internals,
|
||||
experimental!(needs_allocator),
|
||||
default_lib_allocator, Normal, template!(Word), WarnFollowing,
|
||||
@only_local: true, allocator_internals, experimental!(default_lib_allocator),
|
||||
),
|
||||
gated!(
|
||||
needs_allocator, Normal, template!(Word), WarnFollowing,
|
||||
@only_local: true, allocator_internals, experimental!(needs_allocator),
|
||||
),
|
||||
gated!(
|
||||
panic_runtime, Normal, template!(Word), WarnFollowing,
|
||||
@only_local: true, experimental!(panic_runtime)
|
||||
),
|
||||
gated!(panic_runtime, Normal, template!(Word), WarnFollowing, experimental!(panic_runtime)),
|
||||
gated!(
|
||||
needs_panic_runtime, Normal, template!(Word), WarnFollowing,
|
||||
experimental!(needs_panic_runtime)
|
||||
@only_local: true, experimental!(needs_panic_runtime)
|
||||
),
|
||||
gated!(
|
||||
compiler_builtins, Normal, template!(Word), WarnFollowing,
|
||||
@only_local: true,
|
||||
"the `#[compiler_builtins]` attribute is used to identify the `compiler_builtins` crate \
|
||||
which contains compiler-rt intrinsics and will never be stable",
|
||||
),
|
||||
gated!(
|
||||
profiler_runtime, Normal, template!(Word), WarnFollowing,
|
||||
@only_local: true,
|
||||
"the `#[profiler_runtime]` attribute is used to identify the `profiler_builtins` crate \
|
||||
which contains the profiler runtime and will never be stable",
|
||||
),
|
||||
@ -630,7 +654,10 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
|
||||
template!(Word, List: "name, /*opt*/ attributes(name1, name2, ...)"), ErrorFollowing,
|
||||
IMPL_DETAIL,
|
||||
),
|
||||
rustc_attr!(rustc_proc_macro_decls, Normal, template!(Word), WarnFollowing, INTERNAL_UNSTABLE),
|
||||
rustc_attr!(
|
||||
rustc_proc_macro_decls, Normal, template!(Word), WarnFollowing,
|
||||
@only_local: true, INTERNAL_UNSTABLE
|
||||
),
|
||||
rustc_attr!(
|
||||
rustc_macro_transparency, Normal,
|
||||
template!(NameValueStr: "transparent|semitransparent|opaque"), ErrorFollowing,
|
||||
|
@ -136,11 +136,15 @@ pub(super) fn check_refining_return_position_impl_trait_in_trait<'tcx>(
|
||||
// 1. Project the RPITIT projections from the trait to the opaques on the impl,
|
||||
// which means that they don't need to be mapped manually.
|
||||
//
|
||||
// 2. Project any other projections that show up in the bound. That makes sure that
|
||||
// we don't consider `tests/ui/async-await/in-trait/async-associated-types.rs`
|
||||
// to be refining.
|
||||
let (trait_bounds, impl_bounds) =
|
||||
ocx.normalize(&ObligationCause::dummy(), param_env, (trait_bounds, impl_bounds));
|
||||
// 2. Deeply normalize any other projections that show up in the bound. That makes sure
|
||||
// that we don't consider `tests/ui/async-await/in-trait/async-associated-types.rs`
|
||||
// or `tests/ui/impl-trait/in-trait/refine-normalize.rs` to be refining.
|
||||
let Ok((trait_bounds, impl_bounds)) =
|
||||
ocx.deeply_normalize(&ObligationCause::dummy(), param_env, (trait_bounds, impl_bounds))
|
||||
else {
|
||||
tcx.dcx().delayed_bug("encountered errors when checking RPITIT refinement (selection)");
|
||||
return;
|
||||
};
|
||||
|
||||
// Since we've normalized things, we need to resolve regions, since we'll
|
||||
// possibly have introduced region vars during projection. We don't expect
|
||||
|
@ -1004,13 +1004,6 @@ pub(crate) struct StaticSpecialize {
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(hir_analysis_missing_tilde_const)]
|
||||
pub(crate) struct MissingTildeConst {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
pub(crate) enum DropImplPolarity {
|
||||
#[diag(hir_analysis_drop_impl_negative)]
|
||||
|
@ -557,14 +557,6 @@ pub(crate) struct CatchAfterTry {
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(parse_gen_fn)]
|
||||
#[help]
|
||||
pub(crate) struct GenFn {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(parse_comma_after_base_struct)]
|
||||
#[note]
|
||||
|
@ -187,7 +187,7 @@ passes_doc_attr_not_crate_level =
|
||||
`#![doc({$attr_name} = "...")]` isn't allowed as a crate-level attribute
|
||||
|
||||
passes_doc_cfg_hide_takes_list =
|
||||
`#[doc(cfg_hide(...)]` takes a list of attributes
|
||||
`#[doc(cfg_hide(...))]` takes a list of attributes
|
||||
|
||||
passes_doc_expect_str =
|
||||
doc {$attr_name} attribute expects a string: #[doc({$attr_name} = "a")]
|
||||
|
@ -7,32 +7,6 @@ use rustc_span::{
|
||||
|
||||
use crate::{late::PatternSource, Res};
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(resolve_parent_module_reset_for_binding, code = E0637)]
|
||||
pub(crate) struct ParentModuleResetForBinding;
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(resolve_ampersand_used_without_explicit_lifetime_name, code = E0637)]
|
||||
#[note]
|
||||
pub(crate) struct AmpersandUsedWithoutExplicitLifetimeName(#[primary_span] pub(crate) Span);
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(resolve_underscore_lifetime_name_cannot_be_used_here, code = E0637)]
|
||||
#[note]
|
||||
pub(crate) struct UnderscoreLifetimeNameCannotBeUsedHere(#[primary_span] pub(crate) Span);
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(resolve_crate_may_not_be_imported)]
|
||||
pub(crate) struct CrateMayNotBeImported(#[primary_span] pub(crate) Span);
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(resolve_crate_root_imports_must_be_named_explicitly)]
|
||||
pub(crate) struct CrateRootNamesMustBeNamedExplicitly(#[primary_span] pub(crate) Span);
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(resolve_crate_root_imports_must_be_named_explicitly)]
|
||||
pub(crate) struct ResolutionError(#[primary_span] pub(crate) Span);
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(resolve_generic_params_from_outer_item, code = E0401)]
|
||||
pub(crate) struct GenericParamsFromOuterItem {
|
||||
@ -467,19 +441,6 @@ pub(crate) struct UnreachableLabelSubLabelUnreachable {
|
||||
pub(crate) ident_span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(resolve_trait_impl_mismatch)]
|
||||
pub(crate) struct TraitImplMismatch {
|
||||
#[primary_span]
|
||||
#[label]
|
||||
pub(crate) span: Span,
|
||||
pub(crate) name: Symbol,
|
||||
pub(crate) kind: String,
|
||||
#[label(resolve_label_trait_item)]
|
||||
pub(crate) trait_item_span: Span,
|
||||
pub(crate) trait_path: String,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(resolve_invalid_asm_sym)]
|
||||
#[help]
|
||||
|
@ -107,6 +107,15 @@ impl<'a, 'tcx> ObligationCtxt<'a, 'tcx> {
|
||||
self.register_infer_ok_obligations(infer_ok)
|
||||
}
|
||||
|
||||
pub fn deeply_normalize<T: TypeFoldable<TyCtxt<'tcx>>>(
|
||||
&self,
|
||||
cause: &ObligationCause<'tcx>,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
value: T,
|
||||
) -> Result<T, Vec<FulfillmentError<'tcx>>> {
|
||||
self.infcx.at(cause, param_env).deeply_normalize(value, &mut **self.engine.borrow_mut())
|
||||
}
|
||||
|
||||
/// Makes `expected <: actual`.
|
||||
pub fn eq_exp<T>(
|
||||
&self,
|
||||
|
@ -152,6 +152,7 @@
|
||||
#![feature(set_ptr_value)]
|
||||
#![feature(sized_type_properties)]
|
||||
#![feature(slice_from_ptr_range)]
|
||||
#![feature(slice_index_methods)]
|
||||
#![feature(slice_ptr_get)]
|
||||
#![feature(slice_ptr_len)]
|
||||
#![feature(slice_range)]
|
||||
|
@ -54,7 +54,7 @@ use core::ops::Add;
|
||||
use core::ops::AddAssign;
|
||||
#[cfg(not(no_global_oom_handling))]
|
||||
use core::ops::Bound::{Excluded, Included, Unbounded};
|
||||
use core::ops::{self, Index, IndexMut, Range, RangeBounds};
|
||||
use core::ops::{self, Range, RangeBounds};
|
||||
use core::ptr;
|
||||
use core::slice;
|
||||
use core::str::pattern::Pattern;
|
||||
@ -2433,100 +2433,26 @@ impl AddAssign<&str> for String {
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl ops::Index<ops::Range<usize>> for String {
|
||||
type Output = str;
|
||||
impl<I> ops::Index<I> for String
|
||||
where
|
||||
I: slice::SliceIndex<str>,
|
||||
{
|
||||
type Output = I::Output;
|
||||
|
||||
#[inline]
|
||||
fn index(&self, index: ops::Range<usize>) -> &str {
|
||||
&self[..][index]
|
||||
fn index(&self, index: I) -> &I::Output {
|
||||
index.index(self.as_str())
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl ops::Index<ops::RangeTo<usize>> for String {
|
||||
type Output = str;
|
||||
|
||||
impl<I> ops::IndexMut<I> for String
|
||||
where
|
||||
I: slice::SliceIndex<str>,
|
||||
{
|
||||
#[inline]
|
||||
fn index(&self, index: ops::RangeTo<usize>) -> &str {
|
||||
&self[..][index]
|
||||
}
|
||||
}
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl ops::Index<ops::RangeFrom<usize>> for String {
|
||||
type Output = str;
|
||||
|
||||
#[inline]
|
||||
fn index(&self, index: ops::RangeFrom<usize>) -> &str {
|
||||
&self[..][index]
|
||||
}
|
||||
}
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl ops::Index<ops::RangeFull> for String {
|
||||
type Output = str;
|
||||
|
||||
#[inline]
|
||||
fn index(&self, _index: ops::RangeFull) -> &str {
|
||||
unsafe { str::from_utf8_unchecked(&self.vec) }
|
||||
}
|
||||
}
|
||||
#[stable(feature = "inclusive_range", since = "1.26.0")]
|
||||
impl ops::Index<ops::RangeInclusive<usize>> for String {
|
||||
type Output = str;
|
||||
|
||||
#[inline]
|
||||
fn index(&self, index: ops::RangeInclusive<usize>) -> &str {
|
||||
Index::index(&**self, index)
|
||||
}
|
||||
}
|
||||
#[stable(feature = "inclusive_range", since = "1.26.0")]
|
||||
impl ops::Index<ops::RangeToInclusive<usize>> for String {
|
||||
type Output = str;
|
||||
|
||||
#[inline]
|
||||
fn index(&self, index: ops::RangeToInclusive<usize>) -> &str {
|
||||
Index::index(&**self, index)
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "derefmut_for_string", since = "1.3.0")]
|
||||
impl ops::IndexMut<ops::Range<usize>> for String {
|
||||
#[inline]
|
||||
fn index_mut(&mut self, index: ops::Range<usize>) -> &mut str {
|
||||
&mut self[..][index]
|
||||
}
|
||||
}
|
||||
#[stable(feature = "derefmut_for_string", since = "1.3.0")]
|
||||
impl ops::IndexMut<ops::RangeTo<usize>> for String {
|
||||
#[inline]
|
||||
fn index_mut(&mut self, index: ops::RangeTo<usize>) -> &mut str {
|
||||
&mut self[..][index]
|
||||
}
|
||||
}
|
||||
#[stable(feature = "derefmut_for_string", since = "1.3.0")]
|
||||
impl ops::IndexMut<ops::RangeFrom<usize>> for String {
|
||||
#[inline]
|
||||
fn index_mut(&mut self, index: ops::RangeFrom<usize>) -> &mut str {
|
||||
&mut self[..][index]
|
||||
}
|
||||
}
|
||||
#[stable(feature = "derefmut_for_string", since = "1.3.0")]
|
||||
impl ops::IndexMut<ops::RangeFull> for String {
|
||||
#[inline]
|
||||
fn index_mut(&mut self, _index: ops::RangeFull) -> &mut str {
|
||||
unsafe { str::from_utf8_unchecked_mut(&mut *self.vec) }
|
||||
}
|
||||
}
|
||||
#[stable(feature = "inclusive_range", since = "1.26.0")]
|
||||
impl ops::IndexMut<ops::RangeInclusive<usize>> for String {
|
||||
#[inline]
|
||||
fn index_mut(&mut self, index: ops::RangeInclusive<usize>) -> &mut str {
|
||||
IndexMut::index_mut(&mut **self, index)
|
||||
}
|
||||
}
|
||||
#[stable(feature = "inclusive_range", since = "1.26.0")]
|
||||
impl ops::IndexMut<ops::RangeToInclusive<usize>> for String {
|
||||
#[inline]
|
||||
fn index_mut(&mut self, index: ops::RangeToInclusive<usize>) -> &mut str {
|
||||
IndexMut::index_mut(&mut **self, index)
|
||||
fn index_mut(&mut self, index: I) -> &mut I::Output {
|
||||
index.index_mut(self.as_mut_str())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -258,6 +258,9 @@ fn _var(key: &OsStr) -> Result<String, VarError> {
|
||||
/// None => println!("{key} is not defined in the environment.")
|
||||
/// }
|
||||
/// ```
|
||||
///
|
||||
/// If expecting a delimited variable (such as `PATH`), [`split_paths`]
|
||||
/// can be used to separate items.
|
||||
#[must_use]
|
||||
#[stable(feature = "env", since = "1.0.0")]
|
||||
pub fn var_os<K: AsRef<OsStr>>(key: K) -> Option<OsString> {
|
||||
@ -441,6 +444,16 @@ pub struct SplitPaths<'a> {
|
||||
/// Returns an iterator over the paths contained in `unparsed`. The iterator
|
||||
/// element type is [`PathBuf`].
|
||||
///
|
||||
/// On most Unix platforms, the separator is `:` and on Windows it is `;`. This
|
||||
/// also performs unquoting on Windows.
|
||||
///
|
||||
/// [`join_paths`] can be used to recombine elements.
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// This will panic on systems where there is no delimited `PATH` variable,
|
||||
/// such as UEFI.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
@ -456,6 +469,7 @@ pub struct SplitPaths<'a> {
|
||||
/// None => println!("{key} is not defined in the environment.")
|
||||
/// }
|
||||
/// ```
|
||||
#[doc(alias = "PATH")]
|
||||
#[stable(feature = "env", since = "1.0.0")]
|
||||
pub fn split_paths<T: AsRef<OsStr> + ?Sized>(unparsed: &T) -> SplitPaths<'_> {
|
||||
SplitPaths { inner: os_imp::split_paths(unparsed.as_ref()) }
|
||||
@ -496,7 +510,8 @@ pub struct JoinPathsError {
|
||||
///
|
||||
/// Returns an [`Err`] (containing an error message) if one of the input
|
||||
/// [`Path`]s contains an invalid character for constructing the `PATH`
|
||||
/// variable (a double quote on Windows or a colon on Unix).
|
||||
/// variable (a double quote on Windows or a colon on Unix), or if the system
|
||||
/// does not have a `PATH`-like variable (e.g. UEFI or WASI).
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
@ -550,6 +565,7 @@ pub struct JoinPathsError {
|
||||
/// ```
|
||||
///
|
||||
/// [`env::split_paths()`]: split_paths
|
||||
#[doc(alias = "PATH")]
|
||||
#[stable(feature = "env", since = "1.0.0")]
|
||||
pub fn join_paths<I, T>(paths: I) -> Result<OsString, JoinPathsError>
|
||||
where
|
||||
|
@ -6,7 +6,7 @@ use crate::any::Any;
|
||||
use crate::collections;
|
||||
use crate::panicking;
|
||||
use crate::sync::atomic::{AtomicU8, Ordering};
|
||||
use crate::sync::{Mutex, RwLock};
|
||||
use crate::sync::{Condvar, Mutex, RwLock};
|
||||
use crate::thread::Result;
|
||||
|
||||
#[doc(hidden)]
|
||||
@ -67,11 +67,15 @@ pub fn panic_any<M: 'static + Any + Send>(msg: M) -> ! {
|
||||
impl<T: ?Sized> UnwindSafe for Mutex<T> {}
|
||||
#[stable(feature = "catch_unwind", since = "1.9.0")]
|
||||
impl<T: ?Sized> UnwindSafe for RwLock<T> {}
|
||||
#[stable(feature = "catch_unwind", since = "1.9.0")]
|
||||
impl UnwindSafe for Condvar {}
|
||||
|
||||
#[stable(feature = "unwind_safe_lock_refs", since = "1.12.0")]
|
||||
impl<T: ?Sized> RefUnwindSafe for Mutex<T> {}
|
||||
#[stable(feature = "unwind_safe_lock_refs", since = "1.12.0")]
|
||||
impl<T: ?Sized> RefUnwindSafe for RwLock<T> {}
|
||||
#[stable(feature = "unwind_safe_lock_refs", since = "1.12.0")]
|
||||
impl RefUnwindSafe for Condvar {}
|
||||
|
||||
// https://github.com/rust-lang/rust/issues/62301
|
||||
#[stable(feature = "hashbrown", since = "1.36.0")]
|
||||
|
@ -547,6 +547,9 @@ impl<T> Channel<T> {
|
||||
}
|
||||
|
||||
let mut head = self.head.index.load(Ordering::Acquire);
|
||||
// The channel may be uninitialized, so we have to swap to avoid overwriting any sender's attempts
|
||||
// to initalize the first block before noticing that the receivers disconnected. Late allocations
|
||||
// will be deallocated by the sender in Drop.
|
||||
let mut block = self.head.block.swap(ptr::null_mut(), Ordering::AcqRel);
|
||||
|
||||
// If we're going to be dropping messages we need to synchronize with initialization
|
||||
|
@ -18,7 +18,7 @@ help: to apply to the crate, use an inner attribute
|
||||
LL | #![doc(cfg_hide(doc))]
|
||||
| +
|
||||
|
||||
error: `#[doc(cfg_hide(...)]` takes a list of attributes
|
||||
error: `#[doc(cfg_hide(...))]` takes a list of attributes
|
||||
--> $DIR/doc_cfg_hide.rs:4:8
|
||||
|
|
||||
LL | #![doc(cfg_hide = "test")]
|
||||
@ -27,7 +27,7 @@ LL | #![doc(cfg_hide = "test")]
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
|
||||
|
||||
error: `#[doc(cfg_hide(...)]` takes a list of attributes
|
||||
error: `#[doc(cfg_hide(...))]` takes a list of attributes
|
||||
--> $DIR/doc_cfg_hide.rs:6:8
|
||||
|
|
||||
LL | #![doc(cfg_hide)]
|
||||
|
20
tests/ui/impl-trait/in-trait/refine-normalize.rs
Normal file
20
tests/ui/impl-trait/in-trait/refine-normalize.rs
Normal file
@ -0,0 +1,20 @@
|
||||
//@ check-pass
|
||||
//@ edition: 2021
|
||||
//@ revisions: current next
|
||||
//@[next] compile-flags: -Znext-solver
|
||||
|
||||
#![deny(refining_impl_trait)]
|
||||
|
||||
pub trait Foo {
|
||||
type Item;
|
||||
|
||||
fn hello() -> impl Iterator<Item = Self::Item>;
|
||||
}
|
||||
|
||||
impl Foo for () {
|
||||
type Item = ();
|
||||
|
||||
fn hello() -> impl Iterator<Item = ()> { [()].into_iter() }
|
||||
}
|
||||
|
||||
fn main() {}
|
@ -673,6 +673,12 @@ compiler = [
|
||||
libs = [
|
||||
"@cuviper",
|
||||
"@Mark-Simulacrum",
|
||||
"@m-ou-se",
|
||||
"@Amanieu",
|
||||
"@Nilstrieb",
|
||||
"@workingjubilee",
|
||||
"@joboet",
|
||||
"@jhpratt",
|
||||
]
|
||||
bootstrap = [
|
||||
"@Mark-Simulacrum",
|
||||
@ -810,7 +816,7 @@ project-stable-mir = [
|
||||
"/compiler/rustc_type_ir" = ["compiler", "types"]
|
||||
"/compiler/stable_mir" = ["project-stable-mir"]
|
||||
"/library/alloc" = ["libs"]
|
||||
"/library/core" = ["libs"]
|
||||
"/library/core" = ["libs", "@scottmcm"]
|
||||
"/library/panic_abort" = ["libs"]
|
||||
"/library/panic_unwind" = ["libs"]
|
||||
"/library/proc_macro" = ["@petrochenkov"]
|
||||
|
Loading…
Reference in New Issue
Block a user