1
Fork 0

Rollup merge of #108983 - LeSeulArtichaut:108646-target-feature-default-impl, r=cjgillot

Forbid `#[target_feature]` on safe default implementations

Fixes #108646.
This commit is contained in:
Matthias Krüger 2023-03-10 19:59:21 +01:00 committed by GitHub
commit f74bb35dad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 2 deletions

View file

@ -442,7 +442,7 @@ fn asm_target_features(tcx: TyCtxt<'_>, did: DefId) -> &FxIndexSet<Symbol> {
pub fn check_target_feature_trait_unsafe(tcx: TyCtxt<'_>, id: LocalDefId, attr_span: Span) {
if let DefKind::AssocFn = tcx.def_kind(id) {
let parent_id = tcx.local_parent(id);
if let DefKind::Impl { of_trait: true } = tcx.def_kind(parent_id) {
if let DefKind::Trait | DefKind::Impl { of_trait: true } = tcx.def_kind(parent_id) {
tcx.sess
.struct_span_err(
attr_span,