Skip to content

Commit 672831a

Browse files
committed
Auto merge of #101938 - Dylan-DPC:rollup-6vlohhs, r=Dylan-DPC
Rollup of 6 pull requests Successful merges: - #93628 (Stabilize `let else`) - #98441 (Implement simd_as for pointers) - #101790 (Do not suggest a placeholder to const and static without a type) - #101807 (Disallow defaults on type GATs) - #101915 (doc: fix redirected link in `/index.html`) - #101931 (doc: Fix a typo in `Rc::make_mut` docstring) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents b195f53 + 80cceb8 commit 672831a

File tree

125 files changed

+437
-236
lines changed

Some content is hidden

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

125 files changed

+437
-236
lines changed

compiler/rustc_ast/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#![feature(if_let_guard)]
1616
#![cfg_attr(bootstrap, feature(label_break_value))]
1717
#![feature(let_chains)]
18-
#![feature(let_else)]
18+
#![cfg_attr(bootstrap, feature(let_else))]
1919
#![feature(min_specialization)]
2020
#![feature(negative_impls)]
2121
#![feature(slice_internals)]

compiler/rustc_ast_lowering/src/block.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
use crate::{ImplTraitContext, ImplTraitPosition, LoweringContext};
22
use rustc_ast::{Block, BlockCheckMode, Local, LocalKind, Stmt, StmtKind};
33
use rustc_hir as hir;
4-
use rustc_session::parse::feature_err;
5-
use rustc_span::sym;
64

75
use smallvec::SmallVec;
86

