Skip to content

Commit 0469a92

Browse files
committed
Auto merge of #156023 - jhpratt:rollup-sZeK85e, r=jhpratt
Rollup of 19 pull requests Successful merges: - #155237 (Disentangle AST crates and error crates) - #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) - #155954 (rustdoc: preserve parent doc cfg for `macro_export` macros) - #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) - #155821 (c-variadic: document `Clone` and `Drop` instances and require `VaArgSafe: Copy`) - #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) - #156000 (Fix ICE when using -Zinstrument-mcount and -Clinker-flavor=lld) - #156002 (Allow to use `Diagnostic` directly in `SharedContext::emit_lint`) - #156015 (rustc-dev-guide subtree update)
2 parents f53b654 + fbde425 commit 0469a92

185 files changed

Lines changed: 2525 additions & 1084 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.

Cargo.lock

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3853,8 +3853,6 @@ dependencies = [
38533853
"icu_list",
38543854
"icu_locale",
38553855
"intl-memoizer",
3856-
"rustc_ast",
3857-
"rustc_ast_pretty",
38583856
"rustc_baked_icu_data",
38593857
"rustc_data_structures",
38603858
"rustc_macros",
@@ -4186,7 +4184,6 @@ dependencies = [
41864184
name = "rustc_lint_defs"
41874185
version = "0.0.0"
41884186
dependencies = [
4189-
"rustc_ast",
41904187
"rustc_data_structures",
41914188
"rustc_error_messages",
41924189
"rustc_hir_id",

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: 20 additions & 9 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 {
@@ -1117,8 +1128,8 @@ fn validate_generic_param_order(dcx: DiagCtxtHandle<'_>, generics: &[GenericPara
11171128
dcx.emit_err(errors::OutOfOrderParams {
11181129
spans: spans.clone(),
11191130
sugg_span: span,
1120-
param_ord,
1121-
max_param,
1131+
param_ord: param_ord.to_string(),
1132+
max_param: max_param.to_string(),
11221133
ordered_params: &ordered_params,
11231134
});
11241135
}

compiler/rustc_ast_passes/src/errors.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
//! Errors emitted by ast_passes.
22
33
use rustc_abi::ExternAbi;
4-
use rustc_ast::ParamKindOrd;
54
use rustc_errors::codes::*;
65
use rustc_errors::{Applicability, Diag, EmissionGuarantee, Subdiagnostic};
76
use rustc_macros::{Diagnostic, Subdiagnostic};
@@ -632,8 +631,8 @@ pub(crate) struct OutOfOrderParams<'a> {
632631
applicability = "machine-applicable"
633632
)]
634633
pub sugg_span: Span,
635-
pub param_ord: &'a ParamKindOrd,
636-
pub max_param: &'a ParamKindOrd,
634+
pub param_ord: String,
635+
pub max_param: String,
637636
pub ordered_params: &'a str,
638637
}
639638

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

0 commit comments

Comments
 (0)