PrimeIntellect/SWE-rebench-V2-Filtered-Easy-Verified huggingface dataset:
Repository: shepmaster/snafu (rust)
Issue: Could not find `convert` in `core` when using `ensure!` with a conflicting module called `core` in scope
```
error[E0433]: failed to resolve: could not find `convert` in `core`
   --> meridian-graphics/src/shader/user_uniform.rs:940:17
    |
940 | /                 ensure!(is_valid_glsl_identifier(name), InvalidUniformBlockFieldIdentifier {
941 | |                     uniform_block_name,
942 | |                     field_name: name
943 | |                 });
    | |___________________^ could not find `convert` in `core`
    |
    = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
```
Looks as if the issue is that it considers `core::convert` to be an ambiguous import; writing `use core::convert` in the same source file raises an error that it isn't sure which module to use. Replacing `core::convert` in the `ensure!` macro source with `::core::convert` appears to fix the issue, but I am not sure if that would be a breaking change for another reason.
Pull request description: Disambiguate references to the core library from the ensure macro
Fixes #270

Patch:
diff --git a/src/lib.rs b/src/lib.rs
index 415ebb2..c1aa2ab 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -199,7 +199,9 @@ pub use no_std_error::Error;
 macro_rules! ensure {
     ($predicate:expr, $context_selector:expr $(,)*) => {
         if !$predicate {
-            return $context_selector.fail().map_err(core::convert::Into::into);
+            return $context_selector
+                .fail()
+                .map_err(::core::convert::Into::into);
         }
     };
 }


Test patch:
diff --git a/compatibility-tests/v1_31/Cargo.toml b/compatibility-tests/v1_31/Cargo.toml
index 0c3d66e..3fff116 100644
--- a/compatibility-tests/v1_31/Cargo.toml
+++ b/compatibility-tests/v1_31/Cargo.toml
@@ -9,3 +9,4 @@ snafu = { path = "../..", default-features = false, features = ["backtraces"] }
 
 # These versions are the last versions to support Rust 1.31
 backtrace = "= 0.3.35"
+cc = "= 1.0.61"
diff --git a/tests/name-conflicts.rs b/tests/name-conflicts.rs
index eda36d7..1f7eeb0 100644
--- a/tests/name-conflicts.rs
+++ b/tests/name-conflicts.rs
@@ -1,4 +1,4 @@
-use snafu::Snafu;
+use snafu::{ensure, Snafu};
 
 // Modules to clash with likely candidates from the standard library.
 mod core {}
@@ -23,3 +23,8 @@ enum VariantNamedOk<T> {
 enum VariantNamedErr<T> {
     Err { value: T },
 }
+
+fn _using_ensure() -> Result<u8, VariantNamedNone> {
+    ensure!(false, None);
+    Ok(0)
+}