Skip to content

Commit fd830fc

Browse files
borschenyukang
authored andcommitted
Auto merge of rust-lang#154633 - tgross35:rollup-Yvmg0Vs, r=tgross35
Rollup of 9 pull requests Successful merges: - rust-lang#154582 (miri subtree update) - rust-lang#142659 (compiler-builtins: Clean up features) - rust-lang#153574 (Avoid ICE when param-env normalization leaves unresolved inference variables) - rust-lang#153648 (Fix EII function aliases eliminated by LTO) - rust-lang#153790 (Fix regression when dealing with generics/values with unresolved inference) - rust-lang#154551 (Skip suggestions pointing to macro def for assert_eq) - rust-lang#154574 (delete several `ui/consts` tests) - rust-lang#154577 (Update `mir-opt` 64-bit panic-abort tests for `Alignment` rename) - rust-lang#154579 (remove debug requirement from hooks)
2 parents 37cfa17 + 4485c39 commit fd830fc

File tree

73 files changed

+1284
-353
lines changed

Some content is hidden

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

73 files changed

+1284
-353
lines changed

Cargo.lock

Lines changed: 41 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3421,14 +3421,14 @@ dependencies = [
34213421

34223422
[[package]]
34233423
name = "rustc-build-sysroot"
3424-
version = "0.5.11"
3424+
version = "0.5.12"
34253425
source = "registry+https://github.com/rust-lang/crates.io-index"
3426-
checksum = "3b881c015c729b43105bbd3702a9bdecee28fafaa21126d1d62e454ec011a4b7"
3426+
checksum = "eec3905e8201688412f6f4b1f6c86d38b3ee6578f59ba85f41330a3af61e8365"
34273427
dependencies = [
34283428
"anyhow",
34293429
"rustc_version",
34303430
"tempfile",
3431-
"toml 0.8.23",
3431+
"toml 1.1.0+spec-1.1.0",
34323432
"walkdir",
34333433
]
34343434

@@ -5195,9 +5195,9 @@ dependencies = [
51955195

51965196
[[package]]
51975197
name = "serde_spanned"
5198-
version = "1.0.3"
5198+
version = "1.1.0"
51995199
source = "registry+https://github.com/rust-lang/crates.io-index"
5200-
checksum = "e24345aa0fe688594e73770a5f6d1b216508b4f93484c0026d521acd30134392"
5200+
checksum = "876ac351060d4f882bb1032b6369eb0aef79ad9df1ea8bc404874d8cc3d0cd98"
52015201
dependencies = [
52025202
"serde_core",
52035203
]
@@ -5693,7 +5693,6 @@ version = "0.8.23"
56935693
source = "registry+https://github.com/rust-lang/crates.io-index"
56945694
checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362"
56955695
dependencies = [
5696-
"indexmap",
56975696
"serde",
56985697
"serde_spanned 0.6.9",
56995698
"toml_datetime 0.6.11",
@@ -5708,13 +5707,28 @@ checksum = "f0dc8b1fb61449e27716ec0e1bdf0f6b8f3e8f6b05391e8497b8b6d7804ea6d8"
57085707
dependencies = [
57095708
"indexmap",
57105709
"serde_core",
5711-
"serde_spanned 1.0.3",
5710+
"serde_spanned 1.1.0",
57125711
"toml_datetime 0.7.3",
57135712
"toml_parser",
57145713
"toml_writer",
57155714
"winnow 0.7.13",
57165715
]
57175716

5717+
[[package]]
5718+
name = "toml"
5719+
version = "1.1.0+spec-1.1.0"
5720+
source = "registry+https://github.com/rust-lang/crates.io-index"
5721+
checksum = "f8195ca05e4eb728f4ba94f3e3291661320af739c4e43779cbdfae82ab239fcc"
5722+
dependencies = [
5723+
"indexmap",
5724+
"serde_core",
5725+
"serde_spanned 1.1.0",
5726+
"toml_datetime 1.1.0+spec-1.1.0",
5727+
"toml_parser",
5728+
"toml_writer",
5729+
"winnow 1.0.0",
5730+
]
5731+
57185732
[[package]]
57195733
name = "toml_datetime"
57205734
version = "0.6.11"
@@ -5733,6 +5747,15 @@ dependencies = [
57335747
"serde_core",
57345748
]
57355749

5750+
[[package]]
5751+
name = "toml_datetime"
5752+
version = "1.1.0+spec-1.1.0"
5753+
source = "registry+https://github.com/rust-lang/crates.io-index"
5754+
checksum = "97251a7c317e03ad83774a8752a7e81fb6067740609f75ea2b585b569a59198f"
5755+
dependencies = [
5756+
"serde_core",
5757+
]
5758+
57365759
[[package]]
57375760
name = "toml_edit"
57385761
version = "0.19.15"
@@ -5762,11 +5785,11 @@ dependencies = [
57625785

57635786
[[package]]
57645787
name = "toml_parser"
5765-
version = "1.0.4"
5788+
version = "1.1.0+spec-1.1.0"
57665789
source = "registry+https://github.com/rust-lang/crates.io-index"
5767-
checksum = "c0cbe268d35bdb4bb5a56a2de88d0ad0eb70af5384a99d648cd4b3d04039800e"
5790+
checksum = "2334f11ee363607eb04df9b8fc8a13ca1715a72ba8662a26ac285c98aabb4011"
57685791
dependencies = [
5769-
"winnow 0.7.13",
5792+
"winnow 1.0.0",
57705793
]
57715794

57725795
[[package]]
@@ -5777,9 +5800,9 @@ checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801"
57775800

57785801
[[package]]
57795802
name = "toml_writer"
5780-
version = "1.0.4"
5803+
version = "1.1.0+spec-1.1.0"
57815804
source = "registry+https://github.com/rust-lang/crates.io-index"
5782-
checksum = "df8b2b54733674ad286d16267dcfc7a71ed5c776e4ac7aa3c3e2561f7c637bf2"
5805+
checksum = "d282ade6016312faf3e41e57ebbba0c073e4056dab1232ab1cb624199648f8ed"
57835806

57845807
[[package]]
57855808
name = "tracing"
@@ -6765,6 +6788,12 @@ dependencies = [
67656788
"memchr",
67666789
]
67676790

6791+
[[package]]
6792+
name = "winnow"
6793+
version = "1.0.0"
6794+
source = "registry+https://github.com/rust-lang/crates.io-index"
6795+
checksum = "a90e88e4667264a994d34e6d1ab2d26d398dcdca8b7f52bec8668957517fc7d8"
6796+
67686797
[[package]]
67696798
name = "winsplit"
67706799
version = "0.1.0"

compiler/rustc_codegen_ssa/src/back/symbol_export.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,14 @@ fn exported_non_generic_symbols_provider_local<'tcx>(
199199
}))
200200
}
201201

