about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorLines
2015-02-25Always error on invalid macro fragment specifiersKeegan McAllister-4/+36
Fixes #21370. unused-macro-with-follow-violation.rs was already handled correctly. That test is just for good measure. :)
2015-02-25Auto merge of #22512 - nikomatsakis:issue-20300-where-clause-not-bounds, ↵bors-417/+1066
r=nikomatsakis This is a fix for #20300 though as a side-sweep it fixes a number of stack overflows because it integrates cycle detection into the conversion process. I didn't go through and retest everything. The tricky part here is that in some cases we have to go find the information we need from the AST -- we can't use the converted form of the where-clauses because we often have to handle something like `T::Item` *while converting the where-clauses themselves*. Since this is also not a fixed-point process we can't just try and keep trying to find the best order. So instead I modified the `AstConv` interface to allow you to request the bounds for a type parameter; we'll then do a secondary scan of the where-clauses to figure out what we need. This may create a cycle in some cases, but we have code to catch that. Another approach that is NOT taken by this PR would be to "convert" `T::Item` into a form that does not specify what trait it's using. This then kind of defers the problem of picking the trait till later. That might be a good idea, but it would make normalization and everything else much harder, so I'm holding off on that (and hoping to find a better way for handling things like `i32::T`). This PR also removes "most of" the `bounds` struct from `TypeParameterDef`. Still a little ways to go before `ParamBounds` can be removed entirely -- it's used for supertraits, for example (though those really ought to be converted, I think, to a call to `get_type_parameter_bounds` on `Self` from within the trait definition). cc @jroesch Fixes #20300
2015-02-24Merge conflicts due to eddyb's UFCS branchNiko Matsakis-9/+11
2015-02-24Remove two uses of old `[]` notationNiko Matsakis-2/+2
2015-02-24Merge conflict: port default impls codeNiko Matsakis-1/+1
2015-02-24Add handy switch `-Z treat-err-as-bug` -- it often happens that I amNiko Matsakis-0/+15
compiling something I expect to succeed, and this lets me get stacktraces and also abort compilation faster.
2015-02-24Rework trait-bound-conversion so be based on the AST and rework collectNiko Matsakis-266/+552
to pass in the appropriate ast::generics etc
2015-02-24Remove bounds struct from TypeParameterDef. Bounds information is nowNiko Matsakis-57/+38
exclusively stored in the where clauses.
2015-02-24Rework the `get_type_parameter_bounds` impl to use a trait objectNiko Matsakis-31/+79
and act more generically.
2015-02-24Comprehence cycle detection in `collect`. In some cases, the cycles weNiko Matsakis-68/+282
report are not *necessary* cycles, but we'll work on refactoring them over time. This overlaps with the cycle detection that astconv already does: I left that code in because it gives a more targeted error message, though perhaps less helpful in that it doesn't give the full details of the cycle.
2015-02-24Convert `astconv` to request bounds through the `AstConv` interfaceNiko Matsakis-7/+55
rather than poking through the `TypeParameterDef` directly.
2015-02-24Change collect to implement `AstConv` on a `ItemCtxt` rather than aNiko Matsakis-125/+180
global context. Have this `ItemCtxt` carry a (currently unused) pointer to the in-scope generics.
2015-02-24Auto merge of #22530 - rprichard:master, r=dotdashbors-1/+7
Fixes #22525 I wasn't sure if I should reuse `write::get_llvm_opt_level` or not. It returns an `llvm::CodeGenOptLevel`, which is the Rust binding for `CodeGenOpt::Level`. `lto.rs` is passing an optlevel to LLVM's `PassManagerBuilder`, which takes an unsigned int. `PassManagerBuilder`'s optlevel uses essentially the same enumeration (i.e. 0-3 with 2 as default), but it's implicit.
2015-02-24Auto merge of #22172 - eddyb:almost-there, r=nikomatsakisbors-2648/+2363
Adds `<module::Type>::method` support and makes `module::Type::method` a shorthand for it. This is most of #16293, except that chaining multiple associated types is not yet supported. It also fixes #22563 as `impl`s are no longer treated as modules in resolve. Unfortunately, this is still a *[breaking-change]*: * If you used a global path to a primitive type, i.e. `::bool`, `::i32` etc. - that was a bug I had to fix. Solution: remove the leading `::`. * If you passed explicit `impl`-side type parameters to an inherent method, e.g.: ```rust struct Foo<T>(T); impl<A, B> Foo<(A, B)> { fn pair(a: A, b: B) -> Foo<(A, B)> { Foo((a, b)) } } Foo::<A, B>::pair(a, b) // Now that is sugar for: <Foo<A, B>>::pair(a, b) // Which isn't valid because `Foo` has only one type parameter. // Solution: replace with: Foo::<(A, B)>::pair(a, b) // And, if possible, remove the explicit type param entirely: Foo::pair(a, b) ``` * If you used the `QPath`-related `AstBuilder` methods @hugwijst added in #21943. The methods still exist, but `QPath` was replaced by `QSelf`, with the actual path stored separately. Solution: unpack the pair returned by `cx.qpath` to get the two arguments for `cx.expr_qpath`.
2015-02-24Auto merge of #22749 - kballard:process-stdio-constructors, r=alexcrichtonbors-2/+2
There are no tests for this because testing inherit/null is tricky. Probably why there weren't tests for it to begin with.
2015-02-24syntax: update pretty-printer for the `<T>::method` shorthand.Eduard Burtescu-3/+6
2015-02-24Fix fallout from rebasing.Eduard Burtescu-21/+22
2015-02-24rustc_typeck: unify the impl type with the UFCS path prefix type.Eduard Burtescu-7/+32
2015-02-24Update trans/save's span hacks for fully qualified UFCS paths.Eduard Burtescu-3/+11
2015-02-24Fix fallout from allowing impls outside of the type's definition module.Eduard Burtescu-9/+4
2015-02-24Fix fallout from correct stability handling in UFCS.Eduard Burtescu-9/+145
2015-02-24Fix @nikomatsakis' nits in typeck.Eduard Burtescu-36/+27
2015-02-24tests: add two new run-pass tests for method behavior after UFCS.Eduard Burtescu-0/+69
2015-02-24Implement `<T>::method` UFCS expression syntax.Eduard Burtescu-200/+286
2015-02-24tests: remove warnings from and rename const-polymorphic-paths to ↵Eduard Burtescu-32/+32
ufcs-polymorphic-paths.
2015-02-24rustc: combine partial_def_map and last_private_map into def_map.Eduard Burtescu-449/+444
2015-02-24rustc_resolve: don't handle impl items as if they were modules.Eduard Burtescu-384/+156
2015-02-24core: fix typo that wasn't caught by the hacky previous implementation.Eduard Burtescu-1/+1
2015-02-24Use partial path resolutions in expressions for UFCS desugaring.Eduard Burtescu-213/+387
2015-02-24rustc_resolve: remove the distinction between DefStaticMethod and DefMethod.Eduard Burtescu-159/+89
2015-02-24rustc: use partially resolved definitions to replace the `T::A` hack.Eduard Burtescu-375/+376
2015-02-24rustc_resolve: use the visitor model more, remove redundant repeated lookups.Eduard Burtescu-722/+335
2015-02-24syntax: use a single Path for Trait::Item in QPath.Eduard Burtescu-251/+177
2015-02-24rustc_resolve: use DefAssociatedTy for TyQPath.Eduard Burtescu-84/+95
2015-02-24rustc: load DefAssociatedTy from cross-crate metadata. Fixes #20542.Eduard Burtescu-27/+38
2015-02-24rustc: remove unused ForeignType item family.Eduard Burtescu-3/+1
2015-02-24syntax: don't use TraitRef in QPath.Eduard Burtescu-146/+143
2015-02-24syntax: don't store a secondary NodeId for TyPath.Eduard Burtescu-101/+74
2015-02-24Revert bogus rename from DefTrait to DefaultImpl.Eduard Burtescu-26/+26
2015-02-24Auto merge of #22755 - Manishearth:rollup, r=Manishearthbors-948/+1401
2015-02-24Fix integers in tests (fixup #22700)Manish Goregaokar-4/+4
2015-02-23Disable run-pass/sepcomp-lib-lto.rs on Android until #18800 is fixedRyan Prichard-0/+1
2015-02-24Rollup merge of #22720 - edwardw:enum-struct-ident-walk-into-a-bar, r=nick29581Manish Goregaokar-0/+44
Closes #22589 Closes #22647 Closes #22665 Closes #22712
2015-02-24Add tests for expect ident but find enum or struct panicEdward Wang-0/+44
Closes #22589 Closes #22647 Closes #22665 Closes #22712
2015-02-24Remove another instance of ty_open (fixup #22213)Manish Goregaokar-2/+0
2015-02-24Rollup merge of #22213 - eddyb:ty_open-case-closed, r=nikomatsakisManish Goregaokar-320/+184
This type wasn't necessary, as there was no place using it and unsized types not wrapped in it, at the same time. r? @nikomatsakis
2015-02-24rustc_trans: use an Lvalue Datum for an unsized lvalue to avoid bogus drops.Eduard Burtescu-12/+7
2015-02-24tests: update expected recursion limit errors for the temporary lack of spans.Eduard Burtescu-16/+29
2015-02-24Remove ty_open and treat Unsized lvalues as *Unsized.Eduard Burtescu-303/+159
2015-02-24Remove double expr_u32 (fixup #22700)Manish Goregaokar-3/+0