Rollup merge of #117420 - Jules-Bertholet:internal-unstable-stmt-expr-attributes, r=petrochenkov

Make `#![allow_internal_unstable(..)]` work with `stmt_expr_attributes`

This is a necessary first step to fixing #117304, as explained in https://github.com/rust-lang/rust/issues/117304#issuecomment-1784414453.

`@rustbot` label T-compiler
This commit is contained in:
Matthias Krüger 2024-01-26 14:43:29 +01:00 committed by GitHub
commit 4808aa8872
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 17 additions and 5 deletions

View file

@ -373,7 +373,9 @@ impl<'a> StripUnconfigured<'a> {
/// If attributes are not allowed on expressions, emit an error for `attr`
#[instrument(level = "trace", skip(self))]
pub(crate) fn maybe_emit_expr_attr_err(&self, attr: &Attribute) {
if self.features.is_some_and(|features| !features.stmt_expr_attributes) {
if self.features.is_some_and(|features| !features.stmt_expr_attributes)
&& !attr.span.allows_unstable(sym::stmt_expr_attributes)
{
let mut err = feature_err(
&self.sess,
sym::stmt_expr_attributes,