From ea11d78995c281f4eeae0513d69d8d2eb127d855 Mon Sep 17 00:00:00 2001 From: Noa Date: Fri, 14 Oct 2022 17:23:32 -0500 Subject: [PATCH] Fix compilation without compiler feature --- stdlib/src/dis.rs | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/stdlib/src/dis.rs b/stdlib/src/dis.rs index d9322d4871..12c2ea75df 100644 --- a/stdlib/src/dis.rs +++ b/stdlib/src/dis.rs @@ -13,18 +13,23 @@ mod decl { let co = if let Ok(co) = obj.get_attr("__code__", vm) { // Method or function: PyRef::try_from_object(vm, co)? - } else if let Ok(_co_str) = PyStrRef::try_from_object(vm, obj.clone()) { + } else if let Ok(co_str) = PyStrRef::try_from_object(vm, obj.clone()) { #[cfg(not(feature = "compiler"))] - return Err(vm.new_runtime_error( - "dis.dis() with str argument requires `compiler` feature".to_owned(), - )); + { + let _ = co_str; + return Err(vm.new_runtime_error( + "dis.dis() with str argument requires `compiler` feature".to_owned(), + )); + } #[cfg(feature = "compiler")] - vm.compile( - _co_str.as_str(), - crate::vm::compiler::Mode::Exec, - "".to_owned(), - ) - .map_err(|err| vm.new_syntax_error(&err, Some(_co_str.as_str())))? + { + vm.compile( + co_str.as_str(), + crate::vm::compiler::Mode::Exec, + "".to_owned(), + ) + .map_err(|err| vm.new_syntax_error(&err, Some(co_str.as_str())))? + } } else { PyRef::try_from_object(vm, obj)? };