diff --git a/Cargo.lock b/Cargo.lock index ecadb737a0f..14429784fba 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -573,7 +573,7 @@ dependencies = [ [[package]] name = "cargo-util-schemas" -version = "0.14.0" +version = "0.13.1" dependencies = [ "jiff", "schemars", diff --git a/Cargo.toml b/Cargo.toml index 141de6ed099..b38a964620f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -36,7 +36,7 @@ cargo-platform = { path = "crates/cargo-platform", version = "0.3.3" } cargo-test-macro = { version = "0.4.10", path = "crates/cargo-test-macro" } cargo-test-support = { version = "0.11.2", path = "crates/cargo-test-support" } cargo-util = { version = "0.2.28", path = "crates/cargo-util" } -cargo-util-schemas = { version = "0.14.0", path = "crates/cargo-util-schemas" } +cargo-util-schemas = { version = "0.13.0", path = "crates/cargo-util-schemas" } cargo-util-terminal = { version = "0.1.0", path = "crates/cargo-util-terminal" } cargo_metadata = "0.23.1" clap = "4.6.0" diff --git a/crates/cargo-util-schemas/Cargo.toml b/crates/cargo-util-schemas/Cargo.toml index 94003480a6e..a205864220c 100644 --- a/crates/cargo-util-schemas/Cargo.toml +++ b/crates/cargo-util-schemas/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cargo-util-schemas" -version = "0.14.0" +version = "0.13.1" rust-version = "1.94" # MSRV:1 edition.workspace = true license.workspace = true diff --git a/crates/cargo-util-schemas/manifest.schema.json b/crates/cargo-util-schemas/manifest.schema.json index ae5f01c23c2..ec63f68ee0c 100644 --- a/crates/cargo-util-schemas/manifest.schema.json +++ b/crates/cargo-util-schemas/manifest.schema.json @@ -1437,13 +1437,6 @@ "null" ], "default": null - }, - "frame-pointers": { - "type": [ - "string", - "null" - ], - "default": null } } }, diff --git a/crates/cargo-util-schemas/src/manifest/mod.rs b/crates/cargo-util-schemas/src/manifest/mod.rs index 2e329820303..c08ea423d62 100644 --- a/crates/cargo-util-schemas/src/manifest/mod.rs +++ b/crates/cargo-util-schemas/src/manifest/mod.rs @@ -941,7 +941,6 @@ pub struct TomlProfile { pub trim_paths: Option, /// Unstable feature `hint-mostly-unused` pub hint_mostly_unused: Option, - pub frame_pointers: Option, } impl TomlProfile { @@ -1037,10 +1036,6 @@ impl TomlProfile { if let Some(v) = profile.hint_mostly_unused { self.hint_mostly_unused = Some(v); } - - if let Some(v) = &profile.frame_pointers { - self.frame_pointers = Some(v.clone()); - } } } diff --git a/src/cargo/core/compiler/mod.rs b/src/cargo/core/compiler/mod.rs index d5e91df5601..a3178cb40ab 100644 --- a/src/cargo/core/compiler/mod.rs +++ b/src/cargo/core/compiler/mod.rs @@ -103,7 +103,7 @@ pub use crate::core::compiler::unit::Unit; pub use crate::core::compiler::unit::UnitIndex; pub use crate::core::compiler::unit::UnitInterner; use crate::core::manifest::TargetSourcePath; -use crate::core::profiles::{FramePointers, PanicStrategy, Profile, StripInner}; +use crate::core::profiles::{PanicStrategy, Profile, StripInner}; use crate::core::{Feature, PackageId, Target}; use crate::lints::get_key_value; use crate::util::OnceExt; @@ -1232,7 +1232,6 @@ fn build_base_args( rustflags: profile_rustflags, trim_paths, hint_mostly_unused: profile_hint_mostly_unused, - frame_pointers, .. } = unit.profile.clone(); let hints = unit.pkg.hints().cloned().unwrap_or_default(); @@ -1455,14 +1454,6 @@ fn build_base_args( cmd.arg("-C").arg(format!("strip={}", strip)); } - if let Some(frame_pointers) = frame_pointers { - let val = match frame_pointers { - FramePointers::ForceOn => "on", - FramePointers::ForceOff => "off", - }; - cmd.arg("-C").arg(format!("force-frame-pointers={}", val)); - } - if unit.is_std { // -Zforce-unstable-if-unmarked prevents the accidental use of // unstable crates within the sysroot (such as "extern crate libc" or diff --git a/src/cargo/core/profiles.rs b/src/cargo/core/profiles.rs index 12004981304..5319656836d 100644 --- a/src/cargo/core/profiles.rs +++ b/src/cargo/core/profiles.rs @@ -581,15 +581,6 @@ fn merge_profile(profile: &mut Profile, toml: &TomlProfile) { if let Some(hint_mostly_unused) = toml.hint_mostly_unused { profile.hint_mostly_unused = Some(hint_mostly_unused); } - if let Some(ref frame_pointers) = toml.frame_pointers { - profile.frame_pointers = match frame_pointers.as_str() { - "force-on" => Some(FramePointers::ForceOn), - "force-off" => Some(FramePointers::ForceOff), - "default" => None, - // This should be validated in TomlProfile::validate - _ => panic!("invalid frame-pointers value `{}`", frame_pointers), - }; - } profile.strip = match toml.strip { Some(StringOrBool::Bool(true)) => Strip::Resolved(StripInner::Named("symbols".into())), Some(StringOrBool::Bool(false)) => Strip::Resolved(StripInner::None), @@ -641,8 +632,6 @@ pub struct Profile { pub trim_paths: Option, #[serde(skip_serializing_if = "Option::is_none")] pub hint_mostly_unused: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub frame_pointers: Option, } impl Default for Profile { @@ -665,7 +654,6 @@ impl Default for Profile { rustflags: vec![], trim_paths: None, hint_mostly_unused: None, - frame_pointers: None, } } } @@ -696,7 +684,6 @@ compact_debug! { rustflags trim_paths hint_mostly_unused - frame_pointers )] } } @@ -763,12 +750,7 @@ impl Profile { self.debug_assertions, self.overflow_checks, self.rpath, - ( - self.incremental, - self.panic, - self.strip, - self.frame_pointers, - ), + (self.incremental, self.panic, self.strip), &self.rustflags, &self.trim_paths, ) @@ -990,26 +972,6 @@ impl Ord for Strip { } } -/// The setting for controlling frame pointers in generated code. -#[derive( - Clone, Copy, PartialEq, Eq, Debug, Hash, PartialOrd, Ord, serde::Serialize, serde::Deserialize, -)] -#[serde(rename_all = "kebab-case")] -pub enum FramePointers { - ForceOn, - ForceOff, -} - -impl fmt::Display for FramePointers { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - match *self { - FramePointers::ForceOn => "force-on", - FramePointers::ForceOff => "force-off", - } - .fmt(f) - } -} - /// Flags used in creating `Unit`s to indicate the purpose for the target, and /// to ensure the target's dependencies have the correct settings. /// diff --git a/src/cargo/util/toml/mod.rs b/src/cargo/util/toml/mod.rs index 0147890c433..5e570a80b5e 100644 --- a/src/cargo/util/toml/mod.rs +++ b/src/cargo/util/toml/mod.rs @@ -2592,18 +2592,6 @@ pub fn validate_profile( } } - if let Some(frame_pointers) = &root.frame_pointers { - if frame_pointers != "force-on" - && frame_pointers != "force-off" - && frame_pointers != "default" - { - bail!( - "`frame-pointers` setting of `{frame_pointers}` is not a valid setting, \ - must be `\"force-on\"`, `\"force-off\"`, or `\"default\"`.", - ); - } - } - Ok(()) } diff --git a/src/doc/src/reference/profiles.md b/src/doc/src/reference/profiles.md index 6996c7f8f39..28dd841fd16 100644 --- a/src/doc/src/reference/profiles.md +++ b/src/doc/src/reference/profiles.md @@ -258,26 +258,6 @@ whether or not [`rpath`] is enabled. [`-C rpath` flag]: ../../rustc/codegen-options/index.html#rpath [`rpath`]: https://en.wikipedia.org/wiki/Rpath -### frame-pointers - -The `frame-pointers` setting controls the [`-C force-frame-pointers` flag] -which controls whether frame pointers are forced in generated code. Frame -pointers are useful for profiling as they enable reliable stack unwinding. - -```toml -[profile.release] -frame-pointers = "force-on" -``` - -The valid options are: -- `"force-on"`: Force frame pointers to be enabled. -- `"force-off"`: Don't force frame pointers (the compiler may still emit them based on target defaults). -- `"default"`: Use the compiler's target-specific default. - -When not specified, the compiler's target-specific default is used. - -[`-C force-frame-pointers` flag]: ../../rustc/codegen-options/index.html#force-frame-pointers - ## Default profiles ### dev diff --git a/src/doc/src/reference/semver.md b/src/doc/src/reference/semver.md index 41434089590..491f70f1b62 100644 --- a/src/doc/src/reference/semver.md +++ b/src/doc/src/reference/semver.md @@ -1341,7 +1341,7 @@ struct Foo; impl Trait for Foo {} fn main() { - let obj: Box = Box::new(Foo); // Error: the trait `Trait` is not dyn compatible + let obj: Box = Box::new(Foo); // Error: the trait `updated_crate::Trait` is not dyn compatible } ``` diff --git a/tests/testsuite/config.rs b/tests/testsuite/config.rs index fe09aded742..0f0b08d5c3e 100644 --- a/tests/testsuite/config.rs +++ b/tests/testsuite/config.rs @@ -1676,7 +1676,6 @@ fn all_profile_options() { rustflags: None, trim_paths: None, hint_mostly_unused: None, - frame_pointers: Some("force-on".to_string()), }; let mut overrides = BTreeMap::new(); let key = cargo_toml::ProfilePackageSpec::Spec(PackageIdSpec::parse("foo").unwrap()); diff --git a/tests/testsuite/profiles.rs b/tests/testsuite/profiles.rs index d8ac1dcaf09..61cc8d2187a 100644 --- a/tests/testsuite/profiles.rs +++ b/tests/testsuite/profiles.rs @@ -956,136 +956,3 @@ fn profile_hint_mostly_unused_nightly() { ) .run(); } - -#[cargo_test] -fn frame_pointers_force_on() { - let p = project() - .file( - "Cargo.toml", - r#" - [package] - name = "foo" - version = "0.1.0" - edition = "2015" - - [profile.release] - frame-pointers = "force-on" - "#, - ) - .file("src/main.rs", "fn main() {}") - .build(); - - p.cargo("build --release -v") - .with_stderr_data(str![[r#" -[COMPILING] foo v0.1.0 ([ROOT]/foo) -[RUNNING] `rustc [..] -C force-frame-pointers=on [..]` -[FINISHED] `release` profile [optimized] target(s) in [ELAPSED]s - -"#]]) - .run(); -} - -#[cargo_test] -fn frame_pointers_force_off() { - let p = project() - .file( - "Cargo.toml", - r#" - [package] - name = "foo" - version = "0.1.0" - edition = "2015" - - [profile.release] - frame-pointers = "force-off" - "#, - ) - .file("src/main.rs", "fn main() {}") - .build(); - - p.cargo("build --release -v") - .with_stderr_data(str![[r#" -[COMPILING] foo v0.1.0 ([ROOT]/foo) -[RUNNING] `rustc [..] -C force-frame-pointers=off [..]` -[FINISHED] `release` profile [optimized] target(s) in [ELAPSED]s - -"#]]) - .run(); -} - -#[cargo_test] -fn frame_pointers_unspecified() { - let p = project() - .file( - "Cargo.toml", - r#" - [package] - name = "foo" - version = "0.1.0" - edition = "2015" - "#, - ) - .file("src/main.rs", "fn main() {}") - .build(); - - p.cargo("build -v") - .with_stderr_does_not_contain("[RUNNING] `rustc [..] -C force-frame-pointers[..]`") - .run(); -} - -#[cargo_test] -fn frame_pointers_default_overrides_parent() { - let p = project() - .file( - "Cargo.toml", - r#" - [package] - name = "foo" - version = "0.1.0" - edition = "2015" - - [profile.release] - frame-pointers = "force-on" - - [profile.myprofile] - inherits = "release" - frame-pointers = "default" - "#, - ) - .file("src/main.rs", "fn main() {}") - .build(); - - p.cargo("build --profile myprofile -v") - .with_stderr_does_not_contain("[RUNNING] `rustc [..] -C force-frame-pointers[..]`") - .run(); -} - -#[cargo_test] -fn frame_pointers_invalid_value() { - let p = project() - .file( - "Cargo.toml", - r#" - [package] - name = "foo" - version = "0.1.0" - edition = "2015" - - [profile.release] - frame-pointers = "invalid" - "#, - ) - .file("src/main.rs", "fn main() {}") - .build(); - - p.cargo("build --release") - .with_status(101) - .with_stderr_data(str![[r#" -[ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml` - -Caused by: - `frame-pointers` setting of `invalid` is not a valid setting, must be `"force-on"`, `"force-off"`, or `"default"`. - -"#]]) - .run(); -}