about summary refs log tree commit diff
path: root/src/librustc/traits
AgeCommit message (Collapse)AuthorLines
2018-08-29Remove `AccumulateVec` and its uses.Nicholas Nethercote-3/+3
It's basically just a less capable version of `SmallVec`.
2018-08-29Replace bug! call with OverflowGuillaume Gomez-1/+1
2018-08-27Rename hir::map::NodeKind to hir::Nodevarkor-9/+9
2018-08-27Remove path prefixes from NodeKindvarkor-8/+9
2018-08-27Rename hir::map::Node to hir::map::NodeKindvarkor-8/+8
2018-08-27Auto merge of #53580 - nikomatsakis:nll-issue-53568, r=pnkfelixbors-2/+89
fix NLL ICEs Custom type-ops reuse some of the query machinery -- but while query results are canonicalized after they are constructed, custom type ops are not, and hence we have to resolve the type variables to avoid an ICE here. Also, use the type-op machinery for implied outlives bounds. Fixes #53568 Fixes #52992 Fixes #53680
2018-08-24Rollup merge of #53563 - matthiaskrgr:String, r=varkorkennytm-5/+5
use String::new() instead of String::from(""), "".to_string(), "".to_owned() or "".into()
2018-08-23Auto merge of #53588 - ↵bors-30/+8
tristanburgess:52985_diagnostics_no_concrete_type_behind_existential_type, r=oli-obk 52985 diagnostics no concrete type behind existential type @oli-obk FYI. See below for new cycle error generated. ```rust error[E0391]: cycle detected when processing `Foo` --> /dev/staging/existential_type_no_concrete_type_nouse_potential.rs:3:1 | 3 | existential type Foo: Copy; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: ...which requires processing `bar`... --> /dev/staging/existential_type_no_concrete_type_nouse_potential.rs:6:23 | 6 | fn bar(x: Foo) -> Foo { | _______________________^ 7 | | x 8 | | } | |_^ = note: ...which again requires processing `Foo`, completing the cycle error: aborting due to previous error For more information about this error, try `rustc --explain E0391`. ```
2018-08-23use `TypeOp` machinery for `outlives_bounds`Niko Matsakis-0/+81
Fixes #52992
2018-08-23resolve type variables in the custom type op pathwayNiko Matsakis-1/+2
2018-08-23use String::new() instead of String::from(""), "".to_string(), "".to_owned() ↵Matthias Krüger-5/+5
or "".into()
2018-08-23Use optimized SmallVec implementationIgor Gutorov-5/+5
2018-08-2252985: formatting PR filesTristan Burgess-9/+14
2018-08-2252985: better cycle error for existential typesTristan Burgess-36/+9
- Original cycle error diagnostics PR'd against this issue caught panic-causing error while resolving std::mem::transmute calls - Now, catch invalid use case of not providing a concrete sized type behind existential type in definining use case. - Update relevant test to reflect this new error 52985: revert normalize query changes - PR 53588 invalidates 53316, causing a correct cycle error to occur with a good span. - Don't need to revert the whole merge as the test files are still fine, just need to revert the normalize query changes. - It should now be correct that infinite recursion detected during normalize query type folding is a bug, should have been caught earlier (when resolving the existential type's defining use cases). 52985: code review impl - Only cause cycle error if anonymous type resolves to anonymous type that has the same def id (is the same type) as the original (parent) type. - Add test case to cover this case for existential types. 52985: remove Ty prefix from TyAnon - To align with changes per commit 6f637da50c56a22f745fd056691da8c86824cd9b
2018-08-22Remove unnecessary TyKind::svarkor-2/+2
2018-08-22Remove Ty prefix from Ty{Bool|Char|Int|Uint|Float|Str}varkor-29/+29
2018-08-22Remove Ty prefix from Ty{Foreign|Param}varkor-21/+21
2018-08-22Remove Ty prefix from ↵varkor-163/+163
Ty{Adt|Array|Slice|RawPtr|Ref|FnDef|FnPtr|Dynamic|Closure|Generator|GeneratorWitness|Never|Tuple|Projection|Anon|Infer|Error}
2018-08-22Rename ty::TyVariants to ty::TyKindvarkor-2/+2
2018-08-22Rename ty::Slice to ty::Listvarkor-5/+5
2018-08-21change `make_query_outlives` to take an iteratorNiko Matsakis-2/+7
2018-08-21Rollup merge of #53496 - matthiaskrgr:codespell_08_2018, r=varkorkennytm-6/+6
Fix typos found by codespell.
2018-08-20Force-inline `shallow_resolve` at its hottest call site.Nicholas Nethercote-1/+2
It's a ~1% win on `keccak` and `inflate`.
2018-08-19Auto merge of #52953 - dsciarra:mv-codemap-sourcemap, r=petrochenkovbors-22/+22
Rename CodeMap/FileMap to SourceMap/SourceFile A first renaming for #51574
2018-08-19Auto merge of #53316 - tristanburgess:52895_existential_type_ICE, r=oli-obkbors-9/+36
52985: cause cycle err on inf trait normalization Issue: #52985 - If an existential type is defined, but no user code infers the concrete type behind the existential type, normalization would infinitely recurse on this existential type which is only defined in terms of itself. - Instead of raising an inf recurse error, we cause a cycle error to help highlight that the issue is that the type is only defined in terms of itself. - Three known potential improvements: - If type folding itself was exposed as a query, used by normalization and other mechanisms, cases that would cause infinite recursion would automatically cause a cycle error. - The span for the cycle error should be improved to point to user code that fails to allow inference of the concrete type of the existential type, assuming that this error occurs because no user code can allow inference the concrete type. - A mechanism to extend the cycle error with a helpful note would be nice. Currently, the error is built and maintained by src/librustc/ty/query/plumbing, with no known way to extend the information that the error gets built with. r? @oli-obk
2018-08-19mv codemap() source_map()Donato Sciarra-19/+19
2018-08-19mv (mod) codemap source_mapDonato Sciarra-3/+3
2018-08-19Fix typos found by codespell.Matthias Krüger-6/+6
2018-08-19Auto merge of #53248 - nikomatsakis:nll-trivial-sized-predicate, r=eddybbors-2/+16
skip trivial `Sized` predicates This came to about a 2% win for me in cargo. Small, but hey. r? @eddyb
2018-08-19Auto merge of #51131 - qnighy:unsized-locals, r=eddybbors-0/+12
Implement Unsized Rvalues This PR is the first step to implement RFC1909: unsized rvalues (#48055). ## Implemented - `Sized` is removed for arguments and local bindings. (under `#![feature(unsized_locals)]`) - Unsized locations are allowed in MIR - Unsized places and operands are correctly translated at codegen ## Not implemented in this PR - Additional `Sized` checks: - tuple struct constructor (accidentally compiles now) - closure arguments at closure generation (accidentally compiles now) - upvars (ICEs now) - Generating vtable for `fn method(self)` (ICEs now) - VLAs: `[e; n]` where `n` isn't const - Reduce unnecessary allocations ## Current status - [x] Fix `__rust_probestack` (rust-lang-nursery/compiler-builtins#244) - [x] Get the fix merged - [x] `#![feature(unsized_locals)]` - [x] Give it a tracking issue number - [x] Lift sized checks in typeck and MIR-borrowck - [ ] <del>Forbid `A(unsized-expr)`</del> will be another PR - [x] Minimum working codegen - [x] Add more examples and fill in unimplemented codegen paths - [ ] <del>Loosen object-safety rules (will be another PR)</del> - [ ] <del>Implement `Box<FnOnce>` (will be another PR)</del> - [ ] <del>Reduce temporaries (will be another PR)</del>
2018-08-19Lift some Sized checks.Masaki Hara-0/+6
2018-08-19Add notes on unsized argument errors.Masaki Hara-0/+6
2018-08-18Use the new Entry::or_default method where possible.Eduard-Mihai Burtescu-25/+17
2018-08-17Auto merge of #53449 - frewsxcv:rollup, r=frewsxcvbors-0/+4
Rollup of 11 pull requests Successful merges: - #52858 (Implement Iterator::size_hint for Elaborator.) - #53321 (Fix usage of `wasm_target_feature`) - #53326 ([nll] add regression test for issue #27868) - #53347 (rustc_resolve: don't allow paths starting with `::crate`.) - #53349 ([nll] add tests for #48697 and #30104) - #53357 (Pretty print btreemap for GDB) - #53358 (`{to,from}_{ne,le,be}_bytes` for unsigned integer types) - #53406 (Do not suggest conversion method that is already there) - #53407 (make more ported compile fail tests more robust w.r.t. NLL) - #53413 (Warn that `#![feature(rust_2018_preview)]` is implied when the edition is set to Rust 2018.) - #53434 (wasm: Remove --strip-debug argument to LLD) Failed merges: r? @ghost
2018-08-17Auto merge of #53288 - RalfJung:dropck, r=nikomatsakisbors-5/+3
unions are not always trivially dropable Fixes #52786 r? @nikomatsakis
2018-08-16Implement Iterator::size_hint for Elaborator.Corey Farwell-0/+4
2018-08-16Auto merge of #53295 - estebank:on-unimplemented, r=michaelwoeristerbors-16/+28
Various changes to `rustc_on_unimplemented` - Add `from_method` and `from_desugaring` to formatting options - Change wording of errors slightly
2018-08-15Rollup merge of #53342 - RalfJung:unsized-packed, r=cramertjGuillaume Gomez-6/+11
fix error for unsized packed struct field It was really confusing to be told "only the last field of a struct may have a dynamically sized type" when only the last field *was* unsized.
2018-08-15fix error for unsized packed struct fieldRalf Jung-6/+11
2018-08-15Auto merge of #53212 - sunjay:nll-raw-cast, r=nikomatsakisbors-1/+14
NLL - Prevent where clauses from extending the lifetime of bindings Fixes https://github.com/rust-lang/rust/issues/53123 r? @nikomatsakis
2018-08-14Suggested trait implementation ordering is now deterministic.David Wood-4/+12
2018-08-1352985: cause cycle err on inf trait normalizationTristan Burgess-9/+36
- If an existential type is defined, but no user code infers the concrete type behind the existential type, normalization would infinitely recurse on this existential type which is only defined in terms of itself. - Instead of raising an inf recurse error, we cause a cycle error to help highlight that the issue is that the type is only defined in terms of itself. - Three known potential improvements: - If type folding itself was exposed as a query, used by normalization and other mechanisms, cases that would cause infinite recursion would automatically cause a cycle error. - The span for the cycle error should be improved to point to user code that fails to allow inference of the concrete type of the existential type, assuming that this error occurs because no user code can allow inference the concrete type. - A mechanism to extend the cycle error with a helpful note would be nice. Currently, the error is built and maintained by src/librustc/ty/query/plumbing, with no known way to extend the information that the error gets built with.
2018-08-12Rollup merge of #53223 - ljedrz:cleanup_data_structures, r=oli-obkGuillaume Gomez-3/+3
A few cleanups for rustc_data_structures - remove a redundant `clone()` - make some calls to `.iter()` implicit - collapse/simplify a few operations - remove some explicit `return`s - make `SnapshotMap::{commit, rollback_to}` take references - remove unnecessary struct field names - change `transmute()`s in `IdxSet::{from_slice, from_slice_mut}` to casts - remove some unnecessary lifetime annotations - split 2 long literals
2018-08-12Various changes to `rustc_on_unimplemented`Esteban Küber-16/+28
- Add `from_method` and `from_desugaring` to formatting options - Change wording of errors slightly
2018-08-12unions are not always trivially dropableRalf Jung-5/+3
Fixes #52786
2018-08-10skip trivial `T: Sized` predicatesNiko Matsakis-2/+16
2018-08-10Consider changing assert! to debug_assert! when it calls visit_withljedrz-6/+6
2018-08-09Preferring BuiltInCandidate { has_nested: false } in all casesSunjay Varma-1/+14
2018-08-09Make SnapshotMap::{commit, rollback_to} take referencesljedrz-3/+3
2018-08-07Avoid unnecessary pattern matching against Option and Resultljedrz-8/+5