Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 1f94abc

Browse files
committed
Auto merge of rust-lang#87808 - JohnTitor:rollup-qqp79xs, r=JohnTitor
Rollup of 9 pull requests Successful merges: - rust-lang#87561 (thread set_name haiku implementation.) - rust-lang#87715 (Add long error explanation for E0625) - rust-lang#87727 (explicit_generic_args_with_impl_trait: fix min expected number of generics) - rust-lang#87742 (Validate FFI-safety warnings on naked functions) - rust-lang#87756 (Add back -Zno-profiler-runtime) - rust-lang#87759 (Re-use std::sealed::Sealed in os/linux/process.) - rust-lang#87760 (Promote `aarch64-apple-ios-sim` to Tier 2) - rust-lang#87770 (permit drop impls with generic constants in where clauses) - rust-lang#87780 (alloc: Use intra doc links for the reserve function) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 7129033 + b98c388 commit 1f94abc

File tree

26 files changed

+179
-46
lines changed

26 files changed

+179
-46
lines changed

compiler/rustc_error_codes/src/error_codes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,7 @@ E0621: include_str!("./error_codes/E0621.md"),
359359
E0622: include_str!("./error_codes/E0622.md"),
360360
E0623: include_str!("./error_codes/E0623.md"),
361361
E0624: include_str!("./error_codes/E0624.md"),
362+
E0625: include_str!("./error_codes/E0625.md"),
362363
E0626: include_str!("./error_codes/E0626.md"),
363364
E0627: include_str!("./error_codes/E0627.md"),
364365
E0628: include_str!("./error_codes/E0628.md"),
@@ -622,7 +623,6 @@ E0783: include_str!("./error_codes/E0783.md"),
622623
// E0611, // merged into E0616
623624
// E0612, // merged into E0609
624625
// E0613, // Removed (merged with E0609)
625-
E0625, // thread-local statics cannot be accessed at compile-time
626626
// E0629, // missing 'feature' (rustc_const_unstable)
627627
// E0630, // rustc_const_unstable attribute must be paired with stable/unstable
628628
// attribute
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
A compile-time const variable is referring to a thread-local static variable.
2+
3+
Erroneous code example:
4+
5+
```compile_fail,E0625
6+
#![feature(thread_local)]
7+
8+
#[thread_local]
9+
static X: usize = 12;
10+
11+
const Y: usize = 2 * X;
12+
```
13+
14+
Static and const variables can refer to other const variables but a const
15+
variable cannot refer to a thread-local static variable. In this example,
16+
`Y` cannot refer to `X`. To fix this, the value can be extracted as a const
17+
and then used:
18+
19+
```
20+
#![feature(thread_local)]
21+
22+
const C: usize = 12;
23+
24+
#[thread_local]
25+
static X: usize = C;
26+
27+
const Y: usize = 2 * C;
28+
```

compiler/rustc_interface/src/tests.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -740,6 +740,7 @@ fn test_debugging_options_tracking_hash() {
740740
tracked!(new_llvm_pass_manager, Some(true));
741741
tracked!(no_generate_arange_section, true);
742742
tracked!(no_link, true);
743+
tracked!(no_profiler_runtime, true);
743744
tracked!(osx_rpath_install_name, true);
744745
tracked!(panic_abort_tests, true);
745746
tracked!(plt, Some(true));
@@ -748,7 +749,7 @@ fn test_debugging_options_tracking_hash() {
748749
tracked!(print_fuel, Some("abc".to_string()));
749750
tracked!(profile, true);
750751
tracked!(profile_emit, Some(PathBuf::from("abc")));
751-
tracked!(profiler_runtime, None);
752+
tracked!(profiler_runtime, "abc".to_string());
752753
tracked!(relax_elf_relocations, Some(true));
753754
tracked!(relro_level, Some(RelroLevel::Full));
754755
tracked!(simulate_remapped_rust_src_base, Some(PathBuf::from("/rustc/abc")));

compiler/rustc_metadata/src/creader.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -777,19 +777,17 @@ impl<'a> CrateLoader<'a> {
777777
}
778778

779779
fn inject_profiler_runtime(&mut self, krate: &ast::Crate) {
780-
let profiler_runtime = &self.sess.opts.debugging_opts.profiler_runtime;
781-
782-
if !(profiler_runtime.is_some()
783-
&& (self.sess.instrument_coverage()
780+
if self.sess.opts.debugging_opts.no_profiler_runtime
781+
|| !(self.sess.instrument_coverage()
784782
|| self.sess.opts.debugging_opts.profile
785-
|| self.sess.opts.cg.profile_generate.enabled()))
783+
|| self.sess.opts.cg.profile_generate.enabled())
786784
{
787785
return;
788786
}
789787

790788
info!("loading profiler");
791789

792-
let name = Symbol::intern(profiler_runtime.as_ref().unwrap());
790+
let name = Symbol::intern(&self.sess.opts.debugging_opts.profiler_runtime);
793791
if name == sym::profiler_builtins && self.sess.contains_name(&krate.attrs, sym::no_core) {
794792
self.sess.err(
795793
"`profiler_builtins` crate (required by compiler options) \

compiler/rustc_metadata/src/locator.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1103,8 +1103,8 @@ impl CrateError {
11031103
if sess.is_nightly_build() {
11041104
err.help("consider building the standard library from source with `cargo build -Zbuild-std`");
11051105
}
1106-
} else if Some(crate_name)
1107-
== sess.opts.debugging_opts.profiler_runtime.as_deref().map(Symbol::intern)
1106+
} else if crate_name
1107+
== Symbol::intern(&sess.opts.debugging_opts.profiler_runtime)
11081108
{
11091109
err.note(&"the compiler may have been built without the profiler runtime");
11101110
}

compiler/rustc_session/src/options.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1172,6 +1172,8 @@ options! {
11721172
"compile without linking"),
11731173
no_parallel_llvm: bool = (false, parse_no_flag, [UNTRACKED],
11741174
"run LLVM in non-parallel mode (while keeping codegen-units and ThinLTO)"),
1175+
no_profiler_runtime: bool = (false, parse_no_flag, [TRACKED],
1176+
"prevent automatic injection of the profiler_builtins crate"),
11751177
normalize_docs: bool = (false, parse_bool, [TRACKED],
11761178
"normalize associated items in rustdoc when generating documentation"),
11771179
osx_rpath_install_name: bool = (false, parse_bool, [TRACKED],
@@ -1217,8 +1219,8 @@ options! {
12171219
profile_emit: Option<PathBuf> = (None, parse_opt_pathbuf, [TRACKED],
12181220
"file path to emit profiling data at runtime when using 'profile' \
12191221
(default based on relative source path)"),
1220-
profiler_runtime: Option<String> = (Some(String::from("profiler_builtins")), parse_opt_string, [TRACKED],
1221-
"name of the profiler runtime crate to automatically inject, or None to disable"),
1222+
profiler_runtime: String = (String::from("profiler_builtins"), parse_string, [TRACKED],
1223+
"name of the profiler runtime crate to automatically inject (default: `profiler_builtins`)"),
12221224
query_dep_graph: bool = (false, parse_bool, [UNTRACKED],
12231225
"enable queries of the dependency graph for regression testing (default: no)"),
12241226
query_stats: bool = (false, parse_bool, [UNTRACKED],

compiler/rustc_typeck/src/astconv/generics.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,6 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
613613
param_counts.consts + named_type_param_count
614614
- default_counts.types
615615
- default_counts.consts
616-
- synth_type_param_count
617616
};
618617
debug!("expected_min: {:?}", expected_min);
619618
debug!("arg_counts.lifetimes: {:?}", gen_args.num_lifetime_params());

compiler/rustc_typeck/src/check/dropck.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,9 @@ fn ensure_drop_predicates_are_implied_by_item_defn<'tcx>(
218218

219219
// This closure is a more robust way to check `Predicate` equality
220220
// than simple `==` checks (which were the previous implementation).
221-
// It relies on `ty::relate` for `TraitPredicate` and `ProjectionPredicate`
222-
// (which implement the Relate trait), while delegating on simple equality
223-
// for the other `Predicate`.
221+
// It relies on `ty::relate` for `TraitPredicate`, `ProjectionPredicate`,
222+
// `ConstEvaluatable` and `TypeOutlives` (which implement the Relate trait),
223+
// while delegating on simple equality for the other `Predicate`.
224224
// This implementation solves (Issue #59497) and (Issue #58311).
225225
// It is unclear to me at the moment whether the approach based on `relate`
226226
// could be extended easily also to the other `Predicate`.
@@ -235,6 +235,13 @@ fn ensure_drop_predicates_are_implied_by_item_defn<'tcx>(
235235
(ty::PredicateKind::Projection(a), ty::PredicateKind::Projection(b)) => {
236236
relator.relate(predicate.rebind(a), p.rebind(b)).is_ok()
237237
}
238+
(
239+
ty::PredicateKind::ConstEvaluatable(def_a, substs_a),
240+
ty::PredicateKind::ConstEvaluatable(def_b, substs_b),
241+
) => tcx.try_unify_abstract_consts(((def_a, substs_a), (def_b, substs_b))),
242+
(ty::PredicateKind::TypeOutlives(a), ty::PredicateKind::TypeOutlives(b)) => {
243+
relator.relate(predicate.rebind(a.0), p.rebind(b.0)).is_ok()
244+
}
238245
_ => predicate == p,
239246
}
240247
};

library/alloc/src/collections/vec_deque/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,9 @@ impl<T, A: Allocator> VecDeque<T, A> {
697697
///
698698
/// Note that the allocator may give the collection more space than it
699699
/// requests. Therefore, capacity can not be relied upon to be precisely
700-
/// minimal. Prefer `reserve` if future insertions are expected.
700+
/// minimal. Prefer [`reserve`] if future insertions are expected.
701+
///
702+
/// [`reserve`]: VecDeque::reserve
701703
///
702704
/// # Errors
703705
///

library/alloc/src/string.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1035,7 +1035,9 @@ impl String {
10351035
///
10361036
/// Note that the allocator may give the collection more space than it
10371037
/// requests. Therefore, capacity can not be relied upon to be precisely
1038-
/// minimal. Prefer `reserve` if future insertions are expected.
1038+
/// minimal. Prefer [`reserve`] if future insertions are expected.
1039+
///
1040+
/// [`reserve`]: String::reserve
10391041
///
10401042
/// # Errors
10411043
///

0 commit comments

Comments
 (0)