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

rustdoc warns main is never used #13894

Closed
gifnksm opened this issue May 2, 2014 · 1 comment
Closed

rustdoc warns main is never used #13894

gifnksm opened this issue May 2, 2014 · 1 comment
Labels
T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@gifnksm
Copy link
Contributor

gifnksm commented May 2, 2014

rustdoc warns that main is never used.

// hello.rs
#![crate_id="hello"]

fn main() {}
$ rustdoc hello.rs
hello.rs:3:1: 3:13 warning: code is never used: `main`, #[warn(dead_code)] on by default
hello.rs:3 fn main() {}
           ^~~~~~~~~~~~

I think rustdoc shouldn't warn about it, because rustc doesn't warn.

$ rustc hello.rs
# no output

If the main is pub, rustdoc doesn't warn about it. Shoulud all mains mark as pub?

// pubhello.rs
#![crate_id="hello"]

pub fn main() {}
$ rustdoc pubhello.rs
# no output
$ rustc --version
rustc 0.11-pre (9f836d5 2014-05-01 16:06:48 -0700)
host: x86_64-unknown-linux-gnu

$ rustdoc --version
rustdoc 0.11-pre (9f836d5 2014-05-01 16:06:48 -0700)
host: x86_64-unknown-linux-gnu
@alexcrichton
Copy link
Member

This is currently intended behavior, rustdoc compiles crates as if it were compiling a library. If you compile rustdoc --crate-type=dylib hello.rs you'll get the same warning.

arcnmx pushed a commit to arcnmx/rust that referenced this issue Jan 9, 2023
…gation-resolution, r=lnicola

Apply fallback before final obligation resolution

Fixes rust-lang#13249
Fixes rust-lang#13518

We've been applying fallback to type variables independently even when there are some unresolved obligations that associate them. This PR applies fallback to unresolved scalar type variables before the final attempt of resolving obligations, which enables us to infer more.

Unlike rustc, which has separate storages for each kind of type variables, we currently don't have a way to retrieve only integer/float type variables without folding/visiting every single type we've inferred. I've repurposed `TypeVariableData` as bitflags that also hold the kind of the type variable it's referring to so that we can "reconstruct" scalar type variables from their indices.

This PR increases the number of ??ty for rust-analyzer repo not because we regress and fail to infer the existing code but because we fail to infer the new code. It seems we have problems inferring some functions bitflags produces.
flip1995 pushed a commit to flip1995/rust that referenced this issue Feb 6, 2025
…#13894)

Closes rust-lang#11434 by moving `format_push_string` and `format_collect` to
pedantic.

changelog: Move `format_push_string` and `format_collect` to pedantic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

2 participants