about summary refs log tree commit diff
path: root/src/test/compile-fail/drop-on-non-struct.rs
AgeCommit message (Collapse)AuthorLines
2018-08-14Moved compile-fail tests to ui tests.David Wood-20/+0
2015-01-08Update compile fail tests to use isize.Huon Wilson-1/+1
2015-01-07rollup merge of #20631: huon/no-drop-and-copyAlex Crichton-1/+1
2015-01-08Require that types cannot implement both Drop and Copy.Huon Wilson-1/+1
Opt-in built-in traits allowed one to explicitly implement both `Drop` and `Copy` for a type. This can theoretically make some sense, but the current implementation means it is codegened totally incorrectly which can lead to memory unsafety, so this feature is disabled for now. Fixes #20126.
2015-01-05Implement new orphan rule that requires that impls of remote traits meet the ↵Niko Matsakis-1/+1
following two criteria: - the self type includes some local type; and, - type parameters in the self type must be constrained by a local type. A type parameter is called *constrained* if it appears in some type-parameter of a local type. Here are some examples that are accepted. In all of these examples, I assume that `Foo` is a trait defined in another crate. If `Foo` were defined in the local crate, then all the examples would be legal. - `impl Foo for LocalType` - `impl<T> Foo<T> for LocalType` -- T does not appear in Self, so it is OK - `impl<T> Foo<T> for LocalType<T>` -- T here is constrained by LocalType - `impl<T> Foo<T> for (LocalType<T>, T)` -- T here is constrained by LocalType Here are some illegal examples (again, these examples assume that `Foo` is not local to the current crate): - `impl Foo for int` -- the Self type is not local - `impl<T> Foo for T` -- T appears in Self unconstrained by a local type - `impl<T> Foo for (LocalType, T)` -- T appears in Self unconstrained by a local type This is a [breaking-change]. For the time being, you can opt out of the new rules by placing `#[old_orphan_check]` on the trait (and enabling the feature gate where the trait is defined). Longer term, you should restructure your traits to avoid the problem. Usually this means changing the order of parameters so that the "central" type parameter is in the `Self` position. As an example of that refactoring, consider the `BorrowFrom` trait: ```rust pub trait BorrowFrom<Sized? Owned> for Sized? { fn borrow_from(owned: &Owned) -> &Self; } ``` As defined, this trait is commonly implemented for custom pointer types, such as `Arc`. Those impls follow the pattern: ```rust impl<T> BorrowFrom<Arc<T>> for T {...} ``` Unfortunately, this impl is illegal because the self type `T` is not local to the current crate. Therefore, we are going to change the order of the parameters, so that `BorrowFrom` becomes `Borrow`: ```rust pub trait Borrow<Sized? Borrowed> for Sized? { fn borrow_from(owned: &Self) -> &Borrowed; } ``` Now the `Arc` impl is written: ```rust impl<T> Borrow<T> for Arc<T> { ... } ``` This impl is legal because the self type (`Arc<T>`) is local.
2014-09-15Update error messages in compile-fail testsNiko Matsakis-6/+3
2014-08-27Implement generalized object and type parameter bounds (Fixes #16462)Niko Matsakis-1/+0
2014-07-26Remove managed_box gate from testsBrian Anderson-1/+0
No longer does anything.
2014-05-07test: Update with std => core movementAlex Crichton-1/+1
2014-03-28Convert most code to new inner attribute syntax.Brian Anderson-1/+1
Closes #2569
2014-03-22Remove outdated and unnecessary std::vec_ng::Vec imports.Huon Wilson-1/+0
(And fix some tests.)
2014-03-21test: Make manual changes to deal with the fallout from removal ofPatrick Walton-2/+5
`~[T]` in test, libgetopts, compiletest, librustdoc, and libnum.
2014-03-21test: Automatically remove all `~[T]` from tests.Patrick Walton-1/+1
2014-02-02Update/delete tests using @[].Huon Wilson-1/+1
2014-01-11Remove re-exports of std::io::stdio::{print, println} in the prelude.Brendan Zabarauskas-1/+1
The `print!` and `println!` macros are now the preferred method of printing, and so there is no reason to export the `stdio` functions in the prelude. The functions have also been replaced by their macro counterparts in the tutorial and other documentation so that newcomers don't get confused about what they should be using.
2013-10-23register snapshotsDaniel Micay-0/+2
2013-09-16switch Drop to `&mut self`Daniel Micay-1/+1
2013-06-25Change finalize -> drop.Luqman Aden-1/+1
2013-05-29librustc: Stop reexporting the standard modules from prelude.Patrick Walton-1/+1
2013-05-03add gitattributes and fix whitespace issuesDaniel Micay-2/+0
2013-02-14librustc: Replace `impl Type : Trait` with `impl Trait for Type`. ↵Patrick Walton-1/+1
rs=implflipping
2013-01-29libstd: Remove "dual impls" from the language and enforce coherence rules. ↵Patrick Walton-0/+1
r=brson "Dual impls" are impls that are both type implementations and trait implementations. They can lead to ambiguity and so this patch removes them from the language. This also enforces coherence rules. Without this patch, records can implement traits not defined in the current crate. This patch fixes this, and updates all of rustc to adhere to the new enforcement. Most of this patch is fixing rustc to obey the coherence rules, which involves converting a bunch of records to structs.
2012-12-10Reliciense makefiles and testsuite. Yup.Graydon Hoare-0/+10
2012-11-29librustc: Make the Drop trait use explicit selfPatrick Walton-1/+1
2012-11-07rustc: Implement the Drop trait. r=brsonPatrick Walton-0/+12