Auto merge of #136135 - GuillaumeGomez:rollup-1ik636d, r=GuillaumeGomez

Rollup of 10 pull requests

Successful merges:

 - #135773 (Clarify WindowsMut (Lending)Iterator)
 - #135807 (Implement phantom variance markers)
 - #135876 (fix doc for std::sync::mpmc)
 - #135988 (Add a workaround for parallel rustc crashing when there are delayed bugs)
 - #136037 (Mark all NuttX targets as tier 3 target and support the standard library)
 - #136064 (Add a suggestion to cast target_feature fn items to fn pointers.)
 - #136082 (Incorporate `iter_nodes` into `graph::DirectedGraph`)
 - #136112 (Clean up all dead files inside `tests/ui/`)
 - #136114 (Use identifiers more in diagnostics code)
 - #136118 (Change `collect_and_partition_mono_items` tuple return type to a struct)

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors 2025-01-27 17:50:34 +00:00
commit ebcf860e73
150 changed files with 632 additions and 3852 deletions

View File

@ -157,7 +157,7 @@ pub(crate) fn expand_deriving_coerce_pointee(
{
cx.dcx().emit_err(RequiresMaybeSized {
span: pointee_ty_ident.span,
name: pointee_ty_ident.name.to_ident_string(),
name: pointee_ty_ident,
});
return;
}
@ -471,5 +471,5 @@ struct TooManyPointees {
struct RequiresMaybeSized {
#[primary_span]
span: Span,
name: String,
name: Ident,
}

View File

@ -676,7 +676,7 @@ pub(crate) fn run_aot(
.to_owned();
let cgus = if tcx.sess.opts.output_types.should_codegen() {
tcx.collect_and_partition_mono_items(()).1
tcx.collect_and_partition_mono_items(()).codegen_units
} else {
// If only `--emit metadata` is used, we shouldn't perform any codegen.
// Also `tcx.collect_and_partition_mono_items` may panic in that case.

View File

@ -9,6 +9,7 @@ use rustc_data_structures::fx::{FxHashSet, FxIndexMap};
use rustc_hir::def_id::{DefId, LocalDefId};
use rustc_index::IndexVec;
use rustc_middle::mir;
use rustc_middle::mir::mono::MonoItemPartitions;
use rustc_middle::ty::{self, TyCtxt};
use rustc_session::RemapFileNameExt;
use rustc_session::config::RemapPathScopeComponents;
@ -297,12 +298,13 @@ struct UsageSets<'tcx> {
/// Prepare sets of definitions that are relevant to deciding whether something
/// is an "unused function" for coverage purposes.
fn prepare_usage_sets<'tcx>(tcx: TyCtxt<'tcx>) -> UsageSets<'tcx> {
let (all_mono_items, cgus) = tcx.collect_and_partition_mono_items(());
let MonoItemPartitions { all_mono_items, codegen_units } =
tcx.collect_and_partition_mono_items(());
// Obtain a MIR body for each function participating in codegen, via an
// arbitrary instance.
let mut def_ids_seen = FxHashSet::default();
let def_and_mir_for_all_mono_fns = cgus
let def_and_mir_for_all_mono_fns = codegen_units
.iter()
.flat_map(|cgu| cgu.items().keys())
.filter_map(|item| match item {

View File

@ -46,8 +46,12 @@ pub fn assert_module_sources(tcx: TyCtxt<'_>, set_reuse: &dyn Fn(&mut CguReuseTr
return;
}
let available_cgus =
tcx.collect_and_partition_mono_items(()).1.iter().map(|cgu| cgu.name()).collect();
let available_cgus = tcx
.collect_and_partition_mono_items(())
.codegen_units
.iter()
.map(|cgu| cgu.name())
.collect();
let mut ams = AssertModuleSource {
tcx,

View File

@ -293,7 +293,7 @@ fn exported_symbols_provider_local(
// external linkage is enough for monomorphization to be linked to.
let need_visibility = tcx.sess.target.dynamic_linking && !tcx.sess.target.only_cdylib;
let (_, cgus) = tcx.collect_and_partition_mono_items(());
let cgus = tcx.collect_and_partition_mono_items(()).codegen_units;
// The symbols created in this loop are sorted below it
#[allow(rustc::potential_query_instability)]

View File

@ -619,7 +619,7 @@ pub fn codegen_crate<B: ExtraBackendMethods>(
// Run the monomorphization collector and partition the collected items into
// codegen units.
let codegen_units = tcx.collect_and_partition_mono_items(()).1;
let codegen_units = tcx.collect_and_partition_mono_items(()).codegen_units;
// Force all codegen_unit queries so they are already either red or green
// when compile_codegen_unit accesses them. We are not able to re-execute
@ -1051,7 +1051,7 @@ pub(crate) fn provide(providers: &mut Providers) {
config::OptLevel::SizeMin => config::OptLevel::Default,
};
let (defids, _) = tcx.collect_and_partition_mono_items(cratenum);
let defids = tcx.collect_and_partition_mono_items(cratenum).all_mono_items;
let any_for_speed = defids.items().any(|id| {
let CodegenFnAttrs { optimize, .. } = tcx.codegen_fn_attrs(*id);

View File

@ -14,7 +14,23 @@ mod tests;
pub trait DirectedGraph {
type Node: Idx;
/// Returns the total number of nodes in this graph.
///
/// Several graph algorithm implementations assume that every node ID is
/// strictly less than the number of nodes, i.e. nodes are densely numbered.
/// That assumption allows them to use `num_nodes` to allocate per-node
/// data structures, indexed by node.
fn num_nodes(&self) -> usize;
/// Iterates over all nodes of a graph in ascending numeric order.
///
/// Assumes that nodes are densely numbered, i.e. every index in
/// `0..num_nodes` is a valid node.
fn iter_nodes(
&self,
) -> impl Iterator<Item = Self::Node> + DoubleEndedIterator + ExactSizeIterator {
(0..self.num_nodes()).map(<Self::Node as Idx>::new)
}
}
pub trait NumEdges: DirectedGraph {

View File

@ -333,8 +333,8 @@ where
to_annotation,
};
let scc_indices = (0..num_nodes)
.map(G::Node::new)
let scc_indices = graph
.iter_nodes()
.map(|node| match this.start_walk_from(node) {
WalkReturn::Complete { scc_index, .. } => scc_index,
WalkReturn::Cycle { min_depth, .. } => {

View File

@ -2362,7 +2362,7 @@ fn try_report_async_mismatch<'tcx>(
// the right span is a bit difficult.
return Err(tcx.sess.dcx().emit_err(MethodShouldReturnFuture {
span: tcx.def_span(impl_m.def_id),
method_name: trait_m.name,
method_name: tcx.item_ident(impl_m.def_id),
trait_item_span: tcx.hir().span_if_local(trait_m.def_id),
}));
}

View File

@ -197,7 +197,7 @@ fn maybe_check_static_with_link_section(tcx: TyCtxt<'_>, id: LocalDefId) {
fn report_forbidden_specialization(tcx: TyCtxt<'_>, impl_item: DefId, parent_impl: DefId) {
let span = tcx.def_span(impl_item);
let ident = tcx.item_name(impl_item);
let ident = tcx.item_ident(impl_item);
let err = match tcx.span_of_impl(parent_impl) {
Ok(sp) => errors::ImplNotMarkedDefault::Ok { span, ident, ok_label: sp },
@ -297,7 +297,7 @@ fn default_body_is_unstable(
reason: Option<Symbol>,
issue: Option<NonZero<u32>>,
) {
let missing_item_name = tcx.associated_item(item_did).name;
let missing_item_name = tcx.item_ident(item_did);
let (mut some_note, mut none_note, mut reason_str) = (false, false, String::new());
match reason {
Some(r) => {

View File

@ -292,7 +292,7 @@ fn visit_implementation_of_dispatch_from_dyn(checker: &Checker<'_>) -> Result<()
res = Err(tcx.dcx().emit_err(errors::DispatchFromDynZST {
span,
name: field.name,
name: field.ident(tcx),
ty: ty_a,
}));

View File

@ -465,8 +465,8 @@ fn emit_orphan_check_error<'tcx>(
traits::OrphanCheckErr::UncoveredTyParams(UncoveredTyParams { uncovered, local_ty }) => {
let mut reported = None;
for param_def_id in uncovered {
let span = tcx.def_ident_span(param_def_id).unwrap();
let name = tcx.item_name(param_def_id);
let name = tcx.item_ident(param_def_id);
let span = name.span;
reported.get_or_insert(match local_ty {
Some(local_type) => tcx.dcx().emit_err(errors::TyParamFirstLocal {
@ -492,7 +492,7 @@ fn lint_uncovered_ty_params<'tcx>(
for param_def_id in uncovered {
let span = tcx.def_ident_span(param_def_id).unwrap();
let name = tcx.item_name(param_def_id);
let name = tcx.item_ident(param_def_id);
match local_ty {
Some(local_type) => tcx.emit_node_span_lint(

View File

@ -928,7 +928,7 @@ fn lower_enum_variant_types(tcx: TyCtxt<'_>, def_id: DefId) {
tcx.dcx().emit_err(errors::EnumDiscriminantOverflowed {
span,
discr: prev_discr.unwrap().to_string(),
item_name: tcx.item_name(variant.def_id),
item_name: tcx.item_ident(variant.def_id),
wrapped_discr: wrapped_discr.to_string(),
});
None
@ -990,11 +990,10 @@ impl<'tcx> FieldUniquenessCheckContext<'tcx> {
}
/// Check if a given field `ident` declared at `field_decl` has been declared elsewhere before.
fn check_field_decl(&mut self, ident: Ident, field_decl: FieldDeclSpan) {
fn check_field_decl(&mut self, field_name: Ident, field_decl: FieldDeclSpan) {
use FieldDeclSpan::*;
let field_name = ident.name;
let ident = ident.normalize_to_macros_2_0();
match (field_decl, self.seen_fields.get(&ident).copied()) {
let field_name = field_name.normalize_to_macros_2_0();
match (field_decl, self.seen_fields.get(&field_name).copied()) {
(NotNested(span), Some(NotNested(prev_span))) => {
self.tcx.dcx().emit_err(errors::FieldAlreadyDeclared::NotNested {
field_name,
@ -1035,7 +1034,7 @@ impl<'tcx> FieldUniquenessCheckContext<'tcx> {
});
}
(field_decl, None) => {
self.seen_fields.insert(ident, field_decl);
self.seen_fields.insert(field_name, field_decl);
}
}
}

View File

@ -55,7 +55,7 @@ pub(super) fn find_opaque_ty_constraints_for_impl_trait_in_assoc_type(
} else {
let reported = tcx.dcx().emit_err(UnconstrainedOpaqueType {
span: tcx.def_span(def_id),
name: tcx.item_name(parent_def_id.to_def_id()),
name: tcx.item_ident(parent_def_id.to_def_id()),
what: "impl",
});
Ty::new_error(tcx, reported)
@ -136,7 +136,7 @@ pub(super) fn find_opaque_ty_constraints_for_tait(tcx: TyCtxt<'_>, def_id: Local
}
let reported = tcx.dcx().emit_err(UnconstrainedOpaqueType {
span: tcx.def_span(def_id),
name: tcx.item_name(parent_def_id.to_def_id()),
name: tcx.item_ident(parent_def_id.to_def_id()),
what: match tcx.hir_node(scope) {
_ if scope == hir::CRATE_HIR_ID => "module",
Node::Item(hir::Item { kind: hir::ItemKind::Mod(_), .. }) => "module",

View File

@ -217,7 +217,7 @@ pub(crate) struct DropImplOnWrongItem {
pub(crate) enum FieldAlreadyDeclared {
#[diag(hir_analysis_field_already_declared, code = E0124)]
NotNested {
field_name: Symbol,
field_name: Ident,
#[primary_span]
#[label]
span: Span,
@ -226,7 +226,7 @@ pub(crate) enum FieldAlreadyDeclared {
},
#[diag(hir_analysis_field_already_declared_current_nested)]
CurrentNested {
field_name: Symbol,
field_name: Ident,
#[primary_span]
#[label]
span: Span,
@ -239,7 +239,7 @@ pub(crate) enum FieldAlreadyDeclared {
},
#[diag(hir_analysis_field_already_declared_previous_nested)]
PreviousNested {
field_name: Symbol,
field_name: Ident,
#[primary_span]
#[label]
span: Span,
@ -252,7 +252,7 @@ pub(crate) enum FieldAlreadyDeclared {
},
#[diag(hir_analysis_field_already_declared_both_nested)]
BothNested {
field_name: Symbol,
field_name: Ident,
#[primary_span]
#[label]
span: Span,
@ -418,7 +418,7 @@ pub(crate) struct ValueOfAssociatedStructAlreadySpecified {
pub(crate) struct UnconstrainedOpaqueType {
#[primary_span]
pub span: Span,
pub name: Symbol,
pub name: Ident,
pub what: &'static str,
}
@ -802,7 +802,7 @@ pub(crate) struct EnumDiscriminantOverflowed {
#[label]
pub span: Span,
pub discr: String,
pub item_name: Symbol,
pub item_name: Ident,
pub wrapped_discr: String,
}
@ -893,7 +893,7 @@ pub(crate) enum ImplNotMarkedDefault {
span: Span,
#[label(hir_analysis_ok_label)]
ok_label: Span,
ident: Symbol,
ident: Ident,
},
#[diag(hir_analysis_impl_not_marked_default_err, code = E0520)]
#[note]
@ -901,7 +901,7 @@ pub(crate) enum ImplNotMarkedDefault {
#[primary_span]
span: Span,
cname: Symbol,
ident: Symbol,
ident: Ident,
},
}
@ -977,7 +977,7 @@ pub(crate) struct MissingTraitItemUnstable {
pub some_note: bool,
#[note(hir_analysis_none_note)]
pub none_note: bool,
pub missing_item_name: Symbol,
pub missing_item_name: Ident,
pub feature: Symbol,
pub reason: String,
}
@ -1249,7 +1249,7 @@ pub(crate) struct InherentNominal {
pub(crate) struct DispatchFromDynZST<'a> {
#[primary_span]
pub span: Span,
pub name: Symbol,
pub name: Ident,
pub ty: Ty<'a>,
}
@ -1389,7 +1389,7 @@ pub(crate) struct TyParamFirstLocal<'tcx> {
pub span: Span,
#[note(hir_analysis_case_note)]
pub note: (),
pub param: Symbol,
pub param: Ident,
pub local_type: Ty<'tcx>,
}
@ -1401,7 +1401,7 @@ pub(crate) struct TyParamFirstLocalLint<'tcx> {
pub span: Span,
#[note(hir_analysis_case_note)]
pub note: (),
pub param: Symbol,
pub param: Ident,
pub local_type: Ty<'tcx>,
}
@ -1414,7 +1414,7 @@ pub(crate) struct TyParamSome {
pub span: Span,
#[note(hir_analysis_only_note)]
pub note: (),
pub param: Symbol,
pub param: Ident,
}
#[derive(LintDiagnostic)]
@ -1425,7 +1425,7 @@ pub(crate) struct TyParamSomeLint {
pub span: Span,
#[note(hir_analysis_only_note)]
pub note: (),
pub param: Symbol,
pub param: Ident,
}
#[derive(Diagnostic)]
@ -1533,7 +1533,7 @@ pub(crate) struct UnsupportedDelegation<'a> {
pub(crate) struct MethodShouldReturnFuture {
#[primary_span]
pub span: Span,
pub method_name: Symbol,
pub method_name: Ident,
#[note]
pub trait_item_span: Option<Span>,
}
@ -1585,7 +1585,7 @@ pub(crate) struct UnconstrainedGenericParameter {
#[primary_span]
#[label]
pub span: Span,
pub param_name: Symbol,
pub param_name: Ident,
pub param_def_kind: &'static str,
#[note(hir_analysis_const_param_note)]
pub const_param_note: bool,

View File

@ -495,7 +495,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {
.iter()
.any(|constraint| constraint.ident.name == item.name)
})
.map(|item| item.name.to_ident_string())
.map(|item| self.tcx.item_ident(item.def_id).to_string())
.collect()
} else {
Vec::default()

View File

@ -152,7 +152,7 @@ pub(crate) fn enforce_impl_lifetime_params_are_constrained(
{
let mut diag = tcx.dcx().create_err(UnconstrainedGenericParameter {
span: tcx.def_span(param.def_id),
param_name: param.name,
param_name: tcx.item_ident(param.def_id),
param_def_kind: tcx.def_descr(param.def_id),
const_param_note: false,
const_param_note2: false,
@ -223,7 +223,7 @@ pub(crate) fn enforce_impl_non_lifetime_params_are_constrained(
let const_param_note = matches!(param.kind, ty::GenericParamDefKind::Const { .. });
let mut diag = tcx.dcx().create_err(UnconstrainedGenericParameter {
span: tcx.def_span(param.def_id),
param_name: param.name,
param_name: tcx.item_ident(param.def_id),
param_def_kind: tcx.def_descr(param.def_id),
const_param_note,
const_param_note2: const_param_note,

View File

@ -3337,10 +3337,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
})
.map(|mut field_path| {
field_path.pop();
field_path
.iter()
.map(|id| format!("{}.", id.name.to_ident_string()))
.collect::<String>()
field_path.iter().map(|id| format!("{}.", id)).collect::<String>()
})
.collect::<Vec<_>>();
candidate_fields.sort();

View File

@ -453,7 +453,7 @@ fn report_unexpected_variant_res(
);
let fields = fields
.iter()
.map(|field| format!("{}: _", field.name.to_ident_string()))
.map(|field| format!("{}: _", field.ident(tcx)))
.collect::<Vec<_>>()
.join(", ");
let sugg = format!(" {{ {} }}", fields);

View File

@ -2714,7 +2714,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
.map(|field_path| {
field_path
.iter()
.map(|id| id.name.to_ident_string())
.map(|id| id.to_string())
.collect::<Vec<String>>()
.join(".")
})

View File

@ -141,7 +141,7 @@ fn lint_expr(cx: &LateContext<'_>, expr: &Expr<'_>) {
expr.hir_id,
method.ident.span,
DanglingPointersFromTemporaries {
callee: method.ident.name,
callee: method.ident,
ty,
ptr_span: method.ident.span,
temporary_span: receiver.span,

View File

@ -1150,7 +1150,7 @@ pub(crate) struct IgnoredUnlessCrateSpecified<'a> {
#[help(lint_help_visit)]
// FIXME: put #[primary_span] on `ptr_span` once it does not cause conflicts
pub(crate) struct DanglingPointersFromTemporaries<'tcx> {
pub callee: Symbol,
pub callee: Ident,
pub ty: Ty<'tcx>,
#[label(lint_label_ptr)]
pub ptr_span: Span,
@ -1351,7 +1351,7 @@ pub(crate) enum NonUpperCaseGlobalSub {
#[diag(lint_noop_method_call)]
#[note]
pub(crate) struct NoopMethodCallDiag<'a> {
pub method: Symbol,
pub method: Ident,
pub orig_ty: Ty<'a>,
pub trait_: Symbol,
#[suggestion(code = "", applicability = "machine-applicable")]

View File

@ -343,5 +343,5 @@ fn path_span_without_args(path: &Path<'_>) -> Span {
/// Return a "error message-able" ident for the last segment of the `Path`
fn path_name_to_string(path: &Path<'_>) -> String {
path.segments.last().unwrap().ident.name.to_ident_string()
path.segments.last().unwrap().ident.to_string()
}

View File

@ -129,7 +129,7 @@ impl<'tcx> LateLintPass<'tcx> for NoopMethodCall {
_ => None,
};
cx.emit_span_lint(NOOP_METHOD_CALL, span, NoopMethodCallDiag {
method: call.ident.name,
method: call.ident,
orig_ty,
trait_,
label: span,

View File

@ -45,7 +45,7 @@ fn path_for_pass_by_value(cx: &LateContext<'_>, ty: &hir::Ty<'_>) -> Option<Stri
if let TyKind::Path(QPath::Resolved(_, path)) = &ty.kind {
match path.res {
Res::Def(_, def_id) if cx.tcx.has_attr(def_id, sym::rustc_pass_by_value) => {
let name = cx.tcx.item_name(def_id).to_ident_string();
let name = cx.tcx.item_ident(def_id);
let path_segment = path.segments.last().unwrap();
return Some(format!("{}{}", name, gen_args(cx, path_segment)));
}

View File

@ -8,7 +8,7 @@ use rustc_data_structures::fx::FxIndexMap;
use rustc_data_structures::stable_hasher::{Hash128, HashStable, StableHasher, ToStableHashKey};
use rustc_data_structures::unord::UnordMap;
use rustc_hir::ItemId;
use rustc_hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
use rustc_hir::def_id::{CrateNum, DefId, DefIdSet, LOCAL_CRATE};
use rustc_index::Idx;
use rustc_macros::{HashStable, TyDecodable, TyEncodable};
use rustc_query_system::ich::StableHashingContext;
@ -247,6 +247,12 @@ impl ToStableHashKey<StableHashingContext<'_>> for MonoItem<'_> {
}
}
#[derive(Debug, HashStable, Copy, Clone)]
pub struct MonoItemPartitions<'tcx> {
pub codegen_units: &'tcx [CodegenUnit<'tcx>],
pub all_mono_items: &'tcx DefIdSet,
}
#[derive(Debug, HashStable)]
pub struct CodegenUnit<'tcx> {
/// A name for this CGU. Incremental compilation requires that

View File

@ -349,6 +349,7 @@ tcx_lifetime! {
rustc_middle::mir::interpret::GlobalId,
rustc_middle::mir::interpret::LitToConstInput,
rustc_middle::mir::interpret::EvalStaticInitializerRawResult,
rustc_middle::mir::mono::MonoItemPartitions,
rustc_middle::traits::query::MethodAutoderefStepsResult,
rustc_middle::traits::query::type_op::AscribeUserType,
rustc_middle::traits::query::type_op::Eq,

View File

@ -23,7 +23,7 @@ use rustc_data_structures::unord::{UnordMap, UnordSet};
use rustc_errors::ErrorGuaranteed;
use rustc_hir::def::{DefKind, DocLinkResMap};
use rustc_hir::def_id::{
CrateNum, DefId, DefIdMap, DefIdSet, LocalDefId, LocalDefIdMap, LocalDefIdSet, LocalModDefId,
CrateNum, DefId, DefIdMap, LocalDefId, LocalDefIdMap, LocalDefIdSet, LocalModDefId,
};
use rustc_hir::lang_items::{LangItem, LanguageItems};
use rustc_hir::{Crate, ItemLocalId, ItemLocalMap, TraitCandidate};
@ -58,7 +58,7 @@ use crate::mir::interpret::{
EvalStaticInitializerRawResult, EvalToAllocationRawResult, EvalToConstValueResult,
EvalToValTreeResult, GlobalId, LitToConstInput,
};
use crate::mir::mono::{CodegenUnit, CollectionMode, MonoItem};
use crate::mir::mono::{CodegenUnit, CollectionMode, MonoItem, MonoItemPartitions};
use crate::query::erase::{Erase, erase, restore};
use crate::query::plumbing::{
CyclePlaceholder, DynamicQuery, query_ensure, query_ensure_error_guaranteed, query_get_at,
@ -2166,7 +2166,7 @@ rustc_queries! {
separate_provide_extern
}
query collect_and_partition_mono_items(_: ()) -> (&'tcx DefIdSet, &'tcx [CodegenUnit<'tcx>]) {
query collect_and_partition_mono_items(_: ()) -> MonoItemPartitions<'tcx> {
eval_always
desc { "collect_and_partition_mono_items" }
}

View File

@ -1349,6 +1349,33 @@ pub struct GlobalCtxt<'tcx> {
/// Stores memory for globals (statics/consts).
pub(crate) alloc_map: Lock<interpret::AllocMap<'tcx>>,
current_gcx: CurrentGcx,
}
impl<'tcx> GlobalCtxt<'tcx> {
/// Installs `self` in a `TyCtxt` and `ImplicitCtxt` for the duration of
/// `f`.
pub fn enter<F, R>(&'tcx self, f: F) -> R
where
F: FnOnce(TyCtxt<'tcx>) -> R,
{
let icx = tls::ImplicitCtxt::new(self);
// Reset `current_gcx` to `None` when we exit.
let _on_drop = defer(move || {
*self.current_gcx.value.write() = None;
});
// Set this `GlobalCtxt` as the current one.
{
let mut guard = self.current_gcx.value.write();
assert!(guard.is_none(), "no `GlobalCtxt` is currently set");
*guard = Some(self as *const _ as *const ());
}
tls::enter_context(&icx, || f(icx.tcx))
}
}
/// This is used to get a reference to a `GlobalCtxt` if one is available.
@ -1539,23 +1566,11 @@ impl<'tcx> TyCtxt<'tcx> {
canonical_param_env_cache: Default::default(),
data_layout,
alloc_map: Lock::new(interpret::AllocMap::new()),
current_gcx,
});
let icx = tls::ImplicitCtxt::new(&gcx);
// Reset `current_gcx` to `None` when we exit.
let _on_drop = defer(|| {
*current_gcx.value.write() = None;
});
// Set this `GlobalCtxt` as the current one.
{
let mut guard = current_gcx.value.write();
assert!(guard.is_none(), "no `GlobalCtxt` is currently set");
*guard = Some(&gcx as *const _ as *const ());
}
tls::enter_context(&icx, || f(icx.tcx))
// This is a separate function to work around a crash with parallel rustc (#135870)
gcx.enter(f)
}
/// Obtain all lang items of this crate and all dependencies (recursively)

View File

@ -1596,6 +1596,15 @@ impl<'tcx> TyCtxt<'tcx> {
Some(Ident::new(def, span))
}
/// Look up the name and span of a definition.
///
/// See [`item_name`][Self::item_name] for more information.
pub fn item_ident(self, def_id: DefId) -> Ident {
self.opt_item_ident(def_id).unwrap_or_else(|| {
bug!("item_ident: no name for {:?}", self.def_path(def_id));
})
}
pub fn opt_associated_item(self, def_id: DefId) -> Option<AssocItem> {
if let DefKind::AssocConst | DefKind::AssocFn | DefKind::AssocTy = self.def_kind(def_id) {
Some(self.associated_item(def_id))

View File

@ -7,7 +7,7 @@ use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic};
use rustc_middle::ty::{self, Ty};
use rustc_pattern_analysis::errors::Uncovered;
use rustc_pattern_analysis::rustc::RustcPatCtxt;
use rustc_span::{Span, Symbol};
use rustc_span::{Ident, Span, Symbol};
use crate::fluent_generated as fluent;
@ -753,7 +753,7 @@ pub(crate) struct BindingsWithVariantName {
#[suggestion(code = "{ty_path}::{name}", applicability = "machine-applicable")]
pub(crate) suggestion: Option<Span>,
pub(crate) ty_path: String,
pub(crate) name: Symbol,
pub(crate) name: Ident,
}
#[derive(LintDiagnostic)]
@ -797,7 +797,7 @@ pub(crate) struct BorrowOfMovedValue {
pub(crate) binding_span: Span,
#[label(mir_build_value_borrowed_label)]
pub(crate) conflicts_ref: Vec<Span>,
pub(crate) name: Symbol,
pub(crate) name: Ident,
pub(crate) ty: String,
#[suggestion(code = "ref ", applicability = "machine-applicable")]
pub(crate) suggest_borrowing: Option<Span>,

View File

@ -25,7 +25,7 @@ use rustc_session::lint::builtin::{
};
use rustc_span::edit_distance::find_best_match_for_name;
use rustc_span::hygiene::DesugaringKind;
use rustc_span::{Span, sym};
use rustc_span::{Ident, Span, sym};
use rustc_trait_selection::infer::InferCtxtExt;
use tracing::instrument;
@ -800,7 +800,7 @@ fn check_borrow_conflicts_in_at_patterns<'tcx>(cx: &MatchVisitor<'_, 'tcx>, pat:
sess.dcx().emit_err(BorrowOfMovedValue {
binding_span: pat.span,
conflicts_ref,
name,
name: Ident::new(name, pat.span),
ty,
suggest_borrowing: Some(pat.span.shrink_to_lo()),
has_path: path.is_some(),
@ -908,7 +908,7 @@ fn check_for_bindings_named_same_as_variants(
None
},
ty_path,
name,
name: Ident::new(name, pat.span),
},
)
}

View File

@ -10,14 +10,12 @@ use rustc_index::bit_set::DenseBitSet;
use rustc_middle::mir::coverage::{CounterId, CovTerm, Expression, ExpressionId, Op};
use crate::coverage::counters::balanced_flow::BalancedFlowGraph;
use crate::coverage::counters::iter_nodes::IterNodes;
use crate::coverage::counters::node_flow::{
CounterTerm, NodeCounters, make_node_counters, node_flow_data_for_balanced_graph,
};
use crate::coverage::graph::{BasicCoverageBlock, CoverageGraph};
mod balanced_flow;
mod iter_nodes;
mod node_flow;
mod union_find;

View File

@ -20,8 +20,6 @@ use rustc_data_structures::graph::reversed::ReversedGraph;
use rustc_index::Idx;
use rustc_index::bit_set::DenseBitSet;
use crate::coverage::counters::iter_nodes::IterNodes;
/// A view of an underlying graph that has been augmented to have “balanced flow”.
/// This means that the flow (execution count) of each node is equal to the
/// sum of its in-edge flows, and also equal to the sum of its out-edge flows.

View File

@ -1,16 +0,0 @@
use rustc_data_structures::graph;
use rustc_index::Idx;
pub(crate) trait IterNodes: graph::DirectedGraph {
/// Iterates over all nodes of a graph in ascending numeric order.
/// Assumes that nodes are densely numbered, i.e. every index in
/// `0..num_nodes` is a valid node.
///
/// FIXME: Can this just be part of [`graph::DirectedGraph`]?
fn iter_nodes(
&self,
) -> impl Iterator<Item = Self::Node> + DoubleEndedIterator + ExactSizeIterator {
(0..self.num_nodes()).map(<Self::Node as Idx>::new)
}
}
impl<G: graph::DirectedGraph> IterNodes for G {}

View File

@ -11,7 +11,6 @@ use rustc_index::bit_set::DenseBitSet;
use rustc_index::{Idx, IndexSlice, IndexVec};
use rustc_middle::mir::coverage::Op;
use crate::coverage::counters::iter_nodes::IterNodes;
use crate::coverage::counters::union_find::UnionFind;
#[cfg(test)]

View File

@ -5,7 +5,7 @@ use rustc_middle::mir::AssertKind;
use rustc_middle::ty::TyCtxt;
use rustc_session::lint::{self, Lint};
use rustc_span::def_id::DefId;
use rustc_span::{Span, Symbol};
use rustc_span::{Ident, Span, Symbol};
use crate::fluent_generated as fluent;
@ -114,7 +114,7 @@ pub(crate) struct FnItemRef {
#[suggestion(code = "{sugg}", applicability = "unspecified")]
pub span: Span,
pub sugg: String,
pub ident: String,
pub ident: Ident,
}
#[derive(Diagnostic)]

View File

@ -168,7 +168,7 @@ impl<'tcx> FunctionItemRefChecker<'_, 'tcx> {
s
}
};
let ident = self.tcx.item_name(fn_id).to_ident_string();
let ident = self.tcx.item_ident(fn_id);
let ty_params = fn_args.types().map(|ty| format!("{ty}"));
let const_params = fn_args.consts().map(|c| format!("{c}"));
let params = ty_params.chain(const_params).join(", ");
@ -177,7 +177,7 @@ impl<'tcx> FunctionItemRefChecker<'_, 'tcx> {
let ret = if fn_sig.output().skip_binder().is_unit() { "" } else { " -> _" };
let sugg = format!(
"{} as {}{}fn({}{}){}",
if params.is_empty() { ident.clone() } else { format!("{ident}::<{params}>") },
if params.is_empty() { ident.to_string() } else { format!("{ident}::<{params}>") },
unsafety,
abi,
vec!["_"; num_args].join(", "),

View File

@ -110,7 +110,7 @@ use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags;
use rustc_middle::middle::exported_symbols::{SymbolExportInfo, SymbolExportLevel};
use rustc_middle::mir::mono::{
CodegenUnit, CodegenUnitNameBuilder, InstantiationMode, Linkage, MonoItem, MonoItemData,
Visibility,
MonoItemPartitions, Visibility,
};
use rustc_middle::ty::print::{characteristic_def_id_of_type, with_no_trimmed_paths};
use rustc_middle::ty::{self, InstanceKind, TyCtxt};
@ -1114,7 +1114,7 @@ where
}
}
fn collect_and_partition_mono_items(tcx: TyCtxt<'_>, (): ()) -> (&DefIdSet, &[CodegenUnit<'_>]) {
fn collect_and_partition_mono_items(tcx: TyCtxt<'_>, (): ()) -> MonoItemPartitions<'_> {
let collection_strategy = match tcx.sess.opts.unstable_opts.print_mono_items {
Some(ref s) => {
let mode = s.to_lowercase();
@ -1236,7 +1236,7 @@ fn collect_and_partition_mono_items(tcx: TyCtxt<'_>, (): ()) -> (&DefIdSet, &[Co
}
}
(tcx.arena.alloc(mono_items), codegen_units)
MonoItemPartitions { all_mono_items: tcx.arena.alloc(mono_items), codegen_units }
}
/// Outputs stats about instantiation counts and estimated size, per `MonoItem`'s
@ -1319,14 +1319,13 @@ fn dump_mono_items_stats<'tcx>(
pub(crate) fn provide(providers: &mut Providers) {
providers.collect_and_partition_mono_items = collect_and_partition_mono_items;
providers.is_codegened_item = |tcx, def_id| {
let (all_mono_items, _) = tcx.collect_and_partition_mono_items(());
all_mono_items.contains(&def_id)
};
providers.is_codegened_item =
|tcx, def_id| tcx.collect_and_partition_mono_items(()).all_mono_items.contains(&def_id);
providers.codegen_unit = |tcx, name| {
let (_, all) = tcx.collect_and_partition_mono_items(());
all.iter()
tcx.collect_and_partition_mono_items(())
.codegen_units
.iter()
.find(|cgu| cgu.name() == name)
.unwrap_or_else(|| panic!("failed to find cgu with name {name:?}"))
};

View File

@ -3233,7 +3233,7 @@ pub(crate) struct MalformedCfgAttr {
pub(crate) struct UnknownBuiltinConstruct {
#[primary_span]
pub span: Span,
pub name: Symbol,
pub name: Ident,
}
#[derive(Diagnostic)]

View File

@ -1958,7 +1958,7 @@ impl<'a> Parser<'a> {
} else {
let err = self.dcx().create_err(errors::UnknownBuiltinConstruct {
span: lo.to(ident.span),
name: ident.name,
name: ident,
});
return Err(err);
};

View File

@ -677,7 +677,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
}
if could_be_path {
let import_suggestions = self.lookup_import_candidates(
Ident::with_dummy_span(name),
name,
Namespace::ValueNS,
&parent_scope,
&|res: Res| {

View File

@ -59,7 +59,7 @@ pub(crate) struct NameAlreadyUsedInParameterList {
pub(crate) span: Span,
#[label(resolve_first_use_of_name)]
pub(crate) first_use_span: Span,
pub(crate) name: Symbol,
pub(crate) name: Ident,
}
#[derive(Diagnostic)]
@ -142,7 +142,7 @@ pub(crate) struct VariableBoundWithDifferentMode {
pub(crate) span: Span,
#[label(resolve_first_binding_span)]
pub(crate) first_binding_span: Span,
pub(crate) variable_name: Symbol,
pub(crate) variable_name: Ident,
}
#[derive(Diagnostic)]
@ -151,7 +151,7 @@ pub(crate) struct IdentifierBoundMoreThanOnceInParameterList {
#[primary_span]
#[label]
pub(crate) span: Span,
pub(crate) identifier: Symbol,
pub(crate) identifier: Ident,
}
#[derive(Diagnostic)]
@ -160,7 +160,7 @@ pub(crate) struct IdentifierBoundMoreThanOnceInSamePattern {
#[primary_span]
#[label]
pub(crate) span: Span,
pub(crate) identifier: Symbol,
pub(crate) identifier: Ident,
}
#[derive(Diagnostic)]
@ -478,7 +478,7 @@ pub(crate) struct TraitImplDuplicate {
pub(crate) old_span: Span,
#[label(resolve_trait_item_span)]
pub(crate) trait_item_span: Span,
pub(crate) name: Symbol,
pub(crate) name: Ident,
}
#[derive(Diagnostic)]
@ -976,7 +976,7 @@ pub(crate) struct AttemptToDefineBuiltinMacroTwice {
pub(crate) struct VariableIsNotBoundInAllPatterns {
#[primary_span]
pub(crate) multispan: MultiSpan,
pub(crate) name: Symbol,
pub(crate) name: Ident,
}
#[derive(Subdiagnostic, Debug, Clone)]
@ -984,7 +984,7 @@ pub(crate) struct VariableIsNotBoundInAllPatterns {
pub(crate) struct PatternDoesntBindName {
#[primary_span]
pub(crate) span: Span,
pub(crate) name: Symbol,
pub(crate) name: Ident,
}
#[derive(Subdiagnostic, Debug, Clone)]
@ -1260,7 +1260,7 @@ pub(crate) struct TraitImplMismatch {
#[primary_span]
#[label]
pub(crate) span: Span,
pub(crate) name: Symbol,
pub(crate) name: Ident,
pub(crate) kind: &'static str,
pub(crate) trait_path: String,
#[label(resolve_trait_impl_mismatch_label_item)]

View File

@ -2835,7 +2835,7 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
match seen_bindings.entry(ident) {
Entry::Occupied(entry) => {
let span = *entry.get();
let err = ResolutionError::NameAlreadyUsedInParameterList(ident.name, span);
let err = ResolutionError::NameAlreadyUsedInParameterList(ident, span);
self.report_error(param.ident.span, err);
let rib = match param.kind {
GenericParamKind::Lifetime => {
@ -3422,7 +3422,7 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
match seen_trait_items.entry(id_in_trait) {
Entry::Occupied(entry) => {
self.report_error(span, ResolutionError::TraitImplDuplicate {
name: ident.name,
name: ident,
old_span: *entry.get(),
trait_item_span: binding.span,
});
@ -3457,7 +3457,7 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
};
let trait_path = path_names_to_string(path);
self.report_error(span, ResolutionError::TraitImplMismatch {
name: ident.name,
name: ident,
kind,
code,
trait_path,
@ -3640,9 +3640,8 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
.filter(|(_, pat)| pat.id != pat_outer.id)
.flat_map(|(map, _)| map);
for (key, binding_inner) in inners {
let name = key.name;
match map_outer.get(key) {
for (&name, binding_inner) in inners {
match map_outer.get(&name) {
None => {
// The inner binding is missing in the outer.
let binding_error =
@ -3880,7 +3879,7 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
// `Variant(a, a)`:
_ => IdentifierBoundMoreThanOnceInSamePattern,
};
self.report_error(ident.span, error(ident.name));
self.report_error(ident.span, error(ident));
}
// Record as bound if it's valid:

View File

@ -1636,13 +1636,12 @@ impl<'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> {
.enumerate()
.map(|(idx, new)| (new, old_fields.get(idx)))
.map(|(new, old)| {
let new = new.name.to_ident_string();
if let Some(Some(old)) = old
&& new != *old
&& new.as_str() != old
{
format!("{new}: {old}")
} else {
new
new.to_string()
}
})
.collect::<Vec<String>>()

View File

@ -214,7 +214,7 @@ enum Used {
#[derive(Debug)]
struct BindingError {
name: Symbol,
name: Ident,
origin: BTreeSet<Span>,
target: BTreeSet<Span>,
could_be_path: bool,
@ -226,7 +226,7 @@ enum ResolutionError<'ra> {
GenericParamsFromOuterItem(Res, HasGenericParams, DefKind),
/// Error E0403: the name is already used for a type or const parameter in this generic
/// parameter list.
NameAlreadyUsedInParameterList(Symbol, Span),
NameAlreadyUsedInParameterList(Ident, Span),
/// Error E0407: method is not a member of trait.
MethodNotMemberOfTrait(Ident, String, Option<Symbol>),
/// Error E0437: type is not a member of trait.
@ -236,11 +236,11 @@ enum ResolutionError<'ra> {
/// Error E0408: variable `{}` is not bound in all patterns.
VariableNotBoundInPattern(BindingError, ParentScope<'ra>),
/// Error E0409: variable `{}` is bound in inconsistent ways within the same match arm.
VariableBoundWithDifferentMode(Symbol, Span),
VariableBoundWithDifferentMode(Ident, Span),
/// Error E0415: identifier is bound more than once in this parameter list.
IdentifierBoundMoreThanOnceInParameterList(Symbol),
IdentifierBoundMoreThanOnceInParameterList(Ident),
/// Error E0416: identifier is bound more than once in the same pattern.
IdentifierBoundMoreThanOnceInSamePattern(Symbol),
IdentifierBoundMoreThanOnceInSamePattern(Ident),
/// Error E0426: use of undeclared label.
UndeclaredLabel { name: Symbol, suggestion: Option<LabelSuggestion> },
/// Error E0429: `self` imports are only allowed within a `{ }` list.
@ -292,14 +292,14 @@ enum ResolutionError<'ra> {
UnreachableLabel { name: Symbol, definition_span: Span, suggestion: Option<LabelSuggestion> },
/// Error E0323, E0324, E0325: mismatch between trait item and impl item.
TraitImplMismatch {
name: Symbol,
name: Ident,
kind: &'static str,
trait_path: String,
trait_item_span: Span,
code: ErrCode,
},
/// Error E0201: multiple impl items for the same trait item.
TraitImplDuplicate { name: Symbol, trait_item_span: Span, old_span: Span },
TraitImplDuplicate { name: Ident, trait_item_span: Span, old_span: Span },
/// Inline asm `sym` operand must refer to a `fn` or `static`.
InvalidAsmSym,
/// `self` used instead of `Self` in a generic parameter

View File

@ -36,7 +36,7 @@ pub(crate) fn target() -> Target {
description: Some("AArch64 NuttX".into()),
tier: Some(3),
host_tools: Some(false),
std: Some(false),
std: Some(true),
},
pointer_width: 64,
data_layout: "e-m:e-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32".into(),

View File

@ -31,7 +31,7 @@ pub(crate) fn target() -> Target {
description: Some("ARMv7-A Cortex-A with NuttX".into()),
tier: Some(3),
host_tools: Some(false),
std: Some(false),
std: Some(true),
},
pointer_width: 32,
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),

View File

@ -31,7 +31,7 @@ pub(crate) fn target() -> Target {
description: Some("ARMv7-A Cortex-A with NuttX (hard float)".into()),
tier: Some(3),
host_tools: Some(false),
std: Some(false),
std: Some(true),
},
pointer_width: 32,
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),

View File

@ -6,9 +6,9 @@ pub(crate) fn target() -> Target {
llvm_target: "riscv32".into(),
metadata: crate::spec::TargetMetadata {
description: None,
tier: None,
tier: Some(3),
host_tools: None,
std: None,
std: Some(true),
},
pointer_width: 32,
arch: "riscv32".into(),

View File

@ -6,9 +6,9 @@ pub(crate) fn target() -> Target {
llvm_target: "riscv32".into(),
metadata: crate::spec::TargetMetadata {
description: None,
tier: None,
tier: Some(3),
host_tools: None,
std: None,
std: Some(true),
},
pointer_width: 32,
arch: "riscv32".into(),

View File

@ -6,9 +6,9 @@ pub(crate) fn target() -> Target {
llvm_target: "riscv32".into(),
metadata: crate::spec::TargetMetadata {
description: None,
tier: None,
tier: Some(3),
host_tools: None,
std: None,
std: Some(true),
},
pointer_width: 32,
arch: "riscv32".into(),

View File

@ -8,9 +8,9 @@ pub(crate) fn target() -> Target {
data_layout: "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128".into(),
metadata: crate::spec::TargetMetadata {
description: None,
tier: None,
tier: Some(3),
host_tools: None,
std: None,
std: Some(true),
},
llvm_target: "riscv64".into(),
pointer_width: 64,

View File

@ -8,9 +8,9 @@ pub(crate) fn target() -> Target {
data_layout: "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128".into(),
metadata: crate::spec::TargetMetadata {
description: None,
tier: None,
tier: Some(3),
host_tools: None,
std: None,
std: Some(true),
},
llvm_target: "riscv64".into(),
pointer_width: 64,

View File

@ -7,9 +7,9 @@ pub(crate) fn target() -> Target {
llvm_target: "thumbv6m-none-eabi".into(),
metadata: crate::spec::TargetMetadata {
description: None,
tier: None,
tier: Some(3),
host_tools: None,
std: None,
std: Some(true),
},
pointer_width: 32,
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
@ -22,12 +22,9 @@ pub(crate) fn target() -> Target {
llvm_floatabi: Some(FloatAbi::Soft),
// The ARMv6-M architecture doesn't support unaligned loads/stores so we disable them
// with +strict-align.
// Also force-enable 32-bit atomics, which allows the use of atomic load/store only.
// The resulting atomics are ABI incompatible with atomics backed by libatomic.
features: "+strict-align,+atomics-32".into(),
// There are no atomic CAS instructions available in the instruction set of the ARMv6-M
// architecture
atomic_cas: false,
// The ARMv6-M doesn't support hardware atomic operations, use atomic builtins instead.
features: "+strict-align".into(),
max_atomic_width: Some(32),
..base::thumb::opts()
},
}

View File

@ -11,9 +11,9 @@ pub(crate) fn target() -> Target {
llvm_target: "thumbv7a-none-eabi".into(),
metadata: crate::spec::TargetMetadata {
description: None,
tier: None,
tier: Some(3),
host_tools: None,
std: None,
std: Some(true),
},
pointer_width: 32,
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),

View File

@ -14,9 +14,9 @@ pub(crate) fn target() -> Target {
llvm_target: "thumbv7a-none-eabihf".into(),
metadata: crate::spec::TargetMetadata {
description: None,
tier: None,
tier: Some(3),
host_tools: None,
std: None,
std: Some(true),
},
pointer_width: 32,
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),

View File

@ -16,9 +16,9 @@ pub(crate) fn target() -> Target {
llvm_target: "thumbv7em-none-eabi".into(),
metadata: crate::spec::TargetMetadata {
description: None,
tier: None,
tier: Some(3),
host_tools: None,
std: None,
std: Some(true),
},
pointer_width: 32,
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),

View File

@ -15,9 +15,9 @@ pub(crate) fn target() -> Target {
llvm_target: "thumbv7em-none-eabihf".into(),
metadata: crate::spec::TargetMetadata {
description: None,
tier: None,
tier: Some(3),
host_tools: None,
std: None,
std: Some(true),
},
pointer_width: 32,
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),

View File

@ -7,9 +7,9 @@ pub(crate) fn target() -> Target {
llvm_target: "thumbv7m-none-eabi".into(),
metadata: crate::spec::TargetMetadata {
description: None,
tier: None,
tier: Some(3),
host_tools: None,
std: None,
std: Some(true),
},
pointer_width: 32,
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),

View File

@ -7,9 +7,9 @@ pub(crate) fn target() -> Target {
llvm_target: "thumbv8m.base-none-eabi".into(),
metadata: crate::spec::TargetMetadata {
description: None,
tier: None,
tier: Some(3),
host_tools: None,
std: None,
std: Some(true),
},
pointer_width: 32,
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),

View File

@ -8,9 +8,9 @@ pub(crate) fn target() -> Target {
llvm_target: "thumbv8m.main-none-eabi".into(),
metadata: crate::spec::TargetMetadata {
description: None,
tier: None,
tier: Some(3),
host_tools: None,
std: None,
std: Some(true),
},
pointer_width: 32,
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),

View File

@ -8,9 +8,9 @@ pub(crate) fn target() -> Target {
llvm_target: "thumbv8m.main-none-eabihf".into(),
metadata: crate::spec::TargetMetadata {
description: None,
tier: None,
tier: Some(3),
host_tools: None,
std: None,
std: Some(true),
},
pointer_width: 32,
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),

View File

@ -462,6 +462,9 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
err.note(
"`#[target_feature]` functions do not implement the `Fn` traits",
);
err.note(
"try casting the function to a `fn` pointer or wrapping it in a closure",
);
}
self.try_to_add_help_message(

View File

@ -13,7 +13,7 @@ use rustc_middle::ty::print::PrintTraitRefExt as _;
use rustc_middle::ty::{self, GenericArgsRef, GenericParamDefKind, TyCtxt};
use rustc_parse_format::{ParseMode, Parser, Piece, Position};
use rustc_session::lint::builtin::UNKNOWN_OR_MALFORMED_DIAGNOSTIC_ATTRIBUTES;
use rustc_span::{Span, Symbol, kw, sym};
use rustc_span::{Ident, Span, Symbol, kw, sym};
use tracing::{debug, info};
use {rustc_attr_parsing as attr, rustc_hir as hir};
@ -375,7 +375,7 @@ impl IgnoredDiagnosticOption {
#[help]
pub struct UnknownFormatParameterForOnUnimplementedAttr {
argument_name: Symbol,
trait_name: Symbol,
trait_name: Ident,
}
#[derive(LintDiagnostic)]
@ -792,7 +792,7 @@ impl<'tcx> OnUnimplementedFormatString {
tcx.trait_id_of_impl(item_def_id)
.expect("expected `on_unimplemented` to correspond to a trait")
};
let trait_name = tcx.item_name(trait_def_id);
let trait_name = tcx.item_ident(trait_def_id);
let generics = tcx.generics_of(item_def_id);
let s = self.symbol.as_str();
let mut parser = Parser::new(s, None, None, false, ParseMode::Format);
@ -821,7 +821,11 @@ impl<'tcx> OnUnimplementedFormatString {
Position::ArgumentNamed(s) => {
match Symbol::intern(s) {
// `{ThisTraitsName}` is allowed
s if s == trait_name && !self.is_diagnostic_namespace_variant => (),
s if s == trait_name.name
&& !self.is_diagnostic_namespace_variant =>
{
()
}
s if ALLOWED_FORMAT_SYMBOLS.contains(&s)
&& !self.is_diagnostic_namespace_variant =>
{

View File

@ -6,6 +6,13 @@
#![stable(feature = "rust1", since = "1.0.0")]
mod variance;
#[unstable(feature = "phantom_variance_markers", issue = "135806")]
pub use self::variance::{
PhantomContravariant, PhantomContravariantLifetime, PhantomCovariant, PhantomCovariantLifetime,
PhantomInvariant, PhantomInvariantLifetime, Variance, variance,
};
use crate::cell::UnsafeCell;
use crate::cmp;
use crate::fmt::Debug;

View File

@ -0,0 +1,260 @@
#![unstable(feature = "phantom_variance_markers", issue = "135806")]
use super::PhantomData;
use crate::any::type_name;
use crate::cmp::Ordering;
use crate::fmt;
use crate::hash::{Hash, Hasher};
macro_rules! first_token {
($first:tt $($rest:tt)*) => {
$first
};
}
macro_rules! phantom_type {
($(
$(#[$attr:meta])*
pub struct $name:ident <$t:ident> ($($inner:tt)*);
)*) => {$(
$(#[$attr])*
pub struct $name<$t>($($inner)*) where T: ?Sized;
impl<T> $name<T>
where T: ?Sized
{
/// Constructs a new instance of the variance marker.
pub const fn new() -> Self {
Self(PhantomData)
}
}
impl<T> self::sealed::Sealed for $name<T> where T: ?Sized {
const VALUE: Self = Self::new();
}
impl<T> Variance for $name<T> where T: ?Sized {}
impl<T> Default for $name<T>
where T: ?Sized
{
fn default() -> Self {
Self(PhantomData)
}
}
impl<T> fmt::Debug for $name<T>
where T: ?Sized
{
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}<{}>", stringify!($name), type_name::<T>())
}
}
impl<T> Clone for $name<T>
where T: ?Sized
{
fn clone(&self) -> Self {
*self
}
}
impl<T> Copy for $name<T> where T: ?Sized {}
impl<T> PartialEq for $name<T>
where T: ?Sized
{
fn eq(&self, _: &Self) -> bool {
true
}
}
impl<T> Eq for $name<T> where T: ?Sized {}
impl<T> PartialOrd for $name<T>
where T: ?Sized
{
fn partial_cmp(&self, _: &Self) -> Option<Ordering> {
Some(Ordering::Equal)
}
}
impl<T> Ord for $name<T>
where T: ?Sized
{
fn cmp(&self, _: &Self) -> Ordering {
Ordering::Equal
}
}
impl<T> Hash for $name<T>
where T: ?Sized
{
fn hash<H: Hasher>(&self, _: &mut H) {}
}
)*};
}
macro_rules! phantom_lifetime {
($(
$(#[$attr:meta])*
pub struct $name:ident <$lt:lifetime> ($($inner:tt)*);
)*) => {$(
$(#[$attr])*
#[derive(Default, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct $name<$lt>($($inner)*);
impl $name<'_> {
/// Constructs a new instance of the variance marker.
pub const fn new() -> Self {
Self(first_token!($($inner)*)(PhantomData))
}
}
impl self::sealed::Sealed for $name<'_> {
const VALUE: Self = Self::new();
}
impl Variance for $name<'_> {}
impl fmt::Debug for $name<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", stringify!($name))
}
}
)*};
}
phantom_lifetime! {
/// Zero-sized type used to mark a lifetime as covariant.
///
/// Covariant lifetimes must live at least as long as declared. See [the reference][1] for more
/// information.
///
/// [1]: https://doc.rust-lang.org/stable/reference/subtyping.html#variance
///
/// ## Layout
///
/// For all `'a`, the following are guaranteed:
/// * `size_of::<PhantomCovariantLifetime<'a>>() == 0`
/// * `align_of::<PhantomCovariantLifetime<'a>>() == 1`
pub struct PhantomCovariantLifetime<'a>(PhantomCovariant<&'a ()>);
/// Zero-sized type used to mark a lifetime as contravariant.
///
/// Contravariant lifetimes must live at most as long as declared. See [the reference][1] for
/// more information.
///
/// [1]: https://doc.rust-lang.org/stable/reference/subtyping.html#variance
///
/// ## Layout
///
/// For all `'a`, the following are guaranteed:
/// * `size_of::<PhantomContravariantLifetime<'a>>() == 0`
/// * `align_of::<PhantomContravariantLifetime<'a>>() == 1`
pub struct PhantomContravariantLifetime<'a>(PhantomContravariant<&'a ()>);
/// Zero-sized type used to mark a lifetime as invariant.
///
/// Invariant lifetimes must be live for the exact length declared, neither shorter nor longer.
/// See [the reference][1] for more information.
///
/// [1]: https://doc.rust-lang.org/stable/reference/subtyping.html#variance
///
/// ## Layout
///
/// For all `'a`, the following are guaranteed:
/// * `size_of::<PhantomInvariantLifetime<'a>>() == 0`
/// * `align_of::<PhantomInvariantLifetime<'a>>() == 1`
pub struct PhantomInvariantLifetime<'a>(PhantomInvariant<&'a ()>);
}
phantom_type! {
/// Zero-sized type used to mark a type parameter as covariant.
///
/// Types used as part of the return value from a function are covariant. If the type is _also_
/// passed as a parameter then it is [invariant][PhantomInvariant]. See [the reference][1] for
/// more information.
///
/// [1]: https://doc.rust-lang.org/stable/reference/subtyping.html#variance
///
/// ## Layout
///
/// For all `T`, the following are guaranteed:
/// * `size_of::<PhantomCovariant<T>>() == 0`
/// * `align_of::<PhantomCovariant<T>>() == 1`
pub struct PhantomCovariant<T>(PhantomData<fn() -> T>);
/// Zero-sized type used to mark a type parameter as contravariant.
///
/// Types passed as arguments to a function are contravariant. If the type is _also_ part of the
/// return value from a function then it is [invariant][PhantomInvariant]. See [the
/// reference][1] for more information.
///
/// [1]: https://doc.rust-lang.org/stable/reference/subtyping.html#variance
///
/// ## Layout
///
/// For all `T`, the following are guaranteed:
/// * `size_of::<PhantomContravariant<T>>() == 0`
/// * `align_of::<PhantomContravariant<T>>() == 1`
pub struct PhantomContravariant<T>(PhantomData<fn(T)>);
/// Zero-sized type used to mark a type parameter as invariant.
///
/// Types that are both passed as an argument _and_ used as part of the return value from a
/// function are invariant. See [the reference][1] for more information.
///
/// [1]: https://doc.rust-lang.org/stable/reference/subtyping.html#variance
///
/// ## Layout
///
/// For all `T`, the following are guaranteed:
/// * `size_of::<PhantomInvariant<T>>() == 0`
/// * `align_of::<PhantomInvariant<T>>() == 1`
pub struct PhantomInvariant<T>(PhantomData<fn(T) -> T>);
}
mod sealed {
pub trait Sealed {
const VALUE: Self;
}
}
/// A marker trait for phantom variance types.
pub trait Variance: sealed::Sealed + Default {}
/// Construct a variance marker; equivalent to [`Default::default`].
///
/// This type can be any of the following. You generally should not need to explicitly name the
/// type, however.
///
/// - [`PhantomCovariant`]
/// - [`PhantomContravariant`]
/// - [`PhantomInvariant`]
/// - [`PhantomCovariantLifetime`]
/// - [`PhantomContravariantLifetime`]
/// - [`PhantomInvariantLifetime`]
///
/// # Example
///
/// ```rust
/// #![feature(phantom_variance_markers)]
///
/// use core::marker::{PhantomCovariant, variance};
///
/// struct BoundFn<F, P, R>
/// where
/// F: Fn(P) -> R,
/// {
/// function: F,
/// parameter: P,
/// return_value: PhantomCovariant<R>,
/// }
///
/// let bound_fn = BoundFn {
/// function: core::convert::identity,
/// parameter: 5u8,
/// return_value: variance(),
/// };
/// ```
pub const fn variance<T>() -> T
where
T: Variance,
{
T::VALUE
}

View File

@ -1099,10 +1099,15 @@ impl<T> [T] {
/// assert!(iter.next().is_none());
/// ```
///
/// There's no `windows_mut`, as that existing would let safe code violate the
/// "only one `&mut` at a time to the same thing" rule. However, you can sometimes
/// use [`Cell::as_slice_of_cells`](crate::cell::Cell::as_slice_of_cells) in
/// conjunction with `windows` to accomplish something similar:
/// Because the [Iterator] trait cannot represent the required lifetimes,
/// there is no `windows_mut` analog to `windows`;
/// `[0,1,2].windows_mut(2).collect()` would violate [the rules of references]
/// (though a [LendingIterator] analog is possible). You can sometimes use
/// [`Cell::as_slice_of_cells`](crate::cell::Cell::as_slice_of_cells) in
/// conjunction with `windows` instead:
///
/// [the rules of references]: https://doc.rust-lang.org/book/ch04-02-references-and-borrowing.html#the-rules-of-references
/// [LendingIterator]: https://blog.rust-lang.org/2022/10/28/gats-stabilization.html
/// ```
/// use std::cell::Cell;
///

View File

@ -18,7 +18,7 @@
//! infinite buffer.
//!
//! 2. A synchronous, bounded channel. The [`sync_channel`] function will
//! return a `(SyncSender, Receiver)` tuple where the storage for pending
//! return a `(Sender, Receiver)` tuple where the storage for pending
//! messages is a pre-allocated buffer of a fixed size. All sends will be
//! **synchronous** by blocking until there is buffer space available. Note
//! that a bound of 0 is allowed, causing the channel to become a "rendezvous"
@ -360,9 +360,17 @@ impl<T> Sender<T> {
/// that a return value of [`Err`] means that the data will never be
/// received, but a return value of [`Ok`] does *not* mean that the data
/// will be received. It is possible for the corresponding receiver to
/// hang up immediately after this function returns [`Ok`].
/// hang up immediately after this function returns [`Ok`]. However, if
/// the channel is zero-capacity, it acts as a rendezvous channel and a
/// return value of [`Ok`] means that the data has been received.
///
/// This method will never block the current thread.
/// If the channel is full and not disconnected, this call will block until
/// the send operation can proceed. If the channel becomes disconnected,
/// this call will wake up and return an error. The returned error contains
/// the original message.
///
/// If called on a zero-capacity channel, this method will wait for a receive
/// operation to appear on the other side of the channel.
///
/// # Examples
///
@ -650,7 +658,7 @@ impl<T> fmt::Debug for Sender<T> {
}
/// The receiving half of Rust's [`channel`] (or [`sync_channel`]) type.
/// Different threads can share this [`Sender`] by cloning it.
/// Different threads can share this [`Receiver`] by cloning it.
///
/// Messages sent to the channel can be retrieved using [`recv`].
///

View File

@ -262,7 +262,7 @@ target | std | host | notes
[`aarch64-unknown-nto-qnx710`](platform-support/nto-qnx.md) | ✓ | | ARM64 QNX Neutrino 7.1 RTOS with default network stack (io-pkt) |
[`aarch64-unknown-nto-qnx710_iosock`](platform-support/nto-qnx.md) | ✓ | | ARM64 QNX Neutrino 7.1 RTOS with new network stack (io-sock) |
[`aarch64-unknown-nto-qnx800`](platform-support/nto-qnx.md) | ✓ | | ARM64 QNX Neutrino 8.0 RTOS |
[`aarch64-unknown-nuttx`](platform-support/nuttx.md) | * | | ARM64 with NuttX
[`aarch64-unknown-nuttx`](platform-support/nuttx.md) | | | ARM64 with NuttX
[`aarch64-unknown-openbsd`](platform-support/openbsd.md) | ✓ | ✓ | ARM64 OpenBSD
[`aarch64-unknown-redox`](platform-support/redox.md) | ✓ | | ARM64 Redox OS
[`aarch64-unknown-teeos`](platform-support/aarch64-unknown-teeos.md) | ? | | ARM64 TEEOS |
@ -298,8 +298,8 @@ target | std | host | notes
[`armv7k-apple-watchos`](platform-support/apple-watchos.md) | ✓ | | Armv7-A Apple WatchOS
[`armv7s-apple-ios`](platform-support/apple-ios.md) | ✓ | | Armv7-A Apple-A6 Apple iOS
[`armv8r-none-eabihf`](platform-support/armv8r-none-eabihf.md) | * | | Bare Armv8-R, hardfloat
[`armv7a-nuttx-eabi`](platform-support/nuttx.md) | * | | ARMv7-A with NuttX
[`armv7a-nuttx-eabihf`](platform-support/nuttx.md) | * | | ARMv7-A with NuttX, hardfloat
[`armv7a-nuttx-eabi`](platform-support/nuttx.md) | | | ARMv7-A with NuttX
[`armv7a-nuttx-eabihf`](platform-support/nuttx.md) | | | ARMv7-A with NuttX, hardfloat
`avr-unknown-gnu-atmega328` | * | | AVR. Requires `-Z build-std=core`
`bpfeb-unknown-none` | * | | BPF (big endian)
`bpfel-unknown-none` | * | | BPF (little endian)
@ -369,21 +369,21 @@ target | std | host | notes
[`riscv32im-risc0-zkvm-elf`](platform-support/riscv32im-risc0-zkvm-elf.md) | ? | | RISC Zero's zero-knowledge Virtual Machine (RV32IM ISA)
[`riscv32ima-unknown-none-elf`](platform-support/riscv32-unknown-none-elf.md) | * | | Bare RISC-V (RV32IMA ISA)
[`riscv32imac-esp-espidf`](platform-support/esp-idf.md) | ✓ | | RISC-V ESP-IDF
[`riscv32imac-unknown-nuttx-elf`](platform-support/nuttx.md) | * | | RISC-V 32bit with NuttX
[`riscv32imac-unknown-nuttx-elf`](platform-support/nuttx.md) | | | RISC-V 32bit with NuttX
[`riscv32imac-unknown-xous-elf`](platform-support/riscv32imac-unknown-xous-elf.md) | ? | | RISC-V Xous (RV32IMAC ISA)
[`riscv32imafc-esp-espidf`](platform-support/esp-idf.md) | ✓ | | RISC-V ESP-IDF
[`riscv32imafc-unknown-nuttx-elf`](platform-support/nuttx.md) | * | | RISC-V 32bit with NuttX
[`riscv32imafc-unknown-nuttx-elf`](platform-support/nuttx.md) | | | RISC-V 32bit with NuttX
[`riscv32imc-esp-espidf`](platform-support/esp-idf.md) | ✓ | | RISC-V ESP-IDF
[`riscv32imc-unknown-nuttx-elf`](platform-support/nuttx.md) | * | | RISC-V 32bit with NuttX
[`riscv32imc-unknown-nuttx-elf`](platform-support/nuttx.md) | | | RISC-V 32bit with NuttX
[`riscv64-linux-android`](platform-support/android.md) | ? | | RISC-V 64-bit Android
[`riscv64-wrs-vxworks`](platform-support/vxworks.md) | ✓ | |
`riscv64gc-unknown-freebsd` | ? | | RISC-V FreeBSD
`riscv64gc-unknown-fuchsia` | ? | | RISC-V Fuchsia
[`riscv64gc-unknown-hermit`](platform-support/hermit.md) | ✓ | | RISC-V Hermit
[`riscv64gc-unknown-netbsd`](platform-support/netbsd.md) | ✓ | ✓ | RISC-V NetBSD
[`riscv64gc-unknown-nuttx-elf`](platform-support/nuttx.md) | * | | RISC-V 64bit with NuttX
[`riscv64gc-unknown-nuttx-elf`](platform-support/nuttx.md) | | | RISC-V 64bit with NuttX
[`riscv64gc-unknown-openbsd`](platform-support/openbsd.md) | ✓ | ✓ | OpenBSD/riscv64
[`riscv64imac-unknown-nuttx-elf`](platform-support/nuttx.md) | * | | RISC-V 64bit with NuttX
[`riscv64imac-unknown-nuttx-elf`](platform-support/nuttx.md) | | | RISC-V 64bit with NuttX
[`s390x-unknown-linux-musl`](platform-support/s390x-unknown-linux-musl.md) | ✓ | | S390x Linux (kernel 3.2, musl 1.2.3)
`sparc-unknown-linux-gnu` | ✓ | | 32-bit SPARC Linux
[`sparc-unknown-none-elf`](./platform-support/sparc-unknown-none-elf.md) | * | | Bare 32-bit SPARC V7+
@ -391,18 +391,18 @@ target | std | host | notes
[`sparc64-unknown-openbsd`](platform-support/openbsd.md) | ✓ | ✓ | OpenBSD/sparc64
[`thumbv4t-none-eabi`](platform-support/armv4t-none-eabi.md) | * | | Thumb-mode Bare Armv4T
[`thumbv5te-none-eabi`](platform-support/armv5te-none-eabi.md) | * | | Thumb-mode Bare Armv5TE
[`thumbv6m-nuttx-eabi`](platform-support/nuttx.md) | * | | ARMv6M with NuttX
[`thumbv6m-nuttx-eabi`](platform-support/nuttx.md) | | | ARMv6M with NuttX
`thumbv7a-pc-windows-msvc` | | |
[`thumbv7a-uwp-windows-msvc`](platform-support/uwp-windows-msvc.md) | | |
[`thumbv7a-nuttx-eabi`](platform-support/nuttx.md) | * | | ARMv7-A with NuttX
[`thumbv7a-nuttx-eabihf`](platform-support/nuttx.md) | * | | ARMv7-A with NuttX, hardfloat
[`thumbv7em-nuttx-eabi`](platform-support/nuttx.md) | * | | ARMv7EM with NuttX
[`thumbv7em-nuttx-eabihf`](platform-support/nuttx.md) | * | | ARMv7EM with NuttX, hardfloat
[`thumbv7m-nuttx-eabi`](platform-support/nuttx.md) | * | | ARMv7M with NuttX
[`thumbv7a-nuttx-eabi`](platform-support/nuttx.md) | | | ARMv7-A with NuttX
[`thumbv7a-nuttx-eabihf`](platform-support/nuttx.md) | | | ARMv7-A with NuttX, hardfloat
[`thumbv7em-nuttx-eabi`](platform-support/nuttx.md) | | | ARMv7EM with NuttX
[`thumbv7em-nuttx-eabihf`](platform-support/nuttx.md) | | | ARMv7EM with NuttX, hardfloat
[`thumbv7m-nuttx-eabi`](platform-support/nuttx.md) | | | ARMv7M with NuttX
`thumbv7neon-unknown-linux-musleabihf` | ? | | Thumb2-mode Armv7-A Linux with NEON, musl 1.2.3
[`thumbv8m.base-nuttx-eabi`](platform-support/nuttx.md) | * | | ARMv8M Baseline with NuttX
[`thumbv8m.main-nuttx-eabi`](platform-support/nuttx.md) | * | | ARMv8M Mainline with NuttX
[`thumbv8m.main-nuttx-eabihf`](platform-support/nuttx.md) | * | | ARMv8M Mainline with NuttX, hardfloat
[`thumbv8m.base-nuttx-eabi`](platform-support/nuttx.md) | | | ARMv8M Baseline with NuttX
[`thumbv8m.main-nuttx-eabi`](platform-support/nuttx.md) | | | ARMv8M Mainline with NuttX
[`thumbv8m.main-nuttx-eabihf`](platform-support/nuttx.md) | | | ARMv8M Mainline with NuttX, hardfloat
[`wasm64-unknown-unknown`](platform-support/wasm64-unknown-unknown.md) | ? | | WebAssembly
[`x86_64-apple-tvos`](platform-support/apple-tvos.md) | ✓ | | x86 64-bit tvOS
[`x86_64-apple-watchos-sim`](platform-support/apple-watchos.md) | ✓ | | x86 64-bit Apple WatchOS simulator

View File

@ -1385,7 +1385,6 @@ ui/issue-18502.rs
ui/issue-24106.rs
ui/issue-76387-llvm-miscompile.rs
ui/issues-71798.rs
ui/issues/auxiliary/issue-111011.rs
ui/issues/auxiliary/issue-11224.rs
ui/issues/auxiliary/issue-11508.rs
ui/issues/auxiliary/issue-11529.rs

View File

@ -17,7 +17,7 @@ use ignore::Walk;
const ENTRY_LIMIT: u32 = 901;
// FIXME: The following limits should be reduced eventually.
const ISSUES_ENTRY_LIMIT: u32 = 1662;
const ISSUES_ENTRY_LIMIT: u32 = 1658;
const EXPECTED_TEST_FILE_EXTENSIONS: &[&str] = &[
"rs", // test source files

View File

@ -1,17 +0,0 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/equality.rs:5:12
|
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
error: return type notation is not allowed to use type equality
--> $DIR/equality.rs:14:18
|
LL | fn test<T: Trait<method() = Box<dyn Future<Output = ()>>>>() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 1 previous error; 1 warning emitted

View File

@ -1,17 +0,0 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/equality.rs:5:12
|
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
error: return type notation is not allowed to use type equality
--> $DIR/equality.rs:14:18
|
LL | fn test<T: Trait<method() = Box<dyn Future<Output = ()>>>>() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 1 previous error; 1 warning emitted

View File

@ -1,11 +0,0 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/issue-110963-late.rs:6:12
|
LL | #![feature(return_type_notation)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View File

@ -1,10 +0,0 @@
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes
--> $DIR/super-method-bound.rs:6:31
|
LL | #![feature(return_type_notation)] | ^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
= note: `#[warn(incomplete_features)]` on by default
warning: 1 warning emitted

View File

@ -1,8 +0,0 @@
error: unexpected `--cfg test` flag
|
= note: config `test` is only supposed to be controlled by `--test`
= note: see <https://github.com/rust-lang/rust/issues/xxxxx> for more information
= note: `#[deny(unexpected_builtin_cfgs)]` on by default
error: aborting due to 1 previous error

View File

@ -1,37 +0,0 @@
error: lifetime may not live long enough
--> $DIR/expect-region-supply-region-2.rs:14:30
|
LL | fn expect_bound_supply_named<'x>() {
| -- lifetime `'x` defined here
...
LL | closure_expecting_bound(|x: &'x u32| {
| ^ - let's call the lifetime of this reference `'1`
| |
| requires that `'1` must outlive `'x`
error[E0521]: borrowed data escapes outside of closure
--> $DIR/expect-region-supply-region-2.rs:20:9
|
LL | let mut f: Option<&u32> = None;
| ----- `f` declared here, outside of the closure body
...
LL | closure_expecting_bound(|x: &'x u32| {
| - `x` is a reference that is only valid in the closure body
...
LL | f = Some(x);
| ^^^^^^^^^^^ `x` escapes the closure body here
error: lifetime may not live long enough
--> $DIR/expect-region-supply-region-2.rs:14:30
|
LL | fn expect_bound_supply_named<'x>() {
| -- lifetime `'x` defined here
...
LL | closure_expecting_bound(|x: &'x u32| {
| ^ requires that `'x` must outlive `'static`
|
= help: consider replacing `'x` with `'static`
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0521`.

View File

@ -1,9 +0,0 @@
error[E0570]: `"C-cmse-nonsecure-entry"` is not a supported ABI for the current target
--> $DIR/trustzone-only.rs:5:1
|
LL | pub extern "C-cmse-nonsecure-entry" fn entry_function(input: u32) -> u32 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0570`.

View File

@ -1,9 +0,0 @@
error[E0284]: type annotations needed: cannot satisfy `<usize as SliceIndex<[u8]>>::Output == _`
--> $DIR/ub-nonnull.rs:19:30
|
LL | let out_of_bounds_ptr = &ptr[255];
| ^^^^^^^^ cannot satisfy `<usize as SliceIndex<[u8]>>::Output == _`
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0284`.

View File

@ -1,9 +0,0 @@
error[E0282]: type annotations needed
--> $DIR/ub-wide-ptr.rs:90:67
|
LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::transmute(3u8) }]);
| ^^^^^^^^^^^^^^ cannot infer type for type parameter `U` declared on the function `transmute`
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0282`.

View File

@ -1,23 +0,0 @@
error[E0658]: mutable references are not allowed in constants
--> $DIR/write_to_mut_ref_dest.rs:11:27
|
LL | let b: *mut u32 = &mut a;
| ^^^^^^
|
= note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0658]: dereferencing raw mutable pointers in constants is unstable
--> $DIR/write_to_mut_ref_dest.rs:12:18
|
LL | unsafe { *b = 5; }
| ^^^^^^
|
= note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0658`.

View File

@ -1,12 +0,0 @@
error[E0621]: explicit lifetime required in the type of `x`
--> $DIR/generator-region-requirements.rs:16:51
|
LL | fn dangle(x: &mut i32) -> &'static mut i32 {
| -------- help: add explicit lifetime `'static` to the type of `x`: `&'static mut i32`
...
LL | GeneratorState::Complete(c) => return c,
| ^ lifetime `'static` required
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0621`.

View File

@ -1,52 +0,0 @@
error[E0038]: the trait `Foo` is not dyn compatible
--> $DIR/gat-in-trait-path.rs:26:17
|
LL | fn f(_arg : Box<dyn for<'a> Foo<A<'a> = &'a ()>>) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Foo` is not dyn compatible
|
note: for a trait to be dyn compatible it needs to allow building a vtable
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
--> $DIR/gat-in-trait-path.rs:10:10
|
LL | trait Foo {
| --- this trait is not dyn compatible...
LL | type A<'a> where Self: 'a;
| ^ ...because it contains the generic associated type `A`
= help: consider moving `A` to another trait
error[E0038]: the trait `Foo` is not dyn compatible
--> $DIR/gat-in-trait-path.rs:32:5
|
LL | f(Box::new(foo));
| ^^^^^^^^^^^^^ `Foo` is not dyn compatible
|
note: for a trait to be dyn compatible it needs to allow building a vtable
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
--> $DIR/gat-in-trait-path.rs:10:10
|
LL | trait Foo {
| --- this trait is not dyn compatible...
LL | type A<'a> where Self: 'a;
| ^ ...because it contains the generic associated type `A`
= help: consider moving `A` to another trait
error[E0038]: the trait `Foo` is not dyn compatible
--> $DIR/gat-in-trait-path.rs:32:5
|
LL | f(Box::new(foo));
| ^^^^^^^^^^^^^ `Foo` is not dyn compatible
|
note: for a trait to be dyn compatible it needs to allow building a vtable
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
--> $DIR/gat-in-trait-path.rs:10:10
|
LL | trait Foo {
| --- this trait is not dyn compatible...
LL | type A<'a> where Self: 'a;
| ^ ...because it contains the generic associated type `A`
= help: consider moving `A` to another trait
= note: required for the cast from `Box<Fooer<{integer}>>` to `Box<(dyn Foo<A<'a> = &'a ()> + 'static)>`
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0038`.

View File

@ -1,19 +0,0 @@
error[E0038]: the trait `X` is not dyn compatible
--> $DIR/issue-67510-pass.rs:12:23
|
LL | fn _func1<'a>(_x: Box<dyn X<Y<'a>=&'a ()>>) {}
| ^^^^^^^^^^^^^^^^^^^ `X` is not dyn compatible
|
note: for a trait to be dyn compatible it needs to allow building a vtable
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
--> $DIR/issue-67510-pass.rs:9:10
|
LL | trait X {
| - this trait is not dyn compatible...
LL | type Y<'a>;
| ^ ...because it contains the generic associated type `Y`
= help: consider moving `Y` to another trait
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0038`.

View File

@ -1,57 +0,0 @@
error[E0107]: missing generics for associated type `SuperTrait::SubType`
--> $DIR/issue-76535.rs:39:33
|
LL | let sub: Box<dyn SuperTrait<SubType = SubStruct>> = Box::new(SuperStruct::new(0));
| ^^^^^^^ expected 1 lifetime argument
|
note: associated type defined here, with 1 lifetime parameter: `'a`
--> $DIR/issue-76535.rs:9:10
|
LL | type SubType<'a>: SubTrait where Self: 'a;
| ^^^^^^^ --
help: add missing lifetime argument
|
LL | let sub: Box<dyn SuperTrait<SubType<'a> = SubStruct>> = Box::new(SuperStruct::new(0));
| ++++
error[E0038]: the trait `SuperTrait` is not dyn compatible
--> $DIR/issue-76535.rs:39:14
|
LL | let sub: Box<dyn SuperTrait<SubType = SubStruct>> = Box::new(SuperStruct::new(0));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `SuperTrait` is not dyn compatible
|
note: for a trait to be dyn compatible it needs to allow building a vtable
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
--> $DIR/issue-76535.rs:9:10
|
LL | pub trait SuperTrait {
| ---------- this trait is not dyn compatible...
LL | type SubType<'a>: SubTrait where Self: 'a;
| ^^^^^^^ ...because it contains the generic associated type `SubType`
= help: consider moving `SubType` to another trait
= help: only type `SuperStruct` implements `SuperTrait` within this crate. Consider using it directly instead.
= note: `SuperTrait` may be implemented in other crates; if you want to support your users passing their own types here, you can't refer to a specific type
error[E0038]: the trait `SuperTrait` is not dyn compatible
--> $DIR/issue-76535.rs:39:57
|
LL | let sub: Box<dyn SuperTrait<SubType = SubStruct>> = Box::new(SuperStruct::new(0));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `SuperTrait` is not dyn compatible
|
note: for a trait to be dyn compatible it needs to allow building a vtable
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
--> $DIR/issue-76535.rs:9:10
|
LL | pub trait SuperTrait {
| ---------- this trait is not dyn compatible...
LL | type SubType<'a>: SubTrait where Self: 'a;
| ^^^^^^^ ...because it contains the generic associated type `SubType`
= help: consider moving `SubType` to another trait
= help: only type `SuperStruct` implements `SuperTrait` within this crate. Consider using it directly instead.
= note: `SuperTrait` may be implemented in other crates; if you want to support your users passing their own types here, you can't refer to a specific type
= note: required for the cast from `Box<SuperStruct>` to `Box<dyn SuperTrait<SubType<'_> = SubStruct<'_>>>`
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0038, E0107.
For more information about an error, try `rustc --explain E0038`.

View File

@ -1,19 +0,0 @@
error[E0107]: missing generics for associated type `SuperTrait::SubType`
--> $DIR/issue-76535.rs:39:33
|
LL | let sub: Box<dyn SuperTrait<SubType = SubStruct>> = Box::new(SuperStruct::new(0));
| ^^^^^^^ expected 1 lifetime argument
|
note: associated type defined here, with 1 lifetime parameter: `'a`
--> $DIR/issue-76535.rs:9:10
|
LL | type SubType<'a>: SubTrait where Self: 'a;
| ^^^^^^^ --
help: add missing lifetime argument
|
LL | let sub: Box<dyn SuperTrait<SubType<'a> = SubStruct>> = Box::new(SuperStruct::new(0));
| ++++
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0107`.

View File

@ -1,36 +0,0 @@
error[E0107]: missing generics for associated type `CollectionFamily::Member`
--> $DIR/issue-78671.rs:10:47
|
LL | Box::new(Family) as &dyn CollectionFamily<Member=usize>
| ^^^^^^ expected 1 generic argument
|
note: associated type defined here, with 1 generic parameter: `T`
--> $DIR/issue-78671.rs:7:10
|
LL | type Member<T>;
| ^^^^^^ -
help: add missing generic argument
|
LL | Box::new(Family) as &dyn CollectionFamily<Member<T>=usize>
| +++
error[E0038]: the trait `CollectionFamily` is not dyn compatible
--> $DIR/issue-78671.rs:10:25
|
LL | Box::new(Family) as &dyn CollectionFamily<Member=usize>
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `CollectionFamily` is not dyn compatible
|
note: for a trait to be dyn compatible it needs to allow building a vtable
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
--> $DIR/issue-78671.rs:7:10
|
LL | trait CollectionFamily {
| ---------------- this trait is not dyn compatible...
LL | type Member<T>;
| ^^^^^^ ...because it contains the generic associated type `Member`
= help: consider moving `Member` to another trait
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0038, E0107.
For more information about an error, try `rustc --explain E0038`.

View File

@ -1,19 +0,0 @@
error[E0107]: missing generics for associated type `CollectionFamily::Member`
--> $DIR/issue-78671.rs:10:47
|
LL | Box::new(Family) as &dyn CollectionFamily<Member=usize>
| ^^^^^^ expected 1 generic argument
|
note: associated type defined here, with 1 generic parameter: `T`
--> $DIR/issue-78671.rs:7:10
|
LL | type Member<T>;
| ^^^^^^ -
help: add missing generic argument
|
LL | Box::new(Family) as &dyn CollectionFamily<Member<T>=usize>
| +++
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0107`.

View File

@ -1,53 +0,0 @@
error[E0107]: missing generics for associated type `MapLike::VRefCont`
--> $DIR/issue-79422.rs:47:36
|
LL | as Box<dyn MapLike<u8, u8, VRefCont = dyn RefCont<'_, u8>>>;
| ^^^^^^^^ expected 1 lifetime argument
|
note: associated type defined here, with 1 lifetime parameter: `'a`
--> $DIR/issue-79422.rs:23:10
|
LL | type VRefCont<'a>: RefCont<'a, V> where Self: 'a;
| ^^^^^^^^ --
help: add missing lifetime argument
|
LL | as Box<dyn MapLike<u8, u8, VRefCont<'a> = dyn RefCont<'_, u8>>>;
| ++++
error[E0038]: the trait `MapLike` is not dyn compatible
--> $DIR/issue-79422.rs:47:12
|
LL | as Box<dyn MapLike<u8, u8, VRefCont = dyn RefCont<'_, u8>>>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `MapLike` is not dyn compatible
|
note: for a trait to be dyn compatible it needs to allow building a vtable
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
--> $DIR/issue-79422.rs:23:10
|
LL | trait MapLike<K, V> {
| ------- this trait is not dyn compatible...
LL | type VRefCont<'a>: RefCont<'a, V> where Self: 'a;
| ^^^^^^^^ ...because it contains the generic associated type `VRefCont`
= help: consider moving `VRefCont` to another trait
error[E0038]: the trait `MapLike` is not dyn compatible
--> $DIR/issue-79422.rs:44:13
|
LL | let m = Box::new(std::collections::BTreeMap::<u8, u8>::new())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `MapLike` is not dyn compatible
|
note: for a trait to be dyn compatible it needs to allow building a vtable
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
--> $DIR/issue-79422.rs:23:10
|
LL | trait MapLike<K, V> {
| ------- this trait is not dyn compatible...
LL | type VRefCont<'a>: RefCont<'a, V> where Self: 'a;
| ^^^^^^^^ ...because it contains the generic associated type `VRefCont`
= help: consider moving `VRefCont` to another trait
= note: required for the cast from `Box<BTreeMap<u8, u8>>` to `Box<dyn MapLike<u8, u8, VRefCont<'_> = (dyn RefCont<'_, u8> + 'static)>>`
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0038, E0107.
For more information about an error, try `rustc --explain E0038`.

View File

@ -1,36 +0,0 @@
error[E0107]: missing generics for associated type `MapLike::VRefCont`
--> $DIR/issue-79422.rs:47:36
|
LL | as Box<dyn MapLike<u8, u8, VRefCont = dyn RefCont<'_, u8>>>;
| ^^^^^^^^ expected 1 lifetime argument
|
note: associated type defined here, with 1 lifetime parameter: `'a`
--> $DIR/issue-79422.rs:23:10
|
LL | type VRefCont<'a>: RefCont<'a, V> where Self: 'a;
| ^^^^^^^^ --
help: add missing lifetime argument
|
LL | as Box<dyn MapLike<u8, u8, VRefCont<'a> = dyn RefCont<'_, u8>>>;
| ++++
error[E0271]: type mismatch resolving `<BTreeMap<u8, u8> as MapLike<u8, u8>>::VRefCont<'_> == dyn RefCont<'_, u8>`
--> $DIR/issue-79422.rs:44:13
|
LL | let m = Box::new(std::collections::BTreeMap::<u8, u8>::new())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type mismatch resolving `<BTreeMap<u8, u8> as MapLike<u8, u8>>::VRefCont<'_> == dyn RefCont<'_, u8>`
|
note: expected this to be `(dyn RefCont<'_, u8> + 'static)`
--> $DIR/issue-79422.rs:28:25
|
LL | type VRefCont<'a> = &'a V where Self: 'a;
| ^^^^^
= note: expected trait object `(dyn RefCont<'_, u8> + 'static)`
found reference `&u8`
= help: `&u8` implements `RefCont` so you could box the found value and coerce it to the trait object `Box<dyn RefCont>`, you will have to change the expected type as well
= note: required for the cast from `Box<BTreeMap<u8, u8>>` to `Box<dyn MapLike<u8, u8, VRefCont<'_> = (dyn RefCont<'_, u8> + 'static)>>`
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0107, E0271.
For more information about an error, try `rustc --explain E0107`.

View File

@ -1,15 +0,0 @@
error[E0308]: mismatched types
--> $DIR/issue-90014-tait2.rs:27:9
|
LL | fn make_fut(&self) -> Box<dyn for<'a> Trait<'a, Thing = Fut<'a>>> {
| ------------------------------------------- expected `Box<(dyn for<'a> Trait<'a, Thing = Fut<'a>> + 'static)>` because of return type
LL | Box::new((async { () },))
| ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Box<dyn Trait<'a, Thing = Fut<'_>>>`, found `Box<(...,)>`
|
= note: expected struct `Box<(dyn for<'a> Trait<'a, Thing = Fut<'a>> + 'static)>`
found struct `Box<({async block@$DIR/issue-90014-tait2.rs:27:19: 27:31},)>`
= help: `({async block@$DIR/issue-90014-tait2.rs:27:19: 27:31},)` implements `Trait` so you could box the found value and coerce it to the trait object `Box<dyn Trait>`, you will have to change the expected type as well
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0308`.

View File

@ -1,7 +0,0 @@
error: expected identifier, found `<<`
--> $DIR/issue-91139.rs:1:1
|
| ^^ expected identifier
error: aborting due to 1 previous error

View File

@ -1,24 +0,0 @@
error[E0311]: the parameter type `C` may not live long enough
--> $DIR/issue-92096.rs:19:33
|
LL | fn call_connect<C>(c: &'_ C) -> impl '_ + Future + Send
| ^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `C` will meet its required lifetime bounds
|
help: consider adding an explicit lifetime bound...
|
LL | C: Client + Send + Sync + 'a,
| ++++
error[E0311]: the parameter type `C` may not live long enough
--> $DIR/issue-92096.rs:19:33
|
LL | fn call_connect<C>(c: &'_ C) -> impl '_ + Future + Send
| ^^^^^^^^^^^^^^^^^^^^^^^ ...so that the type `C` will meet its required lifetime bounds
|
help: consider adding an explicit lifetime bound...
|
LL | C: Client + Send + Sync + 'a,
| ++++
error: aborting due to 2 previous errors

View File

@ -1,51 +0,0 @@
error[E0038]: the trait `StreamingIterator` is not dyn compatible
--> $DIR/trait-objects.rs:13:21
|
LL | fn min_size(x: &mut dyn for<'a> StreamingIterator<Item<'a> = &'a i32>) -> usize {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `StreamingIterator` is not dyn compatible
|
note: for a trait to be dyn compatible it needs to allow building a vtable
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
--> $DIR/trait-objects.rs:7:10
|
LL | trait StreamingIterator {
| ----------------- this trait is not dyn compatible...
LL | type Item<'a> where Self: 'a;
| ^^^^ ...because it contains the generic associated type `Item`
= help: consider moving `Item` to another trait
error[E0038]: the trait `StreamingIterator` is not dyn compatible
--> $DIR/trait-objects.rs:15:7
|
LL | x.size_hint().0
| ^^^^^^^^^ `StreamingIterator` is not dyn compatible
|
note: for a trait to be dyn compatible it needs to allow building a vtable
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
--> $DIR/trait-objects.rs:7:10
|
LL | trait StreamingIterator {
| ----------------- this trait is not dyn compatible...
LL | type Item<'a> where Self: 'a;
| ^^^^ ...because it contains the generic associated type `Item`
= help: consider moving `Item` to another trait
error[E0038]: the trait `StreamingIterator` is not dyn compatible
--> $DIR/trait-objects.rs:15:5
|
LL | x.size_hint().0
| ^^^^^^^^^^^^^ `StreamingIterator` is not dyn compatible
|
note: for a trait to be dyn compatible it needs to allow building a vtable
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
--> $DIR/trait-objects.rs:7:10
|
LL | trait StreamingIterator {
| ----------------- this trait is not dyn compatible...
LL | type Item<'a> where Self: 'a;
| ^^^^ ...because it contains the generic associated type `Item`
= help: consider moving `Item` to another trait
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0038`.

View File

@ -1,19 +0,0 @@
error[E0521]: borrowed data escapes outside of function
--> $DIR/trait-objects.rs:15:5
|
LL | fn min_size(x: &mut dyn for<'a> StreamingIterator<Item<'a> = &'a i32>) -> usize {
| - - let's call the lifetime of this reference `'1`
| |
| `x` is a reference that is only valid in the function body
LL |
LL | x.size_hint().0
| ^^^^^^^^^^^^^
| |
| `x` escapes the function body here
| argument requires that `'1` must outlive `'static`
|
= note: due to current limitations in the borrow checker, this implies a `'static` lifetime
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0521`.

View File

@ -1,13 +0,0 @@
error: unconstrained generic constant
--> $DIR/evaluatable-bounds.rs:16:5
|
LL | const ARRAY: [i32; Self::LEN];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: try adding a `where` bound
|
LL | const ARRAY: [i32; Self::LEN] where [(); Self::LEN]:;
| ++++++++++++++++++++++
error: aborting due to 1 previous error

View File

@ -1,71 +0,0 @@
warning: function cannot return without recursing
--> $DIR/hrtb-perfect-forwarding.rs:16:1
|
LL | / fn no_hrtb<'b, T>(mut t: T)
LL | | where
LL | | T: Bar<&'b isize>,
LL | | {
... |
LL | | no_hrtb(&mut t);
| | --------------- recursive call site
LL | | }
| |_^ cannot return without recursing
|
= note: `#[warn(unconditional_recursion)]` on by default
= help: a `loop` may express intention better if this is on purpose
warning: function cannot return without recursing
--> $DIR/hrtb-perfect-forwarding.rs:25:1
|
LL | / fn bar_hrtb<T>(mut t: T)
LL | | where
LL | | T: for<'b> Bar<&'b isize>,
LL | | {
... |
LL | | bar_hrtb(&mut t);
| | ---------------- recursive call site
LL | | }
| |_^ cannot return without recursing
|
= help: a `loop` may express intention better if this is on purpose
warning: function cannot return without recursing
--> $DIR/hrtb-perfect-forwarding.rs:35:1
|
LL | / fn foo_hrtb_bar_not<'b, T>(mut t: T)
LL | | where
LL | | T: for<'a> Foo<&'a isize> + Bar<&'b isize>,
LL | | {
... |
LL | | foo_hrtb_bar_not(&mut t);
| | ------------------------ recursive call site
LL | |
LL | |
LL | | }
| |_^ cannot return without recursing
|
= help: a `loop` may express intention better if this is on purpose
error: higher-ranked subtype error
--> $DIR/hrtb-perfect-forwarding.rs:43:5
|
LL | foo_hrtb_bar_not(&mut t);
| ^^^^^^^^^^^^^^^^^^^^^^^^
warning: function cannot return without recursing
--> $DIR/hrtb-perfect-forwarding.rs:48:1
|
LL | / fn foo_hrtb_bar_hrtb<T>(mut t: T)
LL | | where
LL | | T: for<'a> Foo<&'a isize> + for<'b> Bar<&'b isize>,
LL | | {
LL | | // OK -- now we have `T : for<'b> Bar<&'b isize>`.
LL | | foo_hrtb_bar_hrtb(&mut t);
| | ------------------------- recursive call site
LL | | }
| |_^ cannot return without recursing
|
= help: a `loop` may express intention better if this is on purpose
error: aborting due to 1 previous error; 4 warnings emitted

View File

@ -1,12 +0,0 @@
error[E0119]: conflicting implementations of trait `AnotherTrait` for type `D<_>`
--> $DIR/auto-trait-coherence.rs:24:1
|
LL | impl<T: Send> AnotherTrait for T {}
| -------------------------------- first implementation here
...
LL | impl AnotherTrait for D<OpaqueType> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `D<_>`
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0119`.

View File

@ -1,12 +0,0 @@
error[E0119]: conflicting implementations of trait `AnotherTrait` for type `D<_>`
--> $DIR/auto-trait-coherence.rs:24:1
|
LL | impl<T: Send> AnotherTrait for T {}
| -------------------------------- first implementation here
...
LL | impl AnotherTrait for D<OpaqueType> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `D<_>`
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0119`.

Some files were not shown because too many files have changed in this diff Show More