Skip to content

rustfmt internal error #136065

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 · 1 comment
Closed

rustfmt internal error #136065

float3 opened this issue Jan 25, 2025 · 1 comment
Labels
C-bug Category: This is a bug.

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

@float3 float3 added the C-bug Category: This is a bug. label Jan 25, 2025
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jan 25, 2025
@float3
Copy link
Author

float3 commented Jan 25, 2025

sorry wrong, repo rust-lang/rustfmt#6455

@float3 float3 closed this as completed Jan 25, 2025
@jieyouxu jieyouxu removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jan 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug.
Projects
None yet
Development

No branches or pull requests

3 participants