-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): enabled a default visitor to be overrided * ast/rust-ast-visitor.h: passes a method virtual * checks/errors/rust-feature-gate.cc (FeatureGate::visit): implements all checks for the new features * checks/errors/rust-feature-gate.h: the prototypes of the new checkers * checks/errors/rust-feature.cc (Feature::create): implements the recognition and creation of some new features * checks/errors/rust-feature.h: creation of the features name in the enum gcc/testsuite/ChangeLog: * rust/compile/feature_extern_types.rs: Move to... * rust/compile/features/extern_types.rs: ...here. * rust/compile/feature_intrinsics.rs: Move to... * rust/compile/features/intrinsics.rs: ...here. * rust/compile/features/arbitrary_self_types_activated.rs: New test. * rust/compile/features/arbitrary_self_types_not_activated.rs: New test. * rust/compile/features/associated_type_defaults_activated.rs: New test. * rust/compile/features/const_trait_impl_activated.rs: New test. * rust/compile/features/doc_cfg_activated.rs: New test. * rust/compile/features/doc_cfg_not_activated.rs: New test. * rust/compile/features/feature.exp: New test. * rust/compile/features/impl_trait_in_assoc_type_activated.rs: New test. * rust/compile/features/impl_trait_in_assoc_type_not_activated.rs: New test. * rust/compile/features/register_tool_activated.rs: New test. * rust/compile/features/register_tool_not_activated.rs: New test.
- Loading branch information
1 parent
daa2977
commit 8a82b04
Showing
19 changed files
with
228 additions
and
3 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
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
5 changes: 5 additions & 0 deletions
5
gcc/testsuite/rust/compile/features/arbitrary_self_types_activated.rs
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,5 @@ | ||
#![feature(arbitrary_self_types)] | ||
|
||
trait Foo { | ||
fn bar(self: *const Self); | ||
} |
3 changes: 3 additions & 0 deletions
3
gcc/testsuite/rust/compile/features/arbitrary_self_types_not_activated.rs
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,3 @@ | ||
trait Foo { | ||
fn bar(self: *const Self); // { dg-error "arbitrary self types are experimental." } | ||
} |
1 change: 1 addition & 0 deletions
1
gcc/testsuite/rust/compile/features/associated_type_defaults_activated.rs
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 @@ | ||
#![feature(associated_type_defaults)] |
1 change: 1 addition & 0 deletions
1
gcc/testsuite/rust/compile/features/const_trait_impl_activated.rs
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 @@ | ||
#![feature(const_trait_impl)] |
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,20 @@ | ||
#![feature(doc_cfg)] | ||
|
||
#[cfg(any(windows, doc))] | ||
#[doc(cfg(windows))] | ||
/// The application's icon in the notification area (a.k.a. system tray). | ||
/// | ||
/// # Examples | ||
/// | ||
/// ```no_run | ||
/// extern crate my_awesome_ui_library; | ||
/// use my_awesome_ui_library::current_app; | ||
/// use my_awesome_ui_library::windows::notification; | ||
/// | ||
/// let icon = current_app().get::<notification::Icon>(); | ||
/// icon.show(); | ||
/// icon.show_message("Hello"); | ||
/// ``` | ||
pub struct Icon { | ||
// ... | ||
} |
18 changes: 18 additions & 0 deletions
18
gcc/testsuite/rust/compile/features/doc_cfg_not_activated.rs
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,18 @@ | ||
#[cfg(any(windows, doc))] | ||
#[doc(cfg(windows))] | ||
/// The application's icon in the notification area (a.k.a. system tray). | ||
/// | ||
/// # Examples | ||
/// | ||
/// ```no_run | ||
/// extern crate my_awesome_ui_library; | ||
/// use my_awesome_ui_library::current_app; | ||
/// use my_awesome_ui_library::windows::notification; | ||
/// | ||
/// let icon = current_app().get::<notification::Icon>(); | ||
/// icon.show(); | ||
/// icon.show_message("Hello"); | ||
/// ``` | ||
pub struct Icon { | ||
// ... | ||
} |
File renamed without changes.
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,35 @@ | ||
# Copyright (C) 2021-2024 Free Software Foundation, Inc. | ||
|
||
# This program is free software; you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation; either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with GCC; see the file COPYING3. If not see | ||
# <http://www.gnu.org/licenses/>. | ||
|
||
# Compile tests, no torture testing. | ||
# | ||
# These tests raise errors in the front end; torture testing doesn't apply. | ||
|
||
# Load support procs. | ||
load_lib rust-dg.exp | ||
|
||
# Initialize `dg'. | ||
dg-init | ||
|
||
# Main loop. | ||
set saved-dg-do-what-default ${dg-do-what-default} | ||
|
||
set dg-do-what-default "compile" | ||
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.rs]] "" "" | ||
set dg-do-what-default ${saved-dg-do-what-default} | ||
|
||
# All done. | ||
dg-finish |
28 changes: 28 additions & 0 deletions
28
gcc/testsuite/rust/compile/features/impl_trait_in_assoc_type_activated.rs
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,28 @@ | ||
// check-pass | ||
// { dg-additional-options "-frust-compile-until=lowering" } | ||
|
||
#![feature(impl_trait_in_assoc_type)] | ||
|
||
fn main() {} | ||
|
||
trait Bar { | ||
type Assoc; | ||
} | ||
|
||
trait Thing { | ||
type Out; | ||
fn func() -> Self::Out; | ||
} | ||
|
||
struct AssocIsCopy; | ||
impl Bar for AssocIsCopy { | ||
type Assoc = u8; | ||
} | ||
|
||
impl Thing for AssocIsCopy { | ||
type Out = impl Bar<Assoc: Copy>; | ||
|
||
fn func() -> Self::Out { | ||
AssocIsCopy | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
gcc/testsuite/rust/compile/features/impl_trait_in_assoc_type_not_activated.rs
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 @@ | ||
// { dg-additional-options "-frust-compile-until=lowering" } | ||
|
||
fn main() {} | ||
|
||
trait Bar { | ||
type Assoc; | ||
} | ||
|
||
trait Thing { | ||
type Out; | ||
fn func() -> Self::Out; | ||
} | ||
|
||
struct AssocIsCopy; | ||
impl Bar for AssocIsCopy { | ||
type Assoc = u8; | ||
} | ||
|
||
impl Thing for AssocIsCopy { | ||
type Out = impl Bar<Assoc: Copy>; // { dg-error "impl trait in assoc type is experimental" } | ||
|
||
fn func() -> Self::Out { | ||
AssocIsCopy | ||
} | ||
} |
File renamed without changes.
4 changes: 4 additions & 0 deletions
4
gcc/testsuite/rust/compile/features/register_tool_activated.rs
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,4 @@ | ||
#![feature(register_tool)] | ||
#![register_tool(my_tool)] | ||
|
||
fn main() {} |
3 changes: 3 additions & 0 deletions
3
gcc/testsuite/rust/compile/features/register_tool_not_activated.rs
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,3 @@ | ||
#![register_tool(my_tool)] // { dg-error "register tool is an experimental feature" } | ||
|
||
fn main() {} |