about summary refs log tree commit diff
path: root/src/libsyntax/codemap.rs
AgeCommit message (Collapse)AuthorLines
2016-02-12syntax: Replace unstable `vec.as_slice().get()` with `vec.get()`Erick Tryzelaar-1/+1
2016-02-03Changed macro spans in CSVs to point to the macro name, bugfixed nested spansDaniel Campbell-1/+20
2016-02-02Auto merge of #31279 - DanielJCampbell:MacroReferencing, r=nrcbors-0/+21
r? @nrc
2016-02-01Implemented macro referencing for save analysisDaniel Campbell-0/+21
2016-02-01Spans now derive equalityDaniel Campbell-13/+12
2016-01-28Implement MultiSpan error reportingmitaa-3/+260
This allows to render multiple spans on one line, or to splice multiple replacements into a code suggestion.
2016-01-22Extended save-analysis to support generated code, alterned some spans in ↵Daniel Campbell-2/+23
format_args! and derive to maintain compatability
2016-01-20syntax: Fix encoding and decoding spansErick Tryzelaar-5/+20
The protocol for `serialize::{En,De}code` doesn't allow for two integers to be serialized next to each other. This switches the protocol to serializing `Span`s as a struct. rbml structs don't have any overhead, so the metadata shouldn't increase in size, but it allows the json format to be properly generated, albeit slightly more heavy than when it was just serializing a span as a u64. Closes #31025. s
2015-12-28Use a more efficient encoding for opaque data in RBML.Michael Woerister-7/+4
2015-12-08Added pretty-printing for span expansion chains through span_to_expanded_string.Daniel Campbell-0/+204
2015-11-12Add -Zinput-statsNick Cameron-0/+8
Emits loc, and node count - before and after expansion. E.g., ``` rustc: x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore Lines of code: 32060 Pre-expansion node count: 120205 Post-expansion node count: 482749 ```
2015-10-09Some cleanup of no longer used AST thingsNick Cameron-22/+0
2015-10-03Add a method to test span containmentSeo Sanghyeon-1/+5
2015-09-24Cleanup interfaces of Name, SyntaxContext and IdentVadim Petrochenkov-1/+0
Make sure Name, SyntaxContext and Ident are passed by value Make sure Idents don't serve as keys (or parts of keys) in maps, Ident comparison is not well defined
2015-08-31Closures are not generated code.Nick Cameron-2/+0
2015-08-28Move ExpnInfo to NameManish Goregaokar-7/+9
2015-08-27Enumify CompilerExpansion in ExpnInfoManish Goregaokar-7/+34
2015-08-10add and use Span.substitute_dummy methodTim Neumann-0/+7
2015-07-22Instrumentation in effort to understand treatment of `allow_internal_unstable`.Felix S. Klock II-0/+4
It is all `debug!` instrumentation so it should not impose a cost on non-debug builds.
2015-07-21Use a span from the correct file for the inner span of a moduleNick Cameron-1/+1
This basically only affects modules which are empty (or only contain comments). Closes #26755
2015-07-21Provide a filemap ctor with line infoNick Cameron-14/+16
2015-07-21Allow for space between each filemap in the codemapNick Cameron-72/+90
So if a filemap's last byte is at position n in the codemap, then n+1 will not refer to any filemap, and the next filemap will begin an n+2. This is useful for empty files, it means that every file (even empty ones) has a byte in the codemap. Closes #23301, #26504
2015-06-19Move AST Repr impls to Debug impls in libsyntax.Eduard Burtescu-2/+16
2015-06-16Fix file!(), line!() and column!() macrosSimonas Kazlauskas-53/+44
These used to return wrong results in case they were expanded inside compiler’s iternal syntax sugar (closures, if-let) expansions Fixes #26322
2015-06-11Conver reborrows to .iter() calls where appropriateJoshua Landau-2/+2
2015-05-14syntax: abstract over the file loading mechanism.Eduard Burtescu-2/+46
2015-05-12Proper spans for for loop expansionNick Cameron-1/+3
2015-05-07Auto merge of #25013 - pnkfelix:span_to_lines-oflo, r=huonwbors-5/+26
Guard against overflow in `codemap::span_to_lines`. (Revised/expanded version of PR #24976) Make `span_to_lines` to return a `Result`. In `diagnostic`, catch `Err` from `span_to_lines` and print `"(unprintable span)"` instead. ---- There a number of recent issues that report the bug here. See e.g. #24761 and #24954. This change *might* fix them. However, that is *not* its main goal. The main goals are: 1. Make it possible for callers to recover from an error here, and 2. Insert a more conservative check, in that we are also checking that the files match up. ---- As a drive-by, fix #24997 , which was causing my attempts to `make check-stage1` on an `--enable-debug` build to fail.
2015-05-05Guard against overflow in `codemap::span_to_lines`.Felix S. Klock II-5/+26
Make `span_to_lines` to return a `Result`. (This is better than just asserting internally, since it allows caller to decide if they can recover from the problem.) Added type alias for `FileLinesResult` returned by `span_to_lines`. Update embedded unit test to reflect `span_to_lines` signature change. In diagnostic, catch `Err` from `span_to_lines` and print `"(internal compiler error: unprintable span)"` instead. ---- There a number of recent issues that report the bug here. See e.g. #24761 and #24954. This change *might* fix them. However, that is not its main goal. The main goals are: 1. Make it possible for callers to recover from an error here, and 2. Insert a more conservative check, in that we are also checking that the files match up.
2015-05-01syntax: Avoid reallocating or copying in CodeMap::new_filemapUlrik Sverdrup-8/+4
Avoid creating a new String when there is no BOM to strip, and otherwises use .drain(..3) to strip the BOM using the same allocation.
2015-04-24Change name of unit test sub-module to "tests".Johannes Oertel-1/+1
Changes the style guidelines regarding unit tests to recommend using a sub-module named "tests" instead of "test" for unit tests as "test" might clash with imports of libtest.
2015-04-21rollup merge of #24636: alexcrichton/remove-deprecatedAlex Crichton-2/+5
Conflicts: src/libcore/result.rs
2015-04-21std: Remove deprecated/unstable num functionalityAlex Crichton-2/+5
This commit removes all the old casting/generic traits from `std::num` that are no longer in use by the standard library. This additionally removes the old `strconv` module which has not seen much use in quite a long time. All generic functionality has been supplanted with traits in the `num` crate and the `strconv` module is supplanted with the [rust-strconv crate][rust-strconv]. [rust-strconv]: https://github.com/lifthrasiir/rust-strconv This is a breaking change due to the removal of these deprecated crates, and the alternative crates are listed above. [breaking-change]
2015-04-21syntax: Change ExpnId::{from,to}_llvm_cookie to {from,to}_u32Erick Tryzelaar-6/+4
2015-04-21syntax: Replace Vec::map_in_place with stable mut iteratorErick Tryzelaar-9/+11
2015-04-21syntax: Replace String::from_str with the stable String::fromErick Tryzelaar-2/+2
2015-04-21Model lexer: Fix remaining issuesPiotr Czarnecki-2/+0
2015-04-14Negative case of `len()` -> `is_empty()`Tamir Duberstein-3/+3
`s/([^\(\s]+\.)len\(\) [(?:!=)>] 0/!$1is_empty()/g`
2015-04-14Positive case of `len()` -> `is_empty()`Tamir Duberstein-1/+1
`s/(?<!\{ self)(?<=\.)len\(\) == 0/is_empty()/g`
2015-04-11Suppress the macro backtrace for `fileline_note` and `fileline_help`.Ryan Prichard-1/+1
2015-04-10Modify the codemap code to use more slices and to information aboutNiko Matsakis-13/+92
columns within a line, not just the line numbers. Also try to clarify and use the term `line_index` when 0-based.
2015-04-09Debug impls for a few things in syntax::codemapNick Cameron-0/+12
2015-04-01rollup merge of #23860: nikomatsakis/copy-requires-cloneAlex Crichton-2/+2
Conflicts: src/test/compile-fail/coherence-impls-copy.rs
2015-04-01fallout when bootstrapping `rustc`.Felix S. Klock II-2/+2
2015-04-01Fallout in libsyntaxNiko Matsakis-2/+2
2015-03-25Add trivial cast lints.Nick Cameron-3/+3
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-23Add generic conversion traitsAaron Turon-2/+1
This commit: * Introduces `std::convert`, providing an implementation of RFC 529. * Deprecates the `AsPath`, `AsOsStr`, and `IntoBytes` traits, all in favor of the corresponding generic conversion traits. Consequently, various IO APIs now take `AsRef<Path>` rather than `AsPath`, and so on. Since the types provided by `std` implement both traits, this should cause relatively little breakage. * Deprecates many `from_foo` constructors in favor of `from`. * Changes `PathBuf::new` to take no argument (creating an empty buffer, as per convention). The previous behavior is now available as `PathBuf::from`. * De-stabilizes `IntoCow`. It's not clear whether we need this separate trait. Closes #22751 Closes #14433 [breaking-change]
2015-03-10Fix unstable span checksSteven Fackler-1/+1
2015-03-09Rename #[should_fail] to #[should_panic]Steven Fackler-1/+1
2015-03-06Add #[allow_internal_unstable] to track stability for macros better.Huon Wilson-32/+38
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.