Skip to content

Commit 2dc23e7

Browse files
committed
Auto merge of rust-lang#3263 - rust-lang:rustup-2024-01-10, r=saethlin
Automatic Rustup
2 parents 707db44 + 7e9da57 commit 2dc23e7

File tree

869 files changed

+15140
-9226
lines changed

Some content is hidden

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

869 files changed

+15140
-9226
lines changed

.github/ISSUE_TEMPLATE/diagnostics.yaml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,23 @@ body:
5252
render: Rust
5353
validations:
5454
required: false
55-
- type: markdown
55+
- type: textarea
56+
id: version
5657
attributes:
57-
value: |
58-
If you're using the stable version of the compiler, you should also check if the bug also exists in the beta or nightly versions. The output might also be different depending on the Edition.
58+
label: Rust Version
59+
description: Please provide the `rustc` version, `rustc --version --verbose`. Make sure that you're using the latest version of the compiler, and not an outdated stable or nightly release!
60+
placeholder: |
61+
$ rustc --version --verbose
62+
rustc 1.XX.Y (SHORTHASH DATE)
63+
binary: rustc
64+
commit-hash: LONGHASHVALUE
65+
commit-date: DATE
66+
host: PLATFORMTRIPLE
67+
release: 1.XX.Y
68+
LLVM version: XX.YY.ZZ
69+
render: Shell
70+
validations:
71+
required: true
5972
- type: textarea
6073
id: extra
6174
attributes:

.github/ISSUE_TEMPLATE/ice.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ body:
4040
id: version
4141
attributes:
4242
label: Rust Version
43-
description: Please provide the `rustc` version, `rustc --version --verbose`
43+
description: Please provide the `rustc` version, `rustc --version --verbose`. Make sure that you're using the latest version of the compiler, and not an outdated stable or nightly release!
4444
placeholder: |
4545
$ rustc --version --verbose
4646
rustc 1.XX.Y (SHORTHASH DATE)

Cargo.lock

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -704,9 +704,9 @@ checksum = "55b672471b4e9f9e95499ea597ff64941a309b2cdbffcc46f2cc5e2d971fd335"
704704

705705
[[package]]
706706
name = "compiler_builtins"
707-
version = "0.1.103"
707+
version = "0.1.104"
708708
source = "registry+https://github.com/rust-lang/crates.io-index"
709-
checksum = "a3b73c3443a5fd2438d7ba4853c64e4c8efc2404a9e28a9234cc2d5eebc6c242"
709+
checksum = "99c3f9035afc33f4358773239573f7d121099856753e1bbd2a6a5207098fc741"
710710
dependencies = [
711711
"cc",
712712
"rustc-std-workspace-core",
@@ -3738,6 +3738,7 @@ dependencies = [
37383738
"rustc_trait_selection",
37393739
"rustc_ty_utils",
37403740
"serde_json",
3741+
"shlex",
37413742
"time",
37423743
"tracing",
37433744
"windows",
@@ -3797,7 +3798,6 @@ dependencies = [
37973798
name = "rustc_expand"
37983799
version = "0.0.0"
37993800
dependencies = [
3800-
"crossbeam-channel",
38013801
"rustc_ast",
38023802
"rustc_ast_passes",
38033803
"rustc_ast_pretty",
@@ -3877,6 +3877,7 @@ dependencies = [
38773877
"rustc_feature",
38783878
"rustc_fluent_macro",
38793879
"rustc_hir",
3880+
"rustc_hir_pretty",
38803881
"rustc_index",
38813882
"rustc_infer",
38823883
"rustc_lint_defs",
@@ -4644,6 +4645,7 @@ dependencies = [
46444645
"rustc_index",
46454646
"rustc_macros",
46464647
"rustc_serialize",
4648+
"rustc_span",
46474649
"smallvec",
46484650
]
46494651

Cargo.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,14 @@ gimli.debug = 0
104104
miniz_oxide.debug = 0
105105
object.debug = 0
106106

107+
# These are very thin wrappers around executing lld with the right binary name.
108+
# Basically nothing within them can go wrong without having been explicitly logged anyway.
109+
# We ship these in every rustc tarball and even after compression they add up
110+
# to around 0.6MB of data every user needs to download (and 15MB on disk).
111+
[profile.release.package.lld-wrapper]
112+
debug = 0
113+
strip = true
114+
107115
[patch.crates-io]
108116
# See comments in `library/rustc-std-workspace-core/README.md` for what's going on
109117
# here

compiler/rustc_abi/src/lib.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use rustc_data_structures::stable_hasher::StableOrd;
1616
#[cfg(feature = "nightly")]
1717
use rustc_macros::HashStable_Generic;
1818
#[cfg(feature = "nightly")]
19-
use rustc_macros::{Decodable, Encodable};
19+
use rustc_macros::{Decodable_Generic, Encodable_Generic};
2020
#[cfg(feature = "nightly")]
2121
use std::iter::Step;
2222

@@ -30,7 +30,7 @@ pub use layout::LayoutCalculator;
3030
pub trait HashStableContext {}
3131

3232
#[derive(Clone, Copy, PartialEq, Eq, Default)]
33-
#[cfg_attr(feature = "nightly", derive(Encodable, Decodable, HashStable_Generic))]
33+
#[cfg_attr(feature = "nightly", derive(Encodable_Generic, Decodable_Generic, HashStable_Generic))]
3434
pub struct ReprFlags(u8);
3535

3636
bitflags! {
@@ -52,7 +52,7 @@ bitflags! {
5252
rustc_data_structures::external_bitflags_debug! { ReprFlags }
5353

5454
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
55-
#[cfg_attr(feature = "nightly", derive(Encodable, Decodable, HashStable_Generic))]
55+
#[cfg_attr(feature = "nightly", derive(Encodable_Generic, Decodable_Generic, HashStable_Generic))]
5656
pub enum IntegerType {
5757
/// Pointer-sized integer type, i.e. `isize` and `usize`. The field shows signedness, e.g.
5858
/// `Pointer(true)` means `isize`.
@@ -73,7 +73,7 @@ impl IntegerType {
7373

7474
/// Represents the repr options provided by the user.
7575
#[derive(Copy, Clone, Debug, Eq, PartialEq, Default)]
76-
#[cfg_attr(feature = "nightly", derive(Encodable, Decodable, HashStable_Generic))]
76+
#[cfg_attr(feature = "nightly", derive(Encodable_Generic, Decodable_Generic, HashStable_Generic))]
7777
pub struct ReprOptions {
7878
pub int: Option<IntegerType>,
7979
pub align: Option<Align>,
@@ -412,7 +412,7 @@ impl FromStr for Endian {
412412

413413
/// Size of a type in bytes.
414414
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
415-
#[cfg_attr(feature = "nightly", derive(Encodable, Decodable, HashStable_Generic))]
415+
#[cfg_attr(feature = "nightly", derive(Encodable_Generic, Decodable_Generic, HashStable_Generic))]
416416
pub struct Size {
417417
raw: u64,
418418
}
@@ -636,7 +636,7 @@ impl Step for Size {
636636

637637
/// Alignment of a type in bytes (always a power of two).
638638
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
639-
#[cfg_attr(feature = "nightly", derive(Encodable, Decodable, HashStable_Generic))]
639+
#[cfg_attr(feature = "nightly", derive(Encodable_Generic, Decodable_Generic, HashStable_Generic))]
640640
pub struct Align {
641641
pow2: u8,
642642
}
@@ -777,7 +777,7 @@ impl AbiAndPrefAlign {
777777

778778
/// Integers, also used for enum discriminants.
779779
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
780-
#[cfg_attr(feature = "nightly", derive(Encodable, Decodable, HashStable_Generic))]
780+
#[cfg_attr(feature = "nightly", derive(Encodable_Generic, Decodable_Generic, HashStable_Generic))]
781781
pub enum Integer {
782782
I8,
783783
I16,

compiler/rustc_ast/src/ast.rs

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
2121
pub use crate::format::*;
2222
pub use crate::util::parser::ExprPrecedence;
23+
pub use rustc_span::AttrId;
2324
pub use GenericArgs::*;
2425
pub use UnsafeSource::*;
2526

@@ -30,7 +31,6 @@ use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
3031
use rustc_data_structures::stack::ensure_sufficient_stack;
3132
use rustc_data_structures::sync::Lrc;
3233
use rustc_macros::HashStable_Generic;
33-
use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
3434
use rustc_span::source_map::{respan, Spanned};
3535
use rustc_span::symbol::{kw, sym, Ident, Symbol};
3636
use rustc_span::{ErrorGuaranteed, Span, DUMMY_SP};
@@ -2682,22 +2682,6 @@ pub enum AttrStyle {
26822682
Inner,
26832683
}
26842684

2685-
rustc_index::newtype_index! {
2686-
#[orderable]
2687-
#[debug_format = "AttrId({})"]
2688-
pub struct AttrId {}
2689-
}
2690-
2691-
impl<S: Encoder> Encodable<S> for AttrId {
2692-
fn encode(&self, _s: &mut S) {}
2693-
}
2694-
2695-
impl<D: Decoder> Decodable<D> for AttrId {
2696-
default fn decode(_: &mut D) -> AttrId {
2697-
panic!("cannot decode `AttrId` with `{}`", std::any::type_name::<D>());
2698-
}
2699-
}
2700-
27012685
/// A list of attributes.
27022686
pub type AttrVec = ThinVec<Attribute>;
27032687

compiler/rustc_ast/src/tokenstream.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ use crate::AttrVec;
2121
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
2222
use rustc_data_structures::sync::{self, Lrc};
2323
use rustc_macros::HashStable_Generic;
24-
use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
25-
use rustc_span::{sym, Span, Symbol, DUMMY_SP};
24+
use rustc_serialize::{Decodable, Encodable};
25+
use rustc_span::{sym, Span, SpanDecoder, SpanEncoder, Symbol, DUMMY_SP};
2626
use smallvec::{smallvec, SmallVec};
2727

2828
use std::borrow::Cow;
@@ -150,14 +150,14 @@ impl fmt::Debug for LazyAttrTokenStream {
150150
}
151151
}
152152

153-
impl<S: Encoder> Encodable<S> for LazyAttrTokenStream {
153+
impl<S: SpanEncoder> Encodable<S> for LazyAttrTokenStream {
154154
fn encode(&self, s: &mut S) {
155155
// Used by AST json printing.
156156
Encodable::encode(&self.to_attr_token_stream(), s);
157157
}
158158
}
159159

160-
impl<D: Decoder> Decodable<D> for LazyAttrTokenStream {
160+
impl<D: SpanDecoder> Decodable<D> for LazyAttrTokenStream {
161161
fn decode(_d: &mut D) -> Self {
162162
panic!("Attempted to decode LazyAttrTokenStream");
163163
}

compiler/rustc_ast_lowering/messages.ftl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ ast_lowering_bad_return_type_notation_output =
3535
3636
ast_lowering_base_expression_double_dot =
3737
base expression required after `..`
38-
.label = add a base expression here
38+
.suggestion = add a base expression here
3939
4040
ast_lowering_clobber_abi_not_supported =
4141
`clobber_abi` is not supported on this target
@@ -106,7 +106,8 @@ ast_lowering_misplaced_double_dot =
106106
.note = only allowed in tuple, tuple struct, and slice patterns
107107
108108
ast_lowering_misplaced_impl_trait =
109-
`impl Trait` only allowed in function and inherent method argument and return types, not in {$position}
109+
`impl Trait` is not allowed in {$position}
110+
.note = `impl Trait` is only allowed in arguments and return types of functions and methods
110111
111112
ast_lowering_misplaced_relax_trait_bound =
112113
`?Trait` bounds are only permitted at the point where a type parameter is declared

compiler/rustc_ast_lowering/src/errors.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ pub enum AssocTyParenthesesSub {
9090

9191
#[derive(Diagnostic)]
9292
#[diag(ast_lowering_misplaced_impl_trait, code = "E0562")]
93+
#[note]
9394
pub struct MisplacedImplTrait<'a> {
9495
#[primary_span]
9596
pub span: Span,
@@ -113,10 +114,10 @@ pub struct UnderscoreExprLhsAssign {
113114
}
114115

115116
#[derive(Diagnostic, Clone, Copy)]
116-
#[diag(ast_lowering_base_expression_double_dot)]
117+
#[diag(ast_lowering_base_expression_double_dot, code = "E0797")]
117118
pub struct BaseExpressionDoubleDot {
118119
#[primary_span]
119-
#[label]
120+
#[suggestion(code = "/* expr */", applicability = "has-placeholders", style = "verbose")]
120121
pub span: Span,
121122
}
122123

compiler/rustc_ast_lowering/src/item.rs

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use rustc_hir::def::{DefKind, Res};
1212
use rustc_hir::def_id::{LocalDefId, CRATE_DEF_ID};
1313
use rustc_hir::PredicateOrigin;
1414
use rustc_index::{Idx, IndexSlice, IndexVec};
15+
use rustc_middle::span_bug;
1516
use rustc_middle::ty::{ResolverAstLowering, TyCtxt};
1617
use rustc_span::edit_distance::find_best_match_for_name;
1718
use rustc_span::symbol::{kw, sym, Ident};
@@ -182,7 +183,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
182183
self.lower_use_tree(use_tree, &prefix, id, vis_span, ident, attrs)
183184
}
184185
ItemKind::Static(box ast::StaticItem { ty: t, mutability: m, expr: e }) => {
185-
let (ty, body_id) = self.lower_const_item(t, span, e.as_deref());
186+
let (ty, body_id) =
187+
self.lower_const_item(t, span, e.as_deref(), ImplTraitPosition::StaticTy);
186188
hir::ItemKind::Static(ty, *m, body_id)
187189
}
188190
ItemKind::Const(box ast::ConstItem { generics, ty, expr, .. }) => {
@@ -191,7 +193,9 @@ impl<'hir> LoweringContext<'_, 'hir> {
191193
Const::No,
192194
id,
193195
&ImplTraitContext::Disallowed(ImplTraitPosition::Generic),
194-
|this| this.lower_const_item(ty, span, expr.as_deref()),
196+
|this| {
197+
this.lower_const_item(ty, span, expr.as_deref(), ImplTraitPosition::ConstTy)
198+
},
195199
);
196200
hir::ItemKind::Const(ty, generics, body_id)
197201
}
@@ -448,8 +452,9 @@ impl<'hir> LoweringContext<'_, 'hir> {
448452
ty: &Ty,
449453
span: Span,
450454
body: Option<&Expr>,
455+
impl_trait_position: ImplTraitPosition,
451456
) -> (&'hir hir::Ty<'hir>, hir::BodyId) {
452-
let ty = self.lower_ty(ty, &ImplTraitContext::Disallowed(ImplTraitPosition::ConstTy));
457+
let ty = self.lower_ty(ty, &ImplTraitContext::Disallowed(impl_trait_position));
453458
(ty, self.lower_const_body(span, body))
454459
}
455460

@@ -572,23 +577,25 @@ impl<'hir> LoweringContext<'_, 'hir> {
572577
// This is used to track which lifetimes have already been defined,
573578
// and which need to be replicated when lowering an async fn.
574579

575-
match parent_hir.node().expect_item().kind {
580+
let generics = match parent_hir.node().expect_item().kind {
576581
hir::ItemKind::Impl(impl_) => {
577582
self.is_in_trait_impl = impl_.of_trait.is_some();
583+
&impl_.generics
578584
}
579-
hir::ItemKind::Trait(_, _, generics, _, _) if self.tcx.features().effects => {
580-
self.host_param_id = generics
581-
.params
582-
.iter()
583-
.find(|param| {
584-
matches!(
585-
param.kind,
586-
hir::GenericParamKind::Const { is_host_effect: true, .. }
587-
)
588-
})
589-
.map(|param| param.def_id);
585+
hir::ItemKind::Trait(_, _, generics, _, _) => generics,
586+
kind => {
587+
span_bug!(item.span, "assoc item has unexpected kind of parent: {}", kind.descr())
590588
}
591-
_ => {}
589+
};
590+
591+
if self.tcx.features().effects {
592+
self.host_param_id = generics
593+
.params
594+
.iter()
595+
.find(|param| {
596+
matches!(param.kind, hir::GenericParamKind::Const { is_host_effect: true, .. })
597+
})
598+
.map(|param| param.def_id);
592599
}
593600

594601
match ctxt {

0 commit comments

Comments
 (0)