Skip to content

Commit 9c20450

Browse files
committed
Fix build failure due to false positive warning in 1.93 from macro
This is confirmed fixed in 1.94+. I tested ms-beta which is 1.95, Mikey tested public 1.94. However, even with ms-prod-1.93-20260401 (today's release), this fails compilation (due to warning being treated as error). More unfortunately, the ignore must be at the file-level due to how the macro expands. I tested both on the field-level and enum-level, to no avail.
1 parent 77ae07f commit 9c20450

File tree

4 files changed

+103
-91
lines changed

4 files changed

+103
-91
lines changed

lib/dsc-lib/src/types/date_version.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT License.
33

4+
// TODO: Remove when updating to rustc 1.94; false positive from thiserror + rust-i18n t!() macro
5+
#![allow(unused_assignments)]
6+
47
use std::{
58
fmt::Display,
69
str::FromStr,

lib/dsc-lib/src/types/fully_qualified_type_name.rs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT License.
33

4+
// TODO: Remove when updating to rustc 1.94; false positive from thiserror + rust-i18n t!() macro
5+
#![allow(unused_assignments)]
6+
47
use std::fmt::{Display, Formatter};
58
use std::hash::Hash;
69
use std::ops::Deref;
@@ -223,7 +226,7 @@ pub enum FullyQualifiedTypeNameError {
223226
///
224227
/// If the fully qualified type name contains any empty namespace segments, validation raises
225228
/// this error in the `errors` field of the main [`InvalidTypeName`] error.
226-
///
229+
///
227230
/// [`InvalidTypeName`]: Self::InvalidTypeName
228231
#[error("{t}", t = t!(
229232
"types.fully_qualified_type_name.emptyNamespaceSegment",
@@ -384,7 +387,7 @@ impl FullyQualifiedTypeName {
384387
/// }
385388
/// );
386389
/// ```
387-
///
390+
///
388391
/// - An empty namespace segment is not valid.
389392
///
390393
/// ```rust
@@ -437,21 +440,21 @@ impl FullyQualifiedTypeName {
437440

438441
/// Private helper to parse the input into segments and collect validation errors for owner
439442
/// and namespace segments.
440-
///
443+
///
441444
/// This is used by the public `parse()` method to handle the common parsing and validation
442445
/// logic that is shared by [`FullyQualifiedTypeName`] and [`WildcardTypeName`] since they
443446
/// share the same overall structure.
444-
///
447+
///
445448
/// # Arguments
446-
///
449+
///
447450
/// - `text`: The input string to parse into type name segments.
448451
/// - `validating_segment_regex`: The regex to use for validating each segment of the type name.
449452
/// - `errors`: A mutable reference to a vector for collecting any validation errors encountered
450453
/// while parsing the segments. This allows the method to accumulate multiple errors for
451454
/// different segments of the type name.
452-
///
455+
///
453456
/// # Returns
454-
///
457+
///
455458
/// The method returns the parsed segments (`owner`, `namespaces`, and `name`) as a tuple. Any
456459
/// validation errors encountered during parsing are added to the provided `errors` vector for
457460
/// the caller to handle.
@@ -535,7 +538,7 @@ impl FullyQualifiedTypeName {
535538
/// number of `namespace` segments, which must be separated from the previous segment by a
536539
/// single period (`.`). Finally, the string must include a forward slash (`/`) followed by one
537540
/// or more unicode alphanumeric characters and underscores to define the `name` segment.
538-
///
541+
///
539542
/// [`VALIDATING_SEGMENT_PATTERN`]: Self::VALIDATING_SEGMENT_PATTERN
540543
pub const VALIDATING_PATTERN: &str = r"^\w+(\.\w+)*\/\w+$";
541544

lib/dsc-lib/src/types/semantic_version_req.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT License.
33

4+
// TODO: Remove when updating to rustc 1.94; false positive from thiserror + rust-i18n t!() macro
5+
#![allow(unused_assignments)]
6+
47
use std::{fmt::Display, ops::Deref, str::FromStr, sync::OnceLock};
58

69
use miette::Diagnostic;
@@ -688,28 +691,28 @@ impl SemanticVersionReq {
688691
/// // 2.0.0 isn't compatible with the requirement.
689692
/// assert!(!requirement.matches(&SemanticVersion::new(2, 0, 0)));
690693
/// ```
691-
///
694+
///
692695
/// The following example shows how the `matches` function treats prerelease versions as not
693696
/// matching a requirement unless the requirement explicitly defines a prerelease segment.
694-
///
697+
///
695698
/// ```rust
696699
/// # use dsc_lib::types::{SemanticVersion, SemanticVersionReq};
697700
/// let v_stable = &SemanticVersion::parse("1.2.3").unwrap();
698701
/// let v_rc1 = &SemanticVersion::parse("1.2.3-rc.1").unwrap();
699702
/// let v_rc2 = &SemanticVersion::parse("1.2.3-rc.2").unwrap();
700-
///
701-
/// // Only the stable version matches the stable requirement
703+
///
704+
/// // Only the stable version matches the stable requirement
702705
/// let stable_req = SemanticVersionReq::parse("^1.2.3").unwrap();
703706
/// assert!(!stable_req.matches(v_rc1));
704707
/// assert!(!stable_req.matches(v_rc2));
705708
/// assert!(stable_req.matches(v_stable));
706-
///
709+
///
707710
/// // All three versions match the requirement that explicitly defines the prerelease segment
708711
/// let prerelease_req = SemanticVersionReq::parse("^1.2.3-rc.1").unwrap();
709712
/// assert!(prerelease_req.matches(v_stable));
710713
/// assert!(prerelease_req.matches(v_rc1));
711714
/// assert!(prerelease_req.matches(v_rc2));
712-
///
715+
///
713716
/// ```
714717
pub fn matches(&self, version: &SemanticVersion) -> bool {
715718
self.0.matches(version.as_ref())

0 commit comments

Comments
 (0)