202+
symbols.extend(sorted.iter().flat_map(|&(&def_id, &info)| {
203+
tcx.codegen_fn_attrs(def_id).foreign_item_symbol_aliases.iter().map(
204+
move |&(foreign_item, _linkage, _visibility)| {
205+
(ExportedSymbol::NonGeneric(foreign_item), info)
206+
},
207+
)
208+
}));
209+
202210
if tcx.entry_fn(()).is_some() {
203211
let exported_symbol =
204212
ExportedSymbol::NoDefId(SymbolName::new(tcx, tcx.sess.target.entry_name.as_ref()));

compiler/rustc_trait_selection/src/error_reporting/infer/note_and_explain.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,13 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
105105
if !sp.contains(p_span) {
106106
diag.span_label(p_span, format!("{expected}this type parameter"));
107107
}
108-
let parent = p_def_id.as_local().and_then(|id| {
108+
let bound_param_def_id = match *proj.self_ty().kind() {
109+
ty::Param(param) => {
110+
tcx.generics_of(body_owner_def_id).type_param(param, tcx).def_id
111+
}
112+
_ => p_def_id,
113+
};
114+
let parent = bound_param_def_id.as_local().and_then(|id| {
109115
let local_id = tcx.local_def_id_to_hir_id(id);
110116
let generics = tcx.parent_hir_node(local_id).generics()?;
111117
Some((id, generics))

compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2878,6 +2878,10 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
28782878
trait_predicate: ty::PolyTraitPredicate<'tcx>,
28792879
root_obligation: &PredicateObligation<'tcx>,
28802880
) -> (PredicateObligation<'tcx>, ty::PolyTraitPredicate<'tcx>) {
2881+
if obligation.predicate.has_non_region_param() || obligation.has_non_region_infer() {
2882+
return (obligation.clone(), trait_predicate);
2883+
}
2884+
28812885
let ocx = ObligationCtxt::new(self);
28822886
let normalized_predicate = self.tcx.erase_and_anonymize_regions(
28832887
self.tcx.instantiate_bound_regions_with_erased(trait_predicate),

compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -545,8 +545,12 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
545545
.all(|obligation| self.predicate_may_hold(obligation))
546546
}) && steps > 0
547547
{
548+
if span.in_external_macro(self.tcx.sess.source_map()) {
549+
return false;
550+
}
548551
let derefs = "*".repeat(steps);
549552
let msg = "consider dereferencing here";
553+
550554
let call_node = self.tcx.hir_node(*call_hir_id);
551555
let is_receiver = matches!(
552556
call_node,
@@ -593,7 +597,6 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
593597
})
594598
{
595599
// Suggest dereferencing the LHS, RHS, or both terms of a binop if possible
596-
597600
let trait_pred = predicate.unwrap_or(trait_pred);
598601
let lhs_ty = self.tcx.instantiate_bound_regions_with_erased(trait_pred.self_ty());
599602
let lhs_autoderef = (self.autoderef_steps)(lhs_ty);
@@ -644,6 +647,9 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
644647
})
645648
{
646649
let make_sugg = |mut expr: &Expr<'_>, mut steps| {
650+
if expr.span.in_external_macro(self.tcx.sess.source_map()) {
651+
return None;
652+
}
647653
let mut prefix_span = expr.span.shrink_to_lo();
648654
let mut msg = "consider dereferencing here";
649655
if let hir::ExprKind::AddrOf(_, _, inner) = expr.kind {
@@ -661,10 +667,10 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
661667
}
662668
// Empty suggestions with empty spans ICE with debug assertions
663669
if steps == 0 {
664-
return (
670+
return Some((
665671
msg.trim_end_matches(" and dereferencing instead"),
666672
vec![(prefix_span, String::new())],
667-
);
673+
));
668674
}
669675
let derefs = "*".repeat(steps);
670676
let needs_parens = steps > 0 && expr_needs_parens(expr);
@@ -686,16 +692,21 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
686692
if !prefix_span.is_empty() {
687693
suggestion.push((prefix_span, String::new()));
688694
}
689-
(msg, suggestion)
695+
Some((msg, suggestion))
690696
};
691697

692698
if let Some(lsteps) = lsteps
693699
&& let Some(rsteps) = rsteps
694700
&& lsteps > 0
695701
&& rsteps > 0
696702
{
697-
let mut suggestion = make_sugg(lhs, lsteps).1;
698-
suggestion.append(&mut make_sugg(rhs, rsteps).1);
703+
let Some((_, mut suggestion)) = make_sugg(lhs, lsteps) else {
704+
return false;
705+
};
706+
let Some((_, mut rhs_suggestion)) = make_sugg(rhs, rsteps) else {
707+
return false;
708+
};
709+
suggestion.append(&mut rhs_suggestion);
699710
err.multipart_suggestion(
700711
"consider dereferencing both sides of the expression",
701712
suggestion,
@@ -705,13 +716,17 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
705716
} else if let Some(lsteps) = lsteps
706717
&& lsteps > 0
707718
{
708-
let (msg, suggestion) = make_sugg(lhs, lsteps);
719+
let Some((msg, suggestion)) = make_sugg(lhs, lsteps) else {
720+
return false;
721+
};
709722
err.multipart_suggestion(msg, suggestion, Applicability::MachineApplicable);
710723
return true;
711724
} else if let Some(rsteps) = rsteps
712725
&& rsteps > 0
713726
{
714-
let (msg, suggestion) = make_sugg(rhs, rsteps);
727+
let Some((msg, suggestion)) = make_sugg(rhs, rsteps) else {
728+
return false;
729+
};
715730
err.multipart_suggestion(msg, suggestion, Applicability::MachineApplicable);
716731
return true;
717732
}
@@ -4824,6 +4839,9 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
48244839
candidate_impls: &[ImplCandidate<'tcx>],
48254840
span: Span,
48264841
) {
4842+
if span.in_external_macro(self.tcx.sess.source_map()) {
4843+
return;
4844+
}
48274845
// We can only suggest the slice coercion for function and binary operation arguments,
48284846
// since the suggestion would make no sense in turbofish or call
48294847
let (ObligationCauseCode::BinOp { .. } | ObligationCauseCode::FunctionArg { .. }) =

compiler/rustc_trait_selection/src/traits/mod.rs

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -300,19 +300,14 @@ fn do_normalize_predicates<'tcx>(
300300
Ok(predicates) => Ok(predicates),
301301
Err(fixup_err) => {
302302
// If we encounter a fixup error, it means that some type
303-
// variable wound up unconstrained. I actually don't know
304-
// if this can happen, and I certainly don't expect it to
305-
// happen often, but if it did happen it probably
306-
// represents a legitimate failure due to some kind of
307-
// unconstrained variable.
308-
//
309-
// @lcnr: Let's still ICE here for now. I want a test case
310-
// for that.
311-
span_bug!(
303+
// variable wound up unconstrained. That can happen for
304+
// ill-formed impls, so we delay a bug here instead of
305+
// immediately ICEing and let type checking report the
306+
// actual user-facing errors.
307+
Err(tcx.dcx().span_delayed_bug(
312308
span,
313-
"inference variables in normalized parameter environment: {}",
314-
fixup_err
315-
);
309+
format!("inference variables in normalized parameter environment: {fixup_err}"),
310+
))
316311
}
317312
}
318313
}

library/alloc/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ bench = false
1616

1717
[dependencies]
1818
core = { path = "../core", public = true }
19-
compiler_builtins = { path = "../compiler-builtins/compiler-builtins", features = ["rustc-dep-of-std"] }
19+
compiler_builtins = { path = "../compiler-builtins/compiler-builtins", features = ["compiler-builtins"] }
2020

2121
[features]
2222
compiler-builtins-mem = ['compiler_builtins/mem']

library/compiler-builtins/builtins-shim/Cargo.toml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ test = false
3939
cc = { version = "1.2", optional = true }
4040

4141
[features]
42-
default = ["compiler-builtins"]
42+
default = []
4343

4444
# Enable compilation of C code in compiler-rt, filling in some more optimized
4545
# implementations and also filling in unimplemented intrinsics
@@ -50,7 +50,8 @@ c = ["dep:cc"]
5050
# the generic versions on all platforms.
5151
no-asm = []
5252

53-
# Flag this library as the unstable compiler-builtins lib
53+
# Flag this library as the unstable compiler-builtins lib. This must be enabled
54+
# when using as `std`'s dependency.'
5455
compiler-builtins = []
5556

5657
# Generate memory-related intrinsics like memcpy
@@ -60,9 +61,6 @@ mem = []
6061
# compiler-rt implementations. Also used for testing
6162
mangled-names = []
6263

63-
# Only used in the compiler's build system
64-
rustc-dep-of-std = ["compiler-builtins"]
65-
6664
# This makes certain traits and function specializations public that
6765
# are not normally public but are required by the `builtins-test`
6866
unstable-public-internals = []

library/compiler-builtins/compiler-builtins/Cargo.toml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ core = { path = "../../core", optional = true }
3434
cc = { version = "1.2", optional = true }
3535

3636
[features]
37-
default = ["compiler-builtins"]
37+
default = []
3838

3939
# Enable compilation of C code in compiler-rt, filling in some more optimized
4040
# implementations and also filling in unimplemented intrinsics
@@ -45,8 +45,9 @@ c = ["dep:cc"]
4545
# the generic versions on all platforms.
4646
no-asm = []
4747

48-
# Flag this library as the unstable compiler-builtins lib
49-
compiler-builtins = []
48+
# Flag this library as the unstable compiler-builtins lib. This must be enabled
49+
# when using as `std`'s dependency.'
50+
compiler-builtins = ["dep:core"]
5051

5152
# Generate memory-related intrinsics like memcpy
5253
mem = []
@@ -55,9 +56,6 @@ mem = []
5556
# compiler-rt implementations. Also used for testing
5657
mangled-names = []
5758

58-
# Only used in the compiler's build system
59-
rustc-dep-of-std = ["compiler-builtins", "dep:core"]
60-
6159
# This makes certain traits and function specializations public that
6260
# are not normally public but are required by the `builtins-test`
6361
unstable-public-internals = []

0 commit comments

Comments
 (0)