From 879d143229d0d3ff80e7ee7573515f828859f525 Mon Sep 17 00:00:00 2001 From: Maybe Lapkin Date: Sun, 23 Jun 2024 21:55:41 +0200 Subject: [PATCH 1/6] Add `.ignore` file to make `config.toml` searchable in vscode --- .ignore | 2 ++ .reuse/dep5 | 1 + 2 files changed, 3 insertions(+) create mode 100644 .ignore diff --git a/.ignore b/.ignore new file mode 100644 index 0000000000000..40d1513978fc6 --- /dev/null +++ b/.ignore @@ -0,0 +1,2 @@ +# Make vscode *not* count `config.toml` as ignored, so it is included in search +!/config.toml diff --git a/.reuse/dep5 b/.reuse/dep5 index 06afec2b3faec..7b9365a5e48f7 100644 --- a/.reuse/dep5 +++ b/.reuse/dep5 @@ -35,6 +35,7 @@ Files: compiler/* .gitignore .gitmodules .mailmap + .ignore Copyright: The Rust Project Developers (see https://thanks.rust-lang.org) License: MIT or Apache-2.0 From 39bf1dcce5b0e80fbdbcde30e618821f5c9b0bf0 Mon Sep 17 00:00:00 2001 From: Pavel Grigorenko Date: Mon, 24 Jun 2024 17:57:58 +0300 Subject: [PATCH 2/6] Small fixme in core now that split_first has no codegen issues --- library/core/src/num/dec2flt/common.rs | 4 +--- library/core/src/num/dec2flt/parse.rs | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/library/core/src/num/dec2flt/common.rs b/library/core/src/num/dec2flt/common.rs index 11a626485191c..c85727b493816 100644 --- a/library/core/src/num/dec2flt/common.rs +++ b/library/core/src/num/dec2flt/common.rs @@ -39,9 +39,7 @@ impl ByteSlice for [u8] { fn parse_digits(&self, mut func: impl FnMut(u8)) -> &Self { let mut s = self; - // FIXME: Can't use s.split_first() here yet, - // see https://github.com/rust-lang/rust/issues/109328 - while let [c, s_next @ ..] = s { + while let Some((c, s_next)) = s.split_first() { let c = c.wrapping_sub(b'0'); if c < 10 { func(c); diff --git a/library/core/src/num/dec2flt/parse.rs b/library/core/src/num/dec2flt/parse.rs index b0a23835c5bd4..975bb8ad6bc1f 100644 --- a/library/core/src/num/dec2flt/parse.rs +++ b/library/core/src/num/dec2flt/parse.rs @@ -51,9 +51,7 @@ fn try_parse_19digits(s_ref: &mut &[u8], x: &mut u64) { let mut s = *s_ref; while *x < MIN_19DIGIT_INT { - // FIXME: Can't use s.split_first() here yet, - // see https://github.com/rust-lang/rust/issues/109328 - if let [c, s_next @ ..] = s { + if let Some((c, s_next)) = s.split_first() { let digit = c.wrapping_sub(b'0'); if digit < 10 { From 64b3492c30eaa3a963ed87a3c306f2cb29baa5b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Sat, 29 Jun 2024 13:51:50 +0200 Subject: [PATCH 3/6] Rename Rust for Linux CI job to make its name clearer --- .../{rfl => x86_64-rust-for-linux}/Dockerfile | 0 src/ci/github-actions/jobs.yml | 10 +++++----- 2 files changed, 5 insertions(+), 5 deletions(-) rename src/ci/docker/host-x86_64/{rfl => x86_64-rust-for-linux}/Dockerfile (100%) diff --git a/src/ci/docker/host-x86_64/rfl/Dockerfile b/src/ci/docker/host-x86_64/x86_64-rust-for-linux/Dockerfile similarity index 100% rename from src/ci/docker/host-x86_64/rfl/Dockerfile rename to src/ci/docker/host-x86_64/x86_64-rust-for-linux/Dockerfile diff --git a/src/ci/github-actions/jobs.yml b/src/ci/github-actions/jobs.yml index cf750bbd0c568..a6e12c6ff954d 100644 --- a/src/ci/github-actions/jobs.yml +++ b/src/ci/github-actions/jobs.yml @@ -215,6 +215,11 @@ auto: only_on_channel: nightly <<: *job-linux-8c + # Tests integration with Rust for Linux. + # Builds stage 1 compiler and tries to compile a few RfL examples with it. + - image: x86_64-rust-for-linux + <<: *job-linux-8c + - image: x86_64-gnu <<: *job-linux-4c @@ -465,8 +470,3 @@ auto: RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-extended --enable-profiler SCRIPT: python x.py dist bootstrap --include-default-paths <<: *job-windows-8c - - # Tests integration with Rust for Linux. - # Builds stage 1 compiler and tries to compile a few RfL examples with it. - - image: rfl - <<: *job-linux-8c From 28ba5e4124659107bd0ed08ba5c480d0e71c3aa1 Mon Sep 17 00:00:00 2001 From: Askar Safin Date: Wed, 19 Jun 2024 21:19:20 +0300 Subject: [PATCH 4/6] Updated docs on `#[panic_handler]` in `library/core/src/lib.rs` --- library/core/src/lib.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs index ef28bc99c4fc8..4bc0e37800ed5 100644 --- a/library/core/src/lib.rs +++ b/library/core/src/lib.rs @@ -34,12 +34,9 @@ //! Rust user code is to call the functions provided by this library instead (such as //! `ptr::copy`). //! -//! * `rust_begin_panic` - This function takes four arguments, a -//! `fmt::Arguments`, a `&'static str`, and two `u32`'s. These four arguments -//! dictate the panic message, the file at which panic was invoked, and the -//! line and column inside the file. It is up to consumers of this core +//! * Panic handler - This function takes one argument, a `&panic::PanicInfo`. It is up to consumers of this core //! library to define this panic function; it is only required to never -//! return. This requires a `lang` attribute named `panic_impl`. +//! return. You should mark your implementation using `#[panic_handler]`. //! //! * `rust_eh_personality` - is used by the failure mechanisms of the //! compiler. This is often mapped to GCC's personality function, but crates From e52d95bc823fc27d7f69f7aab980b278a6772a0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Sat, 29 Jun 2024 22:09:58 +0200 Subject: [PATCH 5/6] Remove unused compiler dependencies --- Cargo.lock | 4 ---- compiler/rustc_trait_selection/Cargo.toml | 4 ---- 2 files changed, 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0182eca05058d..16ed81bcd3897 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4752,8 +4752,6 @@ checksum = "8ba09476327c4b70ccefb6180f046ef588c26a24cf5d269a9feba316eb4f029f" name = "rustc_trait_selection" version = "0.0.0" dependencies = [ - "bitflags 2.5.0", - "derivative", "itertools", "rustc_ast", "rustc_ast_ir", @@ -4762,7 +4760,6 @@ dependencies = [ "rustc_errors", "rustc_fluent_macro", "rustc_hir", - "rustc_index", "rustc_infer", "rustc_macros", "rustc_middle", @@ -4775,7 +4772,6 @@ dependencies = [ "rustc_target", "rustc_transmute", "rustc_type_ir", - "rustc_type_ir_macros", "smallvec", "tracing", ] diff --git a/compiler/rustc_trait_selection/Cargo.toml b/compiler/rustc_trait_selection/Cargo.toml index 1f4fb57d996cc..f023a0eb53aeb 100644 --- a/compiler/rustc_trait_selection/Cargo.toml +++ b/compiler/rustc_trait_selection/Cargo.toml @@ -5,8 +5,6 @@ edition = "2021" [dependencies] # tidy-alphabetical-start -bitflags = "2.4.1" -derivative = "2.2.0" itertools = "0.12" rustc_ast = { path = "../rustc_ast" } rustc_ast_ir = { path = "../rustc_ast_ir" } @@ -15,7 +13,6 @@ rustc_data_structures = { path = "../rustc_data_structures" } rustc_errors = { path = "../rustc_errors" } rustc_fluent_macro = { path = "../rustc_fluent_macro" } rustc_hir = { path = "../rustc_hir" } -rustc_index = { path = "../rustc_index" } rustc_infer = { path = "../rustc_infer" } rustc_macros = { path = "../rustc_macros" } rustc_middle = { path = "../rustc_middle" } @@ -28,7 +25,6 @@ rustc_span = { path = "../rustc_span" } rustc_target = { path = "../rustc_target" } rustc_transmute = { path = "../rustc_transmute", features = ["rustc"] } rustc_type_ir = { path = "../rustc_type_ir" } -rustc_type_ir_macros = { path = "../rustc_type_ir_macros" } smallvec = { version = "1.8.1", features = ["union", "may_dangle"] } tracing = "0.1" # tidy-alphabetical-end From 682e7c1174161c6e4e48a50e188e09f2dec80712 Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Sat, 29 Jun 2024 16:14:34 -0400 Subject: [PATCH 6/6] Print `TypeId` as a `u128` for `Debug` Since , `TypeId` is represented as a `(u64, u64)`. This also made the debug implementation a lot larger, which is especially apparent with pretty formatting. Make this less noisy by converting the inner value back to a `u128` then printing as a tuple struct. Current: TypeId { t: (1403077013027291752, 4518903163082958039) } TypeId { t: ( 1403077013027291752, 4518903163082958039, ), } New: TypeId(25882202575019293479932656973818029271) TypeId( 25882202575019293479932656973818029271, ) --- library/core/src/any.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/library/core/src/any.rs b/library/core/src/any.rs index 37cb8e7d303af..eab11ae288a95 100644 --- a/library/core/src/any.rs +++ b/library/core/src/any.rs @@ -602,7 +602,7 @@ impl dyn Any + Send + Sync { /// While `TypeId` implements `Hash`, `PartialOrd`, and `Ord`, it is worth /// noting that the hashes and ordering will vary between Rust releases. Beware /// of relying on them inside of your code! -#[derive(Clone, Copy, Debug, Eq, PartialOrd, Ord)] +#[derive(Clone, Copy, Eq, PartialOrd, Ord)] #[stable(feature = "rust1", since = "1.0.0")] pub struct TypeId { // We avoid using `u128` because that imposes higher alignment requirements on many platforms. @@ -644,6 +644,10 @@ impl TypeId { let t2 = t as u64; TypeId { t: (t1, t2) } } + + fn as_u128(self) -> u128 { + u128::from(self.t.0) << 64 | u128::from(self.t.1) + } } #[stable(feature = "rust1", since = "1.0.0")] @@ -666,6 +670,13 @@ impl hash::Hash for TypeId { } } +#[stable(feature = "rust1", since = "1.0.0")] +impl fmt::Debug for TypeId { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> { + f.debug_tuple("TypeId").field(&self.as_u128()).finish() + } +} + /// Returns the name of a type as a string slice. /// /// # Note