Skip to content

Commit 1c7b36d

Browse files
committed
Auto merge of rust-lang#99177 - Dylan-DPC:rollup-m0k9q2w, r=Dylan-DPC
Rollup of 6 pull requests Successful merges: - rust-lang#98622 (rustc_target: Flip the default for `TargetOptions::executables` to true) - rust-lang#98633 (Fix last `let_chains` blocker) - rust-lang#98972 (Suggest adding a missing zero to a floating point number) - rust-lang#99038 (Some more `EarlyBinder` cleanups) - rust-lang#99154 (use PlaceRef::iter_projections to fix old FIXME) - rust-lang#99171 (Put back UI test regex) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents b3f4c31 + 87e25e4 commit 1c7b36d

File tree

82 files changed

+1180
-427
lines changed

Some content is hidden

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

82 files changed

+1180
-427
lines changed

compiler/rustc_middle/src/mir/visit.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -1111,11 +1111,9 @@ macro_rules! visit_place_fns {
11111111
context: PlaceContext,
11121112
location: Location,
11131113
) {
1114-
// FIXME: Use PlaceRef::iter_projections, once that exists.
1115-
let mut cursor = place_ref.projection;
1116-
while let &[ref proj_base @ .., elem] = cursor {
1117-
cursor = proj_base;
1118-
self.visit_projection_elem(place_ref.local, cursor, elem, context, location);
1114+
for (base, elem) in place_ref.iter_projections().rev() {
1115+
let base_proj = base.projection;
1116+
self.visit_projection_elem(place_ref.local, base_proj, elem, context, location);
11191117
}
11201118
}
11211119

compiler/rustc_middle/src/ty/generics.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,10 @@ impl GenericParamDef {
8585
) -> Option<EarlyBinder<ty::GenericArg<'tcx>>> {
8686
match self.kind {
8787
GenericParamDefKind::Type { has_default, .. } if has_default => {
88-
Some(EarlyBinder(tcx.type_of(self.def_id).into()))
88+
Some(tcx.bound_type_of(self.def_id).map_bound(|t| t.into()))
8989
}
9090
GenericParamDefKind::Const { has_default } if has_default => {
91-
Some(EarlyBinder(tcx.const_param_default(self.def_id).into()))
91+
Some(tcx.bound_const_param_default(self.def_id).map_bound(|c| c.into()))
9292
}
9393
_ => None,
9494
}

compiler/rustc_middle/src/ty/sty.rs

+4
Original file line numberDiff line numberDiff line change
@@ -932,6 +932,10 @@ impl<T> EarlyBinder<T> {
932932
let value = f(self.0)?;
933933
Ok(EarlyBinder(value))
934934
}
935+
936+
pub fn rebind<U>(&self, value: U) -> EarlyBinder<U> {
937+
EarlyBinder(value)
938+
}
935939
}
936940

937941
impl<T> EarlyBinder<Option<T>> {

compiler/rustc_middle/src/ty/util.rs

+4
Original file line numberDiff line numberDiff line change
@@ -676,6 +676,10 @@ impl<'tcx> TyCtxt<'tcx> {
676676
) -> ty::EarlyBinder<&'tcx ty::List<ty::Predicate<'tcx>>> {
677677
ty::EarlyBinder(self.item_bounds(def_id))
678678
}
679+
680+
pub fn bound_const_param_default(self, def_id: DefId) -> ty::EarlyBinder<ty::Const<'tcx>> {
681+
ty::EarlyBinder(self.const_param_default(def_id))
682+
}
679683
}
680684

681685
struct OpaqueTypeExpander<'tcx> {

compiler/rustc_mir_transform/src/shim.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -537,13 +537,12 @@ fn build_call_shim<'tcx>(
537537
};
538538

539539
let def_id = instance.def_id();
540-
let sig = tcx.fn_sig(def_id);
541-
let mut sig = tcx.erase_late_bound_regions(sig);
540+
let sig = tcx.bound_fn_sig(def_id);
541+
let sig = sig.map_bound(|sig| tcx.erase_late_bound_regions(sig));
542542

543543
assert_eq!(sig_substs.is_some(), !instance.has_polymorphic_mir_body());
544-
if let Some(sig_substs) = sig_substs {
545-
sig = EarlyBinder(sig).subst(tcx, sig_substs);
546-
}
544+
let mut sig =
545+
if let Some(sig_substs) = sig_substs { sig.subst(tcx, sig_substs) } else { sig.0 };
547546

548547
if let CallKind::Indirect(fnty) = call_kind {
549548
// `sig` determines our local decls, and thus the callee type in the `Call` terminator. This

compiler/rustc_parse/src/parser/expr.rs

+24-8
Original file line numberDiff line numberDiff line change
@@ -1393,7 +1393,9 @@ impl<'a> Parser<'a> {
13931393
self.parse_yield_expr(attrs)
13941394
} else if self.is_do_yeet() {
13951395
self.parse_yeet_expr(attrs)
1396-
} else if self.eat_keyword(kw::Let) {
1396+
} else if self.check_keyword(kw::Let) {
1397+
self.manage_let_chains_context();
1398+
self.bump();
13971399
self.parse_let_expr(attrs)
13981400
} else if self.eat_keyword(kw::Underscore) {
13991401
Ok(self.mk_expr(self.prev_token.span, ExprKind::Underscore, attrs))
@@ -2355,16 +2357,30 @@ impl<'a> Parser<'a> {
23552357
Ok(cond)
23562358
}
23572359

2360+
// Checks if `let` is in an invalid position like `let x = let y = 1;` or
2361+
// if the current `let` is in a let_chains context but nested in another
2362+
// expression like `if let Some(_) = _opt && [1, 2, 3][let _ = ()] = 1`.
2363+
//
2364+
// This method expects that the current token is `let`.
2365+
fn manage_let_chains_context(&mut self) {
2366+
debug_assert!(matches!(self.token.kind, TokenKind::Ident(kw::Let, _)));
2367+
let is_in_a_let_chains_context_but_nested_in_other_expr = self.let_expr_allowed
2368+
&& !matches!(
2369+
self.prev_token.kind,
2370+
TokenKind::AndAnd
2371+
| TokenKind::CloseDelim(Delimiter::Brace)
2372+
| TokenKind::Ident(kw::If, _)
2373+
| TokenKind::Ident(kw::While, _)
2374+
);
2375+
if !self.let_expr_allowed || is_in_a_let_chains_context_but_nested_in_other_expr {
2376+
self.struct_span_err(self.token.span, "expected expression, found `let` statement")
2377+
.emit();
2378+
}
2379+
}
2380+
23582381
/// Parses a `let $pat = $expr` pseudo-expression.
23592382
/// The `let` token has already been eaten.
23602383
fn parse_let_expr(&mut self, attrs: AttrVec) -> PResult<'a, P<Expr>> {
2361-
if !self.let_expr_allowed {
2362-
self.struct_span_err(
2363-
self.prev_token.span,
2364-
"expected expression, found `let` statement",
2365-
)
2366-
.emit();
2367-
}
23682384
let lo = self.prev_token.span;
23692385
let pat = self.parse_pat_allow_top_alt(
23702386
None,

compiler/rustc_target/src/spec/aarch64_unknown_none.rs

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ pub fn target() -> Target {
1313
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
1414
linker: Some("rust-lld".into()),
1515
features: "+strict-align,+neon,+fp-armv8".into(),
16-
executables: true,
1716
relocation_model: RelocModel::Static,
1817
disable_redzone: true,
1918
max_atomic_width: Some(128),

compiler/rustc_target/src/spec/aarch64_unknown_none_softfloat.rs

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ pub fn target() -> Target {
1414
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
1515
linker: Some("rust-lld".into()),
1616
features: "+strict-align,-neon,-fp-armv8".into(),
17-
executables: true,
1817
relocation_model: RelocModel::Static,
1918
disable_redzone: true,
2019
max_atomic_width: Some(128),

compiler/rustc_target/src/spec/apple_base.rs

-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ pub fn opts(os: &'static str) -> TargetOptions {
2525
function_sections: false,
2626
dynamic_linking: true,
2727
linker_is_gnu: false,
28-
executables: true,
2928
families: cvs!["unix"],
3029
is_like_osx: true,
3130
default_dwarf_version: 2,

compiler/rustc_target/src/spec/apple_sdk_base.rs

-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ pub fn opts(os: &'static str, arch: Arch) -> TargetOptions {
5454
abi: target_abi(arch).into(),
5555
cpu: target_cpu(arch).into(),
5656
dynamic_linking: false,
57-
executables: true,
5857
link_env_remove: link_env_remove(arch),
5958
has_thread_local: false,
6059
..super::apple_base::opts(os)

compiler/rustc_target/src/spec/armebv7r_none_eabi.rs

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ pub fn target() -> Target {
1414
abi: "eabi".into(),
1515
endian: Endian::Big,
1616
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
17-
executables: true,
1817
linker: Some("rust-lld".into()),
1918
relocation_model: RelocModel::Static,
2019
panic_strategy: PanicStrategy::Abort,

compiler/rustc_target/src/spec/armebv7r_none_eabihf.rs

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ pub fn target() -> Target {
1414
abi: "eabihf".into(),
1515
endian: Endian::Big,
1616
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
17-
executables: true,
1817
linker: Some("rust-lld".into()),
1918
relocation_model: RelocModel::Static,
2019
panic_strategy: PanicStrategy::Abort,

compiler/rustc_target/src/spec/armv6k_nintendo_3ds.rs

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ pub fn target() -> Target {
2323
abi: "eabihf".into(),
2424
linker_flavor: LinkerFlavor::Gcc,
2525
cpu: "mpcore".into(),
26-
executables: true,
2726
families: cvs!["unix"],
2827
linker: Some("arm-none-eabi-gcc".into()),
2928
relocation_model: RelocModel::Static,

compiler/rustc_target/src/spec/armv7a_none_eabi.rs

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ pub fn target() -> Target {
2222
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
2323
linker: Some("rust-lld".into()),
2424
features: "+v7,+thumb2,+soft-float,-neon,+strict-align".into(),
25-
executables: true,
2625
relocation_model: RelocModel::Static,
2726
disable_redzone: true,
2827
max_atomic_width: Some(64),

compiler/rustc_target/src/spec/armv7a_none_eabihf.rs

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ pub fn target() -> Target {
1313
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
1414
linker: Some("rust-lld".into()),
1515
features: "+v7,+vfp3,-d32,+thumb2,-neon,+strict-align".into(),
16-
executables: true,
1716
relocation_model: RelocModel::Static,
1817
disable_redzone: true,
1918
max_atomic_width: Some(64),

compiler/rustc_target/src/spec/armv7r_none_eabi.rs

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ pub fn target() -> Target {
1313
options: TargetOptions {
1414
abi: "eabi".into(),
1515
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
16-
executables: true,
1716
linker: Some("rust-lld".into()),
1817
relocation_model: RelocModel::Static,
1918
panic_strategy: PanicStrategy::Abort,

compiler/rustc_target/src/spec/armv7r_none_eabihf.rs

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ pub fn target() -> Target {
1313
options: TargetOptions {
1414
abi: "eabihf".into(),
1515
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
16-
executables: true,
1716
linker: Some("rust-lld".into()),
1817
relocation_model: RelocModel::Static,
1918
panic_strategy: PanicStrategy::Abort,

compiler/rustc_target/src/spec/avr_gnu_base.rs

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ pub fn target(target_cpu: &'static str, mmcu: &'static str) -> Target {
1616
exe_suffix: ".elf".into(),
1717

1818
linker: Some("avr-gcc".into()),
19-
executables: true,
2019
eh_frame_header: false,
2120
pre_link_args: TargetOptions::link_args(LinkerFlavor::Gcc, &[mmcu]),
2221
late_link_args: TargetOptions::link_args(LinkerFlavor::Gcc, &["-lgcc"]),

compiler/rustc_target/src/spec/bpf_base.rs

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ pub fn opts(endian: Endian) -> TargetOptions {
77
endian,
88
linker_flavor: LinkerFlavor::BpfLinker,
99
atomic_cas: false,
10-
executables: true,
1110
dynamic_linking: true,
1211
no_builtins: true,
1312
panic_strategy: PanicStrategy::Abort,

compiler/rustc_target/src/spec/dragonfly_base.rs

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ pub fn opts() -> TargetOptions {
44
TargetOptions {
55
os: "dragonfly".into(),
66
dynamic_linking: true,
7-
executables: true,
87
families: cvs!["unix"],
98
has_rpath: true,
109
position_independent_executables: true,

compiler/rustc_target/src/spec/freebsd_base.rs

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ pub fn opts() -> TargetOptions {
44
TargetOptions {
55
os: "freebsd".into(),
66
dynamic_linking: true,
7-
executables: true,
87
families: cvs!["unix"],
98
has_rpath: true,
109
position_independent_executables: true,

compiler/rustc_target/src/spec/fuchsia_base.rs

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ pub fn opts() -> TargetOptions {
2323
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
2424
linker: Some("rust-lld".into()),
2525
dynamic_linking: true,
26-
executables: true,
2726
families: cvs!["unix"],
2827
pre_link_args,
2928
pre_link_objects: crt_objects::new(&[

compiler/rustc_target/src/spec/haiku_base.rs

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ pub fn opts() -> TargetOptions {
44
TargetOptions {
55
os: "haiku".into(),
66
dynamic_linking: true,
7-
executables: true,
87
families: cvs!["unix"],
98
relro_level: RelroLevel::Full,
109
..Default::default()

compiler/rustc_target/src/spec/hermit_base.rs

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ pub fn opts() -> TargetOptions {
1010
os: "hermit".into(),
1111
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
1212
linker: Some("rust-lld".into()),
13-
executables: true,
1413
has_thread_local: true,
1514
pre_link_args,
1615
panic_strategy: PanicStrategy::Abort,

compiler/rustc_target/src/spec/hexagon_unknown_linux_musl.rs

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ pub fn target() -> Target {
1111
base.has_rpath = true;
1212
base.linker_is_gnu = false;
1313
base.dynamic_linking = true;
14-
base.executables = true;
1514

1615
base.c_enum_min_bits = 8;
1716

compiler/rustc_target/src/spec/illumos_base.rs

-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ pub fn opts() -> TargetOptions {
2727
TargetOptions {
2828
os: "illumos".into(),
2929
dynamic_linking: true,
30-
executables: true,
3130
has_rpath: true,
3231
families: cvs!["unix"],
3332
is_like_solaris: true,

compiler/rustc_target/src/spec/l4re_base.rs

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ pub fn opts() -> TargetOptions {
55
os: "l4re".into(),
66
env: "uclibc".into(),
77
linker_flavor: LinkerFlavor::L4Bender,
8-
executables: true,
98
panic_strategy: PanicStrategy::Abort,
109
linker: Some("l4-bender".into()),
1110
linker_is_gnu: false,

compiler/rustc_target/src/spec/linux_base.rs

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ pub fn opts() -> TargetOptions {
44
TargetOptions {
55
os: "linux".into(),
66
dynamic_linking: true,
7-
executables: true,
87
families: cvs!["unix"],
98
has_rpath: true,
109
position_independent_executables: true,

compiler/rustc_target/src/spec/mipsel_sony_psp.rs

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ pub fn target() -> Target {
1818
vendor: "sony".into(),
1919
linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
2020
cpu: "mips2".into(),
21-
executables: true,
2221
linker: Some("rust-lld".into()),
2322
relocation_model: RelocModel::Static,
2423

compiler/rustc_target/src/spec/mipsel_unknown_none.rs

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ pub fn target() -> Target {
1717
cpu: "mips32r2".into(),
1818
features: "+mips32r2,+soft-float,+noabicalls".into(),
1919
max_atomic_width: Some(32),
20-
executables: true,
2120
linker: Some("rust-lld".into()),
2221
panic_strategy: PanicStrategy::Abort,
2322
relocation_model: RelocModel::Static,

compiler/rustc_target/src/spec/mod.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -1212,8 +1212,7 @@ pub struct TargetOptions {
12121212
pub dynamic_linking: bool,
12131213
/// If dynamic linking is available, whether only cdylibs are supported.
12141214
pub only_cdylib: bool,
1215-
/// Whether executables are available on this target. iOS, for example, only allows static
1216-
/// libraries. Defaults to false.
1215+
/// Whether executables are available on this target. Defaults to true.
12171216
pub executables: bool,
12181217
/// Relocation model to use in object file. Corresponds to `llc
12191218
/// -relocation-model=$relocation_model`. Defaults to `Pic`.
@@ -1520,7 +1519,7 @@ impl Default for TargetOptions {
15201519
features: "".into(),
15211520
dynamic_linking: false,
15221521
only_cdylib: false,
1523-
executables: false,
1522+
executables: true,
15241523
relocation_model: RelocModel::Pic,
15251524
code_model: None,
15261525
tls_model: TlsModel::GeneralDynamic,

compiler/rustc_target/src/spec/msp430_none_elf.rs

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ pub fn target() -> Target {
99

1010
options: TargetOptions {
1111
c_int_width: "16".into(),
12-
executables: true,
1312

1413
// The LLVM backend currently can't generate object files. To
1514
// workaround this LLVM generates assembly files which then we feed

compiler/rustc_target/src/spec/msvc_base.rs

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ pub fn opts() -> TargetOptions {
77

88
TargetOptions {
99
linker_flavor: LinkerFlavor::Msvc,
10-
executables: true,
1110
is_like_windows: true,
1211
is_like_msvc: true,
1312
lld_flavor: LldFlavor::Link,

compiler/rustc_target/src/spec/netbsd_base.rs

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ pub fn opts() -> TargetOptions {
44
TargetOptions {
55
os: "netbsd".into(),
66
dynamic_linking: true,
7-
executables: true,
87
families: cvs!["unix"],
98
no_default_libraries: false,
109
has_rpath: true,

compiler/rustc_target/src/spec/nvptx64_nvidia_cuda.rs

-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ pub fn target() -> Target {
2626

2727
// Needed to use `dylib` and `bin` crate types and the linker.
2828
dynamic_linking: true,
29-
executables: true,
3029

3130
// Avoid using dylib because it contain metadata not supported
3231
// by LLVM NVPTX backend.

compiler/rustc_target/src/spec/openbsd_base.rs

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ pub fn opts() -> TargetOptions {
44
TargetOptions {
55
os: "openbsd".into(),
66
dynamic_linking: true,
7-
executables: true,
87
families: cvs!["unix"],
98
has_rpath: true,
109
abi_return_struct_as_int: true,

compiler/rustc_target/src/spec/redox_base.rs

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ pub fn opts() -> TargetOptions {
55
os: "redox".into(),
66
env: "relibc".into(),
77
dynamic_linking: true,
8-
executables: true,
98
families: cvs!["unix"],
109
has_rpath: true,
1110
position_independent_executables: true,

compiler/rustc_target/src/spec/riscv32i_unknown_none_elf.rs

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ pub fn target() -> Target {
1414
cpu: "generic-rv32".into(),
1515
max_atomic_width: Some(0),
1616
atomic_cas: false,
17-
executables: true,
1817
panic_strategy: PanicStrategy::Abort,
1918
relocation_model: RelocModel::Static,
2019
emit_debug_gdb_scripts: false,

compiler/rustc_target/src/spec/riscv32im_unknown_none_elf.rs

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ pub fn target() -> Target {
1515
max_atomic_width: Some(0),
1616
atomic_cas: false,
1717
features: "+m".into(),
18-
executables: true,
1918
panic_strategy: PanicStrategy::Abort,
2019
relocation_model: RelocModel::Static,
2120
emit_debug_gdb_scripts: false,

compiler/rustc_target/src/spec/riscv32imac_unknown_none_elf.rs

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ pub fn target() -> Target {
1414
cpu: "generic-rv32".into(),
1515
max_atomic_width: Some(32),
1616
features: "+m,+a,+c".into(),
17-
executables: true,
1817
panic_strategy: PanicStrategy::Abort,
1918
relocation_model: RelocModel::Static,
2019
emit_debug_gdb_scripts: false,

0 commit comments

Comments
 (0)