@@ -30,14 +30,14 @@ use crate::fix::{fix_file, FixResult};
3030use crate :: message:: Message ;
3131use crate :: noqa:: add_noqa;
3232use crate :: package:: PackageRoot ;
33- use crate :: preview:: is_unsupported_syntax_enabled;
33+ use crate :: preview:: { is_py314_support_enabled , is_unsupported_syntax_enabled} ;
3434use crate :: registry:: { AsRule , Rule , RuleSet } ;
3535#[ cfg( any( feature = "test-rules" , test) ) ]
3636use crate :: rules:: ruff:: rules:: test_rules:: { self , TestRule , TEST_RULES } ;
3737use crate :: settings:: types:: UnsafeFixes ;
3838use crate :: settings:: { flags, LinterSettings } ;
3939use crate :: source_kind:: SourceKind ;
40- use crate :: { directives, fs, Locator } ;
40+ use crate :: { directives, fs, warn_user_once , Locator } ;
4141
4242pub struct LinterResult {
4343 /// A collection of diagnostic messages generated by the linter.
@@ -450,6 +450,11 @@ pub fn lint_only(
450450 source : ParseSource ,
451451) -> LinterResult {
452452 let target_version = settings. resolve_target_version ( path) ;
453+
454+ if matches ! ( target_version, PythonVersion :: PY314 ) && !is_py314_support_enabled ( settings) {
455+ warn_user_once ! ( "Support for Python 3.14 is under development and may be unstable. Enable `preview` to remove this warning." ) ;
456+ }
457+
453458 let parsed = source. into_parsed ( source_kind, source_type, target_version) ;
454459
455460 // Map row and column locations to byte slices (lazily).
@@ -559,6 +564,10 @@ pub fn lint_fix<'a>(
559564
560565 let target_version = settings. resolve_target_version ( path) ;
561566
567+ if matches ! ( target_version, PythonVersion :: PY314 ) && !is_py314_support_enabled ( settings) {
568+ warn_user_once ! ( "Support for Python 3.14 is under development and may be unstable. Enable `preview` to remove this warning." ) ;
569+ }
570+
562571 // Continuously fix until the source code stabilizes.
563572 loop {
564573 // Parse once.
0 commit comments