-
Notifications
You must be signed in to change notification settings - Fork 162
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
Required features for Rust For Linux #3309
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,11 +17,19 @@ | |
// <http://www.gnu.org/licenses/>. | ||
|
||
#include "rust-feature-gate.h" | ||
#include "config.h" | ||
#include "is-a.h" | ||
#include "rust-abi.h" | ||
#include "rust-ast.h" | ||
#include "rust-attribute-values.h" | ||
#include "rust-ast-visitor.h" | ||
#include "rust-feature.h" | ||
#include "rust-ast-full.h" | ||
#include "rust-item.h" | ||
#include "rust-path.h" | ||
#include "rust-type.h" | ||
#include "rust-tyty.h" | ||
#include <iostream> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this should use rust-system.h i dont see why you need iostream and rust-tyty.h for the type abstractions There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I do not need them actually, my lsp just went overboard with the includes ^^' |
||
|
||
namespace Rust { | ||
|
||
|
@@ -236,4 +244,40 @@ FeatureGate::visit (AST::UseTreeGlob &use) | |
// #[feature(prelude_import)] | ||
} | ||
|
||
void | ||
FeatureGate::visit (AST::RawPointerType &type) | ||
{ | ||
auto &t = static_cast<AST::TypePath &> (type.get_type_pointed_to ()); | ||
if (t.get_num_segments () == 1) | ||
{ | ||
auto seg | ||
= static_cast<AST::TypePathSegment> (*t.get_segments ().at (0).get ()); | ||
if (seg.is_big_self_seg ()) | ||
gate (Feature::Name::ARBITRARY_SELF_TYPES, type.get_locus (), | ||
"arbitrary self types are experimental"); | ||
} | ||
} | ||
|
||
void | ||
FeatureGate::visit (AST::ImplTraitType &type) | ||
{ | ||
gate (Feature::Name::IMPL_TRAIT_IN_ASSOC_TYPE, type.get_locus (), | ||
"impl trait in assoc type is experimental"); | ||
} | ||
|
||
void | ||
FeatureGate::visit (AST::ImplTraitTypeOneBound &type) | ||
{ | ||
gate (Feature::Name::IMPL_TRAIT_IN_ASSOC_TYPE, type.get_locus (), | ||
"impl trait in assoc type is experimental"); | ||
} | ||
|
||
void | ||
FeatureGate::visit (AST::Attribute &attr) | ||
{ | ||
if (attr.get_path ().as_string () == "register_tool") | ||
gate (Feature::Name::REGISTER_TOOL, attr.get_locus (), | ||
"register tool is an experimental feature"); | ||
} | ||
|
||
} // namespace Rust |
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); | ||
} |
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." } | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// check-pass | ||
Check failure on line 1 in gcc/testsuite/rust/compile/features/associated_type_defaults_activated.rs GitHub Actions / build-and-check-ubuntu-32bitTest failure (FAIL)
Check failure on line 1 in gcc/testsuite/rust/compile/features/associated_type_defaults_activated.rs GitHub Actions / build-alpine-32bit-and-check-alpine-32bitTest failure (FAIL)
Check failure on line 1 in gcc/testsuite/rust/compile/features/associated_type_defaults_activated.rs GitHub Actions / build-and-check-asanTest failure (FAIL)
Check failure on line 1 in gcc/testsuite/rust/compile/features/associated_type_defaults_activated.rs GitHub Actions / build-and-check-ubuntu-64bitTest failure (FAIL)
|
||
|
||
// This is another instance of the "normalizations don't work" issue with | ||
// defaulted associated types. | ||
|
||
#![feature(associated_type_defaults)] | ||
|
||
pub trait Emitter<'a> { | ||
type Ctxt: 'a; | ||
type CtxtBrw: 'a = &'a Self::Ctxt; | ||
|
||
fn get_cx(&'a self) -> Self::CtxtBrw; | ||
} | ||
|
||
fn main() {} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// check-pass | ||
Check failure on line 1 in gcc/testsuite/rust/compile/features/associated_type_defaults_not_activated.rs GitHub Actions / build-and-check-ubuntu-32bitTest failure (FAIL)
Check failure on line 1 in gcc/testsuite/rust/compile/features/associated_type_defaults_not_activated.rs GitHub Actions / build-alpine-32bit-and-check-alpine-32bitTest failure (FAIL)
Check failure on line 1 in gcc/testsuite/rust/compile/features/associated_type_defaults_not_activated.rs GitHub Actions / build-and-check-asanTest failure (FAIL)
Check failure on line 1 in gcc/testsuite/rust/compile/features/associated_type_defaults_not_activated.rs GitHub Actions / build-and-check-ubuntu-64bitTest failure (FAIL)
|
||
|
||
// This is another instance of the "normalizations don't work" issue with | ||
// defaulted associated types. | ||
|
||
// #![feature(associated_type_defaults)] | ||
|
||
pub trait Emitter<'a> { | ||
type Ctxt: 'a; | ||
type CtxtBrw: 'a = &'a Self::Ctxt; | ||
|
||
fn get_cx(&'a self) -> Self::CtxtBrw; | ||
} | ||
|
||
fn main() {} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#![feature(const_trait_impl)] |
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 { | ||
// ... | ||
} |
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 { | ||
// ... | ||
} |
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 |
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 | ||
} | ||
} |
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 | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#![feature(register_tool)] | ||
#![register_tool(my_tool)] | ||
|
||
fn main() {} |
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() {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this need virtual i dont see where your overriding it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh wait scratch that i see now sorry