Skip to content

Incorrect span / broken rustfix: help: use dyn: dyn #[dom_struct] #61963

Closed
@SimonSapin

Description

@SimonSapin

One of the many new (or newly enabled by default) warnings in Servo in today’s Nightly:

warning: trait objects without an explicit `dyn` are deprecated
   --> components/script/dom/window.rs:169:1
    |
169 | #[dom_struct]
    | ^^^^^^^^^^^^^ help: use `dyn`: `dyn #[dom_struct]`

The suggestion is wrong, which means cargo fix also fails and therefore does not apply fixes for (the many) other warnings where the suggestion is correct.

warning: failed to automatically apply fixes suggested by rustc to crate `script`

after fixes were automatically applied the compiler reported errors within these files:

  * components/script/dom/dedicatedworkerglobalscope.rs

This likely indicates a bug in either rustc or cargo itself,
and we would appreciate a bug report! You're likely to see 
a number of compiler warnings after this message which cargo
attempted to fix but failed. If you could open an issue at
https://github.com/rust-lang/rust/issues
quoting the full output of this command we'd be very appreciative!
Note that you may be able to make some more progress in the near-term
fixing code with the `--broken-code` flag

The following errors were reported:
error: expected item, found keyword `dyn`
   --> components/script/dom/dedicatedworkerglobalscope.rs:164:1
    |
164 | dyn #[dom_struct]
    | ^^^ expected item

error: aborting due to previous error

Original diagnostics will follow.

Metadata

Metadata

Assignees

Labels

A-attributesArea: Attributes (`#[…]`, `#![…]`)A-parserArea: The lexing & parsing of Rust source code to an ASTA-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`C-bugCategory: This is a bug.E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable ExampleP-highHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions