about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorLines
2015-12-18Auto merge of #29973 - petrochenkov:privinpub, r=nikomatsakisbors-320/+808
Some notes: This patch enforces the rules from [RFC 136](https://github.com/rust-lang/rfcs/blob/master/text/0136-no-privates-in-public.md) and makes "private in public" a module-level concept and not crate-level. Only `pub` annotations are used by the new algorithm, crate-level exported node set produced by `EmbargoVisitor` is not used. The error messages are tweaked accordingly and don't use the word "exported" to avoid confusing people (https://github.com/rust-lang/rust/issues/29668). The old algorithm tried to be extra smart with impls, but it mostly led to unpredictable behavior and bugs like https://github.com/rust-lang/rust/issues/28325. The new algorithm tries to be as simple as possible - an impl is considered public iff its type is public and its trait is public (if presents). A type or trait is considered public if all its components are public, [complications](https://internals.rust-lang.org/t/limits-of-type-inference-smartness/2919) with private types leaking to other crates/modules through trait impls and type inference are deliberately ignored so far. The new algorithm is not recursive and uses the nice new facility `Crate::visit_all_items`! Obsolete pre-1.0 feature `visible_private_types` is removed. This is a [breaking-change]. The two main vectors of breakage are type aliases (https://github.com/rust-lang/rust/issues/28450) and impls (https://github.com/rust-lang/rust/issues/28325). I need some statistics from a crater run (cc @alexcrichton) to decide on the breakage mitigation strategy. UPDATE: All the new errors are reported as warnings controlled by a lint `private_in_public` and lint group `future_incompatible`, but the intent is to make them hard errors eventually. Closes https://github.com/rust-lang/rust/issues/28325 Closes https://github.com/rust-lang/rust/issues/28450 Closes https://github.com/rust-lang/rust/issues/29524 Closes https://github.com/rust-lang/rust/issues/29627 Closes https://github.com/rust-lang/rust/issues/29668 Closes https://github.com/rust-lang/rust/issues/30055 r? @nikomatsakis
2015-12-18Do not substitute type aliases during error reportingVadim Petrochenkov-6/+13
Type aliases are still substituted when determining impl publicity
2015-12-18Auto merge of #30374 - durka:issue-30371, r=alexcrichtonbors-2/+21
Fixes #30371.
2015-12-18Rollup merge of #30452 - dotdash:24876_take_2, r=alexcrichtonManish Goregaokar-0/+103
LLVM doesn't really support reusing the same module to emit more than one file. One bug this causes is that the IR is invalidated by the stack coloring pass when emitting the first file, and then the IR verifier complains by the time we try to emit the second file. Also, we get different binaries with --emit=asm,link than with just --emit=link. In some cases leading to segfaults. Unfortunately, it seems that at this point in time, the most sensible option to circumvent this problem is to just clone the whole llvm module for the asm output if we need both, asm and obj file output. Fixes #24876 Fixes #26235
2015-12-18Rollup merge of #30447 - Xmasreturns:Docu, r=steveklabnikManish Goregaokar-4/+6
Added sentences for description of code and changed x in the example to an int
2015-12-18Rollup merge of #30431 - mmcco:cleanup, r=alexcrichtonManish Goregaokar-3/+2
Remove a needless variable and simply a cfg().
2015-12-18Rollup merge of #30420 - petrochenkov:owned2, r=nrcManish Goregaokar-413/+400
Part of https://github.com/rust-lang/rust/pull/30095 not causing mysterious segfaults. r? @nrc
2015-12-18Rollup merge of #30406 - durka:patch-13, r=sanxiynManish Goregaokar-3/+3
The previous example had no chance of compiling in either form, due to the restrictive follow set for `ty`. This one has the desired behavior: http://is.gd/kYdw4g (well, I don't exactly desire this behavior at all, but it's true at least :p )
2015-12-18Rollup merge of #30398 - jwworth:pull-request-1450205451, r=sanxiynManish Goregaokar-1/+1
This fixes a double word typo, 'the'.
2015-12-18Rollup merge of #30384 - nrc:diagnostics, r=@nikomatsakisManish Goregaokar-773/+856
Should make it possible to add JSON or HTML errors. Also tidies up a lot.
2015-12-18Rollup merge of #30286 - oli-obk:const_error_span, r=nikomatsakisManish Goregaokar-25/+37
previously the error was erased and a `non-const path` error was emitted at the location of the field access instead of at the overflow location (as can be seen in the playground: http://is.gd/EuAF5F )
2015-12-18Auto merge of #30272 - tshepang:doc-drain, r=blussbors-15/+26
Second sentence actually repeats info from first sentence. "from start to end" also feels like it adds nothing. I also extended Vec::drain example.
2015-12-18Fix emitting asm and object file output at the same timeBjörn Steinbrink-0/+103
LLVM doesn't really support reusing the same module to emit more than one file. One bug this causes is that the IR is invalidated by the stack coloring pass when emitting the first file, and then the IR verifier complains by the time we try to emit the second file. Also, we get different binaries with --emit=asm,link than with just --emit=link. In some cases leading to segfaults. Unfortunately, it seems that at this point in time, the most sensible option to circumvent this problem is to just clone the whole llvm module for the asm output if we need both, asm and obj file output. Fixes #24876 Fixes #26235
2015-12-18Add more systematic testsVadim Petrochenkov-429/+402
2015-12-18Prohibit public glob reexports of private variantsVadim Petrochenkov-10/+57
2015-12-18Address the commentsVadim Petrochenkov-39/+47
2015-12-18Substitute type aliases before checking for privacyVadim Petrochenkov-24/+43
2015-12-18Use lint instead of warningVadim Petrochenkov-31/+128
2015-12-18Report errors not caught by the old visitor as warningsVadim Petrochenkov-28/+390
2015-12-18Prohibit private variant reexportsVadim Petrochenkov-7/+37
2015-12-18Approximate type aliases as public when determining impl publicityVadim Petrochenkov-0/+29
2015-12-18Update error messages and error descriptionsVadim Petrochenkov-41/+44
2015-12-18Fix the falloutVadim Petrochenkov-50/+27
2015-12-18Rewrite VisiblePrivateTypesVisitorVadim Petrochenkov-322/+258
2015-12-18Auto merge of #29907 - nagisa:mir-moar-constants, r=nikomatsakisbors-28/+490
Still will not translate references to items like `X` or `Y::V` where ``` struct X; enum Y { V } ``` but I must go work on university things so I’m PRing what I have. r? @nikomatsakis
2015-12-17Clarified shadowing exampleXmasreturns-4/+6
Added some additional descriptive sentences and changed x to an int in the example
2015-12-18Abstract away differences between Vec and ptr::P in HIRVadim Petrochenkov-184/+214
2015-12-18Deprecate name `OwnedSlice` and don't use itVadim Petrochenkov-114/+96
2015-12-18libsyntax: Merge OwnedSlice into ptr::PVadim Petrochenkov-115/+90
2015-12-17Auto merge of #30445 - steveklabnik:rollup, r=steveklabnikbors-44/+31
- Successful merges: #30370, #30404, #30415, #30419, #30428, #30437, #30439, #30441, #30442, #30443 - Failed merges:
2015-12-17Rollup merge of #30443 - tshepang:just-a-rename, r=steveklabnikSteve Klabnik-9/+0
2015-12-17Rollup merge of #30442 - tshepang:typo, r=steveklabnikSteve Klabnik-1/+1
2015-12-17Rollup merge of #30441 - tshepang:missing-comma, r=steveklabnikSteve Klabnik-1/+1
2015-12-17Rollup merge of #30439 - swooster:swooster-nomicon-patch-1, r=steveklabnikSteve Klabnik-2/+2
The Rustonomicon's Lifetimes chapter uses the idiom "big ask", which is obscure compared to "tall order" (check [Google ngrams](https://books.google.com/ngrams/graph?content=big+ask%2C+tall+order&year_start=1800)). Also, it's easily mistaken for a typo; either "a big task" or "a big thing to ask" could plausibly work there. r? @steveklabnik
2015-12-17Rollup merge of #30437 - tshepang:clarity, r=steveklabnikSteve Klabnik-1/+1
The comma removes the sorface ambiguity
2015-12-17Rollup merge of #30428 - steveklabnik:quickfix, r=apasel422Steve Klabnik-1/+1
2015-12-17Rollup merge of #30419 - shepmaster:rogue-I, r=alexcrichtonSteve Klabnik-1/+1
r? @steveklabnik
2015-12-17Rollup merge of #30415 - steveklabnik:remove_bad_stability_note, r=alexcrichtonSteve Klabnik-6/+0
2015-12-17Rollup merge of #30404 - Shiney:ImprovedStackHeap, r=steveklabnikSteve Klabnik-20/+22
…entation clearer I could not use colors as suggested for #29854 because Github doesn't support these in markdown, however this solution may be better for color-blind readers.
2015-12-17Rollup merge of #30370 - zachreizner:patch-1, r=apasel422Steve Klabnik-2/+2
2015-12-17doc: improve drain examples and remove secondary info from leading paragraphTshepang Lekhonkhobe-15/+26
2015-12-17doc: no need to duplicate docs on renamed APITshepang Lekhonkhobe-9/+0
2015-12-17Test generic methodsSimonas Kazlauskas-1/+64
2015-12-17doc: fix typoTshepang Lekhonkhobe-1/+1
2015-12-17doc: add a missing commaTshepang Lekhonkhobe-1/+1
2015-12-17Auto merge of #30325 - jseyfried:fixes_30078, r=nrcbors-75/+60
This fixes a bug in which unused imports can get wrongly marked as used when checking for unused qualifications in `resolve_path` (issue #30078), and it removes unused imports that were previously undetected because of the bug.
2015-12-17Change "big ask" to "tall order" in Rustonomicon.Steve Wooster-2/+2
The Rustonomicon's Lifetimes chapter uses the idiom "big ask", which is obscure compared to "tall order" (check Google ngrams). Also, it's easily mistaken for a typo; either "a big task" or "a big thing to ask" could plausibly work there.
2015-12-17doc: improve clarity by introducing a pauseTshepang Lekhonkhobe-1/+1
2015-12-17rustc_resolve: fix a bug in which unused imports can get wrongly marked as ↵Jeffrey Seyfried-16/+25
used when checking for unused qualifications in resolve_path (fixes #30078)
2015-12-17Remove unused importsJeffrey Seyfried-59/+35