summary refs log tree commit diff
path: root/src/test/compile-fail
AgeCommit message (Collapse)AuthorLines
2017-01-19more complete error messageNiko Matsakis-1/+1
2017-01-19only consider value items when searching for methods, not typesNiko Matsakis-0/+15
2017-01-17Improve the warning cycle for `use $crate;`.Jeffrey Seyfried-3/+10
2017-01-07Merge pull request #38884 from nikomatsakis/beta-unmergedAlex Crichton-0/+15
More beta backports
2017-01-06Don't `unused_qualifications`-check global paths.Jeffrey Seyfried-4/+5
2017-01-06Fix tidy warningJonathan Turner-0/+10
2017-01-06Add in test for E0090Jonathan Turner-0/+5
2017-01-06Don't leak the compiler's internal representation of scopes in error messages.Eduard-Mihai Burtescu-0/+58
2017-01-06Regression test and exploratory unit test.Felix S. Klock II-0/+20
2016-12-30Demote most backwards incompatible ambiguity errors from RFC 1560 to warnings.Jeffrey Seyfried-0/+30
2016-12-30Fix non-termination in `resolve`.Jeffrey Seyfried-1/+3
2016-12-29Remove --crate-type=metadata from betaNick Cameron-149/+0
Leaves most of the implementation, just ignores the argument itself.
2016-12-15Warn unused type aliasesSeo Sanghyeon-0/+22
2016-12-15Fix regression in resolution of primitive typesVadim Petrochenkov-0/+20
2016-12-12Auto merge of #38057 - KiChjang:display-formal-type-param, r=nikomatsakisbors-18/+18
Display better error messages for E0282 Fixes #36554.
2016-12-08Change error to E0572Guillaume Gomez-1/+1
2016-12-08Add E0571 testGuillaume Gomez-0/+13
2016-12-07Rollup merge of #38085 - estebank:empty-import-list-fix-38012, r=jseyfriedGuillaume Gomez-3/+9
Warn when an import list is empty For a given file ```rust use std::*; use std::{}; ``` output the following warnings ``` warning: unused import: `use std::{};`, #[warn(unused_imports)] on by default --> file.rs:2:1 | 2 | use std::{}; | ^^^^^^^^^^^^ warning: unused import: `std::*;`, #[warn(unused_imports)] on by default --> file.rs:1:5 | 1 | use std::*; | ^^^^^^^ ```
2016-12-06Auto merge of #37973 - vadimcn:dllimport, r=alexcrichtonbors-6/+38
Implement RFC 1717 Implement the first two points from #37403. r? @alexcrichton
2016-12-05Warn when an import list is emptyEsteban Küber-3/+9
For a given file ```rust use std::*; use std::{}; ``` output the following warnings ``` warning: unused import: `use std::{};`, #[warn(unused_imports)] on by default --> file.rs:2:1 | 2 | use std::{}; | ^^^^^^^^^^^^ warning: unused import: `std::*;`, #[warn(unused_imports)] on by default --> file.rs:1:5 | 1 | use std::*; | ^^^^^^^ ```
2016-12-06Auto merge of #38121 - jonathandturner:better_e0061, r=nikomatsakisbors-22/+25
Point arg num mismatch errors back to their definition This PR updates the arg num errors (like E0061) to point back at the function definition where they were defined. Before: ``` error[E0061]: this function takes 2 parameters but 1 parameter was supplied --> E0061.rs:18:7 | 18 | f(0); | ^ | = note: the following parameter types were expected: = note: u16, &str ``` Now: ``` error[E0061]: this function takes 2 parameters but 1 parameter was supplied --> E0061.rs:18:7 | 11 | fn f(a: u16, b: &str) {} | ------------------------ defined here ... 18 | f(0); | ^ expected 2 parameters ``` This is an incremental improvement. We probably want to underline only the function name and also have support for functions defined in crates outside of the current crate. r? @nikomatsakis
2016-12-05Auto merge of #38093 - mikhail-m1:stack-overflow, r=arielb1bors-0/+26
fix stack overflow by enum and cont issue #36163 some paths were skipped while checking for recursion. I fixed bug reproduces on win64 cargo test. In previous PR #36458 time complexity was exponential in case of linked const values. Now it's linear. r? @alexcrichton
2016-12-04Auto merge of #38082 - jseyfried:macro_invocation_paths, r=nrcbors-41/+45
macros: support invocation paths (e.g. `foo::bar!()`) behind `#![feature(use_extern_macros)]` r? @nrc
2016-12-03Update error expectationsKeith Yeung-18/+18
2016-12-03fix stack overflow by enum and cont issue #36163, some paths were skipped ↵Mikhail Modin-0/+26
while checking for recursion.
2016-12-03Auto merge of #38079 - BurntSushi:attrtarget, r=alexcrichtonbors-0/+13
Add new #[target_feature = "..."] attribute. This commit adds a new attribute that instructs the compiler to emit target specific code for a single function. For example, the following function is permitted to use instructions that are part of SSE 4.2: #[target_feature = "+sse4.2"] fn foo() { ... } In particular, use of this attribute does not require setting the -C target-feature or -C target-cpu options on rustc. This attribute does not have any protections built into it. For example, nothing stops one from calling the above `foo` function on hosts without SSE 4.2 support. Doing so may result in a SIGILL. I've also expanded the x86 target feature whitelist.
2016-12-01Tighten up error checking of library renames.Vadim Chugunov-0/+48
2016-12-01Remove the "linked_from" feature.Vadim Chugunov-16/+0
2016-12-01Point arg num mismatch errors back to their definitionJonathan Turner-22/+25
2016-12-02limit the length of types in monomorphizationAriel Ben-Yehuda-1/+37
This adds the new insta-stable `#![type_size_limit]` crate attribute to control the limit, and is obviously a [breaking-change] fixable by that.
2016-11-30Add tests.Jeffrey Seyfried-41/+45
2016-11-30Auto merge of #38014 - jseyfried:refactor_path_resolution, r=nrcbors-1/+1
resolve: refactor path resolution This is a pure refactoring, modulo minor diagnostics improvements. r? @nrc
2016-11-29Auto merge of #37965 - Mark-Simulacrum:trait-obj-to-exis-predicate, r=eddybbors-19/+18
Refactor TraitObject to Slice<ExistentialPredicate> For reference, the primary types changes in this PR are shown below. They may add in the understanding of what is discussed below, though they should not be required. We change `TraitObject` into a list of `ExistentialPredicate`s to allow for a couple of things: - Principal (ExistentialPredicate::Trait) is now optional. - Region bounds are moved out of `TraitObject` into `TyDynamic`. This permits wrapping only the `ExistentialPredicate` list in `Binder`. - `BuiltinBounds` and `BuiltinBound` are removed entirely from the codebase, to permit future non-constrained auto traits. These are replaced with `ExistentialPredicate::AutoTrait`, which only requires a `DefId`. For the time being, only `Send` and `Sync` are supported; this constraint can be lifted in a future pull request. - Binder-related logic is extracted from `ExistentialPredicate` into the parent (`Binder<Slice<EP>>`), so `PolyX`s are inside `TraitObject` are replaced with `X`. The code requires a sorting order for `ExistentialPredicate`s in the interned `Slice`. The sort order is asserted to be correct during interning, but the slices are not sorted at that point. 1. `ExistentialPredicate::Trait` are defined as always equal; **This may be wrong; should we be comparing them and sorting them in some way?** 1. `ExistentialPredicate::Projection`: Compared by `ExistentialProjection::sort_key`. 1. `ExistentialPredicate::AutoTrait`: Compared by `TraitDef.def_path_hash`. Construction of `ExistentialPredicate`s is conducted through `TyCtxt::mk_existential_predicates`, which interns a passed iterator as a `Slice`. There are no convenience functions to construct from a set of separate iterators; callers must pass an iterator chain. The lack of convenience functions is primarily due to few uses and the relative difficulty in defining a nice API due to optional parts and difficulty in recognizing which argument goes where. It is also true that the current situation isn't significantly better than 4 arguments to a constructor function; but the extra work is deemed unnecessary as of this time. ```rust // before this PR struct TraitObject<'tcx> { pub principal: PolyExistentialTraitRef<'tcx>, pub region_bound: &'tcx ty::Region, pub builtin_bounds: BuiltinBounds, pub projection_bounds: Vec<PolyExistentialProjection<'tcx>>, } // after pub enum ExistentialPredicate<'tcx> { // e.g. Iterator Trait(ExistentialTraitRef<'tcx>), // e.g. Iterator::Item = T Projection(ExistentialProjection<'tcx>), // e.g. Send AutoTrait(DefId), } ```
2016-11-29Add new #[target_feature = "..."] attribute.Andrew Gallant-0/+13
This commit adds a new attribute that instructs the compiler to emit target specific code for a single function. For example, the following function is permitted to use instructions that are part of SSE 4.2: #[target_feature = "+sse4.2"] fn foo() { ... } In particular, use of this attribute does not require setting the -C target-feature or -C target-cpu options on rustc. This attribute does not have any protections built into it. For example, nothing stops one from calling the above `foo` function on hosts without SSE 4.2 support. Doing so may result in a SIGILL. This commit also expands the target feature whitelist to include lzcnt, popcnt and sse4a. Namely, lzcnt and popcnt have their own CPUID bits, but were introduced with SSE4.
2016-11-29Auto merge of #37863 - mikhail-m1:mut_error, r=nikomatsakisbors-381/+0
add hint to fix error for immutable ref in arg fix #36412 part of #35233 r? @jonathandturner
2016-11-28Remove auto_traits from PartitionedBoundsMark-Simulacrum-1/+1
2016-11-28Refactor TyTrait to contain a interned ExistentialPredicate slice.Mark-Simulacrum-10/+9
Renames TyTrait to TyDynamic.
2016-11-29Refactor path resoloution.Jeffrey Seyfried-1/+1
2016-11-29add hint to fix error for immutable ref in argMikhail Modin-381/+0
2016-11-28Auto merge of #37791 - petrochenkov:where, r=nikomatsakisbors-0/+73
Support `?Sized` in where clauses Implemented as described in https://github.com/rust-lang/rust/issues/20503#issuecomment-258677026 - `?Trait` bounds are moved on type parameter definitions when possible, reported as errors otherwise. (It'd be nice to unify bounds and where clauses in HIR, but this is mostly blocked by rustdoc now - it needs to render bounds in pleasant way and the best way to do it so far is to mirror what was written in source code.) Fixes https://github.com/rust-lang/rust/issues/20503 r? @nikomatsakis
2016-11-28Remove BuiltinBound and BuiltinBounds.Mark-Simulacrum-12/+12
2016-11-28rustc_privacy: switch private-in-public checking to Ty.Eduard Burtescu-85/+106
2016-11-28rustc: rework stability to be on-demand for type-directed lookup.Eduard Burtescu-384/+1485
2016-11-28rustc: embed path resolutions into the HIR instead of keeping DefMap.Eduard-Mihai Burtescu-1/+1
2016-11-28rustc: desugar UFCS as much as possible during HIR lowering.Eduard Burtescu-7/+9
2016-11-26Overload get{,_mut}{,_unchecked}Steven Fackler-13/+14
2016-11-25Support `?Sized` in where clausesVadim Petrochenkov-0/+73
2016-11-23Rollup merge of #37442 - estebank:cast-deref-hint, r=jonathandturnerGuillaume Gomez-0/+5
Provide hint when cast needs a dereference For a given code: ``` rust vec![0.0].iter().map(|s| s as i16).collect::<Vec<i16>>(); ``` display: ``` nocode error: casting `&f64` as `i16` is invalid --> file3.rs:2:35 | 2 | vec![0.0].iter().map(|s| s as i16).collect::<Vec<i16>>(); | - ^^^ | | | did you mean `*s`? ``` instead of: ``` nocode error: casting `&f64` as `i16` is invalid --> <anon>:2:30 | 2 | vec![0.0].iter().map(|s| s as i16).collect(); | ^^^^^^^^ | = help: cast through a raw pointer first ``` Fixes #37338.
2016-11-22Auto merge of #37681 - nrc:crate-metadata, r=@alexcrichtonbors-0/+149
add --crate-type metadata r? @alexcrichton
2016-11-22Auto merge of #37487 - goffrie:break, r=nikomatsakisbors-0/+116
Implement the `loop_break_value` feature. This implements RFC 1624, tracking issue #37339. - `FnCtxt` (in typeck) gets a stack of `LoopCtxt`s, which store the currently deduced type of that loop, the desired type, and a list of break expressions currently seen. `loop` loops get a fresh type variable as their initial type (this logic is stolen from that for arrays). `while` loops get `()`. - `break {expr}` looks up the broken loop, and unifies the type of `expr` with the type of the loop. - `break` with no expr unifies the loop's type with `()`. - When building MIR, loops no longer construct a `()` value at termination of the loop; rather, the `break` expression assigns the result of the loop. - ~~I have also changed the loop scoping in MIR-building so that the test of a while loop is not considered to be part of that loop. This makes the rules consistent with #37360. The new loop scopes in typeck also follow this rule. That means that `loop { while (break) {} }` now terminates instead of looping forever. This is technically a breaking change.~~ - ~~On that note, expressions like `while break {}` and `if break {}` no longer parse because `{}` is interpreted as an expression argument to `break`. But no code except compiler test cases should do that anyway because it makes no sense.~~ - The RFC did not make it clear, but I chose to make `break ()` inside of a `while` loop illegal, just in case we wanted to do anything with that design space in the future. This is my first time dealing with this part of rustc so I'm sure there's plenty of problems to pick on here ^_^