@@ -92,15 +90,6 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
9290
let hir_id = self.lower_node_id(l.id);
9391
let pat = self.lower_pat(&l.pat);
9492
let els = if let LocalKind::InitElse(_, els) = &l.kind {
95-
if !self.tcx.features().let_else {
96-
feature_err(
97-
&self.tcx.sess.parse_sess,
98-
sym::let_else,
99-
l.span,
100-
"`let...else` statements are unstable",
101-
)
102-
.emit();
103-
}
10493
Some(self.lower_block(els, false))
10594
} else {
10695
None

compiler/rustc_ast_lowering/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
3333
#![feature(box_patterns)]
3434
#![feature(let_chains)]
35-
#![feature(let_else)]
35+
#![cfg_attr(bootstrap, feature(let_else))]
3636
#![feature(never_type)]
3737
#![recursion_limit = "256"]
3838
#![allow(rustc::potential_query_instability)]

compiler/rustc_ast_passes/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#![feature(if_let_guard)]
1010
#![feature(iter_is_partitioned)]
1111
#![feature(let_chains)]
12-
#![feature(let_else)]
12+
#![cfg_attr(bootstrap, feature(let_else))]
1313
#![recursion_limit = "256"]
1414

1515
#[macro_use]

compiler/rustc_attr/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
//! to this crate.
66
77
#![feature(let_chains)]
8-
#![feature(let_else)]
8+
#![cfg_attr(bootstrap, feature(let_else))]
99
#![deny(rustc::untranslatable_diagnostic)]
1010
#![deny(rustc::diagnostic_outside_of_impl)]
1111

compiler/rustc_borrowck/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#![allow(rustc::potential_query_instability)]
44
#![feature(box_patterns)]
55
#![feature(let_chains)]
6-
#![feature(let_else)]
6+
#![cfg_attr(bootstrap, feature(let_else))]
77
#![feature(min_specialization)]
88
#![feature(never_type)]
99
#![feature(rustc_attrs)]

compiler/rustc_builtin_macros/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#![feature(if_let_guard)]
1010
#![feature(is_sorted)]
1111
#![feature(let_chains)]
12-
#![feature(let_else)]
12+
#![cfg_attr(bootstrap, feature(let_else))]
1313
#![feature(proc_macro_internals)]
1414
#![feature(proc_macro_quote)]
1515
#![recursion_limit = "256"]

compiler/rustc_codegen_llvm/src/intrinsic.rs

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1705,6 +1705,97 @@ unsupported {} from `{}` with element `{}` of size `{}` to `{}`"#,
17051705
bitwise_red!(simd_reduce_all: vector_reduce_and, true);
17061706
bitwise_red!(simd_reduce_any: vector_reduce_or, true);
17071707

1708+
if name == sym::simd_cast_ptr {
1709+
require_simd!(ret_ty, "return");
1710+
let (out_len, out_elem) = ret_ty.simd_size_and_type(bx.tcx());
1711+
require!(
1712+
in_len == out_len,
1713+
"expected return type with length {} (same as input type `{}`), \
1714+
found `{}` with length {}",
1715+
in_len,
1716+
in_ty,
1717+
ret_ty,
1718+
out_len
1719+
);
1720+
1721+
match in_elem.kind() {
1722+
ty::RawPtr(p) => {
1723+
let (metadata, check_sized) = p.ty.ptr_metadata_ty(bx.tcx, |ty| {
1724+
bx.tcx.normalize_erasing_regions(ty::ParamEnv::reveal_all(), ty)
1725+
});
1726+
assert!(!check_sized); // we are in codegen, so we shouldn't see these types
1727+
require!(metadata.is_unit(), "cannot cast fat pointer `{}`", in_elem)
1728+
}
1729+
_ => return_error!("expected pointer, got `{}`", in_elem),
1730+
}
1731+
match out_elem.kind() {
1732+
ty::RawPtr(p) => {
1733+
let (metadata, check_sized) = p.ty.ptr_metadata_ty(bx.tcx, |ty| {
1734+
bx.tcx.normalize_erasing_regions(ty::ParamEnv::reveal_all(), ty)
1735+
});
1736+
assert!(!check_sized); // we are in codegen, so we shouldn't see these types
1737+
require!(metadata.is_unit(), "cannot cast to fat pointer `{}`", out_elem)
1738+
}
1739+
_ => return_error!("expected pointer, got `{}`", out_elem),
1740+
}
1741+
1742+
if in_elem == out_elem {
1743+
return Ok(args[0].immediate());
1744+
} else {
1745+
return Ok(bx.pointercast(args[0].immediate(), llret_ty));
1746+
}
1747+
}
1748+
1749+
if name == sym::simd_expose_addr {
1750+
require_simd!(ret_ty, "return");
1751+
let (out_len, out_elem) = ret_ty.simd_size_and_type(bx.tcx());
1752+
require!(
1753+
in_len == out_len,
1754+
"expected return type with length {} (same as input type `{}`), \
1755+
found `{}` with length {}",
1756+
in_len,
1757+
in_ty,
1758+
ret_ty,
1759+
out_len
1760+
);
1761+
1762+
match in_elem.kind() {
1763+
ty::RawPtr(_) => {}
1764+
_ => return_error!("expected pointer, got `{}`", in_elem),
1765+
}
1766+
match out_elem.kind() {
1767+
ty::Uint(ty::UintTy::Usize) => {}
1768+
_ => return_error!("expected `usize`, got `{}`", out_elem),
1769+
}
1770+
1771+
return Ok(bx.ptrtoint(args[0].immediate(), llret_ty));
1772+
}
1773+
1774+
if name == sym::simd_from_exposed_addr {
1775+
require_simd!(ret_ty, "return");
1776+
let (out_len, out_elem) = ret_ty.simd_size_and_type(bx.tcx());
1777+
require!(
1778+
in_len == out_len,
1779+
"expected return type with length {} (same as input type `{}`), \
1780+
found `{}` with length {}",
1781+
in_len,
1782+
in_ty,
1783+
ret_ty,
1784+
out_len
1785+
);
1786+
1787+
match in_elem.kind() {
1788+
ty::Uint(ty::UintTy::Usize) => {}
1789+
_ => return_error!("expected `usize`, got `{}`", in_elem),
1790+
}
1791+
match out_elem.kind() {
1792+
ty::RawPtr(_) => {}
1793+
_ => return_error!("expected pointer, got `{}`", out_elem),
1794+
}
1795+
1796+
return Ok(bx.inttoptr(args[0].immediate(), llret_ty));
1797+
}
1798+
17081799
if name == sym::simd_cast || name == sym::simd_as {
17091800
require_simd!(ret_ty, "return");
17101801
let (out_len, out_elem) = ret_ty.simd_size_and_type(bx.tcx());

compiler/rustc_codegen_llvm/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
88
#![feature(hash_raw_entry)]
99
#![feature(let_chains)]
10-
#![feature(let_else)]
10+
#![cfg_attr(bootstrap, feature(let_else))]
1111
#![feature(extern_types)]
1212
#![feature(once_cell)]
1313
#![feature(iter_intersperse)]

compiler/rustc_codegen_ssa/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
22
#![feature(box_patterns)]
33
#![feature(try_blocks)]
4-
#![feature(let_else)]
4+
#![cfg_attr(bootstrap, feature(let_else))]
55
#![feature(once_cell)]
66
#![feature(associated_type_bounds)]
77
#![feature(strict_provenance)]

0 commit comments

Comments
 (0)