Skip to content

Commit 506052d

Browse files
committed
Auto merge of rust-lang#129162 - matthiaskrgr:rollup-r0oxdev, r=matthiaskrgr
Rollup of 6 pull requests Successful merges: - rust-lang#128990 (Re-enable more debuginfo tests on freebsd) - rust-lang#129042 (Special-case alias ty during the delayed bug emission in `try_from_lit`) - rust-lang#129086 (Stabilize `is_none_or`) - rust-lang#129149 (Migrate `validate_json.py` script to rust in `run-make/rustdoc-map-file` test) - rust-lang#129154 (Fix wrong source location for some incorrect macro definitions) - rust-lang#129161 (Stabilize std::thread::Builder::spawn_unchecked) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 569d7e3 + a9bf86a commit 506052d

File tree

20 files changed

+76
-71
lines changed

20 files changed

+76
-71
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3149,6 +3149,7 @@ dependencies = [
31493149
"gimli 0.31.0",
31503150
"object 0.36.2",
31513151
"regex",
3152+
"serde_json",
31523153
"similar",
31533154
"wasmparser 0.214.0",
31543155
]

compiler/rustc_const_eval/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
#![feature(box_patterns)]
77
#![feature(decl_macro)]
88
#![feature(if_let_guard)]
9-
#![feature(is_none_or)]
109
#![feature(let_chains)]
1110
#![feature(never_type)]
1211
#![feature(rustdoc_internals)]

compiler/rustc_expand/src/mbe/quoted.rs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,18 +54,24 @@ pub(super) fn parse(
5454

5555
// For each token tree in `input`, parse the token into a `self::TokenTree`, consuming
5656
// additional trees if need be.
57-
let mut trees = input.trees();
57+
let mut trees = input.trees().peekable();
5858
while let Some(tree) = trees.next() {
5959
// Given the parsed tree, if there is a metavar and we are expecting matchers, actually
6060
// parse out the matcher (i.e., in `$id:ident` this would parse the `:` and `ident`).
6161
let tree = parse_tree(tree, &mut trees, parsing_patterns, sess, node_id, features, edition);
6262
match tree {
6363
TokenTree::MetaVar(start_sp, ident) if parsing_patterns => {
64-
let span = match trees.next() {
64+
// Not consuming the next token immediately, as it may not be a colon
65+
let span = match trees.peek() {
6566
Some(&tokenstream::TokenTree::Token(
6667
Token { kind: token::Colon, span: colon_span },
6768
_,
6869
)) => {
70+
// Consume the colon first
71+
trees.next();
72+
73+
// It's ok to consume the next tree no matter how,
74+
// since if it's not a token then it will be an invalid declaration.
6975
match trees.next() {
7076
Some(tokenstream::TokenTree::Token(token, _)) => match token.ident() {
7177
Some((fragment, _)) => {
@@ -125,12 +131,13 @@ pub(super) fn parse(
125131
}
126132
_ => token.span,
127133
},
128-
Some(tree) => tree.span(),
129-
None => colon_span,
134+
// Invalid, return a nice source location
135+
_ => colon_span.with_lo(start_sp.lo()),
130136
}
131137
}
132-
Some(tree) => tree.span(),
133-
None => start_sp,
138+
// Whether it's none or some other tree, it doesn't belong to
139+
// the current meta variable, returning the original span.
140+
_ => start_sp,
134141
};
135142

136143
result.push(TokenTree::MetaVarDecl(span, ident, None));

compiler/rustc_hir_typeck/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#![feature(box_patterns)]
66
#![feature(control_flow_enum)]
77
#![feature(if_let_guard)]
8-
#![feature(is_none_or)]
98
#![feature(let_chains)]
109
#![feature(never_type)]
1110
#![feature(try_blocks)]

compiler/rustc_interface/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// tidy-alphabetical-start
22
#![feature(decl_macro)]
33
#![feature(let_chains)]
4-
#![feature(thread_spawn_unchecked)]
54
#![feature(try_blocks)]
65
// tidy-alphabetical-end
76

compiler/rustc_middle/src/ty/consts.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,10 @@ impl<'tcx> Const<'tcx> {
305305
// mir.
306306
match tcx.at(expr.span).lit_to_const(lit_input) {
307307
Ok(c) => return Some(c),
308+
Err(_) if lit_input.ty.has_aliases() => {
309+
// allow the `ty` to be an alias type, though we cannot handle it here
310+
return None;
311+
}
308312
Err(e) => {
309313
tcx.dcx().span_delayed_bug(
310314
expr.span,

library/core/src/option.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -656,8 +656,6 @@ impl<T> Option<T> {
656656
/// # Examples
657657
///
658658
/// ```
659-
/// #![feature(is_none_or)]
660-
///
661659
/// let x: Option<u32> = Some(2);
662660
/// assert_eq!(x.is_none_or(|x| x > 1), true);
663661
///
@@ -669,7 +667,7 @@ impl<T> Option<T> {
669667
/// ```
670668
#[must_use]
671669
#[inline]
672-
#[unstable(feature = "is_none_or", issue = "126383")]
670+
#[stable(feature = "is_none_or", since = "CURRENT_RUSTC_VERSION")]
673671
pub fn is_none_or(self, f: impl FnOnce(T) -> bool) -> bool {
674672
match self {
675673
None => true,

library/std/src/thread/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,6 @@ impl Builder {
412412
/// # Examples
413413
///
414414
/// ```
415-
/// #![feature(thread_spawn_unchecked)]
416415
/// use std::thread;
417416
///
418417
/// let builder = thread::Builder::new();
@@ -433,7 +432,7 @@ impl Builder {
433432
/// ```
434433
///
435434
/// [`io::Result`]: crate::io::Result
436-
#[unstable(feature = "thread_spawn_unchecked", issue = "55132")]
435+
#[stable(feature = "thread_spawn_unchecked", since = "CURRENT_RUSTC_VERSION")]
437436
pub unsafe fn spawn_unchecked<F, T>(self, f: F) -> io::Result<JoinHandle<T>>
438437
where
439438
F: FnOnce() -> T,

src/tools/miri/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
#![feature(let_chains)]
1313
#![feature(trait_upcasting)]
1414
#![feature(strict_overflow_ops)]
15-
#![feature(is_none_or)]
1615
// Configure clippy and other lints
1716
#![allow(
1817
clippy::collapsible_else_if,

src/tools/run-make-support/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ wasmparser = { version = "0.214", default-features = false, features = ["std"] }
1111
regex = "1.8" # 1.8 to avoid memchr 2.6.0, as 2.5.0 is pinned in the workspace
1212
gimli = "0.31.0"
1313
build_helper = { path = "../build_helper" }
14+
serde_json = "1.0"

0 commit comments

Comments
 (0)