Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
aab1563
`impl PartialEq<{str,String}> for {Path,PathBuf}`
Kixunil Dec 18, 2022
964eb82
Stabilize `ip_from`
GrigorenkoPV May 29, 2025
06ae1be
Make doc for transpose api better
chenyukang Jun 22, 2025
a067c6a
refactor `unreachable/expr_cast.rs` test
WaffleLapkin Jun 1, 2025
d2e133d
don't warn on explicit casts of never to any
WaffleLapkin Jun 1, 2025
3a993a6
Ignore sleep_until test on SGX
raoulstrackx Aug 5, 2025
4e2d420
avoid duplicate error string
lcnr Aug 7, 2025
d62e857
also consider HR bounds
lcnr Aug 7, 2025
a95a2ac
rework `add_placeholder_from_predicate_note`
lcnr Aug 7, 2025
5c716bd
add comment
lcnr Aug 7, 2025
3ebf611
it's not a borrow checker limitation :<
lcnr Aug 13, 2025
8d0a049
Declare module `rustc_codegen_llvm::back` in the normal way
Zalathar Aug 15, 2025
44f5ec7
Avoid an explicit cast from `*const c_uchar` to `*const c_char`
Zalathar Aug 15, 2025
61932e1
Avoid an unnecessary intermediate `&mut` reference
Zalathar Aug 15, 2025
9e7d066
Simplify the `args_cstr_buff` assertion
Zalathar Aug 15, 2025
8511e40
rustdoc-search: search backend with partitioned suffix tree
notriddle Nov 22, 2024
cf8ec67
Remove `LlvmArchiveBuilder` and supporting code/bindings
Zalathar Aug 16, 2025
ddf39ca
Avoid copying rustc rmeta artifacts into the build compiler sysroot
Kobzol Aug 16, 2025
70e26c1
take attr style into account in attr diagnostics
jdonszelmann Aug 11, 2025
814b8e6
Only check std in cross-compilation instead of building it
Kobzol Aug 16, 2025
4335405
overhaul `&mut` suggestions in borrowck errors
fee1-dead Aug 6, 2025
e78b417
refactor return type of `suggest_ampmut` into an enum
fee1-dead Aug 16, 2025
3ef065b
Implement the #[sanitize(..)] attribute
1c3t3a Jun 18, 2025
95bdb34
Remove the no_sanitize attribute in favor of sanitize
1c3t3a Jun 18, 2025
22519d3
Do not overwrite the value of `RUSTC_ADDITIONAL_SYSROOT_PATHS`
Kobzol Aug 18, 2025
4668751
Print what bootstrap invocation failed when an error happens in CI
Kobzol Aug 18, 2025
a1f5bbe
Provide more useful command creation spans
Kobzol Aug 18, 2025
a6a760e
Remove the `From` derive macro from prelude
Kobzol Aug 18, 2025
c6db6f2
comment style changes
fee1-dead Aug 18, 2025
79a40c9
rustdoc: add rustdoc top bar web component
notriddle Aug 18, 2025
704cb8f
interpret: avoid forcing all integer newtypes into memory during clea…
RalfJung Aug 18, 2025
79d3006
cleanup: make run-make test use run_in_tmpdir
durin42 Aug 14, 2025
9d08596
tests: fix RISC-V failures and adjust transmute-scalar.rs target
Jul 28, 2025
4c21251
Fix uplifting in `Assemble` step
Kobzol Aug 18, 2025
533ecdb
Assume UTF-8 in sysroot paths
Kobzol Aug 18, 2025
2beb54c
Rollup merge of #140956 - Kixunil:impl-partialeq-str-for-path, r=Amanieu
Zalathar Aug 19, 2025
027c7a5
Rollup merge of #141744 - GrigorenkoPV:ip_from, r=Amanieu
Zalathar Aug 19, 2025
633cc0c
Rollup merge of #142681 - 1c3t3a:sanitize-off-on, r=rcvalle
Zalathar Aug 19, 2025
0671b2f
Rollup merge of #142871 - chenyukang:yukang-fix-doc-for-transpose, r=…
Zalathar Aug 19, 2025
b9fdc6b
Rollup merge of #144252 - Kobzol:rmeta-sysroot, r=jieyouxu
Zalathar Aug 19, 2025
d6645f7
Rollup merge of #144476 - notriddle:notriddle/stringdex, r=lolbinaryc…
Zalathar Aug 19, 2025
3a03bb9
Rollup merge of #144567 - CaiWeiran:transmute-scalar_test, r=nikic
Zalathar Aug 19, 2025
cff7ed1
Rollup merge of #144804 - WaffleLapkin:reach-for-the-casts, r=compile…
Zalathar Aug 19, 2025
d0fa5c7
Rollup merge of #144960 - raoulstrackx:raoul/rte-513-disable_sleep_te…
Zalathar Aug 19, 2025
181480d
Rollup merge of #145013 - fee1-dead-contrib:push-vwvsqsqnrxqm, r=nnet…
Zalathar Aug 19, 2025
f3f1847
Rollup merge of #145041 - lcnr:borrowck-limitations-error, r=BoxyUwU
Zalathar Aug 19, 2025
11c6d89
Rollup merge of #145243 - jdonszelmann:inner-attr-errors, r=petrochenkov
Zalathar Aug 19, 2025
02848e7
Rollup merge of #145405 - durin42:test-cleanup-tmpdir, r=lqd
Zalathar Aug 19, 2025
8945924
Rollup merge of #145432 - Zalathar:target-machine, r=wesleywiser
Zalathar Aug 19, 2025
8748d8e
Rollup merge of #145484 - Zalathar:archive-builder, r=bjorn3
Zalathar Aug 19, 2025
cf2f50e
Rollup merge of #145557 - Kobzol:rustc-link-fix, r=jieyouxu
Zalathar Aug 19, 2025
f44f963
Rollup merge of #145563 - Kobzol:remove-from-from-prelude, r=petroche…
Zalathar Aug 19, 2025
3ced940
Rollup merge of #145565 - Kobzol:bootstrap-ci-print-error, r=jieyouxu
Zalathar Aug 19, 2025
531ec85
Rollup merge of #145584 - RalfJung:interpret-clear-provenance, r=comp…
Zalathar Aug 19, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove the From derive macro from prelude
To avoid backwards compatibility problems.
  • Loading branch information
