Skip to content

Conversation

dfordivam
Copy link
Contributor

The following code silently ignores the error as the LLVMRustSetLastError only tracks one error at a time. At all other places where LLVMRustSetLastError is used the code immediately returns.

if (!Plugin) {
LLVMRustSetLastError(("Failed to load pass plugin" + PluginPath.str()).c_str());
continue;
}

@rustbot
Copy link
Collaborator

rustbot commented Nov 17, 2022

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @cuviper (or someone else) soon.

Please see the contribution instructions for more information.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 17, 2022
@cuviper
Copy link
Member

cuviper commented Nov 19, 2022

cc #91125 @eskarn @nagisa

I think this is intentional to continue without the plugin, but you're right that LLVMRustSetLastError isn't useful if we don't actually indicate a failure. The similar code in opt prints that it's ignored and returns from its callback:
https://github.com/llvm/llvm-project/blob/96c037ef9c01e5e26c84e571feb3e5c16519727d/llvm/tools/opt/opt.cpp#L503-L508

@nagisa
Copy link
Member

nagisa commented Nov 21, 2022

A non-functional-change would be to concatenate all the plugins that failed into the error message and return it after the loop is done, though in practice I don't think it is a huge deal either way.

@dfordivam
Copy link
Contributor Author

In the legacy pass manager, not able to load a plugin used to be an error / panic. So I am not sure why the behavior should change with the new pass manager.

let lib = Library::new(plugin).unwrap_or_else(|e| bug!("couldn't load plugin: {}", e));

Concatenating the errors is definitely better, but as mentioned it isn't a big deal either way.

@cuviper
Copy link
Member

cuviper commented Nov 23, 2022

In the legacy pass manager, not able to load a plugin used to be an error / panic. So I am not sure why the behavior should change with the new pass manager.

OK, fair enough!

@bors r+

@bors
Copy link
Collaborator

bors commented Nov 23, 2022

📌 Commit 693c631 has been approved by cuviper

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 23, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 24, 2022
…iaskrgr

Rollup of 9 pull requests

Successful merges:

 - rust-lang#103908 (Suggest `.clone()` or `ref binding` on E0382)
 - rust-lang#104517 (Throw error on failure in loading llvm-plugin)
 - rust-lang#104594 (Properly handle `Pin<&mut dyn* Trait>` receiver in codegen)
 - rust-lang#104742 (Make `deref_into_dyn_supertrait` lint the impl and not the usage)
 - rust-lang#104753 (Pass `InferCtxt` to `DropRangeVisitor` so we can resolve vars)
 - rust-lang#104771 (Add regression test for issue rust-lang#99938)
 - rust-lang#104772 (Small accessibility improvements)
 - rust-lang#104775 (Use ObligationCtxt::normalize)
 - rust-lang#104778 (:arrow_up: rust-analyzer)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 1e0df88 into rust-lang:master Nov 24, 2022
@rustbot rustbot added this to the 1.67.0 milestone Nov 24, 2022
@dfordivam dfordivam deleted the patch-1 branch November 25, 2022 01:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants