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

Simplify #3798

Merged
merged 7 commits into from
Apr 2, 2020
Merged

Simplify #3798

merged 7 commits into from
Apr 2, 2020

Conversation

Veetaha
Copy link
Contributor

@Veetaha Veetaha commented Mar 31, 2020

bear with me


pub fn is_member(&self) -> bool {
self.is_member
pub fn new_non_member(path: PathBuf) -> PackageRoot {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe better name is new_foreign?

/// Is a member of the current workspace
is_member: bool,
pub is_member: bool,
Copy link
Member

Choose a reason for hiding this comment

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

Why pub if we don't mutate it after constructor ?

Copy link
Contributor Author

@Veetaha Veetaha Apr 1, 2020

Choose a reason for hiding this comment

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

Right, unfortunately, I cannot put readonly in front of a property. This is pub, so that we don't clone the .path property here and there but just move it out of the temporary PackageRoot. Though, the special deconstructor method for this purpose would seem out-of-place...

Copy link
Member

Choose a reason for hiding this comment

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

Thats why we use accessor method in the first place.

Copy link
Member

Choose a reason for hiding this comment

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

And there is no significant different between a.foo and a.foo() if foo() return a ref.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The difference is that you cannot move out values from the ref. E.g.:

fn consume(p: PathBuf) {};
consume(a.foo);
consume(a.foo()); // cannot move out of shared reference

Copy link
Member

Choose a reason for hiding this comment

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

Yes, but we only move out once, and I don't think it is so significant.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed ac699da

@@ -87,7 +91,7 @@ fn test_globs() {

let filter = RustPackageFilterBuilder::default()
.set_member(true)
.exclude(Glob::new("src/llvm-project/**").unwrap())
.exclude(std::iter::once(Glob::new("src/llvm-project/**").unwrap()))
Copy link
Contributor Author

@Veetaha Veetaha Apr 1, 2020

Choose a reason for hiding this comment

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

By the way, this also works since impl IntoIter for Option holds:

        .exclude(Some(Glob::new("src/llvm-project/**").unwrap()))

But it looks very hacky :D

Copy link
Member

@lnicola lnicola Apr 1, 2020

Choose a reason for hiding this comment

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

.exclude([Glob::new("src/llvm-project/**")])?

Copy link
Contributor Author

@Veetaha Veetaha Apr 1, 2020

Choose a reason for hiding this comment

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

Nope, there is not into_iter for [T; N]

This comment was marked as resolved.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

&[T] yields only refs &T, but here we need T

@matklad
Copy link
Member

matklad commented Apr 2, 2020

nice cleanup, but needs a rebase

bors d+

@bors
Copy link
Contributor

bors bot commented Apr 2, 2020

✌️ Veetaha can now approve this pull request. To approve and merge a pull request, simply reply with bors r+. More detailed instructions are available here.

@Veetaha
Copy link
Contributor Author

Veetaha commented Apr 2, 2020

bors r+

@bors
Copy link
Contributor

bors bot commented Apr 2, 2020

@bors bors bot merged commit 642f3f4 into rust-lang:master Apr 2, 2020
@Veetaha
Copy link
Contributor Author

Veetaha commented Apr 2, 2020

@matklad I think the issue with Cargo.toml drop order in tests is not resolved because CI failed again for this PR, as I can tell:
https://github.com/rust-analyzer/rust-analyzer/actions/runs/69284408

@Veetaha Veetaha deleted the simplify branch April 2, 2020 19:02
lnicola pushed a commit to lnicola/rust-analyzer that referenced this pull request Sep 25, 2024
…, r=saethlin

miri-script: use --remap-path-prefix to print errors relative to the right root

Inspired by rust-lang/rust-clippy#13232, this makes it so that when cargo-miri fails to build, `./miri check` will print errors with paths like `cargo-miri/src/setup.rs`. That means we can get rid of the miri-symlink-hacks and instead tell RA to just always invoke the `./miri clippy` script just once, in the root.

This means that we can no longer share a target dir between cargo-miri and miri as the RUSTFLAGS are different to crates that are shared in the dependency tree need to be built twice with two different flags. `miri-script` hence now has to set the MIRI environment variable to tell the `cargo miri setup` invocation where to find Miri.

I also made it so that errors in miri-script itself are properly shown in RA, for which the `./miri` shell wrapper needs to set the right flags.
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.

4 participants