Skip to content
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

Add docs for SmallIntMap, TreeMap, TreeSet, TrieMap and TrieSet #12953

Closed
wants to merge 1 commit into from
Closed

Add docs for SmallIntMap, TreeMap, TreeSet, TrieMap and TrieSet #12953

wants to merge 1 commit into from

Conversation

ghost
Copy link

@ghost ghost commented Mar 16, 2014

No description provided.

/// match birthdates.get(1955)) {
/// Some(v) => println!("{:}", v);
/// None => println!("Not found.");
///
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The syntax here seems to have gone awry, I think the match block is missing the closing } and there's an extra ) in the match clause.

Additionally, {:} is equivalent to {}, so feel free to leave out the colon.

/// # Example
///
/// ```rust
/// use collections::TreeMap;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This example doesn't compile:

exampel.rs:6:20: 6:46 error: the impl referenced by this path needs 2 type parameters, but 0 type parameters were supplied
exampel.rs:6  let mut artists = TreeMap::new::<uint, ~str>();
                                ^~~~~~~~~~~~~~~~~~~~~~~~~~
exampel.rs:24:44: 24:48 error: mismatched types: expected `&uint` but found `<generic integer #4>` (expected &-ptr but found integral variable)
exampel.rs:24  for (year, artist) in artists.upper_bound(1980) {
                                                         ^~~~

(and that's after I fixed the aritst typo below.)

I think the make check-stage1-doc-crate-collections target will run all the examples here and show you any errors that occur. (Once you've done that once, you can use make check-stage1-doc-crate-collections NO_REBUILD=1 as you update to just run the tests straight away, rather than doing a bootstrap.)

@alexcrichton
Copy link
Member

Closing due to inactivity, but feel free to reopen with the comments addressed!

@ghost ghost deleted the docs-sprint branch June 5, 2014 16:41
lnicola pushed a commit to lnicola/rust that referenced this pull request Aug 9, 2022
Run stable `fmt` & `cargo` through `rustup`

`cargo test -p ide-assists` fails on Windows/x64/nightly:

```shell
> rustup self update
info: checking for self-updates
  rustup unchanged - 1.25.1

> rustup update
info: syncing channel updates for 'stable-x86_64-pc-windows-msvc'
info: syncing channel updates for 'nightly-x86_64-pc-windows-msvc'
info: checking for self-updates

   stable-x86_64-pc-windows-msvc unchanged - rustc 1.62.1 (e092d0b 2022-07-16)
  nightly-x86_64-pc-windows-msvc unchanged - rustc 1.64.0-nightly (affe0d3 2022-08-05)

info: cleaning up downloads & tmp directories

> rustup show
Default host: x86_64-pc-windows-msvc
rustup home:  C:\Users\stanc\.rustup

installed toolchains
--------------------

stable-x86_64-pc-windows-msvc
nightly-x86_64-pc-windows-msvc (default)

active toolchain
----------------

nightly-x86_64-pc-windows-msvc (default)
rustc 1.64.0-nightly (affe0d3 2022-08-05)

> cargo test -p ide-assists

test tests::sourcegen::sourcegen_assists_docs ... FAILED

failures:

---- tests::sourcegen::sourcegen_assists_docs stdout ----
thread 'tests::sourcegen::sourcegen_assists_docs' panicked at 'Failed to run rustfmt from toolchain 'stable'. Please run `rustup component add rustfmt --toolchain stable` to install it.', crates\sourcegen\src\lib.rs:141:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

failures:
    tests::sourcegen::sourcegen_assists_docs

test result: FAILED. 1576 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 1.82s

error: test failed, to rerun pass '-p ide-assists --lib'
```

After some investigation it seemed that [`cmd!`](https://github.com/rust-lang/rust-analyzer/blob/51705698bd66919435e4fcbc25d96bd7fc5583f4/crates/sourcegen/src/lib.rs#L139) didn't execute the expected (stable) rustfmt.

A simple `xshell` test failed too:

```rust
use xshell::{cmd, Shell};

fn main() {
    let sh = &Shell::new().unwrap();
    sh.set_var("RUSTUP_TOOLCHAIN", "stable");
    let version = cmd!(sh, "rustfmt --version").read().unwrap_or_default();
    println!("{version}");
}
```

Bypassing `xshell` and using `Command` directly failed too:

```rust
use std::process::{Command, Stdio};

fn main() {
    let child = Command::new("rustfmt")
        .arg("--version")
        .stdin(Stdio::null())
        .stdout(Stdio::piped())
        .env("RUSTUP_TOOLCHAIN", "stable")
        .spawn()
        .expect("failed to start");
    let output = child.wait_with_output().unwrap();
    let version = String::from_utf8_lossy(&output.stdout);
    println!("{version}");
}
```

Spawning `cargo +stable fmt version` [failed too](rust-lang/rustup#3036) with `error: no such subcommand: +stable`.

Only `rustup run stable` worked fine for both `cargo` and `fmt`.

Thanks to `@lnicola` for a live investigation session, hints and tips.
flip1995 pushed a commit to flip1995/rust that referenced this pull request Jun 27, 2024
Add myself back to reviewer rotation

Hey 👋

Even though I might have less time than usual, $DAY_JOB soon and working on Cosmographic Software for fun, I think I want to get back in the swing of things here

changelog: none
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