Kobzol committed Aug 18, 2025
commit a6a760edaf16d4b00ab4d3c607f6d85a6d193c0b
7 changes: 7 additions & 0 deletions library/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,13 @@ pub mod assert_matches {
pub use crate::macros::{assert_matches, debug_assert_matches};
}

#[unstable(feature = "derive_from", issue = "144889")]
/// Unstable module containing the unstable `From` derive macro.
pub mod from {
#[unstable(feature = "derive_from", issue = "144889")]
pub use crate::macros::builtin::From;
}

// We don't export this through #[macro_export] for now, to avoid breakage.
#[unstable(feature = "autodiff", issue = "124509")]
/// Unstable module containing the unstable `autodiff` macro.
Expand Down
7 changes: 0 additions & 7 deletions library/core/src/prelude/v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,3 @@ pub use crate::macros::builtin::deref;
reason = "`type_alias_impl_trait` has open design concerns"
)]
pub use crate::macros::builtin::define_opaque;

#[unstable(
feature = "derive_from",
issue = "144889",
reason = "`derive(From)` is unstable"
)]
pub use crate::macros::builtin::From;
8 changes: 8 additions & 0 deletions library/std/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -737,6 +737,14 @@ pub use core::{
unreachable, write, writeln,
};

// Re-export unstable derive macro defined through core.
#[unstable(feature = "derive_from", issue = "144889")]
/// Unstable module containing the unstable `From` derive macro.
pub mod from {
#[unstable(feature = "derive_from", issue = "144889")]
pub use core::from::From;
}

// Include a number of private modules that exist solely to provide
// the rustdoc documentation for primitive types. Using `include!`
// because rustdoc only looks for these modules at the crate level.
Expand Down
18 changes: 15 additions & 3 deletions tests/ui/deriving/deriving-all-codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
#![allow(deprecated)]
#![feature(derive_from)]

use std::from::From;

