Skip to content

String concatenation misses the last character sometimes #163

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 Sep 20, 2010 · 1 comment
Closed

String concatenation misses the last character sometimes #163

ghost opened this issue Sep 20, 2010 · 1 comment

Comments

@ghost
Copy link

ghost commented Sep 20, 2010

Some combinations of string variables and literals are not concatenated properly using '+'. It seems to be if there's a variable between two literals. Example

fn main() {
  let str ff = "abc";
  log ff + "ABC" + ff;
  log "ABC" + ff + "ABC";
}

Produces
rt: ---
rt: e6c6:main:main: rust: abcABCabc
rt: e6c6:main:main: rust: ABCabABC
Note the missing 'c' in the second line.

@froystig
Copy link
Contributor

When translating vec-append, delay destination string's null-byte-accounting length decrement until the destination string has already been resized. Closed by 3c3421e.

mbrubeck pushed a commit to mbrubeck/rust that referenced this issue Oct 17, 2011
…ounting length decrement until the destination string has already been resized. Closes rust-lang#163.
mbrubeck pushed a commit to mbrubeck/rust that referenced this issue Oct 17, 2011
oli-obk pushed a commit to oli-obk/rust that referenced this issue Jul 19, 2017
Rustup to rustc 1.19.0-nightly (2d4ed8e 2017-05-03)
keeperofdakeys pushed a commit to keeperofdakeys/rust that referenced this issue Dec 12, 2017
musl: add support for mips/mipsel
keeperofdakeys pushed a commit to keeperofdakeys/rust that referenced this issue Dec 12, 2017
I messed up the logic of the cfg during my rebase of rust-lang#163 😅
kazcw pushed a commit to kazcw/rust that referenced this issue Oct 23, 2018
* avx: _mm256_testnzc_si256

* avx: _mm256_shuffle_ps

8 levels of macro expansion takes too long to compile.

* avx: remove useless 0 in tests

* avx: _mm256_shuffle_ps

Macro expansion can be reduced to four levels

* avx: _mm256_blend_ps

Copy/paste from avx2::_mm256_blend_epi32
dlrobertson pushed a commit to dlrobertson/rust that referenced this issue Nov 29, 2018
antoyo added a commit to antoyo/rust that referenced this issue Jun 7, 2022
Add inline assembly `sym` operands as GCC input operands
celinval pushed a commit to celinval/rust-dev that referenced this issue Jun 4, 2024
* Copy 1 rust-test to compiletest.

* Add comments and address other concerns.

* Modify comments.

Co-authored-by: Adrian Palacios <73246657+adpaco-aws@users.noreply.github.com>
celinval pushed a commit to celinval/rust-dev that referenced this issue Dec 6, 2024
Towards / Resolves rust-lang#59 

(Resolved) Depends on [this Kani
Issue](model-checking/kani#3629) and [this
PR](model-checking/kani#3660), as discussed in
[this
thread](model-checking#59 (comment))
in rust-lang#59

(Resolved) Depends on [this Kani
Issue](model-checking/kani#3711) and [this
PR](model-checking/kani#3742)

(Resolved) Waiting for Kani PR#3742 merged into
`feature/verify-rust-std`

f16 and f128 are in rust-lang#163 

### Changes
* Added contracts for `f{32,64}::to_int_unchecked` (located in
`library/core/src/num/f{32,64}.rs`)
* Added a macro for generating `to_int_unchecked` harnesses
* Added harnesses for `f{32,64}to_int_unchecked` of each integer type
* `i8`, `i16`, `i32`, `i64`, `i128`, `isize`, `u8`, `u16`, `u32`, `u64`,
`u128`, `usize` --- 12 harnesses in total.

### Verification Results
To compile, we need to add the `-Z float-lib` flag.
```
Checking harness num::verify::checked_f32_to_int_unchecked_usize...

VERIFICATION RESULT:
 ** 0 of 136 failed

VERIFICATION:- SUCCESSFUL
Verification Time: 6.424911s

Checking harness num::verify::checked_f64_to_int_unchecked_u128...

VERIFICATION RESULT:
 ** 0 of 136 failed

VERIFICATION:- SUCCESSFUL
Verification Time: 6.8557353s

Checking harness num::verify::checked_f32_to_int_unchecked_u16...

VERIFICATION RESULT:
 ** 0 of 136 failed

VERIFICATION:- SUCCESSFUL
Verification Time: 6.195041s

Checking harness num::verify::checked_f32_to_int_unchecked_i8...

VERIFICATION RESULT:
 ** 0 of 136 failed

VERIFICATION:- SUCCESSFUL
Verification Time: 6.2361426s

Checking harness num::verify::checked_f64_to_int_unchecked_i32...

VERIFICATION RESULT:
 ** 0 of 136 failed

VERIFICATION:- SUCCESSFUL
Verification Time: 6.3952055s

Checking harness num::verify::checked_f64_to_int_unchecked_i128...

VERIFICATION RESULT:
 ** 0 of 136 failed

VERIFICATION:- SUCCESSFUL
Verification Time: 7.5295496s

Checking harness num::verify::checked_f64_to_int_unchecked_u16...

VERIFICATION RESULT:
 ** 0 of 136 failed

VERIFICATION:- SUCCESSFUL
Verification Time: 6.2897367s

Checking harness num::verify::checked_f32_to_int_unchecked_i64...

VERIFICATION RESULT:
 ** 0 of 136 failed

VERIFICATION:- SUCCESSFUL
Verification Time: 6.58576s

Checking harness num::verify::checked_f64_to_int_unchecked_i16...

VERIFICATION RESULT:
 ** 0 of 136 failed

VERIFICATION:- SUCCESSFUL
Verification Time: 6.2046432s

Checking harness num::verify::checked_f32_to_int_unchecked_i128...

VERIFICATION RESULT:
 ** 0 of 136 failed

VERIFICATION:- SUCCESSFUL
Verification Time: 6.8473463s

Checking harness num::verify::checked_f32_to_int_unchecked_u8...

VERIFICATION RESULT:
 ** 0 of 136 failed

VERIFICATION:- SUCCESSFUL
Verification Time: 6.131122s

Checking harness num::verify::checked_f32_to_int_unchecked_i16...

VERIFICATION RESULT:
 ** 0 of 136 failed

VERIFICATION:- SUCCESSFUL
Verification Time: 6.436728s

Checking harness num::verify::checked_f32_to_int_unchecked_u128...

VERIFICATION RESULT:
 ** 0 of 136 failed

VERIFICATION:- SUCCESSFUL
Verification Time: 6.666422s

Checking harness num::verify::checked_f64_to_int_unchecked_u8...

VERIFICATION RESULT:
 ** 0 of 136 failed

VERIFICATION:- SUCCESSFUL
Verification Time: 6.17829s

Checking harness num::verify::checked_f32_to_int_unchecked_i32...

VERIFICATION RESULT:
 ** 0 of 136 failed

VERIFICATION:- SUCCESSFUL
Verification Time: 6.6507607s

Checking harness num::verify::checked_f64_to_int_unchecked_i64...

VERIFICATION RESULT:
 ** 0 of 136 failed

VERIFICATION:- SUCCESSFUL
Verification Time: 7.3081775s

Checking harness num::verify::checked_f64_to_int_unchecked_u64...

VERIFICATION RESULT:
 ** 0 of 136 failed

VERIFICATION:- SUCCESSFUL
Verification Time: 7.0912967s

Checking harness num::verify::checked_f64_to_int_unchecked_i8...

VERIFICATION RESULT:
 ** 0 of 136 failed

VERIFICATION:- SUCCESSFUL
Verification Time: 6.4602604s

Checking harness num::verify::checked_f64_to_int_unchecked_usize...

VERIFICATION RESULT:
 ** 0 of 136 failed

VERIFICATION:- SUCCESSFUL
Verification Time: 6.9098988s

Checking harness num::verify::checked_f64_to_int_unchecked_u32...

VERIFICATION RESULT:
 ** 0 of 136 failed

VERIFICATION:- SUCCESSFUL
Verification Time: 6.557031s

Checking harness num::verify::checked_f64_to_int_unchecked_isize...

VERIFICATION RESULT:
 ** 0 of 136 failed

VERIFICATION:- SUCCESSFUL
Verification Time: 7.1193557s

Checking harness num::verify::checked_f32_to_int_unchecked_u64...

VERIFICATION RESULT:
 ** 0 of 136 failed

VERIFICATION:- SUCCESSFUL
Verification Time: 6.7919626s

Checking harness num::verify::checked_f32_to_int_unchecked_u32...

VERIFICATION RESULT:
 ** 0 of 136 failed

VERIFICATION:- SUCCESSFUL
Verification Time: 6.557074s

Checking harness num::verify::checked_f32_to_int_unchecked_isize...

VERIFICATION RESULT:
 ** 0 of 136 failed

VERIFICATION:- SUCCESSFUL
Verification Time: 6.710118s

Complete - 24 successfully verified harnesses, 0 failures, 24 total.
```
By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 and MIT licenses.

---------

Co-authored-by: rajathmCMU <rajathkotyal@gmail.com>
Co-authored-by: MWDZ <jinjunfeng721@gmail.com>
Co-authored-by: Zyad Hassan <zyadh@amazon.com>
celinval pushed a commit to celinval/rust-dev that referenced this issue Dec 6, 2024
This issue was closed.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant