Auto merge of #139552 - matthiaskrgr:rollup-b194mk8, r=matthiaskrgr
Rollup of 10 pull requests Successful merges: - #139494 (Restrict some queries by def-kind more) - #139496 (Revert r-a changes of rust-lang/rust#139455) - #139506 (add missing word in doc comment (part 2)) - #139515 (Improve presentation of closure signature mismatch from `Fn` trait goal) - #139520 (compiletest maintenance: sort deps and drop dep on `anyhow`) - #139523 (Rustc dev guide subtree update) - #139526 (Fix deprecation note for std::intrinsics) - #139528 (compiletest: Remove the `--logfile` flag) - #139541 (Instantiate higher-ranked transmute goal w/ placeholders before emitting sub-obligations) - #139547 (Update library tracking issue template to set S-tracking-unimplemented) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
97c966bb40
37 changed files with 207 additions and 113 deletions
|
@ -2,7 +2,7 @@
|
||||||
name: Library Tracking Issue
|
name: Library Tracking Issue
|
||||||
about: A tracking issue for an unstable library feature.
|
about: A tracking issue for an unstable library feature.
|
||||||
title: Tracking Issue for XXX
|
title: Tracking Issue for XXX
|
||||||
labels: C-tracking-issue, T-libs-api
|
labels: C-tracking-issue, T-libs-api, S-tracking-unimplemented
|
||||||
---
|
---
|
||||||
<!--
|
<!--
|
||||||
Thank you for creating a tracking issue!
|
Thank you for creating a tracking issue!
|
||||||
|
@ -49,6 +49,8 @@ For larger features, more steps might be involved.
|
||||||
If the feature is changed later, please add those PRs here as well.
|
If the feature is changed later, please add those PRs here as well.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
(Remember to update the `S-tracking-*` label when checking boxes.)
|
||||||
|
|
||||||
- [ ] Implementation: #...
|
- [ ] Implementation: #...
|
||||||
- [ ] Final comment period (FCP)[^1]
|
- [ ] Final comment period (FCP)[^1]
|
||||||
- [ ] Stabilization PR
|
- [ ] Stabilization PR
|
||||||
|
|
|
@ -718,7 +718,6 @@ name = "compiletest"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anstyle-svg",
|
"anstyle-svg",
|
||||||
"anyhow",
|
|
||||||
"build_helper",
|
"build_helper",
|
||||||
"colored",
|
"colored",
|
||||||
"diff",
|
"diff",
|
||||||
|
|
|
@ -647,9 +647,9 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
|
||||||
#[rustc_lint_diagnostics]
|
#[rustc_lint_diagnostics]
|
||||||
pub fn note_expected_found(
|
pub fn note_expected_found(
|
||||||
&mut self,
|
&mut self,
|
||||||
expected_label: &dyn fmt::Display,
|
expected_label: &str,
|
||||||
expected: DiagStyledString,
|
expected: DiagStyledString,
|
||||||
found_label: &dyn fmt::Display,
|
found_label: &str,
|
||||||
found: DiagStyledString,
|
found: DiagStyledString,
|
||||||
) -> &mut Self {
|
) -> &mut Self {
|
||||||
self.note_expected_found_extra(
|
self.note_expected_found_extra(
|
||||||
|
@ -665,9 +665,9 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
|
||||||
#[rustc_lint_diagnostics]
|
#[rustc_lint_diagnostics]
|
||||||
pub fn note_expected_found_extra(
|
pub fn note_expected_found_extra(
|
||||||
&mut self,
|
&mut self,
|
||||||
expected_label: &dyn fmt::Display,
|
expected_label: &str,
|
||||||
expected: DiagStyledString,
|
expected: DiagStyledString,
|
||||||
found_label: &dyn fmt::Display,
|
found_label: &str,
|
||||||
found: DiagStyledString,
|
found: DiagStyledString,
|
||||||
expected_extra: DiagStyledString,
|
expected_extra: DiagStyledString,
|
||||||
found_extra: DiagStyledString,
|
found_extra: DiagStyledString,
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
//! At present, however, we do run collection across all items in the
|
//! At present, however, we do run collection across all items in the
|
||||||
//! crate as a kind of pass. This should eventually be factored away.
|
//! crate as a kind of pass. This should eventually be factored away.
|
||||||
|
|
||||||
|
use std::assert_matches::assert_matches;
|
||||||
use std::cell::Cell;
|
use std::cell::Cell;
|
||||||
use std::iter;
|
use std::iter;
|
||||||
use std::ops::Bound;
|
use std::ops::Bound;
|
||||||
|
@ -1344,7 +1345,8 @@ fn fn_sig(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::EarlyBinder<'_, ty::PolyFn
|
||||||
compute_sig_of_foreign_fn_decl(tcx, def_id, sig.decl, abi, sig.header.safety())
|
compute_sig_of_foreign_fn_decl(tcx, def_id, sig.decl, abi, sig.header.safety())
|
||||||
}
|
}
|
||||||
|
|
||||||
Ctor(data) | Variant(hir::Variant { data, .. }) if data.ctor().is_some() => {
|
Ctor(data) => {
|
||||||
|
assert_matches!(data.ctor(), Some(_));
|
||||||
let adt_def_id = tcx.hir_get_parent_item(hir_id).def_id.to_def_id();
|
let adt_def_id = tcx.hir_get_parent_item(hir_id).def_id.to_def_id();
|
||||||
let ty = tcx.type_of(adt_def_id).instantiate_identity();
|
let ty = tcx.type_of(adt_def_id).instantiate_identity();
|
||||||
let inputs = data.fields().iter().map(|f| tcx.type_of(f.def_id).instantiate_identity());
|
let inputs = data.fields().iter().map(|f| tcx.type_of(f.def_id).instantiate_identity());
|
||||||
|
|
|
@ -44,13 +44,13 @@ fn variances_of(tcx: TyCtxt<'_>, item_def_id: LocalDefId) -> &[ty::Variance] {
|
||||||
return &[];
|
return &[];
|
||||||
}
|
}
|
||||||
|
|
||||||
match tcx.def_kind(item_def_id) {
|
let kind = tcx.def_kind(item_def_id);
|
||||||
|
match kind {
|
||||||
DefKind::Fn
|
DefKind::Fn
|
||||||
| DefKind::AssocFn
|
| DefKind::AssocFn
|
||||||
| DefKind::Enum
|
| DefKind::Enum
|
||||||
| DefKind::Struct
|
| DefKind::Struct
|
||||||
| DefKind::Union
|
| DefKind::Union
|
||||||
| DefKind::Variant
|
|
||||||
| DefKind::Ctor(..) => {
|
| DefKind::Ctor(..) => {
|
||||||
// These are inferred.
|
// These are inferred.
|
||||||
let crate_map = tcx.crate_variances(());
|
let crate_map = tcx.crate_variances(());
|
||||||
|
@ -89,7 +89,11 @@ fn variances_of(tcx: TyCtxt<'_>, item_def_id: LocalDefId) -> &[ty::Variance] {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Variance not relevant.
|
// Variance not relevant.
|
||||||
span_bug!(tcx.def_span(item_def_id), "asked to compute variance for wrong kind of item");
|
span_bug!(
|
||||||
|
tcx.def_span(item_def_id),
|
||||||
|
"asked to compute variance for {}",
|
||||||
|
kind.descr(item_def_id.to_def_id())
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone)]
|
#[derive(Debug, Copy, Clone)]
|
||||||
|
|
|
@ -513,7 +513,7 @@ impl Subdiagnostic for BuiltinClashingExternSub<'_> {
|
||||||
expected_str.push(self.expected.fn_sig(self.tcx).to_string(), false);
|
expected_str.push(self.expected.fn_sig(self.tcx).to_string(), false);
|
||||||
let mut found_str = DiagStyledString::new();
|
let mut found_str = DiagStyledString::new();
|
||||||
found_str.push(self.found.fn_sig(self.tcx).to_string(), true);
|
found_str.push(self.found.fn_sig(self.tcx).to_string(), true);
|
||||||
diag.note_expected_found(&"", expected_str, &"", found_str);
|
diag.note_expected_found("", expected_str, "", found_str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1099,7 +1099,6 @@ fn should_encode_variances<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId, def_kind: Def
|
||||||
DefKind::Struct
|
DefKind::Struct
|
||||||
| DefKind::Union
|
| DefKind::Union
|
||||||
| DefKind::Enum
|
| DefKind::Enum
|
||||||
| DefKind::Variant
|
|
||||||
| DefKind::OpaqueTy
|
| DefKind::OpaqueTy
|
||||||
| DefKind::Fn
|
| DefKind::Fn
|
||||||
| DefKind::Ctor(..)
|
| DefKind::Ctor(..)
|
||||||
|
@ -1109,6 +1108,7 @@ fn should_encode_variances<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId, def_kind: Def
|
||||||
matches!(tcx.opt_rpitit_info(def_id), Some(ty::ImplTraitInTraitData::Trait { .. }))
|
matches!(tcx.opt_rpitit_info(def_id), Some(ty::ImplTraitInTraitData::Trait { .. }))
|
||||||
}
|
}
|
||||||
DefKind::Mod
|
DefKind::Mod
|
||||||
|
| DefKind::Variant
|
||||||
| DefKind::Field
|
| DefKind::Field
|
||||||
| DefKind::AssocConst
|
| DefKind::AssocConst
|
||||||
| DefKind::TyParam
|
| DefKind::TyParam
|
||||||
|
|
|
@ -967,7 +967,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
|
||||||
format!("...so that the {}", sup_trace.cause.as_requirement_str()),
|
format!("...so that the {}", sup_trace.cause.as_requirement_str()),
|
||||||
);
|
);
|
||||||
|
|
||||||
err.note_expected_found(&"", sup_expected, &"", sup_found);
|
err.note_expected_found("", sup_expected, "", sup_found);
|
||||||
return if sub_region.is_error() | sup_region.is_error() {
|
return if sub_region.is_error() | sup_region.is_error() {
|
||||||
err.delay_as_bug()
|
err.delay_as_bug()
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -2,6 +2,7 @@ use core::ops::ControlFlow;
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
|
use rustc_abi::ExternAbi;
|
||||||
use rustc_ast::TraitObjectSyntax;
|
use rustc_ast::TraitObjectSyntax;
|
||||||
use rustc_data_structures::fx::FxHashMap;
|
use rustc_data_structures::fx::FxHashMap;
|
||||||
use rustc_data_structures::unord::UnordSet;
|
use rustc_data_structures::unord::UnordSet;
|
||||||
|
@ -2799,32 +2800,57 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note any argument mismatches
|
// Note any argument mismatches
|
||||||
let given_ty = params.skip_binder();
|
let ty::Tuple(given) = *params.skip_binder().kind() else {
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
let expected_ty = trait_pred.skip_binder().trait_ref.args.type_at(1);
|
let expected_ty = trait_pred.skip_binder().trait_ref.args.type_at(1);
|
||||||
if let ty::Tuple(given) = given_ty.kind()
|
let ty::Tuple(expected) = *expected_ty.kind() else {
|
||||||
&& let ty::Tuple(expected) = expected_ty.kind()
|
return;
|
||||||
{
|
};
|
||||||
if expected.len() != given.len() {
|
|
||||||
// Note number of types that were expected and given
|
if expected.len() != given.len() {
|
||||||
err.note(
|
// Note number of types that were expected and given
|
||||||
format!(
|
err.note(format!(
|
||||||
"expected a closure taking {} argument{}, but one taking {} argument{} was given",
|
"expected a closure taking {} argument{}, but one taking {} argument{} was given",
|
||||||
given.len(),
|
given.len(),
|
||||||
pluralize!(given.len()),
|
pluralize!(given.len()),
|
||||||
expected.len(),
|
expected.len(),
|
||||||
pluralize!(expected.len()),
|
pluralize!(expected.len()),
|
||||||
)
|
));
|
||||||
);
|
return;
|
||||||
} else if !self.same_type_modulo_infer(given_ty, expected_ty) {
|
}
|
||||||
// Print type mismatch
|
|
||||||
let (expected_args, given_args) = self.cmp(given_ty, expected_ty);
|
let given_ty = Ty::new_fn_ptr(
|
||||||
err.note_expected_found(
|
self.tcx,
|
||||||
&"a closure with arguments",
|
params.rebind(self.tcx.mk_fn_sig(
|
||||||
expected_args,
|
given,
|
||||||
&"a closure with arguments",
|
self.tcx.types.unit,
|
||||||
given_args,
|
false,
|
||||||
);
|
hir::Safety::Safe,
|
||||||
}
|
ExternAbi::Rust,
|
||||||
|
)),
|
||||||
|
);
|
||||||
|
let expected_ty = Ty::new_fn_ptr(
|
||||||
|
self.tcx,
|
||||||
|
trait_pred.rebind(self.tcx.mk_fn_sig(
|
||||||
|
expected,
|
||||||
|
self.tcx.types.unit,
|
||||||
|
false,
|
||||||
|
hir::Safety::Safe,
|
||||||
|
ExternAbi::Rust,
|
||||||
|
)),
|
||||||
|
);
|
||||||
|
|
||||||
|
if !self.same_type_modulo_infer(given_ty, expected_ty) {
|
||||||
|
// Print type mismatch
|
||||||
|
let (expected_args, given_args) = self.cmp(expected_ty, given_ty);
|
||||||
|
err.note_expected_found(
|
||||||
|
"a closure with signature",
|
||||||
|
expected_args,
|
||||||
|
"a closure with signature",
|
||||||
|
given_args,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -415,7 +415,7 @@ impl Subdiagnostic for RegionOriginNote<'_> {
|
||||||
label_or_note(span, fluent::trait_selection_subtype);
|
label_or_note(span, fluent::trait_selection_subtype);
|
||||||
diag.arg("requirement", requirement);
|
diag.arg("requirement", requirement);
|
||||||
|
|
||||||
diag.note_expected_found(&"", expected, &"", found);
|
diag.note_expected_found("", expected, "", found);
|
||||||
}
|
}
|
||||||
RegionOriginNote::WithRequirement { span, requirement, expected_found: None } => {
|
RegionOriginNote::WithRequirement { span, requirement, expected_found: None } => {
|
||||||
// FIXME: this really should be handled at some earlier stage. Our
|
// FIXME: this really should be handled at some earlier stage. Our
|
||||||
|
|
|
@ -317,7 +317,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||||
obligation.cause.clone(),
|
obligation.cause.clone(),
|
||||||
obligation.recursion_depth + 1,
|
obligation.recursion_depth + 1,
|
||||||
obligation.param_env,
|
obligation.param_env,
|
||||||
obligation.predicate.rebind(trait_ref),
|
trait_ref,
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -343,7 +343,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||||
obligation.cause.clone(),
|
obligation.cause.clone(),
|
||||||
obligation.recursion_depth + 1,
|
obligation.recursion_depth + 1,
|
||||||
obligation.param_env,
|
obligation.param_env,
|
||||||
obligation.predicate.rebind(outlives),
|
outlives,
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -404,7 +404,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let predicate = obligation.predicate.skip_binder();
|
let predicate = self.infcx.enter_forall_and_leak_universe(obligation.predicate);
|
||||||
|
|
||||||
let mut assume = predicate.trait_ref.args.const_at(2);
|
let mut assume = predicate.trait_ref.args.const_at(2);
|
||||||
// FIXME(mgca): We should shallowly normalize this.
|
// FIXME(mgca): We should shallowly normalize this.
|
||||||
|
|
|
@ -4,9 +4,9 @@ use rustc_data_structures::fx::FxHashMap;
|
||||||
use rustc_hir as hir;
|
use rustc_hir as hir;
|
||||||
use rustc_hir::def::DefKind;
|
use rustc_hir::def::DefKind;
|
||||||
use rustc_hir::def_id::LocalDefId;
|
use rustc_hir::def_id::LocalDefId;
|
||||||
use rustc_middle::bug;
|
|
||||||
use rustc_middle::query::Providers;
|
use rustc_middle::query::Providers;
|
||||||
use rustc_middle::ty::{self, Ty, TyCtxt, fold_regions};
|
use rustc_middle::ty::{self, Ty, TyCtxt, fold_regions};
|
||||||
|
use rustc_middle::{bug, span_bug};
|
||||||
use rustc_span::Span;
|
use rustc_span::Span;
|
||||||
|
|
||||||
pub(crate) fn provide(providers: &mut Providers) {
|
pub(crate) fn provide(providers: &mut Providers) {
|
||||||
|
@ -21,7 +21,8 @@ pub(crate) fn provide(providers: &mut Providers) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn assumed_wf_types<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) -> &'tcx [(Ty<'tcx>, Span)] {
|
fn assumed_wf_types<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) -> &'tcx [(Ty<'tcx>, Span)] {
|
||||||
match tcx.def_kind(def_id) {
|
let kind = tcx.def_kind(def_id);
|
||||||
|
match kind {
|
||||||
DefKind::Fn => {
|
DefKind::Fn => {
|
||||||
let sig = tcx.fn_sig(def_id).instantiate_identity();
|
let sig = tcx.fn_sig(def_id).instantiate_identity();
|
||||||
let liberated_sig = tcx.liberate_late_bound_regions(def_id.to_def_id(), sig);
|
let liberated_sig = tcx.liberate_late_bound_regions(def_id.to_def_id(), sig);
|
||||||
|
@ -121,32 +122,38 @@ fn assumed_wf_types<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) -> &'tcx [(Ty<'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DefKind::AssocConst | DefKind::AssocTy => tcx.assumed_wf_types(tcx.local_parent(def_id)),
|
DefKind::AssocConst | DefKind::AssocTy => tcx.assumed_wf_types(tcx.local_parent(def_id)),
|
||||||
DefKind::OpaqueTy => bug!("implied bounds are not defined for opaques"),
|
DefKind::Static { .. }
|
||||||
DefKind::Mod
|
| DefKind::Const
|
||||||
|
| DefKind::AnonConst
|
||||||
|
| DefKind::InlineConst
|
||||||
| DefKind::Struct
|
| DefKind::Struct
|
||||||
| DefKind::Union
|
| DefKind::Union
|
||||||
| DefKind::Enum
|
| DefKind::Enum
|
||||||
| DefKind::Variant
|
|
||||||
| DefKind::Trait
|
| DefKind::Trait
|
||||||
| DefKind::TyAlias
|
|
||||||
| DefKind::ForeignTy
|
|
||||||
| DefKind::TraitAlias
|
| DefKind::TraitAlias
|
||||||
|
| DefKind::TyAlias => ty::List::empty(),
|
||||||
|
DefKind::OpaqueTy
|
||||||
|
| DefKind::Mod
|
||||||
|
| DefKind::Variant
|
||||||
|
| DefKind::ForeignTy
|
||||||
| DefKind::TyParam
|
| DefKind::TyParam
|
||||||
| DefKind::Const
|
|
||||||
| DefKind::ConstParam
|
| DefKind::ConstParam
|
||||||
| DefKind::Static { .. }
|
|
||||||
| DefKind::Ctor(_, _)
|
| DefKind::Ctor(_, _)
|
||||||
| DefKind::Macro(_)
|
| DefKind::Macro(_)
|
||||||
| DefKind::ExternCrate
|
| DefKind::ExternCrate
|
||||||
| DefKind::Use
|
| DefKind::Use
|
||||||
| DefKind::ForeignMod
|
| DefKind::ForeignMod
|
||||||
| DefKind::AnonConst
|
|
||||||
| DefKind::InlineConst
|
|
||||||
| DefKind::Field
|
| DefKind::Field
|
||||||
| DefKind::LifetimeParam
|
| DefKind::LifetimeParam
|
||||||
| DefKind::GlobalAsm
|
| DefKind::GlobalAsm
|
||||||
| DefKind::Closure
|
| DefKind::Closure
|
||||||
| DefKind::SyntheticCoroutineBody => ty::List::empty(),
|
| DefKind::SyntheticCoroutineBody => {
|
||||||
|
span_bug!(
|
||||||
|
tcx.def_span(def_id),
|
||||||
|
"`assumed_wf_types` not defined for {} `{def_id:?}`",
|
||||||
|
kind.descr(def_id.to_def_id())
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,10 +3,10 @@ use rustc_hir::def::DefKind;
|
||||||
use rustc_hir::def_id::LocalDefId;
|
use rustc_hir::def_id::LocalDefId;
|
||||||
use rustc_hir::intravisit;
|
use rustc_hir::intravisit;
|
||||||
use rustc_hir::intravisit::Visitor;
|
use rustc_hir::intravisit::Visitor;
|
||||||
use rustc_middle::bug;
|
|
||||||
use rustc_middle::query::Providers;
|
use rustc_middle::query::Providers;
|
||||||
use rustc_middle::ty::util::{CheckRegions, NotUniqueParam};
|
use rustc_middle::ty::util::{CheckRegions, NotUniqueParam};
|
||||||
use rustc_middle::ty::{self, Ty, TyCtxt, TypeSuperVisitable, TypeVisitable, TypeVisitor};
|
use rustc_middle::ty::{self, Ty, TyCtxt, TypeSuperVisitable, TypeVisitable, TypeVisitor};
|
||||||
|
use rustc_middle::{bug, span_bug};
|
||||||
use rustc_span::Span;
|
use rustc_span::Span;
|
||||||
use tracing::{instrument, trace};
|
use tracing::{instrument, trace};
|
||||||
|
|
||||||
|
@ -320,9 +320,12 @@ fn opaque_types_defined_by<'tcx>(
|
||||||
| DefKind::AnonConst => {
|
| DefKind::AnonConst => {
|
||||||
collector.collect_taits_declared_in_body();
|
collector.collect_taits_declared_in_body();
|
||||||
}
|
}
|
||||||
|
// Closures and coroutines are type checked with their parent
|
||||||
|
DefKind::Closure | DefKind::InlineConst => {
|
||||||
|
collector.opaques.extend(tcx.opaque_types_defined_by(tcx.local_parent(item)));
|
||||||
|
}
|
||||||
|
DefKind::AssocTy | DefKind::TyAlias | DefKind::GlobalAsm => {}
|
||||||
DefKind::OpaqueTy
|
DefKind::OpaqueTy
|
||||||
| DefKind::TyAlias
|
|
||||||
| DefKind::AssocTy
|
|
||||||
| DefKind::Mod
|
| DefKind::Mod
|
||||||
| DefKind::Struct
|
| DefKind::Struct
|
||||||
| DefKind::Union
|
| DefKind::Union
|
||||||
|
@ -340,12 +343,13 @@ fn opaque_types_defined_by<'tcx>(
|
||||||
| DefKind::ForeignMod
|
| DefKind::ForeignMod
|
||||||
| DefKind::Field
|
| DefKind::Field
|
||||||
| DefKind::LifetimeParam
|
| DefKind::LifetimeParam
|
||||||
| DefKind::GlobalAsm
|
|
||||||
| DefKind::Impl { .. }
|
| DefKind::Impl { .. }
|
||||||
| DefKind::SyntheticCoroutineBody => {}
|
| DefKind::SyntheticCoroutineBody => {
|
||||||
// Closures and coroutines are type checked with their parent
|
span_bug!(
|
||||||
DefKind::Closure | DefKind::InlineConst => {
|
tcx.def_span(item),
|
||||||
collector.opaques.extend(tcx.opaque_types_defined_by(tcx.local_parent(item)));
|
"`opaque_types_defined_by` not defined for {} `{item:?}`",
|
||||||
|
kind.descr(item.to_def_id())
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tcx.mk_local_def_ids(&collector.opaques)
|
tcx.mk_local_def_ids(&collector.opaques)
|
||||||
|
|
|
@ -116,7 +116,7 @@ pub fn walk_types<'tcx, V: SpannedTypeVisitor<'tcx>>(
|
||||||
"{kind:?} has not seen any uses of `walk_types` yet, ping oli-obk if you'd like any help"
|
"{kind:?} has not seen any uses of `walk_types` yet, ping oli-obk if you'd like any help"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
// These don't have any types.
|
// These don't have any types, but are visited during privacy checking.
|
||||||
| DefKind::ExternCrate
|
| DefKind::ExternCrate
|
||||||
| DefKind::ForeignMod
|
| DefKind::ForeignMod
|
||||||
| DefKind::ForeignTy
|
| DefKind::ForeignTy
|
||||||
|
|
|
@ -3720,7 +3720,7 @@ pub const fn ptr_metadata<P: ptr::Pointee<Metadata = M> + ?Sized, M>(ptr: *const
|
||||||
/// [`Vec::append`]: ../../std/vec/struct.Vec.html#method.append
|
/// [`Vec::append`]: ../../std/vec/struct.Vec.html#method.append
|
||||||
#[doc(alias = "memcpy")]
|
#[doc(alias = "memcpy")]
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[rustc_allowed_through_unstable_modules = "import this function via `std::mem` instead"]
|
#[rustc_allowed_through_unstable_modules = "import this function via `std::ptr` instead"]
|
||||||
#[rustc_const_stable(feature = "const_intrinsic_copy", since = "1.83.0")]
|
#[rustc_const_stable(feature = "const_intrinsic_copy", since = "1.83.0")]
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
|
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
|
||||||
|
@ -3823,7 +3823,7 @@ pub const unsafe fn copy_nonoverlapping<T>(src: *const T, dst: *mut T, count: us
|
||||||
/// ```
|
/// ```
|
||||||
#[doc(alias = "memmove")]
|
#[doc(alias = "memmove")]
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[rustc_allowed_through_unstable_modules = "import this function via `std::mem` instead"]
|
#[rustc_allowed_through_unstable_modules = "import this function via `std::ptr` instead"]
|
||||||
#[rustc_const_stable(feature = "const_intrinsic_copy", since = "1.83.0")]
|
#[rustc_const_stable(feature = "const_intrinsic_copy", since = "1.83.0")]
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
|
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
|
||||||
|
@ -3903,7 +3903,7 @@ pub const unsafe fn copy<T>(src: *const T, dst: *mut T, count: usize) {
|
||||||
/// ```
|
/// ```
|
||||||
#[doc(alias = "memset")]
|
#[doc(alias = "memset")]
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[rustc_allowed_through_unstable_modules = "import this function via `std::mem` instead"]
|
#[rustc_allowed_through_unstable_modules = "import this function via `std::ptr` instead"]
|
||||||
#[rustc_const_stable(feature = "const_ptr_write", since = "1.83.0")]
|
#[rustc_const_stable(feature = "const_ptr_write", since = "1.83.0")]
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
|
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
|
||||||
|
|
|
@ -189,7 +189,7 @@ pub enum GccCiMode {
|
||||||
///
|
///
|
||||||
/// Note that this structure is not decoded directly into, but rather it is
|
/// Note that this structure is not decoded directly into, but rather it is
|
||||||
/// filled out from the decoded forms of the structs below. For documentation
|
/// filled out from the decoded forms of the structs below. For documentation
|
||||||
/// each field, see the corresponding fields in
|
/// on each field, see the corresponding fields in
|
||||||
/// `bootstrap.example.toml`.
|
/// `bootstrap.example.toml`.
|
||||||
#[derive(Default, Clone)]
|
#[derive(Default, Clone)]
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[book]
|
[book]
|
||||||
title = "Rust Compiler Development Guide"
|
title = "Rust Compiler Development Guide"
|
||||||
author = "The Rust Project Developers"
|
authors = ["The Rust Project Developers"]
|
||||||
description = "A guide to developing the Rust compiler (rustc)"
|
description = "A guide to developing the Rust compiler (rustc)"
|
||||||
|
|
||||||
[build]
|
[build]
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
ae9173d7dd4a31806c950c90dcc331f1508b4d17
|
25a615bf829b9f6d6f22da537e3851043f92e5f2
|
||||||
|
|
|
@ -110,7 +110,7 @@ See [`compute_hir_hash`] for where the hash is actually computed.
|
||||||
|
|
||||||
[SVH]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_data_structures/svh/struct.Svh.html
|
[SVH]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_data_structures/svh/struct.Svh.html
|
||||||
[incremental compilation]: ../queries/incremental-compilation.md
|
[incremental compilation]: ../queries/incremental-compilation.md
|
||||||
[`compute_hir_hash`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_ast_lowering/struct.LoweringContext.html#method.compute_hir_hash
|
[`compute_hir_hash`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_ast_lowering/fn.compute_hir_hash.html
|
||||||
|
|
||||||
### Stable Crate Id
|
### Stable Crate Id
|
||||||
|
|
||||||
|
|
|
@ -90,7 +90,9 @@ does is call the `main()` that's in this crate's `lib.rs`, though.)
|
||||||
are in `tests/rustdoc-gui`. These use a [NodeJS tool called
|
are in `tests/rustdoc-gui`. These use a [NodeJS tool called
|
||||||
browser-UI-test](https://github.com/GuillaumeGomez/browser-UI-test/) that uses
|
browser-UI-test](https://github.com/GuillaumeGomez/browser-UI-test/) that uses
|
||||||
puppeteer to run tests in a headless browser and check rendering and
|
puppeteer to run tests in a headless browser and check rendering and
|
||||||
interactivity.
|
interactivity. For information on how to write this form of test,
|
||||||
|
see [`tests/rustdoc-gui/README.md`][rustdoc-gui-readme]
|
||||||
|
as well as [the description of the `.goml` format][goml-script]
|
||||||
* Additionally, JavaScript type annotations are written using [TypeScript-flavored JSDoc]
|
* Additionally, JavaScript type annotations are written using [TypeScript-flavored JSDoc]
|
||||||
comments and an external d.ts file. The code itself is plain, valid JavaScript; we only
|
comments and an external d.ts file. The code itself is plain, valid JavaScript; we only
|
||||||
use tsc as a linter.
|
use tsc as a linter.
|
||||||
|
@ -100,6 +102,8 @@ does is call the `main()` that's in this crate's `lib.rs`, though.)
|
||||||
[These tests have several extra directives available to them](./rustdoc-internals/rustdoc-test-suite.md).
|
[These tests have several extra directives available to them](./rustdoc-internals/rustdoc-test-suite.md).
|
||||||
|
|
||||||
[TypeScript-flavored JSDoc]: https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html
|
[TypeScript-flavored JSDoc]: https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html
|
||||||
|
[rustdoc-gui-readme]: https://github.com/rust-lang/rust/blob/master/tests/rustdoc-gui/README.md
|
||||||
|
[goml-script]: https://github.com/GuillaumeGomez/browser-UI-test/blob/master/goml-script.md
|
||||||
|
|
||||||
## Constraints
|
## Constraints
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,8 @@
|
||||||
FIXME(jieyouxu) completely revise this chapter.
|
FIXME(jieyouxu) completely revise this chapter.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
Directives are special comments that tell compiletest how to build and interpret a test. They must appear before the Rust source in the test. They may also appear in `rmake.rs` [run-make tests](compiletest.md#run-make-tests).
|
Directives are special comments that tell compiletest how to build and interpret a test.
|
||||||
|
They may also appear in `rmake.rs` [run-make tests](compiletest.md#run-make-tests).
|
||||||
|
|
||||||
They are normally put after the short comment that explains the point of this
|
They are normally put after the short comment that explains the point of this
|
||||||
test. Compiletest test suites use `//@` to signal that a comment is a directive.
|
test. Compiletest test suites use `//@` to signal that a comment is a directive.
|
||||||
|
|
|
@ -335,8 +335,9 @@ But for strict testing, try to use the `ERROR` annotation as much as possible,
|
||||||
including `//~?` annotations for diagnostics without span.
|
including `//~?` annotations for diagnostics without span.
|
||||||
For compile time diagnostics `error-pattern` should very rarely be necessary.
|
For compile time diagnostics `error-pattern` should very rarely be necessary.
|
||||||
|
|
||||||
Per-line annotations (`//~`) are still checked in tests using `error-pattern`,
|
Per-line annotations (`//~`) are still checked in tests using `error-pattern`.
|
||||||
to opt out of these checks in exceptional cases use `//@ compile-flags: --error-format=human`.
|
To opt out of these checks, use `//@ compile-flags: --error-format=human`.
|
||||||
|
Do that only in exceptional cases.
|
||||||
|
|
||||||
### Error levels
|
### Error levels
|
||||||
|
|
||||||
|
|
|
@ -7,25 +7,26 @@ edition = "2021"
|
||||||
doctest = false
|
doctest = false
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
# tidy-alphabetical-start
|
||||||
anstyle-svg = "0.1.3"
|
anstyle-svg = "0.1.3"
|
||||||
|
build_helper = { path = "../../build_helper" }
|
||||||
colored = "2"
|
colored = "2"
|
||||||
diff = "0.1.10"
|
diff = "0.1.10"
|
||||||
unified-diff = "0.2.1"
|
|
||||||
getopts = "0.2"
|
getopts = "0.2"
|
||||||
|
glob = "0.3.0"
|
||||||
|
home = "0.5.5"
|
||||||
indexmap = "2.0.0"
|
indexmap = "2.0.0"
|
||||||
miropt-test-tools = { path = "../miropt-test-tools" }
|
miropt-test-tools = { path = "../miropt-test-tools" }
|
||||||
build_helper = { path = "../../build_helper" }
|
|
||||||
tracing = "0.1"
|
|
||||||
tracing-subscriber = { version = "0.3.3", default-features = false, features = ["ansi", "env-filter", "fmt", "parking_lot", "smallvec"] }
|
|
||||||
regex = "1.0"
|
regex = "1.0"
|
||||||
|
rustfix = "0.8.1"
|
||||||
semver = { version = "1.0.23", features = ["serde"] }
|
semver = { version = "1.0.23", features = ["serde"] }
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
rustfix = "0.8.1"
|
tracing = "0.1"
|
||||||
|
tracing-subscriber = { version = "0.3.3", default-features = false, features = ["ansi", "env-filter", "fmt", "parking_lot", "smallvec"] }
|
||||||
|
unified-diff = "0.2.1"
|
||||||
walkdir = "2"
|
walkdir = "2"
|
||||||
glob = "0.3.0"
|
# tidy-alphabetical-end
|
||||||
anyhow = "1"
|
|
||||||
home = "0.5.5"
|
|
||||||
|
|
||||||
[target.'cfg(unix)'.dependencies]
|
[target.'cfg(unix)'.dependencies]
|
||||||
libc = "0.2"
|
libc = "0.2"
|
||||||
|
|
|
@ -275,9 +275,6 @@ pub struct Config {
|
||||||
/// Explicitly enable or disable running.
|
/// Explicitly enable or disable running.
|
||||||
pub run: Option<bool>,
|
pub run: Option<bool>,
|
||||||
|
|
||||||
/// Write out a parseable log of tests that were run
|
|
||||||
pub logfile: Option<PathBuf>,
|
|
||||||
|
|
||||||
/// A command line to prefix program execution with,
|
/// A command line to prefix program execution with,
|
||||||
/// for running under valgrind for example.
|
/// for running under valgrind for example.
|
||||||
///
|
///
|
||||||
|
|
|
@ -138,7 +138,7 @@ fn test_opts(config: &Config) -> test::TestOpts {
|
||||||
filter_exact: config.filter_exact,
|
filter_exact: config.filter_exact,
|
||||||
run_ignored: if config.run_ignored { test::RunIgnored::Yes } else { test::RunIgnored::No },
|
run_ignored: if config.run_ignored { test::RunIgnored::Yes } else { test::RunIgnored::No },
|
||||||
format: config.format.to_libtest(),
|
format: config.format.to_libtest(),
|
||||||
logfile: config.logfile.clone(),
|
logfile: None,
|
||||||
run_tests: true,
|
run_tests: true,
|
||||||
bench_benchmarks: true,
|
bench_benchmarks: true,
|
||||||
nocapture: config.nocapture,
|
nocapture: config.nocapture,
|
||||||
|
|
|
@ -139,7 +139,6 @@ pub fn parse_config(args: Vec<String>) -> Config {
|
||||||
.optflag("", "quiet", "print one character per test instead of one line")
|
.optflag("", "quiet", "print one character per test instead of one line")
|
||||||
.optopt("", "color", "coloring: auto, always, never", "WHEN")
|
.optopt("", "color", "coloring: auto, always, never", "WHEN")
|
||||||
.optflag("", "json", "emit json output instead of plaintext output")
|
.optflag("", "json", "emit json output instead of plaintext output")
|
||||||
.optopt("", "logfile", "file to log test execution to", "FILE")
|
|
||||||
.optopt("", "target", "the target to build for", "TARGET")
|
.optopt("", "target", "the target to build for", "TARGET")
|
||||||
.optopt("", "host", "the host to build for", "HOST")
|
.optopt("", "host", "the host to build for", "HOST")
|
||||||
.optopt("", "cdb", "path to CDB to use for CDB debuginfo tests", "PATH")
|
.optopt("", "cdb", "path to CDB to use for CDB debuginfo tests", "PATH")
|
||||||
|
@ -378,7 +377,6 @@ pub fn parse_config(args: Vec<String>) -> Config {
|
||||||
"never" => Some(false),
|
"never" => Some(false),
|
||||||
_ => panic!("unknown `--run` option `{}` given", mode),
|
_ => panic!("unknown `--run` option `{}` given", mode),
|
||||||
}),
|
}),
|
||||||
logfile: matches.opt_str("logfile").map(|s| PathBuf::from(&s)),
|
|
||||||
runner: matches.opt_str("runner"),
|
runner: matches.opt_str("runner"),
|
||||||
host_rustcflags: matches.opt_strs("host-rustcflags"),
|
host_rustcflags: matches.opt_strs("host-rustcflags"),
|
||||||
target_rustcflags: matches.opt_strs("target-rustcflags"),
|
target_rustcflags: matches.opt_strs("target-rustcflags"),
|
||||||
|
|
|
@ -10,7 +10,6 @@ use std::process::{Child, Command, ExitStatus, Output, Stdio};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::{env, iter, str};
|
use std::{env, iter, str};
|
||||||
|
|
||||||
use anyhow::Context;
|
|
||||||
use colored::Colorize;
|
use colored::Colorize;
|
||||||
use regex::{Captures, Regex};
|
use regex::{Captures, Regex};
|
||||||
use tracing::*;
|
use tracing::*;
|
||||||
|
@ -143,11 +142,11 @@ pub fn run(config: Arc<Config>, testpaths: &TestPaths, revision: Option<&str>) {
|
||||||
}
|
}
|
||||||
|
|
||||||
let cx = TestCx { config: &config, props: &props, testpaths, revision };
|
let cx = TestCx { config: &config, props: &props, testpaths, revision };
|
||||||
create_dir_all(&cx.output_base_dir())
|
|
||||||
.with_context(|| {
|
if let Err(e) = create_dir_all(&cx.output_base_dir()) {
|
||||||
format!("failed to create output base directory {}", cx.output_base_dir().display())
|
panic!("failed to create output base directory {}: {e}", cx.output_base_dir().display());
|
||||||
})
|
}
|
||||||
.unwrap();
|
|
||||||
if props.incremental {
|
if props.incremental {
|
||||||
cx.init_incremental_test();
|
cx.init_incremental_test();
|
||||||
}
|
}
|
||||||
|
|
|
@ -400,6 +400,7 @@ pub enum FnAbi {
|
||||||
Rust,
|
Rust,
|
||||||
RustCall,
|
RustCall,
|
||||||
RustCold,
|
RustCold,
|
||||||
|
RustIntrinsic,
|
||||||
Stdcall,
|
Stdcall,
|
||||||
StdcallUnwind,
|
StdcallUnwind,
|
||||||
System,
|
System,
|
||||||
|
@ -456,6 +457,7 @@ impl FnAbi {
|
||||||
s if *s == sym::riscv_dash_interrupt_dash_s => FnAbi::RiscvInterruptS,
|
s if *s == sym::riscv_dash_interrupt_dash_s => FnAbi::RiscvInterruptS,
|
||||||
s if *s == sym::rust_dash_call => FnAbi::RustCall,
|
s if *s == sym::rust_dash_call => FnAbi::RustCall,
|
||||||
s if *s == sym::rust_dash_cold => FnAbi::RustCold,
|
s if *s == sym::rust_dash_cold => FnAbi::RustCold,
|
||||||
|
s if *s == sym::rust_dash_intrinsic => FnAbi::RustIntrinsic,
|
||||||
s if *s == sym::Rust => FnAbi::Rust,
|
s if *s == sym::Rust => FnAbi::Rust,
|
||||||
s if *s == sym::stdcall_dash_unwind => FnAbi::StdcallUnwind,
|
s if *s == sym::stdcall_dash_unwind => FnAbi::StdcallUnwind,
|
||||||
s if *s == sym::stdcall => FnAbi::Stdcall,
|
s if *s == sym::stdcall => FnAbi::Stdcall,
|
||||||
|
@ -498,6 +500,7 @@ impl FnAbi {
|
||||||
FnAbi::Rust => "Rust",
|
FnAbi::Rust => "Rust",
|
||||||
FnAbi::RustCall => "rust-call",
|
FnAbi::RustCall => "rust-call",
|
||||||
FnAbi::RustCold => "rust-cold",
|
FnAbi::RustCold => "rust-cold",
|
||||||
|
FnAbi::RustIntrinsic => "rust-intrinsic",
|
||||||
FnAbi::Stdcall => "stdcall",
|
FnAbi::Stdcall => "stdcall",
|
||||||
FnAbi::StdcallUnwind => "stdcall-unwind",
|
FnAbi::StdcallUnwind => "stdcall-unwind",
|
||||||
FnAbi::System => "system",
|
FnAbi::System => "system",
|
||||||
|
|
|
@ -59,7 +59,19 @@ impl Evaluator<'_> {
|
||||||
|
|
||||||
let function_data = self.db.function_data(def);
|
let function_data = self.db.function_data(def);
|
||||||
let attrs = self.db.attrs(def.into());
|
let attrs = self.db.attrs(def.into());
|
||||||
let is_intrinsic = attrs.by_key(&sym::rustc_intrinsic).exists();
|
let is_intrinsic = attrs.by_key(&sym::rustc_intrinsic).exists()
|
||||||
|
// Keep this around for a bit until extern "rustc-intrinsic" abis are no longer used
|
||||||
|
|| (match &function_data.abi {
|
||||||
|
Some(abi) => *abi == sym::rust_dash_intrinsic,
|
||||||
|
None => match def.lookup(self.db.upcast()).container {
|
||||||
|
hir_def::ItemContainerId::ExternBlockId(block) => {
|
||||||
|
let id = block.lookup(self.db.upcast()).id;
|
||||||
|
id.item_tree(self.db.upcast())[id.value].abi.as_ref()
|
||||||
|
== Some(&sym::rust_dash_intrinsic)
|
||||||
|
}
|
||||||
|
_ => false,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
if is_intrinsic {
|
if is_intrinsic {
|
||||||
return self.exec_intrinsic(
|
return self.exec_intrinsic(
|
||||||
|
|
|
@ -18,6 +18,7 @@ use hir_def::{
|
||||||
TypeOrConstParamId,
|
TypeOrConstParamId,
|
||||||
};
|
};
|
||||||
use hir_expand::name::Name;
|
use hir_expand::name::Name;
|
||||||
|
use intern::sym;
|
||||||
use rustc_abi::TargetDataLayout;
|
use rustc_abi::TargetDataLayout;
|
||||||
use rustc_hash::FxHashSet;
|
use rustc_hash::FxHashSet;
|
||||||
use smallvec::{smallvec, SmallVec};
|
use smallvec::{smallvec, SmallVec};
|
||||||
|
@ -302,13 +303,26 @@ pub fn is_fn_unsafe_to_call(
|
||||||
|
|
||||||
let loc = func.lookup(db.upcast());
|
let loc = func.lookup(db.upcast());
|
||||||
match loc.container {
|
match loc.container {
|
||||||
hir_def::ItemContainerId::ExternBlockId(_block) => {
|
hir_def::ItemContainerId::ExternBlockId(block) => {
|
||||||
// Function in an `extern` block are always unsafe to call, except when
|
let id = block.lookup(db.upcast()).id;
|
||||||
// it is marked as `safe`.
|
let is_intrinsic_block =
|
||||||
if data.is_safe() {
|
id.item_tree(db.upcast())[id.value].abi.as_ref() == Some(&sym::rust_dash_intrinsic);
|
||||||
Unsafety::Safe
|
if is_intrinsic_block {
|
||||||
|
// legacy intrinsics
|
||||||
|
// extern "rust-intrinsic" intrinsics are unsafe unless they have the rustc_safe_intrinsic attribute
|
||||||
|
if db.attrs(func.into()).by_key(&sym::rustc_safe_intrinsic).exists() {
|
||||||
|
Unsafety::Safe
|
||||||
|
} else {
|
||||||
|
Unsafety::Unsafe
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Unsafety::Unsafe
|
// Function in an `extern` block are always unsafe to call, except when
|
||||||
|
// it is marked as `safe`.
|
||||||
|
if data.is_safe() {
|
||||||
|
Unsafety::Safe
|
||||||
|
} else {
|
||||||
|
Unsafety::Unsafe
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => Unsafety::Safe,
|
_ => Unsafety::Safe,
|
||||||
|
|
|
@ -36,6 +36,7 @@ const SUPPORTED_CALLING_CONVENTIONS: &[&str] = &[
|
||||||
"wasm",
|
"wasm",
|
||||||
"system",
|
"system",
|
||||||
"system-unwind",
|
"system-unwind",
|
||||||
|
"rust-intrinsic",
|
||||||
"rust-call",
|
"rust-call",
|
||||||
"unadjusted",
|
"unadjusted",
|
||||||
];
|
];
|
||||||
|
|
|
@ -125,6 +125,7 @@ define_symbols! {
|
||||||
riscv_dash_interrupt_dash_s = "riscv-interrupt-s",
|
riscv_dash_interrupt_dash_s = "riscv-interrupt-s",
|
||||||
rust_dash_call = "rust-call",
|
rust_dash_call = "rust-call",
|
||||||
rust_dash_cold = "rust-cold",
|
rust_dash_cold = "rust-cold",
|
||||||
|
rust_dash_intrinsic = "rust-intrinsic",
|
||||||
stdcall_dash_unwind = "stdcall-unwind",
|
stdcall_dash_unwind = "stdcall-unwind",
|
||||||
system_dash_unwind = "system-unwind",
|
system_dash_unwind = "system-unwind",
|
||||||
sysv64_dash_unwind = "sysv64-unwind",
|
sysv64_dash_unwind = "sysv64-unwind",
|
||||||
|
|
|
@ -6,8 +6,8 @@ LL | call(f, ());
|
||||||
| |
|
| |
|
||||||
| required by a bound introduced by this call
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
= note: expected a closure with arguments `((),)`
|
= note: expected a closure with signature `for<'a> fn(<_ as ATC<'a>>::Type)`
|
||||||
found a closure with arguments `(<_ as ATC<'a>>::Type,)`
|
found a closure with signature `fn(())`
|
||||||
note: this is a known limitation of the trait solver that will be lifted in the future
|
note: this is a known limitation of the trait solver that will be lifted in the future
|
||||||
--> $DIR/issue-62529-3.rs:25:14
|
--> $DIR/issue-62529-3.rs:25:14
|
||||||
|
|
|
|
||||||
|
|
|
@ -6,8 +6,8 @@ LL | real_dispatch(f)
|
||||||
| |
|
| |
|
||||||
| required by a bound introduced by this call
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
= note: expected a closure with arguments `(&mut UIView<'a, _>,)`
|
= note: expected a closure with signature `for<'a, 'b> fn(&'a mut UIView<'b, _>)`
|
||||||
found a closure with arguments `(&mut UIView<'_, _>,)`
|
found a closure with signature `fn(&mut UIView<'a, _>)`
|
||||||
note: required by a bound in `real_dispatch`
|
note: required by a bound in `real_dispatch`
|
||||||
--> $DIR/issue-100690.rs:8:8
|
--> $DIR/issue-100690.rs:8:8
|
||||||
|
|
|
|
||||||
|
|
|
@ -7,8 +7,8 @@ LL | let _ = (-10..=10).find(|x: i32| x.signum() == 0);
|
||||||
| required by a bound introduced by this call
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
= help: the trait `for<'a> FnMut(&'a <std::ops::RangeInclusive<{integer}> as Iterator>::Item)` is not implemented for closure `{closure@$DIR/closure-arg-type-mismatch-issue-45727.rs:6:29: 6:37}`
|
= help: the trait `for<'a> FnMut(&'a <std::ops::RangeInclusive<{integer}> as Iterator>::Item)` is not implemented for closure `{closure@$DIR/closure-arg-type-mismatch-issue-45727.rs:6:29: 6:37}`
|
||||||
= note: expected a closure with arguments `(i32,)`
|
= note: expected a closure with signature `for<'a> fn(&'a <std::ops::RangeInclusive<{integer}> as Iterator>::Item)`
|
||||||
found a closure with arguments `(&<std::ops::RangeInclusive<{integer}> as Iterator>::Item,)`
|
found a closure with signature `fn(i32)`
|
||||||
note: required by a bound in `find`
|
note: required by a bound in `find`
|
||||||
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
|
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
|
||||||
|
|
||||||
|
@ -27,8 +27,8 @@ LL | let _ = (-10..=10).find(|x: &&&i32| x.signum() == 0);
|
||||||
| required by a bound introduced by this call
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
= help: the trait `for<'a> FnMut(&'a <std::ops::RangeInclusive<{integer}> as Iterator>::Item)` is not implemented for closure `{closure@$DIR/closure-arg-type-mismatch-issue-45727.rs:9:29: 9:40}`
|
= help: the trait `for<'a> FnMut(&'a <std::ops::RangeInclusive<{integer}> as Iterator>::Item)` is not implemented for closure `{closure@$DIR/closure-arg-type-mismatch-issue-45727.rs:9:29: 9:40}`
|
||||||
= note: expected a closure with arguments `(&&&i32,)`
|
= note: expected a closure with signature `for<'a> fn(&'a <std::ops::RangeInclusive<{integer}> as Iterator>::Item)`
|
||||||
found a closure with arguments `(&<std::ops::RangeInclusive<{integer}> as Iterator>::Item,)`
|
found a closure with signature `fn(&&&i32)`
|
||||||
note: required by a bound in `find`
|
note: required by a bound in `find`
|
||||||
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
|
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,8 @@ LL | take(f)
|
||||||
| |
|
| |
|
||||||
| required by a bound introduced by this call
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
= note: expected a closure with arguments `(u32,)`
|
= note: expected a closure with signature `fn(i32)`
|
||||||
found a closure with arguments `(i32,)`
|
found a closure with signature `fn(u32)`
|
||||||
note: required by a bound in `take`
|
note: required by a bound in `take`
|
||||||
--> $DIR/mismatch-fn-trait.rs:1:18
|
--> $DIR/mismatch-fn-trait.rs:1:18
|
||||||
|
|
|
|
||||||
|
@ -68,8 +68,8 @@ LL | take(f)
|
||||||
| required by a bound introduced by this call
|
| required by a bound introduced by this call
|
||||||
|
|
|
|
||||||
= note: `impl FnOnce(u32)` implements `FnOnce`, but it must implement `FnMut`, which is more general
|
= note: `impl FnOnce(u32)` implements `FnOnce`, but it must implement `FnMut`, which is more general
|
||||||
= note: expected a closure with arguments `(u32,)`
|
= note: expected a closure with signature `fn(i32)`
|
||||||
found a closure with arguments `(i32,)`
|
found a closure with signature `fn(u32)`
|
||||||
note: required by a bound in `take`
|
note: required by a bound in `take`
|
||||||
--> $DIR/mismatch-fn-trait.rs:1:18
|
--> $DIR/mismatch-fn-trait.rs:1:18
|
||||||
|
|
|
|
||||||
|
|
18
tests/ui/transmutability/transmute-higher-ranked.rs
Normal file
18
tests/ui/transmutability/transmute-higher-ranked.rs
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
// Ensure we don't ICE when transmuting higher-ranked types via a
|
||||||
|
// higher-ranked transmute goal.
|
||||||
|
|
||||||
|
//@ check-pass
|
||||||
|
|
||||||
|
#![feature(transmutability)]
|
||||||
|
|
||||||
|
use std::mem::TransmuteFrom;
|
||||||
|
|
||||||
|
pub fn transmute()
|
||||||
|
where
|
||||||
|
for<'a> &'a &'a i32: TransmuteFrom<&'a &'a u32>,
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
transmute();
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue