Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit f1bc669

Browse files
committed
Auto merge of #138974 - Zalathar:rollup-568cpmy, r=Zalathar
Rollup of 7 pull requests Successful merges: - #138483 (Target modifiers fix for bool flags without value) - #138818 (Don't produce debug information for compiler-introduced-vars when desugaring assignments.) - #138898 (Mostly parser: Eliminate code that's been dead / semi-dead since the removal of type ascription syntax) - #138930 (Add bootstrap step diff to CI job analysis) - #138954 (Ensure `define_opaque` attrs are accounted for in HIR hash) - #138959 (Revert "Make MatchPairTree::place non-optional") - #138967 (Fix typo in error message) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 65899c0 + 46a40be commit f1bc669

File tree

63 files changed

+896
-745
lines changed

Some content is hidden

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

63 files changed

+896
-745
lines changed

‎compiler/rustc_ast/src/ast.rs‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -545,14 +545,6 @@ pub struct Block {
545545
pub rules: BlockCheckMode,
546546
pub span: Span,
547547
pub tokens: Option<LazyAttrTokenStream>,
548-
/// The following *isn't* a parse error, but will cause multiple errors in following stages.
549-
/// ```compile_fail
550-
/// let x = {
551-
/// foo: var
552-
/// };
553-
/// ```
554-
/// #34255
555-
pub could_be_bare_literal: bool,
556548
}
557549

558550
/// A match pattern.

‎compiler/rustc_ast/src/mut_visit.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1222,7 +1222,7 @@ fn walk_mt<T: MutVisitor>(vis: &mut T, MutTy { ty, mutbl: _ }: &mut MutTy) {
12221222
}
12231223

12241224
pub fn walk_block<T: MutVisitor>(vis: &mut T, block: &mut P<Block>) {
1225-
let Block { id, stmts, rules: _, span, tokens,could_be_bare_literal: _ } = block.deref_mut();
1225+
let Block { id, stmts, rules: _, span, tokens } = block.deref_mut();
12261226
vis.visit_id(id);
12271227
stmts.flat_map_in_place(|stmt| vis.flat_map_stmt(stmt));
12281228
visit_lazy_tts(vis, tokens);

‎compiler/rustc_ast/src/visit.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1067,7 +1067,7 @@ pub fn walk_field_def<'a, V: Visitor<'a>>(visitor: &mut V, field: &'a FieldDef)
10671067
}
10681068

10691069
pub fn walk_block<'a, V: Visitor<'a>>(visitor: &mut V, block: &'a Block) -> V::Result {
1070-
let Block { stmts, id: _, rules: _, span: _, tokens: _,could_be_bare_literal: _ } = block;
1070+
let Block { stmts, id: _, rules: _, span: _, tokens: _ } = block;
10711071
walk_list!(visitor, visit_stmt, stmts);
10721072
V::Result::output()
10731073
}

‎compiler/rustc_ast_lowering/src/lib.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
623623

624624
// Don't hash unless necessary, because it's expensive.
625625
let (opt_hash_including_bodies, attrs_hash) =
626-
self.tcx.hash_owner_nodes(node, &bodies, &attrs);
626+
self.tcx.hash_owner_nodes(node, &bodies, &attrs, define_opaque);
627627
let num_nodes = self.item_local_id_counter.as_usize();
628628
let (nodes, parenting) = index::index_hir(self.tcx, node, &bodies, num_nodes);
629629
let nodes = hir::OwnerNodes { opt_hash_including_bodies, nodes, bodies };

‎compiler/rustc_builtin_macros/src/autodiff.rs‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,6 @@ mod llvm_enzyme {
395395
tokens: None,
396396
rules: unsf,
397397
span,
398-
could_be_bare_literal: false,
399398
};
400399
let unsf_expr = ecx.expr_block(P(unsf_block));
401400
let blackbox_call_expr = ecx.expr_path(ecx.path(span, blackbox_path));

‎compiler/rustc_builtin_macros/src/deriving/mod.rs‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ fn call_unreachable(cx: &ExtCtxt<'_>, span: Span) -> P<ast::Expr> {
110110
rules: ast::BlockCheckMode::Unsafe(ast::CompilerGenerated),
111111
span,
112112
tokens: None,
113-
could_be_bare_literal: false,
114113
}))
115114
}
116115

‎compiler/rustc_expand/src/build.rs‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,6 @@ impl<'a> ExtCtxt<'a> {
286286
rules: BlockCheckMode::Default,
287287
span,
288288
tokens: None,
289-
could_be_bare_literal: false,
290289
})
291290
}
292291

‎compiler/rustc_metadata/messages.ftl‎

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,23 @@ metadata_incompatible_rustc =
118118
119119
metadata_incompatible_target_modifiers =
120120
mixing `{$flag_name_prefixed}` will cause an ABI mismatch in crate `{$local_crate}`
121-
.note = `{$flag_name_prefixed}={$flag_local_value}` in this crate is incompatible with `{$flag_name_prefixed}={$flag_extern_value}` in dependency `{$extern_crate}`
121+
.note = `{$flag_name_prefixed}={$local_value}` in this crate is incompatible with `{$flag_name_prefixed}={$extern_value}` in dependency `{$extern_crate}`
122122
.help = the `{$flag_name_prefixed}` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely
123-
124123
metadata_incompatible_target_modifiers_help_allow = if you are sure this will not cause problems, you may use `-Cunsafe-allow-abi-mismatch={$flag_name}` to silence this error
125-
metadata_incompatible_target_modifiers_help_fix = set `{$flag_name_prefixed}={$flag_extern_value}` in this crate or `{$flag_name_prefixed}={$flag_local_value}` in `{$extern_crate}`
124+
metadata_incompatible_target_modifiers_help_fix = set `{$flag_name_prefixed}={$extern_value}` in this crate or `{$flag_name_prefixed}={$local_value}` in `{$extern_crate}`
125+
126+
metadata_incompatible_target_modifiers_help_fix_l_missed = set `{$flag_name_prefixed}={$extern_value}` in this crate or unset `{$flag_name_prefixed}` in `{$extern_crate}`
126127
128+
metadata_incompatible_target_modifiers_help_fix_r_missed = unset `{$flag_name_prefixed}` in this crate or set `{$flag_name_prefixed}={$local_value}` in `{$extern_crate}`
129+
130+
metadata_incompatible_target_modifiers_l_missed =
131+
mixing `{$flag_name_prefixed}` will cause an ABI mismatch in crate `{$local_crate}`
132+
.note = unset `{$flag_name_prefixed}` in this crate is incompatible with `{$flag_name_prefixed}={$extern_value}` in dependency `{$extern_crate}`
133+
.help = the `{$flag_name_prefixed}` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely
134+
metadata_incompatible_target_modifiers_r_missed =
135+
mixing `{$flag_name_prefixed}` will cause an ABI mismatch in crate `{$local_crate}`
136+
.note = `{$flag_name_prefixed}={$local_value}` in this crate is incompatible with unset `{$flag_name_prefixed}` in dependency `{$extern_crate}`
137+
.help = the `{$flag_name_prefixed}` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely
127138
metadata_incompatible_wasm_link =
128139
`wasm_import_module` is incompatible with other arguments in `#[link]` attributes
129140

‎compiler/rustc_metadata/src/creader.rs‎

Lines changed: 51 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -358,57 +358,90 @@ impl CStore {
358358
) {
359359
let span = krate.spans.inner_span.shrink_to_lo();
360360
let allowed_flag_mismatches = &tcx.sess.opts.cg.unsafe_allow_abi_mismatch;
361-
let name = tcx.crate_name(LOCAL_CRATE);
361+
let local_crate = tcx.crate_name(LOCAL_CRATE);
362362
let tmod_extender = |tmod: &TargetModifier| (tmod.extend(), tmod.clone());
363363
let report_diff = |prefix: &String,
364364
opt_name: &String,
365-
flag_local_value: &String,
366-
flag_extern_value: &String| {
365+
flag_local_value: Option<&String>,
366+
flag_extern_value: Option<&String>| {
367367
if allowed_flag_mismatches.contains(&opt_name) {
368368
return;
369369
}
370-
tcx.dcx().emit_err(errors::IncompatibleTargetModifiers {
371-
span,
372-
extern_crate: data.name(),
373-
local_crate: name,
374-
flag_name: opt_name.clone(),
375-
flag_name_prefixed: format!("-{}{}", prefix, opt_name),
376-
flag_local_value: flag_local_value.to_string(),
377-
flag_extern_value: flag_extern_value.to_string(),
378-
});
370+
let extern_crate = data.name();
371+
let flag_name = opt_name.clone();
372+
let flag_name_prefixed = format!("-{}{}", prefix, opt_name);
373+
374+
match (flag_local_value, flag_extern_value) {
375+
(Some(local_value), Some(extern_value)) => {
376+
tcx.dcx().emit_err(errors::IncompatibleTargetModifiers {
377+
span,
378+
extern_crate,
379+
local_crate,
380+
flag_name,
381+
flag_name_prefixed,
382+
local_value: local_value.to_string(),
383+
extern_value: extern_value.to_string(),
384+
})
385+
}
386+
(None, Some(extern_value)) => {
387+
tcx.dcx().emit_err(errors::IncompatibleTargetModifiersLMissed {
388+
span,
389+
extern_crate,
390+
local_crate,
391+
flag_name,
392+
flag_name_prefixed,
393+
extern_value: extern_value.to_string(),
394+
})
395+
}
396+
(Some(local_value), None) => {
397+
tcx.dcx().emit_err(errors::IncompatibleTargetModifiersRMissed {
398+
span,
399+
extern_crate,
400+
local_crate,
401+
flag_name,
402+
flag_name_prefixed,
403+
local_value: local_value.to_string(),
404+
})
405+
}
406+
(None, None) => panic!("Incorrect target modifiers report_diff(None, None)"),
407+
};
379408
};
380409
let mut it1 = mods.iter().map(tmod_extender);
381410
let mut it2 = dep_mods.iter().map(tmod_extender);
382411
let mut left_name_val: Option<(ExtendedTargetModifierInfo, TargetModifier)> = None;
383412
let mut right_name_val: Option<(ExtendedTargetModifierInfo, TargetModifier)> = None;
384-
let no_val = "*".to_string();
385413
loop {
386414
left_name_val = left_name_val.or_else(|| it1.next());
387415
right_name_val = right_name_val.or_else(|| it2.next());
388416
match (&left_name_val, &right_name_val) {
389417
(Some(l), Some(r)) => match l.1.opt.cmp(&r.1.opt) {
390418
cmp::Ordering::Equal => {
391419
if l.0.tech_value != r.0.tech_value {
392-
report_diff(&l.0.prefix, &l.0.name, &l.1.value_name, &r.1.value_name);
420+
report_diff(
421+
&l.0.prefix,
422+
&l.0.name,
423+
Some(&l.1.value_name),
424+
Some(&r.1.value_name),
425+
);
393426
}
394427
left_name_val = None;
395428
right_name_val = None;
396429
}
397430
cmp::Ordering::Greater => {
398-
report_diff(&r.0.prefix, &r.0.name, &no_val,&r.1.value_name);
431+
report_diff(&r.0.prefix, &r.0.name, None,Some(&r.1.value_name));
399432
right_name_val = None;
400433
}
401434
cmp::Ordering::Less => {
402-
report_diff(&l.0.prefix, &l.0.name, &l.1.value_name,&no_val);
435+
report_diff(&l.0.prefix, &l.0.name, Some(&l.1.value_name),None);
403436
left_name_val = None;
404437
}
405438
},
406439
(Some(l), None) => {
407-
report_diff(&l.0.prefix, &l.0.name, &l.1.value_name,&no_val);
440+
report_diff(&l.0.prefix, &l.0.name, Some(&l.1.value_name),None);
408441
left_name_val = None;
409442
}
410443
(None, Some(r)) => {
411-
report_diff(&r.0.prefix, &r.0.name, &no_val,&r.1.value_name);
444+
report_diff(&r.0.prefix, &r.0.name, None,Some(&r.1.value_name));
412445
right_name_val = None;
413446
}
414447
(None, None) => break,

‎compiler/rustc_metadata/src/errors.rs‎

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -759,8 +759,40 @@ pub struct IncompatibleTargetModifiers {
759759
pub local_crate: Symbol,
760760
pub flag_name: String,
761761
pub flag_name_prefixed: String,
762-
pub flag_local_value: String,
763-
pub flag_extern_value: String,
762+
pub local_value: String,
763+
pub extern_value: String,
764+
}
765+
766+
#[derive(Diagnostic)]
767+
#[diag(metadata_incompatible_target_modifiers_l_missed)]
768+
#[help]
769+
#[note]
770+
#[help(metadata_incompatible_target_modifiers_help_fix_l_missed)]
771+
#[help(metadata_incompatible_target_modifiers_help_allow)]
772+
pub struct IncompatibleTargetModifiersLMissed {
773+
#[primary_span]
774+
pub span: Span,
775+
pub extern_crate: Symbol,
776+
pub local_crate: Symbol,
777+
pub flag_name: String,
778+
pub flag_name_prefixed: String,
779+
pub extern_value: String,
780+
}
781+
782+
#[derive(Diagnostic)]
783+
#[diag(metadata_incompatible_target_modifiers_r_missed)]
784+
#[help]
785+
#[note]
786+
#[help(metadata_incompatible_target_modifiers_help_fix_r_missed)]
787+
#[help(metadata_incompatible_target_modifiers_help_allow)]
788+
pub struct IncompatibleTargetModifiersRMissed {
789+
#[primary_span]
790+
pub span: Span,
791+
pub extern_crate: Symbol,
792+
pub local_crate: Symbol,
793+
pub flag_name: String,
794+
pub flag_name_prefixed: String,
795+
pub local_value: String,
764796
}
765797

766798
#[derive(Diagnostic)]

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /