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

Rustpkg should infer crates to build #5680

Closed
graydon opened this issue Apr 2, 2013 · 3 comments
Closed

Rustpkg should infer crates to build #5680

graydon opened this issue Apr 2, 2013 · 3 comments
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Milestone

Comments

@graydon
Copy link
Contributor

graydon commented Apr 2, 2013

Sub-bug of #5677

Rustpkg currently always looks for a pkg.rs file, compiles and links it against librustpkg and runs it. This behaviour should only exist as an escape hatch for custom build logic. Most of the time, rustpkg should be able to infer what to build. The inference rules should be:

  • foo/lib.rs implies compiling lib.rs into a library with basename foo
  • foo/main.rs implies compiling main.rs into a binary called foo
  • foo/test.rs implies compiling test.rs into a test binary called foo-test
  • foo/bench.rs implies compiling test.rs into a benchmark binary called foo-bench
  • The presence of pkg.rs in the package root disables inference and does the "custom build logic" routine.
  • The "standard inferred build" routine is available as a library call within a pkg.rs script.

A sketch of the logic for inferring these things is here:

https://github.com/graydon/rust/blob/rustpkg/src/librustpkg/rustpkg.rc#L1143

It doesn't make any difference if these files are in the root of a package or in subdirs: the stem foo for a crate is taken from immediately-containing directory name in all cases.

Test and benchmark binaries should not leave their build dirs; they should be run in-place by the install process. Mains should be installed to bin and libraries to lib in the corresponding install dirs.

@catamorphism
Copy link
Contributor

This is mostly done as of pending pull request #5920, except:

  • the "standard inferred build" routine is not yet available from pkg.rs
  • rustpkg runs the "custom build logic" routine and then runs inference when pkg.rs exists; it should only run the custom build logic
  • install isn't implemented yet.

@catamorphism
Copy link
Contributor

This is done except for the last bullet point, 'The "standard inferred build" routine is available as a library call within a pkg.rs script.'

@catamorphism
Copy link
Contributor

Closing this, because #6401 captures the work left to do.

tesuji pushed a commit to tesuji/rustc that referenced this issue Jun 9, 2020
let_and_return: avoid "does not live long enough" errors

EDIT: Add rust-lang#3324 to the list of fixes

<details>
<summary>Description of old impl</summary>
<br>
Avoid suggesting turning the RHS expression of the last statement into the block tail expression if a temporary borrows from a local that would be destroyed before.

This is my first incursion into MIR so there's probably room for improvement!
</details>

Avoid linting if the return type of some method or function called in the last statement has a lifetime parameter.

changelog: Fix false positive in [`let_and_return`]

Fixes rust-lang#3792
Fixes rust-lang#3324
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Projects
None yet
Development

No branches or pull requests

2 participants