Skip to content

Commit f5eee5c

Browse files
committed
Remove support for export-range radians
1 parent d53c0b1 commit f5eee5c

File tree

2 files changed

+17
-29
lines changed

2 files changed

+17
-29
lines changed

godot-core/src/deprecated.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,6 @@ pub use crate::emit_deprecated_warning;
3838
// Library-side deprecations -- see usage description above.
3939

4040
// ----------------------------------------------------------------------------------------------------------------------------------------------
41-
// Godot-side deprecations
41+
// Godot-side deprecations (we may mark them deprecated but keep support).
4242

43-
// This is a Godot-side deprecation. Since it's the only way in Godot 4.1, we keep compatibility for now.
44-
// TODO(v0.4): remove with error.
45-
#[deprecated = "\nUse #[export(range = (radians_as_degrees))] and not #[export(range = (radians))].\n\
46-
More information on https://github.com/godotengine/godot/pull/82195."]
47-
pub const fn export_range_radians() {}
43+
// Past removals: `radians` in #[export(range)].

godot-macros/src/class/data_models/field_export.rs

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use std::collections::{HashMap, HashSet};
1010
use proc_macro2::{Ident, Span, TokenStream};
1111
use quote::quote;
1212

13-
use crate::util::{ident, KvParser, ListParser};
13+
use crate::util::{bail, ident, KvParser, ListParser};
1414
use crate::ParseResult;
1515

1616
pub struct FieldExport {
@@ -72,7 +72,6 @@ pub enum ExportType {
7272
or_less: bool,
7373
exp: bool,
7474
radians_as_degrees: bool,
75-
radians: bool,
7675
degrees: bool,
7776
hide_slider: bool,
7877
suffix: Option<TokenStream>,
@@ -331,11 +330,19 @@ impl ExportType {
331330
let key_maybe_value =
332331
parser.next_allowed_key_optional_value(&FLAG_OPTIONS, &KV_OPTIONS)?;
333332
match key_maybe_value {
334-
Some((option, None)) => {
335-
flags.insert(option.to_string());
333+
Some((ident, None)) => {
334+
if ident == "radians" {
335+
return bail!(
336+
&ident,
337+
"#[export(range = (...))]: `radians` is broken in Godot and superseded by `radians_as_degrees`.\n\
338+
See https://github.com/godotengine/godot/pull/82195 for details."
339+
);
340+
}
341+
342+
flags.insert(ident.to_string());
336343
}
337-
Some((option, Some(value))) => {
338-
kvs.insert(option.to_string(), value.expr()?);
344+
Some((ident, Some(value))) => {
345+
kvs.insert(ident.to_string(), value.expr()?);
339346
}
340347
None => break,
341348
}
@@ -351,7 +358,6 @@ impl ExportType {
351358
or_less: flags.contains("or_less"),
352359
exp: flags.contains("exp"),
353360
radians_as_degrees: flags.contains("radians_as_degrees"),
354-
radians: flags.contains("radians"),
355361
degrees: flags.contains("degrees"),
356362
hide_slider: flags.contains("hide_slider"),
357363
suffix: kvs.get("suffix").cloned(),
@@ -441,7 +447,6 @@ impl ExportType {
441447
or_less,
442448
exp,
443449
radians_as_degrees,
444-
radians,
445450
degrees,
446451
hide_slider,
447452
suffix,
@@ -452,22 +457,9 @@ impl ExportType {
452457
quote! { None }
453458
};
454459
let export_func = quote_export_func! {
455-
export_range(#min, #max, #step, #or_greater, #or_less, #exp, #radians_as_degrees || #radians, #degrees, #hide_slider, #suffix)
460+
export_range(#min, #max, #step, #or_greater, #or_less, #exp, #radians_as_degrees, #degrees, #hide_slider, #suffix)
456461
}?;
457-
let deprecation_warning = if *radians {
458-
// For some reason, rustfmt formatting like this. Probably a bug.
459-
// See https://github.com/godot-rust/gdext/pull/783#discussion_r1669105958 and
460-
// https://github.com/rust-lang/rustfmt/issues/6233
461-
quote! {
462-
#export_func;
463-
::godot::__deprecated::emit_deprecated_warning!(export_range_radians);
464-
}
465-
} else {
466-
quote! { #export_func }
467-
};
468-
Some(quote! {
469-
#deprecation_warning
470-
})
462+
Some(export_func)
471463
}
472464

473465
Self::Enum { variants } => {

0 commit comments

Comments
 (0)