ProcMacro::Literal
literal_from_string (const std::string &data, bool &error)
{
- Lexer lex (data);
+ Lexer lex (data, nullptr);
const_TokenPtr output = lex.build_token ();
if (output == nullptr || !output->is_literal ())
{
tokenstream_from_string (std::string &data, bool &lex_error)
{
// FIXME: Insert location pointing to call site in tokens
- Lexer lex (data);
+ Lexer lex (data, nullptr);
std::vector<const_TokenPtr> tokens;
TokenPtr ptr;
return cpp_check_xid_property (codepoint) & CPP_XID_CONTINUE;
}
-Lexer::Lexer (const std::string &input)
+Lexer::Lexer (const std::string &input, Linemap *linemap)
: input (RAIIFile::create_error ()), current_line (1), current_column (1),
- line_map (nullptr), dump_lex_out ({}),
+ line_map (linemap), dump_lex_out ({}),
raw_input_source (new BufferInputSource (input, 0)),
input_queue{*raw_input_source}, token_queue (TokenSource (this))
{}
tl::optional<std::ofstream &> dump_lex_opt = tl::nullopt);
// Lex the contents of a string instead of a file
- Lexer (const std::string &input);
+ Lexer (const std::string &input, Linemap *linemap);
// dtor
~Lexer ();
key.clear ();
value.clear ();
- auto lexer = Lexer (input);
+ auto lexer = Lexer (input, nullptr);
auto parser = Parser<Lexer> (lexer);
auto token = parser.peek_current_token ();
mappings->set_current_crate (crate_num);
// then lets parse this as a 2nd crate
- Lexer lex (extern_crate.get_metadata ());
+ Lexer lex (extern_crate.get_metadata (), linemap);
Parser<Lexer> parser (lex);
std::unique_ptr<AST::Crate> metadata_crate = parser.parse_crate ();
TyTy::BaseType *self = nullptr;
std::vector<TyTy::SubstitutionParamMapping> substitutions;
- // FIXME
- // this should use the resolve_generic_params like everywhere else
+ // this needs to be special cased for the sized trait to not auto implemented
+ // Sized on Self
for (auto &generic_param : trait_reference->get_generic_params ())
{
switch (generic_param.get ()->get_kind ())
break;
case HIR::GenericParam::GenericKind::TYPE: {
+ auto &typaram = static_cast<HIR::TypeParam &> (*generic_param);
+ bool is_self
+ = typaram.get_type_representation ().as_string ().compare ("Self")
+ == 0;
+
+ // https://doc.rust-lang.org/std/marker/trait.Sized.html
+ // The one exception is the implicit Self type of a trait
+ bool apply_sized = !is_self;
auto param_type
- = TypeResolveGenericParam::Resolve (generic_param.get ());
+ = TypeResolveGenericParam::Resolve (generic_param.get (),
+ apply_sized);
context->insert_type (generic_param->get_mappings (), param_type);
-
- auto &typaram = static_cast<HIR::TypeParam &> (*generic_param);
substitutions.push_back (
TyTy::SubstitutionParamMapping (typaram, param_type));
- if (typaram.get_type_representation ().as_string ().compare ("Self")
- == 0)
+ if (is_self)
{
rust_assert (param_type->get_kind () == TyTy::TypeKind::PARAM);
TyTy::ParamType *p
#include "rust-hir-type-check-base.h"
#include "rust-hir-type-check-expr.h"
#include "rust-hir-type-check-type.h"
+#include "rust-hir-trait-resolve.h"
#include "rust-type-util.h"
namespace Rust {
}
}
+TyTy::TypeBoundPredicate
+TypeCheckBase::get_marker_predicate (Analysis::RustLangItem::ItemType item_type,
+ location_t locus)
+{
+ DefId item_id = mappings->get_lang_item (item_type, locus);
+ HIR::Item *item = mappings->lookup_defid (item_id);
+ rust_assert (item != nullptr);
+ rust_assert (item->get_item_kind () == HIR::Item::ItemKind::Trait);
+
+ HIR::Trait &trait = *static_cast<HIR::Trait *> (item);
+ TraitReference *ref = TraitResolver::Resolve (trait);
+ rust_assert (ref != nullptr);
+
+ return TyTy::TypeBoundPredicate (*ref, BoundPolarity::RegularBound, locus);
+}
+
} // namespace Resolver
} // namespace Rust
TraitReference *resolve_trait_path (HIR::TypePath &);
TyTy::TypeBoundPredicate
- get_predicate_from_bound (HIR::TypePath &path, HIR::Type *associated_self);
+ get_predicate_from_bound (HIR::TypePath &path, HIR::Type *associated_self,
+ BoundPolarity polarity
+ = BoundPolarity::RegularBound);
bool check_for_unconstrained (
const std::vector<TyTy::SubstitutionParamMapping> ¶ms_to_constrain,
const std::vector<std::unique_ptr<HIR::GenericParam> > &generic_params,
std::vector<TyTy::SubstitutionParamMapping> &substitutions);
+ TyTy::TypeBoundPredicate
+ get_marker_predicate (Analysis::RustLangItem::ItemType item_type,
+ location_t locus);
+
Analysis::Mappings *mappings;
Resolver *resolver;
TypeCheckContext *context;
}
TyTy::ParamType *
-TypeResolveGenericParam::Resolve (HIR::GenericParam *param)
+TypeResolveGenericParam::Resolve (HIR::GenericParam *param, bool apply_sized)
{
- TypeResolveGenericParam resolver;
+ TypeResolveGenericParam resolver (apply_sized);
switch (param->get_kind ())
{
case HIR::GenericParam::GenericKind::TYPE:
= new HIR::TypePath (mappings, {}, BUILTINS_LOCATION, false);
}
+ std::map<DefId, std::vector<TyTy::TypeBoundPredicate>> predicates;
+
+ // https://doc.rust-lang.org/std/marker/trait.Sized.html
+ // All type parameters have an implicit bound of Sized. The special syntax
+ // ?Sized can be used to remove this bound if it’s not appropriate.
+ //
+ // We can only do this when we are not resolving the implicit Self for Sized
+ // itself
+ rust_debug_loc (param.get_locus (), "apply_sized: %s",
+ apply_sized ? "true" : "false");
+ if (apply_sized)
+ {
+ TyTy::TypeBoundPredicate sized_predicate
+ = get_marker_predicate (Analysis::RustLangItem::ItemType::SIZED,
+ param.get_locus ());
+
+ predicates[sized_predicate.get_id ()] = {sized_predicate};
+ }
+
// resolve the bounds
- std::vector<TyTy::TypeBoundPredicate> specified_bounds;
if (param.has_type_param_bounds ())
{
for (auto &bound : param.get_type_param_bounds ())
TyTy::TypeBoundPredicate predicate
= get_predicate_from_bound (b->get_path (),
- implicit_self_bound);
+ implicit_self_bound,
+ b->get_polarity ());
if (!predicate.is_error ())
- specified_bounds.push_back (std::move (predicate));
+ {
+ switch (predicate.get_polarity ())
+ {
+ case BoundPolarity::AntiBound: {
+ bool found = predicates.find (predicate.get_id ())
+ != predicates.end ();
+ if (found)
+ predicates.erase (predicate.get_id ());
+ else
+ {
+ // emit error message
+ rich_location r (line_table, b->get_locus ());
+ r.add_range (predicate.get ()->get_locus ());
+ rust_error_at (
+ r, "antibound for %s is not applied here",
+ predicate.get ()->get_name ().c_str ());
+ }
+ }
+ break;
+
+ default: {
+ if (predicates.find (predicate.get_id ())
+ == predicates.end ())
+ {
+ predicates[predicate.get_id ()] = {};
+ }
+ predicates[predicate.get_id ()].push_back (predicate);
+ }
+ break;
+ }
+ }
}
break;
}
}
+ // now to flat map the specified_bounds into the raw specified predicates
+ std::vector<TyTy::TypeBoundPredicate> specified_bounds;
+ for (auto it = predicates.begin (); it != predicates.end (); it++)
+ {
+ for (const auto &predicate : it->second)
+ {
+ specified_bounds.push_back (predicate);
+ }
+ }
+
resolved = new TyTy::ParamType (param.get_type_representation ().as_string (),
param.get_locus (),
param.get_mappings ().get_hirid (), param,
class TypeResolveGenericParam : public TypeCheckBase
{
public:
- static TyTy::ParamType *Resolve (HIR::GenericParam *param);
+ static TyTy::ParamType *Resolve (HIR::GenericParam *param,
+ bool apply_sized = true);
protected:
void visit (HIR::TypeParam ¶m);
void visit (HIR::ConstGenericParam ¶m);
private:
- TypeResolveGenericParam () : TypeCheckBase (), resolved (nullptr) {}
+ TypeResolveGenericParam (bool apply_sized)
+ : TypeCheckBase (), resolved (nullptr), apply_sized (apply_sized)
+ {}
TyTy::ParamType *resolved;
+ bool apply_sized;
};
class ResolveWhereClauseItem : public TypeCheckBase
TypeCheckContext::insert_autoderef_mappings (
HirId id, std::vector<Adjustment> &&adjustments)
{
- rust_assert (autoderef_mappings.find (id) == autoderef_mappings.end ());
autoderef_mappings.emplace (id, std::move (adjustments));
}
TypeCheckContext::insert_cast_autoderef_mappings (
HirId id, std::vector<Adjustment> &&adjustments)
{
- rust_assert (cast_autoderef_mappings.find (id)
- == cast_autoderef_mappings.end ());
cast_autoderef_mappings.emplace (id, std::move (adjustments));
}
{
const TyTy::BaseType *raw = receiver->destructure ();
- // does this thing actually implement sized?
+ // https://runrust.miraheze.org/wiki/Dynamically_Sized_Type
+ // everything is sized except for:
+ //
+ // 1. dyn traits
+ // 2. slices
+ // 3. str
+ // 4. ADT's which contain any of the above
+ // t. tuples which contain any of the above
switch (raw->get_kind ())
{
- case TyTy::ADT:
- case TyTy::STR:
+ case TyTy::ARRAY:
case TyTy::REF:
case TyTy::POINTER:
case TyTy::PARAM:
- case TyTy::SLICE:
case TyTy::FNDEF:
case TyTy::FNPTR:
- case TyTy::TUPLE:
case TyTy::BOOL:
case TyTy::CHAR:
case TyTy::INT:
case TyTy::ISIZE:
case TyTy::CLOSURE:
case TyTy::INFER:
- assemble_builtin_candidate (Analysis::RustLangItem::SIZED);
- break;
-
- case TyTy::ARRAY:
case TyTy::NEVER:
case TyTy::PLACEHOLDER:
case TyTy::PROJECTION:
+ assemble_builtin_candidate (Analysis::RustLangItem::SIZED);
+ break;
+
+ // FIXME str and slice need to be moved and test cases updated
+ case TyTy::SLICE:
+ case TyTy::STR:
+ case TyTy::ADT:
+ case TyTy::TUPLE:
+ // FIXME add extra checks
+ assemble_builtin_candidate (Analysis::RustLangItem::SIZED);
+ break;
+
case TyTy::DYNAMIC:
case TyTy::ERROR:
break;
TyTy::TypeBoundPredicate
TypeCheckBase::get_predicate_from_bound (HIR::TypePath &type_path,
- HIR::Type *associated_self)
+ HIR::Type *associated_self,
+ BoundPolarity polarity)
{
TyTy::TypeBoundPredicate lookup = TyTy::TypeBoundPredicate::error ();
bool already_resolved
if (trait->is_error ())
return TyTy::TypeBoundPredicate::error ();
- TyTy::TypeBoundPredicate predicate (*trait, BoundPolarity::RegularBound,
- type_path.get_locus ());
+ TyTy::TypeBoundPredicate predicate (*trait, polarity, type_path.get_locus ());
HIR::GenericArgs args
= HIR::GenericArgs::create_empty (type_path.get_locus ());
TypeCheckType::Resolve (fn.get_return_type ().get ());
HIR::TraitItem *trait_item = mappings->lookup_trait_item_lang_item (
- Analysis::RustLangItem::ItemType::FN_ONCE_OUTPUT);
+ Analysis::RustLangItem::ItemType::FN_ONCE_OUTPUT,
+ final_seg->get_locus ());
std::vector<HIR::GenericArgsBinding> bindings;
location_t output_locus = fn.get_return_type ()->get_locus ();
TyTy::BaseType *type = it.second;
TypeBoundPredicateItem item = lookup_associated_item (identifier);
- rust_assert (!item.is_error ());
-
- const auto item_ref = item.get_raw_item ();
- item_ref->associated_type_set (type);
+ if (!item.is_error ())
+ {
+ const auto item_ref = item.get_raw_item ();
+ item_ref->associated_type_set (type);
+ }
}
// FIXME more error handling at some point
return builtinMarker;
}
-HIR::TraitItem *
-Mappings::lookup_trait_item_lang_item (Analysis::RustLangItem::ItemType item)
+DefId
+Mappings::get_lang_item (RustLangItem::ItemType item_type, location_t locus)
{
- DefId trait_item_id = UNKNOWN_DEFID;
- bool trait_item_lang_item_defined = lookup_lang_item (item, &trait_item_id);
+ DefId item = UNKNOWN_DEFID;
+ bool ok = lookup_lang_item (item_type, &item);
+ if (!ok)
+ rust_fatal_error (locus, "failed to find lang item %s",
+ RustLangItem::ToString (item_type).c_str ());
- // FIXME
- // make this an error? what does rustc do when a lang item is not defined?
- rust_assert (trait_item_lang_item_defined);
+ return item;
+}
+HIR::TraitItem *
+Mappings::lookup_trait_item_lang_item (Analysis::RustLangItem::ItemType item,
+ location_t locus)
+{
+ DefId trait_item_id = get_lang_item (item, locus);
return lookup_trait_item_defid (trait_item_id);
}
return true;
}
+ // This will fatal_error when this lang item does not exist
+ DefId get_lang_item (RustLangItem::ItemType item_type, location_t locus);
+
void insert_macro_def (AST::MacroRulesDefinition *macro);
bool lookup_macro_def (NodeId id, AST::MacroRulesDefinition **def);
HIR::ImplBlock *lookup_builtin_marker ();
HIR::TraitItem *
- lookup_trait_item_lang_item (Analysis::RustLangItem::ItemType item);
+ lookup_trait_item_lang_item (Analysis::RustLangItem::ItemType item,
+ location_t locus);
private:
Mappings ();
if (ident.is_raw)
value = "r#" + value;
- Lexer lexer (value);
+ Lexer lexer (value, nullptr);
auto token = lexer.build_token ();
token->set_locus (convert (ident.span));
result.push_back (token);
{
// TODO: UTF-8 string
std::string whole (acc.begin (), acc.end ());
- auto lexer = Lexer (whole);
+ auto lexer = Lexer (whole, nullptr);
auto token = lexer.build_token ();
token->set_locus (convert (punct.span));
result.push_back (token);
+#[lang = "sized"]
+pub trait Sized {}
+
mod core {
mod ops {
#[lang = "add"]
// { dg-additional-options "-w -fdump-tree-gimple -frust-crate=example" }
+#[lang = "sized"]
+pub trait Sized {}
+
struct Foo(i32);
trait TR {
+#[lang = "sized"]
+pub trait Sized {}
+
fn test<T>(a: T) -> T {
a
}
+#[lang = "sized"]
+pub trait Sized {}
+
#[lang = "fn_once"]
trait FnOnce<Args> {
type Output;
-struct S; // { dg-warning "struct is never constructed" "" { target *-*-* } .-1 }
+#[lang = "sized"]
+pub trait Sized {}
+
+struct S; // { dg-warning "struct is never constructed" }
impl S {
fn f() -> i32 { return 0; }
// { dg-warning "associated function is never used" "" { target *-*-* } .-1 }
// { dg-additional-options "-w" }
#![feature(intrinsics)]
+#[lang = "sized"]
+pub trait Sized {}
+
mod intrinsics {
extern "rust-intrinsic" {
pub fn wrapping_add<T>(a: T, b: T) -> T;
// There are errors about unused generic parameters, but we can't handle that yet.
// Still, this code is invalid Rust.
+#[lang = "sized"]
+pub trait Sized {}
+
mod sain {
struct Foo<const N: usize>;
struct Bar<T, const N: usize>;
+#[lang = "sized"]
+pub trait Sized {}
+
struct Bidule<const N: i32 = 15> {}
enum Bidoule<const N: i32 = 15> {}
+#[lang = "sized"]
+pub trait Sized {}
+
pub trait Clone {
fn clone(&self) -> Self;
}
+#[lang = "sized"]
+pub trait Sized {}
+
pub trait Clone {
fn clone(&self) -> Self;
}
+#[lang = "sized"]
+pub trait Sized {}
+
pub trait Copy {}
pub trait Clone {
fn clone(&self) -> Self;
+#[lang = "sized"]
+pub trait Sized {}
+
pub trait Copy {}
pub trait Clone {
fn clone(&self) -> Self;
+#[lang = "sized"]
+pub trait Sized {}
+
struct Foo<A>(A);
fn main() {
+#[lang = "sized"]
+pub trait Sized {}
+
struct Foo<A>(A);
impl Foo {
// { dg-error "expected .i32. got .i8." "" { target *-*-* } 0 }
+#[lang = "sized"]
+pub trait Sized {}
+
struct GenericStruct<T>(T, usize);
fn main() {
+#[lang = "sized"]
+pub trait Sized {}
+
struct Foo<T>(T, bool);
impl<T> Foo<T> {
+#[lang = "sized"]
+pub trait Sized {}
+
fn main() {
bar();
// { dg-error "type annotations needed" "" { target *-*-* } .-1 }
// { dg-error "expected .i32. got .i8." "" { target *-*-* } 0 }
+#[lang = "sized"]
+pub trait Sized {}
+
struct GenericStruct<T>(T, usize);
fn main() {
// { dg-error "expected .i32. got .i8." "" { target *-*-* } 0 }
+#[lang = "sized"]
+pub trait Sized {}
+
struct GenericStruct<T>(T, usize);
fn main() {
+#[lang = "sized"]
+pub trait Sized {}
+
struct GenericStruct<T>(T, usize);
fn main() {
+#[lang = "sized"]
+pub trait Sized {}
+
struct Foo<A> {
a: A,
}
+#[lang = "sized"]
+pub trait Sized {}
+
struct Foo<A> {
a: A,
}
+#[lang = "sized"]
+pub trait Sized {}
+
struct Foo<A, B>(A, B);
impl<T> Foo<i32, T> {
+#[lang = "sized"]
+pub trait Sized {}
+
pub enum Option<T> {
None,
Some(T),
// { dg-additional-options "-w" }
+#[lang = "sized"]
+pub trait Sized {}
+
impl<T> *const T {
fn test(self) {}
}
+#[lang = "sized"]
+pub trait Sized {}
+
trait A<T> {
type Output;
#![feature(intrinsics)]
+#[lang = "sized"]
+pub trait Sized {}
+
extern "rust-intrinsic" {
#[rustc_const_stable(feature = "const_ptr_offset", since = "1.61.0")]
pub fn offset<T>(dst: *const T, offset: isize) -> *const T;
+#[lang = "sized"]
+pub trait Sized {}
+
trait Foo<T> {
type Output;
+#[lang = "sized"]
+pub trait Sized {}
+
pub trait Hasher {
fn write(&mut self, bytes: &[u8]);
fn write_u8(&mut self, i: u8) {
// { dg-additional-options "-w" }
+#[lang = "sized"]
+pub trait Sized {}
+
pub trait Hasher {
fn finish(&self) -> u64;
fn write(&mut self, bytes: &[u8]);
// { dg-additional-options "-w" }
#![feature(intrinsics)]
+#[lang = "sized"]
+pub trait Sized {}
+
mod mem {
extern "rust-intrinsic" {
fn size_of<T>() -> usize;
#![feature(intrinsics)]
+#[lang = "sized"]
+pub trait Sized {}
+
extern "rust-intrinsic" {
fn size_of<T>() -> usize;
fn offset<T>(dst: *const T, offset: isize) -> *const T;
+#[lang = "sized"]
+pub trait Sized {}
+
struct Foo<T>(T);
fn main() {
#![feature(intrinsics)]
+#[lang = "sized"]
+pub trait Sized {}
+
mod mem {
extern "rust-intrinsic" {
pub fn transmute<U, V>(_: U) -> V;
// { dg-additional-options "-w" }
+#[lang = "sized"]
+pub trait Sized {}
+
struct FatPtr<T> {
data: *const T,
len: usize,
// { dg-additional-options "-w" }
#![feature(intrinsics)]
+#[lang = "sized"]
+pub trait Sized {}
+
mod intrinsics {
extern "rust-intrinsic" {
pub fn offset<T>(ptr: *const T, count: isize) -> *const T;
#![feature(intrinsics)]
+#[lang = "sized"]
+pub trait Sized {}
+
extern "C" {
fn printf(s: *const i8, ...);
}
+#[lang = "sized"]
+pub trait Sized {}
+
pub fn generic_function<X>(a: X) -> X {
a
}
// { dg-options "-w" }
+#[lang = "sized"]
+pub trait Sized {}
+
struct PhantomData<T>;
struct Hasher<S> {
+#[lang = "sized"]
+pub trait Sized {}
+
pub trait A: B {}
// { dg-error "trait cycle detected" "" { target *-*-* } .-1 }
+#[lang = "sized"]
+pub trait Sized {}
+
mod core {
mod ops {
#[lang = "add"]
+#[lang = "sized"]
+pub trait Sized {}
+
mod core {
mod ops {
#[lang = "add"]
+#[lang = "sized"]
+pub trait Sized {}
+
trait Foo<T> {
type A;
+#[lang = "sized"]
+pub trait Sized {}
+
#[lang = "clone"]
trait Clone {
fn clone(&self) -> Self;
+#[lang = "sized"]
+pub trait Sized {}
+
pub enum Option<T> {
None,
Some(T),
+#[lang = "sized"]
+pub trait Sized {}
+
mod intrinsics {
extern "rust-intrinsic" {
pub fn offset<T>(ptr: *const T, count: isize) -> *const T;
// { dg-options "-w" }
+#[lang = "sized"]
+pub trait Sized {}
+
fn test<T>(x: *mut T) {
let x = x as *mut u8;
}
+#[lang = "sized"]
+pub trait Sized {}
+
mod intrinsics {
extern "rust-intrinsic" {
pub fn offset<T>(ptr: *const T, count: isize) -> *const T;
+#[lang = "sized"]
+pub trait Sized {}
+
#[lang = "add"]
pub trait Add<RHS = Self> {
type Output;
+#[lang = "sized"]
+pub trait Sized {}
+
#[lang = "add"]
pub trait Add<RHS = Self> {
type Output;
+#[lang = "sized"]
+pub trait Sized {}
+
macro_rules! forward_ref_binop {
(impl $imp:ident, $method:ident for $t:ty, $u:ty) => {
forward_ref_binop!(impl $imp, $method for $t, $u,
+#[lang = "sized"]
+pub trait Sized {}
+
trait Hash<H> {
fn hash2(&self, hasher: &H) -> u64;
}
+#[lang = "sized"]
+pub trait Sized {}
+
trait Foo {
fn bar(&mut self, other: &mut Foo);
}
+#[lang = "sized"]
+pub trait Sized {}
+
trait Foo {
fn get(self) -> i32;
}
+#[lang = "sized"]
+pub trait Sized {}
+
pub enum Option<T> {
Some(T),
None,
+#[lang = "sized"]
+pub trait Sized {}
+
struct Foo(u32);
// { dg-warning "struct is never constructed" "" { target *-*-* } .-1 }
+#[lang = "sized"]
+pub trait Sized {}
+
pub trait Foo<A> {
fn foo(self, _: A) -> u16;
}
+#[lang = "sized"]
+pub trait Sized {}
+
pub trait Foo {
fn foo();
}
+#[lang = "sized"]
+pub trait Sized {}
+
struct S;
impl S {
+#[lang = "sized"]
+pub trait Sized {}
+
pub trait Foo {
fn foo();
}
+#[lang = "sized"]
+pub trait Sized {}
+
#[lang = "fn_once"]
pub trait FnOnce<Args> {
#[lang = "fn_once_output"]
+#[lang = "sized"]
+pub trait Sized {}
+
pub trait Alpha<T = Self> {
type Beta;
}
+#[lang = "sized"]
+pub trait Sized {}
+
trait Add {
type Output;
+#[lang = "sized"]
+pub trait Sized {}
+
#[lang = "deref"]
trait Deref {
type Target;
// { dg-options "-w" }
+#[lang = "sized"]
+pub trait Sized {}
+
#[lang = "deref"]
trait Deref {
type Target;
+#[lang = "sized"]
+pub trait Sized {}
+
struct A<T> {
// { dg-warning "struct is never constructed" "" { target *-*-* } .-1 }
f: *const T,
+#[lang = "sized"]
+pub trait Sized {}
+
fn main() {
struct Foo;
+#[lang = "sized"]
+pub trait Sized {}
+
#[lang = "add"]
pub trait Add<RHS = Self> {
type Output;
--- /dev/null
+#[lang = "sized"]
+pub trait Sized {}
+
+pub trait Trait {
+ fn foo(&self) -> Self
+ where
+ Self: Sized;
+}
+
+pub fn static_foo<T: Trait + ?Sized>(_b: &T) {}
+
+pub fn dynamic_bar(a: &dyn Trait) {
+ static_foo(a)
+}
+#[lang = "sized"]
+pub trait Sized {}
+
extern "C" {
fn printf(s: *const i8, ...);
}
pub use result::Result::{self, Err, Ok};
+#[lang = "sized"]
+pub trait Sized {}
+
extern "C" {
fn printf(s: *const i8, ...);
}
+#[lang = "sized"]
+pub trait Sized {}
+
struct S;
trait A {
fn foo(&self);
// { dg-additional-options "-w" }
+#[lang = "sized"]
+pub trait Sized {}
+
macro_rules! foo {
( ( $( $Trait: ident ),+ ) for $Ty: ident ) => {
$(
+#[lang = "sized"]
+pub trait Sized {}
+
macro_rules! define_trait {
($assoc:ident, $i:item) => {
type $assoc;
+#[lang = "sized"]
+pub trait Sized {}
+
macro_rules! maybe_impl {
($left:ident, $right:ident, $l_fn:ident, $r_fn:ident) => {
fn $l_fn(value: T) -> Maybe<T> {
// { dg-additional-options "-w" }
+#[lang = "sized"]
+pub trait Sized {}
+
macro_rules! t {
() => {
i32
+#[lang = "sized"]
+pub trait Sized {}
+
macro_rules! foo {
() => {"foo"};
(number) => { 12 };
+#[lang = "sized"]
+pub trait Sized {}
+
struct Bar;
trait Foo {
+#[lang = "sized"]
+pub trait Sized {}
+
trait Foo {
fn foo(&self) {} // { dg-warning "unused name" }
}
+#[lang = "sized"]
+pub trait Sized {}
+
pub struct A<T>(T);
pub struct B<T>(T);
+#[lang = "sized"]
+pub trait Sized {}
+
trait Foo {
type A;
+#[lang = "sized"]
+pub trait Sized {}
+
trait Foo {
type A;
+#[lang = "sized"]
+pub trait Sized {}
+
trait Bar {
type B;
+#[lang = "sized"]
+pub trait Sized {}
+
pub enum Either<T, E> {
Left(T),
Right(E),
+#[lang = "sized"]
+pub trait Sized {}
+
pub enum Either<L, R> {
Left(L),
Right(R),
+#[lang = "sized"]
+pub trait Sized {}
+
pub enum Result<T, E> {
Ok(T),
Err(E),
+#[lang = "sized"]
+pub trait Sized {}
+
mod orange {
mod green {
fn bean<T>(value: T) -> T {
// { dg-additional-options "-w" }
+#[lang = "sized"]
+pub trait Sized {}
+
struct Adt;
enum EAdt {
V0,
+#[lang = "sized"]
+pub trait Sized {}
+
mod mem {
extern "rust-intrinsic" {
pub fn size_of<T>() -> usize;
+#[lang = "sized"]
+pub trait Sized {}
+
pub struct A(i32, i32);
trait Clone {
+#[lang = "sized"]
+pub trait Sized {}
+
pub trait Foo {
type A;
+#[lang = "sized"]
+pub trait Sized {}
+
pub fn main() {
let a;
a = foo { a: 123, b: 456f32 };
+#[lang = "sized"]
+pub trait Sized {}
+
struct Foo {
a: f32,
b: bool,
+#[lang = "sized"]
+pub trait Sized {}
+
struct Foo<T>(T);
struct Bar<T> {
+#[lang = "sized"]
+pub trait Sized {}
+
struct Foo<T>(T, u32);
type TypeAlias = Foo<i32>;
+#[lang = "sized"]
+pub trait Sized {}
+
struct GenericStruct<T>(T, usize);
impl GenericStruct<i32> {
+#[lang = "sized"]
+pub trait Sized {}
+
struct Foo<A> {
a: A,
// { dg-warning "field is never read" "" { target *-*-* } .-1 }
+#[lang = "sized"]
+pub trait Sized {}
+
struct Foo<A> {
a: A,
// { dg-warning "field is never read" "" { target *-*-* } .-1 }
+#[lang = "sized"]
+pub trait Sized {}
+
struct Foo<T>(T, bool);
impl Foo<i32> {
+#[lang = "sized"]
+pub trait Sized {}
+
struct Foo<T>(T, bool);
impl Foo<i32> {
+#[lang = "sized"]
+pub trait Sized {}
+
struct Foo<T>(T);
impl<X> Foo<X> {
+#[lang = "sized"]
+pub trait Sized {}
+
struct Foo<T>(T);
impl<X> Foo<X> {
+#[lang = "sized"]
+pub trait Sized {}
+
struct Foo<X, Y>(X, Y);
impl<T> Foo<u32, T> {
+#[lang = "sized"]
+pub trait Sized {}
+
struct Foo(f32, bool);
struct GenericStruct<T>(T, usize);
+#[lang = "sized"]
+pub trait Sized {}
+
struct Foo<A, B>(A, B);
impl<T> Foo<T, T> {
+#[lang = "sized"]
+pub trait Sized {}
+
fn callee<T>(t: &T) -> i32 {
// { dg-warning "unused name" "" { target *-*-* } .-1 }
32
+#[lang = "sized"]
+pub trait Sized {}
+
fn callee<T>(t: (T, bool)) -> i32 {
// { dg-warning "unused name" "" { target *-*-* } .-1 }
32
+#[lang = "sized"]
+pub trait Sized {}
+
struct Foo<A = f32>(A);
fn main() {
+#[lang = "sized"]
+pub trait Sized {}
+
struct Foo<A = (isize, char)> {
a: A,
}
+#[lang = "sized"]
+pub trait Sized {}
+
struct Foo<A, B = (A, A)>(A, B);
fn main() {
+#[lang = "sized"]
+pub trait Sized {}
+
// github issue #415
fn test<A, B>(a: A, b: B) -> (A, B) {
(a, b)
+#[lang = "sized"]
+pub trait Sized {}
+
// github issue #415
fn test<A>(a: &A) -> &A {
a
+#[lang = "sized"]
+pub trait Sized {}
+
struct Foo<A, B>(A, B);
impl Foo<i32, f32> {
+#[lang = "sized"]
+pub trait Sized {}
+
struct Foo<A, B>(A, B);
impl Foo<i32, f32> {
+#[lang = "sized"]
+pub trait Sized {}
+
fn test<T>(a: T) -> T {
a
}
+#[lang = "sized"]
+pub trait Sized {}
+
struct Foo<A, B>(A, B);
impl<T> Foo<T, f32> {
+#[lang = "sized"]
+pub trait Sized {}
+
struct Foo<A, B>(A, B);
impl<T> Foo<T, f32> {
+#[lang = "sized"]
+pub trait Sized {}
+
struct Foo<A, B>(A, B);
impl<T> Foo<T, f32> {
+#[lang = "sized"]
+pub trait Sized {}
+
struct Foo<T> {
a: T,
// { dg-warning "field is never read" "" { target *-*-* } .-1 }
+#[lang = "sized"]
+pub trait Sized {}
+
fn test<T>(a: T) -> T {
a
}
+#[lang = "sized"]
+pub trait Sized {}
+
struct Foo<T>(T);
struct Bar<T> {
+#[lang = "sized"]
+pub trait Sized {}
+
struct Foo<T>(T);
struct Bar {
+#[lang = "sized"]
+pub trait Sized {}
+
struct GenericStruct<T>(T, usize);
impl<T> GenericStruct<T> {
+#[lang = "sized"]
+pub trait Sized {}
+
struct GenericStruct<T>(T, usize);
impl<T> GenericStruct<T> {
#![feature(intrinsics)]
+#[lang = "sized"]
+pub trait Sized {}
+
extern "rust-intrinsic" {
pub fn size_of<T>() -> usize;
}
#![feature(intrinsics)]
+#[lang = "sized"]
+pub trait Sized {}
+
extern "rust-intrinsic" {
pub fn unchecked_add<T>(x: T, y: T) -> T;
pub fn unchecked_sub<T>(x: T, y: T) -> T;
#![feature(intrinsics)]
+#[lang = "sized"]
+pub trait Sized {}
+
extern "rust-intrinsic" {
pub fn unchecked_add<T>(x: T, y: T) -> T;
// { dg-error "unchecked operation intrinsics can only be used with basic integer types .got .NotAdd.." "" { target *-*-* } .-1 }
+#[lang = "sized"]
+pub trait Sized {}
+
mod intrinsics {
extern "rust-intrinsic" {
pub fn add_with_overflow<T>(x: T, y: T) -> (T, bool);
#![feature(intrinsics)]
+#[lang = "sized"]
+pub trait Sized {}
+
extern "rust-intrinsic" {
pub fn size_of<T>() -> usize;
}
// { dg-additional-options "-w" }
#![feature(intrinsics)]
+#[lang = "sized"]
+pub trait Sized {}
+
extern "rust-intrinsic" {
#[rustc_const_stable(feature = "const_ptr_offset", since = "1.61.0")]
pub fn offset<T>(dst: *const T, offset: isize) -> *const T;
// { dg-additional-options "-w" }
#![feature(intrinsics)]
+
+#[lang = "sized"]
+pub trait Sized {}
+
mod intrinsics {
extern "rust-intrinsic" {
#[rustc_const_stable(feature = "const_int_wrapping", since = "1.40.0")]
+#[lang = "sized"]
+pub trait Sized {}
+
extern "C" {
fn printf(s: *const i8, ...);
}
+#[lang = "sized"]
+pub trait Sized {}
+
struct S;
fn foo<S>(s: S) -> S {
+#[lang = "sized"]
+pub trait Sized {}
+
pub trait Foo {
type Target;
// { dg-additional-options "-w" }
+
+#[lang = "sized"]
+pub trait Sized {}
+
extern "C" {
fn printf(s: *const i8, ...);
}
// { dg-additional-options "-w" }
+#[lang = "sized"]
+pub trait Sized {}
+
struct Foo<T>(T);
impl<T> Foo<T> {
fn new<Y>(a: T, b: Y) -> Self {
// { dg-additional-options "-w" }
+#[lang = "sized"]
+pub trait Sized {}
+
struct Foo<T>(T);
impl<T> Foo<T> {
fn new<Y>(a: T, b: Y) -> Self {
+#[lang = "sized"]
+pub trait Sized {}
+
trait A {
#[must_use]
fn test() -> i32;
+#[lang = "sized"]
+pub trait Sized {}
+
pub fn main() {
fn test<T>(x: T) -> T {
x
// { dg-options "-w" }
+#[lang = "sized"]
+pub trait Sized {}
+
#[lang = "phantom_data"]
struct PhantomData<T>;
// { dg-additional-options "-w" }
+#[lang = "sized"]
+pub trait Sized {}
+
#[lang = "RangeFull"]
pub struct RangeFull;
+#[lang = "sized"]
+pub trait Sized {}
+
trait Foo {
fn bar() -> i32;
}
+#[lang = "sized"]
+pub trait Sized {}
+
trait Foo {
type A;
+#[lang = "sized"]
+pub trait Sized {}
+
trait Foo {
type A;
+#[lang = "sized"]
+pub trait Sized {}
+
trait Trait {
const FOO: usize;
type Target;
+#[lang = "sized"]
+pub trait Sized {}
+
trait Foo<T> {
type A;
+#[lang = "sized"]
+pub trait Sized {}
+
trait Foo<T> {
type A;
+#[lang = "sized"]
+pub trait Sized {}
+
trait A {
fn a() -> i32 {
123
+#[lang = "sized"]
+pub trait Sized {}
+
trait A {
fn a() -> i32 {
123
+#[lang = "sized"]
+pub trait Sized {}
+
trait Foo<'a> {}
trait Bar {
// { dg-additional-options "-w" }
+#[lang = "sized"]
+pub trait Sized {}
+
trait Get {
type Value;
fn get(&self) -> &<Self as Get>::Value;
+#[lang = "sized"]
+pub trait Sized {}
+
trait Foo {
fn bar() -> i32;
}
+#[lang = "sized"]
+pub trait Sized {}
+
pub trait Foo {
fn Bar(self) -> i32;
}
+#[lang = "sized"]
+pub trait Sized {}
+
trait Foo {
type A;
type B;
+#[lang = "sized"]
+pub trait Sized {}
+
trait Foo {
type A;
type B;
+#[lang = "sized"]
+pub trait Sized {}
+
trait Foo {
type A;
+#[lang = "sized"]
+pub trait Sized {}
+
trait Foo {
const A: i32;
+#[lang = "sized"]
+pub trait Sized {}
+
trait Foo {
fn default() -> i32;
}
+#[lang = "sized"]
+pub trait Sized {}
+
trait Foo {
fn default() -> i32;
fn get(self) -> i32;
+#[lang = "sized"]
+pub trait Sized {}
+
mod mem {
extern "rust-intrinsic" {
fn size_of<T>() -> usize;
+#[lang = "sized"]
+pub trait Sized {}
+
mod mem {
extern "rust-intrinsic" {
fn size_of<T>() -> usize;
+#[lang = "sized"]
+pub trait Sized {}
+
mod intrinsics {
extern "rust-intrinsic" {
pub fn uninit<T>() -> T;
+#[lang = "sized"]
+pub trait Sized {}
+
pub fn f() {
let crab = ();
+#[lang = "sized"]
+pub trait Sized {}
+
trait Foo {
fn Bar() -> i32 {}
// { dg-error "expected .i32. got .()." "" { target *-*-* } .-1 }
+#[lang = "sized"]
+pub trait Sized {}
+
struct Foo(i32);
trait Bar {
+#[lang = "sized"]
+pub trait Sized {}
+
struct Foo(i32);
trait A {
+#[lang = "sized"]
+pub trait Sized {}
+
trait A<T> {
type Output;
+#[lang = "sized"]
+pub trait Sized {}
+
trait Foo {
fn Bar() -> i32 {}
// { dg-error "expected .i32. got .()." "" { target *-*-* } .-1 }
+#[lang = "sized"]
+pub trait Sized {}
+
trait Foo {
type A;
+#[lang = "sized"]
+pub trait Sized {}
+
trait Foo {
const A: i32;
+#[lang = "sized"]
+pub trait Sized {}
+
trait Foo {
const A: i32;
+#[lang = "sized"]
+pub trait Sized {}
+
trait Foo {
fn default() -> i32;
}
+#[lang = "sized"]
+pub trait Sized {}
+
trait Foo {
fn default() -> i32;
}
+#[lang = "sized"]
+pub trait Sized {}
+
trait A {
fn get(self) -> f64;
}
+#[lang = "sized"]
+pub trait Sized {}
+
struct Foo(i32);
trait Bar {
fn baz(&self);
+#[lang = "sized"]
+pub trait Sized {}
+
struct Foo<A, B>(A, B);
fn main() {
+#[lang = "sized"]
+pub trait Sized {}
+
struct Foo<T>(T, bool);
impl<X, Y> Foo<X> {
#![feature(intrinsics)]
+#[lang = "sized"]
+pub trait Sized {}
+
extern "rust-intrinsic" {
pub fn rotate_left<T>(l: T, r: T) -> T;
}
+#[lang = "sized"]
+pub trait Sized {}
+
extern "C" {
fn printf(s: *const i8, ...);
}
fn printf(s: *const i8, ...);
}
+#[lang = "sized"]
+pub trait Sized {}
+
#[lang = "fn_once"]
pub trait FnOnce<Args> {
#[lang = "fn_once_output"]
fn printf(s: *const i8, ...);
}
+#[lang = "sized"]
+pub trait Sized {}
+
#[lang = "fn_once"]
pub trait FnOnce<Args> {
#[lang = "fn_once_output"]
+#[lang = "sized"]
+pub trait Sized {}
+
#[lang = "fn_once"]
pub trait FnOnce<Args> {
#[lang = "fn_once_output"]
fn printf(s: *const i8, ...);
}
+#[lang = "sized"]
+pub trait Sized {}
+
struct Foo(i32);
trait Bar {
fn baz(&self);
fn printf(s: *const i8, ...);
}
+#[lang = "sized"]
+pub trait Sized {}
+
struct Foo(i32);
trait Bar {
fn baz(&self);
// { dg-output "123\n" }
+#[lang = "sized"]
+pub trait Sized {}
+
trait A {
fn get_int(&self) -> i32;
}
#![feature(intrinsics)]
+#[lang = "sized"]
+pub trait Sized {}
extern "rust-intrinsic" {
pub fn copy_nonoverlapping<T>(src: *const T, dst: *mut T, count: usize);
*i_copy - *i
}
-}
\ No newline at end of file
+}
+#[lang = "sized"]
+pub trait Sized {}
+
pub trait Clone {
fn clone(&self) -> Self;
}
+#[lang = "sized"]
+pub trait Sized {}
+
pub trait Clone {
fn clone(&self) -> Self;
}
+#[lang = "sized"]
+pub trait Sized {}
+
pub trait Clone {
fn clone(&self) -> Self;
}
// should be 0 if all fields were cloned correctly
l + r
-}
\ No newline at end of file
+}
// { dg-additional-options "-w" }
+#[lang = "sized"]
+pub trait Sized {}
+
#[lang = "index"]
trait Index<Idx> {
type Output;
// { dg-additional-options "-w" }
#![feature(intrinsics)]
+#[lang = "sized"]
+pub trait Sized {}
+
extern "rust-intrinsic" {
#[rustc_const_stable(feature = "const_ptr_offset", since = "1.61.0")]
pub fn offset<T>(dst: *const T, offset: isize) -> *const T;
// { dg-additional-options "-w" }
#![feature(intrinsics)]
+#[lang = "sized"]
+pub trait Sized {}
+
extern "rust-intrinsic" {
#[rustc_const_stable(feature = "const_ptr_offset", since = "1.61.0")]
pub fn offset<T>(dst: *const T, offset: isize) -> *const T;
fn printf(s: *const i8, ...);
}
+#[lang = "sized"]
+pub trait Sized {}
+
#[lang = "deref"]
pub trait Deref {
type Target;
// { dg-output "slice_access=3\r*\n" }
#![feature(intrinsics)]
+#[lang = "sized"]
+pub trait Sized {}
+
extern "rust-intrinsic" {
#[rustc_const_stable(feature = "const_ptr_offset", since = "1.61.0")]
fn offset<T>(dst: *const T, offset: isize) -> *const T;
// { dg-options "-w" }
// { dg-output "1\r*\n2\r*\n" }
+#[lang = "sized"]
+pub trait Sized {}
+
extern "C" {
fn printf(s: *const i8, ...);
}
// { dg-options "-w" }
+#[lang = "sized"]
+pub trait Sized {}
+
mod intrinsics {
extern "rust-intrinsic" {
#[rustc_const_stable(feature = "const_ptr_offset", since = "1.61.0")]
fn printf(s: *const i8, ...);
}
+#[lang = "sized"]
+pub trait Sized {}
+
#[lang = "deref"]
pub trait Deref {
type Target;
+#[lang = "sized"]
+pub trait Sized {}
+
mod core {
mod ops {
#[lang = "add"]
+#[lang = "sized"]
+pub trait Sized {}
+
mod core {
mod ops {
#[lang = "add"]
+#[lang = "sized"]
+pub trait Sized {}
+
#[lang = "fn_once"]
pub trait FnOnce<Args> {
#[lang = "fn_once_output"]
// { dg-output "123\n" }
+#[lang = "sized"]
+pub trait Sized {}
+
trait A {
fn get_int(&self) -> i32;
}
// { dg-output "123\n" }
+#[lang = "sized"]
+pub trait Sized {}
+
trait A {
fn get_int(&self) -> i32;
}
// { dg-options "-w" }
+#[lang = "sized"]
+pub trait Sized {}
+
mod core {
mod ops {
#[lang = "deref"]
fn printf(s: *const i8, ...);
}
+#[lang = "sized"]
+pub trait Sized {}
+
struct Foo<T>(T);
struct Bar<T> {
fn printf(s: *const i8, ...);
}
+#[lang = "sized"]
+pub trait Sized {}
+
struct Foo {}
trait Bar {
fn printf(s: *const i8, ...);
}
+#[lang = "sized"]
+pub trait Sized {}
+
enum Foo<T> {
A,
B(T),
fn printf(s: *const i8, ...);
}
+#[lang = "sized"]
+pub trait Sized {}
+
enum Foo<T> {
A,
B(T),
+#[lang = "sized"]
+pub trait Sized {}
+
trait Valuable {
const VALUE: i32;
}
+#[lang = "sized"]
+pub trait Sized {}
+
macro_rules! t {
() => {
i32
fn printf(s: *const i8, ...);
}
+#[lang = "sized"]
+pub trait Sized {}
+
#[lang = "deref"]
pub trait Deref {
type Target;
fn printf(s: *const i8, ...);
}
+#[lang = "sized"]
+pub trait Sized {}
+
#[lang = "deref"]
pub trait Deref {
type Target;
fn printf(s: *const i8, ...);
}
+#[lang = "sized"]
+pub trait Sized {}
+
#[lang = "deref"]
pub trait Deref {
type Target;
fn printf(s: *const i8, ...);
}
+#[lang = "sized"]
+pub trait Sized {}
+
#[lang = "add"]
pub trait Add<Rhs = Self> {
type Output;
fn printf(s: *const i8, ...);
}
+#[lang = "sized"]
+pub trait Sized {}
+
#[lang = "deref"]
pub trait Deref {
type Target;
fn printf(s: *const i8, ...);
}
+#[lang = "sized"]
+pub trait Sized {}
+
#[lang = "bitand"]
pub trait BitAnd<Rhs = Self> {
type Output;
fn printf(s: *const i8, ...);
}
+#[lang = "sized"]
+pub trait Sized {}
+
#[lang = "bitand_assign"]
pub trait BitAndAssign<Rhs = Self> {
fn bitand_assign(&mut self, rhs: Rhs);
fn printf(s: *const i8, ...);
}
+#[lang = "sized"]
+pub trait Sized {}
+
#[lang = "add"]
pub trait Add<Rhs = Self> {
type Output;
fn printf(s: *const i8, ...);
}
+#[lang = "sized"]
+pub trait Sized {}
+
#[lang = "add"]
pub trait Add<Rhs = Self> {
type Output;
fn printf(s: *const i8, ...);
}
+#[lang = "sized"]
+pub trait Sized {}
+
#[lang = "neg"]
pub trait Neg {
type Output;
fn printf(s: *const i8, ...);
}
+#[lang = "sized"]
+pub trait Sized {}
+
#[lang = "not"]
pub trait Not {
type Output;
fn printf(s: *const i8, ...);
}
+#[lang = "sized"]
+pub trait Sized {}
+
#[lang = "add_assign"]
pub trait AddAssign<Rhs = Self> {
fn add_assign(&mut self, rhs: Rhs);
fn printf(s: *const i8, ...);
}
+#[lang = "sized"]
+pub trait Sized {}
+
#[lang = "deref"]
pub trait Deref {
type Target;
fn printf(s: *const i8, ...);
}
+#[lang = "sized"]
+pub trait Sized {}
+
#[lang = "deref"]
pub trait Deref {
type Target;
fn printf(s: *const i8, ...);
}
+#[lang = "sized"]
+pub trait Sized {}
+
#[lang = "deref"]
pub trait Deref {
type Target;
#![feature(intrinsics)]
+#[lang = "sized"]
+pub trait Sized {}
+
extern "rust-intrinsic" {
fn prefetch_read_data<T>(addr: *const T, locality: i32);
fn prefetch_write_data<T>(addr: *const T, locality: i32);
+#[lang = "sized"]
+pub trait Sized {}
+
#[lang = "fn_once"]
pub trait FnOnce<Args> {
#[lang = "fn_once_output"]
// { dg-additional-options "-w" }
#![feature(intrinsics)]
+#[lang = "sized"]
+pub trait Sized {}
+
extern "rust-intrinsic" {
#[rustc_const_stable(feature = "const_ptr_offset", since = "1.61.0")]
pub fn offset<T>(dst: *const T, offset: isize) -> *const T;
// { dg-additional-options "-w" }
#![feature(intrinsics)]
+#[lang = "sized"]
+pub trait Sized {}
+
extern "rust-intrinsic" {
#[rustc_const_stable(feature = "const_ptr_offset", since = "1.61.0")]
pub fn offset<T>(dst: *const T, offset: isize) -> *const T;
// { dg-additional-options "-w" }
+#[lang = "sized"]
+pub trait Sized {}
+
struct FatPtr<T> {
data: *const T,
len: usize,
// { dg-output "t1sz=5 t2sz=10\r*" }
#![feature(intrinsics)]
+#[lang = "sized"]
+pub trait Sized {}
+
mod mem {
extern "rust-intrinsic" {
#[rustc_const_stable(feature = "const_transmute", since = "1.46.0")]
fn printf(s: *const i8, ...);
}
+#[lang = "sized"]
+pub trait Sized {}
+
struct S;
impl S {
fn printf(s: *const i8, ...);
}
+#[lang = "sized"]
+pub trait Sized {}
+
struct Foo(i32);
trait Bar {
fn baz(&self);
/* { dg-output "3\r*\n" } */
+#[lang = "sized"]
+pub trait Sized {}
+
extern "C" {
fn printf(s: *const i8, ...);
}
fn printf(s: *const i8, ...);
}
+#[lang = "sized"]
+pub trait Sized {}
+
trait FnLike<A, R> {
fn call(&self, arg: A) -> R;
}
fn printf(s: *const i8, ...);
}
+#[lang = "sized"]
+pub trait Sized {}
+
struct Foo(i32);
trait Bar {
fn baz(&self);
fn printf(s: *const i8, ...);
}
+#[lang = "sized"]
+pub trait Sized {}
+
trait Foo {
const A: i32 = 123;
}
fn printf(s: *const i8, ...);
}
+#[lang = "sized"]
+pub trait Sized {}
+
trait A {
fn a() -> i32 {
123
fn printf(s: *const i8, ...);
}
+#[lang = "sized"]
+pub trait Sized {}
+
struct Foo(i32);
trait Bar {
fn baz(&self);
fn printf(s: *const i8, ...);
}
+#[lang = "sized"]
+pub trait Sized {}
+
struct Foo(i32);
trait Bar {
fn baz(&self);
fn printf(s: *const i8, ...);
}
+#[lang = "sized"]
+pub trait Sized {}
+
pub trait Foo {
type A;
fn printf(s: *const i8, ...);
}
+#[lang = "sized"]
+pub trait Sized {}
+
pub trait Foo {
type A;
fn printf(s: *const i8, ...);
}
+#[lang = "sized"]
+pub trait Sized {}
+
pub trait Foo {
type A;
fn printf(s: *const i8, ...);
}
+#[lang = "sized"]
+pub trait Sized {}
+
trait FnLike<A, R> {
fn call(&self, arg: A) -> R;
}
fn transmute<T, U>(value: T) -> U;
}
+#[lang = "sized"]
+pub trait Sized {}
+
struct WrapI {
inner: i32,
}
#![feature(intrinsics)]
+#[lang = "sized"]
+pub trait Sized {}
+
extern "rust-intrinsic" {
pub fn wrapping_add<T>(l: T, r: T) -> T;
}
#![feature(intrinsics)]
+#[lang = "sized"]
+pub trait Sized {}
+
extern "rust-intrinsic" {
pub fn wrapping_add<T>(l: T, r: T) -> T;
pub fn wrapping_sub<T>(l: T, r: T) -> T;
+// { dg-xfail-if "https://github.com/Rust-GCC/gccrs/issues/2349" { *-*-* } }
+// { dg-excess-errors "" { xfail *-*-* } }
+
extern crate generic_function_1;
use generic_function_1::generic_function;
+#[lang = "sized"]
+pub trait Sized {}
+
pub fn generic_function<X>(a: X) -> X {
a
}