Skip to content

String interpolation filling in value instead of compile time error #93478

New issue

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

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

Already on GitHub? # to your account

Closed
ghost opened this issue Jan 30, 2022 · 2 comments
Closed

String interpolation filling in value instead of compile time error #93478

ghost opened this issue Jan 30, 2022 · 2 comments
Labels
C-bug Category: This is a bug.

Comments

@ghost
Copy link

ghost commented Jan 30, 2022

I tried this code:

fn main() {
    let tup = (500, 6.4, 1);

    let (x, y, z) = tup;

    println!("The value of x, y, z is: {x}, {}, {z}");
}

I expected to see this happen: Compile time error for providing an empty parenthesis in println!("The value of x, y, z is: {x}, {}, {z}");

Instead, this happened:

The value of x, y, z is: 500, 500, 1 The value of variable x (500) was filled in for the empty parenthesis.

Meta

rustc --version --verbose:

<version>
rustc 1.58.1 (db9d1b20b 2022-01-20)                                                                                                                                                 
binary: rustc                                                                                                                                                                       
commit-hash: db9d1b20bba1968c1ec1fc49616d4742c1725b4b                                                                                                                               
commit-date: 2022-01-20                                                                                                                                                             
host: x86_64-pc-windows-msvc                                                                                                                                                        
release: 1.58.1                                                                                                                                                                     
LLVM version: 13.0.0 
Backtrace

<backtrace>

@ghost ghost added the C-bug Category: This is a bug. label Jan 30, 2022
@fmease
Copy link
Member

fmease commented Jan 30, 2022

Duplicate of #93378.

@ehuss
Copy link
Contributor

ehuss commented Jan 30, 2022

Yea, I believe this is a duplicate of #93378 and should be fixed by #93394.

@ehuss ehuss closed this as completed Jan 30, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
C-bug Category: This is a bug.
Projects
None yet
Development

No branches or pull requests

2 participants