Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Rust][Diagnostics] Add initial boilerplate for Rust diagnostic interface. #6656

Merged
merged 32 commits into from Nov 2, 2020

Conversation

jroesch
Copy link
Member

@jroesch jroesch commented Oct 9, 2020

This PR exposes new diagnostics to Rust so we can reuse the better libraries for diagnostics rendering via Rust.

@jroesch jroesch changed the title [Rust][Diagnostics] Add initial boilerplate for Rust diagnostic interface. [Rust][Diagnostics][WIP] Add initial boilerplate for Rust diagnostic interface. Oct 9, 2020
@jroesch
Copy link
Member Author

jroesch commented Oct 9, 2020

cc @gussmith23 and @mwillsey

@tqchen tqchen changed the base branch from master to main October 11, 2020 18:16
@jroesch jroesch changed the title [Rust][Diagnostics][WIP] Add initial boilerplate for Rust diagnostic interface. [Rust][Diagnostics] Add initial boilerplate for Rust diagnostic interface. Oct 16, 2020
rust/compiler-ext/Cargo.toml Outdated Show resolved Hide resolved
cmake/modules/RustExt.cmake Outdated Show resolved Hide resolved
rust/tvm/src/ir/diagnostics/mod.rs Outdated Show resolved Hide resolved
rust/tvm/src/ir/span.rs Outdated Show resolved Hide resolved
cmake/modules/RustExt.cmake Outdated Show resolved Hide resolved
CMakeLists.txt Outdated Show resolved Hide resolved
@jroesch
Copy link
Member Author

jroesch commented Oct 26, 2020

I think this one is now ready to roll.

jroesch and others added 3 commits October 30, 2020 13:51
Co-authored-by: Tristan Konolige <tristan.konolige@gmail.com>
rust/compiler-ext/Cargo.toml Outdated Show resolved Hide resolved
rust/compiler-ext/Cargo.toml Show resolved Hide resolved

fn next(&mut self) -> Option<Self::Item> {
if self.pos < self.size {
let item = self.array.get(self.pos).expect("should not fail");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even though exceptional, better error message here than "should not fail"

rust/tvm-rt/src/function.rs Show resolved Hide resolved
rust/tvm-rt/src/function.rs Outdated Show resolved Hide resolved
rust/tvm/src/bin/tyck.rs Outdated Show resolved Hide resolved
rust/tvm/src/bin/tyck.rs Outdated Show resolved Hide resolved
rust/tvm/src/bin/tyck.rs Show resolved Hide resolved
}

/// A mapping for all files in a source map to byte ranges.
struct SpanToByteRange {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a place where we could integrating like tracing-style spans? (looking for PR ideas)


// TODO(@jroesch): define type
type TypeData = ObjectRef;
type GlobalTypeVar = ObjectRef;

#[derive(Error, Debug)]
pub enum Error {
#[error("{0}")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we also want to use #[source] for the errors?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This kind of stuff would be good follow up work imo.

@junrushao junrushao merged commit 883954e into apache:main Nov 2, 2020
trevor-m pushed a commit to trevor-m/tvm that referenced this pull request Dec 2, 2020
…face. (apache#6656)

* Add initial boilerplate for Rust diagnostic interface.

* Codespan example almost working

* WIP

* Hacking on Rust inside of TVM

* Borrow code from Egg

* Update CMake and delete old API

* Fix Linux build

* Clean up exporting to show off new diagnostics

* Improve Rust bindings

* Fix calling

* Fix

* Rust Diagnostics work

* Remove type checker

* Format and cleanup

* Fix the extension code

* More cleanup

* Fix some CR

* Add docs and address feedback

* WIP more improvments

* Update cmake/modules/RustExt.cmake

Co-authored-by: Robert Kimball <bobkimball@gmail.com>

* Update rust/tvm/src/ir/diagnostics/mod.rs

Co-authored-by: Robert Kimball <bobkimball@gmail.com>

* Clean up PR

* Format all

* Remove dead comment

* Code review comments  and apache  headers

* Purge test file

* Update cmake/modules/LLVM.cmake

Co-authored-by: Tristan Konolige <tristan.konolige@gmail.com>

* Format Rust

* Add TK's suggestion

* More CR and cleanup

* Fix tyck line

* Format

Co-authored-by: Robert Kimball <bobkimball@gmail.com>
Co-authored-by: Tristan Konolige <tristan.konolige@gmail.com>
trevor-m pushed a commit to trevor-m/tvm that referenced this pull request Dec 4, 2020
…face. (apache#6656)

* Add initial boilerplate for Rust diagnostic interface.

* Codespan example almost working

* WIP

* Hacking on Rust inside of TVM

* Borrow code from Egg

* Update CMake and delete old API

* Fix Linux build

* Clean up exporting to show off new diagnostics

* Improve Rust bindings

* Fix calling

* Fix

* Rust Diagnostics work

* Remove type checker

* Format and cleanup

* Fix the extension code

* More cleanup

* Fix some CR

* Add docs and address feedback

* WIP more improvments

* Update cmake/modules/RustExt.cmake

Co-authored-by: Robert Kimball <bobkimball@gmail.com>

* Update rust/tvm/src/ir/diagnostics/mod.rs

Co-authored-by: Robert Kimball <bobkimball@gmail.com>

* Clean up PR

* Format all

* Remove dead comment

* Code review comments  and apache  headers

* Purge test file

* Update cmake/modules/LLVM.cmake

Co-authored-by: Tristan Konolige <tristan.konolige@gmail.com>

* Format Rust

* Add TK's suggestion

* More CR and cleanup

* Fix tyck line

* Format

Co-authored-by: Robert Kimball <bobkimball@gmail.com>
Co-authored-by: Tristan Konolige <tristan.konolige@gmail.com>
trevor-m pushed a commit to neo-ai/tvm that referenced this pull request Dec 4, 2020
…face. (apache#6656)

* Add initial boilerplate for Rust diagnostic interface.

* Codespan example almost working

* WIP

* Hacking on Rust inside of TVM

* Borrow code from Egg

* Update CMake and delete old API

* Fix Linux build

* Clean up exporting to show off new diagnostics

* Improve Rust bindings

* Fix calling

* Fix

* Rust Diagnostics work

* Remove type checker

* Format and cleanup

* Fix the extension code

* More cleanup

* Fix some CR

* Add docs and address feedback

* WIP more improvments

* Update cmake/modules/RustExt.cmake

Co-authored-by: Robert Kimball <bobkimball@gmail.com>

* Update rust/tvm/src/ir/diagnostics/mod.rs

Co-authored-by: Robert Kimball <bobkimball@gmail.com>

* Clean up PR

* Format all

* Remove dead comment

* Code review comments  and apache  headers

* Purge test file

* Update cmake/modules/LLVM.cmake

Co-authored-by: Tristan Konolige <tristan.konolige@gmail.com>

* Format Rust

* Add TK's suggestion

* More CR and cleanup

* Fix tyck line

* Format

Co-authored-by: Robert Kimball <bobkimball@gmail.com>
Co-authored-by: Tristan Konolige <tristan.konolige@gmail.com>
@jroesch jroesch deleted the rust-diag branch February 4, 2021 04:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants