about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-01-13 16:09:45 +0000
committerbors <bors@rust-lang.org>2024-01-13 16:09:45 +0000
commitc6c4abf58499d89000e333627237e63dbca24437 (patch)
tree074da426f6d67f7cfbf0a8c7a524eebf67037ea2
parent1d8d7b16cbcd048e98359cd0d42b03bc1710cca8 (diff)
parentf53caa1106e3c7c3b231540d1afb6acb626813e8 (diff)
downloadrust-c6c4abf58499d89000e333627237e63dbca24437.tar.gz
rust-c6c4abf58499d89000e333627237e63dbca24437.zip
Auto merge of #119927 - matthiaskrgr:rollup-885ws57, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #119587 (Varargs support for system ABI)
 - #119891 (rename `reported_signature_mismatch` to reflect its use)
 - #119894 (Allow `~const` on associated type bounds again)
 - #119896 (Taint `_` placeholder types in trait impl method signatures)
 - #119898 (Remove unused `ErrorReporting` variant from overflow handling)
 - #119902 (fix typo in `fn()` docs)

r? `@ghost`
`@rustbot` modify labels: rollup
-rw-r--r--compiler/rustc_ast_passes/messages.ftl3
-rw-r--r--compiler/rustc_ast_passes/src/ast_validation.rs38
-rw-r--r--compiler/rustc_ast_passes/src/errors.rs17
-rw-r--r--compiler/rustc_hir_analysis/src/astconv/mod.rs8
-rw-r--r--compiler/rustc_hir_analysis/src/lib.rs3
-rw-r--r--compiler/rustc_infer/src/infer/at.rs2
-rw-r--r--compiler/rustc_infer/src/infer/mod.rs4
-rw-r--r--compiler/rustc_metadata/src/native_libs.rs16
-rw-r--r--compiler/rustc_middle/src/traits/mod.rs3
-rw-r--r--compiler/rustc_middle/src/traits/select.rs2
-rw-r--r--compiler/rustc_target/src/abi/call/mod.rs4
-rw-r--r--compiler/rustc_target/src/spec/abi/mod.rs3
-rw-r--r--compiler/rustc_target/src/spec/mod.rs8
-rw-r--r--compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs7
-rw-r--r--compiler/rustc_trait_selection/src/traits/query/evaluate_obligation.rs2
-rw-r--r--compiler/rustc_trait_selection/src/traits/select/mod.rs8
-rw-r--r--compiler/rustc_ty_utils/src/abi.rs6
-rw-r--r--library/core/src/primitive_docs.rs6
-rw-r--r--src/librustdoc/clean/blanket_impl.rs1
-rw-r--r--tests/ui/c-variadic/variadic-ffi-2.rs5
-rw-r--r--tests/ui/c-variadic/variadic-ffi-2.stderr2
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage-0.qualified.stderr14
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage-0.rs24
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage-1.qualified.stderr14
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage-1.rs27
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage.rs15
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage.stderr22
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type.rs28
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type.stderr22
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-invalid-places.stderr24
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-trait-assoc-tys.rs18
-rw-r--r--tests/ui/traits/method-argument-mismatch-variance-ice-119867.rs13
-rw-r--r--tests/ui/traits/method-argument-mismatch-variance-ice-119867.stderr24
33 files changed, 289 insertions, 104 deletions
diff --git a/compiler/rustc_ast_passes/messages.ftl b/compiler/rustc_ast_passes/messages.ftl
index a10797626f1..6586ca5d36f 100644
--- a/compiler/rustc_ast_passes/messages.ftl
+++ b/compiler/rustc_ast_passes/messages.ftl
@@ -232,6 +232,9 @@ ast_passes_tilde_const_disallowed = `~const` is not allowed here
     .trait = this trait is not a `#[const_trait]`, so it cannot have `~const` trait bounds
     .trait_impl = this impl is not `const`, so it cannot have `~const` trait bounds
     .impl = inherent impls cannot have `~const` trait bounds
+    .trait_assoc_ty = associated types in non-`#[const_trait]` traits cannot have `~const` trait bounds
+    .trait_impl_assoc_ty = associated types in non-const impls cannot have `~const` trait bounds
+    .inherent_assoc_ty = inherent associated types cannot have `~const` trait bounds
     .object = trait objects cannot have `~const` trait bounds
     .item = this item cannot have `~const` trait bounds
 
diff --git a/compiler/rustc_ast_passes/src/ast_validation.rs b/compiler/rustc_ast_passes/src/ast_validation.rs
index 7f78f687055..9ea5d1ed5fa 100644
--- a/compiler/rustc_ast_passes/src/ast_validation.rs
+++ b/compiler/rustc_ast_passes/src/ast_validation.rs
@@ -37,12 +37,17 @@ enum SelfSemantic {
 }
 
 /// What is the context that prevents using `~const`?
+// FIXME(effects): Consider getting rid of this in favor of `errors::TildeConstReason`, they're
+// almost identical. This gets rid of an abstraction layer which might be considered bad.
 enum DisallowTildeConstContext<'a> {
     TraitObject,
     Fn(FnKind<'a>),
     Trait(Span),
     TraitImpl(Span),
     Impl(Span),
+    TraitAssocTy(Span),
+    TraitImplAssocTy(Span),
+    InherentAssocTy(Span),
     Item,
 }
 
@@ -316,6 +321,7 @@ impl<'a> AstValidator<'a> {
                 constness: Const::No,
                 polarity: ImplPolarity::Positive,
                 trait_ref,
+                ..
             } = parent
         {
             Some(trait_ref.path.span.shrink_to_lo())
@@ -1286,6 +1292,15 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
                             // suggestion for moving such bounds to the assoc const fns if available.
                             errors::TildeConstReason::Impl { span }
                         }
+                        &DisallowTildeConstContext::TraitAssocTy(span) => {
+                            errors::TildeConstReason::TraitAssocTy { span }
+                        }
+                        &DisallowTildeConstContext::TraitImplAssocTy(span) => {
+                            errors::TildeConstReason::TraitImplAssocTy { span }
+                        }
+                        &DisallowTildeConstContext::InherentAssocTy(span) => {
+                            errors::TildeConstReason::InherentAssocTy { span }
+                        }
                         DisallowTildeConstContext::TraitObject => {
                             errors::TildeConstReason::TraitObject
                         }
@@ -1483,13 +1498,12 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
             self.check_item_named(item.ident, "const");
         }
 
+        let parent_is_const =
+            self.outer_trait_or_trait_impl.as_ref().and_then(TraitOrTraitImpl::constness).is_some();
+
         match &item.kind {
             AssocItemKind::Fn(box Fn { sig, generics, body, .. })
-                if self
-                    .outer_trait_or_trait_impl
-                    .as_ref()
-                    .and_then(TraitOrTraitImpl::constness)
-                    .is_some()
+                if parent_is_const
                     || ctxt == AssocCtxt::Trait
                     || matches!(sig.header.constness, Const::Yes(_)) =>
             {
@@ -1505,6 +1519,20 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
                 );
                 self.visit_fn(kind, item.span, item.id);
             }
+            AssocItemKind::Type(_) => {
+                let disallowed = (!parent_is_const).then(|| match self.outer_trait_or_trait_impl {
+                    Some(TraitOrTraitImpl::Trait { .. }) => {
+                        DisallowTildeConstContext::TraitAssocTy(item.span)
+                    }
+                    Some(TraitOrTraitImpl::TraitImpl { .. }) => {
+                        DisallowTildeConstContext::TraitImplAssocTy(item.span)
+                    }
+                    None => DisallowTildeConstContext::InherentAssocTy(item.span),
+                });
+                self.with_tilde_const(disallowed, |this| {
+                    this.with_in_trait_impl(None, |this| visit::walk_assoc_item(this, item, ctxt))
+                })
+            }
             _ => self.with_in_trait_impl(None, |this| visit::walk_assoc_item(this, item, ctxt)),
         }
     }
diff --git a/compiler/rustc_ast_passes/src/errors.rs b/compiler/rustc_ast_passes/src/errors.rs
index fcf19ce52ec..e2b8e64b115 100644
--- a/compiler/rustc_ast_passes/src/errors.rs
+++ b/compiler/rustc_ast_passes/src/errors.rs
@@ -565,6 +565,8 @@ pub struct ConstBoundTraitObject {
     pub span: Span,
 }
 
+// FIXME(effects): Consider making the note/reason the message of the diagnostic.
+// FIXME(effects): Provide structured suggestions (e.g., add `const` / `#[const_trait]` here).
 #[derive(Diagnostic)]
 #[diag(ast_passes_tilde_const_disallowed)]
 pub struct TildeConstDisallowed {
@@ -598,6 +600,21 @@ pub enum TildeConstReason {
         #[primary_span]
         span: Span,
     },
+    #[note(ast_passes_trait_assoc_ty)]
+    TraitAssocTy {
+        #[primary_span]
+        span: Span,
+    },
+    #[note(ast_passes_trait_impl_assoc_ty)]
+    TraitImplAssocTy {
+        #[primary_span]
+        span: Span,
+    },
+    #[note(ast_passes_inherent_assoc_ty)]
+    InherentAssocTy {
+        #[primary_span]
+        span: Span,
+    },
     #[note(ast_passes_object)]
     TraitObject,
     #[note(ast_passes_item)]
diff --git a/compiler/rustc_hir_analysis/src/astconv/mod.rs b/compiler/rustc_hir_analysis/src/astconv/mod.rs
index 78740ac33ca..9f4f1413650 100644
--- a/compiler/rustc_hir_analysis/src/astconv/mod.rs
+++ b/compiler/rustc_hir_analysis/src/astconv/mod.rs
@@ -2659,7 +2659,11 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
                         self.suggest_trait_fn_ty_for_impl_fn_infer(hir_id, Some(i))
                     {
                         infer_replacements.push((a.span, suggested_ty.to_string()));
-                        return suggested_ty;
+                        return Ty::new_error_with_message(
+                            self.tcx(),
+                            a.span,
+                            suggested_ty.to_string(),
+                        );
                     }
                 }
 
