Skip to content

minor int-template.rs cleanup - #4570

Merged
catamorphism merged 1 commit into
rust-lang:incomingfrom
wting:minor_int_cleanup
Jan 22, 2013
Merged

minor int-template.rs cleanup#4570
catamorphism merged 1 commit into
rust-lang:incomingfrom
wting:minor_int_cleanup

Conversation

@wting

@wting wting commented Jan 21, 2013

Copy link
Copy Markdown
Contributor

Not sure if pull requests like these are welcomed, but just a few minor things I noticed while when reading the source.

  • Modified int::range() to match uint::range() as a pure function.
  • Changed int::Times() line for readability and dogfooding. Since is_negative() is inlined it makes no functional difference.

catamorphism added a commit that referenced this pull request Jan 22, 2013
@catamorphism
catamorphism merged commit b49c47a into rust-lang:incoming Jan 22, 2013
@catamorphism

Copy link
Copy Markdown
Contributor

Thanks!

RalfJung added a commit to RalfJung/rust that referenced this pull request Sep 18, 2025
atomic rmw intrinsics: RHS must be an integer
U007D pushed a commit to U007D/rust-mos that referenced this pull request Aug 21, 2026
4570: Use Chalk's built-in impls r=matklad a=flodiebold

This contains two changes:
 - Chalk has begun adding built-in representations of primitive types; use these in our type conversion logic. There's one somewhat 'iffy' part here, namely references; we don't keep track of lifetimes, but Chalk does, so it will expect a lifetime parameter on references. If we didn't provide that, it could cause crashes in Chalk code that expects the lifetime, so I rather hackily add an (always the same) lifetime placeholder during conversion. I expect that we'll fully switch to using Chalk's types everywhere before we add lifetime support, so I think this is the best solution for now.
 - let Chalk know about well-known traits (from lang items), so it can apply its built-in impls.

Before:
```
Total expressions: 181485
Expressions of unknown type: 2940 (1%)
Expressions of partially unknown type: 2884 (1%)
Type mismatches: 901
Inference: 37.821210245s, 0b allocated 0b resident
Total: 53.399467609s, 0b allocated 0b resident
```

After:
```
Total expressions: 181485
Expressions of unknown type: 2923 (1%)
Expressions of partially unknown type: 2879 (1%)
Type mismatches: 734
Inference: 39.157752509s, 0b allocated 0b resident
Total: 54.110767621s, 0b allocated 0b resident
```

(I will start splitting up `chalk.rs` in a separate PR, since it's getting pretty big...)

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
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

Successfully merging this pull request may close these issues.

2 participants