Skip to content

rustfmt internal error #6455

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
float3 opened this issue Jan 25, 2025 · 0 comments
Closed

rustfmt internal error #6455

float3 opened this issue Jan 25, 2025 · 0 comments

Comments

@float3
Copy link

float3 commented Jan 25, 2025

I tried this code:

fn show_translation_unit() {
    let m = buffers.iter()
    .map( 
        |(i, b)| format!("\n
        Pass 
            {{
                Name \"{}\"

                CGPROGRAM
                #include \"UnityCustomRenderTexture.cginc\"
                #pragma target 5.0
                #pragma vertex CustomRenderTextureVertexShader
                #pragma fragment frag  
        
                #include \"UnityCG.cginc\"
                // Built-in properties
                sampler2D _MainTex_{};   float4 _MainTex_{}_TexelSize;
                sampler2D _SecondTex_{}; float4 _SecondTex_{}_TexelSize;
                sampler2D _ThirdTex_{};  float4 _ThirdTex_{}_TexelSize;
                sampler2D _FourthTex_{}; float4 _FourthTex_{}_TexelSize;                
                float4 _Mouse;
                float _GammaCorrect;
                float _Resolution;
                float _WorldSpace;
                float4 _Offset;

                //Def CRT Res
                #ifdef iResolution
                    #undef iResolution
                    #define iResolution float3(_CustomRenderTextureWidth, _CustomRenderTextureHeight, _Resolution)
                #endif
                // GLSL Compatability macros
                #ifndef COMMON_INCLUDE_BLOCK
                #define COMMON_INCLUDE_BLOCK
                    #define glsl_mod(x,y) (((x)-(y)*floor((x)/(y))))
                    #define texelFetch(ch, uv, lod) tex2Dlod(ch, float4((uv).xy * ch##_TexelSize.xy + ch##_TexelSize.xy * 0.5, 0, lod))
                    #define textureLod(ch, uv, lod) tex2Dlod(ch, float4(uv, 0, lod))
                    #define iResolution float3(_CustomRenderTextureWidth, _CustomRenderTextureHeight, _Resolution)
                    #define iFrame (floor(_Time.y / 60))
                    #define iChannelTime float4(_Time.y, _Time.y, _Time.y, _Time.y)
                    #define iDate float4(2020, 6, 18, 30)
                    #define iSampleRate (44100)
                #endif    
                #define iChannelResolution float4x4(                      \\
                    _MainTex_{}_TexelSize.z,   _MainTex_{}_TexelSize.w,   0, 0, \\
                    _SecondTex_{}_TexelSize.z, _SecondTex_{}_TexelSize.w, 0, 0, \\
                    _ThirdTex_{}_TexelSize.z,  _ThirdTex_{}_TexelSize.w,  0, 0, \\
                    _FourthTex_{}_TexelSize.z, _FourthTex_{}_TexelSize.w, 0, 0)                
                {}
                ENDCG
            }}        
            ", i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,i,b))
    .collect::<Vec<_>>()
    .concat();
}

I expected to see this happen: succesful rustfmt

Instead, this happened:

error[internal]: left behind trailing whitespace
 --> [path removed]/transpiler.rs:3:3:10
  |
3 |     .map( 
  |          ^
  |

warning: rustfmt has failed to format. See previous 1 errors.

Meta

rustfmt --version:

rustfmt 1.8.0-stable (9fc6b43126 2025-01-07)
rustfmt 1.8.0-nightly (1e9b0177da 2025-01-24)
rustfmt 1.8.0-beta (4416507043 2025-01-20)

happens on all of them

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants