summary refs log tree commit diff
path: root/src/test/compile-fail
AgeCommit message (Collapse)AuthorLines
2014-03-28Convert most code to new inner attribute syntax.Brian Anderson-261/+261
Closes #2569
2014-03-28syntax: Accept meta matchers in macrosAlex Crichton-4/+4
This removes the `attr` matcher and adds a `meta` matcher. The previous `attr` matcher is now ambiguous because it doesn't disambiguate whether it means inner attribute or outer attribute. The new behavior can still be achieved by taking an argument of the form `#[$foo:meta]` (the brackets are part of the macro pattern). Closes #13067
2014-03-28Rename Pod into CopyFlavio Percoco-94/+94
Summary: So far, we've used the term POD "Plain Old Data" to refer to types that can be safely copied. However, this term is not consistent with the other built-in bounds that use verbs instead. This patch renames the Pod kind into Copy. RFC: 0003-opt-in-builtin-traits Test Plan: make check Reviewers: cmr Differential Revision: http://phabricator.octayn.net/D3
2014-03-27auto merge of #13108 : pongad/rust/lintraw, r=huonwbors-0/+35
Fixes #13032
2014-03-27Fix fallout of removing default boundsAlex Crichton-6/+7
This is all purely fallout of getting the previous commit to compile.
2014-03-27Added lint for #[deriving] structs and enums with unsafe pointers. #13032.Michael Darakananda-0/+35
2014-03-26auto merge of #13079 : alexcrichton/rust/colons, r=cmrbors-2/+2
The previous syntax was `Foo:Bound<trait-parameters>`, but this is a little ambiguous because it was being parsed as `Foo: (Bound<trait-parameters)` rather than `Foo: (Bound) <trait-parameters>` This commit changes the syntax to `Foo<trait-parameters>: Bound` in order to be clear where the trait parameters are going. Closes #9265
2014-03-26syntax: Tweak parsing bounds on generics pathsAlex Crichton-2/+2
The previous syntax was `Foo:Bound<trait-parameters>`, but this is a little ambiguous because it was being parsed as `Foo: (Bound<trait-parameters)` rather than `Foo: (Bound) <trait-parameters>` This commit changes the syntax to `Foo<trait-parameters>: Bound` in order to be clear where the trait parameters are going. Closes #9265
2014-03-26rustc: Relax restriction on privacy for fieldsAlex Crichton-21/+1
This is a necessary change in preparation for switching the defaults as part of #8122. RFC: 0004-private-fields
2014-03-25auto merge of #13083 : FlaPer87/rust/issue-13005-borrow-unsafe-static, ↵bors-0/+7
r=nikomatsakis It was possible to borrow unsafe static items in static initializers. This patch implements a small `Visitor` that walks static initializer's expressions and checks borrows aliasability. Fixes #13005 cc @nikomatsakis r?
2014-03-24auto merge of #12900 : alexcrichton/rust/rewrite-sync, r=brsonbors-245/+10
* Remove clone-ability from all primitives. All shared state will now come from the usage of the primitives being shared, not the primitives being inherently shareable. This allows for fewer allocations for stack-allocated primitives. * Add `Mutex<T>` and `RWLock<T>` which are stack-allocated primitives for purely wrapping a piece of data * Remove `RWArc<T>` in favor of `Arc<RWLock<T>>` * Remove `MutexArc<T>` in favor of `Arc<Mutex<T>>` * Shuffle around where things are located * The `arc` module now only contains `Arc` * A new `lock` module contains `Mutex`, `RWLock`, and `Barrier` * A new `raw` module contains the primitive implementations of `Semaphore`, `Mutex`, and `RWLock` * The Deref/DerefMut trait was implemented where appropriate * `CowArc` was removed, the functionality is now part of `Arc` and is tagged with `#[experimental]`. * The crate now has #[deny(missing_doc)] * `Arc` now supports weak pointers This is not a large-scale rewrite of the functionality contained within the `sync` crate, but rather a shuffling of who does what an a thinner hierarchy of ownership to allow for better composability.
2014-03-24test: Update all tests with the sync changesAlex Crichton-245/+10
2014-03-24rustc: Completely forbid borrows of unsafe staticsFlavio Percoco-0/+7
Summary: It was possible to borrow unsafe static items in static initializers. This patch implements a small `Visitor` that walks static initializer's expressions and checks borrows aliasability. Fixes #13005 Test Plan: make check Differential Revision: http://phabricator.octayn.net/D2
2014-03-24auto merge of #12998 : huonw/rust/log_syntax, r=alexcrichtonbors-1/+29
syntax: allow `trace_macros!` and `log_syntax!` in item position. Previously trace_macros!(true) fn main() {} would complain about `trace_macros` being an expression macro in item position. This is a pointless limitation, because the macro is purely compile-time, with no runtime effect. (And similarly for log_syntax.) This also changes the behaviour of `trace_macros!` very slightly, it used to be equivalent to macro_rules! trace_macros { (true $($_x: tt)*) => { true }; (false $($_x: tt)*) => { false } } I.e. you could invoke it with arbitrary trailing arguments, which were ignored. It is changed to accept only exactly `true` or `false` (with no trailing arguments) and expands to `()`.
2014-03-22auto merge of #13076 : FlaPer87/rust/remove-freeze, r=alexcrichtonbors-99/+14
This PR removes the `Freeze` kind and the `NoFreeze` marker completely. Fixes #12577 cc @nikomatsakis r?
2014-03-22rustc: Remove all usage of manual deref()Alex Crichton-1/+1
Favor using '*' instead
2014-03-22test: Fix fallout of removing get()Alex Crichton-4/+4
2014-03-22test: Remove Freeze / NoFreeze from testsFlavio Percoco-99/+14
2014-03-22syntax: allow `trace_macros!` and `log_syntax!` in item position.Huon Wilson-1/+29
Previously trace_macros!(true) fn main() {} would complain about `trace_macros` being an expression macro in item position. This is a pointless limitation, because the macro is purely compile-time, with no runtime effect. (And similarly for log_syntax.) This also changes the behaviour of `trace_macros!` very slightly, it used to be equivalent to macro_rules! trace_macros { (true $($_x: tt)*) => { true }; (false $($_x: tt)*) => { false } } I.e. you could invoke it with arbitrary trailing arguments, which were ignored. It is changed to accept only exactly `true` or `false` (with no trailing arguments) and expands to `()`.
2014-03-22Remove outdated and unnecessary std::vec_ng::Vec imports.Huon Wilson-30/+5
(And fix some tests.)
2014-03-21test: Make manual changes to deal with the fallout from removal ofPatrick Walton-192/+104
`~[T]` in test, libgetopts, compiletest, librustdoc, and libnum.
2014-03-21test: Automatically remove all `~[T]` from tests.Patrick Walton-127/+107
2014-03-20syntax: Tidy up parsing the new attribute syntaxAlex Crichton-4/+4
2014-03-20Added new attribute syntax with backward compatibility.Daniel Fagnan-0/+14
Signed-off-by: Daniel Fagnan <dnfagnan@gmail.com>
2014-03-20Removing imports of std::vec_ng::VecAlex Crichton-2/+0
It's now in the prelude.
2014-03-20auto merge of #12686 : FlaPer87/rust/shared, r=nikomatsakisbors-50/+73
`Share` implies that all *reachable* content is *threadsafe*. Threadsafe is defined as "exposing no operation that permits a data race if multiple threads have access to a &T pointer simultaneously". (NB: the type system should guarantee that if you have access to memory via a &T pointer, the only other way to gain access to that memory is through another &T pointer)... Fixes #11781 cc #12577 What this PR will do ================ - [x] Add Share kind and - [x] Replace usages of Freeze with Share in bounds. - [x] Add Unsafe<T> #12577 - [x] Forbid taking the address of a immutable static item with `Unsafe<T>` interior What's left to do in a separate PR (after the snapshot)? =========================================== - Remove `Freeze` completely
2014-03-20Allow static items that don't fulfill `Freeze`Flavio Percoco-24/+0
2014-03-20Forbid borrow of static items with unsafe interiorFlavio Percoco-0/+47
2014-03-20Replace Freeze bounds with Share boundsFlavio Percoco-26/+26
2014-03-20rename std::vec_ng -> std::vecDaniel Micay-1/+1
Closes #12771
2014-03-20rename std::vec -> std::sliceDaniel Micay-3/+3
Closes #12702
2014-03-18auto merge of #13006 : alexcrichton/rust/rollup, r=alexcrichtonbors-0/+62
Closes #13008 (Made the `clone_from` implementation for `~T` reuse the `T` itself if possible) Closes #13003 (Make method Vec::remove() public) Closes #13002 (disallow duplicate methods in trait impls) Closes #13000 (rustc: test: don't silently ignore bad benches) Closes #12999 (rustc: buffer the output writer for -Z ast-json[-noexpand].) Closes #12993 (syntax: Don't parameterize the the pretty printer) Closes #12990 (`char` reference: s/character/Unicode scalar value/) Closes #12987 (Move syntax-extension-hexfloat.rs) Closes #12983 (Fix linkage1 test which fails due to --as-needed) Closes #12978 (rustc: remove linker_private/linker_private_weak) Closes #12976 (libsyntax: librustdoc: ignore utf-8 BOM in .rs files) Closes #12973 (closes #12967 fix [en|de]coding of HashMap<K,V> where K is a numeric type) Closes #12972 (Add impl IntoStr for ::std::vec_ng::Vec<Ascii>) Closes #12968 (deny missing docs getopts) Closes #12965 (Documentation and formatting changes for option.rs.) Closes #12962 (Relax the memory ordering on the implementation of UnsafeArc) Closes #12958 (Typo fixes.) Closes #12950 (Docsprint: Document ops module, primarily Deref.) Closes #12946 (rustdoc: Implement cross-crate searching)
2014-03-18rustc: test: don't silently ignore bad benchesCorey Richardson-0/+36
This is adequate because when a function has a type that isn't caught here, that is, it has a single argument, but it *isn't* `&mut BenchHarness`, it errors later on with: error: mismatched types: expected `fn(&mut test::BenchHarness)` but found `fn(int)` (expected &-ptr but found int) which I consider acceptable. Closes #12997
2014-03-18rustc: disallow duplicate methods in trait implsCorey Richardson-0/+26
Closes #8153
2014-03-18test: Fix android testsAlex Crichton-3/+2
This compile-fail test didn't have a main function for architectures other than x86
2014-03-17auto merge of #12935 : lbonn/rust/nullenum, r=alexcrichtonbors-4/+54
Fix for #12560
2014-03-17auto merge of #12742 : FlaPer87/rust/issue-11411-static-mut-slice, ↵bors-0/+16
r=nikomatsakis This PR enables the use of mutable slices in *mutable* static items. The work was started by @xales and I added a follow-up commit that moves the *immutable* restriction to the recently added `check_static` Closes #11411
2014-03-17auto merge of #12951 : cadencemarseille/rust/issue-12943-remove-AtomicFlag, ↵bors-2/+0
r=alexcrichton fixes #12943
2014-03-17rustc: disallow trailing parentheses for nullary enum variantsLaurent Bonnans-4/+54
Fixes #12560
2014-03-16auto merge of #12937 : sinistersnare/rust/method-error-message, r=huonwbors-0/+34
its a common (yet easily fixable) error to just forget parens at the end of getter-like methods without any arguments. The current error message for that case asks for an anonymous function, this patch adds a note asking for either an anonymous function, or for trailing parens. This is my first contribution! do i need to do anything else?
2014-03-16Remove AtomicFlagCadence Marseille-2/+0
fixes #12943
2014-03-16Asked if missing (), then asks about an anonymous function. Also added test.Davis Silverman-0/+34
2014-03-15log: Introduce liblog, the old std::loggingAlex Crichton-102/+102
This commit moves all logging out of the standard library into an external crate. This crate is the new crate which is responsible for all logging macros and logging implementation. A few reasons for this change are: * The crate map has always been a bit of a code smell among rust programs. It has difficulty being loaded on almost all platforms, and it's used almost exclusively for logging and only logging. Removing the crate map is one of the end goals of this movement. * The compiler has a fair bit of special support for logging. It has the __log_level() expression as well as generating a global word per module specifying the log level. This is unfairly favoring the built-in logging system, and is much better done purely in libraries instead of the compiler itself. * Initialization of logging is much easier to do if there is no reliance on a magical crate map being available to set module log levels. * If the logging library can be written outside of the standard library, there's no reason that it shouldn't be. It's likely that we're not going to build the highest quality logging library of all time, so third-party libraries should be able to provide just as high-quality logging systems as the default one provided in the rust distribution. With a migration such as this, the change does not come for free. There are some subtle changes in the behavior of liblog vs the previous logging macros: * The core change of this migration is that there is no longer a physical log-level per module. This concept is still emulated (it is quite useful), but there is now only a global log level, not a local one. This global log level is a reflection of the maximum of all log levels specified. The previously generated logging code looked like: if specified_level <= __module_log_level() { println!(...) } The newly generated code looks like: if specified_level <= ::log::LOG_LEVEL { if ::log::module_enabled(module_path!()) { println!(...) } } Notably, the first layer of checking is still intended to be "super fast" in that it's just a load of a global word and a compare. The second layer of checking is executed to determine if the current module does indeed have logging turned on. This means that if any module has a debug log level turned on, all modules with debug log levels get a little bit slower (they all do more expensive dynamic checks to determine if they're turned on or not). Semantically, this migration brings no change in this respect, but runtime-wise, this will have a perf impact on some code. * A `RUST_LOG=::help` directive will no longer print out a list of all modules that can be logged. This is because the crate map will no longer specify the log levels of all modules, so the list of modules is not known. Additionally, warnings can no longer be provided if a malformed logging directive was supplied. The new "hello world" for logging looks like: #[phase(syntax, link)] extern crate log; fn main() { debug!("Hello, world!"); }
2014-03-14extra: Put the nail in the coffin, delete libextraAlex Crichton-63/+4
This commit shreds all remnants of libextra from the compiler and standard distribution. Two modules, c_vec/tempfile, were moved into libstd after some cleanup, and the other modules were moved to separate crates as seen fit. Closes #8784 Closes #12413 Closes #12576
2014-03-14Added support for type placeholders (explicit requested typeMarvin Löbel-0/+191
inference in a type with `_` ). This enables partial type inference.
2014-03-13auto merge of #12861 : huonw/rust/lint-owned-vecs, r=thestingerbors-0/+23
lint: add lint for use of a `~[T]`. This is useless at the moment (since pretty much every crate uses `~[]`), but should help avoid regressions once completely removed from a crate.
2014-03-13auto merge of #12798 : pczarn/rust/inline-asm, r=alexcrichtonbors-0/+41
## read+write modifier '+' This small sugar was left out in the original implementation (#5359). When an output operand with the '+' modifier is encountered, we store the index of that operand alongside the expression to create and append an input operand later. The following lines are equivalent: ``` asm!("" : "+m"(expr)); asm!("" : "=m"(expr) : "0"(expr)); ``` ## misplaced options and clobbers give a warning It's really annoying when a small typo might change behavior without any warning. ``` asm!("mov $1, $0" : "=r"(x) : "r"(8u) : "cc" , "volatile"); //~^ WARNING expected a clobber, but found an option ``` ## liveness Fixed incorrect order of propagation. Sometimes it caused spurious warnings in code: `warning: value assigned to `i` is never read, #[warn(dead_assignment)] on by default` ~~Note: Rebased on top of another PR. (uses other changes)~~ * [x] Implement read+write * [x] Warn about misplaced options * [x] Fix liveness (`dead_assignment` lint) * [x] Add all tests
2014-03-14lint: add lint for use of a `~[T]`.Huon Wilson-0/+23
This is useless at the moment (since pretty much every crate uses `~[]`), but should help avoid regressions once completely removed from a crate.
2014-03-13Fix and improve inline assembly.Piotr Czarnecki-0/+41
Read+write modifier Some documentation in asm.rs rpass and cfail tests
2014-03-13auto merge of #12815 : alexcrichton/rust/chan-rename, r=brsonbors-14/+14
* Chan<T> => Sender<T> * Port<T> => Receiver<T> * Chan::new() => channel() * constructor returns (Sender, Receiver) instead of (Receiver, Sender) * local variables named `port` renamed to `rx` * local variables named `chan` renamed to `tx` Closes #11765