about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock1
-rw-r--r--compiler/rustc_const_eval/src/lib.rs1
-rw-r--r--compiler/rustc_expand/src/mbe/quoted.rs19
-rw-r--r--compiler/rustc_hir_typeck/src/lib.rs1
-rw-r--r--compiler/rustc_interface/src/lib.rs1
-rw-r--r--compiler/rustc_middle/src/ty/consts.rs4
-rw-r--r--library/core/src/option.rs4
-rw-r--r--library/std/src/thread/mod.rs3
-rw-r--r--src/tools/miri/src/lib.rs1
-rw-r--r--src/tools/run-make-support/Cargo.toml1
-rw-r--r--src/tools/run-make-support/src/lib.rs1
-rw-r--r--src/tools/rust-analyzer/crates/hir-ty/src/display.rs2
-rw-r--r--tests/debuginfo/pretty-huge-vec.rs1
-rw-r--r--tests/debuginfo/pretty-std-collections.rs1
-rw-r--r--tests/debuginfo/pretty-std.rs1
-rw-r--r--tests/debuginfo/pretty-uninitialized-vec.rs1
-rw-r--r--tests/run-make/rustdoc-map-file/rmake.rs47
-rwxr-xr-xtests/run-make/rustdoc-map-file/validate_json.py41
-rw-r--r--tests/ui/const-generics/adt_const_params/116308.rs (renamed from tests/crashes/116308.rs)4
-rw-r--r--tests/ui/macros/macro-match-nonterminal.stderr12
20 files changed, 76 insertions, 71 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 1aa0b2ea4a3..0b546d6e5ee 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -3149,6 +3149,7 @@ dependencies = [
  "gimli 0.31.0",
  "object 0.36.2",
  "regex",
+ "serde_json",
  "similar",
  "wasmparser 0.214.0",
 ]
diff --git a/compiler/rustc_const_eval/src/lib.rs b/compiler/rustc_const_eval/src/lib.rs
index 780404212c3..d825a47bfdf 100644
--- a/compiler/rustc_const_eval/src/lib.rs
+++ b/compiler/rustc_const_eval/src/lib.rs
@@ -6,7 +6,6 @@
 #![feature(box_patterns)]
 #![feature(decl_macro)]
 #![feature(if_let_guard)]
-#![feature(is_none_or)]
 #![feature(let_chains)]
 #![feature(never_type)]
 #![feature(rustdoc_internals)]
diff --git a/compiler/rustc_expand/src/mbe/quoted.rs b/compiler/rustc_expand/src/mbe/quoted.rs
index e5a1c6c7899..b2f7c8f5183 100644
--- a/compiler/rustc_expand/src/mbe/quoted.rs
+++ b/compiler/rustc_expand/src/mbe/quoted.rs
@@ -54,18 +54,24 @@ pub(super) fn parse(
 
     // For each token tree in `input`, parse the token into a `self::TokenTree`, consuming
     // additional trees if need be.
-    let mut trees = input.trees();
+    let mut trees = input.trees().peekable();
     while let Some(tree) = trees.next() {
         // Given the parsed tree, if there is a metavar and we are expecting matchers, actually
         // parse out the matcher (i.e., in `$id:ident` this would parse the `:` and `ident`).
         let tree = parse_tree(tree, &mut trees, parsing_patterns, sess, node_id, features, edition);
         match tree {
             TokenTree::MetaVar(start_sp, ident) if parsing_patterns => {
-                let span = match trees.next() {
+                // Not consuming the next token immediately, as it may not be a colon
+                let span = match trees.peek() {
                     Some(&tokenstream::TokenTree::Token(
                         Token { kind: token::Colon, span: colon_span },
                         _,
                     )) => {
+                        // Consume the colon first
+                        trees.next();
+
+                        // It's ok to consume the next tree no matter how,
+                        // since if it's not a token then it will be an invalid declaration.
                         match trees.next() {
                             Some(tokenstream::TokenTree::Token(token, _)) => match token.ident() {
                                 Some((fragment, _)) => {
@@ -125,12 +131,13 @@ pub(super) fn parse(
                                 }
                                 _ => token.span,
                             },
-                            Some(tree) => tree.span(),
-                            None => colon_span,
+                            // Invalid, return a nice source location
+                            _ => colon_span.with_lo(start_sp.lo()),
                         }
                     }
-                    Some(tree) => tree.span(),
-                    None => start_sp,
+                    // Whether it's none or some other tree, it doesn't belong to
+                    // the current meta variable, returning the original span.
+                    _ => start_sp,
                 };
 
                 result.push(TokenTree::MetaVarDecl(span, ident, None));
diff --git a/compiler/rustc_hir_typeck/src/lib.rs b/compiler/rustc_hir_typeck/src/lib.rs
index 758a1cefe63..9ec101196a4 100644
--- a/compiler/rustc_hir_typeck/src/lib.rs
+++ b/compiler/rustc_hir_typeck/src/lib.rs
@@ -5,7 +5,6 @@
 #![feature(box_patterns)]
 #![feature(control_flow_enum)]
 #![feature(if_let_guard)]
-#![feature(is_none_or)]
 #![feature(let_chains)]
 #![feature(never_type)]
 #![feature(try_blocks)]
diff --git a/compiler/rustc_interface/src/lib.rs b/compiler/rustc_interface/src/lib.rs
index e37b30749ab..3492df69b8d 100644
--- a/compiler/rustc_interface/src/lib.rs
+++ b/compiler/rustc_interface/src/lib.rs
@@ -1,7 +1,6 @@
 // tidy-alphabetical-start
 #![feature(decl_macro)]
 #![feature(let_chains)]
-#![feature(thread_spawn_unchecked)]
 #![feature(try_blocks)]
 // tidy-alphabetical-end
 
diff --git a/compiler/rustc_middle/src/ty/consts.rs b/compiler/rustc_middle/src/ty/consts.rs
index c380019e63f..e373292741b 100644
--- a/compiler/rustc_middle/src/ty/consts.rs
+++ b/compiler/rustc_middle/src/ty/consts.rs
@@ -305,6 +305,10 @@ impl<'tcx> Const<'tcx> {
             // mir.
             match tcx.at(expr.span).lit_to_const(lit_input) {
                 Ok(c) => return Some(c),
+                Err(_) if lit_input.ty.has_aliases() => {
+                    // allow the `ty` to be an alias type, though we cannot handle it here
+                    return None;
+                }
                 Err(e) => {
                     tcx.dcx().span_delayed_bug(
                         expr.span,
diff --git a/library/core/src/option.rs b/library/core/src/option.rs
index 9cec79c17ca..50cb22b7eb3 100644
--- a/library/core/src/option.rs
+++ b/library/core/src/option.rs
@@ -656,8 +656,6 @@ impl<T> Option<T> {
     /// # Examples
     ///
     /// ```
-    /// #![feature(is_none_or)]
-    ///
     /// let x: Option<u32> = Some(2);
     /// assert_eq!(x.is_none_or(|x| x > 1), true);
     ///
@@ -669,7 +667,7 @@ impl<T> Option<T> {
     /// ```
     #[must_use]
     #[inline]
-    #[unstable(feature = "is_none_or", issue = "126383")]
+    #[stable(feature = "is_none_or", since = "CURRENT_RUSTC_VERSION")]
     pub fn is_none_or(self, f: impl FnOnce(T) -> bool) -> bool {
         match self {
             None => true,
diff --git a/library/std/src/thread/mod.rs b/library/std/src/thread/mod.rs
index 88b31cd78a6..e29c28f3c7e 100644
--- a/library/std/src/thread/mod.rs
+++ b/library/std/src/thread/mod.rs
@@ -412,7 +412,6 @@ impl Builder {
     /// # Examples
     ///
     /// ```
-    /// #![feature(thread_spawn_unchecked)]
     /// use std::thread;
     ///
     /// let builder = thread::Builder::new();
@@ -433,7 +432,7 @@ impl Builder {
     /// ```
     ///
     /// [`io::Result`]: crate::io::Result
-    #[unstable(feature = "thread_spawn_unchecked", issue = "55132")]
+    #[stable(feature = "thread_spawn_unchecked", since = "CURRENT_RUSTC_VERSION")]
     pub unsafe fn spawn_unchecked<F, T>(self, f: F) -> io::Result<JoinHandle<T>>
     where
         F: FnOnce() -> T,
diff --git a/src/tools/miri/src/lib.rs b/src/tools/miri/src/lib.rs
index 966d38508f6..7a11e353f9d 100644
--- a/src/tools/miri/src/lib.rs
+++ b/src/tools/miri/src/lib.rs
@@ -12,7 +12,6 @@
 #![feature(let_chains)]
 #![feature(trait_upcasting)]
 #![feature(strict_overflow_ops)]
-#![feature(is_none_or)]
 // Configure clippy and other lints
 #![allow(
     clippy::collapsible_else_if,
diff --git a/src/tools/run-make-support/Cargo.toml b/src/tools/run-make-support/Cargo.toml
index c4d5446a248..eae6022b803 100644
--- a/src/tools/run-make-support/Cargo.toml
+++ b/src/tools/run-make-support/Cargo.toml
@@ -11,3 +11,4 @@ wasmparser = { version = "0.214", default-features = false, features = ["std"] }
 regex = "1.8" # 1.8 to avoid memchr 2.6.0, as 2.5.0 is pinned in the workspace
 gimli = "0.31.0"
 build_helper = { path = "../build_helper" }
+serde_json = "1.0"
diff --git a/src/tools/run-make-support/src/lib.rs b/src/tools/run-make-support/src/lib.rs
index 4bef4f05007..fc20fd3b2e8 100644
--- a/src/tools/run-make-support/src/lib.rs
+++ b/src/tools/run-make-support/src/lib.rs
@@ -38,6 +38,7 @@ pub use bstr;
 pub use gimli;
 pub use object;
 pub use regex;
+pub use serde_json;
 pub use wasmparser;
 
 // Re-exports of external dependencies.
diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/display.rs b/src/tools/rust-analyzer/crates/hir-ty/src/display.rs
index 7c481958d1a..f406666ae5a 100644
--- a/src/tools/rust-analyzer/crates/hir-ty/src/display.rs
+++ b/src/tools/rust-analyzer/crates/hir-ty/src/display.rs
@@ -1462,7 +1462,7 @@ fn generic_args_sans_defaults<'ga>(
                     // otherwise, if the arg is equal to the param default, hide it (unless the
                     // default is an error which can happen for the trait Self type)
                     #[allow(unstable_name_collisions)]
-                    default_parameters.get(i).is_none_or(|default_parameter| {
+                    IsNoneOr::is_none_or(default_parameters.get(i), |default_parameter| {
                         // !is_err(default_parameter.skip_binders())
                         //     &&
                         arg != &default_parameter.clone().substitute(Interner, &parameters)
diff --git a/tests/debuginfo/pretty-huge-vec.rs b/tests/debuginfo/pretty-huge-vec.rs
index f4b5345b66d..dcf3521175d 100644
--- a/tests/debuginfo/pretty-huge-vec.rs
+++ b/tests/debuginfo/pretty-huge-vec.rs
@@ -1,5 +1,4 @@
 //@ ignore-windows failing on win32 bot
-//@ ignore-freebsd: gdb package too new
 //@ ignore-android: FIXME(#10381)
 //@ compile-flags:-g
 //@ min-gdb-version: 8.1
diff --git a/tests/debuginfo/pretty-std-collections.rs b/tests/debuginfo/pretty-std-collections.rs
index 7f518a886d7..3d5a30d19a9 100644
--- a/tests/debuginfo/pretty-std-collections.rs
+++ b/tests/debuginfo/pretty-std-collections.rs
@@ -1,5 +1,4 @@
 //@ ignore-windows failing on win32 bot
-//@ ignore-freebsd: gdb package too new
 //@ ignore-android: FIXME(#10381)
 //@ ignore-windows-gnu: #128981
 //@ compile-flags:-g
diff --git a/tests/debuginfo/pretty-std.rs b/tests/debuginfo/pretty-std.rs
index cb5c825bb72..933be977234 100644
--- a/tests/debuginfo/pretty-std.rs
+++ b/tests/debuginfo/pretty-std.rs
@@ -1,5 +1,4 @@
 // ignore-tidy-linelength
-//@ ignore-freebsd: gdb package too new
 //@ ignore-windows-gnu: #128981
 //@ ignore-android: FIXME(#10381)
 //@ compile-flags:-g
diff --git a/tests/debuginfo/pretty-uninitialized-vec.rs b/tests/debuginfo/pretty-uninitialized-vec.rs
index 225b4a6d534..5206ff23fd5 100644
--- a/tests/debuginfo/pretty-uninitialized-vec.rs
+++ b/tests/debuginfo/pretty-uninitialized-vec.rs
@@ -1,5 +1,4 @@
 //@ ignore-windows failing on win32 bot
-//@ ignore-freebsd: gdb package too new
 //@ ignore-android: FIXME(#10381)
 //@ compile-flags:-g
 //@ min-gdb-version: 8.1
diff --git a/tests/run-make/rustdoc-map-file/rmake.rs b/tests/run-make/rustdoc-map-file/rmake.rs
index a4485165fd2..d7e3510fe31 100644
--- a/tests/run-make/rustdoc-map-file/rmake.rs
+++ b/tests/run-make/rustdoc-map-file/rmake.rs
@@ -1,13 +1,54 @@
-use run_make_support::{python_command, rustdoc};
+// This test ensures that all items from `foo` are correctly generated into the `redirect-map.json`
+// file with `--generate-redirect-map` rustdoc option.
+
+use std::path::Path;
+
+use run_make_support::rfs::read_to_string;
+use run_make_support::{path, rustdoc, serde_json};
 
 fn main() {
     let out_dir = "out";
+    let crate_name = "foo";
     rustdoc()
         .input("foo.rs")
+        .crate_name(crate_name)
         .arg("-Zunstable-options")
         .arg("--generate-redirect-map")
         .out_dir(&out_dir)
         .run();
-    // FIXME (GuillaumeGomez): Port the python script to Rust as well.
-    python_command().arg("validate_json.py").arg(&out_dir).run();
+
+    let generated = read_to_string(path(out_dir).join(crate_name).join("redirect-map.json"));
+    let expected = read_to_string("expected.json");
+    let generated: serde_json::Value =
+        serde_json::from_str(&generated).expect("failed to parse JSON");
+    let expected: serde_json::Value =
+        serde_json::from_str(&expected).expect("failed to parse JSON");
+    let expected = expected.as_object().unwrap();
+
+    let mut differences = Vec::new();
+    for (key, expected_value) in expected.iter() {
+        match generated.get(key) {
+            Some(value) => {
+                if expected_value != value {
+                    differences.push(format!(
+                        "values for key `{key}` don't match: `{expected_value:?}` != `{value:?}`"
+                    ));
+                }
+            }
+            None => differences.push(format!("missing key `{key}`")),
+        }
+    }
+    for (key, data) in generated.as_object().unwrap().iter() {
+        if !expected.contains_key(key) {
+            differences.push(format!("Extra data not expected: key: `{key}`, data: `{data}`"));
+        }
+    }
+
+    if !differences.is_empty() {
+        eprintln!("Found differences in JSON files:");
+        for diff in differences {
+            eprintln!("=> {diff}");
+        }
+        panic!("Found differences in JSON files");
+    }
 }
diff --git a/tests/run-make/rustdoc-map-file/validate_json.py b/tests/run-make/rustdoc-map-file/validate_json.py
deleted file mode 100755
index 912dea3791b..00000000000
--- a/tests/run-make/rustdoc-map-file/validate_json.py
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/usr/bin/env python
-
-import os
-import sys
-import json
-
-
-def find_redirect_map_file(folder, errors):
-    for root, _dirs, files in os.walk(folder):
-        for name in files:
-            if not name.endswith("redirect-map.json"):
-                continue
-            with open(os.path.join(root, name)) as f:
-                data = json.load(f)
-            with open("expected.json") as f:
-                expected = json.load(f)
-            for key in expected:
-                if expected[key] != data.get(key):
-                    errors.append("Expected `{}` for key `{}`, found: `{}`".format(
-                        expected[key], key, data.get(key)))
-                else:
-                    del data[key]
-            for key in data:
-                errors.append("Extra data not expected: key: `{}`, data: `{}`".format(
-                    key, data[key]))
-            return True
-    return False
-
-
-if len(sys.argv) != 2:
-    print("Expected doc directory to check!")
-    sys.exit(1)
-
-errors = []
-if not find_redirect_map_file(sys.argv[1], errors):
-    print("Didn't find the map file in `{}`...".format(sys.argv[1]))
-    sys.exit(1)
-for err in errors:
-    print("=> {}".format(err))
-if len(errors) != 0:
-    sys.exit(1)
diff --git a/tests/crashes/116308.rs b/tests/ui/const-generics/adt_const_params/116308.rs
index cb96c80d79b..9ea7022e29c 100644
--- a/tests/crashes/116308.rs
+++ b/tests/ui/const-generics/adt_const_params/116308.rs
@@ -1,6 +1,8 @@
-//@ known-bug: #116308
+//@ check-pass
 #![feature(adt_const_params)]
 
+// Regression test for #116308
+
 pub trait Identity {
     type Identity;
 }
diff --git a/tests/ui/macros/macro-match-nonterminal.stderr b/tests/ui/macros/macro-match-nonterminal.stderr
index 831579c4fef..f221f92c3cd 100644
--- a/tests/ui/macros/macro-match-nonterminal.stderr
+++ b/tests/ui/macros/macro-match-nonterminal.stderr
@@ -1,14 +1,14 @@
 error: missing fragment specifier
-  --> $DIR/macro-match-nonterminal.rs:2:8
+  --> $DIR/macro-match-nonterminal.rs:2:6
    |
 LL |     ($a, $b) => {
-   |        ^
+   |      ^^
 
 error: missing fragment specifier
-  --> $DIR/macro-match-nonterminal.rs:2:8
+  --> $DIR/macro-match-nonterminal.rs:2:6
    |
 LL |     ($a, $b) => {
-   |        ^
+   |      ^^
    |
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
    = note: for more information, see issue #40107 <https://github.com/rust-lang/rust/issues/40107>
@@ -27,10 +27,10 @@ error: aborting due to 3 previous errors
 
 Future incompatibility report: Future breakage diagnostic:
 error: missing fragment specifier
-  --> $DIR/macro-match-nonterminal.rs:2:8
+  --> $DIR/macro-match-nonterminal.rs:2:6
    |
 LL |     ($a, $b) => {
-   |        ^
+   |      ^^
    |
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
    = note: for more information, see issue #40107 <https://github.com/rust-lang/rust/issues/40107>