// Empty struct.
#[derive(Clone, Copy, Debug, Default, Hash, PartialEq, Eq, PartialOrd, Ord)]
struct Empty;
Expand Down Expand Up @@ -51,7 +53,14 @@ struct SingleField {
// `clone` implemention that just does `*self`.
#[derive(Clone, Copy, Debug, Default, Hash, PartialEq, Eq, PartialOrd, Ord)]
struct Big {
b1: u32, b2: u32, b3: u32, b4: u32, b5: u32, b6: u32, b7: u32, b8: u32,
b1: u32,
b2: u32,
b3: u32,
b4: u32,
b5: u32,
b6: u32,
b7: u32,
b8: u32,
}

// It is more efficient to compare scalar types before non-scalar types.
Expand Down Expand Up @@ -126,7 +135,7 @@ enum Enum0 {}
// A single-variant enum.
#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
enum Enum1 {
Single { x: u32 }
Single { x: u32 },
}

// A C-like, fieldless enum with a single variant.
Expand All @@ -152,7 +161,10 @@ enum Mixed {
P,
Q,
R(u32),
S { d1: Option<u32>, d2: Option<i32> },
S {
d1: Option<u32>,
d2: Option<i32>,
},
}

// When comparing enum variant it is more efficient to compare scalar types before non-scalar types.
Expand Down
2 changes: 2 additions & 0 deletions tests/ui/deriving/deriving-all-codegen.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ extern crate std;
#[prelude_import]
use std::prelude::rust_2021::*;

use std::from::From;

// Empty struct.
struct Empty;
#[automatically_derived]
Expand Down
3 changes: 2 additions & 1 deletion tests/ui/deriving/deriving-from-wrong-target.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
//@ edition: 2021
//@ check-fail

#![feature(derive_from)]
#![allow(dead_code)]

use std::from::From;

#[derive(From)]
//~^ ERROR `#[derive(From)]` used on a struct with no fields
struct S1;
Expand Down
18 changes: 9 additions & 9 deletions tests/ui/deriving/deriving-from-wrong-target.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: `#[derive(From)]` used on a struct with no fields
--> $DIR/deriving-from-wrong-target.rs:7:10
--> $DIR/deriving-from-wrong-target.rs:8:10
|
LL | #[derive(From)]
| ^^^^
Expand All @@ -10,7 +10,7 @@ LL | struct S1;
= note: `#[derive(From)]` can only be used on structs with exactly one field

error: `#[derive(From)]` used on a struct with no fields
--> $DIR/deriving-from-wrong-target.rs:11:10
--> $DIR/deriving-from-wrong-target.rs:12:10
|
LL | #[derive(From)]
| ^^^^
Expand All @@ -21,7 +21,7 @@ LL | struct S2 {}
= note: `#[derive(From)]` can only be used on structs with exactly one field

error: `#[derive(From)]` used on a struct with multiple fields
--> $DIR/deriving-from-wrong-target.rs:15:10
--> $DIR/deriving-from-wrong-target.rs:16:10
|
LL | #[derive(From)]
| ^^^^
Expand All @@ -32,7 +32,7 @@ LL | struct S3(u32, bool);
= note: `#[derive(From)]` can only be used on structs with exactly one field

error: `#[derive(From)]` used on a struct with multiple fields
--> $DIR/deriving-from-wrong-target.rs:19:10
--> $DIR/deriving-from-wrong-target.rs:20:10
|
LL | #[derive(From)]
| ^^^^
Expand All @@ -43,7 +43,7 @@ LL | struct S4 {
= note: `#[derive(From)]` can only be used on structs with exactly one field

error: `#[derive(From)]` used on an enum
--> $DIR/deriving-from-wrong-target.rs:26:10
--> $DIR/deriving-from-wrong-target.rs:27:10
|
LL | #[derive(From)]
| ^^^^
Expand All @@ -54,7 +54,7 @@ LL | enum E1 {}
= note: `#[derive(From)]` can only be used on structs with exactly one field

error[E0277]: the size for values of type `T` cannot be known at compilation time
--> $DIR/deriving-from-wrong-target.rs:30:10
--> $DIR/deriving-from-wrong-target.rs:31:10
|
LL | #[derive(From)]
| ^^^^ doesn't have a size known at compile-time
Expand All @@ -71,7 +71,7 @@ LL + struct SUnsizedField<T> {
|

error[E0277]: the size for values of type `T` cannot be known at compilation time
--> $DIR/deriving-from-wrong-target.rs:30:10
--> $DIR/deriving-from-wrong-target.rs:31:10
|
LL | #[derive(From)]
| ^^^^ doesn't have a size known at compile-time
Expand All @@ -80,7 +80,7 @@ LL | struct SUnsizedField<T: ?Sized> {
| - this type parameter needs to be `Sized`
|
note: required because it appears within the type `SUnsizedField<T>`
--> $DIR/deriving-from-wrong-target.rs:33:8
--> $DIR/deriving-from-wrong-target.rs:34:8
|
LL | struct SUnsizedField<T: ?Sized> {
| ^^^^^^^^^^^^^
Expand All @@ -92,7 +92,7 @@ LL + struct SUnsizedField<T> {
|

error[E0277]: the size for values of type `T` cannot be known at compilation time
--> $DIR/deriving-from-wrong-target.rs:34:11
--> $DIR/deriving-from-wrong-target.rs:35:11
|
LL | struct SUnsizedField<T: ?Sized> {
| - this type parameter needs to be `Sized`
Expand Down
2 changes: 2 additions & 0 deletions tests/ui/deriving/deriving-from.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

#![feature(derive_from)]

use core::from::From;

#[derive(From)]
struct TupleSimple(u32);

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/feature-gates/feature-gate-derive-from.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//@ edition: 2021
use std::from::From; //~ ERROR use of unstable library feature `derive_from

#[derive(From)] //~ ERROR use of unstable library feature `derive_from`
struct Foo(u32);
Expand Down
12 changes: 11 additions & 1 deletion tests/ui/feature-gates/feature-gate-derive-from.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@ LL | #[derive(From)]
= help: add `#![feature(derive_from)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error: aborting due to 1 previous error
error[E0658]: use of unstable library feature `derive_from`
--> $DIR/feature-gate-derive-from.rs:1:5
|
LL | use std::from::From;
| ^^^^^^^^^^^^^^^
|
= note: see issue #144889 <https://github.com/rust-lang/rust/issues/144889> for more information
= help: add `#![feature(derive_from)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0658`.
Loading