Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/librustdoc/passes/collect_intra_doc_links.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,12 @@ impl<'tcx> LinkCollector<'_, 'tcx> {
})
}
}
_ => unreachable!(),
_ => Err(UnresolvedPath {
item_id,
module_id,
partial_res: Some(Res::Def(DefKind::TyAlias, did)),
unresolved: variant_name.to_string().into(),
}),
}
}
_ => Err(UnresolvedPath {
Expand Down
11 changes: 11 additions & 0 deletions tests/rustdoc-ui/intra-doc/ty-alias-field.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#![deny(rustdoc::broken_intra_doc_links)]
//~^ NOTE the lint level is defined here

/// [Self::a::b]
//~^ ERROR unresolved link to `Self::a::b`
//~| NOTE the struct `MyStruct` has no field or associated item named `a`
pub struct MyStruct;
/// [Self::a::b]
//~^ ERROR unresolved link to `Self::a::b`
//~| NOTE the type alias `MyAlias` has no associated item named `a`
pub type MyAlias = MyStruct;
20 changes: 20 additions & 0 deletions tests/rustdoc-ui/intra-doc/ty-alias-field.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
error: unresolved link to `Self::a::b`
--> $DIR/ty-alias-field.rs:4:6
|
LL | /// [Self::a::b]
| ^^^^^^^^^^ the struct `MyStruct` has no field or associated item named `a`
|
note: the lint level is defined here
--> $DIR/ty-alias-field.rs:1:9
|
LL | #![deny(rustdoc::broken_intra_doc_links)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: unresolved link to `Self::a::b`
--> $DIR/ty-alias-field.rs:8:6
|
LL | /// [Self::a::b]
| ^^^^^^^^^^ the type alias `MyAlias` has no associated item named `a`

error: aborting due to 2 previous errors

Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Regression test for <https://github.com/rust-lang/rust/issues/18611>.
fn add_state(op: <isize as HasState>::State) {
//~^ ERROR `isize: HasState` is not satisfied
//~| ERROR `isize: HasState` is not satisfied
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
error[E0277]: the trait bound `isize: HasState` is not satisfied
--> $DIR/issue-18611.rs:1:18
--> $DIR/assoc-type-unsatisfied-bound.rs:3:18
|
LL | fn add_state(op: <isize as HasState>::State) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `HasState` is not implemented for `isize`
|
help: this trait has no implementations, consider adding one
--> $DIR/issue-18611.rs:6:1
--> $DIR/assoc-type-unsatisfied-bound.rs:8:1
|
LL | trait HasState {
| ^^^^^^^^^^^^^^

error[E0277]: the trait bound `isize: HasState` is not satisfied
--> $DIR/issue-18611.rs:1:18
--> $DIR/assoc-type-unsatisfied-bound.rs:3:18
|
LL | fn add_state(op: <isize as HasState>::State) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `HasState` is not implemented for `isize`
|
help: this trait has no implementations, consider adding one
--> $DIR/issue-18611.rs:6:1
--> $DIR/assoc-type-unsatisfied-bound.rs:8:1
|
LL | trait HasState {
| ^^^^^^^^^^^^^^
Expand Down
4 changes: 4 additions & 0 deletions tests/ui/attributes/malformed-attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@
//~^ ERROR malformed
#[optimize]
//~^ ERROR malformed
#[optimize(none, none)]
//~^ ERROR malformed
#[optimize(none, speed)]
//~^ ERROR malformed
#[cold = 1]
//~^ ERROR malformed
#[must_use()]
Expand Down
Loading
Loading