-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rust: fix ICE when compiling impl block for !
We need to resolve the never type which is its own special AST node so it doesnt magically get handled like the regular builtin type paths such as i32. Fixes #3035 gcc/rust/ChangeLog: * resolve/rust-ast-resolve-type.cc (ResolveType::visit): handle never type (ResolveTypeToCanonicalPath::visit): likewise * resolve/rust-ast-resolve-type.h: missing never type * resolve/rust-name-resolver.cc (Resolver::generate_builtins): track never type node_id (Resolver::setup_builtin): likewise * resolve/rust-name-resolver.h: new never type getter gcc/testsuite/ChangeLog: * rust/compile/nr2/exclude: nr2 cant handle this * rust/compile/issue-3035.rs: New test. Signed-off-by: Philip Herron <herron.philip@googlemail.com>
- Loading branch information
Showing
6 changed files
with
48 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#[lang = "sized"] | ||
trait Sized {} | ||
|
||
// ---- gccrs additions | ||
|
||
#[lang = "clone"] | ||
pub trait Clone: Sized { | ||
#[stable(feature = "rust1", since = "1.0.0")] | ||
#[must_use = "cloning is often expensive and is not expected to have side effects"] | ||
fn clone(&self) -> Self; | ||
|
||
#[inline] | ||
#[stable(feature = "rust1", since = "1.0.0")] | ||
fn clone_from(&mut self, source: &Self) { | ||
*self = source.clone() | ||
} | ||
} | ||
|
||
#[unstable(feature = "never_type", issue = "35121")] | ||
impl Clone for ! { | ||
#[inline] | ||
fn clone(&self) -> Self { | ||
*self | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters