Skip to content

Rename things in std::ascii for consistency #14436

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
wants to merge 5 commits into from

Conversation

lilyball
Copy link
Contributor

Tweak the names of various things in std::ascii to be more descriptive and consistent.

Also fix Vec.ptr() to always return the correct pointer even for zero-sized types; handle the issues with iteration over zero-sized types in the iterators instead.

[breaking-change]

@lilyball
Copy link
Contributor Author

@alexcrichton I removed the String::from_owned_str() commit, with the expectation that #14414 will handle it.

@lilyball lilyball mentioned this pull request May 28, 2014
lilyball added 5 commits May 29, 2014 18:51
Don't special-case zero-sized values in Vec.ptr(). Doing that prevents
the following from working:

    // v is a Vec<T>
    let newv = Vec::from_raw_parts(v.len(), v.cap(), v.mut_ptr());
    mem::forget(v);

Instead, teach slice::Items/MutItems to handle zero-sized values better.
std::string::raw has one function, from_utf(), that converts a Vec<u8>
to a String without testing for valid UTF-8.
Rename a few traits in std::ascii to have more descriptive names. Also
reimplement a few methods to avoid unnecessary allocation. And add a
trait for Vec<Ascii> to do things like casemapping in-place.

- Rename AsciiCast to ToAscii
- Rename OwnedAsciiCast to IntoAscii
- Split AsciiStr into two traits, the second called AsciiSlice
- Add trait AsciiVec
- Rename OwnedStrAsciiExt to StringAsciiExt

This just barely qualifies as a breaking change. Every trait except
StringAsciiExt is in the prelude.

[breaking-change]
Rename the various *_lower and *_upper methods to the equivalent
*_lowercase and *_uppercase names.

[breaking-change]
This includes updating for the previous rename of to_lower/upper on
Ascii.
@aochagavia
Copy link
Contributor

@kballard are you still working on this?

@lilyball
Copy link
Contributor Author

lilyball commented Jun 4, 2014

@aochagavia Between WWDC and work, I have very little time to work on Rust this week. I'm still planning on finishing up the std::ascii work, but it won't happen in the next few days.

@alexcrichton
Copy link
Member

Closing due to inactivity, but feel free to reopen with a rebase!

bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 5, 2023
…th-expr, r=HKalbasi

Normalize associated types in paths in expressions

Part of rust-lang#14393

When we resolve paths in expressions (either path expressions or paths in struct expressions), there's a need of projection normalization, which `TyLoweringContext` cannot do on its own. We've been properly applying normalization for paths in struct expressions without type anchor, but not for others:

```rust
enum E {
    S { v: i32 }
    Empty,
}

impl Foo for Bar {
    type Assoc = E;
    fn foo() {
        let _ = Self::Assoc::S { v: 42 };   // path in struct expr without type anchor; we already support this
        let _ = <Self>::Assoc::S { v: 42 }; // path in struct expr with type anchor; resolves with this PR
        let _ = Self::Assoc::Empty;         // path expr; resolves with this PR
    }
}
```

With this PR we correctly resolve the whole path, but we need some more tweaks in HIR and/or IDE layers to properly resolve a qualifier (prefix) of such paths and provide IDE features that are pointed out in rust-lang#14393 to be currently broken.
flip1995 pushed a commit to flip1995/rust that referenced this pull request Mar 20, 2025
changelog: [`question_mark`]: Now respects the [`msrv`] configuration
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.

3 participants