Commit Graph

224 Commits

Author SHA1 Message Date
Eduard Burtescu
ef4352fba6 rustc_metadata: group information into less tags. 2016-09-20 20:08:04 +03:00
bors
5bdf79bf37 Auto merge of #36270 - petrochenkov:pipwarnagain, r=nikomatsakis
Make `private_in_public` compatibility lint warn-by-default again

More details: https://internals.rust-lang.org/t/regression-report-stable-2016-08-16-vs-beta-2016-08-26/3930/10

r? @nikomatsakis
2016-09-14 12:04:30 -07:00
Vadim Petrochenkov
f2b672d556 Refactor TyStruct/TyEnum/TyUnion into TyAdt 2016-09-08 22:17:53 +03:00
Vadim Petrochenkov
3be6d1f954 Make private_in_public compatibility lint warn-by-default again 2016-09-05 00:28:44 +03:00
Vadim Petrochenkov
e05e74ac83 Replace _, _ with .. 2016-09-04 12:30:33 +03:00
Vadim Petrochenkov
6f7e51e49b Replace _, _, _ with .. 2016-09-04 12:27:01 +03:00
Vadim Petrochenkov
93067ca089 Address comments and add requested tests 2016-09-03 13:39:35 +03:00
Vadim Petrochenkov
d9b332bd69 Translate union constants
Fix alignment for packed unions
Add some missing privacy test
Get rid of `unimplemented_unions` macro
2016-09-03 13:39:35 +03:00
Vadim Petrochenkov
641d8e9e4c Some better support for unions through the compiler 2016-09-03 13:39:34 +03:00
Vadim Petrochenkov
a014323e45 Lower unions from AST to HIR and from HIR to types
Parse union items and add a feature for them
2016-09-03 13:39:33 +03:00
Vadim Petrochenkov
4001c039de Add unions to HIR 2016-09-03 13:37:25 +03:00
Guillaume Gomez
5185bd05c9 Rollup merge of #36054 - mikhail-m1:master2, r=jonathandturner
update error E0451 to new format

Fixes #35928 as part of #35233.

r? @jonathandturner
2016-08-30 10:39:07 +02:00
Mikhail Modin
46fc80c44e update error E0451 to new format 2016-08-29 09:55:16 +03:00
Mikhail Modin
9c07ed2128 update error E0450 to new format 2016-08-27 19:39:22 +03:00
Mohit Agarwal
11e9b8de7d Update E0445 and E0454 to new error format
Fixes #35922.
Fixes #35930.
Part of #35233.

r? @GuillaumeGomez
2016-08-24 17:43:51 +05:30
bors
e25542cb02 Auto merge of #35162 - canndrew:bang_type_coerced, r=nikomatsakis
Implement the `!` type

This implements the never type (`!`) and hides it behind the feature gate `#[feature(never_type)]`. With the feature gate off, things should build as normal (although some error messages may be different). With the gate on, `!` is usable as a type and diverging type variables (ie. types that are unconstrained by anything in the code) will default to `!` instead of `()`.
2016-08-16 00:12:12 -07:00
Andrew Cann
ed02344fbc Remove obsolete divergence related stuff
Replace FnOutput with Ty
Replace FnConverging(ty) with ty
Purge FnDiverging, FunctionRetTy::NoReturn and FunctionRetTy::None
2016-08-13 21:37:09 +08:00
Vadim Petrochenkov
737961b6c6 Make private_in_public compatibility lint deny-by-default 2016-08-11 23:19:04 +03:00
petrochenkov
d43b9cb487 privacy: Move private-in-public diagnostics for type aliases to the public interface location 2016-08-11 00:32:07 +03:00
Vadim Petrochenkov
b7db9e88bf privacy: Substitute type aliases in private-in-public checker 2016-08-11 00:32:07 +03:00
Michael Woerister
415fde498a intravisit: Fold functionality of IdVisitor into the regular Visitor. 2016-07-29 04:55:31 -04:00
Vadim Petrochenkov
ba419a78f3 Cleanup of some pattern related code 2016-07-08 12:36:45 +03:00
Jeffrey Seyfried
542ba8c5f7 Fix Cargo.tomls 2016-06-27 18:30:46 +00:00
Jonathan Turner
6ae3502134 Move errors from libsyntax to its own crate 2016-06-23 08:07:35 -04:00
bors
4ba60aba38 Auto merge of #34186 - GuillaumeGomez:err-code-check, r=alexcrichton
Implementation of #34168

r? @brson

cc @alexcrichton
cc @steveklabnik
cc @jonathandturner

I only updated `librustc_privacy/diagnostics.rs`, and I already found a case where the code doesn't throw the expected error code (E0448).

Fixes #34168.
2016-06-20 15:54:17 -07:00
Guillaume Gomez
ddfaf10f6b Add error code flag 2016-06-20 19:38:26 +02:00
Vadim Petrochenkov
ee4e55398b Introduce TyCtxt::expect_def/expect_resolution helpers and use them where possible 2016-06-10 01:03:54 +03:00
bors
c2cab1fd58 Auto merge of #33794 - petrochenkov:sanity, r=nrc
Add AST validation pass and move some checks to it

The purpose of this pass is to catch constructions that fit into AST data structures, but not permitted by the language. As an example, `impl`s don't have visibilities, but for convenience and uniformity with other items they are represented with a structure `Item` which has `Visibility` field.

This pass is intended to run after expansion of macros and syntax extensions (and before lowering to HIR), so it can catch erroneous constructions that were generated by them. This pass allows to remove ad hoc semantic checks from the parser, which can be overruled by syntax extensions and occasionally macros.

The checks can be put here if they are simple, local, don't require results of any complex analysis like name resolution or type checking and maybe don't logically fall into other passes. I expect most of errors generated by this pass to be non-fatal and allowing the compilation to proceed.

I intend to move some more checks to this pass later and maybe extend it with new checks, like, for example, identifier validity. Given that syntax extensions are going to be stabilized in the measurable future, it's important that they would not be able to subvert usual language rules.

In this patch I've added two new checks - a check for labels named `'static` and a check for lifetimes and labels named `'_`. The first one gives a hard error, the second one - a future compatibility warning.
Fixes https://github.com/rust-lang/rust/issues/33059 ([breaking-change])
cc https://github.com/rust-lang/rfcs/pull/1177

r? @nrc
2016-06-01 06:21:53 -07:00
Manish Goregaokar
10e1e6a7a2 Rollup merge of #33793 - GuillaumeGomez:compile_fail, r=GuillaumeGomez
Fix compile_fail tag

Fixes #33780

r? @steveklabnik
2016-05-30 15:18:59 +05:30
Vadim Petrochenkov
c02c6e88e6 Move some other checks to AST sanity pass 2016-05-28 20:27:57 +03:00
Guillaume Gomez
abe9961283 * Fix compile_fail tag (in some cases, it compiled whereas it wasn't expected to and was still considered 'ok')
* Fix error explanations tests/tags
2016-05-27 00:39:57 +02:00
Vadim Petrochenkov
35ef09c38b Replace pat_adjust_pos with an iterator adapter 2016-05-26 11:11:58 +03:00
Vadim Petrochenkov
d69aeaf662 Implement .. in tuple (struct) patterns 2016-05-26 11:11:58 +03:00
Vadim Petrochenkov
766f9b5a2f Remove ExplicitSelf from HIR 2016-05-14 13:26:40 +03:00
Eduard Burtescu
76affa5d6f rustc: Split 'tcx into 'gcx and 'tcx for InferCtxt and its users. 2016-05-11 04:14:58 +03:00
Eduard Burtescu
513d392f7e rustc: Replace &'a TyCtxt<'tcx> with a TyCtxt<'a, 'tcx> wrapper. 2016-05-11 04:14:58 +03:00
Seo Sanghyeon
7ad1900e1c Remove unused trait imports flagged by lint 2016-05-03 18:48:34 +09:00
Jeffrey Seyfried
daec3fe4e6 Always report PRIVATE_IN_PUBLIC violations as hard errors when
the feature `pub_restricted` is enabled.
2016-04-16 21:27:20 +00:00
Jeffrey Seyfried
35204025be Improve PrivateItemsInPublicInterfacesVisitor 2016-04-07 04:33:14 +00:00
Jeffrey Seyfried
0d34c5dd8a Use the node id from the Restricted variant when checking accessibility
in `typeck` and in `privacy::PrivacyVisitor`.
2016-04-07 04:33:06 +00:00
Jeffrey Seyfried
bb66d91c98 Make hir::Visibility non-copyable and add ty::Visibility 2016-04-07 04:31:45 +00:00
Eduard Burtescu
ffca6c3e15 rustc: move middle::{def,def_id,pat_util} to hir. 2016-04-06 09:14:21 +03:00
Eduard Burtescu
8b0937293b rustc: move rustc_front to rustc::hir. 2016-04-06 09:01:55 +03:00
Benjamin Herr
487219ccb1 librustc_privacy: use bug!(), span_bug!() 2016-03-31 22:06:52 +02:00
Vadim Petrochenkov
38bef43652 privacy: Cleanup check_field 2016-03-30 21:26:35 +00:00
Jeffrey Seyfried
48b048deb7 Clean up the privacy visitor 2016-03-30 21:26:35 +00:00
Eduard Burtescu
5efdde0de1 rustc: move cfg, infer, traits and ty from middle to top-level. 2016-03-27 01:05:54 +02:00
bors
bcda58f491 Auto merge of #31710 - eddyb:reify, r=nikomatsakis
Distinguish fn item types to allow reification from nothing to fn pointers.

The first commit is a rebase of #26284, except for files that have moved since.

This is a [breaking-change], due to:
* each FFI function has a distinct type, like all other functions currently do
* all generic parameters on functions are recorded in their item types, e.g.:
`size_of::<u8>` & `size_of::<i8>`'s types differ despite their identical signature.
* function items are zero-sized, which will stop transmutes from working on them

The first two cases are handled in most cases with the new coerce-unify logic,
which will combine incompatible function item types into function pointers,
at the outer-most level of if-else chains, match arms and array literals.

The last case is specially handled during type-checking such that transmutes
from a function item type to a pointer or integer type will continue to work for
another release cycle, but are being linted against. To get rid of warnings and
ensure your code will continue to compile, cast to a pointer before transmuting.
2016-03-09 20:16:20 -08:00
Eduard Burtescu
ffa0860467 Track fn type and lifetime parameters in TyFnDef. 2016-03-09 16:45:28 +02:00
Eli Friedman
b423a0f9ef Split TyBareFn into TyFnDef and TyFnPtr.
There's a lot of stuff wrong with the representation of these types:
TyFnDef doesn't actually uniquely identify a function, TyFnPtr is used to
represent method calls, TyFnDef in the sub-expression of a cast isn't
correctly reified, and probably some other stuff I haven't discovered yet.
Splitting them seems like the right first step, though.
2016-03-09 16:45:28 +02:00