about summary refs log tree commit diff
path: root/src/libsyntax/ext/tt
AgeCommit message (Collapse)AuthorLines
2015-03-25Add trivial cast lints.Nick Cameron-1/+1
This permits all coercions to be performed in casts, but adds lints to warn in those cases. Part of this patch moves cast checking to a later stage of type checking. We acquire obligations to check casts as part of type checking where we previously checked them. Once we have type checked a function or module, then we check any cast obligations which have been acquired. That means we have more type information available to check casts (this was crucial to making coercions work properly in place of some casts), but it means that casts cannot feed input into type inference. [breaking change] * Adds two new lints for trivial casts and trivial numeric casts, these are warn by default, but can cause errors if you build with warnings as errors. Previously, trivial numeric casts and casts to trait objects were allowed. * The unused casts lint has gone. * Interactions between casting and type inference have changed in subtle ways. Two ways this might manifest are: - You may need to 'direct' casts more with extra type information, for example, in some cases where `foo as _ as T` succeeded, you may now need to specify the type for `_` - Casts do not influence inference of integer types. E.g., the following used to type check: ``` let x = 42; let y = &x as *const u32; ``` Because the cast would inform inference that `x` must have type `u32`. This no longer applies and the compiler will fallback to `i32` for `x` and thus there will be a type error in the cast. The solution is to add more type information: ``` let x: u32 = 42; let y = &x as *const u32; ```
2015-03-23Fallout in stdlib, rustdoc, rustc, etc. For most maps, converted uses ofNiko Matsakis-2/+2
`[]` on maps to `get` in rustc, since stage0 and stage1+ disagree about how to use `[]`.
2015-03-13syntax: use lookahead to distinguish inner and outer attributes, instead of ↵Eduard Burtescu-16/+10
passing the latter around.
2015-03-11syntax: move MethMac to MacImplItem and combine {Provided,Required}Method ↵Eduard Burtescu-6/+4
into MethodTraitItem.
2015-03-11syntax: gather common fields of impl & trait items into their respective types.Eduard Burtescu-1/+2
2015-03-11syntax: move indirection around {Trait,Impl}Item, from within.Eduard Burtescu-1/+1
2015-03-06Add #[allow_internal_unstable] to track stability for macros better.Huon Wilson-1/+1
Unstable items used in a macro expansion will now always trigger stability warnings, *unless* the unstable items are directly inside a macro marked with `#[allow_internal_unstable]`. IOW, the compiler warns unless the span of the unstable item is a subspan of the definition of a macro marked with that attribute. E.g. #[allow_internal_unstable] macro_rules! foo { ($e: expr) => {{ $e; unstable(); // no warning only_called_by_foo!(); }} } macro_rules! only_called_by_foo { () => { unstable() } // warning } foo!(unstable()) // warning The unstable inside `foo` is fine, due to the attribute. But the `unstable` inside `only_called_by_foo` is not, since that macro doesn't have the attribute, and the `unstable` passed into `foo` is also not fine since it isn't contained in the macro itself (that is, even though it is only used directly in the macro). In the process this makes the stability tracking much more precise, e.g. previously `println!("{}", unstable())` got no warning, but now it does. As such, this is a bug fix that may cause [breaking-change]s. The attribute is definitely feature gated, since it explicitly allows side-stepping the feature gating system.
2015-03-05Auto merge of #22061 - pczarn:quote_matcher_and_attr, r=kmcallisterbors-13/+9
Fixes #19674 Fixes #17396 (already closed, yeah) cc @kmcallister , @cmr
2015-03-04Add quasiquote for matchers and attributesPiotr Czarnecki-13/+9
2015-03-03Switched to Box::new in many places.Felix S. Klock II-3/+3
Many of the modifications putting in `Box::new` calls also include a pointer to Issue 22405, which tracks going back to `box <expr>` if possible in the future. (Still tried to use `Box<_>` where it sufficed; thus some tests still have `box_syntax` enabled, as they use a mix of `box` and `Box::new`.) Precursor for overloaded-`box` and placement-`in`; see Issue 22181.
2015-02-25Always error on invalid macro fragment specifiersKeegan McAllister-4/+4
Fixes #21370. unused-macro-with-follow-violation.rs was already handled correctly. That test is just for good measure. :)
2015-02-20Remove remaining uses of `[]`. This time I tried to use deref coercions ↵Niko Matsakis-1/+1
where possible.
2015-02-18Round 3 test fixes and conflictsAlex Crichton-7/+7
2015-02-18rollup merge of #22502: nikomatsakis/deprecate-bracket-bracketAlex Crichton-10/+10
Conflicts: src/libcollections/slice.rs src/libcollections/str.rs src/librustc/middle/lang_items.rs src/librustc_back/rpath.rs src/librustc_typeck/check/regionck.rs src/libstd/ffi/os_str.rs src/libsyntax/diagnostic.rs src/libsyntax/parse/parser.rs src/libsyntax/util/interner.rs src/test/run-pass/regions-refcell.rs
2015-02-18Replace all uses of `&foo[]` with `&foo[..]` en masse.Niko Matsakis-10/+10
2015-02-18rollup merge of #22497: nikomatsakis/suffixesAlex Crichton-1/+1
Conflicts: src/librustc_trans/trans/tvec.rs
2015-02-18Remove `i`, `is`, `u`, or `us` suffixes that are not necessary.Niko Matsakis-1/+1
2015-02-18Opt for .cloned() over .map(|x| x.clone()) etc.Kevin Butler-2/+2
2015-02-13Parse `pub` in the expansion of a method macroKeegan McAllister-2/+1
Fixes #17436.
2015-02-06Update to last version, remove "[]" as much as possibleGuillaumeGomez-2/+2
2015-02-06Libsyntax has been updatedGuillaumeGomez-3/+2
2015-02-06Replace the get method by the deref one on InternedStringGuillaumeGomez-3/+4
2015-02-05cleanup: replace `as[_mut]_slice()` calls with deref coercionsJorge Aparicio-9/+9
2015-02-02rollup merge of #21830: japaric/for-cleanupAlex Crichton-5/+5
Conflicts: src/librustc/metadata/filesearch.rs src/librustc_back/target/mod.rs src/libstd/os.rs src/libstd/sys/windows/os.rs src/libsyntax/ext/tt/macro_parser.rs src/libsyntax/print/pprust.rs src/test/compile-fail/issue-2149.rs
2015-02-02`for x in xs.iter_mut()` -> `for x in &mut xs`Jorge Aparicio-1/+1
Also `for x in option.iter_mut()` -> `if let Some(ref mut x) = option`
2015-02-02`for x in xs.iter()` -> `for x in &xs`Jorge Aparicio-4/+4
2015-02-02Omit integer suffix when unnecessaryAlfie John-18/+18
See PR # 21378 for context
2015-01-29convert remaining `range(a, b)` to `a..b`Jorge Aparicio-1/+1
2015-01-29`for x in range(a, b)` -> `for x in a..b`Jorge Aparicio-3/+3
sed -i 's/in range(\([^,]*\), *\([^()]*\))/in \1\.\.\2/g' **/*.rs
2015-01-29`range(a, b).foo()` -> `(a..b).foo()`Jorge Aparicio-1/+1
sed -i 's/ range(\([^,]*\), *\([^()]*\))\./ (\1\.\.\2)\./g' **/*.rs
2015-01-23Rephrase error message on invalid fragment specifiers in macros.Alexander Korolkov-6/+10
Also, print help on valid fragment specifiers.
2015-01-21rollup merge of #21429: GuillaumeGomez/macro-fixAlex Crichton-53/+54
This is little clean code of this PR: #21366. I patched the same thing as aochagavia but too slowly obviously. This is a merge of our two codes, more "rust-like".
2015-01-21rollup merge of #21340: pshc/libsyntax-no-more-intsAlex Crichton-31/+31
Collaboration with @rylev! I didn't change `int` in the [quasi-quoter](https://github.com/pshc/rust/blob/99ae1a30f3ca28c0f7e431620560d30e44627124/src/libsyntax/ext/quote.rs#L328), because I'm not sure if there will be adverse effects. Addresses #21095.
2015-01-19Updates of the fixGuillaumeGomez-43/+43
2015-01-18libsyntax: 0u -> 0us, 0i -> 0isPaul Collier-18/+18
2015-01-18Fix #21356Adolfo Ochagavía-14/+15
2015-01-18syntax: allow bare sequences in lhs for follow checkingCorey Richardson-10/+13
Closes #21350
2015-01-17libsyntax: uint types to usizePaul Collier-13/+13
2015-01-07use slicing sugarJorge Aparicio-20/+20
2015-01-06Test fixes and rebase conflictsAlex Crichton-14/+19
2015-01-06rollup merge of #20563: cmr/macro-input-future-proofingAlex Crichton-8/+185
2015-01-06Minor fallout/update FOLLOW setsCorey Richardson-2/+2
2015-01-06rollup merge of #19430: pczarn/interp_tt-cleanupAlex Crichton-26/+44
Conflicts: src/libsyntax/parse/parser.rs
2015-01-06rollup merge of #20653: alexcrichton/entry-unstableAlex Crichton-1/+1
There's been some debate over the precise form that these APIs should take, and they've undergone some changes recently, so these APIs are going to be left unstable for now to be fleshed out during the next release cycle.
2015-01-07Cleanup and followup to PR #17830: parsing changesPiotr Czarnecki-26/+44
Prevents breaking down `$name` tokens into separate `$` and `name`. Reports unknown macro variables. Fixes #18775 Fixes #18839 Fixes #15640
2015-01-06rollup merge of #20481: seanmonstar/fmt-show-stringAlex Crichton-2/+2
Conflicts: src/compiletest/runtest.rs src/libcore/fmt/mod.rs src/libfmt_macros/lib.rs src/libregex/parse.rs src/librustc/middle/cfg/construct.rs src/librustc/middle/dataflow.rs src/librustc/middle/infer/higher_ranked/mod.rs src/librustc/middle/ty.rs src/librustc_back/archive.rs src/librustc_borrowck/borrowck/fragments.rs src/librustc_borrowck/borrowck/gather_loans/mod.rs src/librustc_resolve/lib.rs src/librustc_trans/back/link.rs src/librustc_trans/save/mod.rs src/librustc_trans/trans/base.rs src/librustc_trans/trans/callee.rs src/librustc_trans/trans/common.rs src/librustc_trans/trans/consts.rs src/librustc_trans/trans/controlflow.rs src/librustc_trans/trans/debuginfo.rs src/librustc_trans/trans/expr.rs src/librustc_trans/trans/monomorphize.rs src/librustc_typeck/astconv.rs src/librustc_typeck/check/method/mod.rs src/librustc_typeck/check/mod.rs src/librustc_typeck/check/regionck.rs src/librustc_typeck/collect.rs src/libsyntax/ext/format.rs src/libsyntax/ext/source_util.rs src/libsyntax/ext/tt/transcribe.rs src/libsyntax/parse/mod.rs src/libsyntax/parse/token.rs src/test/run-pass/issue-8898.rs
2015-01-07falloutNick Cameron-1/+1
2015-01-06Stricter rules surrounding adjacent nonterminals and sequencesCorey Richardson-29/+74
2015-01-06core: split into fmt::Show and fmt::StringSean McArthur-2/+2
fmt::Show is for debugging, and can and should be implemented for all public types. This trait is used with `{:?}` syntax. There still exists #[derive(Show)]. fmt::String is for types that faithfully be represented as a String. Because of this, there is no way to derive fmt::String, all implementations must be purposeful. It is used by the default format syntax, `{}`. This will break most instances of `{}`, since that now requires the type to impl fmt::String. In most cases, replacing `{}` with `{:?}` is the correct fix. Types that were being printed specifically for users should receive a fmt::String implementation to fix this. Part of #20013 [breaking-change]
2015-01-07Replace full slice notation with index callsNick Cameron-21/+21