Skip to content

Write generics of trait aliases into metadata. #57786

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

Closed
wants to merge 1 commit into from
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
1 change: 1 addition & 0 deletions src/librustc_metadata/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1213,6 +1213,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> {
hir::ItemKind::Union(..) |
hir::ItemKind::Impl(..) |
hir::ItemKind::Existential(..) |
hir::ItemKind::TraitAlias(..) |
hir::ItemKind::Trait(..) => Some(self.encode_generics(def_id)),
_ => None,
},
Expand Down
2 changes: 2 additions & 0 deletions src/test/ui/issues/auxiliary/issue-57676.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#![feature(trait_alias)]
trait TestAlias = core::fmt::Debug;
15 changes: 15 additions & 0 deletions src/test/ui/issues/issue-57676.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// aux-build:issue-57676.rs

extern crate issue_57676;

// This tests that when assembling the extension candidates for traits, the presence of a trait
// alias from another crate will not cause an ICE (the actual errors produced by this once the
// ICE is fixed aren't interesting).

use std::path::Path;

fn main() {
let d: Path = Path::new(".");
//~^ ERROR mismatched types [E0308]
//~^^ ERROR the size for values of type `[u8]` cannot be known at compilation time [E0277]
}
25 changes: 25 additions & 0 deletions src/test/ui/issues/issue-57676.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
error[E0308]: mismatched types
--> $DIR/issue-57676.rs:12:19
|
LL | let d: Path = Path::new(".");
| ^^^^^^^^^^^^^^ expected struct `std::path::Path`, found reference
|
= note: expected type `std::path::Path`
found type `&std::path::Path`

error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
--> $DIR/issue-57676.rs:12:9
|
LL | let d: Path = Path::new(".");
| ^ borrow the `Path` instead
|
= help: within `std::path::Path`, the trait `std::marker::Sized` is not implemented for `[u8]`
= note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: required because it appears within the type `std::path::Path`
= note: all local variables must have a statically known size
= help: unsized locals are gated as an unstable feature

error: aborting due to 2 previous errors

Some errors occurred: E0277, E0308.
For more information about an error, try `rustc --explain E0277`.