Skip to content

Commit 20f0a86

Browse files
committed
Auto merge of #157541 - JonathanBrouwer:rollup-Kf94s03, r=JonathanBrouwer
Rollup of 17 pull requests Successful merges: - #157251 (`rust-analyzer` subtree update) - #157533 (Subtree sync for rustc_codegen_cranelift) - #154742 (Add APIs for case folding to the standard library) - #155144 (mir_build: Add an extra intermediate step in MIR building for patterns ) - #157016 (add `extern "tail"` calling convention) - #157264 (diagnostics: Fix ICE building a trait ref in method suggestions) - #157386 (Parse deprecated note links separately in rustc_resolve) - #157483 (fix windows-gnu TLS leak) - #157488 (compiletest: inject `#![windows_subsystem = "windows"]` to debuginfo tests on Windows) - #157509 (remove solaris implementation for File::lock, it has the wrong semantics) - #157521 (Rename `SyncView::{as_pin => as_pin_ref}`) - #156136 (Move tests box) - #157365 (Revert "LLVM 23: Run AssignGUIDPass in some places") - #157471 (Debug assert that parsed attributes are in the `BUILTIN_ATTRIBUTE_MAP`) - #157485 (Rename `errors.rs` file to `diagnostics.rs` (1/N)) - #157494 (Convert `QueryRegionConstraint` into a struct) - #157526 (std tests: skip a slow test on Miri) Failed merges: - #155527 (Replace printables table with `unicode_data.rs` tables)
2 parents 61d7280 + 52921a2 commit 20f0a86

419 files changed

Lines changed: 11046 additions & 4618 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: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6070,6 +6070,7 @@ checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493"
60706070
name = "unicode-table-generator"
60716071
version = "0.1.0"
60726072
dependencies = [
6073+
"rustc-hash 2.1.1",
60736074
"ucd-parse",
60746075
]
60756076

