Skip to content

Commit cb530f1

Browse files
committed
Auto merge of #156010 - JonathanBrouwer:rollup-E73S0nX, r=JonathanBrouwer
Rollup of 13 pull requests Successful merges: - #155249 (Fix: On wasm targets, call `panic_in_cleanup` if panic occurs in cleanup) - #155853 (Use `_mcount` as the mcount symbol name on RISC-V Linux GNU targets) - #155919 (simplify `ast_fragments!`) - #155939 (Add feature gate for view_types experiment) - #155974 (add `c_variadic_experimental_arch` feature) - #155991 (Catch unwinds from the global ctxt callback to complete queries profiling data in more cases) - #156003 (Pass Session to optimize_and_codegen_fat_lto) - #153566 (Add suggestion for E0401 on inner const items) - #154610 (Suggest public re-exports when a private module makes an import path inaccessible) - #155523 (Reorganize `tests/ui/issues/` - 02) - #155980 (Move `feature*` methods from `parse` mod to `errors` mod.) - #155987 (Make lifting infallible) - #155988 (tests/run-make/print-cfg: add Android target_env case)
2 parents f53b654 + c323908 commit cb530f1

123 files changed

Lines changed: 1771 additions & 480 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

compiler/rustc_abi/src/extern_abi.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ impl StableOrd for ExternAbi {
261261
rustc_error_messages::into_diag_arg_using_display!(ExternAbi);
262262

263263
#[cfg(feature = "nightly")]
264+
#[derive(Debug)]
264265
pub enum CVariadicStatus {
265266
NotSupported,
266267
Stable,

compiler/rustc_ast_lowering/src/asm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexMap};
55
use rustc_errors::msg;
66
use rustc_hir as hir;
77
use rustc_hir::def::{DefKind, Res};
8-
use rustc_session::parse::feature_err;
8+
use rustc_session::errors::feature_err;
99
use rustc_span::{Span, sym};
1010
use rustc_target::asm;
1111

compiler/rustc_ast_lowering/src/expr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1693,7 +1693,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
16931693
&& !self.tcx.features().coroutines()
16941694
&& !self.tcx.features().gen_blocks()
16951695
{
1696-
rustc_session::parse::feature_err(
1696+
rustc_session::errors::feature_err(
16971697
&self.tcx.sess,
16981698
sym::yield_expr,
16991699
span,

compiler/rustc_ast_lowering/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ use rustc_macros::extension;
6262
use rustc_middle::hir::{self as mid_hir};
6363
use rustc_middle::span_bug;
6464
use rustc_middle::ty::{DelegationInfo, ResolverAstLowering, TyCtxt};
65-
use rustc_session::parse::add_feature_diagnostics;
65+
use rustc_session::errors::add_feature_diagnostics;
6666
use rustc_span::symbol::{Ident, Symbol, kw, sym};
6767
use rustc_span::{DUMMY_SP, DesugaringKind, Span};
6868
use smallvec::SmallVec;

compiler/rustc_ast_lowering/src/path.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use rustc_hir::def::{DefKind, PartialRes, PerNS, Res};
66
use rustc_hir::def_id::DefId;
77
use rustc_hir::{self as hir, GenericArg};
88
use rustc_middle::{span_bug, ty};
9-
use rustc_session::parse::add_feature_diagnostics;
9+
use rustc_session::errors::add_feature_diagnostics;
1010
use rustc_span::{BytePos, DUMMY_SP, DesugaringKind, Ident, Span, Symbol, sym};
1111
use smallvec::smallvec;
1212
use tracing::{debug, instrument};

compiler/rustc_ast_lowering/src/stability.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::fmt;
33
use rustc_abi::ExternAbi;
44
use rustc_feature::Features;
55
use rustc_session::Session;
6-
use rustc_session::parse::feature_err;
6+
use rustc_session::errors::feature_err;
77
use rustc_span::symbol::sym;
88
use rustc_span::{Span, Symbol};
99

compiler/rustc_ast_passes/src/ast_validation.rs

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ use rustc_data_structures::fx::FxIndexMap;
3030
use rustc_errors::{DiagCtxtHandle, Diagnostic, LintBuffer};
3131
use rustc_feature::Features;
3232
use rustc_session::Session;
33+
use rustc_session::errors::feature_err;
3334
use rustc_session::lint::builtin::{
3435
DEPRECATED_WHERE_CLAUSE_LOCATION, MISSING_ABI, MISSING_UNSAFE_ON_EXTERN,
3536
PATTERNS_IN_FNS_WITHOUT_BODY, UNUSED_VISIBILITIES,
3637
};
37-
use rustc_session::parse::feature_err;
3838
use rustc_span::{Ident, Span, kw, sym};
3939
use rustc_target::spec::{AbiMap, AbiMapping};
4040
use thin_vec::thin_vec;
@@ -762,12 +762,23 @@ impl<'a> AstValidator<'a> {
762762
match fn_ctxt {
763763
FnCtxt::Foreign => return,
764764
FnCtxt::Free | FnCtxt::Assoc(_) => {
765-
if !self.sess.target.supports_c_variadic_definitions() {
766-
self.dcx().emit_err(errors::CVariadicNotSupported {
767-
variadic_span: variadic_param.span,
768-
target: &*self.sess.target.llvm_target,
769-
});
770-
return;
765+
match self.sess.target.supports_c_variadic_definitions() {
766+
CVariadicStatus::NotSupported => {
767+
self.dcx().emit_err(errors::CVariadicNotSupported {
768+
variadic_span: variadic_param.span,
769+
target: &*self.sess.target.llvm_target,
770+
});
771+
return;
772+
}
773+
CVariadicStatus::Unstable { feature } if !self.features.enabled(feature) => {
774+
let msg =
775+
format!("C-variadic function definitions on this target are unstable");
776+
feature_err(&self.sess, feature, variadic_param.span, msg).emit();
777+
return;
778+
}
779+
CVariadicStatus::Unstable { .. } | CVariadicStatus::Stable => {
780+
/* fall through */
781+
}
771782
}
772783

773784
match sig.header.ext {

compiler/rustc_ast_passes/src/feature_gate.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use rustc_feature::{AttributeGate, BUILTIN_ATTRIBUTE_MAP, BuiltinAttribute, Feat
66
use rustc_hir::Attribute;
77
use rustc_hir::attrs::AttributeKind;
88
use rustc_session::Session;
9-
use rustc_session::parse::{feature_err, feature_warn};
9+
use rustc_session::errors::{feature_err, feature_warn};
1010
use rustc_span::{Span, Spanned, Symbol, sym};
1111
use thin_vec::ThinVec;
1212

@@ -510,6 +510,7 @@ pub fn check_crate(krate: &ast::Crate, sess: &Session, features: &Features) {
510510
gate_all!(try_blocks_heterogeneous, "`try bikeshed` expression is experimental");
511511
gate_all!(unsafe_binders, "unsafe binder types are experimental");
512512
gate_all!(unsafe_fields, "`unsafe` fields are experimental");
513+
gate_all!(view_types, "view types are experimental");
513514
gate_all!(where_clause_attrs, "attributes in `where` clause are unstable");
514515
gate_all!(yeet_expr, "`do yeet` expression is experimental");
515516
// tidy-alphabetical-end

compiler/rustc_attr_parsing/src/attributes/cfg.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ use rustc_parse::parser::{ForceCollect, Parser, Recovery};
1313
use rustc_parse::{exp, parse_in};
1414
use rustc_session::Session;
1515
use rustc_session::config::ExpectedValues;
16+
use rustc_session::errors::feature_err;
1617
use rustc_session::lint::builtin::UNEXPECTED_CFGS;
17-
use rustc_session::parse::{ParseSess, feature_err};
18+
use rustc_session::parse::ParseSess;
1819
use rustc_span::{ErrorGuaranteed, Span, Symbol, sym};
1920
use thin_vec::ThinVec;
2021

compiler/rustc_attr_parsing/src/attributes/codegen_attrs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use rustc_hir::attrs::{CoverageAttrKind, OptimizeAttr, RtsanSetting, SanitizerSet, UsedBy};
2-
use rustc_session::parse::feature_err;
2+
use rustc_session::errors::feature_err;
33
use rustc_span::edition::Edition::Edition2024;
44

55
use super::prelude::*;

0 commit comments

Comments
 (0)