Skip to content

Commit bddf1d7

Browse files
committed
Merge from rustc
2 parents f0b8456 + f2e711e commit bddf1d7

File tree

215 files changed

+3972
-1379
lines changed

Some content is hidden

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

215 files changed

+3972
-1379
lines changed

Cargo.lock

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4354,6 +4354,7 @@ dependencies = [
43544354
"rustc_target",
43554355
"smallvec",
43564356
"tracing",
4357+
"typed-arena",
43574358
]
43584359

43594360
[[package]]
@@ -5689,6 +5690,12 @@ dependencies = [
56895690
"rustc-hash",
56905691
]
56915692

5693+
[[package]]
5694+
name = "typed-arena"
5695+
version = "2.0.2"
5696+
source = "registry+https://github.com/rust-lang/crates.io-index"
5697+
checksum = "6af6ae20167a9ece4bcb41af5b80f8a1f1df981f6391189ce00fd257af04126a"
5698+
56925699
[[package]]
56935700
name = "typenum"
56945701
version = "1.16.0"

RELEASES.md

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,128 @@
1+
Version 1.75.0 (2023-12-28)
2+
==========================
3+
4+
<a id="1.75.0-Language"></a>
5+
6+
Language
7+
--------
8+
9+
- [Stabilize `async fn` and return-position `impl Trait` in traits.](https://github.com/rust-lang/rust/pull/115822/)
10+
- [Allow function pointer signatures containing `&mut T` in `const` contexts.](https://github.com/rust-lang/rust/pull/116015/)
11+
- [Match `usize`/`isize` exhaustively with half-open ranges.](https://github.com/rust-lang/rust/pull/116692/)
12+
- [Guarantee that `char` has the same size and alignment as `u32`.](https://github.com/rust-lang/rust/pull/116894/)
13+
- [Document that the null pointer has the 0 address.](https://github.com/rust-lang/rust/pull/116988/)
14+
- [Allow partially moved values in `match`.](https://github.com/rust-lang/rust/pull/103208/)
15+
- [Add notes about non-compliant FP behavior on 32bit x86 targets.](https://github.com/rust-lang/rust/pull/113053/)
16+
- [Stabilize ratified RISC-V target features.](https://github.com/rust-lang/rust/pull/116485/)
17+
18+
<a id="1.75.0-Compiler"></a>
19+
20+
Compiler
21+
--------
22+
23+
- [Rework negative coherence to properly consider impls that only partly overlap.](https://github.com/rust-lang/rust/pull/112875/)
24+
- [Bump `COINDUCTIVE_OVERLAP_IN_COHERENCE` to deny, and warn in dependencies.](https://github.com/rust-lang/rust/pull/116493/)
25+
- [Consider alias bounds when computing liveness in NLL.](https://github.com/rust-lang/rust/pull/116733/)
26+
- [Add the V (vector) extension to the `riscv64-linux-android` target spec.](https://github.com/rust-lang/rust/pull/116618/)
27+
- [Automatically enable cross-crate inlining for small functions](https://github.com/rust-lang/rust/pull/116505)
28+
- Add several new tier 3 targets:
29+
- [`csky-unknown-linux-gnuabiv2hf`](https://github.com/rust-lang/rust/pull/117049/)
30+
- [`i586-unknown-netbsd`](https://github.com/rust-lang/rust/pull/117170/)
31+
- [`mipsel-unknown-netbsd`](https://github.com/rust-lang/rust/pull/117356/)
32+
33+
Refer to Rust's [platform support page][platform-support-doc]
34+
for more information on Rust's tiered platform support.
35+
36+
<a id="1.75.0-Libraries"></a>
37+
38+
Libraries
39+
---------
40+
41+
- [Override `Waker::clone_from` to avoid cloning `Waker`s unnecessarily.](https://github.com/rust-lang/rust/pull/96979/)
42+
- [Implement `BufRead` for `VecDeque<u8>`.](https://github.com/rust-lang/rust/pull/110604/)
43+
- [Implement `FusedIterator` for `DecodeUtf16` when the inner iterator does.](https://github.com/rust-lang/rust/pull/110729/)
44+
- [Implement `Not, Bit{And,Or}{,Assign}` for IP addresses.](https://github.com/rust-lang/rust/pull/113747/)
45+
- [Implement `Default` for `ExitCode`.](https://github.com/rust-lang/rust/pull/114589/)
46+
- [Guarantee representation of None in NPO](https://github.com/rust-lang/rust/pull/115333/)
47+
- [Document when atomic loads are guaranteed read-only.](https://github.com/rust-lang/rust/pull/115577/)
48+
- [Broaden the consequences of recursive TLS initialization.](https://github.com/rust-lang/rust/pull/116172/)
49+
- [Windows: Support sub-millisecond sleep.](https://github.com/rust-lang/rust/pull/116461/)
50+
- [Fix generic bound of `str::SplitInclusive`'s `DoubleEndedIterator` impl](https://github.com/rust-lang/rust/pull/100806/)
51+
- [Fix exit status / wait status on non-Unix `cfg(unix)` platforms.](https://github.com/rust-lang/rust/pull/115108/)
52+
53+
<a id="1.75.0-Stabilized-APIs"></a>
54+
55+
Stabilized APIs
56+
---------------
57+
58+
- [`Atomic*::from_ptr`](https://doc.rust-lang.org/stable/core/sync/atomic/struct.AtomicUsize.html#method.from_ptr)
59+
- [`FileTimes`](https://doc.rust-lang.org/stable/std/fs/struct.FileTimes.html)
60+
- [`FileTimesExt`](https://doc.rust-lang.org/stable/std/os/windows/fs/trait.FileTimesExt.html)
61+
- [`File::set_modified`](https://doc.rust-lang.org/stable/std/fs/struct.File.html#method.set_modified)
62+
- [`File::set_times`](https://doc.rust-lang.org/stable/std/fs/struct.File.html#method.set_times)
63+
- [`IpAddr::to_canonical`](https://doc.rust-lang.org/stable/core/net/enum.IpAddr.html#method.to_canonical)
64+
- [`Ipv6Addr::to_canonical`](https://doc.rust-lang.org/stable/core/net/struct.Ipv6Addr.html#method.to_canonical)
65+
- [`Option::as_slice`](https://doc.rust-lang.org/stable/core/option/enum.Option.html#method.as_slice)
66+
- [`Option::as_mut_slice`](https://doc.rust-lang.org/stable/core/option/enum.Option.html#method.as_mut_slice)
67+
- [`pointer::byte_add`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.byte_add)
68+
- [`pointer::byte_offset`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.byte_offset)
69+
- [`pointer::byte_offset_from`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.byte_offset_from)
70+
- [`pointer::byte_sub`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.byte_sub)
71+
- [`pointer::wrapping_byte_add`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.wrapping_byte_add)
72+
- [`pointer::wrapping_byte_offset`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.wrapping_byte_offset)
73+
- [`pointer::wrapping_byte_sub`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.wrapping_byte_sub)
74+
75+
These APIs are now stable in const contexts:
76+
77+
- [`Ipv6Addr::to_ipv4_mapped`](https://doc.rust-lang.org/stable/core/net/struct.Ipv6Addr.html#method.to_ipv4_mapped)
78+
- [`MaybeUninit::assume_init_read`](https://doc.rust-lang.org/stable/core/mem/union.MaybeUninit.html#method.assume_init_read)
79+
- [`MaybeUninit::zeroed`](https://doc.rust-lang.org/stable/core/mem/union.MaybeUninit.html#method.zeroed)
80+
- [`mem::discriminant`](https://doc.rust-lang.org/stable/core/mem/fn.discriminant.html)
81+
- [`mem::zeroed`](https://doc.rust-lang.org/stable/core/mem/fn.zeroed.html)
82+
83+
<a id="1.75.0-Cargo"></a>
84+
85+
Cargo
86+
-----
87+
88+
- [Add new packages to `[workspace.members]` automatically.](https://github.com/rust-lang/cargo/pull/12779/)
89+
- [Allow version-less `Cargo.toml` manifests.](https://github.com/rust-lang/cargo/pull/12786/)
90+
- [Make browser links out of HTML file paths.](https://github.com/rust-lang/cargo/pull/12889)
91+
92+
<a id="1.75.0-Rustdoc"></a>
93+
94+
Rustdoc
95+
-------
96+
97+
- [Accept less invalid Rust in rustdoc.](https://github.com/rust-lang/rust/pull/117450/)
98+
- [Document lack of object safety on affected traits.](https://github.com/rust-lang/rust/pull/113241/)
99+
- [Hide `#[repr(transparent)]` if it isn't part of the public ABI.](https://github.com/rust-lang/rust/pull/115439/)
100+
- [Show enum discriminant if it is a C-like variant.](https://github.com/rust-lang/rust/pull/116142/)
101+
102+
<a id="1.75.0-Compatibility-Notes"></a>
103+
104+
Compatibility Notes
105+
-------------------
106+
107+
- [FreeBSD targets now require at least version 12.](https://github.com/rust-lang/rust/pull/114521/)
108+
- [Formally demote tier 2 MIPS targets to tier 3.](https://github.com/rust-lang/rust/pull/115238/)
109+
- [Make misalignment a hard error in `const` contexts.](https://github.com/rust-lang/rust/pull/115524/)
110+
- [Fix detecting references to packed unsized fields.](https://github.com/rust-lang/rust/pull/115583/)
111+
- [Remove support for compiler plugins.](https://github.com/rust-lang/rust/pull/116412/)
112+
113+
<a id="1.75.0-Internal-Changes"></a>
114+
115+
Internal Changes
116+
----------------
117+
118+
These changes do not affect any public interfaces of Rust, but they represent
119+
significant improvements to the performance or internals of rustc and related
120+
tools.
121+
122+
- [Optimize `librustc_driver.so` with BOLT.](https://github.com/rust-lang/rust/pull/116352/)
123+
- [Enable parallel rustc front end in dev and nightly builds.](https://github.com/rust-lang/rust/pull/117435/)
124+
- [Distribute `rustc-codegen-cranelift` as rustup component on the nightly channel.](https://github.com/rust-lang/rust/pull/81746/)
125+
1126
Version 1.74.1 (2023-12-07)
2127
===========================
3128

compiler/rustc_ast/src/ast.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2788,7 +2788,11 @@ pub enum VariantData {
27882788
/// Struct variant.
27892789
///
27902790
/// E.g., `Bar { .. }` as in `enum Foo { Bar { .. } }`.
2791-
Struct(ThinVec<FieldDef>, bool),
2791+
Struct {
2792+
fields: ThinVec<FieldDef>,
2793+
// FIXME: investigate making this a `Option<ErrorGuaranteed>`
2794+
recovered: bool,
2795+
},
27922796
/// Tuple variant.
27932797
///
27942798
/// E.g., `Bar(..)` as in `enum Foo { Bar(..) }`.
@@ -2803,15 +2807,15 @@ impl VariantData {
28032807
/// Return the fields of this variant.
28042808
pub fn fields(&self) -> &[FieldDef] {
28052809
match self {
2806-
VariantData::Struct(fields, ..) | VariantData::Tuple(fields, _) => fields,
2810+
VariantData::Struct { fields, .. } | VariantData::Tuple(fields, _) => fields,
28072811
_ => &[],
28082812
}
28092813
}
28102814

28112815
/// Return the `NodeId` of this variant's constructor, if it has one.
28122816
pub fn ctor_node_id(&self) -> Option<NodeId> {
28132817
match *self {
2814-
VariantData::Struct(..) => None,
2818+
VariantData::Struct { .. } => None,
28152819
VariantData::Tuple(_, id) | VariantData::Unit(id) => Some(id),
28162820
}
28172821
}

compiler/rustc_ast/src/mut_visit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -976,7 +976,7 @@ pub fn noop_visit_where_predicate<T: MutVisitor>(pred: &mut WherePredicate, vis:
976976

977977
pub fn noop_visit_variant_data<T: MutVisitor>(vdata: &mut VariantData, vis: &mut T) {
978978
match vdata {
979-
VariantData::Struct(fields, ..) => {
979+
VariantData::Struct { fields, .. } => {
980980
fields.flat_map_in_place(|field| vis.flat_map_field_def(field));
981981
}
982982
VariantData::Tuple(fields, id) => {

compiler/rustc_ast_lowering/src/index.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
use rustc_data_structures::fx::FxHashMap;
21
use rustc_data_structures::sorted_map::SortedMap;
32
use rustc_hir as hir;
4-
use rustc_hir::def_id::LocalDefId;
3+
use rustc_hir::def_id::{LocalDefId, LocalDefIdMap};
54
use rustc_hir::intravisit::Visitor;
65
use rustc_hir::*;
76
use rustc_index::{Idx, IndexVec};
@@ -17,7 +16,7 @@ struct NodeCollector<'a, 'hir> {
1716

1817
/// Outputs
1918
nodes: IndexVec<ItemLocalId, Option<ParentedNode<'hir>>>,
20-
parenting: FxHashMap<LocalDefId, ItemLocalId>,
19+
parenting: LocalDefIdMap<ItemLocalId>,
2120

2221
/// The parent of this node
2322
parent_node: hir::ItemLocalId,
@@ -30,7 +29,7 @@ pub(super) fn index_hir<'hir>(
3029
tcx: TyCtxt<'hir>,
3130
item: hir::OwnerNode<'hir>,
3231
bodies: &SortedMap<ItemLocalId, &'hir Body<'hir>>,
33-
) -> (IndexVec<ItemLocalId, Option<ParentedNode<'hir>>>, FxHashMap<LocalDefId, ItemLocalId>) {
32+
) -> (IndexVec<ItemLocalId, Option<ParentedNode<'hir>>>, LocalDefIdMap<ItemLocalId>) {
3433
let mut nodes = IndexVec::new();
3534
// This node's parent should never be accessed: the owner's parent is computed by the
3635
// hir_owner_parent query. Make it invalid (= ItemLocalId::MAX) to force an ICE whenever it is
@@ -42,7 +41,7 @@ pub(super) fn index_hir<'hir>(
4241
parent_node: ItemLocalId::new(0),
4342
nodes,
4443
bodies,
45-
parenting: FxHashMap::default(),
44+
parenting: Default::default(),
4645
};
4746

4847
match item {

compiler/rustc_ast_lowering/src/item.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -661,11 +661,12 @@ impl<'hir> LoweringContext<'_, 'hir> {
661661
vdata: &VariantData,
662662
) -> hir::VariantData<'hir> {
663663
match vdata {
664-
VariantData::Struct(fields, recovered) => hir::VariantData::Struct(
665-
self.arena
664+
VariantData::Struct { fields, recovered } => hir::VariantData::Struct {
665+
fields: self
666+
.arena
666667
.alloc_from_iter(fields.iter().enumerate().map(|f| self.lower_field_def(f))),
667-
*recovered,
668-
),
668+
recovered: *recovered,
669+
},
669670
VariantData::Tuple(fields, id) => {
670671
let ctor_id = self.lower_node_id(*id);
671672
self.alias_attrs(ctor_id, parent_id);

compiler/rustc_ast_lowering/src/lib.rs

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -44,23 +44,23 @@ extern crate tracing;
4444

4545
use crate::errors::{AssocTyParentheses, AssocTyParenthesesSub, MisplacedImplTrait};
4646

47+
use rustc_ast::node_id::NodeMap;
4748
use rustc_ast::ptr::P;
4849
use rustc_ast::{self as ast, *};
4950
use rustc_ast_pretty::pprust;
5051
use rustc_data_structures::captures::Captures;
5152
use rustc_data_structures::fingerprint::Fingerprint;
52-
use rustc_data_structures::fx::FxHashMap;
5353
use rustc_data_structures::sorted_map::SortedMap;
5454
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
5555
use rustc_data_structures::sync::Lrc;
5656
use rustc_errors::{DiagnosticArgFromDisplay, StashKey};
5757
use rustc_hir as hir;
5858
use rustc_hir::def::{DefKind, LifetimeRes, Namespace, PartialRes, PerNS, Res};
59-
use rustc_hir::def_id::{LocalDefId, CRATE_DEF_ID, LOCAL_CRATE};
60-
use rustc_hir::{ConstArg, GenericArg, ItemLocalId, ParamName, TraitCandidate};
59+
use rustc_hir::def_id::{LocalDefId, LocalDefIdMap, CRATE_DEF_ID, LOCAL_CRATE};
60+
use rustc_hir::{ConstArg, GenericArg, ItemLocalMap, ParamName, TraitCandidate};
6161
use rustc_index::{Idx, IndexSlice, IndexVec};
6262
use rustc_middle::span_bug;
63-
use rustc_middle::ty::{ResolverAstLowering, TyCtxt, Visibility};
63+
use rustc_middle::ty::{ResolverAstLowering, TyCtxt};
6464
use rustc_session::parse::{add_feature_diagnostics, feature_err};
6565
use rustc_span::symbol::{kw, sym, Ident, Symbol};
6666
use rustc_span::{DesugaringKind, Span, DUMMY_SP};
@@ -119,13 +119,13 @@ struct LoweringContext<'a, 'hir> {
119119

120120
current_hir_id_owner: hir::OwnerId,
121121
item_local_id_counter: hir::ItemLocalId,
122-
trait_map: FxHashMap<ItemLocalId, Box<[TraitCandidate]>>,
122+
trait_map: ItemLocalMap<Box<[TraitCandidate]>>,
123123

124124
impl_trait_defs: Vec<hir::GenericParam<'hir>>,
125125
impl_trait_bounds: Vec<hir::WherePredicate<'hir>>,
126126

127127
/// NodeIds that are lowered inside the current HIR owner.
128-
node_id_to_local_id: FxHashMap<NodeId, hir::ItemLocalId>,
128+
node_id_to_local_id: NodeMap<hir::ItemLocalId>,
129129

130130
allow_try_trait: Lrc<[Symbol]>,
131131
allow_gen_future: Lrc<[Symbol]>,
@@ -135,7 +135,7 @@ struct LoweringContext<'a, 'hir> {
135135
/// For each captured lifetime (e.g., 'a), we create a new lifetime parameter that is a generic
136136
/// defined on the TAIT, so we have type Foo<'a1> = ... and we establish a mapping in this
137137
/// field from the original parameter 'a to the new parameter 'a1.
138-
generics_def_id_map: Vec<FxHashMap<LocalDefId, LocalDefId>>,
138+
generics_def_id_map: Vec<LocalDefIdMap<LocalDefId>>,
139139

140140
host_param_id: Option<LocalDefId>,
141141
}
@@ -380,7 +380,7 @@ enum AstOwner<'a> {
380380
}
381381

382382
fn index_crate<'a>(
383-
node_id_to_def_id: &FxHashMap<NodeId, LocalDefId>,
383+
node_id_to_def_id: &NodeMap<LocalDefId>,
384384
krate: &'a Crate,
385385
) -> IndexVec<LocalDefId, AstOwner<'a>> {
386386
let mut indexer = Indexer { node_id_to_def_id, index: IndexVec::new() };
@@ -390,7 +390,7 @@ fn index_crate<'a>(
390390
return indexer.index;
391391

392392
struct Indexer<'s, 'a> {
393-
node_id_to_def_id: &'s FxHashMap<NodeId, LocalDefId>,
393+
node_id_to_def_id: &'s NodeMap<LocalDefId>,
394394
index: IndexVec<LocalDefId, AstOwner<'a>>,
395395
}
396396

@@ -642,7 +642,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
642642
/// `'a` declared on the TAIT, instead of the function.
643643
fn with_remapping<R>(
644644
&mut self,
645-
remap: FxHashMap<LocalDefId, LocalDefId>,
645+
remap: LocalDefIdMap<LocalDefId>,
646646
f: impl FnOnce(&mut Self) -> R,
647647
) -> R {
648648
self.generics_def_id_map.push(remap);
@@ -1651,13 +1651,9 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
16511651
);
16521652
debug!(?opaque_ty_def_id);
16531653

1654-
// Meaningless, but provided so that all items have visibilities.
1655-
let parent_mod = self.tcx.parent_module_from_def_id(opaque_ty_def_id).to_def_id();
1656-
self.tcx.feed_local_def_id(opaque_ty_def_id).visibility(Visibility::Restricted(parent_mod));
1657-
16581654
// Map from captured (old) lifetime to synthetic (new) lifetime.
16591655
// Used to resolve lifetimes in the bounds of the opaque.
1660-
let mut captured_to_synthesized_mapping = FxHashMap::default();
1656+
let mut captured_to_synthesized_mapping = LocalDefIdMap::default();
16611657
// List of (early-bound) synthetic lifetimes that are owned by the opaque.
16621658
// This is used to create the `hir::Generics` owned by the opaque.
16631659
let mut synthesized_lifetime_definitions = vec![];

compiler/rustc_ast_passes/messages.ftl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,13 @@ ast_passes_fn_without_body =
117117
free function without a body
118118
.suggestion = provide a definition for the function
119119
120+
ast_passes_forbidden_bound =
121+
bounds cannot be used in this context
122+
120123
ast_passes_forbidden_default =
121124
`default` is only allowed on items in trait impls
122125
.label = `default` because of this
123126
124-
ast_passes_forbidden_lifetime_bound =
125-
lifetime bounds cannot be used in this context
126-
127127
ast_passes_forbidden_non_lifetime_param =
128128
only lifetime parameters can be used in this context
129129

compiler/rustc_ast_passes/src/ast_validation.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,7 +1000,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
10001000
}
10011001
}
10021002
ItemKind::Struct(vdata, generics) => match vdata {
1003-
VariantData::Struct(fields, ..) => {
1003+
VariantData::Struct { fields, .. } => {
10041004
self.visit_vis(&item.vis);
10051005
self.visit_ident(item.ident);
10061006
self.visit_generics(generics);
@@ -1016,7 +1016,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
10161016
self.dcx().emit_err(errors::FieldlessUnion { span: item.span });
10171017
}
10181018
match vdata {
1019-
VariantData::Struct(fields, ..) => {
1019+
VariantData::Struct { fields, .. } => {
10201020
self.visit_vis(&item.vis);
10211021
self.visit_ident(item.ident);
10221022
self.visit_generics(generics);

compiler/rustc_ast_passes/src/errors.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ pub struct TraitFnConst {
5252
}
5353

5454
#[derive(Diagnostic)]
55-
#[diag(ast_passes_forbidden_lifetime_bound)]
56-
pub struct ForbiddenLifetimeBound {
55+
#[diag(ast_passes_forbidden_bound)]
56+
pub struct ForbiddenBound {
5757
#[primary_span]
5858
pub spans: Vec<Span>,
5959
}

0 commit comments

Comments
 (0)