compiler/rustc_abi/src/canon_abi.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ pub enum CanonAbi {
2828
Rust,
2929
RustCold,
3030
RustPreserveNone,
31+
RustTail,
3132

3233
/// An ABI that rustc does not know how to call or define.
3334
Custom,
@@ -59,7 +60,10 @@ pub enum CanonAbi {
5960
impl CanonAbi {
6061
pub fn is_rustic_abi(self) -> bool {
6162
match self {
62-
CanonAbi::Rust | CanonAbi::RustCold | CanonAbi::RustPreserveNone => true,
63+
CanonAbi::Rust
64+
| CanonAbi::RustCold
65+
| CanonAbi::RustPreserveNone
66+
| CanonAbi::RustTail => true,
6367
CanonAbi::C
6468
| CanonAbi::Custom
6569
| CanonAbi::Swift
@@ -81,6 +85,7 @@ impl fmt::Display for CanonAbi {
8185
CanonAbi::Rust => ExternAbi::Rust,
8286
CanonAbi::RustCold => ExternAbi::RustCold,
8387
CanonAbi::RustPreserveNone => ExternAbi::RustPreserveNone,
88+
CanonAbi::RustTail => ExternAbi::RustTail,
8489
CanonAbi::Custom => ExternAbi::Custom,
8590
CanonAbi::Swift => ExternAbi::Swift,
8691
CanonAbi::Arm(arm_call) => match arm_call {

compiler/rustc_abi/src/extern_abi.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ pub enum ExternAbi {
4949
/// forcing callers to save all registers.
5050
RustPreserveNone,
5151

52+
/// Ensures that calls in tail position can always be optimized into a jump.
53+
///
54+
/// This ABI is not stable, and relies on LLVM implementation details.
55+
RustTail,
56+
5257
/// Unstable impl detail that directly uses Rust types to describe the ABI to LLVM.
5358
/// Even normally-compatible Rust types can become ABI-incompatible with this ABI!
5459
Unadjusted,
@@ -205,6 +210,7 @@ abi_impls! {
205210
System { unwind: true } =><= "system-unwind",
206211
SysV64 { unwind: false } =><= "sysv64",
207212
SysV64 { unwind: true } =><= "sysv64-unwind",
213+
RustTail =><= "tail",
208214
Thiscall { unwind: false } =><= "thiscall",
209215
Thiscall { unwind: true } =><= "thiscall-unwind",
210216
Unadjusted =><= "unadjusted",
@@ -280,7 +286,7 @@ impl ExternAbi {
280286
/// - are subject to change between compiler versions
281287
pub fn is_rustic_abi(self) -> bool {
282288
use ExternAbi::*;
283-
matches!(self, Rust | RustCall | RustCold | RustPreserveNone)
289+
matches!(self, Rust | RustCall | RustCold | RustPreserveNone | RustTail)
284290
}
285291

286292
/// Returns whether the ABI supports C variadics. This only controls whether we allow *imports*
@@ -354,6 +360,7 @@ impl ExternAbi {
354360
| Self::SysV64 { .. }
355361
| Self::Win64 { .. }
356362
| Self::RustPreserveNone
363+
| Self::RustTail
357364
| Self::Swift => true,
358365
}
359366
}

compiler/rustc_ast_lowering/src/asm.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,17 @@ use rustc_session::errors::feature_err;
99
use rustc_span::{Span, sym};
1010
use rustc_target::asm;
1111

12-
use super::LoweringContext;
13-
use super::errors::{
12+
use crate::diagnostics::{
1413
AbiSpecifiedMultipleTimes, AttSyntaxOnlyX86, ClobberAbiNotSupported,
1514
InlineAsmUnsupportedTarget, InvalidAbiClobberAbi, InvalidAsmTemplateModifierConst,
1615
InvalidAsmTemplateModifierLabel, InvalidAsmTemplateModifierRegClass,
1716
InvalidAsmTemplateModifierRegClassSub, InvalidAsmTemplateModifierSym, InvalidRegister,
1817
InvalidRegisterClass, RegisterClassOnlyClobber, RegisterClassOnlyClobberStable,
1918
RegisterConflict,
2019
};
21-
use crate::{AllowReturnTypeNotation, ImplTraitContext, ImplTraitPosition, ParamMode};
20+
use crate::{
21+
AllowReturnTypeNotation, ImplTraitContext, ImplTraitPosition, LoweringContext, ParamMode,
22+
};
2223

2324
impl<'hir> LoweringContext<'_, 'hir> {
2425
pub(crate) fn lower_inline_asm(

compiler/rustc_ast_lowering/src/delegation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ use rustc_span::symbol::kw;
5656
use rustc_span::{ErrorGuaranteed, Ident, Span, Symbol};
5757

5858
use crate::delegation::generics::{GenericsGenerationResult, GenericsGenerationResults};
59-
use crate::errors::{
59+
use crate::diagnostics::{
6060
CycleInDelegationSignatureResolution, DelegationAttemptedBlockWithDefsDeletion,
6161
DelegationBlockSpecifiedWhenNoParams, UnresolvedDelegationCallee,
6262
};
File renamed without changes.

compiler/rustc_ast_lowering/src/expr.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,17 @@ use visit::{Visitor, walk_expr};
1919

2020
mod closure;
2121

22-
use super::errors::{
22+
use crate::diagnostics::{
2323
AsyncCoroutinesNotSupported, AwaitOnlyInAsyncFnAndBlocks,
24-
FunctionalRecordUpdateDestructuringAssignment, InclusiveRangeWithNoEnd, MatchArmWithNoBody,
25-
MoveExprOnlyInPlainClosures, NeverPatternWithBody, NeverPatternWithGuard,
26-
UnderscoreExprLhsAssign,
24+
FunctionalRecordUpdateDestructuringAssignment, InclusiveRangeWithNoEnd,
25+
InvalidLegacyConstGenericArg, MatchArmWithNoBody, MoveExprOnlyInPlainClosures,
26+
NeverPatternWithBody, NeverPatternWithGuard, UnderscoreExprLhsAssign, UseConstGenericArg,
27+
YieldInClosure,
2728
};
28-
use super::{
29-
GenericArgsMode, ImplTraitContext, LoweringContext, ParamMode, ResolverAstLoweringExt,
29+
use crate::{
30+
AllowReturnTypeNotation, GenericArgsMode, ImplTraitContext, ImplTraitPosition, LoweringContext,
31+
ParamMode, ResolverAstLoweringExt, TryBlockScope,
3032
};
31-
use crate::errors::{InvalidLegacyConstGenericArg, UseConstGenericArg, YieldInClosure};
32-
use crate::{AllowReturnTypeNotation, ImplTraitPosition, TryBlockScope};
3333

3434
pub(super) struct WillCreateDefIdsVisitor;
3535

compiler/rustc_ast_lowering/src/expr/closure.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use rustc_span::Span;
77

88
use super::{LoweringContext, MoveExprInitializerFinder, MoveExprState};
99
use crate::FnDeclKind;
10-
use crate::errors::{ClosureCannotBeStatic, CoroutineTooManyParameters};
10+
use crate::diagnostics::{ClosureCannotBeStatic, CoroutineTooManyParameters};
1111

1212
impl<'hir> LoweringContext<'_, 'hir> {
1313
// Entry point for `ExprKind::Closure`. Plain closures go through

compiler/rustc_ast_lowering/src/item.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ use smallvec::{SmallVec, smallvec};
1919
use thin_vec::ThinVec;
2020
use tracing::instrument;
2121

22-
use super::errors::{InvalidAbi, InvalidAbiSuggestion, TupleStructWithDefault, UnionWithDefault};
22+
use super::diagnostics::{
23+
InvalidAbi, InvalidAbiSuggestion, TupleStructWithDefault, UnionWithDefault,
24+
};
2325
use super::stability::{enabled_names, gate_unstable_abi};
2426
use super::{
2527
AstOwner, FnDeclKind, GenericArgsMode, ImplTraitContext, ImplTraitPosition, LoweringContext,

compiler/rustc_ast_lowering/src/lib.rs

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ use smallvec::SmallVec;
7070
use thin_vec::ThinVec;
7171
use tracing::{debug, instrument, trace};
7272

73-
use crate::errors::{AssocTyParentheses, AssocTyParenthesesSub, MisplacedImplTrait};
73+
use crate::diagnostics::{AssocTyParentheses, AssocTyParenthesesSub, MisplacedImplTrait};
7474
use crate::item::Owners;
7575

7676
macro_rules! arena_vec {
@@ -83,7 +83,7 @@ mod asm;
8383
mod block;
8484
mod contract;
8585
mod delegation;
86-
mod errors;
86+
mod diagnostics;
8787
mod expr;
8888
mod format;
8989
mod index;
@@ -1145,17 +1145,21 @@ impl<'hir> LoweringContext<'_, 'hir> {
11451145
{
11461146
let err = match (&data.inputs[..], &data.output) {
11471147
([_, ..], FnRetTy::Default(_)) => {
1148-
errors::BadReturnTypeNotation::Inputs { span: data.inputs_span }
1148+
diagnostics::BadReturnTypeNotation::Inputs {
1149+
span: data.inputs_span,
1150+
}
11491151
}
11501152
([], FnRetTy::Default(_)) => {
1151-
errors::BadReturnTypeNotation::NeedsDots { span: data.inputs_span }
1153+
diagnostics::BadReturnTypeNotation::NeedsDots {
1154+
span: data.inputs_span,
1155+
}
11521156
}
11531157
// The case `T: Trait<method(..) -> Ret>` is handled in the parser.
11541158
(_, FnRetTy::Ty(ty)) => {
11551159
let span = data.inputs_span.shrink_to_hi().to(ty.span);
1156-
errors::BadReturnTypeNotation::Output {
1160+
diagnostics::BadReturnTypeNotation::Output {
11571161
span,
1158-
suggestion: errors::RTNSuggestion {
1162+
suggestion: diagnostics::RTNSuggestion {
11591163
output: span,
11601164
input: data.inputs_span,
11611165
},
@@ -1226,7 +1230,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
12261230
_ => None,
12271231
};
12281232

1229-
let guar = self.dcx().emit_err(errors::MisplacedAssocTyBinding {
1233+
let guar = self.dcx().emit_err(diagnostics::MisplacedAssocTyBinding {
12301234
span: constraint.span,
12311235
suggestion,
12321236
});
@@ -1529,7 +1533,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
15291533
ast::GenericBound::Use(_, span) => Some(span),
15301534
_ => None,
15311535
}) {
1532-
self.tcx.dcx().emit_err(errors::NoPreciseCapturesOnApit { span });
1536+
self.tcx.dcx().emit_err(diagnostics::NoPreciseCapturesOnApit { span });
15331537
}
15341538

15351539
let def_id = self.local_def_id(*def_node_id);
@@ -2123,7 +2127,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
21232127
.filter(|_| match source {
21242128
hir::GenericParamSource::Generics => true,
21252129
hir::GenericParamSource::Binder => {
2126-
self.dcx().emit_err(errors::GenericParamDefaultInBinder {
2130+
self.dcx().emit_err(diagnostics::GenericParamDefaultInBinder {
21272131
span: param.span(),
21282132
});
21292133

@@ -2154,7 +2158,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
21542158
.filter(|anon_const| match source {
21552159
hir::GenericParamSource::Generics => true,
21562160
hir::GenericParamSource::Binder => {
2157-
let err = errors::GenericParamDefaultInBinder { span: param.span() };
2161+
let err =
2162+
diagnostics::GenericParamDefaultInBinder { span: param.span() };
21582163
if expr::WillCreateDefIdsVisitor
21592164
.visit_expr(&anon_const.value)
21602165
.is_break()

0 commit comments

Comments
 (0)