Skip to content

Commit f419a33

Browse files
borscompiler-errors
authored andcommitted
Auto merge of rust-lang#136094 - davidv1992:upgrade-elsa, r=oli-obk
Upgrade elsa to the newest version. This was locked to 1.7.1 because of an error in the elsa release process that has since been fixed. Upgrading has the advantage that the elsa code runs properly in miri, at least with tree borrows. This was spawned from rust-lang#135870 (comment)
2 parents 07179d5 + 1b8a792 commit f419a33

File tree

4 files changed

+35
-19
lines changed

4 files changed

+35
-19
lines changed

Diff for: Cargo.lock

+2-2
Original file line numberDiff line numberDiff line change
@@ -1098,9 +1098,9 @@ dependencies = [
10981098

10991099
[[package]]
11001100
name = "elsa"
1101-
version = "1.7.1"
1101+
version = "1.11.0"
11021102
source = "registry+https://github.com/rust-lang/crates.io-index"
1103-
checksum = "848fe615fbb0a74d9ae68dcaa510106d32e37d9416207bbea4bd008bd89c47ed"
1103+
checksum = "2343daaeabe09879d4ea058bb4f1e63da3fc07dadc6634e01bda1b3d6a9d9d2b"
11041104
dependencies = [
11051105
"stable_deref_trait",
11061106
]

Diff for: compiler/rustc_data_structures/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ edition = "2021"
88
arrayvec = { version = "0.7", default-features = false }
99
bitflags = "2.4.1"
1010
either = "1.0"
11-
elsa = "=1.7.1"
11+
elsa = "1.11.0"
1212
ena = "0.14.3"
1313
indexmap = "2.4.0"
1414
jobserver_crate = { version = "0.1.28", package = "jobserver" }

Diff for: compiler/rustc_passes/src/stability.rs

+19-16
Original file line numberDiff line numberDiff line change
@@ -300,11 +300,24 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> {
300300
// const stability: inherit feature gate from regular stability.
301301
let mut const_stab = const_stab.map(|(stab, _span)| stab);
302302

303+
// `impl const Trait for Type` items forward their const stability to their
304+
// immediate children.
305+
// FIXME(const_trait_impl): how is this supposed to interact with `#[rustc_const_stable_indirect]`?
306+
// Currently, once that is set, we do not inherit anything from the parent any more.
307+
if const_stab.is_none()
308+
&& let Some(parent) = self.parent_const_stab
309+
&& parent.is_const_unstable()
310+
{
311+
// For now, `const fn` in const traits/trait impls does not exist.
312+
assert!(fn_sig.is_none_or(|s| !s.header.is_const()), "should never have parent const stability for a const fn");
313+
self.index.const_stab_map.insert(def_id, parent);
314+
}
315+
303316
// If this is a const fn but not annotated with stability markers, see if we can inherit regular stability.
304-
if fn_sig.is_some_and(|s| s.header.is_const()) && const_stab.is_none() &&
317+
if fn_sig.is_some_and(|s| s.header.is_const())
318+
&& const_stab.is_none()
305319
// We only ever inherit unstable features.
306-
let Some(inherit_regular_stab) =
307-
final_stab.filter(|s| s.is_unstable())
320+
&& let Some(inherit_regular_stab) = final_stab.filter(|s| s.is_unstable())
308321
{
309322
const_stab = Some(ConstStability {
310323
// We subject these implicitly-const functions to recursive const stability.
@@ -329,19 +342,6 @@ impl<'a, 'tcx> Annotator<'a, 'tcx> {
329342
self.index.implications.insert(implied_by, feature);
330343
}
331344

332-
// `impl const Trait for Type` items forward their const stability to their
333-
// immediate children.
334-
// FIXME(const_trait_impl): how is this supposed to interact with `#[rustc_const_stable_indirect]`?
335-
// Currently, once that is set, we do not inherit anything from the parent any more.
336-
if const_stab.is_none() {
337-
debug!("annotate: const_stab not found, parent = {:?}", self.parent_const_stab);
338-
if let Some(parent) = self.parent_const_stab {
339-
if parent.is_const_unstable() {
340-
self.index.const_stab_map.insert(def_id, parent);
341-
}
342-
}
343-
}
344-
345345
self.recurse_with_stability_attrs(
346346
depr.map(|(d, _)| DeprecationEntry::local(d, def_id)),
347347
stab,
@@ -418,6 +418,9 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> {
418418
kind = AnnotationKind::DeprecationProhibited;
419419
const_stab_inherit = InheritConstStability::Yes;
420420
}
421+
hir::ItemKind::Trait(..) => {
422+
const_stab_inherit = InheritConstStability::Yes;
423+
}
421424
hir::ItemKind::Struct(ref sd, _) => {
422425
if let Some(ctor_def_id) = sd.ctor_def_id() {
423426
self.annotate(

Diff for: tests/ui/traits/const-traits/auxiliary/staged-api.rs

+13
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@
99
pub trait MyTrait {
1010
#[stable(feature = "rust1", since = "1.0.0")]
1111
fn func();
12+
13+
#[stable(feature = "rust1", since = "1.0.0")]
14+
fn default<T: ~const MyTrait>() {
15+
// This call is const-unstable, but permitted here since we inherit
16+
// the `rustc_const_unstable` above.
17+
T::func();
18+
}
1219
}
1320

1421
#[stable(feature = "rust1", since = "1.0.0")]
@@ -18,6 +25,12 @@ pub struct Unstable;
1825
#[rustc_const_unstable(feature = "unstable", issue = "none")]
1926
impl const MyTrait for Unstable {
2027
fn func() {}
28+
29+
fn default<T: ~const MyTrait>() {
30+
// This call is const-unstable, but permitted here since we inherit
31+
// the `rustc_const_unstable` above.
32+
T::func();
33+
}
2134
}
2235

2336
#[stable(feature = "rust1", since = "1.0.0")]

0 commit comments

Comments
 (0)