Skip to content

Commit f29921f

Browse files
committed
Auto merge of #147316 - Zalathar:rollup-ehwa64f, r=Zalathar
Rollup of 14 pull requests Successful merges: - #142670 (Document fully-qualified syntax in `as`' keyword doc) - #144908 (Fix doctest output json) - #145685 (add CloneFromCell and Cell::get_cloned) - #146330 (Bump unicode_data and printables to version 17.0.0) - #146451 (Fix atan2 inaccuracy in documentation) - #146479 (add mem::conjure_zst) - #147190 (std: `sys::net` cleanups) - #147245 (only replace the intended comma in pattern suggestions) - #147251 (Do not assert that a change in global cache only happens when concurrent) - #147269 (Add regression test for 123953) - #147277 (Extract common logic for iterating over features) - #147280 (Return to needs-llvm-components being info-only) - #147292 (Respect `-Z` unstable options in `rustdoc --test`) - #147300 (Add xtensa arch to object file creation) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 7950f24 + f2b68c7 commit f29921f

File tree

72 files changed

+1537
-905
lines changed

Some content is hidden

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

72 files changed

+1537
-905
lines changed

compiler/rustc_ast_passes/src/feature_gate.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -622,11 +622,7 @@ fn maybe_stage_features(sess: &Session, features: &Features, krate: &ast::Crate)
622622
}
623623

624624
fn check_incompatible_features(sess: &Session, features: &Features) {
625-
let enabled_lang_features =
626-
features.enabled_lang_features().iter().map(|feat| (feat.gate_name, feat.attr_sp));
627-
let enabled_lib_features =
628-
features.enabled_lib_features().iter().map(|feat| (feat.gate_name, feat.attr_sp));
629-
let enabled_features = enabled_lang_features.chain(enabled_lib_features);
625+
let enabled_features = features.enabled_features_iter_stable_order();
630626

631627
for (f1, f2) in rustc_feature::INCOMPATIBLE_FEATURES
632628
.iter()

compiler/rustc_feature/src/unstable.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,16 @@ impl Features {
9393
&self.enabled_features
9494
}
9595

96+
/// Returns a iterator of enabled features in stable order.
97+
pub fn enabled_features_iter_stable_order(
98+
&self,
99+
) -> impl Iterator<Item = (Symbol, Span)> + Clone {
100+
self.enabled_lang_features
101+
.iter()
102+
.map(|feat| (feat.gate_name, feat.attr_sp))
103+
.chain(self.enabled_lib_features.iter().map(|feat| (feat.gate_name, feat.attr_sp)))
104+
}
105+
96106
/// Is the given feature enabled (via `#[feature(...)]`)?
97107
pub fn enabled(&self, feature: Symbol) -> bool {
98108
self.enabled_features.contains(&feature)

compiler/rustc_lint/src/builtin.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2331,13 +2331,9 @@ declare_lint_pass!(
23312331
impl EarlyLintPass for IncompleteInternalFeatures {
23322332
fn check_crate(&mut self, cx: &EarlyContext<'_>, _: &ast::Crate) {
23332333
let features = cx.builder.features();
2334-
let lang_features =
2335-
features.enabled_lang_features().iter().map(|feat| (feat.gate_name, feat.attr_sp));
2336-
let lib_features =
2337-
features.enabled_lib_features().iter().map(|feat| (feat.gate_name, feat.attr_sp));
23382334

2339-
lang_features
2340-
.chain(lib_features)
2335+
features
2336+
.enabled_features_iter_stable_order()
23412337
.filter(|(name, _)| features.incomplete(*name) || features.internal(*name))
23422338
.for_each(|(name, span)| {
23432339
if features.incomplete(name) {

compiler/rustc_middle/src/ty/context.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,9 @@ impl<'tcx> Interner for TyCtxt<'tcx> {
207207
from_entry(entry)
208208
}
209209

210-
fn evaluation_is_concurrent(&self) -> bool {
211-
self.sess.threads() > 1
210+
fn assert_evaluation_is_concurrent(&self) {
211+
// Turns out, the assumption for this function isn't perfect.
212+
// See trait-system-refactor-initiative#234.
212213
}
213214

214215
fn expand_abstract_consts<T: TypeFoldable<TyCtxt<'tcx>>>(self, t: T) -> T {

compiler/rustc_parse/src/parser/diagnostics.rs

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2939,26 +2939,24 @@ impl<'a> Parser<'a> {
29392939
}
29402940
let seq_span = lo.to(self.prev_token.span);
29412941
let mut err = self.dcx().struct_span_err(comma_span, "unexpected `,` in pattern");
2942-
if let Ok(seq_snippet) = self.span_to_snippet(seq_span) {
2943-
err.multipart_suggestion(
2944-
format!(
2945-
"try adding parentheses to match on a tuple{}",
2946-
if let CommaRecoveryMode::LikelyTuple = rt { "" } else { "..." },
2947-
),
2948-
vec![
2949-
(seq_span.shrink_to_lo(), "(".to_string()),
2950-
(seq_span.shrink_to_hi(), ")".to_string()),
2951-
],
2942+
err.multipart_suggestion(
2943+
format!(
2944+
"try adding parentheses to match on a tuple{}",
2945+
if let CommaRecoveryMode::LikelyTuple = rt { "" } else { "..." },
2946+
),
2947+
vec![
2948+
(seq_span.shrink_to_lo(), "(".to_string()),
2949+
(seq_span.shrink_to_hi(), ")".to_string()),
2950+
],
2951+
Applicability::MachineApplicable,
2952+
);
2953+
if let CommaRecoveryMode::EitherTupleOrPipe = rt {
2954+
err.span_suggestion(
2955+
comma_span,
2956+
"...or a vertical bar to match on alternatives",
2957+
" |",
29522958
Applicability::MachineApplicable,
29532959
);
2954-
if let CommaRecoveryMode::EitherTupleOrPipe = rt {
2955-
err.span_suggestion(
2956-
seq_span,
2957-
"...or a vertical bar to match on multiple alternatives",
2958-
seq_snippet.replace(',', " |"),
2959-
Applicability::MachineApplicable,
2960-
);
2961-
}
29622960
}
29632961
Err(err)
29642962
}

compiler/rustc_target/src/spec/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3182,6 +3182,7 @@ impl Target {
31823182
"avr" => (Architecture::Avr, None),
31833183
"msp430" => (Architecture::Msp430, None),
31843184
"hexagon" => (Architecture::Hexagon, None),
3185+
"xtensa" => (Architecture::Xtensa, None),
31853186
"bpf" => (Architecture::Bpf, None),
31863187
"loongarch32" => (Architecture::LoongArch32, None),
31873188
"loongarch64" => (Architecture::LoongArch64, None),

compiler/rustc_type_ir/src/interner.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,9 @@ pub trait Interner:
183183
from_entry: impl FnOnce(&CanonicalParamEnvCacheEntry<Self>) -> R,
184184
) -> R;
185185

186-
fn evaluation_is_concurrent(&self) -> bool;
186+
/// Useful for testing. If a cache entry is replaced, this should
187+
/// (in theory) only happen when concurrent.
188+
fn assert_evaluation_is_concurrent(&self);
187189

188190
fn expand_abstract_consts<T: TypeFoldable<Self>>(self, t: T) -> T;
189191

@@ -567,7 +569,7 @@ impl<I: Interner> search_graph::Cx for I {
567569
fn with_global_cache<R>(self, f: impl FnOnce(&mut search_graph::GlobalCache<Self>) -> R) -> R {
568570
I::with_global_cache(self, f)
569571
}
570-
fn evaluation_is_concurrent(&self) -> bool {
571-
self.evaluation_is_concurrent()
572+
fn assert_evaluation_is_concurrent(&self) {
573+
self.assert_evaluation_is_concurrent()
572574
}
573575
}

compiler/rustc_type_ir/src/search_graph/global_cache.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,13 @@ impl<X: Cx> GlobalCache<X> {
5656
let with_overflow = WithOverflow { nested_goals, result };
5757
let prev = entry.with_overflow.insert(required_depth, with_overflow);
5858
if let Some(prev) = &prev {
59-
assert!(cx.evaluation_is_concurrent());
59+
cx.assert_evaluation_is_concurrent();
6060
assert_eq!(cx.get_tracked(&prev.result), evaluation_result.result);
6161
}
6262
} else {
6363
let prev = entry.success.replace(Success { required_depth, nested_goals, result });
6464
if let Some(prev) = &prev {
65-
assert!(cx.evaluation_is_concurrent());
65+
cx.assert_evaluation_is_concurrent();
6666
assert_eq!(cx.get_tracked(&prev.result), evaluation_result.result);
6767
}
6868
}

compiler/rustc_type_ir/src/search_graph/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ pub trait Cx: Copy {
5353

5454
fn with_global_cache<R>(self, f: impl FnOnce(&mut GlobalCache<Self>) -> R) -> R;
5555

56-
fn evaluation_is_concurrent(&self) -> bool;
56+
fn assert_evaluation_is_concurrent(&self);
5757
}
5858

5959
pub trait Delegate: Sized {

library/alloc/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@
9696
#![feature(bstr)]
9797
#![feature(bstr_internals)]
9898
#![feature(cast_maybe_uninit)]
99+
#![feature(cell_get_cloned)]
99100
#![feature(char_internals)]
100101
#![feature(char_max_len)]
101102
#![feature(clone_to_uninit)]

0 commit comments

Comments
 (0)