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

Update E0038 to the new error format #35537

Merged
merged 1 commit into from
Aug 12, 2016
Merged

Update E0038 to the new error format #35537

merged 1 commit into from
Aug 12, 2016

Conversation

munyari
Copy link
Contributor

@munyari munyari commented Aug 8, 2016

Part of #35233

Addresses #35500
"r? @jonathandturner

This doesn't compile yet, and I need help. In my naive solution, adding the span label makes our error message a mutable errors::DiagnosticBuilder pointer.

python src/bootstrap/bootstrap.py --step check-cfail E0038 --stage 1
Building stage0 std artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
Building stage0 test artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
Building stage0 compiler artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
   Compiling rustc v0.0.0 (file:///home/nash/code/rust/src/librustc)
src/librustc/traits/error_reporting.rs:735:9: 735:12 error: mismatched types [E0308]
src/librustc/traits/error_reporting.rs:735         err
                                                   ^~~
src/librustc/traits/error_reporting.rs:735:9: 735:12 help: run `rustc --explain E0308` to see a detailed explanation
src/librustc/traits/error_reporting.rs:735:9: 735:12 note: expected type `core::option::Option<errors::DiagnosticBuilder<'tcx>>`
src/librustc/traits/error_reporting.rs:735:9: 735:12 note:    found type `core::option::Option<&mut errors::DiagnosticBuilder<'_>>`
error: aborting due to previous error
error: Could not compile `rustc`.

To learn more, run the command again with --verbose.


command did not execute successfully: "/home/nash/code/rust/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "build" "-j" "4" "--target" "x86_64-unknown-linux-gnu" "--release" "--features" " jemalloc" "--manifest-path" "/home/nash/code/rust/src/rustc/Cargo.toml"
expected success, got: exit code: 101

@sophiajt
Copy link
Contributor

sophiajt commented Aug 9, 2016

@munyari - .span_label(..) takes in a &mut and returns &mut. It's used for chaining calls together. You don't have to use it that way. Instead, you can create a temporary to hold the value from struct_span_err! and call .span_label() on the temporary without using that in the Some.

Something like this:

        let mut err = match warning_node_id {
            Some(_) => None,
            None => {
                let trait_str = self.item_path_str(trait_def_id);
                let mut db = struct_span_err!(
                            self.sess, span, E0038,
                            "the trait `{}` cannot be made into an object",
                            trait_str);
                db.span_label(span,
                            &format!("the trait `{}` cannot be made \
                            into an object", trait_str));
                Some(db)
            }
        };

@sophiajt
Copy link
Contributor

sophiajt commented Aug 9, 2016

Also, when you update this label, be sure to run:

python src/bootstrap/bootstrap.py --stage 1 --step check-cfail

I'm seeing 6 unit tests that will also need to be updated once you add the label.

@munyari
Copy link
Contributor Author

munyari commented Aug 9, 2016

@jonathandturner I just made the update

@sophiajt
Copy link
Contributor

sophiajt commented Aug 9, 2016

Looks good!

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Aug 9, 2016

📌 Commit 20ea8cb has been approved by jonathandturner

steveklabnik added a commit to steveklabnik/rust that referenced this pull request Aug 10, 2016
Update E0038 to the new error format

Part of rust-lang#35233

Addresses rust-lang#35500
"r? @jonathandturner

This doesn't compile yet, and I need help. In my naive solution, adding the span label makes our error message a mutable `errors::DiagnosticBuilder` pointer.

```bash
python src/bootstrap/bootstrap.py --step check-cfail E0038 --stage 1
```

```
Building stage0 std artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
Building stage0 test artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
Building stage0 compiler artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
   Compiling rustc v0.0.0 (file:///home/nash/code/rust/src/librustc)
src/librustc/traits/error_reporting.rs:735:9: 735:12 error: mismatched types [E0308]
src/librustc/traits/error_reporting.rs:735         err
                                                   ^~~
src/librustc/traits/error_reporting.rs:735:9: 735:12 help: run `rustc --explain E0308` to see a detailed explanation
src/librustc/traits/error_reporting.rs:735:9: 735:12 note: expected type `core::option::Option<errors::DiagnosticBuilder<'tcx>>`
src/librustc/traits/error_reporting.rs:735:9: 735:12 note:    found type `core::option::Option<&mut errors::DiagnosticBuilder<'_>>`
error: aborting due to previous error
error: Could not compile `rustc`.

To learn more, run the command again with --verbose.

command did not execute successfully: "/home/nash/code/rust/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "build" "-j" "4" "--target" "x86_64-unknown-linux-gnu" "--release" "--features" " jemalloc" "--manifest-path" "/home/nash/code/rust/src/rustc/Cargo.toml"
expected success, got: exit code: 101
```
sophiajt pushed a commit to sophiajt/rust that referenced this pull request Aug 10, 2016
Update E0038 to the new error format

Part of rust-lang#35233

Addresses rust-lang#35500
"r? @jonathandturner

This doesn't compile yet, and I need help. In my naive solution, adding the span label makes our error message a mutable `errors::DiagnosticBuilder` pointer.

```bash
python src/bootstrap/bootstrap.py --step check-cfail E0038 --stage 1
```

```
Building stage0 std artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
Building stage0 test artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
Building stage0 compiler artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
   Compiling rustc v0.0.0 (file:///home/nash/code/rust/src/librustc)
src/librustc/traits/error_reporting.rs:735:9: 735:12 error: mismatched types [E0308]
src/librustc/traits/error_reporting.rs:735         err
                                                   ^~~
src/librustc/traits/error_reporting.rs:735:9: 735:12 help: run `rustc --explain E0308` to see a detailed explanation
src/librustc/traits/error_reporting.rs:735:9: 735:12 note: expected type `core::option::Option<errors::DiagnosticBuilder<'tcx>>`
src/librustc/traits/error_reporting.rs:735:9: 735:12 note:    found type `core::option::Option<&mut errors::DiagnosticBuilder<'_>>`
error: aborting due to previous error
error: Could not compile `rustc`.

To learn more, run the command again with --verbose.

command did not execute successfully: "/home/nash/code/rust/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "build" "-j" "4" "--target" "x86_64-unknown-linux-gnu" "--release" "--features" " jemalloc" "--manifest-path" "/home/nash/code/rust/src/rustc/Cargo.toml"
expected success, got: exit code: 101
```
sophiajt pushed a commit to sophiajt/rust that referenced this pull request Aug 11, 2016
Update E0038 to the new error format

Part of rust-lang#35233

Addresses rust-lang#35500
"r? @jonathandturner

This doesn't compile yet, and I need help. In my naive solution, adding the span label makes our error message a mutable `errors::DiagnosticBuilder` pointer.

```bash
python src/bootstrap/bootstrap.py --step check-cfail E0038 --stage 1
```

```
Building stage0 std artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
Building stage0 test artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
Building stage0 compiler artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
   Compiling rustc v0.0.0 (file:///home/nash/code/rust/src/librustc)
src/librustc/traits/error_reporting.rs:735:9: 735:12 error: mismatched types [E0308]
src/librustc/traits/error_reporting.rs:735         err
                                                   ^~~
src/librustc/traits/error_reporting.rs:735:9: 735:12 help: run `rustc --explain E0308` to see a detailed explanation
src/librustc/traits/error_reporting.rs:735:9: 735:12 note: expected type `core::option::Option<errors::DiagnosticBuilder<'tcx>>`
src/librustc/traits/error_reporting.rs:735:9: 735:12 note:    found type `core::option::Option<&mut errors::DiagnosticBuilder<'_>>`
error: aborting due to previous error
error: Could not compile `rustc`.

To learn more, run the command again with --verbose.

command did not execute successfully: "/home/nash/code/rust/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "build" "-j" "4" "--target" "x86_64-unknown-linux-gnu" "--release" "--features" " jemalloc" "--manifest-path" "/home/nash/code/rust/src/rustc/Cargo.toml"
expected success, got: exit code: 101
```
bors added a commit that referenced this pull request Aug 11, 2016
@bors bors merged commit 20ea8cb into rust-lang:master Aug 12, 2016
@munyari munyari deleted the e0038 branch August 12, 2016 05:03
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.

3 participants