@@ -2677,7 +2681,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
                         self.suggest_trait_fn_ty_for_impl_fn_infer(hir_id, None)
                 {
                     infer_replacements.push((output.span, suggested_ty.to_string()));
-                    suggested_ty
+                    Ty::new_error_with_message(self.tcx(), output.span, suggested_ty.to_string())
                 } else {
                     visitor.visit_ty(output);
                     self.ast_ty_to_ty(output)
diff --git a/compiler/rustc_hir_analysis/src/lib.rs b/compiler/rustc_hir_analysis/src/lib.rs
index dfc54ac5b23..d4f08b12a18 100644
--- a/compiler/rustc_hir_analysis/src/lib.rs
+++ b/compiler/rustc_hir_analysis/src/lib.rs
@@ -116,7 +116,8 @@ use rustc_hir::def::DefKind;
 rustc_fluent_macro::fluent_messages! { "../messages.ftl" }
 
 fn require_c_abi_if_c_variadic(tcx: TyCtxt<'_>, decl: &hir::FnDecl<'_>, abi: Abi, span: Span) {
-    const CONVENTIONS_UNSTABLE: &str = "`C`, `cdecl`, `aapcs`, `win64`, `sysv64` or `efiapi`";
+    const CONVENTIONS_UNSTABLE: &str =
+        "`C`, `cdecl`, `system`, `aapcs`, `win64`, `sysv64` or `efiapi`";
     const CONVENTIONS_STABLE: &str = "`C` or `cdecl`";
     const UNSTABLE_EXPLAIN: &str =
         "using calling conventions other than `C` or `cdecl` for varargs functions is unstable";
diff --git a/compiler/rustc_infer/src/infer/at.rs b/compiler/rustc_infer/src/infer/at.rs
index 09313cd9738..e60e3ffeaa7 100644
--- a/compiler/rustc_infer/src/infer/at.rs
+++ b/compiler/rustc_infer/src/infer/at.rs
@@ -84,7 +84,7 @@ impl<'tcx> InferCtxt<'tcx> {
             selection_cache: self.selection_cache.clone(),
             evaluation_cache: self.evaluation_cache.clone(),
             reported_trait_errors: self.reported_trait_errors.clone(),
-            reported_closure_mismatch: self.reported_closure_mismatch.clone(),
+            reported_signature_mismatch: self.reported_signature_mismatch.clone(),
             tainted_by_errors: self.tainted_by_errors.clone(),
             err_count_on_creation: self.err_count_on_creation,
             universe: self.universe.clone(),
diff --git a/compiler/rustc_infer/src/infer/mod.rs b/compiler/rustc_infer/src/infer/mod.rs
index fcc94687ed2..e164041c599 100644
--- a/compiler/rustc_infer/src/infer/mod.rs
+++ b/compiler/rustc_infer/src/infer/mod.rs
@@ -278,7 +278,7 @@ pub struct InferCtxt<'tcx> {
     /// avoid reporting the same error twice.
     pub reported_trait_errors: RefCell<FxIndexMap<Span, Vec<ty::Predicate<'tcx>>>>,
 
-    pub reported_closure_mismatch: RefCell<FxHashSet<(Span, Option<Span>)>>,
+    pub reported_signature_mismatch: RefCell<FxHashSet<(Span, Option<Span>)>>,
 
     /// When an error occurs, we want to avoid reporting "derived"
     /// errors that are due to this original failure. Normally, we
@@ -702,7 +702,7 @@ impl<'tcx> InferCtxtBuilder<'tcx> {
             selection_cache: Default::default(),
             evaluation_cache: Default::default(),
             reported_trait_errors: Default::default(),
-            reported_closure_mismatch: Default::default(),
+            reported_signature_mismatch: Default::default(),
             tainted_by_errors: Cell::new(None),
             err_count_on_creation: tcx.dcx().err_count(),
             universe: Cell::new(ty::UniverseIndex::ROOT),
diff --git a/compiler/rustc_metadata/src/native_libs.rs b/compiler/rustc_metadata/src/native_libs.rs
index a639a887544..efb6406b05b 100644
--- a/compiler/rustc_metadata/src/native_libs.rs
+++ b/compiler/rustc_metadata/src/native_libs.rs
@@ -520,11 +520,23 @@ impl<'tcx> Collector<'tcx> {
     ) -> DllImport {
         let span = self.tcx.def_span(item);
 
+        // this logic is similar to `Target::adjust_abi` (in rustc_target/src/spec/mod.rs) but errors on unsupported inputs
         let calling_convention = if self.tcx.sess.target.arch == "x86" {
             match abi {
                 Abi::C { .. } | Abi::Cdecl { .. } => DllCallingConvention::C,
-                Abi::Stdcall { .. } | Abi::System { .. } => {
-                    DllCallingConvention::Stdcall(self.i686_arg_list_size(item))
+                Abi::Stdcall { .. } => DllCallingConvention::Stdcall(self.i686_arg_list_size(item)),
+                // On Windows, `extern "system"` behaves like msvc's `__stdcall`.
+                // `__stdcall` only applies on x86 and on non-variadic functions:
+                // https://learn.microsoft.com/en-us/cpp/cpp/stdcall?view=msvc-170
+                Abi::System { .. } => {
+                    let c_variadic =
+                        self.tcx.type_of(item).instantiate_identity().fn_sig(self.tcx).c_variadic();
+
+                    if c_variadic {
+                        DllCallingConvention::C
+                    } else {
+                        DllCallingConvention::Stdcall(self.i686_arg_list_size(item))
+                    }
                 }
                 Abi::Fastcall { .. } => {
                     DllCallingConvention::Fastcall(self.i686_arg_list_size(item))
diff --git a/compiler/rustc_middle/src/traits/mod.rs b/compiler/rustc_middle/src/traits/mod.rs
index af601a0d702..bebee8df10e 100644
--- a/compiler/rustc_middle/src/traits/mod.rs
+++ b/compiler/rustc_middle/src/traits/mod.rs
@@ -611,9 +611,6 @@ pub enum SelectionError<'tcx> {
     NotConstEvaluatable(NotConstEvaluatable),
     /// Exceeded the recursion depth during type projection.
     Overflow(OverflowError),
-    /// Signaling that an error has already been emitted, to avoid
-    /// multiple errors being shown.
-    ErrorReporting,
     /// Computing an opaque type's hidden type caused an error (e.g. a cycle error).
     /// We can thus not know whether the hidden type implements an auto trait, so
     /// we should not presume anything about it.
diff --git a/compiler/rustc_middle/src/traits/select.rs b/compiler/rustc_middle/src/traits/select.rs
index 734c2b61c07..64f4af08e12 100644
--- a/compiler/rustc_middle/src/traits/select.rs
+++ b/compiler/rustc_middle/src/traits/select.rs
@@ -302,7 +302,6 @@ impl EvaluationResult {
 pub enum OverflowError {
     Error(ErrorGuaranteed),
     Canonical,
-    ErrorReporting,
 }
 
 impl From<ErrorGuaranteed> for OverflowError {
@@ -318,7 +317,6 @@ impl<'tcx> From<OverflowError> for SelectionError<'tcx> {
         match overflow_error {
             OverflowError::Error(e) => SelectionError::Overflow(OverflowError::Error(e)),
             OverflowError::Canonical => SelectionError::Overflow(OverflowError::Canonical),
-            OverflowError::ErrorReporting => SelectionError::ErrorReporting,
         }
     }
 }
diff --git a/compiler/rustc_target/src/abi/call/mod.rs b/compiler/rustc_target/src/abi/call/mod.rs
index fafc10e7163..1c83039047e 100644
--- a/compiler/rustc_target/src/abi/call/mod.rs
+++ b/compiler/rustc_target/src/abi/call/mod.rs
@@ -840,7 +840,7 @@ impl<'a, Ty> FnAbi<'a, Ty> {
             "sparc" => sparc::compute_abi_info(cx, self),
             "sparc64" => sparc64::compute_abi_info(cx, self),
             "nvptx64" => {
-                if cx.target_spec().adjust_abi(abi) == spec::abi::Abi::PtxKernel {
+                if cx.target_spec().adjust_abi(abi, self.c_variadic) == spec::abi::Abi::PtxKernel {
                     nvptx64::compute_ptx_kernel_abi_info(cx, self)
                 } else {
                     nvptx64::compute_abi_info(self)
@@ -849,7 +849,7 @@ impl<'a, Ty> FnAbi<'a, Ty> {
             "hexagon" => hexagon::compute_abi_info(self),
             "riscv32" | "riscv64" => riscv::compute_abi_info(cx, self),
             "wasm32" | "wasm64" => {
-                if cx.target_spec().adjust_abi(abi) == spec::abi::Abi::Wasm {
+                if cx.target_spec().adjust_abi(abi, self.c_variadic) == spec::abi::Abi::Wasm {
                     wasm::compute_wasm_abi_info(self)
                 } else {
                     wasm::compute_c_abi_info(cx, self)
diff --git a/compiler/rustc_target/src/spec/abi/mod.rs b/compiler/rustc_target/src/spec/abi/mod.rs
index 4c1f0c01a04..1a0aa6f0c4a 100644
--- a/compiler/rustc_target/src/spec/abi/mod.rs
+++ b/compiler/rustc_target/src/spec/abi/mod.rs
@@ -70,15 +70,16 @@ impl Abi {
         // * C and Cdecl obviously support varargs.
         // * C can be based on Aapcs, SysV64 or Win64, so they must support varargs.
         // * EfiApi is based on Win64 or C, so it also supports it.
+        // * System falls back to C for functions with varargs.
         //
         // * Stdcall does not, because it would be impossible for the callee to clean
         //   up the arguments. (callee doesn't know how many arguments are there)
         // * Same for Fastcall, Vectorcall and Thiscall.
-        // * System can become Stdcall, so is also a no-no.
         // * Other calling conventions are related to hardware or the compiler itself.
         match self {
             Self::C { .. }
             | Self::Cdecl { .. }
+            | Self::System { .. }
             | Self::Aapcs { .. }
             | Self::Win64 { .. }
             | Self::SysV64 { .. }
diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs
index da8706ea715..5d74ebebdf3 100644
--- a/compiler/rustc_target/src/spec/mod.rs
+++ b/compiler/rustc_target/src/spec/mod.rs
@@ -2401,10 +2401,14 @@ impl DerefMut for Target {
 
 impl Target {
     /// Given a function ABI, turn it into the correct ABI for this target.
-    pub fn adjust_abi(&self, abi: Abi) -> Abi {
+    pub fn adjust_abi(&self, abi: Abi, c_variadic: bool) -> Abi {
         match abi {
             Abi::C { .. } => self.default_adjusted_cabi.unwrap_or(abi),
-            Abi::System { unwind } if self.is_like_windows && self.arch == "x86" => {
+
+            // On Windows, `extern "system"` behaves like msvc's `__stdcall`.
+            // `__stdcall` only applies on x86 and on non-variadic functions:
+            // https://learn.microsoft.com/en-us/cpp/cpp/stdcall?view=msvc-170
+            Abi::System { unwind } if self.is_like_windows && self.arch == "x86" && !c_variadic => {
                 Abi::Stdcall { unwind }
             }
             Abi::System { unwind } => Abi::C { unwind },
diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs
index 47a700805fa..b970ec7f726 100644
--- a/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs
+++ b/compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs
@@ -947,9 +947,6 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
             Overflow(_) => {
                 bug!("overflow should be handled before the `report_selection_error` path");
             }
-            SelectionError::ErrorReporting => {
-                bug!("ErrorReporting Overflow should not reach `report_selection_err` call")
-            }
         };
 
         self.note_obligation_cause(&mut err, &obligation);
@@ -3459,14 +3456,12 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
         let found_node = found_did.and_then(|did| self.tcx.hir().get_if_local(did));
         let found_span = found_did.and_then(|did| self.tcx.hir().span_if_local(did));
 
-        if self.reported_closure_mismatch.borrow().contains(&(span, found_span)) {
+        if !self.reported_signature_mismatch.borrow_mut().insert((span, found_span)) {
             // We check closures twice, with obligations flowing in different directions,
             // but we want to complain about them only once.
             return None;
         }
 
-        self.reported_closure_mismatch.borrow_mut().insert((span, found_span));
-
         let mut not_tupled = false;
 
         let found = match found_trait_ref.skip_binder().args.type_at(1).kind() {
diff --git a/compiler/rustc_trait_selection/src/traits/query/evaluate_obligation.rs b/compiler/rustc_trait_selection/src/traits/query/evaluate_obligation.rs
index 31e34096fb0..4c0c57377e0 100644
--- a/compiler/rustc_trait_selection/src/traits/query/evaluate_obligation.rs
+++ b/compiler/rustc_trait_selection/src/traits/query/evaluate_obligation.rs
@@ -116,11 +116,9 @@ impl<'tcx> InferCtxtExt<'tcx> for InferCtxt<'tcx> {
                             r,
                         )
                     }
-                    OverflowError::ErrorReporting => EvaluationResult::EvaluatedToErr,
                     OverflowError::Error(_) => EvaluationResult::EvaluatedToErr,
                 })
             }
-            Err(OverflowError::ErrorReporting) => EvaluationResult::EvaluatedToErr,
             Err(OverflowError::Error(_)) => EvaluationResult::EvaluatedToErr,
         }
     }
diff --git a/compiler/rustc_trait_selection/src/traits/select/mod.rs b/compiler/rustc_trait_selection/src/traits/select/mod.rs
index 61fe2c8efe3..6a6adcbb680 100644
--- a/compiler/rustc_trait_selection/src/traits/select/mod.rs
+++ b/compiler/rustc_trait_selection/src/traits/select/mod.rs
@@ -14,9 +14,9 @@ use super::util;
 use super::util::closure_trait_ref_and_return_type;
 use super::wf;
 use super::{
-    ErrorReporting, ImplDerivedObligation, ImplDerivedObligationCause, Normalized, Obligation,
-    ObligationCause, ObligationCauseCode, Overflow, PolyTraitObligation, PredicateObligation,
-    Selection, SelectionError, SelectionResult, TraitQueryMode,
+    ImplDerivedObligation, ImplDerivedObligationCause, Normalized, Obligation, ObligationCause,
+    ObligationCauseCode, Overflow, PolyTraitObligation, PredicateObligation, Selection,
+    SelectionError, SelectionResult, TraitQueryMode,
 };
 
 use crate::infer::{InferCtxt, InferOk, TypeFreshener};
@@ -496,7 +496,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
                 }
                 Ok(_) => Ok(None),
                 Err(OverflowError::Canonical) => Err(Overflow(OverflowError::Canonical)),
-                Err(OverflowError::ErrorReporting) => Err(ErrorReporting),
                 Err(OverflowError::Error(e)) => Err(Overflow(OverflowError::Error(e))),
             })
             .flat_map(Result::transpose)
@@ -1233,7 +1232,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
             Ok(Some(c)) => self.evaluate_candidate(stack, &c),
             Ok(None) => Ok(EvaluatedToAmbig),
             Err(Overflow(OverflowError::Canonical)) => Err(OverflowError::Canonical),
-            Err(ErrorReporting) => Err(OverflowError::ErrorReporting),
             Err(..) => Ok(EvaluatedToErr),
         }
     }
diff --git a/compiler/rustc_ty_utils/src/abi.rs b/compiler/rustc_ty_utils/src/abi.rs
index 2772831e731..6e8293dac31 100644
--- a/compiler/rustc_ty_utils/src/abi.rs
+++ b/compiler/rustc_ty_utils/src/abi.rs
@@ -228,9 +228,9 @@ fn fn_sig_for_fn_abi<'tcx>(
 }
 
 #[inline]
-fn conv_from_spec_abi(tcx: TyCtxt<'_>, abi: SpecAbi) -> Conv {
+fn conv_from_spec_abi(tcx: TyCtxt<'_>, abi: SpecAbi, c_variadic: bool) -> Conv {
     use rustc_target::spec::abi::Abi::*;
-    match tcx.sess.target.adjust_abi(abi) {
+    match tcx.sess.target.adjust_abi(abi, c_variadic) {
         RustIntrinsic | PlatformIntrinsic | Rust | RustCall => Conv::Rust,
 
         // This is intentionally not using `Conv::Cold`, as that has to preserve
@@ -488,7 +488,7 @@ fn fn_abi_new_uncached<'tcx>(
 ) -> Result<&'tcx FnAbi<'tcx, Ty<'tcx>>, &'tcx FnAbiError<'tcx>> {
     let sig = cx.tcx.normalize_erasing_late_bound_regions(cx.param_env, sig);
 
-    let conv = conv_from_spec_abi(cx.tcx(), sig.abi);
+    let conv = conv_from_spec_abi(cx.tcx(), sig.abi, sig.c_variadic);
 
     let mut inputs = sig.inputs();
     let extra_args = if sig.abi == RustCall {
diff --git a/library/core/src/primitive_docs.rs b/library/core/src/primitive_docs.rs
index bd2851a26fb..267d9b44ad7 100644
--- a/library/core/src/primitive_docs.rs
+++ b/library/core/src/primitive_docs.rs
@@ -1605,9 +1605,9 @@ mod prim_ref {}
 /// type in the function pointer to the type at the function declaration, and the return value is
 /// [`transmute`d][mem::transmute] from the type in the declaration to the type in the
 /// pointer. All the usual caveats and concerns around transmutation apply; for instance, if the
-/// function expects a `NonNullI32` and the function pointer uses the ABI-compatible type
-/// `Option<NonNullI32>`, and the value used for the argument is `None`, then this call is Undefined
-/// Behavior since transmuting `None::<NonNullI32>` to `NonNullI32` violates the non-null
+/// function expects a `NonZeroI32` and the function pointer uses the ABI-compatible type
+/// `Option<NonZeroI32>`, and the value used for the argument is `None`, then this call is Undefined
+/// Behavior since transmuting `None::<NonZeroI32>` to `NonZeroI32` violates the non-zero
 /// requirement.
 ///
 /// #### Requirements concerning target features
diff --git a/src/librustdoc/clean/blanket_impl.rs b/src/librustdoc/clean/blanket_impl.rs
index 4da85885d67..47cfe651e31 100644
--- a/src/librustdoc/clean/blanket_impl.rs
+++ b/src/librustdoc/clean/blanket_impl.rs
@@ -81,7 +81,6 @@ impl<'a, 'tcx> BlanketImplFinder<'a, 'tcx> {
                     match infcx.evaluate_obligation(&obligation) {
                         Ok(eval_result) if eval_result.may_apply() => {}
                         Err(traits::OverflowError::Canonical) => {}
-                        Err(traits::OverflowError::ErrorReporting) => {}
                         _ => continue 'blanket_impls,
                     }
                 }
diff --git a/tests/ui/c-variadic/variadic-ffi-2.rs b/tests/ui/c-variadic/variadic-ffi-2.rs
index 67a0a9a1dec..a412a58d7c5 100644
--- a/tests/ui/c-variadic/variadic-ffi-2.rs
+++ b/tests/ui/c-variadic/variadic-ffi-2.rs
@@ -3,10 +3,13 @@
 
 fn baz(f: extern "stdcall" fn(usize, ...)) {
     //~^ ERROR: C-variadic function must have a compatible calling convention,
-    // like C, cdecl, aapcs, win64, sysv64 or efiapi
+    // like C, cdecl, system, aapcs, win64, sysv64 or efiapi
     f(22, 44);
 }
 
+fn system(f: extern "system" fn(usize, ...)) {
+    f(22, 44);
+}
 fn aapcs(f: extern "aapcs" fn(usize, ...)) {
     f(22, 44);
 }
diff --git a/tests/ui/c-variadic/variadic-ffi-2.stderr b/tests/ui/c-variadic/variadic-ffi-2.stderr
index d0ca7034ba1..fbf273b1f1d 100644
--- a/tests/ui/c-variadic/variadic-ffi-2.stderr
+++ b/tests/ui/c-variadic/variadic-ffi-2.stderr
@@ -1,4 +1,4 @@
-error[E0045]: C-variadic function must have a compatible calling convention, like `C`, `cdecl`, `aapcs`, `win64`, `sysv64` or `efiapi`
+error[E0045]: C-variadic function must have a compatible calling convention, like `C`, `cdecl`, `system`, `aapcs`, `win64`, `sysv64` or `efiapi`
   --> $DIR/variadic-ffi-2.rs:4:11
    |
 LL | fn baz(f: extern "stdcall" fn(usize, ...)) {
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage-0.qualified.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage-0.qualified.stderr
new file mode 100644
index 00000000000..62c8a442ab9
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage-0.qualified.stderr
@@ -0,0 +1,14 @@
+error[E0277]: the trait bound `T: Trait` is not satisfied
+  --> $DIR/assoc-type-const-bound-usage-0.rs:21:6
+   |
+LL |     <T as /* FIXME: ~const */ Trait>::Assoc::func()
+   |      ^ the trait `Trait` is not implemented for `T`
+   |
+help: consider further restricting this bound
+   |
+LL | const fn qualified<T: ~const Trait + Trait>() -> i32 {
+   |                                    +++++++
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage-0.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage-0.rs
new file mode 100644
index 00000000000..d8573d3af01
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage-0.rs
@@ -0,0 +1,24 @@
+// FIXME(effects): Collapse the revisions into one once we support `<Ty as ~const Trait>::Proj`.
+// revisions: unqualified qualified
+//[unqualified] check-pass
+//[qualified] known-bug: unknown
+
+#![feature(const_trait_impl, effects)]
+
+#[const_trait]
+trait Trait {
+    type Assoc: ~const Trait;
+    fn func() -> i32;
+}
+
+#[cfg(unqualified)]
+const fn unqualified<T: ~const Trait>() -> i32 {
+    T::Assoc::func()
+}
+
+#[cfg(qualified)]
+const fn qualified<T: ~const Trait>() -> i32 {
+    <T as /* FIXME: ~const */ Trait>::Assoc::func()
+}
+
+fn main() {}
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage-1.qualified.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage-1.qualified.stderr
new file mode 100644
index 00000000000..10e467da952
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage-1.qualified.stderr
@@ -0,0 +1,14 @@
+error[E0277]: the trait bound `T: Trait` is not satisfied
+  --> $DIR/assoc-type-const-bound-usage-1.rs:23:43
+   |
+LL | fn qualified<T: const Trait>() -> Type<{ <T as /* FIXME: const */ Trait>::Assoc::func() }> {
+   |                                           ^ the trait `Trait` is not implemented for `T`
+   |
+help: consider further restricting this bound
+   |
+LL | fn qualified<T: const Trait + Trait>() -> Type<{ <T as /* FIXME: const */ Trait>::Assoc::func() }> {
+   |                             +++++++
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage-1.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage-1.rs
new file mode 100644
index 00000000000..2190fa337b4
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage-1.rs
@@ -0,0 +1,27 @@
+// FIXME(effects): Collapse the revisions into one once we support `<Ty as const Trait>::Proj`.
+// revisions: unqualified qualified
+//[unqualified] check-pass
+//[qualified] known-bug: unknown
+
+#![feature(const_trait_impl, effects, generic_const_exprs)]
+#![allow(incomplete_features)]
+
+#[const_trait]
+trait Trait {
+    type Assoc: ~const Trait;
+    fn func() -> i32;
+}
+
+struct Type<const N: i32>;
+
+#[cfg(unqualified)]
+fn unqualified<T: const Trait>() -> Type<{ T::Assoc::func() }> {
+    Type
+}
+
+#[cfg(qualified)]
+fn qualified<T: const Trait>() -> Type<{ <T as /* FIXME: const */ Trait>::Assoc::func() }> {
+    Type
+}
+
+fn main() {}
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage.rs
deleted file mode 100644
index 16b717bc181..00000000000
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage.rs
+++ /dev/null
@@ -1,15 +0,0 @@
-// known-bug: #110395
-// FIXME check-pass
-#![feature(const_trait_impl, effects)]
-
-#[const_trait]
-trait Foo {
-    type Assoc: ~const Foo;
-    fn foo() {}
-}
-
-const fn foo<T: ~const Foo>() {
-    <T as /* FIXME: ~const */ Foo>::Assoc::foo();
-}
-
-fn main() {}
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage.stderr
deleted file mode 100644
index 268e337ee93..00000000000
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage.stderr
+++ /dev/null
@@ -1,22 +0,0 @@
-error: `~const` is not allowed here
-  --> $DIR/assoc-type-const-bound-usage.rs:7:17
-   |
-LL |     type Assoc: ~const Foo;
-   |                 ^^^^^^
-   |
-   = note: this item cannot have `~const` trait bounds
-
-error[E0277]: the trait bound `T: Foo` is not satisfied
-  --> $DIR/assoc-type-const-bound-usage.rs:12:6
-   |
-LL |     <T as /* FIXME: ~const */ Foo>::Assoc::foo();
-   |      ^ the trait `Foo` is not implemented for `T`
-   |
-help: consider further restricting this bound
-   |
-LL | const fn foo<T: ~const Foo + Foo>() {
-   |                            +++++
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type.rs
index 96790a87311..886fa6577d7 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type.rs
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type.rs
@@ -1,29 +1,43 @@
-// known-bug: #110395
+// FIXME(effects): Replace `Add` with `std::ops::Add` once the latter a `#[const_trait]` again.
+#![feature(const_trait_impl, effects)]
 
-#![feature(const_trait_impl)]
+#[const_trait]
+trait Add<Rhs = Self> {
+    type Output;
+
+    fn add(self, other: Rhs) -> Self::Output;
+}
+
+impl const Add for i32 {
+    type Output = Self;
+
+    fn add(self, other: Self) -> Self::Output {
+        self + other
+    }
+}
 
 struct NonConstAdd(i32);
 
-impl std::ops::Add for NonConstAdd {
+impl Add for NonConstAdd {
     type Output = Self;
 
     fn add(self, rhs: Self) -> Self {
-        NonConstAdd(self.0 + rhs.0)
+        NonConstAdd(self.0.add(rhs.0))
     }
 }
 
 #[const_trait]
 trait Foo {
-    type Bar: ~const std::ops::Add;
+    type Bar: ~const Add;
 }
 
 impl const Foo for NonConstAdd {
-    type Bar = NonConstAdd;
+    type Bar = NonConstAdd; //~ ERROR the trait bound `NonConstAdd: ~const Add` is not satisfied
 }
 
 #[const_trait]
 trait Baz {
-    type Qux: std::ops::Add;
+    type Qux: Add;
 }
 
 impl const Baz for NonConstAdd {
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type.stderr
index 58ad1849d4f..a9cae2a70be 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type.stderr
@@ -1,16 +1,16 @@
-error: `~const` is not allowed here
-  --> $DIR/assoc-type.rs:17:15
+error[E0277]: the trait bound `NonConstAdd: ~const Add` is not satisfied
+  --> $DIR/assoc-type.rs:35:16
    |
-LL |     type Bar: ~const std::ops::Add;
-   |               ^^^^^^
+LL |     type Bar = NonConstAdd;
+   |                ^^^^^^^^^^^ the trait `~const Add` is not implemented for `NonConstAdd`
    |
-   = note: this item cannot have `~const` trait bounds
-
-error: `~const` can only be applied to `#[const_trait]` traits
-  --> $DIR/assoc-type.rs:17:22
+   = help: the trait `Add` is implemented for `NonConstAdd`
+note: required by a bound in `Foo::Bar`
+  --> $DIR/assoc-type.rs:31:15
    |
-LL |     type Bar: ~const std::ops::Add;
-   |                      ^^^^^^^^^^^^^
+LL |     type Bar: ~const Add;
+   |               ^^^^^^^^^^ required by this bound in `Foo::Bar`
 
-error: aborting due to 2 previous errors
+error: aborting due to 1 previous error
 
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-invalid-places.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-invalid-places.stderr
index a54ba7a94b4..6b886e88511 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-invalid-places.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-invalid-places.stderr
@@ -72,7 +72,11 @@ error: `~const` is not allowed here
 LL |     type Type<T: ~const Trait>: ~const Trait;
    |                  ^^^^^^
    |
-   = note: this item cannot have `~const` trait bounds
+note: associated types in non-`#[const_trait]` traits cannot have `~const` trait bounds
+  --> $DIR/tilde-const-invalid-places.rs:25:5
+   |
+LL |     type Type<T: ~const Trait>: ~const Trait;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: `~const` is not allowed here
   --> $DIR/tilde-const-invalid-places.rs:25:33
@@ -80,7 +84,11 @@ error: `~const` is not allowed here
 LL |     type Type<T: ~const Trait>: ~const Trait;
    |                                 ^^^^^^
    |
-   = note: this item cannot have `~const` trait bounds
+note: associated types in non-`#[const_trait]` traits cannot have `~const` trait bounds
+  --> $DIR/tilde-const-invalid-places.rs:25:5
+   |
+LL |     type Type<T: ~const Trait>: ~const Trait;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: `~const` is not allowed here
   --> $DIR/tilde-const-invalid-places.rs:28:30
@@ -108,7 +116,11 @@ error: `~const` is not allowed here
 LL |     type Type<T: ~const Trait> = ();
    |                  ^^^^^^
    |
-   = note: this item cannot have `~const` trait bounds
+note: associated types in non-const impls cannot have `~const` trait bounds
+  --> $DIR/tilde-const-invalid-places.rs:34:5
+   |
+LL |     type Type<T: ~const Trait> = ();
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: `~const` is not allowed here
   --> $DIR/tilde-const-invalid-places.rs:36:30
@@ -136,7 +148,11 @@ error: `~const` is not allowed here
 LL |     type Type<T: ~const Trait> = ();
    |                  ^^^^^^
    |
-   = note: this item cannot have `~const` trait bounds
+note: inherent associated types cannot have `~const` trait bounds
+  --> $DIR/tilde-const-invalid-places.rs:44:5
+   |
+LL |     type Type<T: ~const Trait> = ();
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: `~const` is not allowed here
   --> $DIR/tilde-const-invalid-places.rs:46:30
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-trait-assoc-tys.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-trait-assoc-tys.rs
new file mode 100644
index 00000000000..4c383fe1506
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-trait-assoc-tys.rs
@@ -0,0 +1,18 @@
+// check-pass
+#![feature(const_trait_impl, effects)]
+
+#[const_trait]
+trait Trait {
+    // FIXME(effects): `~const` bounds in trait associated types (excluding associated type bounds)
+    // don't look super useful. Should we forbid them again?
+    type Assoc<T: ~const Bound>;
+}
+
+impl const Trait for () {
+    type Assoc<T: ~const Bound> = T;
+}
+
+#[const_trait]
+trait Bound {}
+
+fn main() {}
diff --git a/tests/ui/traits/method-argument-mismatch-variance-ice-119867.rs b/tests/ui/traits/method-argument-mismatch-variance-ice-119867.rs
new file mode 100644
index 00000000000..4b7862abc91
--- /dev/null
+++ b/tests/ui/traits/method-argument-mismatch-variance-ice-119867.rs
@@ -0,0 +1,13 @@
+trait Deserialize {
+    fn deserialize(&self);
+}
+
+struct ArchivedVec<T>(T);
+
+impl<T> Deserialize for ArchivedVec<T> {
+    fn deserialize(s: _) {}
+    //~^ ERROR: `_` is not allowed within types on item signatures
+    //~| ERROR: has a `&self` declaration in the trait, but not in the impl
+}
+
+fn main() {}
diff --git a/tests/ui/traits/method-argument-mismatch-variance-ice-119867.stderr b/tests/ui/traits/method-argument-mismatch-variance-ice-119867.stderr
new file mode 100644
index 00000000000..e63cc522dd1
--- /dev/null
+++ b/tests/ui/traits/method-argument-mismatch-variance-ice-119867.stderr
@@ -0,0 +1,24 @@
+error[E0121]: the placeholder `_` is not allowed within types on item signatures for functions
+  --> $DIR/method-argument-mismatch-variance-ice-119867.rs:8:23
+   |
+LL |     fn deserialize(s: _) {}
+   |                       ^ not allowed in type signatures
+   |
+help: try replacing `_` with the type in the corresponding trait method signature
+   |
+LL |     fn deserialize(s: &ArchivedVec<T>) {}
+   |                       ~~~~~~~~~~~~~~~
+
+error[E0186]: method `deserialize` has a `&self` declaration in the trait, but not in the impl
+  --> $DIR/method-argument-mismatch-variance-ice-119867.rs:8:5
+   |
+LL |     fn deserialize(&self);
+   |     ---------------------- `&self` used in trait
+...
+LL |     fn deserialize(s: _) {}
+   |     ^^^^^^^^^^^^^^^^^^^^ expected `&self` in impl
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0121, E0186.
+For more information about an error, try `rustc --explain E0121`.