Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

Work around https://github.com/rust-lang/rust/pull/55937 #1220

Merged
merged 1 commit into from
Jan 2, 2019

Conversation

Xanewok
Copy link
Member

@Xanewok Xanewok commented Jan 2, 2019

This exchanges a compilation error for a warning-but-future-error
but at least it compiles now and I'm not exactly sure how to fix it
without cloning those METHOD constants on every match (which is less
than ideal, to say the least).

This exchanges a compilation error for a warning-but-future-error
but at least it compiles now and I'm not exactly sure how to fix it
without cloning those `METHOD` constants on every match (which is less
than ideal, to say the least).
@Xanewok
Copy link
Member Author

Xanewok commented Jan 2, 2019

Previous error:

error[E0621]: explicit lifetime required in the type of `msg`======> ] 245/246: rls(bin)
   --> src/tools/rls/src/server/mod.rs:185:21
    |
173 |       fn dispatch_message(&mut self, msg: &RawMessage) -> Result<(), jsonrpc::Error> {
    |                                           ----------- help: add explicit lifetime `'static` to the type of `msg`: `&'static server::message::RawMessage`
...
185 |                       <$n_action as LSPNotification>::METHOD => {
    |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime `'static` required
...
259 | /         match_action!(
260 | |             msg.method;
261 | |             notifications:
262 | |                 notifications::Initialized,
...   |
287 | |                 requests::CodeLensRequest;
288 | |         );
    | |__________- in this macro invocation
error: aborting due to previous error

New warning:

warning[E0597]: `msg.method` does not live long enough=============> ] 245/246: rls(bin)                                      [342/1941]
   --> src/tools/rls/src/server/mod.rs:260:13
    |
185 |                     <$n_action as LSPNotification>::METHOD => {
    |                     -------------------------------------- type annotation requires that `msg.method` is borrowed for `'static`
...
260 |             msg.method;
    |             ^^^^^^^^^^ borrowed value does not live long enough
...
290 |     }
    |     - `msg.method` dropped here while still borrowed
    |
    = warning: this error has been downgraded to a warning for backwards compatibility with previous releases
    = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
    Finished release [optimized] target(s) in 41.03s

@Xanewok
Copy link
Member Author

Xanewok commented Jan 2, 2019

failures:
    test_use_statement_completion_doesnt_suggest_arguments
test result: FAILED. 12 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out

spurious failure, retrying

@Xanewok Xanewok closed this Jan 2, 2019
@Xanewok Xanewok reopened this Jan 2, 2019
@Xanewok
Copy link
Member Author

Xanewok commented Jan 2, 2019

The underlying error/warning seems to be a bug, tracked at rust-lang/rust#57280. Gonna go ahead and merge this to fix the RLS toolstate.

cc @nrc

@Xanewok Xanewok merged commit cdc2464 into rust-lang:master Jan 2, 2019
@Xanewok Xanewok deleted the ub-or-not-ub branch January 2, 2019 20:58
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant